Commit 56fa599fca7b89b842b6ccf919375cf5030c9dad

Authored by totoro
1 parent cd5d8eb4

add edit dialog on hayamiki list table

database/vtm/view_table_renderer.anubis
@@ -25,6 +25,7 @@ read calexium_lib/web/CXM_making_a_web_site.anubis @@ -25,6 +25,7 @@ read calexium_lib/web/CXM_making_a_web_site.anubis
25 read calexium_lib/web/CXM_multihost_http_server.anubis 25 read calexium_lib/web/CXM_multihost_http_server.anubis
26 read calexium_lib/web/jQuery/CXM_jquery_datatable.anubis 26 read calexium_lib/web/jQuery/CXM_jquery_datatable.anubis
27 read calexium_lib/web/jQuery/CXM_jquery_datatable_types.anubis 27 read calexium_lib/web/jQuery/CXM_jquery_datatable_types.anubis
  28 +read calexium_lib/web/jQuery/CXM_jquery_dialog.anubis
28 read calexium_lib/web/jQuery/ui-addon/datetimepicker.anubis 29 read calexium_lib/web/jQuery/ui-addon/datetimepicker.anubis
29 read calexium_lib/web/CXM_form.anubis 30 read calexium_lib/web/CXM_form.anubis
30 read calexium_lib/web/widgets/css_helper.anubis 31 read calexium_lib/web/widgets/css_helper.anubis
@@ -97,12 +98,10 @@ public define HTML_Partial_Content @@ -97,12 +98,10 @@ public define HTML_Partial_Content
97 with table_name = vt_elist.table_name, 98 with table_name = vt_elist.table_name,
98 with button_name = if get_String(lwa, "id","none") = "none" then _T("CREATE") else _T("UPDATE"), 99 with button_name = if get_String(lwa, "id","none") = "none" then _T("CREATE") else _T("UPDATE"),
99 partial_content(jq_datetimepicker_init(lang), 100 partial_content(jq_datetimepicker_init(lang),
100 - partial(html_wave_box(  
101 - _T(to_upper(table_name)),  
102 cxm_form( table_name, htmlId(table_name), lwa, 101 cxm_form( table_name, htmlId(table_name), lwa,
103 edit_form_lines(db, _T, vt_elist.list, [])+ 102 edit_form_lines(db, _T, vt_elist.list, [])+
104 [ submit("create", failure, button_name, [("table_name", table_name)]) ] 103 [ submit("create", failure, button_name, [("table_name", table_name)]) ]
105 - )))). 104 + )).
106 105
107 public define Maybe(HTML_Partial_Content) 106 public define Maybe(HTML_Partial_Content)
108 edit_table_content 107 edit_table_content
@@ -139,7 +138,8 @@ define HTML_Row(HTML_Off_Form) make_line @@ -139,7 +138,8 @@ define HTML_Row(HTML_Off_Form) make_line
139 with cell = if h is 138 with cell = if h is
140 { 139 {
141 text(string) then cell((HTML_Off_Form)text(string)), 140 text(string) then cell((HTML_Off_Form)text(string)),
142 - link(id, string) then cell((HTML_Off_Form)actioner(same,same, link(string), action_name, [("table_name", table_name),("id",id)])), 141 +// link(id, string) then cell((HTML_Off_Form)actioner(same,same, link(string), action_name, [("table_name", table_name),("id",id)])),
  142 + link(id, string) then cell((HTML_Off_Form)literal(jq_dialog_open(string, dialog_id(action_name+"_dlg_ajax"), "'id="+id+"'"))),
143 icon(icon_path) then cell((HTML_Off_Form)image([], icon_path, "")) 143 icon(icon_path) then cell((HTML_Off_Form)image([], icon_path, ""))
144 }, 144 },
145 make_line(table_name, action_name, t, [cell . so_far]) 145 make_line(table_name, action_name, t, [cell . so_far])
@@ -163,7 +163,8 @@ define List(HTML_Row(HTML_Off_Form)) @@ -163,7 +163,8 @@ define List(HTML_Row(HTML_Off_Form))
163 with actions_cell = (HTML_Cell(HTML_Off_Form)) 163 with actions_cell = (HTML_Cell(HTML_Off_Form))
164 cell([], 164 cell([],
165 sequence([ 165 sequence([
166 - partial(img_button_confirm(icn16_cross, _T("CONFIRMATION_REQUEST"), _T("CONFIRM_LINE_DELETION") , _T("OK"), _T("CANCEL"), jQuery_actioner(same, jqlink, "hk_del_row" + format_extra_operands([("table_name", table_name),("id",to_String(h.db_id))])))) 166 + partial(img_button_confirm(icn16_cross, _T("CONFIRMATION_REQUEST"), _T("CONFIRM_LINE_DELETION") , _T("OK"), _T("CANCEL"), jQuery_actioner(same, jqlink, "hk_del_row" + format_extra_operands([("table_name", table_name),("id",to_String(h.db_id))])))),
  167 + partial(img_button(icn16_edit, [event(onclick, jq_dialog_open(dialog_id(action_name+"_dlg_ajax"), "'id="+to_String(h.db_id)+"'"))], "", [])),
167 ]) 168 ])
168 ), 169 ),
169 make_lines(_T, table_name, action_name, t, [make_line(table_name, action_name, h.list, [actions_cell]). so_far] ) 170 make_lines(_T, table_name, action_name, t, [make_line(table_name, action_name, h.list, [actions_cell]). so_far] )
@@ -200,9 +201,13 @@ public define HTML_Partial_Content @@ -200,9 +201,13 @@ public define HTML_Partial_Content
200 VT_view rows 201 VT_view rows
201 )= 202 )=
202 with action_header_cell = header_cell((HTML_Off_Form)text(_T("ACTION"))), 203 with action_header_cell = header_cell((HTML_Off_Form)text(_T("ACTION"))),
203 - partial_content(div( [/*class("tableau")*/], 204 + partial_content(
  205 + div( [/*class("tableau")*/],
204 sequence( 206 sequence(
205 [ actioner(same,same, link([class("my_button")],_T("NEW")),"edit_table",[("table_name", rows.table_name)]), 207 [ actioner(same,same, link([class("my_button")],_T("NEW")),"edit_table",[("table_name", rows.table_name)]),
  208 + //dialog used by datatable entries
  209 + partial(jq_dialog_create(dialog_id("edit_table_dlg_ajax"), ajax("?a=ajax_edit_table&table_name="+rows.table_name))),
  210 +
206 table([core_attrs([id("table_view"), class("tableau display compact nowrap")])], 211 table([core_attrs([id("table_view"), class("tableau display compact nowrap")])],
207 make_header(_T, rows.header.list, [action_header_cell]), 212 make_header(_T, rows.header.list, [action_header_cell]),
208 make_lines(_T, rows.table_name, action_name, rows.list, [])) 213 make_lines(_T, rows.table_name, action_name, rows.list, []))
@@ -224,9 +229,9 @@ public define HTML_Partial_Content @@ -224,9 +229,9 @@ public define HTML_Partial_Content
224 // if tb is tool_box(lang, _T, _, _, db, _) then 229 // if tb is tool_box(lang, _T, _, _, db, _) then
225 // println("view_table_page - lang : "+lang); 230 // println("view_table_page - lang : "+lang);
226 // println("view_table_page - web_site_directory : "+web_site_directory); 231 // println("view_table_page - web_site_directory : "+web_site_directory);
227 - partial_content(  
228 - [html_wave_box_wide(_T(to_upper(rows.table_name)),  
229 - jquery_datatable("table_view", view_table_form(_T, action_name, rows), true, false, jq_dt_pt_full_numbers, scrollY(500), true, true, true, lang, no_extra, web_site_directory))]). 232 + partial_content(jq_dialog_init + jq_datetimepicker_init(lang),
  233 + [partial(html_wave_box_wide(_T(to_upper(rows.table_name)),
  234 + jquery_datatable("table_view", view_table_form(_T, action_name, rows), true, false, jq_dt_pt_full_numbers, scrollY(500), true, true, true, lang, no_extra, web_site_directory)))]).
230 235
231 public define Maybe(HTML_Partial_Content) 236 public define Maybe(HTML_Partial_Content)
232 view_table_content 237 view_table_content
web/CXM_making_a_web_site.anubis
@@ -3464,10 +3464,17 @@ define Printable_tree @@ -3464,10 +3464,17 @@ define Printable_tree
3464 "</a>" 3464 "</a>"
3465 ], 3465 ],
3466 img_link(options, img, alt_text) then 3466 img_link(options, img, alt_text) then
3467 - [  
3468 - "<a href=\"", url,"\"", format_attrs(options),"><img src=\"", img,  
3469 - "\" alt=\"" + alt_text + "\" border=\"0\"></a>"  
3470 - ], 3467 + //if action name is empty, format options on image because maybe there onclick action
  3468 + if action_name ="" then
  3469 + [
  3470 + "<img src=\"", img,"\"",
  3471 + format_attrs(options)," alt=\"" + alt_text + "\" border=\"0\">"
  3472 + ]
  3473 + else
  3474 + [
  3475 + "<a href=\"", url,"\"", format_attrs(options),"><img src=\"", img,
  3476 + "\" alt=\"" + alt_text + "\" border=\"0\"></a>"
  3477 + ],
3471 push_button(options, text) then 3478 push_button(options, text) then
3472 [ 3479 [
3473 if action is 3480 if action is
web/jQuery/CXM_jquery_dialog.anubis
@@ -100,7 +100,25 @@ public define String @@ -100,7 +100,25 @@ public define String
100 String params 100 String params
101 )= 101 )=
102 _jq_dialog_open(success(html), dialog_id, params). 102 _jq_dialog_open(success(html), dialog_id, params).
103 - 103 +
  104 +public define HTML_Partial_Content
  105 + jq_dialog_open
  106 + (
  107 + String html,
  108 + JQuery_dialog_id dialog_id,
  109 + String params
  110 + )=
  111 + partial_content([],
  112 + literal(_jq_dialog_open(success(html), dialog_id, params))).
  113 +
  114 +public define String
  115 + jq_dialog_open
  116 + (
  117 + JQuery_dialog_id dialog_id,
  118 + String params
  119 + )=
  120 + _jq_dialog_open(failure, dialog_id, params).
  121 +
104 public define String 122 public define String
105 jq_dialog_open 123 jq_dialog_open
106 ( 124 (
web/widgets/button.anubis
@@ -51,7 +51,7 @@ public define HTML_Partial_Content @@ -51,7 +51,7 @@ public define HTML_Partial_Content
51 String url, 51 String url,
52 List((String, String)) extra_ops 52 List((String, String)) extra_ops
53 )= 53 )=
54 - partial_content(actioner(same, same, img_link(core_attrs, img_path, ""), url, extra_ops)). 54 + partial_content(actioner(same, same, img_link(core_attrs+[style("cursor: pointer")], img_path, ""), url, extra_ops)).
55 55
56 public define HTML_Partial_Content 56 public define HTML_Partial_Content
57 img_button 57 img_button