huqi 5 лет назад
Родитель
Сommit
0a862462b3

+ 25 - 1
o2web/source/x_component_FindDesigner/FindWorker.js

@@ -301,6 +301,18 @@ _worker._createFindMessageReplyData = function(designer, pattern){
     }
 };
 
+_worker._setFilterOptionRegex = function(){
+    var keyword = _worker.findData.filterOption.keyword;
+    if (_worker.findData.filterOption.matchRegExp){
+        var flag = (_worker.findData.filterOption.caseSensitive) ? "g" : "gi";
+        this.keywordRegexp =  new RegExp(keyword, flag);
+    }else{
+        var flag = (_worker.findData.filterOption.caseSensitive) ? "g" : "gi";
+        keyword = (_worker.findData.filterOption.matchWholeWord) ? "\\b"+keyword+"\\b";
+        this.keywordRegexp = new RegExp(keyword, flag);
+    }
+};
+
 _worker._findProcessPlatformParse_script = function(designer){
     if (designer.patternList && designer.patternList.length){
         var action = this.findData.actions.getProcessScript;
@@ -311,7 +323,18 @@ _worker._findProcessPlatformParse_script = function(designer){
                     var scriptLines = json.data.text.split(/\s*\n\s*/);
                     pattern.lines.each(function(line){
                         var scriptText = scriptLines[line-1];
-
+                        while ((arr = this.keywordRegexp.exec(scriptText)) !== null) {
+                            var col = arr.index;
+                            var key = arr[0];
+                            var value = arr.input;
+                            _worker._findMessageReply(_worker._createFindMessageReplyData(designer, {
+                                "property": pattern.property,
+                                "value": value,
+                                "line": line,
+                                "column": col,
+                                "key": key
+                            }));
+                        }
                     });
                 }else{
                     _worker._findMessageReply(_worker._createFindMessageReplyData(designer, {
@@ -388,6 +411,7 @@ onmessage = function(e) {
     this.findData = e.data;
     var moduleList = this.findData.filterOption.moduleList;
     this.findData.filterOption.moduleList = [];
+    _worker._setFilterOptionRegex();
 
     this.filterOptionTemplete = JSON.stringify(this.findData.filterOption);
     this.filterOptionList = [];

+ 42 - 2
o2web/source/x_component_FindDesigner/Main.js

@@ -351,9 +351,49 @@ MWF.xApplication.FindDesigner.Main = new Class({
 			if (e.data && e.data.type=="find") this.doFindResult(e.data);
 		}.bind(this);
 	},
-	doFindResult: function(){
+	doFindResult: function(data){
 		this.findOptionModuleProcessed++;
 		this.updateFindProgress();
+		this.showFindResult(data);
+	},
+
+	getResultTree: function(){
+
+	},
+
+	showFindResult: function(){
+
+		o2.require("o2.widget.Tree", function(){
+			var tree = new o2.widget.Tree(this.listContentNode, {
+				"onQueryExpand": function(item){
+					if (item.designer) this.loadDesignerPattern(item);
+				}.bind(this)
+			});
+			tree.load();
+			if (data.processPlatformList && data.processPlatformList.length){
+				var platformItem = this.createResultCategroyItem(this.lp.processPlatform, this.lp.processPlatform, tree);
+				this.listProcessResult(platformItem, data.processPlatformList, "processPlatform");
+			}
+			if (data.cmsList && data.cmsList.length){
+				var platformItem = this.createResultCategroyItem(this.lp.cms, this.lp.cms, tree);
+				//this.listProcessResult(categroyItem, data.cmsList);
+			}
+			if (data.portalList && data.portalList.length){
+				var platformItem = this.createResultCategroyItem(this.lp.portal, this.lp.portal, tree);
+
+			}
+			if (data.queryList && data.queryList.length){
+				var platformItem = this.createResultCategroyItem(this.lp.query, this.lp.query, tree);
+			}
+			if (data.serviceList && data.serviceList.length){
+				var platformItem = this.createResultCategroyItem(this.lp.service, this.lp.service, tree);
+			}
+
+
+		}.bind(this));
+	},
+
+
 	},
 	setReceiveMessage: function(){
 		this.listTitleInfoNode.set("text", this.lp.receiveToFind);
@@ -427,7 +467,7 @@ MWF.xApplication.FindDesigner.Main = new Class({
 			filterOption: this.filterOption,
 			debug: (window.layout && layout["debugger"]),
 			token: (window.layout && layout.session && layout.session.user) ? layout.session.user.token : ""
-		}
+		};
 		this.findWorker.postMessage(workerMessage);
 	},