提交 | 用户 | 时间
|
1ac2bc
|
1 |
/* |
懒 |
2 |
* Activiti Modeler component part of the Activiti project |
|
3 |
* Copyright 2005-2014 Alfresco Software, Ltd. All rights reserved. |
|
4 |
* |
|
5 |
* This library is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU Lesser General Public |
|
7 |
* License as published by the Free Software Foundation; either |
|
8 |
* version 2.1 of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This library is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 |
* Lesser General Public License for more details. |
|
14 |
|
|
15 |
* You should have received a copy of the GNU Lesser General Public |
|
16 |
* License along with this library; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
18 |
*/ |
|
19 |
|
|
20 |
/* |
|
21 |
* String controller |
|
22 |
*/ |
|
23 |
|
|
24 |
var KisBpmStringPropertyCtrl = [ '$scope', function ($scope) { |
|
25 |
|
|
26 |
$scope.shapeId = $scope.selectedShape.id; |
|
27 |
$scope.valueFlushed = false; |
|
28 |
/** Handler called when input field is blurred */ |
|
29 |
$scope.inputBlurred = function() { |
|
30 |
$scope.valueFlushed = true; |
|
31 |
if ($scope.property.value) { |
|
32 |
$scope.property.value = $scope.property.value.replace(/(<([^>]+)>)/ig,""); |
|
33 |
} |
|
34 |
$scope.updatePropertyInModel($scope.property); |
|
35 |
}; |
|
36 |
|
|
37 |
$scope.enterPressed = function(keyEvent) { |
|
38 |
if (keyEvent && keyEvent.which === 13) { |
|
39 |
keyEvent.preventDefault(); |
|
40 |
$scope.inputBlurred(); // we want to do the same as if the user would blur the input field |
|
41 |
} |
|
42 |
}; |
|
43 |
|
|
44 |
$scope.$on('$destroy', function controllerDestroyed() { |
|
45 |
if(!$scope.valueFlushed) { |
|
46 |
if ($scope.property.value) { |
|
47 |
$scope.property.value = $scope.property.value.replace(/(<([^>]+)>)/ig,""); |
|
48 |
} |
|
49 |
$scope.updatePropertyInModel($scope.property, $scope.shapeId); |
|
50 |
} |
|
51 |
}); |
|
52 |
|
|
53 |
}]; |
|
54 |
|
|
55 |
/* |
|
56 |
* Boolean controller |
|
57 |
*/ |
|
58 |
|
|
59 |
var KisBpmBooleanPropertyCtrl = ['$scope', function ($scope) { |
|
60 |
|
|
61 |
$scope.changeValue = function() { |
|
62 |
if ($scope.property.key === 'oryx-defaultflow' && $scope.property.value) { |
|
63 |
var selectedShape = $scope.selectedShape; |
|
64 |
if (selectedShape) { |
|
65 |
var incomingNodes = selectedShape.getIncomingShapes(); |
|
66 |
if (incomingNodes && incomingNodes.length > 0) { |
|
67 |
// get first node, since there can be only one for a sequence flow |
|
68 |
var rootNode = incomingNodes[0]; |
|
69 |
var flows = rootNode.getOutgoingShapes(); |
|
70 |
if (flows && flows.length > 1) { |
|
71 |
// in case there are more flows, check if another flow is already defined as default |
|
72 |
for (var i = 0; i < flows.length; i++) { |
|
73 |
if (flows[i].resourceId != selectedShape.resourceId) { |
|
74 |
var defaultFlowProp = flows[i].properties['oryx-defaultflow']; |
|
75 |
if (defaultFlowProp) { |
|
76 |
flows[i].setProperty('oryx-defaultflow', false, true); |
|
77 |
} |
|
78 |
} |
|
79 |
} |
|
80 |
} |
|
81 |
} |
|
82 |
} |
|
83 |
} |
|
84 |
$scope.updatePropertyInModel($scope.property); |
|
85 |
}; |
|
86 |
|
|
87 |
}]; |
|
88 |
|
|
89 |
/* |
|
90 |
* Text controller |
|
91 |
*/ |
|
92 |
|
|
93 |
var KisBpmTextPropertyCtrl = [ '$scope', '$modal', function($scope, $modal) { |
|
94 |
|
|
95 |
var opts = { |
|
96 |
template: 'editor-app/configuration/properties/text-popup.html?version=' + Date.now(), |
|
97 |
scope: $scope |
|
98 |
}; |
|
99 |
|
|
100 |
// Open the dialog |
|
101 |
$modal(opts); |
|
102 |
}]; |
|
103 |
|
|
104 |
var KisBpmTextPropertyPopupCtrl = ['$scope', function($scope) { |
|
105 |
|
|
106 |
$scope.save = function() { |
|
107 |
$scope.updatePropertyInModel($scope.property); |
|
108 |
$scope.close(); |
|
109 |
}; |
|
110 |
|
|
111 |
$scope.close = function() { |
|
112 |
$scope.property.mode = 'read'; |
|
113 |
$scope.$hide(); |
|
114 |
}; |
|
115 |
}]; |