cpee 2.0.24 → 2.0.25

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/cockpit/{templates/.CPEE.xml → CPEE.xml} +1 -1
  3. data/cockpit/{templates/.Signavio.xml → Signavio.xml} +1 -1
  4. data/cockpit/css/model.css +1 -1
  5. data/cockpit/css/ui.css +3 -1
  6. data/cockpit/edit.html +260 -0
  7. data/cockpit/index.html +0 -2
  8. data/cockpit/js/edit.js +32 -0
  9. data/cockpit/js/instance.js +28 -19
  10. data/cockpit/js/model.js +0 -25
  11. data/cockpit/js/parameters.js +3 -0
  12. data/cockpit/js/ui.js +7 -0
  13. data/cockpit/model.html +1 -0
  14. data/cockpit/themes/compact/rngs/call.rng +26 -1
  15. data/cockpit/themes/compact/rngs/callmanipulate.rng +32 -2
  16. data/cockpit/themes/compact/theme.js +57 -25
  17. data/cockpit/themes/control/rngs/call.rng +26 -1
  18. data/cockpit/themes/control/rngs/callmanipulate.rng +32 -2
  19. data/cockpit/themes/control/theme.js +50 -19
  20. data/cockpit/themes/default/rngs/call.rng +26 -1
  21. data/cockpit/themes/default/rngs/callmanipulate.rng +32 -2
  22. data/cockpit/themes/default/theme.js +49 -18
  23. data/cockpit/themes/extended/rngs/call.rng +26 -1
  24. data/cockpit/themes/extended/rngs/callmanipulate.rng +32 -2
  25. data/cockpit/themes/extended/theme.js +50 -19
  26. data/cockpit/themes/model/rngs/call.rng +21 -20
  27. data/cockpit/themes/model/rngs/callmanipulate.rng +23 -22
  28. data/cockpit/themes/model/theme.js +51 -20
  29. data/cockpit/themes/packed/rngs/call.rng +26 -1
  30. data/cockpit/themes/packed/rngs/callmanipulate.rng +32 -2
  31. data/cockpit/themes/packed/theme.js +50 -19
  32. data/cockpit/themes/preset/rngs/call.rng +26 -1
  33. data/cockpit/themes/preset/rngs/callmanipulate.rng +32 -2
  34. data/cockpit/themes/preset/theme.js +49 -18
  35. data/cockpit/{templates/.transformations.xml → transformations.xml} +0 -0
  36. data/cpee.gemspec +1 -1
  37. data/lib/callbacks.xml +5 -0
  38. data/lib/cpee/controller.rb +29 -27
  39. data/lib/cpee/implementation_callbacks.rb +53 -0
  40. data/server/handlerwrappers/default.rb +15 -3
  41. data/server/resources/transformation_dslx.xsl +1 -1
  42. data/server/routing/end.pid +1 -1
  43. data/server/routing/forward-events.pid +1 -1
  44. data/server/routing/forward-votes.pid +1 -1
  45. data/server/routing/persist.pid +1 -1
  46. data/server/routing/persist.rb +3 -3
  47. data/server/server.pid +1 -1
  48. metadata +6 -54
  49. data/cockpit/edit.html +0 -1
  50. data/cockpit/templates/.templates.xml +0 -13
  51. data/cockpit/themes/diana/rngs/alternative.rng +0 -25
  52. data/cockpit/themes/diana/rngs/call.rng +0 -149
  53. data/cockpit/themes/diana/rngs/callmanipulate.rng +0 -188
  54. data/cockpit/themes/diana/rngs/choose.rng +0 -14
  55. data/cockpit/themes/diana/rngs/closed_loop.rng +0 -62
  56. data/cockpit/themes/diana/rngs/closed_loop_cancel.rng +0 -5
  57. data/cockpit/themes/diana/rngs/closed_loop_control.rng +0 -31
  58. data/cockpit/themes/diana/rngs/closed_loop_measuring.rng +0 -12
  59. data/cockpit/themes/diana/rngs/critical.rng +0 -5
  60. data/cockpit/themes/diana/rngs/escape.rng +0 -1
  61. data/cockpit/themes/diana/rngs/group.rng +0 -3
  62. data/cockpit/themes/diana/rngs/loop.rng +0 -22
  63. data/cockpit/themes/diana/rngs/manipulate.rng +0 -9
  64. data/cockpit/themes/diana/rngs/otherwise.rng +0 -22
  65. data/cockpit/themes/diana/rngs/parallel.rng +0 -21
  66. data/cockpit/themes/diana/rngs/parallel_branch.rng +0 -8
  67. data/cockpit/themes/diana/rngs/scripts.rng +0 -23
  68. data/cockpit/themes/diana/rngs/stop.rng +0 -5
  69. data/cockpit/themes/diana/rngs/terminate.rng +0 -1
  70. data/cockpit/themes/diana/symbols/alternative.svg +0 -5
  71. data/cockpit/themes/diana/symbols/arrow.svg +0 -3
  72. data/cockpit/themes/diana/symbols/call.svg +0 -6
  73. data/cockpit/themes/diana/symbols/callmanipulate.svg +0 -8
  74. data/cockpit/themes/diana/symbols/choose.svg +0 -5
  75. data/cockpit/themes/diana/symbols/choose_exclusive.svg +0 -5
  76. data/cockpit/themes/diana/symbols/choose_inclusive.svg +0 -4
  77. data/cockpit/themes/diana/symbols/closed_loop.svg +0 -5
  78. data/cockpit/themes/diana/symbols/closed_loop_cancel.svg +0 -5
  79. data/cockpit/themes/diana/symbols/closed_loop_control.svg +0 -5
  80. data/cockpit/themes/diana/symbols/closed_loop_measuring.svg +0 -6
  81. data/cockpit/themes/diana/symbols/complex.svg +0 -8
  82. data/cockpit/themes/diana/symbols/critical.svg +0 -4
  83. data/cockpit/themes/diana/symbols/end.svg +0 -3
  84. data/cockpit/themes/diana/symbols/escape.svg +0 -5
  85. data/cockpit/themes/diana/symbols/event_end.svg +0 -3
  86. data/cockpit/themes/diana/symbols/loop.svg +0 -5
  87. data/cockpit/themes/diana/symbols/manipulate.svg +0 -4
  88. data/cockpit/themes/diana/symbols/otherwise.svg +0 -5
  89. data/cockpit/themes/diana/symbols/parallel.svg +0 -5
  90. data/cockpit/themes/diana/symbols/parallel_branch.svg +0 -5
  91. data/cockpit/themes/diana/symbols/parallel_branch_compact.svg +0 -4
  92. data/cockpit/themes/diana/symbols/parallel_branch_event.svg +0 -14
  93. data/cockpit/themes/diana/symbols/parallel_branch_normal.svg +0 -5
  94. data/cockpit/themes/diana/symbols/scripts.svg +0 -4
  95. data/cockpit/themes/diana/symbols/start.svg +0 -3
  96. data/cockpit/themes/diana/symbols/stop.svg +0 -5
  97. data/cockpit/themes/diana/symbols/terminate.svg +0 -4
  98. data/cockpit/themes/diana/theme.js +0 -1650
