Commit e5f23786a3e1bf39a1b9917f4b2d512791c16372

Authored by David RENÉ
1 parent 5714863d

img_button_confirm take a new argument which is the target_id of load_content. S…

…o the behavior of this function change as follow. When the target_id is empty the jq_query function is use to submit the result else this is the ajax_load_content.
Showing 1 changed file with 24 additions and 8 deletions   Show diff stats
web/widgets/button.anubis
... ... @@ -11,6 +11,7 @@ transmit calexium_lib/web/CXM_jquery.anubis
11 11 read calexium_lib/web/CXM_json.anubis
12 12 read calexium_lib/web/js_tools.anubis
13 13 transmit calexium_lib/web/widgets/icons_set.anubis
  14 +read calexium_lib/web/load_content.anubis
14 15 read tools/basis.anubis
15 16 read tools/printable_tree.anubis
16 17  
... ... @@ -153,10 +154,15 @@ define List(CoreAttrs)
153 154 List(CoreAttrs) core_attrs,
154 155 String uid,
155 156 WEB_Action_Name web_action,
156   - List((String, String)) extra_ops
  157 + List((String, String)) extra_ops,
  158 + String load_content_target
157 159 ) =
158 160 //action to execute if confirmation is ok
159   - with ok_action = to_JS_String("CalexiumToolBox.jq_query("+format_web_action_name_to_js(web_action, extra_ops)+")"),
  161 +
  162 + with ok_action = if load_content_target = "" then
  163 + to_JS_String("CalexiumToolBox.jq_query("+format_web_action_name_to_js(web_action, extra_ops)+")")
  164 + else
  165 + to_JS_String("CalexiumToolBox.ajax_load_content('"+load_content_target+"', "+format_web_action_name_to_js(web_action, extra_ops)+", true)"),
160 166  
161 167 core_attrs + [id(uid), style("cursor: pointer"), event(onclick, "CalexiumToolBox.make_confirm_dialog(this, "+ ok_action +");")].
162 168  
... ... @@ -242,17 +248,27 @@ public define HTML_Partial_Content
242 248 String dlg_ok,
243 249 String dlg_cancel,
244 250 WEB_Action_Name web_action,
245   - List((String, String)) extra_ops
  251 + List((String, String)) extra_ops,
  252 + String load_content_target //if empty doesn't use load content
246 253 ) =
247 254 with uid = generate_random_string(20),
248 255 //with event_click = (CoreAttrs)event(onclick, "CalexiumToolBox.jq_query("+format_web_action_name_to_js(web_action, extra_ops)+")"),
249 256  
250 257 partial_content([js(js_file("js/cxm/cxm.js")), js_inline(jquery_ready(img_button_confirm_js(uid, dlg_title, dlg_text, dlg_ok, dlg_cancel)))],
251   - img(img_button_confirm_image_attrs(core_attrs, uid, web_action, extra_ops), img_path))
  258 + img(img_button_confirm_image_attrs(core_attrs, uid, web_action, extra_ops, load_content_target), img_path))
252 259 .
253 260  
254   -
255   -
256   - "<script type=\"text/javascript\">" + jquery_ready(img_button_confirm_js(uid, dlg_title, dlg_text, dlg_ok, dlg_cancel)) + "</script>" +
257   - "<img " + format_attrs(img_button_confirm_image_attrs(core_attrs, uid, web_action, extra_ops)) + " src=\"" + img_path + "\"></img>"
  261 +public define HTML_Partial_Content
  262 + img_button_confirm
  263 + (
  264 + String img_path,
  265 + List(CoreAttrs) core_attrs,
  266 + String dlg_title,
  267 + String dlg_text,
  268 + String dlg_ok,
  269 + String dlg_cancel,
  270 + WEB_Action_Name web_action,
  271 + List((String, String)) extra_ops
  272 + ) =
  273 + img_button_confirm(img_path, core_attrs, dlg_title, dlg_text, dlg_ok, dlg_cancel, web_action, extra_ops, "")
258 274 .
... ...