jiji 1.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (670) hide show
  1. data/ChangeLog +58 -0
  2. data/README +1 -0
  3. data/base/agents/moving_average_agent.rb +78 -0
  4. data/base/shared_lib/moving_average.rb +35 -0
  5. data/base/shared_lib/system/cross.rb +76 -0
  6. data/base/shared_lib/system/position_manager.rb +160 -0
  7. data/base/shared_lib/system/signal.rb +347 -0
  8. data/bin/jiji +5 -0
  9. data/html/css/calendar.css +432 -0
  10. data/html/css/datatable.css +299 -0
  11. data/html/css/default.css +627 -0
  12. data/html/css/dialog.css +77 -0
  13. data/html/css/treeview.css +205 -0
  14. data/html/img/auto_trade_off.gif +0 -0
  15. data/html/img/auto_trade_on.gif +0 -0
  16. data/html/img/back_bottom.gif +0 -0
  17. data/html/img/back_middle.gif +0 -0
  18. data/html/img/back_top.gif +0 -0
  19. data/html/img/bin_closed.png +0 -0
  20. data/html/img/bin_empty.png +0 -0
  21. data/html/img/bt-create-title-1.gif +0 -0
  22. data/html/img/bt-create-title-2.gif +0 -0
  23. data/html/img/bt-create-title-3.gif +0 -0
  24. data/html/img/button_add.gif +0 -0
  25. data/html/img/button_add_gray.gif +0 -0
  26. data/html/img/button_add_over.gif +0 -0
  27. data/html/img/button_add_small.gif +0 -0
  28. data/html/img/button_add_small_gray.gif +0 -0
  29. data/html/img/button_add_small_over.gif +0 -0
  30. data/html/img/button_apply.gif +0 -0
  31. data/html/img/button_apply_gray.gif +0 -0
  32. data/html/img/button_apply_over.gif +0 -0
  33. data/html/img/button_calendar.gif +0 -0
  34. data/html/img/button_calendar_over.gif +0 -0
  35. data/html/img/button_cancel.gif +0 -0
  36. data/html/img/button_cancel.jpg +0 -0
  37. data/html/img/button_cancel_gray.gif +0 -0
  38. data/html/img/button_cancel_over.gif +0 -0
  39. data/html/img/button_cancel_over.jpg +0 -0
  40. data/html/img/button_close.gif +0 -0
  41. data/html/img/button_close_gray.gif +0 -0
  42. data/html/img/button_close_over.gif +0 -0
  43. data/html/img/button_mkcol.gif +0 -0
  44. data/html/img/button_mkcol_gray.gif +0 -0
  45. data/html/img/button_mkcol_over.gif +0 -0
  46. data/html/img/button_no.gif +0 -0
  47. data/html/img/button_no_gray.gif +0 -0
  48. data/html/img/button_no_over.gif +0 -0
  49. data/html/img/button_ok.gif +0 -0
  50. data/html/img/button_ok_gray.gif +0 -0
  51. data/html/img/button_ok_over.gif +0 -0
  52. data/html/img/button_remove.gif +0 -0
  53. data/html/img/button_remove_gray.gif +0 -0
  54. data/html/img/button_remove_over.gif +0 -0
  55. data/html/img/button_remove_small.gif +0 -0
  56. data/html/img/button_remove_small_gray.gif +0 -0
  57. data/html/img/button_remove_small_over.gif +0 -0
  58. data/html/img/button_rename.gif +0 -0
  59. data/html/img/button_rename_gray.gif +0 -0
  60. data/html/img/button_rename_over.gif +0 -0
  61. data/html/img/button_save.gif +0 -0
  62. data/html/img/button_save_gray.gif +0 -0
  63. data/html/img/button_save_over.gif +0 -0
  64. data/html/img/button_start.gif +0 -0
  65. data/html/img/button_start_over.gif +0 -0
  66. data/html/img/button_update.gif +0 -0
  67. data/html/img/button_update_gray.gif +0 -0
  68. data/html/img/button_update_over.gif +0 -0
  69. data/html/img/button_update_s.gif +0 -0
  70. data/html/img/button_update_s_gray.gif +0 -0
  71. data/html/img/button_update_s_over.gif +0 -0
  72. data/html/img/button_yes.gif +0 -0
  73. data/html/img/button_yes_gray.gif +0 -0
  74. data/html/img/button_yes_over.gif +0 -0
  75. data/html/img/circle.gif +0 -0
  76. data/html/img/control_play.png +0 -0
  77. data/html/img/control_play_blue.png +0 -0
  78. data/html/img/delta.gif +0 -0
  79. data/html/img/dialog_info.jpg +0 -0
  80. data/html/img/dialog_input.jpg +0 -0
  81. data/html/img/dialog_warn.jpg +0 -0
  82. data/html/img/dt-arrow-dn.png +0 -0
  83. data/html/img/dt-arrow-up.png +0 -0
  84. data/html/img/folder.png +0 -0
  85. data/html/img/folder_brick.png +0 -0
  86. data/html/img/folder_user.png +0 -0
  87. data/html/img/foot.jpg +0 -0
  88. data/html/img/goto.gif +0 -0
  89. data/html/img/goto_o.gif +0 -0
  90. data/html/img/h3_bt-create_0.gif +0 -0
  91. data/html/img/h3_bt-create_1.gif +0 -0
  92. data/html/img/h3_bt-create_2.gif +0 -0
  93. data/html/img/h3_result_0.gif +0 -0
  94. data/html/img/h3_result_1.gif +0 -0
  95. data/html/img/h3_result_2.gif +0 -0
  96. data/html/img/h3_result_3.gif +0 -0
  97. data/html/img/h3_result_4.gif +0 -0
  98. data/html/img/h3_result_5.gif +0 -0
  99. data/html/img/h3_result_6.gif +0 -0
  100. data/html/img/h3_rt-setting_0.gif +0 -0
  101. data/html/img/h3_rt-setting_1.gif +0 -0
  102. data/html/img/head.jpg +0 -0
  103. data/html/img/line-numbers.png +0 -0
  104. data/html/img/line_white.gif +0 -0
  105. data/html/img/loading.gif +0 -0
  106. data/html/img/page_white_ruby.png +0 -0
  107. data/html/img/panel_100_bottom.gif +0 -0
  108. data/html/img/panel_100_middle.gif +0 -0
  109. data/html/img/panel_100_top.gif +0 -0
  110. data/html/img/panel_140_650_b.gif +0 -0
  111. data/html/img/panel_140_650_m.gif +0 -0
  112. data/html/img/panel_140_650_t.gif +0 -0
  113. data/html/img/panel_140_660_b.gif +0 -0
  114. data/html/img/panel_140_660_m.gif +0 -0
  115. data/html/img/panel_140_660_t.gif +0 -0
  116. data/html/img/panel_140_b.gif +0 -0
  117. data/html/img/panel_140_m.gif +0 -0
  118. data/html/img/panel_140_t.gif +0 -0
  119. data/html/img/panel_260_b.gif +0 -0
  120. data/html/img/panel_260_m.gif +0 -0
  121. data/html/img/panel_260_t.gif +0 -0
  122. data/html/img/panel_300_b.gif +0 -0
  123. data/html/img/panel_300_m.gif +0 -0
  124. data/html/img/panel_300_t.gif +0 -0
  125. data/html/img/panel_320_b.gif +0 -0
  126. data/html/img/panel_320_m.gif +0 -0
  127. data/html/img/panel_320_t.gif +0 -0
  128. data/html/img/panel_360_b.gif +0 -0
  129. data/html/img/panel_360_m.gif +0 -0
  130. data/html/img/panel_360_t.gif +0 -0
  131. data/html/img/panel_380_b.gif +0 -0
  132. data/html/img/panel_380_m.gif +0 -0
  133. data/html/img/panel_380_t.gif +0 -0
  134. data/html/img/panel_500_b.gif +0 -0
  135. data/html/img/panel_500_m.gif +0 -0
  136. data/html/img/panel_500_t.gif +0 -0
  137. data/html/img/panel_620_b.gif +0 -0
  138. data/html/img/panel_620_m.gif +0 -0
  139. data/html/img/panel_620_t.gif +0 -0
  140. data/html/img/panel_780_b.gif +0 -0
  141. data/html/img/panel_780_m.gif +0 -0
  142. data/html/img/panel_780_t.gif +0 -0
  143. data/html/img/problem.gif +0 -0
  144. data/html/img/progressbar.gif +0 -0
  145. data/html/img/result-title-1-1.gif +0 -0
  146. data/html/img/result-title-1-2.gif +0 -0
  147. data/html/img/result-title-2-1.gif +0 -0
  148. data/html/img/result-title-2-2.gif +0 -0
  149. data/html/img/result-title-3-1.gif +0 -0
  150. data/html/img/result-title-4-1.gif +0 -0
  151. data/html/img/rt-setting-title-1.gif +0 -0
  152. data/html/img/rt-setting-title-2.gif +0 -0
  153. data/html/img/s.gif +0 -0
  154. data/html/img/scroll.gif +0 -0
  155. data/html/img/separator.gif +0 -0
  156. data/html/img/sidebar_agent.png +0 -0
  157. data/html/img/sidebar_agent_edit.png +0 -0
  158. data/html/img/sidebar_agent_edit_agent.png +0 -0
  159. data/html/img/sidebar_agent_edit_agent_over.png +0 -0
  160. data/html/img/sidebar_agent_edit_agent_s.png +0 -0
  161. data/html/img/sidebar_agent_edit_over.png +0 -0
  162. data/html/img/sidebar_agent_edit_s.png +0 -0
  163. data/html/img/sidebar_agent_edit_shared_lib.png +0 -0
  164. data/html/img/sidebar_agent_edit_shared_lib_over.png +0 -0
  165. data/html/img/sidebar_agent_edit_shared_lib_s.png +0 -0
  166. data/html/img/sidebar_back.gif +0 -0
  167. data/html/img/sidebar_bt.png +0 -0
  168. data/html/img/sidebar_bt_create.png +0 -0
  169. data/html/img/sidebar_bt_create_over.png +0 -0
  170. data/html/img/sidebar_bt_create_s.png +0 -0
  171. data/html/img/sidebar_bt_result.png +0 -0
  172. data/html/img/sidebar_bt_result_over.png +0 -0
  173. data/html/img/sidebar_bt_result_s.png +0 -0
  174. data/html/img/sidebar_result_rmt.png +0 -0
  175. data/html/img/sidebar_result_rmt_over.png +0 -0
  176. data/html/img/sidebar_result_rmt_s.png +0 -0
  177. data/html/img/sidebar_rt.png +0 -0
  178. data/html/img/sidebar_rt_setting.png +0 -0
  179. data/html/img/sidebar_rt_setting_over.png +0 -0
  180. data/html/img/sidebar_rt_setting_s.png +0 -0
  181. data/html/img/sprite.png +0 -0
  182. data/html/img/submenu_agents.png +0 -0
  183. data/html/img/submenu_agents_over.png +0 -0
  184. data/html/img/submenu_agents_s.png +0 -0
  185. data/html/img/submenu_graph.png +0 -0
  186. data/html/img/submenu_graph_over.png +0 -0
  187. data/html/img/submenu_graph_s.png +0 -0
  188. data/html/img/submenu_info.png +0 -0
  189. data/html/img/submenu_info_over.png +0 -0
  190. data/html/img/submenu_info_s.png +0 -0
  191. data/html/img/submenu_log.png +0 -0
  192. data/html/img/submenu_log_over.png +0 -0
  193. data/html/img/submenu_log_s.png +0 -0
  194. data/html/img/submenu_operation.png +0 -0
  195. data/html/img/submenu_operation_over.png +0 -0
  196. data/html/img/submenu_operation_s.png +0 -0
  197. data/html/img/submenu_trade.png +0 -0
  198. data/html/img/submenu_trade_over.png +0 -0
  199. data/html/img/submenu_trade_s.png +0 -0
  200. data/html/img/td_over.gif +0 -0
  201. data/html/img/td_over_d.gif +0 -0
  202. data/html/img/td_selected.gif +0 -0
  203. data/html/img/thead.gif +0 -0
  204. data/html/img/transparent.gif +0 -0
  205. data/html/img/yui/treeview-sprite.gif +0 -0
  206. data/html/index.html +492 -0
  207. data/html/js/agent-editor/agent-editor-page.js +324 -0
  208. data/html/js/agent-editor/agent-editor.js +363 -0
  209. data/html/js/agent-editor/agent-list-tree.js +251 -0
  210. data/html/js/agent-selector.js +666 -0
  211. data/html/js/app.js +198 -0
  212. data/html/js/bt-create-page.js +205 -0
  213. data/html/js/container-min.js +1 -0
  214. data/html/js/container-utils.js +78 -0
  215. data/html/js/container.js +944 -0
  216. data/html/js/dialog.js +279 -0
  217. data/html/js/edit_area/autocompletion.js +491 -0
  218. data/html/js/edit_area/edit_area.css +546 -0
  219. data/html/js/edit_area/edit_area.js +539 -0
  220. data/html/js/edit_area/edit_area_compressor.php +408 -0
  221. data/html/js/edit_area/edit_area_full.gz +0 -0
  222. data/html/js/edit_area/edit_area_full.js +38 -0
  223. data/html/js/edit_area/edit_area_full_with_plugins.gz +0 -0
  224. data/html/js/edit_area/edit_area_full_with_plugins.js +39 -0
  225. data/html/js/edit_area/edit_area_functions.js +1205 -0
  226. data/html/js/edit_area/edit_area_loader.js +1082 -0
  227. data/html/js/edit_area/elements_functions.js +334 -0
  228. data/html/js/edit_area/highlight.js +391 -0
  229. data/html/js/edit_area/images/autocompletion.gif +0 -0
  230. data/html/js/edit_area/images/close.gif +0 -0
  231. data/html/js/edit_area/images/fullscreen.gif +0 -0
  232. data/html/js/edit_area/images/go_to_line.gif +0 -0
  233. data/html/js/edit_area/images/goto.png +0 -0
  234. data/html/js/edit_area/images/help.gif +0 -0
  235. data/html/js/edit_area/images/help.png +0 -0
  236. data/html/js/edit_area/images/highlight.gif +0 -0
  237. data/html/js/edit_area/images/load.gif +0 -0
  238. data/html/js/edit_area/images/move.gif +0 -0
  239. data/html/js/edit_area/images/newdocument.gif +0 -0
  240. data/html/js/edit_area/images/opacity.png +0 -0
  241. data/html/js/edit_area/images/processing.gif +0 -0
  242. data/html/js/edit_area/images/redo.gif +0 -0
  243. data/html/js/edit_area/images/redo.png +0 -0
  244. data/html/js/edit_area/images/reset_highlight.gif +0 -0
  245. data/html/js/edit_area/images/save.gif +0 -0
  246. data/html/js/edit_area/images/save.png +0 -0
  247. data/html/js/edit_area/images/search.gif +0 -0
  248. data/html/js/edit_area/images/search.png +0 -0
  249. data/html/js/edit_area/images/smooth_selection.gif +0 -0
  250. data/html/js/edit_area/images/spacer.gif +0 -0
  251. data/html/js/edit_area/images/statusbar_resize.gif +0 -0
  252. data/html/js/edit_area/images/undo.gif +0 -0
  253. data/html/js/edit_area/images/undo.png +0 -0
  254. data/html/js/edit_area/images/word_wrap.gif +0 -0
  255. data/html/js/edit_area/keyboard.js +145 -0
  256. data/html/js/edit_area/langs/bg.js +73 -0
  257. data/html/js/edit_area/langs/cs.js +67 -0
  258. data/html/js/edit_area/langs/de.js +67 -0
  259. data/html/js/edit_area/langs/dk.js +67 -0
  260. data/html/js/edit_area/langs/en.js +67 -0
  261. data/html/js/edit_area/langs/eo.js +67 -0
  262. data/html/js/edit_area/langs/es.js +64 -0
  263. data/html/js/edit_area/langs/fi.js +67 -0
  264. data/html/js/edit_area/langs/fr.js +67 -0
  265. data/html/js/edit_area/langs/hr.js +67 -0
  266. data/html/js/edit_area/langs/it.js +67 -0
  267. data/html/js/edit_area/langs/ja.js +67 -0
  268. data/html/js/edit_area/langs/mk.js +67 -0
  269. data/html/js/edit_area/langs/nl.js +67 -0
  270. data/html/js/edit_area/langs/pl.js +67 -0
  271. data/html/js/edit_area/langs/pt.js +67 -0
  272. data/html/js/edit_area/langs/ru.js +67 -0
  273. data/html/js/edit_area/langs/sk.js +67 -0
  274. data/html/js/edit_area/langs/zh.js +67 -0
  275. data/html/js/edit_area/license_apache.txt +7 -0
  276. data/html/js/edit_area/license_bsd.txt +10 -0
  277. data/html/js/edit_area/license_lgpl.txt +458 -0
  278. data/html/js/edit_area/manage_area.js +623 -0
  279. data/html/js/edit_area/plugins/charmap/charmap.js +90 -0
  280. data/html/js/edit_area/plugins/charmap/css/charmap.css +64 -0
  281. data/html/js/edit_area/plugins/charmap/images/charmap.gif +0 -0
  282. data/html/js/edit_area/plugins/charmap/jscripts/map.js +373 -0
  283. data/html/js/edit_area/plugins/charmap/langs/bg.js +12 -0
  284. data/html/js/edit_area/plugins/charmap/langs/cs.js +6 -0
  285. data/html/js/edit_area/plugins/charmap/langs/de.js +6 -0
  286. data/html/js/edit_area/plugins/charmap/langs/dk.js +6 -0
  287. data/html/js/edit_area/plugins/charmap/langs/en.js +6 -0
  288. data/html/js/edit_area/plugins/charmap/langs/eo.js +6 -0
  289. data/html/js/edit_area/plugins/charmap/langs/es.js +6 -0
  290. data/html/js/edit_area/plugins/charmap/langs/fr.js +6 -0
  291. data/html/js/edit_area/plugins/charmap/langs/hr.js +6 -0
  292. data/html/js/edit_area/plugins/charmap/langs/it.js +6 -0
  293. data/html/js/edit_area/plugins/charmap/langs/ja.js +6 -0
  294. data/html/js/edit_area/plugins/charmap/langs/mk.js +6 -0
  295. data/html/js/edit_area/plugins/charmap/langs/nl.js +6 -0
  296. data/html/js/edit_area/plugins/charmap/langs/pl.js +6 -0
  297. data/html/js/edit_area/plugins/charmap/langs/pt.js +6 -0
  298. data/html/js/edit_area/plugins/charmap/langs/ru.js +6 -0
  299. data/html/js/edit_area/plugins/charmap/langs/sk.js +6 -0
  300. data/html/js/edit_area/plugins/charmap/langs/zh.js +6 -0
  301. data/html/js/edit_area/plugins/charmap/popup.html +24 -0
  302. data/html/js/edit_area/plugins/test/css/test.css +3 -0
  303. data/html/js/edit_area/plugins/test/images/Thumbs.db +0 -0
  304. data/html/js/edit_area/plugins/test/images/test.gif +0 -0
  305. data/html/js/edit_area/plugins/test/langs/bg.js +10 -0
  306. data/html/js/edit_area/plugins/test/langs/cs.js +4 -0
  307. data/html/js/edit_area/plugins/test/langs/de.js +4 -0
  308. data/html/js/edit_area/plugins/test/langs/dk.js +4 -0
  309. data/html/js/edit_area/plugins/test/langs/en.js +4 -0
  310. data/html/js/edit_area/plugins/test/langs/eo.js +4 -0
  311. data/html/js/edit_area/plugins/test/langs/es.js +4 -0
  312. data/html/js/edit_area/plugins/test/langs/fr.js +4 -0
  313. data/html/js/edit_area/plugins/test/langs/hr.js +4 -0
  314. data/html/js/edit_area/plugins/test/langs/it.js +4 -0
  315. data/html/js/edit_area/plugins/test/langs/ja.js +4 -0
  316. data/html/js/edit_area/plugins/test/langs/mk.js +4 -0
  317. data/html/js/edit_area/plugins/test/langs/nl.js +4 -0
  318. data/html/js/edit_area/plugins/test/langs/pl.js +4 -0
  319. data/html/js/edit_area/plugins/test/langs/pt.js +4 -0
  320. data/html/js/edit_area/plugins/test/langs/ru.js +4 -0
  321. data/html/js/edit_area/plugins/test/langs/sk.js +4 -0
  322. data/html/js/edit_area/plugins/test/langs/zh.js +4 -0
  323. data/html/js/edit_area/plugins/test/test.js +110 -0
  324. data/html/js/edit_area/plugins/test/test2.js +1 -0
  325. data/html/js/edit_area/reg_syntax/basic.js +69 -0
  326. data/html/js/edit_area/reg_syntax/brainfuck.js +44 -0
  327. data/html/js/edit_area/reg_syntax/c.js +62 -0
  328. data/html/js/edit_area/reg_syntax/coldfusion.js +119 -0
  329. data/html/js/edit_area/reg_syntax/cpp.js +65 -0
  330. data/html/js/edit_area/reg_syntax/css.js +84 -0
  331. data/html/js/edit_area/reg_syntax/html.js +50 -0
  332. data/html/js/edit_area/reg_syntax/java.js +56 -0
  333. data/html/js/edit_area/reg_syntax/js.js +93 -0
  334. data/html/js/edit_area/reg_syntax/pas.js +82 -0
  335. data/html/js/edit_area/reg_syntax/perl.js +88 -0
  336. data/html/js/edit_area/reg_syntax/php.js +156 -0
  337. data/html/js/edit_area/reg_syntax/python.js +144 -0
  338. data/html/js/edit_area/reg_syntax/robotstxt.js +24 -0
  339. data/html/js/edit_area/reg_syntax/ruby.js +67 -0
  340. data/html/js/edit_area/reg_syntax/sql.js +55 -0
  341. data/html/js/edit_area/reg_syntax/tsql.js +87 -0
  342. data/html/js/edit_area/reg_syntax/vb.js +52 -0
  343. data/html/js/edit_area/reg_syntax/xml.js +56 -0
  344. data/html/js/edit_area/reg_syntax.js +166 -0
  345. data/html/js/edit_area/regexp.js +139 -0
  346. data/html/js/edit_area/resize_area.js +78 -0
  347. data/html/js/edit_area/search_replace.js +174 -0
  348. data/html/js/edit_area/template.html +101 -0
  349. data/html/js/json-broker-client.js +67 -0
  350. data/html/js/page-manager.js +93 -0
  351. data/html/js/prototype.js +4184 -0
  352. data/html/js/result-page.js +775 -0
  353. data/html/js/rt-setting-page.js +152 -0
  354. data/html/js/sidebar.js +263 -0
  355. data/html/js/templates.js +386 -0
  356. data/html/js/utils.js +890 -0
  357. data/html/js/uuid.js +103 -0
  358. data/html/js/yui/treeview.js +3671 -0
  359. data/html/swf/chart.swf +0 -0
  360. data/html/test/agent_editor_spec.js +815 -0
  361. data/html/test/index.html +40 -0
  362. data/html/test/jsspec/JSSpec.css +224 -0
  363. data/html/test/jsspec/JSSpec.js +1549 -0
  364. data/html/test/jsspec/diff_match_patch.js +1 -0
  365. data/html/test/utils_spec.js +111 -0
  366. data/lib/jiji/agent/agent.rb +149 -0
  367. data/lib/jiji/agent/agent_manager.rb +138 -0
  368. data/lib/jiji/agent/agent_registry.rb +165 -0
  369. data/lib/jiji/agent/permitter.rb +128 -0
  370. data/lib/jiji/agent/util.rb +16 -0
  371. data/lib/jiji/collector.rb +226 -0
  372. data/lib/jiji/command.rb +204 -0
  373. data/lib/jiji/configuration.rb +86 -0
  374. data/lib/jiji/dao/file_system_dao.rb +158 -0
  375. data/lib/jiji/dao/rate_dao.rb +149 -0
  376. data/lib/jiji/dao/timed_data_dao.rb +336 -0
  377. data/lib/jiji/dao/trade_result_dao.rb +128 -0
  378. data/lib/jiji/error.rb +49 -0
  379. data/lib/jiji/migration/migrator.rb +50 -0
  380. data/lib/jiji/migration/migrator1_0_3.rb +26 -0
  381. data/lib/jiji/migration/migrator1_1_0.rb +46 -0
  382. data/lib/jiji/migration/migrator1_2_0.rb +67 -0
  383. data/lib/jiji/models.rb +223 -0
  384. data/lib/jiji/observer.rb +105 -0
  385. data/lib/jiji/operator.rb +396 -0
  386. data/lib/jiji/output.rb +221 -0
  387. data/lib/jiji/output_manager.rb +84 -0
  388. data/lib/jiji/plugin/embedded/click_securities_demo_plugin.rb +141 -0
  389. data/lib/jiji/plugin/embedded/single_click_client.rb +116 -0
  390. data/lib/jiji/plugin/plugin_loader.rb +53 -0
  391. data/lib/jiji/plugin/securities_plugin.rb +134 -0
  392. data/lib/jiji/process.rb +234 -0
  393. data/lib/jiji/process_manager.rb +290 -0
  394. data/lib/jiji/registry.rb +349 -0
  395. data/lib/jiji/server.rb +127 -0
  396. data/lib/jiji/service/agent_service.rb +230 -0
  397. data/lib/jiji/service/hello_service.rb +10 -0
  398. data/lib/jiji/service/output_service.rb +82 -0
  399. data/lib/jiji/service/process_service.rb +76 -0
  400. data/lib/jiji/service/rate_service.rb +38 -0
  401. data/lib/jiji/service/system_service.rb +14 -0
  402. data/lib/jiji/service/trade_result_service.rb +31 -0
  403. data/lib/jiji/util/backtester.rb +116 -0
  404. data/lib/jiji/util/block_to_session.rb +70 -0
  405. data/lib/jiji/util/cache.rb +79 -0
  406. data/lib/jiji/util/csv_append_support.rb +15 -0
  407. data/lib/jiji/util/file_lock.rb +86 -0
  408. data/lib/jiji/util/fix_yaml_bug.rb +11 -0
  409. data/lib/jiji/util/include_proxy.rb +17 -0
  410. data/lib/jiji/util/iterator.rb +70 -0
  411. data/lib/jiji/util/json_broker.rb +55 -0
  412. data/lib/jiji/util/json_rpc_requestor.rb +30 -0
  413. data/lib/jiji/util/rate_data_importer.rb +219 -0
  414. data/lib/jiji/util/synchronize_interceptor.rb +41 -0
  415. data/lib/jiji/util/thread_use_generator.rb +52 -0
  416. data/lib/jiji/util/util.rb +112 -0
  417. data/lib/jiji_plugin.rb +6 -0
  418. data/swf/build.xml +23 -0
  419. data/swf/chart/FxChart-config.xml +9 -0
  420. data/swf/chart/FxChart.mxml +17 -0
  421. data/swf/chart/fx/chart/Chart.as +173 -0
  422. data/swf/chart/fx/chart/ctrl/AutoUpdate.as +96 -0
  423. data/swf/chart/fx/chart/ctrl/Controller.as +270 -0
  424. data/swf/chart/fx/chart/ctrl/Event.as +75 -0
  425. data/swf/chart/fx/chart/model/Model.as +228 -0
  426. data/swf/chart/fx/chart/model/TimedData.as +40 -0
  427. data/swf/chart/fx/chart/ui/AbstractChartUI.as +59 -0
  428. data/swf/chart/fx/chart/ui/AbstractDrawChartUI.as +63 -0
  429. data/swf/chart/fx/chart/ui/Constants.as +233 -0
  430. data/swf/chart/fx/chart/ui/InformationWindow.as +228 -0
  431. data/swf/chart/fx/chart/ui/LayerManager.as +95 -0
  432. data/swf/chart/fx/chart/ui/Loading.as +32 -0
  433. data/swf/chart/fx/chart/ui/Pointer.as +61 -0
  434. data/swf/chart/fx/chart/ui/RangeInfoWindow.as +84 -0
  435. data/swf/chart/fx/chart/ui/RenderingContext.as +54 -0
  436. data/swf/chart/fx/chart/ui/ScaleSelector.as +84 -0
  437. data/swf/chart/fx/chart/ui/Scroll.as +241 -0
  438. data/swf/chart/fx/chart/ui/ScrollBar.as +378 -0
  439. data/swf/chart/fx/chart/ui/Stage.as +97 -0
  440. data/swf/chart/fx/chart/ui/TradeDetailWindow.as +147 -0
  441. data/swf/chart/fx/chart/ui/TradeResult.as +330 -0
  442. data/swf/chart/fx/chart/ui/Window.as +96 -0
  443. data/swf/chart/fx/chart/ui/candle/Axis.as +112 -0
  444. data/swf/chart/fx/chart/ui/candle/Candle.as +79 -0
  445. data/swf/chart/fx/chart/ui/candle/CandleChart.as +81 -0
  446. data/swf/chart/fx/chart/ui/graph/Graph.as +200 -0
  447. data/swf/chart/fx/chart/ui/graph/GraphManager.as +192 -0
  448. data/swf/chart/fx/chart/ui/resource/buy.gif +0 -0
  449. data/swf/chart/fx/chart/ui/resource/cursor_hand.gif +0 -0
  450. data/swf/chart/fx/chart/ui/resource/diff_label.gif +0 -0
  451. data/swf/chart/fx/chart/ui/resource/down.gif +0 -0
  452. data/swf/chart/fx/chart/ui/resource/down_buy.gif +0 -0
  453. data/swf/chart/fx/chart/ui/resource/down_buy_1.gif +0 -0
  454. data/swf/chart/fx/chart/ui/resource/down_buy_2.gif +0 -0
  455. data/swf/chart/fx/chart/ui/resource/down_buy_3.gif +0 -0
  456. data/swf/chart/fx/chart/ui/resource/down_sell.gif +0 -0
  457. data/swf/chart/fx/chart/ui/resource/down_sell_1.gif +0 -0
  458. data/swf/chart/fx/chart/ui/resource/down_sell_2.gif +0 -0
  459. data/swf/chart/fx/chart/ui/resource/down_sell_3.gif +0 -0
  460. data/swf/chart/fx/chart/ui/resource/draw_buy.gif +0 -0
  461. data/swf/chart/fx/chart/ui/resource/draw_sell.gif +0 -0
  462. data/swf/chart/fx/chart/ui/resource/end_label.gif +0 -0
  463. data/swf/chart/fx/chart/ui/resource/fixed.gif +0 -0
  464. data/swf/chart/fx/chart/ui/resource/loading.gif +0 -0
  465. data/swf/chart/fx/chart/ui/resource/max_label.gif +0 -0
  466. data/swf/chart/fx/chart/ui/resource/min_label.gif +0 -0
  467. data/swf/chart/fx/chart/ui/resource/scroll_bar.gif +0 -0
  468. data/swf/chart/fx/chart/ui/resource/scroll_bar_a.gif +0 -0
  469. data/swf/chart/fx/chart/ui/resource/scroll_bar_handle.gif +0 -0
  470. data/swf/chart/fx/chart/ui/resource/scroll_bar_handle_a.gif +0 -0
  471. data/swf/chart/fx/chart/ui/resource/scroll_bar_handle_o.gif +0 -0
  472. data/swf/chart/fx/chart/ui/resource/scroll_bar_left.gif +0 -0
  473. data/swf/chart/fx/chart/ui/resource/scroll_bar_left_a.gif +0 -0
  474. data/swf/chart/fx/chart/ui/resource/scroll_bar_left_o.gif +0 -0
  475. data/swf/chart/fx/chart/ui/resource/scroll_bar_o.gif +0 -0
  476. data/swf/chart/fx/chart/ui/resource/scroll_bar_right.gif +0 -0
  477. data/swf/chart/fx/chart/ui/resource/scroll_bar_right_a.gif +0 -0
  478. data/swf/chart/fx/chart/ui/resource/scroll_bar_right_o.gif +0 -0
  479. data/swf/chart/fx/chart/ui/resource/scroll_handle.gif +0 -0
  480. data/swf/chart/fx/chart/ui/resource/scroll_info_handle.gif +0 -0
  481. data/swf/chart/fx/chart/ui/resource/scroll_left_button.gif +0 -0
  482. data/swf/chart/fx/chart/ui/resource/scroll_left_button_d.gif +0 -0
  483. data/swf/chart/fx/chart/ui/resource/scroll_left_button_down.gif +0 -0
  484. data/swf/chart/fx/chart/ui/resource/scroll_left_button_g.gif +0 -0
  485. data/swf/chart/fx/chart/ui/resource/scroll_left_button_o.gif +0 -0
  486. data/swf/chart/fx/chart/ui/resource/scroll_left_button_up.gif +0 -0
  487. data/swf/chart/fx/chart/ui/resource/scroll_outer.gif +0 -0
  488. data/swf/chart/fx/chart/ui/resource/scroll_outer_left.gif +0 -0
  489. data/swf/chart/fx/chart/ui/resource/scroll_outer_right.gif +0 -0
  490. data/swf/chart/fx/chart/ui/resource/scroll_right_button.gif +0 -0
  491. data/swf/chart/fx/chart/ui/resource/scroll_right_button_d.gif +0 -0
  492. data/swf/chart/fx/chart/ui/resource/scroll_right_button_down.gif +0 -0
  493. data/swf/chart/fx/chart/ui/resource/scroll_right_button_g.gif +0 -0
  494. data/swf/chart/fx/chart/ui/resource/scroll_right_button_o.gif +0 -0
  495. data/swf/chart/fx/chart/ui/resource/scroll_right_button_up.gif +0 -0
  496. data/swf/chart/fx/chart/ui/resource/scroll_slider_left.gif +0 -0
  497. data/swf/chart/fx/chart/ui/resource/scroll_slider_right.gif +0 -0
  498. data/swf/chart/fx/chart/ui/resource/sell.gif +0 -0
  499. data/swf/chart/fx/chart/ui/resource/start_label.gif +0 -0
  500. data/swf/chart/fx/chart/ui/resource/stripe.gif +0 -0
  501. data/swf/chart/fx/chart/ui/resource/stripe_b.gif +0 -0
  502. data/swf/chart/fx/chart/ui/resource/stripe_r.gif +0 -0
  503. data/swf/chart/fx/chart/ui/resource/unfixed.gif +0 -0
  504. data/swf/chart/fx/chart/ui/resource/up.gif +0 -0
  505. data/swf/chart/fx/chart/ui/resource/up_buy.gif +0 -0
  506. data/swf/chart/fx/chart/ui/resource/up_buy_1.gif +0 -0
  507. data/swf/chart/fx/chart/ui/resource/up_buy_2.gif +0 -0
  508. data/swf/chart/fx/chart/ui/resource/up_buy_3.gif +0 -0
  509. data/swf/chart/fx/chart/ui/resource/up_sell.gif +0 -0
  510. data/swf/chart/fx/chart/ui/resource/up_sell_1.gif +0 -0
  511. data/swf/chart/fx/chart/ui/resource/up_sell_2.gif +0 -0
  512. data/swf/chart/fx/chart/ui/resource/up_sell_3.gif +0 -0
  513. data/swf/chart/fx/net/StubFactory.as +113 -0
  514. data/swf/chart/fx/util/ListenerSupport.as +55 -0
  515. data/swf/chart/fx/util/PositionManager.as +95 -0
  516. data/swf/chart/fx/util/ScaleFormatter.as +156 -0
  517. data/swf/chart/fx/util/Util.as +61 -0
  518. data/swf/chart/log.as +40 -0
  519. data/swf/lib/corelib.swc +0 -0
  520. data/test/BackCollectorTest/basic/2008-08-04/AUDJPY.csv +5 -0
  521. data/test/BackCollectorTest/basic/2008-08-04/USDJPY.csv +5 -0
  522. data/test/BackCollectorTest/basic/2008-08-04/ZARJPY.csv +5 -0
  523. data/test/BackCollectorTest/basic/2008-08-05/AUDJPY.csv +5 -0
  524. data/test/BackCollectorTest/basic/2008-08-05/USDJPY.csv +5 -0
  525. data/test/BackCollectorTest/basic/2008-08-05/ZARJPY.csv +5 -0
  526. data/test/BackCollectorTest/basic/2008-08-06/AUDJPY.csv +5 -0
  527. data/test/BackCollectorTest/basic/2008-08-06/USDJPY.csv +5 -0
  528. data/test/BackCollectorTest/basic/2008-08-06/ZARJPY.csv +5 -0
  529. data/test/BackCollectorTest/basic/2008-08-07/AUDJPY.csv +5 -0
  530. data/test/BackCollectorTest/basic/2008-08-07/USDJPY.csv +5 -0
  531. data/test/BackCollectorTest/basic/2008-08-07/ZARJPY.csv +5 -0
  532. data/test/BackCollectorTest/basic/AUDJPY/raw/2008-08-04.csv +5 -0
  533. data/test/BackCollectorTest/basic/AUDJPY/raw/2008-08-05.csv +5 -0
  534. data/test/BackCollectorTest/basic/AUDJPY/raw/2008-08-06.csv +5 -0
  535. data/test/BackCollectorTest/basic/AUDJPY/raw/2008-08-07.csv +5 -0
  536. data/test/BackCollectorTest/basic/USDJPY/raw/2008-08-04.csv +5 -0
  537. data/test/BackCollectorTest/basic/USDJPY/raw/2008-08-05.csv +5 -0
  538. data/test/BackCollectorTest/basic/USDJPY/raw/2008-08-06.csv +5 -0
  539. data/test/BackCollectorTest/basic/USDJPY/raw/2008-08-07.csv +5 -0
  540. data/test/BackCollectorTest/basic/ZARJPY/raw/2008-08-04.csv +5 -0
  541. data/test/BackCollectorTest/basic/ZARJPY/raw/2008-08-05.csv +5 -0
  542. data/test/BackCollectorTest/basic/ZARJPY/raw/2008-08-06.csv +5 -0
  543. data/test/BackCollectorTest/basic/ZARJPY/raw/2008-08-07.csv +5 -0
  544. data/test/BackCollectorTest/lack/2008-08-04/AUDJPY.csv +5 -0
  545. data/test/BackCollectorTest/lack/2008-08-04/USDJPY.csv +5 -0
  546. data/test/BackCollectorTest/lack/2008-08-04/ZARJPY.csv +5 -0
  547. data/test/BackCollectorTest/lack/2008-08-06/AUDJPY.csv +5 -0
  548. data/test/BackCollectorTest/lack/2008-08-06/USDJPY.csv +5 -0
  549. data/test/BackCollectorTest/lack/2008-08-06/ZARJPY.csv +5 -0
  550. data/test/BackCollectorTest/lack/2008-08-07/AUDJPY.csv +5 -0
  551. data/test/BackCollectorTest/lack/2008-08-07/USDJPY.csv +5 -0
  552. data/test/BackCollectorTest/lack/2008-08-07/ZARJPY.csv +5 -0
  553. data/test/BackCollectorTest/lack/AUDJPY/raw/2008-08-04.csv +5 -0
  554. data/test/BackCollectorTest/lack/AUDJPY/raw/2008-08-06.csv +5 -0
  555. data/test/BackCollectorTest/lack/AUDJPY/raw/2008-08-07.csv +5 -0
  556. data/test/BackCollectorTest/lack/USDJPY/raw/2008-08-04.csv +5 -0
  557. data/test/BackCollectorTest/lack/USDJPY/raw/2008-08-06.csv +5 -0
  558. data/test/BackCollectorTest/lack/USDJPY/raw/2008-08-07.csv +5 -0
  559. data/test/BackCollectorTest/lack/ZARJPY/raw/2008-08-04.csv +5 -0
  560. data/test/BackCollectorTest/lack/ZARJPY/raw/2008-08-06.csv +5 -0
  561. data/test/BackCollectorTest/lack/ZARJPY/raw/2008-08-07.csv +5 -0
  562. data/test/OutputregistryTest/conf/configuration.yaml +3 -0
  563. data/test/ProcessManagerTest/agents/moving_average.rb +95 -0
  564. data/test/ProcessManagerTest/conf/configuration.yaml +6 -0
  565. data/test/ProcessManagerTest/rate_datas/EURJPY/raw/2008-08-21.csv +5853 -0
  566. data/test/ProcessManagerTest/rate_datas/EURJPY/raw/2008-08-22.csv +5821 -0
  567. data/test/ProcessManagerTest/rate_datas/EURJPY/raw/2008-08-23.csv +5921 -0
  568. data/test/ProcessManagerTest/rate_datas/EURJPY/raw/2008-08-24.csv +5956 -0
  569. data/test/ProcessManagerTest/rate_datas/EURJPY/raw/2008-08-25.csv +5796 -0
  570. data/test/ProcessManagerTest/rate_datas/USDJPY/raw/2008-08-21.csv +5853 -0
  571. data/test/ProcessManagerTest/rate_datas/USDJPY/raw/2008-08-22.csv +5821 -0
  572. data/test/ProcessManagerTest/rate_datas/USDJPY/raw/2008-08-23.csv +5921 -0
  573. data/test/ProcessManagerTest/rate_datas/USDJPY/raw/2008-08-24.csv +5956 -0
  574. data/test/ProcessManagerTest/rate_datas/USDJPY/raw/2008-08-25.csv +5796 -0
  575. data/test/ProcessTest/agents/foo.rb +10 -0
  576. data/test/ProcessTest/conf/configuration.yaml +3 -0
  577. data/test/agent/agent_tests.rb +10 -0
  578. data/test/agent/test_AgentManager.rb +321 -0
  579. data/test/agent/test_AgentRegistry.rb +662 -0
  580. data/test/agent/test_PeriodicallyAgent.rb +180 -0
  581. data/test/agent/test_Permitter.rb +217 -0
  582. data/test/all_tests.rb +24 -0
  583. data/test/dao/dao_tests.rb +9 -0
  584. data/test/dao/test_FileSystemDao.rb +431 -0
  585. data/test/dao/test_RateDao.rb +695 -0
  586. data/test/dao/test_TradeResultDao.rb +487 -0
  587. data/test/jiji_plugin.rb +7 -0
  588. data/test/migration/migration_tests.rb +10 -0
  589. data/test/migration/migrator1_0_3test_data/rmt/out/M2NlOTA2ODEtZDdlNi00NWU1LWIwNDQtMjBmODY2ZGNkNzBj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
  590. data/test/migration/migrator1_0_3test_data/rmt/out/NjM5YWFhZmQtNDFjNy00NjUxLWIwYmItNTc3ZjAyZTg5ODA5/56e75YuV5bmz5Z2H57ea/meta.yaml +12 -0
  591. data/test/migration/migrator1_0_3test_data/rmt/out/NjM5YWFhZmQtNDFjNy00NjUxLWIwYmItNTc3ZjAyZTg5ODA5/56e75Yuasdwqdd/meta.yaml +12 -0
  592. data/test/migration/migrator1_1_0test_data/configuration.yaml +11 -0
  593. data/test/migration/migrator1_2_0test_data/basic/out/M2NlOTA2ODEtZDdlNi00NWU1LWIwNDQtMjBmODY2ZGNkNzBj/56e75YuV5bmz5Z2H57ea/1d/2009-04.csv +8 -0
  594. data/test/migration/migrator1_2_0test_data/basic/out/M2NlOTA2ODEtZDdlNi00NWU1LWIwNDQtMjBmODY2ZGNkNzBj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
  595. data/test/migration/migrator1_2_0test_data/basic/out/MDVhYzcxMjYtMGFlMS00Mzk0LWEyNmUtYjVjZjgwNDA0ZmE2/56e75YuV5bmz5Z2H57ea/1d/2009-07.csv +1 -0
  596. data/test/migration/migrator1_2_0test_data/basic/out/MDVhYzcxMjYtMGFlMS00Mzk0LWEyNmUtYjVjZjgwNDA0ZmE2/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
  597. data/test/migration/migrator1_2_0test_data/basic/out/MzA1YTk0NDgtNzhjNi00NDk3LTk2NTktYzE1ZjBhNzdiYjNj/56e75YuV5bmz5Z2H57ea/1d/2009-07.csv +1 -0
  598. data/test/migration/migrator1_2_0test_data/basic/out/MzA1YTk0NDgtNzhjNi00NDk3LTk2NTktYzE1ZjBhNzdiYjNj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
  599. data/test/migration/migrator1_2_0test_data/basic/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/1d/2009-04.csv +10 -0
  600. data/test/migration/migrator1_2_0test_data/basic/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/1d/2009-05.csv +20 -0
  601. data/test/migration/migrator1_2_0test_data/basic/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/1d/2009-06.csv +20 -0
  602. data/test/migration/migrator1_2_0test_data/basic/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/1d/2009-07.csv +18 -0
  603. data/test/migration/migrator1_2_0test_data/basic/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/meta.yaml +9 -0
  604. data/test/migration/migrator1_2_0test_data/basic/props.yaml +85 -0
  605. data/test/migration/migrator1_2_0test_data/illegal_props/out/M2NlOTA2ODEtZDdlNi00NWU1LWIwNDQtMjBmODY2ZGNkNzBj/56e75YuV5bmz5Z2H57ea/1d/2009-04.csv +8 -0
  606. data/test/migration/migrator1_2_0test_data/illegal_props/out/M2NlOTA2ODEtZDdlNi00NWU1LWIwNDQtMjBmODY2ZGNkNzBj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
  607. data/test/migration/migrator1_2_0test_data/illegal_props/out/MDVhYzcxMjYtMGFlMS00Mzk0LWEyNmUtYjVjZjgwNDA0ZmE2/56e75YuV5bmz5Z2H57ea/1d/2009-07.csv +1 -0
  608. data/test/migration/migrator1_2_0test_data/illegal_props/out/MDVhYzcxMjYtMGFlMS00Mzk0LWEyNmUtYjVjZjgwNDA0ZmE2/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
  609. data/test/migration/migrator1_2_0test_data/illegal_props/out/MzA1YTk0NDgtNzhjNi00NDk3LTk2NTktYzE1ZjBhNzdiYjNj/56e75YuV5bmz5Z2H57ea/1d/2009-07.csv +1 -0
  610. data/test/migration/migrator1_2_0test_data/illegal_props/out/MzA1YTk0NDgtNzhjNi00NDk3LTk2NTktYzE1ZjBhNzdiYjNj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
  611. data/test/migration/migrator1_2_0test_data/illegal_props/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/1d/2009-04.csv +10 -0
  612. data/test/migration/migrator1_2_0test_data/illegal_props/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/1d/2009-05.csv +20 -0
  613. data/test/migration/migrator1_2_0test_data/illegal_props/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/1d/2009-06.csv +20 -0
  614. data/test/migration/migrator1_2_0test_data/illegal_props/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/1d/2009-07.csv +18 -0
  615. data/test/migration/migrator1_2_0test_data/illegal_props/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/meta.yaml +9 -0
  616. data/test/migration/migrator1_2_0test_data/illegal_props/props.yaml +1 -0
  617. data/test/migration/migrator1_2_0test_data/no_outs/props.yaml +85 -0
  618. data/test/migration/migrator1_2_0test_data/no_props/out/M2NlOTA2ODEtZDdlNi00NWU1LWIwNDQtMjBmODY2ZGNkNzBj/56e75YuV5bmz5Z2H57ea/1d/2009-04.csv +8 -0
  619. data/test/migration/migrator1_2_0test_data/no_props/out/M2NlOTA2ODEtZDdlNi00NWU1LWIwNDQtMjBmODY2ZGNkNzBj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
  620. data/test/migration/migrator1_2_0test_data/no_props/out/MDVhYzcxMjYtMGFlMS00Mzk0LWEyNmUtYjVjZjgwNDA0ZmE2/56e75YuV5bmz5Z2H57ea/1d/2009-07.csv +1 -0
  621. data/test/migration/migrator1_2_0test_data/no_props/out/MDVhYzcxMjYtMGFlMS00Mzk0LWEyNmUtYjVjZjgwNDA0ZmE2/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
  622. data/test/migration/migrator1_2_0test_data/no_props/out/MzA1YTk0NDgtNzhjNi00NDk3LTk2NTktYzE1ZjBhNzdiYjNj/56e75YuV5bmz5Z2H57ea/1d/2009-07.csv +1 -0
  623. data/test/migration/migrator1_2_0test_data/no_props/out/MzA1YTk0NDgtNzhjNi00NDk3LTk2NTktYzE1ZjBhNzdiYjNj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
  624. data/test/migration/migrator1_2_0test_data/no_props/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/1d/2009-04.csv +10 -0
  625. data/test/migration/migrator1_2_0test_data/no_props/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/1d/2009-05.csv +20 -0
  626. data/test/migration/migrator1_2_0test_data/no_props/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/1d/2009-06.csv +20 -0
  627. data/test/migration/migrator1_2_0test_data/no_props/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/1d/2009-07.csv +18 -0
  628. data/test/migration/migrator1_2_0test_data/no_props/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/meta.yaml +9 -0
  629. data/test/migration/test_Migrator.rb +117 -0
  630. data/test/migration/test_Migrator1_0_3.rb +118 -0
  631. data/test/migration/test_Migrator1_1_0.rb +56 -0
  632. data/test/migration/test_Migrator1_2_0.rb +94 -0
  633. data/test/plugin/embedded/test_SingleClickClient.rb +144 -0
  634. data/test/plugin/error_test/jiji_plugin.rb +2 -0
  635. data/test/plugin/plugin_tests.rb +8 -0
  636. data/test/plugin/test/foo_plugin.rb +1 -0
  637. data/test/plugin/test/jiji_plugin.rb +2 -0
  638. data/test/plugin/test_Loader.rb +33 -0
  639. data/test/plugin/test_gem/a/jiji_plugin_test_gem_a-1.0.0.gem +0 -0
  640. data/test/plugin/test_gem/a/jiji_plugin_test_gem_a.gemspec +10 -0
  641. data/test/plugin/test_gem/a/lib/jiji_plugin.rb +2 -0
  642. data/test/plugin/test_gem/a/lib/jiji_plugin_test.rb +6 -0
  643. data/test/plugin/test_gem/b/jiji_plugin_test_gem_b-1.0.0.gem +0 -0
  644. data/test/plugin/test_gem/b/jiji_plugin_test_gem_b.gemspec +9 -0
  645. data/test/plugin/test_gem/b/lib/jiji_plugin.rb +2 -0
  646. data/test/service/all_service_tests.rb +10 -0
  647. data/test/service/test_AgentService.rb +185 -0
  648. data/test/service/test_OutputService.rb +33 -0
  649. data/test/service/test_RateService.rb +56 -0
  650. data/test/shared/rate.csv +144 -0
  651. data/test/shared/shared_tests.rb +9 -0
  652. data/test/shared/test_Cross.rb +144 -0
  653. data/test/shared/test_PositionManager.rb +285 -0
  654. data/test/shared/test_Signal.rb +65 -0
  655. data/test/test_BackTestCollector.rb +273 -0
  656. data/test/test_Collector.rb +230 -0
  657. data/test/test_Configuration.rb +61 -0
  658. data/test/test_Configuration_a.yaml +6 -0
  659. data/test/test_Operator.rb +501 -0
  660. data/test/test_Output.rb +175 -0
  661. data/test/test_OutputManager.rb +162 -0
  662. data/test/test_Output_registry.rb +42 -0
  663. data/test/test_Process.rb +557 -0
  664. data/test/test_ProcessManager.rb +723 -0
  665. data/test/test_utils.rb +112 -0
  666. data/test/util/test_BlockToSession.rb +121 -0
  667. data/test/util/test_CSV.rb +84 -0
  668. data/test/util/test_SynchronizeInterceptor.rb +76 -0
  669. data/test/util/util_tests.rb +9 -0
  670. metadata +941 -0
