diff --git a/StyleSheetSwitcher.mpk b/StyleSheetSwitcher.mpk
new file mode 100644
index 0000000..a9b4a22
Binary files /dev/null and b/StyleSheetSwitcher.mpk differ
diff --git a/src/StyleSheetSwitcher/StyleSheetSwitcherURL.xml b/src/StyleSheetSwitcher/StyleSheetSwitcherURL.xml
index b2ca4ca..3670133 100644
--- a/src/StyleSheetSwitcher/StyleSheetSwitcherURL.xml
+++ b/src/StyleSheetSwitcher/StyleSheetSwitcherURL.xml
@@ -13,13 +13,13 @@
Behavior
The folder containing the stylesheets (such as: /custom/style/css). A trailing slash is added automatically
-
+
Default css
Behavior
- The default CSS stylesheet (such as: default.css).
+ The the default styleshete URLs will be saved (such as: default.css,custom.css).
+
-
-
+
Remove default css
Behavior
Remove the default css when loading a new one (if the custom stylesheet is equal to the default stylesheet it will not be removed from the DOM).
@@ -43,10 +43,20 @@
Microflow
Behavior
- The microflow to execute in order to find a different stylesheet. Expects URL entity, returns filename.
+ The microflow to execute in order to find a different stylesheet. Expects URL entity, returns filenames.
+
+ Delete and reload custom.css
+ Behavior
+
+
+ No reload
+ Reload after change default theme
+
+
+
Reload mxui.css
Behavior
diff --git a/src/StyleSheetSwitcher/widget/StyleSheetSwitcherURL.js b/src/StyleSheetSwitcher/widget/StyleSheetSwitcherURL.js
index 13e5d21..a921f44 100644
--- a/src/StyleSheetSwitcher/widget/StyleSheetSwitcherURL.js
+++ b/src/StyleSheetSwitcher/widget/StyleSheetSwitcherURL.js
@@ -73,6 +73,7 @@ define([
this._urlObj = obj;
this._urlObj.set(this.urlAttribute, mx.appUrl);
this._executeMF();
+ this._cssDefault();
})
});
@@ -140,6 +141,30 @@ define([
}
},
+ _cssDefault: function () {
+ // If a microflow has been set execute the microflow on a click.
+ logger.debug(this.id + "App URL: " + mx.appUrl);
+
+ if (this._cssDefault !== "") {
+ logger.debug(this.id + " - object: " + this._urlObj.getGuid());
+
+ mx.data.action({
+ params: {
+ actionname: this.cssDefault,
+ applyto: "selection",
+ guids: [this._urlObj.getGuid()]
+
+ },
+ callback: dojoLang.hitch(this, function (resultString) {
+ this.cssDefault = resultString;
+ this._updateRendering();
+ }),
+ error: dojoLang.hitch(this, function (error) {
+ logger.info(this.id + ": An error occurred while executing microflow: " + error.description);
+ })
+ }, this);
+ }
+ },
// Attach events to HTML dom elements
_setupEvents: function () {
@@ -184,9 +209,13 @@ define([
}
+ if (this.CustomCssReload === "after") {
+ logger.debug(this.id + " - Removing path: styles/css/custom/custom.css");
+ dom.removeCss("styles/css/custom/custom.css");
+ }
-
+ //dom.removeCss(cssPath);
logger.debug(this.id + " - Adding path: " + cssPath);
dom.addCss( cssPath );
@@ -202,10 +231,17 @@ define([
dom.addCss("mxclientsystem/mxui/ui/mxui.css");
}
+ if (this.CustomCssReload === "after") {
+ logger.debug(this.id + " - Removing path: styles/css/custom/custom.css");
+ dom.addCss("styles/css/custom/custom.css");
+
+ }
+
}
else{
logger.info(this.id + " - Invalid path: " + cssPath);
}
+
},
// Handle validations.