sogo/UI/WebServerResources/js/Scheduler.js

3 lines
35 KiB
JavaScript
Raw Normal View History

2016-01-14 22:10:37 +01:00
!function(){"use strict";function a(a,d){a.state("calendars",{url:"/calendar",views:{calendars:{templateUrl:"UIxCalMainView",controller:"CalendarsController",controllerAs:"app"}},resolve:{stateCalendars:b}}).state("calendars.view",{url:"/{view:(?:day|week|month|multicolumnday)}/:day",views:{calendarView:{templateUrl:function(a){return a.view+"view?day="+a.day},controller:"CalendarController",controllerAs:"calendar"}},resolve:{stateEventsBlocks:c}}),d.when("/calendar/day",function(){var a=new Date;return"/calendar/day/"+a.getDayString()}),d.when("/calendar/multicolumnday",function(){var a=new Date;return"/calendar/multicolumnday/"+a.getDayString()}),d.when("/calendar/week",function(){var a=new Date;return"/calendar/week/"+a.getDayString()}),d.when("/calendar/month",function(){var a=new Date;return"/calendar/month/"+a.getDayString()}),d.otherwise("/calendar")}function b(a){return a.$calendars||a.$findAll(window.calendarsData)}function c(a,b,c){return b.$eventsBlocksForView(a.view,a.day.asDate()).then(function(a){return _.forEach(a,function(a){a.id&&(a.calendar=new c({id:a.id,name:a.calendarName}))}),a})}function d(a,b,c,d,e){a.$on("$stateChangeError",function(a,c,e,f,g,h){b.error(h),d.go("calendar")}),a.$on("$routeChangeError",function(a,c,d,e){b.error(a,c,d,e)}),0===c.url().length&&e.ready().then(function(){var a="/calendar/",b=/(.+)view/.exec(e.settings.Calendar.View);a+=b?b[1]:"week",c.replace().url(a)})}angular.module("SOGo.SchedulerUI",["ui.router","angularFileUpload","SOGo.Common","SOGo.PreferencesUI","SOGo.ContactsUI","SOGo.MailerUI"]).config(a).run(d),a.$inject=["$stateProvider","$urlRouterProvider"],b.$inject=["Calendar"],c.$inject=["$stateParams","Component","Calendar"],d.$inject=["$rootScope","$log","$location","$state","Preferences"]}(),function(){"use strict";function a(a,b,c,d,e,f,g){function h(){f.$eventsBlocksForView(d.view,d.day.asDate()).then(function(a){l.views=a,_.forEach(l.views,function(a){a.id&&(a.calendar=new e({id:a.id,name:a.calendarName}))})})}function i(a){var b=angular.element(a.currentTarget).attr("date");c.go("calendars.view",{day:b})}function j(a){c.go("calendars.view",{view:a})}var k,l=this;l.views=g,l.changeDate=i,l.changeView=j,k=b.$on("calendars:list",h),a.$on("$destroy",k)}a.$inject=["$scope","$rootScope","$state","$stateParams","Calendar","Component","stateEventsBlocks"],angular.module("SOGo.SchedulerUI").controller("CalendarController",a)}(),function(){"use strict";function a(a,b,c,d,e,f,g,h){function i(a,b){(b&&b.reload||z.componentType!=a)&&(angular.isUndefined(h["$"+a])&&h.$filter(a),z.unselectComponents(),z.componentType=a,h.saveSelectedList(a))}function j(){_.each(h["$"+z.componentType],function(a){a.selected=!1})}function k(){_.each(h["$"+z.componentType],function(a){a.selected=!0})}function m(a,b){b.selected=!b.selected,a.preventDefault(),a.stopPropagation()}function n(){e.confirm(l("Warning"),l("Are you sure you want to delete the selected components?")).then(function(){var a=_.filter(h["$"+z.componentType],function(a){return a.selected});g.$deleteComponents(a)},function(a,b){})}function o(a,b){q(a,b,"appointment")}function p(a,b){q(a,b,"task")}function q(a,b,c){if(b.viewable){var e="UIx"+c.capitalize()+"ViewTemplate";d.show({parent:angular.element(document.body),targetEvent:a,clickOutsideToClose:!0,escapeToClose:!0,templateUrl:e,controller:"ComponentController",controllerAs:"editor",locals:{stateComponent:b}})}}function r(a,b){var c,e="appointment";b?(c=b,e=b.type):("tasks"==z.componentType&&(e="task"),c=new h({pid:g.$defaultCalendar(),type:e}));var f="UIx"+e.capitalize()+"EditorTemplate";return d.show({parent:angular.element(document.body),targetEvent:a,clickOutsideToClose:!0,escapeToClose:!0,templateUrl:f,controller:"ComponentEditorController",controllerAs:"editor",locals:{stateComponent:c}})}function s(c){function e(a,b,c,d){a.updateThisOccurrence=function(){c.$adjust(d).then(b.hide,b.cancel)},a.updateAllOccurrences=function(){delete c.occurrenceId,c.$adjust(d).then(b.hide,b.cancel)}}var f,i,j,k,m,n,o;f=h.$ghost.component,i=h.$ghost.pointerHandler,f.isNew?(j=i.currentEven
this.currentEventCoordinates.duration=this.originalEventCoordinates.duration):"change-start"==this.dragMode?(b=this.originalEventCoordinates.duration-f,b>0?(this.currentEventCoordinates.start=this.originalEventCoordinates.start+f,this.currentEventCoordinates.duration=b):0>b&&(this.currentEventCoordinates.start=this.originalEventCoordinates.start+this.originalEventCoordinates.duration,this.currentEventCoordinates.duration=-b)):"change-end"==this.dragMode&&(b=this.originalEventCoordinates.duration+f,b>0?(this.currentEventCoordinates.start=this.originalEventCoordinates.start,this.currentEventCoordinates.duration=b):0>b&&(this.currentEventCoordinates.start=this.originalEventCoordinates.start+b,this.currentEventCoordinates.duration=-b));var g;this.currentEventCoordinates.start<0?(g=Math.ceil(-this.currentEventCoordinates.start/e.EventDragDayLength),this.currentEventCoordinates.start+=g*e.EventDragDayLength,this.currentEventCoordinates.dayNumber-=g):this.currentEventCoordinates.start>=e.EventDragDayLength&&(g=Math.floor(this.currentEventCoordinates.start/e.EventDragDayLength),this.currentEventCoordinates.start-=g*e.EventDragDayLength,this.currentEventCoordinates.dayNumber+=g),c.debug("event coordinates "+JSON.stringify(this.currentEventCoordinates)),a.$emit("calendar:drag")},getContainerBasedCoordinates:function(a,b){var c=b||this.currentCoordinates,d=c.getDelta(a.coordinates),e=a.element;return(d.x<a.daysOffset||d.x>e.clientWidth||d.y<0||d.y>e.clientHeight)&&(d=null),d},prepareWithEventType:function(a){var b={multiday:this.getEventMultiDayViewCoordinates,"multiday-allday":this.getEventMultiDayAllDayViewCoordinates,monthly:this.getEventMonthlyViewCoordinates,unknown:null},c=b[a];this.eventType=a,this.getEventViewCoordinates=c},getEventMultiDayViewCoordinates:function(a,b){var c=this.getEventMultiDayAllDayViewCoordinates(a,b);if(c){var d=a.quarterHeight,f=this.getContainerBasedCoordinates(a,b);f.y+=a.element.scrollTop,c.y=Math.floor((f.y-e.EventDragHorizontalOffset)/d);var g=e.EventDragDayLength-1;c.y<0?c.y=0:c.y>g&&(c.y=g)}return c},getEventMultiDayAllDayViewCoordinates:function(a,b){var c,e=this.getContainerBasedCoordinates(a,b);if(e){c=new q;var f=a.dayWidth,g=a.daysOffset;c.x=Math.floor((e.x-g)/f);var h=0,i=d.$view.maxX;if("move-event"!=this.dragMode){var k=j.calendarData();k&&(h=i=k.index)}c.x<h?c.x=h:c.x>i&&(c.x=i),c.y=0}else c=null;return c},getEventMonthlyViewCoordinates:function(a,b){var c,d=this.getContainerBasedCoordinates(a,b);if(d){c=new q;var e=0,f=a.dayWidth,g=a.daysOffset,h=a.dayHeight,i=Math.floor((d.y-e)/h);0>i&&(i=0),c.x=Math.floor((d.x-g)/f),c.x<0?c.x=0:c.x>6&&(c.x=6),c.x+=7*i,c.y=0}else c=null;return c},getDistance:function(){return this.currentCoordinates.getDistance(this.originalCoordinates)},setTimeFromQuarters:function(a,b){var c,d;c=Math.floor(b/4),d=b%4*15,a.setHours(c,d)}}}return{restrict:"CA",require:"^sgCalendarDay",link:g}}a.$inject=["$rootScope","$timeout","$log","Calendar","CalendarSettings","Component"],angular.module("SOGo.SchedulerUI").directive("sgDraggableCalendarBlock",a)}(),function(){"use strict";function a(a,b,c,d,e,f){return{restrict:"CA",scope:{onDrop:"&sgOnDrop"},link:function(b,c,d,e){var f=a.$on("calendar:dragend",b.onDrop);b.$on("$destroy",f)}}}a.$inject=["$rootScope","$timeout","$mdGesture","Calendar","CalendarSettings","Component"],angular.module("SOGo.SchedulerUI").directive("sgDroppableBlock",a)}();
//# sourceMappingURL=Scheduler.js.map