1 var myApp = angular.module('myApp', []);
\r
2 myApp.config(function ($interpolateProvider) {
\r
3 $interpolateProvider.startSymbol('{[{').endSymbol('}]}');
\r
5 myApp.factory('$exceptionHandler', function () {
\r
6 return function (exception, cause) {
\r
7 if (exception.message.contains('leases')) {
\r
8 console.log(exception.message);
\r
9 angular.element(document.getElementById('SchedulerCtrl')).scope().initSlots(_schedulerCurrentCellPosition, _schedulerCurrentCellPosition + SchedulerTotalVisibleCells);
\r
15 // Create a private execution space for our controller. When
\r
16 // executing this function expression, we're going to pass in
\r
17 // the Angular reference and our application module.
\r
18 (function (ng, app) {
\r
21 // Define our Controller constructor.
\r
22 function Controller($scope) {
\r
24 // Store the scope so we can reference it in our
\r
26 this.scope = $scope;
\r
28 // Set up the default scope value.
\r
29 this.scope.errorMessage = null;
\r
30 this.scope.name = "";
\r
32 $scope.resources = SchedulerDataViewData;
\r
33 $scope.slots = SchedulerSlotsViewData;
\r
34 //$scope.msg = "hello";
\r
36 angular.element(document).ready(function() {
\r
37 //console.log('Hello World');
\r
38 //alert('Hello World');
\r
39 //afterAngularRendered();
\r
42 $scope.moveFrontSlot = function(from, to) {
\r
43 $scope.slots.shift();
\r
44 $scope.slots.push(SchedulerSlots[to]);
\r
45 for (var j = 0; j < $scope.resources.length; j++) {
\r
46 $scope.resources[j].leases.shift();
\r
47 $scope.resources[j].leases.push(SchedulerData[j].leases[to]);
\r
53 $scope.initSlots(from, to);
\r
57 $scope.moveBackSlot = function(from, to) {
\r
58 $scope.$apply(function() {
\r
61 $scope.slots.unshift(SchedulerSlots[from]);
\r
62 for (var j = 0; j < $scope.resources.length; j++) {
\r
63 $scope.resources[j].leases.pop();
\r
64 $scope.resources[j].leases.unshift(SchedulerData[j].leases[from]);
\r
72 $scope.initSlots = function(from, to) {
\r
75 for (var k = 0; k < SchedulerData.length; k++) {
\r
76 if ($scope.resources.length < SchedulerData.length)
\r
77 $scope.resources.push(jQuery.extend(true, {}, SchedulerData[k]));
\r
78 $scope.resources[k].leases = [];
\r
81 for (var i = from; i < to; i++) {
\r
82 $scope.slots.push(SchedulerSlots[i]);
\r
83 for (var j = 0; j < $scope.resources.length; j++) {
\r
84 $scope.resources[j].leases.push(SchedulerData[j].leases[i]);
\r
92 // Return this object reference.
\r
98 // Define the Controller as the constructor function.
\r
99 app.controller("SchedulerCtrl", Controller);
\r