cpee 2.0.30 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (330) hide show
  1. checksums.yaml +4 -4
  2. data/cockpit/js/instance.js +3 -3
  3. data/cockpit/js/wfadaptor.js +2 -0
  4. data/cockpit/templates.legacy/Async.xml +12 -12
  5. data/cockpit/templates.legacy/BCO.xml +9 -11
  6. data/cockpit/templates.legacy/BCS.xml +9 -11
  7. data/cockpit/templates.legacy/Centurio.xml +7 -7
  8. data/cockpit/templates.legacy/Concurrent.xml +7 -7
  9. data/cockpit/templates.legacy/Coopis Testset.xml +7 -7
  10. data/cockpit/templates.legacy/Endpoints and Data Manipulation.xml +6 -7
  11. data/cockpit/templates.legacy/ICSOC Testset.xml +7 -7
  12. data/cockpit/templates.legacy/Infinity.xml +7 -7
  13. data/cockpit/templates.legacy/Lego Boxer.xml +13 -13
  14. data/cockpit/templates.legacy/Lego Conveyor.xml +13 -13
  15. data/cockpit/templates.legacy/Lego Crane.xml +16 -16
  16. data/cockpit/templates.legacy/Lego Ejector.xml +16 -16
  17. data/cockpit/templates.legacy/Lego Full.xml +12 -12
  18. data/cockpit/templates.legacy/Lego Liddy.xml +13 -13
  19. data/cockpit/templates.legacy/Lego Plate.xml +13 -13
  20. data/cockpit/templates.legacy/Lego Transporter.xml +14 -14
  21. data/cockpit/templates.legacy/Lego_Part_1.xml +12 -12
  22. data/cockpit/templates.legacy/LgLinear.xml +7 -10
  23. data/cockpit/templates.legacy/Linear.xml +11 -14
  24. data/cockpit/templates.legacy/Log.xml +11 -12
  25. data/cockpit/templates.legacy/Mangler 1.xml +7 -7
  26. data/cockpit/templates.legacy/Mangler 2.xml +7 -7
  27. data/cockpit/templates.legacy/Manuel Labels.xml +11 -11
  28. data/cockpit/templates.legacy/Promise.xml +30 -30
  29. data/cockpit/templates.legacy/SOPROMO Test Sonification.xml +7 -7
  30. data/cockpit/templates.legacy/Subprocess.xml +15 -15
  31. data/cockpit/templates.legacy/Syncing P34 1.xml +8 -11
  32. data/cockpit/templates.legacy/Syncing P34 2.xml +8 -11
  33. data/cockpit/templates.legacy/Syncing P34 3.xml +8 -11
  34. data/cockpit/templates.legacy/Syncing P34.xml +8 -11
  35. data/cockpit/templates.legacy/TEST - Bad Loop.xml +7 -7
  36. data/cockpit/templates.legacy/TEST - Wrong Positions.xml +7 -7
  37. data/cockpit/templates.legacy/Take_5.xml +14 -14
  38. data/cockpit/templates.legacy/Update.xml +11 -11
  39. data/cockpit/templates.legacy/Worklist Parallel.xml +17 -17
  40. data/cockpit/templates.legacy/Worklist Test CPEE.xml +14 -14
  41. data/cockpit/templates.legacy/Worklist Test.xml +14 -14
  42. data/cockpit/templates.legacy/Worklist Test2.xml +14 -14
  43. data/cockpit/templates/Coopis 2010.xml +8 -8
  44. data/cockpit/templates/IUPC arXiv:1104.3609 P34 1.xml +8 -11
  45. data/cockpit/templates/IUPC arXiv:1104.3609 P34 2.xml +8 -11
  46. data/cockpit/templates/IUPC arXiv:1104.3609 P34 3.xml +8 -11
  47. data/cockpit/templates/Track Test Local.xml +2 -2
  48. data/cockpit/templates/Track Test.xml +1 -1
  49. data/cockpit/templates/UR-VUE 2020 Manual Adjust.xml +1 -1
  50. data/cockpit/templates/UR-VUE 2020 Solution Baseline.xml +1 -1
  51. data/cockpit/templates/UR-VUE 2020 Solution NN.xml +1 -1
  52. data/cockpit/templates/UR-VUE 2020 Solution View.xml +1 -1
  53. data/cockpit/templates/UR-VUE 2020.xml +1 -1
  54. data/cockpit/templates/Worklist.xml +14 -14
  55. data/cockpit/templates/instantiate.local/Take_Sub.xml +2 -2
  56. data/cockpit/templates/instantiate/Take_Perf.xml +1 -1
  57. data/cockpit/templates/instantiate/Take_Sub.xml +2 -2
  58. data/cockpit/templates/instantiate/Take_X.xml +2 -2
  59. data/cockpit/themes/compact/rngs/start.rng +83 -0
  60. data/cockpit/themes/compact/symbols/start.svg +1 -1
  61. data/cockpit/themes/control/rngs/start.rng +83 -0
  62. data/cockpit/themes/control/symbols/start.svg +1 -1
  63. data/cockpit/themes/default/rngs/start.rng +83 -0
  64. data/cockpit/themes/default/symbols/start.svg +1 -1
  65. data/cockpit/themes/default/theme.js +1 -1
  66. data/cockpit/themes/extended/rngs/start.rng +83 -0
  67. data/cockpit/themes/extended/symbols/start.svg +1 -1
  68. data/cockpit/themes/model/symbols/start.svg +1 -1
  69. data/cockpit/themes/packed/rngs/start.rng +83 -0
  70. data/cockpit/themes/packed/symbols/start.svg +1 -1
  71. data/cockpit/themes/preset/rngs/start.rng +83 -0
  72. data/cockpit/themes/preset/symbols/start.svg +1 -1
  73. data/cockpit/themes/preset/theme.js +1 -1
  74. data/cpee.gemspec +2 -2
  75. data/lib/cpee/attributes_helper.rb +14 -0
  76. data/lib/cpee/implementation.rb +10 -8
  77. data/lib/cpee/implementation_callbacks.rb +14 -0
  78. data/lib/cpee/implementation_notifications.rb +14 -0
  79. data/lib/cpee/implementation_properties.rb +128 -24
  80. data/lib/cpee/persistence.rb +0 -27
  81. data/lib/cpee/statemachine.rb +14 -0
  82. data/lib/cpee/value_helper.rb +14 -0
  83. data/lib/properties.xml +4 -4
  84. data/lib/properties/{handlerwrapper.rng → executionhandler.rng} +2 -2
  85. data/lib/properties/properties.rng +2 -2
  86. data/lib/properties/set-properties.rng +2 -2
  87. data/lib/properties/set-some-properties.rng +2 -2
  88. data/server/{resources → executionhandlers/ruby}/backend/README.md +0 -0
  89. data/server/{resources → executionhandlers/ruby}/backend/instance.template +2 -4
  90. data/server/{resources → executionhandlers/ruby}/backend/opts.yaml +2 -2
  91. data/server/executionhandlers/ruby/backend/run +37 -0
  92. data/server/{handlerwrappers/default.rb → executionhandlers/ruby/connection.rb} +3 -3
  93. data/server/executionhandlers/ruby/controller.rb +195 -0
  94. data/server/{resources/transformation_dslx.xsl → executionhandlers/ruby/dsl_to_dslx.xsl} +53 -8
  95. data/server/executionhandlers/ruby/execution.rb +81 -0
  96. data/server/resources/properties.empty +1 -1
  97. data/server/resources/properties.init +1 -1
  98. data/server/resources/topics.xml +2 -2
  99. data/server/routing/persist.rb +3 -3
  100. data/tools/cpee +9 -3
  101. data/tools/server/cpee +1 -1
  102. data/tools/server/resources/properties.init +1 -1
  103. metadata +19 -237
  104. data/cockpit/templates.legacy/convert_cpee2.rb +0 -15
  105. data/lib/cpee/controller.rb +0 -199
  106. data/lib/cpee/transform.rb +0 -95
  107. data/server/resources/backend/instance.rb +0 -23
  108. data/server/resources/backend/run +0 -33
  109. data/server/routing/end.pid +0 -1
  110. data/server/routing/forward-events.pid +0 -1
  111. data/server/routing/forward-votes.pid +0 -1
  112. data/server/routing/persist.pid +0 -1
  113. data/server/server.pid +0 -1
  114. data/tools/test/README +0 -4
  115. data/tools/test/config.json +0 -3
  116. data/tools/test/contrib/graph_example.svg +0 -1166
  117. data/tools/test/contrib/legend.svg +0 -817
  118. data/tools/test/contrib/symbols.svg +0 -224
  119. data/tools/test/contrib/transformation1.xsl +0 -264
  120. data/tools/test/contrib/transformation2.xsl +0 -10
  121. data/tools/test/contrib/tree_example.svg +0 -788
  122. data/tools/test/css/model.css +0 -24
  123. data/tools/test/css/track.css +0 -60
  124. data/tools/test/css/ui.css +0 -214
  125. data/tools/test/css/wfadaptor.css +0 -422
  126. data/tools/test/edit.html +0 -258
  127. data/tools/test/graph.html +0 -69
  128. data/tools/test/index.html +0 -258
  129. data/tools/test/js/details.js +0 -109
  130. data/tools/test/js/instance.js +0 -1344
  131. data/tools/test/js/model.js +0 -41
  132. data/tools/test/js/parameters.js +0 -82
  133. data/tools/test/js/track.js +0 -18
  134. data/tools/test/js/ui.js +0 -104
  135. data/tools/test/js/wfadaptor.js +0 -763
  136. data/tools/test/js_libs.zip +0 -0
  137. data/tools/test/js_libs/Makefile +0 -2
  138. data/tools/test/js_libs/ansi_up.js +0 -333
  139. data/tools/test/js_libs/console.js +0 -80
  140. data/tools/test/js_libs/custommenu.css +0 -84
  141. data/tools/test/js_libs/custommenu.js +0 -104
  142. data/tools/test/js_libs/experiments1/relaxngui.css +0 -185
  143. data/tools/test/js_libs/experiments1/relaxngui.js +0 -488
  144. data/tools/test/js_libs/experiments1/rngtest9.html +0 -60
  145. data/tools/test/js_libs/experiments1/rngtest9.rng +0 -35
  146. data/tools/test/js_libs/experiments1/rngtest9.xml +0 -8
  147. data/tools/test/js_libs/jquery-2.2.4.min.js +0 -4
  148. data/tools/test/js_libs/jquery-3.2.1.min.js +0 -4
  149. data/tools/test/js_libs/jquery-3.3.1.min.js +0 -2
  150. data/tools/test/js_libs/jquery.browser.js +0 -40
  151. data/tools/test/js_libs/jquery.caret.min.js +0 -10
  152. data/tools/test/js_libs/jquery.cookie.js +0 -117
  153. data/tools/test/js_libs/jquery.min.js +0 -1
  154. data/tools/test/js_libs/jquery.svg.min.js +0 -6
  155. data/tools/test/js_libs/jquery.svgdom.min.js +0 -6
  156. data/tools/test/js_libs/markdown.min.js +0 -1
  157. data/tools/test/js_libs/parsequery.js +0 -21
  158. data/tools/test/js_libs/printf.js +0 -368
  159. data/tools/test/js_libs/relaxngui.css +0 -213
  160. data/tools/test/js_libs/relaxngui.js +0 -543
  161. data/tools/test/js_libs/strftime.min.js +0 -1
  162. data/tools/test/js_libs/tests/dataelements.html +0 -59
  163. data/tools/test/js_libs/tests/dataelements.rng +0 -8
  164. data/tools/test/js_libs/tests/dataelements.xml +0 -3
  165. data/tools/test/js_libs/tests/relaxngui.css +0 -203
  166. data/tools/test/js_libs/tests/relaxngui.js +0 -502
  167. data/tools/test/js_libs/tests/rngtest1.html +0 -66
  168. data/tools/test/js_libs/tests/rngtest1.rng +0 -147
  169. data/tools/test/js_libs/tests/rngtest1.xml +0 -13
  170. data/tools/test/js_libs/tests/rngtest2.html +0 -60
  171. data/tools/test/js_libs/tests/rngtest2.rng +0 -6
  172. data/tools/test/js_libs/tests/rngtest2.xml +0 -3
  173. data/tools/test/js_libs/tests/rngtest3.html +0 -60
  174. data/tools/test/js_libs/tests/rngtest3.rng +0 -23
  175. data/tools/test/js_libs/tests/rngtest3.xml +0 -9
  176. data/tools/test/js_libs/tests/rngtest4.html +0 -60
  177. data/tools/test/js_libs/tests/rngtest4.rng +0 -19
  178. data/tools/test/js_libs/tests/rngtest4.xml +0 -12
  179. data/tools/test/js_libs/tests/rngtest5.html +0 -60
  180. data/tools/test/js_libs/tests/rngtest5.rng +0 -75
  181. data/tools/test/js_libs/tests/rngtest5.xml +0 -40
  182. data/tools/test/js_libs/tests/rngtest6.html +0 -60
  183. data/tools/test/js_libs/tests/rngtest6.rng +0 -24
  184. data/tools/test/js_libs/tests/rngtest6.xml +0 -6
  185. data/tools/test/js_libs/tests/rngtest8.html +0 -60
  186. data/tools/test/js_libs/tests/rngtest8.rng +0 -13
  187. data/tools/test/js_libs/tests/rngtest8.xml +0 -2
  188. data/tools/test/js_libs/tests/rngtest9.html +0 -60
  189. data/tools/test/js_libs/tests/rngtest9.rng +0 -31
  190. data/tools/test/js_libs/tests/rngtest9.xml +0 -8
  191. data/tools/test/js_libs/ui.css +0 -333
  192. data/tools/test/js_libs/ui.html +0 -168
  193. data/tools/test/js_libs/ui.js +0 -177
  194. data/tools/test/js_libs/underscore.min.js +0 -27
  195. data/tools/test/js_libs/util.js +0 -81
  196. data/tools/test/js_libs/vkbeautify.0.99.00.beta.js +0 -358
  197. data/tools/test/js_libs/vkbeautify.js +0 -1
  198. data/tools/test/js_libs/webcomponents.min.js +0 -196
  199. data/tools/test/model.html +0 -192
  200. data/tools/test/rngs/attributes.rng +0 -8
  201. data/tools/test/rngs/dataelements.rng +0 -8
  202. data/tools/test/rngs/endpoints.rng +0 -8
  203. data/tools/test/templates.legacy/Async.xml +0 -46
  204. data/tools/test/templates.legacy/BCO.xml +0 -70
  205. data/tools/test/templates.legacy/BCS.xml +0 -70
  206. data/tools/test/templates.legacy/Centurio.xml +0 -75
  207. data/tools/test/templates.legacy/Concurrent.xml +0 -40
  208. data/tools/test/templates.legacy/Coopis Testset.xml +0 -76
  209. data/tools/test/templates.legacy/Endpoints and Data Manipulation.xml +0 -30
  210. data/tools/test/templates.legacy/ICSOC Testset.xml +0 -95
  211. data/tools/test/templates.legacy/Infinity.xml +0 -28
  212. data/tools/test/templates.legacy/Lego Boxer.xml +0 -31
  213. data/tools/test/templates.legacy/Lego Conveyor.xml +0 -31
  214. data/tools/test/templates.legacy/Lego Crane.xml +0 -87
  215. data/tools/test/templates.legacy/Lego Ejector.xml +0 -55
  216. data/tools/test/templates.legacy/Lego Full.xml +0 -142
  217. data/tools/test/templates.legacy/Lego Liddy.xml +0 -40
  218. data/tools/test/templates.legacy/Lego Plate.xml +0 -31
  219. data/tools/test/templates.legacy/Lego Transporter.xml +0 -43
  220. data/tools/test/templates.legacy/Lego_Part_1.xml +0 -85
  221. data/tools/test/templates.legacy/LgLinear.xml +0 -65
  222. data/tools/test/templates.legacy/Linear.xml +0 -77
  223. data/tools/test/templates.legacy/Log.xml +0 -117
  224. data/tools/test/templates.legacy/Mangler 1.xml +0 -87
  225. data/tools/test/templates.legacy/Mangler 2.xml +0 -103
  226. data/tools/test/templates.legacy/Manuel Labels.xml +0 -55
  227. data/tools/test/templates.legacy/Promise.xml +0 -275
  228. data/tools/test/templates.legacy/SOPROMO Test Sonification.xml +0 -83
  229. data/tools/test/templates.legacy/Subprocess.xml +0 -56
  230. data/tools/test/templates.legacy/Syncing P34 1.xml +0 -77
  231. data/tools/test/templates.legacy/Syncing P34 2.xml +0 -77
  232. data/tools/test/templates.legacy/Syncing P34 3.xml +0 -77
  233. data/tools/test/templates.legacy/Syncing P34.xml +0 -77
  234. data/tools/test/templates.legacy/TEST - Bad Loop.xml +0 -173
  235. data/tools/test/templates.legacy/TEST - Wrong Positions.xml +0 -174
  236. data/tools/test/templates.legacy/Take_5.xml +0 -48
  237. data/tools/test/templates.legacy/Update.xml +0 -32
  238. data/tools/test/templates.legacy/Worklist Parallel.xml +0 -104
  239. data/tools/test/templates.legacy/Worklist Test CPEE.xml +0 -40
  240. data/tools/test/templates.legacy/Worklist Test.xml +0 -42
  241. data/tools/test/templates.legacy/Worklist Test2.xml +0 -43
  242. data/tools/test/templates.legacy/convert_cpee2.rb +0 -15
  243. data/tools/test/templates.legacy/convert_preset.rb +0 -32
  244. data/tools/test/templates.legacy/testsets.xml +0 -37
  245. data/tools/test/templates.legacy/transformations.xml +0 -4
  246. data/tools/test/templates/Coopis 2010.xml +0 -76
  247. data/tools/test/templates/IUPC arXiv:1104.3609 P34 1.xml +0 -77
  248. data/tools/test/templates/IUPC arXiv:1104.3609 P34 2.xml +0 -77
  249. data/tools/test/templates/IUPC arXiv:1104.3609 P34 3.xml +0 -77
  250. data/tools/test/templates/Track Test Local.xml +0 -82
  251. data/tools/test/templates/Track Test.xml +0 -82
  252. data/tools/test/templates/UR-VUE 2020 Manual Adjust.xml +0 -182
  253. data/tools/test/templates/UR-VUE 2020 Solution Baseline.xml +0 -203
  254. data/tools/test/templates/UR-VUE 2020 Solution NN.xml +0 -197
  255. data/tools/test/templates/UR-VUE 2020 Solution View.xml +0 -151
  256. data/tools/test/templates/UR-VUE 2020.xml +0 -26
  257. data/tools/test/templates/Worklist.xml +0 -42
  258. data/tools/test/templates/instantiate.local/Take_Sub.xml +0 -59
  259. data/tools/test/templates/instantiate/Take_Perf.xml +0 -46
  260. data/tools/test/templates/instantiate/Take_Sub.xml +0 -58
  261. data/tools/test/templates/instantiate/Take_X.xml +0 -48
  262. data/tools/test/themes/compact/theme.js +0 -1285
  263. data/tools/test/themes/diana/theme.js +0 -1650
  264. data/tools/test/themes/extended/theme.js +0 -1325
  265. data/tools/test/themes/model/rngs/alternative.rng +0 -1
  266. data/tools/test/themes/model/rngs/call.rng +0 -67
  267. data/tools/test/themes/model/rngs/callmanipulate.rng +0 -72
  268. data/tools/test/themes/model/rngs/choose.rng +0 -1
  269. data/tools/test/themes/model/rngs/critical.rng +0 -1
  270. data/tools/test/themes/model/rngs/escape.rng +0 -1
  271. data/tools/test/themes/model/rngs/group.rng +0 -1
  272. data/tools/test/themes/model/rngs/loop.rng +0 -1
  273. data/tools/test/themes/model/rngs/manipulate.rng +0 -1
  274. data/tools/test/themes/model/rngs/otherwise.rng +0 -1
  275. data/tools/test/themes/model/rngs/parallel.rng +0 -1
  276. data/tools/test/themes/model/rngs/parallel_branch.rng +0 -1
  277. data/tools/test/themes/model/rngs/scripts.rng +0 -7
  278. data/tools/test/themes/model/rngs/stop.rng +0 -1
  279. data/tools/test/themes/model/rngs/terminate.rng +0 -1
  280. data/tools/test/themes/model/theme.js +0 -1268
  281. data/tools/test/themes/packed/theme.js +0 -1286
  282. data/tools/test/themes/preset/rngs/alternative.rng +0 -25
  283. data/tools/test/themes/preset/rngs/call.rng +0 -122
  284. data/tools/test/themes/preset/rngs/callmanipulate.rng +0 -145
  285. data/tools/test/themes/preset/rngs/choose.rng +0 -14
  286. data/tools/test/themes/preset/rngs/closed_loop.rng +0 -62
  287. data/tools/test/themes/preset/rngs/closed_loop_cancel.rng +0 -5
  288. data/tools/test/themes/preset/rngs/closed_loop_control.rng +0 -31
  289. data/tools/test/themes/preset/rngs/closed_loop_measuring.rng +0 -12
  290. data/tools/test/themes/preset/rngs/critical.rng +0 -5
  291. data/tools/test/themes/preset/rngs/escape.rng +0 -1
  292. data/tools/test/themes/preset/rngs/group.rng +0 -3
  293. data/tools/test/themes/preset/rngs/loop.rng +0 -22
  294. data/tools/test/themes/preset/rngs/manipulate.rng +0 -9
  295. data/tools/test/themes/preset/rngs/otherwise.rng +0 -22
  296. data/tools/test/themes/preset/rngs/parallel.rng +0 -21
  297. data/tools/test/themes/preset/rngs/parallel_branch.rng +0 -8
  298. data/tools/test/themes/preset/rngs/scripts.rng +0 -23
  299. data/tools/test/themes/preset/rngs/stop.rng +0 -5
  300. data/tools/test/themes/preset/rngs/terminate.rng +0 -1
  301. data/tools/test/themes/preset/symbols/alternative.svg +0 -5
  302. data/tools/test/themes/preset/symbols/arrow.svg +0 -3
  303. data/tools/test/themes/preset/symbols/call.svg +0 -6
  304. data/tools/test/themes/preset/symbols/callmanipulate.svg +0 -8
  305. data/tools/test/themes/preset/symbols/choose.svg +0 -5
  306. data/tools/test/themes/preset/symbols/choose_exclusive.svg +0 -5
  307. data/tools/test/themes/preset/symbols/choose_inclusive.svg +0 -4
  308. data/tools/test/themes/preset/symbols/closed_loop.svg +0 -5
  309. data/tools/test/themes/preset/symbols/closed_loop_cancel.svg +0 -5
  310. data/tools/test/themes/preset/symbols/closed_loop_control.svg +0 -5
  311. data/tools/test/themes/preset/symbols/closed_loop_measuring.svg +0 -6
  312. data/tools/test/themes/preset/symbols/complex.svg +0 -8
  313. data/tools/test/themes/preset/symbols/critical.svg +0 -4
  314. data/tools/test/themes/preset/symbols/end.svg +0 -3
  315. data/tools/test/themes/preset/symbols/escape.svg +0 -5
  316. data/tools/test/themes/preset/symbols/event_end.svg +0 -3
  317. data/tools/test/themes/preset/symbols/loop.svg +0 -5
  318. data/tools/test/themes/preset/symbols/manipulate.svg +0 -4
  319. data/tools/test/themes/preset/symbols/otherwise.svg +0 -5
  320. data/tools/test/themes/preset/symbols/parallel.svg +0 -5
  321. data/tools/test/themes/preset/symbols/parallel_branch.svg +0 -5
  322. data/tools/test/themes/preset/symbols/parallel_branch_compact.svg +0 -4
  323. data/tools/test/themes/preset/symbols/parallel_branch_event.svg +0 -14
  324. data/tools/test/themes/preset/symbols/parallel_branch_normal.svg +0 -5
  325. data/tools/test/themes/preset/symbols/scripts.svg +0 -4
  326. data/tools/test/themes/preset/symbols/start.svg +0 -3
  327. data/tools/test/themes/preset/symbols/stop.svg +0 -5
  328. data/tools/test/themes/preset/symbols/terminate.svg +0 -4
  329. data/tools/test/themes/preset/theme.js +0 -1287
  330. data/tools/test/track.html +0 -142
