Changeset 7982 for branches


Ignore:
Timestamp:
03/08/13 16:32:58 (11 years ago)
Author:
douglas
Message:

Ticket #3378 - Importação automatica de eventos nos participantes

Location:
branches/2.5
Files:
2 added
13 edited

Legend:

Unmodified
Added
Removed
  • branches/2.5/admin/inc/class.uiconfig.inc.php

    r7655 r7982  
    5353                                default: 
    5454                                        $appname = $_GET['appname']; 
    55                                         $config_appname = $appname; 
     55                                        $config_appname = (isset($_GET['config']) && $_GET['config']) ? $_GET['config'] : $appname ; 
    5656                                        break; 
    5757                        } 
     
    7272                        } 
    7373         
    74                 if($appname === "expressoCalendar"){                                             
     74                if($appname === "expressoCalendar"){  
     75  
     76            if($config_appname == 'expressoCalendar' )  
     77            {  
     78                $t->set_var('action_url',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiconfig.index&appname=' . $appname));  
     79  
     80            };  
     81  
     82            if($_POST['newsettings']['expressoCalendar_autoImportCalendars'] == 'true')  
     83            {  
     84                $db = $GLOBALS['phpgw']->db;  
     85                $calendars = array();  
     86                $db->query('SELECT calendar_signature.user_uidnumber as "user",calendar.id as "calendar" FROM calendar,calendar_signature WHERE calendar.id = calendar_signature.calendar_id AND calendar.type = 0 AND calendar_signature.is_owner = 1 AND (SELECT id from module_preference WHERE user_uidnumber = calendar_signature.user_uidnumber AND module_preference.module = \'expressoCalendar\' AND module_preference.name = \'dafaultImportCalendar\'  ) IS NULL');  
     87                while( $db->next_record() )  
     88                {  
     89                    $calendars[] = $db->row();  
     90                }  
     91  
     92                foreach($calendars as $v)  
     93                {  
     94                    $db->query('INSERT INTO module_preference ("user_uidnumber","value","name","module") VALUES ( \''.$v['user'].'\' , \''.$v['calendar'].'\',\'dafaultImportCalendar\' , \'expressoCalendar\')');  
     95                }  
     96            }  
     97  
    7598                        if (isset($_POST['migration']) && ($_POST['migration']  == "true")){ 
    7699                         
     
    80103                                $migratrion->calendar(); 
    81104                        } 
     105  
    82106                } 
    83107 
     
    105129                                                        if(function_exists(substr($key,0,strrpos($key,'_')))) 
    106130                                { 
    107                                 call_user_func(substr($key,0,strrpos($key,'_')),&$config); 
     131                                call_user_func(substr($key,0,strrpos($key,'_')), $config); 
    108132                                }  
    109133                                else  
     
    114138                                if($GLOBALS['config_error']) 
    115139                                                        { 
    116                                                                 $errors .= lang($GLOBALS['config_error']) . ' '; 
     140                                                                $errors = lang($GLOBALS['config_error']) . ' '; 
    117141                                                                $GLOBALS['config_error'] = False; 
    118142                                                        } 
  • branches/2.5/expressoCalendar/inc/hook_admin.inc.php

    r5804 r7982  
    1313        $title = $appname; 
    1414        $file = Array( 
    15                 'ExpressoCalendar migração' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiconfig.index&appname=' . $appname) 
     15                'ExpressoCalendar migration' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiconfig.index&appname=' . $appname. '&config=migra'),  
     16        'Global Settings' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiconfig.index&appname=' . $appname)  
    1617        ); 
    1718        //Do not modify below this line 
  • branches/2.5/expressoCalendar/templates/default/config.tpl

    r5804 r7982  
    11<!-- BEGIN header --> 
    2 <form  method="POST" action="{action_url}"> 
    3 <input type="hidden" name="migration" value="true"> 
    4 <table border="0" align="center"> 
    5         <tr class="th"> 
    6                 <td colspan="2"><font color="{th_text}">&nbsp;<b>{title}</b></font></td> 
    7         </tr> 
    8         <tr> 
    9                 <td></td> 
    10         </tr> 
    11         <tr> 
    12                 <td colspan="2"><b>{error}</b></td> 
    13         </tr> 
    14    <tr> 
    15         <td></td> 
    16    </tr> 
    17 <!-- END header --> 
    18 <!-- BEGIN body --> 
    19         <tr class="th"> 
    20                 <td colspan="2" align="center"><b>{lang_expressoCalendar_migration}</b></td> 
    21         </tr> 
    22         <tr> 
    23                 <td></td> 
    24         </tr> 
    25         <tr class="row_on"> 
    26                 <td>{lang_Migrate_all_calendar_events_for_expressoCalendar}:</td> 
    27         </tr>    
    28 <!-- END body --> 
    29 <!-- BEGIN footer --> 
    30         <tr class="th"> 
    31                 <td colspan="2">&nbsp;</td> 
    32         </tr> 
    33         <tr> 
    34                 <td colspan="2" align="center"> 
    35                         <input type="submit" name="submit" value="{lang_submit}"> 
    36                         <input type="submit" name="cancel" value="{lang_cancel}"> 
    37                 </td> 
    38         </tr> 
    39 </table> 
     2<form method="POST" action="{action_url}">  
     3    <table border="0" align="center">  
     4        <!-- END header -->  
     5        <!-- BEGIN body -->  
     6        <tr class="th">  
     7            <td colspan="2" align="center"><b>{lang_expressoCalendar_Setup}</b></td>  
     8        </tr>  
     9  
     10        <tr><td></td></tr>  
     11  
     12        <tr class="row_off">  
     13            <td>{lang_Auto_import_calendars_to_receive_an_internal_event}:</td>  
     14            <td>  
     15                <select name="newsettings[expressoCalendar_autoImportCalendars]">  
     16                    <option value="false" {selected_expressoCalendar_autoImportCalendars_false}>{lang_no}</option>  
     17                    <option value="true"  {selected_expressoCalendar_autoImportCalendars_true}>{lang_yes}</option>  
     18                </select>  
     19            </td>  
     20        </tr>  
     21        <!-- END body -->  
     22        <!-- BEGIN footer -->  
     23        <tr class="th">  
     24            <td colspan="2">&nbsp;</td>  
     25        </tr>  
     26        <tr>  
     27            <td colspan="2" align="center">  
     28                <input type="submit" name="submit" value="{lang_submit}">  
     29                <input type="submit" name="cancel" value="{lang_cancel}">  
     30            </td>  
     31        </tr>  
     32    </table>  
    4033</form> 
    4134<!-- END footer --> 
  • branches/2.5/phpgwapi/setup/phpgw_pt-br.lang

    r5870 r7982  
    5454austria common  pt-br   AUSTRIA 
    5555author  common  pt-br   Autor 
     56Auto import calendars to receive an internal event      common  pt-br   Auto importar calendarios ao receber um evento interno 
    5657autohide sidebox menus  common  pt-br   Ocultar Caixa do Menu 
    5758automacally hide the sidebox menus?     common  pt-br   Esconder automáticamente os menus laterais 
     
    208209exact   common  pt-br   exato(a) 
    209210exit    common  pt-br   Sair 
     211ExpressoCalendar migration      common  pt-br   ExpressoCalendar migração 
     212expressoCalendar Setup  common  pt-br   Configuração do ExpressoCalendar 
    210213ExpressoLivre is unavailable at this moment. Code %1<br>Please, try later.      common  pt-br   ExpressoLivre indisponível no momento. Código %1<br>Tente mais tarde. 
    211214Catalog is out of service, you will not able to do some operations      common  pt-br   O serviço de catálogo está em manutenção, você não poderá realizar algumas operações 
     
    244247gibraltar       common  pt-br   GIBRALTAR 
    245248Global Catalogues Configuration common  pt-br   Configuração Global do Catálogo 
     249Global Settings common  pt-br   Configurações globais 
    246250global  common  pt-br   Global 
    247251global public   common  pt-br   Público a todos 
  • branches/2.5/prototype/config/participant.ini

    r7377 r7982  
    2121[after.create] 
    2222createParticipantHistoric = modules/calendar/interceptors/DBMapping.php 
     23autoImportCalendar = modules/calendar/interceptors/DBMapping.php 
    2324 
    2425[before.create] 
  • branches/2.5/prototype/modules/calendar/interceptors/DBMapping.php

    r7978 r7982  
    169169    public function schedulableSecurity(&$uri, &$params, &$criteria, $original)  
    170170    { 
     171  
    171172        if( !isset($criteria['filter'][1]) || !$criteria['filter'][1] == 'uid')  
    172173        {  
     
    763764            } 
    764765        } 
     766    }  
     767  
     768    static function autoImportCalendar(&$uri, &$params, &$criteria, $original){  
     769        $autoCommit = Controller::service('PostgreSQL')->execResultSql('Select config_value FROM phpgw_config WHERE config_app = \'expressoCalendar\' AND config_name = \'expressoCalendar_autoImportCalendars\'');  
     770  
     771  
     772        if(isset($autoCommit[0]) && $autoCommit[0]['config_value'] == 'true')  
     773        {  
     774            if(isset($original['properties']) && isset($original['properties']['user'])  && isset($original['properties']['isOrganizer']) &&  $original['properties']['isOrganizer'] != '1')  
     775            {  
     776                $defaultCalendar = Controller::find(array('concept' => 'modulePreference'), array('value') , array('filter' => array( 'and' , array('=' , 'name' , 'dafaultImportCalendar') , array('=' , 'module' , 'expressoCalendar') , array('=' , 'user' , $original['properties']['user'])  )) );  
     777                if(isset($defaultCalendar[0]) && $defaultCalendar[0]['value'] > 0)  
     778                {  
     779                    Controller::create(array('concept' => 'calendarToSchedulable'),  
     780                        array('schedulable' => $original['properties']['schedulable'],  
     781                            'calendar' => $defaultCalendar[0]['value']  
     782                        )  
     783                    );  
     784                }  
     785            }  
     786        }  
    765787    } 
    766788 
     
    13781400 
    13791401    public function deleteCalendarSignatureDependences(&$uri, &$params, &$criteria, $original) { 
    1380         $signature = Controller::read($uri, array('isOwner', 'calendar')); 
     1402        $signature = Controller::read($uri, array('isOwner', 'calendar','user')); 
    13811403 
    13821404        if ($signature['isOwner'] == '1') { 
     
    13921414 
    13931415            Controller::delete(array('concept' => 'calendar', 'id' => $signature['calendar'])); 
    1394                  
    1395                 $permissions = Controller::find(array('concept' => 'calendarToPermission'), array('id'), array('filter' => array('=', 'calendar', $signature['calendar']))); 
    1396  
    1397                  
    1398                  
     1416  
     1417        $autoCommit = Controller::service('PostgreSQL')->execResultSql('Select config_value FROM phpgw_config WHERE config_app = \'expressoCalendar\' AND config_name = \'expressoCalendar_autoImportCalendars\'');  
     1418  
     1419        if(isset($autoCommit[0]) && $autoCommit[0]['config_value'] == 'true')  
     1420        {  
     1421            $defaultCalendar = Controller::find(array('concept' => 'modulePreference'), array('value','id') , array('filter' => array( 'and' , array('=' , 'name' , 'dafaultImportCalendar') , array('=' , 'module' , 'expressoCalendar') , array('=' , 'user' , $signature['user'])  )) );  
     1422  
     1423  
     1424            self::lg($defaultCalendar);  
     1425            if(isset($defaultCalendar[0])  && $defaultCalendar[0]['value'] == $signature['calendar'] )  
     1426            {  
     1427                Controller::delete(array('concept' => 'modulePreference', 'id' => $defaultCalendar[0]['id']));  
     1428            }  
     1429        }  
     1430  
     1431        $permissions = Controller::find(array('concept' => 'calendarToPermission'), array('id'), array('filter' => array('=', 'calendar', $signature['calendar'])));  
     1432  
    13991433                if($permissions && count($permissions) > 0){ 
    14001434                        $ids = array(); 
     
    15431577                } 
    15441578 
    1545                     DAViCalAdapter::importCollection($v->url, $calCreated['id']); 
     1579                if($i == 0)  
     1580                {  
     1581                    $pref = array();  
     1582                    $pref['user'] = $_SESSION['wallet']['user']['uidNumber'];  
     1583                    $pref['value'] = $calCreated['id'];  
     1584                    $pref['name'] = 'dafaultImportCalendar' ;  
     1585                    $pref['module'] = 'expressoCalendar';  
     1586                    Controller::create(array('concept' => 'modulePreference'), $pref);  
     1587                }  
     1588  
    15461589                } 
    15471590            } else { 
     
    15651608 
    15661609                $sigCreated = Controller::create(array('concept' => 'calendarSignature'), $sig); 
     1610  
     1611  
     1612            $pref = array();  
     1613            $pref['user'] = $_SESSION['wallet']['user']['uidNumber'];  
     1614            $pref['value'] = $calCreated['id'];  
     1615            $pref['name'] = 'dafaultImportCalendar' ;  
     1616            $pref['module'] = 'expressoCalendar';  
     1617            Controller::create(array('concept' => 'modulePreference'), $pref);  
     1618  
     1619  
    15671620        } 
    15681621     
  • branches/2.5/prototype/modules/calendar/js/calendar.codecs.js

    r7969 r7982  
    18561856                                occurrence: occurrences[i], 
    18571857                                type: typeEvent, 
    1858                                 calendar: evt.calendar 
     1858                                calendar: evt.calendar,  
     1859                unanswered: evt.unanswered,  
    18591860                                }, (parseInt(typeEvent) == 1 ? eventEditable(evt.id, isRepeat, i ) : (parseInt(typeEvent) == 2 ? taskEditable(evt.id) : {editable: false, disableResizing: true, disableDragging: true})))); 
    18601861        } 
  • branches/2.5/prototype/modules/calendar/js/helpers.js

    r7970 r7982  
    15591559        DataLayer.render( 'templates/preferences_calendar.ejs', { 
    15601560            preferences:User.preferences,  
    1561             calendars: Calendar.calendars 
     1561            calendars: Calendar.calendars,  
     1562        signatureOf : Calendar.signatureOf  
    15621563            }, function( template ){ 
    15631564            var tabPrefCalendar = jQuery('#preference_tab').html( template ).find('.preferences-win'); 
    15641565                 
    1565             tabPrefCalendar.find('option[value="'+User.preferences.defaultCalendar+'"]').attr('selected','selected').trigger('change'); 
    1566                  
    1567             DataLayer.render( 'templates/timezone_list.ejs', {}, function( timezones_options ){ 
     1566            tabPrefCalendar.find('select[name="defaultCalendar"] option[value="'+User.preferences.defaultCalendar+'"]').attr('selected','selected').trigger('change');  
     1567        tabPrefCalendar.find('select[name="dafaultImportCalendar"] option[value="'+User.preferences.dafaultImportCalendar+'"]').attr('selected','selected').trigger('change');  
     1568  
     1569        DataLayer.render( 'templates/timezone_list.ejs', {}, function( timezones_options ){  
     1570 
    15681571                tabPrefCalendar.find('select[name="timezone"]').html(timezones_options).find('option[value="'+User.preferences.timezone+'"]').attr('selected','selected').trigger('change'); 
    15691572            }); 
  • branches/2.5/prototype/modules/calendar/js/init.js

    r7968 r7982  
    358358 
    359359                        var img_icon = ""; 
     360  
     361            if( !!parseInt(event.unanswered)  ){  
     362  
     363                img_icon = "mini-attention.png";  
     364  
     365            }else{  
     366  
    360367                        if(event.type == 1) 
    361368                                img_icon = "mini-event.png"; 
     
    365372                                img_icon = "mini-activity.png"; 
    366373 
    367                          
     374        } 
     375                 
    368376            element.find(".fc-event-inner.fc-event-skin").prepend($('<img style="width: 11px; height: 13px;" class="" src="../prototype/modules/calendar/img/' + img_icon + '"></img>')); 
    369377                }, 
  • branches/2.5/prototype/modules/calendar/schedules.php

    r7967 r7982  
    158158            $attend = Controller::read(array('concept' => 'participant'), null, array('filter' => array('AND', array('=','schedulable',$v['id']), array('=','user', Config::me('uidNumber'))  ))); 
    159159 
     160            $result[$i]['unanswered'] = 0;  
     161  
    160162            if(count($attend) > 0 && !empty($attend)){ 
    161  
    162163                if(array_key_exists(0, $attend)) 
    163164                    $attend = $attend[0]; 
    164165 
    165166                $result[$i]['editable'] = (strstr($attend['acl'],"w") || strstr($attend['acl'],"o") || $attend['isOrganizer'] == '1') ? 1 : 0; 
     167  
     168                if($attend['status'] == STATUS_UNANSWERED)  
     169                    $result[$i]['unanswered'] = 1;  
    166170 
    167171            }else{ 
  • branches/2.5/prototype/modules/calendar/templates/attendee_add.ejs

    r7388 r7982  
    1111                                                <option value="3" <%= data.event.status=='3' ? 'selected="selected"':'' %>>Eu não vou</option> 
    1212                                                <option value="2" <%= data.event.status=='2' ? 'selected="selected"':'' %>>Talvez</option> 
    13                                                 <option class="hidden" value="5">Delegado</option> 
     13                        <option value="4" <%= data.event.status=='4' ? 'selected="selected"':'' %>>Sem resposta </option>  
     14                                            <option class="hidden" value="5" >Delegado</option>  
    1415                                        <%}%> 
    1516                                <%}else{%> 
  • branches/2.5/prototype/modules/calendar/templates/event_detail_list.ejs

    r7702 r7982  
    33    var encoder = {}; 
    44    encoder.alarm = {'1':'do evento','2':'da tarefa','3':'da atividade'}; 
    5     encoder.status = {'1':'Eu vou', '2':'Talvez', '3':'Eu não vou'}; 
     5    encoder.status = {'1':'Eu vou', '2':'Talvez', '3':'Eu não vou' , '4':'Sem resposta'}; 
    66    encoder.statusEvent = {1: 'Sem ações', 2: 'Em processo', 3: 'Completo', 4: 'Cancelado'}; 
    77    encoder.priority = {1: 'Alta', 2: 'Normal', 3: 'Baixa'}; 
  • branches/2.5/prototype/modules/calendar/templates/preferences_calendar.ejs

    r7143 r7982  
    7272 
    7373                        <p class="input-group">  
    74                 <label for="defaultCalendar">Agenda padrão:</label>  
     74                <label for="defaultCalendar">Agenda padrão para Criação de Eventos:</label>  
    7575                <select name="defaultCalendar" >  
    7676                    <%for(var i = 0; i < data.calendars.length; i++){%>  
     
    7979                </select> 
    8080                        </p> 
     81  
     82            <p class="input-group">  
     83                <label for="dafaultImportCalendar">Agenda padrão para Importação de Eventos :</label>  
     84                <select name="dafaultImportCalendar" >  
     85                    <option value=""> </option>  
     86                    <%for(var i = 0; i < data.calendars.length; i++){  
     87                     if(data.signatureOf[data.calendars[i].id].isOwner == '1'){  
     88                    %>  
     89                    <option value="<%=data.calendars[i].id%>"> <%= data.calendars[i].name %></option>  
     90                    <%}}%>  
     91                </select>  
     92            </p>  
    8193 
    8294                        <p class="input-group"> 
Note: See TracChangeset for help on using the changeset viewer.