2011-06-22 15:13:21 -04:00
|
|
|
/*
|
|
|
|
|
* @author krlos P.C <carlos@colosa.com>
|
|
|
|
|
* Jan 15th, 2011
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
Ext.onReady(function(){
|
|
|
|
|
|
|
|
|
|
var fieldNameWS=new Ext.form.TextField({
|
2012-04-18 18:06:41 -04:00
|
|
|
id: 'NW_TITLE',
|
|
|
|
|
fieldLabel: _('ID_NAME'),
|
2011-06-22 15:13:21 -04:00
|
|
|
xtype:'textfield',
|
|
|
|
|
value:'sample',
|
|
|
|
|
width: 200,
|
|
|
|
|
autoCreate: {tag: 'input', type: 'text', size: '20', autocomplete: 'off', maxlength: '13'},
|
|
|
|
|
allowBlank: false,
|
|
|
|
|
listeners: {
|
|
|
|
|
'render': function(c) {
|
|
|
|
|
c.getEl().on('keyup', function() {
|
|
|
|
|
namews=formNewSite.getForm().findField('NW_TITLE').getValue();
|
2011-06-22 17:32:32 -04:00
|
|
|
formNewSite.getForm().findField('AO_DB_WF').setValue('wf_'+namews);
|
2014-09-04 16:28:17 -04:00
|
|
|
formNewSite.getForm().findField('AO_DB_WF').setValue('wf_'+namews);
|
|
|
|
|
formNewSite.getForm().findField('AO_DB_WF').setValue('wf_'+namews);
|
2011-06-22 15:13:21 -04:00
|
|
|
}, c);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
nameWS = new Ext.form.FieldSet({
|
2012-04-23 10:23:09 -04:00
|
|
|
title: _('ID_NEW_WORKSPACE'),
|
2011-06-22 15:13:21 -04:00
|
|
|
items: [
|
2012-04-23 10:23:09 -04:00
|
|
|
fieldNameWS
|
2012-04-18 18:06:41 -04:00
|
|
|
]
|
2011-06-22 15:13:21 -04:00
|
|
|
});
|
|
|
|
|
dbOptionsWS = new Ext.form.FieldSet({
|
2012-04-23 10:23:09 -04:00
|
|
|
title: _('ID_DATABASE_OPTIONS'),
|
2012-04-18 18:06:41 -04:00
|
|
|
items: [
|
2011-06-22 15:13:21 -04:00
|
|
|
{
|
2012-04-18 18:06:41 -04:00
|
|
|
id: 'AO_DB_WF',
|
2012-04-23 10:23:09 -04:00
|
|
|
fieldLabel: _('ID_WORKFLOW_DATABASE'),
|
2011-06-22 15:13:21 -04:00
|
|
|
xtype:'textfield',
|
2011-06-22 19:06:59 -04:00
|
|
|
value:'wf_sample',
|
2011-06-22 15:13:21 -04:00
|
|
|
width: 200,
|
2015-03-27 16:09:14 -04:00
|
|
|
regex: /^\w+$/,
|
2011-06-22 15:13:21 -04:00
|
|
|
autoCreate: {tag: 'input', type: 'text', size: '20', autocomplete: 'off', maxlength: '13'},
|
2015-03-27 16:09:14 -04:00
|
|
|
allowBlank: false,
|
2015-04-02 11:36:39 -04:00
|
|
|
msgTarget: 'under',
|
2015-04-06 11:26:51 -04:00
|
|
|
validator: function(v) {
|
|
|
|
|
var valueInputField= /^\w+$/.test(v)?true:"Invalid Workflow Database";
|
|
|
|
|
if (valueInputField==true) {
|
|
|
|
|
Ext.getCmp('_idTest').enable();
|
|
|
|
|
}else{
|
|
|
|
|
Ext.getCmp('_idTest').disable();
|
|
|
|
|
}
|
|
|
|
|
return valueInputField;
|
|
|
|
|
}
|
2012-04-18 18:06:41 -04:00
|
|
|
},
|
2014-09-04 16:28:17 -04:00
|
|
|
/*{
|
2011-06-22 15:13:21 -04:00
|
|
|
id: 'AO_DB_RB',
|
2012-04-23 10:23:09 -04:00
|
|
|
fieldLabel: _('ID_RBAC_DATABASE'),
|
2011-06-22 15:13:21 -04:00
|
|
|
xtype:'textfield',
|
|
|
|
|
value:'rb_sample',
|
|
|
|
|
width: 200,
|
|
|
|
|
autoCreate: {tag: 'input', type: 'text', size: '20', autocomplete: 'off', maxlength: '13'},
|
|
|
|
|
allowBlank: false
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'AO_DB_RP',
|
2012-04-23 10:23:09 -04:00
|
|
|
fieldLabel: _('ID_REPORT_DATABASE'),
|
2011-06-22 15:13:21 -04:00
|
|
|
xtype:'textfield',
|
|
|
|
|
value:'rp_sample',
|
|
|
|
|
width: 200,
|
|
|
|
|
autoCreate: {tag: 'input', type: 'text', size: '20', autocomplete: 'off', maxlength: '13'},
|
|
|
|
|
allowBlank: false
|
2014-09-04 16:28:17 -04:00
|
|
|
},*/
|
2012-04-18 18:06:41 -04:00
|
|
|
{
|
|
|
|
|
xtype: 'checkbox',
|
2012-04-23 10:23:09 -04:00
|
|
|
fieldLabel: _('ID_DROP_DATABASE_EXISTS'),
|
2012-04-18 18:06:41 -04:00
|
|
|
name: 'AO_DB_DROP',
|
2011-06-22 15:13:21 -04:00
|
|
|
id: 'id-active'
|
2012-04-18 18:06:41 -04:00
|
|
|
}
|
2011-06-22 15:13:21 -04:00
|
|
|
]
|
|
|
|
|
});
|
2012-04-18 18:06:41 -04:00
|
|
|
|
2011-06-22 15:13:21 -04:00
|
|
|
wspaceAdmWS = new Ext.form.FieldSet({
|
2012-04-23 10:23:09 -04:00
|
|
|
title: _('ID_WORKSPACE_ADMINISTRATOR'),
|
2012-04-18 18:06:41 -04:00
|
|
|
items: [
|
2011-06-22 15:13:21 -04:00
|
|
|
{
|
2012-04-18 18:06:41 -04:00
|
|
|
id: 'NW_USERNAME',
|
2012-04-23 10:23:09 -04:00
|
|
|
fieldLabel: _('ID_USERNAME'),
|
2011-06-22 15:13:21 -04:00
|
|
|
xtype:'textfield',
|
|
|
|
|
value:'admin',
|
|
|
|
|
width: 200,
|
|
|
|
|
allowBlank: false
|
2012-04-18 18:06:41 -04:00
|
|
|
},
|
2011-06-22 15:13:21 -04:00
|
|
|
{
|
|
|
|
|
id: 'NW_PASSWORD',
|
2012-04-23 10:23:09 -04:00
|
|
|
fieldLabel: _('ID_PASSWORD_ADMIN'),
|
2011-06-22 15:13:21 -04:00
|
|
|
xtype:'textfield',
|
|
|
|
|
inputType:'password',
|
|
|
|
|
value:'admin',
|
|
|
|
|
width: 200,
|
|
|
|
|
allowBlank: false
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'NW_PASSWORD2',
|
2012-04-23 10:23:09 -04:00
|
|
|
fieldLabel: _('ID_PASSWORD_ADMIN_RETYPE'),
|
2011-06-22 15:13:21 -04:00
|
|
|
xtype:'textfield',
|
|
|
|
|
inputType:'password',
|
|
|
|
|
value:'admin',
|
|
|
|
|
width: 200,
|
|
|
|
|
allowBlank: false
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
});
|
2012-04-18 18:06:41 -04:00
|
|
|
|
|
|
|
|
|
2011-06-22 15:13:21 -04:00
|
|
|
formNewSite = new Ext.FormPanel({
|
2012-04-18 18:06:41 -04:00
|
|
|
id:'formNewSite',
|
2011-06-22 15:13:21 -04:00
|
|
|
labelWidth: 250,
|
|
|
|
|
labelAlign:'right',
|
|
|
|
|
autoScroll: true,
|
|
|
|
|
fileUpload: true,
|
|
|
|
|
width:800,
|
|
|
|
|
bodyStyle:'padding:10px',
|
|
|
|
|
waitMsgTarget : true,
|
|
|
|
|
frame: true,
|
|
|
|
|
defaults: {
|
|
|
|
|
anchor: '100%',
|
|
|
|
|
allowBlank: false,
|
|
|
|
|
resizable: true,
|
|
|
|
|
msgTarget: 'side',
|
2012-04-18 18:06:41 -04:00
|
|
|
align:'center'
|
2011-06-22 15:13:21 -04:00
|
|
|
},
|
|
|
|
|
items:[
|
|
|
|
|
nameWS,
|
|
|
|
|
dbOptionsWS,
|
|
|
|
|
wspaceAdmWS
|
|
|
|
|
],
|
|
|
|
|
buttons: [
|
|
|
|
|
{
|
2012-04-23 10:23:09 -04:00
|
|
|
text: _('ID_RESET'),
|
2011-06-22 15:13:21 -04:00
|
|
|
handler: resetfields
|
2012-04-18 18:06:41 -04:00
|
|
|
|
2011-06-22 15:13:21 -04:00
|
|
|
},
|
2012-04-18 18:06:41 -04:00
|
|
|
{
|
2015-04-02 11:36:39 -04:00
|
|
|
id: '_idTest',
|
2012-04-23 10:23:09 -04:00
|
|
|
text: _('ID_TEST'),
|
2011-06-22 15:13:21 -04:00
|
|
|
handler: TestSite
|
|
|
|
|
}
|
|
|
|
|
]
|
2012-04-18 18:06:41 -04:00
|
|
|
|
2011-06-22 15:13:21 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
formNewSite.render(document.body);
|
2012-04-18 18:06:41 -04:00
|
|
|
|
2011-06-22 15:13:21 -04:00
|
|
|
});
|
|
|
|
|
function resetfields(){
|
|
|
|
|
formNewSite.getForm().reset();
|
2015-04-02 11:36:39 -04:00
|
|
|
Ext.getCmp('_idTest').enable();
|
2011-06-22 15:13:21 -04:00
|
|
|
}
|
|
|
|
|
function TestSite(){
|
|
|
|
|
formNewSite.getForm().submit({
|
|
|
|
|
url: '../newSiteProxy/testingNW',
|
|
|
|
|
params: {
|
|
|
|
|
action : 'test'
|
|
|
|
|
},
|
2012-04-23 10:23:09 -04:00
|
|
|
waitMsg : _('ID_NEW_SITE_TESTING'),
|
2013-09-02 10:55:45 -04:00
|
|
|
waitTitle : " ",
|
2011-06-22 15:13:21 -04:00
|
|
|
timeout : 3600,
|
|
|
|
|
success: function(f,a){
|
|
|
|
|
nwTitle =formNewSite.getForm().findField('NW_TITLE').getValue();
|
|
|
|
|
aoDbWf =formNewSite.getForm().findField('AO_DB_WF').getValue();
|
2014-10-30 12:49:53 -04:00
|
|
|
aoDbRb =aoDbWf;
|
|
|
|
|
aoDbRp =aoDbWf;
|
2011-06-22 15:13:21 -04:00
|
|
|
nwUsername =formNewSite.getForm().findField('NW_USERNAME').getValue();
|
|
|
|
|
nwPassword =formNewSite.getForm().findField('NW_PASSWORD').getValue();
|
|
|
|
|
nwPassword2=formNewSite.getForm().findField('NW_PASSWORD2').getValue();
|
|
|
|
|
aoDbDrop=formNewSite.getForm().findField('AO_DB_DROP').getValue();
|
|
|
|
|
//Ext.getCmp('NW_TITLE').disable()=true;
|
|
|
|
|
//Ext.getCmp('NW_TITLE').readOnly = true;
|
|
|
|
|
createNW(nwTitle, aoDbWf, aoDbRb, aoDbRp, nwUsername, nwPassword, nwPassword2);
|
|
|
|
|
},
|
|
|
|
|
failure: function(f,a){
|
|
|
|
|
if (a.failureType === Ext.form.Action.CONNECT_FAILURE){
|
2012-04-23 10:23:09 -04:00
|
|
|
Ext.Msg.alert(_('ID_FAILURE'), _('ID_SERVER_REPORTED') + ':' + a.response.status+' '+a.response.statusText);
|
2011-06-22 15:13:21 -04:00
|
|
|
}
|
|
|
|
|
if (a.failureType === Ext.form.Action.SERVER_INVALID){
|
2014-05-07 14:53:05 -04:00
|
|
|
var text = JSON.parse(a.response.responseText);
|
2014-10-30 12:49:53 -04:00
|
|
|
if (typeof(text.message) != 'undefined') {
|
2014-05-07 14:53:05 -04:00
|
|
|
Ext.Msg.alert(_('ID_ERROR'), _('ID_MYSQL_ERROR', text.message));
|
|
|
|
|
} else {
|
|
|
|
|
Ext.Msg.alert(_('ID_WARNING'), _('NEW_SITE_NOT_AVAILABLE'));
|
|
|
|
|
}
|
2011-06-22 15:13:21 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
2012-04-18 18:06:41 -04:00
|
|
|
}
|
|
|
|
|
|
2011-06-22 15:13:21 -04:00
|
|
|
function createNW(nwTitle, aoDbWf, aoDbRb, aoDbRp, nwUsername, nwPassword, nwPassword2){
|
|
|
|
|
PMExt.confirm(_('ID_CONFIRM'), _('NEW_SITE_CONFIRM_TO_CREATE'), function(){
|
2012-04-23 10:23:09 -04:00
|
|
|
var loadMask = new Ext.LoadMask(document.body, {msg : _('ID_SITE_CREATING')});
|
2015-04-17 12:17:20 -04:00
|
|
|
var oParams = {
|
|
|
|
|
action : 'create',
|
|
|
|
|
NW_TITLE : nwTitle,
|
|
|
|
|
AO_DB_WF : aoDbWf,
|
|
|
|
|
AO_DB_RB : aoDbRb,
|
|
|
|
|
AO_DB_RP : aoDbRp,
|
|
|
|
|
NW_USERNAME : nwUsername,
|
|
|
|
|
NW_PASSWORD : nwPassword,
|
|
|
|
|
NW_PASSWORD2 : nwPassword2
|
|
|
|
|
};
|
|
|
|
|
if(aoDbDrop){
|
|
|
|
|
oParams.AO_DB_DROP = 'On';
|
|
|
|
|
}
|
2011-06-22 15:13:21 -04:00
|
|
|
loadMask.show();
|
|
|
|
|
Ext.Ajax.request({
|
|
|
|
|
url: '../newSiteProxy/testingNW',
|
2015-04-17 12:17:20 -04:00
|
|
|
params: oParams,
|
2011-06-22 15:13:21 -04:00
|
|
|
method: 'POST',
|
|
|
|
|
success: function ( result, request ) {
|
|
|
|
|
loadMask.hide();
|
|
|
|
|
var data = Ext.util.JSON.decode(result.responseText);
|
|
|
|
|
if( data.success ) {
|
|
|
|
|
PMExt.confirm(_('ID_CONFIRM'), _('NEW_SITE_SUCCESS') +" "+nwTitle+"<br/>"+ _('NEW_SITE_SUCCESS_CONFIRM')+"<br/>"+ _('NEW_SITE_SUCCESS_CONFIRMNOTE'), function(){
|
2012-04-18 18:06:41 -04:00
|
|
|
nwTitle = formNewSite.getForm().findField('NW_TITLE').getValue();
|
|
|
|
|
if (typeof window.parent.parent.parent != 'undefined') {
|
2012-04-26 18:36:12 -04:00
|
|
|
parent.parent.parent.window.location = "/sys" + nwTitle + "/" + SYS_LANG + "/" + SYS_SKIN + "/login/login";
|
2012-04-18 18:06:41 -04:00
|
|
|
}
|
|
|
|
|
else {
|
2012-04-26 18:36:12 -04:00
|
|
|
parent.parent.window.location = "/sys" + nwTitle + "/" + SYS_LANG + "/" + SYS_SKIN + "/login/login";
|
2012-04-18 18:06:41 -04:00
|
|
|
}
|
2011-06-22 15:13:21 -04:00
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
PMExt.error(_('ID_ERROR'), data.msg);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
failure: function ( result, request) {
|
2012-04-23 10:23:09 -04:00
|
|
|
Ext.MessageBox.alert(_('ID_FAILED'), result.responseText);
|
2011-06-22 15:13:21 -04:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|