// author mode to use StyleSheet and not AuthorStyleSheet? // // do I need a prefix then? // !! panel in backstage // add the macro somewhere to start with? //404 ?separate plugin //hiding author text //MainMenus //problem with pluginmanager not showing errors? //keyboard shortcut //config option default mode //admin not author //close button //backstage, toggle based on new mode in startup, based on start mode in normal running //lite side bar in user moade config.macros.publisher = { modes:{ }, startMode : 'Public', currentMode : '', defaults: [ {name: "StyleSheet", notify: refreshStyles}, {name: "PageTemplate", notify: refreshPageTemplate} ], tiddlerTemplates : merge({},config.tiddlerTemplates), applyMode : function (newMode){ var oldMode = this.currentMode; var oldStyleElement = document.getElementById(oldMode+"StyleSheet"); if (oldStyleElement){ oldStyleElement.parentNode.removeChild(oldStyleElement); } for (var i=0; i< this.defaults.length; i++){ var name = this.defaults[i]["name"]; var newElement = store.isTiddler(newMode + name) ? newMode + name : name; store.removeNotification(oldMode + name, this.defaults[i]["notify"]); store.addNotification(newElement,this.defaults[i]["notify"]); store.notify(newElement); } this.currentMode = newMode; this.switchTemplates(); this.toggleReadOnly(); this.toggleBackstage(); this.toggleSPM(); refreshDisplay(); story.publisherRefreshAllTiddlers(); }, switchTemplates : function(){ console.log(this.currentMode) if (store.isTiddler(this.currentMode+"ViewTemplate")){ config.tiddlerTemplates["1"] = this.currentMode + "ViewTemplate"; } else{ config.tiddlerTemplates["1"] = this.tiddlerTemplates["1"]; } if (store.isTiddler(this.currentMode+"EditTemplate")){ config.tiddlerTemplates["2"] = this.currentMode + "EditTemplate"; } else{ config.tiddlerTemplates["2"] = this.tiddlerTemplates["2"]; } }, toggleBackstage :function(){ if (this.modes[this.currentMode]['backstage']){ if (backstage && backstage.button){ //if(readOnly)backstage.init(); backstage.button.style.display = "block"; backstage.show(); } } else if (backstage && backstage.button){ backstage.button.style.display = "none"; backstage.hide(); } }, toggleReadOnly : function(){ if (this.modes[this.currentMode]['readOnly']){ config.options.chkHttpReadOnly = true; readOnly = true; //refreshDisplay(); } else{ config.options.chkHttpReadOnly =false; readOnly = false; //refreshDisplay(); } }, toggleSPM : function(){ config.options.chkSinglePageMode = (this.modes[this.currentMode]['SPM'])? true : false; }, loadDb : function(){ var modelines = store.getTiddlerText("PublisherGroupsConfig").split("\n"); for (i=1; i>",document.getElementById("backstageToolbar")); }; TiddlyWiki.prototype.isTiddler= function (title) { return store.tiddlerExists(title) || store.isShadowTiddler(title); }; TiddlyWiki.prototype.removeNotification = function(title,fn) { for (var i=0;i\n
\n
\n","");