diff --git a/workflow/engine/controllers/admin.php b/workflow/engine/controllers/admin.php new file mode 100644 index 000000000..858e18b2c --- /dev/null +++ b/workflow/engine/controllers/admin.php @@ -0,0 +1,79 @@ + + * @New Calendar + * @access public + */ +class Admin extends Controller +{ + /** + * getting default list + * @param string $httpData->PRO_UID (opional) + */ + public function calendarEdit($httpData) + { + global $RBAC; + + $CalendarUid = str_replace ( '"', '', isset ( $_GET ['id'] ) ? $_GET ['id'] : G::GenerateUniqueID () ); + G::LoadClass ( 'calendar' ); + $calendarObj = new calendar ( ); + + if ((isset ( $_GET ['id'] )) && ($_GET ['id'] != "")) { + $fields = $calendarObj->getCalendarInfoE ( $CalendarUid ); + $fields ['OLD_NAME'] = $fields['CALENDAR_NAME']; + } + if (! (isset ( $fields ['CALENDAR_UID'] ))) { //For a new Calendar + $fields ['CALENDAR_UID'] = $CalendarUid; + $fields ['OLD_NAME'] = ''; + + //Default Business Hour + $fields ['BUSINESS_DAY'] [1] ['CALENDAR_BUSINESS_DAY'] = 7; + $fields ['BUSINESS_DAY'] [1] ['CALENDAR_BUSINESS_START'] = "09:00"; + $fields ['BUSINESS_DAY'] [1] ['CALENDAR_BUSINESS_END'] = "17:00"; + } + if ((isset ( $_GET ['cp'] )) && ($_GET ['cp'] == 1)) { // Copy Calendar + $fields ['CALENDAR_UID'] = G::GenerateUniqueID (); + $fields ['CALENDAR_NAME'] = G::LoadTranslation ( "ID_COPY_OF" ) . " " . $fields ['CALENDAR_NAME']; + } + + $RBAC->requirePermissions('PM_SETUP_ADVANCE'); + G::LoadClass('configuration'); + $c = new Configurations(); + $configPage = $c->getConfiguration('additionalTablesList', 'pageSize','',$_SESSION['USER_LOGGED']); + $Config['pageSize'] = isset($configPage['pageSize']) ? $configPage['pageSize'] : 20; + + $this->includeExtJS('admin/calendarEdit'); + $this->setView('admin/calendarEdit'); + + $variableArray = array(); + $variableArray[0] = 'uno'; + $variableArray[1] = 'dos'; + + + $businessDayArray = array(); + for($i=0;$isetJSVar('CALENDAR_UID',$fields['CALENDAR_UID']); + $this->setJSVar('fields',$fields); + + G::RenderPage('publish', 'extJs'); + } +} \ No newline at end of file diff --git a/workflow/engine/controllers/adminProxy.php b/workflow/engine/controllers/adminProxy.php new file mode 100644 index 000000000..8978f02f7 --- /dev/null +++ b/workflow/engine/controllers/adminProxy.php @@ -0,0 +1,75 @@ +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + * + */ +class adminProxy extends HttpProxyController +{ + function calendarSave() { + //{ $_POST['BUSINESS_DAY'] + $businessDayArray = G::json_decode($_POST['BUSINESS_DAY']); + $businessDayFixArray = array(); + for($i=0;$iCALENDAR_BUSINESS_DAY; + $businessDayFixArray[$i+1]['CALENDAR_BUSINESS_START'] = $businessDayArray[$i]->CALENDAR_BUSINESS_START; + $businessDayFixArray[$i+1]['CALENDAR_BUSINESS_END'] = $businessDayArray[$i]->CALENDAR_BUSINESS_END; + } + $_POST['BUSINESS_DAY'] = $businessDayFixArray; + //} + + //{ $_POST['CALENDAR_WORK_DAYS'] + $calendarWorkDaysArray = G::json_decode($_POST['CALENDAR_WORK_DAYS']); + $calendarWorkDaysFixArray = array(); + for($i=0;$iCALENDAR_HOLIDAY_NAME; + $holidayFixArray[$i+1]['CALENDAR_HOLIDAY_START'] = $holidayArray[$i]->CALENDAR_HOLIDAY_START; + $holidayFixArray[$i+1]['CALENDAR_HOLIDAY_END'] = $holidayArray[$i]->CALENDAR_HOLIDAY_END; + } + $_POST['HOLIDAY'] = $holidayFixArray; + //} + + //[ CALENDAR_STATUS BUSINESS_DAY_STATUS HOLIDAY_STATUS + if($_POST['BUSINESS_DAY_STATUS']=="INACTIVE") { + unset($_POST['BUSINESS_DAY_STATUS']); + } + if($_POST['HOLIDAY_STATUS']=="INACTIVE") { + unset($_POST['HOLIDAY_STATUS']); + } + //] + + $form = $_POST; + G::LoadClass('calendar'); + $calendarObj=new calendar(); + $calendarObj->saveCalendarInfo($form); + + echo "{success: true}"; + } +} \ No newline at end of file diff --git a/workflow/engine/templates/admin/calendarEdit.html b/workflow/engine/templates/admin/calendarEdit.html new file mode 100644 index 000000000..11104b5a2 --- /dev/null +++ b/workflow/engine/templates/admin/calendarEdit.html @@ -0,0 +1,130 @@ +
+
+
+ + + + + + + + + diff --git a/workflow/engine/templates/admin/calendarEdit.js b/workflow/engine/templates/admin/calendarEdit.js new file mode 100644 index 000000000..3246dbdac --- /dev/null +++ b/workflow/engine/templates/admin/calendarEdit.js @@ -0,0 +1,1162 @@ +/*! + * Ext JS Library 3.2.1 + * Copyright(c) 2006-2010 Ext JS, Inc. + * licensing@extjs.com + * http://www.extjs.com/license + */ + + comboStatusStore = new Ext.data.SimpleStore({ + fields: ['id','value'], + data: [['- ALL -','- ALL -'],['SUN','SUN'],['MON','MON'],['TUE','TUE'],['WED','WED'],['THU','THU'],['FRI','FRI'],['SAT','SAT']] + }); + + function workHourCompositeFieldInterfaz(i){ + //!dataSystem + var d = new Date(); + var idTime = d.getTime(); + + var workHourComposite = 'workHourComposite'+idTime; + //! + + var CompositeField1 = new Ext.form.CompositeField( { + xtype : 'compositefield', + id : workHourComposite, + hideLabel : true, + labelWidth : 100, + items : [ + { + xtype : 'displayfield', + width : 10, + value : '' + }, + { + xtype: 'displayfield', + style: 'text-align:center;color:#808080;font-size:11px;margin-top:5px;', + value: i-1 + }, + { + xtype : 'displayfield', + width : 5, + value : '' + }, + { + xtype: 'combo', + fieldLabel: _('ID_STATUS'), + hiddenName: 'status', + typeAhead: true, + mode: 'local', + store: comboStatusStore, + displayField: 'value', + width: 100, + valueField:'id', + allowBlank: true, + triggerAction: 'all', + emptyText: _('ID_SELECT_STATUS'), + selectOnFocus:true + }, + { + xtype : 'displayfield', + width : 10, + value : '' + }, + { + xtype: 'textfield', + width: 70, + fieldLabel: 'Name', + name : 'td1', + allowBlank: true + }, + { + xtype : 'displayfield', + width : 10, + value : '' + }, + { + xtype: 'textfield', + width: 70, + fieldLabel: 'Name', + name : 'td2', + allowBlank: true + }, + { + xtype : 'displayfield', + width : 10, + value : '' + }, + { + xtype: 'box', + fieldLabel: 'Filename', + name: 'filename', + autoEl: { + style: 'margin-top:5px', + html:'Delete' + } + } + ] + }); + return CompositeField1; + } + + function fordataWorkDayFieldNew() { + + var dynaformCalendar_ = Ext.getCmp('dynaformCalendar'); + + var idWorkHour_= Ext.getCmp('idWorkHour'); + var i = idWorkHour_.items.length; + + idWorkHour_.insert( i, workHourCompositeFieldInterfaz(i) ); + + dynaformCalendar_.doLayout(); + } + + function fordataWorkDayFieldRemove(workHourComposite,i) { + + + dynaformCalendar_ = Ext.getCmp('dynaformCalendar'); + idWorkHour_= Ext.getCmp('idWorkHour'); + + var workHourComposite_ = Ext.getCmp(workHourComposite); + + var idWorkHour_= Ext.getCmp('idWorkHour'); + + for( var index = 0 ; index < idWorkHour_.items.length ; index++ ) { + if( index >= i ) { + idWorkHour_.items.items[index].items.items[1].value = index-2; + idWorkHour_.items.items[index].items.items[1].originalValue = index-2; + } + } + + var e = workHourComposite_.el.up( '.x-form-item' ); + idWorkHour_.remove( workHourComposite_ ); + e.remove(); + dynaformCalendar_.doLayout(); + } + Ext.ux.OrderedFormPanel = Ext.extend( Ext.FormPanel, { + addAfter : function( a, c ){ + for( var i = 0 ; i < this.items.items.length ; i++ ){ + if( this.items.items[i] == a ){ + this.insert( i + 1, c ); + return; + } + } + + }, + addBefore : function( a, c ) { + for( var i = 0 ; i < this.items.items.length ; i++ ){ + if( this.items.items[i] == a ){ + this.insert( i, c ); + return; + } + } + } + }); + + //[ Global variables + calendarWorkDayArray = []; + calendarWorkDayArray[0] = 'SUN'; + calendarWorkDayArray[1] = 'MON'; + calendarWorkDayArray[2] = 'TUE'; + calendarWorkDayArray[3] = 'WED'; + calendarWorkDayArray[4] = 'THU'; + calendarWorkDayArray[5] = 'FRI'; + calendarWorkDayArray[6] = 'SAT'; + + calendarWorkDayStatusArray = new Array(); + calendarWorkDayStatusArray['SUN'] = 'On'; + calendarWorkDayStatusArray['MON'] = 'On'; + calendarWorkDayStatusArray['TUE'] = 'On'; + calendarWorkDayStatusArray['WED'] = 'On'; + calendarWorkDayStatusArray['THU'] = 'On'; + calendarWorkDayStatusArray['FRI'] = 'On'; + calendarWorkDayStatusArray['SAT'] = 'On'; + + function calendarWorkDayStatusReset() { + calendarWorkDayStatusArray['SUN'] = 'On'; + calendarWorkDayStatusArray['MON'] = 'On'; + calendarWorkDayStatusArray['TUE'] = 'On'; + calendarWorkDayStatusArray['WED'] = 'On'; + calendarWorkDayStatusArray['THU'] = 'On'; + calendarWorkDayStatusArray['FRI'] = 'On'; + calendarWorkDayStatusArray['SAT'] = 'On'; + } + //] + +Ext.onReady( function() { + + var Employee = Ext.data.Record.create ([ + { + name: 'name', + type: 'string' + }, + { + name: 'start', + type: 'string' + }, + { + name: 'end', + type: 'string' + } + ]); + + //[ genData + var genData = function() { + + var data = []; + bussinesDayArray = fields['BUSINESS_DAY']; + + var rowNameDataArray = new Array(); + rowNameDataArray['7'] = '- ALL -'; + rowNameDataArray['0'] = 'SUN'; + rowNameDataArray['1'] = 'MON' ; + rowNameDataArray['2'] = 'TUE' ; + rowNameDataArray['3'] = 'WED' ; + rowNameDataArray['4'] = 'THU' ; + rowNameDataArray['5'] = 'FRI' ; + rowNameDataArray['6'] = 'SAT' ; + + for (i=0;i=gridEachEndSecond) { + if(editorEndSecond<=gridEachStartSecond||editorEndSecond>=gridEachEndSecond) { + } + else { + dataExist = 'Off'; + } + } + else { + dataExist = 'Off'; + } + } + } + }); + if(dataExist == 'Off') { + PMExt.notify( _('ID_ERROR') , _('ID_TIME_EXIST_IN_LIST')); + e.name = gridName; + e.start = gridStart; + e.end = gridEnd; + } + else { + } + } + } + return; + }, + beforeedit: function(roweditor, rowIndex) { + } + }); + + grid = new Ext.grid.GridPanel( { + store: store, + id: "gridCalendar", + width: 470, + height : 120, + region:'center', + margins: '0 5 5 5', + autoExpandColumn: 'name', + plugins: [editor], + view: new Ext.grid.GroupingView({ + markDirty: false + }), + tbar: [ { + iconCls: 'icon-user-add', + text: _('ID_ADD'), + handler: function(){ + var e = new Employee({ + name: '- ALL -', + start: '00:00', + end: '00:00' + + }); + editor.stopEditing(); + store.insert(0, e); + grid.getView().refresh(); + grid.getSelectionModel().selectRow(0); + editor.startEditing(0); + } + }, + { + ref: '../removeBtn', + iconCls: 'icon-user-delete', + text: _('ID_REMOVE'), + disabled: false, + handler: function(){ + editor.stopEditing(); + var s = grid.getSelectionModel().getSelections(); + for(var i = 0, r; r = s[i]; i++){ + store.remove(r); + } + } + }], + + columns: [ + new Ext.grid.RowNumberer(), + { + header: _('ID_DAY'), + id: 'name', + dataIndex: 'name', + width: 50, + sortable: true, + + editor: { + xtype: 'combo', + id: 'calendarColumnDayCombo', + fieldLabel: _('ID_STATUS'), + hiddenName: 'status', + typeAhead: true, + mode: 'local', + forceSelection: true, + store: comboStatusStore, + displayField: 'value', + width: 150, + valueField:'id', + allowBlank: true, + triggerAction: 'all', + emptyText: _('ID_SELECT_STATUS'), + selectOnFocus:true + + + } + }, + { + header: _('ID_START_HH_MM'), + dataIndex: 'start', + width: 150, + sortable: true, + editor: { + xtype: 'timefield', + minValue: '12:00 AM', + maxValue: '23:59 PM', + increment: 1, + forceSelection: true, + format: 'H:i' + }, + renderer: horaRender + }, + { + header: _('ID_END_HH_MM'), + dataIndex: 'end', + width: 150, + sortable: true, + editor: { + xtype: 'timefield', + minValue: '12:00 AM', + maxValue: '23:59 PM', + increment: 1, + forceSelection: true, + format: 'H:i' + } + } + ] + }); + + var EmployeeHoliday = Ext.data.Record.create ([ + { + name: 'name', + type: 'string' + }, + { + name: 'email', + type: 'date', + dateFormat: 'n/j/Y' + }, + { + name: 'start', + type: 'date', + dateFormat: 'n/j/Y' + } + ]); + var genDataHoliday = function(){ + var data = []; + + + var holidayArray = fields['HOLIDAY']; + + console.info(holidayArray); + + for (i=0;i