unageanu-jiji 1.1.4 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (233) hide show
  1. data/ChangeLog +24 -1
  2. data/README +0 -0
  3. data/base/shared_lib/moving_average.rb +34 -33
  4. data/base/shared_lib/system/cross.rb +76 -0
  5. data/base/shared_lib/system/position_manager.rb +160 -0
  6. data/base/shared_lib/system/signal.rb +347 -0
  7. data/html/css/datatable.css +4 -4
  8. data/html/css/default.css +57 -5
  9. data/html/css/treeview.css +205 -0
  10. data/html/img/bin_closed.png +0 -0
  11. data/html/img/bin_empty.png +0 -0
  12. data/html/img/button_add_small.gif +0 -0
  13. data/html/img/button_add_small_gray.gif +0 -0
  14. data/html/img/button_add_small_over.gif +0 -0
  15. data/html/img/button_mkcol.gif +0 -0
  16. data/html/img/button_mkcol_gray.gif +0 -0
  17. data/html/img/button_mkcol_over.gif +0 -0
  18. data/html/img/button_remove_small.gif +0 -0
  19. data/html/img/button_remove_small_gray.gif +0 -0
  20. data/html/img/button_remove_small_over.gif +0 -0
  21. data/html/img/button_rename.gif +0 -0
  22. data/html/img/button_rename_gray.gif +0 -0
  23. data/html/img/button_rename_over.gif +0 -0
  24. data/html/img/control_play.png +0 -0
  25. data/html/img/control_play_blue.png +0 -0
  26. data/html/img/folder.png +0 -0
  27. data/html/img/folder_brick.png +0 -0
  28. data/html/img/folder_user.png +0 -0
  29. data/html/{js/codepress/images → img}/line-numbers.png +0 -0
  30. data/html/img/page_white_ruby.png +0 -0
  31. data/html/img/sidebar_agent_edit.png +0 -0
  32. data/html/img/sidebar_agent_edit_over.png +0 -0
  33. data/html/img/sidebar_agent_edit_s.png +0 -0
  34. data/html/img/yui/treeview-sprite.gif +0 -0
  35. data/html/index.html +34 -18
  36. data/html/js/agent-editor/agent-editor-page.js +324 -0
  37. data/html/js/agent-editor/agent-editor.js +363 -0
  38. data/html/js/agent-editor/agent-list-tree.js +251 -0
  39. data/html/js/agent-selector.js +23 -28
  40. data/html/js/app.js +63 -91
  41. data/html/js/bt-create-page.js +25 -19
  42. data/html/js/container-min.js +1 -1
  43. data/html/js/container.js +944 -0
  44. data/html/js/edit_area/autocompletion.js +11 -13
  45. data/html/js/edit_area/edit_area.css +79 -40
  46. data/html/js/edit_area/edit_area.js +255 -226
  47. data/html/js/edit_area/edit_area_compressor.php +4 -4
  48. data/html/js/edit_area/edit_area_full.gz +0 -0
  49. data/html/js/edit_area/edit_area_full.js +31 -31
  50. data/html/js/edit_area/edit_area_full_with_plugins.gz +0 -0
  51. data/html/js/edit_area/edit_area_full_with_plugins.js +31 -31
  52. data/html/js/edit_area/edit_area_functions.js +448 -341
  53. data/html/js/edit_area/edit_area_loader.js +409 -397
  54. data/html/js/edit_area/elements_functions.js +120 -123
  55. data/html/js/edit_area/highlight.js +305 -197
  56. data/html/js/edit_area/images/goto.png +0 -0
  57. data/html/js/edit_area/images/help.png +0 -0
  58. data/html/js/edit_area/images/redo.png +0 -0
  59. data/html/js/edit_area/images/save.png +0 -0
  60. data/html/js/edit_area/images/search.png +0 -0
  61. data/html/js/edit_area/images/undo.png +0 -0
  62. data/html/js/edit_area/images/word_wrap.gif +0 -0
  63. data/html/js/edit_area/keyboard.js +5 -5
  64. data/html/js/edit_area/langs/bg.js +73 -0
  65. data/html/js/edit_area/langs/cs.js +2 -0
  66. data/html/js/edit_area/langs/de.js +2 -0
  67. data/html/js/edit_area/langs/dk.js +2 -0
  68. data/html/js/edit_area/langs/en.js +2 -0
  69. data/html/js/edit_area/langs/eo.js +2 -0
  70. data/html/js/edit_area/langs/es.js +2 -0
  71. data/html/js/edit_area/langs/fi.js +67 -0
  72. data/html/js/edit_area/langs/fr.js +2 -0
  73. data/html/js/edit_area/langs/hr.js +2 -0
  74. data/html/js/edit_area/langs/it.js +2 -0
  75. data/html/js/edit_area/langs/ja.js +2 -0
  76. data/html/js/edit_area/langs/mk.js +2 -0
  77. data/html/js/edit_area/langs/nl.js +2 -0
  78. data/html/js/edit_area/langs/pl.js +2 -0
  79. data/html/js/edit_area/langs/pt.js +2 -0
  80. data/html/js/edit_area/langs/ru.js +2 -0
  81. data/html/js/edit_area/langs/sk.js +2 -0
  82. data/html/js/edit_area/langs/zh.js +67 -0
  83. data/html/js/edit_area/manage_area.js +362 -205
  84. data/html/js/edit_area/plugins/charmap/langs/bg.js +12 -0
  85. data/html/js/edit_area/plugins/charmap/langs/zh.js +6 -0
  86. data/html/js/edit_area/plugins/test/langs/bg.js +10 -0
  87. data/html/js/edit_area/plugins/test/langs/zh.js +4 -0
  88. data/html/js/edit_area/reg_syntax/java.js +56 -0
  89. data/html/js/edit_area/reg_syntax/ruby.js +9 -9
  90. data/html/js/edit_area/reg_syntax.js +15 -13
  91. data/html/js/edit_area/regexp.js +36 -32
  92. data/html/js/edit_area/resize_area.js +43 -47
  93. data/html/js/edit_area/search_replace.js +29 -29
  94. data/html/js/edit_area/template.html +6 -4
  95. data/html/js/json-broker-client.js +23 -17
  96. data/html/js/result-page.js +107 -57
  97. data/html/js/rt-setting-page.js +38 -15
  98. data/html/js/sidebar.js +41 -27
  99. data/html/js/templates.js +167 -32
  100. data/html/js/utils.js +143 -7
  101. data/html/js/yui/treeview.js +3671 -0
  102. data/html/swf/chart.swf +0 -0
  103. data/html/test/agent_editor_spec.js +815 -0
  104. data/html/test/index.html +40 -0
  105. data/html/test/jsspec/JSSpec.css +224 -0
  106. data/html/test/jsspec/JSSpec.js +1549 -0
  107. data/html/test/jsspec/diff_match_patch.js +1 -0
  108. data/html/test/utils_spec.js +111 -0
  109. data/lib/jiji/agent/agent.rb +69 -12
  110. data/lib/jiji/agent/agent_manager.rb +18 -12
  111. data/lib/jiji/agent/agent_registry.rb +35 -121
  112. data/lib/jiji/collector.rb +16 -6
  113. data/lib/jiji/command.rb +46 -5
  114. data/lib/jiji/dao/file_system_dao.rb +158 -0
  115. data/lib/jiji/dao/timed_data_dao.rb +2 -0
  116. data/lib/jiji/dao/trade_result_dao.rb +1 -1
  117. data/lib/jiji/error.rb +24 -8
  118. data/lib/jiji/migration/migrator1_2_0.rb +67 -0
  119. data/lib/jiji/models.rb +82 -24
  120. data/lib/jiji/operator.rb +55 -51
  121. data/lib/jiji/output.rb +85 -29
  122. data/lib/jiji/output_manager.rb +84 -0
  123. data/lib/jiji/plugin/embedded/single_click_client.rb +2 -2
  124. data/lib/jiji/plugin/securities_plugin.rb +0 -1
  125. data/lib/jiji/process.rb +229 -208
  126. data/lib/jiji/process_manager.rb +190 -96
  127. data/lib/jiji/registry.rb +87 -19
  128. data/lib/jiji/server.rb +1 -0
  129. data/lib/jiji/service/agent_service.rb +147 -48
  130. data/lib/jiji/service/output_service.rb +37 -17
  131. data/lib/jiji/service/process_service.rb +3 -5
  132. data/lib/jiji/service/trade_result_service.rb +4 -5
  133. data/lib/jiji/util/file_lock.rb +4 -4
  134. data/lib/jiji/util/include_proxy.rb +17 -0
  135. data/lib/jiji/util/json_broker.rb +6 -4
  136. data/lib/jiji/util/util.rb +1 -1
  137. data/swf/chart/fx/chart/Chart.as +7 -0
  138. data/swf/chart/fx/chart/ui/graph/GraphManager.as +15 -2
  139. data/test/ProcessTest/agents/foo.rb +10 -0
  140. data/test/ProcessTest/conf/configuration.yaml +3 -0
  141. data/test/agent/agent_tests.rb +10 -0
  142. data/test/agent/test_AgentManager.rb +28 -12
  143. data/test/agent/test_AgentRegistry.rb +194 -99
  144. data/test/agent/test_PeriodicallyAgent.rb +1 -2
  145. data/test/agent/test_Permitter.rb +1 -2
  146. data/test/all_tests.rb +7 -19
  147. data/test/dao/dao_tests.rb +9 -0
  148. data/test/dao/test_FileSystemDao.rb +431 -0
  149. data/test/dao/test_RateDao.rb +5 -7
  150. data/test/dao/test_TradeResultDao.rb +1 -2
  151. data/test/migration/migration_tests.rb +10 -0
  152. data/test/migration/migrator1_2_0test_data/basic/out/M2NlOTA2ODEtZDdlNi00NWU1LWIwNDQtMjBmODY2ZGNkNzBj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
  153. data/test/migration/migrator1_2_0test_data/basic/out/MDVhYzcxMjYtMGFlMS00Mzk0LWEyNmUtYjVjZjgwNDA0ZmE2/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
  154. data/test/migration/migrator1_2_0test_data/basic/out/MzA1YTk0NDgtNzhjNi00NDk3LTk2NTktYzE1ZjBhNzdiYjNj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
  155. data/test/migration/migrator1_2_0test_data/basic/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/meta.yaml +9 -0
  156. data/test/migration/migrator1_2_0test_data/basic/props.yaml +85 -0
  157. data/test/migration/migrator1_2_0test_data/illegal_props/out/M2NlOTA2ODEtZDdlNi00NWU1LWIwNDQtMjBmODY2ZGNkNzBj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
  158. data/test/migration/migrator1_2_0test_data/illegal_props/out/MDVhYzcxMjYtMGFlMS00Mzk0LWEyNmUtYjVjZjgwNDA0ZmE2/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
  159. data/test/migration/migrator1_2_0test_data/illegal_props/out/MzA1YTk0NDgtNzhjNi00NDk3LTk2NTktYzE1ZjBhNzdiYjNj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
  160. data/test/migration/migrator1_2_0test_data/illegal_props/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/meta.yaml +9 -0
  161. data/test/migration/migrator1_2_0test_data/illegal_props/props.yaml +1 -0
  162. data/test/migration/migrator1_2_0test_data/no_outs/props.yaml +85 -0
  163. data/test/migration/migrator1_2_0test_data/no_props/out/M2NlOTA2ODEtZDdlNi00NWU1LWIwNDQtMjBmODY2ZGNkNzBj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
  164. data/test/migration/migrator1_2_0test_data/no_props/out/MDVhYzcxMjYtMGFlMS00Mzk0LWEyNmUtYjVjZjgwNDA0ZmE2/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
  165. data/test/migration/migrator1_2_0test_data/no_props/out/MzA1YTk0NDgtNzhjNi00NDk3LTk2NTktYzE1ZjBhNzdiYjNj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
  166. data/test/migration/migrator1_2_0test_data/no_props/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/meta.yaml +9 -0
  167. data/test/migration/test_Migrator.rb +1 -1
  168. data/test/migration/test_Migrator1_0_3.rb +1 -1
  169. data/test/migration/test_Migrator1_1_0.rb +1 -1
  170. data/test/migration/test_Migrator1_2_0.rb +94 -0
  171. data/test/plugin/embedded/test_SingleClickClient.rb +1 -2
  172. data/test/plugin/plugin_tests.rb +8 -0
  173. data/test/plugin/test_Loader.rb +1 -1
  174. data/test/shared/rate.csv +144 -0
  175. data/test/shared/shared_tests.rb +9 -0
  176. data/test/shared/test_Cross.rb +144 -0
  177. data/test/shared/test_PositionManager.rb +285 -0
  178. data/test/shared/test_Signal.rb +65 -0
  179. data/test/test_Output.rb +28 -21
  180. data/test/test_OutputManager.rb +162 -0
  181. data/test/test_Output_registry.rb +6 -17
  182. data/test/test_Process.rb +434 -222
  183. data/test/test_ProcessManager.rb +458 -101
  184. data/test/test_utils.rb +71 -8
  185. data/test/util/test_BlockToSession.rb +1 -2
  186. data/test/util/test_CSV.rb +1 -2
  187. data/test/util/test_SynchronizeInterceptor.rb +1 -2
  188. data/test/util/util_tests.rb +9 -0
  189. metadata +127 -47
  190. data/html/js/agent-editor-page.js +0 -440
  191. data/html/js/codepress/codepress.css +0 -21
  192. data/html/js/codepress/codepress.html +0 -35
  193. data/html/js/codepress/codepress.js +0 -138
  194. data/html/js/codepress/engines/gecko.js +0 -293
  195. data/html/js/codepress/engines/khtml.js +0 -0
  196. data/html/js/codepress/engines/msie.js +0 -304
  197. data/html/js/codepress/engines/older.js +0 -0
  198. data/html/js/codepress/engines/opera.js +0 -260
  199. data/html/js/codepress/images/line-numbers.gif +0 -0
  200. data/html/js/codepress/index.html +0 -443
  201. data/html/js/codepress/languages/asp.css +0 -71
  202. data/html/js/codepress/languages/asp.js +0 -117
  203. data/html/js/codepress/languages/autoit.css +0 -13
  204. data/html/js/codepress/languages/autoit.js +0 -32
  205. data/html/js/codepress/languages/csharp.css +0 -9
  206. data/html/js/codepress/languages/csharp.js +0 -25
  207. data/html/js/codepress/languages/css.css +0 -10
  208. data/html/js/codepress/languages/css.js +0 -23
  209. data/html/js/codepress/languages/generic.css +0 -9
  210. data/html/js/codepress/languages/generic.js +0 -25
  211. data/html/js/codepress/languages/html.css +0 -13
  212. data/html/js/codepress/languages/html.js +0 -59
  213. data/html/js/codepress/languages/java.css +0 -7
  214. data/html/js/codepress/languages/java.js +0 -24
  215. data/html/js/codepress/languages/javascript.css +0 -8
  216. data/html/js/codepress/languages/javascript.js +0 -30
  217. data/html/js/codepress/languages/perl.css +0 -11
  218. data/html/js/codepress/languages/perl.js +0 -27
  219. data/html/js/codepress/languages/php.css +0 -12
  220. data/html/js/codepress/languages/php.js +0 -61
  221. data/html/js/codepress/languages/ruby.css +0 -10
  222. data/html/js/codepress/languages/ruby.js +0 -26
  223. data/html/js/codepress/languages/sql.css +0 -10
  224. data/html/js/codepress/languages/sql.js +0 -30
  225. data/html/js/codepress/languages/text.css +0 -5
  226. data/html/js/codepress/languages/text.js +0 -9
  227. data/html/js/codepress/languages/vbscript.css +0 -71
  228. data/html/js/codepress/languages/vbscript.js +0 -117
  229. data/html/js/codepress/languages/xsl.css +0 -15
  230. data/html/js/codepress/languages/xsl.js +0 -103
  231. data/html/js/codepress/license.txt +0 -458
  232. data/html/js/edit_area/images/Thumbs.db +0 -0
  233. data/test/plugin/test_gem/a/lib/jiji_plugin_test.rb +0 -6
