gfdnavi 1.3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (446) hide show
  1. data/ChangeLog +10949 -0
  2. data/LICENCE.txt +57 -0
  3. data/Makefile +18 -0
  4. data/TODO +132 -0
  5. data/app/controllers/analysis_controller.rb +700 -0
  6. data/app/controllers/application.rb +41 -0
  7. data/app/controllers/draw_method_controller.rb +172 -0
  8. data/app/controllers/explorer_controller.rb +197 -0
  9. data/app/controllers/finder_controller.rb +331 -0
  10. data/app/controllers/function_controller.rb +204 -0
  11. data/app/controllers/group_controller.rb +115 -0
  12. data/app/controllers/keyword_attributes_controller.rb +52 -0
  13. data/app/controllers/knowledge_controller.rb +928 -0
  14. data/app/controllers/nodes_controller.rb +515 -0
  15. data/app/controllers/search_controller.rb +341 -0
  16. data/app/controllers/user_controller.rb +337 -0
  17. data/app/helpers/analysis_helper.rb +2 -0
  18. data/app/helpers/application_helper.rb +105 -0
  19. data/app/helpers/description_helper.rb +2 -0
  20. data/app/helpers/function_helper.rb +2 -0
  21. data/app/helpers/group_helper.rb +2 -0
  22. data/app/helpers/search_helper.rb +3 -0
  23. data/app/helpers/user_helper.rb +2 -0
  24. data/app/helpers/work_flow_helper.rb +92 -0
  25. data/app/models/actual_file.rb +3 -0
  26. data/app/models/analysis.rb +715 -0
  27. data/app/models/analysis_history.rb +42 -0
  28. data/app/models/cross_array.rb +22 -0
  29. data/app/models/cross_result.rb +254 -0
  30. data/app/models/derived_spatial_attribute.rb +3 -0
  31. data/app/models/diagram_cache.rb +16 -0
  32. data/app/models/diagram_cache_datum.rb +4 -0
  33. data/app/models/diagram_cache_session.rb +8 -0
  34. data/app/models/directory.rb +21 -0
  35. data/app/models/draw_method.rb +48 -0
  36. data/app/models/draw_method_attribute.rb +8 -0
  37. data/app/models/draw_parameter.rb +12 -0
  38. data/app/models/explorer_query.rb +354 -0
  39. data/app/models/explorer_result.rb +312 -0
  40. data/app/models/function.rb +75 -0
  41. data/app/models/function_argument.rb +6 -0
  42. data/app/models/function_output.rb +4 -0
  43. data/app/models/group.rb +153 -0
  44. data/app/models/image.rb +20 -0
  45. data/app/models/keyword_attribute.rb +179 -0
  46. data/app/models/knowledge.rb +94 -0
  47. data/app/models/knowledge_backup.rb +32 -0
  48. data/app/models/knowledge_figure.rb +16 -0
  49. data/app/models/knowledge_figure_backup.rb +16 -0
  50. data/app/models/knowledge_parser.rb +392 -0
  51. data/app/models/node.rb +605 -0
  52. data/app/models/node_entity_abstract.rb +112 -0
  53. data/app/models/node_lineage.rb +6 -0
  54. data/app/models/node_relation.rb +4 -0
  55. data/app/models/path_node.rb +60 -0
  56. data/app/models/query.rb +193 -0
  57. data/app/models/query_history.rb +12 -0
  58. data/app/models/results.rb +48 -0
  59. data/app/models/sign_up_user.rb +25 -0
  60. data/app/models/spatial_and_time_attribute.rb +11 -0
  61. data/app/models/user.rb +115 -0
  62. data/app/models/user_mailer.rb +48 -0
  63. data/app/models/value_type.rb +3 -0
  64. data/app/models/variable.rb +70 -0
  65. data/app/models/virtual_node.rb +457 -0
  66. data/app/views/analysis/__help_analysis_tab.en.html +57 -0
  67. data/app/views/analysis/__help_draw_share.en.html +12 -0
  68. data/app/views/analysis/__help_draw_tab.en.html +6 -0
  69. data/app/views/analysis/_analysis_function_settings.rhtml +61 -0
  70. data/app/views/analysis/_analysis_settings.rhtml +28 -0
  71. data/app/views/analysis/_diagram.rhtml +70 -0
  72. data/app/views/analysis/_dimension_option.rhtml +59 -0
  73. data/app/views/analysis/_draw_general_settings.rhtml +217 -0
  74. data/app/views/analysis/_draw_settings.rhtml +73 -0
  75. data/app/views/analysis/_history.rhtml +19 -0
  76. data/app/views/analysis/_popular_diagrams.rhtml +42 -0
  77. data/app/views/analysis/_save_form.rhtml +44 -0
  78. data/app/views/analysis/_variables.rhtml +66 -0
  79. data/app/views/analysis/_variables_order.rhtml +56 -0
  80. data/app/views/analysis/index.rhtml +195 -0
  81. data/app/views/analysis/preview.rhtml +3 -0
  82. data/app/views/analysis/save.rhtml +73 -0
  83. data/app/views/analysis/show_diagram.rhtml +42 -0
  84. data/app/views/cross/_display_map.rhtml +201 -0
  85. data/app/views/cross/_result.rhtml +205 -0
  86. data/app/views/cross/_show_result_tree.rhtml +40 -0
  87. data/app/views/cross/_show_results.rhtml +80 -0
  88. data/app/views/cross/_style.rhtml +21 -0
  89. data/app/views/cross/index.rhtml +271 -0
  90. data/app/views/draw_method/_edit_form.rhtml +110 -0
  91. data/app/views/draw_method/create.rhtml +8 -0
  92. data/app/views/draw_method/details.rhtml +113 -0
  93. data/app/views/draw_method/edit.rhtml +8 -0
  94. data/app/views/draw_method/list.rhtml +80 -0
  95. data/app/views/explorer/_display_map.rhtml +199 -0
  96. data/app/views/explorer/_show_result_tree.rhtml +40 -0
  97. data/app/views/explorer/_show_results.rhtml +101 -0
  98. data/app/views/explorer/_style.rhtml +21 -0
  99. data/app/views/explorer/index.rhtml +214 -0
  100. data/app/views/finder/_children.html.erb +84 -0
  101. data/app/views/finder/_children_details.html.erb +74 -0
  102. data/app/views/finder/_children_details_tr.html.erb +196 -0
  103. data/app/views/finder/create_tree.html.erb +15 -0
  104. data/app/views/finder/flex.html.erb +52 -0
  105. data/app/views/finder/index.html.erb +47 -0
  106. data/app/views/finder/show_details.html.erb +3 -0
  107. data/app/views/finder/show_images.html.erb +3 -0
  108. data/app/views/function/_edit_form.rhtml +106 -0
  109. data/app/views/function/create.rhtml +8 -0
  110. data/app/views/function/details.rhtml +96 -0
  111. data/app/views/function/edit.rhtml +8 -0
  112. data/app/views/function/list.rhtml +80 -0
  113. data/app/views/group/add_member.rhtml +13 -0
  114. data/app/views/group/change_owner.rhtml +15 -0
  115. data/app/views/group/create.rhtml +11 -0
  116. data/app/views/group/delete_member.rhtml +14 -0
  117. data/app/views/group/list.rhtml +63 -0
  118. data/app/views/knowledge/_backup.rhtml +135 -0
  119. data/app/views/knowledge/_category.rhtml +58 -0
  120. data/app/views/knowledge/_category_list.rhtml +34 -0
  121. data/app/views/knowledge/_category_table.rhtml +23 -0
  122. data/app/views/knowledge/_comment.rhtml +64 -0
  123. data/app/views/knowledge/_comment_input_form.rhtml +19 -0
  124. data/app/views/knowledge/_comments.rhtml +84 -0
  125. data/app/views/knowledge/_form.rhtml +139 -0
  126. data/app/views/knowledge/_group_figure_form.rhtml +187 -0
  127. data/app/views/knowledge/_layout_figure.rhtml +61 -0
  128. data/app/views/knowledge/_layout_figures_in_a_row_above_text.rhtml +42 -0
  129. data/app/views/knowledge/_layout_figures_under_text.rhtml +45 -0
  130. data/app/views/knowledge/_layout_one_figure_above_text.rhtml +28 -0
  131. data/app/views/knowledge/_summary.rhtml +21 -0
  132. data/app/views/knowledge/edit.rhtml +37 -0
  133. data/app/views/knowledge/list.rhtml +287 -0
  134. data/app/views/knowledge/new.rhtml +23 -0
  135. data/app/views/knowledge/new_from_analysis.rhtml +21 -0
  136. data/app/views/knowledge/show.rhtml +196 -0
  137. data/app/views/layouts/gfdnavi.rhtml +105 -0
  138. data/app/views/nodes/_ancestors.html.erb +89 -0
  139. data/app/views/nodes/_description_methods_table.html.erb +75 -0
  140. data/app/views/nodes/_mode.html.erb +16 -0
  141. data/app/views/nodes/description.html.erb +181 -0
  142. data/app/views/nodes/description_methods.html.erb +1 -0
  143. data/app/views/nodes/edit.html.erb +73 -0
  144. data/app/views/nodes/index.html.erb +25 -0
  145. data/app/views/nodes/show.html.erb +20 -0
  146. data/app/views/search/_children_details_mapsearch.rhtml +68 -0
  147. data/app/views/search/_children_details_tr.rhtml +205 -0
  148. data/app/views/search/_show_grouplist.rhtml +74 -0
  149. data/app/views/search/_show_results.rhtml +43 -0
  150. data/app/views/search/_show_results_global.rhtml +36 -0
  151. data/app/views/search/_show_results_partial.rhtml +39 -0
  152. data/app/views/search/_show_results_partial_groupbyfile.rhtml +50 -0
  153. data/app/views/search/_show_variablelist.rhtml +28 -0
  154. data/app/views/search/mapsearch.rhtml +176 -0
  155. data/app/views/search/remapsearch.rjs +18 -0
  156. data/app/views/search/show_details.rhtml +3 -0
  157. data/app/views/user/add_user.rhtml +30 -0
  158. data/app/views/user/change_password.rhtml +25 -0
  159. data/app/views/user/edit.html.erb +50 -0
  160. data/app/views/user/index.rhtml +162 -0
  161. data/app/views/user/login.rhtml +41 -0
  162. data/app/views/user/logout.rhtml +4 -0
  163. data/app/views/user/signup.rhtml +36 -0
  164. data/app/views/user/signup_succeeded.rhtml +36 -0
  165. data/app/views/user_mailer/authorization_inform.rhtml +15 -0
  166. data/app/views/user_mailer/signup_accepted.rhtml +12 -0
  167. data/app/views/user_mailer/signup_confirm.rhtml +14 -0
  168. data/app/views/user_mailer/signup_inform.rhtml +13 -0
  169. data/app/views/user_mailer/signup_rejected.rhtml +11 -0
  170. data/app/views/work_flow/_push_wsdls.rhtml +55 -0
  171. data/app/views/work_flow/index.rhtml +46 -0
  172. data/config/database.yml.example +35 -0
  173. data/config/environment.rb +68 -0
  174. data/config/gfdnavi.yml.example +95 -0
  175. data/config/load_config.rb +151 -0
  176. data/config/routes.rb +35 -0
  177. data/consistency_checker.rb +129 -0
  178. data/data/gfdnavi_docs/how_to_draw_multiple_images.knlge +68 -0
  179. data/data/gfdnavi_docs/how_to_knowledge.knlge +138 -0
  180. data/data/gfdnavi_docs/how_to_write_document_about_Gfdnavi.knlge +30 -0
  181. data/data/samples/jmadata.SIGEN +8 -0
  182. data/data/samples/jmadata.yml +6 -0
  183. data/data/samples/jmadata/MSM-P/2006.nc.yml +2 -0
  184. data/data/samples/jmadata/MSM-P/2006.yml +17 -0
  185. data/data/samples/jmadata/MSM-P/2006/0101.nc +0 -0
  186. data/data/samples/jmadata/MSM-P/2006/0101.nc.yml +13 -0
  187. data/data/samples/jmadata/MSM-P/2006/0102.nc +0 -0
  188. data/data/samples/jmadata/MSM-P/2006/0103.nc +0 -0
  189. data/data/samples/jmadata/MSM-P/2006/0104.nc +0 -0
  190. data/data/samples/jmadata/MSM-P/2006/0105.nc +0 -0
  191. data/data/samples/jmadata/MSM-P/2006/010[1-3].nc.yml +2 -0
  192. data/data/samples/jmadata/MSM-P/2006/skip_data.rb +96 -0
  193. data/data/samples/jmadata/MSM-P/2006/skip_data.sh +6 -0
  194. data/data/samples/reanalysis.SIGEN +8 -0
  195. data/data/samples/reanalysis/era40.SIGEN +8 -0
  196. data/data/samples/reanalysis/era40.yml +2 -0
  197. data/data/samples/reanalysis/era40/t.jan.nc +0 -0
  198. data/data/samples/reanalysis/era40/t.jan.nc.yml +1 -0
  199. data/data/samples/reanalysis/ncep.SIGEN +9 -0
  200. data/data/samples/reanalysis/ncep/T.jan.100hPa.png +0 -0
  201. data/data/samples/reanalysis/ncep/T.jan.100hPa.png.yml +43 -0
  202. data/data/samples/reanalysis/ncep/T.jan.nc +0 -0
  203. data/data/samples/reanalysis/ncep/T.jan.zonal_mean.nc +0 -0
  204. data/data/samples/reanalysis/ncep/T.jan.zonal_mean.nc.yml +8 -0
  205. data/data/samples/reanalysis/ncep/T.jan_only_root.nc +0 -0
  206. data/data/samples/reanalysis/ncep/T.jan_only_root.nc.yml +4 -0
  207. data/data/samples/reanalysis/ncep/UV.jan.nc +0 -0
  208. data/data/samples/reanalysis/ncep/UV.jan.nc.yml +10 -0
  209. data/data/samples/reanalysis/ncep/UV.jan.nc.yml.ja +11 -0
  210. data/data/samples/sonde_operational.yml +5 -0
  211. data/data/samples/sonde_operational/std_plev.yml +12 -0
  212. data/data/samples/sonde_operational/std_plev/41256.spl.nc +0 -0
  213. data/data/samples/sonde_operational/std_plev/42410.spl.nc +0 -0
  214. data/data/samples/sonde_operational/std_plev/43333.spl.nc +0 -0
  215. data/data/samples/sonde_operational/std_plev/43346.spl.nc +0 -0
  216. data/data/samples/sonde_operational/std_plev/48698.spl.nc +0 -0
  217. data/data/samples/sonde_operational/std_plev/61641.spl.nc +0 -0
  218. data/data/samples/sonde_operational/std_plev/63741.spl.nc +0 -0
  219. data/data/samples/sonde_operational/std_plev/67083.spl.nc +0 -0
  220. data/data/samples/sonde_operational/std_plev/72261.spl.nc +0 -0
  221. data/data/samples/sonde_operational/std_plev/76805.spl.nc +0 -0
  222. data/data/samples/sonde_operational/std_plev/82193.spl.nc +0 -0
  223. data/data/samples/sonde_operational/std_plev/91165.spl.nc +0 -0
  224. data/data/samples/sonde_operational/std_plev/91610.spl.nc +0 -0
  225. data/data/samples/sonde_operational/std_plev/91948.spl.nc +0 -0
  226. data/data/samples/sonde_operational/std_plev/94294.spl.nc +0 -0
  227. data/db/NetCDFparser.rb +406 -0
  228. data/db/create_derived_spatial_attributes.sql +12 -0
  229. data/db/draw_methods/line.yml +6 -0
  230. data/db/draw_methods/scatter.yml +38 -0
  231. data/db/draw_methods/tone.yml +64 -0
  232. data/db/draw_methods/vector.yml +19 -0
  233. data/db/dump_db.rb +43 -0
  234. data/db/functions/additions.yml +10 -0
  235. data/db/functions/cut.yml +10 -0
  236. data/db/functions/division.yml +10 -0
  237. data/db/functions/mean.yml +28 -0
  238. data/db/functions/multiplication.yml +10 -0
  239. data/db/functions/stddev.yml +28 -0
  240. data/db/functions/subtraction.yml +10 -0
  241. data/db/migrate/001_initial_scheme.rb +289 -0
  242. data/db/migrate/002_add_open_id_authentication_tables.rb +20 -0
  243. data/db/register_directory_tree.rb +760 -0
  244. data/db/restore_db.rb +60 -0
  245. data/gfdnavi-install +828 -0
  246. data/install.rb +828 -0
  247. data/lib/activerecord_gfdnavi.rb +31 -0
  248. data/lib/basic_authorization.rb +50 -0
  249. data/lib/create_activeresources.rb +108 -0
  250. data/lib/execute_analysis.rb +472 -0
  251. data/lib/file_gfdnavi.rb +38 -0
  252. data/lib/gphys_gfdnavi.rb +81 -0
  253. data/lib/localdir.rb +110 -0
  254. data/lib/login_system.rb +110 -0
  255. data/lib/multibytes.rb +20 -0
  256. data/lib/narray_yaml.rb +58 -0
  257. data/lib/no_rdb_base.rb +40 -0
  258. data/lib/opendapdir.rb +171 -0
  259. data/lib/tar.rb +127 -0
  260. data/lib/tasks/clean.rake +65 -0
  261. data/lib/tasks/setup.rake +316 -0
  262. data/lib/tasks/update.rake +62 -0
  263. data/lib/vizshot_gfdnavi.rb +224 -0
  264. data/public/crossdomain.xml +4 -0
  265. data/public/flex/NodeTreeDescriptor.as +55 -0
  266. data/public/flex/TreeNode.as +253 -0
  267. data/public/flex/finder.mxml +304 -0
  268. data/public/flex/finder.swf +0 -0
  269. data/public/flex/gfdnavi.mxml +52 -0
  270. data/public/flex/gfdnavi.swf +0 -0
  271. data/public/images/Help_S-shots/dir_tree_with_add.jpg +0 -0
  272. data/public/images/analyze.gif +0 -0
  273. data/public/images/circle.gif +0 -0
  274. data/public/images/create_from_analysis_button.png +0 -0
  275. data/public/images/delete.png +0 -0
  276. data/public/images/down.png +0 -0
  277. data/public/images/drawbutton.gif +0 -0
  278. data/public/images/gfdnavi_home_logo.png +0 -0
  279. data/public/images/gfdnavi_logo_big.png +0 -0
  280. data/public/images/gfdnavi_logo_med.png +0 -0
  281. data/public/images/gfdnavi_logo_mini.png +0 -0
  282. data/public/images/gfdnavi_logo_nobg_big.png +0 -0
  283. data/public/images/gfdnavi_logo_nobg_med.png +0 -0
  284. data/public/images/gfdnavi_logo_nobg_small.png +0 -0
  285. data/public/images/gfdnavi_logo_small.png +0 -0
  286. data/public/images/gfdnavi_logo_xsmall.png +0 -0
  287. data/public/images/hbar.png +0 -0
  288. data/public/images/helpmark16.png +0 -0
  289. data/public/images/helpmark18.png +0 -0
  290. data/public/images/kikyu_g.gif +0 -0
  291. data/public/images/kikyu_r.gif +0 -0
  292. data/public/images/map_icon_g.gif +0 -0
  293. data/public/images/map_icon_r.gif +0 -0
  294. data/public/images/new_knowledge.png +0 -0
  295. data/public/images/openid.png +0 -0
  296. data/public/images/read_in_the_form.png +0 -0
  297. data/public/images/slider_f.gif +0 -0
  298. data/public/images/slider_f_red.gif +0 -0
  299. data/public/images/star1.gif +0 -0
  300. data/public/images/star2.gif +0 -0
  301. data/public/images/startanim.gif +0 -0
  302. data/public/images/stopanim.gif +0 -0
  303. data/public/images/tree/DL.png +0 -0
  304. data/public/images/tree/anal_viz.png +0 -0
  305. data/public/images/tree/analyze_visualize_checked_items.png +0 -0
  306. data/public/images/tree/binary.png +0 -0
  307. data/public/images/tree/details.png +0 -0
  308. data/public/images/tree/download_checked_items.png +0 -0
  309. data/public/images/tree/folder.png +0 -0
  310. data/public/images/tree/folder_close.gif +0 -0
  311. data/public/images/tree/image2.png +0 -0
  312. data/public/images/tree/knowledge.png +0 -0
  313. data/public/images/tree/knowledges.png +0 -0
  314. data/public/images/tree/last.gif +0 -0
  315. data/public/images/tree/last.png +0 -0
  316. data/public/images/tree/minus.gif +0 -0
  317. data/public/images/tree/minus_simple.gif +0 -0
  318. data/public/images/tree/none.gif +0 -0
  319. data/public/images/tree/none.png +0 -0
  320. data/public/images/tree/plus.gif +0 -0
  321. data/public/images/tree/plus_simple.gif +0 -0
  322. data/public/images/tree/show.png +0 -0
  323. data/public/images/tree/show_checked_items.png +0 -0
  324. data/public/images/tree/t.gif +0 -0
  325. data/public/images/tree/t.png +0 -0
  326. data/public/images/tree/tate.gif +0 -0
  327. data/public/images/tree/tate.png +0 -0
  328. data/public/images/up.png +0 -0
  329. data/public/images/vbar.png +0 -0
  330. data/public/images/white.bmp +0 -0
  331. data/public/images/x.gif +0 -0
  332. data/public/index.html +100 -0
  333. data/public/javascripts/AC_OETags.js +269 -0
  334. data/public/javascripts/analysis.js +751 -0
  335. data/public/javascripts/application.js +29 -0
  336. data/public/javascripts/directory_tree.js +102 -0
  337. data/public/javascripts/draw_method.js +83 -0
  338. data/public/javascripts/excanvas.js +704 -0
  339. data/public/javascripts/function.js +107 -0
  340. data/public/javascripts/gfdnavi.js +175 -0
  341. data/public/javascripts/knowledge.js +384 -0
  342. data/public/javascripts/mapsearch.js +313 -0
  343. data/public/javascripts/progress.js +42 -0
  344. data/public/javascripts/resizable_box.js +164 -0
  345. data/public/javascripts/slider.js +260 -0
  346. data/public/javascripts/tab.js +17 -0
  347. data/public/javascripts/work_flow.js +452 -0
  348. data/public/stylesheets/analysis.css +111 -0
  349. data/public/stylesheets/description.css +71 -0
  350. data/public/stylesheets/gfdnavi.css +141 -0
  351. data/public/stylesheets/knowledge.css +218 -0
  352. data/public/stylesheets/search.css +184 -0
  353. data/public/stylesheets/tree.css +45 -0
  354. data/public/stylesheets/tree_for_ie.css +3 -0
  355. data/public/stylesheets/work_flow.css +78 -0
  356. data/script/cleaner +11 -0
  357. data/script/server_ssl +131 -0
  358. data/test/fixtures/diagram_cache_data.yml +5 -0
  359. data/test/fixtures/diagram_cache_sessions.yml +6 -0
  360. data/test/fixtures/diagram_caches.yml +6 -0
  361. data/test/fixtures/directories.yml +57 -0
  362. data/test/fixtures/draw_parameters.yml +6 -0
  363. data/test/fixtures/function_arguments.yml +15 -0
  364. data/test/fixtures/function_outputs.yml +15 -0
  365. data/test/fixtures/functions.yml +29 -0
  366. data/test/fixtures/group_members.yml +33 -0
  367. data/test/fixtures/groups.yml +25 -0
  368. data/test/fixtures/images.yml +12 -0
  369. data/test/fixtures/keyword_attributes.yml +73 -0
  370. data/test/fixtures/knowledges.yml +10 -0
  371. data/test/fixtures/node_relations.yml +11 -0
  372. data/test/fixtures/nodes.yml +298 -0
  373. data/test/fixtures/sign_up_users.yml +8 -0
  374. data/test/fixtures/spatial_and_time_attributes.yml +29 -0
  375. data/test/fixtures/user_mailer/authorization_inform +11 -0
  376. data/test/fixtures/user_mailer/signup_accepted +10 -0
  377. data/test/fixtures/user_mailer/signup_confirm +17 -0
  378. data/test/fixtures/user_mailer/signup_inform +10 -0
  379. data/test/fixtures/user_mailer/signup_rejected +9 -0
  380. data/test/fixtures/users.yml +31 -0
  381. data/test/fixtures/value_types.yml +10 -0
  382. data/test/fixtures/variables.yml +17 -0
  383. data/test/functional/analysis_controller_test.rb +169 -0
  384. data/test/functional/description_controller_test.rb +18 -0
  385. data/test/functional/function_controller_test.rb +18 -0
  386. data/test/functional/group_controller_test.rb +18 -0
  387. data/test/functional/search_controller_test.rb +83 -0
  388. data/test/functional/user_controller_test.rb +77 -0
  389. data/test/functional/webservice_analysis_api_test.rb +12 -0
  390. data/test/functional/work_flow_controller_test.rb +18 -0
  391. data/test/test_helper.rb +28 -0
  392. data/test/unit/diagram_cache_datum_test.rb +10 -0
  393. data/test/unit/diagram_cache_session_test.rb +10 -0
  394. data/test/unit/diagram_cache_test.rb +10 -0
  395. data/test/unit/directory_test.rb +49 -0
  396. data/test/unit/draw_parameter_test.rb +10 -0
  397. data/test/unit/function_argument_test.rb +10 -0
  398. data/test/unit/function_output_test.rb +10 -0
  399. data/test/unit/function_test.rb +10 -0
  400. data/test/unit/group_test.rb +48 -0
  401. data/test/unit/image_test.rb +13 -0
  402. data/test/unit/keyword_attribute_test.rb +33 -0
  403. data/test/unit/knowledge_test.rb +13 -0
  404. data/test/unit/node_relation_test.rb +20 -0
  405. data/test/unit/node_test.rb +85 -0
  406. data/test/unit/sign_up_user_test.rb +20 -0
  407. data/test/unit/spatial_and_time_attribute_test.rb +29 -0
  408. data/test/unit/user_mailer_test.rb +101 -0
  409. data/test/unit/user_test.rb +134 -0
  410. data/test/unit/value_type_test.rb +10 -0
  411. data/test/unit/variable_test.rb +35 -0
  412. data/vendor/plugins/acts_as_list/README +23 -0
  413. data/vendor/plugins/acts_as_list/init.rb +3 -0
  414. data/vendor/plugins/acts_as_list/lib/active_record/acts/list.rb +256 -0
  415. data/vendor/plugins/acts_as_list/test/list_test.rb +332 -0
  416. data/vendor/plugins/acts_as_tree/README +26 -0
  417. data/vendor/plugins/acts_as_tree/Rakefile +22 -0
  418. data/vendor/plugins/acts_as_tree/init.rb +1 -0
  419. data/vendor/plugins/acts_as_tree/lib/active_record/acts/tree.rb +96 -0
  420. data/vendor/plugins/acts_as_tree/test/abstract_unit.rb +0 -0
  421. data/vendor/plugins/acts_as_tree/test/acts_as_tree_test.rb +219 -0
  422. data/vendor/plugins/acts_as_tree/test/database.yml +0 -0
  423. data/vendor/plugins/acts_as_tree/test/fixtures/mixin.rb +0 -0
  424. data/vendor/plugins/acts_as_tree/test/fixtures/mixins.yml +0 -0
  425. data/vendor/plugins/acts_as_tree/test/schema.rb +0 -0
  426. data/vendor/plugins/will_paginate/CHANGELOG +92 -0
  427. data/vendor/plugins/will_paginate/LICENSE +18 -0
  428. data/vendor/plugins/will_paginate/README.rdoc +131 -0
  429. data/vendor/plugins/will_paginate/Rakefile +62 -0
  430. data/vendor/plugins/will_paginate/examples/apple-circle.gif +0 -0
  431. data/vendor/plugins/will_paginate/examples/index.haml +69 -0
  432. data/vendor/plugins/will_paginate/examples/index.html +92 -0
  433. data/vendor/plugins/will_paginate/examples/pagination.css +90 -0
  434. data/vendor/plugins/will_paginate/examples/pagination.sass +91 -0
  435. data/vendor/plugins/will_paginate/init.rb +1 -0
  436. data/vendor/plugins/will_paginate/lib/will_paginate.rb +86 -0
  437. data/vendor/plugins/will_paginate/lib/will_paginate/array.rb +16 -0
  438. data/vendor/plugins/will_paginate/lib/will_paginate/collection.rb +145 -0
  439. data/vendor/plugins/will_paginate/lib/will_paginate/core_ext.rb +32 -0
  440. data/vendor/plugins/will_paginate/lib/will_paginate/finder.rb +247 -0
  441. data/vendor/plugins/will_paginate/lib/will_paginate/named_scope.rb +132 -0
  442. data/vendor/plugins/will_paginate/lib/will_paginate/named_scope_patch.rb +39 -0
  443. data/vendor/plugins/will_paginate/lib/will_paginate/version.rb +9 -0
  444. data/vendor/plugins/will_paginate/lib/will_paginate/view_helpers.rb +373 -0
  445. data/vendor/plugins/will_paginate/will_paginate.gemspec +21 -0
  446. metadata +586 -0
