|
@@ -50,17 +50,21 @@ MWF.xApplication.query.StatementDesigner.widget.ViewFilter = new Class({
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
loadData: function () {
|
|
loadData: function () {
|
|
|
- if (this.filtrData.filtrData && this.filtrData.filtrData.length) {
|
|
|
|
|
|
|
+ if (this.filtrData.parameterData && this.filtrData.parameterData.length && this.parameterListAreaNode) {
|
|
|
|
|
+ this.filtrData.parameterData.each(function (data) {
|
|
|
|
|
+ data.type = "parameter";
|
|
|
|
|
+ this.items.push(new MWF.xApplication.query.StatementDesigner.widget.ViewFilter.ItemParameter(this, data));
|
|
|
|
|
+ }.bind(this));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (this.filtrData.filtrData && this.filtrData.filtrData.length && this.filterListAreaNode ) {
|
|
|
this.filtrData.filtrData.each(function (data) {
|
|
this.filtrData.filtrData.each(function (data) {
|
|
|
- if( this.options.withForm ){
|
|
|
|
|
- this.items.push(new MWF.xApplication.query.StatementDesigner.widget.ViewFilter.ItemWithForm(this, data));
|
|
|
|
|
- }else{
|
|
|
|
|
- this.items.push(new MWF.xApplication.query.StatementDesigner.widget.ViewFilter.Item(this, data));
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ data.type = "filter";
|
|
|
|
|
+ this.items.push(new MWF.xApplication.query.StatementDesigner.widget.ViewFilter.ItemFilter(this, data));
|
|
|
}.bind(this));
|
|
}.bind(this));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (this.filtrData.customData && this.filtrData.customData.length) {
|
|
|
|
|
|
|
+ if (this.filtrData.customData && this.filtrData.customData.length && this.customFilterListAreaNode ) {
|
|
|
this.filtrData.customData.each(function (data) {
|
|
this.filtrData.customData.each(function (data) {
|
|
|
data.type = "custom";
|
|
data.type = "custom";
|
|
|
this.items.push(new MWF.xApplication.query.StatementDesigner.widget.ViewFilter.ItemCustom(this, data));
|
|
this.items.push(new MWF.xApplication.query.StatementDesigner.widget.ViewFilter.ItemCustom(this, data));
|
|
@@ -87,25 +91,25 @@ MWF.xApplication.query.StatementDesigner.widget.ViewFilter = new Class({
|
|
|
this.scriptArea.load(v);
|
|
this.scriptArea.load(v);
|
|
|
}.bind(this));
|
|
}.bind(this));
|
|
|
},
|
|
},
|
|
|
- createFilterValueScriptArea: function (node) {
|
|
|
|
|
|
|
+ createParameterValueScriptArea: function (node) {
|
|
|
var title = node.get("title");
|
|
var title = node.get("title");
|
|
|
|
|
|
|
|
MWF.require("MWF.widget.ScriptArea", function () {
|
|
MWF.require("MWF.widget.ScriptArea", function () {
|
|
|
- this.filterValueScriptArea = new MWF.widget.ScriptArea(node, {
|
|
|
|
|
|
|
+ this.parameterValueScriptArea = new MWF.widget.ScriptArea(node, {
|
|
|
"title": title,
|
|
"title": title,
|
|
|
"isload": true,
|
|
"isload": true,
|
|
|
"isbind": false,
|
|
"isbind": false,
|
|
|
"maxObj": this.app.formContentNode || this.app.pageContentNode,
|
|
"maxObj": this.app.formContentNode || this.app.pageContentNode,
|
|
|
"onChange": function () {
|
|
"onChange": function () {
|
|
|
- this.filterValueScriptData = this.filterValueScriptArea.toJson();
|
|
|
|
|
|
|
+ this.parameterValueScriptData = this.parameterValueScriptArea.toJson();
|
|
|
}.bind(this),
|
|
}.bind(this),
|
|
|
"onSave": function () {
|
|
"onSave": function () {
|
|
|
//this.app.saveForm();
|
|
//this.app.saveForm();
|
|
|
}.bind(this),
|
|
}.bind(this),
|
|
|
"style": "formula"
|
|
"style": "formula"
|
|
|
});
|
|
});
|
|
|
- var v = (this.filterValueScriptData) ? this.filterValueScriptData.code : "";
|
|
|
|
|
- this.filterValueScriptArea.load(v);
|
|
|
|
|
|
|
+ var v = (this.parameterValueScriptData) ? this.parameterValueScriptData.code : "";
|
|
|
|
|
+ this.parameterValueScriptArea.load(v);
|
|
|
}.bind(this));
|
|
}.bind(this));
|
|
|
},
|
|
},
|
|
|
createCustomFilterValueScriptArea: function (node) {
|
|
createCustomFilterValueScriptArea: function (node) {
|
|
@@ -134,8 +138,10 @@ MWF.xApplication.query.StatementDesigner.widget.ViewFilter = new Class({
|
|
|
this.inputAreaNode = this.node.getElement(".inputAreaNode_vf");
|
|
this.inputAreaNode = this.node.getElement(".inputAreaNode_vf");
|
|
|
this.actionAreaNode = this.node.getElement(".actionAreaNode_vf");
|
|
this.actionAreaNode = this.node.getElement(".actionAreaNode_vf");
|
|
|
this.actionAreaNode.setStyles(this.css.actionAreaNode);
|
|
this.actionAreaNode.setStyles(this.css.actionAreaNode);
|
|
|
- this.listAreaNode = this.node.getElement(".listAreaNode_vf");
|
|
|
|
|
- this.fieldListAreaNode = this.node.getElement(".fieldListAreaNode_vf");
|
|
|
|
|
|
|
+
|
|
|
|
|
+ this.filterListAreaNode = this.node.getElement(".filterListAreaNode_vf");
|
|
|
|
|
+ this.parameterListAreaNode = this.node.getElement(".parameterListAreaNode_vf");
|
|
|
|
|
+ this.customFilterListAreaNode = this.node.getElement(".customFilterListAreaNode_vf");
|
|
|
|
|
|
|
|
this.restrictViewFilterTable = this.node.getElement(".restrictViewFilterTable_vf");
|
|
this.restrictViewFilterTable = this.node.getElement(".restrictViewFilterTable_vf");
|
|
|
|
|
|
|
@@ -151,6 +157,7 @@ MWF.xApplication.query.StatementDesigner.widget.ViewFilter = new Class({
|
|
|
// this.parameterInputSelect = this.inputAreaNode.getElement(".parameterInputSelect_vf");
|
|
// this.parameterInputSelect = this.inputAreaNode.getElement(".parameterInputSelect_vf");
|
|
|
this.datatypeInput = this.inputAreaNode.getElement(".datatypeInput_vf");
|
|
this.datatypeInput = this.inputAreaNode.getElement(".datatypeInput_vf");
|
|
|
|
|
|
|
|
|
|
+ this.restrictParameterInput = this.inputAreaNode.getElement(".restrictParameterInput_vf");
|
|
|
this.restrictFilterInput = this.inputAreaNode.getElement(".restrictFilterInput_vf");
|
|
this.restrictFilterInput = this.inputAreaNode.getElement(".restrictFilterInput_vf");
|
|
|
this.customFilterInput = this.inputAreaNode.getElement(".customFilterInput_vf");
|
|
this.customFilterInput = this.inputAreaNode.getElement(".customFilterInput_vf");
|
|
|
|
|
|
|
@@ -171,11 +178,11 @@ MWF.xApplication.query.StatementDesigner.widget.ViewFilter = new Class({
|
|
|
if (this.app.statement && this.app.statement.view) {
|
|
if (this.app.statement && this.app.statement.view) {
|
|
|
var dataId = this.app.statement.view.data.id;
|
|
var dataId = this.app.statement.view.data.id;
|
|
|
|
|
|
|
|
- this.filterValueType = this.inputAreaNode.getElements("[name='" + dataId + "viewFilterValueType']");
|
|
|
|
|
- this.filterValueScriptDiv = this.inputAreaNode.getElement("#" + dataId + "viewFilterValueScriptDiv");
|
|
|
|
|
- this.filterValueScript = this.inputAreaNode.getElement("[name='" + dataId + "viewFilterValueScript']");
|
|
|
|
|
- if (this.filterValueScript) {
|
|
|
|
|
- this.createFilterValueScriptArea(this.filterValueScript);
|
|
|
|
|
|
|
+ this.parameterValueType = this.inputAreaNode.getElements("[name='" + dataId + "viewParameterValueType']");
|
|
|
|
|
+ this.parameterValueScriptDiv = this.inputAreaNode.getElement("#" + dataId + "viewParameterValueScriptDiv");
|
|
|
|
|
+ this.parameterValueScript = this.inputAreaNode.getElement("[name='" + dataId + "viewParameterValueScript']");
|
|
|
|
|
+ if (this.parameterValueScript) {
|
|
|
|
|
+ this.createParameterValueScriptArea(this.parameterValueScript);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
this.customFilterValueTypes = this.inputAreaNode.getElements("[name='" + dataId + "viewCustomFilterValueType']");
|
|
this.customFilterValueTypes = this.inputAreaNode.getElements("[name='" + dataId + "viewCustomFilterValueType']");
|
|
@@ -194,7 +201,7 @@ MWF.xApplication.query.StatementDesigner.widget.ViewFilter = new Class({
|
|
|
"target": this.app.content,
|
|
"target": this.app.content,
|
|
|
"format": "db",
|
|
"format": "db",
|
|
|
"onComplate": function () {
|
|
"onComplate": function () {
|
|
|
- this.node.getElement("#" + id + "viewFilterDateFormulaSelector").getElements("input").set("checked", false);
|
|
|
|
|
|
|
+ this.node.getElement("#" + id + "viewParameterDateFormulaSelector").getElements("input").set("checked", false);
|
|
|
}.bind(this)
|
|
}.bind(this)
|
|
|
});
|
|
});
|
|
|
new MWF.widget.Calendar(this.valueDateInput, {
|
|
new MWF.widget.Calendar(this.valueDateInput, {
|
|
@@ -268,8 +275,8 @@ MWF.xApplication.query.StatementDesigner.widget.ViewFilter = new Class({
|
|
|
case "date":
|
|
case "date":
|
|
|
t = "dateTimeValue";
|
|
t = "dateTimeValue";
|
|
|
break;
|
|
break;
|
|
|
- // t = "dateValue";
|
|
|
|
|
- // break;
|
|
|
|
|
|
|
+ // t = "dateValue";
|
|
|
|
|
+ // break;
|
|
|
case "time":
|
|
case "time":
|
|
|
t = "timeValue";
|
|
t = "timeValue";
|
|
|
break;
|
|
break;
|
|
@@ -302,7 +309,7 @@ MWF.xApplication.query.StatementDesigner.widget.ViewFilter = new Class({
|
|
|
|
|
|
|
|
//if (this.app.statement.view){
|
|
//if (this.app.statement.view){
|
|
|
// var id = this.app.view.data.id;
|
|
// var id = this.app.view.data.id;
|
|
|
- // var div = this.node.getElement("#"+id+"viewFilterValueArea2");
|
|
|
|
|
|
|
+ // var div = this.node.getElement("#"+id+"viewParameterValueArea2");
|
|
|
// // inputs = div.getElements("input");
|
|
// // inputs = div.getElements("input");
|
|
|
// if( div ){
|
|
// if( div ){
|
|
|
//this.valueTextInput2 = div.getElement(".valueTextInput2_vf") || null;
|
|
//this.valueTextInput2 = div.getElement(".valueTextInput2_vf") || null;
|
|
@@ -320,7 +327,7 @@ MWF.xApplication.query.StatementDesigner.widget.ViewFilter = new Class({
|
|
|
// "target": this.app.content,
|
|
// "target": this.app.content,
|
|
|
// "format": "db",
|
|
// "format": "db",
|
|
|
// "onComplate": function(){
|
|
// "onComplate": function(){
|
|
|
- // this.node.getElement("#"+id+"viewFilterDateFormulaSelector2").getElements("input").set("checked", false);
|
|
|
|
|
|
|
+ // this.node.getElement("#"+id+"viewParameterDateFormulaSelector2").getElements("input").set("checked", false);
|
|
|
// }.bind(this)
|
|
// }.bind(this)
|
|
|
// });
|
|
// });
|
|
|
// new MWF.widget.Calendar(this.valueDateInput2, {
|
|
// new MWF.widget.Calendar(this.valueDateInput2, {
|
|
@@ -411,23 +418,23 @@ MWF.xApplication.query.StatementDesigner.widget.ViewFilter = new Class({
|
|
|
}
|
|
}
|
|
|
var config = {
|
|
var config = {
|
|
|
"textValue": {
|
|
"textValue": {
|
|
|
- "selectorArea": "#" + id + "viewFilterTextFormulaSelector",
|
|
|
|
|
|
|
+ "selectorArea": "#" + id + "viewParameterTextFormulaSelector",
|
|
|
"input": this.valueTextInput
|
|
"input": this.valueTextInput
|
|
|
},
|
|
},
|
|
|
"datetimeValue": {
|
|
"datetimeValue": {
|
|
|
- "selectorArea": "#" + id + "viewFilterDateFormulaSelector",
|
|
|
|
|
|
|
+ "selectorArea": "#" + id + "viewParameterDateFormulaSelector",
|
|
|
"input": this.valueDatetimeInput
|
|
"input": this.valueDatetimeInput
|
|
|
},
|
|
},
|
|
|
"dateTimeValue": {
|
|
"dateTimeValue": {
|
|
|
- "selectorArea": "#" + id + "viewFilterDateFormulaSelector",
|
|
|
|
|
|
|
+ "selectorArea": "#" + id + "viewParameterDateFormulaSelector",
|
|
|
"input": this.valueDatetimeInput
|
|
"input": this.valueDatetimeInput
|
|
|
},
|
|
},
|
|
|
"dateValue": {
|
|
"dateValue": {
|
|
|
- "selectorArea": "#" + id + "viewFilterDateOnlyFormulaSelector",
|
|
|
|
|
|
|
+ "selectorArea": "#" + id + "viewParameterDateOnlyFormulaSelector",
|
|
|
"input": this.valueDateInput
|
|
"input": this.valueDateInput
|
|
|
},
|
|
},
|
|
|
"timeValue": {
|
|
"timeValue": {
|
|
|
- "selectorArea": "#" + id + "viewFilterTimeOnlyFormulaSelector",
|
|
|
|
|
|
|
+ "selectorArea": "#" + id + "viewParameterTimeOnlyFormulaSelector",
|
|
|
"input": this.valueTimeInput
|
|
"input": this.valueTimeInput
|
|
|
},
|
|
},
|
|
|
"numberValue": {
|
|
"numberValue": {
|
|
@@ -439,10 +446,10 @@ MWF.xApplication.query.StatementDesigner.widget.ViewFilter = new Class({
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
var formulaSelectorIdList = [
|
|
var formulaSelectorIdList = [
|
|
|
- "#" + id + "viewFilterTextFormulaSelector",
|
|
|
|
|
- "#" + id + "viewFilterDateFormulaSelector",
|
|
|
|
|
- "#" + id + "viewFilterDateOnlyFormulaSelector",
|
|
|
|
|
- "#" + id + "viewFilterTimeOnlyFormulaSelector"
|
|
|
|
|
|
|
+ "#" + id + "viewParameterTextFormulaSelector",
|
|
|
|
|
+ "#" + id + "viewParameterDateFormulaSelector",
|
|
|
|
|
+ "#" + id + "viewParameterDateOnlyFormulaSelector",
|
|
|
|
|
+ "#" + id + "viewParameterTimeOnlyFormulaSelector"
|
|
|
];
|
|
];
|
|
|
|
|
|
|
|
var inputList = [
|
|
var inputList = [
|
|
@@ -516,15 +523,19 @@ MWF.xApplication.query.StatementDesigner.widget.ViewFilter = new Class({
|
|
|
},
|
|
},
|
|
|
modifyOrAddFilterItem: function () {
|
|
modifyOrAddFilterItem: function () {
|
|
|
var flag;
|
|
var flag;
|
|
|
- if (this.currentFilterItem) {
|
|
|
|
|
|
|
+ var type;
|
|
|
|
|
+ if (this.currentItem) {
|
|
|
flag = this.modifyFilterItem();
|
|
flag = this.modifyFilterItem();
|
|
|
} else {
|
|
} else {
|
|
|
- if( this.options.withForm ){
|
|
|
|
|
- flag = this.addFilterItemWithForm();
|
|
|
|
|
- }else if (this.restrictFilterInput.checked) {
|
|
|
|
|
|
|
+ if( this.restrictFilterInput && this.restrictFilterInput.checked ){ //this.options.withForm this.restrictParameterInput
|
|
|
flag = this.addFilterItem();
|
|
flag = this.addFilterItem();
|
|
|
|
|
+ type = "filter"
|
|
|
|
|
+ }else if ( this.restrictParameterInput && this.restrictParameterInput.checked) {
|
|
|
|
|
+ flag = this.addParameterItem();
|
|
|
|
|
+ type = "parameter"
|
|
|
} else {
|
|
} else {
|
|
|
flag = this.addCustomFilterItem();
|
|
flag = this.addCustomFilterItem();
|
|
|
|
|
+ type = "custom"
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
if( flag ){
|
|
if( flag ){
|
|
@@ -533,7 +544,7 @@ MWF.xApplication.query.StatementDesigner.widget.ViewFilter = new Class({
|
|
|
"path": "",
|
|
"path": "",
|
|
|
"parameter" : "",
|
|
"parameter" : "",
|
|
|
"title": "",
|
|
"title": "",
|
|
|
- "type": this.restrictFilterInput.checked ? "restrict" : "custom",
|
|
|
|
|
|
|
+ "type": type,
|
|
|
"comparison": "equals",
|
|
"comparison": "equals",
|
|
|
"formatType": "textValue",
|
|
"formatType": "textValue",
|
|
|
"value": "",
|
|
"value": "",
|
|
@@ -544,34 +555,34 @@ MWF.xApplication.query.StatementDesigner.widget.ViewFilter = new Class({
|
|
|
},
|
|
},
|
|
|
modifyFilterItem: function () {
|
|
modifyFilterItem: function () {
|
|
|
var data = this.getInputData();
|
|
var data = this.getInputData();
|
|
|
- if( this.options.withForm ){
|
|
|
|
|
|
|
+ if( this.restrictFilterInput && this.restrictFilterInput.checked ){ //this.options.withForm
|
|
|
if (this.verificationDataWithForm(data)) {
|
|
if (this.verificationDataWithForm(data)) {
|
|
|
- this.currentFilterItem.reload(data);
|
|
|
|
|
- this.currentFilterItem.unSelected();
|
|
|
|
|
|
|
+ this.currentItem.reload(data);
|
|
|
|
|
+ this.currentItem.unSelected();
|
|
|
this.fireEvent("change");
|
|
this.fireEvent("change");
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
- }else if( this.restrictFilterInput.checked ){
|
|
|
|
|
|
|
+ }else if( this.restrictParameterInput && this.restrictParameterInput.checked ){
|
|
|
if (this.verificationData(data)) {
|
|
if (this.verificationData(data)) {
|
|
|
- this.currentFilterItem.reload(data);
|
|
|
|
|
- this.currentFilterItem.unSelected();
|
|
|
|
|
|
|
+ this.currentItem.reload(data);
|
|
|
|
|
+ this.currentItem.unSelected();
|
|
|
this.fireEvent("change");
|
|
this.fireEvent("change");
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
}else{
|
|
}else{
|
|
|
if (this.verificationDataCustom(data)) {
|
|
if (this.verificationDataCustom(data)) {
|
|
|
- this.currentFilterItem.reload(data);
|
|
|
|
|
- this.currentFilterItem.unSelected();
|
|
|
|
|
|
|
+ this.currentItem.reload(data);
|
|
|
|
|
+ this.currentItem.unSelected();
|
|
|
this.fireEvent("change");
|
|
this.fireEvent("change");
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
return false;
|
|
return false;
|
|
|
},
|
|
},
|
|
|
- addFilterItem: function () {
|
|
|
|
|
|
|
+ addParameterItem: function () {
|
|
|
var data = this.getInputData();
|
|
var data = this.getInputData();
|
|
|
if (this.verificationData(data)) {
|
|
if (this.verificationData(data)) {
|
|
|
- this.items.push(new MWF.xApplication.query.StatementDesigner.widget.ViewFilter.Item(this, data));
|
|
|
|
|
|
|
+ this.items.push(new MWF.xApplication.query.StatementDesigner.widget.ViewFilter.ItemParameter(this, data));
|
|
|
this.fireEvent("change");
|
|
this.fireEvent("change");
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
@@ -586,10 +597,10 @@ MWF.xApplication.query.StatementDesigner.widget.ViewFilter = new Class({
|
|
|
}
|
|
}
|
|
|
return false;
|
|
return false;
|
|
|
},
|
|
},
|
|
|
- addFilterItemWithForm : function(){
|
|
|
|
|
|
|
+ addFilterItem : function(){
|
|
|
var data = this.getInputData();
|
|
var data = this.getInputData();
|
|
|
if (this.verificationDataWithForm(data)) {
|
|
if (this.verificationDataWithForm(data)) {
|
|
|
- this.items.push(new MWF.xApplication.query.StatementDesigner.widget.ViewFilter.ItemWithForm(this, data));
|
|
|
|
|
|
|
+ this.items.push(new MWF.xApplication.query.StatementDesigner.widget.ViewFilter.ItemFilter(this, data));
|
|
|
this.fireEvent("change");
|
|
this.fireEvent("change");
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
@@ -746,8 +757,11 @@ MWF.xApplication.query.StatementDesigner.widget.ViewFilter = new Class({
|
|
|
var parameter = this.parameterInput ? this.parameterInput.get("value") : "";
|
|
var parameter = this.parameterInput ? this.parameterInput.get("value") : "";
|
|
|
|
|
|
|
|
var title = this.titleInput.get("value");
|
|
var title = this.titleInput.get("value");
|
|
|
- if (this.restrictFilterInput.checked) var type = "restrict";
|
|
|
|
|
- if (this.customFilterInput.checked) var type = "custom";
|
|
|
|
|
|
|
+
|
|
|
|
|
+ var type = "custom";
|
|
|
|
|
+ if ( this.restrictFilterInput && this.restrictFilterInput.checked) type = "filter";
|
|
|
|
|
+ if ( this.restrictParameterInput && this.restrictParameterInput.checked) type = "parameter";
|
|
|
|
|
+ if (this.customFilterInput.checked) type = "custom";
|
|
|
|
|
|
|
|
// var comparison = this.comparisonInput.options[this.comparisonInput.selectedIndex].value;
|
|
// var comparison = this.comparisonInput.options[this.comparisonInput.selectedIndex].value;
|
|
|
var comparison = "";
|
|
var comparison = "";
|
|
@@ -796,7 +810,7 @@ MWF.xApplication.query.StatementDesigner.widget.ViewFilter = new Class({
|
|
|
//}
|
|
//}
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
- if (this.options.withForm ) {
|
|
|
|
|
|
|
+ if ( type === "filter" ) { //this.options.withForm
|
|
|
return {
|
|
return {
|
|
|
// "logic": "and",
|
|
// "logic": "and",
|
|
|
"path": path,
|
|
"path": path,
|
|
@@ -808,8 +822,8 @@ MWF.xApplication.query.StatementDesigner.widget.ViewFilter = new Class({
|
|
|
"otherValue": value2,
|
|
"otherValue": value2,
|
|
|
"code": this.scriptData
|
|
"code": this.scriptData
|
|
|
};
|
|
};
|
|
|
- }else if (type === "restrict") {
|
|
|
|
|
- this.filterValueType.each(function (radio) {
|
|
|
|
|
|
|
+ }else if (type === "parameter") {
|
|
|
|
|
+ this.parameterValueType.each(function (radio) {
|
|
|
if (radio.get("checked")) valueType = radio.get("value");
|
|
if (radio.get("checked")) valueType = radio.get("value");
|
|
|
});
|
|
});
|
|
|
return {
|
|
return {
|
|
@@ -823,7 +837,7 @@ MWF.xApplication.query.StatementDesigner.widget.ViewFilter = new Class({
|
|
|
//"otherValue": value2,
|
|
//"otherValue": value2,
|
|
|
"code": this.scriptData,
|
|
"code": this.scriptData,
|
|
|
"valueType": valueType,
|
|
"valueType": valueType,
|
|
|
- "valueScript": this.filterValueScriptData
|
|
|
|
|
|
|
+ "valueScript": this.parameterValueScriptData
|
|
|
};
|
|
};
|
|
|
} else {
|
|
} else {
|
|
|
var valueType = "";
|
|
var valueType = "";
|
|
@@ -894,9 +908,7 @@ MWF.xApplication.query.StatementDesigner.widget.ViewFilter = new Class({
|
|
|
} catch (e) {
|
|
} catch (e) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if( this.options.withForm ){
|
|
|
|
|
- this.switchInputDisplay();
|
|
|
|
|
- }else{
|
|
|
|
|
|
|
+ if (data.type === "parameter"){
|
|
|
switch (data.formatType) {
|
|
switch (data.formatType) {
|
|
|
case "textValue":
|
|
case "textValue":
|
|
|
this.valueTextInput.set("value", data.value);
|
|
this.valueTextInput.set("value", data.value);
|
|
@@ -933,66 +945,52 @@ MWF.xApplication.query.StatementDesigner.widget.ViewFilter = new Class({
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- //if (this.valueBooleanInput2){
|
|
|
|
|
- // for (var i=0; i<this.valueBooleanInput2.options.length; i++){
|
|
|
|
|
- // var v = this.valueBooleanInput2.options[i].value;
|
|
|
|
|
- // if (v=="true"){
|
|
|
|
|
- // v = true;
|
|
|
|
|
- // }else{
|
|
|
|
|
- // v = false;
|
|
|
|
|
- // }
|
|
|
|
|
- // if (v===data.otherValue){
|
|
|
|
|
- // this.valueBooleanInput2.options[i].set("selected", true);
|
|
|
|
|
- // break;
|
|
|
|
|
- // }
|
|
|
|
|
- // }
|
|
|
|
|
- //}
|
|
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- if (data.type === "custom") {
|
|
|
|
|
- this.customFilterValueTypes.each(function (radio) {
|
|
|
|
|
- if (data.valueType) {
|
|
|
|
|
- if (data.valueType === radio.get("value")) radio.set("checked", true);
|
|
|
|
|
- } else {
|
|
|
|
|
- if ("input" === radio.get("value")) radio.set("checked", true);
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- if (this.customFilterValueScriptArea) {
|
|
|
|
|
- if (!data.valueType || data.valueType === "input") {
|
|
|
|
|
- this.customFilterValueScriptDiv.hide();
|
|
|
|
|
- this.customFilterValueScriptData = "";
|
|
|
|
|
- this.customFilterValueScriptArea.editor.setValue("");
|
|
|
|
|
- } else {
|
|
|
|
|
- this.customFilterValueScriptDiv.show();
|
|
|
|
|
- this.customFilterValueScriptData = data.valueScript;
|
|
|
|
|
- this.customFilterValueScriptArea.editor.setValue(data.valueScript ? data.valueScript.code : "");
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (data.type === "custom") {
|
|
|
|
|
+ this.customFilterValueTypes.each(function (radio) {
|
|
|
|
|
+ if (data.valueType) {
|
|
|
|
|
+ if (data.valueType === radio.get("value")) radio.set("checked", true);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if ("input" === radio.get("value")) radio.set("checked", true);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ if (this.customFilterValueScriptArea) {
|
|
|
|
|
+ if (!data.valueType || data.valueType === "input") {
|
|
|
|
|
+ this.customFilterValueScriptDiv.hide();
|
|
|
|
|
+ this.customFilterValueScriptData = "";
|
|
|
|
|
+ this.customFilterValueScriptArea.editor.setValue("");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.customFilterValueScriptDiv.show();
|
|
|
|
|
+ this.customFilterValueScriptData = data.valueScript;
|
|
|
|
|
+ this.customFilterValueScriptArea.editor.setValue(data.valueScript ? data.valueScript.code : "");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- if (data.type === "restrict") {
|
|
|
|
|
- this.filterValueType.each(function (radio) {
|
|
|
|
|
- if (data.valueType) {
|
|
|
|
|
- if (data.valueType === radio.get("value")) radio.set("checked", true);
|
|
|
|
|
- } else {
|
|
|
|
|
- if ("input" === radio.get("value")) radio.set("checked", true);
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- if (this.filterValueScriptArea) {
|
|
|
|
|
- if (!data.valueType || data.valueType === "input") {
|
|
|
|
|
- this.filterValueScriptDiv.hide();
|
|
|
|
|
- this.filterValueScriptData = "";
|
|
|
|
|
- this.filterValueScriptArea.editor.setValue("");
|
|
|
|
|
- } else {
|
|
|
|
|
- this.filterValueScriptDiv.show();
|
|
|
|
|
- this.filterValueScriptData = data.valueScript;
|
|
|
|
|
- this.filterValueScriptArea.editor.setValue(data.valueScript ? data.valueScript.code : "");
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (data.type === "parameter") {
|
|
|
|
|
+ this.parameterValueType.each(function (radio) {
|
|
|
|
|
+ if (data.valueType) {
|
|
|
|
|
+ if (data.valueType === radio.get("value")) radio.set("checked", true);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if ("input" === radio.get("value")) radio.set("checked", true);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ if (this.parameterValueScriptArea) {
|
|
|
|
|
+ if (!data.valueType || data.valueType === "input") {
|
|
|
|
|
+ this.parameterValueScriptDiv.hide();
|
|
|
|
|
+ this.parameterValueScriptData = "";
|
|
|
|
|
+ this.parameterValueScriptArea.editor.setValue("");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.parameterValueScriptDiv.show();
|
|
|
|
|
+ this.parameterValueScriptData = data.valueScript;
|
|
|
|
|
+ this.parameterValueScriptArea.editor.setValue(data.valueScript ? data.valueScript.code : "");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- this.switchInputDisplay();
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+ this.switchInputDisplay();
|
|
|
|
|
|
|
|
if (this.datatypeInput.onchange) {
|
|
if (this.datatypeInput.onchange) {
|
|
|
this.datatypeInput.onchange();
|
|
this.datatypeInput.onchange();
|
|
@@ -1000,32 +998,35 @@ MWF.xApplication.query.StatementDesigner.widget.ViewFilter = new Class({
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
deleteItem: function (item) {
|
|
deleteItem: function (item) {
|
|
|
- if (this.currentFilterItem == item) item.unSelected();
|
|
|
|
|
|
|
+ if (this.currentItem == item) item.unSelected();
|
|
|
this.items.erase(item);
|
|
this.items.erase(item);
|
|
|
item.node.destroy();
|
|
item.node.destroy();
|
|
|
MWF.release(item);
|
|
MWF.release(item);
|
|
|
this.fireEvent("change");
|
|
this.fireEvent("change");
|
|
|
},
|
|
},
|
|
|
getData: function () {
|
|
getData: function () {
|
|
|
- var data = [];
|
|
|
|
|
|
|
+ var parameterData = [];
|
|
|
var customData = [];
|
|
var customData = [];
|
|
|
|
|
+ var filterData = [];
|
|
|
this.items.each(function (item) {
|
|
this.items.each(function (item) {
|
|
|
if (item.data.type === "custom") {
|
|
if (item.data.type === "custom") {
|
|
|
customData.push(item.data);
|
|
customData.push(item.data);
|
|
|
|
|
+ }else if (item.data.type === "filter") {
|
|
|
|
|
+ filterData.push(item.data);
|
|
|
} else {
|
|
} else {
|
|
|
- data.push(item.data);
|
|
|
|
|
|
|
+ parameterData.push(item.data);
|
|
|
}
|
|
}
|
|
|
}.bind(this));
|
|
}.bind(this));
|
|
|
- return {"data": data, "customData": customData};
|
|
|
|
|
|
|
+ return {"parameterData": parameterData, "customData": customData, "filterData" : filterData };
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
-MWF.xApplication.query.StatementDesigner.widget.ViewFilter.Item = new Class({
|
|
|
|
|
|
|
+MWF.xApplication.query.StatementDesigner.widget.ViewFilter.ItemParameter = new Class({
|
|
|
Implements: [Events],
|
|
Implements: [Events],
|
|
|
initialize: function (filter, data) {
|
|
initialize: function (filter, data) {
|
|
|
this.filter = filter;
|
|
this.filter = filter;
|
|
|
this.data = data;
|
|
this.data = data;
|
|
|
- this.container = this.filter.listAreaNode;
|
|
|
|
|
|
|
+ this.container = this.filter.parameterListAreaNode;
|
|
|
this.css = this.filter.css;
|
|
this.css = this.filter.css;
|
|
|
this.app = this.filter.app;
|
|
this.app = this.filter.app;
|
|
|
this.load();
|
|
this.load();
|
|
@@ -1062,17 +1063,16 @@ MWF.xApplication.query.StatementDesigner.widget.ViewFilter.Item = new Class({
|
|
|
this.filter.verificationNode = null;
|
|
this.filter.verificationNode = null;
|
|
|
this.filter.parameterInput.setStyle("background-color", "#FFF");
|
|
this.filter.parameterInput.setStyle("background-color", "#FFF");
|
|
|
}
|
|
}
|
|
|
- this.filter.restrictFilterInput.set("checked", true);
|
|
|
|
|
- this.filter.restrictFilterInput.click();
|
|
|
|
|
- if (this.filter.currentFilterItem) this.filter.currentFilterItem.unSelected();
|
|
|
|
|
|
|
+ this.filter.restrictParameterInput.set("checked", true);
|
|
|
|
|
+ this.filter.restrictParameterInput.click();
|
|
|
|
|
+ if (this.filter.currentItem) this.filter.currentItem.unSelected();
|
|
|
this.node.setStyles(this.css.itemNode_current);
|
|
this.node.setStyles(this.css.itemNode_current);
|
|
|
- this.filter.currentFilterItem = this;
|
|
|
|
|
|
|
+ this.filter.currentItem = this;
|
|
|
this.filter.setData(this.data);
|
|
this.filter.setData(this.data);
|
|
|
},
|
|
},
|
|
|
unSelected: function () {
|
|
unSelected: function () {
|
|
|
this.node.setStyles(this.css.itemNode);
|
|
this.node.setStyles(this.css.itemNode);
|
|
|
- this.filter.currentFilterItem = null;
|
|
|
|
|
- this.filter.currentItem = this;
|
|
|
|
|
|
|
+ this.filter.currentItem = null;
|
|
|
},
|
|
},
|
|
|
deleteItem: function (e) {
|
|
deleteItem: function (e) {
|
|
|
var _self = this;
|
|
var _self = this;
|
|
@@ -1089,11 +1089,11 @@ MWF.xApplication.query.StatementDesigner.widget.ViewFilter.Item = new Class({
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
MWF.xApplication.query.StatementDesigner.widget.ViewFilter.ItemCustom = new Class({
|
|
MWF.xApplication.query.StatementDesigner.widget.ViewFilter.ItemCustom = new Class({
|
|
|
- Extends: MWF.xApplication.query.StatementDesigner.widget.ViewFilter.Item,
|
|
|
|
|
|
|
+ Extends: MWF.xApplication.query.StatementDesigner.widget.ViewFilter.ItemParameter,
|
|
|
initialize: function (filter, data) {
|
|
initialize: function (filter, data) {
|
|
|
this.filter = filter;
|
|
this.filter = filter;
|
|
|
this.data = data;
|
|
this.data = data;
|
|
|
- this.container = this.filter.fieldListAreaNode;
|
|
|
|
|
|
|
+ this.container = this.filter.customFilterListAreaNode;
|
|
|
this.css = this.filter.css;
|
|
this.css = this.filter.css;
|
|
|
this.app = this.filter.app;
|
|
this.app = this.filter.app;
|
|
|
this.load();
|
|
this.load();
|
|
@@ -1104,11 +1104,11 @@ MWF.xApplication.query.StatementDesigner.widget.ViewFilter.ItemCustom = new Clas
|
|
|
this.filter.verificationNode = null;
|
|
this.filter.verificationNode = null;
|
|
|
this.filter.pathInput.setStyle("background-color", "#FFF");
|
|
this.filter.pathInput.setStyle("background-color", "#FFF");
|
|
|
}
|
|
}
|
|
|
- this.filter.customFilterInput.set("checked", true);
|
|
|
|
|
- this.filter.customFilterInput.click();
|
|
|
|
|
- if (this.filter.currentFilterItem) this.filter.currentFilterItem.unSelected();
|
|
|
|
|
|
|
+ this.filter.customFilterInput.set("checked", true);
|
|
|
|
|
+ this.filter.customFilterInput.click();
|
|
|
|
|
+ if (this.filter.currentItem) this.filter.currentItem.unSelected();
|
|
|
this.node.setStyles(this.css.itemNode_current);
|
|
this.node.setStyles(this.css.itemNode_current);
|
|
|
- this.filter.currentFilterItem = this;
|
|
|
|
|
|
|
+ this.filter.currentItem = this;
|
|
|
this.filter.setData(this.data);
|
|
this.filter.setData(this.data);
|
|
|
},
|
|
},
|
|
|
getText: function () {
|
|
getText: function () {
|
|
@@ -1117,12 +1117,12 @@ MWF.xApplication.query.StatementDesigner.widget.ViewFilter.ItemCustom = new Clas
|
|
|
},
|
|
},
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
-MWF.xApplication.query.StatementDesigner.widget.ViewFilter.ItemWithForm = new Class({
|
|
|
|
|
- Extends: MWF.xApplication.query.StatementDesigner.widget.ViewFilter.Item,
|
|
|
|
|
|
|
+MWF.xApplication.query.StatementDesigner.widget.ViewFilter.ItemFilter = new Class({
|
|
|
|
|
+ Extends: MWF.xApplication.query.StatementDesigner.widget.ViewFilter.ItemParameter,
|
|
|
initialize: function (filter, data) {
|
|
initialize: function (filter, data) {
|
|
|
this.filter = filter;
|
|
this.filter = filter;
|
|
|
this.data = data;
|
|
this.data = data;
|
|
|
- this.container = this.filter.listAreaNode;
|
|
|
|
|
|
|
+ this.container = this.filter.filterListAreaNode;
|
|
|
this.css = this.filter.css;
|
|
this.css = this.filter.css;
|
|
|
this.app = this.filter.app;
|
|
this.app = this.filter.app;
|
|
|
this.load();
|
|
this.load();
|
|
@@ -1133,11 +1133,11 @@ MWF.xApplication.query.StatementDesigner.widget.ViewFilter.ItemWithForm = new Cl
|
|
|
this.filter.verificationNode = null;
|
|
this.filter.verificationNode = null;
|
|
|
this.filter.pathInput.setStyle("background-color", "#FFF");
|
|
this.filter.pathInput.setStyle("background-color", "#FFF");
|
|
|
}
|
|
}
|
|
|
- // this.filter.customFilterInput.set("checked", true);
|
|
|
|
|
- // this.filter.customFilterInput.click();
|
|
|
|
|
- if (this.filter.currentFilterItem) this.filter.currentFilterItem.unSelected();
|
|
|
|
|
|
|
+ this.filter.restrictFilterInput.set("checked", true);
|
|
|
|
|
+ this.filter.restrictFilterInput.click();
|
|
|
|
|
+ if (this.filter.currentItem) this.filter.currentItem.unSelected();
|
|
|
this.node.setStyles(this.css.itemNode_current);
|
|
this.node.setStyles(this.css.itemNode_current);
|
|
|
- this.filter.currentFilterItem = this;
|
|
|
|
|
|
|
+ this.filter.currentItem = this;
|
|
|
this.filter.setData(this.data);
|
|
this.filter.setData(this.data);
|
|
|
},
|
|
},
|
|
|
getText: function () {
|
|
getText: function () {
|