12345678 |
- /*
- Copyright (c) 2004-2009, The Dojo Foundation All Rights Reserved.
- Available via Academic Free License >= 2.1 OR the modified BSD license.
- see: http://dojotoolkit.org/license for details
- */
- if(!dojo._hasResource["jeus.Tree"]){dojo._hasResource["jeus.Tree"]=true;dojo.provide("jeus.Tree");dojo.require("dojox.data.QueryReadStore");dojo.require("dijit.Tree");dojo.declare("jeus.NodeReadStore",dojox.data.QueryReadStore,{getValues:function(_1,_2){this._assertIsItem(_1);var _3=[];if(this.hasAttribute(_1,_2)){dojo.forEach(_1.i[_2],function(e){_3.push({i:e,r:this});},this);}return _3;},setValues:function(_4,_5,_6){_4.i[_5]=dojo.map(_6,function(_7){return _7.i;},this);return true;}});dojo.declare("jeus.NodeStoreModel",dijit.tree.TreeStoreModel,{query:{load:true,refresh:true},mayHaveChildren:function(_8){return !this.store.getValue(_8,"leaf")||this.inherited("mayHaveChildren",arguments);},getChildren:function(_9,_a,_b){var _c=dojo.some(this.childrenAttrs,function(_d){return this.store.hasAttribute(_9,_d);},this);if(_c){this.inherited(arguments);}else{var _e=dojo.hitch(this,arguments.callee);this.store.fetch({query:this.query,serverQuery:{expand:true,load:true,uniqueKey:this.store.getValue(_9,"uniqueKey")},onComplete:dojo.hitch(this,function(_f){this.store.setValues(_9,this.childrenAttrs[0],_f);_e(_9,_a,_b);}),onError:_b});}}});dojo.declare("jeus.NodeTree",dijit.Tree,{getIconClass:function(_10,_11){var _12=this.model.store.getValue(_10,"icon");if(!!_12){return _12;}else{return this.inherited(arguments);}},onClick:function(_13,_14){var _15=this.model.store;var _16=_15.getValue(_13,"href");if(!!_16){var _17=_15.getValue(_13,"popup");if(!!_17){var _18=_15.getValue(_13,"popupName");setTimeout(dojo.hitch(this,function(){window.open(_16,_18,_17).focus();}),100);}else{var _19=_15.getValue(_13,"target");if(!!_19){jeus.loadContent(_19,_16);}else{window.location.href=_16;}}}},_state:function(_1a,_1b){if(typeof _1b=="undefined"){return this.model.store.getValue(_1a,"expanded");}else{var _1c=this.model.store;var _1d={expand:_1b,load:false,uniqueKey:_1c.getValue(_1a,"uniqueKey")};var _1e=_1c.requestMethod.toLowerCase()=="post"?dojo.xhrPost:dojo.xhrGet;_1e({url:_1c.url,handleAs:"json-comment-optional",content:_1d});}},resize:function(_1f){this.inherited("resize",false);}});}
|