Ignore:
Timestamp:
08/08/12 18:02:13 (12 years ago)
Author:
acoutinho
Message:

Ticket #2966 - Criado suporte a historico em atividades

Location:
sandbox/2.4.2-expresso1
Files:
1 added
10 edited

Legend:

Unmodified
Added
Removed
  • sandbox/2.4.2-expresso1/expressoCalendar/setup/setup.inc.php

    r6945 r6968  
    3434        $setup_info['expressoCalendar']['tables'][]             =  'module_preference'; 
    3535    $setup_info['expressoCalendar']['tables'][]     =  'calendar_repeat_ranges'; 
    36         $setup_info['expressoCalendar']['tables'][]             =  'calendar_task_to_activity_object'; 
     36    $setup_info['expressoCalendar']['tables'][]     =  'calendar_task_to_activity_object'; 
     37        $setup_info['expressoCalendar']['tables'][]             =  'calendar_historic'; 
    3738 
    3839        $setup_info['expressoCalendar']['enable']               = 1; 
  • sandbox/2.4.2-expresso1/expressoCalendar/setup/tables_current.inc.php

    r6945 r6968  
    148148                 
    149149             
    150             'calendar_participant' => array( 
     150        'calendar_participant' => array( 
    151151            'fd' => array( 
    152152                'id' => array( 'type' => 'auto', 'nullable' => False), 
     
    183183            'uc' => array() 
    184184                ), 
    185                  
    186                  
    187             'calendar_signature_alarm' => array( 
     185 
     186        'calendar_historic' => array( 
     187            'fd' => array( 
     188                'id' => array( 'type' => 'auto', 'nullable' => False), 
     189                'object_id' => array('type' => 'int', 'precision' => '8','nullable' => True), 
     190                'user_uidnumber' => array( 'type' => 'int', 'precision' => '8', 'nullable' => False), 
     191                'dtstamp' => array( 'type' => 'bigint', 'precision' => '16', 'nullable' => False), 
     192                'attribute' => array('type' => 'varchar','precision' => '50','nullable' => True), 
     193                'before_value' => array( 'type' => 'varchar', 'precision' => '255', 'nullable' => True),               
     194                'after_value' => array( 'type' => 'varchar', 'precision' => '255', 'nullable' => True)             
     195            ), 
     196            'pk' => array('id'), 
     197            'fk' => array(), 
     198            'ix' => array(), 
     199            'uc' => array() 
     200        ),       
     201                 
     202        'calendar_signature_alarm' => array( 
    188203            'fd' => array( 
    189204                'id' => array( 'type' => 'auto', 'nullable' => False), 
  • sandbox/2.4.2-expresso1/expressoCalendar/setup/tables_update.inc.php

    r6945 r6968  
    137137        $oProc->query("CREATE TABLE calendar_task_to_activity_object(id serial not null, calendar_object_activity_id integer not null, calendar_object_task_id integer not null, owner integer not null);"); 
    138138 
     139        $oProc->CreateTable('calendar_historic', array( 
     140            'fd' => array( 
     141                'id' => array( 'type' => 'auto', 'nullable' => False), 
     142                'object_id' => array('type' => 'int', 'precision' => '8','nullable' => True), 
     143                'user_uidnumber' => array( 'type' => 'int', 'precision' => '8', 'nullable' => False), 
     144                'dtstamp' => array( 'type' => 'bigint', 'precision' => '16', 'nullable' => False), 
     145                'attribute' => array('type' => 'varchar','precision' => '50','nullable' => True), 
     146                'before_value' => array( 'type' => 'varchar', 'precision' => '255', 'nullable' => True),               
     147                'after_value' => array( 'type' => 'varchar', 'precision' => '255', 'nullable' => True)             
     148            ), 
     149            'pk' => array('id'), 
     150            'fk' => array(), 
     151            'ix' => array(), 
     152            'uc' => array() 
     153            ) 
     154        ); 
     155 
     156        $oProc->CreateTable('calendar_task_to_activity_object', array( 
     157            'fd' => array( 
     158                'id' => array( 'type' => 'auto', 'nullable' => False), 
     159                'calendar_object_activity_id' => array(  'type' => 'int', 'precision' => '8', 'nullable' => False), 
     160                'calendar_object_task_id' => array(  'type' => 'int', 'precision' => '8', 'nullable' => False), 
     161                'owner' => array(  'type' => 'int', 'precision' => '8', 'nullable' => False), 
     162            ), 
     163            'pk' => array('id'), 
     164            'fk' => array(), 
     165            'ix' => array(), 
     166            'uc' => array() 
     167            ) 
     168        ); 
     169 
    139170        $GLOBALS['setup_info']['expressoCalendar']['currentver'] = '1.008'; 
    140171        return $GLOBALS['setup_info']['expressoCalendar']['currentver']; 
  • sandbox/2.4.2-expresso1/prototype/config/participant.ini

    r6111 r6968  
    1919deepnessReadParticipant = modules/calendar/interceptors/DBMapping.php 
    2020 
     21[after.create] 
     22createParticipantHistoric = modules/calendar/interceptors/DBMapping.php 
     23 
     24[before.delete] 
     25prepareParticipantHistoric = modules/calendar/interceptors/DBMapping.php 
     26 
     27[after.delete] 
     28removeParticipantHistoric = modules/calendar/interceptors/DBMapping.php 
     29 
    2130[after.commit] 
    2231commitParticipant = modules/calendar/interceptors/Notifications.php 
     32 
    2333 
    2434[PostgreSQL.mapping] 
  • sandbox/2.4.2-expresso1/prototype/config/schedulable.ini

    r6945 r6968  
    1515[after.create] 
    1616createCalendarToSchedulable = modules/calendar/interceptors/DBMapping.php 
    17 ;createTasksToActivity = modules/calendar/interceptors/DBMapping.php 
    1817 
    1918[before.find] 
     
    3130[after.update] 
    3231putEvent = modules/calendar/interceptors/DBMapping.php 
     32createHistoric = modules/calendar/interceptors/DBMapping.php 
    3333 
    3434[after.read] 
  • sandbox/2.4.2-expresso1/prototype/config/schedulableToAttachment.ini

    r6369 r6968  
    55schedulable = schedulable.attachments 
    66 
     7[after.create] 
     8createAttachmentHistoric = modules/calendar/interceptors/DBMapping.php 
     9 
    710[before.delete] 
    811decodeSchedulablettachment = modules/calendar/interceptors/DBMapping.php 
    912 
    1013[after.delete] 
     14removeAttachmentHistoric = modules/calendar/interceptors/DBMapping.php 
    1115deleteAttachmentDependences = modules/calendar/interceptors/DBMapping.php 
    1216 
  • sandbox/2.4.2-expresso1/prototype/modules/calendar/css/style.css

    r6961 r6968  
    575575.div-addtask fieldset#calendar_addtask_details5.tab-level2{margin: 0} 
    576576 
    577 .div-addtask  #calendar_addtask_details8 .parent {width: 715px; min-height: 208px; float: left;} 
    578 .div-addtask  #calendar_addtask_details8 .parent .child-top {width: 745px; height: 30px; background: #E8F4FD; border-left: 1px solid #CCC; border-right: 1px solid #CCC; border-bottom: 1px solid #CCC;} 
     577.div-addtask  #calendar_addtask_details8 .parent {width: 746px; min-height: 208px; float: left;} 
     578/*.div-addtask  #calendar_addtask_details8 .parent .child-top {width: 745px; height: 20px; background: #E8F4FD; border-left: 1px solid #CCC; border-right: 1px solid #CCC; border-bottom: 1px solid #CCC;}*/ 
     579.div-addtask  #calendar_addtask_details8 .parent .child-top {width: 745px; height: 25px; background: #E8F4FD; border-left: 1px solid #CCC; border-right: 1px solid #CCC; border-bottom: 1px solid #CCC; border-top: 1px solid #CCC;} 
    579580.div-addtask  #calendar_addtask_details8 .parent .child-bottom {width: 745px; height: 208px; overflow: auto;  float: left; border-left: 1px solid #CCC; border-right: 1px solid #CCC; border-bottom: 1px solid #CCC;} 
    580 .div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each { height: 30px; } 
     581.div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each { height: 20px; } 
    581582.div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each:hover { background: #FFF2F2; cursor: pointer;} 
    582583 
    583 .div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .date-hour { width: 30%; float: left; height: 30px} 
     584.div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .date-hour { width: 140px; float: left; height: 20px} 
    584585.div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .date-hour span { margin: 8px; float: left; } 
    585 .div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .organization{ width: 69%; float: left;  height: 30px; border-left: 1px solid #CCC; } 
    586 .div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .organization span{ margin: 8px; float: left; } 
    587  
    588 .div-addtask  #calendar_addtask_details8 .parent .child-top .date-hour { width: 29%; float: left; background: #E8F4FD; height: 30px; } 
    589 .div-addtask  #calendar_addtask_details8 .parent .child-top .date-hour span{ margin: 8px; float: left; font-weight: bold; color: #2E6E9E; } 
    590 .div-addtask  #calendar_addtask_details8 .parent .child-top .organization { width: 70%; float: left; background: #E8F4FD; height: 30px; border-left: 1px solid #CCC; font-weight: bold; color: #2E6E9E; } 
    591 .div-addtask  #calendar_addtask_details8 .parent .child-top .organization span{margin: 8px; float: left; } 
     586.div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .user{ width: 150px; float: left;  height: 20px; border-left: 1px solid #CCC; } 
     587.div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .user span{ margin: 8px; float: left; } 
     588.div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .attribute{ width: 130px; float: left;  height: 20px; border-left: 1px solid #CCC; } 
     589.div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .attribute span{ margin: 8px; float: left; } 
     590.div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .beforeValue{ width: 150px; float: left;  height: 20px; border-left: 1px solid #CCC; } 
     591.div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .beforeValue span{ margin: 8px; float: left; } 
     592.div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .afterValue{ width: 150px; float: left;  height: 20px; border-left: 1px solid #CCC; } 
     593.div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .afterValue span{ margin: 8px; float: left; } 
     594 
     595.div-addtask  #calendar_addtask_details8 .parent .child-top .date-hour { width: 140px; float: left; background: #E8F4FD; height: 20px; text-align: center; } 
     596.div-addtask  #calendar_addtask_details8 .parent .child-top .date-hour span{ margin: 6px 0; position: absolute; font-weight: bold; color: #2E6E9E; } 
     597.div-addtask  #calendar_addtask_details8 .parent .child-top .user { width: 150px; float: left; background: #E8F4FD; height: 20px; font-weight: bold; color: #2E6E9E; text-align: center;} 
     598.div-addtask  #calendar_addtask_details8 .parent .child-top .user span{margin: 6px 0; position: absolute; } 
     599.div-addtask  #calendar_addtask_details8 .parent .child-top .attribute { width: 130px; float: left; background: #E8F4FD; height: 20px; font-weight: bold; color: #2E6E9E;  text-align: center;} 
     600.div-addtask  #calendar_addtask_details8 .parent .child-top .attribute span{margin: 6px 0; position: absolute; } 
     601.div-addtask  #calendar_addtask_details8 .parent .child-top .beforeValue { width: 150px; float: left; background: #E8F4FD; height: 20px; font-weight: bold; color: #2E6E9E;  text-align: center;} 
     602.div-addtask  #calendar_addtask_details8 .parent .child-top .beforeValue span{margin: 6px 0; position: absolute; } 
     603.div-addtask  #calendar_addtask_details8 .parent .child-top .afterValue { width: 150px; float: left; background: #E8F4FD; height: 20px; font-weight: bold; color: #2E6E9E;  text-align: center;} 
     604.div-addtask  #calendar_addtask_details8 .parent .child-top .afterValue span{margin: 6px 0; position: absolute; } 
    592605 
    593606/*Atividades*/ 
  • sandbox/2.4.2-expresso1/prototype/modules/calendar/interceptors/DBMapping.php

    r6945 r6968  
    188188    public function findTask(&$uri, &$params, &$criteria, $original) { 
    189189 
    190         ob_start(); 
    191         print_r('$uri' . "\n"); 
    192         print_r($uri); 
    193         print_r('$params' . "\n"); 
    194         print_r($params); 
    195         print_r('$criteria' . "\n"); 
    196         print_r($criteria); 
    197         print_r('$original' . "\n"); 
    198         print_r($original); 
    199         $output = ob_get_clean(); 
    200         file_put_contents( "/tmp/acoutinho.log",  $output , FILE_APPEND); 
    201190        if (isset($criteria['filterTasks']) && $criteria['filterTasks']) { 
    202191 
     
    473462 
    474463        $event = Controller::read(array('concept' => 'schedulable', 'id' => $params['id'])); 
    475          
     464                     
    476465        if (isset($params['startTime'])) { 
    477466 
     
    485474 
    486475            if (!is_numeric($params['endTime'])) { 
    487                 $params['endTime'] = self::parseTimeDate($params['endTime'], $event['timezone']); 
    488  
    489             if ((isset($params['allDay']) && $params['allDay']) || ( !isset($params['allDay']) && $event['allDay'])) 
    490                 $params['endTime'] = $params['endTime'] + 86400000; 
     476                        $params['endTime'] = self::parseTimeDate($params['endTime'], $event['timezone']); 
     477 
     478                    if ((isset($params['allDay']) && $params['allDay']) || ( !isset($params['allDay']) && $event['allDay'])) 
     479                        $params['endTime'] = $params['endTime'] + 86400000; 
    491480            } 
    492481            $params['rangeEnd'] = $params['endTime']; 
     
    496485        if (isset($params['due']) && $params['due'] != '' && !is_numeric($params['due'])) 
    497486            $params['due'] = self::parseTimeDate($params['due'], $event['timezone']); 
     487 
     488 
     489        if($event['type'] == '2'){ 
     490 
     491            $criteria['historic'] = $params; 
     492            $criteria['beforeValue'] = $event; 
     493 
     494            if(isset($params['startTime']) && $params['startTime'] == $event['startTime']) 
     495                unset($criteria['historic']['startTime']); 
     496 
     497            if(isset($params['endTime']) && $params['endTime'] == $event['endTime']) 
     498                unset($criteria['historic']['endTime']); 
     499 
     500            if(isset($params['due']) && $params['due'] == $event['due']) 
     501                unset($criteria['historic']['due']); 
     502 
     503            unset($criteria['historic']['rangeEnd']); 
     504            unset($criteria['historic']['rangeStart']); 
     505            unset($criteria['historic']['id']);             
     506        } 
    498507    } 
    499508 
     
    526535    } 
    527536 
     537 
     538    static function prepareParticipantHistoric(&$uri, &$params, &$criteria, $original){ 
     539       $participant = Controller::read(array('concept' => 'participant', 'id' => $uri['id'])); 
     540       $schedulable = Controller::read(array('concept' => 'schedulable', 'id' => $participant['schedulable'])); 
     541 
     542 
     543       if($schedulable['type'] == '2') 
     544            $criteria['historic']['participant']  = $participant; 
     545    }  
     546 
     547    static function removeParticipantHistoric(&$uri, &$params, &$criteria, $original){ 
     548        if(isset($criteria['historic'])){ 
     549 
     550            $participant = $criteria['historic']['participant']; 
     551 
     552             Controller::create(array('concept' => 'calendarHistoric'),  
     553                array('schedulable' => $participant['schedulable'],  
     554                    'user' => Config::me('uidNumber'), 
     555                    'time' => time() . '000', 
     556                    'attribute' => 'participant', 
     557                    'beforeValue' => $participant['user'], 
     558                    'afterValue' => '' 
     559                    ) 
     560                ); 
     561 
     562        } 
     563 
     564    } 
     565 
     566    static function createParticipantHistoric(&$uri, &$params, &$criteria, $original){ 
     567 
     568        if(!isset($criteria['event'])){ 
     569            $event = Controller::read(array('concept' => 'schedulable', 'id' => $original['properties']['schedulable'])); 
     570            $criteria['event'] = $event; 
     571        }else 
     572            $event = $criteria['event']; 
     573 
     574        if($event['type'] == '2'){ 
     575             Controller::create(array('concept' => 'calendarHistoric'),  
     576                array('schedulable' => $original['properties']['schedulable'],  
     577                    'user' => Config::me('uidNumber'), 
     578                    'time' => time() . '000', 
     579                    'attribute' => 'participant', 
     580                    'beforeValue' => '', 
     581                    'afterValue' => $original['properties']['user'] 
     582                    ) 
     583                ); 
     584        } 
     585    } 
     586 
     587    static function createHistoric(&$uri, &$result, &$criteria, $original) { 
     588 
     589        if(isset($criteria['historic']) && count($criteria['historic'])){ 
     590            $time =  time() . '000'; 
     591 
     592            foreach($criteria['historic'] as $k => $v){ 
     593                Controller::create(array('concept' => 'calendarHistoric'),  
     594                    array('schedulable' => $uri['id'],  
     595                        'user' => Config::me('uidNumber'), 
     596                        'time' => $time, 
     597                        'attribute' => $k, 
     598                        'beforeValue' => $criteria['beforeValue'][$k], 
     599                        'afterValue' => $v 
     600                        ) 
     601                    ); 
     602            } 
     603        }     
     604    } 
     605 
    528606/////////////////////////////////////////////////////////////////////////////////////////////////////////////// 
    529607 
     
    542620    public function createTasksToActivity(&$uri, &$result, &$criteria, $original) { 
    543621 
    544         ob_start(); 
    545         print_r('$uri' . "\n"); 
    546         print_r($uri); 
    547         print_r('$params' . "\n"); 
    548         print_r($params); 
    549         print_r('$criteria' . "\n"); 
    550         print_r($criteria); 
    551         print_r('$original' . "\n"); 
    552         print_r($original); 
    553         $output = ob_get_clean(); 
    554         file_put_contents( "/tmp/acoutinho.log",  $output , FILE_APPEND); 
    555  
    556622        if(isset($original['properties']['taskToActivity']) && $original['properties']['taskToActivity']){ 
    557623 
     
    563629    } 
    564630 
    565     public function createCreateSchedulableToAttachment(&$uri, &$params, &$criteria, $original) { 
    566         if (array_key_exists('attachments', $original['properties'])) 
    567             foreach ($original['properties']['attachments'] as $key => $value) { 
    568                 if (isset($params['id'])) 
    569                     Controller::create(array('concept' => 'schedulableToAttachment'), array('attachment' => $value['attachment'], 'schedulable' => $params['id'])); 
    570             } 
     631    public function removeAttachmentHistoric(&$uri, &$params, &$criteria, $original) { 
     632 
     633        if(isset($criteria['historic'])){ 
     634            $attachment = $criteria['historic']['attachment']; 
     635 
     636            $attachment['attachment'] = Controller::read(array('concept' => 'attachment', 'id' => $attachment['attachment']), array('name')); 
     637            Controller::create(array('concept' => 'calendarHistoric'),  
     638                    array('schedulable' => $attachment['schedulable'],  
     639                        'user' => Config::me('uidNumber'), 
     640                        'time' => time() . '000', 
     641                        'attribute' => 'attachment', 
     642                        'beforeValue' => $attachment['attachment']['name'], 
     643                        'afterValue' => '' 
     644                        ) 
     645                    ); 
     646 
     647        } 
     648     
     649    } 
     650 
     651    public function createAttachmentHistoric(&$uri, &$params, &$criteria, $original) { 
     652        $event = Controller::read(array('concept' => 'schedulable', 'id' => $original['properties']['schedulable'])); 
     653 
     654        if($event['type'] == '2'){ 
     655            $attachment = Controller::read(array('concept' => 'attachment', 'id' => $original['properties']['attachment']), array('name')); 
     656 
     657            Controller::create(array('concept' => 'calendarHistoric'),  
     658                array('schedulable' => $original['properties']['schedulable'],  
     659                    'user' => Config::me('uidNumber'), 
     660                    'time' => time() . '000', 
     661                    'attribute' => 'attachment', 
     662                    'beforeValue' => '', 
     663                    'afterValue' => $attachment['name'] 
     664                    ) 
     665                ); 
     666 
     667        } 
    571668    } 
    572669 
     
    618715    } 
    619716 
    620  
     717    //TODO: Remover apos suporte a deepness na api  
     718    public function deepnessFindHistoric(&$uri, &$result, &$criteria, $original) { 
     719        if (isset($original['criteria']['deepness']) && $original['criteria']['deepness'] != 0) { 
     720            foreach($result as &$v){ 
     721                $v['user'] = Controller::read(array('concept' => 'user', 'id' => $v['user'])); 
     722 
     723                if($v['attribute'] == 'participant'){ 
     724                    if($v['beforeValue'] != '') 
     725                        $v['beforeValue'] = Controller::read(array('concept' => 'user', 'id' => $v['beforeValue'])); 
     726 
     727                    if($v['afterValue'] != '') 
     728                        $v['afterValue'] = Controller::read(array('concept' => 'user', 'id' => $v['afterValue'])); 
     729                } 
     730            } 
     731        } 
     732    } 
    621733 
    622734    //TODO: Remover apos suporte a deepness na api  
     
    659771            if($taskToActivity) 
    660772                $result[$i]['taskToActivity'] = $taskToActivity; 
     773 
     774            $result[$i]['historic'] = Controller::find(array('concept' => 'calendarHistoric'), false, array('filter' => array('=', 'schedulable', $v['id']) , 'deepness' => 2)); 
    661775 
    662776        } 
     
    10121126            $schedulableAttachment = Controller::read(array('concept' => 'schedulableToAttachment'), false, array('filter' => array( '=', 'attachment' , $original['URI']['id'] ))); 
    10131127            $uri['id'] = $schedulableAttachment[0]['id']; 
     1128 
     1129            $params = $schedulableAttachment[0]; 
     1130 
     1131            $event = Controller::read(array('concept' => 'schedulable', 'id' => $params['schedulable'])); 
     1132            if($event['type'] == '2') 
     1133                $criteria['historic']['attachment'] = $schedulableAttachment[0]; 
     1134 
    10141135        } 
    10151136    } 
    10161137 
    10171138    public function deleteAttachmentDependences(&$uri, &$params, &$criteria, $original) { 
    1018         Controller::delete(array('concept' => 'attachment', 'id' => $original['URI']['id'])); 
     1139        Controller::delete(array('concept' => 'attachment', 'id' => (isset($params['attachment']) ? $params['attachment'] : $original['URI']['id']))); 
    10191140    } 
    10201141     
     
    11921313 
    11931314    public function davcalCreateCollection(&$uri, &$params, &$criteria, $original) { 
    1194         if (Config::module('useCaldav', 'expressoCalendar')) { 
    1195             require_once ROOTPATH . '/modules/calendar/interceptors/DAViCalAdapter.php'; 
    1196             DAViCalAdapter::mkcalendar($params['location'], $params['name'], isset($params['description']) ? $params['description'] : '' ); 
    1197         } 
     1315        if (Config::module('useCaldav', 'expressoCalendar')) { 
     1316            require_once ROOTPATH . '/modules/calendar/interceptors/DAViCalAdapter.php'; 
     1317            DAViCalAdapter::mkcalendar($params['location'], $params['name'], isset($params['description']) ? $params['description'] : '' ); 
     1318           } 
    11981319    } 
    11991320 
    12001321    public function davcalDeleteCollection(&$uri, &$params, &$criteria, $original) { 
    1201         if (Config::module('useCaldav', 'expressoCalendar') && Config::module('onRemoveCascadeCalDav')) { 
    1202             require_once ROOTPATH . '/modules/calendar/interceptors/DAViCalAdapter.php'; 
    1203             $calendar = Controller::read($uri); 
    1204             DAViCalAdapter::rmCalendar($calendar['location']); 
    1205         } 
     1322        if (Config::module('useCaldav', 'expressoCalendar') && Config::module('onRemoveCascadeCalDav')) { 
     1323            require_once ROOTPATH . '/modules/calendar/interceptors/DAViCalAdapter.php'; 
     1324            $calendar = Controller::read($uri); 
     1325            DAViCalAdapter::rmCalendar($calendar['location']); 
     1326        } 
    12061327    } 
    12071328 
    12081329    public function davcalUpdateCollection(&$uri, &$params, &$criteria, $original) { 
    1209         if (Config::module('useCaldav', 'expressoCalendar')) { 
    1210             require_once ROOTPATH . '/modules/calendar/interceptors/DAViCalAdapter.php'; 
    1211             if (isset($params['location'])) { 
    1212                 $calendar = Controller::read($uri); 
    1213                 if ($calendar['location'] !== $params['location']) 
    1214                     DAViCalAdapter::mvcalendar($calendar['location'], $params['location']); 
    1215             } 
    1216         } 
     1330        if (Config::module('useCaldav', 'expressoCalendar')) { 
     1331            require_once ROOTPATH . '/modules/calendar/interceptors/DAViCalAdapter.php'; 
     1332            if (isset($params['location'])) { 
     1333                $calendar = Controller::read($uri); 
     1334                if ($calendar['location'] !== $params['location']) 
     1335                    DAViCalAdapter::mvcalendar($calendar['location'], $params['location']); 
     1336            } 
     1337        } 
    12171338    } 
    12181339 
  • sandbox/2.4.2-expresso1/prototype/modules/calendar/js/calendar.codecs.js

    r6955 r6968  
    727727        dueTime: (!objEvent.due || objEvent.due == '' || objEvent.due == '0') ? '' : dateCalendar.formatDate(Timezone.getDateEvent(new Date( parseInt(objEvent.due)), objEvent.timezone, objEvent.calendar, objEvent.DayLigth, 'startTime'), User.preferences.hourFormat), 
    728728        allDay: !!parseInt( objEvent.allDay ), 
    729             historic: [], 
     729            historic: !!objEvent.historic ? decodeHistotic(objEvent) : [] , 
    730730        attachments: $.map(objEvent.attachments || [], function( attachment, i ){ 
    731731            var attach = DataLayer.get('schedulableToAttachment', attachment, false); 
     
    802802    } 
    803803}); 
     804 
     805function decodeHistotic ( evt ) { 
     806    var historic = evt.historic; 
     807    var decoded = []; 
     808    var attributeDecoded = { 
     809        'startTime': 'Data de inicio', 
     810        'endTime' : 'Data de fim', 
     811        'summary' : 'Título', 
     812        'description': 'Descrição', 
     813        'status': 'Status', 
     814        'percentage': 'Porcentagem', 
     815        'priority': 'Priorudade', 
     816        'due' : 'Previsão de término' 
     817    } 
     818 
     819    var decodeDate = function(time){ 
     820        return new Date( parseInt( time) ).setTimezoneOffset( Timezone.timezone( evt.timezone ) ).toString( User.preferences.dateFormat+' - '+User.preferences.hourFormat ); 
     821    }; 
     822 
     823    var decodeItem = function(historic){ 
     824        switch(historic.attribute){ 
     825            case 'startTime': 
     826            case 'endTime' : 
     827            case 'due': 
     828                return { 
     829                    user : historic.user, 
     830                    attribute : attributeDecoded[historic.attribute], 
     831                    beforeValue : decodeDate(historic.beforeValue), 
     832                    afterValue : decodeDate(historic.afterValue), 
     833                    time: decodeDate(historic.time) 
     834                } 
     835            break; 
     836            case 'participant': 
     837                return{ 
     838                    user : historic.user, 
     839                    attribute : historic.beforeValue == '' ? ('Novo participante') : ('Rem. participante'), 
     840                    beforeValue : historic.beforeValue == '' ? '' : historic.beforeValue.mail, 
     841                    afterValue : historic.afterValue == '' ? '' : historic.afterValue.mail, 
     842                    time: decodeDate(historic.time) 
     843                } 
     844            break; 
     845            case 'attachment': 
     846                return{ 
     847                    user : historic.user, 
     848                    attribute : historic.beforeValue == '' ? ('Novo anexo') : ('Rem. anexo'), 
     849                    beforeValue : historic.beforeValue, 
     850                    afterValue : historic.afterValue, 
     851                    time: decodeDate(historic.time) 
     852                } 
     853            case 'percentage': 
     854                    return{ 
     855                    user : historic.user, 
     856                    attribute :attributeDecoded[historic.attribute], 
     857                    beforeValue : historic.beforeValue+' %', 
     858                    afterValue : historic.afterValue+' %', 
     859                    time: decodeDate(historic.time) 
     860                } 
     861            break; 
     862            default: 
     863                return { 
     864                    user : historic.user, 
     865                    attribute : attributeDecoded[historic.attribute], 
     866                    beforeValue : historic.beforeValue, 
     867                    afterValue : historic.afterValue, 
     868                    time: decodeDate(historic.time) 
     869                } 
     870            break; 
     871 
     872        } 
     873    } 
     874 
     875    for(var i = 0; i < historic.length; i++) 
     876        decoded.push(decodeItem(historic[i])); 
     877 
     878    return decoded; 
     879 
     880} 
    804881 
    805882DataLayer.codec( "schedulable", "taskSearch", { 
  • sandbox/2.4.2-expresso1/prototype/modules/calendar/templates/task_add.ejs

    r6965 r6968  
    169169                         
    170170                        <div class="child-top"> 
    171                                 <div class="date-hour"><span>Data -Hora</span></div> 
    172                                 <div class="organization"><span>Participante/Organizador</span></div> 
     171                                <div class="date-hour"><span>Data-Hora</span></div> 
     172                <div class="user"><span>Participante</span></div> 
     173                <div class="attribute"><span>Alterou</span></div> 
     174                <div class="beforeValue"><span>De</span></div> 
     175                                <div class="afterValue"><span>Para</span></div> 
    173176                        </div> 
    174177 
    175178                        <div class="child-bottom"> 
    176                          
    177                  
    178                             <%  
    179                                 if(data.task.historic){ 
     179                            <% if(data.task.historic){ 
    180180                                        for(var i=0; i< data.task.historic.length; i++){ %> 
    181                                 <div class="child-bottom-each"> 
    182                                     <div class="date-hour"><span><%= data.task.historic[i].date %></span></div> 
    183                                     <div class="organization"><span><%= data.task.historic[i].description %></span></div> 
    184                                 </div> 
     181                                        <div class="child-bottom-each"> 
     182                                            <div class="date-hour"><span><%= data.task.historic[i].time %></span></div> 
     183                            <div class="user"><span><%= data.task.historic[i].user.name %></span></div> 
     184                            <div class="attribute"><span><%= data.task.historic[i].attribute %></span></div> 
     185                            <div class="beforeValue"><span><%= data.task.historic[i].beforeValue %></span></div> 
     186                                            <div class="afterValue"><span><%= data.task.historic[i].afterValue %></span></div> 
     187                                        </div> 
    185188                            <%  }        
    186189                                }                                
Note: See TracChangeset for help on using the changeset viewer.