- Timestamp:
- 07/25/12 17:05:36 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/2.4.2-expresso1/prototype/modules/calendar/js/map.disponibility.js
r6444 r6876 8 8 9 9 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');10 function 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'); 16 16 17 17 var formatString = User.preferences.dateFormat + " " + User.preferences.hourFormat; … … 21 21 22 22 23 var event = $( "#new_event_map").fullCalendar('clientEvents', 'map')[0];23 var event = $('.new-'+viewName+'-win .map_disponibility').fullCalendar('clientEvents', 'map')[0]; 24 24 25 25 … … 28 28 event.end = endDate; 29 29 event.allDay = isAllDay; 30 $( "#new_event_map").fullCalendar( 'updateEvent', event )30 $('.new-'+viewName+'-win .map_disponibility').fullCalendar( 'updateEvent', event ) 31 31 } 32 32 … … 35 35 36 36 37 function disponibily(objEvent, path, attendees ){37 function disponibily(objEvent, path, attendees, viewName){ 38 38 var formatString = User.preferences.dateFormat + " " + User.preferences.hourFormat; 39 39 var startDate = Date.parseExact( objEvent.startDate + " " + $.trim(objEvent.startHour) , formatString ); 40 40 var endDate = Date.parseExact( objEvent.endDate + " " + $.trim(objEvent.endHour) , formatString ); 41 42 var dialogName = {event: 'addEvent', task: 'addTask', activity: 'addActivity'} 41 43 42 44 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({ 45 47 height : 300, 46 48 timeFormat: User.preferences.hourFormat, … … 77 79 if(!allDay){ 78 80 $('[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'); 80 82 81 83 $('[name="startHour"]').val(start.toString(User.preferences.hourFormat)); … … 85 87 }else{ 86 88 $('[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'); 88 90 } 89 91 }, … … 98 100 className : "map-event", 99 101 backgroundColor : "transparent !important", 100 editable : objEvent.acl .write || objEvent.acl.organization102 editable : objEvent.acl ? (objEvent.acl.write || objEvent.acl.organization) : true 101 103 } 102 104 ], … … 104 106 if(event.allDay){ 105 107 $('[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'); 107 109 108 110 $('[name="startDate"]').val(dateCalendar.toString(event.start, User.preferences.dateFormat)); … … 111 113 }else{ 112 114 $('[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'); 114 116 115 117 $('[name="startHour"]').val(dateCalendar.formatDate(event.start, User.preferences.hourFormat)); … … 132 134 var eventSource = new Array(); 133 135 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'); 136 138 var map = {}; 137 $( "#new_event_map").fullCalendar( 'removeEventSource', eventSource );139 $('.new-'+viewName+'-win .map_disponibility').fullCalendar( 'removeEventSource', eventSource ); 138 140 eventSource = new Array(); 139 141 map = {startTime : view.start.getTime(), endTime : view.end.getTime(), attendees: {}, timezone: (objEvent.timezone || User.preferences.timezone)}; … … 167 169 } 168 170 if(eventSource.length) 169 $( "#new_event_map").fullCalendar( 'addEventSource', eventSource );171 $('.new-'+viewName+'-win .map_disponibility').fullCalendar( 'addEventSource', eventSource ); 170 172 }; 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(); 175 176 }); 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(){ 177 178 updateMapView(); 178 179 });
Note: See TracChangeset
for help on using the changeset viewer.