Commit 9ade2a47e122002e841a7da1514d9474b3182e34
1 parent
187c20bf
add no_referer as alternative in HK_Referer
begin to manage the referer
Showing
4 changed files
with
39 additions
and
25 deletions
Show diff stats
types/hayamiki.anubis
| @@ -12,6 +12,7 @@ transmit hayamiki_lib/model/database.anubis | @@ -12,6 +12,7 @@ transmit hayamiki_lib/model/database.anubis | ||
| 12 | transmit hayamiki_lib/model/columns.anubis | 12 | transmit hayamiki_lib/model/columns.anubis |
| 13 | 13 | ||
| 14 | public type HK_Referer: | 14 | public type HK_Referer: |
| 15 | + no_referer, | ||
| 15 | hk_referer( | 16 | hk_referer( |
| 16 | String referer_table, | 17 | String referer_table, |
| 17 | String referer_row_id, | 18 | String referer_row_id, |
view/jqgrid.anubis
| @@ -24,9 +24,11 @@ define String | @@ -24,9 +24,11 @@ define String | ||
| 24 | to_jqGrid_ColModel | 24 | to_jqGrid_ColModel |
| 25 | ( | 25 | ( |
| 26 | SQLite3DataBase db, | 26 | SQLite3DataBase db, |
| 27 | + HK_Referer table_referer, | ||
| 27 | VT_view_model_entry model, | 28 | VT_view_model_entry model, |
| 28 | (String) -> String _T | 29 | (String) -> String _T |
| 29 | )= | 30 | )= |
| 31 | + with empty_referer = hk_referer("","","",""), | ||
| 30 | if model is | 32 | if model is |
| 31 | { | 33 | { |
| 32 | primary_key then "{ name: \"id\", hidden:true }", | 34 | primary_key then "{ name: \"id\", hidden:true }", |
| @@ -34,22 +36,22 @@ define String | @@ -34,22 +36,22 @@ define String | ||
| 34 | text(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true }", | 36 | 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)+"\" }", | 37 | password(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\" }", |
| 36 | foreign_text(label,column_name,selector,help) then | 38 | foreign_text(label,column_name,selector,help) then |
| 37 | - "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, edittype:\"select\", editoptions:{value: "+to_jqGrid_selector(selector.get(db,""))+"},"+ | 39 | + "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, edittype:\"select\", editoptions:{value: "+to_jqGrid_selector(selector.get(db,table_referer,""))+"},"+ |
| 38 | " formatter: \"select\","+ | 40 | " formatter: \"select\","+ |
| 39 | - " formatoptions:{value: "+to_jqGrid_selector(selector.get(db,""))+"},"+ | 41 | + " formatoptions:{value: "+to_jqGrid_selector(selector.get(db, table_referer, ""))+"},"+ |
| 40 | "}", | 42 | "}", |
| 41 | choices_text(label,column_name,selector,help) then | 43 | choices_text(label,column_name,selector,help) then |
| 42 | - "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, edittype:\"select\", editoptions:{value: "+to_jqGrid_selector(selector.get(db,""))+"},"+ | 44 | + "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, edittype:\"select\", editoptions:{value: "+to_jqGrid_selector(selector.get(db, empty_referer, ""))+"},"+ |
| 43 | " formatter: \"select\","+ | 45 | " formatter: \"select\","+ |
| 44 | - " formatoptions:{value: "+to_jqGrid_selector(selector.get(db,""))+"},"+ | 46 | + " formatoptions:{value: "+to_jqGrid_selector(selector.get(db, empty_referer, ""))+"},"+ |
| 45 | "}", | 47 | "}", |
| 46 | text_area(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\" }", | 48 | 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\" }", | 49 | 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\" }", | 50 | 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\" }", | 51 | 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,""))+"},"+ | 52 | + 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, empty_referer, ""))+"},"+ |
| 51 | " formatter: \"select\","+ | 53 | " formatter: \"select\","+ |
| 52 | - " formatoptions:{value: "+to_jqGrid_selector(selector.get(db,""))+"},"+ | 54 | + " formatoptions:{value: "+to_jqGrid_selector(selector.get(db, empty_referer, ""))+"},"+ |
| 53 | "}", | 55 | "}", |
| 54 | date(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, formatter: \"date\", formatoptions: { newformat: \"Y-M-d\" }}", | 56 | 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 }", | 57 | time(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true }", |
| @@ -62,13 +64,14 @@ public define String | @@ -62,13 +64,14 @@ public define String | ||
| 62 | to_jqGrid_ColModel | 64 | to_jqGrid_ColModel |
| 63 | ( | 65 | ( |
| 64 | SQLite3DataBase db, | 66 | SQLite3DataBase db, |
| 67 | + HK_Referer table_referer, | ||
| 65 | (String) -> String _T, | 68 | (String) -> String _T, |
| 66 | List(VT_view_model_entry) models | 69 | List(VT_view_model_entry) models |
| 67 | )= | 70 | )= |
| 68 | "colModel: [\n"+ | 71 | "colModel: [\n"+ |
| 69 | join(",\n ", | 72 | join(",\n ", |
| 70 | [ "{name: 'myac', label: 'Action', width:65, fixed:true, sortable:false, resize:false, formatter:'actions', formatoptions:{keys:true}}" . | 73 | [ "{name: 'myac', label: 'Action', width:65, fixed:true, sortable:false, resize:false, formatter:'actions', formatoptions:{keys:true}}" . |
| 71 | - map((VT_view_model_entry col_model) |-> to_jqGrid_ColModel(db, col_model, _T), models) | 74 | + map((VT_view_model_entry col_model) |-> to_jqGrid_ColModel(db, table_referer, col_model, _T), models) |
| 72 | ] | 75 | ] |
| 73 | )+ | 76 | )+ |
| 74 | "]" | 77 | "]" |
view/view_table_renderer.anubis
| @@ -210,13 +210,14 @@ public define HTML_Partial_Content | @@ -210,13 +210,14 @@ public define HTML_Partial_Content | ||
| 210 | VT_view rows, | 210 | VT_view rows, |
| 211 | (String) -> String _T, | 211 | (String) -> String _T, |
| 212 | String lang, | 212 | String lang, |
| 213 | - String clause | 213 | + String clause, |
| 214 | + HK_Referer table_referer | ||
| 214 | )= | 215 | )= |
| 215 | with filter_clause = if clause = "" then "" else "&clause="+url_quote(clause), | 216 | with filter_clause = if clause = "" then "" else "&clause="+url_quote(clause), |
| 216 | with js = js_inline(jquery_ready("$(\"#"+uid+"_grid\").jqGrid({\n"+ | 217 | with js = js_inline(jquery_ready("$(\"#"+uid+"_grid\").jqGrid({\n"+ |
| 217 | "url:'?aws_controller=hk_c&aws_action=grid_view&table_name="+rows.table_name+"&view_name="+rows.view_name+filter_clause+"',"+ | 218 | "url:'?aws_controller=hk_c&aws_action=grid_view&table_name="+rows.table_name+"&view_name="+rows.view_name+filter_clause+"',"+ |
| 218 | "datatype: \"json\","+ | 219 | "datatype: \"json\","+ |
| 219 | - to_jqGrid_ColModel(db, _T, rows.view_model.list)+","+ | 220 | + to_jqGrid_ColModel(db, table_referer, _T, rows.view_model.list)+","+ |
| 220 | // rows.json_data_string+ | 221 | // rows.json_data_string+ |
| 221 | jqGrid_options(uid, rows, _T)+ | 222 | jqGrid_options(uid, rows, _T)+ |
| 222 | ",loadComplete: function () { | 223 | ",loadComplete: function () { |
| @@ -252,6 +253,7 @@ public define HTML_Partial_Content | @@ -252,6 +253,7 @@ public define HTML_Partial_Content | ||
| 252 | VTM_view vtm_v, | 253 | VTM_view vtm_v, |
| 253 | String view_name, | 254 | String view_name, |
| 254 | String f_clause, //filter for current table | 255 | String f_clause, //filter for current table |
| 256 | + HK_Referer referer, | ||
| 255 | String fk_clause //filter for foreign key of the table (one to many) | 257 | String fk_clause //filter for foreign key of the table (one to many) |
| 256 | ) = | 258 | ) = |
| 257 | with filter_clause = if f_clause = "" then "" else "&clause="+url_quote(f_clause), | 259 | with filter_clause = if f_clause = "" then "" else "&clause="+url_quote(f_clause), |
| @@ -267,12 +269,12 @@ public define HTML_Partial_Content | @@ -267,12 +269,12 @@ public define HTML_Partial_Content | ||
| 267 | partial(img_button(icn16_add, [event(onclick, jq_dialog_open(dialog_id(uid+action_name+"_dlg_ajax")))], "", [])), | 269 | partial(img_button(icn16_add, [event(onclick, jq_dialog_open(dialog_id(uid+action_name+"_dlg_ajax")))], "", [])), |
| 268 | table_view_selector(_T, vtm_v, view_name), | 270 | table_view_selector(_T, vtm_v, view_name), |
| 269 | ])), | 271 | ])), |
| 270 | - partial(jqGrid_table(db, uid, current_view, _T, lang, f_clause)) | 272 | + partial(jqGrid_table(db, uid, current_view, _T, lang, f_clause, referer)) |
| 271 | //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)) | 273 | //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)) |
| 272 | ]))]). | 274 | ]))]). |
| 273 | 275 | ||
| 274 | public define HTML_Partial_Content | 276 | public define HTML_Partial_Content |
| 275 | - view_table | 277 | + list_view |
| 276 | ( | 278 | ( |
| 277 | SQLite3DataBase db, | 279 | SQLite3DataBase db, |
| 278 | (String) -> String _T, | 280 | (String) -> String _T, |
| @@ -282,6 +284,7 @@ public define HTML_Partial_Content | @@ -282,6 +284,7 @@ public define HTML_Partial_Content | ||
| 282 | VTM_view vtm_v, | 284 | VTM_view vtm_v, |
| 283 | String view_name, | 285 | String view_name, |
| 284 | String f_clause, //filter for current table | 286 | String f_clause, //filter for current table |
| 287 | + HK_Referer referer, | ||
| 285 | String fk_clause //filter for foreign key of the table (one to many) | 288 | String fk_clause //filter for foreign key of the table (one to many) |
| 286 | ) = | 289 | ) = |
| 287 | with filter_clause = if f_clause = "" then "" else "&clause="+url_quote(f_clause), | 290 | with filter_clause = if f_clause = "" then "" else "&clause="+url_quote(f_clause), |
| @@ -296,7 +299,7 @@ public define HTML_Partial_Content | @@ -296,7 +299,7 @@ public define HTML_Partial_Content | ||
| 296 | partial(jq_dialog_create(dialog_id(uid+action_name+"_dlg_ajax"), ajax(controller_action("hk_c", "ajax_edit_table&table_name="+current_view.table_name+filter_clause+foreign_clause)))), | 299 | partial(jq_dialog_create(dialog_id(uid+action_name+"_dlg_ajax"), ajax(controller_action("hk_c", "ajax_edit_table&table_name="+current_view.table_name+filter_clause+foreign_clause)))), |
| 297 | partial(img_button(icn16_add, [event(onclick, jq_dialog_open(dialog_id(uid+action_name+"_dlg_ajax")))], "", [])), | 300 | partial(img_button(icn16_add, [event(onclick, jq_dialog_open(dialog_id(uid+action_name+"_dlg_ajax")))], "", [])), |
| 298 | //table_view_selector(_T, vtm_v, view_name), | 301 | //table_view_selector(_T, vtm_v, view_name), |
| 299 | - partial(jqGrid_table(db, uid, current_view, _T, lang, fk_clause)), | 302 | + partial(jqGrid_table(db, uid, current_view, _T, lang, fk_clause, referer)), |
| 300 | //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)) | 303 | //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)) |
| 301 | ]). | 304 | ]). |
| 302 | 305 | ||
| @@ -311,6 +314,7 @@ public define Maybe(HTML_Partial_Content) | @@ -311,6 +314,7 @@ public define Maybe(HTML_Partial_Content) | ||
| 311 | String view_name, | 314 | String view_name, |
| 312 | String action_name, | 315 | String action_name, |
| 313 | String f_clause, | 316 | String f_clause, |
| 317 | + HK_Referer table_referer, | ||
| 314 | String fk_clause, | 318 | String fk_clause, |
| 315 | VTM vtm | 319 | VTM vtm |
| 316 | ) = | 320 | ) = |
| @@ -318,7 +322,7 @@ public define Maybe(HTML_Partial_Content) | @@ -318,7 +322,7 @@ public define Maybe(HTML_Partial_Content) | ||
| 318 | { | 322 | { |
| 319 | failure then failure, | 323 | failure then failure, |
| 320 | success(vtm_v) then | 324 | success(vtm_v) then |
| 321 | - success(view_table_page(db, _T, lang, web_site_directory, action_name, vtm_v, view_name, f_clause, fk_clause)) | 325 | + success(view_table_page(db, _T, lang, web_site_directory, action_name, vtm_v, view_name, f_clause, table_referer, fk_clause)) |
| 322 | }. | 326 | }. |
| 323 | 327 | ||
| 324 | public define Maybe(HTML_Partial_Content) | 328 | public define Maybe(HTML_Partial_Content) |
| @@ -332,14 +336,15 @@ public define Maybe(HTML_Partial_Content) | @@ -332,14 +336,15 @@ public define Maybe(HTML_Partial_Content) | ||
| 332 | String view_name, | 336 | String view_name, |
| 333 | String action_name, | 337 | String action_name, |
| 334 | String f_clause, | 338 | String f_clause, |
| 335 | - String fk_clause, | 339 | + HK_Referer table_referer, |
| 340 | + String fk_filter, | ||
| 336 | VTM vtm | 341 | VTM vtm |
| 337 | ) = | 342 | ) = |
| 338 | if vtm_get_view(table, vtm.view_list) is | 343 | if vtm_get_view(table, vtm.view_list) is |
| 339 | { | 344 | { |
| 340 | failure then failure, | 345 | failure then failure, |
| 341 | success(vtm_v) then | 346 | success(vtm_v) then |
| 342 | - success(view_table(db, _T, lang, web_site_directory, action_name, vtm_v, view_name, f_clause, fk_clause)) | 347 | + success(view_table(db, _T, lang, web_site_directory, action_name, vtm_v, view_name, f_clause, table_referer, fk_filter)) |
| 343 | }. | 348 | }. |
| 344 | 349 | ||
| 345 | define CXM_Form_Field | 350 | define CXM_Form_Field |
| @@ -362,11 +367,13 @@ public define List(CXM_Form_Field) | @@ -362,11 +367,13 @@ public define List(CXM_Form_Field) | ||
| 362 | ( | 367 | ( |
| 363 | SQLite3DataBase db, | 368 | SQLite3DataBase db, |
| 364 | String fk_clause, | 369 | String fk_clause, |
| 370 | + HK_Referer table_referer, | ||
| 365 | (String) -> String _T, | 371 | (String) -> String _T, |
| 366 | List(VT_edit_entry) list, | 372 | List(VT_edit_entry) list, |
| 367 | Bool new_entry, | 373 | Bool new_entry, |
| 368 | List(CXM_Form_Field) so_far | 374 | List(CXM_Form_Field) so_far |
| 369 | )= | 375 | )= |
| 376 | + with empty_referer = hk_referer("","","",""), | ||
| 370 | if list is | 377 | if list is |
| 371 | { | 378 | { |
| 372 | [] then reverse(so_far), | 379 | [] then reverse(so_far), |
| @@ -401,9 +408,9 @@ public define List(CXM_Form_Field) | @@ -401,9 +408,9 @@ public define List(CXM_Form_Field) | ||
| 401 | ], | 408 | ], |
| 402 | 409 | ||
| 403 | foreign_text(s_name, c_name, value, select, help) then | 410 | foreign_text(s_name, c_name, value, select, help) then |
| 404 | - [selector_c([],label(_T(s_name), no_help), html_Id(""), wan(c_name), 1, select.get(db, fk_clause), success(init(to_String(value))), mandatory), help_line(help, _T)], | 411 | + [selector_c([],label(_T(s_name), no_help), html_Id(""), wan(c_name), 1, select.get(db, table_referer, fk_clause), success(init(to_String(value))), mandatory), help_line(help, _T)], |
| 405 | choices_text(s_name, c_name, value, select, help) then | 412 | choices_text(s_name, c_name, value, select, help) then |
| 406 | - [selector_c([],label(_T(s_name), no_help), html_Id(""), wan(c_name), 1, select.get(db, ""), success(init(value)), mandatory), help_line(help, _T)], | 413 | + [selector_c([],label(_T(s_name), no_help), html_Id(""), wan(c_name), 1, select.get(db, empty_referer, ""), success(init(value)), mandatory), help_line(help, _T)], |
| 407 | text_area(s_name, c_name, value, txt_editor, help) then | 414 | text_area(s_name, c_name, value, txt_editor, help) then |
| 408 | with id = if txt_editor is { none then "", rich_editor then c_name+"_editor"}, | 415 | with id = if txt_editor is { none then "", rich_editor then c_name+"_editor"}, |
| 409 | [text_area([],label(_T(s_name), no_help), html_Id(id), wan(c_name), init(not_null_String(value)), narrow, (Int)5, mandatory), help_line(help, _T)], | 416 | [text_area([],label(_T(s_name), no_help), html_Id(id), wan(c_name), init(not_null_String(value)), narrow, (Int)5, mandatory), help_line(help, _T)], |
| @@ -414,7 +421,7 @@ public define List(CXM_Form_Field) | @@ -414,7 +421,7 @@ public define List(CXM_Form_Field) | ||
| 414 | float(s_name, c_name, value, help) then | 421 | float(s_name, c_name, value, help) then |
| 415 | [input(label(_T(s_name), no_help), wan(c_name), init(float_to_string(value, 5)), small, mandatory), help_line(help, _T)], | 422 | [input(label(_T(s_name), no_help), wan(c_name), init(float_to_string(value, 5)), small, mandatory), help_line(help, _T)], |
| 416 | choices_int(s_name, c_name, value, select, help) then | 423 | choices_int(s_name, c_name, value, select, help) then |
| 417 | - [selector_c([],label(_T(s_name), no_help), html_Id(""), wan(c_name), 1, select.get(db, ""), success(init(to_String(value))), mandatory), help_line(help, _T)], | 424 | + [selector_c([],label(_T(s_name), no_help), html_Id(""), wan(c_name), 1, select.get(db, empty_referer, ""), success(init(to_String(value))), mandatory), help_line(help, _T)], |
| 418 | date(s_name, c_name, value, help) then | 425 | date(s_name, c_name, value, help) then |
| 419 | [input([class("datepicker")], label(_T(s_name), no_help), html_Id(c_name), wan(c_name), init(value), small, non_mandatory), help_line(help, _T)], | 426 | [input([class("datepicker")], label(_T(s_name), no_help), html_Id(c_name), wan(c_name), init(value), small, non_mandatory), help_line(help, _T)], |
| 420 | time(s_name, c_name, value, help) then | 427 | time(s_name, c_name, value, help) then |
| @@ -424,7 +431,7 @@ public define List(CXM_Form_Field) | @@ -424,7 +431,7 @@ public define List(CXM_Form_Field) | ||
| 424 | color( s_name, c_name, value, help) then | 431 | color( s_name, c_name, value, help) then |
| 425 | [input([class("jscolor")], label(_T(s_name), no_help), wan(c_name), init(not_null_String(value)), narrow, mandatory), help_line(help, _T)], | 432 | [input([class("jscolor")], label(_T(s_name), no_help), wan(c_name), init(not_null_String(value)), narrow, mandatory), help_line(help, _T)], |
| 426 | }, | 433 | }, |
| 427 | - edit_form_lines(db, fk_clause, _T, t, new_entry, reverse(line)+so_far) | 434 | + edit_form_lines(db, fk_clause, table_referer, _T, t, new_entry, reverse(line)+so_far) |
| 428 | }. | 435 | }. |
| 429 | 436 | ||
| 430 | define HTML_Head_Tag | 437 | define HTML_Head_Tag |
| @@ -464,7 +471,8 @@ public define HTML_Partial_Content | @@ -464,7 +471,8 @@ public define HTML_Partial_Content | ||
| 464 | VT_edit vt_elist, | 471 | VT_edit vt_elist, |
| 465 | VTM vtm, | 472 | VTM vtm, |
| 466 | String clause, | 473 | String clause, |
| 467 | - String fk_clause | 474 | + String fk_clause, |
| 475 | + HK_Referer table_referer //from which table and row id that editor is called | ||
| 468 | ) = | 476 | ) = |
| 469 | with table_name = vt_elist.table_name, | 477 | with table_name = vt_elist.table_name, |
| 470 | //true if need to create row or false for updating | 478 | //true if need to create row or false for updating |
| @@ -480,7 +488,7 @@ public define HTML_Partial_Content | @@ -480,7 +488,7 @@ public define HTML_Partial_Content | ||
| 480 | get_editor_header(vt_elist.list), //add editor header if need. Like init ck_editor | 488 | get_editor_header(vt_elist.list), //add editor header if need. Like init ck_editor |
| 481 | sequence([ | 489 | sequence([ |
| 482 | cxm_form( table_name, lwa, | 490 | cxm_form( table_name, lwa, |
| 483 | - edit_form_lines(db, fk_clause, _T, vt_elist.list, create, [])+ | 491 | + edit_form_lines(db, "", table_referer, _T, vt_elist.list, create, [])+ |
| 484 | [ one_line_fields([ | 492 | [ one_line_fields([ |
| 485 | submit(if create then hkc_save_row else hkc_update_row, failure, button_name, [("table_name", table_name)]), | 493 | submit(if create then hkc_save_row else hkc_update_row, failure, button_name, [("table_name", table_name)]), |
| 486 | submit(if create then hkc_save_row_and_new else hkc_update_row_and_new, failure, button_name_and_new, [("table_name", table_name)]), | 494 | submit(if create then hkc_save_row_and_new else hkc_update_row_and_new, failure, button_name_and_new, [("table_name", table_name)]), |
| @@ -494,7 +502,8 @@ public define HTML_Partial_Content | @@ -494,7 +502,8 @@ public define HTML_Partial_Content | ||
| 494 | map( (HK_V_Edit_Tab tab) | 502 | map( (HK_V_Edit_Tab tab) |
| 495 | |-> | 503 | |-> |
| 496 | since tab is hk_v_edit_tab(fk_table_name, fk_col_name, list_view_name), | 504 | since tab is hk_v_edit_tab(fk_table_name, fk_col_name, list_view_name), |
| 497 | - if view_table_only(db, _T, lang, web_site_directory, fk_table_name, list_view_name, "edit", "", fk_col_name+" = "+id, vtm) is | 505 | + with referer = hk_referer(table_name, id, fk_table_name, fk_col_name), |
| 506 | + if view_table_only(db, _T, lang, web_site_directory, fk_table_name, list_view_name, "edit", "", referer, fk_clause, vtm) is | ||
| 498 | { | 507 | { |
| 499 | failure then empty, | 508 | failure then empty, |
| 500 | success(p_content) then partial(p_content) | 509 | success(p_content) then partial(p_content) |
| @@ -516,14 +525,15 @@ public define Maybe(HTML_Partial_Content) | @@ -516,14 +525,15 @@ public define Maybe(HTML_Partial_Content) | ||
| 516 | VT_action action, //new_entry or edit an existing record | 525 | VT_action action, //new_entry or edit an existing record |
| 517 | VTM vtm, | 526 | VTM vtm, |
| 518 | String clause, | 527 | String clause, |
| 519 | - String fk_clause | 528 | + String fk_clause, |
| 529 | + HK_Referer referer | ||
| 520 | ) = | 530 | ) = |
| 521 | if vtm_get_edit(table, vtm.edit_list) is | 531 | if vtm_get_edit(table, vtm.edit_list) is |
| 522 | { | 532 | { |
| 523 | failure then failure, | 533 | failure then failure, |
| 524 | success(vtm_e) then | 534 | success(vtm_e) then |
| 525 | since vtm_e is vtm_edit(_, get_edit), | 535 | since vtm_e is vtm_edit(_, get_edit), |
| 526 | - success(edit_table_page(db, _T, lang, web_site_directory, lwa, get_edit(db, action, view_name), vtm, clause, fk_clause)) | 536 | + success(edit_table_page(db, _T, lang, web_site_directory, lwa, get_edit(db, action, view_name), vtm, clause, fk_clause, referer)) |
| 527 | }. | 537 | }. |
| 528 | 538 | ||
| 529 | 539 |
view/view_table_types.anubis
| @@ -10,7 +10,7 @@ transmit calexium_lib/web/CXM_common.anubis | @@ -10,7 +10,7 @@ transmit calexium_lib/web/CXM_common.anubis | ||
| 10 | read hayamiki_lib/types/hayamiki.anubis | 10 | read hayamiki_lib/types/hayamiki.anubis |
| 11 | 11 | ||
| 12 | public type VT_edit_selector: | 12 | public type VT_edit_selector: |
| 13 | - vt_edit_selector((SQLite3DataBase db, String clause) -> List((List(CoreAttrs), WebArgValue, String)) get). | 13 | + vt_edit_selector((SQLite3DataBase db, HK_Referer referer, String filter) -> List((List(CoreAttrs), WebArgValue, String)) get). |
| 14 | 14 | ||
| 15 | 15 | ||
| 16 | public type VT_edit_entry: | 16 | public type VT_edit_entry: |