diff --git a/module/tree/model.php b/module/tree/model.php index d3d81d35fe..c1569505da 100644 --- a/module/tree/model.php +++ b/module/tree/model.php @@ -1606,4 +1606,42 @@ class treeModel extends model } return $tree; } + + /** + * Get all doc structure. + * + * @access public + * @return array + */ + public function getDocStructure() + { + $stmt = $this->dbh->query($this->dao->select('*')->from(TABLE_MODULE)->where('type')->eq('doc')->get()); + $parent = array(); + while($module = $stmt->fetch()) + { + if(!isset($parent[$module->root])) $parent[$module->root] = array(); + + if(isset($parent[$module->root][$module->id])) + { + $module->children = $parent[$module->root][$module->id]->children; + unset($parent[$module->root][$module->id]); + } + if(!isset($parent[$module->root][$module->parent])) $parent[$module->root][$module->parent] = new stdclass(); + $parent[$module->root][$module->parent]->children[] = $module; + } + + $tree = array(); + foreach($parent as $root => $modules) + { + foreach($modules as $module) + { + foreach($module->children as $children) + { + if($children->parent != 0) continue;//Filter project children modules. + $tree[$root][] = $children; + } + } + } + return $tree; + } } diff --git a/www/js/zui/min.js b/www/js/zui/min.js index 08eac58715..081d6fa64d 100644 --- a/www/js/zui/min.js +++ b/www/js/zui/min.js @@ -1,5 +1,5 @@ /*! - * ZUI: Zentao template - v1.8.1 - 2018-04-26 + * ZUI: Zentao template - v1.8.1 - 2018-04-28 * http://zui.sexy * GitHub: https://github.com/easysoft/zui.git * Copyright (c) 2018 cnezsoft.com; Licensed MIT @@ -10,20 +10,20 @@ * Copyright (c) 2010 "Cowboy" Ben Alman * MIT & GPL http://benalman.com/about/license/ */ -function(t,e,i){"$:nomunge";function s(){n=e[r](function(){a.each(function(){var e=t(this),i=e.width(),s=e.height(),n=t.data(this,h);i===n.w&&s===n.h||e.trigger(l,[n.w=i,n.h=s])}),s()},o[c])}var n,a=t([]),o=t.resize=t.extend(t.resize,{}),r="setTimeout",l="resize",h=l+"-special-event",c="delay",d="throttleWindow";o[c]=250,o[d]=!0,t.event.special[l]={setup:function(){if(!o[d]&&this[r])return!1;var e=t(this);a=a.add(e),t.data(this,h,{w:e.width(),h:e.height()}),1===a.length&&s()},teardown:function(){if(!o[d]&&this[r])return!1;var e=t(this);a=a.not(e),e.removeData(h),a.length||clearTimeout(n)},add:function(e){function s(e,s,a){var o=t(this),r=t.data(this,h)||{};r.w=s!==i?s:o.width(),r.h=a!==i?a:o.height(),n.apply(this,arguments)}if(!o[d]&&this[r])return!1;var n;return t.isFunction(e)?(n=e,s):(n=e.handler,void(e.handler=s))}}}(jQuery,this),function(t,e){"use strict";var i,s,n="localStorage",a="page_"+t.location.pathname+t.location.search,o=function(){this.slience=!0;try{n in t&&t[n]&&t[n].setItem&&(this.enable=!0,i=t[n])}catch(o){}this.enable||(s={},i={getLength:function(){var t=0;return e.each(s,function(){t++}),t},key:function(t){var i,n=0;return e.each(s,function(e){return n===t?(i=e,!1):void n++}),i},removeItem:function(t){delete s[t]},getItem:function(t){return s[t]},setItem:function(t,e){s[t]=e},clear:function(){s={}}}),this.storage=i,this.page=this.get(a,{})};o.prototype.pageSave=function(){if(e.isEmptyObject(this.page))this.remove(a);else{var t,i=[];for(t in this.page){var s=this.page[t];null===s&&i.push(t)}for(t=i.length-1;t>=0;t--)delete this.page[i[t]];this.set(a,this.page)}},o.prototype.pageRemove=function(t){"undefined"!=typeof this.page[t]&&(this.page[t]=null,this.pageSave())},o.prototype.pageClear=function(){this.page={},this.pageSave()},o.prototype.pageGet=function(t,e){var i=this.page[t];return void 0===e||null!==i&&void 0!==i?i:e},o.prototype.pageSet=function(t,i){e.isPlainObject(t)?e.extend(!0,this.page,t):this.page[this.serialize(t)]=i,this.pageSave()},o.prototype.check=function(){if(!this.enable&&!this.slience)throw new Error("Browser not support localStorage or enable status been set true.");return this.enable},o.prototype.length=function(){return this.check()?i.getLength?i.getLength():i.length:0},o.prototype.removeItem=function(t){return i.removeItem(t),this},o.prototype.remove=function(t){return this.removeItem(t)},o.prototype.getItem=function(t){return i.getItem(t)},o.prototype.get=function(t,e){var i=this.deserialize(this.getItem(t));return"undefined"!=typeof i&&null!==i||"undefined"==typeof e?i:e},o.prototype.key=function(t){return i.key(t)},o.prototype.setItem=function(t,e){return i.setItem(t,e),this},o.prototype.set=function(t,e){return void 0===e?this.remove(t):(this.setItem(t,this.serialize(e)),this)},o.prototype.clear=function(){return i.clear(),this},o.prototype.forEach=function(t){for(var e=this.length(),s=e-1;s>=0;s--){var n=i.key(s);t(n,this.get(n))}return this},o.prototype.getAll=function(){var t={};return this.forEach(function(e,i){t[e]=i}),t},o.prototype.serialize=function(t){return"string"==typeof t?t:JSON.stringify(t)},o.prototype.deserialize=function(t){if("string"==typeof t)try{return JSON.parse(t)}catch(e){return t||void 0}},e.zui({store:new o})}(window,jQuery),function(t){"use strict";var e="zui.searchBox",i=function(e,s){var n=this;n.name=name,n.$=t(e),n.options=s=t.extend({},i.DEFAULTS,n.$.data(),s);var a=n.$.is(s.inputSelector)?n.$:n.$.find(s.inputSelector);if(a.length){var o=function(){n.changeTimer&&(clearTimeout(n.changeTimer),n.changeTimer=null)},r=function(){o();var t=n.getSearch();if(t!==n.lastValue){var e=""===t;a.toggleClass("empty",e),n.$.callComEvent(n,"onSearchChange",[t,e]),n.lastValue=t}};n.$input=a=a.first(),n.lastValue=n.getSearch(),a.on(s.listenEvent,function(t){n.changeTimer=setTimeout(function(){r()},s.changeDelay)}).on("focus",function(t){a.addClass("focus"),n.$.callComEvent(n,"onFocus",[t])}).on("blur",function(t){a.removeClass("focus"),n.$.callComEvent(n,"onBlur",[t])}).on("keydown",function(t){var e=0,i=t.which;27===i&&s.escToClear?(this.setSearch("",!0),r(),e=1):13===i&&s.onPressEnter&&(r(),n.$.callComEvent(n,"onPressEnter",[t]));var a=n.$.callComEvent(n,"onKeyDown",[t]);a===!1&&(e=1),e&&t.preventDefault()}),n.$.on("click",".search-clear-btn",function(t){n.setSearch("",!0),r(),t.preventDefault()}),r()}else console.error("ZUI: search box init error, cannot find search box input element.")};i.DEFAULTS={inputSelector:'input[type="search"],input[type="text"]',listenEvent:"change input paste",changeDelay:500},i.prototype.getSearch=function(){return this.$input&&t.trim(this.$input.val())},i.prototype.setSearch=function(t,e){var i=this.$input;i&&(i.val(t),e||i.trigger("change"))},i.prototype.focus=function(){this.$input&&this.$input.focus()},t.fn.searchBox=function(s){return this.each(function(){var n=t(this),a=n.data(e),o="object"==typeof s&&s;a||n.data(e,a=new i(this,o)),"string"==typeof s&&a[s]()})},i.NAME=e,t.fn.searchBox.Constructor=i}(jQuery),function(t,e){"use strict";var i="zui.draggable",s={container:"body",move:!0},n=0,a=function(e,i){var a=this;a.$=t(e),a.id=n++,a.options=t.extend({},s,a.$.data(),i),a.init()};a.DEFAULTS=s,a.NAME=i,a.prototype.init=function(){var s,n,a,o,r,l=this,h=l.$,c="before",d="drag",u="finish",p="."+i+"."+l.id,f="mousedown"+p,g="mouseup"+p,m="mousemove"+p,v=l.options,y=v.selector,b=v.handle,w=h,x=t.isFunction(v.move),_=function(t){var e=t.pageX,i=t.pageY;r=!0;var n={left:e-a.x,top:i-a.y};w.removeClass("drag-ready").addClass("dragging"),v.move&&(x?v.move(n,w):w.css(n)),v[d]&&v[d]({event:t,element:w,startOffset:a,pos:n,offset:{x:e-s.x,y:i-s.y},smallOffset:{x:e-o.x,y:i-o.y}}),o.x=e,o.y=i,v.stopPropagation&&t.stopPropagation()},C=function(i){if(t(e).off(p),!r)return void w.removeClass("drag-ready");var n={left:i.pageX-a.x,top:i.pageY-a.y};w.removeClass("drag-ready dragging"),v.move&&(x?v.move(n,w):w.css(n)),v[u]&&v[u]({event:i,element:w,startOffset:a,pos:n,offset:{x:i.pageX-s.x,y:i.pageY-s.y},smallOffset:{x:i.pageX-o.x,y:i.pageY-o.y}}),i.preventDefault(),v.stopPropagation&&i.stopPropagation()},k=function(i){var l=t.zui.getMouseButtonCode(v.mouseButton);if(!(l>-1&&i.button!==l)){var h=t(this);if(y&&(w=b?h.closest(y):h),v[c]){var d=v[c]({event:i,element:w});if(d===!1)return}var u=t(v.container),p=w.offset();n=u.offset(),s={x:i.pageX,y:i.pageY},a={x:i.pageX-p.left+n.left,y:i.pageY-p.top+n.top},o=t.extend({},s),r=!1,w.addClass("drag-ready"),i.preventDefault(),v.stopPropagation&&i.stopPropagation(),t(e).on(m,_).on(g,C)}};b?h.on(f,b,k):y?h.on(f,y,k):h.on(f,k)},a.prototype.destroy=function(){var s="."+i+"."+this.id;this.$.off(s),t(e).off(s),this.$.data(i,null)},t.fn.draggable=function(e){return this.each(function(){var s=t(this),n=s.data(i),o="object"==typeof e&&e;n||s.data(i,n=new a(this,o)),"string"==typeof e&&n[e]()})},t.fn.draggable.Constructor=a}(jQuery,document),function(t,e,i){"use strict";var s="zui.droppable",n={target:".droppable-target",deviation:5,sensorOffsetX:0,sensorOffsetY:0},a=0,o=function(e,i){var s=this;s.id=a++,s.$=t(e),s.options=t.extend({},n,s.$.data(),i),s.init()};o.DEFAULTS=n,o.NAME=s,o.prototype.trigger=function(e,i){return t.zui.callEvent(this.options[e],i,this)},o.prototype.init=function(){var n,a,o,r,l,h,c,d,u,p,f,g,m,v=this,y=v.$,b=v.options,w=b.deviation,x="."+s+"."+v.id,_="mousedown"+x,C="mouseup"+x,k="mousemove"+x,T=b.selector,S=b.handle,D=b.flex,M=b.container,P=b.canMoveHere,F=y,L=!1,z=M?t(b.container).first():T?y:t("body"),$=function(e){if(L&&(f={left:e.pageX,top:e.pageY},!(i.abs(f.left-d.left)a&&f.top>o&&f.left-1&&i.button!==s)){var f=t(this);T&&(F=S?f.closest(T):f),F.hasClass("drag-shadow")||b.before&&b.before({event:i,element:F})===!1||(L=!0,n=t.isFunction(b.target)?b.target(y):z.find(b.target),a=null,o=null,r=!1,l=!0,h=null,c=F.offset(),u=z.offset(),d={left:i.pageX,top:i.pageY},g=t.extend({},d),p={left:d.left-c.left,top:d.top-c.top},F.addClass("drag-from"),t(e).on(k,$).on(C,E),m=setTimeout(function(){t(e).on(_,E)},10),i.preventDefault())}};S?y.on(_,S,I):T?y.on(_,T,I):y.on(_,I)},o.prototype.destroy=function(){var i="."+s+"."+this.id;this.$.off(i),t(e).off(i),this.$.data(s,null)},o.prototype.reset=function(){this.destroy(),this.init()},t.fn.droppable=function(e){return this.each(function(){var i=t(this),n=i.data(s),a="object"==typeof e&&e;n||i.data(s,n=new o(this,a)),"string"==typeof e&&n[e]()})},t.fn.droppable.Constructor=o}(jQuery,document,Math),+function(t,e){"use strict";function i(e,i,a){return this.each(function(){var o=t(this),r=o.data(s),l=t.extend({},n.DEFAULTS,o.data(),"object"==typeof e&&e);r||o.data(s,r=new n(this,l)),"string"==typeof e?r[e](i,a):l.show&&r.show(i,a)})}var s="zui.modal",n=function(i,n){var a=this;a.options=n,a.$body=t(document.body),a.$element=t(i),a.$backdrop=a.isShown=null,a.scrollbarWidth=0,n.moveable===e&&(a.options.moveable=a.$element.hasClass("modal-moveable")),n.remote&&a.$element.find(".modal-content").load(n.remote,function(){a.$element.trigger("loaded."+s)})};n.VERSION="3.2.0",n.TRANSITION_DURATION=300,n.BACKDROP_TRANSITION_DURATION=150,n.DEFAULTS={backdrop:!0,keyboard:!0,show:!0,position:"fit"};var a=function(e,i){var s=t(window);i.left=Math.max(0,Math.min(i.left,s.width()-e.outerWidth())),i.top=Math.max(0,Math.min(i.top,s.height()-e.outerHeight())),e.css(i)};n.prototype.toggle=function(t,e){return this.isShown?this.hide():this.show(t,e)},n.prototype.ajustPosition=function(i){var n=this,o=n.options;if(i===e&&(i=o.position),i!==e){t.isFunction(i)&&(i=i(n));var r=n.$element.find(".modal-dialog"),l=Math.max(0,(t(window).height()-r.outerHeight())/2);if("fit"===i?i={top:Math.floor(2*l/3)}:"center"===i?i={top:l}:t.isPlainObject(i)||(i={top:i}),r.hasClass("modal-moveable")){var h=null,c=o.rememberPos;c&&(c===!0?h=n.$element.data("modal-pos"):t.zui.store&&(h=t.zui.store.pageGet(s+".rememberPos."+c))),i=t.extend(i,{left:Math.max(0,(t(window).width()-r.outerWidth())/2)},h),"inside"===o.moveable?a(r,i):r.css(i)}else r.css(i)}},n.prototype.setMoveale=function(){t.fn.draggable||console.error("Moveable modal requires draggable.js.");var e=this,i=e.options,n=e.$element.find(".modal-dialog").removeClass("modal-dragged");n.toggleClass("modal-moveable",!!i.moveable),e.$element.data("modal-moveable-setup")||n.draggable({container:e.$element,handle:".modal-header",before:function(){var t=n.css("margin-top");t&&"0px"!==t&&n.css("top",t).css("margin-top","").addClass("modal-dragged")},finish:function(n){var a=i.rememberPos;a&&(e.$element.data("modal-pos",n.pos),t.zui.store&&a!==!0&&t.zui.store.pageSet(s+".rememberPos."+a,n.pos))},move:"inside"!==i.moveable||function(t){a(n,t)}})},n.prototype.show=function(e,i){var a=this,o=t.Event("show."+s,{relatedTarget:e});a.$element.trigger(o),a.isShown||o.isDefaultPrevented()||(a.isShown=!0,a.options.moveable&&a.setMoveale(),a.checkScrollbar(),a.options.backdrop!==!1&&(a.$body.addClass("modal-open"),a.setScrollbar()),a.escape(),a.$element.on("click.dismiss."+s,'[data-dismiss="modal"]',t.proxy(a.hide,a)),a.backdrop(function(){var o=t.support.transition&&a.$element.hasClass("fade");a.$element.parent().length||a.$element.appendTo(a.$body),a.$element.show().scrollTop(0),o&&a.$element[0].offsetWidth,a.$element.addClass("in").attr("aria-hidden",!1),a.ajustPosition(i),a.enforceFocus();var r=t.Event("shown."+s,{relatedTarget:e});o?a.$element.find(".modal-dialog").one("bsTransitionEnd",function(){a.$element.trigger("focus").trigger(r)}).emulateTransitionEnd(n.TRANSITION_DURATION):a.$element.trigger("focus").trigger(r)}))},n.prototype.hide=function(e){e&&e.preventDefault();var i=this;e=t.Event("hide."+s),i.$element.trigger(e),i.isShown&&!e.isDefaultPrevented()&&(i.isShown=!1,i.options.backdrop!==!1&&(i.$body.removeClass("modal-open"),i.resetScrollbar()),i.escape(),t(document).off("focusin."+s),i.$element.removeClass("in").attr("aria-hidden",!0).off("click.dismiss."+s),t.support.transition&&i.$element.hasClass("fade")?i.$element.one("bsTransitionEnd",t.proxy(i.hideModal,i)).emulateTransitionEnd(n.TRANSITION_DURATION):i.hideModal())},n.prototype.enforceFocus=function(){t(document).off("focusin."+s).on("focusin."+s,t.proxy(function(t){this.$element[0]===t.target||this.$element.has(t.target).length||this.$element.trigger("focus")},this))},n.prototype.escape=function(){this.isShown&&this.options.keyboard?t(document).on("keydown.dismiss."+s,t.proxy(function(i){if(27==i.which){var n=t.Event("escaping."+s),a=this.$element.triggerHandler(n,"esc");if(a!=e&&!a)return;this.hide()}},this)):this.isShown||t(document).off("keydown.dismiss."+s)},n.prototype.hideModal=function(){var t=this;this.$element.hide(),this.backdrop(function(){t.$element.trigger("hidden."+s)})},n.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},n.prototype.backdrop=function(e){var i=this,a=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var o=t.support.transition&&a;if(this.$backdrop=t('