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.
- data/ChangeLog +24 -1
- data/README +0 -0
- data/base/shared_lib/moving_average.rb +34 -33
- data/base/shared_lib/system/cross.rb +76 -0
- data/base/shared_lib/system/position_manager.rb +160 -0
- data/base/shared_lib/system/signal.rb +347 -0
- data/html/css/datatable.css +4 -4
- data/html/css/default.css +57 -5
- data/html/css/treeview.css +205 -0
- data/html/img/bin_closed.png +0 -0
- data/html/img/bin_empty.png +0 -0
- data/html/img/button_add_small.gif +0 -0
- data/html/img/button_add_small_gray.gif +0 -0
- data/html/img/button_add_small_over.gif +0 -0
- data/html/img/button_mkcol.gif +0 -0
- data/html/img/button_mkcol_gray.gif +0 -0
- data/html/img/button_mkcol_over.gif +0 -0
- data/html/img/button_remove_small.gif +0 -0
- data/html/img/button_remove_small_gray.gif +0 -0
- data/html/img/button_remove_small_over.gif +0 -0
- data/html/img/button_rename.gif +0 -0
- data/html/img/button_rename_gray.gif +0 -0
- data/html/img/button_rename_over.gif +0 -0
- data/html/img/control_play.png +0 -0
- data/html/img/control_play_blue.png +0 -0
- data/html/img/folder.png +0 -0
- data/html/img/folder_brick.png +0 -0
- data/html/img/folder_user.png +0 -0
- data/html/{js/codepress/images → img}/line-numbers.png +0 -0
- data/html/img/page_white_ruby.png +0 -0
- data/html/img/sidebar_agent_edit.png +0 -0
- data/html/img/sidebar_agent_edit_over.png +0 -0
- data/html/img/sidebar_agent_edit_s.png +0 -0
- data/html/img/yui/treeview-sprite.gif +0 -0
- data/html/index.html +34 -18
- data/html/js/agent-editor/agent-editor-page.js +324 -0
- data/html/js/agent-editor/agent-editor.js +363 -0
- data/html/js/agent-editor/agent-list-tree.js +251 -0
- data/html/js/agent-selector.js +23 -28
- data/html/js/app.js +63 -91
- data/html/js/bt-create-page.js +25 -19
- data/html/js/container-min.js +1 -1
- data/html/js/container.js +944 -0
- data/html/js/edit_area/autocompletion.js +11 -13
- data/html/js/edit_area/edit_area.css +79 -40
- data/html/js/edit_area/edit_area.js +255 -226
- data/html/js/edit_area/edit_area_compressor.php +4 -4
- data/html/js/edit_area/edit_area_full.gz +0 -0
- data/html/js/edit_area/edit_area_full.js +31 -31
- data/html/js/edit_area/edit_area_full_with_plugins.gz +0 -0
- data/html/js/edit_area/edit_area_full_with_plugins.js +31 -31
- data/html/js/edit_area/edit_area_functions.js +448 -341
- data/html/js/edit_area/edit_area_loader.js +409 -397
- data/html/js/edit_area/elements_functions.js +120 -123
- data/html/js/edit_area/highlight.js +305 -197
- data/html/js/edit_area/images/goto.png +0 -0
- data/html/js/edit_area/images/help.png +0 -0
- data/html/js/edit_area/images/redo.png +0 -0
- data/html/js/edit_area/images/save.png +0 -0
- data/html/js/edit_area/images/search.png +0 -0
- data/html/js/edit_area/images/undo.png +0 -0
- data/html/js/edit_area/images/word_wrap.gif +0 -0
- data/html/js/edit_area/keyboard.js +5 -5
- data/html/js/edit_area/langs/bg.js +73 -0
- data/html/js/edit_area/langs/cs.js +2 -0
- data/html/js/edit_area/langs/de.js +2 -0
- data/html/js/edit_area/langs/dk.js +2 -0
- data/html/js/edit_area/langs/en.js +2 -0
- data/html/js/edit_area/langs/eo.js +2 -0
- data/html/js/edit_area/langs/es.js +2 -0
- data/html/js/edit_area/langs/fi.js +67 -0
- data/html/js/edit_area/langs/fr.js +2 -0
- data/html/js/edit_area/langs/hr.js +2 -0
- data/html/js/edit_area/langs/it.js +2 -0
- data/html/js/edit_area/langs/ja.js +2 -0
- data/html/js/edit_area/langs/mk.js +2 -0
- data/html/js/edit_area/langs/nl.js +2 -0
- data/html/js/edit_area/langs/pl.js +2 -0
- data/html/js/edit_area/langs/pt.js +2 -0
- data/html/js/edit_area/langs/ru.js +2 -0
- data/html/js/edit_area/langs/sk.js +2 -0
- data/html/js/edit_area/langs/zh.js +67 -0
- data/html/js/edit_area/manage_area.js +362 -205
- data/html/js/edit_area/plugins/charmap/langs/bg.js +12 -0
- data/html/js/edit_area/plugins/charmap/langs/zh.js +6 -0
- data/html/js/edit_area/plugins/test/langs/bg.js +10 -0
- data/html/js/edit_area/plugins/test/langs/zh.js +4 -0
- data/html/js/edit_area/reg_syntax/java.js +56 -0
- data/html/js/edit_area/reg_syntax/ruby.js +9 -9
- data/html/js/edit_area/reg_syntax.js +15 -13
- data/html/js/edit_area/regexp.js +36 -32
- data/html/js/edit_area/resize_area.js +43 -47
- data/html/js/edit_area/search_replace.js +29 -29
- data/html/js/edit_area/template.html +6 -4
- data/html/js/json-broker-client.js +23 -17
- data/html/js/result-page.js +107 -57
- data/html/js/rt-setting-page.js +38 -15
- data/html/js/sidebar.js +41 -27
- data/html/js/templates.js +167 -32
- data/html/js/utils.js +143 -7
- data/html/js/yui/treeview.js +3671 -0
- data/html/swf/chart.swf +0 -0
- data/html/test/agent_editor_spec.js +815 -0
- data/html/test/index.html +40 -0
- data/html/test/jsspec/JSSpec.css +224 -0
- data/html/test/jsspec/JSSpec.js +1549 -0
- data/html/test/jsspec/diff_match_patch.js +1 -0
- data/html/test/utils_spec.js +111 -0
- data/lib/jiji/agent/agent.rb +69 -12
- data/lib/jiji/agent/agent_manager.rb +18 -12
- data/lib/jiji/agent/agent_registry.rb +35 -121
- data/lib/jiji/collector.rb +16 -6
- data/lib/jiji/command.rb +46 -5
- data/lib/jiji/dao/file_system_dao.rb +158 -0
- data/lib/jiji/dao/timed_data_dao.rb +2 -0
- data/lib/jiji/dao/trade_result_dao.rb +1 -1
- data/lib/jiji/error.rb +24 -8
- data/lib/jiji/migration/migrator1_2_0.rb +67 -0
- data/lib/jiji/models.rb +82 -24
- data/lib/jiji/operator.rb +55 -51
- data/lib/jiji/output.rb +85 -29
- data/lib/jiji/output_manager.rb +84 -0
- data/lib/jiji/plugin/embedded/single_click_client.rb +2 -2
- data/lib/jiji/plugin/securities_plugin.rb +0 -1
- data/lib/jiji/process.rb +229 -208
- data/lib/jiji/process_manager.rb +190 -96
- data/lib/jiji/registry.rb +87 -19
- data/lib/jiji/server.rb +1 -0
- data/lib/jiji/service/agent_service.rb +147 -48
- data/lib/jiji/service/output_service.rb +37 -17
- data/lib/jiji/service/process_service.rb +3 -5
- data/lib/jiji/service/trade_result_service.rb +4 -5
- data/lib/jiji/util/file_lock.rb +4 -4
- data/lib/jiji/util/include_proxy.rb +17 -0
- data/lib/jiji/util/json_broker.rb +6 -4
- data/lib/jiji/util/util.rb +1 -1
- data/swf/chart/fx/chart/Chart.as +7 -0
- data/swf/chart/fx/chart/ui/graph/GraphManager.as +15 -2
- data/test/ProcessTest/agents/foo.rb +10 -0
- data/test/ProcessTest/conf/configuration.yaml +3 -0
- data/test/agent/agent_tests.rb +10 -0
- data/test/agent/test_AgentManager.rb +28 -12
- data/test/agent/test_AgentRegistry.rb +194 -99
- data/test/agent/test_PeriodicallyAgent.rb +1 -2
- data/test/agent/test_Permitter.rb +1 -2
- data/test/all_tests.rb +7 -19
- data/test/dao/dao_tests.rb +9 -0
- data/test/dao/test_FileSystemDao.rb +431 -0
- data/test/dao/test_RateDao.rb +5 -7
- data/test/dao/test_TradeResultDao.rb +1 -2
- data/test/migration/migration_tests.rb +10 -0
- data/test/migration/migrator1_2_0test_data/basic/out/M2NlOTA2ODEtZDdlNi00NWU1LWIwNDQtMjBmODY2ZGNkNzBj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
- data/test/migration/migrator1_2_0test_data/basic/out/MDVhYzcxMjYtMGFlMS00Mzk0LWEyNmUtYjVjZjgwNDA0ZmE2/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
- data/test/migration/migrator1_2_0test_data/basic/out/MzA1YTk0NDgtNzhjNi00NDk3LTk2NTktYzE1ZjBhNzdiYjNj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
- data/test/migration/migrator1_2_0test_data/basic/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/meta.yaml +9 -0
- data/test/migration/migrator1_2_0test_data/basic/props.yaml +85 -0
- data/test/migration/migrator1_2_0test_data/illegal_props/out/M2NlOTA2ODEtZDdlNi00NWU1LWIwNDQtMjBmODY2ZGNkNzBj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
- data/test/migration/migrator1_2_0test_data/illegal_props/out/MDVhYzcxMjYtMGFlMS00Mzk0LWEyNmUtYjVjZjgwNDA0ZmE2/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
- data/test/migration/migrator1_2_0test_data/illegal_props/out/MzA1YTk0NDgtNzhjNi00NDk3LTk2NTktYzE1ZjBhNzdiYjNj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
- data/test/migration/migrator1_2_0test_data/illegal_props/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/meta.yaml +9 -0
- data/test/migration/migrator1_2_0test_data/illegal_props/props.yaml +1 -0
- data/test/migration/migrator1_2_0test_data/no_outs/props.yaml +85 -0
- data/test/migration/migrator1_2_0test_data/no_props/out/M2NlOTA2ODEtZDdlNi00NWU1LWIwNDQtMjBmODY2ZGNkNzBj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
- data/test/migration/migrator1_2_0test_data/no_props/out/MDVhYzcxMjYtMGFlMS00Mzk0LWEyNmUtYjVjZjgwNDA0ZmE2/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
- data/test/migration/migrator1_2_0test_data/no_props/out/MzA1YTk0NDgtNzhjNi00NDk3LTk2NTktYzE1ZjBhNzdiYjNj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
- data/test/migration/migrator1_2_0test_data/no_props/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/meta.yaml +9 -0
- data/test/migration/test_Migrator.rb +1 -1
- data/test/migration/test_Migrator1_0_3.rb +1 -1
- data/test/migration/test_Migrator1_1_0.rb +1 -1
- data/test/migration/test_Migrator1_2_0.rb +94 -0
- data/test/plugin/embedded/test_SingleClickClient.rb +1 -2
- data/test/plugin/plugin_tests.rb +8 -0
- data/test/plugin/test_Loader.rb +1 -1
- data/test/shared/rate.csv +144 -0
- data/test/shared/shared_tests.rb +9 -0
- data/test/shared/test_Cross.rb +144 -0
- data/test/shared/test_PositionManager.rb +285 -0
- data/test/shared/test_Signal.rb +65 -0
- data/test/test_Output.rb +28 -21
- data/test/test_OutputManager.rb +162 -0
- data/test/test_Output_registry.rb +6 -17
- data/test/test_Process.rb +434 -222
- data/test/test_ProcessManager.rb +458 -101
- data/test/test_utils.rb +71 -8
- data/test/util/test_BlockToSession.rb +1 -2
- data/test/util/test_CSV.rb +1 -2
- data/test/util/test_SynchronizeInterceptor.rb +1 -2
- data/test/util/util_tests.rb +9 -0
- metadata +127 -47
- data/html/js/agent-editor-page.js +0 -440
- data/html/js/codepress/codepress.css +0 -21
- data/html/js/codepress/codepress.html +0 -35
- data/html/js/codepress/codepress.js +0 -138
- data/html/js/codepress/engines/gecko.js +0 -293
- data/html/js/codepress/engines/khtml.js +0 -0
- data/html/js/codepress/engines/msie.js +0 -304
- data/html/js/codepress/engines/older.js +0 -0
- data/html/js/codepress/engines/opera.js +0 -260
- data/html/js/codepress/images/line-numbers.gif +0 -0
- data/html/js/codepress/index.html +0 -443
- data/html/js/codepress/languages/asp.css +0 -71
- data/html/js/codepress/languages/asp.js +0 -117
- data/html/js/codepress/languages/autoit.css +0 -13
- data/html/js/codepress/languages/autoit.js +0 -32
- data/html/js/codepress/languages/csharp.css +0 -9
- data/html/js/codepress/languages/csharp.js +0 -25
- data/html/js/codepress/languages/css.css +0 -10
- data/html/js/codepress/languages/css.js +0 -23
- data/html/js/codepress/languages/generic.css +0 -9
- data/html/js/codepress/languages/generic.js +0 -25
- data/html/js/codepress/languages/html.css +0 -13
- data/html/js/codepress/languages/html.js +0 -59
- data/html/js/codepress/languages/java.css +0 -7
- data/html/js/codepress/languages/java.js +0 -24
- data/html/js/codepress/languages/javascript.css +0 -8
- data/html/js/codepress/languages/javascript.js +0 -30
- data/html/js/codepress/languages/perl.css +0 -11
- data/html/js/codepress/languages/perl.js +0 -27
- data/html/js/codepress/languages/php.css +0 -12
- data/html/js/codepress/languages/php.js +0 -61
- data/html/js/codepress/languages/ruby.css +0 -10
- data/html/js/codepress/languages/ruby.js +0 -26
- data/html/js/codepress/languages/sql.css +0 -10
- data/html/js/codepress/languages/sql.js +0 -30
- data/html/js/codepress/languages/text.css +0 -5
- data/html/js/codepress/languages/text.js +0 -9
- data/html/js/codepress/languages/vbscript.css +0 -71
- data/html/js/codepress/languages/vbscript.js +0 -117
- data/html/js/codepress/languages/xsl.css +0 -15
- data/html/js/codepress/languages/xsl.js +0 -103
- data/html/js/codepress/license.txt +0 -458
- data/html/js/edit_area/images/Thumbs.db +0 -0
- data/test/plugin/test_gem/a/lib/jiji_plugin_test.rb +0 -6
@@ -1,440 +0,0 @@
|
|
1
|
-
|
2
|
-
// ネームスペース
|
3
|
-
namespace( "fx.ui" )
|
4
|
-
namespace( "fx.ui.pages" )
|
5
|
-
|
6
|
-
// エージェント追加/編集UI
|
7
|
-
fx.ui.pages.AgentEditorPage = function() {
|
8
|
-
this.elementId = null // @Inject
|
9
|
-
this.agentServiceStub = null; //@Inject
|
10
|
-
this.agentFileListTable = null; //@Inject
|
11
|
-
this.dialog = null; // @Inject
|
12
|
-
this.topicPath = null; // @Inject
|
13
|
-
|
14
|
-
// データ
|
15
|
-
this.agentFiles = null;
|
16
|
-
// 編集中のファイル
|
17
|
-
this.editingFile = null;
|
18
|
-
|
19
|
-
// ボタン
|
20
|
-
var self = this;
|
21
|
-
this.addButton = new util.Button("agent-edit_add", "add", function() {
|
22
|
-
self.add();
|
23
|
-
}, fx.template.Templates.common.button.add);
|
24
|
-
this.addButton.setEnable( true );
|
25
|
-
|
26
|
-
this.removeButton = new util.Button("agent-edit_remove", "remove", function() {
|
27
|
-
self.remove();
|
28
|
-
}, fx.template.Templates.common.button.del);
|
29
|
-
this.removeButton.setEnable( true );
|
30
|
-
|
31
|
-
this.saveButton = new util.Button("agent-edit_save", "save", function() {
|
32
|
-
if ( !self.editingFile ) { return; }
|
33
|
-
var newData = agent_editor.getCode();
|
34
|
-
newData = newData.strip();
|
35
|
-
self.save(true,self.editingFile, self.target, newData);
|
36
|
-
}, fx.template.Templates.common.button.save);
|
37
|
-
this.saveButton.setEnable( false );
|
38
|
-
|
39
|
-
// 自動保存するためのタイマー
|
40
|
-
// this.autoSave = new util.Timer( 1000*10, function(){ self.save(); }, false );
|
41
|
-
}
|
42
|
-
fx.ui.pages.AgentEditorPage.prototype = {
|
43
|
-
|
44
|
-
/**
|
45
|
-
* このページから画面を移動する際に呼び出される。
|
46
|
-
* 戻り値としてfalseを返すと遷移をキャンセルする。
|
47
|
-
*/
|
48
|
-
from : function(toId) {
|
49
|
-
// 自動更新タイマーを停止
|
50
|
-
// this.autoSave.stop();
|
51
|
-
|
52
|
-
// 変更を強制的に反映するため、一旦保存
|
53
|
-
var self = this;
|
54
|
-
this.saveIfNotSaved(function(){
|
55
|
-
self.clearEdit();
|
56
|
-
});
|
57
|
-
|
58
|
-
// ページを非表示
|
59
|
-
document.getElementById(this.elementId).style.display = "none";
|
60
|
-
this.topicPath.set("");
|
61
|
-
return true;
|
62
|
-
},
|
63
|
-
/**
|
64
|
-
* このページに画面を移動すると呼び出される。
|
65
|
-
*/
|
66
|
-
to : function( fromId, param ) {
|
67
|
-
|
68
|
-
this.target = param["id"];
|
69
|
-
|
70
|
-
// ページを表示
|
71
|
-
document.getElementById(this.elementId).style.display = "block";
|
72
|
-
var frames = document.getElementById("agent-editor-body").getElementsByTagName("iframe")
|
73
|
-
for ( var i = 0 ; i < frames.length; i++ ) {
|
74
|
-
frames[i].style.width = "500px";
|
75
|
-
frames[i].style.height = "600px";
|
76
|
-
}
|
77
|
-
this.topicPath.set( this.target == "agent"
|
78
|
-
? fx.template.Templates.agentEditor.topicPath.agent
|
79
|
-
: fx.template.Templates.agentEditor.topicPath.sharedLib );
|
80
|
-
|
81
|
-
document.getElementById("agent_edit_desc").innerHTML =
|
82
|
-
this.target == "agent" ? fx.template.Templates.agentEditor.desc.agent : fx.template.Templates.agentEditor.desc.sharedLib;
|
83
|
-
|
84
|
-
this.clearEdit();
|
85
|
-
|
86
|
-
// ファイル一覧を更新
|
87
|
-
this.initialize();
|
88
|
-
},
|
89
|
-
|
90
|
-
initialize: function( ) {
|
91
|
-
var self = this;
|
92
|
-
self.editingFile = null;
|
93
|
-
agent_editor.setCode("\n");
|
94
|
-
this.agentFileListTable.initialize();
|
95
|
-
this.agentFileListTable.table.subscribe("rowSelectEvent", function(ev){
|
96
|
-
self.selectionChanged();
|
97
|
-
});
|
98
|
-
this.agentFileListTable.table.subscribe("rowUnselectEvent", function(ev){
|
99
|
-
self.selectionChanged();
|
100
|
-
});
|
101
|
-
this.agentFileListTable.loading(true);
|
102
|
-
this.listAgentFiles( true, function( data ) {
|
103
|
-
self.agentFiles = data;
|
104
|
-
self.agentFileListTable.setData(data);
|
105
|
-
self.agentFileListTable.loading(false);
|
106
|
-
self.selectionChanged();
|
107
|
-
// 自動更新タイマーを開始
|
108
|
-
// self.autoSave.start();
|
109
|
-
}, null ); // TODO
|
110
|
-
},
|
111
|
-
|
112
|
-
add: function(){
|
113
|
-
|
114
|
-
// ダイアログを開く
|
115
|
-
var self = this;
|
116
|
-
var old = agent_editor.textarea.readOnly;
|
117
|
-
this.dialog.show( "input", {
|
118
|
-
message : fx.template.Templates.agentEditor.add.body.evaluate({ "text" : "" }),
|
119
|
-
init: function() {
|
120
|
-
document.file_name_input_form.file_name_input.focus();
|
121
|
-
if ( !agent_editor.textarea.readOnly ) {
|
122
|
-
agent_editor.toggleReadOnly();
|
123
|
-
}
|
124
|
-
},
|
125
|
-
buttons : [
|
126
|
-
{ type:"ok",
|
127
|
-
alt: fx.template.Templates.common.button.ok,
|
128
|
-
key: "Enter",
|
129
|
-
action: function(dialog){
|
130
|
-
var text = document.getElementById("file_name_input").value;
|
131
|
-
|
132
|
-
// 文字列をチェック
|
133
|
-
var error = null;
|
134
|
-
if ( !text ) {
|
135
|
-
error = fx.template.Templates.agentEditor.add.errormsgs.no;
|
136
|
-
}
|
137
|
-
if ( !error && !text.match( /^[A-Za-z0-9_\*\+\-\#\"\'\!\~\(\)\[\]\?\.]+$/ ) ) {
|
138
|
-
error = fx.template.Templates.agentEditor.add.errormsgs.illegalChar;
|
139
|
-
}
|
140
|
-
// 重複チェック
|
141
|
-
var x = self;
|
142
|
-
if ( !error && self.agentFiles ) {
|
143
|
-
for ( var i = self.agentFiles.length-1; i >= 0; i-- ) {
|
144
|
-
if ( self.agentFiles[i]["name"] == (text.match( /\.rb$/) ? text : text + ".rb") ) {
|
145
|
-
error = fx.template.Templates.agentEditor.add.errormsgs.conflict;
|
146
|
-
break;
|
147
|
-
}
|
148
|
-
}
|
149
|
-
}
|
150
|
-
if ( !error && !(text.match( /\.rb$/ )) ) {
|
151
|
-
text = text + ".rb"
|
152
|
-
}
|
153
|
-
if (error) {
|
154
|
-
dialog.content.innerHTML =
|
155
|
-
fx.template.Templates.agentEditor.add.error.evaluate({ "error" : error.escapeHTML() })
|
156
|
-
+ fx.template.Templates.agentEditor.add.body.evaluate({ "text" : text.escapeHTML() })
|
157
|
-
return false;
|
158
|
-
} else {
|
159
|
-
self.saveFile( text, self.target, "", function(){
|
160
|
-
self.listAgentFiles( true, function( data ) {
|
161
|
-
self.agentFiles = data;
|
162
|
-
self.agentFileListTable.setData(data);
|
163
|
-
self.selectionChanged();
|
164
|
-
}, null ); // TODO
|
165
|
-
}, null ); // TODO
|
166
|
-
if ( old != agent_editor.textarea.readOnly ) {
|
167
|
-
agent_editor.toggleReadOnly();
|
168
|
-
}
|
169
|
-
return true;
|
170
|
-
}
|
171
|
-
} },
|
172
|
-
{ type:"cancel",
|
173
|
-
alt: fx.template.Templates.common.button.cancel,
|
174
|
-
key: "Esc",
|
175
|
-
action: function(dialog){
|
176
|
-
if ( old != agent_editor.textarea.readOnly ) {
|
177
|
-
agent_editor.toggleReadOnly();
|
178
|
-
}
|
179
|
-
return true;
|
180
|
-
}}
|
181
|
-
]
|
182
|
-
} );
|
183
|
-
},
|
184
|
-
remove: function(){
|
185
|
-
|
186
|
-
// 選択されている行を取得
|
187
|
-
var selectedRowIds = this.agentFileListTable.table.getSelectedTrEls();
|
188
|
-
if ( selectedRowIds.length <= 0 ) {
|
189
|
-
return;
|
190
|
-
}
|
191
|
-
var names = [];
|
192
|
-
for( var i=0,s=selectedRowIds.length;i<s;i++ ) {
|
193
|
-
names.push( this.agentFileListTable.table.getRecord( selectedRowIds[i] ).getData().name);
|
194
|
-
}
|
195
|
-
// 確認
|
196
|
-
var self = this;
|
197
|
-
var old = agent_editor.textarea.readOnly;
|
198
|
-
this.dialog.show( "input", {
|
199
|
-
message : fx.template.Templates.agentEditor.remove.body,
|
200
|
-
init: function() {
|
201
|
-
if ( !agent_editor.textarea.readOnly ) {
|
202
|
-
agent_editor.toggleReadOnly();
|
203
|
-
}
|
204
|
-
},
|
205
|
-
buttons : [
|
206
|
-
{ type:"ok",
|
207
|
-
alt: fx.template.Templates.common.button.ok,
|
208
|
-
key: "Enter",
|
209
|
-
action: function(dialog){
|
210
|
-
if ( old != agent_editor.textarea.readOnly ) {
|
211
|
-
agent_editor.toggleReadOnly();
|
212
|
-
}
|
213
|
-
// 行のデータを削除
|
214
|
-
self.deleteFile( names, function(){
|
215
|
-
self.listAgentFiles( true, function( data ) {
|
216
|
-
self.agentFiles = data;
|
217
|
-
self.agentFileListTable.setData(data);
|
218
|
-
self.selectionChanged();
|
219
|
-
}, null ); // TODO
|
220
|
-
}, null ); // TODO
|
221
|
-
return true;
|
222
|
-
}},
|
223
|
-
{ type:"cancel",
|
224
|
-
alt: fx.template.Templates.common.button.cancel,
|
225
|
-
key: "Esc",
|
226
|
-
action: function(dialog){
|
227
|
-
if ( old != agent_editor.textarea.readOnly ) {
|
228
|
-
agent_editor.toggleReadOnly();
|
229
|
-
}
|
230
|
-
return true;
|
231
|
-
}}
|
232
|
-
]
|
233
|
-
});
|
234
|
-
},
|
235
|
-
save: function( showResult, editingFile, mode, newData ){
|
236
|
-
var self = this;
|
237
|
-
this.saveFile( editingFile, mode, newData, function(result){
|
238
|
-
// 結果を表示しない == 別画面に移動する場合は、前のコードは不要なので変更しない。
|
239
|
-
if (!showResult) { return; }
|
240
|
-
self.prevCode = newData;
|
241
|
-
if ( result == "success" ) {
|
242
|
-
document.getElementById("agent_edit_msg").innerHTML =
|
243
|
-
fx.template.Templates.agentEditor.saved.success.evaluate({ "now" : util.formatDate( new Date() ) });
|
244
|
-
} else {
|
245
|
-
document.getElementById("agent_edit_msg").innerHTML =
|
246
|
-
fx.template.Templates.agentEditor.saved.error.evaluate({ "now" : util.formatDate( new Date() ), "result":result.escapeHTML()} );
|
247
|
-
}
|
248
|
-
}, null ); // TODO
|
249
|
-
},
|
250
|
-
/**
|
251
|
-
* 未保存かどうかチェックして、未保存でかつtrueであれば保存を実行する。
|
252
|
-
*/
|
253
|
-
saveIfNotSaved: function( callback ){
|
254
|
-
// 編集中でない
|
255
|
-
if ( !this.editingFile ) {
|
256
|
-
if (callback) { callback(); }
|
257
|
-
return true;
|
258
|
-
}
|
259
|
-
var editingFile = this.editingFile;
|
260
|
-
var target = this.target;
|
261
|
-
|
262
|
-
// コードが変更されていない
|
263
|
-
var newData = agent_editor.getCode();
|
264
|
-
newData = newData.strip();
|
265
|
-
var self = this;
|
266
|
-
if ( self.prevCode == newData ) {
|
267
|
-
if (callback) { callback(); }
|
268
|
-
return true;
|
269
|
-
}
|
270
|
-
|
271
|
-
// 確認ダイアログを表示
|
272
|
-
this.dialog.show( "input", {
|
273
|
-
message : fx.template.Templates.agentEditor.dosave,
|
274
|
-
buttons : [
|
275
|
-
{ type:"yes",
|
276
|
-
alt: fx.template.Templates.common.button.yes,
|
277
|
-
key: "Enter",
|
278
|
-
action: function(dialog){
|
279
|
-
self.save(false, editingFile, target, newData);
|
280
|
-
if (callback) { callback(); }
|
281
|
-
return true;
|
282
|
-
}},
|
283
|
-
{ type:"no",
|
284
|
-
alt: fx.template.Templates.common.button.no,
|
285
|
-
key: "Esc",
|
286
|
-
action: function(dialog){
|
287
|
-
if (callback) { callback(); }
|
288
|
-
return true;
|
289
|
-
}
|
290
|
-
}
|
291
|
-
]
|
292
|
-
});
|
293
|
-
},
|
294
|
-
/**
|
295
|
-
* 編集なし状態にします。
|
296
|
-
*/
|
297
|
-
clearEdit : function(){
|
298
|
-
this.editingFile = null;
|
299
|
-
agent_editor.setCode("\n");
|
300
|
-
this.saveButton.setEnable( false );
|
301
|
-
document.getElementById("agent_edit_msg").innerHTML = "";
|
302
|
-
},
|
303
|
-
selectionChanged: function() {
|
304
|
-
|
305
|
-
// 選択されている行を取得
|
306
|
-
var self = this;
|
307
|
-
var selectedRowIds = this.agentFileListTable.table.getSelectedTrEls();
|
308
|
-
var data = null;
|
309
|
-
var removeEnable = false;
|
310
|
-
if ( selectedRowIds.length <= 0 ) {
|
311
|
-
// 選択なし
|
312
|
-
removeEnable = false;
|
313
|
-
document.getElementById("agent-editor-file-name").innerHTML=
|
314
|
-
fx.template.Templates.agentEditor.defaultFileName;
|
315
|
-
} else if ( selectedRowIds.length == 1 ) {
|
316
|
-
removeEnable = true;
|
317
|
-
// エディタも更新する。
|
318
|
-
data = this.agentFileListTable.table.getRecord( selectedRowIds[0] ).getData();
|
319
|
-
} else {
|
320
|
-
removeEnable = true;
|
321
|
-
// エディタは初期化
|
322
|
-
document.getElementById("agent-editor-file-name").innerHTML= "---";
|
323
|
-
}
|
324
|
-
// 削除の状態更新
|
325
|
-
this.removeButton.setEnable(removeEnable);
|
326
|
-
this.saveButton.setEnable(false);
|
327
|
-
|
328
|
-
// エディタのデータを更新
|
329
|
-
// 保存確認
|
330
|
-
self.saveIfNotSaved( function(){
|
331
|
-
if ( data ) {
|
332
|
-
self.editingFile = null;
|
333
|
-
document.getElementById("agent-editor-file-name").innerHTML=
|
334
|
-
fx.template.Templates.common.loading;
|
335
|
-
self.getFile( data.name, function( body ) {
|
336
|
-
body = body.strip();
|
337
|
-
self.editingFile = data.name;
|
338
|
-
self.prevCode = body;
|
339
|
-
if ( agent_editor.textarea.readOnly ) {
|
340
|
-
agent_editor.toggleReadOnly();
|
341
|
-
}
|
342
|
-
if( body == "" ) body = "\n" // 空文字をcodePressに設定するとバグるので対策。
|
343
|
-
agent_editor.setCode(body);
|
344
|
-
agent_editor.editor.syntaxHighlight('init');
|
345
|
-
document.getElementById("agent-editor-file-name").innerHTML= data.name;
|
346
|
-
document.getElementById("agent_edit_msg").innerHTML = "";
|
347
|
-
self.saveButton.setEnable( true );
|
348
|
-
}, null ); // TODO
|
349
|
-
} else {
|
350
|
-
self.clearEdit();
|
351
|
-
agent_editor.editor.syntaxHighlight('init');
|
352
|
-
if ( !agent_editor.textarea.readOnly ) {
|
353
|
-
agent_editor.toggleReadOnly();
|
354
|
-
}
|
355
|
-
}
|
356
|
-
});
|
357
|
-
},
|
358
|
-
|
359
|
-
/**
|
360
|
-
* エージェントファイルの一覧を取得する。
|
361
|
-
* @param {Boolean} reload 再読み込みするかどうか
|
362
|
-
* @param {Function} success 成功時のコールバック
|
363
|
-
* @param {Function} fail 失敗時のコールバック
|
364
|
-
*/
|
365
|
-
listAgentFiles : function( reload, success, fail ) {
|
366
|
-
var self = this;
|
367
|
-
if ( !this.agentClasses || reload ) {
|
368
|
-
this.agentServiceStub.list_files( self.target, function( data ) {
|
369
|
-
self.agentFiles = data;
|
370
|
-
success(data);
|
371
|
-
}, fail );
|
372
|
-
} else {
|
373
|
-
success(data);
|
374
|
-
}
|
375
|
-
},
|
376
|
-
/**
|
377
|
-
* エージェントファイルを取得する。
|
378
|
-
* @param {String} file 取得するファイル
|
379
|
-
* @param {Function} success 成功時のコールバック
|
380
|
-
* @param {Function} fail 失敗時のコールバック
|
381
|
-
*/
|
382
|
-
getFile : function( file, success, fail ) {
|
383
|
-
this.agentServiceStub.get_file( file, this.target, success, fail );
|
384
|
-
},
|
385
|
-
/**
|
386
|
-
* エージェントファイルを保存する。
|
387
|
-
* @param {String} file 保存するファイル
|
388
|
-
* @param {String} content ファイル本文
|
389
|
-
* @param {Function} success 成功時のコールバック
|
390
|
-
* @param {Function} fail 失敗時のコールバック
|
391
|
-
*/
|
392
|
-
saveFile : function( file, target, content, success, fail ) {
|
393
|
-
this.agentServiceStub.put_file( file, content, target, success, fail );
|
394
|
-
},
|
395
|
-
/**
|
396
|
-
* エージェントファイルを削除する。
|
397
|
-
* @param {String} file 削除するファイル
|
398
|
-
* @param {Function} success 成功時のコールバック
|
399
|
-
* @param {Function} fail 失敗時のコールバック
|
400
|
-
*/
|
401
|
-
deleteFile : function( files, success, fail ) {
|
402
|
-
this.agentServiceStub.delete_files( files, this.target, success, fail );
|
403
|
-
}
|
404
|
-
}
|
405
|
-
|
406
|
-
|
407
|
-
// エージェント一覧テーブル
|
408
|
-
fx.ui.AgentFileListTable = function() {
|
409
|
-
this.elementId = null; // @Inject
|
410
|
-
this.table = null;
|
411
|
-
this.ds = null;
|
412
|
-
}
|
413
|
-
fx.ui.AgentFileListTable.prototype = util.merge( util.BasicTable, {
|
414
|
-
initialize: function() {
|
415
|
-
var self = this;
|
416
|
-
var columnDefs = [
|
417
|
-
{key:"name", label:fx.template.Templates.agentEditor.fileList.column.name,
|
418
|
-
sortable:true, resizeable:true, formatter: function( cell, record, column, data){
|
419
|
-
cell.innerHTML = String(data).escapeHTML();
|
420
|
-
}, width:122},
|
421
|
-
{key:"update", label:fx.template.Templates.agentEditor.fileList.column.update,
|
422
|
-
sortable:true, resizeable:true, formatter: function( cell, record, column, data){
|
423
|
-
var d = new Date(data*1000);
|
424
|
-
cell.innerHTML = util.formatDate(d);
|
425
|
-
}, width:118}
|
426
|
-
];
|
427
|
-
self.ds = new YAHOO.util.DataSource([]);
|
428
|
-
self.ds.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
|
429
|
-
self.ds.responseSchema = {
|
430
|
-
fields: ["name","update"]
|
431
|
-
};
|
432
|
-
self.table = new YAHOO.widget.DataTable(self.elementId,
|
433
|
-
columnDefs, self.ds, {
|
434
|
-
selectionMode:"standard",
|
435
|
-
scrollable: true,
|
436
|
-
width:"260px"
|
437
|
-
});
|
438
|
-
this.setBasicActions();
|
439
|
-
}
|
440
|
-
});
|
@@ -1,21 +0,0 @@
|
|
1
|
-
body {
|
2
|
-
margin-top:13px;
|
3
|
-
_margin-top:14px;
|
4
|
-
background:#E5E5E5;
|
5
|
-
margin-left:32px;
|
6
|
-
font-family: verdana, 'trebuchet ms', sans-serif;
|
7
|
-
font-size:13px;
|
8
|
-
white-space:pre;
|
9
|
-
background-image:url("images/line-numbers.gif");
|
10
|
-
background-repeat:repeat-y;
|
11
|
-
background-position:0 0px;
|
12
|
-
line-height:16px;
|
13
|
-
height:100%;
|
14
|
-
}
|
15
|
-
pre {margin:0;}
|
16
|
-
html>body{background-position:0 0px;}
|
17
|
-
P {margin:0;padding:0;border:0;outline:0;display:block;white-space:pre;}
|
18
|
-
b, i, s, u, a, em, tt, ins, big, cite, strong, var, dfn {text-decoration:none;font-weight:normal;font-style:normal;font-size:13px;}
|
19
|
-
|
20
|
-
body.hide-line-numbers {background:white;margin-left:16px;}
|
21
|
-
body.show-line-numbers {background-image:url("images/line-numbers.png");margin-left:32px;}
|
@@ -1,35 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>CodePress - Real Time Syntax Highlighting Editor written in JavaScript</title>
|
5
|
-
<meta name="description" content="CodePress - source code editor window" />
|
6
|
-
|
7
|
-
<script type="text/javascript">
|
8
|
-
var language = 'generic';
|
9
|
-
var engine = 'older';
|
10
|
-
var ua = navigator.userAgent;
|
11
|
-
var ts = (new Date).getTime(); // timestamp to avoid cache
|
12
|
-
var lh = location.href;
|
13
|
-
|
14
|
-
if(ua.match('MSIE')) engine = 'msie';
|
15
|
-
else if(ua.match('KHTML')) engine = 'khtml';
|
16
|
-
else if(ua.match('Opera')) engine = 'opera';
|
17
|
-
else if(ua.match('Gecko')) engine = 'gecko';
|
18
|
-
|
19
|
-
if(lh.match('language=')) language = lh.replace(/.*language=(.*?)(&.*)?$/,'$1');
|
20
|
-
|
21
|
-
document.write('<link type="text/css" href="codepress.css?ts='+ts+'" rel="stylesheet" />');
|
22
|
-
document.write('<link type="text/css" href="languages/'+language+'.css?ts='+ts+'" rel="stylesheet" id="cp-lang-style" />');
|
23
|
-
document.write('<scr'+'ipt type="text/javascript" src="engines/'+engine+'.js?ts='+ts+'"></scr'+'ipt>');
|
24
|
-
document.write('<scr'+'ipt type="text/javascript" src="languages/'+language+'.js?ts='+ts+'"></scr'+'ipt>');
|
25
|
-
</script>
|
26
|
-
|
27
|
-
</head>
|
28
|
-
|
29
|
-
<script type="text/javascript">
|
30
|
-
if(engine == "msie" || engine == "gecko") document.write('<body><pre> </pre></body>');
|
31
|
-
else if(engine == "opera") document.write('<body></body>');
|
32
|
-
// else if(engine == "khtml") document.write('<body> </body>');
|
33
|
-
</script>
|
34
|
-
|
35
|
-
</html>
|
@@ -1,138 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* CodePress - Real Time Syntax Highlighting Editor written in JavaScript - http://codepress.org/
|
3
|
-
*
|
4
|
-
* Copyright (C) 2006 Fernando M.A.d.S. <fermads@gmail.com>
|
5
|
-
*
|
6
|
-
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
7
|
-
* GNU Lesser General Public License as published by the Free Software Foundation.
|
8
|
-
*
|
9
|
-
* Read the full licence: http://www.opensource.org/licenses/lgpl-license.php
|
10
|
-
*/
|
11
|
-
|
12
|
-
CodePress = function(obj) {
|
13
|
-
var self = document.createElement('iframe');
|
14
|
-
self.textarea = obj;
|
15
|
-
self.textarea.disabled = true;
|
16
|
-
self.textarea.style.overflow = 'hidden';
|
17
|
-
self.style.height = self.textarea.clientHeight +'px';
|
18
|
-
self.style.width = self.textarea.clientWidth +'px';
|
19
|
-
self.textarea.style.overflow = 'auto';
|
20
|
-
//self.style.border = '1px solid gray';
|
21
|
-
self.frameBorder = 0; // remove IE internal iframe border
|
22
|
-
self.style.visibility = 'hidden';
|
23
|
-
self.style.position = 'absolute';
|
24
|
-
self.options = self.textarea.className;
|
25
|
-
|
26
|
-
self.initialize = function() {
|
27
|
-
self.editor = self.contentWindow.CodePress;
|
28
|
-
self.editor.body = self.contentWindow.document.getElementsByTagName('body')[0];
|
29
|
-
self.editor.setCode(self.textarea.value);
|
30
|
-
self.setOptions();
|
31
|
-
self.editor.syntaxHighlight('init');
|
32
|
-
self.textarea.style.display = 'none';
|
33
|
-
self.style.position = 'static';
|
34
|
-
self.style.visibility = 'visible';
|
35
|
-
self.style.display = 'inline';
|
36
|
-
}
|
37
|
-
|
38
|
-
// obj can by a textarea id or a string (code)
|
39
|
-
self.edit = function(obj,language) {
|
40
|
-
if(obj) self.textarea.value = document.getElementById(obj) ? document.getElementById(obj).value : obj;
|
41
|
-
if(!self.textarea.disabled) return;
|
42
|
-
self.language = language ? language : self.getLanguage();
|
43
|
-
self.src = CodePress.path+'codepress.html?language='+self.language+'&ts='+(new Date).getTime();
|
44
|
-
if(self.attachEvent) self.attachEvent('onload',self.initialize);
|
45
|
-
else self.addEventListener('load',self.initialize,false);
|
46
|
-
}
|
47
|
-
|
48
|
-
self.getLanguage = function() {
|
49
|
-
for (language in CodePress.languages)
|
50
|
-
if(self.options.match('\\b'+language+'\\b'))
|
51
|
-
return CodePress.languages[language] ? language : 'generic';
|
52
|
-
}
|
53
|
-
|
54
|
-
self.setOptions = function() {
|
55
|
-
if(self.options.match('autocomplete-off')) self.toggleAutoComplete();
|
56
|
-
if(self.options.match('readonly-on')) self.toggleReadOnly();
|
57
|
-
if(self.options.match('linenumbers-off')) self.toggleLineNumbers();
|
58
|
-
}
|
59
|
-
|
60
|
-
self.getCode = function() {
|
61
|
-
return self.textarea.disabled ? self.editor.getCode() : self.textarea.value;
|
62
|
-
}
|
63
|
-
|
64
|
-
self.setCode = function(code) {
|
65
|
-
self.textarea.disabled ? self.editor.setCode(code) : self.textarea.value = code;
|
66
|
-
}
|
67
|
-
|
68
|
-
self.toggleAutoComplete = function() {
|
69
|
-
self.editor.autocomplete = (self.editor.autocomplete) ? false : true;
|
70
|
-
}
|
71
|
-
|
72
|
-
self.toggleReadOnly = function() {
|
73
|
-
self.textarea.readOnly = (self.textarea.readOnly) ? false : true;
|
74
|
-
if(self.style.display != 'none') // prevent exception on FF + iframe with display:none
|
75
|
-
self.editor.readOnly(self.textarea.readOnly ? true : false);
|
76
|
-
}
|
77
|
-
|
78
|
-
self.toggleLineNumbers = function() {
|
79
|
-
var cn = self.editor.body.className;
|
80
|
-
self.editor.body.className = (cn==''||cn=='show-line-numbers') ? 'hide-line-numbers' : 'show-line-numbers';
|
81
|
-
}
|
82
|
-
|
83
|
-
self.toggleEditor = function() {
|
84
|
-
if(self.textarea.disabled) {
|
85
|
-
self.textarea.value = self.getCode();
|
86
|
-
self.textarea.disabled = false;
|
87
|
-
self.style.display = 'none';
|
88
|
-
self.textarea.style.display = 'inline';
|
89
|
-
}
|
90
|
-
else {
|
91
|
-
self.textarea.disabled = true;
|
92
|
-
self.setCode(self.textarea.value);
|
93
|
-
self.editor.syntaxHighlight('init');
|
94
|
-
self.style.display = 'inline';
|
95
|
-
self.textarea.style.display = 'none';
|
96
|
-
}
|
97
|
-
}
|
98
|
-
|
99
|
-
self.edit();
|
100
|
-
return self;
|
101
|
-
}
|
102
|
-
|
103
|
-
CodePress.languages = {
|
104
|
-
csharp : 'C#',
|
105
|
-
css : 'CSS',
|
106
|
-
generic : 'Generic',
|
107
|
-
html : 'HTML',
|
108
|
-
java : 'Java',
|
109
|
-
javascript : 'JavaScript',
|
110
|
-
perl : 'Perl',
|
111
|
-
ruby : 'Ruby',
|
112
|
-
php : 'PHP',
|
113
|
-
text : 'Text',
|
114
|
-
sql : 'SQL',
|
115
|
-
vbscript : 'VBScript'
|
116
|
-
}
|
117
|
-
|
118
|
-
|
119
|
-
CodePress.run = function() {
|
120
|
-
s = document.getElementsByTagName('script');
|
121
|
-
for(var i=0,n=s.length;i<n;i++) {
|
122
|
-
if(s[i].src.match('codepress.js')) {
|
123
|
-
CodePress.path = s[i].src.replace('codepress.js','');
|
124
|
-
}
|
125
|
-
}
|
126
|
-
t = document.getElementsByTagName('textarea');
|
127
|
-
for(var i=0,n=t.length;i<n;i++) {
|
128
|
-
if(t[i].className.match('codepress')) {
|
129
|
-
id = t[i].id;
|
130
|
-
t[i].id = id+'_cp';
|
131
|
-
eval(id+' = new CodePress(t[i])');
|
132
|
-
t[i].parentNode.insertBefore(eval(id), t[i]);
|
133
|
-
}
|
134
|
-
}
|
135
|
-
}
|
136
|
-
|
137
|
-
if(window.attachEvent) window.attachEvent('onload',CodePress.run);
|
138
|
-
else window.addEventListener('DOMContentLoaded',CodePress.run,false);
|