@@ -0,0 +1,260 @@
1
+ dial_image = gfdnaviUrlRoot + "/images/slider_f.gif";
2
+ dial_red_image = gfdnaviUrlRoot + "/images/slider_f_red.gif";
3
+
4
+ var Dial = Class.create();
5
+ Object.extend(Dial.prototype, Draggable.prototype);
6
+ Object.extend(Dial.prototype, {
7
+ updateDrag: function(event, pointer) {
8
+ var offset = this.offset[0];
9
+ offset += Position.cumulativeOffset(this.element)[0];
10
+ offset -= this.currentDelta()[0];
11
+ offset -= this.relative_offset;
12
+ var pos = pointer[0] - offset;
13
+ var index = this.slider.posToIndex(pos, this.min, this.max);
14
+ var ary = this.slider.indexToValAndPos(index);
15
+ if (this.text)
16
+ this.text.value = ary[0];
17
+ this.index = index;
18
+ pos = ary[1];
19
+ pointer[0] = pos + offset;
20
+ if(this.set_bound)
21
+ this.set_bound(index);
22
+ if(this.come_up)
23
+ this.come_up();
24
+ Draggable.prototype.updateDrag.apply(this, arguments);
25
+ },
26
+ endDrag: function(event, pointer) {
27
+ if (this.handler) this.handler();
28
+ Draggable.prototype.endDrag.apply(this, arguments);
29
+ }
30
+ });
31
+
32
+ var Slider = Class.create();
33
+ Slider.prototype = {
34
+ initialize: function(name, width, text_size, ary, make_right, left_default, right_default) {
35
+
36
+ element = $(name);
37
+
38
+ var left_obj = new Object();
39
+ this.left_obj = left_obj;
40
+
41
+ left_obj.text_id = name+"_left_text";
42
+ left_obj.dial_id = name+"_left_dial";
43
+ if(make_right) {
44
+ var right_obj = new Object();
45
+ this.right_obj = right_obj;
46
+ right_obj.text_id = name+"_right_text";
47
+ right_obj.dial_id = name+"_right_dial";
48
+ }
49
+ var free_obj = new Object();
50
+ this.free_obj = free_obj;
51
+ free_obj.dial_id = name+"_free_dial";
52
+
53
+ back_id = name+"_back";
54
+ td_id = name+"_td";
55
+ this.back_id = back_id;
56
+
57
+ var text_var;
58
+
59
+ var html = '<table><tr>';
60
+ if(left_default != null)
61
+ text_var = left_default;
62
+ else
63
+ text_var = ary.first();
64
+ html += '<td><input type="text" name="' + name + '[min]" id="' + left_obj.text_id + '" size="' + text_size + '" value="' + text_var +'"/></td>';
65
+ html += '<td id="' + td_id + '">';
66
+ html += '<div id="' + back_id + '" style="width:' + width +';height:' + 0 + ';"><hr style="position:relative;top:1ex"/></div>';
67
+ html += '<span id="' + left_obj.dial_id + '" style="position:relative;"></span>';
68
+ if(make_right)
69
+ html += '<span id="' + right_obj.dial_id + '" style="position:relative;"></span>';
70
+ html += '<span id="' + free_obj.dial_id + '" style="position:relative;display:none;"></span>';
71
+ html += '</td>'
72
+ if(make_right) {
73
+ if(right_default != null)
74
+ text_var = right_default;
75
+ else
76
+ text_var = ary.last();
77
+ html += '<td><input type="text" name="' + name + '[max]" id="' + right_obj.text_id + '" size="' + text_size + '" value="' + text_var + '" /><td>'
78
+ }
79
+ html += '</tr></table>';
80
+ element.update(html);
81
+
82
+ var imgl = new Image();
83
+ imgl.src = dial_image;
84
+ imgl.alt = name+"_min";
85
+ left_obj.dial_dom = $(left_obj.dial_id);
86
+ left_obj.dial_dom.appendChild(imgl);
87
+ left_obj.dial_img = imgl;
88
+ if(make_right) {
89
+ var imgr = new Image();
90
+ imgr.src = dial_image;
91
+ imgr.alt = name+"_max";
92
+ right_obj.dial_dom = $(right_obj.dial_id);
93
+ right_obj.dial_dom.appendChild(imgr);
94
+ right_obj.dial_img = imgr;
95
+ }
96
+ var imgf = new Image();
97
+ imgf.src = dial_red_image;
98
+ imgf.alt = name+"_free";
99
+ free_obj.dial_dom = $(free_obj.dial_id);
100
+ free_obj.dial_dom.appendChild(imgf);
101
+ free_obj.dial_img = imgf;
102
+ free_obj.dial_dom.style.zIndex = 3;
103
+
104
+
105
+ left_obj.text_dom = $(left_obj.text_id);
106
+ Event.observe(left_obj.text_dom, 'change', this.moveLeftDial.bind(this));
107
+ if(make_right) {
108
+ right_obj.text_dom = $(right_obj.text_id);
109
+ Event.observe(right_obj.text_dom, 'change', this.moveRightDial.bind(this));
110
+ }
111
+
112
+ var left_bound = 0;
113
+ this.left_bound = left_bound;
114
+ //var img_width = imgl.width;
115
+ var img_width = 11;
116
+ this.right_bound = left_bound + width - img_width;
117
+
118
+ this.ary = ary;
119
+
120
+ var options = {
121
+ constraint: 'horizontal',
122
+ starteffect: null,
123
+ endeffect: null
124
+ };
125
+ left_dial = new Dial(left_obj.dial_dom, options);
126
+ left_dial.min = 0;
127
+ left_dial.max = ary.length-1;
128
+ left_dial.text = left_obj.text_dom;
129
+ left_dial.slider = this;
130
+ left_dial.relative_offset = 0;
131
+ left_dial.index = 0;
132
+ left_dial.handler = function() { if (this.slider.leftHandler) this.slider.leftHandler() };
133
+ left_obj.dial = left_dial
134
+
135
+ if(make_right) {
136
+ right_dial = new Dial(right_obj.dial_dom, options);
137
+ right_dial.min = 0;
138
+ right_dial.max = ary.length-1;
139
+ right_dial.text = right_obj.text_dom;
140
+ right_dial.slider = this;
141
+ right_dial.relative_offset = img_width;
142
+ right_dial.index = right_dial.max;
143
+ right_dial.handler = function() { if (this.slider.rightHandler) this.slider.rightHandler() };
144
+ right_obj.dial = right_dial
145
+
146
+ left_obj.dial.set_bound = function(index) {
147
+ this.slider.right_obj.dial.min = index;
148
+ };
149
+ left_obj.dial.come_up = function() {
150
+ this.slider.left_obj.dial_dom.style.zIndex = 2;
151
+ this.slider.right_obj.dial_dom.style.zIndex = 1;
152
+ }
153
+
154
+ right_obj.dial.set_bound = function(index) {
155
+ this.slider.left_obj.dial.max = index;
156
+ }
157
+ right_obj.dial.come_up = function() {
158
+ this.slider.right_obj.dial_dom.style.zIndex = 2;
159
+ this.slider.left_obj.dial_dom.style.zIndex = 1;
160
+ }
161
+ }
162
+ free_dial = new Dial(free_obj.dial_dom, options);
163
+ free_dial.min = 0;
164
+ free_dial.max = ary.length-1;
165
+ free_dial.slider = this;
166
+ free_dial.relative_offset = img_width*2;
167
+ free_dial.index = 0;
168
+ free_obj.dial = free_dial;
169
+
170
+
171
+ this.moveLeftDial();
172
+ if(this.right_obj)
173
+ this.moveRightDial();
174
+ this.moveFreeDial();
175
+ },
176
+
177
+ enableRight: function() {
178
+ this.right_obj.text_dom.disabled = false;
179
+ Element.setOpacity(this.right_obj.dial_img, 1.0);
180
+ },
181
+ disableRight: function() {
182
+ this.right_obj.text_dom.disabled = true;
183
+ Element.setOpacity(this.right_obj.dial_img, 0.3);
184
+ },
185
+
186
+ setLeft: function(val) {
187
+ this.left_obj.text_dom.value = val;
188
+ this.moveLeftDial();
189
+ },
190
+ setRight: function(val) {
191
+ this.right_obj.text_dom.value = val;
192
+ this.moveRightDial();
193
+ },
194
+ getLeft: function() {
195
+ return this.left_obj.text_dom.value;
196
+ },
197
+ getRight: function() {
198
+ return this.right_obj.text_dom.value;
199
+ },
200
+
201
+ moveLeftDial: function() {
202
+ this.moveDial(this.left_obj);
203
+ if (this.leftHander) this.leftHander();
204
+ },
205
+ moveRightDial: function() {
206
+ this.moveDial(this.right_obj);
207
+ if (this.rightHander) this.rightHander();
208
+ },
209
+ moveFreeDial: function() {
210
+ this.moveDial(this.free_obj);
211
+ },
212
+
213
+ moveDial: function(obj) {
214
+ var text_dom = obj.text_dom;
215
+ var index;
216
+ if ( text_dom ) {
217
+ index = this.valToIndex(text_dom.value);
218
+ } else {
219
+ index = obj.dial.index;
220
+ }
221
+ var ary = this.indexToValAndPos(index);
222
+ if(obj.dial.set_bound)
223
+ obj.dial.set_bound(index);
224
+ if(obj.dial.come_up)
225
+ obj.dial.come_up();
226
+ if (text_dom)
227
+ text_dom.value = ary[0];
228
+ obj.dial_dom.style.left = (ary[1]-obj.dial.relative_offset)+'px';
229
+ obj.dial.index = index;
230
+ },
231
+
232
+ posToIndex: function(pos, min, max) {
233
+ var flac = (pos-this.left_bound)/(this.right_bound-this.left_bound);
234
+ var index = Math.round(flac*(this.ary.length-1));
235
+ if (index < min) index = min;
236
+ if (index > max) index = max;
237
+ return index
238
+ },
239
+
240
+ valToIndex: function(val) {
241
+ var min;
242
+ var index;
243
+ var diff;
244
+ this.ary.each(function(v,i) {
245
+ diff = Math.abs( v - val );
246
+ if( i==0 || diff < min ) {
247
+ min = diff;
248
+ index = i;
249
+ }
250
+ });
251
+ return index;
252
+ },
253
+
254
+ indexToValAndPos: function(index) {
255
+ var val = this.ary[index];
256
+ var pos = this.left_bound+(this.right_bound-this.left_bound)*index/(this.ary.length-1);
257
+ return [val, pos]
258
+ }
259
+
260
+ }
@@ -0,0 +1,17 @@
1
+ var Tab = Class.create();
2
+ Tab.prototype = {
3
+ initialize: function() {
4
+ this.tab_list = new Array();
5
+ this.body_list = new Array();
6
+ this.action_list = new Array();
7
+ },
8
+
9
+ select: function(num) {
10
+ this.tab_list.each( function(val,i){val.className = "tab_close";} );
11
+ this.tab_list[num].className = "tab_open";
12
+ this.body_list.each( function(val,i){Element.hide(val);} );
13
+ Element.show(this.body_list[num]);
14
+ if( this.action_list[num] )
15
+ eval(this.action_list[num]);
16
+ }
17
+ }
@@ -0,0 +1,452 @@
1
+ var canvas;
2
+ var ctx;
3
+
4
+ Droppables.isContained = function(element, drop) {
5
+ var containmentNode;
6
+ if(drop.tree) {
7
+ containmentNode = element.treeNode;
8
+ } else {
9
+ containmentNode = element.parentNode;
10
+ }
11
+ return !drop._containers.detect(function(c) { return containmentNode == c });
12
+ };
13
+
14
+ var Plug = Class.create();
15
+ Plug.prototype = {
16
+ initialize: function(type, entity) {
17
+ var entity_id = entity.entity_id;
18
+ var divId = type + "_plug_" + entity_id;
19
+ new Insertion.Bottom(entity.div,
20
+ '<div class="plug ' + type + '" id="' + divId + '" style="display:none;"></div>'
21
+ );
22
+ var div = $(divId);
23
+ var width = div.getWidth();
24
+ var height = div.getHeight();
25
+ div.style.position = 'absolute';
26
+ div.style.left = entity.width/2 - width/2 + 'px';
27
+ if ( type=="input")
28
+ div.style.top = -height/2 - 1 + 'px';
29
+ else
30
+ div.style.top = entity.height - height/2 - 3 + 'px';
31
+ div.show();
32
+ this.entity = entity;
33
+ this.type = type;
34
+ this.div = div;
35
+ div.plug = this;
36
+ this.width = width;
37
+ this.height = height;
38
+ this.cons = new Array();
39
+ this.drag = new Draggable(div,
40
+ {
41
+ zindex: false,
42
+ constraint: true,
43
+ snap: function(x,y,obj) {
44
+ var relPos = this.entity.relativePosition();
45
+ var offset = obj.offset;
46
+ drawCanvas();
47
+ ctx.beginPath();
48
+ ctx.strokeStyle = "blue";
49
+ ctx.lineWidth = 1;
50
+ var posFrom = this.getCenter();
51
+ ctx.moveTo( posFrom[0], posFrom[1]);
52
+ ctx.lineTo( x+relPos[0]+offset[0], y+relPos[1]+offset[1] );
53
+ ctx.stroke();
54
+ return [x,y]
55
+ }.bind(this),
56
+ endeffect: function(element) {
57
+ drawCanvas();
58
+ }
59
+ }
60
+ );
61
+ Droppables.add(div,
62
+ {
63
+ accept: type=="input" ? "output" : "input",
64
+ hoverclass: "plug_hover",
65
+ containment: entity.div,
66
+ onDrop: function(from, dest, event) {
67
+ from = from.plug;
68
+ dest = dest.plug;
69
+ if (from.type == "input") {
70
+ var tmp = from;
71
+ from = dest;
72
+ dest = tmp;
73
+ }
74
+ new Connector(from, dest);
75
+ }
76
+ }
77
+ );
78
+ },
79
+ getCenter: function() {
80
+ var pos = Position.cumulativeOffset(this.div);
81
+ var offset = this.entity.offset();
82
+ var x = pos[0] + this.width/2 - offset[0] + 1;
83
+ var y = pos[1] + this.height/2 - offset[1] + 1;
84
+ return [x, y]
85
+ },
86
+ pushConnector: function(con) {
87
+ this.cons.push(con);
88
+ },
89
+ removeConnector: function(con) {
90
+ this.cons = this.cons.without(con);
91
+ },
92
+ destroy: function() {
93
+ for (var i=0; i<this.cons.length; i++) {
94
+ this.cons[i].destroy();
95
+ }
96
+ this.drag.destroy();
97
+ Droppables.remove(this.div);
98
+ Element.remove( this.div );
99
+ }
100
+ }
101
+
102
+ var ApiEntity = Class.create();
103
+ ApiEntity._list = new Array();
104
+ ApiEntity._selected = null;
105
+ ApiEntity.prototype = {
106
+ initialize: function(name, form, output) {
107
+ var entity_id = ApiEntity._list.last() ? ApiEntity._list.last().entity_id+1 : 0;
108
+ var div_id = "entity_" + entity_id;
109
+ var img_id = "entity_delete_" + entity_id;
110
+ var html;
111
+ html = '<div class="entity" id="' + div_id + '" style="display:none">';
112
+ html += '<nobr>';
113
+ html += '<span>' + name + '</span>';
114
+ html += '<img src="' + gfdnaviUrlRoot + "/images/x.gif" + '" class="delete" alt="delete" id="' + img_id + '" style="margin-left:3px;"/>';
115
+ html += '</nobr>';
116
+ html += '</div>';
117
+ new Insertion.Bottom('api_entities', html);
118
+ var div = $(div_id);
119
+ div.style.position = 'absolute';
120
+ var height = canvas.getHeight()-25
121
+ var y = (100*entity_id + 10);
122
+ var x = (100*parseInt(y/height) + 10)%(canvas.getWidth()-50);
123
+ y = y%height;
124
+ var img = $(img_id);
125
+ img.onclick = this.destroy.bind(this);
126
+ var form_id = "entity_form_" + entity_id;
127
+ html = '<div id="' + form_id + '" style="display:none;">'
128
+ html += form.gsub("api_id",entity_id);
129
+ html += '</div>'
130
+ new Insertion.Bottom('entity_form', html);
131
+ div.onmousedown = this.select.bind(this);
132
+ this.canvas = canvas;
133
+ var offset = this.offset();
134
+ div.style.left = offset[0] + x + 'px';
135
+ div.style.top = offset[1] + y + 'px';
136
+ div.show();
137
+ this.entity_id = entity_id;
138
+ this.div = div;
139
+ this.width = div.getWidth();
140
+ this.height = div.getHeight();
141
+ this.inputPlug = new Plug("input", this);
142
+ this.outputPlug = new Plug("output", this);
143
+ this.form = $(form_id);
144
+ this.name = name;
145
+ this.output = output;
146
+ ApiEntity._list.push( this );
147
+ this.drag = new Draggable(div,
148
+ {
149
+ starteffect: function(element) {
150
+ this._clone = element.cloneNode(true);
151
+ element.parentNode.insertBefore(this._clone, element);
152
+ element._opacity = Element.getOpacity(element);
153
+ Draggable._dragging[element] = true;
154
+ new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.5});
155
+ }.bind(this),
156
+ snap: function(x,y) {
157
+ var width = this.canvas.getWidth();
158
+ var height = this.canvas.getHeight();
159
+ var offset = this.offset();
160
+ var xmin = offset[0];
161
+ var xmax = offset[0] + width - this.width;
162
+ var padding = 2;
163
+ if ( x < xmin+padding )
164
+ x = xmin+padding;
165
+ else if ( x > xmax-padding )
166
+ x = xmax-padding;
167
+ var ymin = offset[1] + this.inputPlug.height/2;
168
+ var ymax = offset[1] + height - this.height - this.outputPlug.height/2;
169
+ if ( y < ymin+padding )
170
+ y = ymin+padding;
171
+ else if ( y > ymax-padding )
172
+ y = ymax-padding;
173
+ return [x,y];
174
+ }.bind(this),
175
+ revert: function(elm) {
176
+ Element.remove(this._clone);
177
+ this._clone = null;
178
+ drawCanvas();
179
+ return false;
180
+ }.bind(this)
181
+ }
182
+ );
183
+ this.select();
184
+ },
185
+ offset: function() {
186
+ return Position.cumulativeOffset(this.canvas);
187
+ },
188
+ relativePosition: function() {
189
+ var ary0 = Position.cumulativeOffset(this.div);
190
+ var ary1 = this.offset();
191
+ return [ ary0[0]-ary1[0], ary0[1]-ary1[1] ]
192
+ },
193
+ select: function() {
194
+ if ( ApiEntity._selected ) ApiEntity._selected.unselect();
195
+ if ( Connector._selected ) Connector._selected.unselect();
196
+ this.form.show();
197
+ Element.addClassName(this.div, "selected");
198
+ ApiEntity._selected = this;
199
+ },
200
+ unselect: function() {
201
+ this.form.hide();
202
+ Element.removeClassName(this.div, "selected");
203
+ ApiEntity._selected = null;
204
+ },
205
+ destroy: function(e) {
206
+ this.inputPlug.destroy();
207
+ this.outputPlug.destroy();
208
+ this.drag.destroy();
209
+ Element.remove( this.form );
210
+ Element.remove( this.div );
211
+ ApiEntity._list = ApiEntity._list.without(this);
212
+ if (e) Event.stop(e);
213
+ }
214
+ }
215
+
216
+ var Connector = Class.create();
217
+ Connector._list = new Array();
218
+ Connector._selected = null;
219
+ Connector.prototype = {
220
+ initialize: function(from, dest) {
221
+ var connector_id = Connector._list.last() ? Connector._list.last().connector_id+1 : 0;
222
+ var html;
223
+ var div_id = "connector_" + connector_id;
224
+ var box_id = "connector_box_" + connector_id;
225
+ var img_id = "connector_delete_" + connector_id;
226
+ html = '<div id="' + div_id + '" style="display:none">';
227
+ html += '<nobr>';
228
+ html += '<div id="' + box_id + '" class="connector"></div>';
229
+ html += '<img src="' + gfdnaviUrlRoot + "/images/x.gif" + '" class="delete" alt="delete" id="' + img_id + '" style="margin-left:1px;display:none;"/>';
230
+ html += '</nobr>';
231
+ html += '</div>';
232
+ new Insertion.Bottom('api_entities', html);
233
+ var div = $(div_id);
234
+ var box = $(div_id);
235
+ var img = $(img_id);
236
+ div.style.position = 'absolute';
237
+ div.onmouseover = function(){ this.img.show(); }.bind(this);
238
+ div.onmouseout = function(){ this.img.hide(); }.bind(this);
239
+ box.onclick = this.select.bind(this);
240
+ img.onclick = this.destroy.bind(this);
241
+ from.pushConnector( this );
242
+ dest.pushConnector( this );
243
+ var form_id = "connector_form_" + connector_id;
244
+ var connector_select_input_id = "connector_select_input_" + connector_id;
245
+ html = '<div id="' + form_id + '" style="display:none;">';
246
+ html += '<input type="hidden" name="connector[' + connector_id + '][from_api]" value="' + from.entity.entity_id + '"/>';
247
+ html += '<input type="hidden" name="connector[' + connector_id + '][dest_api]" value="' + dest.entity.entity_id + '"/>';
248
+ html += '<span>';
249
+ html += from.entity.name + ":";
250
+ html += '<select name="connector[' + connector_id + '][from_param]">';
251
+ html += '<option selected></option>';
252
+ from.entity.output.each( function(op) {
253
+ var value = op.gsub(/\(.*\)/,"");
254
+ value = value.sub(/^[^\[]*\[/, "[");
255
+ html += '<option value="' + value + '">';
256
+ html += op;
257
+ html += '</option>';
258
+ });
259
+ html += '</select>';
260
+ html += '</span>';
261
+ html += ' => ';
262
+ html += '<span>';
263
+ html += dest.entity.name + ":";
264
+ html += '<select name="connector[' + connector_id + '][dest_param]" id="' + connector_select_input_id + '">';
265
+ html += '<option selected></option>';
266
+ $A($(dest.entity.form).getElementsByTagName('*')).inject([],
267
+ function(elements, child) {
268
+ if (Form.Element.Serializers[child.tagName.toLowerCase()])
269
+ elements.push(Element.extend(child));
270
+ return elements;
271
+ }
272
+ ).each( function(element) {
273
+ var name = element.name;
274
+ if ( !( name.match("uri_wsdl") || name.match("api_name") ) ) {
275
+ text = name.gsub(/^apis\[\d*\]\[/,"");
276
+ text = text.gsub(/[^\d]\]\[([^\d]*)\]/, function(ary){ return "=>"+ary[1];});
277
+ text = text.gsub(/([^\d])\]/, function(ary){return ary[1];});
278
+ html += '<option value="' + name + '">';
279
+ html += text;
280
+ html += '</option>';
281
+ }
282
+ } );
283
+ html += '</select>';
284
+ html += '</span>';
285
+ html += "<hr/>";
286
+ html += '</div>';
287
+ new Insertion.Bottom('entity_form', html);
288
+ $(connector_select_input_id).onchange = function(e) {
289
+ var elm = Event.element(e);
290
+ if (this.selected_input) {
291
+ this.selected_input.readOnly = false;
292
+ this.selected_input.style.color = "";
293
+ this.selected_input.style.backgroundColor = "";
294
+ }
295
+ var ind = elm.selectedIndex;
296
+ this.selected_input = $(elm[ind].value);
297
+ this.selected_input.readOnly = true;
298
+ this.selected_input.style.color = "#888";
299
+ this.selected_input.style.backgroundColor = "#f5f5f5";
300
+ }.bind(this);
301
+ this.form = $(form_id);
302
+ this.from = from;
303
+ this.dest = dest;
304
+ this.connector_id = connector_id;
305
+ this.div = div;
306
+ this.box = box;
307
+ this.img = img;
308
+ this.divWidth = box.getWidth();
309
+ this.divHeight = box.getHeight();
310
+ Connector._list.push( this );
311
+ this.draw();
312
+ div.show();
313
+ this.select();
314
+ },
315
+ offset: function() {
316
+ return Position.cumulativeOffset(canvas);
317
+ },
318
+ draw: function() {
319
+ var posFrom = this.from.getCenter();
320
+ var posDest = this.dest.getCenter();
321
+ if ( this == Connector._selected )
322
+ ctx.strokeStyle = "blue";
323
+ else
324
+ ctx.strokeStyle = "black";
325
+ ctx.lineWidth = 2;
326
+ ctx.beginPath();
327
+ ctx.moveTo( posFrom[0], posFrom[1]);
328
+ ctx.lineTo( posDest[0], posDest[1] );
329
+ ctx.stroke();
330
+ var div = this.div;
331
+ var offset = this.offset();
332
+ div.style.left = (posFrom[0]+posDest[0])/2 - this.divWidth/2 + offset[0] + 1 + 'px';
333
+ div.style.top = (posFrom[1]+posDest[1])/2 - this.divHeight/2 + offset[1] + 1 + 'px';
334
+ },
335
+ select: function() {
336
+ if ( ApiEntity._selected ) ApiEntity._selected.unselect();
337
+ if ( Connector._selected ) Connector._selected.unselect();
338
+ this.form.show();
339
+ Element.addClassName(this.box, "selected");
340
+ Connector._selected = this;
341
+ drawCanvas();
342
+ },
343
+ unselect: function() {
344
+ this.form.hide();
345
+ Element.addClassName(this.box, "selected");
346
+ Connector._selected = null;
347
+ drawCanvas();
348
+ },
349
+ destroy: function(e) {
350
+ if (this.selected_input) {
351
+ this.selected_input.readOnly = false;
352
+ this.selected_input.style.color = "";
353
+ this.selected_input.style.backgroundColor = "";
354
+ }
355
+ this.from.removeConnector( this );
356
+ this.dest.removeConnector( this );
357
+ Element.remove(this.div);
358
+ Element.remove(this.form);
359
+ Connector._list = Connector._list.without( this );
360
+ drawCanvas();
361
+ if (e) Event.stop(e);
362
+ }
363
+ }
364
+
365
+ function drawCanvas() {
366
+ var width = canvas.getWidth();
367
+ var height = canvas.getHeight();
368
+ ctx.clearRect(0,0,width,height);
369
+ var i;
370
+ for (i=0; i<Connector._list.length; i++) {
371
+ Connector._list[i].draw();
372
+ }
373
+ }
374
+
375
+ var Wsdl = Class.create();
376
+ Wsdl._list = new Array();
377
+ Wsdl._selected = null;
378
+ Wsdl.prototype = {
379
+ initialize: function(name, apis, forms, outputs) {
380
+ Wsdl._list.push( name );
381
+ var id = Wsdl._list.length - 1;
382
+ this.name = name;
383
+ this.apis = new Array();
384
+ for (var i=0; i<apis.length; i++) {
385
+ this.apis.push( new WsApi(apis[i], forms[i], outputs[i], id) );
386
+ }
387
+ var html;
388
+ var span_id = 'span_' + name;
389
+ html = '<span id="' + span_id + '" class="link">' + name + '</span><br/>';
390
+ new Insertion.Bottom('wsdl_list', html);
391
+ var span = $(span_id);
392
+ span.onclick = this.select.bind(this);
393
+ this.span = span;
394
+ },
395
+ select: function() {
396
+ var apis = this.apis;
397
+ var api_list = $('api_list');
398
+ if (Wsdl._selected)
399
+ Element.removeClassName(Wsdl._selected.span, "selected");
400
+ api_list.update("");
401
+ for (var i=0; i<apis.length; i++) {
402
+ apis[i].show();
403
+ }
404
+ Wsdl._selected = this;
405
+ Element.addClassName(Wsdl._selected.span, "selected");
406
+ }
407
+ }
408
+
409
+ var WsApi = Class.create();
410
+ WsApi.prototype = {
411
+ initialize: function(name, form, output, id) {
412
+ this.name = name;
413
+ this.form = form;
414
+ this.output = output;
415
+ this.id = id;
416
+ },
417
+ show: function() {
418
+ var html;
419
+ var span_id = this.name + '_' + this.id;
420
+ html = '<span id="' + span_id + '" class="link">';
421
+ html += this.name;
422
+ html += '</span><br/>';
423
+ new Insertion.Bottom('api_list', html);
424
+ $(span_id).onclick = function() {
425
+ new ApiEntity(this.name, this.form, this.output);
426
+ }.bind(this);
427
+ }
428
+ }
429
+
430
+
431
+ function execute() {
432
+ new Ajax.Request(gfdnaviUrlRoot + "/work_flow/execute",
433
+ {
434
+ parameters: Form.serialize('entity_form'),
435
+ onLoading: function() { document.body.style.cursor = "wait"; },
436
+ onComplete: function() { document.body.style.cursor = "auto"; },
437
+ onFailure: function(req) {
438
+ alert("operation failed");
439
+ // alert(req.responseText);
440
+ }
441
+ }
442
+ );
443
+ return false;
444
+ }
445
+
446
+ function get_ruby_code(elm) {
447
+ form = $('entity_form');
448
+ form.action = gfdnaviUrlRoot + "/work_flow/get_ruby_code";
449
+ form.method = "post";
450
+ form.submit();
451
+ return false;
452
+ }