Merge pull request #581 from julceslauhub/master

Add some little validations in user edit screen and in the case messages list
This commit is contained in:
julceslauhub
2012-09-20 11:49:51 -07:00
2 changed files with 146 additions and 147 deletions

View File

@@ -55,7 +55,7 @@ switch($_POST['action'])
$oCriteria->addSelectColumn(UsersPeer::USR_FIRSTNAME); $oCriteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);
$oCriteria->addSelectColumn(UsersPeer::USR_LASTNAME); $oCriteria->addSelectColumn(UsersPeer::USR_LASTNAME);
$oCriteria->addSelectColumn(UsersPeer::USR_EMAIL); $oCriteria->addSelectColumn(UsersPeer::USR_EMAIL);
$oCriteria->add(UsersPeer::USR_STATUS,'ACTIVE'); $oCriteria->add(UsersPeer::USR_STATUS, array('ACTIVE', 'VACATION'), Criteria::IN);
if (isset($_POST['USR_UID'])) { if (isset($_POST['USR_UID'])) {
$oCriteria->add(UsersPeer::USR_UID, $_POST['USR_UID'], Criteria::NOT_EQUAL); $oCriteria->add(UsersPeer::USR_UID, $_POST['USR_UID'], Criteria::NOT_EQUAL);
} }

View File

