2011-10-31 20:14:05 -04:00
|
|
|
Ext.namespace("dashletInstance");
|
|
|
|
|
|
|
|
|
|
dashletInstance.form = {
|
|
|
|
|
init: function () {
|
|
|
|
|
dashletInstanceSaveProcessAjax = function () {
|
|
|
|
|
var myMask = new Ext.LoadMask(Ext.getBody(), {msg: "Saving. Please wait..."});
|
|
|
|
|
myMask.show();
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
Ext.Ajax.request({
|
|
|
|
|
url: "saveDashletInstance",
|
|
|
|
|
method: "POST",
|
2011-11-10 16:39:14 -04:00
|
|
|
params: dashletInstanceFrm.getForm().getFieldValues(),
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
success:function (result, request) {
|
|
|
|
|
myMask.hide();
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
var dataResponse = Ext.util.JSON.decode(result.responseText)
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
switch (dataResponse.status) {
|
2011-11-15 09:47:38 -04:00
|
|
|
case "OK": window.location.href = "dashletsList";
|
2011-10-31 20:50:23 -04:00
|
|
|
break;
|
|
|
|
|
default: Ext.MessageBox.alert("Alert", "Dashboard Instance registered failed");
|
|
|
|
|
break;
|
2011-10-31 20:14:05 -04:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
failure:function (result, request) {
|
|
|
|
|
myMask.hide();
|
|
|
|
|
Ext.MessageBox.alert("Alert", "Ajax communication failed");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
//------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
var storeDasUID = new Ext.data.Store({
|
|
|
|
|
proxy: new Ext.data.HttpProxy({
|
2011-11-09 18:56:59 -04:00
|
|
|
url: "getDashlets",
|
2011-10-31 20:14:05 -04:00
|
|
|
method: "POST"
|
|
|
|
|
}),
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
baseParams: {"option": "DASHLST"},
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
reader: new Ext.data.JsonReader({
|
2011-11-09 18:56:59 -04:00
|
|
|
totalProperty: "total",
|
|
|
|
|
root: "dashlets",
|
2011-10-31 20:14:05 -04:00
|
|
|
fields:[{name: "DAS_UID", type: "string"},
|
|
|
|
|
{name: "DAS_TITLE", type: "string"}
|
|
|
|
|
]
|
|
|
|
|
}),
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
autoLoad: true, //First call
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
listeners: {
|
|
|
|
|
load: function (store, record, option) {
|
|
|
|
|
cboDasUID.setValue(store.getAt(0).get(cboDasUID.valueField));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
var storeDasInsType = new Ext.data.ArrayStore({
|
2011-11-15 09:47:38 -04:00
|
|
|
idIndex: 0,
|
2011-10-31 20:14:05 -04:00
|
|
|
fields: ["id", "value"],
|
|
|
|
|
data: [["OPEN_CASES", "Open Cases"]
|
|
|
|
|
]
|
|
|
|
|
});
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
var storeDasInsContextTime = new Ext.data.ArrayStore({
|
|
|
|
|
idIndex: 0,
|
|
|
|
|
fields: ["id", "value"],
|
|
|
|
|
data: [//["RANGE", "Date Ranges"],
|
2011-10-31 21:29:55 -04:00
|
|
|
["TODAY", "Today"],
|
|
|
|
|
["YESTERDAY", "Yesterday"],
|
|
|
|
|
["THIS_WEEK", "This Week"],
|
|
|
|
|
["PREVIOUS_WEEK", "Previous Week"],
|
|
|
|
|
["THIS_MONTH", "This Month"],
|
|
|
|
|
["PREVIOUS_MONTH", "Previous Month"],
|
2011-10-31 23:31:25 -04:00
|
|
|
//["THIS_QUARTER", "This Quarter"],
|
|
|
|
|
//["PREVIOUS_QUARTER", "Previous Quarter"],
|
2011-10-31 21:29:55 -04:00
|
|
|
["THIS_YEAR", "This Year"],
|
|
|
|
|
["PREVIOUS_YEAR", "Previous Year"]
|
2011-10-31 20:14:05 -04:00
|
|
|
]
|
|
|
|
|
});
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
var storeDasInsOwnerType = new Ext.data.ArrayStore({
|
|
|
|
|
idIndex: 0,
|
|
|
|
|
fields: ["id", "value"],
|
2011-11-09 18:56:59 -04:00
|
|
|
data: [["USER", "User"],
|
|
|
|
|
["DEPARTMENT", "Department"],
|
|
|
|
|
["GROUP", "Group"]
|
2011-10-31 20:14:05 -04:00
|
|
|
]
|
|
|
|
|
});
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
var storeDasInsOwnerUID = new Ext.data.Store({
|
|
|
|
|
proxy: new Ext.data.HttpProxy({
|
2011-11-09 18:56:59 -04:00
|
|
|
url: "getOwnersByType",
|
2011-10-31 20:14:05 -04:00
|
|
|
method: "POST"
|
|
|
|
|
}),
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
reader: new Ext.data.JsonReader({
|
2011-11-09 18:56:59 -04:00
|
|
|
totalProperty: "total",
|
|
|
|
|
root: "owners",
|
|
|
|
|
fields:[{name: "OWNER_UID", type: "string"},
|
|
|
|
|
{name: "OWNER_NAME", type: "string"}
|
2011-10-31 20:14:05 -04:00
|
|
|
]
|
|
|
|
|
}),
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
autoLoad: true, //First call
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
listeners: {
|
|
|
|
|
beforeload: function (store) {
|
|
|
|
|
storeDasInsOwnerUID.baseParams = {"option": "OWNERTYPE",
|
|
|
|
|
"type": cboDasInsOwnerType.getValue()
|
|
|
|
|
};
|
|
|
|
|
},
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
load: function (store, record, option) {
|
2011-10-31 22:15:31 -04:00
|
|
|
if (dashletInstance.DAS_INS_UID) {
|
|
|
|
|
cboDasInsOwnerUID.setValue(dashletInstance.DAS_INS_OWNER_UID);
|
|
|
|
|
}
|
|
|
|
|
else {
|
2011-11-10 21:41:39 -04:00
|
|
|
if (store.getAt(0)) {
|
|
|
|
|
cboDasInsOwnerUID.setValue(store.getAt(0).get(cboDasInsOwnerUID.valueField));
|
|
|
|
|
}
|
2011-10-31 22:15:31 -04:00
|
|
|
}
|
2011-10-31 20:14:05 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
var storeProcess = new Ext.data.ArrayStore({
|
|
|
|
|
idIndex: 0,
|
|
|
|
|
fields: ["id", "value"],
|
|
|
|
|
data: [["ALL", "All"]
|
|
|
|
|
//,
|
|
|
|
|
//["SEL", "Selection"]
|
|
|
|
|
]
|
|
|
|
|
});
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
var storeTask = new Ext.data.ArrayStore({
|
|
|
|
|
idIndex: 0,
|
|
|
|
|
fields: ["id", "value"],
|
|
|
|
|
data: [["ALL", "All"]
|
|
|
|
|
//,
|
|
|
|
|
//["SEL", "Selection"]
|
|
|
|
|
]
|
|
|
|
|
});
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
//------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
var hiddenDasInsUID = new Ext.form.Hidden({
|
|
|
|
|
id: "hiddenDasInsUID",
|
2011-10-31 20:53:51 -04:00
|
|
|
name: "DAS_INS_UID"
|
2011-10-31 20:14:05 -04:00
|
|
|
});
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
var cboDasUID = new Ext.form.ComboBox({
|
|
|
|
|
id: "cboDasUID",
|
|
|
|
|
name: "DAS_UID",
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
valueField: "DAS_UID",
|
|
|
|
|
displayField: "DAS_TITLE",
|
|
|
|
|
store: storeDasUID,
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
triggerAction: "all",
|
|
|
|
|
mode: "local",
|
|
|
|
|
editable: false,
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-11-30 15:37:50 -04:00
|
|
|
width: 325,
|
2011-10-31 20:14:05 -04:00
|
|
|
fieldLabel: "Dashboard"
|
|
|
|
|
});
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
var cboDasInsType = new Ext.form.ComboBox({
|
|
|
|
|
id: "cboDasInsType",
|
|
|
|
|
name: "DAS_INS_TYPE",
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
valueField: "id",
|
|
|
|
|
displayField: "value",
|
|
|
|
|
value: "OPEN_CASES",
|
|
|
|
|
store: storeDasInsType,
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
triggerAction: "all",
|
|
|
|
|
mode: "local",
|
|
|
|
|
editable: false,
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-11-30 15:37:50 -04:00
|
|
|
width: 325,
|
2011-10-31 20:14:05 -04:00
|
|
|
fieldLabel: "Type"
|
|
|
|
|
});
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
var cboDasInsContextTime = new Ext.form.ComboBox({
|
|
|
|
|
id: "cboDasInsContextTime",
|
|
|
|
|
name: "DAS_INS_CONTEXT_TIME",
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
valueField: "id",
|
|
|
|
|
displayField: "value",
|
2011-10-31 23:26:42 -04:00
|
|
|
value: "TODAY",
|
2011-10-31 20:14:05 -04:00
|
|
|
store: storeDasInsContextTime,
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
triggerAction: "all",
|
|
|
|
|
mode: "local",
|
|
|
|
|
editable: false,
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-11-30 15:37:50 -04:00
|
|
|
width: 325,
|
2011-10-31 20:14:05 -04:00
|
|
|
fieldLabel: "Period"
|
|
|
|
|
});
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
var txtDasInsStartDate = new Ext.form.DateField({
|
|
|
|
|
id: "txtDasInsStartDate",
|
|
|
|
|
name: "DAS_INS_START_DATE",
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
value: new Date(2011, 0, 1), //january=0, february=1, etc
|
|
|
|
|
width: 100,
|
|
|
|
|
format: "Y/m/d",
|
|
|
|
|
editable: false,
|
|
|
|
|
fieldLabel: "Start Date"
|
|
|
|
|
});
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
var txtDasInsEndDate = new Ext.form.DateField({
|
|
|
|
|
id: "txtDasInsEndDate",
|
|
|
|
|
name: "DAS_INS_END_DATE",
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
value: new Date(2011, 0, 1),
|
|
|
|
|
width: 100,
|
|
|
|
|
format: "Y/m/d",
|
|
|
|
|
editable: false,
|
|
|
|
|
fieldLabel: "Finish Date"
|
|
|
|
|
});
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
var cboDasInsOwnerType = new Ext.form.ComboBox({
|
|
|
|
|
id: "cboDasInsOwnerType",
|
|
|
|
|
name: "DAS_INS_OWNER_TYPE",
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
valueField: "id",
|
|
|
|
|
displayField: "value",
|
|
|
|
|
value: "DEPARTMENT",
|
|
|
|
|
store: storeDasInsOwnerType,
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
triggerAction: "all",
|
|
|
|
|
mode: "local",
|
|
|
|
|
editable: false,
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-11-30 15:37:50 -04:00
|
|
|
width: 325,
|
2011-11-09 18:56:59 -04:00
|
|
|
fieldLabel: "Assign To",
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
listeners: {
|
|
|
|
|
select: function (combo, record, index) {
|
|
|
|
|
storeDasInsOwnerUID.baseParams = {"option": "OWNERTYPE",
|
|
|
|
|
"type": combo.getValue()
|
|
|
|
|
};
|
2011-11-14 20:16:13 -04:00
|
|
|
dashletInstance.DAS_INS_OWNER_UID = '';
|
2011-11-09 18:56:59 -04:00
|
|
|
cboDasInsOwnerUID.store.removeAll();
|
2011-11-10 21:41:39 -04:00
|
|
|
cboDasInsOwnerUID.clearValue();
|
|
|
|
|
cboDasInsOwnerUID.store.reload();
|
2011-10-31 20:14:05 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
var cboDasInsOwnerUID = new Ext.form.ComboBox({
|
|
|
|
|
id: "cboDasInsOwnerUID",
|
|
|
|
|
name: "DAS_INS_OWNER_UID",
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-11-09 18:56:59 -04:00
|
|
|
valueField: "OWNER_UID",
|
|
|
|
|
displayField: "OWNER_NAME",
|
2011-10-31 20:14:05 -04:00
|
|
|
store: storeDasInsOwnerUID,
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
triggerAction: "all",
|
|
|
|
|
mode: "local",
|
|
|
|
|
editable: false,
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-11-30 15:37:50 -04:00
|
|
|
width: 325,
|
2011-11-10 21:41:39 -04:00
|
|
|
fieldLabel: "Name",
|
|
|
|
|
allowBlank: false
|
2011-10-31 20:14:05 -04:00
|
|
|
});
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
var cboProcess = new Ext.form.ComboBox({
|
|
|
|
|
id: "cboProcess",
|
|
|
|
|
name: "DAS_INS_PROCESSES",
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
valueField: "id",
|
|
|
|
|
displayField: "value",
|
|
|
|
|
value: "ALL",
|
|
|
|
|
store: storeProcess,
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
triggerAction: "all",
|
|
|
|
|
mode: "local",
|
|
|
|
|
editable: false,
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-11-30 15:37:50 -04:00
|
|
|
width: 325,
|
2011-10-31 20:14:05 -04:00
|
|
|
fieldLabel: "Process"
|
|
|
|
|
});
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
var cboTask = new Ext.form.ComboBox({
|
|
|
|
|
id: "cboTask",
|
|
|
|
|
name: "DAS_INS_TASKS",
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
valueField: "id",
|
|
|
|
|
displayField: "value",
|
|
|
|
|
value: "ALL",
|
|
|
|
|
store: storeTask,
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
triggerAction: "all",
|
|
|
|
|
mode: "local",
|
|
|
|
|
editable: false,
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-11-30 15:37:50 -04:00
|
|
|
width: 325,
|
2011-10-31 20:14:05 -04:00
|
|
|
fieldLabel: "Task"
|
|
|
|
|
});
|
2011-10-31 23:26:42 -04:00
|
|
|
|
2011-12-01 12:18:44 -04:00
|
|
|
var sliderMaxValue = 100;
|
|
|
|
|
var sliderValue = [];
|
|
|
|
|
|
|
|
|
|
var additionalFieldName = [];
|
|
|
|
|
var additionalFieldN = additionaFields.length;
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i <= additionalFieldN - 1; i++) {
|
|
|
|
|
additionalFieldName[i] = additionaFields[i].name;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i <= (additionalFieldN / 2) - 1; i++) {
|
|
|
|
|
sliderValue[i] = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var sliderRangeColor = new Ext.slider.MultiSlider({
|
|
|
|
|
//renderTo: "id",
|
|
|
|
|
|
|
|
|
|
fieldLabel: "Range Of Colors",
|
|
|
|
|
|
|
|
|
|
width: 325,
|
|
|
|
|
minValue: 0,
|
|
|
|
|
maxValue: sliderMaxValue,
|
|
|
|
|
values: sliderValue,
|
|
|
|
|
plugins: new Ext.slider.Tip(),
|
|
|
|
|
|
|
|
|
|
listeners:{
|
|
|
|
|
//changecomplete(Ext.slider.MultiSlider slider, Number newValue, Ext.slider.Thumb thumb)
|
|
|
|
|
changecomplete: function (slider, newValue, thumb) {
|
|
|
|
|
var sliderAux = slider.getValues();
|
|
|
|
|
var index = 0;
|
|
|
|
|
var sw = 0;
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i <= sliderAux.length - 1 && sw == 0; i++) {
|
|
|
|
|
if (sliderAux[i] == newValue) {
|
|
|
|
|
index = i;
|
|
|
|
|
sw = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dashletInstanceFrm.getForm().findField(additionalFieldName[(index * 2) + 1]).setValue(newValue);
|
|
|
|
|
|
|
|
|
|
if (index < (additionalFieldN / 2) - 1) {
|
|
|
|
|
dashletInstanceFrm.getForm().findField(additionalFieldName[(index * 2) + 1 + 1]).setValue(newValue);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
var formFields = [
|
|
|
|
|
new Ext.form.FieldSet({
|
|
|
|
|
title: "Setting",
|
|
|
|
|
items:[hiddenDasInsUID,
|
|
|
|
|
cboDasUID,
|
|
|
|
|
cboDasInsType,
|
|
|
|
|
cboDasInsContextTime,
|
|
|
|
|
//txtDasInsStartDate,
|
|
|
|
|
//txtDasInsEndDate,
|
|
|
|
|
cboDasInsOwnerType,
|
|
|
|
|
cboDasInsOwnerUID
|
|
|
|
|
//,
|
|
|
|
|
//cboProcess,
|
|
|
|
|
//cboTask,
|
|
|
|
|
]
|
|
|
|
|
})
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
formFields = formFields.concat([
|
|
|
|
|
new Ext.form.FieldSet({
|
|
|
|
|
title: "Configuration",
|
|
|
|
|
items:[sliderRangeColor,
|
|
|
|
|
additionaFields
|
|
|
|
|
]
|
|
|
|
|
})
|
|
|
|
|
]);
|
2011-11-10 16:39:14 -04:00
|
|
|
|
2011-10-31 20:14:05 -04:00
|
|
|
//------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
var dashletInstanceFrm = new Ext.form.FormPanel({
|
|
|
|
|
id: "dashletInstanceFrm",
|
2011-11-30 15:37:50 -04:00
|
|
|
labelWidth: 100,
|
2011-10-31 20:14:05 -04:00
|
|
|
border: true,
|
2011-12-01 12:18:44 -04:00
|
|
|
width: 465,
|
2011-11-15 09:47:38 -04:00
|
|
|
frame: true,
|
2011-11-30 15:37:50 -04:00
|
|
|
title: "Dashlet Instance Configuration",
|
2011-11-10 16:39:14 -04:00
|
|
|
items: formFields,
|
2011-10-31 20:14:05 -04:00
|
|
|
buttonAlign: "right",
|
|
|
|
|
buttons: [new Ext.Action({
|
|
|
|
|
id: "btnSubmit",
|
|
|
|
|
text: "Save",
|
|
|
|
|
handler: function () {
|
2011-11-10 21:41:39 -04:00
|
|
|
if (dashletInstanceFrm.getForm().isValid()) {
|
|
|
|
|
dashletInstanceSaveProcessAjax();
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
Ext.MessageBox.alert('Invalid data', 'Please check the fields mark in red.');
|
|
|
|
|
}
|
2011-10-31 20:14:05 -04:00
|
|
|
}
|
|
|
|
|
}),
|
|
|
|
|
{xtype: "button",
|
|
|
|
|
id: "btnCancel",
|
|
|
|
|
text: "Cancel",
|
|
|
|
|
handler: function () {
|
2011-10-31 20:31:27 -04:00
|
|
|
window.location.href = "dashletsList";
|
2011-10-31 20:14:05 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
});
|
2011-12-01 12:18:44 -04:00
|
|
|
|
2011-11-10 16:39:14 -04:00
|
|
|
dashletInstanceFrm.getForm().setValues(dashletInstance);
|
2011-12-01 12:18:44 -04:00
|
|
|
|
|
|
|
|
///////
|
|
|
|
|
var frm = dashletInstanceFrm.getForm();
|
|
|
|
|
var n = additionalFieldN / 2;
|
|
|
|
|
|
|
|
|
|
if (dashletInstance.DAS_INS_UID) {
|
|
|
|
|
for (var i = 0; i <= n - 1; i++) {
|
|
|
|
|
//setValue(Number index, Number value, Boolean animate)
|
|
|
|
|
sliderRangeColor.setValue(i, frm.findField(additionalFieldName[(i * 2) + 1]).getValue(), true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
var range = parseInt(sliderMaxValue / n);
|
|
|
|
|
var r = range;
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i <= n - 1; i++) {
|
|
|
|
|
sliderRangeColor.setValue(i, r, true);
|
|
|
|
|
|
|
|
|
|
frm.findField(additionalFieldName[(i * 2) + 1 - 1]).setValue(r - range);
|
|
|
|
|
frm.findField(additionalFieldName[(i * 2) + 1]).setValue(r);
|
|
|
|
|
|
|
|
|
|
r = r + range;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sliderRangeColor.setValue(n - 1, sliderMaxValue, true);
|
|
|
|
|
|
|
|
|
|
frm.findField(additionalFieldName[((n - 1) * 2) + 1]).setValue(sliderMaxValue);
|
|
|
|
|
}
|
|
|
|
|
///////
|
|
|
|
|
|
2011-11-15 09:47:38 -04:00
|
|
|
dashletInstanceFrm.render(document.body);
|
2011-10-31 20:14:05 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Ext.onReady(dashletInstance.form.init, dashletInstance.form);
|