Permalink
Browse files

More settings updates

  • Loading branch information...
1 parent 0b2fa01 commit a0b1b5a898811bf53185257205446b9bf46a52ce @benkeen committed Oct 26, 2015
View
@@ -23,7 +23,7 @@ module.exports = function(grunt) {
},
options: {
report: "min",
- compress: true
+ compress: {}
}
}
},
@@ -125,4 +125,4 @@ module.exports = function(grunt) {
// with the latest file mapping
'md5'
]);
-};
+};
@@ -118,34 +118,12 @@ public function __construct($action, $post = array()) {
$this->response["content"] = $response["errorMessage"];
break;
- // drop this. Use installDataTypes and pass a flag to check for
-// case "resetDataTypes":
-// Core::init("resetPlugins");
-// if (Core::checkIsLoggedIn() && Core::$user->isAdmin()) {
-// $this->setDataTypes();
-// }
-// break;
-
-// case "installationSaveDataTypes":
-// Core::init("installationDatabaseReady");
-// if (!Core::checkIsInstalled()) {
-// $folders = $this->post["folders"];
-// $response = Settings::setSetting("installedDataTypes", $folders);
-// $this->response["success"] = $response["success"];
-// $this->response["content"] = $response["errorMessage"];
-// }
-// break;
-
-// case "resetSaveDataTypes":
-// Core::init("resetPlugins");
-// if (Core::checkIsLoggedIn() && Core::$user->isAdmin()) {
-// $folders = $this->post["folders"];
-// $response = Settings::setSetting("installedDataTypes", $folders);
-// $this->response["success"] = $response["success"];
-// $this->response["content"] = $response["errorMessage"];
-// }
-// break;
-//
+ case "resetDataTypes":
+ Core::init("resetPlugins");
+ if (Core::checkIsLoggedIn() && Core::$user->isAdmin()) {
+ $this->installDataTypes();
+ }
+ break;
case "installExportTypes":
Core::init("installationDatabaseReady");
@@ -154,15 +132,15 @@ public function __construct($action, $post = array()) {
}
break;
-// case "resetExportTypes":
-// Core::init("resetPlugins");
-// if (Core::checkIsLoggedIn() && Core::$user->isAdmin()) {
-// $this->setExportTypes();
-// }
-// break;
+ case "resetExportTypes":
+ Core::init("resetPlugins");
+ if (Core::checkIsLoggedIn() && Core::$user->isAdmin()) {
+ $this->installExportTypes();
+ }
+ break;
- case "selectPlugins":
- // for new installations, we just update the (only) record in the database.
+ // for new installations, we just update the (only) record in the database.
+ case "savePluginList":
if (!Core::checkIsInstalled()) {
Core::init("installationDatabaseReady");
$response = Account::updateSelectedPlugins(1, $this->post["dataTypes"], $this->post["exportTypes"], $this->post["countries"]);
@@ -177,31 +155,16 @@ public function __construct($action, $post = array()) {
Settings::setSetting("installationComplete", "yes");
return;
}
-
- // TODO. Here we can check sessions + just update the current user
- //Core::$user
-
break;
-// case "installationSaveExportTypes":
-// Core::init("installationDatabaseReady");
-// if (!Core::checkIsInstalled()) {
-// $folders = $this->post["folders"];
-// $response = Settings::setSetting("installedExportTypes", $folders);
-// $this->response["success"] = $response["success"];
-// $this->response["content"] = $response["errorMessage"];
-// }
-// break;
+ // called anytime the plugins were updated
+// case "resetPluginList":
+// Core::init();
+// if (Core::checkIsLoggedIn() && Core::$user->isAdmin()) {
//
-// case "resetSaveExportTypes":
-// Core::init("resetPlugins");
-// if (Core::checkIsLoggedIn() && Core::$user->isAdmin()) {
-// $folders = $this->post["folders"];
-// $response = Settings::setSetting("installedExportTypes", $folders);
-// $this->response["success"] = $response["success"];
-// $this->response["content"] = $response["errorMessage"];
-// }
-// break;
+// $this->response["success"] = (Minification::createAppStartFile()) ? 1 : 0;
+// }
+// break;
case "installCountries":
Core::init("installationDatabaseReady");
@@ -210,39 +173,13 @@ public function __construct($action, $post = array()) {
}
break;
-// case "resetCountries":
-// Core::init("resetPlugins");
-// if (Core::checkIsLoggedIn() && Core::$user->isAdmin()) {
-// $this->setCountries();
-// }
-// break;
-
-// case "installationSaveCountries":
-// Core::init("installationDatabaseReady");
-// if (!Core::checkIsInstalled()) {
-// $folders = $this->post["folders"];
-// Settings::setSetting("installedCountries", $folders);
-// $response = Settings::setSetting("installationComplete", "yes");
-// $this->response["success"] = $response["success"];
-// $this->response["content"] = $response["errorMessage"];
-// }
-// break;
-
-// case "resetSaveCountries":
-// Core::init("resetPlugins");
-// if (Core::checkIsLoggedIn() && Core::$user->isAdmin()) {
-// $folders = $this->post["folders"];
-// Settings::setSetting("installedCountries", $folders);
-// $this->response["success"] = true; // ...!
-// }
-// break;
-
- // called anytime the plugins were updated (either via the installation or core script). This
- // runs any post-processes that need to be done
-// case "updatedPluginsPostProcess":
-// Core::init();
-// $this->response["success"] = (Minification::createAppStartFile()) ? 1 : 0;
-// break;
+ case "resetCountries":
+ Core::init("resetPlugins");
+ if (Core::checkIsLoggedIn() && Core::$user->isAdmin()) {
+ $this->installCountries();
+ }
+ break;
+
// ------------------------------------------------------------------------------------
// USER ACCOUNTS
@@ -472,33 +409,6 @@ private function installDataTypes() {
);
}
-// private function setDataTypes() {
-// $index = $this->post["index"];
-// $groupedDataTypes = DataTypePluginHelper::getDataTypePlugins("installationDatabaseReady", false);
-// $dataTypes = DataTypePluginHelper::getDataTypeList($groupedDataTypes);
-//
-// if ($index >= count($dataTypes)) {
-// $this->response["success"] = 1;
-// $this->response["content"] = "";
-// $this->response["isComplete"] = true;
-// } else {
-// // attempt to install this data type
-// $currDataType = $dataTypes[$index];
-// $this->response["dataTypeName"] = $currDataType->getName();
-// $this->response["dataTypeFolder"] = $currDataType->folder;
-// $this->response["isComplete"] = false;
-//
-// try {
-// list($success, $content) = $currDataType->install();
-// $this->response["success"] = $success;
-// $this->response["content"] = $content;
-// } catch (Exception $e) {
-// $this->response["success"] = false;
-// $this->response["content"] = "Unknown error.";
-// }
-// }
-// }
-
private function installExportTypes() {
$exportTypes = ExportTypePluginHelper::getExportTypePlugins("installationDatabaseReady", false);
$hasError = false;
@@ -536,7 +446,6 @@ private function installExportTypes() {
);
}
-
private function installCountries() {
$countryPlugins = CountryPluginHelper::getCountryPlugins(false);
$hasError = false;
@@ -573,57 +482,4 @@ private function installCountries() {
"results" => $results
);
}
-
-
-// private function setExportTypes() {
-// $index = $this->post["index"];
-// $exportTypes = ExportTypePluginHelper::getExportTypePlugins("installationDatabaseReady", false);
-//
-// if ($index >= count($exportTypes)) {
-// $this->response["success"] = 1;
-// $this->response["content"] = "";
-// $this->response["isComplete"] = true;
-// } else {
-// // attempt to install this export type
-// $currExportType = $exportTypes[$index];
-// $this->response["exportTypeName"] = $currExportType->getName();
-// $this->response["exportTypeFolder"] = $currExportType->folder;
-// $this->response["isComplete"] = false;
-// try {
-// list($success, $content) = $currExportType->install();
-// $this->response["success"] = $success;
-// $this->response["content"] = $content;
-// } catch (Exception $e) {
-// $this->response["success"] = false;
-// $this->response["content"] = "Unknown error.";
-// }
-// }
-// }
-
-// private function setCountries() {
-// $index = $this->post["index"];
-// $countryPlugins = CountryPluginHelper::getCountryPlugins(false);
-//
-// if ($index >= count($countryPlugins)) {
-// $this->response["success"] = 1;
-// $this->response["content"] = "";
-// $this->response["isComplete"] = true;
-// } else {
-// // attempt to install this country
-// $currCountryPlugin = $countryPlugins[$index];
-// $this->response["countryName"] = $currCountryPlugin->getName();
-// $this->response["countryFolder"] = $currCountryPlugin->folder;
-// $this->response["isComplete"] = false;
-// try {
-// // always run the uninstallation function first to ensure any old data is all cleared out
-// $currCountryPlugin->uninstall();
-// list($success, $content) = $currCountryPlugin->install();
-// $this->response["success"] = $success;
-// $this->response["content"] = $content;
-// } catch (Exception $e) {
-// $this->response["success"] = false;
-// $this->response["content"] = "Unknown error.";
-// }
-// }
-// }
}
@@ -130,7 +130,7 @@ define([
$("#gdDataSetPublic").on("click", _toggleDataSetVisibilityStatus);
$("#gdSettingsForm").on("submit", function (e) { e.preventDefault(); });
$("#updateSettingsBtn").on("click", _submitSettingsForm);
- $("#gdResetPluginsBtn").on("click", _resetPlugins);
+ $("#gdResetPluginsBtn").on("click", _onClickResetPlugins);
$("#gdNumRowsToGenerate").on("click", _onClickNumRowsField);
$("input[name=gdExportTarget]").on("change", _onChangeExportTarget);
@@ -1081,34 +1081,16 @@ define([
}
};
- var _resetPlugins = function (e) {
-
+ var _onClickResetPlugins = function (e) {
var useMinified = $(e.target).data("useMinified");
-
-// if (useMinified) {
+ if (useMinified) {
$("#gdResetPluginsDialog").dialog({
modal: true,
resizable: true,
title: "Reset Plugins",
width: 480,
height: 200,
open: function () {
- utils.insertModalSpinner({modalID: "gdPluginInstallation"});
- utils.playSpinner("gdPluginInstallation");
- pluginManager.installPlugins({
- errorHandler: null,
- onCompleteHandler: function () {
- utils.pauseSpinner("gdPluginInstallation");
- $("#gdPluginInstallation").dialog("option", "buttons", [
- {
- text: L.refresh_page,
- click: function () {
- window.location.reload(true);
- }
- }
- ]);
- }
- });
},
buttons: [
@@ -1122,14 +1104,32 @@ define([
text: L.reset_plugins,
click: function () {
$(this).dialog("close");
+ _resetPlugins();
}
}
]
});
+ return;
+ }
+
+ _resetPlugins();
+ };
- // } else {
- //
- // }
+ var _resetPlugins = function () {
+ pluginManager.installPlugins("update", {
+ errorHandler: null,
+ onCompleteHandler: function () {
+ utils.pauseSpinner("gdPluginInstallation");
+ $("#gdPluginInstallation").dialog("option", "buttons", [
+ {
+ text: L.refresh_page,
+ click: function () {
+ window.location.reload(true);
+ }
+ }
+ ]);
+ }
+ });
};
var _changeTextSize = function (e) {
@@ -108,7 +108,7 @@ require([
} else if (currentStep === 3) {
_setupUserAccounts();
} else if (currentStep === 4) {
- _installPlugins();
+ _installPlugins("install");
} else if (currentStep === 5) {
window.location = "./";
}
Oops, something went wrong.

0 comments on commit a0b1b5a

Please sign in to comment.