@@ -0,0 +1,1205 @@
1
+ //replace tabulation by the good number of white spaces
2
+ EditArea.prototype.replace_tab= function(text){
3
+ return text.replace(/((\n?)([^\t\n]*)\t)/gi, editArea.smartTab); // slower than simple replace...
4
+ };
5
+
6
+ // call by the replace_tab function
7
+ EditArea.prototype.smartTab= function(){
8
+ val=" ";
9
+ return EditArea.prototype.smartTab.arguments[2] + EditArea.prototype.smartTab.arguments[3] + val.substr(0, editArea.tab_nb_char - (EditArea.prototype.smartTab.arguments[3].length)%editArea.tab_nb_char);
10
+ };
11
+
12
+ EditArea.prototype.show_waiting_screen= function(){
13
+ width = this.editor_area.offsetWidth;
14
+ height = this.editor_area.offsetHeight;
15
+ if( !(this.isIE && this.isIE<6) )
16
+ {
17
+ width -= 2;
18
+ height -= 2;
19
+ }
20
+ this.processing_screen.style.display= "block";
21
+ this.processing_screen.style.width = width+"px";
22
+ this.processing_screen.style.height = height+"px";
23
+ this.waiting_screen_displayed = true;
24
+ };
25
+
26
+ EditArea.prototype.hide_waiting_screen= function(){
27
+ this.processing_screen.style.display="none";
28
+ this.waiting_screen_displayed= false;
29
+ };
30
+
31
+ EditArea.prototype.add_style= function(styles){
32
+ if(styles.length>0){
33
+ newcss = document.createElement("style");
34
+ newcss.type="text/css";
35
+ newcss.media="all";
36
+ if(newcss.styleSheet){ // IE
37
+ newcss.styleSheet.cssText = styles;
38
+ } else { // W3C
39
+ newcss.appendChild(document.createTextNode(styles));
40
+ }
41
+ document.getElementsByTagName("head")[0].appendChild(newcss);
42
+ }
43
+ };
44
+
45
+ EditArea.prototype.set_font= function(family, size){
46
+ var t=this, a=this.textarea, s=this.settings, elem_font, i, elem;
47
+ // list all elements concerned by font changes
48
+ var elems= ["textarea", "content_highlight", "cursor_pos", "end_bracket", "selection_field", "selection_field_text", "line_number"];
49
+
50
+ if(family && family!="")
51
+ s["font_family"]= family;
52
+ if(size && size>0)
53
+ s["font_size"] = size;
54
+ if( t.isOpera && t.isOpera < 9.6 ) // opera<9.6 can't manage non monospace font
55
+ s['font_family']="monospace";
56
+
57
+ // update the select tag
58
+ if( elem_font = _$("area_font_size") )
59
+ {
60
+ for( i = 0; i < elem_font.length; i++ )
61
+ {
62
+ if( elem_font.options[i].value && elem_font.options[i].value == s["font_size"] )
63
+ elem_font.options[i].selected=true;
64
+ }
65
+ }
66
+
67
+ /*
68
+ * somethimes firefox has rendering mistake with non-monospace font for text width in textarea vs in div for changing font size (eg: verdana change between 11pt to 12pt)
69
+ * => looks like a browser internal random bug as text width can change while content_highlight is updated
70
+ * we'll check if the font-size produce the same text width inside textarea and div and if not, we'll increment the font-size
71
+ *
72
+ * This is an ugly fix
73
+ */
74
+ if( t.isFirefox )
75
+ {
76
+ var nbTry = 3;
77
+ do {
78
+ var div1 = document.createElement( 'div' ), text1 = document.createElement( 'textarea' );
79
+ var styles = {
80
+ width: '40px',
81
+ overflow: 'scroll',
82
+ zIndex: 50,
83
+ visibility: 'hidden',
84
+ fontFamily: s["font_family"],
85
+ fontSize: s["font_size"]+"pt",
86
+ lineHeight: t.lineHeight+"px",
87
+ padding: '0',
88
+ margin: '0',
89
+ border: 'none',
90
+ whiteSpace: 'nowrap'
91
+ };
92
+ var diff, changed = false;
93
+ for( i in styles )
94
+ {
95
+ div1.style[ i ] = styles[i];
96
+ text1.style[ i ] = styles[i];
97
+ }
98
+ // no wrap for this text
99
+ text1.wrap = 'off';
100
+ text1.setAttribute('wrap', 'off');
101
+ t.container.appendChild( div1 );
102
+ t.container.appendChild( text1 );
103
+ // try to make FF to bug
104
+ div1.innerHTML = text1.value = 'azertyuiopqsdfghjklm';
105
+ div1.innerHTML = text1.value = text1.value+'wxcvbn^p*ù$!:;,,';
106
+ diff = text1.scrollWidth - div1.scrollWidth;
107
+
108
+ // firefox return here a diff of 1 px between equals scrollWidth (can't explain)
109
+ if( Math.abs( diff ) >= 2 )
110
+ {
111
+ s["font_size"]++;
112
+ changed = true;
113
+ }
114
+ t.container.removeChild( div1 );
115
+ t.container.removeChild( text1 );
116
+ nbTry--;
117
+ }while( changed && nbTry > 0 );
118
+ }
119
+
120
+
121
+ // calc line height
122
+ elem = t.test_font_size;
123
+ elem.style.fontFamily = ""+s["font_family"];
124
+ elem.style.fontSize = s["font_size"]+"pt";
125
+ elem.innerHTML = "0";
126
+ t.lineHeight = elem.offsetHeight;
127
+
128
+ // update font for all concerned elements
129
+ for( i=0; i<elems.length; i++)
130
+ {
131
+ elem = _$(elems[i]);
132
+ elem.style.fontFamily = s["font_family"];
133
+ elem.style.fontSize = s["font_size"]+"pt";
134
+ elem.style.lineHeight = t.lineHeight+"px";
135
+ }
136
+ // define a css for <pre> tags
137
+ t.add_style("pre{font-family:"+s["font_family"]+"}");
138
+
139
+ // old opera and IE>=8 doesn't update font changes to the textarea
140
+ if( ( t.isOpera && t.isOpera < 9.6 ) || t.isIE >= 8 )
141
+ {
142
+ var parNod = a.parentNode, nxtSib = a.nextSibling, start= a.selectionStart, end= a.selectionEnd;
143
+ parNod.removeChild(a);
144
+ parNod.insertBefore(a, nxtSib);
145
+ t.area_select(start, end-start);
146
+ }
147
+
148
+ // force update of selection field
149
+ this.focus();
150
+ this.update_size();
151
+ this.check_line_selection();
152
+ };
153
+
154
+ EditArea.prototype.change_font_size= function(){
155
+ var size=_$("area_font_size").value;
156
+ if(size>0)
157
+ this.set_font("", size);
158
+ };
159
+
160
+
161
+ EditArea.prototype.open_inline_popup= function(popup_id){
162
+ this.close_all_inline_popup();
163
+ var popup= _$(popup_id);
164
+ var editor= _$("editor");
165
+
166
+ // search matching icon
167
+ for(var i=0; i<this.inlinePopup.length; i++){
168
+ if(this.inlinePopup[i]["popup_id"]==popup_id){
169
+ var icon= _$(this.inlinePopup[i]["icon_id"]);
170
+ if(icon){
171
+ this.switchClassSticky(icon, 'editAreaButtonSelected', true);
172
+ break;
173
+ }
174
+ }
175
+ }
176
+ // check size
177
+ popup.style.height="auto";
178
+ popup.style.overflow= "visible";
179
+
180
+ if(document.body.offsetHeight< popup.offsetHeight){
181
+ popup.style.height= (document.body.offsetHeight-10)+"px";
182
+ popup.style.overflow= "auto";
183
+ }
184
+
185
+ if(!popup.positionned){
186
+ var new_left= editor.offsetWidth /2 - popup.offsetWidth /2;
187
+ var new_top= editor.offsetHeight /2 - popup.offsetHeight /2;
188
+ //var new_top= area.offsetHeight /2 - popup.offsetHeight /2;
189
+ //var new_left= area.offsetWidth /2 - popup.offsetWidth /2;
190
+ //alert("new_top: ("+new_top+") = calculeOffsetTop(area) ("+calculeOffsetTop(area)+") + area.offsetHeight /2("+ area.offsetHeight /2+") - popup.offsetHeight /2("+popup.offsetHeight /2+") - scrollTop: "+document.body.scrollTop);
191
+ popup.style.left= new_left+"px";
192
+ popup.style.top= new_top+"px";
193
+ popup.positionned=true;
194
+ }
195
+ popup.style.visibility="visible";
196
+
197
+ //popup.style.display="block";
198
+ };
199
+
200
+ EditArea.prototype.close_inline_popup= function(popup_id){
201
+ var popup= _$(popup_id);
202
+ // search matching icon
203
+ for(var i=0; i<this.inlinePopup.length; i++){
204
+ if(this.inlinePopup[i]["popup_id"]==popup_id){
205
+ var icon= _$(this.inlinePopup[i]["icon_id"]);
206
+ if(icon){
207
+ this.switchClassSticky(icon, 'editAreaButtonNormal', false);
208
+ break;
209
+ }
210
+ }
211
+ }
212
+
213
+ popup.style.visibility="hidden";
214
+ };
215
+
216
+ EditArea.prototype.close_all_inline_popup= function(e){
217
+ for(var i=0; i<this.inlinePopup.length; i++){
218
+ this.close_inline_popup(this.inlinePopup[i]["popup_id"]);
219
+ }
220
+ this.textarea.focus();
221
+ };
222
+
223
+ EditArea.prototype.show_help= function(){
224
+
225
+ this.open_inline_popup("edit_area_help");
226
+
227
+ };
228
+
229
+ EditArea.prototype.new_document= function(){
230
+ this.textarea.value="";
231
+ this.area_select(0,0);
232
+ };
233
+
234
+ EditArea.prototype.get_all_toolbar_height= function(){
235
+ var area= _$("editor");
236
+ var results= parent.getChildren(area, "div", "class", "area_toolbar", "all", "0"); // search only direct children
237
+ //results= results.concat(getChildren(area, "table", "class", "area_toolbar", "all", "0"));
238
+ var height=0;
239
+ for(var i=0; i<results.length; i++){
240
+ height+= results[i].offsetHeight;
241
+ }
242
+ //alert("toolbar height: "+height);
243
+ return height;
244
+ };
245
+
246
+ EditArea.prototype.go_to_line= function(line){
247
+ if(!line)
248
+ {
249
+ var icon= _$("go_to_line");
250
+ if(icon != null){
251
+ this.restoreClass(icon);
252
+ this.switchClassSticky(icon, 'editAreaButtonSelected', true);
253
+ }
254
+
255
+ line= prompt(this.get_translation("go_to_line_prompt"));
256
+ if(icon != null)
257
+ this.switchClassSticky(icon, 'editAreaButtonNormal', false);
258
+ }
259
+ if(line && line!=null && line.search(/^[0-9]+$/)!=-1){
260
+ var start=0;
261
+ var lines= this.textarea.value.split("\n");
262
+ if(line > lines.length)
263
+ start= this.textarea.value.length;
264
+ else{
265
+ for(var i=0; i<Math.min(line-1, lines.length); i++)
266
+ start+= lines[i].length + 1;
267
+ }
268
+ this.area_select(start, 0);
269
+ }
270
+
271
+
272
+ };
273
+
274
+
275
+ EditArea.prototype.change_smooth_selection_mode= function(setTo){
276
+ //alert("setTo: "+setTo);
277
+ if(this.do_highlight)
278
+ return;
279
+
280
+ if(setTo != null){
281
+ if(setTo === false)
282
+ this.smooth_selection=true;
283
+ else
284
+ this.smooth_selection=false;
285
+ }
286
+ var icon= _$("change_smooth_selection");
287
+ this.textarea.focus();
288
+ if(this.smooth_selection===true){
289
+ //setAttribute(icon, "class", getAttribute(icon, "class").replace(/ selected/g, "") );
290
+ /*setAttribute(icon, "oldClassName", "editAreaButtonNormal" );
291
+ setAttribute(icon, "className", "editAreaButtonNormal" );*/
292
+ //this.restoreClass(icon);
293
+ //this.restoreAndSwitchClass(icon,'editAreaButtonNormal');
294
+ this.switchClassSticky(icon, 'editAreaButtonNormal', false);
295
+
296
+ this.smooth_selection=false;
297
+ this.selection_field.style.display= "none";
298
+ _$("cursor_pos").style.display= "none";
299
+ _$("end_bracket").style.display= "none";
300
+ }else{
301
+ //setAttribute(icon, "class", getAttribute(icon, "class") + " selected");
302
+ //this.switchClass(icon,'editAreaButtonSelected');
303
+ this.switchClassSticky(icon, 'editAreaButtonSelected', false);
304
+ this.smooth_selection=true;
305
+ this.selection_field.style.display= "block";
306
+ _$("cursor_pos").style.display= "block";
307
+ _$("end_bracket").style.display= "block";
308
+ }
309
+ };
310
+
311
+ // the auto scroll of the textarea has some lacks when it have to show cursor in the visible area when the textarea size change
312
+ // show specifiy whereas it is the "top" or "bottom" of the selection that is showned
313
+ EditArea.prototype.scroll_to_view= function(show){
314
+ var zone, lineElem;
315
+ if(!this.smooth_selection)
316
+ return;
317
+ zone= _$("result");
318
+
319
+ // manage height scroll
320
+ var cursor_pos_top= _$("cursor_pos").cursor_top;
321
+ if(show=="bottom")
322
+ {
323
+ //cursor_pos_top+= (this.last_selection["line_nb"]-1)* this.lineHeight;
324
+ cursor_pos_top+= this.getLinePosTop( this.last_selection['line_start'] + this.last_selection['line_nb'] - 1 );
325
+ }
326
+
327
+ var max_height_visible= zone.clientHeight + zone.scrollTop;
328
+ var miss_top = cursor_pos_top + this.lineHeight - max_height_visible;
329
+ if(miss_top>0){
330
+ //alert(miss_top);
331
+ zone.scrollTop= zone.scrollTop + miss_top;
332
+ }else if( zone.scrollTop > cursor_pos_top){
333
+ // when erase all the content -> does'nt scroll back to the top
334
+ //alert("else: "+cursor_pos_top);
335
+ zone.scrollTop= cursor_pos_top;
336
+ }
337
+
338
+ // manage left scroll
339
+ //var cursor_pos_left= parseInt(_$("cursor_pos").style.left.replace("px",""));
340
+ var cursor_pos_left= _$("cursor_pos").cursor_left;
341
+ var max_width_visible= zone.clientWidth + zone.scrollLeft;
342
+ var miss_left= cursor_pos_left + 10 - max_width_visible;
343
+ if(miss_left>0){
344
+ zone.scrollLeft= zone.scrollLeft + miss_left + 50;
345
+ }else if( zone.scrollLeft > cursor_pos_left){
346
+ zone.scrollLeft= cursor_pos_left ;
347
+ }else if( zone.scrollLeft == 45){
348
+ // show the line numbers if textarea align to it's left
349
+ zone.scrollLeft=0;
350
+ }
351
+ };
352
+
353
+ EditArea.prototype.check_undo= function(only_once){
354
+ if(!editAreas[this.id])
355
+ return false;
356
+ if(this.textareaFocused && editAreas[this.id]["displayed"]==true){
357
+ var text=this.textarea.value;
358
+ if(this.previous.length<=1)
359
+ this.switchClassSticky(_$("undo"), 'editAreaButtonDisabled', true);
360
+
361
+ if(!this.previous[this.previous.length-1] || this.previous[this.previous.length-1]["text"] != text){
362
+ this.previous.push({"text": text, "selStart": this.textarea.selectionStart, "selEnd": this.textarea.selectionEnd});
363
+ if(this.previous.length > this.settings["max_undo"]+1)
364
+ this.previous.shift();
365
+
366
+ }
367
+ if(this.previous.length >= 2)
368
+ this.switchClassSticky(_$("undo"), 'editAreaButtonNormal', false);
369
+ }
370
+
371
+ if(!only_once)
372
+ setTimeout("editArea.check_undo()", 3000);
373
+ };
374
+
375
+ EditArea.prototype.undo= function(){
376
+ //alert("undo"+this.previous.length);
377
+ if(this.previous.length > 0)
378
+ {
379
+ this.getIESelection();
380
+ // var pos_cursor=this.textarea.selectionStart;
381
+ this.next.push( { "text": this.textarea.value, "selStart": this.textarea.selectionStart, "selEnd": this.textarea.selectionEnd } );
382
+ var prev= this.previous.pop();
383
+ if( prev["text"] == this.textarea.value && this.previous.length > 0 )
384
+ prev =this.previous.pop();
385
+ this.textarea.value = prev["text"];
386
+ this.last_undo = prev["text"];
387
+ this.area_select(prev["selStart"], prev["selEnd"]-prev["selStart"]);
388
+ this.switchClassSticky(_$("redo"), 'editAreaButtonNormal', false);
389
+ this.resync_highlight(true);
390
+ //alert("undo"+this.previous.length);
391
+ this.check_file_changes();
392
+ }
393
+ };
394
+
395
+ EditArea.prototype.redo= function(){
396
+ if(this.next.length > 0)
397
+ {
398
+ /*this.getIESelection();*/
399
+ //var pos_cursor=this.textarea.selectionStart;
400
+ var next= this.next.pop();
401
+ this.previous.push(next);
402
+ this.textarea.value= next["text"];
403
+ this.last_undo= next["text"];
404
+ this.area_select(next["selStart"], next["selEnd"]-next["selStart"]);
405
+ this.switchClassSticky(_$("undo"), 'editAreaButtonNormal', false);
406
+ this.resync_highlight(true);
407
+ this.check_file_changes();
408
+ }
409
+ if( this.next.length == 0)
410
+ this.switchClassSticky(_$("redo"), 'editAreaButtonDisabled', true);
411
+ };
412
+
413
+ EditArea.prototype.check_redo= function(){
414
+ if(editArea.next.length == 0 || editArea.textarea.value!=editArea.last_undo){
415
+ editArea.next= []; // undo the ability to use "redo" button
416
+ editArea.switchClassSticky(_$("redo"), 'editAreaButtonDisabled', true);
417
+ }
418
+ else
419
+ {
420
+ this.switchClassSticky(_$("redo"), 'editAreaButtonNormal', false);
421
+ }
422
+ };
423
+
424
+
425
+ // functions that manage icons roll over, disabled, etc...
426
+ EditArea.prototype.switchClass = function(element, class_name, lock_state) {
427
+ var lockChanged = false;
428
+
429
+ if (typeof(lock_state) != "undefined" && element != null) {
430
+ element.classLock = lock_state;
431
+ lockChanged = true;
432
+ }
433
+
434
+ if (element != null && (lockChanged || !element.classLock)) {
435
+ element.oldClassName = element.className;
436
+ element.className = class_name;
437
+ }
438
+ };
439
+
440
+ EditArea.prototype.restoreAndSwitchClass = function(element, class_name) {
441
+ if (element != null && !element.classLock) {
442
+ this.restoreClass(element);
443
+ this.switchClass(element, class_name);
444
+ }
445
+ };
446
+
447
+ EditArea.prototype.restoreClass = function(element) {
448
+ if (element != null && element.oldClassName && !element.classLock) {
449
+ element.className = element.oldClassName;
450
+ element.oldClassName = null;
451
+ }
452
+ };
453
+
454
+ EditArea.prototype.setClassLock = function(element, lock_state) {
455
+ if (element != null)
456
+ element.classLock = lock_state;
457
+ };
458
+
459
+ EditArea.prototype.switchClassSticky = function(element, class_name, lock_state) {
460
+ var lockChanged = false;
461
+ if (typeof(lock_state) != "undefined" && element != null) {
462
+ element.classLock = lock_state;
463
+ lockChanged = true;
464
+ }
465
+
466
+ if (element != null && (lockChanged || !element.classLock)) {
467
+ element.className = class_name;
468
+ element.oldClassName = class_name;
469
+ }
470
+ };
471
+
472
+ //make the "page up" and "page down" buttons works correctly
473
+ EditArea.prototype.scroll_page= function(params){
474
+ var dir= params["dir"], shift_pressed= params["shift"];
475
+ var lines= this.textarea.value.split("\n");
476
+ var new_pos=0, length=0, char_left=0, line_nb=0, curLine=0;
477
+ var toScrollAmount = _$("result").clientHeight -30;
478
+ var nbLineToScroll = 0, diff= 0;
479
+
480
+ if(dir=="up"){
481
+ nbLineToScroll = Math.ceil( toScrollAmount / this.lineHeight );
482
+
483
+ // fix number of line to scroll
484
+ for( i = this.last_selection["line_start"]; i - diff > this.last_selection["line_start"] - nbLineToScroll ; i-- )
485
+ {
486
+ if( elem = _$('line_'+ i) )
487
+ {
488
+ diff += Math.floor( ( elem.offsetHeight - 1 ) / this.lineHeight );
489
+ }
490
+ }
491
+ nbLineToScroll -= diff;
492
+
493
+ if(this.last_selection["selec_direction"]=="up"){
494
+ for(line_nb=0; line_nb< Math.min(this.last_selection["line_start"]-nbLineToScroll, lines.length); line_nb++){
495
+ new_pos+= lines[line_nb].length + 1;
496
+ }
497
+ char_left=Math.min(lines[Math.min(lines.length-1, line_nb)].length, this.last_selection["curr_pos"]-1);
498
+ if(shift_pressed)
499
+ length=this.last_selection["selectionEnd"]-new_pos-char_left;
500
+ this.area_select(new_pos+char_left, length);
501
+ view="top";
502
+ }else{
503
+ view="bottom";
504
+ for(line_nb=0; line_nb< Math.min(this.last_selection["line_start"]+this.last_selection["line_nb"]-1-nbLineToScroll, lines.length); line_nb++){
505
+ new_pos+= lines[line_nb].length + 1;
506
+ }
507
+ char_left=Math.min(lines[Math.min(lines.length-1, line_nb)].length, this.last_selection["curr_pos"]-1);
508
+ if(shift_pressed){
509
+ //length=this.last_selection["selectionEnd"]-new_pos-char_left;
510
+ start= Math.min(this.last_selection["selectionStart"], new_pos+char_left);
511
+ length= Math.max(new_pos+char_left, this.last_selection["selectionStart"] )- start ;
512
+ if(new_pos+char_left < this.last_selection["selectionStart"])
513
+ view="top";
514
+ }else
515
+ start=new_pos+char_left;
516
+ this.area_select(start, length);
517
+
518
+ }
519
+ }
520
+ else
521
+ {
522
+ var nbLineToScroll= Math.floor( toScrollAmount / this.lineHeight );
523
+ // fix number of line to scroll
524
+ for( i = this.last_selection["line_start"]; i + diff < this.last_selection["line_start"] + nbLineToScroll ; i++ )
525
+ {
526
+ if( elem = _$('line_'+ i) )
527
+ {
528
+ diff += Math.floor( ( elem.offsetHeight - 1 ) / this.lineHeight );
529
+ }
530
+ }
531
+ nbLineToScroll -= diff;
532
+
533
+ if(this.last_selection["selec_direction"]=="down"){
534
+ view="bottom";
535
+ for(line_nb=0; line_nb< Math.min(this.last_selection["line_start"]+this.last_selection["line_nb"]-2+nbLineToScroll, lines.length); line_nb++){
536
+ if(line_nb==this.last_selection["line_start"]-1)
537
+ char_left= this.last_selection["selectionStart"] -new_pos;
538
+ new_pos+= lines[line_nb].length + 1;
539
+
540
+ }
541
+ if(shift_pressed){
542
+ length=Math.abs(this.last_selection["selectionStart"]-new_pos);
543
+ length+=Math.min(lines[Math.min(lines.length-1, line_nb)].length, this.last_selection["curr_pos"]);
544
+ //length+=Math.min(lines[Math.min(lines.length-1, line_nb)].length, char_left);
545
+ this.area_select(Math.min(this.last_selection["selectionStart"], new_pos), length);
546
+ }else{
547
+ this.area_select(new_pos+char_left, 0);
548
+ }
549
+
550
+ }else{
551
+ view="top";
552
+ for(line_nb=0; line_nb< Math.min(this.last_selection["line_start"]+nbLineToScroll-1, lines.length, lines.length); line_nb++){
553
+ if(line_nb==this.last_selection["line_start"]-1)
554
+ char_left= this.last_selection["selectionStart"] -new_pos;
555
+ new_pos+= lines[line_nb].length + 1;
556
+ }
557
+ if(shift_pressed){
558
+ length=Math.abs(this.last_selection["selectionEnd"]-new_pos-char_left);
559
+ length+=Math.min(lines[Math.min(lines.length-1, line_nb)].length, this.last_selection["curr_pos"])- char_left-1;
560
+ //length+=Math.min(lines[Math.min(lines.length-1, line_nb)].length, char_left);
561
+ this.area_select(Math.min(this.last_selection["selectionEnd"], new_pos+char_left), length);
562
+ if(new_pos+char_left > this.last_selection["selectionEnd"])
563
+ view="bottom";
564
+ }else{
565
+ this.area_select(new_pos+char_left, 0);
566
+ }
567
+
568
+ }
569
+ }
570
+ //console.log( new_pos, char_left, length, nbLineToScroll, toScrollAmount, _$("result").clientHeigh );
571
+ this.check_line_selection();
572
+ this.scroll_to_view(view);
573
+ };
574
+
575
+ EditArea.prototype.start_resize= function(e){
576
+ parent.editAreaLoader.resize["id"] = editArea.id;
577
+ parent.editAreaLoader.resize["start_x"] = (e)? e.pageX : event.x + document.body.scrollLeft;
578
+ parent.editAreaLoader.resize["start_y"] = (e)? e.pageY : event.y + document.body.scrollTop;
579
+ if(editArea.isIE)
580
+ {
581
+ editArea.textarea.focus();
582
+ editArea.getIESelection();
583
+ }
584
+ parent.editAreaLoader.resize["selectionStart"] = editArea.textarea.selectionStart;
585
+ parent.editAreaLoader.resize["selectionEnd"] = editArea.textarea.selectionEnd;
586
+ parent.editAreaLoader.start_resize_area();
587
+ };
588
+
589
+ EditArea.prototype.toggle_full_screen= function(to){
590
+ var t=this, p=parent, a=t.textarea, html, frame, selStart, selEnd, old, icon;
591
+ if(typeof(to)=="undefined")
592
+ to= !t.fullscreen['isFull'];
593
+ old = t.fullscreen['isFull'];
594
+ t.fullscreen['isFull']= to;
595
+ icon = _$("fullscreen");
596
+ selStart = t.textarea.selectionStart;
597
+ selEnd = t.textarea.selectionEnd;
598
+ html = p.document.getElementsByTagName("html")[0];
599
+ frame = p.document.getElementById("frame_"+t.id);
600
+
601
+ if(to && to!=old)
602
+ { // toogle on fullscreen
603
+
604
+ t.fullscreen['old_overflow'] = p.get_css_property(html, "overflow");
605
+ t.fullscreen['old_height'] = p.get_css_property(html, "height");
606
+ t.fullscreen['old_width'] = p.get_css_property(html, "width");
607
+ t.fullscreen['old_scrollTop'] = html.scrollTop;
608
+ t.fullscreen['old_scrollLeft'] = html.scrollLeft;
609
+ t.fullscreen['old_zIndex'] = p.get_css_property(frame, "z-index");
610
+ if(t.isOpera){
611
+ html.style.height = "100%";
612
+ html.style.width = "100%";
613
+ }
614
+ html.style.overflow = "hidden";
615
+ html.scrollTop = 0;
616
+ html.scrollLeft = 0;
617
+
618
+ frame.style.position = "absolute";
619
+ frame.style.width = html.clientWidth+"px";
620
+ frame.style.height = html.clientHeight+"px";
621
+ frame.style.display = "block";
622
+ frame.style.zIndex = "999999";
623
+ frame.style.top = "0px";
624
+ frame.style.left = "0px";
625
+
626
+ // if the iframe was in a div with position absolute, the top and left are the one of the div,
627
+ // so I fix it by seeing at witch position the iframe start and correcting it
628
+ frame.style.top = "-"+p.calculeOffsetTop(frame)+"px";
629
+ frame.style.left = "-"+p.calculeOffsetLeft(frame)+"px";
630
+
631
+ // parent.editAreaLoader.execCommand(t.id, "update_size();");
632
+ // var body=parent.document.getElementsByTagName("body")[0];
633
+ // body.appendChild(frame);
634
+
635
+ t.switchClassSticky(icon, 'editAreaButtonSelected', false);
636
+ t.fullscreen['allow_resize']= t.resize_allowed;
637
+ t.allow_resize(false);
638
+
639
+ //t.area_select(selStart, selEnd-selStart);
640
+
641
+
642
+ // opera can't manage to do a direct size update
643
+ if(t.isFirefox){
644
+ p.editAreaLoader.execCommand(t.id, "update_size();");
645
+ t.area_select(selStart, selEnd-selStart);
646
+ t.scroll_to_view();
647
+ t.focus();
648
+ }else{
649
+ p.editAreaLoader.execCommand(t.id, "update_size();");
650
+ setTimeout("editArea.focus();", 10);
651
+ //setTimeout("p.editAreaLoader.execCommand('"+ t.id +"', 'update_size();');editArea.focus();", 10);
652
+ }
653
+
654
+
655
+ }
656
+ else if(to!=old)
657
+ { // toogle off fullscreen
658
+ frame.style.position="static";
659
+ frame.style.zIndex= t.fullscreen['old_zIndex'];
660
+
661
+ if(t.isOpera)
662
+ {
663
+ html.style.height = "auto";
664
+ html.style.width = "auto";
665
+ html.style.overflow = "auto";
666
+ }
667
+ else if(t.isIE && p!=top)
668
+ { // IE doesn't manage html overflow in frames like in normal page...
669
+ html.style.overflow = "auto";
670
+ }
671
+ else
672
+ {
673
+ html.style.overflow = t.fullscreen['old_overflow'];
674
+ }
675
+ html.scrollTop = t.fullscreen['old_scrollTop'];
676
+ html.scrollLeft = t.fullscreen['old_scrollLeft'];
677
+
678
+ p.editAreaLoader.hide(t.id);
679
+ p.editAreaLoader.show(t.id);
680
+
681
+ t.switchClassSticky(icon, 'editAreaButtonNormal', false);
682
+ if(t.fullscreen['allow_resize'])
683
+ t.allow_resize(t.fullscreen['allow_resize']);
684
+ if(t.isFirefox){
685
+ t.area_select(selStart, selEnd-selStart);
686
+ setTimeout("editArea.scroll_to_view();", 10);
687
+ }
688
+
689
+ //p.editAreaLoader.remove_event(p.window, "resize", editArea.update_size);
690
+ }
691
+
692
+ };
693
+
694
+ EditArea.prototype.allow_resize= function(allow){
695
+ var resize= _$("resize_area");
696
+ if(allow){
697
+
698
+ resize.style.visibility="visible";
699
+ parent.editAreaLoader.add_event(resize, "mouseup", editArea.start_resize);
700
+ }else{
701
+ resize.style.visibility="hidden";
702
+ parent.editAreaLoader.remove_event(resize, "mouseup", editArea.start_resize);
703
+ }
704
+ this.resize_allowed= allow;
705
+ };
706
+
707
+
708
+ EditArea.prototype.change_syntax= function(new_syntax, is_waiting){
709
+ // alert("cahnge to "+new_syntax);
710
+ // the syntax is the same
711
+ if(new_syntax==this.settings['syntax'])
712
+ return true;
713
+
714
+ // check that the syntax is one allowed
715
+ var founded= false;
716
+ for(var i=0; i<this.syntax_list.length; i++)
717
+ {
718
+ if(this.syntax_list[i]==new_syntax)
719
+ founded= true;
720
+ }
721
+
722
+ if(founded==true)
723
+ {
724
+ // the reg syntax file is not loaded
725
+ if(!parent.editAreaLoader.load_syntax[new_syntax])
726
+ {
727
+ // load the syntax file and wait for file loading
728
+ if(!is_waiting)
729
+ parent.editAreaLoader.load_script(parent.editAreaLoader.baseURL + "reg_syntax/" + new_syntax + ".js");
730
+ setTimeout("editArea.change_syntax('"+ new_syntax +"', true);", 100);
731
+ this.show_waiting_screen();
732
+ }
733
+ else
734
+ {
735
+ if(!this.allready_used_syntax[new_syntax])
736
+ { // the syntax has still not been used
737
+ // rebuild syntax definition for new languages
738
+ parent.editAreaLoader.init_syntax_regexp();
739
+ // add style to the new list
740
+ this.add_style(parent.editAreaLoader.syntax[new_syntax]["styles"]);
741
+ this.allready_used_syntax[new_syntax]=true;
742
+ }
743
+ // be sure that the select option is correctly updated
744
+ var sel= _$("syntax_selection");
745
+ if(sel && sel.value!=new_syntax)
746
+ {
747
+ for(var i=0; i<sel.length; i++){
748
+ if(sel.options[i].value && sel.options[i].value == new_syntax)
749
+ sel.options[i].selected=true;
750
+ }
751
+ }
752
+
753
+ /* if(this.settings['syntax'].length==0)
754
+ {
755
+ this.switchClassSticky(_$("highlight"), 'editAreaButtonNormal', false);
756
+ this.switchClassSticky(_$("reset_highlight"), 'editAreaButtonNormal', false);
757
+ this.change_highlight(true);
758
+ }
759
+ */
760
+ this.settings['syntax']= new_syntax;
761
+ this.resync_highlight(true);
762
+ this.hide_waiting_screen();
763
+ return true;
764
+ }
765
+ }
766
+ return false;
767
+ };
768
+
769
+
770
+ // check if the file has changed
771
+ EditArea.prototype.set_editable= function(is_editable){
772
+ if(is_editable)
773
+ {
774
+ document.body.className= "";
775
+ this.textarea.readOnly= false;
776
+ this.is_editable= true;
777
+ }
778
+ else
779
+ {
780
+ document.body.className= "non_editable";
781
+ this.textarea.readOnly= true;
782
+ this.is_editable= false;
783
+ }
784
+
785
+ if(editAreas[this.id]["displayed"]==true)
786
+ this.update_size();
787
+ };
788
+
789
+ /***** Wrap mode *****/
790
+
791
+ // toggling function for set_wrap_mode
792
+ EditArea.prototype.toggle_word_wrap= function(){
793
+ this.set_word_wrap( !this.settings['word_wrap'] );
794
+ };
795
+
796
+
797
+ // open a new tab for the given file
798
+ EditArea.prototype.set_word_wrap= function(to){
799
+ var t=this, a= t.textarea;
800
+
801
+ if( t.isOpera )
802
+ {
803
+ this.settings['word_wrap']= false;
804
+ t.switchClassSticky( _$("word_wrap"), 'editAreaButtonDisabled', true );
805
+ return false;
806
+ }
807
+
808
+ if( to )
809
+ {
810
+ wrap_mode = 'soft';
811
+ this.container.className+= ' word_wrap';
812
+ this.container.style.width="";
813
+ this.content_highlight.style.width="";
814
+ a.style.width="100%";
815
+ if( t.isIE && t.isIE < 7 ) // IE 6 count 50 px too much
816
+ {
817
+ a.style.width = ( a.offsetWidth-5 )+"px";
818
+ }
819
+
820
+ t.switchClassSticky( _$("word_wrap"), 'editAreaButtonSelected', false );
821
+ }
822
+ else
823
+ {
824
+ wrap_mode = 'off';
825
+ this.container.className = this.container.className.replace(/word_wrap/g, '');
826
+ t.switchClassSticky( _$("word_wrap"), 'editAreaButtonNormal', true );
827
+ }
828
+ this.textarea.previous_scrollWidth = '';
829
+ this.textarea.previous_scrollHeight = '';
830
+
831
+ a.wrap= wrap_mode;
832
+ a.setAttribute('wrap', wrap_mode);
833
+ // only IE can change wrap mode on the fly without element reloading
834
+ if(!this.isIE)
835
+ {
836
+ var start=a.selectionStart, end= a.selectionEnd;
837
+ var parNod = a.parentNode, nxtSib = a.nextSibling;
838
+ parNod.removeChild(a);
839
+ parNod.insertBefore(a, nxtSib);
840
+ this.area_select(start, end-start);
841
+ }
842
+ // reset some optimisation
843
+ this.settings['word_wrap'] = to;
844
+ this.focus();
845
+ this.update_size();
846
+ this.check_line_selection();
847
+ };
848
+ /***** tabbed files managing functions *****/
849
+
850
+ // open a new tab for the given file
851
+ EditArea.prototype.open_file= function(settings){
852
+
853
+ if(settings['id']!="undefined")
854
+ {
855
+ var id= settings['id'];
856
+ // create a new file object with defautl values
857
+ var new_file= {};
858
+ new_file['id'] = id;
859
+ new_file['title'] = id;
860
+ new_file['text'] = "";
861
+ new_file['last_selection'] = "";
862
+ new_file['last_text_to_highlight'] = "";
863
+ new_file['last_hightlighted_text'] = "";
864
+ new_file['previous'] = [];
865
+ new_file['next'] = [];
866
+ new_file['last_undo'] = "";
867
+ new_file['smooth_selection'] = this.settings['smooth_selection'];
868
+ new_file['do_highlight']= this.settings['start_highlight'];
869
+ new_file['syntax'] = this.settings['syntax'];
870
+ new_file['scroll_top'] = 0;
871
+ new_file['scroll_left'] = 0;
872
+ new_file['selection_start']= 0;
873
+ new_file['selection_end']= 0;
874
+ new_file['edited'] = false;
875
+ new_file['font_size'] = this.settings["font_size"];
876
+ new_file['font_family'] = this.settings["font_family"];
877
+ new_file['word_wrap'] = this.settings["word_wrap"];
878
+ new_file['toolbar'] = {'links':{}, 'selects': {}};
879
+ new_file['compare_edited_text']= new_file['text'];
880
+
881
+
882
+ this.files[id]= new_file;
883
+ this.update_file(id, settings);
884
+ this.files[id]['compare_edited_text']= this.files[id]['text'];
885
+
886
+
887
+ var html_id= 'tab_file_'+encodeURIComponent(id);
888
+ this.filesIdAssoc[html_id]= id;
889
+ this.files[id]['html_id']= html_id;
890
+
891
+ if(!_$(this.files[id]['html_id']) && id!="")
892
+ {
893
+ // be sure the tab browsing area is displayed
894
+ this.tab_browsing_area.style.display= "block";
895
+ var elem= document.createElement('li');
896
+ elem.id= this.files[id]['html_id'];
897
+ var close= "<img src=\""+ parent.editAreaLoader.baseURL +"images/close.gif\" title=\""+ this.get_translation('close_tab', 'word') +"\" onclick=\"editArea.execCommand('close_file', editArea.filesIdAssoc['"+ html_id +"']);return false;\" class=\"hidden\" onmouseover=\"this.className=''\" onmouseout=\"this.className='hidden'\" />";
898
+ elem.innerHTML= "<a onclick=\"javascript:editArea.execCommand('switch_to_file', editArea.filesIdAssoc['"+ html_id +"']);\" selec=\"none\"><b><span><strong class=\"edited\">*</strong>"+ this.files[id]['title'] + close +"</span></b></a>";
899
+ _$('tab_browsing_list').appendChild(elem);
900
+ var elem= document.createElement('text');
901
+ this.update_size();
902
+ }
903
+
904
+ // open file callback (for plugin)
905
+ if(id!="")
906
+ this.execCommand('file_open', this.files[id]);
907
+
908
+ this.switch_to_file(id, true);
909
+ return true;
910
+ }
911
+ else
912
+ return false;
913
+ };
914
+
915
+ // close the given file
916
+ EditArea.prototype.close_file= function(id){
917
+ if(this.files[id])
918
+ {
919
+ this.save_file(id);
920
+
921
+ // close file callback
922
+ if(this.execCommand('file_close', this.files[id])!==false)
923
+ {
924
+ // remove the tab in the toolbar
925
+ var li= _$(this.files[id]['html_id']);
926
+ li.parentNode.removeChild(li);
927
+ // select a new file
928
+ if(id== this.curr_file)
929
+ {
930
+ var next_file= "";
931
+ var is_next= false;
932
+ for(var i in this.files)
933
+ {
934
+ if( is_next )
935
+ {
936
+ next_file = i;
937
+ break;
938
+ }
939
+ else if( i == id )
940
+ is_next = true;
941
+ else
942
+ next_file = i;
943
+ }
944
+ // display the next file
945
+ this.switch_to_file(next_file);
946
+ }
947
+ // clear datas
948
+ delete (this.files[id]);
949
+ this.update_size();
950
+ }
951
+ }
952
+ };
953
+
954
+ // backup current file datas
955
+ EditArea.prototype.save_file= function(id){
956
+ var t= this, save, a_links, a_selects, save_butt, img, i;
957
+ if(t.files[id])
958
+ {
959
+ var save= t.files[id];
960
+ save['last_selection'] = t.last_selection;
961
+ save['last_text_to_highlight'] = t.last_text_to_highlight;
962
+ save['last_hightlighted_text'] = t.last_hightlighted_text;
963
+ save['previous'] = t.previous;
964
+ save['next'] = t.next;
965
+ save['last_undo'] = t.last_undo;
966
+ save['smooth_selection'] = t.smooth_selection;
967
+ save['do_highlight'] = t.do_highlight;
968
+ save['syntax'] = t.settings['syntax'];
969
+ save['text'] = t.textarea.value;
970
+ save['scroll_top'] = t.result.scrollTop;
971
+ save['scroll_left'] = t.result.scrollLeft;
972
+ save['selection_start'] = t.last_selection["selectionStart"];
973
+ save['selection_end'] = t.last_selection["selectionEnd"];
974
+ save['font_size'] = t.settings["font_size"];
975
+ save['font_family'] = t.settings["font_family"];
976
+ save['word_wrap'] = t.settings["word_wrap"];
977
+ save['toolbar'] = {'links':{}, 'selects': {}};
978
+
979
+ // save toolbar buttons state for fileSpecific buttons
980
+ a_links= _$("toolbar_1").getElementsByTagName("a");
981
+ for( i=0; i<a_links.length; i++ )
982
+ {
983
+ if( a_links[i].getAttribute('fileSpecific') == 'yes' )
984
+ {
985
+ save_butt = {};
986
+ img = a_links[i].getElementsByTagName('img')[0];
987
+ save_butt['classLock'] = img.classLock;
988
+ save_butt['className'] = img.className;
989
+ save_butt['oldClassName'] = img.oldClassName;
990
+
991
+ save['toolbar']['links'][a_links[i].id]= save_butt;
992
+ }
993
+ }
994
+
995
+ // save toolbar select state for fileSpecific buttons
996
+ a_selects= _$("toolbar_1").getElementsByTagName("select");
997
+ for( i=0; i<a_selects.length; i++)
998
+ {
999
+ if(a_selects[i].getAttribute('fileSpecific')=='yes')
1000
+ {
1001
+ save['toolbar']['selects'][a_selects[i].id]= a_selects[i].value;
1002
+ }
1003
+ }
1004
+
1005
+ t.files[id]= save;
1006
+
1007
+ return save;
1008
+ }
1009
+
1010
+ return false;
1011
+ };
1012
+
1013
+ // update file_datas
1014
+ EditArea.prototype.update_file= function(id, new_values){
1015
+ for(var i in new_values)
1016
+ {
1017
+ this.files[id][i]= new_values[i];
1018
+ }
1019
+ };
1020
+
1021
+ // display file datas
1022
+ EditArea.prototype.display_file= function(id){
1023
+ var t = this, a= t.textarea, new_file, a_lis, a_selects, a_links, a_options, i, j;
1024
+
1025
+ // we're showing the empty file
1026
+ if(id=='')
1027
+ {
1028
+ a.readOnly= true;
1029
+ t.tab_browsing_area.style.display= "none";
1030
+ _$("no_file_selected").style.display= "block";
1031
+ t.result.className= "empty";
1032
+ // clear current datas
1033
+ if(!t.files[''])
1034
+ {
1035
+ t.open_file({id: ''});
1036
+ }
1037
+ }
1038
+ // we try to show a non existent file, so we left
1039
+ else if( typeof( t.files[id] ) == 'undefined' )
1040
+ {
1041
+ return false;
1042
+ }
1043
+ // display a normal file
1044
+ else
1045
+ {
1046
+ t.result.className= "";
1047
+ a.readOnly= !t.is_editable;
1048
+ _$("no_file_selected").style.display= "none";
1049
+ t.tab_browsing_area.style.display= "block";
1050
+ }
1051
+
1052
+ // ensure to have last state for undo/redo actions
1053
+ t.check_redo(true);
1054
+ t.check_undo(true);
1055
+ t.curr_file= id;
1056
+
1057
+ // replace selected tab file
1058
+ a_lis= t.tab_browsing_area.getElementsByTagName('li');
1059
+ for( i=0; i<a_lis.length; i++)
1060
+ {
1061
+ if(a_lis[i].id == t.files[id]['html_id'])
1062
+ a_lis[i].className='selected';
1063
+ else
1064
+ a_lis[i].className='';
1065
+ }
1066
+
1067
+ // replace next files datas
1068
+ new_file= t.files[id];
1069
+
1070
+ // restore text content
1071
+ a.value= new_file['text'];
1072
+
1073
+ // restore font-size
1074
+ t.set_font(new_file['font_family'], new_file['font_size']);
1075
+
1076
+ // restore selection and scroll
1077
+ t.area_select(new_file['last_selection']['selection_start'], new_file['last_selection']['selection_end'] - new_file['last_selection']['selection_start']);
1078
+ t.manage_size(true);
1079
+ t.result.scrollTop= new_file['scroll_top'];
1080
+ t.result.scrollLeft= new_file['scroll_left'];
1081
+
1082
+ // restore undo, redo
1083
+ t.previous= new_file['previous'];
1084
+ t.next= new_file['next'];
1085
+ t.last_undo= new_file['last_undo'];
1086
+ t.check_redo(true);
1087
+ t.check_undo(true);
1088
+
1089
+ // restore highlight
1090
+ t.execCommand("change_highlight", new_file['do_highlight']);
1091
+ t.execCommand("change_syntax", new_file['syntax']);
1092
+
1093
+ // smooth mode
1094
+ t.execCommand("change_smooth_selection_mode", new_file['smooth_selection']);
1095
+
1096
+ // word_wrap
1097
+ t.execCommand("set_word_wrap", new_file['word_wrap']);
1098
+
1099
+ // restore links state in toolbar
1100
+ a_links= new_file['toolbar']['links'];
1101
+ for( i in a_links)
1102
+ {
1103
+ if( img = _$(i).getElementsByTagName('img')[0] )
1104
+ {
1105
+ img.classLock = a_links[i]['classLock'];
1106
+ img.className = a_links[i]['className'];
1107
+ img.oldClassName= a_links[i]['oldClassName'];
1108
+ }
1109
+ }
1110
+
1111
+ // restore select state in toolbar
1112
+ a_selects = new_file['toolbar']['selects'];
1113
+ for( i in a_selects)
1114
+ {
1115
+ a_options = _$(i).options;
1116
+ for( j=0; j<a_options.length; j++)
1117
+ {
1118
+ if( a_options[j].value == a_selects[i] )
1119
+ _$(i).options[j].selected=true;
1120
+ }
1121
+ }
1122
+
1123
+ };
1124
+
1125
+ // change tab for displaying a new one
1126
+ EditArea.prototype.switch_to_file= function(file_to_show, force_refresh){
1127
+ if(file_to_show!=this.curr_file || force_refresh)
1128
+ {
1129
+ this.save_file(this.curr_file);
1130
+ if(this.curr_file!='')
1131
+ this.execCommand('file_switch_off', this.files[this.curr_file]);
1132
+ this.display_file(file_to_show);
1133
+ if(file_to_show!='')
1134
+ this.execCommand('file_switch_on', this.files[file_to_show]);
1135
+ }
1136
+ };
1137
+
1138
+ // get all infos for the given file
1139
+ EditArea.prototype.get_file= function(id){
1140
+ if(id==this.curr_file)
1141
+ this.save_file(id);
1142
+ return this.files[id];
1143
+ };
1144
+
1145
+ // get all available files infos
1146
+ EditArea.prototype.get_all_files= function(){
1147
+ tmp_files= this.files;
1148
+ this.save_file(this.curr_file);
1149
+ if(tmp_files[''])
1150
+ delete(this.files['']);
1151
+ return tmp_files;
1152
+ };
1153
+
1154
+
1155
+ // check if the file has changed
1156
+ EditArea.prototype.check_file_changes= function(){
1157
+
1158
+ var id= this.curr_file;
1159
+ if(this.files[id] && this.files[id]['compare_edited_text']!=undefined)
1160
+ {
1161
+ if(this.files[id]['compare_edited_text'].length==this.textarea.value.length && this.files[id]['compare_edited_text']==this.textarea.value)
1162
+ {
1163
+ if(this.files[id]['edited']!= false)
1164
+ this.set_file_edited_mode(id, false);
1165
+ }
1166
+ else
1167
+ {
1168
+ if(this.files[id]['edited']!= true)
1169
+ this.set_file_edited_mode(id, true);
1170
+ }
1171
+ }
1172
+ };
1173
+
1174
+ // set if the file is edited or not
1175
+ EditArea.prototype.set_file_edited_mode= function(id, to){
1176
+ // change CSS for edited tab
1177
+ if(this.files[id] && _$(this.files[id]['html_id']))
1178
+ {
1179
+ var link= _$(this.files[id]['html_id']).getElementsByTagName('a')[0];
1180
+ if(to==true)
1181
+ {
1182
+ link.className= 'edited';
1183
+ }
1184
+ else
1185
+ {
1186
+ link.className= '';
1187
+ if(id==this.curr_file)
1188
+ text= this.textarea.value;
1189
+ else
1190
+ text= this.files[id]['text'];
1191
+ this.files[id]['compare_edited_text']= text;
1192
+ }
1193
+
1194
+ this.files[id]['edited']= to;
1195
+ }
1196
+ };
1197
+
1198
+ EditArea.prototype.set_show_line_colors = function(new_value){
1199
+ this.show_line_colors = new_value;
1200
+
1201
+ if( new_value )
1202
+ this.selection_field.className += ' show_colors';
1203
+ else
1204
+ this.selection_field.className = this.selection_field.className.replace( / show_colors/g, '' );
1205
+ };