huqi 4 лет назад
Родитель
Сommit
3c174055d4

+ 31 - 25
o2web/source/o2_core/o2/xDesktop/Default.js

@@ -1233,7 +1233,6 @@ o2.xDesktop.Default.StartMenu = new Class({
     },
 
     loadApplicationsItem: function(layoutJson, componentJson, portalJson){
-        debugger;
         var user = this.layout.session.user;
         var currentNames = [user.name, user.distinguishedName, user.id, user.unique];
         if (user.roleList) currentNames = currentNames.concat(user.roleList);
@@ -1261,44 +1260,51 @@ o2.xDesktop.Default.StartMenu = new Class({
                         if (d) json_portal.erase(d);
 
                     }.bind(this));
-                }else{
+                }else {
                     var appData = null;
-                    if (!appData && json_layout && json_layout.length){
-                        appData = json_layout.find(function(i){ return (i.id === app.id); });
-                        if (appData){
+                    if (!appData && json_layout && json_layout.length) {
+                        appData = json_layout.find(function (i) {
+                            return (i.id === app.id);
+                        });
+                        if (appData) {
                             json_layout.erase(appData);
-                            if ( this.checkMenuItem(appData, currentNames) ) this.createApplicationMenuItem(appData);
+                            if (this.checkMenuItem(appData, currentNames)) this.createApplicationMenuItem(appData);
                         }
                     }
-                    if (!appData && json_component && json_component.length){
-                        appData = json_component.find(function(i){ return (i.id === app.id); });
-                        if (appData){
+                    if (!appData && json_component && json_component.length) {
+                        appData = json_component.find(function (i) {
+                            return (i.id === app.id);
+                        });
+                        if (appData) {
                             json_component.erase(appData);
-                            if ( this.checkMenuItem(appData, currentNames) ) this.createApplicationMenuItem(appData);
+                            if (this.checkMenuItem(appData, currentNames)) this.createApplicationMenuItem(appData);
                         }
                     }
-                    if (!appData && json_portal && json_portal.length){
-                        appData = json_portal.find(function(i){ return (i.id === app.id); });
-                        if (appData){
+                    if (!appData && json_portal && json_portal.length) {
+                        appData = json_portal.find(function (i) {
+                            return (i.id === app.id);
+                        });
+                        if (appData) {
                             json_portal.erase(appData);
                             appData.type = "portal";
                             this.createPortalMenuItem(appData);
                         }
                     }
-                }.bind(this));
-            }
-
-            if (json_layout && json_layout.length) json_layout.each(function(value){
-                if ( this.checkMenuItem(value, currentNames) ) this.createApplicationMenuItem(value);
+                }
             }.bind(this));
+        }
 
-            if (json_component && json_component.length) json_component.each(function(value){
-                if ( this.checkMenuItem(value, currentNames) ) this.createApplicationMenuItem(value);
-            }.bind(this));
+        if (json_layout && json_layout.length) json_layout.each(function(value){
+            if ( this.checkMenuItem(value, currentNames) ) this.createApplicationMenuItem(value);
+        }.bind(this));
 
-            if (json_portal && json_portal.length) json_portal.each(function(value){
-                this.createPortalMenuItem(value);
-            }.bind(this));
+        if (json_component && json_component.length) json_component.each(function(value){
+            if ( this.checkMenuItem(value, currentNames) ) this.createApplicationMenuItem(value);
+        }.bind(this));
+
+        if (json_portal && json_portal.length) json_portal.each(function(value){
+            this.createPortalMenuItem(value);
+        }.bind(this));
 
         if (json_portal && json_portal.length) json_portal.each(function(value){
             value.type = "portal";
@@ -2526,7 +2532,7 @@ o2.xDesktop.Default.TaskItem = new Class({
         this.taskitemMenu.addMenuItem(o2.LP.desktop.closeAll, "click", function(){
             var keys = Array.clone(Object.keys(this.desktop.apps));
             keys.each(function(key){
-                if (!this.desktop.apps[key].isIndex && !this.desktop.apps[key].options.isIndex) this.desktop.apps[key].close();
+                if (!layout.desktop.apps[key].isIndex && !layout.desktop.apps[key].options.isIndex) layout.desktop.apps[key].close();
             }.bind(this));
             keys = null;
         }.bind(this), img);

+ 4 - 24
o2web/source/x_component_process_Xform/Documenteditor.js

@@ -121,7 +121,7 @@ MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor =  new Cla
                 return true;
         }
     },
-    _createPage: function(callback){
+    _createPage: function(callback, callbackAftreLoad){
         var pageContentNode = this._createNewPage().getFirst();
 
         var control = this.getShowControl();
@@ -187,6 +187,7 @@ MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor =  new Cla
                 }
                 if (callback) callback(control);
                 this.fireEvent("loadPage");
+                if (callbackAftreLoad) callbackAftreLoad(control);
             }.bind(this));
         }else{
             this.getTempleteJson(function(){
@@ -200,6 +201,7 @@ MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor =  new Cla
                     }
                     if (callback) callback(control);
                     this.fireEvent("loadPage");
+                    if (callbackAftreLoad) callbackAftreLoad(control);
                 }.bind(this));
             }.bind(this));
         }
@@ -3025,35 +3027,13 @@ MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor =  new Cla
             this.node.setStyles({
                 "height":"auto"
             });
-
-            //var content = this.contentNode.getFirst().getFirst().get("html");
-            // var tmpNode = this.contentNode.getFirst().getFirst().clone(true);
-            // var htmlNode = tmpNode.getLast();
-            // htmlNode = this.removeDisplayNone(htmlNode);
-            // var nodes = tmpNode.querySelectorAll("[data-w-style]");
-            // if (nodes.length){
-            //     for (var i=0; i<nodes.length; i++){
-            //         var n = nodes.item(i);
-            //         wStyle = n.dataset["wStyle"];
-            //         var styles = wStyle.split(/\s*\;\s*/g);
-            //         styles.each(function(style){
-            //             if (style){
-            //                 try{
-            //                     s = style.split(/\s*\:\s*/g);
-            //                     n.setStyle(s[0], s[1]);
-            //                 }catch(e) {}
-            //             }
-            //         });
-            //     }
-            // }
+        }.bind(this), function(){
             var content = this.getDocumentHtml();
             //var content = "<html xmlns:v=\"urn:schemas-microsoft-com:vml\"><head><meta charset=\"UTF-8\" /></head><body>"+tmpNode.get("html")+"</body></html>";
 
             var fileName = docNmae || this.json.toWordFilename || "$doc";
             var n = fileName.lastIndexOf(".");
             if (n==-1) fileName = fileName+".doc";
-            // var ex = fileName.substring(n, fileName.length).toLowerCase();
-            // if (ex!==".doc" && ex!==".docx") fileName = fileName+".doc";
 
             var body = {
                 "fileName": fileName,