Changeset 7980 for trunk


Ignore:
Timestamp:
03/08/13 11:50:57 (11 years ago)
Author:
cristiano
Message:

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

Location:
trunk
Files:
2 added
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/inc/class.uiconfig.inc.php

    r7655 r7980  
    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                                                        } 
  • trunk/expressoCalendar/inc/hook_admin.inc.php

    r5804 r7980  
    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 
  • trunk/expressoCalendar/templates/default/config.tpl

    r5804 r7980  
    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 --> 
  • trunk/phpgwapi/setup/phpgw_pt-br.lang

    r5870 r7980  
    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 
  • trunk/prototype/config/participant.ini

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

    r7973 r7980  
    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 
     
    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        if(isset($autoCommit[0]) && $autoCommit[0]['config_value'] == 'true') 
     1419        { 
     1420            $defaultCalendar = Controller::find(array('concept' => 'modulePreference'), array('value','id') , array('filter' => array( 'and' , array('=' , 'name' , 'dafaultImportCalendar') , array('=' , 'module' , 'expressoCalendar') , array('=' , 'user' , $original['properties']['user'])  )) ); 
     1421            if(isset($defaultCalendar[0])  && $defaultCalendar[0]['value'] == $signature['calendar'] ) 
     1422            { 
     1423                Controller::delete(array('concept' => 'modulePreference', 'id' => $defaultCalendar[0]['id'])); 
     1424            } 
     1425        } 
     1426 
     1427        $permissions = Controller::find(array('concept' => 'calendarToPermission'), array('id'), array('filter' => array('=', 'calendar', $signature['calendar']))); 
     1428 
    13991429                if($permissions && count($permissions) > 0){ 
    14001430                        $ids = array(); 
     
    15431573                } 
    15441574 
    1545                     DAViCalAdapter::importCollection($v->url, $calCreated['id']); 
     1575                if($i == 0) 
     1576                { 
     1577                    $pref = array(); 
     1578                    $pref['user'] = $_SESSION['wallet']['user']['uidNumber']; 
     1579                    $pref['value'] = $calCreated['id']; 
     1580                    $pref['name'] = 'dafaultImportCalendar' ; 
     1581                    $pref['module'] = 'expressoCalendar'; 
     1582                    Controller::create(array('concept' => 'modulePreference'), $pref); 
     1583                } 
     1584 
    15461585                } 
    15471586            } else { 
     
    15651604 
    15661605                $sigCreated = Controller::create(array('concept' => 'calendarSignature'), $sig); 
     1606 
     1607 
     1608            $pref = array(); 
     1609            $pref['user'] = $_SESSION['wallet']['user']['uidNumber']; 
     1610            $pref['value'] = $calCreated['id']; 
     1611            $pref['name'] = 'dafaultImportCalendar' ; 
     1612            $pref['module'] = 'expressoCalendar'; 
     1613            Controller::create(array('concept' => 'modulePreference'), $pref); 
     1614 
     1615 
    15671616        } 
    15681617     
  • trunk/prototype/modules/calendar/js/calendar.codecs.js

    r7959 r7980  
    18581858                                occurrence: occurrences[i], 
    18591859                                type: typeEvent, 
    1860                                 calendar: evt.calendar,  
     1860                                calendar: evt.calendar, 
     1861                unanswered: evt.unanswered, 
    18611862                                status: evt.status 
    18621863                                }, (parseInt(typeEvent) == 1 ? eventEditable(evt.id, isRepeat, i ) : (parseInt(typeEvent) == 2 ? taskEditable(evt.id) : {editable: false, disableResizing: true, disableDragging: true})))); 
  • trunk/prototype/modules/calendar/js/helpers.js

    r7964 r7980  
    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 ){ 
    15681570                tabPrefCalendar.find('select[name="timezone"]').html(timezones_options).find('option[value="'+User.preferences.timezone+'"]').attr('selected','selected').trigger('change'); 
    15691571            }); 
  • trunk/prototype/modules/calendar/js/init.js

    r7957 r7980  
    359359                        var status_ball = ""; //nome da imagem a ser inserida 
    360360                        var status_img = ""; 
    361                         if(event.type == 1) 
    362                                 img_icon = "mini-event.png"; 
    363                         if(event.type == 2) 
    364                                 img_icon = "mini-task.png"; 
    365                         if(event.type == 3) 
    366                                 img_icon = "mini-activity.png"; 
    367  
    368                         //se for diferente de evento(type 1). 
    369                         if(event.type != 1){ 
    370                                 if(event.status == "1"){ 
    371                                         status_ball = "gray.png"; 
    372                                 }else if(event.status == "2"){ 
    373                                         status_ball = "yellow.png"; 
    374                                 }else if(event.status == "3"){ 
    375                                         status_ball = "green.png"; 
    376                                 }else if(event.status == "4"){ 
    377                                         status_ball = "red.png"; 
    378                                 } 
    379  
    380                                 status_img = '<img style="width: 8px; height: 8px; margin-bottom: 2px;" src="../prototype/modules/calendar/img/' + status_ball + '"></img>'; 
    381                         } 
     361 
     362            if( !!parseInt(event.unanswered)  ){ 
     363 
     364                img_icon = "mini-attention.png"; 
     365 
     366            }else{ 
     367 
     368                if(event.type == 1) 
     369                    img_icon = "mini-event.png"; 
     370                if(event.type == 2) 
     371                    img_icon = "mini-task.png"; 
     372                if(event.type == 3) 
     373                    img_icon = "mini-activity.png"; 
     374 
     375                //se for diferente de evento(type 1). 
     376                if(event.type != 1){ 
     377                    if(event.status == "1"){ 
     378                        status_ball = "gray.png"; 
     379                    }else if(event.status == "2"){ 
     380                        status_ball = "yellow.png"; 
     381                    }else if(event.status == "3"){ 
     382                        status_ball = "green.png"; 
     383                    }else if(event.status == "4"){ 
     384                        status_ball = "red.png"; 
     385                    } 
     386 
     387                    status_img = '<img style="width: 8px; height: 8px; margin-bottom: 2px;" src="../prototype/modules/calendar/img/' + status_ball + '"></img>'; 
     388                } 
     389 
     390            } 
     391 
     392 
    382393                        //html que exibe a imagem do type e do status 
    383394            element.find(".fc-event-inner.fc-event-skin").prepend($('<img style="width: 11px; height: 13px;" class="" src="../prototype/modules/calendar/img/' + img_icon + '"></img>' + status_img)); 
  • trunk/prototype/modules/calendar/schedules.php

    r7956 r7980  
    161161            $attend = Controller::read(array('concept' => 'participant'), null, array('filter' => array('AND', array('=','schedulable',$v['id']), array('=','user', Config::me('uidNumber'))  ))); 
    162162 
     163            $result[$i]['unanswered'] = 0; 
     164 
    163165            if(count($attend) > 0 && !empty($attend)){ 
    164  
    165166                if(array_key_exists(0, $attend)) 
    166167                    $attend = $attend[0]; 
    167168 
    168169                $result[$i]['editable'] = (strstr($attend['acl'],"w") || strstr($attend['acl'],"o") || $attend['isOrganizer'] == '1') ? 1 : 0; 
     170 
     171                if($attend['status'] == STATUS_UNANSWERED) 
     172                    $result[$i]['unanswered'] = 1; 
    169173 
    170174            }else{ 
  • trunk/prototype/modules/calendar/templates/attendee_add.ejs

    r7388 r7980  
    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{%> 
  • trunk/prototype/modules/calendar/templates/event_detail_list.ejs

    r7702 r7980  
    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'}; 
  • trunk/prototype/modules/calendar/templates/preferences_calendar.ejs

    r7143 r7980  
    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.