BUG 0000 Upgrade the interface of the page calendar with ExtJS calendar

This commit is contained in:
Douglas Medrano Chura
2011-09-20 19:08:31 -04:00
parent 625b70ed42
commit 7b35e8150e
5 changed files with 1451 additions and 4 deletions

View File

@@ -0,0 +1,79 @@
<?php
/**
* pmTables controller
* @author Douglas Medrano <douglas@colosa.com, douglas.medrano@live.com>
* @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;$i<sizeof($fields['BUSINESS_DAY']);$i++) {
$businessDayArray[$i] = $fields['BUSINESS_DAY'][$i+1];
}
$fields['BUSINESS_DAY'] = $businessDayArray;
$holidayArray = array();
for($i=0;$i<sizeof($fields['HOLIDAY']);$i++) {
$holidayArray[$i] = $fields['HOLIDAY'][$i+1];
}
$_GET ['id']= is_null($_GET ['id'])?'':$_GET ['id'];
$fields['HOLIDAY'] = $holidayArray;
$fields['NEWCALENDAR'] = 'NO';
if(isset ( $_GET ['id'] )&&$_GET ['id']=='') {
$fields['CALENDAR_UID'] = G::GenerateUniqueID();
$fields['NEWCALENDAR'] = 'YES';
}
$this->setJSVar('CALENDAR_UID',$fields['CALENDAR_UID']);
$this->setJSVar('fields',$fields);
G::RenderPage('publish', 'extJs');
}
}

View File

@@ -0,0 +1,75 @@
<?php
/**
* adminProxy.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* 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;$i<sizeof($businessDayArray);$i++) {
$businessDayFixArray[$i+1]['CALENDAR_BUSINESS_DAY'] = $businessDayArray[$i]->CALENDAR_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;$i<sizeof($calendarWorkDaysArray);$i++) {
$calendarWorkDaysFixArray[$i] = $calendarWorkDaysArray[$i]."";
}
$_POST['CALENDAR_WORK_DAYS'] = $calendarWorkDaysFixArray;
//}
//{ $_POST['HOLIDAY']
$holidayArray = G::json_decode($_POST['HOLIDAY']);
$holidayFixArray = array();
for($i=0;$i<sizeof($holidayArray);$i++) {
$holidayFixArray[$i+1]['CALENDAR_HOLIDAY_NAME'] = $holidayArray[$i]->CALENDAR_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}";
}
}

View File

@@ -0,0 +1,130 @@
<div style="padding: 15px">
<div id="list-panel"></div>
</div>
<style type="text/css">
.x-viewport {
overflow:auto;
}
a {
color: #006699;cursor: pointer;text-decoration: none;
}
a:hover {
color:orange !important;
cursor:pointer
}
body {
/* overflow-x: hidden !important;*/
/* background-color:white !important;*/
border-color: #D0D0D0;
}
.x-panel-body {
/*background-color:white !important;*/
border-color: #F1F1F1;
overflow:auto;
}
.ux-layout-center-item {
margin:0 auto;
text-align:left;
}
.ux-layout-center .x-panel-body {
text-align:center;
}
/*!Grid*/
.x-grid3 .x-window-ml{
padding-left: 0;
}
.x-grid3 .x-window-mr {
padding-right: 0;
}
.x-grid3 .x-window-tl {
padding-left: 0;
}
.x-grid3 .x-window-tr {
padding-right: 0;
}
.x-grid3 .x-window-tc .x-window-header {
height: 3px;
padding:0;
overflow:hidden;
}
.x-grid3 .x-window-mc {
border-width: 0;
background: #cdd9e8;
}
.x-grid3 .x-window-bl {
padding-left: 0;
}
.x-grid3 .x-window-br {
padding-right: 0;
}
.x-grid3 .x-panel-btns {
padding:0;
}
.x-grid3 .x-panel-btns td.x-toolbar-cell {
padding:3px 3px 0;
}
.x-box-inner {
zoom:1;
}
.icon-user-add {
background-image: url(/images/add-row-after.png) !important;
}
.icon-user-delete {
background-image: url(/images/delete-row.png) !important;
}
/*!Grid*/
</style>
<script type="text/javascript">
var a, b, c;
function addField(){
fordata= Ext.getCmp('fordata1');
dynForm = fordata;
a = new Ext.form.TextField({
fieldLabel: "A"
});
b = new Ext.form.TextField({
fieldLabel: "B"
});
c = new Ext.form.TextField({
fieldLabel: "C"
});
dynForm.add( a );
dynForm.add( b );
dynForm.addAfter( a, c );
dynForm.doLayout();
}
function remove(){
var e = b.el.up( '.x-form-item' );
dynForm.remove( b );
e.remove();
dynForm.doLayout();
}
</script>

File diff suppressed because it is too large Load Diff

View File

@@ -281,7 +281,8 @@ DoNothing = function(){};
//Open New Calendar
NewCalendarAction = function() {
location.href = 'calendarEdit';
//location.href = 'calendarEdit';
location.href = '../admin/calendarEdit';
};
//Load Grid By Default
@@ -299,7 +300,7 @@ DoSearch = function(){
EditCalendarAction = function() {
rowSelected = infoGrid.getSelectionModel().getSelected();
if (rowSelected){
location.href = 'calendarEdit?id=' + rowSelected.data.CALENDAR_UID;
location.href = '../admin/calendarEdit?id=' + rowSelected.data.CALENDAR_UID;
}
};