Files
luos/workflow/engine/templates/setup/environmentSettings.js

371 lines
11 KiB
JavaScript
Raw Normal View History

2011-02-18 16:00:32 +00:00
var formSettings;
var fsSamples;
var fsNames;
var fsDates;
var fsCases;
2016-07-18 12:26:39 -04:00
var _firstName, _lastName, _uName, _dateSample;
2010-12-02 23:34:41 +00:00
var txtCasesRefreshTime;
2011-02-18 16:00:32 +00:00
Ext.onReady(function() {
2010-12-02 23:34:41 +00:00
Ext.QuickTips.init();
2011-02-18 16:00:32 +00:00
_firstName = 'John';
_lastName = 'Deere';
2016-07-18 12:26:39 -04:00
_uName = 'johndeere';
2011-02-18 16:00:32 +00:00
_dateSample = '2011-02-17 19:15:38';
2011-02-18 16:00:32 +00:00
fsSample = new Ext.form.FieldSet({
title: _('ID_SAMPLES'),
labelWidth: 250,
autoHeight: true,
frame: true,
items: [
{xtype: 'label', fieldLabel: _('IS_USER_NAME_DISPLAY_FORMAT'), id: 'lblFullName', width: 400},
{xtype: 'label', fieldLabel: _('ID_GLOBAL_DATE_FORMAT'), id: 'lblDateFormat', width: 400},
{xtype: 'label', fieldLabel: _('ID_CASE_LIST') +': '+_('ID_CASES_DATE_MASK'), id: 'lblCasesDateFormat', width: 400}//,
//{xtype: "label", fieldLabel: _("ID_CASE_LIST") + ": " +_("ID_CASES_ROW_NUMBER"), id: "lblCasesRowsList", width: 400},
//{xtype: "label", fieldLabel: _("ID_CASE_LIST") + ": " + _("ID_REFRESH_TIME_SECONDS"), id: "lblCasesRefreshTime", width: 400}
]
2011-02-18 16:00:32 +00:00
});
2011-02-18 16:00:32 +00:00
storeUsernameFormat = new Ext.data.GroupingStore({
proxy : new Ext.data.HttpProxy({
url: 'environmentSettingsAjax?request=getUserMaskList'
}),
reader : new Ext.data.JsonReader({
root: 'rows',
fields : [{name : 'id'}, {name : 'name'}]
}),
2011-02-18 16:00:32 +00:00
listeners:{
load: function(){
default_format = FORMATS.format;
i = cmbUsernameFormat.store.findExact('id', default_format, 0);
cmbUsernameFormat.setValue(cmbUsernameFormat.store.getAt(i).data.id);
cmbUsernameFormat.setRawValue(cmbUsernameFormat.store.getAt(i).data.name);
2010-12-02 23:34:41 +00:00
}
2011-02-18 16:00:32 +00:00
}
2010-12-02 23:34:41 +00:00
});
cmbUsernameFormat = new Ext.form.ComboBox({
2011-02-18 16:00:32 +00:00
fieldLabel : _('IS_USER_NAME_DISPLAY_FORMAT'),
2010-12-02 23:34:41 +00:00
hiddenName : 'userFormat',
2011-02-18 16:00:32 +00:00
store : storeUsernameFormat,
2010-12-02 23:34:41 +00:00
valueField : 'id',
displayField : 'name',
triggerAction : 'all',
2011-02-18 16:00:32 +00:00
emptyText : _('ID_SELECT'),
2010-12-02 23:34:41 +00:00
editable : false,
allowBlank : false,
width: 400,
2011-02-18 16:00:32 +00:00
allowBlankText : _('ID_ENVIRONMENT_SETTINGS_MSG_1'),
2010-12-02 23:34:41 +00:00
mode:'local',
listeners:{
afterrender:function(){
cmbUsernameFormat.store.load();
2011-02-18 16:00:32 +00:00
},
select: function ()
{
changeSettings(1);
}
2011-02-18 16:00:32 +00:00
}
});
2011-02-18 16:00:32 +00:00
storeDateFormat = new Ext.data.Store( {
proxy : new Ext.data.HttpProxy( {
url : 'environmentSettingsAjax?request=getDateFormats',
method : 'POST'
}),
reader: new Ext.data.JsonReader( {
root: 'rows',
fields: [
2011-02-18 16:00:32 +00:00
{name : 'id'},
{name : 'name'}
]
}),
listeners:{
load: function(){
default_date_format = FORMATS.dateFormat,
i = cmbDateFormat.store.findExact('id', default_date_format, 0);
cmbDateFormat.setValue(cmbDateFormat.store.getAt(i).data.id);
cmbDateFormat.setRawValue(cmbDateFormat.store.getAt(i).data.name);
2010-12-02 23:34:41 +00:00
}
}
});
cmbDateFormat = new Ext.form.ComboBox({
2011-02-18 16:00:32 +00:00
fieldLabel : _('ID_GLOBAL_DATE_FORMAT'),
2010-12-02 23:34:41 +00:00
hiddenName : 'dateFormat',
width: 330,
2011-02-18 16:00:32 +00:00
store : storeDateFormat,
2010-12-02 23:34:41 +00:00
mode: 'remote',
valueField : 'id',
displayField : 'name',
triggerAction : 'all',
2011-02-18 16:00:32 +00:00
emptyText : _('ID_SELECT'),
2010-12-02 23:34:41 +00:00
editable : false,
allowBlank : false,
2011-02-18 16:00:32 +00:00
allowBlankText : _('ID_ENVIRONMENT_SETTINGS_MSG_1'),
2010-12-02 23:34:41 +00:00
mode:'local',
listeners:{
afterrender:function(){
cmbDateFormat.store.load();
2011-02-18 16:00:32 +00:00
},
select: function ()
{
changeSettings(2);
}
2010-12-02 23:34:41 +00:00
}
});
storeCasesDateFormat = new Ext.data.Store({
2011-02-18 16:00:32 +00:00
proxy : new Ext.data.HttpProxy({
url : 'environmentSettingsAjax?request=getCasesListDateFormat',
method : 'POST'
}),
reader: new Ext.data.JsonReader({
root: 'rows',
fields: [
{name: 'id'},
{name : 'name'}
]
2010-12-02 23:34:41 +00:00
}),
listeners:{
load: function(){
default_caseslist_date_format = FORMATS.casesListDateFormat;
i = cmbCasesDateFormat.store.findExact('id', default_caseslist_date_format, 0);
cmbCasesDateFormat.setValue(cmbCasesDateFormat.store.getAt(i).data.id);
cmbCasesDateFormat.setRawValue(cmbCasesDateFormat.store.getAt(i).data.name);
}
}
2011-02-18 16:00:32 +00:00
});
cmbCasesDateFormat = new Ext.form.ComboBox({
2011-02-18 16:00:32 +00:00
fieldLabel : _('ID_CASES_DATE_MASK'),
hiddenName : 'casesListDateFormat',
width: 330,
store : storeCasesDateFormat,
2010-12-02 23:34:41 +00:00
valueField : 'id',
displayField : 'name',
triggerAction : 'all',
2011-02-18 16:00:32 +00:00
emptyText : _('ID_SELECT'),
2010-12-02 23:34:41 +00:00
editable : false,
allowBlank : false,
2011-02-18 16:00:32 +00:00
allowBlankText : _('ID_ENVIRONMENT_SETTINGS_MSG_1'),
2010-12-02 23:34:41 +00:00
mode:'local',
listeners:{
afterrender:function(){
cmbCasesDateFormat.store.load();
2011-02-18 16:00:32 +00:00
},
select: function ()
{
changeSettings(4);
}
2010-12-02 23:34:41 +00:00
}
});
storeCasesRowNumber = new Ext.data.Store({
proxy : new Ext.data.HttpProxy( {
url : 'environmentSettingsAjax?request=getCasesListRowNumber',
method : 'POST'
}),
reader: new Ext.data.JsonReader( {
root: 'rows',
fields :[
{name : 'id'},
{name : 'name'}
]
}),
listeners:{
load: function ()
{
cmbCasesRowNumber.setValue(FORMATS.casesListRowNumber + "");
}
}
2011-02-18 16:00:32 +00:00
});
2010-12-02 23:34:41 +00:00
cmbCasesRowNumber = new Ext.form.ComboBox({
2011-02-18 16:00:32 +00:00
fieldLabel : _('ID_CASES_ROW_NUMBER'),
2010-12-02 23:34:41 +00:00
hiddenName : 'casesListRowNumber',
store : storeCasesRowNumber,
2010-12-02 23:34:41 +00:00
valueField : 'id',
displayField : 'name',
triggerAction : 'all',
2011-02-18 16:00:32 +00:00
emptyText : _('ID_SELECT'),
editable : false,
2010-12-02 23:34:41 +00:00
allowBlank : false,
2011-02-18 16:00:32 +00:00
allowBlankText : _('ID_ENVIRONMENT_SETTINGS_MSG_1'),
2010-12-02 23:34:41 +00:00
mode:'local',
listeners:{
afterrender:function(){
cmbCasesRowNumber.store.load();
2011-02-18 16:00:32 +00:00
},
select: function ()
{
changeSettings(5);
}
2010-12-02 23:34:41 +00:00
}
});
txtCasesRefreshTime = new Ext.form.NumberField({
id: "txtCasesRefreshTime",
name: "txtCasesRefreshTime",
value: FORMATS.casesListRefreshTime,
fieldLabel: _("ID_REFRESH_TIME_SECONDS"),
maskRe: /^\d*$/,
enableKeyEvents: true,
2020-08-10 21:36:40 +00:00
minValue: 30,
maxValue: 14400,
listeners: {
keyup: function (txt, e)
{
changeSettings(6);
2020-01-30 16:26:32 -04:00
},
render : function(c)
{
new Ext.ToolTip({
target : c.getEl(),
listeners: {
'show': function (t) {
t.update(_("ID_REFRESH_TIME_SCOPE"));
}
}
});
}
}
});
2011-02-18 16:00:32 +00:00
fsNames = new Ext.form.FieldSet({
title: _('ID_PM_ENV_SETTINGS_USERFIELDSET_TITLE'),
labelAlign: 'right',
items: [cmbUsernameFormat]
2010-12-02 23:34:41 +00:00
});
2011-02-18 16:00:32 +00:00
fsDates = new Ext.form.FieldSet({
title: _('ID_PM_ENV_SETTINGS_REGIONFIELDSET_TITLE'),
labelAlign: 'right',
items: [cmbDateFormat]
2011-02-18 16:00:32 +00:00
});
2011-02-18 16:00:32 +00:00
fsCases = new Ext.form.FieldSet({
title: _('ID_HOME_SETTINGS'),//_('ID_PM_ENV_SETTINGS_CASESLIST_TITLE'),
labelAlign: 'right',
items: [
new Ext.form.FieldSet({
title: _('ID_NEW_CASE_PANEL'),
labelAlign: 'right',
items: [
{
xtype: 'checkbox',
checked: FORMATS.startCaseHideProcessInf,
name: 'hideProcessInf',
fieldLabel: _('ID_HIDE_PROCESS_INF'),
listeners:{
check:function(){
saveButton.enable();
}
}
}
]
}),
new Ext.form.FieldSet({
title: _("ID_CASES_LIST_SETUP"),
labelAlign: "right",
items: [cmbCasesDateFormat, cmbCasesRowNumber, txtCasesRefreshTime]
})
]
2011-02-18 16:00:32 +00:00
});
2011-02-18 16:00:32 +00:00
saveButton = new Ext.Action({
text : _('ID_SAVE_SETTINGS'),
disabled : true,
handler : function() {
formSettings.getForm().submit({
url : 'environmentSettingsAjax?request=save&r=' + Math.random(),
waitMsg : _('ID_SAVING_ENVIRONMENT_SETTINGS')+'...',
waitTitle : " ",
2011-02-18 16:00:32 +00:00
timeout : 36000,
success : function(res, req) {
PMExt.notify(_('ID_PM_ENV_SETTINGS_TITLE'), req.result.msg);
saveButton.disable();
currentLocation = parent.parent.location.href;
//frame = parent.location.href;
//settingsPage = location.href;
//location = settingsPage;
//parent.location = frame;
parent.parent.location = currentLocation;
2011-02-18 16:00:32 +00:00
}
});
}
});
2011-02-18 16:00:32 +00:00
formSettings = new Ext.FormPanel( {
region: 'center',
2011-02-18 16:00:32 +00:00
labelWidth : 170, // label settings here cascade unless overridden
//labelAlign: 'right',
frame : true,
title : _('ID_PM_ENV_SETTINGS_TITLE'),
//bodyStyle : 'padding:5px 5px 0',
width : 800,
2011-02-18 16:00:32 +00:00
autoScroll: true,
2010-12-02 23:34:41 +00:00
2011-02-18 16:00:32 +00:00
items : [fsSample,fsNames,fsDates, fsCases],
buttons : [saveButton]
});
2010-12-02 23:34:41 +00:00
loadSamples();
/*viewport = new Ext.Viewport({
layout: 'fit',
autoScroll: false,
items: [
formSettings
]
});*/
formSettings.render(document.body);
2011-02-18 16:00:32 +00:00
});
2010-12-02 23:34:41 +00:00
2011-02-18 16:00:32 +00:00
//Load Samples Label
loadSamples = function ()
{
2016-07-18 12:26:39 -04:00
Ext.getCmp("lblFullName").setText(_FNF(_uName, _firstName, _lastName, FORMATS.format));
Ext.getCmp("lblDateFormat").setText(_DF(_dateSample, FORMATS.dateFormat));
Ext.getCmp("lblCasesDateFormat").setText(_DF(_dateSample, FORMATS.casesListDateFormat, FORMATS.casesListDateFormat));
//Ext.getCmp("lblCasesRowsList").setText(FORMATS.casesListRowNumber);
//Ext.getCmp("lblCasesRefreshTime").setText(FORMATS.casesListRefreshTime);
2011-02-18 16:00:32 +00:00
};
2010-12-02 23:34:41 +00:00
2011-02-18 16:00:32 +00:00
//Change Some Setting
changeSettings = function (iType)
{
saveButton.enable();
switch (iType) {
case 1:
var f = FORMATS.format;
FORMATS.format = cmbUsernameFormat.getValue();
2016-07-18 12:26:39 -04:00
Ext.getCmp("lblFullName").setText(_FNF(_uName, _firstName, _lastName, cmbUsernameFormat.getValue()));
FORMATS.format = f;
break;
case 2:
Ext.getCmp("lblDateFormat").setText(_DF(_dateSample, cmbDateFormat.getValue()));
break;
case 3:
break;
case 4:
Ext.getCmp("lblCasesDateFormat").setText(_DF(_dateSample, cmbCasesDateFormat.getValue()));
break;
case 5:
//Ext.getCmp("lblCasesRowsList").setText(cmbCasesRowNumber.getValue());
break;
case 6:
//Ext.getCmp("lblCasesRefreshTime").setText(txtCasesRefreshTime.getValue());
break;
}
2011-02-18 16:00:32 +00:00
};