Commit 6fd7717b2a584565dc8d8f67ab6233f69c56b63d

Authored by totoro
1 parent ceed0d51

[+] add jq_button_confirm which show you a dialog confirmation before submit the action

web/CXM_jquery.anubis
@@ -4,7 +4,6 @@ @@ -4,7 +4,6 @@
4 * Date: 21/08/2012 4 * Date: 21/08/2012
5 * Time: 16:52 5 * Time: 16:52
6 * 6 *
7 - * To change this template use Tools | Options | Coding | Edit Standard Headers.  
8 */ 7 */
9 8
10 read calexium_lib/web/CXM_making_a_web_site.anubis 9 read calexium_lib/web/CXM_making_a_web_site.anubis
@@ -19,7 +18,7 @@ public type JQuery_Actioner_type: @@ -19,7 +18,7 @@ public type JQuery_Actioner_type:
19 18
20 /* jQuery Actioner */ 19 /* jQuery Actioner */
21 public type JQuery_Actioner: 20 public type JQuery_Actioner:
22 - jQuery_actioner(Actioner_Target target, JQuery_Actioner_type type, String url_or_form_id). 21 + jQuery_actioner(Actioner_Target target, JQuery_Actioner_type type, String url_or_form_id_or_script).
23 22
24 23
25 /* */ 24 /* */
web/jQuery/CXM_jquery_button.anubis
@@ -18,7 +18,7 @@ read tools/random.anubis @@ -18,7 +18,7 @@ read tools/random.anubis
18 public type JQuery_button_type: 18 public type JQuery_button_type:
19 button, 19 button,
20 reset, 20 reset,
21 - submit. 21 + submit. //button with confirmation dialog
22 22
23 public define String 23 public define String
24 to_String 24 to_String
@@ -149,7 +149,7 @@ define HTML_Partial_Content @@ -149,7 +149,7 @@ define HTML_Partial_Content
149 ( 149 (
150 List(JQuery_button) buttons, 150 List(JQuery_button) buttons,
151 List(HTML_Head_Tag) html_tags, 151 List(HTML_Head_Tag) html_tags,
152 - List(HTML_Off_Form) html_buttons 152 + List(HTML_Off_Form) html_buttons
153 ) 153 )
154 = 154 =
155 if buttons is 155 if buttons is
@@ -342,3 +342,50 @@ public define HTML_Partial_Content @@ -342,3 +342,50 @@ public define HTML_Partial_Content
342 jquery_button_html(button, button_id_str)) 342 jquery_button_html(button, button_id_str))
343 . 343 .
344 344
  345 +public define HTML_Partial_Content
  346 + jq_button_confirm
  347 + (
  348 + String button_label,
  349 + String dlg_title,
  350 + String dlg_text,
  351 + String dlg_ok,
  352 + String dlg_cancel,
  353 + String url,
  354 + List((String, String)) extra_ops
  355 + )=
  356 + with button_id = generate_random_string(10),
  357 + button_name = button_id,
  358 + actioner = jQuery_actioner(same, jqscript, "
  359 +
  360 + $( '#" + button_id + "_dlg' ).dialog({
  361 + title: '" + dlg_title + "',
  362 + resizable: false,
  363 + modal: true,
  364 + buttons: {
  365 + '" + dlg_ok + "': function() {
  366 + document.location='/?a=" + url + format_extra_operands(extra_ops)+"';
  367 + },
  368 + '" + dlg_cancel + "': function() {
  369 + $( this ).dialog( 'close' );
  370 + }
  371 + }
  372 + });"),
  373 + partial_content(sequence([
  374 + div([id(button_id+"_dlg"),style("display: none;")], text(dlg_text)),
  375 + partial(jquery_button(jQuery_button(button, button_id, button_name, button_label, actioner, jq_icon_none, jq_icon_none)))
  376 + ])).
  377 +
  378 +
  379 +
  380 +public define HTML_Partial_Content
  381 + jq_button_confirm
  382 + (
  383 + String button_label,
  384 + String dlg_title,
  385 + String dlg_text,
  386 + String dlg_ok,
  387 + String dlg_cancel,
  388 + String url
  389 + )=
  390 + jq_button_confirm(button_label, dlg_title, dlg_text, dlg_ok, dlg_cancel, url, []).
  391 +
web/jQuery/CXM_jquery_datatable.anubis
@@ -70,7 +70,7 @@ public define HTML_Partial_Content @@ -70,7 +70,7 @@ public define HTML_Partial_Content
70 jquery_datatable 70 jquery_datatable
71 ( 71 (
72 String table_id, 72 String table_id,
73 - HTML_Off_Form table, 73 + HTML_Partial_Content table,
74 Bool enable_jqueryui, 74 Bool enable_jqueryui,
75 Bool enable_pagination, 75 Bool enable_pagination,
76 JQuery_datatable_pagination_type pagination_type, 76 JQuery_datatable_pagination_type pagination_type,
@@ -125,4 +125,20 @@ public define HTML_Partial_Content @@ -125,4 +125,20 @@ public define HTML_Partial_Content
125 Bool enable_columns_sorting, 125 Bool enable_columns_sorting,
126 String web_dir 126 String web_dir
127 ) = 127 ) =
  128 + jquery_datatable(table_id, partial_content(table), enable_jqueryui, enable_pagination, pagination_type, scrollY, enable_change_page_length, enable_search_field, enable_columns_sorting, "en", no_extra, web_dir).
  129 +
  130 +public define HTML_Partial_Content
  131 + jquery_datatable
  132 + (
  133 + String table_id,
  134 + HTML_Partial_Content table,
  135 + Bool enable_jqueryui,
  136 + Bool enable_pagination,
  137 + JQuery_datatable_pagination_type pagination_type,
  138 + JQuery_datatable_scrollY_type scrollY,
  139 + Bool enable_change_page_length, // if true, "enable_pagination" must be true too.
  140 + Bool enable_search_field,
  141 + Bool enable_columns_sorting,
  142 + String web_dir
  143 + ) =
128 jquery_datatable(table_id, table, enable_jqueryui, enable_pagination, pagination_type, scrollY, enable_change_page_length, enable_search_field, enable_columns_sorting, "en", no_extra, web_dir). 144 jquery_datatable(table_id, table, enable_jqueryui, enable_pagination, pagination_type, scrollY, enable_change_page_length, enable_search_field, enable_columns_sorting, "en", no_extra, web_dir).