Commit 87cb5f32df8e2993447af9918166ddbea2de6c8a

Authored by totoro
1 parent 229894d6

rename web action name by adding hkc_ as prefix

add jqgrid init in partial content init
jqgrid, translate label in colModel
view/jqgrid.anubis
@@ -24,35 +24,36 @@ define String @@ -24,35 +24,36 @@ define String
24 to_jqGrid_ColModel 24 to_jqGrid_ColModel
25 ( 25 (
26 SQLite3DataBase db, 26 SQLite3DataBase db,
27 - VT_view_model_entry model 27 + VT_view_model_entry model,
  28 + (String) -> String _T
28 )= 29 )=
29 if model is 30 if model is
30 { 31 {
31 - primary_key then "{ name: \"id\" }",  
32 - information(label,column_name,width,help) then "{ name: \""+column_name+"\", label: \""+label+"\" }",  
33 - text(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+label+"\", editable:true }",  
34 - password(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+label+"\" }", 32 + primary_key then "{ name: \"id\", hidden:true }",
  33 + information(label,column_name,width,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\" }",
  34 + text(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true }",
  35 + password(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\" }",
35 foreign_text(label,column_name,selector,help) then 36 foreign_text(label,column_name,selector,help) then
36 - "{ name: \""+column_name+"\", label: \""+label+"\", editable:true, edittype:\"select\", editoptions:{value: "+to_jqGrid_selector(selector.get(db,""))+"},"+ 37 + "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, edittype:\"select\", editoptions:{value: "+to_jqGrid_selector(selector.get(db,""))+"},"+
37 " formatter: \"select\","+ 38 " formatter: \"select\","+
38 " formatoptions:{value: "+to_jqGrid_selector(selector.get(db,""))+"},"+ 39 " formatoptions:{value: "+to_jqGrid_selector(selector.get(db,""))+"},"+
39 "}", 40 "}",
40 choices_text(label,column_name,selector,help) then 41 choices_text(label,column_name,selector,help) then
41 - "{ name: \""+column_name+"\", label: \""+label+"\", editable:true, edittype:\"select\", editoptions:{value: "+to_jqGrid_selector(selector.get(db,""))+"},"+ 42 + "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, edittype:\"select\", editoptions:{value: "+to_jqGrid_selector(selector.get(db,""))+"},"+
42 " formatter: \"select\","+ 43 " formatter: \"select\","+
43 " formatoptions:{value: "+to_jqGrid_selector(selector.get(db,""))+"},"+ 44 " formatoptions:{value: "+to_jqGrid_selector(selector.get(db,""))+"},"+
44 "}", 45 "}",
45 - text_area(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+label+"\" }",  
46 - boolean(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+label+"\", editable:true, template: \"booleanCheckboxFa\" }",  
47 - integer(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+label+"\", editable:true, template: \"integer\" }",  
48 - float(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+label+"\", editable:true, template: \"number\" }",  
49 - choices_int(label,column_name,selector,help) then "{ name: \""+column_name+"\", label: \""+label+"\", editable:true, edittype:\"select\", editoptions:{value: "+to_jqGrid_selector(selector.get(db,""))+"},"+ 46 + text_area(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\" }",
  47 + boolean(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, template: \"booleanCheckboxFa\" }",
  48 + integer(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, template: \"integer\" }",
  49 + float(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, template: \"number\" }",
  50 + choices_int(label,column_name,selector,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, edittype:\"select\", editoptions:{value: "+to_jqGrid_selector(selector.get(db,""))+"},"+
50 " formatter: \"select\","+ 51 " formatter: \"select\","+
51 " formatoptions:{value: "+to_jqGrid_selector(selector.get(db,""))+"},"+ 52 " formatoptions:{value: "+to_jqGrid_selector(selector.get(db,""))+"},"+
52 "}", 53 "}",
53 - date(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+label+"\", editable:true, formatter: \"date\", formatoptions: { newformat: \"Y-M-d\" }}",  
54 - time(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+label+"\", editable:true }",  
55 - datetime(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+label+"\", editable:true }", 54 + date(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, formatter: \"date\", formatoptions: { newformat: \"Y-M-d\" }}",
  55 + time(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true }",
  56 + datetime(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true }",
56 } 57 }
57 . 58 .
58 59
@@ -60,12 +61,13 @@ public define String @@ -60,12 +61,13 @@ public define String
60 to_jqGrid_ColModel 61 to_jqGrid_ColModel
61 ( 62 (
62 SQLite3DataBase db, 63 SQLite3DataBase db,
  64 + (String) -> String _T,
63 List(VT_view_model_entry) models 65 List(VT_view_model_entry) models
64 )= 66 )=
65 "colModel: [\n"+ 67 "colModel: [\n"+
66 join(",\n ", 68 join(",\n ",
67 [ "{name: 'myac', label: 'Action', width:60, fixed:true, sortable:false, resize:false, formatter:'actions', formatoptions:{keys:true}}" . 69 [ "{name: 'myac', label: 'Action', width:60, fixed:true, sortable:false, resize:false, formatter:'actions', formatoptions:{keys:true}}" .
68 - map((VT_view_model_entry col_model) |-> to_jqGrid_ColModel(db, col_model), models) 70 + map((VT_view_model_entry col_model) |-> to_jqGrid_ColModel(db, col_model, _T), models)
69 ] 71 ]
70 )+ 72 )+
71 "]" 73 "]"
view/view_apps_renderer.anubis
@@ -34,7 +34,7 @@ define List(HTML_Row(HTML_Off_Form)) @@ -34,7 +34,7 @@ define List(HTML_Row(HTML_Off_Form))
34 cell( 34 cell(
35 sequence([ 35 sequence([
36 partial(img_button(icn16_add, [event(onclick, jq_dialog_open(dialog_id("edit_table_dlg_ajax"), "'table_name="+table_name+"'"))], "", [])), 36 partial(img_button(icn16_add, [event(onclick, jq_dialog_open(dialog_id("edit_table_dlg_ajax"), "'table_name="+table_name+"'"))], "", [])),
37 - partial(img_button(icn16_view_list, view_table, [("table_name",table_name)])) 37 + partial(img_button(icn16_view_list, hkc_view_table, [("table_name",table_name)]))
38 ]) 38 ])
39 ) 39 )
40 ]) 40 ])
view/view_table_renderer.anubis
@@ -30,6 +30,7 @@ read calexium_lib/web/jQuery/CXM_jquery_datatable_types.anubis @@ -30,6 +30,7 @@ read calexium_lib/web/jQuery/CXM_jquery_datatable_types.anubis
30 read calexium_lib/web/jQuery/CXM_jquery_dialog.anubis 30 read calexium_lib/web/jQuery/CXM_jquery_dialog.anubis
31 read calexium_lib/web/jQuery/CXM_jquery_button.anubis 31 read calexium_lib/web/jQuery/CXM_jquery_button.anubis
32 read calexium_lib/web/jQuery/ui-addon/datetimepicker.anubis 32 read calexium_lib/web/jQuery/ui-addon/datetimepicker.anubis
  33 +read calexium_lib/web/jQuery/jqgrid.anubis
33 read calexium_lib/web/CXM_form.anubis 34 read calexium_lib/web/CXM_form.anubis
34 read calexium_lib/web/widgets/css_helper.anubis 35 read calexium_lib/web/widgets/css_helper.anubis
35 read calexium_lib/web/widgets/button.anubis 36 read calexium_lib/web/widgets/button.anubis
@@ -102,7 +103,7 @@ define HTML_Header_Row(HTML_Off_Form) @@ -102,7 +103,7 @@ define HTML_Header_Row(HTML_Off_Form)
102 with cell = if h is 103 with cell = if h is
103 { 104 {
104 text(string) then header_cell((HTML_Off_Form)text(_T(string))), 105 text(string) then header_cell((HTML_Off_Form)text(_T(string))),
105 - link(id, string) then header_cell((HTML_Off_Form)actioner(same, same, link(string), edit_table,[])), //TODO 106 + link(id, string) then header_cell((HTML_Off_Form)actioner(same, same, link(string), hkc_edit_table,[])), //TODO
106 link_id_action(id, text, action) then header_cell((HTML_Off_Form)actioner(same,same, link(text), action,[("id",id)])), //TODO 107 link_id_action(id, text, action) then header_cell((HTML_Off_Form)actioner(same,same, link(text), action,[("id",id)])), //TODO
107 icon(icon_path) then header_cell((HTML_Off_Form)image([], icon_path, "")) 108 icon(icon_path) then header_cell((HTML_Off_Form)image([], icon_path, ""))
108 }, 109 },
@@ -164,18 +165,19 @@ public define HTML_Partial_Content @@ -164,18 +165,19 @@ public define HTML_Partial_Content
164 String uid, 165 String uid,
165 VT_view rows, 166 VT_view rows,
166 (String) -> String _T, 167 (String) -> String _T,
  168 + String lang,
167 String clause 169 String clause
168 )= 170 )=
169 with filter_clause = if clause = "" then "" else "&clause="+url_quote(clause), 171 with filter_clause = if clause = "" then "" else "&clause="+url_quote(clause),
170 with js = js_inline(jquery_ready("$(\"#"+uid+"_grid\").jqGrid({\n"+ 172 with js = js_inline(jquery_ready("$(\"#"+uid+"_grid\").jqGrid({\n"+
171 "url:'?aws_controller=hk_c&aws_action=grid_view&table_name="+rows.table_name+"&view_name="+rows.view_name+filter_clause+"',"+ 173 "url:'?aws_controller=hk_c&aws_action=grid_view&table_name="+rows.table_name+"&view_name="+rows.view_name+filter_clause+"',"+
172 "datatype: \"json\","+ 174 "datatype: \"json\","+
173 - to_jqGrid_ColModel(db, rows.view_model.list)+","+ 175 + to_jqGrid_ColModel(db, _T, rows.view_model.list)+","+
174 // rows.json_data_string+ 176 // rows.json_data_string+
175 jqGrid_options(uid, rows, _T)+ 177 jqGrid_options(uid, rows, _T)+
176 "})")), 178 "})")),
177 179
178 - partial_content([js], 180 + partial_content(jqgrid_init(lang) + [js],
179 div([], 181 div([],
180 sequence([ 182 sequence([
181 table([core_attrs([id(uid+"_grid")])],[]), 183 table([core_attrs([id(uid+"_grid")])],[]),
@@ -206,7 +208,7 @@ public define HTML_Partial_Content @@ -206,7 +208,7 @@ public define HTML_Partial_Content
206 sequence([ 208 sequence([
207 partial(jq_dialog_create(dialog_id(uid+action_name+"_dlg_ajax"), ajax(controller_action("hk_c", "ajax_edit_table&table_name="+rows.table_name)))), 209 partial(jq_dialog_create(dialog_id(uid+action_name+"_dlg_ajax"), ajax(controller_action("hk_c", "ajax_edit_table&table_name="+rows.table_name)))),
208 partial(img_button(icn16_add, [event(onclick, jq_dialog_open(dialog_id(uid+action_name+"_dlg_ajax")))], "", [])), 210 partial(img_button(icn16_add, [event(onclick, jq_dialog_open(dialog_id(uid+action_name+"_dlg_ajax")))], "", [])),
209 - partial(jqGrid_table(db, uid, rows, _T, clause)) 211 + partial(jqGrid_table(db, uid, rows, _T, lang, clause))
210 //partial(jquery_datatable(uid+"table_view", view_table_form(_T, uid, action_name, rows), true, false, jq_dt_pt_full_numbers, false, scrollY(500), true, true, true, lang, no_extra, web_site_directory)) 212 //partial(jquery_datatable(uid+"table_view", view_table_form(_T, uid, action_name, rows), true, false, jq_dt_pt_full_numbers, false, scrollY(500), true, true, true, lang, no_extra, web_site_directory))
211 ]))]). 213 ]))]).
212 214
@@ -226,11 +228,13 @@ public define HTML_Partial_Content @@ -226,11 +228,13 @@ public define HTML_Partial_Content
226 // println("view_table_page - lang : "+lang); 228 // println("view_table_page - lang : "+lang);
227 // println("view_table_page - web_site_directory : "+web_site_directory); 229 // println("view_table_page - web_site_directory : "+web_site_directory);
228 with uid = generate_random_string(20)+"_", 230 with uid = generate_random_string(20)+"_",
229 - partial_content(jq_dialog_init + jq_datetimepicker_init(lang), 231 + partial_content(
  232 + jq_dialog_init +
  233 + jq_datetimepicker_init(lang),
230 [ 234 [
231 partial(jq_dialog_create(dialog_id(uid+action_name+"_dlg_ajax"), ajax(controller_action("hk_c", "ajax_edit_table&table_name="+rows.table_name)))), 235 partial(jq_dialog_create(dialog_id(uid+action_name+"_dlg_ajax"), ajax(controller_action("hk_c", "ajax_edit_table&table_name="+rows.table_name)))),
232 partial(img_button(icn16_add, [event(onclick, jq_dialog_open(dialog_id(uid+action_name+"_dlg_ajax")))], "", [])), 236 partial(img_button(icn16_add, [event(onclick, jq_dialog_open(dialog_id(uid+action_name+"_dlg_ajax")))], "", [])),
233 - partial(jqGrid_table(db, uid, rows, _T, clause)), 237 + partial(jqGrid_table(db, uid, rows, _T, lang, clause)),
234 //partial(jquery_datatable(uid+"table_view", view_table_form(_T, uid, action_name, rows), true, false, jq_dt_pt_full_numbers, false, scrollY(200), true, true, true, lang, no_extra, web_site_directory)) 238 //partial(jquery_datatable(uid+"table_view", view_table_form(_T, uid, action_name, rows), true, false, jq_dt_pt_full_numbers, false, scrollY(200), true, true, true, lang, no_extra, web_site_directory))
235 ]). 239 ]).
236 240
@@ -251,8 +255,7 @@ public define Maybe(HTML_Partial_Content) @@ -251,8 +255,7 @@ public define Maybe(HTML_Partial_Content)
251 { 255 {
252 failure then failure, 256 failure then failure,
253 success(vtm_v) then 257 success(vtm_v) then
254 - since vtm_v is vtm_view(_, get_view),  
255 - success(view_table_page(db, _T, lang, web_site_directory, action_name, get_view(view_name), clause)) 258 + success(view_table_page(db, _T, lang, web_site_directory, action_name, vtm_v.get_view(view_name), clause))
256 }. 259 }.
257 260
258 public define Maybe(HTML_Partial_Content) 261 public define Maybe(HTML_Partial_Content)
@@ -272,9 +275,7 @@ public define Maybe(HTML_Partial_Content) @@ -272,9 +275,7 @@ public define Maybe(HTML_Partial_Content)
272 { 275 {
273 failure then failure, 276 failure then failure,
274 success(vtm_v) then 277 success(vtm_v) then
275 - since vtm_v is vtm_view(_, get_view),  
276 -// success(view_table(_T, lang, web_site_directory, action_name, get_view(db, view_name, clause)))  
277 - success(view_table(db, _T, lang, web_site_directory, action_name, get_view(view_name), clause)) 278 + success(view_table(db, _T, lang, web_site_directory, action_name, vtm_v.get_view(view_name), clause))
278 }. 279 }.
279 280
280 define CXM_Form_Field 281 define CXM_Form_Field
@@ -410,9 +411,9 @@ public define HTML_Partial_Content @@ -410,9 +411,9 @@ public define HTML_Partial_Content
410 cxm_form( table_name, lwa, 411 cxm_form( table_name, lwa,
411 edit_form_lines(db, _T, vt_elist.list, create, [])+ 412 edit_form_lines(db, _T, vt_elist.list, create, [])+
412 [ one_line_fields([ 413 [ one_line_fields([
413 - submit(if create then save_row else update_row, failure, button_name, [("table_name", table_name)]),  
414 - submit(if create then save_row_and_new else update_row_and_new, failure, button_name_and_new, [("table_name", table_name)]),  
415 - submit(hk_cancel, failure, _T("CANCEL")) 414 + submit(if create then hkc_save_row else hkc_update_row, failure, button_name, [("table_name", table_name)]),
  415 + submit(if create then hkc_save_row_and_new else hkc_update_row_and_new, failure, button_name_and_new, [("table_name", table_name)]),
  416 + submit(hkc_cancel, failure, _T("CANCEL"))
416 ]) 417 ])
417 ] 418 ]
418 )]+ 419 )]+
view/web_action.anubis
@@ -8,14 +8,16 @@ @@ -8,14 +8,16 @@
8 8
9 read calexium_lib/web/CXM_making_a_web_site.anubis 9 read calexium_lib/web/CXM_making_a_web_site.anubis
10 10
11 -public define WEB_Action_Name edit_table = controller_action("hk_c", "edit_table").  
12 -public define WEB_Action_Name grid_view = controller_action("hk_c", "grid_view").  
13 -public define WEB_Action_Name view_table = controller_action("hk_c", "view_table").  
14 -public define WEB_Action_Name save_row = controller_action("hk_c", "save_row").  
15 -public define WEB_Action_Name save_row_and_new = controller_action("hk_c", "save_row_and_new").  
16 -public define WEB_Action_Name update_row = controller_action("hk_c", "update_row").  
17 -public define WEB_Action_Name update_row_and_new = controller_action("hk_c", "update_row_and_new").  
18 -public define WEB_Action_Name delete_row = controller_action("hk_c", "delete_row").  
19 -public define WEB_Action_Name hk_cancel = controller_action("hk_c", "cancel").  
20 -public define WEB_Action_Name ajax_edit_table = controller_action("hk_c", "ajax_edit_table").  
21 -public define WEB_Action_Name show_apps = controller_action("hk_c", "show_apps"). 11 + here are defined all action managed by Hayamiki Controller
  12 +
  13 +public define WEB_Action_Name hkc_edit_table = controller_action("hk_c", "edit_table").
  14 +public define WEB_Action_Name hkc_grid_view = controller_action("hk_c", "grid_view").
  15 +public define WEB_Action_Name hkc_view_table = controller_action("hk_c", "view_table").
  16 +public define WEB_Action_Name hkc_save_row = controller_action("hk_c", "save_row").
  17 +public define WEB_Action_Name hkc_save_row_and_new = controller_action("hk_c", "save_row_and_new").
  18 +public define WEB_Action_Name hkc_update_row = controller_action("hk_c", "update_row").
  19 +public define WEB_Action_Name hkc_update_row_and_new = controller_action("hk_c", "update_row_and_new").
  20 +public define WEB_Action_Name hkc_delete_row = controller_action("hk_c", "delete_row").
  21 +public define WEB_Action_Name hkc_cancel = controller_action("hk_c", "cancel").
  22 +public define WEB_Action_Name hkc_ajax_edit_table = controller_action("hk_c", "ajax_edit_table").
  23 +public define WEB_Action_Name hkc_show_apps = controller_action("hk_c", "show_apps").