123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427 |
- //MWF.xDesktop.requireApp("Organization", "Selector.package", null, false);
- MWF.xApplication.Org.Main = new Class({
- Extends: MWF.xApplication.Common.Main,
- Implements: [Options, Events],
- options: {
- "style": "default",
- "name": "Org",
- "icon": "icon.png",
- "width": (layout.desktop.size) ? layout.desktop.size.x*0.7 : 1000,
- "height": (layout.desktop.size) ? layout.desktop.size.y*0.8: 800,
- "title": MWF.xApplication.Org.LP.title
- },
- onQueryLoad: function(){
- this.lp = MWF.xApplication.Org.LP;
- this.restActions = MWF.Actions.get("x_organization_assemble_control");
- },
- loadApplication: function(callback){
- this.content.loadCss("../x_component_Org/$Main/"+this.options.style+"/style.css");
- this.createNode();
- this.loadApplicationContent();
- if (callback) callback();
- },
- createNode: function(){
- this.content.setStyle("overflow", "hidden");
- this.node = new Element("div", {
- "styles": {"width": "100%", "height": "100%", "overflow": "hidden"}
- }).inject(this.content);
- },
- loadApplicationContent: function(){
- this.loadStartMenu();
- // this.loadApplicationLayout();
- },
- loadStartMenu: function(){
- this.startMenuNode = new Element("div", {
- "styles": this.css.startMenuNode
- }).inject(this.node);
-
- this.menu = new MWF.xApplication.Org.Menu(this, this.startMenuNode, {
- "onPostLoad": function(){
- if (this.status){
- if (this.status.navi!==null){
- this.menu.doAction(this.menu.startNavis[this.status.navi]);
- }
- }
- }.bind(this)
- });
- this.addEvent("resize", function(){
- if (this.menu) this.menu.onResize();
- }.bind(this));
- },
-
- clearContent: function(){
- if (this.orgConfiguratorContentNode){
- if (this.orgConfigurator){
- this.orgConfigurator.destroy();
- this.orgConfigurator = null;
- }
- this.orgConfiguratorContentNode.destroy();
- this.orgConfiguratorContentNode = null;
- }
- if (this.identityConfiguratorContentNode){
- if (this.identityConfigurator) delete this.identityConfigurator;
- this.identityConfiguratorContentNode.destroy();
- }
- if (this.groupConfiguratorContentNode){
- if (this.groupConfigurator){
- this.groupConfigurator.destroy();
- this.groupConfigurator = null;
- }
- this.groupConfiguratorContentNode.destroy();
- }
- if (this.roleConfiguratorContentNode){
- if (this.roleConfigurator){
- this.roleConfigurator.destroy();
- this.roleConfigurator = null;
- }
- this.roleConfiguratorContentNode.destroy();
- }
- if (this.personConfiguratorContentNode){
- if (this.personConfigurator){
- this.personConfigurator.destroy();
- this.personConfigurator = null;
- }
- this.personConfiguratorContentNode.destroy();
- }
- if (this.importConfiguratorContentNode){
- this.importConfiguratorContentNode.destroy();
- }
- if (this.privateNamesQueryPowerContentNode){
- this.privateNamesQueryPowerContentNode.destroy();
- }
- if (this.pingyinArea) this.pingyinArea.empty();
- },
- orgConfig: function(){
- this.clearContent();
- this.orgConfiguratorContentNode = new Element("div", {
- "styles": this.css.rightContentNode
- }).inject(this.node);
- this.loadOrgConfig();
- },
- loadOrgConfig: function(){
- MWF.xDesktop.requireApp("Org", "UnitExplorer", function(){
- //MWF.xDesktop.requireApp("Org", "Actions.RestActions", function(){
- // if (!this.restActions) this.restActions = new MWF.xApplication.Org.Actions.RestActions();
- this.orgConfigurator = new MWF.xApplication.Org.UnitExplorer(this.orgConfiguratorContentNode, this.restActions);
- this.orgConfigurator.app = this;
- this.orgConfigurator.load();
- //}.bind(this));
- }.bind(this));
- },
- groupConfig: function(){
- this.clearContent();
- this.groupConfiguratorContentNode = new Element("div", {
- "styles": this.css.rightContentNode
- }).inject(this.node);
- this.loadGroupConfig();
- },
- loadGroupConfig: function(){
- MWF.xDesktop.requireApp("Org", "GroupExplorer", function(){
- //MWF.xDesktop.requireApp("Org", "Actions.RestActions", function(){
- // if (!this.restActions) this.restActions = new MWF.xApplication.Org.Actions.RestActions();
- this.groupConfigurator = new MWF.xApplication.Org.GroupExplorer(this.groupConfiguratorContentNode, this.restActions);
- this.groupConfigurator.app = this;
- this.groupConfigurator.load();
- //}.bind(this));
- }.bind(this));
- },
- roleConfig: function(){
- this.clearContent();
- this.roleConfiguratorContentNode = new Element("div", {
- "styles": this.css.rightContentNode
- }).inject(this.node);
- this.loadRoleConfig();
- },
- loadRoleConfig: function(){
- MWF.xDesktop.requireApp("Org", "RoleExplorer", function(){
- //MWF.xDesktop.requireApp("Org", "Actions.RestActions", function(){
- // if (!this.restActions) this.restActions = new MWF.xApplication.Org.Actions.RestActions();
- this.roleConfigurator = new MWF.xApplication.Org.RoleExplorer(this.roleConfiguratorContentNode, this.restActions);
- this.roleConfigurator.app = this;
- this.roleConfigurator.load();
- //}.bind(this));
- }.bind(this));
- },
- personConfig: function(){
- this.clearContent();
- this.personConfiguratorContentNode = new Element("div", {
- "styles": this.css.rightContentNode
- }).inject(this.node);
- this.loadPersonConfig();
- },
- loadPersonConfig: function(){
- MWF.xDesktop.requireApp("Org", "PersonExplorer", function(){
- //MWF.xDesktop.requireApp("Org", "Actions.RestActions", function(){
- // if (!this.restActions) this.restActions = new MWF.xApplication.Org.Actions.RestActions();
- this.personConfigurator = new MWF.xApplication.Org.PersonExplorer(this.personConfiguratorContentNode, this.restActions);
- this.personConfigurator.app = this;
- this.personConfigurator.load();
- //}.bind(this));
- }.bind(this));
- },
- personImport: function(){
- debugger;
- this.clearContent();
- this.importConfiguratorContentNode = new Element("div", {
- "styles": this.css.rightContentNode
- }).inject(this.node);
- this.importConfiguratorContentNode.set("load", {"onSuccess": function(){
- this.importPersonTitleNode = this.importConfiguratorContentNode.getElement(".importPersonTitleNode");
- this.importPersonTemplateNode = this.importConfiguratorContentNode.getElement(".importPersonTemplateNode");
- this.importPersonNode = this.importConfiguratorContentNode.getElement(".importPersonNode");
- this.importPersonResultNode = this.importConfiguratorContentNode.getElement(".importPersonResultNode");
- this.exportPersonNode = this.importConfiguratorContentNode.getElement(".exportPersonNode");
- o2.loadCss(this.path+this.options.style+"/importCss.css", this.importConfiguratorContentNode, function(){
- this.loadPersonImport();
- }.bind(this));
- }.bind(this)}).load(this.path+this.options.style+"/importView.html");
- },
- loadPersonImport: function(){
- var action = o2.Actions.get("x_organization_assemble_control");
- MWF.require("MWF.widget.MaskNode", null, false);
- var url = o2.filterUrl(action.action.address + action.action.actions.getImportPersonTemplate.uri);
- var infor = this.lp.importPersonInfor.replace("{url}", url);
- this.importPersonTitleNode.set("text", this.lp.importPersonTitle);
- this.importPersonTemplateNode.set("html", infor);
- this.importPersonNode.set("text", this.lp.importPersonAction);
-
- this.importPersonNode.addEvent("click", function(){
- this.importPersonResultNode.hide();
- o2.require("o2.widget.Upload", function(){
- new o2.widget.Upload(this.content, {
- "action": "x_organization_assemble_control",
- "method": "importPerson",
- "multiple": false,
- "onCompleted": function(json){
- if (!this.maskNode){
- this.maskNode = new MWF.widget.MaskNode(this.importConfiguratorContentNode, {"style": "bam"});
- this.maskNode.load();
- }
- var url = o2.filterUrl(action.action.address + action.action.actions.getImportPersonResault.uri);
- url = url.replace("{flag}", json.data.flag);
- var result = this.lp.importPersonResult.replace("{url}", url);
- this.importPersonResultNode.set("html", result);
- this.importPersonResultNode.show();
- if (this.maskNode) this.maskNode.hide(function(){
- MWF.release(this.maskNode);
- this.maskNode = null;
- }.bind(this));
- }.bind(this)
- }).load();
- }.bind(this));
- }.bind(this));
- var exporturl = o2.filterUrl(o2.Actions.getHost("x_cms_assemble_control") + "/x_organization_assemble_control/jaxrs/export/export/all");
- this.exportPersonNode.set("text", this.lp.exportPersonText);
- this.exportPersonNode.set("href", exporturl);
- },
- privateNamesQueryPower:function(){
- debugger;
- this.clearContent();
- this.privateNamesQueryPowerContentNode = new Element("div", {
- "styles": this.css.rightContentNode
- }).inject(this.node);
- this.privateNamesQueryPowerContentNode.set("load", {"onSuccess": function(){
- this.queryPrivateConfigAreaNode = this.privateNamesQueryPowerContentNode.getElement(".queryPrivateConfigAreaNode");
- o2.loadCss(this.path+this.options.style+"/queryPrivateConfig.css", this.privateNamesQueryPowerContentNode, function(){
- this.loadprivateNamesQueryPower();
- }.bind(this));
- }.bind(this)}).load(this.path+this.options.style+"/queryPrivateConfigView.html");
- },
- loadprivateNamesQueryPower: function(){
- MWF.xDesktop.requireApp("Org", "PrivateConfig", function(){
- this.privateConfigurator = new MWF.xApplication.Org.PrivateConfig(this.privateNamesQueryPowerContentNode);
- this.privateConfigurator.app = this;
- this.privateConfigurator.load();
- }.bind(this));
- },
- isOnlySecurityManager: function(){
- if( MWF.AC.isAdministrator() )return false;
- if( MWF.AC.isSystemManager() )return false;
- return MWF.AC.isSecurityManager();
- },
- recordStatus: function(){
- var idx = null;
- if (this.menu.currentNavi){
- idx = this.menu.startNavis.indexOf(this.menu.currentNavi);
- }
- return {"navi": idx};
- }
-
- });
- MWF.xApplication.Org.Menu = new Class({
- Implements: [Options, Events],
-
- initialize: function(app, node, options){
- this.setOptions(options);
- this.app = app;
- this.node = $(node);
- this.currentNavi = null;
- this.status = "start";
- this.startNavis = [];
- this.load();
- },
- load: function(){
- //var menuUrl = (MWF.AC.isOrganizationManager()) ? this.app.path+"startMenu_admin.json" : this.app.path+"startMenu.json";
- var menuUrl = this.app.path+"startMenu.json";
- MWF.getJSON(menuUrl, function(json){
- json.each(function(navi){
- if (navi.display){
- var naviNode = new Element("div", {
- "styles": this.app.css.startMenuNaviNode,
- "title": navi.title
- });
- naviNode.store("naviData", navi);
- var iconNode = new Element("div", {
- "styles": this.app.css.startMenuIconNode
- }).inject(naviNode);
- iconNode.setStyle("background-image", "url("+this.app.path+this.app.options.style+"/icon/"+navi.icon+"60.png)");
- var textNode = new Element("div", {
- "styles": this.app.css.startMenuTextNode,
- "text": navi.title
- });
- textNode.inject(naviNode);
- naviNode.inject(this.node);
- this.startNavis.push(naviNode);
- this.setStartNaviEvent(naviNode, navi);
- this.setNodeCenter(this.node);
- }
- }.bind(this));
- this.setStartMenuWidth();
-
- this.fireEvent("postLoad");
- }.bind(this));
- },
- setStartNaviEvent: function(naviNode){
- var _self = this;
- naviNode.addEvents({
- "mouseover": function(){
- //debugger;
- if (_self.currentNavi!==this){
- var iconNode = this.getFirst();
- this.setStyles(_self.app.css.startMenuNaviNode_over);
- var navi = this.retrieve("naviData");
- iconNode.setStyle("background-image", "url("+_self.app.path+_self.app.options.style+"/icon/"+navi.icon+".png)");
- iconNode.setStyles(_self.app.css.startMenuIconNode_over);
- }
- },
- "mouseout": function(){
- var iconNode = this.getFirst();
- if (_self.currentNavi!==this) this.setStyles(_self.app.css.startMenuNaviNode);
- var navi = this.retrieve("naviData");
- iconNode.setStyle("background-image", "url("+_self.app.path+_self.app.options.style+"/icon/"+navi.icon+"60.png)");
- iconNode.setStyles(_self.app.css.startMenuIconNode);
- },
- "mousedown": function(){
- if (_self.currentNavi!==this) this.setStyles(_self.app.css.startMenuNaviNode_down);
- },
- "mouseup": function(){if (_self.currentNavi!==this) this.setStyles(_self.app.css.startMenuNaviNode_over);},
- "click": function(){
- _self.doAction.apply(_self, [this]);
- }
- });
- },
- doAction: function(naviNode){
- var navi = naviNode.retrieve("naviData");
- var action = navi.action;
- this.startNavis.each(function(node){
- node.removeEvents("mouseover");
- node.removeEvents("mouseout");
- node.removeEvents("mousedown");
- node.removeEvents("mouseup");
- node.setStyles(this.app.css.startMenuNaviLeftNode);
- var iconNode = node.getFirst();
- var textNode = node.getLast();
- var tmpnavi = node.retrieve("naviData");
- iconNode.setStyle("background-image", "url("+this.app.path+this.app.options.style+"/icon/"+tmpnavi.icon+"32.png)");
- iconNode.setStyles(this.app.css.startMenuIconLeftNode);
- textNode.setStyles(this.app.css.startMenuTextLeftNode);
- }.bind(this));
- naviNode.setStyles(this.app.css.startMenuNaviLeftNode_current);
- this.currentNavi = naviNode;
- if (this.status === "start"){
- this.toNormal();
- this.status = "normal";
- }
- if (this.app[action]) this.app[action].apply(this.app);
- },
- toNormal: function(){
- var css = this.app.css.normalStartMenuNode;
- if (!this.morph){
- this.morph = new Fx.Morph(this.node, {duration: 50, link: "chain"});
- }
- this.app.pingyinArea = new Element("div", {"styles": this.app.css.startMenuNaviLeftPingyinNode}).inject(this.node, "top");
- this.morph.start(css).chain(function(){
- this.node.setStyles(css);
-
- // MWF.require("MWF.widget.ScrollBar", function(){
- // new MWF.widget.ScrollBar(this.node, {
- // "style":"xApp_ProcessManager_StartMenu", "distance": 100, "friction": 4, "axis": {"x": false, "y": true}
- // });
- // }.bind(this));
- }.bind(this));
- },
- setNodeCenter: function(node){
- var size = node.getSize();
- var contentSize = this.app.node.getSize();
-
- var top = contentSize.y/2 - size.y/2;
- var left = contentSize.x/2 - size.x/2;
- if (left<0) left = 0;
- if (top<0) top = 0;
- node.setStyles({"left": left, "top": top});
- },
- getStartMenuNormalSize: function(){
- var naviItemNode = this.node.getFirst();
-
- var size = naviItemNode.getComputedSize();
- var mt = naviItemNode.getStyle("margin-top").toFloat();
- var mb = naviItemNode.getStyle("margin-bottom").toFloat();
- var height = size.totalWidth+mt+mb;
-
- var ml = naviItemNode.getStyle("margin-left").toFloat();
- var mr = naviItemNode.getStyle("margin-right").toFloat();
- var width = size.totalWidth+ml+mr;
-
- return {"width": width, "height": height*this.startNavis.length};
- },
- setStartMenuWidth: function(){
- var naviItemNode = this.node.getFirst();
-
- var size = naviItemNode.getComputedSize();
- var ml = naviItemNode.getStyle("margin-left").toFloat();
- var mr = naviItemNode.getStyle("margin-right").toFloat();
- var width = size.totalWidth+ml+mr;
- this.node.setStyle("width", (width*this.startNavis.length)+"px");
- },
- onResize: function(){
- if (this.status === "start"){
- this.setNodeCenter(this.node);
- }
- }
- });
|