data/cockpit/js/model.js CHANGED
@@ -1,7 +1,3 @@
1
- document.addEventListener('graph:changed', function (e) {
2
- $("button[name=save]").prop("disabled",false);
3
- }, false);
4
-
5
1
  $(document).ready(function() {
6
2
  $('#tabmodel').click(function(event){
7
3
  $('#model ui-behind button:nth-child(1)').addClass('hidden');
@@ -17,25 +13,4 @@ $(document).ready(function() {
17
13
  var tab = $(document).find('#model ui-content ui-area:not(.inactive) .relaxngui_table');
18
14
  are.animate({ scrollTop: tab.height() }, "slow");
19
15
  });
20
-
21
- $("button[name=save]").click(function(){
22
- var def = new $.Deferred();
23
- def.done(function(name,testset) {
24
- $.ajax({
25
- url: $('body').attr('current-save') + ($('body').attr('current-save-dir') ? ($('body').attr('current-save-dir') + '/').replace(/\/+/,'/') : '') + name + '.xml',
26
- type: 'PUT',
27
- contentType: 'application/xml',
28
- data: testset.serializePrettyXML(),
29
- headers: { 'Content-ID': 'content' },
30
- success: function() {
31
- $("button[name=save]").prop("disabled",true);
32
- $("#lastsavedline").removeClass('hidden');
33
- var dt = new Date();
34
- var time = dt.getHours() + ":" + dt.getMinutes() + ":" + dt.getSeconds();
35
- $("#lastsaved").text(time);
36
- }
37
- });
38
- });
39
- get_testset(def);
40
- });
41
16
  });
@@ -1,3 +1,5 @@
1
+ var parameters_changed = new Event("parameters:changed", {"bubbles":true, "cancelable":false});
2
+
1
3
  $(document).ready(function() {
2
4
  // hook up dataelements with relaxngui //{{{
3
5
  $.ajax({
@@ -68,6 +70,7 @@ function do_parameters_save(event) { //{{{
68
70
  var url = $('body').attr('current-instance');
69
71
  save[visid].set_checkpoint();
70
72
  var send = save[visid].save_text();
73
+ document.dispatchEvent(parameters_changed);
71
74
  $.ajax({
72
75
  type: "PUT",
73
76
  url: url + "/properties/" + visid + "/",
data/cockpit/js/ui.js CHANGED
@@ -102,3 +102,10 @@ $(document).on('paste', '[contenteditable]', function (e) {
102
102
  document.execCommand('insertText', false, content);
103
103
  }
104
104
  });
105
+
106
+ // unmark if storage changes. shit has potentially been copied or marked in other tabs.
107
+ $(window).bind('storage', function (e) {
108
+ if (localStorage.getItem('marked_from') != myid) {
109
+ save['graph_adaptor'].illustrator.get_elements().removeClass('marked');
110
+ }
111
+ });
data/cockpit/model.html CHANGED
@@ -54,6 +54,7 @@
54
54
  <script type="text/javascript" src="js/details.js"></script>
55
55
  <script type="text/javascript" src="js/parameters.js"></script>
56
56
  <script type="text/javascript" src="js/model.js"></script>
57
+ <script type="text/javascript" src="js/edit.js"></script>
57
58
  <link rel="stylesheet" href="css/ui.css" type="text/css"/>
58
59
  <link rel="stylesheet" href="css/model.css" type="text/css"/>
59
60
  <link rel="stylesheet" href="/global_ui/uicpee.css" type="text/css"/>
@@ -97,7 +97,7 @@
97
97
  </element>
98
98
 
99
99
  </element>
100
- <element name="report" rngui:header="Reporting Annotation" rngui:fold="closed">
100
+ <element name="report" rngui:header="Reporting" rngui:fold="closed">
101
101
  <element name="url" rngui:label='HTML Snippet'>
102
102
  <data type="string" rngui:label="url to report snippet"/>
103
103
  </element>
@@ -146,4 +146,29 @@
146
146
  </element>
147
147
  </element>
148
148
  </element>
149
+ <element name="input" rngui:header="Input Arguments Documentation" rngui:fold="closed">
150
+ <zeroOrMore rngui:label="Create Argument">
151
+ <element name="item" rngui:label="Description">
152
+ <attribute name="label" rngui:label="Name">
153
+ <data type="string"/>
154
+ </attribute>
155
+ <text rngui:wrap="true" rngui:label="What does it do?"/>
156
+ </element>
157
+ </zeroOrMore>
158
+ </element>
159
+ <element name="output" rngui:header="Output Elements Documentation" rngui:fold="closed">
160
+ <zeroOrMore rngui:label="Create Element">
161
+ <element name="item" rngui:label="Description">
162
+ <attribute name="label" rngui:label="Name">
163
+ <data type="string"/>
164
+ </attribute>
165
+ <text rngui:wrap="true" rngui:label="What does it do?"/>
166
+ </element>
167
+ </zeroOrMore>
168
+ </element>
169
+ <element name="implementation" rngui:header="Implementation Documentation" rngui:fold="closed">
170
+ <element name="description" rngui:label="Description">
171
+ <text rngui:wrap="true" rngui:label="What is supposed to happen?"/>
172
+ </element>
173
+ </element>
149
174
  </element>
@@ -113,13 +113,13 @@
113
113
  </element>
114
114
 
115
115
  </element>
116
- <element name="report" rngui:header="Reporting Annotation" rngui:fold="closed">
116
+ <element name="report" rngui:header="Reporting" rngui:fold="closed">
117
117
  <element name="url" rngui:label='HTML Snippet'>
118
118
  <data type="string" rngui:label="url to report snippet"/>
119
119
  </element>
120
120
  </element>
121
121
  </element>
122
- <element name="code" rngui:header="Implementation">
122
+ <element name="code" rngui:header="Output Handling">
123
123
  <element name="prepare" rngui:header="Prepare" rngui:label="Code" rngui:fold="closed_conditional">
124
124
  <text rngui:label="Script that is executed, before a service call"/>
125
125
  </element>
@@ -185,4 +185,34 @@
185
185
  </element>
186
186
  </element>
187
187
  </element>
188
+ <element name="input" rngui:header="Input Arguments Documentation" rngui:fold="closed">
189
+ <zeroOrMore rngui:label="Create Argument">
190
+ <element name="item" rngui:label="Description">
191
+ <attribute name="label" rngui:label="Name">
192
+ <data type="string"/>
193
+ </attribute>
194
+ <text rngui:wrap="true" rngui:label="What does it do?"/>
195
+ </element>
196
+ </zeroOrMore>
197
+ </element>
198
+ <element name="output" rngui:header="Output Elements Documentation" rngui:fold="closed">
199
+ <zeroOrMore rngui:label="Create Element">
200
+ <element name="item" rngui:label="Description">
201
+ <attribute name="label" rngui:label="Name">
202
+ <data type="string"/>
203
+ </attribute>
204
+ <text rngui:wrap="true" rngui:label="What does it do?"/>
205
+ </element>
206
+ </zeroOrMore>
207
+ </element>
208
+ <element name="implementation" rngui:header="Implementation Documentation" rngui:fold="closed">
209
+ <element name="description" rngui:label="Description">
210
+ <text rngui:wrap="true" rngui:label="What is supposed to happen?"/>
211
+ </element>
212
+ </element>
213
+ <element name="code" rngui:header="Output Handling Documentation" rngui:fold="closed">
214
+ <element name="description" rngui:label="Description">
215
+ <text rngui:wrap="true" rngui:label="Which output elements are important? How to transform and save them?"/>
216
+ </element>
217
+ </element>
188
218
  </element>
@@ -15,11 +15,7 @@ function WFAdaptorManifestation(adaptor) {
15
15
  $('#relaxngworker').empty();
16
16
  var rngw = new RelaxNGui(base,$('#relaxngworker'),self.adaptor.description.context_eval);
17
17
  var nnew = $(rngw.save().documentElement);
18
- nnew.attr('trans-xmlns','http://cpee.org/ns/description/1.0');
19
- var ntxt = nnew.serializeXML();
20
- ntxt = ntxt.replace(/trans-xmlns/,'xmlns');
21
-
22
- return($X(ntxt));
18
+ return(nnew);
23
19
  } else {
24
20
  if (opts && opts == 'clone') {
25
21
  base = base.clone();
@@ -53,6 +49,16 @@ function WFAdaptorManifestation(adaptor) {
53
49
  });
54
50
  return svgid;
55
51
  }; //}}}
52
+ //{{{ Return the json for all marked tasks
53
+ this.marked_text = function(){
54
+ var nodes = [];
55
+ var markymark = _.uniq(self.marked());
56
+ $(markymark).each(function(key,svgid){
57
+ var node = self.adaptor.description.get_node_by_svg_id(svgid);
58
+ nodes.push($(node).serializePrettyXML());
59
+ });
60
+ return JSON.stringify(nodes);
61
+ }; //}}}
56
62
  //{{{ Render the details from rng (right hand side of graph tab)
57
63
  this.update_details = function(svgid){
58
64
  var tab = $('#dat_details');
@@ -69,41 +75,57 @@ function WFAdaptorManifestation(adaptor) {
69
75
  $(rng).find(' > element[name="parameters"] > element[name="method"]').remove();
70
76
  }
71
77
  save['details'] = new RelaxNGui(rng,tab,self.adaptor.description.context_eval,true);
72
- save['details'].content(node);
78
+ var nn = $X($(node).serializeXML());
79
+ nn.removeAttr('svg-id');
80
+ nn.removeAttr('svg-type');
81
+ nn.removeAttr('svg-subtype');
82
+ nn.removeAttr('svg-label');
83
+ save['details'].content(nn);
73
84
  format_visual_forms();
74
85
  }
75
86
  }; //}}}
76
87
 
77
88
  function copyOrMove(menu,group,xml_node,mode) { //{{{
78
- var markymark = _.uniq(self.marked());
89
+ var nodes = localStorage.getItem('marked');
90
+
91
+ if (typeof(nodes) != "string") { return; }
92
+
93
+ nodes = JSON.parse(nodes);
94
+ $(nodes).each(function(key,str) {
95
+ nodes[key] = $X(str);;
96
+ });
97
+
79
98
  var check1 = [];
80
99
  var check2 = [];
81
- $(markymark).each(function(key,svgid){
82
- var node = self.adaptor.description.get_node_by_svg_id(svgid);
100
+ $(nodes).each(function(key,node){
83
101
  check1.push($(node).attr('svg-type'));
84
102
  });
85
103
  $(group).each(function(key,value){
86
104
  check2.push(value.type);
87
105
  });
88
106
 
89
- if (markymark.length > 0 && _.uniq(check1).length == _.intersection(check1,check2).length) {
90
- var nodes = [];
91
- $(markymark).each(function(key,svgid){
92
- var node = self.adaptor.description.get_node_by_svg_id(svgid);
93
- nodes.unshift(node);
94
- });
95
-
107
+ if (nodes.length > 0 && _.uniq(check1).length == _.intersection(check1,check2).length) {
108
+ if (myid == localStorage.getItem('marked_from')) {
109
+ $(nodes).each(function(key,node){
110
+ nodes[key] = self.adaptor.description.get_node_by_svg_id($(node).attr('svg-id'));
111
+ });
112
+ }
113
+ nodes.reverse();
96
114
  var iconm = self.resources['arrow'].clone();
97
115
  var iconc = self.resources['arrow'].clone();
98
116
  iconm.children('.rfill').addClass('menu');
117
+ if (myid == localStorage.getItem('marked_from')) {
118
+ menu.push(
119
+ {
120
+ 'label': '<em>Move Marked Elements</em>',
121
+ 'function_call': mode,
122
+ 'menu_icon': iconm,
123
+ 'type': undefined,
124
+ 'params': [nodes, xml_node]
125
+ }
126
+ );
127
+ }
99
128
  menu.push(
100
- {
101
- 'label': '<em>Move Marked Elements</em>',
102
- 'function_call': mode,
103
- 'menu_icon': iconm,
104
- 'type': undefined,
105
- 'params': [nodes, xml_node]
106
- },
107
129
  {
108
130
  'label': '<em>Copy Marked Elements</em>',
109
131
  'function_call': mode,
@@ -216,16 +238,26 @@ function WFAdaptorManifestation(adaptor) {
216
238
  self.adaptor.illustrator.get_elements().removeClass('selected');
217
239
  self.adaptor.illustrator.get_labels().removeClass('selected');
218
240
 
219
- if (e && e.ctrlKey) {
241
+ if (e && (e.ctrlKey || e.metaKey)) {
220
242
  if (save['state'] != "ready" && save['state'] != "stopped") { return false; }
221
243
  var tab = $('#dat_details');
222
244
  tab.empty();
223
245
  var vtarget = self.adaptor.illustrator.get_node_by_svg_id(svgid);
224
246
  if (vtarget.length > 0) {
225
- vtarget.parents('g.element[element-id]').toggleClass('marked');
247
+ var vt = vtarget.parents('g.element[element-id]');
248
+ vt.toggleClass('marked');
249
+ if (vt.hasClass('marked')) {
250
+ localStorage.setItem('marked',self.marked_text());
251
+ localStorage.setItem('marked_from',myid);
252
+ } else {
253
+ localStorage.removeItem('marked');
254
+ localStorage.removeItem('marked_from');
255
+ }
226
256
  }
227
257
  } else {
228
258
  self.adaptor.illustrator.get_elements().removeClass('marked');
259
+ localStorage.removeItem('marked');
260
+ localStorage.removeItem('marked_from');
229
261
 
230
262
  var vtarget = self.adaptor.illustrator.get_node_by_svg_id(svgid);
231
263
  if (vtarget.length > 0) {
@@ -97,7 +97,7 @@
97
97
  </element>
98
98
 
99
99
  </element>
100
- <element name="report" rngui:header="Reporting Annotation" rngui:fold="closed">
100
+ <element name="report" rngui:header="Reporting" rngui:fold="closed">
101
101
  <element name="url" rngui:label='HTML Snippet'>
102
102
  <data type="string" rngui:label="url to report snippet"/>
103
103
  </element>
@@ -146,4 +146,29 @@
146
146
  </element>
147
147
  </element>
148
148
  </element>
149
+ <element name="input" rngui:header="Input Arguments Documentation" rngui:fold="closed">
150
+ <zeroOrMore rngui:label="Create Argument">
151
+ <element name="item" rngui:label="Description">
152
+ <attribute name="label" rngui:label="Name">
153
+ <data type="string"/>
154
+ </attribute>
155
+ <text rngui:wrap="true" rngui:label="What does it do?"/>
156
+ </element>
157
+ </zeroOrMore>
158
+ </element>
159
+ <element name="output" rngui:header="Output Elements Documentation" rngui:fold="closed">
160
+ <zeroOrMore rngui:label="Create Element">
161
+ <element name="item" rngui:label="Description">
162
+ <attribute name="label" rngui:label="Name">
163
+ <data type="string"/>
164
+ </attribute>
165
+ <text rngui:wrap="true" rngui:label="What does it do?"/>
166
+ </element>
167
+ </zeroOrMore>
168
+ </element>
169
+ <element name="implementation" rngui:header="Implementation Documentation" rngui:fold="closed">
170
+ <element name="description" rngui:label="Description">
171
+ <text rngui:wrap="true" rngui:label="What is supposed to happen?"/>
172
+ </element>
173
+ </element>
149
174
  </element>
@@ -113,13 +113,13 @@
113
113
  </element>
114
114
 
115
115
  </element>
116
- <element name="report" rngui:header="Reporting Annotation" rngui:fold="closed">
116
+ <element name="report" rngui:header="Reporting" rngui:fold="closed">
117
117
  <element name="url" rngui:label='HTML Snippet'>
118
118
  <data type="string" rngui:label="url to report snippet"/>
119
119
  </element>
120
120
  </element>
121
121
  </element>
122
- <element name="code" rngui:header="Implementation">
122
+ <element name="code" rngui:header="Output Handling">
123
123
  <element name="prepare" rngui:header="Prepare" rngui:label="Code" rngui:fold="closed_conditional">
124
124
  <text rngui:label="Script that is executed, before a service call"/>
125
125
  </element>
@@ -185,4 +185,34 @@
185
185
  </element>
186
186
  </element>
187
187
  </element>
188
+ <element name="input" rngui:header="Input Arguments Documentation" rngui:fold="closed">
189
+ <zeroOrMore rngui:label="Create Argument">
190
+ <element name="item" rngui:label="Description">
191
+ <attribute name="label" rngui:label="Name">
192
+ <data type="string"/>
193
+ </attribute>
194
+ <text rngui:wrap="true" rngui:label="What does it do?"/>
195
+ </element>
196
+ </zeroOrMore>
197
+ </element>
198
+ <element name="output" rngui:header="Output Elements Documentation" rngui:fold="closed">
199
+ <zeroOrMore rngui:label="Create Element">
200
+ <element name="item" rngui:label="Description">
201
+ <attribute name="label" rngui:label="Name">
202
+ <data type="string"/>
203
+ </attribute>
204
+ <text rngui:wrap="true" rngui:label="What does it do?"/>
205
+ </element>
206
+ </zeroOrMore>
207
+ </element>
208
+ <element name="implementation" rngui:header="Implementation Documentation" rngui:fold="closed">
209
+ <element name="description" rngui:label="Description">
210
+ <text rngui:wrap="true" rngui:label="What is supposed to happen?"/>
211
+ </element>
212
+ </element>
213
+ <element name="code" rngui:header="Output Handling Documentation" rngui:fold="closed">
214
+ <element name="description" rngui:label="Description">
215
+ <text rngui:wrap="true" rngui:label="Which output elements are important? How to transform and save them?"/>
216
+ </element>
217
+ </element>
188
218
  </element>
@@ -49,6 +49,16 @@ function WFAdaptorManifestation(adaptor) {
49
49
  });
50
50
  return svgid;
51
51
  }; //}}}
52
+ //{{{ Return the json for all marked tasks
53
+ this.marked_text = function(){
54
+ var nodes = [];
55
+ var markymark = _.uniq(self.marked());
56
+ $(markymark).each(function(key,svgid){
57
+ var node = self.adaptor.description.get_node_by_svg_id(svgid);
58
+ nodes.push($(node).serializePrettyXML());
59
+ });
60
+ return JSON.stringify(nodes);
61
+ }; //}}}
52
62
  //{{{ Render the details from rng (right hand side of graph tab)
53
63
  this.update_details = function(svgid){
54
64
  var tab = $('#dat_details');
@@ -76,35 +86,46 @@ function WFAdaptorManifestation(adaptor) {
76
86
  }; //}}}
77
87
 
78
88
  function copyOrMove(menu,group,xml_node,mode) { //{{{
79
- var markymark = _.uniq(self.marked());
89
+ var nodes = localStorage.getItem('marked');
90
+
91
+ if (typeof(nodes) != "string") { return; }
92
+
93
+ nodes = JSON.parse(nodes);
94
+ $(nodes).each(function(key,str) {
95
+ nodes[key] = $X(str);;
96
+ });
97
+
80
98
  var check1 = [];
81
99
  var check2 = [];
82
- $(markymark).each(function(key,svgid){
83
- var node = self.adaptor.description.get_node_by_svg_id(svgid);
100
+ $(nodes).each(function(key,node){
84
101
  check1.push($(node).attr('svg-type'));
85
102
  });
86
103
  $(group).each(function(key,value){
87
104
  check2.push(value.type);
88
105
  });
89
106
 
90
- if (markymark.length > 0 && _.uniq(check1).length == _.intersection(check1,check2).length) {
91
- var nodes = [];
92
- $(markymark).each(function(key,svgid){
93
- var node = self.adaptor.description.get_node_by_svg_id(svgid);
94
- nodes.unshift(node);
95
- });
96
-
107
+ if (nodes.length > 0 && _.uniq(check1).length == _.intersection(check1,check2).length) {
108
+ if (myid == localStorage.getItem('marked_from')) {
109
+ $(nodes).each(function(key,node){
110
+ nodes[key] = self.adaptor.description.get_node_by_svg_id($(node).attr('svg-id'));
111
+ });
112
+ }
113
+ nodes.reverse();
97
114
  var iconm = self.resources['arrow'].clone();
98
115
  var iconc = self.resources['arrow'].clone();
99
116
  iconm.children('.rfill').addClass('menu');
117
+ if (myid == localStorage.getItem('marked_from')) {
118
+ menu.push(
119
+ {
120
+ 'label': '<em>Move Marked Elements</em>',
121
+ 'function_call': mode,
122
+ 'menu_icon': iconm,
123
+ 'type': undefined,
124
+ 'params': [nodes, xml_node]
125
+ }
126
+ );
127
+ }
100
128
  menu.push(
101
- {
102
- 'label': '<em>Move Marked Elements</em>',
103
- 'function_call': mode,
104
- 'menu_icon': iconm,
105
- 'type': undefined,
106
- 'params': [nodes, xml_node]
107
- },
108
129
  {
109
130
  'label': '<em>Copy Marked Elements</em>',
110
131
  'function_call': mode,
@@ -217,16 +238,26 @@ function WFAdaptorManifestation(adaptor) {
217
238
  self.adaptor.illustrator.get_elements().removeClass('selected');
218
239
  self.adaptor.illustrator.get_labels().removeClass('selected');
219
240
 
220
- if (e && e.ctrlKey) {
241
+ if (e && (e.ctrlKey || e.metaKey)) {
221
242
  if (save['state'] != "ready" && save['state'] != "stopped") { return false; }
222
243
  var tab = $('#dat_details');
223
244
  tab.empty();
224
245
  var vtarget = self.adaptor.illustrator.get_node_by_svg_id(svgid);
225
246
  if (vtarget.length > 0) {
226
- vtarget.parents('g.element[element-id]').toggleClass('marked');
247
+ var vt = vtarget.parents('g.element[element-id]');
248
+ vt.toggleClass('marked');
249
+ if (vt.hasClass('marked')) {
250
+ localStorage.setItem('marked',self.marked_text());
251
+ localStorage.setItem('marked_from',myid);
252
+ } else {
253
+ localStorage.removeItem('marked');
254
+ localStorage.removeItem('marked_from');
255
+ }
227
256
  }
228
257
  } else {
229
258
  self.adaptor.illustrator.get_elements().removeClass('marked');
259
+ localStorage.removeItem('marked');
260
+ localStorage.removeItem('marked_from');
230
261
 
231
262
  var vtarget = self.adaptor.illustrator.get_node_by_svg_id(svgid);
232
263
  if (vtarget.length > 0) {