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
@@ -7,163 +7,147 @@
|
|
7
7
|
******/
|
8
8
|
|
9
9
|
function EditArea(){
|
10
|
-
this
|
10
|
+
var t=this;
|
11
|
+
t.error= false; // to know if load is interrrupt
|
11
12
|
|
12
|
-
|
13
|
-
{popup_id: "edit_area_help", icon_id: "help"}
|
14
|
-
|
13
|
+
t.inlinePopup= [{popup_id: "area_search_replace", icon_id: "search"},
|
14
|
+
{popup_id: "edit_area_help", icon_id: "help"}];
|
15
|
+
t.plugins= {};
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
17
|
+
t.line_number=0;
|
18
|
+
|
19
|
+
parent.editAreaLoader.set_browser_infos(t); // navigator identification
|
20
|
+
// fix IE8 detection as we run in IE7 emulate mode through X-UA <meta> tag
|
21
|
+
if( t.isIE >= 8 )
|
22
|
+
t.isIE = 7;
|
23
|
+
|
24
|
+
t.last_selection={};
|
25
|
+
t.last_text_to_highlight="";
|
26
|
+
t.last_hightlighted_text= "";
|
27
|
+
t.syntax_list= [];
|
28
|
+
t.allready_used_syntax= {};
|
29
|
+
t.check_line_selection_timer= 50; // the timer delay for modification and/or selection change detection
|
30
|
+
|
31
|
+
t.textareaFocused= false;
|
32
|
+
t.highlight_selection_line= null;
|
33
|
+
t.previous= [];
|
34
|
+
t.next= [];
|
35
|
+
t.last_undo="";
|
36
|
+
t.files= {};
|
37
|
+
t.filesIdAssoc= {};
|
38
|
+
t.curr_file= '';
|
39
|
+
//t.loaded= false;
|
40
|
+
t.assocBracket={};
|
41
|
+
t.revertAssocBracket= {};
|
38
42
|
// bracket selection init
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
for(var index in
|
43
|
-
|
43
|
+
t.assocBracket["("]=")";
|
44
|
+
t.assocBracket["{"]="}";
|
45
|
+
t.assocBracket["["]="]";
|
46
|
+
for(var index in t.assocBracket){
|
47
|
+
t.revertAssocBracket[t.assocBracket[index]]=index;
|
44
48
|
}
|
45
|
-
|
49
|
+
t.is_editable= true;
|
46
50
|
|
47
51
|
|
48
|
-
/*
|
52
|
+
/*t.textarea="";
|
49
53
|
|
50
|
-
|
51
|
-
|
54
|
+
t.state="declare";
|
55
|
+
t.code = []; // store highlight syntax for languagues*/
|
52
56
|
// font datas
|
53
|
-
|
54
|
-
/*
|
55
|
-
|
56
|
-
|
57
|
-
if(
|
58
|
-
|
57
|
+
t.lineHeight= 16;
|
58
|
+
/*t.default_font_family= "monospace";
|
59
|
+
t.default_font_size= 10;*/
|
60
|
+
t.tab_nb_char= 8; //nb of white spaces corresponding to a tabulation
|
61
|
+
if(t.isOpera)
|
62
|
+
t.tab_nb_char= 6;
|
59
63
|
|
60
|
-
|
64
|
+
t.is_tabbing= false;
|
61
65
|
|
62
|
-
|
66
|
+
t.fullscreen= {'isFull': false};
|
63
67
|
|
64
|
-
|
68
|
+
t.isResizing=false; // resize var
|
65
69
|
|
66
|
-
// init with settings and ID
|
67
|
-
|
68
|
-
|
70
|
+
// init with settings and ID (area_id is a global var defined by editAreaLoader on iframe creation
|
71
|
+
t.id= area_id;
|
72
|
+
t.settings= editAreas[t.id]["settings"];
|
69
73
|
|
70
|
-
if((""+
|
74
|
+
if((""+t.settings['replace_tab_by_spaces']).match(/^[0-9]+$/))
|
71
75
|
{
|
72
|
-
|
73
|
-
|
74
|
-
for(var i=0; i<
|
75
|
-
|
76
|
+
t.tab_nb_char= t.settings['replace_tab_by_spaces'];
|
77
|
+
t.tabulation="";
|
78
|
+
for(var i=0; i<t.tab_nb_char; i++)
|
79
|
+
t.tabulation+=" ";
|
76
80
|
}else{
|
77
|
-
|
81
|
+
t.tabulation="\t";
|
78
82
|
}
|
79
83
|
|
80
84
|
// retrieve the init parameter for syntax
|
81
|
-
if(
|
82
|
-
|
85
|
+
if(t.settings["syntax_selection_allow"] && t.settings["syntax_selection_allow"].length>0)
|
86
|
+
t.syntax_list= t.settings["syntax_selection_allow"].replace(/ /g,"").split(",");
|
83
87
|
|
84
|
-
if(
|
85
|
-
|
88
|
+
if(t.settings['syntax'])
|
89
|
+
t.allready_used_syntax[t.settings['syntax']]=true;
|
86
90
|
|
87
91
|
|
88
92
|
};
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
{
|
102
|
-
editArea.tab_browsing_area.style.height= "0px";
|
103
|
-
editArea.tab_browsing_area.style.height= (editArea.result.offsetTop - editArea.tab_browsing_area.offsetTop -1)+"px";
|
104
|
-
}
|
105
|
-
|
106
|
-
var height= document.body.offsetHeight - editArea.get_all_toolbar_height() - 4;
|
107
|
-
editArea.result.style.height= height +"px";
|
108
|
-
|
109
|
-
var width=document.body.offsetWidth -2;
|
110
|
-
editArea.result.style.width= width+"px";
|
111
|
-
//alert("result h: "+ height+" w: "+width+"\ntoolbar h: "+this.get_all_toolbar_height()+"\nbody_h: "+document.body.offsetHeight);
|
112
|
-
|
113
|
-
// check that the popups don't get out of the screen
|
114
|
-
for(var i=0; i<editArea.inlinePopup.length; i++){
|
115
|
-
var popup= $(editArea.inlinePopup[i]["popup_id"]);
|
116
|
-
var max_left= document.body.offsetWidth- popup.offsetWidth;
|
117
|
-
var max_top= document.body.offsetHeight- popup.offsetHeight;
|
118
|
-
if(popup.offsetTop>max_top)
|
119
|
-
popup.style.top= max_top+"px";
|
120
|
-
if(popup.offsetLeft>max_left)
|
121
|
-
popup.style.left= max_left+"px";
|
122
|
-
}
|
123
|
-
}
|
124
|
-
};
|
125
|
-
|
93
|
+
EditArea.prototype.debug = function (obj) {
|
94
|
+
var out = document.getElementById('debug');
|
95
|
+
if ( typeof obj == "string" ) {
|
96
|
+
out.innerHTML += obj + "<br/>";
|
97
|
+
} else {
|
98
|
+
out.innerHTML += "---<br/>";
|
99
|
+
out.innerHTML += obj + "<br/>";
|
100
|
+
for ( var i in obj ) {
|
101
|
+
out.innerHTML += i + " : " + obj[i] + "<br/>";
|
102
|
+
}
|
103
|
+
}
|
104
|
+
};
|
126
105
|
EditArea.prototype.init= function(){
|
127
|
-
|
128
|
-
this.
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
if(
|
106
|
+
//try {
|
107
|
+
var t=this, a, s=t.settings;
|
108
|
+
t.textarea = _$("textarea");
|
109
|
+
t.container = _$("container");
|
110
|
+
t.result = _$("result");
|
111
|
+
t.content_highlight = _$("content_highlight");
|
112
|
+
t.selection_field = _$("selection_field");
|
113
|
+
t.selection_field_text= _$("selection_field_text");
|
114
|
+
t.processing_screen = _$("processing");
|
115
|
+
t.editor_area = _$("editor");
|
116
|
+
t.tab_browsing_area = _$("tab_browsing_area");
|
117
|
+
t.test_font_size = _$("test_font_size");
|
118
|
+
a = t.textarea;
|
119
|
+
|
120
|
+
if(!s['is_editable'])
|
121
|
+
t.set_editable(false);
|
122
|
+
|
123
|
+
t.set_show_line_colors( s['show_line_colors'] );
|
124
|
+
|
125
|
+
if(syntax_selec= _$("syntax_selection"))
|
142
126
|
{
|
143
127
|
// set up syntax selection lsit in the toolbar
|
144
|
-
for(var i=0; i<
|
145
|
-
var syntax=
|
128
|
+
for(var i=0; i<t.syntax_list.length; i++) {
|
129
|
+
var syntax= t.syntax_list[i];
|
146
130
|
var option= document.createElement("option");
|
147
131
|
option.value= syntax;
|
148
|
-
if(syntax==
|
132
|
+
if(syntax==s['syntax'])
|
149
133
|
option.selected= "selected";
|
150
|
-
option.innerHTML=
|
134
|
+
option.innerHTML= t.get_translation("syntax_" + syntax, "word");
|
151
135
|
syntax_selec.appendChild(option);
|
152
136
|
}
|
153
137
|
}
|
154
138
|
|
155
139
|
// add plugins buttons in the toolbar
|
156
|
-
spans= parent.getChildren($("toolbar_1"), "span", "", "", "all", -1);
|
140
|
+
spans= parent.getChildren(_$("toolbar_1"), "span", "", "", "all", -1);
|
157
141
|
|
158
142
|
for(var i=0; i<spans.length; i++){
|
159
143
|
|
160
144
|
id=spans[i].id.replace(/tmp_tool_(.*)/, "$1");
|
161
145
|
if(id!= spans[i].id){
|
162
|
-
for(var j in
|
163
|
-
if(typeof(
|
164
|
-
html=
|
146
|
+
for(var j in t.plugins){
|
147
|
+
if(typeof(t.plugins[j].get_control_html)=="function" ){
|
148
|
+
html=t.plugins[j].get_control_html(id);
|
165
149
|
if(html!=false){
|
166
|
-
html=
|
150
|
+
html= t.get_translation(html, "template");
|
167
151
|
var new_span= document.createElement("span");
|
168
152
|
new_span.innerHTML= html;
|
169
153
|
var father= spans[i].parentNode;
|
@@ -175,55 +159,58 @@
|
|
175
159
|
}
|
176
160
|
}
|
177
161
|
|
178
|
-
|
179
162
|
// init datas
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
163
|
+
//a.value = 'a';//editAreas[t.id]["textarea"].value;
|
164
|
+
|
165
|
+
if(s["debug"])
|
166
|
+
{
|
167
|
+
t.debug=parent.document.getElementById("edit_area_debug_"+t.id);
|
168
|
+
}
|
184
169
|
// init size
|
185
170
|
//this.update_size();
|
186
171
|
|
187
|
-
if($("redo") != null)
|
188
|
-
|
189
|
-
|
172
|
+
if(_$("redo") != null)
|
173
|
+
t.switchClassSticky(_$("redo"), 'editAreaButtonDisabled', true);
|
190
174
|
|
191
175
|
// insert css rules for highlight mode
|
192
|
-
if(typeof(parent.editAreaLoader.syntax[
|
176
|
+
if(typeof(parent.editAreaLoader.syntax[s["syntax"]])!="undefined"){
|
193
177
|
for(var i in parent.editAreaLoader.syntax){
|
194
|
-
|
178
|
+
if (typeof(parent.editAreaLoader.syntax[i]["styles"]) != "undefined"){
|
179
|
+
t.add_style(parent.editAreaLoader.syntax[i]["styles"]);
|
180
|
+
}
|
195
181
|
}
|
196
182
|
}
|
183
|
+
|
197
184
|
// init key events
|
198
|
-
if(
|
199
|
-
$("editor").onkeypress= keyDown;
|
185
|
+
if(t.isOpera)
|
186
|
+
_$("editor").onkeypress = keyDown;
|
200
187
|
else
|
201
|
-
$("editor").onkeydown= keyDown;
|
188
|
+
_$("editor").onkeydown = keyDown;
|
202
189
|
|
203
|
-
for(var i=0; i<
|
204
|
-
if(
|
205
|
-
$(
|
190
|
+
for(var i=0; i<t.inlinePopup.length; i++){
|
191
|
+
if(t.isOpera)
|
192
|
+
_$(t.inlinePopup[i]["popup_id"]).onkeypress = keyDown;
|
206
193
|
else
|
207
|
-
$(
|
194
|
+
_$(t.inlinePopup[i]["popup_id"]).onkeydown = keyDown;
|
208
195
|
}
|
209
196
|
|
210
|
-
if(
|
211
|
-
|
197
|
+
if(s["allow_resize"]=="both" || s["allow_resize"]=="x" || s["allow_resize"]=="y")
|
198
|
+
t.allow_resize(true);
|
212
199
|
|
213
|
-
parent.editAreaLoader.toggle(
|
214
|
-
//
|
200
|
+
parent.editAreaLoader.toggle(t.id, "on");
|
201
|
+
//a.focus();
|
215
202
|
// line selection init
|
216
|
-
|
203
|
+
t.change_smooth_selection_mode(editArea.smooth_selection);
|
217
204
|
// highlight
|
218
|
-
|
219
|
-
|
205
|
+
t.execCommand("change_highlight", s["start_highlight"]);
|
206
|
+
|
220
207
|
// get font size datas
|
221
|
-
|
208
|
+
t.set_font(editArea.settings["font_family"], editArea.settings["font_size"]);
|
222
209
|
|
223
210
|
// set unselectable text
|
224
211
|
children= parent.getChildren(document.body, "", "selec", "none", "all", -1);
|
225
212
|
for(var i=0; i<children.length; i++){
|
226
|
-
if(
|
213
|
+
if(t.isIE)
|
227
214
|
children[i].unselectable = true; // IE
|
228
215
|
else
|
229
216
|
children[i].onmousedown= function(){return false};
|
@@ -231,112 +218,162 @@
|
|
231
218
|
children[i].style.KhtmlUserSelect = "none"; // Konqueror/Safari*/
|
232
219
|
}
|
233
220
|
|
234
|
-
|
235
|
-
|
236
|
-
}
|
237
|
-
|
221
|
+
a.spellcheck= s["gecko_spellcheck"];
|
222
|
+
|
238
223
|
/** Browser specific style fixes **/
|
239
224
|
|
240
225
|
// fix rendering bug for highlighted lines beginning with no tabs
|
241
|
-
if(
|
242
|
-
|
226
|
+
if( t.isFirefox >= '3' ) {
|
227
|
+
t.content_highlight.style.paddingLeft= "1px";
|
228
|
+
t.selection_field.style.paddingLeft= "1px";
|
229
|
+
t.selection_field_text.style.paddingLeft= "1px";
|
230
|
+
}
|
243
231
|
|
244
|
-
if(
|
245
|
-
|
232
|
+
if(t.isIE && t.isIE < 8 ){
|
233
|
+
a.style.marginTop= "-1px";
|
246
234
|
}
|
247
235
|
/*
|
248
|
-
if(
|
249
|
-
|
236
|
+
if(t.isOpera){
|
237
|
+
t.editor_area.style.position= "absolute";
|
250
238
|
}*/
|
251
239
|
|
252
|
-
if(
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
if( this.nav['isChrome'] ){
|
259
|
-
this.editor_area.style.position= "absolute";
|
260
|
-
this.textarea.style.marginLeft="0px";
|
261
|
-
this.textarea.style.marginTop="0px";
|
240
|
+
if( t.isSafari ){
|
241
|
+
t.editor_area.style.position = "absolute";
|
242
|
+
a.style.marginLeft ="-3px";
|
243
|
+
if( t.isSafari < 3.2 ) // Safari 3.0 (3.1?)
|
244
|
+
a.style.marginTop ="1px";
|
262
245
|
}
|
263
246
|
|
264
247
|
// si le textarea n'est pas grand, un click sous le textarea doit provoquer un focus sur le textarea
|
265
|
-
parent.editAreaLoader.add_event(
|
248
|
+
parent.editAreaLoader.add_event(t.result, "click", function(e){ if((e.target || e.srcElement)==editArea.result) { editArea.area_select(editArea.textarea.value.length, 0);} });
|
266
249
|
|
267
|
-
if(
|
268
|
-
|
250
|
+
if(s['is_multi_files']!=false)
|
251
|
+
t.open_file({'id': t.curr_file, 'text': ''});
|
269
252
|
|
270
|
-
|
253
|
+
t.set_word_wrap( s['word_wrap'] );
|
271
254
|
|
272
255
|
setTimeout("editArea.focus();editArea.manage_size();editArea.execCommand('EA_load');", 10);
|
273
256
|
//start checkup routine
|
274
|
-
|
275
|
-
|
276
|
-
|
257
|
+
t.check_undo();
|
258
|
+
t.check_line_selection(true);
|
259
|
+
t.scroll_to_view();
|
277
260
|
|
278
|
-
for(var i in
|
279
|
-
if(typeof(
|
280
|
-
|
261
|
+
for(var i in t.plugins){
|
262
|
+
if(typeof(t.plugins[i].onload)=="function")
|
263
|
+
t.plugins[i].onload();
|
281
264
|
}
|
282
|
-
if(
|
283
|
-
|
265
|
+
if(s['fullscreen']==true)
|
266
|
+
t.toggle_full_screen(true);
|
284
267
|
|
285
268
|
parent.editAreaLoader.add_event(window, "resize", editArea.update_size);
|
286
269
|
parent.editAreaLoader.add_event(parent.window, "resize", editArea.update_size);
|
287
270
|
parent.editAreaLoader.add_event(top.window, "resize", editArea.update_size);
|
288
|
-
parent.editAreaLoader.add_event(window, "unload", function(){
|
289
|
-
|
271
|
+
parent.editAreaLoader.add_event(window, "unload", function(){
|
272
|
+
// in case where editAreaLoader have been already cleaned
|
273
|
+
if( parent.editAreaLoader )
|
274
|
+
{
|
275
|
+
parent.editAreaLoader.remove_event(parent.window, "resize", editArea.update_size);
|
276
|
+
parent.editAreaLoader.remove_event(top.window, "resize", editArea.update_size);
|
277
|
+
}
|
278
|
+
if(editAreas[editArea.id] && editAreas[editArea.id]["displayed"]){
|
279
|
+
editArea.execCommand("EA_unload");
|
280
|
+
}
|
281
|
+
});
|
290
282
|
|
283
|
+
//} catch ( e ) { debug(e); }
|
291
284
|
/*date= new Date();
|
292
285
|
alert(date.getTime()- parent.editAreaLoader.start_time);*/
|
293
286
|
};
|
294
287
|
|
295
288
|
|
289
|
+
|
290
|
+
//called by the toggle_on
|
291
|
+
EditArea.prototype.update_size= function(){
|
292
|
+
var d=document,pd=parent.document,height,width,popup,maxLeft,maxTop;
|
293
|
+
|
294
|
+
if( typeof editAreas != 'undefined' && editAreas[editArea.id] && editAreas[editArea.id]["displayed"]==true){
|
295
|
+
if(editArea.fullscreen['isFull']){
|
296
|
+
pd.getElementById("frame_"+editArea.id).style.width = pd.getElementsByTagName("html")[0].clientWidth + "px";
|
297
|
+
pd.getElementById("frame_"+editArea.id).style.height = pd.getElementsByTagName("html")[0].clientHeight + "px";
|
298
|
+
}
|
299
|
+
|
300
|
+
if(editArea.tab_browsing_area.style.display=='block' && ( !editArea.isIE || editArea.isIE >= 8 ) )
|
301
|
+
{
|
302
|
+
editArea.tab_browsing_area.style.height = "0px";
|
303
|
+
editArea.tab_browsing_area.style.height = (editArea.result.offsetTop - editArea.tab_browsing_area.offsetTop -1)+"px";
|
304
|
+
}
|
305
|
+
|
306
|
+
height = d.body.offsetHeight - editArea.get_all_toolbar_height() - 4;
|
307
|
+
editArea.result.style.height = Math.max(height, 0) +"px";
|
308
|
+
|
309
|
+
width = d.body.offsetWidth -2;
|
310
|
+
editArea.result.style.width = Math.max(width, 0)+"px";
|
311
|
+
//alert("result h: "+ height+" w: "+width+"\ntoolbar h: "+this.get_all_toolbar_height()+"\nbody_h: "+document.body.offsetHeight);
|
312
|
+
|
313
|
+
// check that the popups don't get out of the screen
|
314
|
+
for( i=0; i < editArea.inlinePopup.length; i++ )
|
315
|
+
{
|
316
|
+
popup = _$(editArea.inlinePopup[i]["popup_id"]);
|
317
|
+
maxLeft = d.body.offsetWidth - popup.offsetWidth;
|
318
|
+
maxTop = d.body.offsetHeight - popup.offsetHeight;
|
319
|
+
if( popup.offsetTop > maxTop )
|
320
|
+
popup.style.top = maxTop+"px";
|
321
|
+
if( popup.offsetLeft > maxLeft )
|
322
|
+
popup.style.left = maxLeft+"px";
|
323
|
+
}
|
324
|
+
|
325
|
+
editArea.manage_size( true );
|
326
|
+
editArea.fixLinesHeight( editArea.textarea.value, 0,-1);
|
327
|
+
}
|
328
|
+
};
|
329
|
+
|
330
|
+
|
296
331
|
EditArea.prototype.manage_size= function(onlyOneTime){
|
297
332
|
if(!editAreas[this.id])
|
298
333
|
return false;
|
334
|
+
|
299
335
|
if(editAreas[this.id]["displayed"]==true && this.textareaFocused)
|
300
336
|
{
|
301
|
-
var resized= false;
|
337
|
+
var area_height,resized= false;
|
302
338
|
|
303
339
|
//1) Manage display width
|
304
340
|
//1.1) Calc the new width to use for display
|
305
|
-
if( this.settings['
|
306
|
-
{
|
307
|
-
// var area_width= this.result.offsetWidth -50;
|
308
|
-
}
|
309
|
-
else
|
341
|
+
if( !this.settings['word_wrap'] )
|
310
342
|
{
|
311
343
|
var area_width= this.textarea.scrollWidth;
|
312
|
-
|
313
|
-
|
314
|
-
|
344
|
+
area_height= this.textarea.scrollHeight;
|
345
|
+
// bug on old opera versions
|
346
|
+
if(this.isOpera && this.isOpera < 9.6 ){
|
347
|
+
area_width=10000;
|
348
|
+
}
|
349
|
+
//1.2) the width is not the same, we must resize elements
|
350
|
+
if(this.textarea.previous_scrollWidth!=area_width)
|
351
|
+
{
|
352
|
+
this.container.style.width= area_width+"px";
|
353
|
+
this.textarea.style.width= area_width+"px";
|
354
|
+
this.content_highlight.style.width= area_width+"px";
|
355
|
+
this.textarea.previous_scrollWidth=area_width;
|
356
|
+
resized=true;
|
315
357
|
}
|
316
358
|
}
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
this.
|
324
|
-
|
325
|
-
this.content_highlight.style.width=
|
326
|
-
|
327
|
-
resized=true;
|
328
|
-
}
|
329
|
-
|
359
|
+
// manage wrap width
|
360
|
+
if( this.settings['word_wrap'] )
|
361
|
+
{
|
362
|
+
newW=this.textarea.offsetWidth;
|
363
|
+
if( this.isFirefox || this.isIE )
|
364
|
+
newW-=2;
|
365
|
+
if( this.isSafari )
|
366
|
+
newW-=6;
|
367
|
+
this.content_highlight.style.width=this.selection_field_text.style.width=this.selection_field.style.width=this.test_font_size.style.width=newW+"px";
|
368
|
+
}
|
330
369
|
|
331
370
|
//2) Manage display height
|
332
371
|
//2.1) Calc the new height to use for display
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
if(this.nav['isGecko'] && this.smooth_selection && this.last_selection["nb_line"])
|
339
|
-
area_height= this.last_selection["nb_line"]*this.lineHeight;
|
372
|
+
if( this.isOpera || this.isFirefox || this.isSafari ) {
|
373
|
+
area_height= this.getLinePosTop( this.last_selection["nb_line"] + 1 );
|
374
|
+
} else {
|
375
|
+
area_height = this.textarea.scrollHeight;
|
376
|
+
}
|
340
377
|
//2.2) the width is not the same, we must resize elements
|
341
378
|
if(this.textarea.previous_scrollHeight!=area_height)
|
342
379
|
{
|
@@ -350,17 +387,15 @@
|
|
350
387
|
//3) if there is new lines, we add new line numbers in the line numeration area
|
351
388
|
if(this.last_selection["nb_line"] >= this.line_number)
|
352
389
|
{
|
353
|
-
var
|
354
|
-
for(i=
|
390
|
+
var newLines= '', destDiv=_$("line_number"), start=this.line_number, end=this.last_selection["nb_line"]+100;
|
391
|
+
for( i = start+1; i < end; i++ )
|
355
392
|
{
|
356
|
-
|
393
|
+
newLines+='<div id="line_'+ i +'">'+i+"</div>";
|
357
394
|
this.line_number++;
|
358
395
|
}
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
span.innerHTML=div_line_number;
|
363
|
-
$("line_number").appendChild(span);
|
396
|
+
destDiv.innerHTML= destDiv.innerHTML + newLines;
|
397
|
+
|
398
|
+
this.fixLinesHeight( this.textarea.value, start, -1 );
|
364
399
|
}
|
365
400
|
|
366
401
|
//4) be sure the text is well displayed
|
@@ -370,18 +405,11 @@
|
|
370
405
|
this.scroll_to_view();
|
371
406
|
}
|
372
407
|
}
|
408
|
+
|
373
409
|
if(!onlyOneTime)
|
374
410
|
setTimeout("editArea.manage_size();", 100);
|
375
411
|
};
|
376
412
|
|
377
|
-
EditArea.prototype.add_event = function(obj, name, handler) {
|
378
|
-
if (this.nav['isIE']) {
|
379
|
-
obj.attachEvent("on" + name, handler);
|
380
|
-
} else{
|
381
|
-
obj.addEventListener(name, handler, false);
|
382
|
-
}
|
383
|
-
};
|
384
|
-
|
385
413
|
EditArea.prototype.execCommand= function(cmd, param){
|
386
414
|
|
387
415
|
for(var i in this.plugins){
|
@@ -390,6 +418,7 @@
|
|
390
418
|
return;
|
391
419
|
}
|
392
420
|
}
|
421
|
+
//debug( "exec: " + cmd );
|
393
422
|
switch(cmd){
|
394
423
|
case "save":
|
395
424
|
if(this.settings["save_callback"].length>0)
|
@@ -494,16 +523,16 @@
|
|
494
523
|
// add plugin translation to language translation array
|
495
524
|
EditArea.prototype.add_lang= function(language, values){
|
496
525
|
if(!parent.editAreaLoader.lang[language])
|
497
|
-
parent.editAreaLoader.lang[language]=
|
526
|
+
parent.editAreaLoader.lang[language]={};
|
498
527
|
for(var i in values)
|
499
528
|
parent.editAreaLoader.lang[language][i]= values[i];
|
500
529
|
};
|
501
530
|
|
502
531
|
// short cut for document.getElementById()
|
503
|
-
function $(id){return document.getElementById( id );};
|
532
|
+
function _$(id){return document.getElementById( id );};
|
504
533
|
|
505
534
|
var editArea = new EditArea();
|
506
|
-
|
535
|
+
parent.editAreaLoader.add_event(window, "load", init);
|
507
536
|
|
508
537
|
function init(){
|
509
538
|
setTimeout("editArea.init(); ", 10);
|