@@ -1,443 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
-
3
- <html>
4
- <head>
5
- <title>CodePress - Real Time Syntax Highlighting Editor written in JavaScript</title>
6
-
7
- <style>
8
- body {color:#000;background-color:white;font:15px georgia, "Lucida Grande", "Lucida Sans Unicode", Arial, Helvetica, sans-serif; letter-spacing:0.01em;margin:15px;}
9
- p {margin:0 0 15px 0;}
10
- a,a:visited {color:#7f0055;}
11
- select {background:#ffffe1;}
12
- button {margin-top:5px;}
13
- button.actions {width:171px;font-family:arial;}
14
- h1 {color:#7f0055;margin:0;padding:0;font-size:42px;font-weight:normal;}
15
- h1 a {text-decoration:none;}
16
- h2 {margin:0;}
17
- h2 a {text-decoration:none;font-weight:normal;font-size:22px;color:black !important;}
18
- h3 {font-size:20px;font-weight:normal;padding:0;margin:25px 0 5px 0;color:#7f0055;font-weight:bold;border-bottom:2px dotted #d8d8d8;}
19
- h4 {font-size:18px;font-weight:normal;z-index:0;}
20
- code {color:#0080c0;font-size:13px;font-weight:bold;}
21
- ol, ul {padding:5px 0 5px 25px;margin:0;}
22
- ol li, ul li {margin:8px 0 8px 0;}
23
-
24
- #logo {text-align:center;background-color:#d6d6d6;padding:10px;-moz-border-radius:5px;border:1px solid silver;}
25
- #container {width:700px;margin:20px auto;padding:25px;border:3px solid #d9d9d9;-moz-border-radius:10px;background:#f8f8f8;}
26
- #languages {margin:5px 0;}
27
-
28
- #menu {width:100%;background:#7f0055;-moz-border-radius:4px;}
29
- #menu a {font:bold 17px georgia;color:white;padding:4px;display:block;border-left:1px solid white;text-align:center;text-decoration:none;}
30
- #menu a:hover {background:#b9669e;}
31
-
32
- .hidden-code {display:none;}
33
- .copycode {border:1px dotted gray;padding:10px;background:white;font-family:monospace;color:gray}
34
- </style>
35
-
36
- </head>
37
-
38
- <body>
39
- <div id="container">
40
-
41
- <div id="logo">
42
- <h1><a href="http://codepress.org/">CodePress</a></h1>
43
- <h2><a href="http://codepress.org/">Online Real Time Syntax Highlighting Editor</a></h2>
44
- </div>
45
-
46
- <br />
47
-
48
- <table cellpadding="0" cellspacing="0" id="menu">
49
- <tr>
50
- <td>
51
- <a href="http://www.codepress.org/index.php">Home/Download</a>
52
- </td>
53
- <td>
54
- <a href="http://www.codepress.org/install.php">&nbsp;&nbsp;Install&nbsp;&nbsp;</a>
55
- </td>
56
- <td>
57
- <a href="http://www.codepress.org/to-do.php">&nbsp;&nbsp;To-do&nbsp;&nbsp;</a>
58
- </td>
59
- <td>
60
- <a href="http://www.codepress.org/about.php" id="about">&nbsp;&nbsp;About&nbsp;&nbsp;</a>
61
- </td>
62
- </tr>
63
- </table>
64
-
65
- <h4>
66
- CodePress is web-based source code editor with syntax highlighting written in JavaScript that colors text in real time while it's being typed in the browser.
67
- </h4>
68
-
69
- <p>
70
- Go to <strong><a href="http://codepress.org/">http://codepress.org/</a></strong> for updates.
71
- </p>
72
-
73
- <h3>Demo</h3>
74
- <div id="languages">
75
- <em>choose example in:</em>
76
- <button onclick="cp1.edit('cp-php','php')">PHP</button>
77
- <button onclick="cp1.edit('cp-javascript','javascript')">JavaScript</button>
78
- <button onclick="cp1.edit('cp-java','java')">Java</button>
79
- <button onclick="cp1.edit('cp-perl','perl')">Perl</button>
80
- <button onclick="cp1.edit('cp-sql','sql')">SQL</button>
81
- <button onclick="cp1.edit('cp-html','html')">HTML</button>
82
- <button onclick="cp1.edit('cp-css','css')">CSS</button>
83
- </div>
84
-
85
- <textarea id="cp1" class="codepress php" style="width:700px;height:300px;" wrap="off">
86
- <?php
87
- // Very simple implementation of server side script
88
-
89
- if(isset($_GET['file'])) {
90
- $file = basename($_GET['file']);
91
- $full_file = $path['server'].'/'.$path['webdocs'].'/'.$path['files']."/".$file;
92
- if(file_exists($full_file)) {
93
- $code = file_get_contents($full_file);
94
- $code = preg_replace("/>/","&amp;gt;",$code);
95
- $code = preg_replace("/</","&amp;lt;",$code);
96
- $language = getLanguage($file);
97
- }
98
- }
99
- ?>
100
-
101
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
102
- <html>
103
- <head>
104
- <title>CodePress - Real Time Syntax Highlighting Editor written in JavaScript</title>
105
- <link type="text/css" href="languages/codepress-<?=$language?>.css" rel="stylesheet" id="cp-lang-style" />
106
- <script type="text/javascript" src="codepress.js"></script>
107
- <script type="text/javascript">
108
- CodePress.language = '<?=$language?>';
109
- </script>
110
- </head>
111
- <body id="ffedt"><pre id="ieedt"><?=$code?></pre></body>
112
- </html>
113
- </textarea>
114
-
115
- <br /><br />
116
-
117
- <textarea id="codepress2" class="codepress javascript linenumbers-off" style="width:700px;height:200px;" wrap="off">
118
- //set language
119
- this.setLanguage = function() {
120
- if(arguments[0]) {
121
- language = (typeof(Content.languages[arguments[0]])!='undefined') ? arguments[0] : this.setLanguage();
122
- cpLanguage.innerHTML = Content.languages[language].name;
123
- if(cpBody.document.designMode=='on') cpBody.document.designMode = 'off';
124
- CodePress.loadScript(cpBody.document, '../languages/'+language+'.js', function () { cpBody.CodePress.syntaxHighlight('init'); })
125
- cpBody.document.getElementById('cp-lang-style').href = '../languages/'+language+'.css';
126
- this.hideMenu();
127
- }
128
- else {
129
- var extension = filename.replace(/.*\.([^\.]+)$/,'$1');
130
- var aux = false;
131
- for(lang in Content.languages) {
132
- extensions = ','+Content.languages[lang].extensions+',';
133
- if(extensions.match(','+extension+',')) aux = lang;
134
- }
135
- language = (aux) ? aux : 'generic';
136
- }
137
- }
138
- </textarea>
139
-
140
- <p>
141
- <button class="actions" onclick="alert(codepress2.getCode())">get code from editor</button>
142
- <button class="actions" onclick="codepress2.toggleEditor()">turn on/off CodePress</button>
143
- <button class="actions" onclick="codepress2.toggleLineNumbers()">show/hide line numbers</button>
144
- <button class="actions" onclick="codepress2.toggleAutoComplete()">turn on/off auto-complete</button>
145
- <button class="actions" onclick="codepress2.toggleReadOnly()">turn on/off read only</button>
146
- </p>
147
-
148
-
149
-
150
- <h3>Installation</h3>
151
- <ol>
152
- <li>
153
- <p>
154
- <a href="http://codepress.org/">Download</a> and uncompress CodePress under a directory inside your webserver.<br>
155
- Example:<strong> http://yourserver/codepress/</strong><br />
156
- Since CodePress is pure JavaScript and HTML, you can also test it without a webserver.
157
- </p>
158
- </li>
159
- <li>
160
- <p>
161
- Insert CodePress script somewhere in your page inside the <code>&lt;head&gt;</code> or above the <code>&lt;/body&gt;</code> tag.
162
- </p>
163
-
164
- <p class="copycode">
165
- &lt;script src="/codepress/codepress.js" type="text/javascript"&gt;&lt;/script&gt;
166
- </p>
167
- </li>
168
-
169
- <li>
170
- <p>
171
- Add the <code>&lt;textarea&gt;</code> tag to the place on your page you want CodePress to appear. CodePress will inherit the width and height of your textarea.
172
- When the page loads, it will automatically replace your textarea with a CodePress window.
173
- </p>
174
- <p class="copycode">
175
- &lt;textarea id="myCpWindow" class="codepress javascript linenumbers-off"&gt;<br />
176
- &nbsp;&nbsp;&nbsp;// your code here<br />
177
- &lt;/textarea&gt;
178
- </p>
179
- <ul>
180
- <li>
181
- The <code>javascript</code> portion of the class="" means that the language being edited is JavaScript.
182
- </li>
183
- <li>
184
- The <code>codepress</code> portion of the class="" is mandatory and indicates a textarea to be replaced for a CodePress window.
185
- </li>
186
- <li>
187
- Other class options are <code>linenumbers-off</code>, <code>autocomplete-off</code> and <code>readonly-on</code>.
188
- </li>
189
- <li>
190
- Careful not to use the same id for two different CodePress windows (<code>&lt;textarea id="<strong>xx</strong>"...&gt;</code>)
191
- </li>
192
- </ul>
193
-
194
- </li>
195
- </ol>
196
-
197
- <h3>You also can...</h3>
198
- <ol>
199
- <li>
200
- Open/edit code from a different textarea.<br />
201
- Example: <code>textarea_id.edit('other_textarea_id','language')</code><br>
202
- </li>
203
- <li>
204
- Get code from CodePress window.<br />
205
- Example: <code>textarea_id.getCode()</code><br>
206
- </li>
207
- <li>
208
- Turn on/off CodePress editor and return to the regular textarea.<br />
209
- Example: <code>textarea_id.toggleEditor()</code><br>
210
- </li>
211
- <li>
212
- Turn on/off line numbers.<br />
213
- Example: <code>textarea_id.toggleLineNumbers()</code><br>
214
- </li>
215
- <li>
216
- Turn on/off read only.<br />
217
- Example: <code>textarea_id.toggleReadOnly()</code><br>
218
- </li>
219
- <li>
220
- Turn on/off auto-complete.<br />
221
- Example: <code>textarea_id.toggleAutoComplete()</code><br>
222
- </li>
223
-
224
- </ol>
225
-
226
- <!-- p>
227
- You may want to use [id].getCode() to get the content code from CodePress window and save it to your server since CodePress only edit files and do not save them.
228
- </p>
229
- <p>
230
- You may also want to open files from server. You'll have to write a server side script and replace the JavaScript call on codepress.js from codepress.html to codepress.php (if your server side language is PHP, of course).
231
- </p -->
232
-
233
- <h3>License</h3>
234
- <p>
235
- CodePress is distributed under the <a href="http://www.opensource.org/licenses/lgpl-license.php">LGPL</a>. If your software is <a href="http://www.gnu.org/philosophy/license-list.html#GPLCompatibleLicenses">compatible</a> with this licence or it is under <a href="http://creativecommons.org/">Creative Commons</a>, you can use it as you want. Just keep the credits somewhere around.
236
- </p>
237
-
238
-
239
- </div><!--/container-->
240
-
241
-
242
-
243
- <!-- hidden codes for loading -->
244
- <textarea id="cp-php" class="hidden-code">
245
- <?php
246
- // Very simple implementation of server side script
247
-
248
- if(isset($_GET['file'])) {
249
- $file = basename($_GET['file']);
250
- $full_file = $path['server'].'/'.$path['webdocs'].'/'.$path['files']."/".$file;
251
- if(file_exists($full_file)) {
252
- $code = file_get_contents($full_file);
253
- $code = preg_replace("/>/","&amp;gt;",$code);
254
- $code = preg_replace("/</","&amp;lt;",$code);
255
- $language = getLanguage($file);
256
- }
257
- }
258
- ?>
259
-
260
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
261
- <html>
262
- <head>
263
- <title>CodePress - Real Time Syntax Highlighting Editor written in JavaScript</title>
264
- <link type="text/css" href="languages/codepress-<?=$language?>.css" rel="stylesheet" id="cp-lang-style" />
265
- <script type="text/javascript" src="codepress.js"></script>
266
- <script type="text/javascript">
267
- CodePress.language = '<?=$language?>';
268
- </script>
269
- </head>
270
- <body id="ffedt"><pre id="ieedt"><?=$code?></pre></body>
271
- </html>
272
- </textarea>
273
-
274
- <textarea id="cp-javascript" class="hidden-code">
275
- CodePress = function(obj) {
276
- var self = document.createElement('iframe');
277
- self.textarea = obj;
278
- self.textarea.disabled = true;
279
- self.style.height = self.textarea.clientHeight +'px';
280
- self.style.width = self.textarea.clientWidth +'px';
281
-
282
- self.initialize = function() {
283
- self.editor = self.contentWindow.CodePress;
284
- self.editor.body = self.contentWindow.document.getElementsByTagName('body')[0];
285
- self.editor.setCode(self.textarea.value);
286
- self.editor.syntaxHighlight('init');
287
- }
288
-
289
- self.edit = function(id,language) {
290
- self.language = (language) ? language : self.textarea.className.replace(/ ?codepress ?/,'');
291
- self.src = cpPath+'modules/codepress.html?engine='+self.getEngine()+'&language='+self.language;
292
- if(self.attachEvent) self.attachEvent('onload',self.initialize);
293
- else self.addEventListener('load',self.initialize,false);
294
- }
295
- }
296
- </textarea>
297
-
298
- <textarea id="cp-autoit" class="hidden-code">
299
- #include
300
- IsNumber(15)
301
- @Macro
302
- ;comment
303
- $var = "string"
304
- </textarea>
305
-
306
- <textarea id="cp-java" class="hidden-code">
307
- import java.io.FileFilter;
308
- import java.io.IOException;
309
- import java.io.PrintWriter;
310
-
311
- /**
312
- * Project ECCO - File manager class
313
- * @author Fernando M.A.d.S.
314
- */
315
- public class FileManager extends HttpServlet {
316
-
317
- private static final long serialVersionUID = 1L;
318
- private static String login = "feanndor"; // session var should come here
319
- private static String usersPath = System.getProperty("user.dir")+File.separator+"htdocs"+File.separator+"ecco"+File.separator+"users"+File.separator;
320
- private static File dir = new File(usersPath+login+File.separator);
321
- static boolean existDirectories = false;
322
- static int isDirectory = 0;
323
-
324
- public FileFilter filterFiles(File dir) {
325
- return (new FileFilter() {
326
- public boolean accept(File pathname) {
327
- return !(pathname.isDirectory());
328
- }
329
- });
330
- }
331
- }
332
- </textarea>
333
-
334
- <textarea id="cp-perl" class="hidden-code">
335
- #!/usr/bin/perl
336
- # The first line of the script envokes Perl
337
-
338
- # Scalar variables
339
- $var1 = "Hello World";
340
- $var2 = 14.6;
341
-
342
- # Array variables
343
- @arr1 = ("zero","one","two","three","four");
344
-
345
- # Hash variable, or associative array
346
- %hash1 = ("one","Monday","two", "Tuesday","three", "Wednesday","four","Thursday");
347
-
348
- # Some simple printing
349
- print $var1;
350
-
351
- # Subroutine
352
- sub test() {
353
- print "ok";
354
- }
355
- </textarea>
356
-
357
- <textarea id="cp-sql" class="hidden-code">
358
- --
359
- -- simple select example
360
- --
361
- SELECT * FROM books
362
- WHERE price > 100.00 and price < 150.00
363
- ORDER BY title
364
-
365
- SELECT books.title, count(*) AS Authors
366
- FROM books
367
- JOIN book_authors
368
- ON books.book_number = book_authors.book_number
369
- GROUP BY books.title
370
-
371
- -- insert, update and delete examples
372
-
373
- INSERT INTO my_table (field1, field2, field3) VALUES ('test', 'N', NULL);
374
-
375
- BEGIN WORK;
376
- UPDATE inventory SET quantity = quantity - 3 WHERE item = 'pants';
377
- COMMIT;
378
- </textarea>
379
-
380
- <textarea id="cp-html" class="hidden-code">
381
- <html>
382
- <head>
383
- <title>CodePress - Online Real Time Syntax Highlighting Editor</title>
384
-
385
- <style type="text/css">
386
- @import url(styles.css);
387
- </style>
388
- <script type="text/javascript">
389
- function getCode() {
390
- alert(textWithoutHighlighting);
391
- }
392
- </script>
393
- </head>
394
- <body>
395
- <div id="logo">
396
- <h1><a href="http://codepress.org/">CodePress</a></h1>
397
- <h2>Online Real Time Syntax Highlighting Editor</h2>
398
- <img src="testimage.gif" />
399
- </div>
400
- <div id="languages">
401
- <em>choose language:</em>
402
- <button onclick="edit('codepress.php',this)" id="default">PHP</button>
403
- <button onclick="edit('FileManager.java',this)">Java</button>
404
- </div>
405
- </body>
406
- </html>
407
- </textarea>
408
-
409
- <textarea id="cp-css" class="hidden-code">
410
- /* CSS comment */
411
-
412
- body {
413
- color:#000;
414
- background-color:white;
415
- font:15px Georgia, "Lucida Grande", Arial, sans-serif;
416
- letter-spacing:0.01em;
417
- margin:15px;
418
- }
419
-
420
- p {
421
- margin:0 0 15px 0;
422
- }
423
-
424
- a,a:visited {
425
- color:#7f0055;
426
- }
427
-
428
- select {
429
- background:#ffffe1;
430
- }
431
-
432
- h1 {
433
- color:#7f0055;
434
- margin:0;
435
- padding:0;
436
- font-size:42px;
437
- }
438
- </textarea>
439
-
440
-
441
- <script src="codepress.js" type="text/javascript"></script>
442
- </body>
443
- </html>
@@ -1,71 +0,0 @@
1
- /*
2
- * CodePress color styles for ASP-VB syntax highlighting
3
- * By Martin D. Kirk
4
- */
5
- /* tags */
6
-
7
- b {
8
- color:#000080;
9
- }
10
- /* comments */
11
- big, big b, big em, big ins, big s, strong i, strong i b, strong i s, strong i u, strong i a, strong i a u, strong i s u {
12
- color:gray;
13
- font-weight:normal;
14
- }
15
- /* ASP comments */
16
- strong dfn, strong dfn a,strong dfn var, strong dfn a u, strong dfn u{
17
- color:gray;
18
- font-weight:normal;
19
- }
20
- /* attributes */
21
- s, s b, span s u, span s cite, strong span s {
22
- color:#5656fa ;
23
- font-weight:normal;
24
- }
25
- /* strings */
26
- strong s,strong s b, strong s u, strong s cite {
27
- color:#009900;
28
- font-weight:normal;
29
- }
30
- strong ins{
31
- color:#000000;
32
- font-weight:bold;
33
- }
34
- /* Syntax */
35
- strong a, strong a u {
36
- color:#0000FF;
37
- font-weight:;
38
- }
39
- /* Native Keywords */
40
- strong u {
41
- color:#990099;
42
- font-weight:bold;
43
- }
44
- /* Numbers */
45
- strong var{
46
- color:#FF0000;
47
- }
48
- /* ASP Language */
49
- span{
50
- color:#990000;
51
- font-weight:bold;
52
- }
53
- strong i,strong a i, strong u i {
54
- color:#009999;
55
- }
56
- /* style */
57
- em {
58
- color:#800080;
59
- font-style:normal;
60
- }
61
- /* script */
62
- ins {
63
- color:#800000;
64
- font-weight:bold;
65
- }
66
-
67
- /* <?php and ?> */
68
- cite, s cite {
69
- color:red;
70
- font-weight:bold;
71
- }
@@ -1,117 +0,0 @@
1
- /*
2
- * CodePress regular expressions for ASP-vbscript syntax highlighting
3
- */
4
-
5
- // ASP VBScript
6
- Language.syntax = [
7
- // all tags
8
- { input : /(&lt;[^!%|!%@]*?&gt;)/g, output : '<b>$1</b>' },
9
- // style tags
10
- { input : /(&lt;style.*?&gt;)(.*?)(&lt;\/style&gt;)/g, output : '<em>$1</em><em>$2</em><em>$3</em>' },
11
- // script tags
12
- { input : /(&lt;script.*?&gt;)(.*?)(&lt;\/script&gt;)/g, output : '<ins>$1</ins><ins>$2</ins><ins>$3</ins>' },
13
- // strings "" and attributes
14
- { input : /\"(.*?)(\"|<br>|<\/P>)/g, output : '<s>"$1$2</s>' },
15
- // ASP Comment
16
- { input : /\'(.*?)(\'|<br>|<\/P>)/g, output : '<dfn>\'$1$2</dfn>'},
17
- // <%.*
18
- { input : /(&lt;%)/g, output : '<strong>$1' },
19
- // .*%>
20
- { input : /(%&gt;)/g, output : '$1</strong>' },
21
- // <%@...%>
22
- { input : /(&lt;%@)(.+?)(%&gt;)/gi, output : '$1<span>$2</span>$3' },
23
- //Numbers
24
- { input : /\b([\d]+)\b/g, output : '<var>$1</var>' },
25
- // Reserved Words 1 (Blue)
26
- { input : /\b(And|As|ByRef|ByVal|Call|Case|Class|Const|Dim|Do|Each|Else|ElseIf|Empty|End|Eqv|Exit|False|For|Function)\b/gi, output : '<a>$1</a>' },
27
- { input : /\b(Get|GoTo|If|Imp|In|Is|Let|Loop|Me|Mod|Enum|New|Next|Not|Nothing|Null|On|Option|Or|Private|Public|ReDim|Rem)\b/gi, output : '<a>$1</a>' },
28
- { input : /\b(Resume|Select|Set|Stop|Sub|Then|To|True|Until|Wend|While|With|Xor|Execute|Randomize|Erase|ExecuteGlobal|Explicit|step)\b/gi, output : '<a>$1</a>' },
29
- // Reserved Words 2 (Purple)
30
- { input : /\b(Abandon|Abs|AbsolutePage|AbsolutePosition|ActiveCommand|ActiveConnection|ActualSize|AddHeader|AddNew|AppendChunk)\b/gi, output : '<u>$1</u>' },
31
- { input : /\b(AppendToLog|Application|Array|Asc|Atn|Attributes|BeginTrans|BinaryRead|BinaryWrite|BOF|Bookmark|Boolean|Buffer|Byte)\b/gi, output : '<u>$1</u>' },
32
- { input : /\b(CacheControl|CacheSize|Cancel|CancelBatch|CancelUpdate|CBool|CByte|CCur|CDate|CDbl|Charset|Chr|CInt|Clear)\b/gi, output : '<u>$1</u>' },
33
- { input : /\b(ClientCertificate|CLng|Clone|Close|CodePage|CommandText|CommandType|CommandTimeout|CommitTrans|CompareBookmarks|ConnectionString|ConnectionTimeout)\b/gi, output : '<u>$1</u>' },
34
- { input : /\b(Contents|ContentType|Cookies|Cos|CreateObject|CreateParameter|CSng|CStr|CursorLocation|CursorType|DataMember|DataSource|Date|DateAdd|DateDiff)\b/gi, output : '<u>$1</u>' },
35
- { input : /\b(DatePart|DateSerial|DateValue|Day|DefaultDatabase|DefinedSize|Delete|Description|Double|EditMode|Eof|EOF|err|Error)\b/gi, output : '<u>$1</u>' },
36
- { input : /\b(Exp|Expires|ExpiresAbsolute|Filter|Find|Fix|Flush|Form|FormatCurrency|FormatDateTime|FormatNumber|FormatPercent)\b/gi, output : '<u>$1</u>' },
37
- { input : /\b(GetChunk|GetLastError|GetRows|GetString|Global|HelpContext|HelpFile|Hex|Hour|HTMLEncode|IgnoreCase|Index|InStr|InStrRev)\b/gi, output : '<u>$1</u>' },
38
- { input : /\b(Int|Integer|IsArray|IsClientConnected|IsDate|IsolationLevel|Join|LBound|LCase|LCID|Left|Len|Lock|LockType|Log|Long|LTrim)\b/gi, output : '<u>$1</u>' },
39
- { input : /\b(MapPath|MarshalOptions|MaxRecords|Mid|Minute|Mode|Month|MonthName|Move|MoveFirst|MoveLast|MoveNext|MovePrevious|Name|NextRecordset)\b/gi, output : '<u>$1</u>' },
40
- { input : /\b(Now|Number|NumericScale|ObjectContext|Oct|Open|OpenSchema|OriginalValue|PageCount|PageSize|Pattern|PICS|Precision|Prepared|Property)\b/gi, output : '<u>$1</u>' },
41
- { input : /\b(Provider|QueryString|RecordCount|Redirect|RegExp|Remove|RemoveAll|Replace|Requery|Request|Response|Resync|Right|Rnd)\b/gi, output : '<u>$1</u>' },
42
- { input : /\b(RollbackTrans|RTrim|Save|ScriptTimeout|Second|Seek|Server|ServerVariables|Session|SessionID|SetAbort|SetComplete|Sgn)\b/gi, output : '<u>$1</u>' },
43
- { input : /\b(Sin|Size|Sort|Source|Space|Split|Sqr|State|StaticObjects|Status|StayInSync|StrComp|String|StrReverse|Supports|Tan|Time)\b/gi, output : '<u>$1</u>' },
44
- { input : /\b(Timeout|Timer|TimeSerial|TimeValue|TotalBytes|Transfer|Trim|Type|Type|UBound|UCase|UnderlyingValue|UnLock|Update|UpdateBatch)\b/gi, output : '<u>$1</u>' },
45
- { input : /\b(URLEncode|Value|Value|Version|Weekday|WeekdayName|Write|Year)\b/gi, output : '<u>$1</u>' },
46
- // Reserved Words 3 (Turquis)
47
- { input : /\b(vbBlack|vbRed|vbGreen|vbYellow|vbBlue|vbMagenta|vbCyan|vbWhite|vbBinaryCompare|vbTextCompare)\b/gi, output : '<i>$1</i>' },
48
- { input : /\b(vbSunday|vbMonday|vbTuesday|vbWednesday|vbThursday|vbFriday|vbSaturday|vbUseSystemDayOfWeek)\b/gi, output : '<i>$1</i>' },
49
- { input : /\b(vbFirstJan1|vbFirstFourDays|vbFirstFullWeek|vbGeneralDate|vbLongDate|vbShortDate|vbLongTime|vbShortTime)\b/gi, output : '<i>$1</i>' },
50
- { input : /\b(vbObjectError|vbCr|VbCrLf|vbFormFeed|vbLf|vbNewLine|vbNullChar|vbNullString|vbTab|vbVerticalTab|vbUseDefault|vbTrue)\b/gi, output : '<i>$1</i>' },
51
- { input : /\b(vbFalse|vbEmpty|vbNull|vbInteger|vbLong|vbSingle|vbDouble|vbCurrency|vbDate|vbString|vbObject|vbError|vbBoolean|vbVariant)\b/gi, output : '<i>$1</i>' },
52
- { input : /\b(vbDataObject|vbDecimal|vbByte|vbArray)\b/gi, output : '<i>$1</i>' },
53
- // html comments
54
- { input : /(&lt;!--.*?--&gt.)/g, output : '<big>$1</big>' }
55
- ]
56
-
57
- Language.Functions = [
58
- // Output at index 0, must be the desired tagname surrounding a $1
59
- // Name is the index from the regex that marks the functionname
60
- {input : /(function|sub)([ ]*?)(\w+)([ ]*?\()/gi , output : '<ins>$1</ins>', name : '$3'}
61
- ]
62
-
63
- Language.snippets = [
64
- //Conditional
65
- { input : 'if', output : 'If $0 Then\n\t\nEnd If' },
66
- { input : 'ifelse', output : 'If $0 Then\n\t\n\nElse\n\t\nEnd If' },
67
- { input : 'case', output : 'Select Case $0\n\tCase ?\n\tCase Else\nEnd Select'},
68
- //Response
69
- { input : 'rw', output : 'Response.Write( $0 )' },
70
- { input : 'resc', output : 'Response.Cookies( $0 )' },
71
- { input : 'resb', output : 'Response.Buffer'},
72
- { input : 'resflu', output : 'Response.Flush()'},
73
- { input : 'resend', output : 'Response.End'},
74
- //Request
75
- { input : 'reqc', output : 'Request.Cookies( $0 )' },
76
- { input : 'rq', output : 'Request.Querystring("$0")' },
77
- { input : 'rf', output : 'Request.Form("$0")' },
78
- //FSO
79
- { input : 'fso', output : 'Set fso = Server.CreateObject("Scripting.FileSystemObject")\n$0' },
80
- { input : 'setfo', output : 'Set fo = fso.getFolder($0)' },
81
- { input : 'setfi', output : 'Set fi = fso.getFile($0)' },
82
- { input : 'twr', output : 'Set f = fso.CreateTextFile($0,true)\'overwrite\nf.WriteLine()\nf.Close'},
83
- { input : 'tre', output : 'Set f = fso.OpenTextFile($0, 1)\nf.ReadAll\nf.Close'},
84
- //Server
85
- { input : 'mapp', output : 'Server.Mappath($0)' },
86
- //Loops
87
- { input : 'foreach', output : 'For Each $0 in ?\n\t\nNext' },
88
- { input : 'for', output : 'For $0 to ? step ?\n\t\nNext' },
89
- { input : 'do', output : 'Do While($0)\n\t\nLoop' },
90
- { input : 'untilrs', output : 'do until rs.eof\n\t\nrs.movenext\nloop' },
91
- //ADO
92
- { input : 'adorec', output : 'Set rs = Server.CreateObject("ADODB.Recordset")' },
93
- { input : 'adocon', output : 'Set Conn = Server.CreateObject("ADODB.Connection")' },
94
- { input : 'adostr', output : 'Set oStr = Server.CreateObject("ADODB.Stream")' },
95
- //Http Request
96
- { input : 'xmlhttp', output : 'Set xmlHttp = Server.CreateObject("Microsoft.XMLHTTP")\nxmlHttp.open("GET", $0, false)\nxmlHttp.send()\n?=xmlHttp.responseText' },
97
- { input : 'xmldoc', output : 'Set xmldoc = Server.CreateObject("Microsoft.XMLDOM")\nxmldoc.async=false\nxmldoc.load(request)'},
98
- //Functions
99
- { input : 'func', output : 'Function $0()\n\t\n\nEnd Function'},
100
- { input : 'sub', output : 'Sub $0()\n\t\nEnd Sub'}
101
-
102
- ]
103
-
104
- Language.complete = [
105
- //{ input : '\'', output : '\'$0\'' },
106
- { input : '"', output : '"$0"' },
107
- { input : '(', output : '\($0\)' },
108
- { input : '[', output : '\[$0\]' },
109
- { input : '{', output : '{\n\t$0\n}' }
110
- ]
111
-
112
- Language.shortcuts = [
113
- { input : '[space]', output : '&nbsp;' },
114
- { input : '[enter]', output : '<br />' } ,
115
- { input : '[j]', output : 'testing' },
116
- { input : '[7]', output : '&amp;' }
117
- ]
@@ -1,13 +0,0 @@
1
- /**
2
- * CodePress color styles for AutoIt syntax highlighting
3
- */
4
-
5
- u {font-style:normal;color:#000090;font-weight:bold;font-family:Monospace;}
6
- var {color:#AA0000;font-weight:bold;font-style:normal;}
7
- em {color:#FF33FF;}
8
- ins {color:#AC00A9;}
9
- i {color:#F000FF;}
10
- b {color:#FF0000;}
11
- a {color:#0080FF;font-weight:bold;}
12
- s, s u, s b {color:#9999CC;font-weight:normal;}
13
- cite, cite *{color:#009933;font-weight:normal;}