diff --git a/SAS/ResourceAssignment/ResourceAssignmentEditor/lib/static/app/controllers/datacontroller.js b/SAS/ResourceAssignment/ResourceAssignmentEditor/lib/static/app/controllers/datacontroller.js index 7a257f5b0acee9b4c3fd2cfb528b749fffda7338..3aeaabf7f447965547c90320171146d0bb816429 100644 --- a/SAS/ResourceAssignment/ResourceAssignmentEditor/lib/static/app/controllers/datacontroller.js +++ b/SAS/ResourceAssignment/ResourceAssignmentEditor/lib/static/app/controllers/datacontroller.js @@ -51,6 +51,20 @@ angular.module('raeApp').factory("dataService", ['$http', '$q', function($http, return dict; }; + self.applyChanges = function(existingObj, changedObj) { + for(var prop in changedObj) { + if(existingObj.hasOwnProperty(prop) && + changedObj.hasOwnProperty(prop) && + existingObj[prop] != changedObj[prop]) { + if(existingObj[prop] instanceof Date && changedObj[prop] instanceof String) { + existingObj[prop] = new Date(changedObj[prop]); + } else { + existingObj[prop] = changedObj[prop]; + } + } + } + }; + self.getTasks = function() { var defer = $q.defer(); @@ -79,6 +93,7 @@ angular.module('raeApp').factory("dataService", ['$http', '$q', function($http, self.putTask = function(task) { $http.put('/rest/tasks/' + task.id, task).error(function(result) { console.log("Error. Could not update task. " + result); + //TODO: revert to old state }) }; @@ -309,20 +324,6 @@ angular.module('raeApp').factory("dataService", ['$http', '$q', function($http, var changeNumbers = result.changes.map(function(item) { return item.changeNumber; }); self.lastUpdateChangeNumber = changeNumbers.reduce(function(a, b, idx, arr) { return a > b ? a : b; }, undefined); - function applyChanges(existingObj, changedObj) { - for(var prop in changedObj) { - if(existingObj.hasOwnProperty(prop) && - changedObj.hasOwnProperty(prop) && - existingObj[prop] != changedObj[prop]) { - if(existingObj[prop] instanceof Date) { - existingObj[prop] = new Date(changedObj[prop]); - } else { - existingObj[prop] = changedObj[prop]; - } - } - } - }; - var anyResourceClaims = false; for(var i in result.changes) { try { @@ -333,7 +334,7 @@ angular.module('raeApp').factory("dataService", ['$http', '$q', function($http, if(change.changeType == 'update') { var task = self.taskDict[changedTask.id]; if(task) { - applyChanges(task, changedTask); + self.applyChanges(task, changedTask); } } else if(change.changeType == 'insert') { var task = self.taskDict[changedTask.id]; @@ -358,7 +359,7 @@ angular.module('raeApp').factory("dataService", ['$http', '$q', function($http, if(change.changeType == 'update') { var claim = self.resourceClaimDict[changedClaim.id]; if(claim) { - applyChanges(claim, changedClaim); + self.applyChanges(claim, changedClaim); } } else if(change.changeType == 'insert') { var claim = self.resourceClaimDict[changedClaim.id]; diff --git a/SAS/ResourceAssignment/ResourceAssignmentEditor/lib/static/app/controllers/gridcontroller.js b/SAS/ResourceAssignment/ResourceAssignmentEditor/lib/static/app/controllers/gridcontroller.js index 8f507a7fae14f435c526c53b336486e2e57dc73d..af465853318b3bc241e1e073b60d9117f40c007c 100644 --- a/SAS/ResourceAssignment/ResourceAssignmentEditor/lib/static/app/controllers/gridcontroller.js +++ b/SAS/ResourceAssignment/ResourceAssignmentEditor/lib/static/app/controllers/gridcontroller.js @@ -73,6 +73,7 @@ gridControllerMod.controller('GridController', ['$scope', 'dataService', 'uiGrid enableGridMenu: false, enableSorting: true, enableFiltering: true, + enableCellEdit: false, enableColumnResize: true, enableRowSelection: true, enableRowHeaderSelection: true, diff --git a/SAS/ResourceAssignment/ResourceAssignmentEditor/lib/templates/index.html b/SAS/ResourceAssignment/ResourceAssignmentEditor/lib/templates/index.html index ed2979c945e524c109b6bf844e02051ec5b5346d..51a7b2b4f25291e953bc3fabab8b81733bbbca2f 100644 --- a/SAS/ResourceAssignment/ResourceAssignmentEditor/lib/templates/index.html +++ b/SAS/ResourceAssignment/ResourceAssignmentEditor/lib/templates/index.html @@ -78,8 +78,8 @@ column-magnet="options.columnMagnet"> <gantt-tree enabled="true"></gantt-tree> <gantt-movable enabled="true" - allow-moving="true" - allow-resizing="true" + allow-moving="false" + allow-resizing="false" allow-row-switching="false"> </gantt-movable> <gantt-tooltips enabled="true" date-format="'YYYY-MM-DD HH:mm'"></gantt-tooltips> @@ -98,8 +98,8 @@ column-magnet="options.columnMagnet"> <gantt-tree enabled="true"></gantt-tree> <gantt-movable enabled="true" - allow-moving="true" - allow-resizing="true" + allow-moving="false" + allow-resizing="false" allow-row-switching="false"></gantt-movable> <gantt-tooltips enabled="true" date-format="'YYYY-MM-DD HH:mm'"></gantt-tooltips> </div> diff --git a/SAS/ResourceAssignment/ResourceAssignmentEditor/lib/webservice.py b/SAS/ResourceAssignment/ResourceAssignmentEditor/lib/webservice.py index cc0b8c207efee6301d7cea0b139e4baee4ea335c..a9ee817cf514e99b0f5c9c1f001dc732b6cfae92 100755 --- a/SAS/ResourceAssignment/ResourceAssignmentEditor/lib/webservice.py +++ b/SAS/ResourceAssignment/ResourceAssignmentEditor/lib/webservice.py @@ -176,6 +176,8 @@ def getTask(task_id): @app.route('/rest/tasks/<int:task_id>', methods=['PUT']) def putTask(task_id): + abort(403, 'Editing of tasks is by users is not yet approved') + if 'Content-Type' in request.headers and \ request.headers['Content-Type'].startswith('application/json'): updatedTask = json.loads(request.data)