@@ -1,31 +1,31 @@
/* /*
* @author: Douglas Medrano * @author: Douglas Medrano
* May 03, 2011 * May 03, 2011
*/ */
function onResizeIframe(idIframe){ function onResizeIframe(idIframe){
window.parent.tabIframeWidthFix2(idIframe); window.parent.tabIframeWidthFix2(idIframe);
} }
previewMessage = function() { previewMessage = function() {
var rowSelected = Ext.getCmp('processesGrid').getSelectionModel().getSelected(); var rowSelected = Ext.getCmp('processesGrid').getSelectionModel().getSelected();
if (rowSelected) { if (rowSelected) {
windowMessage = new Ext.Window({ windowMessage = new Ext.Window({
title: '', title: '',
width: 600, width: 600,
height: 420, height: 420,
border: false, border: false,
layout : 'fit', layout : 'fit',
items: items:
[ [
{ {
xtype: 'form', xtype: 'form',
frame: true, frame: true,
border: false, border: false,
defaults: { defaults: {
width: 150 width: 150
}, },
items: [ items: [
{ {
xtype: 'textfield', xtype: 'textfield',
fieldLabel: _("ID_FROM"), fieldLabel: _("ID_FROM"),
@@ -61,12 +61,12 @@
readOnly: true, readOnly: true,
name: 'Status' name: 'Status'
}, },
{ {
name : 'body', name : 'body',
id:'body', id:'body',
hideLabel:true, hideLabel:true,
xtype: 'htmleditor', xtype: 'htmleditor',
autoScroll: true, autoScroll: true,
readOnly: true, readOnly: true,
x: 1, x: 1,
y: 1, y: 1,
@@ -79,20 +79,20 @@
enableLists:false, enableLists:false,
enableSourceEdit:false, enableSourceEdit:false,
anchor: '100%', anchor: '100%',
height: 260 height: 260
} }
] ]
} }
] ]
}); });
//load fields from rowSelect //load fields from rowSelect
Ext.getCmp('From').setValue(rowSelected.data.APP_MSG_FROM); Ext.getCmp('From').setValue(rowSelected.data.APP_MSG_FROM);
Ext.getCmp('To').setValue(rowSelected.data.APP_MSG_TO); Ext.getCmp('To').setValue(rowSelected.data.APP_MSG_TO);
Ext.getCmp('Subjet').setValue(rowSelected.data.APP_MSG_SUBJECT); Ext.getCmp('Subjet').setValue(rowSelected.data.APP_MSG_SUBJECT);
Ext.getCmp('date').setValue(rowSelected.data.APP_MSG_DATE); Ext.getCmp('date').setValue(rowSelected.data.APP_MSG_DATE);
Ext.getCmp('body').setValue(rowSelected.data.APP_MSG_BODY); Ext.getCmp('body').setValue(rowSelected.data.APP_MSG_BODY);
//show windows message //show windows message
windowMessage.show(windowMessage); windowMessage.show(windowMessage);
} }
@@ -105,33 +105,33 @@
animEl: 'elId', animEl: 'elId',
icon: Ext.MessageBox.INFO, icon: Ext.MessageBox.INFO,
buttons: Ext.MessageBox.OK buttons: Ext.MessageBox.OK
}); });
} }
} }
function ajaxPostRequest(url, callback_function, id){ function ajaxPostRequest(url, callback_function, id){
var d = new Date(); var d = new Date();
var time = d.getTime(); var time = d.getTime();
url= url + '&nocachetime='+time; url= url + '&nocachetime='+time;
var return_xml=false; var return_xml=false;
var http_request = false; var http_request = false;
if (window.XMLHttpRequest){ // Mozilla, Safari,... if (window.XMLHttpRequest){ // Mozilla, Safari,...
http_request = new XMLHttpRequest(); http_request = new XMLHttpRequest();
if (http_request.overrideMimeType){ if (http_request.overrideMimeType){
http_request.overrideMimeType('text/xml'); http_request.overrideMimeType('text/xml');
} }
} }
else if (window.ActiveXObject){// IE else if (window.ActiveXObject){// IE
try{ try{
http_request = new ActiveXObject("Msxml2.XMLHTTP"); http_request = new ActiveXObject("Msxml2.XMLHTTP");
} }
catch (e){ catch (e){
try{ try{
http_request = new ActiveXObject("Microsoft.XMLHTTP"); http_request = new ActiveXObject("Microsoft.XMLHTTP");
} }
catch (e){ catch (e){
} }
} }
} }
@@ -139,17 +139,17 @@
alert('This browser is not supported.'); alert('This browser is not supported.');
return false; return false;
} }
http_request.onreadystatechange = function(){ http_request.onreadystatechange = function(){
if (http_request.readyState == 4){ if (http_request.readyState == 4){
if (http_request.status == 200){ if (http_request.status == 200){
if (return_xml){ if (return_xml){
eval(callback_function + '(http_request.responseXML)'); eval(callback_function + '(http_request.responseXML)');
} }
else{ else{
eval(callback_function + '(http_request.responseText, \''+id+'\')'); eval(callback_function + '(http_request.responseText, \''+id+'\')');
} }
} }
else{ else{
alert('Error found on request:(Code: ' + http_request.status + ')'); alert('Error found on request:(Code: ' + http_request.status + ')');
} }
@@ -157,8 +157,8 @@
} }
http_request.open('GET', url, true); http_request.open('GET', url, true);
http_request.send(null); http_request.send(null);
} }
var processesGrid; var processesGrid;
var store; var store;
var ActionTabFrameGlobal = ''; var ActionTabFrameGlobal = '';
@@ -170,7 +170,7 @@ var ActionTabFrameGlobal = '';
table.style.display = ''; table.style.display = '';
} }
} }
new Ext.KeyMap( new Ext.KeyMap(
document, document,
{ {
@@ -193,31 +193,31 @@ var ActionTabFrameGlobal = '';
Ext.onReady(function(){ Ext.onReady(function(){
Ext.state.Manager.setProvider(new Ext.state.CookieProvider()); Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
Ext.QuickTips.init(); Ext.QuickTips.init();
messageHistoryGridList(); messageHistoryGridList();
}); });
//!historyGridList| //!historyGridList|
//!!historyGridList|changeLog //!!historyGridList|changeLog
function historyGridListChangeLogPanelBody_RSP(resp,id){ function historyGridListChangeLogPanelBody_RSP(resp,id){
var historyGridListChangeLogPanel_id_ = Ext.getCmp('historyGridListChangeLogPanel_id'); var historyGridListChangeLogPanel_id_ = Ext.getCmp('historyGridListChangeLogPanel_id');
historyGridListChangeLogPanel_id_.show(); historyGridListChangeLogPanel_id_.show();
var historyGridListChangeLogPanelBody_= document.getElementById('historyGridListChangeLogPanelBody_JXP'); var historyGridListChangeLogPanelBody_= document.getElementById('historyGridListChangeLogPanelBody_JXP');
historyGridListChangeLogPanelBody_.innerHTML= resp; historyGridListChangeLogPanelBody_.innerHTML= resp;
} }
function historyGridListChangeLogPanelBody_JXP(){ function historyGridListChangeLogPanelBody_JXP(){
//!historyGridListChangeLogGlobal //!historyGridListChangeLogGlobal
historyGridListChangeLogGlobal.idHistory = historyGridListChangeLogGlobal.idHistory; historyGridListChangeLogGlobal.idHistory = historyGridListChangeLogGlobal.idHistory;
//dataSystem //dataSystem
var idHistory = historyGridListChangeLogGlobal.idHistory; var idHistory = historyGridListChangeLogGlobal.idHistory;
var url = "caseHistory_Ajax.php?actionAjax=historyGridListChangeLogPanelBody_JXP&idHistory="+idHistory; var url = "caseHistory_Ajax.php?actionAjax=historyGridListChangeLogPanelBody_JXP&idHistory="+idHistory;
ajaxPostRequest(url,'historyGridListChangeLogPanelBody_RSP'); ajaxPostRequest(url,'historyGridListChangeLogPanelBody_RSP');
} }
function historyGridListChangeLogPanel(){ function historyGridListChangeLogPanel(){
var w = new Ext.Window({ var w = new Ext.Window({
//draggable: Ext.util.Draggable, //draggable: Ext.util.Draggable,
@@ -242,19 +242,19 @@ var ActionTabFrameGlobal = '';
value:'uploadFileNewProcess' value:'uploadFileNewProcess'
} }
] ]
}); });
historyGridListChangeLogPanelBody_JXP(); historyGridListChangeLogPanelBody_JXP();
} }
var historyGridListChangeLogGlobal = {}; var historyGridListChangeLogGlobal = {};
historyGridListChangeLogGlobal.idHistory =''; historyGridListChangeLogGlobal.idHistory ='';
function historyGridListChangeLog(){ function historyGridListChangeLog(){
historyGridListChangeLogGlobal.idHistory = historyGridListChangeLogGlobal.idHistory; historyGridListChangeLogGlobal.idHistory = historyGridListChangeLogGlobal.idHistory;
var rowSelected = processesGrid.getSelectionModel().getSelected(); var rowSelected = processesGrid.getSelectionModel().getSelected();
if( rowSelected ){ if( rowSelected ){
var idHistory = rowSelected.data.ID_HISTORY; var idHistory = rowSelected.data.ID_HISTORY;
historyGridListChangeLogGlobal.idHistory = idHistory; historyGridListChangeLogGlobal.idHistory = idHistory;
historyGridListChangeLogPanel(); historyGridListChangeLogPanel();
} }
@@ -269,15 +269,14 @@ var ActionTabFrameGlobal = '';
buttons: Ext.MessageBox.OK buttons: Ext.MessageBox.OK
}); });
} }
} }
//!!historyGridList|changeLog //!!historyGridList|changeLog
function caseMessageHistory_RSP(response,id){ function caseMessageHistory_RSP(response,id){
messageHistoryGridListMask.hide();
if(response==""){ if(response==""){
messageHistoryGridListMask.hide();
Ext.Msg.show({ Ext.Msg.show({
title:'', title:'',
msg: _('ID_MAIL_SENT_SUCCESSFULLY'), msg: _('ID_MAIL_SENT_SUCCESSFULLY'),
@@ -287,23 +286,23 @@ var ActionTabFrameGlobal = '';
icon: Ext.MessageBox.INFO, icon: Ext.MessageBox.INFO,
buttons: Ext.MessageBox.OK buttons: Ext.MessageBox.OK
}); });
Ext.destroy(Ext.getCmp('processesGrid')); Ext.destroy(Ext.getCmp('processesGrid'));
messageHistoryGridList(); messageHistoryGridList();
} }
else{ else{
alert(response); alert(response);
} }
} }
function messageHistoryGridList(){ function messageHistoryGridList(){
store = new Ext.data.GroupingStore({ store = new Ext.data.GroupingStore({
proxy : new Ext.data.HttpProxy proxy : new Ext.data.HttpProxy
@@ -311,8 +310,8 @@ var ActionTabFrameGlobal = '';
{ {
url: 'caseMessageHistory_Ajax.php?actionAjax=messageHistoryGridList_JXP' url: 'caseMessageHistory_Ajax.php?actionAjax=messageHistoryGridList_JXP'
} }
), ),
reader : new Ext.data.JsonReader reader : new Ext.data.JsonReader
( (
{ {
@@ -327,26 +326,26 @@ var ActionTabFrameGlobal = '';
{name : 'APP_MSG_FROM'}, {name : 'APP_MSG_FROM'},
{name : 'APP_MSG_TO'}, {name : 'APP_MSG_TO'},
{name : 'APP_MSG_STATUS'}, {name : 'APP_MSG_STATUS'},
{name : 'APP_MSG_BODY'} {name : 'APP_MSG_BODY'}
] ]
} }
) )
}); });
var expander = new Ext.ux.grid.RowExpander({ var expander = new Ext.ux.grid.RowExpander({
tpl : new Ext.Template( tpl : new Ext.Template(
'<p><b>'+TRANSLATIONS.ID_PRO_DESCRIPTION+':</b> {PRO_DESCRIPTION}</p><br>' '<p><b>'+TRANSLATIONS.ID_PRO_DESCRIPTION+':</b> {PRO_DESCRIPTION}</p><br>'
) )
}); });
startDateRender = function(v){ startDateRender = function(v){
var dateString = "-"; var dateString = "-";
if(v!="-"){ if(v!="-"){
dateString = _DF(v,"m/d/Y H:i:s"); dateString = _DF(v,"m/d/Y H:i:s");
} }
return dateString; return dateString;
} }
escapeHtml = function(v){ escapeHtml = function(v){
var pre = document.createElement('pre'); var pre = document.createElement('pre');
@@ -354,7 +353,7 @@ var ActionTabFrameGlobal = '';
pre.appendChild(text); pre.appendChild(text);
return pre.innerHTML; return pre.innerHTML;
} }
actionRenderingTranslation = function(v){ actionRenderingTranslation = function(v){
var actionTranslate = ""; var actionTranslate = "";
if(v=="PAUSE"){ if(v=="PAUSE"){
@@ -371,11 +370,11 @@ var ActionTabFrameGlobal = '';
} }
else if(v==""||v==null){ else if(v==""||v==null){
actionTranslate = _("ID_DERIVATED"); actionTranslate = _("ID_DERIVATED");
} }
return actionTranslate; return actionTranslate;
}; };
var processesGrid = new Ext.grid.GridPanel({ var processesGrid = new Ext.grid.GridPanel({
region: 'center', region: 'center',
layout: 'fit', layout: 'fit',
@@ -391,20 +390,20 @@ var ActionTabFrameGlobal = '';
frame:false, frame:false,
//plugins: expander, //plugins: expander,
cls : 'grid_with_checkbox', cls : 'grid_with_checkbox',
columnLines: true, columnLines: true,
viewConfig: { viewConfig: {
forceFit:true forceFit:true
}, },
cm: new Ext.grid.ColumnModel({ cm: new Ext.grid.ColumnModel({
defaults: { defaults: {
width: 200, width: 200,
sortable: true sortable: true
}, },
columns: [ columns: [
//expander, //expander,
{id:'ID_MESSAGE', dataIndex: 'ID_MESSAGE', hidden:true, hideable:false}, {id:'ID_MESSAGE', dataIndex: 'ID_MESSAGE', hidden:true, hideable:false},
{header: _("ID_TYPE"), dataIndex: 'APP_MSG_TYPE', width: 70}, {header: _("ID_TYPE"), dataIndex: 'APP_MSG_TYPE', width: 70},
{header: _("ID_DATE_LABEL"), dataIndex: 'APP_MSG_DATE', width: 60, renderer: startDateRender}, {header: _("ID_DATE_LABEL"), dataIndex: 'APP_MSG_DATE', width: 60, renderer: startDateRender},
{header: _("ID_SUBJECT"), dataIndex: 'APP_MSG_SUBJECT', width: 60}, {header: _("ID_SUBJECT"), dataIndex: 'APP_MSG_SUBJECT', width: 60},
{header: _("ID_FROM"), dataIndex: 'APP_MSG_FROM', width: 60, renderer: escapeHtml}, {header: _("ID_FROM"), dataIndex: 'APP_MSG_FROM', width: 60, renderer: escapeHtml},
{header: _("ID_TO"), dataIndex: 'APP_MSG_TO', width: 60, renderer: escapeHtml}, {header: _("ID_TO"), dataIndex: 'APP_MSG_TO', width: 60, renderer: escapeHtml},
@@ -418,54 +417,54 @@ var ActionTabFrameGlobal = '';
id:'sendMailMessageFormRadioId', id:'sendMailMessageFormRadioId',
iconCls: 'button_menu_ext', iconCls: 'button_menu_ext',
icon: '/images/mail-send16x16.png', icon: '/images/mail-send16x16.png',
handler: function(){ handler: function(){
var rowSelected = processesGrid.getSelectionModel().getSelected(); var rowSelected = processesGrid.getSelectionModel().getSelected();
if( rowSelected ){ if( rowSelected ){
//!dataGrid //!dataGrid
// Show a dialog using config options: // Show a dialog using config options:
Ext.Msg.show({ Ext.Msg.show({
title:'', title:'',
msg: _('ID_ARE_YOU_SURE_RESEND')+"?", msg: _('ID_ARE_YOU_SURE_RESEND')+"?",
buttons: Ext.Msg.OKCANCEL, buttons: Ext.Msg.OKCANCEL,
icon: Ext.MessageBox.QUESTION, icon: Ext.MessageBox.QUESTION,
fn: function(btn, text){ fn: function(btn, text){
if(btn=='ok'){ if(btn=='ok'){
//!dataGrid //!dataGrid
var idMessage = rowSelected.data.ID_MESSAGE; var idMessage = rowSelected.data.ID_MESSAGE;
var subjectMessage = rowSelected.data.APP_MSG_SUBJECT; var subjectMessage = rowSelected.data.APP_MSG_SUBJECT;
var dateMessage = rowSelected.data.APP_MSG_DATE; var dateMessage = rowSelected.data.APP_MSG_DATE;
var tabName = 'sendMailMessage_'+idMessage; var tabName = 'sendMailMessage_'+idMessage;
var tabTitle = 'Resend('+subjectMessage+' '+dateMessage+')'; var tabTitle = 'Resend('+subjectMessage+' '+dateMessage+')';
ActionTabFrameGlobal.tabName = tabName; ActionTabFrameGlobal.tabName = tabName;
ActionTabFrameGlobal.tabTitle = tabTitle; ActionTabFrameGlobal.tabTitle = tabTitle;
//window.parent.Actions.tabFrame(tabName); //window.parent.Actions.tabFrame(tabName);
var tabNameArray = tabName.split('_'); var tabNameArray = tabName.split('_');
var APP_UID = tabNameArray[1]; var APP_UID = tabNameArray[1];
var APP_MSG_UID = tabNameArray[2]; var APP_MSG_UID = tabNameArray[2];
messageHistoryGridListMask = new Ext.LoadMask(Ext.getBody(), {msg:_('ID_LOADING')}); messageHistoryGridListMask = new Ext.LoadMask(Ext.getBody(), {msg:_('ID_LOADING')});
messageHistoryGridListMask.show(); messageHistoryGridListMask.show();
var url = "caseMessageHistory_Ajax.php?actionAjax=sendMailMessage_JXP&APP_UID="+APP_UID+"&APP_MSG_UID="+APP_MSG_UID; var url = "caseMessageHistory_Ajax.php?actionAjax=sendMailMessage_JXP&APP_UID="+APP_UID+"&APP_MSG_UID="+APP_MSG_UID;
ajaxPostRequest(url,'caseMessageHistory_RSP'); ajaxPostRequest(url,'caseMessageHistory_RSP');
} }
}, },
animEl: 'elId' animEl: 'elId'
}); });
} }
else{ else{
Ext.Msg.show({ Ext.Msg.show({
@@ -477,14 +476,14 @@ var ActionTabFrameGlobal = '';
icon: Ext.MessageBox.INFO, icon: Ext.MessageBox.INFO,
buttons: Ext.MessageBox.OK buttons: Ext.MessageBox.OK
}); });
} }
}, },
disabled:false disabled:false
}, },
{ {
xtype: 'tbseparator' xtype: 'tbseparator'
}, },
@@ -495,9 +494,9 @@ var ActionTabFrameGlobal = '';
icon: '/images/documents/_filefind.png', icon: '/images/documents/_filefind.png',
handler: function(){ handler: function(){
var rowSelected = processesGrid.getSelectionModel().getSelected(); var rowSelected = processesGrid.getSelectionModel().getSelected();
if (rowSelected) { if (rowSelected) {
previewMessage(); previewMessage();
} }
else { else {
Ext.Msg.show({ Ext.Msg.show({
@@ -508,8 +507,8 @@ var ActionTabFrameGlobal = '';
animEl: 'elId', animEl: 'elId',
icon: Ext.MessageBox.INFO, icon: Ext.MessageBox.INFO,
buttons: Ext.MessageBox.OK buttons: Ext.MessageBox.OK
}); });
} }
}, },
disabled:false disabled:false
}, },
@@ -529,16 +528,16 @@ var ActionTabFrameGlobal = '';
rowdblclick: previewMessage, rowdblclick: previewMessage,
render: function(){ render: function(){
this.loadMask = new Ext.LoadMask(this.body, {msg:'Loading...'}); this.loadMask = new Ext.LoadMask(this.body, {msg:'Loading...'});
processesGrid.getSelectionModel().on('rowselect', function(){ processesGrid.getSelectionModel().on('rowselect', function(){
var rowSelected = processesGrid.getSelectionModel().getSelected(); var rowSelected = processesGrid.getSelectionModel().getSelected();
}); });
} }
} }
}); });
processesGrid.store.load({params: {"function":"languagesList"}}); processesGrid.store.load({params: {"function":"languagesList"}});
processesGrid.store.on( processesGrid.store.on(
'load', 'load',
function() function()
@@ -550,16 +549,16 @@ var ActionTabFrameGlobal = '';
single: true single: true
} }
); );
processesGrid.addListener('rowcontextmenu', emptyReturn,this); processesGrid.addListener('rowcontextmenu', emptyReturn,this);
processesGrid.on('rowcontextmenu', function (grid, rowIndex, evt) { processesGrid.on('rowcontextmenu', function (grid, rowIndex, evt) {
var sm = grid.getSelectionModel(); var sm = grid.getSelectionModel();
sm.selectRow(rowIndex, sm.isSelected(rowIndex)); sm.selectRow(rowIndex, sm.isSelected(rowIndex));
var rowSelected = Ext.getCmp('processesGrid').getSelectionModel().getSelected(); var rowSelected = Ext.getCmp('processesGrid').getSelectionModel().getSelected();
var activator = Ext.getCmp('activator2'); var activator = Ext.getCmp('activator2');
var debug = Ext.getCmp('debug'); var debug = Ext.getCmp('debug');
if( rowSelected.data.PRO_STATUS == 'ACTIVE' ){ if( rowSelected.data.PRO_STATUS == 'ACTIVE' ){
activator.setIconClass('icon-deactivate'); activator.setIconClass('icon-deactivate');
activator.setText(TRANSLATIONS.ID_DEACTIVATE); activator.setText(TRANSLATIONS.ID_DEACTIVATE);
@@ -567,7 +566,7 @@ var ActionTabFrameGlobal = '';
activator.setIconClass('icon-activate'); activator.setIconClass('icon-activate');
activator.setText(TRANSLATIONS.ID_ACTIVATE); activator.setText(TRANSLATIONS.ID_ACTIVATE);
} }
if( rowSelected.data.PRO_DEBUG == 1){ if( rowSelected.data.PRO_DEBUG == 1){
debug.setIconClass('icon-debug-disabled'); debug.setIconClass('icon-debug-disabled');
debug.setText(_('ID_DISABLE_DEBUG')); debug.setText(_('ID_DISABLE_DEBUG'));
@@ -576,22 +575,22 @@ var ActionTabFrameGlobal = '';
debug.setText(_('ID_ENABLE_DEBUG')); debug.setText(_('ID_ENABLE_DEBUG'));
} }
}, this); }, this);
processesGrid.on('contextmenu', function (evt) { processesGrid.on('contextmenu', function (evt) {
evt.preventDefault(); evt.preventDefault();
}, this); }, this);
function emptyReturn(){ function emptyReturn(){
} }
var viewport = new Ext.Viewport({ var viewport = new Ext.Viewport({
layout: 'border', layout: 'border',
autoScroll: true, autoScroll: true,
@@ -601,6 +600,6 @@ var ActionTabFrameGlobal = '';
}); });
} }
//!historyGridList| //!historyGridList|