@@ -1,41 +0,0 @@
1
- document.addEventListener('graph:changed', function (e) {
2
- $("button[name=save]").prop("disabled",false);
3
- }, false);
4
-
5
- $(document).ready(function() {
6
- $('#tabmodel').click(function(event){
7
- $('#model ui-behind button:nth-child(1)').addClass('hidden');
8
- });
9
- $('#tabdataelements').click(function(event){
10
- $('#model ui-behind button:nth-child(1)').removeClass('hidden');
11
- });
12
-
13
- $('#model ui-behind button:nth-child(1)').click(function(event){
14
- var but = $(document).find('#model ui-content ui-area:not(.inactive) button');
15
- but.click();
16
- var are = $(document).find('#model ui-content ui-area:not(.inactive)');
17
- var tab = $(document).find('#model ui-content ui-area:not(.inactive) .relaxngui_table');
18
- are.animate({ scrollTop: tab.height() }, "slow");
19
- });
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
- });
@@ -1,82 +0,0 @@
1
- $(document).ready(function() {
2
- // hook up dataelements with relaxngui //{{{
3
- $.ajax({
4
- type: "GET",
5
- url: "rngs/dataelements.rng",
6
- dataType: "xml",
7
- success: function(rng){
8
- save['dataelements'] = new RelaxNGui(rng,$('#dat_dataelements'));
9
- }
10
- }); //}}}
11
- // hook up endpoints with relaxngui //{{{
12
- $.ajax({
13
- type: "GET",
14
- dataType: "xml",
15
- url: "rngs/endpoints.rng",
16
- success: function(rng){
17
- save['endpoints'] = new RelaxNGui(rng,$('#dat_endpoints'));
18
- }
19
- }); //}}}
20
- // hook up attributes with relaxngui //{{{
21
- $.ajax({
22
- type: "GET",
23
- dataType: "xml",
24
- url: "rngs/attributes.rng",
25
- success: function(rng){
26
- save['attributes'] = new RelaxNGui(rng,$('#dat_attributes'));
27
- }
28
- }); //}}}
29
-
30
- // new entry //{{{
31
- $('#parameters ui-behind button:nth-child(1)').click(function(event){
32
- var but = $(document).find('#parameters ui-content ui-area:not(.inactive) button');
33
- but.click();
34
- var are = $(document).find('#parameters ui-content ui-area:not(.inactive)');
35
- var tab = $(document).find('#parameters ui-content ui-area:not(.inactive) .relaxngui_table');
36
- are.animate({ scrollTop: tab.height() }, "slow");
37
- }); //}}}
38
-
39
- var timer;
40
- // when input in one of the inputs, save
41
- $(document).on('input','#dat_dataelements input, #dat_endpoints input, #dat_attributes input',function(event){
42
- clearTimeout(timer);
43
- timer = setTimeout(function(){ do_parameters_save(event); }, 5000);
44
- });
45
- $(document).on('blur','#dat_dataelements input, #dat_endpoints input, #dat_attributes input',function(event){
46
- clearTimeout(timer);
47
- do_parameters_save(event);
48
- }); //}}}
49
- $(document).on('keypress','#dat_dataelements input, #dat_endpoints input, #dat_attributes input',function(event){
50
- if (event.keyCode == 13) {
51
- clearTimeout(timer);
52
- do_parameters_save(event);
53
- }
54
- }); //}}}
55
- $(document).on('relaxngui_remove', '#dat_dataelements, #dat_endpoints, #dat_attributes', function(event){
56
- clearTimeout(timer);
57
- do_parameters_save(event);
58
- });
59
- $(document).on('relaxngui_move', '#dat_dataelements, #dat_endpoints, #dat_attributes', function(event){
60
- clearTimeout(timer);
61
- do_parameters_save(event);
62
- });
63
- });
64
-
65
- function do_parameters_save(event) { //{{{
66
- var visid = $('ui-tabbar ui-tab',$(event.target).parents('ui-tabbed')).not('.switch').not('.inactive').attr('data-tab');
67
- if (save[visid].has_changed()) {
68
- var url = $('body').attr('current-instance');
69
- save[visid].set_checkpoint();
70
- var send = save[visid].save_text();
71
- $.ajax({
72
- type: "PUT",
73
- url: url + "/properties/" + visid + "/",
74
- contentType: 'text/xml',
75
- headers: {
76
- 'Content-ID': visid,
77
- 'CPEE-Event-Source': myid
78
- },
79
- data: send
80
- });
81
- }
82
- } //}}}
@@ -1,18 +0,0 @@
1
- function closeIFrame(srch) {
2
- var count = 0;
3
- $('iframe').each(function(i,val){
4
- if ($(val).attr('src') == 'track.html' + srch) {
5
- $(val).remove();
6
- }
7
- count += 1;
8
- });
9
- if (count == 1) {
10
- $('#graphcolumn').removeClass('resize');
11
- }
12
- }
13
-
14
- $(document).ready(function() {
15
- $("a[name=glob_unshow]").click(e => {
16
- parent.closeIFrame(window.location.search);
17
- });
18
- });
data/tools/test/js/ui.js DELETED
@@ -1,104 +0,0 @@
1
- function config_defaults(){
2
- var default_values = {};
3
- // logs is missing, so that the button is not shown, when there is no info
4
- if (location.protocol.match(/^file/)) {
5
- default_values['res-url'] = 'http://localhost:' + $('body').data('res-port');
6
- default_values['base-url'] = 'http://localhost:' + $('body').data('base-port');
7
- default_values['save-url'] = 'http://localhost:' + $('body').data('base-port') + '/design';
8
- } else {
9
- default_values['res-url'] = location.protocol + "//" + location.hostname + ":" + $('body').data('res-port');
10
- default_values['base-url'] = location.protocol + "//" + location.hostname + ":" + $('body').data('base-port');
11
- default_values['save-url'] = location.protocol + "//" + location.hostname + ":" + $('body').data('base-port') + '/design';
12
- }
13
- default_values['templates-url'] = 'templates/';
14
- return default_values;
15
- }
16
-
17
- $(document).ready(function() {
18
- if (!($.cookie('cpee_iagree')) && $("body > div[id='disclaimer']").length > 0) {
19
- $("body > :not([id='disclaimer'])").remove();
20
- $("body > [id='disclaimer']").removeClass('hidden');
21
-
22
- $("#iagree").click(function(){
23
- if($(this).is(':checked')){
24
- $("#icontinue").prop("disabled", false);
25
- } else {
26
- $("#icontinue").prop("disabled", true);
27
- }
28
- });
29
- $("#icontinue").click(function(){
30
- $.cookie('cpee_iagree','yes');
31
- location.reload();
32
- });
33
- } else {
34
- $.ajax({
35
- url: "config.json",
36
- success: function(res){
37
- var res_def = config_defaults();
38
- if (res['log-url']) { // just leave it out when it is not configured
39
- $("body").attr('current-logs',res['log-url']);
40
- }
41
- if (res['res-url']) {
42
- $("body").attr('current-resources',res['res-url']);
43
- } else {
44
- $("body").attr('current-resources',res_def['res-url']);
45
- }
46
- if (res['base-url']) {
47
- $("body").attr('current-base',res['base-url']);
48
- } else {
49
- $("body").attr('current-base',res_def['base-url']);
50
- }
51
- if (res['save-url']) {
52
- $("body").attr('current-save',res['save-url']);
53
- } else {
54
- $("body").attr('current-save',res_def['save-url']);
55
- }
56
- if (res['templates-url']) {
57
- $("body").attr('current-templates',res['templates-url']);
58
- } else {
59
- $("body").attr('current-templates',res_def['templates-url']);
60
- }
61
- $("input[name=res-url]").val($("body").attr('current-resources'));
62
- $("input[name=base-url]").val($("body").attr('current-base'));
63
- cockpit();
64
- },
65
- error: function(){
66
- var res = config_defaults();
67
- $("body").attr('current-resources',res['res-url']);
68
- $("body").attr('current-base',res['base-url']);
69
- $("body").attr('current-save',res['save-url']);
70
- $("body").attr('current-templates',res['templates-url']);
71
- $("input[name=res-url]").val($("body").attr('current-resources'));
72
- $("input[name=base-url]").val($("body").attr('current-base'));
73
- cockpit();
74
- }
75
- });
76
- }
77
- });
78
-
79
- $(document).on('copy', '[contenteditable]', function (e) {
80
- e = e.originalEvent;
81
- var selectedText = window.getSelection();
82
- var range = selectedText.getRangeAt(0);
83
- var selectedTextReplacement = range.toString()
84
- e.clipboardData.setData('text/plain', selectedTextReplacement);
85
- e.preventDefault(); // default behaviour is to copy any selected text
86
- });
87
-
88
- // Paste fix for contenteditable
89
- $(document).on('paste', '[contenteditable]', function (e) {
90
- e.preventDefault();
91
-
92
- if (window.clipboardData) {
93
- content = window.clipboardData.getData('Text');
94
- if (window.getSelection) {
95
- var selObj = window.getSelection();
96
- var selRange = selObj.getRangeAt(0);
97
- selRange.deleteContents();
98
- selRange.insertNode(document.createTextNode(content));
99
- }
100
- } else if (e.originalEvent.clipboardData) {
101
- content = (e.originalEvent || e).clipboardData.getData('text/plain');
102
- document.execCommand('insertText', false, content);
103
- }
104
- });
@@ -1,763 +0,0 @@
1
- /*
2
- This file is part of CPEE.
3
-
4
- CPEE is free software: you can redistribute it and/or modify it under the terms
5
- of the GNU General Public License as published by the Free Software Foundation,
6
- either version 3 of the License, or (at your option) any later version.
7
-
8
- CPEE is distributed in the hope that it will be useful, but WITHOUT ANY
9
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
10
- PARTICULAR PURPOSE. See the GNU General Public License for more details.
11
-
12
- You should have received a copy of the GNU General Public License along with
13
- CPEE (file COPYING in the main directory). If not, see
14
- <http://www.gnu.org/licenses/>.
15
- */
16
-
17
- // TODO: changes in svg-script:
18
- // 1) drawing functions
19
- // 2) creation of svg-container (Bug: arrows on lines)
20
- // 3) after-function to insert using namespace of description
21
-
22
- // WfAdaptor:
23
- // Handles interaction between Illustartor and Description
24
- // e.g. Event fires to Adaptor to insert Element and Illustrator and Description do it
25
- function WfAdaptor(theme_base,doit) { // Controller {{{
26
-
27
- // public variables {{{
28
- this.illustrator;
29
- this.description;
30
- this.elements = {};
31
- this.theme_base = theme_base;
32
- this.theme_dir = theme_base.replace(/theme.js/,'');
33
- // }}}
34
-
35
- // private variables {{{
36
- var illustrator;
37
- var description;
38
- var self = this;
39
- // }}}
40
-
41
- // helper funtions
42
- this.set_description = function(desc,auto_update) { // public {{{
43
- this.description.set_description(desc,auto_update);
44
- } // }}}
45
-
46
- this.get_description = function() { // public {{{
47
- return description.get_description();
48
- } // }}}
49
- this.notify = function() { // public {{{
50
- } // }}}
51
- this.draw_labels = function(max,labels,height_shift,striped){ // public {{{
52
- } // }}}
53
- this.set_svg_container = function (container) { // {{{
54
- illustrator.set_svg_container(container); // TODO: shadowing the container element
55
- } // }}}
56
- this.set_label_container = function(container) { // {{{
57
- illustrator.set_label_container(container);
58
- } // }}}
59
-
60
- // initialize
61
- this.illustrator = illustrator = new WfIllustrator(this);
62
- this.description = description = new WfDescription(this, this.illustrator);
63
-
64
- this.update = function(doit){ doit(self); };
65
-
66
- $.getScript(theme_base, function() {
67
- manifestation = new WFAdaptorManifestation(self);
68
- illustrator.compact = manifestation.compact == true ? true : false;
69
- illustrator.striped = manifestation.striped == true ? true : false;
70
- description.source = manifestation.source;
71
- var deferreds = [];
72
- // copy parent stuff
73
- for(element in manifestation.elements) {
74
- if (manifestation.elements[element].parent) {
75
- if (!manifestation.elements[element].description) {
76
- manifestation.elements[element].description = manifestation.elements[manifestation.elements[element].parent].description;
77
- }
78
- if (!manifestation.elements[element].adaptor) {
79
- manifestation.elements[element].adaptor = manifestation.elements[manifestation.elements[element].parent].adaptor;
80
- }
81
- var ill = manifestation.elements[manifestation.elements[element].parent].illustrator;
82
- for (var key in ill) {
83
- if (manifestation.elements[element].illustrator[key] == undefined) {
84
- manifestation.elements[element].illustrator[key] = ill[key];
85
- }
86
- }
87
- if (manifestation.elements[element].type == undefined) {
88
- manifestation.elements[element].type = manifestation.elements[manifestation.elements[element].parent].type;
89
- }
90
- }
91
- }
92
- // doit
93
- for(element in manifestation.resources) {
94
- deferreds.push(
95
- $.ajax({
96
- type: "GET",
97
- dataType: "xml",
98
- url: manifestation.resources[element],
99
- context: element,
100
- success: function(res){
101
- manifestation.resources[this] = $(res.documentElement);
102
- }
103
- })
104
- );
105
- }
106
- for(element in manifestation.elements) {
107
- if (manifestation.elements[element].illustrator) {
108
- if (manifestation.elements[element].illustrator.svg) {
109
- deferreds.push(
110
- $.ajax({
111
- type: "GET",
112
- dataType: "xml",
113
- url: manifestation.elements[element].illustrator.svg,
114
- context: element,
115
- success: function(res){
116
- manifestation.elements[this].illustrator.svg = $(res.documentElement);
117
- }
118
- })
119
- );
120
- }
121
- illustrator.elements[element] = manifestation.elements[element].illustrator;
122
- illustrator.elements[element].type = manifestation.elements[element].type || 'abstract';
123
- }
124
- if (manifestation.elements[element].description) {
125
- if ( typeof manifestation.elements[element].description === 'string' ) {
126
- manifestation.elements[element].description = [ manifestation.elements[element].description ];
127
- }
128
- if ($.isArray(manifestation.elements[element].description)) {
129
- _.each(manifestation.elements[element].description,function(val,ind){
130
- deferreds.push(
131
- $.ajax({
132
- type: "GET",
133
- dataType: "xml",
134
- url: val,
135
- context: element,
136
- success: function(res){
137
- manifestation.elements[this].description = $(res.documentElement);
138
- description.elements[this] = manifestation.elements[this].description;
139
- }
140
- })
141
- );
142
- });
143
- }
144
- }
145
- if (manifestation.elements[element].adaptor) {
146
- self.elements[element] = manifestation.elements[element].adaptor;
147
- }
148
- }
149
- $.when.apply($, deferreds).then(function(x) {
150
- doit(self);
151
- });
152
- });
153
- } // }}}
154
-
155
- // WfIllustrator:
156
- // Is in charge of displaying the Graph. It is further able insert and remove elements with given ID's from the illsutration.
157
- function WfIllustrator(wf_adaptor) { // View {{{
158
- // Variable {{{
159
- // public
160
- this.height = 40;
161
- this.width = 40;
162
- this.height_shift = this.height * 0.26;
163
- this.width_shift = this.width * 0.39;
164
- this.elements = {}; // the svgs
165
- this.svg = {};
166
- this.draw = {};
167
- this.compact = true;
168
- this.striped = true;
169
- // private
170
- var self = this;
171
- var adaptor = null;
172
- // }}}
173
- // Generic Functions {{{
174
- this.set_label_container = function(con) { // {{{
175
- self.svg.label_container = con;
176
- } // }}}
177
- this.set_svg_container = function(con) { // {{{
178
- self.svg.container = con;
179
- self.svg.container.append($X('<defs xmlns="http://www.w3.org/2000/svg">' +
180
- ' <marker id="arrow" viewBox="0 0 10 10" refX="33" refY="5" orient="auto" markerUnits="strokeWidth" markerWidth="4.5" makerHeight="4.5">' +
181
- ' <path d="m 2 2 l 6 3 l -6 3 z"/>' +
182
- ' </marker>' +
183
- '</defs>'));
184
- self.svg.defs = {};
185
- self.svg.defs['unknown'] = $X('<g xmlns="http://www.w3.org/2000/svg" class="unknown">' +
186
- '<circle cx="15" cy="15" r="14" class="unkown"/>' +
187
- '<text transform="translate(15,20)" class="normal">?</text>' +
188
- '</g>');
189
- for(element in self.elements)
190
- if(self.elements[element].svg) {
191
- var sym = $X('<g xmlns="http://www.w3.org/2000/svg"/>').append(self.elements[element].svg.clone().children()); // append all children to symbol
192
- $.each(self.elements[element].svg.attr('class').split(/\s+/), function(index, item) { sym.addClass(item); }); // copy all classes from the root node
193
- self.svg.defs[element] = sym;
194
- }
195
- } // }}}
196
- var clear = this.clear = function() { // {{{
197
- $('> :not(defs)', self.svg.container).each(function() {$(this).remove()});
198
- } // }}}
199
- this.set_svg = function(graph) { // {{{
200
- if(graph.max.row < 1) graph.max.row = 1;
201
- if(graph.max.col < 1) graph.max.col = 1;
202
- self.svg.container.attr('height', (graph.max.row) * self.height + self.height_shift);
203
- self.svg.container.attr('width', (graph.max.col+0.55) * self.width );
204
- self.svg.container.append(graph.svg);
205
- } // }}}
206
- this.get_node_by_svg_id = function(svg_id) { // {{{
207
- return $('[element-id = \'' + svg_id + '\'] g.activities', self.svg.container);
208
- } // }}}
209
- this.get_label_by_svg_id = function(svg_id) { // {{{
210
- return $('[element-id = \'' + svg_id + '\']', self.svg.label_container);
211
- } // }}}
212
- this.get_elements = function() { // {{{
213
- return $('g.element', self.svg.container);
214
- } // }}}
215
- this.get_labels = function() { // {{{
216
- return $('[element-id]', self.svg.label_container);
217
- } // }}}
218
- // }}}
219
- // Helper Functions {{{
220
- var draw_stripe = this.draw.draw_stripe = function (row, maxcol) { // {{{
221
- if (maxcol < 1) maxcol = 1;
222
- var g = $X('<rect class="stripe ' + (row % 2 == 0 ? 'even' : 'odd') + '" x="0" y="' + String(row*self.height+self.height_shift/2) + '" width="' + (self.width * maxcol + self.width - self.width_shift) + '" height="' + (self.height) + '" xmlns="http://www.w3.org/2000/svg"></rect>');
223
- self.svg.container.prepend(g);
224
- return g;
225
- } // }}}
226
-
227
- var draw_label = this.draw.draw_label = function (tname, id, label, row, col, group) { // {{{
228
- var g = $X('<text class="label" transform="translate(' + String(col*self.width-self.width_shift) + ',' + String(row*self.height+20-(self.height-self.height_shift)) + ')" xmlns="http://www.w3.org/2000/svg"></text>');
229
- var spli = $(label.split(/\n/));
230
- spli.each(function(k,v) {
231
- var tspan = $X('<tspan x="0" dy="' + (spli.length > 1 ? '-7' : '0') + '" xmlns="http://www.w3.org/2000/svg"></tspan>');
232
- if (k == 0) {
233
- tspan.text(v);
234
- } else {
235
- tspan.text(v);
236
- tspan.attr('dy','15');
237
- tspan.attr('dx','15');
238
- }
239
- g.append(tspan);
240
- });
241
- if(group) { group.find('g.element[element-id=' + id + ']').append(g); }
242
- else {self.svg.container.append(g);}
243
- return g;
244
- } // }}}
245
- var draw_symbol = this.draw.draw_symbol = function (sname, id, title, row, col, group, addition) { // {{{
246
- if(self.elements[sname] == undefined || self.elements[sname].svg == undefined) sname = 'unknown';
247
- if (addition) {
248
- var g = $X('<g class="element" element-type="' + sname + '" element-id="' + id + '" xmlns="http://www.w3.org/2000/svg">' +
249
- '<g transform="translate(' + String(col*self.width-self.width_shift) + ',' + String(row*self.height-(self.height-self.height_shift)) + ')"></g>' +
250
- '</g>');
251
- } else {
252
- var g = $X('<g class="element" element-type="' + sname + '" element-id="' + id + '" xmlns="http://www.w3.org/2000/svg">' +
253
- '<g transform="translate(' + String(col*self.width-self.width_shift) + ',' + String(row*self.height-(self.height-self.height_shift)) + ')">' +
254
- '<text class="super" transform="translate(30,8.4)">' +
255
- '<tspan class="active">0</tspan>' +
256
- '<tspan class="colon">,</tspan>' +
257
- '<tspan class="vote">0</tspan>' +
258
- '</text>' +
259
- '</g>' +
260
- '</g>');
261
- }
262
- var sym = self.svg.defs[sname].clone();
263
- var tit = $X('<title xmlns="http://www.w3.org/2000/svg"></title>');
264
- tit.text(title);
265
- sym.prepend(tit);
266
- sym.attr('class','activities');
267
- $(g[0].childNodes[0]).append(sym);
268
-
269
- // Binding events for symbol
270
- bind_event(g,sname,true);
271
-
272
- if(group) {group.append(g);}
273
- else {self.svg.container.children('g:first').append(g);}
274
- return g;
275
- } // }}}
276
- var bind_event = this.draw.bind_event = function(sym,tname,context) { //{{{
277
- for(event_name in adaptor.elements[tname]) {
278
- sym.bind(event_name, {'function_call':adaptor.elements[tname][event_name]}, function(e) { e.data.function_call($(this).attr('element-id'),e)});
279
- if(event_name == 'mousedown') sym.bind('contextmenu', false);
280
- }
281
- } //}}}
282
- var draw_border = this.draw.draw_border = function(id, p1, p2, group) { // {{{
283
- group.prepend($X('<rect element-id="' + id + '" x="' + (p1.col-0.50)*self.width + '" ' +
284
- 'y="' + (p1.row-0.80)*self.height + '" ' +
285
- 'width="' + ((p2.col+1.00)-p1.col)*self.width + '" ' +
286
- 'height="' + ((p2.row+1.00)-p1.row)*self.height +'" ' +
287
- 'class="block" rx="15" ry="15" xmlns="http://www.w3.org/2000/svg"/>'));
288
- } // }}}
289
- var draw_tile = this.draw.draw_tile = function(id, p1, p2, group) { // {{{
290
- group.prepend($X('<rect element-id="' + id + '" x="' + ((p1.col-1)*self.width + 1.3 * self.width_shift) + '" ' +
291
- 'y="' + ((p1.row-1)*self.height+self.height_shift/2) + '" ' +
292
- 'width="' + ((p2.col+1)-p1.col)*self.width + '" ' +
293
- 'height="' + ((p2.row+1)-p1.row)*self.height +'" ' +
294
- 'class="tile" rx="15" ry="15" xmlns="http://www.w3.org/2000/svg"/>'));
295
- } // }}}
296
- var draw_connection = this.draw.draw_connection = function(group, start, end, max_line, num_lines, arrow) { // {{{
297
- if(((end['row']-start['row']) == 0) && ((end['col']-start['col']) == 0)) return;
298
- var line;
299
- if (arrow)
300
- line = $X('<path xmlns="http://www.w3.org/2000/svg" class="ourline" marker-end="url(#arrow)"/>');
301
- else
302
- line = $X('<path xmlns="http://www.w3.org/2000/svg" class="ourline"/>');
303
- if (end['row']-start['row'] == 0 || end['col']-start['col'] == 0) { // straight line
304
- line.attr("d", "M " + String(start['col']*self.width) + "," + String(start['row']*self.height-15) +" "+
305
- String(end['col']*self.width) + "," + String(end['row']*self.height-15)
306
- );
307
- } else if (end['row']-start['row'] > 0) { // downwards
308
- if (end['col']-start['col'] > 0) {// left - right
309
- if (self.compact) {
310
- line.attr("d", "M " + String(start['col']*self.width) + "," + String(start['row']*self.height-15) +" "+
311
- String(start['col']*self.width+14) + "," + String((end['row']-1)*self.height) +" "+ // first turn of hotizontal-line going away from node
312
- String(end['col']*self.width) + "," + String((end['row']-1)*self.height) +" "+
313
- String(end['col']*self.width) + "," + String(end['row']*self.height-15)
314
- );
315
- } else {
316
- line.attr("d", "M " + String(start['col']*self.width) + "," + String(start['row']*self.height-15) +" "+
317
- String(end['col']*self.width) + "," + String(start['row']*self.height-15) +" "+
318
- String(end['col']*self.width) + "," + String(end['row']*self.height-15)
319
- );
320
- }
321
- } else { // right - left
322
- line.attr("d", "M " + String(start['col']*self.width) + "," + String(start['row']*self.height-15) +" "+
323
- String(start['col']*self.width) + "," + String(end['row']*self.height-35) +" "+
324
- String(end['col']*self.width+14) + "," + String(end['row']*self.height-35) +" "+ // last turn of horizontal-line going into the node
325
- String(end['col']*self.width) + "," + String(end['row']*self.height-15)
326
- );
327
- }
328
- } else if(end['row']-start['row'] < 0) { // upwards
329
- if(num_lines > 1) {// ??? no idea
330
- line.attr("d", "M " + String(start['col']*self.width) + "," + String(start['row']*self.height-15) +" "+
331
- String(start['col']*self.width) + "," + String((max_line-1)*self.height+5) +" "+
332
- String(end['col']*self.width+20) + "," + String((max_line-1)*self.height+5) +" "+
333
- String(end['col']*self.width+20) + "," + String(end['row']*self.height+25)+" "+
334
- String(end['col']*self.width) + "," + String(end['row']*self.height-15)
335
- );
336
- } else {
337
- line.attr("d", "M " + String(start['col']*self.width) + "," + String(start['row']*self.height-15) +" "+
338
- String(end['col']*self.width+15) + "," + String(start['row']*self.height-15) +" "+
339
- String(end['col']*self.width+15) + "," + String(end['row']*self.height+15)+" "+
340
- String(end['col']*self.width) + "," + String(end['row']*self.height-15)
341
- );
342
- }
343
- }
344
- self.svg.container.append(line);
345
- } // }}}
346
- // }}}
347
- // Initialize {{{
348
- adaptor = wf_adaptor;
349
- // }}}
350
- } // }}}
351
-
352
- // WfDescription:
353
- // Manages the description. Is is further able to add/remove elements from the controlflow description.
354
- function WfDescription(wf_adaptor, wf_illustrator) { // Model {{{
355
- // public variables
356
- this.elements = {}; // the rngs
357
- this.source = null;
358
- // private variables
359
- var self = this;
360
- var adaptor;
361
- var illustrator;
362
- var description;
363
- var id_counter = {};
364
- var update_illustrator = true;
365
- var labels = [];
366
-
367
- // Set Labels //{{{
368
- this.set_labels = function(graph) {
369
- if (illustrator.compact == false) {
370
- adaptor.draw_labels(graph.max,labels,illustrator.height_shift,illustrator.striped == true ? true : false);
371
- } else {
372
- adaptor.draw_labels(graph.max,[],illustrator.height_shift,false);
373
- }
374
- if (illustrator.striped == true && illustrator.compact == false) {
375
- for (var i=0; i < graph.max.row; i++) {
376
- illustrator.draw.draw_stripe(i,graph.max.col);
377
- }
378
- }
379
- if (illustrator.compact == false) {
380
- if (labels.length > 0) {
381
- _.each(labels,function(a,key) {
382
- if (a.label && a.label[0] && a.label[0].column == 'Label' && a.label[0].value) {
383
- illustrator.draw.draw_label(a.tname, a.element_id, a.label[0].value, a.row, graph.max.col + 1, graph.svg);
384
- }
385
- });
386
- }
387
- }
388
- } //}}}
389
-
390
- // Generic Functions {{{
391
- this.set_description = function(desc, auto_update) { // public {{{
392
- if(auto_update != undefined) update_illustrator = auto_update;
393
- if(typeof desc == "string") {
394
- description = $($.parseXML(desc));
395
- } else if(desc instanceof jQuery) {
396
- description = desc;
397
- } else {
398
- alert("WfDescription: unknown description type:\nConstructor-Name: " + desc.constructor + " / TypeOf: " + (typeof desc));
399
- description = null;
400
- }
401
- id_counter = {};
402
- labels = [];
403
- illustrator.clear();
404
- var graph = parse(description.children('description').get(0), {'row':0,'col':0,final:false,wide:false});
405
- self.set_labels(graph);
406
- // set labels
407
- illustrator.set_svg(graph);
408
- } // }}}
409
- var gd = this.get_description = function() { // public {{{
410
- var serxml = $(description.get(0).documentElement).clone(true);
411
- serxml.removeAttr('svg-id');
412
- serxml.removeAttr('svg-type');
413
- serxml.removeAttr('svg-subtype');
414
- serxml.removeAttr('svg-label');
415
- $('*[svg-id]',serxml).each(function(){
416
- $(this).removeAttr('svg-id');
417
- });
418
- $('*[svg-type]',serxml).each(function(){
419
- $(this).removeAttr('svg-type');
420
- });
421
- $('*[svg-subtype]',serxml).each(function(){
422
- $(this).removeAttr('svg-subtype');
423
- });
424
- $('*[svg-label]',serxml).each(function(){
425
- $(this).removeAttr('svg-label');
426
- });
427
- return serxml.serializeXML();
428
- } // }}}
429
- this.get_node_by_svg_id = function(svg_id) { // {{{
430
- return $('[svg-id = \'' + svg_id + '\']', description);
431
- } // }}}
432
- var context_eval = this.context_eval = function(what) { // {{{
433
- return eval(what);
434
- } // }}}
435
- var get_free_id = this.get_free_id = function(other) { // {{{
436
- var existing = new Array();
437
- if (other) {
438
- if ($(other).attr('id')) {
439
- existing.push($(other).attr('id'));
440
- }
441
- $(other).find("[id]").each(function(k,v){
442
- existing.push($(v).attr('id'));
443
- });
444
- }
445
- $('*[id]', description).each(function(){existing.push($(this).attr('id'))});
446
- var id = 1;
447
- while ($.inArray('a' + id,existing) != -1) {
448
- id += 1;
449
- }
450
- return 'a' + id;
451
- } // }}}
452
- var refresh = this.refresh = function(doit) {
453
- id_counter = {};
454
- labels = [];
455
- illustrator.clear();
456
- var graph = parse(description.children('description').get(0), {'row':0,'col':0});
457
- self.set_labels(graph);
458
- // set labels
459
- illustrator.set_svg(graph);
460
- doit(self);
461
- }
462
- var update = this.update = function(svgid) { // {{{
463
- id_counter = {};
464
- if(update_illustrator){
465
- labels = [];
466
- illustrator.clear();
467
- var graph = parse(description.children('description').get(0), {'row':0,'col':0});
468
- self.set_labels(graph);
469
- illustrator.set_svg(graph);
470
- }
471
-
472
- var newn = $('*[new=true]',description);
473
- newn.removeAttr('new');
474
-
475
- if (newn.attr('svg-id') != undefined)
476
- adaptor.notify(newn.attr('svg-id'));
477
- else if (svgid != undefined)
478
- adaptor.notify(svgid);
479
- else if (newn.parent('[svg-id]').length > 0)
480
- adaptor.notify(newn.parent('[svg-id]').attr('svg-id'));
481
- else
482
- console.info('Something went horribly wrong');
483
- } // }}}
484
- // }}}
485
- // Adaption functions {{{
486
- this.insert_after = function(new_node, target, source_opts) { // {{{
487
- if ($.isArray(new_node)) {
488
- $.each(new_node,function(k,v){
489
- var nn = self.source(v,source_opts);
490
- target.after(nn);
491
- nn.attr('new','true');
492
- });
493
- } else {
494
- var nn = self.source(new_node,source_opts);
495
- target.after(nn);
496
- nn.attr('new','true');
497
- }
498
- update();
499
- } // }}}
500
- this.insert_first_into = function(new_node, target, source_opts) { // {{{
501
- if ($.isArray(new_node)) {
502
- $.each(new_node,function(k,v){
503
- var nn = self.source(v,source_opts);
504
- target.prepend(nn);
505
- nn.attr('new','true');
506
- });
507
- } else {
508
- var nn = self.source(new_node,source_opts);
509
- target.prepend(nn);
510
- nn.attr('new','true');
511
- }
512
- update();
513
- } // }}}
514
- this.insert_last_into = function(new_node, target) { // {{{
515
- if ($.isArray(new_node)) {
516
- $.each(new_node,function(k,v){
517
- var nn = self.source(v);
518
- target.append(nn);
519
- nn.attr('new','true');
520
- });
521
- } else {
522
- var nn = self.source(new_node);
523
- target.append(nn);
524
- nn.attr('new','true');
525
- }
526
- update();
527
- } // }}}
528
- this.remove = function(selector, target) {//{{{
529
- var svgid;
530
- if(selector == undefined) {
531
- svgid = target.attr('svg-id');
532
- target.remove()
533
- } else {
534
- svgid = $(selector, target).attr('svg-id');
535
- if (!svgid) {
536
- svgid = target.attr('svg-id');
537
- }
538
- $(selector, target).remove();
539
- }
540
- update(svgid);
541
- }
542
- // }}}
543
- // }}}
544
- // Helper Functions {{{
545
- var parse = function(root, parent_pos) { // private {{{
546
- var pos = jQuery.extend(true, {}, parent_pos);
547
- var max = {'row': 0,'col': 0};
548
- var prev = [parent_pos]; // connects parent with child(s), depending on the expansion
549
- var endnodes = [];
550
- var sname = sym_name(root.tagName,root);
551
- var root_expansion = illustrator.elements[root.tagName].expansion(root);
552
- var block = {'max':{}}; // e.g. {'max':{'row':0,'col':0}, 'endpoints':[]};
553
-
554
- var group = $X('<g class="group" xmlns="http://www.w3.org/2000/svg"/>');
555
-
556
- if(root_expansion == 'horizontal') pos.row++;
557
- if(illustrator.elements[root.tagName].col_shift(root) == true && root_expansion != 'horizontal') pos.col++;
558
-
559
- if(root.tagName == 'description') { // First parsing {{{
560
- pos.row++;
561
- $(root).attr('svg-id','description');
562
- group.attr('element-id','group-description');
563
- if (illustrator.elements[sname].label) {
564
- labels.push({row: pos.row, element_id: 'start', tname: 'start', label: illustrator.elements[sname].label(root)});
565
- }
566
- illustrator.draw.draw_symbol('start', 'description', 'START', pos.row, pos.col, group);
567
- } // }}}
568
-
569
- $(root).children().filter(function(){ return this.localName[0] != '_'; }).each(function() {
570
- var context = this;
571
- var tname = context.tagName;
572
- var sname = sym_name(tname,context);
573
- pos.final = illustrator.elements[sname].final ? true : false;
574
- pos.wide = illustrator.elements[sname].wide ? true : false;
575
-
576
- // Calculate next position {{{
577
- if(root_expansion == 'vertical') pos.row++;
578
- if(root_expansion == 'horizontal') {
579
- pos.col++;
580
- if (!illustrator.compact) {
581
- if (block.max.row) {
582
- pos.row = block.max.row + 1;
583
- }
584
- }
585
- }
586
-
587
- if(illustrator.elements[tname] != undefined && illustrator.elements[tname].type == 'complex') {
588
- if(illustrator.elements[tname] != undefined && !illustrator.elements[tname].svg) pos.row--;
589
- // TODO: Remaining problem is the order inside the svg. Thats why the connection is above the icon
590
- block = parse(context, jQuery.extend(true, {}, pos));
591
- group.append(block.svg);
592
- block.svg.attr('id', 'group-' + $(context).attr('svg-id'));
593
- if(illustrator.elements[sname].endnodes == 'aggregate') endnodes = []; // resets endpoints e.g. potential preceding primitive
594
- } else {
595
- if(illustrator.elements[tname] != undefined && illustrator.elements[tname].type == 'primitive' && illustrator.elements[tname].svg) { // This enables "invisble" elements, by returning undefined in the SVG function (e.g. constraints)
596
- block.max.row = pos.row;
597
- block.max.col = pos.col;
598
- block.endnodes = [pos];
599
- block.svg = group;
600
- }
601
- }
602
- // }}}
603
-
604
- var g;
605
- set_details(tname,sname,pos,context);
606
-
607
- var origpos = jQuery.extend(true, {}, pos);
608
- [g, endnodes] = draw_position(tname,origpos,prev,block,group,endnodes,context);
609
-
610
- // Prepare next iteration {{{
611
- if(root_expansion == 'vertical') { prev = jQuery.extend(true, {}, endnodes); pos.row = block.max.row;} // covers e.g. input's for alternative, parallel_branch, ... everything with horizontal expansion
612
- if(root_expansion == 'horizontal') pos.col = block.max.col;
613
- if(max.row < block.max.row) max.row = block.max.row;
614
- if(max.col < block.max.col) max.col = block.max.col;
615
- // }}}
616
-
617
- if (illustrator.elements[sname].closing_symbol) {
618
- var ctname = illustrator.elements[sname].closing_symbol;
619
- var csname = sym_name(ctname,context);
620
- pos.row++;
621
- max.row++;
622
- block.max.row = pos.row;
623
- if (illustrator.elements[sname].endnodes == 'this') {
624
- pos.col++;
625
- if (pos.col > max.col) {
626
- max.col++;
627
- block.max.col = pos.col;
628
- }
629
- draw_position(ctname,pos,block.endnodes,block,group,[],context,{svg: g, pos: origpos});
630
- pos.col--;
631
- } else {
632
- [undefined, endnodes] = draw_position(ctname,pos,prev,block,group,[],context,{svg: g, pos: origpos});
633
- }
634
- set_details(ctname,csname,pos,context,true);
635
- prev = jQuery.extend(true, {}, endnodes);
636
- }
637
- });
638
-
639
- if($(root).children().filter(function(){ return this.attributes['svg-id'] != undefined; }).length == 0) { // empty complex found
640
- endnodes = [parent_pos];
641
- max.row = parent_pos.row;
642
- max.col = parent_pos.col;
643
- }
644
-
645
- if(root.tagName == 'description' && illustrator.elements[root.tagName].closing_symbol) {
646
- pos.row++;
647
- max.row = pos.row;
648
- draw_position(illustrator.elements['start'].closing_symbol,pos,prev,block,group,[],this,{svg: group, pos: pos});
649
- }
650
-
651
- return {'endnodes': endnodes, 'max':max, 'svg':group};
652
- } // }}}
653
- var sym_name = function(tname,context) { //{{{
654
- var sname;
655
- if(!illustrator.elements[tname]) {sname = 'unknown';}
656
- else if(typeof illustrator.elements[tname].resolve_symbol == 'function') {sname = illustrator.elements[tname].resolve_symbol(context,illustrator.elements[tname].col_shift ? illustrator.elements[tname].col_shift(context) : undefined);}
657
- else if(typeof illustrator.elements[tname].resolve_symbol == 'string') {sname = illustrator.elements[tname].resolve_symbol;}
658
- else {sname = tname;}
659
- return sname;
660
- } //}}}
661
- var set_details = function(tname,sname,pos,context,simple) { //{{{
662
- if (simple == undefined || simple == false) {
663
- if($(context).attr('id') == undefined) {
664
- if(id_counter[tname] == undefined) id_counter[tname] = -1;
665
- $(context).attr('svg-id', tname + '_' + (++id_counter[tname]));
666
- } else {
667
- $(context).attr('svg-id', $(context).attr('id'));
668
- }
669
- }
670
- if (illustrator.elements[sname].label) {
671
- var lab = illustrator.elements[sname].label(context);
672
- if (lab && lab[0] && lab[0].value && lab[0].column == 'Label' && lab[0].value != '') {
673
- $(context).attr('svg-label', lab[0].value);
674
- }
675
- labels.push({row: pos.row, element_id: $(context).attr('svg-id'), tname: tname, label: lab});
676
- }
677
- } //}}}
678
- var draw_position = function(tname,pos,prev,block,group,endnodes,context,second) { // private {{{
679
- var sname = sym_name(tname,context);
680
- // Draw Symbol {{{
681
- if (second) {
682
- illustrator.draw.draw_symbol(sname, $(context).attr('svg-id'), $(context).attr('svg-label'), pos.row, pos.col, second.svg, true).addClass(illustrator.elements[sname] ? illustrator.elements[sname].type : 'primitive unknown');
683
- } else {
684
- $(context).attr('svg-type',tname);
685
- $(context).attr('svg-subtype',sname);
686
- if((illustrator.elements[sname] && illustrator.elements[sname].svg) || sname == 'unknown') {
687
- var g = illustrator.draw.draw_symbol(sname, $(context).attr('svg-id'), $(context).attr('svg-label'), pos.row, pos.col, block.svg).addClass(illustrator.elements[sname] ? illustrator.elements[sname].type : 'primitive unknown');
688
- if (illustrator.elements[sname].info) {
689
- var info = illustrator.elements[sname].info(context);
690
- _.each(info,function(val,key) {
691
- g.attr(key, val);
692
- });
693
- }
694
- } else { console.log("no icon "+ sname);}
695
- if(illustrator.elements[sname] && illustrator.elements[sname].border) {
696
- var wide = (illustrator.elements[sname].wide == true && block.max.col == pos.col) ? pos.col + 1 : block.max.col;
697
- if (illustrator.elements[sname].closing_symbol) {
698
- illustrator.draw.draw_border($(context).attr('svg-id'), pos, { col: wide, row: block.max.row + 1 }, block.svg);
699
- } else {
700
- illustrator.draw.draw_border($(context).attr('svg-id'), pos, { col: wide, row: block.max.row }, block.svg);
701
- }
702
- }
703
- if(illustrator.elements[sname] && illustrator.elements[sname].type == 'complex') {
704
- var wide = (illustrator.elements[sname].wide == true && block.max.col == pos.col) ? pos.col + 1 : block.max.col;
705
- if (illustrator.elements[sname].closing_symbol) {
706
- illustrator.draw.draw_tile($(context).attr('svg-id'), pos, { col: wide, row: block.max.row + 1 }, block.svg);
707
- } else {
708
- illustrator.draw.draw_tile($(context).attr('svg-id'), pos, { col: wide, row: block.max.row }, block.svg);
709
- }
710
- }
711
- }
712
- // }}}
713
- // Calculate Connection {{{
714
- if(illustrator.elements[sname] != undefined && illustrator.elements[sname].closeblock == true) { // Close Block if element e.g. loop
715
- if (second) {
716
- if (second.pos.row+1 < pos.row) { // when no content, dont paint the up arrow
717
- illustrator.draw.draw_connection(group, pos, second.pos, block.max.row+1, 1, true);
718
- }
719
- } else {
720
- for(node in block.endnodes) {
721
- if (!block.endnodes[node].final) {
722
- illustrator.draw.draw_connection(group, block.endnodes[node], pos, block.max.row+1, block.endnodes.length, true);
723
- }
724
- }
725
- }
726
- }
727
- if(illustrator.elements[sname] != undefined && illustrator.elements[sname].endnodes != 'this') {
728
- for(i in block.endnodes) { endnodes.push(block.endnodes[i]); } // collects all endpoints from different childs e.g. alternatives from choose
729
- } else { endnodes = [jQuery.extend(true, {}, pos)]; } // sets this element as only endpoint (aggregate)
730
- if(prev[0].row == 0 || prev[0].col == 0) { // this enforces the connection from description to the first element
731
- illustrator.draw.draw_connection(group, { row: 1, col: 1 }, pos, null, null, true);
732
- } else {
733
- if (illustrator.elements[sname].noarrow == undefined || illustrator.elements[sname].noarrow == false) {
734
- for (node in prev) {
735
- if (!prev[node].final) {
736
- if (prev[node].wide) {
737
- var pn = jQuery.extend(true, {}, prev[node]);
738
- if (pos.col > prev[node].col) {
739
- pn.col = pos.col;
740
- }
741
- illustrator.draw.draw_connection(group, pn, pos, null, null, true);
742
- } else {
743
- illustrator.draw.draw_connection(group, prev[node], pos, null, null, true);
744
- }
745
- }
746
- }
747
- } else {
748
- for(node in prev) {
749
- if (!prev[node].final)
750
- illustrator.draw.draw_connection(group, prev[node], pos, null, null, false);
751
- }
752
- }
753
- }
754
- // }}}
755
- return [g, endnodes];
756
- } // }}}
757
- // }}}
758
-
759
- // Initialze {{{
760
- adaptor = wf_adaptor;
761
- illustrator = wf_illustrator;
762
- // }}}
763
- } // }}}