Ignore:
Timestamp:
07/25/12 17:05:36 (12 years ago)
Author:
acoutinho
Message:

Ticket #2966 - Criacao e edicao de tarefas / suporte a anexos, alarmes, participantes e mapa de disponibilidade

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sandbox/2.4.2-expresso1/prototype/modules/calendar/js/map.disponibility.js

    r6444 r6876  
    88 
    99 
    10 function updateMap(data){ 
    11         var start_date = $(".new-event-win.active .start-date").val(); 
    12         var end_date   = $(".new-event-win.active .end-date").val(); 
    13         var start_time = $(".new-event-win.active .start-time").val(); 
    14         var end_time   = $(".new-event-win.active .end-time").val(); 
    15         var isAllDay   = $('.new-event-win.active input[name="allDay"]').is(':checked'); 
     10function updateMap(viewName){ 
     11        var start_date = $(".new-"+viewName+"-win.active .start-date").val(); 
     12        var end_date   = $(".new-"+viewName+"-win.active .end-date").val(); 
     13        var start_time = $(".new-"+viewName+"-win.active .start-time").val(); 
     14        var end_time   = $(".new-"+viewName+"-win.active .end-time").val(); 
     15        var isAllDay   = $('.new-'+viewName+'-win.active input[name="allDay"]').is(':checked'); 
    1616         
    1717        var formatString = User.preferences.dateFormat + " " + User.preferences.hourFormat; 
     
    2121         
    2222         
    23         var event = $("#new_event_map").fullCalendar('clientEvents', 'map')[0]; 
     23        var event = $('.new-'+viewName+'-win .map_disponibility').fullCalendar('clientEvents', 'map')[0]; 
    2424         
    2525         
     
    2828                        event.end = endDate; 
    2929                        event.allDay = isAllDay; 
    30                         $("#new_event_map").fullCalendar( 'updateEvent', event ) 
     30                        $('.new-'+viewName+'-win .map_disponibility').fullCalendar( 'updateEvent', event ) 
    3131                } 
    3232                 
     
    3535 
    3636 
    37 function disponibily(objEvent, path, attendees){ 
     37function disponibily(objEvent, path, attendees, viewName){ 
    3838        var formatString = User.preferences.dateFormat + " " + User.preferences.hourFormat; 
    3939        var startDate = Date.parseExact( objEvent.startDate + " " + $.trim(objEvent.startHour) , formatString ); 
    4040        var endDate = Date.parseExact( objEvent.endDate + " " + $.trim(objEvent.endHour) , formatString ); 
     41 
     42    var dialogName = {event: 'addEvent', task: 'addTask', activity: 'addActivity'} 
    4143          
    4244        var mapHtml = DataLayer.render( path+'templates/availability_map.ejs', {}); 
    43         $("#calendar_addevent_details7").html(mapHtml); 
    44         $("#new_event_map").fullCalendar(DataLayer.merge({ 
     45        $('#calendar_add'+viewName+'_details7').html(mapHtml); 
     46        $('.new-'+viewName+'-win .map_disponibility').fullCalendar(DataLayer.merge({ 
    4547                height : 300, 
    4648                timeFormat: User.preferences.hourFormat, 
     
    7779                        if(!allDay){ 
    7880                                $('[name="allDay"]').attr("checked", false);  
    79                                 UI.dialogs.addEvent.find('.start-time, .end-time').removeClass('hidden'); 
     81                                UI.dialogs[dialogName[viewName]].find('.start-time, .end-time').removeClass('hidden'); 
    8082                                 
    8183                                $('[name="startHour"]').val(start.toString(User.preferences.hourFormat)); 
     
    8587                        }else{ 
    8688                                $('[name="allDay"]').attr("checked", true);  
    87                                 UI.dialogs.addEvent.find('.start-time, .end-time').addClass('hidden'); 
     89                                UI.dialogs[dialogName[viewName]].find('.start-time, .end-time').addClass('hidden'); 
    8890                        } 
    8991                }, 
     
    98100                                className : "map-event", 
    99101                                backgroundColor : "transparent !important", 
    100                                 editable : objEvent.acl.write || objEvent.acl.organization 
     102                                editable : objEvent.acl ? (objEvent.acl.write || objEvent.acl.organization) : true 
    101103                        } 
    102104                ], 
     
    104106                        if(event.allDay){ 
    105107                                $('[name="allDay"]').attr("checked", true);  
    106                                 UI.dialogs.addEvent.find('.start-time, .end-time').addClass('hidden'); 
     108                                UI.dialogs[dialogName[viewName]].find('.start-time, .end-time').addClass('hidden'); 
    107109                                 
    108110                                $('[name="startDate"]').val(dateCalendar.toString(event.start, User.preferences.dateFormat));                            
     
    111113                        }else{ 
    112114                                $('[name="allDay"]').attr("checked", false);  
    113                                 UI.dialogs.addEvent.find('.start-time, .end-time').removeClass('hidden'); 
     115                                UI.dialogs[dialogName[viewName]].find('.start-time, .end-time').removeClass('hidden'); 
    114116                         
    115117                                $('[name="startHour"]').val(dateCalendar.formatDate(event.start, User.preferences.hourFormat)); 
     
    132134        var eventSource = new Array(); 
    133135        var updateMapView = function(){ 
    134                 updateMap(); 
    135                 var view = $("#new_event_map").fullCalendar('getView'); 
     136                updateMap(viewName); 
     137                var view = $('.new-'+viewName+'-win .map_disponibility').fullCalendar('getView'); 
    136138                var map = {}; 
    137                 $("#new_event_map").fullCalendar( 'removeEventSource', eventSource ); 
     139                $('.new-'+viewName+'-win .map_disponibility').fullCalendar( 'removeEventSource', eventSource ); 
    138140                eventSource = new Array();       
    139141                map = {startTime : view.start.getTime(), endTime : view.end.getTime(), attendees: {}, timezone: (objEvent.timezone || User.preferences.timezone)}; 
     
    167169                } 
    168170                if(eventSource.length) 
    169                         $("#new_event_map").fullCalendar( 'addEventSource', eventSource ); 
     171                        $('.new-'+viewName+'-win .map_disponibility').fullCalendar( 'addEventSource', eventSource ); 
    170172        };  
    171         $('[href="#calendar_addevent_details7"]').click(function(eventData, eventObject){ 
    172                 $("#new_event_map").fullCalendar( 'gotoDate', Date.parseExact($('[name="startDate"]').val() + " " + $.trim($('[name="startHour"]').val()), formatString) , formatString); 
    173                 //if(eventObject == undefined) 
    174                         updateMapView(); 
     173        $('[href="#calendar_add'+viewName+'_details7"]').click(function(eventData, eventObject){ 
     174                $('.new-'+viewName+'-win .map_disponibility').fullCalendar( 'gotoDate', Date.parseExact($('[name="startDate"]').val() + " " + $.trim($('[name="startHour"]').val()), formatString) , formatString); 
     175                  updateMapView(); 
    175176        });      
    176         $("#new_event_map").find(".fc-button-prev, .fc-button-next, .fc-button-today").click(function(){ 
     177        $('.new-'+viewName+'-win .map_disponibility').find(".fc-button-prev, .fc-button-next, .fc-button-today").click(function(){ 
    177178                updateMapView(); 
    178179        }); 
Note: See TracChangeset for help on using the changeset viewer.