Commit 670efd29543b7a8a702655372bc51f8109f03d8b
1 parent
42087dcf
add jquery_ready which is execute code when the document.ready()
add jqscript in type JQuery_Actioner_type. add Jquery dialog
Showing
8 changed files
with
446 additions
and
314 deletions
Show diff stats
| 1 | +*.a2a | ... | ... |
web/CXM_jquery.anubis
| 1 | -/* | |
| 2 | - * Created by PyramIDE. | |
| 3 | - * User: Jeremy | |
| 4 | - * Date: 21/08/2012 | |
| 5 | - * Time: 16:52 | |
| 6 | - * | |
| 7 | - * To change this template use Tools | Options | Coding | Edit Standard Headers. | |
| 8 | - */ | |
| 9 | - | |
| 10 | -read calexium_lib/web/CXM_making_a_web_site.anubis | |
| 11 | -read tools/printable_tree.anubis | |
| 12 | -read tools/basis.anubis | |
| 13 | - | |
| 14 | -/* jQuery Actioner type */ | |
| 15 | -public type JQuery_Actioner_type: | |
| 16 | - jqform, | |
| 17 | - jqlink | |
| 18 | -. | |
| 19 | - | |
| 20 | -/* jQuery Actioner */ | |
| 21 | -public type JQuery_Actioner: | |
| 22 | - jQuery_actioner(Actioner_Target target, JQuery_Actioner_type type, String url_or_form_id) | |
| 23 | -. | |
| 24 | - | |
| 25 | - | |
| 26 | -/* jQuery default js files */ | |
| 27 | -define List(HTML_Head_Tag) | |
| 28 | - jquery_defaults | |
| 29 | - = | |
| 30 | - [ | |
| 31 | - js(js_file("/js/jquery/jquery-1.11.1.min.js")), | |
| 32 | - js(js_file("/js/jquery/jquery-ui-1.10.4.custom.min.js")), | |
| 33 | - ]. | |
| 34 | - | |
| 35 | -/* Initialize jQuery in compatiblity mode with jQueryUI */ | |
| 36 | -public define List(HTML_Head_Tag) | |
| 37 | - jquery_init | |
| 38 | - ( | |
| 39 | - String web_dir, | |
| 40 | - String theme_name | |
| 41 | - ) | |
| 42 | - = | |
| 43 | - if file_exists(web_dir+"/public/css/jquery/"+theme_name+"/jquery-ui-1.10.4.custom.min.css") then | |
| 44 | - [ css(css_file("/css/jquery/"+theme_name+"/jquery-ui-1.10.4.custom.min.css")) . jquery_defaults ] | |
| 45 | - else | |
| 46 | - println("Jquery Theme not found "+web_dir+"/css/jquery/"+theme_name+"/jquery-ui-1.10.4.custom.min.css"); | |
| 47 | - [ css(css_file("/css/jquery/redmond/jquery-ui-1.10.4.custom.min.css")) . jquery_defaults ] | |
| 48 | - . | |
| 1 | +/* | |
| 2 | + * Created by PyramIDE. | |
| 3 | + * User: Jeremy | |
| 4 | + * Date: 21/08/2012 | |
| 5 | + * Time: 16:52 | |
| 6 | + * | |
| 7 | + * To change this template use Tools | Options | Coding | Edit Standard Headers. | |
| 8 | + */ | |
| 9 | + | |
| 10 | +read calexium_lib/web/CXM_making_a_web_site.anubis | |
| 11 | +read tools/printable_tree.anubis | |
| 12 | +read tools/basis.anubis | |
| 13 | + | |
| 14 | +/* jQuery Actioner type */ | |
| 15 | +public type JQuery_Actioner_type: | |
| 16 | + jqform, | |
| 17 | + jqlink, | |
| 18 | + jqscript. | |
| 19 | + | |
| 20 | +/* jQuery Actioner */ | |
| 21 | +public type JQuery_Actioner: | |
| 22 | + jQuery_actioner(Actioner_Target target, JQuery_Actioner_type type, String url_or_form_id). | |
| 23 | + | |
| 24 | + | |
| 25 | +/* */ | |
| 26 | +public define Script | |
| 27 | + jquery_ready | |
| 28 | + ( | |
| 29 | + String code //javascript code to execute when the document is ready | |
| 30 | + )= | |
| 31 | + script("","$(document).ready(function(){"+code+"});"). | |
| 32 | + | |
| 33 | + | |
| 34 | +/* jQuery default js files */ | |
| 35 | +define List(HTML_Head_Tag) | |
| 36 | + jquery_defaults | |
| 37 | + = | |
| 38 | + [ | |
| 39 | + js(js_file("/js/jquery/jquery-1.11.1.min.js")), | |
| 40 | + js(js_file("/js/jquery/jquery-ui-1.10.4.custom.min.js")), | |
| 41 | + ]. | |
| 42 | + | |
| 43 | +/* Initialize jQuery in compatiblity mode with jQueryUI */ | |
| 44 | +public define List(HTML_Head_Tag) | |
| 45 | + jquery_init | |
| 46 | + ( | |
| 47 | + String web_dir, | |
| 48 | + String theme_name | |
| 49 | + ) | |
| 50 | + = | |
| 51 | + if file_exists(web_dir+"/public/css/jquery/"+theme_name+"/jquery-ui-1.10.4.custom.min.css") then | |
| 52 | + [ css(css_file("/css/jquery/"+theme_name+"/jquery-ui-1.10.4.custom.min.css")) . jquery_defaults ] | |
| 53 | + else | |
| 54 | + println("Jquery Theme not found "+web_dir+"/css/jquery/"+theme_name+"/jquery-ui-1.10.4.custom.min.css"); | |
| 55 | + [ css(css_file("/css/jquery/redmond/jquery-ui-1.10.4.custom.min.css")) . jquery_defaults ] | |
| 56 | + . | ... | ... |
web/jQuery/CXM_jquery_button.anubis
| ... | ... | @@ -95,20 +95,23 @@ define HTML_Head_Tag |
| 95 | 95 | same then |
| 96 | 96 | if act_type is |
| 97 | 97 | { |
| 98 | - jqform then js_inline(script("", "$(document).ready(function(){$('#"+button_id+"').click(function(){$('#"+str+"').submit();});});")), | |
| 99 | - jqlink then js_inline(script("", "$(document).ready(function(){$('#"+button_id+"').click(function(){document.location='/?a="+str+"';});});")), | |
| 98 | + jqform then js_inline(jquery_ready("$('#"+button_id+"').click(function(){$('#"+str+"').submit();});")), | |
| 99 | + jqlink then js_inline(jquery_ready("$('#"+button_id+"').click(function(){document.location='/?a="+str+"';});")), | |
| 100 | + jqscript then js_inline(jquery_ready("$('#"+button_id+"').click(function(){"+str+"});")) | |
| 100 | 101 | }, |
| 101 | 102 | same(label) then |
| 102 | 103 | if act_type is |
| 103 | 104 | { |
| 104 | - jqform then js_inline(script("", "$(document).ready(function(){$('#"+button_id+"').click(function(){$('#"+str+"').submit();});});")), | |
| 105 | - jqlink then js_inline(script("", "$(document).ready(function(){$('#"+button_id+"').click(function(){document.location='/?a="+str+"';});});")), | |
| 105 | + jqform then js_inline(jquery_ready("$('#"+button_id+"').click(function(){$('#"+str+"').submit();});")), | |
| 106 | + jqlink then js_inline(jquery_ready("$('#"+button_id+"').click(function(){document.location='/?a="+str+"';});")), | |
| 107 | + jqscript then js_inline(jquery_ready("$('#"+button_id+"').click(function(){"+str+"});")) | |
| 106 | 108 | }, |
| 107 | 109 | other(window_name, window_options) then |
| 108 | 110 | if act_type is |
| 109 | 111 | { |
| 110 | - jqform then js_inline(script("", "$(document).ready(function(){$('#"+button_id+"').click(function(){$('#"+str+"').submit();});});")), //il s'agit d'une soumision d'un formulaire => cela se fait uniquement dans la même fenêtre ! | |
| 111 | - jqlink then js_inline(script("", "$(document).ready(function(){$('#"+button_id+"').click(function(){window.open('"+str+"', '"+window_name+"', '"+jquery_button_get_onclick_action_window_options(window_options, "")+"');});});")), | |
| 112 | + jqform then js_inline(jquery_ready("$('#"+button_id+"').click(function(){$('#"+str+"').submit();});")), //il s'agit d'une soumision d'un formulaire => cela se fait uniquement dans la même fenêtre ! | |
| 113 | + jqlink then js_inline(jquery_ready("$('#"+button_id+"').click(function(){window.open('"+str+"', '"+window_name+"', '"+jquery_button_get_onclick_action_window_options(window_options, "")+"');});")), | |
| 114 | + jqscript then js_inline(jquery_ready("$('#"+button_id+"').click(function(){"+str+"});")) | |
| 112 | 115 | } |
| 113 | 116 | } |
| 114 | 117 | . |
| ... | ... | @@ -147,7 +150,7 @@ define HTML_Partial_Content |
| 147 | 150 | _jquery_buttons( |
| 148 | 151 | t, |
| 149 | 152 | [ |
| 150 | - js_inline(script("", "$(document).ready(function(){$('#"+id+"').button();});")), | |
| 153 | + js_inline(jquery_ready("$('#"+id+"').button();")), | |
| 151 | 154 | onclick_action |
| 152 | 155 | ] |
| 153 | 156 | +html_tags, |
| ... | ... | @@ -161,7 +164,7 @@ define HTML_Partial_Content |
| 161 | 164 | _jquery_buttons( |
| 162 | 165 | t, |
| 163 | 166 | [ |
| 164 | - js_inline(script("", "$(document).ready(function(){$('#"+id+"').button({icons:{secondary:'"+jquery_icon_to_string(secondary)+"'}});});")), | |
| 167 | + js_inline(jquery_ready("$('#"+id+"').button({icons:{secondary:'"+jquery_icon_to_string(secondary)+"'}});")), | |
| 165 | 168 | onclick_action |
| 166 | 169 | ] |
| 167 | 170 | +html_tags, |
| ... | ... | @@ -176,7 +179,7 @@ define HTML_Partial_Content |
| 176 | 179 | _jquery_buttons( |
| 177 | 180 | t, |
| 178 | 181 | [ |
| 179 | - js_inline(script("", "$(document).ready(function(){$('#"+id+"').button({icons:{primary:'"+jquery_icon_to_string(primary)+"'}});});")), | |
| 182 | + js_inline(jquery_ready("$('#"+id+"').button({icons:{primary:'"+jquery_icon_to_string(primary)+"'}});")), | |
| 180 | 183 | onclick_action |
| 181 | 184 | ] |
| 182 | 185 | +html_tags, |
| ... | ... | @@ -190,7 +193,7 @@ define HTML_Partial_Content |
| 190 | 193 | _jquery_buttons( |
| 191 | 194 | t, |
| 192 | 195 | [ |
| 193 | - js_inline(script("", "$(document).ready(function(){$('#"+id+"').button({icons:{primary:'"+jquery_icon_to_string(primary)+"',secondary:'"+jquery_icon_to_string(secondary)+"'}});});")), | |
| 196 | + js_inline(jquery_ready("$('#"+id+"').button({icons:{primary:'"+jquery_icon_to_string(primary)+"',secondary:'"+jquery_icon_to_string(secondary)+"'}});")), | |
| 194 | 197 | onclick_action |
| 195 | 198 | ] |
| 196 | 199 | +html_tags, |
| ... | ... | @@ -212,7 +215,7 @@ public define HTML_Partial_Content |
| 212 | 215 | = |
| 213 | 216 | if _jquery_buttons(buttons, [], []) is partial_content(tags, html) then |
| 214 | 217 | partial_content( |
| 215 | - [ js_inline(script("", "$(document).ready(function(){$('#"+buttons_container_id+"').buttonset();});")) ] + tags, | |
| 218 | + [ js_inline(jquery_ready("$('#"+buttons_container_id+"').buttonset();")) ] + tags, | |
| 216 | 219 | sequence([ |
| 217 | 220 | literal("<div id=\""+buttons_container_id+"\">"), |
| 218 | 221 | html, |
| ... | ... | @@ -233,7 +236,7 @@ public define HTML_Partial_Content |
| 233 | 236 | if jquery_icon_to_string(secondary) = "" then |
| 234 | 237 | partial_content( |
| 235 | 238 | [ |
| 236 | - js_inline(script("", "$(document).ready(function(){$('#"+id+"').button();});")), | |
| 239 | + js_inline(jquery_ready("$('#"+id+"').button();")), | |
| 237 | 240 | onclick_action |
| 238 | 241 | ], |
| 239 | 242 | literal("<input type=\"submit\" id=\""+id+"\" name=\""+name+"\" value=\""+label+"\">") |
| ... | ... | @@ -241,7 +244,7 @@ public define HTML_Partial_Content |
| 241 | 244 | else |
| 242 | 245 | partial_content( |
| 243 | 246 | [ |
| 244 | - js_inline(script("", "$(document).ready(function(){$('#"+id+"').button({icons:{secondary:'"+jquery_icon_to_string(secondary)+"'}});});")), | |
| 247 | + js_inline(jquery_ready("$('#"+id+"').button({icons:{secondary:'"+jquery_icon_to_string(secondary)+"'}});")), | |
| 245 | 248 | onclick_action |
| 246 | 249 | ], |
| 247 | 250 | literal("<button id=\""+id+"\">"+label+"</button>") |
| ... | ... | @@ -250,7 +253,7 @@ public define HTML_Partial_Content |
| 250 | 253 | if jquery_icon_to_string(secondary) = "" then |
| 251 | 254 | partial_content( |
| 252 | 255 | [ |
| 253 | - js_inline(script("", "$(document).ready(function(){$('#"+id+"').button({icons:{primary:'"+jquery_icon_to_string(primary)+"'}});});")), | |
| 256 | + js_inline(jquery_ready("$('#"+id+"').button({icons:{primary:'"+jquery_icon_to_string(primary)+"'}});")), | |
| 254 | 257 | onclick_action |
| 255 | 258 | ], |
| 256 | 259 | literal("<button id=\""+id+"\">"+label+"</button>") |
| ... | ... | @@ -258,7 +261,7 @@ public define HTML_Partial_Content |
| 258 | 261 | else |
| 259 | 262 | partial_content( |
| 260 | 263 | [ |
| 261 | - js_inline(script("", "$(document).ready(function(){$('#"+id+"').button({icons:{primary:'"+jquery_icon_to_string(primary)+"',secondary:'"+jquery_icon_to_string(secondary)+"'}});});")), | |
| 264 | + js_inline(jquery_ready("$('#"+id+"').button({icons:{primary:'"+jquery_icon_to_string(primary)+"',secondary:'"+jquery_icon_to_string(secondary)+"'}});")), | |
| 262 | 265 | onclick_action |
| 263 | 266 | ], |
| 264 | 267 | literal("<button id=\""+id+"\">"+label+"</button>") |
| ... | ... | @@ -272,7 +275,7 @@ public type Icon_orientation: |
| 272 | 275 | right. |
| 273 | 276 | |
| 274 | 277 | public type JQuery_img_button: |
| 275 | - jquery_img_button(String img_url, String label_text, JQuery_Actioner jq_action, Icon_orientation orientation). | |
| 278 | + jquery_img_button(String img_url, String label_text, String id, JQuery_Actioner jq_action, Icon_orientation orientation). | |
| 276 | 279 | |
| 277 | 280 | public define HTML_Off_Form |
| 278 | 281 | jquery_button_html |
| ... | ... | @@ -280,7 +283,7 @@ public define HTML_Off_Form |
| 280 | 283 | JQuery_img_button button, |
| 281 | 284 | String button_id |
| 282 | 285 | ) = |
| 283 | - if button is jquery_img_button(img_url, label_text, actioner, orientation) then | |
| 286 | + if button is jquery_img_button(img_url, label_text, _, actioner, orientation) then | |
| 284 | 287 | div([id(button_id), class("jq_img_btn")], |
| 285 | 288 | if orientation is |
| 286 | 289 | { |
| ... | ... | @@ -289,20 +292,25 @@ public define HTML_Off_Form |
| 289 | 292 | left then table([class("jq_img_btn_table")],[ row( [cell(image(img_url)), cell(text(label_text)) ]) ]), |
| 290 | 293 | right then table([class("jq_img_btn_table")],[ row( [cell(text(label_text)), cell(image(img_url)) ]) ]), |
| 291 | 294 | }). |
| 292 | - | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 293 | 298 | public define HTML_Partial_Content |
| 294 | 299 | jquery_button |
| 295 | 300 | ( |
| 296 | 301 | JQuery_img_button button |
| 297 | 302 | )= |
| 298 | - if button is jquery_img_button(_, _, actioner, _) then | |
| 299 | - with button_id = generate_random_string(10), | |
| 303 | + if button is jquery_img_button(_, _, button_id, actioner, _) then | |
| 304 | + with button_id_str = if length(button_id) = 0 then | |
| 305 | + generate_random_string(10) | |
| 306 | + else | |
| 307 | + button_id, | |
| 300 | 308 | partial_content( |
| 301 | 309 | [ |
| 302 | - jquery_button_get_onclick_action(button_id, actioner), | |
| 310 | + jquery_button_get_onclick_action(button_id_str, actioner), | |
| 303 | 311 | css(css_file("css/cxm_button.css")), |
| 304 | - js_inline(script("","$(document).ready(function(){$('.jq_img_btn').button();});")) | |
| 312 | + js_inline(jquery_ready("$('.jq_img_btn').button();")) | |
| 305 | 313 | ], |
| 306 | - jquery_button_html(button, button_id)) | |
| 314 | + jquery_button_html(button, button_id_str)) | |
| 307 | 315 | . |
| 308 | 316 | ... | ... |
web/jQuery/CXM_jquery_datatable.anubis
| ... | ... | @@ -43,7 +43,7 @@ public define HTML_Partial_Content |
| 43 | 43 | ) |
| 44 | 44 | = |
| 45 | 45 | partial_content( |
| 46 | - [ js_inline(script("", "$(document).ready(function(){$('#"+table_id+"').dataTable();});")) ], | |
| 46 | + [ js_inline(jquery_ready("$('#"+table_id+"').dataTable();")) ], | |
| 47 | 47 | table |
| 48 | 48 | ) |
| 49 | 49 | . |
| ... | ... | @@ -58,7 +58,7 @@ public define HTML_Partial_Content |
| 58 | 58 | = |
| 59 | 59 | if enable_jqueryui then |
| 60 | 60 | partial_content( |
| 61 | - [ js_inline(script("", "$(document).ready(function(){$('#"+table_id+"').dataTable({\"bJQueryUI\":true});});")) ], | |
| 61 | + [ js_inline(jquery_ready("$('#"+table_id+"').dataTable({\"bJQueryUI\":true});")) ], | |
| 62 | 62 | table |
| 63 | 63 | ) |
| 64 | 64 | else |
| ... | ... | @@ -85,12 +85,7 @@ public define HTML_Partial_Content |
| 85 | 85 | = |
| 86 | 86 | partial_content( |
| 87 | 87 | [ |
| 88 | - js_inline( | |
| 89 | - script( | |
| 90 | - "", | |
| 91 | - " | |
| 92 | - $(document).ready(function() | |
| 93 | - { | |
| 88 | + js_inline(jquery_ready(" | |
| 94 | 89 | $('#"+table_id+"').dataTable( |
| 95 | 90 | { |
| 96 | 91 | \"bJQueryUI\":"+to_String(enable_jqueryui)+", |
| ... | ... | @@ -108,7 +103,6 @@ public define HTML_Partial_Content |
| 108 | 103 | get_datatable_translation(lang, web_dir)+ |
| 109 | 104 | jquery_datatable_extra_to_string(extra)+ |
| 110 | 105 | "}); |
| 111 | - }); | |
| 112 | 106 | " |
| 113 | 107 | ) |
| 114 | 108 | ) | ... | ... |
| 1 | +/* | |
| 2 | + * Created by PyramIDE. | |
| 3 | + * User: フランスのトトロ & julien | |
| 4 | + * Date: 09/11/2014 | |
| 5 | + * Time: 15:51 | |
| 6 | + * © Calexium | |
| 7 | + */ | |
| 8 | + | |
| 9 | +read calexium_lib/web/CXM_making_a_web_site.anubis | |
| 10 | +read calexium_lib/web/CXM_jquery.anubis | |
| 11 | + | |
| 12 | +public type JQuery_dialog_id: | |
| 13 | + dialog_id(String id). | |
| 14 | + | |
| 15 | +public type JQuery_dialog: | |
| 16 | + p_content(HTML_Partial_Content content), | |
| 17 | + off_form(HTML_Off_Form o_form), | |
| 18 | + ajax(String url). | |
| 19 | + | |
| 20 | + | |
| 21 | +public define HTML_Partial_Content | |
| 22 | + jq_dialog_create | |
| 23 | + ( | |
| 24 | + JQuery_dialog_id dial_id, | |
| 25 | + JQuery_dialog content, | |
| 26 | + String extra_parm | |
| 27 | + )= | |
| 28 | + with dlg_id = id(dial_id), | |
| 29 | + js = js_inline(jquery_ready(" | |
| 30 | + $( \"#"+dlg_id+"\" ).dialog({ | |
| 31 | + autoOpen: false, | |
| 32 | + modal: true, | |
| 33 | + height: 'auto', | |
| 34 | + width: 'auto', | |
| 35 | + "+extra_parm+" | |
| 36 | + Cancel: function() { | |
| 37 | + $( this ).dialog( 'close' ); | |
| 38 | + } | |
| 39 | + }); | |
| 40 | + ")), | |
| 41 | + | |
| 42 | + if content is | |
| 43 | + { | |
| 44 | + p_content(pc) then | |
| 45 | + if pc is partial_content(tags, html) then | |
| 46 | + partial_content( [js . tags ], html), //html code of the dialog | |
| 47 | + off_form(html) then | |
| 48 | + partial_content( [js], html), //html code of the dialog | |
| 49 | + ajax(url) then | |
| 50 | + partial_content( [js], div_empty([id(dlg_id), attr("ajax_url",url)])) | |
| 51 | + }. | |
| 52 | + | |
| 53 | +public define HTML_Partial_Content | |
| 54 | + jq_dialog_create | |
| 55 | + ( | |
| 56 | + JQuery_dialog_id dial_id, | |
| 57 | + JQuery_dialog content | |
| 58 | + )= | |
| 59 | + jq_dialog_create(dial_id, content, ""). | |
| 60 | + | |
| 61 | +define String | |
| 62 | + _jq_dialog_open | |
| 63 | + ( | |
| 64 | + Maybe(String) mb_html, | |
| 65 | + JQuery_dialog_id dialog_id, | |
| 66 | + String params | |
| 67 | + )= | |
| 68 | + with js_function = "jquery_dialog_click('"+id(dialog_id)+"', "+(if length(params)=0 then "''" else params) +");", | |
| 69 | + if mb_html is | |
| 70 | + { | |
| 71 | + failure then js_function, | |
| 72 | + success(html) then "<a onclick=\""+js_function+"\">"+html+"</a>" | |
| 73 | + }. | |
| 74 | + | |
| 75 | +public define String | |
| 76 | + jq_dialog_open | |
| 77 | + ( | |
| 78 | + String html, | |
| 79 | + JQuery_dialog_id dialog_id, | |
| 80 | + String params | |
| 81 | + )= | |
| 82 | + _jq_dialog_open(success(html), dialog_id, params). | |
| 83 | + | |
| 84 | +public define String | |
| 85 | + jq_dialog_open | |
| 86 | + ( | |
| 87 | + JQuery_dialog_id dialog_id | |
| 88 | + )= | |
| 89 | + _jq_dialog_open(failure, dialog_id, ""). | |
| 90 | + | |
| 91 | +public define List(HTML_Head_Tag) | |
| 92 | + jq_dialog_init | |
| 93 | + = | |
| 94 | + [ | |
| 95 | + js_inline(jquery_ready(" | |
| 96 | + jquery_dialog_click = function (dialog_id, url_args) { | |
| 97 | + var dialog_elem = $('#'+dialog_id); | |
| 98 | + if (dialog_elem.is('[ajax_url]')) { | |
| 99 | + $.ajax({ | |
| 100 | + url: $('#'+dialog_id).attr('ajax_url')+((url_args !== '')?'&':'')+url_args | |
| 101 | + }).done(function (data) { | |
| 102 | + var dialog_elem = $('#'+dialog_id); | |
| 103 | + | |
| 104 | + dialog_elem.html(data); | |
| 105 | + dialog_elem.dialog('open'); | |
| 106 | + }); | |
| 107 | + return; | |
| 108 | + } | |
| 109 | + | |
| 110 | + dialog_elem.dialog('open'); | |
| 111 | + }; | |
| 112 | + ")) | |
| 113 | + ]. | |
| 114 | + | |
| 115 | + | ... | ... |
web/jQuery/CXM_jquery_jqplot.anubis
| ... | ... | @@ -18,7 +18,7 @@ read tools/basis.anubis |
| 18 | 18 | )= |
| 19 | 19 | partial_content( |
| 20 | 20 | [ |
| 21 | - js_inline(script("","$(document).ready(function(){$('#jq_img_btn').button();});")) | |
| 21 | + js_inline(jquery_ready("$('#jq_img_btn').button();")) | |
| 22 | 22 | ], |
| 23 | 23 | div([id("jq_img_btn")], |
| 24 | 24 | table([ |
| ... | ... | @@ -39,17 +39,25 @@ public define HTML_Head_Tag |
| 39 | 39 | . |
| 40 | 40 | |
| 41 | 41 | /* jQuery default js files */ |
| 42 | -define List(HTML_Head_Tag) | |
| 43 | - jqplot_defaults | |
| 42 | +public define List(HTML_Head_Tag) | |
| 43 | + jqplot_init | |
| 44 | 44 | = |
| 45 | 45 | [ |
| 46 | 46 | js(js_file("/js/jquery/jqplot/jquery.jqplot.min.js")), |
| 47 | 47 | css(css_file("/js/jquery/jqplot/jquery.jqplot.min.css")), |
| 48 | 48 | ]. |
| 49 | 49 | |
| 50 | - | |
| 51 | -/* Initialize jQuery in compatiblity mode with jQueryUI */ | |
| 50 | +/* jQuery default js files, non minified version */ | |
| 52 | 51 | public define List(HTML_Head_Tag) |
| 52 | + jqplot_init_debug | |
| 53 | + = | |
| 54 | + [ | |
| 55 | + js(js_file("/js/jquery/jqplot/jquery.jqplot.js")), | |
| 56 | + css(css_file("/js/jquery/jqplot/jquery.jqplot.css")), | |
| 57 | + ]. | |
| 58 | + | |
| 59 | +/* Initialize jQuery in compatiblity mode with jQueryUI */ | |
| 60 | + public define List(HTML_Head_Tag) | |
| 53 | 61 | jqplot_init |
| 54 | 62 | = |
| 55 | 63 | jqplot_defaults. | ... | ... |
web/jQuery/CXM_jquery_tabs.anubis
| 1 | -/* | |
| 2 | - * Created by PyramIDE. | |
| 3 | - * User: Jeremy | |
| 4 | - * Date: 04/09/2012 | |
| 5 | - * Time: 16:19 | |
| 6 | - * | |
| 7 | - * To change this template use Tools | Options | Coding | Edit Standard Headers. | |
| 8 | - */ | |
| 9 | - | |
| 10 | -read calexium_lib/web/CXM_making_a_web_site.anubis | |
| 11 | -read tools/basis.anubis | |
| 12 | - | |
| 13 | -public type JQuery_tab: | |
| 14 | - jQuery_tab(String title, HTML_Partial_Content content) | |
| 15 | -. | |
| 16 | - | |
| 17 | - // Helper to be compatible with the first version of JQuery_tab which | |
| 18 | - // take HTML_Off_Form as second argument instead of HTML_Partial_Content. | |
| 19 | - | |
| 20 | -public define JQuery_tab | |
| 21 | - jQuery_tab | |
| 22 | - ( | |
| 23 | - String title, | |
| 24 | - HTML_Off_Form content | |
| 25 | - )= | |
| 26 | - jQuery_tab(title, partial_content([], content)). | |
| 27 | - | |
| 28 | - | |
| 29 | -define HTML_Partial_Content | |
| 30 | - _jquery_tabs | |
| 31 | - ( | |
| 32 | - String tabs_container_id, | |
| 33 | - List(JQuery_tab) tabs, | |
| 34 | - String tabs_titles, | |
| 35 | - List(HTML_Off_Form) tabs_contents, | |
| 36 | - List(HTML_Head_Tag) tabs_heads, | |
| 37 | - Int count | |
| 38 | - ) | |
| 39 | - = | |
| 40 | - if tabs is | |
| 41 | - { | |
| 42 | - [ ] then | |
| 43 | - partial_content( | |
| 44 | - reverse(tabs_heads), | |
| 45 | - sequence([ | |
| 46 | - literal("<ul>"+tabs_titles+"</ul>"), | |
| 47 | - sequence(reverse(tabs_contents)) | |
| 48 | - ]) | |
| 49 | - ), | |
| 50 | - [ h . t ] then | |
| 51 | - if h is jQuery_tab(title, p_content) then | |
| 52 | - if p_content is partial_content(tags, content) then | |
| 53 | - _jquery_tabs( | |
| 54 | - tabs_container_id, | |
| 55 | - t, | |
| 56 | - tabs_titles + "<li><a href=\"#"+tabs_container_id+"-tab-"+count+"\">"+title+"</a></li>", | |
| 57 | - [ | |
| 58 | - sequence([ | |
| 59 | - literal("<div id=\""+tabs_container_id+"-tab-"+count+"\">"), | |
| 60 | - content, | |
| 61 | - literal("</div>") | |
| 62 | - ]) | |
| 63 | - . | |
| 64 | - tabs_contents | |
| 65 | - ], | |
| 66 | - tags + tabs_heads, | |
| 67 | - count+1 | |
| 68 | - ) | |
| 69 | - } | |
| 70 | - . | |
| 71 | - | |
| 72 | - | |
| 73 | -public define HTML_Partial_Content | |
| 74 | - jquery_tabs | |
| 75 | - ( | |
| 76 | - String tabs_container_id, | |
| 77 | - List(JQuery_tab) tabs | |
| 78 | - ) | |
| 79 | - = | |
| 80 | - if _jquery_tabs(tabs_container_id, tabs, "", [], [], 0) is partial_content(tags, html) then | |
| 81 | - partial_content( | |
| 82 | - [ | |
| 83 | - js_inline(script("", "$(document).ready(function(){$('#"+tabs_container_id+"').tabs();});")) | |
| 84 | - . | |
| 85 | - tags | |
| 86 | - ], | |
| 87 | - sequence([ | |
| 88 | - literal("<div id=\""+tabs_container_id+"\">"), | |
| 89 | - html, | |
| 90 | - literal("</div>") | |
| 91 | - ]) | |
| 92 | - ) | |
| 93 | - . | |
| 94 | - | |
| 1 | +/* | |
| 2 | + * Created by PyramIDE. | |
| 3 | + * User: Jeremy | |
| 4 | + * Date: 04/09/2012 | |
| 5 | + * Time: 16:19 | |
| 6 | + * | |
| 7 | + * To change this template use Tools | Options | Coding | Edit Standard Headers. | |
| 8 | + */ | |
| 9 | + | |
| 10 | +read calexium_lib/web/CXM_making_a_web_site.anubis | |
| 11 | +read calexium_lib/web/CXM_jquery.anubis | |
| 12 | +read tools/basis.anubis | |
| 13 | + | |
| 14 | +public type JQuery_tab: | |
| 15 | + jQuery_tab(String title, HTML_Partial_Content content) | |
| 16 | +. | |
| 17 | + | |
| 18 | + // Helper to be compatible with the first version of JQuery_tab which | |
| 19 | + // take HTML_Off_Form as second argument instead of HTML_Partial_Content. | |
| 20 | + | |
| 21 | +public define JQuery_tab | |
| 22 | + jQuery_tab | |
| 23 | + ( | |
| 24 | + String title, | |
| 25 | + HTML_Off_Form content | |
| 26 | + )= | |
| 27 | + jQuery_tab(title, partial_content([], content)). | |
| 28 | + | |
| 29 | + | |
| 30 | +define HTML_Partial_Content | |
| 31 | + _jquery_tabs | |
| 32 | + ( | |
| 33 | + String tabs_container_id, | |
| 34 | + List(JQuery_tab) tabs, | |
| 35 | + String tabs_titles, | |
| 36 | + List(HTML_Off_Form) tabs_contents, | |
| 37 | + List(HTML_Head_Tag) tabs_heads, | |
| 38 | + Int count | |
| 39 | + ) | |
| 40 | + = | |
| 41 | + if tabs is | |
| 42 | + { | |
| 43 | + [ ] then | |
| 44 | + partial_content( | |
| 45 | + reverse(tabs_heads), | |
| 46 | + sequence([ | |
| 47 | + literal("<ul>"+tabs_titles+"</ul>"), | |
| 48 | + sequence(reverse(tabs_contents)) | |
| 49 | + ]) | |
| 50 | + ), | |
| 51 | + [ h . t ] then | |
| 52 | + if h is jQuery_tab(title, p_content) then | |
| 53 | + if p_content is partial_content(tags, content) then | |
| 54 | + _jquery_tabs( | |
| 55 | + tabs_container_id, | |
| 56 | + t, | |
| 57 | + tabs_titles + "<li><a href=\"#"+tabs_container_id+"-tab-"+count+"\">"+title+"</a></li>", | |
| 58 | + [ | |
| 59 | + sequence([ | |
| 60 | + literal("<div id=\""+tabs_container_id+"-tab-"+count+"\">"), | |
| 61 | + content, | |
| 62 | + literal("</div>") | |
| 63 | + ]) | |
| 64 | + . | |
| 65 | + tabs_contents | |
| 66 | + ], | |
| 67 | + tags + tabs_heads, | |
| 68 | + count+1 | |
| 69 | + ) | |
| 70 | + } | |
| 71 | + . | |
| 72 | + | |
| 73 | + | |
| 74 | +public define HTML_Partial_Content | |
| 75 | + jquery_tabs | |
| 76 | + ( | |
| 77 | + String tabs_container_id, | |
| 78 | + List(JQuery_tab) tabs | |
| 79 | + ) | |
| 80 | + = | |
| 81 | + if _jquery_tabs(tabs_container_id, tabs, "", [], [], 0) is partial_content(tags, html) then | |
| 82 | + partial_content( | |
| 83 | + [ | |
| 84 | + js_inline(jquery_ready("$('#"+tabs_container_id+"').tabs();")) | |
| 85 | + . | |
| 86 | + tags | |
| 87 | + ], | |
| 88 | + sequence([ | |
| 89 | + literal("<div id=\""+tabs_container_id+"\">"), | |
| 90 | + html, | |
| 91 | + literal("</div>") | |
| 92 | + ]) | |
| 93 | + ) | |
| 94 | + . | |
| 95 | + | ... | ... |
web/jQuery/CXM_jquery_tiptip.anubis
| 1 | -/* | |
| 2 | - * Created by PyramIDE. | |
| 3 | - * User: Jeremy | |
| 4 | - * Date: 18/09/2012 | |
| 5 | - * Time: 15:42 | |
| 6 | - * | |
| 7 | - * To change this template use Tools | Options | Coding | Edit Standard Headers. | |
| 8 | - */ | |
| 9 | - | |
| 10 | -read calexium_lib/web/CXM_making_a_web_site.anubis | |
| 11 | -read calexium_lib/web/CXM_jquery.anubis | |
| 12 | -read tools/basis.anubis | |
| 13 | -read system/string.anubis | |
| 14 | -read system/convert.anubis | |
| 15 | - | |
| 16 | -/* jQuery tipTip position type */ | |
| 17 | -public type JQ_tiptip_position: | |
| 18 | - jq_tiptip_top, | |
| 19 | - jq_tiptip_left, | |
| 20 | - jq_tiptip_bottom, // is default | |
| 21 | - jq_tiptip_right | |
| 22 | -. | |
| 23 | - | |
| 24 | -/* position to string */ | |
| 25 | -public define String | |
| 26 | - jq_tiptip_position_to_string | |
| 27 | - ( | |
| 28 | - JQ_tiptip_position p | |
| 29 | - ) | |
| 30 | - = | |
| 31 | - if p is | |
| 32 | - { | |
| 33 | - jq_tiptip_top then "top", | |
| 34 | - jq_tiptip_left then "left", | |
| 35 | - jq_tiptip_bottom then "bottom", | |
| 36 | - jq_tiptip_right then "right" | |
| 37 | - } | |
| 38 | - . | |
| 39 | - | |
| 40 | -/* position to string */ | |
| 41 | -public define JQ_tiptip_position | |
| 42 | - string_to_jq_tiptip_position | |
| 43 | - ( | |
| 44 | - String s | |
| 45 | - ) | |
| 46 | - = | |
| 47 | - if s="top" then jq_tiptip_top | |
| 48 | - else if s="left" then jq_tiptip_left | |
| 49 | - else if s="bottom" then jq_tiptip_bottom | |
| 50 | - else if s="right" then jq_tiptip_right | |
| 51 | - else jq_tiptip_bottom //is default | |
| 52 | - . | |
| 53 | - | |
| 54 | -/* Initialize jQuery tipTip */ | |
| 55 | -public define List(HTML_Head_Tag) | |
| 56 | - jquery_tiptip_init | |
| 57 | - ( | |
| 58 | - String web_dir, | |
| 59 | - ) | |
| 60 | - = | |
| 61 | - [ | |
| 62 | - css(css_file("/css/jquery/tipTip.css")), | |
| 63 | - js(js_file("/js/jquery/jquery.tipTip.minified.js")) | |
| 64 | - ] | |
| 65 | - . | |
| 66 | - | |
| 67 | - | |
| 68 | -/* Create a tipTip tooltip with a HTML_Partial_Content and position */ | |
| 69 | -public define HTML_Partial_Content | |
| 70 | - jquery_tiptip | |
| 71 | - ( | |
| 72 | - String rollovered_id, // id of the element on which toolip will be displayed => IT MUST BE UNIQUE !!!! | |
| 73 | - String tooltip_id, // id used to make a container around tooltip content => Uniqueness of the container's id is made with the addition of a timestamp as a suffix | |
| 74 | - HTML_Partial_Content tooltip_partial_content, | |
| 75 | - JQ_tiptip_position position | |
| 76 | - ) | |
| 77 | - = | |
| 78 | - if tooltip_partial_content is partial_content(head, body) then | |
| 79 | - partial_content( | |
| 80 | - [ | |
| 81 | - js_inline(script("", " | |
| 82 | - $(document).ready(function() | |
| 83 | - { | |
| 84 | - var tooltip_"+now+"=$('#"+tooltip_id+"-"+now+"').html(); | |
| 85 | - $('#"+rollovered_id+"').tipTip({maxWidth: 'auto', edgeOffset: 10, defaultPosition: \""+jq_tiptip_position_to_string(position)+"\", content: tooltip_"+now+"}); | |
| 86 | - }); | |
| 87 | - ")) | |
| 88 | - . | |
| 89 | - head | |
| 90 | - ], | |
| 91 | - sequence([ | |
| 92 | - literal("<div id=\""+tooltip_id+"-"+now+"\" style=\"display:none\">"), | |
| 93 | - body, | |
| 94 | - literal("</div>") | |
| 95 | - ]) | |
| 96 | - ) | |
| 97 | - . | |
| 98 | - | |
| 99 | -/* Create a tipTip tooltip with a HTML_Off_Form and position */ | |
| 100 | -public define HTML_Partial_Content | |
| 101 | - jquery_tiptip | |
| 102 | - ( | |
| 103 | - String rollovered_id, // id of the element on which toolip will be displayed => IT MUST BE UNIQUE !!!! | |
| 104 | - String tooltip_id, // id used to make a container around tooltip content => Uniqueness of the container's id is made with the addition of a timestamp as a suffix | |
| 105 | - HTML_Off_Form html_content, | |
| 106 | - JQ_tiptip_position position | |
| 107 | - ) | |
| 108 | - = | |
| 109 | - jquery_tiptip(rollovered_id, tooltip_id, partial_content([], html_content), position) | |
| 110 | - . | |
| 111 | - | |
| 112 | -/* Create a tipTip tooltip with a HTML_Partial_Content */ | |
| 113 | -public define HTML_Partial_Content | |
| 114 | - jquery_tiptip | |
| 115 | - ( | |
| 116 | - String rollovered_id, // id of the element on which toolip will be displayed => IT MUST BE UNIQUE !!!! | |
| 117 | - String tooltip_id, // id used to make a container around tooltip content => Uniqueness of the container's id is made with the addition of a timestamp as a suffix | |
| 118 | - HTML_Partial_Content tooltip_partial_content | |
| 119 | - ) | |
| 120 | - = | |
| 121 | - jquery_tiptip(rollovered_id, tooltip_id, tooltip_partial_content, jq_tiptip_bottom) | |
| 122 | - . | |
| 123 | - | |
| 124 | -/* Create a tipTip tooltip with a HTML_Off_Form */ | |
| 125 | -public define HTML_Partial_Content | |
| 126 | - jquery_tiptip | |
| 127 | - ( | |
| 128 | - String rollovered_id, // id of the element on which toolip will be displayed => IT MUST BE UNIQUE !!!! | |
| 129 | - String tooltip_id, // id used to make a container around tooltip content => Uniqueness of the container's id is made with the addition of a timestamp as a suffix | |
| 130 | - HTML_Off_Form html_content | |
| 131 | - ) | |
| 132 | - = | |
| 133 | - jquery_tiptip(rollovered_id, tooltip_id, partial_content([], html_content)) | |
| 134 | - . | |
| 135 | - | |
| 1 | +/* | |
| 2 | + * Created by PyramIDE. | |
| 3 | + * User: Jeremy | |
| 4 | + * Date: 18/09/2012 | |
| 5 | + * Time: 15:42 | |
| 6 | + * | |
| 7 | + * To change this template use Tools | Options | Coding | Edit Standard Headers. | |
| 8 | + */ | |
| 9 | + | |
| 10 | +read calexium_lib/web/CXM_making_a_web_site.anubis | |
| 11 | +read calexium_lib/web/CXM_jquery.anubis | |
| 12 | +read tools/basis.anubis | |
| 13 | +read system/string.anubis | |
| 14 | +read system/convert.anubis | |
| 15 | + | |
| 16 | +/* jQuery tipTip position type */ | |
| 17 | +public type JQ_tiptip_position: | |
| 18 | + jq_tiptip_top, | |
| 19 | + jq_tiptip_left, | |
| 20 | + jq_tiptip_bottom, // is default | |
| 21 | + jq_tiptip_right | |
| 22 | +. | |
| 23 | + | |
| 24 | +/* position to string */ | |
| 25 | +public define String | |
| 26 | + jq_tiptip_position_to_string | |
| 27 | + ( | |
| 28 | + JQ_tiptip_position p | |
| 29 | + ) | |
| 30 | + = | |
| 31 | + if p is | |
| 32 | + { | |
| 33 | + jq_tiptip_top then "top", | |
| 34 | + jq_tiptip_left then "left", | |
| 35 | + jq_tiptip_bottom then "bottom", | |
| 36 | + jq_tiptip_right then "right" | |
| 37 | + } | |
| 38 | + . | |
| 39 | + | |
| 40 | +/* position to string */ | |
| 41 | +public define JQ_tiptip_position | |
| 42 | + string_to_jq_tiptip_position | |
| 43 | + ( | |
| 44 | + String s | |
| 45 | + ) | |
| 46 | + = | |
| 47 | + if s="top" then jq_tiptip_top | |
| 48 | + else if s="left" then jq_tiptip_left | |
| 49 | + else if s="bottom" then jq_tiptip_bottom | |
| 50 | + else if s="right" then jq_tiptip_right | |
| 51 | + else jq_tiptip_bottom //is default | |
| 52 | + . | |
| 53 | + | |
| 54 | +/* Initialize jQuery tipTip */ | |
| 55 | +public define List(HTML_Head_Tag) | |
| 56 | + jquery_tiptip_init | |
| 57 | + ( | |
| 58 | + String web_dir, | |
| 59 | + ) | |
| 60 | + = | |
| 61 | + [ | |
| 62 | + css(css_file("/css/jquery/tipTip.css")), | |
| 63 | + js(js_file("/js/jquery/jquery.tipTip.minified.js")) | |
| 64 | + ] | |
| 65 | + . | |
| 66 | + | |
| 67 | + | |
| 68 | +/* Create a tipTip tooltip with a HTML_Partial_Content and position */ | |
| 69 | +public define HTML_Partial_Content | |
| 70 | + jquery_tiptip | |
| 71 | + ( | |
| 72 | + String rollovered_id, // id of the element on which toolip will be displayed => IT MUST BE UNIQUE !!!! | |
| 73 | + String tooltip_id, // id used to make a container around tooltip content => Uniqueness of the container's id is made with the addition of a timestamp as a suffix | |
| 74 | + HTML_Partial_Content tooltip_partial_content, | |
| 75 | + JQ_tiptip_position position | |
| 76 | + ) | |
| 77 | + = | |
| 78 | + if tooltip_partial_content is partial_content(head, body) then | |
| 79 | + partial_content( | |
| 80 | + [ | |
| 81 | + js_inline(jquery_ready(" | |
| 82 | + var tooltip_"+now+"=$('#"+tooltip_id+"-"+now+"').html(); | |
| 83 | + $('#"+rollovered_id+"').tipTip({maxWidth: 'auto', edgeOffset: 10, defaultPosition: \""+jq_tiptip_position_to_string(position)+"\", content: tooltip_"+now+"}); | |
| 84 | + ")) | |
| 85 | + . | |
| 86 | + head | |
| 87 | + ], | |
| 88 | + sequence([ | |
| 89 | + literal("<div id=\""+tooltip_id+"-"+now+"\" style=\"display:none\">"), | |
| 90 | + body, | |
| 91 | + literal("</div>") | |
| 92 | + ]) | |
| 93 | + ) | |
| 94 | + . | |
| 95 | + | |
| 96 | +/* Create a tipTip tooltip with a HTML_Off_Form and position */ | |
| 97 | +public define HTML_Partial_Content | |
| 98 | + jquery_tiptip | |
| 99 | + ( | |
| 100 | + String rollovered_id, // id of the element on which toolip will be displayed => IT MUST BE UNIQUE !!!! | |
| 101 | + String tooltip_id, // id used to make a container around tooltip content => Uniqueness of the container's id is made with the addition of a timestamp as a suffix | |
| 102 | + HTML_Off_Form html_content, | |
| 103 | + JQ_tiptip_position position | |
| 104 | + ) | |
| 105 | + = | |
| 106 | + jquery_tiptip(rollovered_id, tooltip_id, partial_content([], html_content), position) | |
| 107 | + . | |
| 108 | + | |
| 109 | +/* Create a tipTip tooltip with a HTML_Partial_Content */ | |
| 110 | +public define HTML_Partial_Content | |
| 111 | + jquery_tiptip | |
| 112 | + ( | |
| 113 | + String rollovered_id, // id of the element on which toolip will be displayed => IT MUST BE UNIQUE !!!! | |
| 114 | + String tooltip_id, // id used to make a container around tooltip content => Uniqueness of the container's id is made with the addition of a timestamp as a suffix | |
| 115 | + HTML_Partial_Content tooltip_partial_content | |
| 116 | + ) | |
| 117 | + = | |
| 118 | + jquery_tiptip(rollovered_id, tooltip_id, tooltip_partial_content, jq_tiptip_bottom) | |
| 119 | + . | |
| 120 | + | |
| 121 | +/* Create a tipTip tooltip with a HTML_Off_Form */ | |
| 122 | +public define HTML_Partial_Content | |
| 123 | + jquery_tiptip | |
| 124 | + ( | |
| 125 | + String rollovered_id, // id of the element on which toolip will be displayed => IT MUST BE UNIQUE !!!! | |
| 126 | + String tooltip_id, // id used to make a container around tooltip content => Uniqueness of the container's id is made with the addition of a timestamp as a suffix | |
| 127 | + HTML_Off_Form html_content | |
| 128 | + ) | |
| 129 | + = | |
| 130 | + jquery_tiptip(rollovered_id, tooltip_id, partial_content([], html_content)) | |
| 131 | + . | |
| 132 | + | ... | ... |