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
10 var tmpScope = angular.element(document.getElementById('SchedulerCtrl')).scope();
\r
11 tmpScope.initSlots(_schedulerCurrentCellPosition, _schedulerCurrentCellPosition + SchedulerTotalVisibleCells);
\r
17 // Create a private execution space for our controller. When
\r
18 // executing this function expression, we're going to pass in
\r
19 // the Angular reference and our application module.
\r
20 (function (ng, app) {
\r
23 // Define our Controller constructor.
\r
24 function Controller($scope) {
\r
26 // Store the scope so we can reference it in our
\r
28 this.scope = $scope;
\r
30 // Set up the default scope value.
\r
31 this.scope.errorMessage = null;
\r
32 this.scope.name = "";
\r
34 $scope.resources = SchedulerDataViewData;
\r
35 $scope.slots = SchedulerSlotsViewData;
\r
36 //$scope.msg = "hello";
\r
38 angular.element(document).ready(function() {
\r
39 //console.log('Hello World');
\r
40 //alert('Hello World');
\r
41 //afterAngularRendered();
\r
44 $scope.moveFrontSlot = function(from, to) {
\r
45 //$scope.slots.shift();
\r
46 //$scope.slots.push(SchedulerSlots[to]);
\r
47 //for (var j = 0; j < $scope.resources.length; j++) {
\r
48 // $scope.resources[j].leases.shift();
\r
49 // $scope.resources[j].leases.push(SchedulerData[j].leases[to]);
\r
52 // $scope.$digest();
\r
53 // //$scope.$apply();
\r
55 // $scope.initSlots(from, to);
\r
57 $scope.initSlots(from, to);
\r
60 $scope.moveBackSlot = function(from, to) {
\r
61 $scope.$apply(function() {
\r
63 // $scope.slots.pop();
\r
64 // $scope.slots.unshift(SchedulerSlots[from]);
\r
65 // for (var j = 0; j < $scope.resources.length; j++) {
\r
66 // $scope.resources[j].leases.pop();
\r
67 // $scope.resources[j].leases.unshift(SchedulerData[j].leases[from]);
\r
73 $scope.initSlots(from, to);
\r
77 $scope.SetSchedulerResources = function (start, to, filter) {
\r
78 for (var k = start; k < to; k++) {
\r
79 if ($scope.resources.length < SchedulerData.length)
\r
80 $scope.resources.push(jQuery.extend(true, {}, SchedulerData[k]));
\r
81 $scope.resources[k].leases = [];
\r
83 $scope.initSlots(0, SchedulerTotalVisibleCells);
\r
86 $scope.initSlots = function(from, to) {
\r
90 for (var i = from; i < to; i++) {
\r
91 $scope.slots.push(SchedulerSlots[i]);
\r
92 for (var j = 0; j < $scope.resources.length; j++) {
\r
93 $scope.resources[j].leases.push(SchedulerData[j].leases[i]);
\r
101 // Return this object reference.
\r
107 // Define the Controller as the constructor function.
\r
108 app.controller("SchedulerCtrl", Controller);
\r