(function(){var g=YAHOO.util.Dom,b=YAHOO.util.Event;Alfresco.WikiDashlet=function(i){this.name="Alfresco.WikiDashlet";this.id=i;Alfresco.util.ComponentManager.register(this);Alfresco.util.YUILoaderHelper.require([],this.onComponentsLoaded,this);this.parser=new Alfresco.WikiParser();return this};Alfresco.WikiDashlet.prototype={options:{guid:"",siteId:"",pages:[]},configDialog:null,setOptions:function d(i){this.options=YAHOO.lang.merge(this.options,i);return this},setMessages:function h(i){Alfresco.util.addMessages(i,this.name);return this},onComponentsLoaded:function f(){b.onContentReady(this.id,this.init,this,true)},init:function a(){b.addListener(this.id+"-wiki-link","click",this.onConfigFeedClick,this,true);this.parser.URL=this._getAbsolutePath();var i=g.get(this.id+"-scrollableList");i.innerHTML=this.parser.parse(i.innerHTML,this.options.pages)},_getAbsolutePath:function e(){return Alfresco.constants.URL_CONTEXT+"page/site/"+this.options.siteId+"/wiki-page?title="},onConfigFeedClick:function c(k){var j=Alfresco.constants.URL_SERVICECONTEXT+"modules/wiki/config/"+encodeURIComponent(this.options.guid);b.stopEvent(k);if(!this.configDialog){this.configDialog=new Alfresco.module.SimpleDialog(this.id+"-configDialog").setOptions({width:"50em",templateUrl:Alfresco.constants.URL_SERVICECONTEXT+"modules/wiki/config/"+this.options.siteId,actionUrl:j,onSuccess:{fn:function i(m){var l=YAHOO.lang.JSON.parse(m.serverResponse.responseText);if(l){g.get(this.id+"-scrollableList").innerHTML=this.parser.parse(l.content,this.options.pages);g.get(this.id+"-title").innerHTML=Alfresco.util.message("label.header-prefix",this.name)+' - <a href="wiki-page?title='+encodeURIComponent(m.config.dataObj.wikipage)+'">'+l.title+"</a>"}},scope:this}})}else{this.configDialog.setOptions({actionUrl:j})}this.configDialog.show()}}})();
