From 1d49576d8028cf74a4c1bac480164b9146ac39bf Mon Sep 17 00:00:00 2001 From: totoro Date: Sun, 10 May 2026 13:49:54 +0900 Subject: [PATCH] [~] change to be compatible with the new xlib 1.19.1 (future xlib 2) --- view/view_apps_renderer.anubis | 51 ++++++++++++++++++++++----------------------------- view/view_editor_renderer.anubis | 2 +- view/view_rows_import.anubis | 112 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------- view/view_table_renderer.anubis | 197 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------------------------------------------------- 4 files changed, 174 insertions(+), 188 deletions(-) diff --git a/view/view_apps_renderer.anubis b/view/view_apps_renderer.anubis index f3fdcc3..7ea1360 100644 --- a/view/view_apps_renderer.anubis +++ b/view/view_apps_renderer.anubis @@ -17,7 +17,7 @@ read xlib/web/jQuery/ui-addon/datetimepicker.anubis read xlib/web/widgets/button.anubis -define List(HTML_Row(HTML_Off_Form)) +define List(HTML) generate_apps ( SQLite3DataBase db, @@ -26,33 +26,28 @@ define List(HTML_Row(HTML_Off_Form)) (String) -> String _T, )= map_append((HK_App app) |-> since app is hk_app(app_name, icon, help, tables), - [ (HTML_Row(HTML_Off_Form))row([core_attrs([class("hk_app_title")])],cell([columns(6)],text(app_name)))]+ //APP name line + [ tr(class("hk_app_title"), td(colspan(6), text(app_name)))]+ //APP name line //here map for each table map((HK_Table table) |-> since table is hk_table(_table_name, short_name, model, display), //construct the real name of the table (app + table_name) with table_name = if length(app_name) > 0 then app_name +"_"+_table_name else _table_name, - (HTML_Row(HTML_Off_Form))row([core_attrs([class("hk_table_line")])], - [ cell(text(_table_name)), - cell( - sequence([ - partial(img_button(icn16_add, [event(onclick, jq_dialog_open(dialog_id(dialog_uid), "'table_name="+table_name+"'"))], "", [])), - actioner(link([core_attrs([event(onclick, jq_dialog_open(dialog_id(dialog_uid), "'table_name="+table_name+"'"))])],_T("ADD")), no_action, []) - ]) - ), - cell( - sequence([ - partial(img_button(icn16_view_list, hkc_list_view, [("table_name",table_name)])), + tr(class("hk_table_line"), + [ td(text(_table_name)), + td([ + img_button(icn16_add, [event(onclick, jq_dialog_open(dialog_id(dialog_uid), "'table_name="+table_name+"'"))], "", []), + actioner(link([event(onclick, jq_dialog_open(dialog_id(dialog_uid), "'table_name="+table_name+"'"))],_T("ADD")), no_action, []) + ]), + td([ + img_button(icn16_view_list, hkc_list_view, [("table_name",table_name)]), actioner(link(_T("LIST")), hkc_list_view, [("table_name",table_name)]) - ]) - ), - cell( - sequence([ - partial(img_button("icons/16x16/table_import.png", hkc_import_dropzone, [("table_name",table_name)])), + ]), + td([ + img_button("icons/16x16/table_import.png", hkc_import_dropzone, [("table_name",table_name)]), actioner(link(_T("CSV_IMPORT")), hkc_import_dropzone, [("table_name",table_name)]) - ]) - ), - cell(text(_T("RECORDS_COUNT")+" ")), - cell([right], text(get_count(db, table_name))) + ]), + td(text(_T("RECORDS_COUNT")+" ")), + //TODO replace old align right to more moderm way + td([/*right*/], text(get_count(db, table_name))) ]) ,tables) @@ -60,9 +55,7 @@ define List(HTML_Row(HTML_Off_Form)) ) . - - -public define Maybe(HTML_Partial_Content) +public define Maybe(HTML) show_apps_content ( SQLite3DataBase db, @@ -72,11 +65,11 @@ public define Maybe(HTML_Partial_Content) String web_site_directory ) = with dialog_uid = "_"+generate_random_string(15)+"_cxm_dlg", - success(partial_content([css(css_file("hayamiki/css/hayamiki.css")),]+ + success(head_tags([css(css_file("hayamiki/css/hayamiki.css")),]+ jq_dialog_init + jq_datetimepicker_init(lang), - sequence([ - partial(jq_dialog_create(dialog_id(dialog_uid), ajax(controller_action("hk_c", "ajax_edit_table&dialog_id="+dialog_uid)))), /*&table_name="+rows.table_name*/ + [ + jq_dialog_create(dialog_id(dialog_uid), ajax(controller_action("hk_c", "ajax_edit_table&dialog_id="+dialog_uid))), /*&table_name="+rows.table_name*/ table([class("hk_table_apps")], generate_apps(db, hk_db.apps, dialog_uid, _T)) - ]) + ] )) . diff --git a/view/view_editor_renderer.anubis b/view/view_editor_renderer.anubis index b64e88a..74df442 100644 --- a/view/view_editor_renderer.anubis +++ b/view/view_editor_renderer.anubis @@ -12,7 +12,7 @@ read hayamiki_lib/view/view_table_manager_types.anubis read hayamiki_lib/view/view_table_manager.anubis read hayamiki_lib/types/hayamiki.anubis - public define Maybe(HTML_Partial_Content) + public define Maybe(HTML) view_editor_content ( SQLite3DataBase db, diff --git a/view/view_rows_import.anubis b/view/view_rows_import.anubis index 42fc834..3c7d0f9 100644 --- a/view/view_rows_import.anubis +++ b/view/view_rows_import.anubis @@ -51,14 +51,14 @@ public define List((List(CoreAttrs), WebArgValue, String)) ([],wav("update"), _T("UPDATE")), ]. -public define HTML_Partial_Content +public define HTML import_zone ( String table_name, (String) -> String _T )= html_wave_box(_T("CONTROL_PANEL"), - partial_content( + head_tags( [ js(js_file("xlib/js/dropzone.js")), js_inline(jquery_ready("Dropzone.options.myAwesomeDropzone = { maxFiles: 1, @@ -70,34 +70,34 @@ public define HTML_Partial_Content sequence([ text([], _T("CSV_IMPORT_FOR")+" "+table_name), - form("my-awesome-dropzone",[class("dropzone")], hkc_import_file, + form("my-awesome-dropzone", [class("dropzone")], hkc_import_file, [("format","csv"), ("table_name",table_name)], empty), - partial(jquery_button(jquery_img_button(icn16_cross, _T("CANCEL"), "", jQuery_actioner(same, jqlink(hkc_cancel)), left))), - partial(jquery_button(jquery_img_button(icn16_check, _T("IMPORT"), "", jQuery_actioner(same, jqlink(hkc_import_choose_col, [("format","csv"), ("table_name",table_name)])), left))) + jquery_button(jquery_img_button(icn16_cross, _T("CANCEL"), "", jQuery_actioner(same, jqlink(hkc_cancel)), left)), + jquery_button(jquery_img_button(icn16_check, _T("IMPORT"), "", jQuery_actioner(same, jqlink(hkc_import_choose_col, [("format","csv"), ("table_name",table_name)])), left)) ]) ) ) . -define List(HTML_Row(HTML_In_Form)) +define List(HTML) source_lines ( - List(String) cols, - List(HTML_Row(HTML_In_Form)) so_far, - Int index, - (String) -> String _T + List(String) cols, + List(HTML) so_far, + Int index, + (String) -> String _T )= if cols is { [] then reverse(so_far), [ h . t ] then - source_lines( t, [ row([cell([style("display:none")], literal("")), - cell([core_attrs([id("col_"+index), class("dnd-src")])], text(_T("COLUMN")+ " "+index+" ("+h+")"))]) . so_far], index+1, _T) + source_lines( t, [ tr([td([style("display:none")], literal("")), + td([id("col_"+index), class("dnd-src")], text(_T("COLUMN")+ " "+index+" ("+h+")"))]) . so_far], index+1, _T) } . -public define HTML_In_Form +public define HTML source_file_column_table ( Word8 separator, @@ -123,24 +123,24 @@ public define HTML_In_Form if col_data is (line, cols) then sequence([ - hidden(html_Id("hk_source_col"), wan("hk_source_col"), wav(to_String(length(cols)))), - table([core_attrs([class("changelist small"), id("table-src")])], - header_row([ header_cell([style("display:none")], literal("")), - header_cell(literal("CSV_FILE_FIELDS"))]), - source_lines(cols, [], 0, _T) + hidden("hk_source_col", to_String(length(cols)), "hk_source_col"), + table([class("changelist small"), id("table-src")], [ + thead([ th(style("display:none")), + th(_T("CSV_FILE_FIELDS"))]) . + source_lines(cols, [], 0, _T)] ) ]) } }. . -define List(HTML_Row(HTML_In_Form)) +define List(HTML) target_lines ( - List((String,String)) cols, - List(HTML_Row(HTML_In_Form)) so_far, - Int index, - (String) -> String _T + List((String,String)) cols, + List(HTML) so_far, + Int index, + (String) -> String _T )= //if tb is tool_box(lang, _, _T, _, db, user, _, _) then if cols is @@ -148,19 +148,16 @@ define List(HTML_Row(HTML_In_Form)) [] then reverse(so_far), [ h . t ] then since h is (hidden_name, text_field), - target_lines( t,[ row([ - cell([style("display:none")], empty), - cell([class("dnd-text ")], text(_T(text_field))), - cell([class("dnd-dst")], sequence([ - text(_T("IGNORED_COLUMN")), - hidden(html_Id("hk_"+hidden_name+"_input"), wan(""), wav(hidden_name)) - ])), - cell(image([class("dnd-dst-btn")],"/icons/16x16/delete_cross.png","")) + target_lines( t,[ tr([ + td(style("display:none")), + td(class("dnd-text "), text(_T(text_field))), + td(class("dnd-dst"), [ text(_T("IGNORED_COLUMN")), hidden([id("hk_"+hidden_name+"_input"), value(hidden_name)]) ]), + td(img(class("dnd-dst-btn"),"/icons/16x16/delete_cross.png")) ]) . so_far], index+1, _T) }. -define HTML_In_Form +define HTML target_column_table ( List((String,String)) choices, @@ -168,16 +165,17 @@ define HTML_In_Form )= //since tb is tool_box(lang, _, _T, _, db, user, _, _), - table([core_attrs([class("changelist small"), id("table-dst")])], - header_row([ header_cell([style("display:none")], empty), - header_cell(text(_T("TABLE_FIELDS"))), - header_cell(text(_T("IMPORTED_FIELDS"))), - header_cell(literal(" "))]), - target_lines(choices, [], 0, _T) + table([class("changelist small"), id("table-dst")], [ + thead([ th([style("display:none")], empty), + th(_T("TABLE_FIELDS")), + th(_T("IMPORTED_FIELDS")), + th(literal(" "))]) + . + target_lines(choices, [], 0, _T)] ) . -public define HTML_Partial_Content +public define HTML import_choose_col ( String target_table_name, @@ -187,40 +185,38 @@ public define HTML_Partial_Content WEB_Action_Name cancel_action, // (String) -> String _T // translator from dictionary )= - partial_content([css(css_file("xlib/css/dnd.css")), + head_tags([css(css_file("xlib/css/dnd.css")), css(css_file("xlib/css/changelists.css")), js(js_file("xlib/js/dnd.js")), js(js_file("hayamiki/js/data_import.js")) ], sequence([ - form("import_csv_form",[], hkc_import_execute, [("table_name", target_table_name), ("file",uploaded_file)], sequence([ - table([class("changelist small")], - header_row([ header_cell(literal(" ")), - header_cell(text(_T("INFORMATION_OF_SOURCE_FILE"))), - header_cell(literal(" ")), - ]), - [row([], [cell(image(icn16_mime_csv)), cell(text(_T("FILE_FORMAT"))), cell(text(_T("CSV_FILE")))]), - row([], [cell(image(icn16_mime_unknown)), cell(text(_T("SOURCE_FILE_TO_IMPORT"))), cell(text(uploaded_file))]), - row([], [cell(empty), cell(text(_T("DELIMITER"))), cell(selector_c([], no_label, html_Id("import_delimiter"), wan("csv_sep"), 1, csv_delimiter_combo(_T), init(separator)),)]), - row([], [cell(empty), cell(text(_T("FILE_ENCODING"))), cell(text("choose encoding"))]), - row([], [cell(empty), cell(text(_T("REMOVE_CSV_HEADER"))), cell(check_box([], no_label, html_Id(""), wan("hk_remove_csv_header"), true))]), - row([], [cell(empty), cell(text(_T("IMPORT_TYPE"))), cell(selector_c([], no_label, html_Id("import_type"), wan("import_type"), 1, csv_import_type_combo(_T), init(separator)),)]), + form("import_csv_form",[], hkc_import_execute, [("table_name", target_table_name), ("file",uploaded_file)], + sequence([ + table(class("changelist small"), + [thead([ th(literal(" ")), th(text(_T("INFORMATION_OF_SOURCE_FILE"))), th(literal(" ")) ]), + tr( [td(image(icn16_mime_csv)), td(_T("FILE_FORMAT")), td(_T("CSV_FILE"))]), + tr( [td(image(icn16_mime_unknown)), td(_T("SOURCE_FILE_TO_IMPORT")), td(uploaded_file)]), +// tr( [td(empty), td(_T("DELIMITER")), td(selector_c([], no_label, html_Id("import_delimiter"), wan("csv_sep"), 1, csv_delimiter_combo(_T), init(separator)),)]), + tr( [td(empty), td(_T("FILE_ENCODING")), td(text("choose encoding"))]), +// tr( [td(empty), td(_T("REMOVE_CSV_HEADER")), td(check_box([], no_label, html_Id(""), wan("hk_remove_csv_header"), true))]), +// tr( [td(empty), td(_T("IMPORT_TYPE")), td(selector_c([], no_label, html_Id("import_type"), wan("import_type"), 1, csv_import_type_combo(_T), init(separator)),)]), ]), br, - div([id("dragLists")], [ + div(id("dragLists"), [ //SOURCE column - div([style("float: left; margin: 5px;")], div([class("dndContainer ")], + div([style("float: left; margin: 5px;")], div(class("dndContainer "), source_file_column_table(if explode(separator) is { [] then ';', [h . _] then h }, uploaded_file, _T))), //TARGET column - div([style("float: left; margin: 5px;")], div([class("dndContainer ")], + div([style("float: left; margin: 5px;")], div(class("dndContainer "), target_column_table(target_columns_choices, _T))), - div_empty([class("clear")]) + div(class("clear")) ]), ])), //end of sequence in form // )]) - partial(jquery_button(jquery_img_button(icn16_cross, _T("CANCEL"), "", jQuery_actioner(same, jqlink(cancel_action)), left))), - partial(img_submit_button(_T("IMPORT"), "import_csv_form")) + jquery_button(jquery_img_button(icn16_cross, _T("CANCEL"), "", jQuery_actioner(same, jqlink(cancel_action)), left)), + img_submit_button(_T("IMPORT"), "import_csv_form") ]) //end of sequence ) . diff --git a/view/view_table_renderer.anubis b/view/view_table_renderer.anubis index 0eab35c..5ef7548 100644 --- a/view/view_table_renderer.anubis +++ b/view/view_table_renderer.anubis @@ -204,7 +204,7 @@ else });" . -define HTML_In_Form +define HTML /* create a selector for choosing the view name. * The selector create an immediate action. This means when the entry is selected, the action is fired. * If only one view exists, the selector is not created @@ -220,10 +220,10 @@ define HTML_In_Form filter_len = length(filters), if filter_len = 0 then - hidden(wan("filter_name"), wav("no_filter")) + hidden("filter_name", "no_filter") else if filter_len = 1 then with filter_name = if filters is { [] then "", [h . _] then h.filter_name }, - hidden(wan("filter_name"), wav(filter_name)) + hidden("filter_name", filter_name) else actioner(same, same, immediate_selector([id("select_view")], @@ -237,7 +237,7 @@ define HTML_In_Form [], []) . -define HTML_Off_Form +define HTML /* create a selector for choosing the view name. * The selector create an immediate action. This means when the entry is selected, the action is fired. * If only one view exists, the selector is not created @@ -250,9 +250,9 @@ define HTML_Off_Form String current_filter )= with all_view_name = vtm_v.get_all_view_name(unique), - form( "table_view_filter_selector", [], "", [], - sequence([ - hidden(wan("table_name"), wav(vtm_v.table_name)), + form( id("table_view_filter_selector"), + [ + hidden("table_name", vtm_v.table_name), (if length(all_view_name) = 1 then empty else @@ -268,36 +268,36 @@ define HTML_Off_Form [], [] )), //!actionner table_filter_selector(_T, all_view_name, current_view, current_filter) - ]) + ] )//!form . // View table part -define HTML_Row(HTML_Off_Form) make_line +define HTML make_line ( String uid, String table_name, String _action_name, //default is "edit_table", but can be surcharged for own use List(VT_view_entry) entries, - List(HTML_Cell(HTML_Off_Form)) so_far + List(HTML) so_far )= if entries is { - [] then row( [], reverse(so_far)), + [] then tr(reverse(so_far)), [h . t] then with cell = if h is { - text(string) then cell((HTML_Off_Form)text(not_null_String(string))), -// link(id, string) then cell((HTML_Off_Form)actioner(same,same, link(string), action_name, [("table_name", table_name),("id",id)])), - link(id, string) then cell((HTML_Off_Form)literal(jq_dialog_open(string, dialog_id(uid+_action_name+"_dlg_ajax"), "'id="+id+"'"))), - link_id_action(id, name, action) then cell((HTML_Off_Form)actioner(same,same, link(name), action, [("id",id)])), - icon(icon_path) then cell((HTML_Off_Form)img(icon_path)) + text(string) then td(text(not_null_String(string))), +// link(id, string) then cell((HTML)actioner(same,same, link(string), action_name, [("table_name", table_name),("id",id)])), + link(id, string) then td(literal(jq_dialog_open(string, dialog_id(uid+_action_name+"_dlg_ajax"), "'id="+id+"'"))), + link_id_action(id, name, action) then td(actioner(same,same, link(name), action, [("id",id)])), + icon(icon_path) then td(img(icon_path)) }, make_line(uid, table_name, _action_name, t, [cell . so_far]) }. -define List(HTML_Row(HTML_Off_Form)) +define List(HTML) make_lines ( (String) -> String _T, //translator @@ -305,7 +305,7 @@ define List(HTML_Row(HTML_Off_Form)) String table_name, String action_name, List(VT_view_row) entries, - List(HTML_Row(HTML_Off_Form)) so_far + List(HTML) so_far )= if entries is { @@ -313,41 +313,39 @@ define List(HTML_Row(HTML_Off_Form)) [h . t] then //compute each line //prepare here the first cell for actioner - with actions_cell = (HTML_Cell(HTML_Off_Form)) - cell([], - sequence([ - partial(img_button_confirm(icn16_cross, _T("CONFIRMATION_REQUEST"), _T("CONFIRM_LINE_DELETION") , _T("OK"), _T("CANCEL"), jQuery_actioner(same, jqlink(controller_action("hk_c", "delete_row" + format_extra_operands([("table_name", table_name),("id",to_String(h.db_id))])))))), - partial(img_button(icn16_edit, [event(onclick, jq_dialog_open(dialog_id(uid+action_name+"_dlg_ajax"), "'id="+to_String(h.db_id)+"'"))], "", [])), - ]) - ), + with actions_cell = //(HTML_Cell(HTML)) + td([ + img_button_confirm(icn16_cross, _T("CONFIRMATION_REQUEST"), _T("CONFIRM_LINE_DELETION") , _T("OK"), _T("CANCEL"), jQuery_actioner(same, jqlink(controller_action("hk_c", "delete_row" + format_extra_operands([("table_name", table_name),("id",to_String(h.db_id))]))))), + img_button(icn16_edit, [event(onclick, jq_dialog_open(dialog_id(uid+action_name+"_dlg_ajax"), "'id="+to_String(h.db_id)+"'"))], "", []), + ]), make_lines(_T, uid, table_name, action_name, t, [make_line(uid, table_name, action_name, h.list, [actions_cell]). so_far] ) }. // View table part -define HTML_Header_Row(HTML_Off_Form) +define HTML make_header ( - (String) -> String _T, //translator - List(VT_view_entry) entries, - List(HTML_Header_Cell(HTML_Off_Form)) so_far + (String) -> String _T, //translator + List(VT_view_entry) entries, + List(HTML) so_far )= if entries is { - [] then header_row( [], reverse(so_far)), + [] then thead(reverse(so_far)), [h . t] then with cell = if h is { - text(string) then header_cell((HTML_Off_Form)text(_T(string))), - link(id, string) then header_cell((HTML_Off_Form)actioner(same, same, link(string), hkc_edit_table,[])), //TODO - link_id_action(id, text, action) then header_cell((HTML_Off_Form)actioner(same,same, link(text), action,[("id",id)])), //TODO - icon(icon_path) then header_cell((HTML_Off_Form)img(icon_path)) + text(string) then th(text(_T(string))), + link(id, string) then th((HTML)actioner(same, same, link(string), hkc_edit_table,[])), //TODO + link_id_action(id, text, action) then th((HTML)actioner(same,same, link(text), action,[("id",id)])), //TODO + icon(icon_path) then th(img(icon_path)) }, make_header(_T, t, [cell . so_far]) }. -public define HTML_Partial_Content +public define HTML view_table_form ( (String) -> String _T, @@ -355,8 +353,8 @@ public define HTML_Partial_Content String action_name, VT_view rows )= - with action_header_cell = header_cell((HTML_Off_Form)text(_T("ACTION"))), - partial_content( + with action_header_cell = th(text(_T("ACTION"))), + div( [/*class("tableau")*/], sequence( [ @@ -368,7 +366,7 @@ public define HTML_Partial_Content //) ] ) - )) + ) . define String @@ -448,7 +446,7 @@ define String // jq_dialog_open(dialog_id(uid+"edit_table_dlg_ajax"), "'id='+rowid")+ . -public define HTML_Partial_Content +public define HTML jqGrid_table ( SQLite3DataBase db, @@ -519,20 +517,18 @@ url:'?aws_c=hk_c&aws_a=grid_view&table_name="+rows.table_name+"&view_name="+rows return ret; }")), logDebug("jqGrid_table: partial_content"); - partial_content(jqgrid_init(lang) + [js_init, + head_tags(jqgrid_init(lang) + [js_init, css(css_file("hayamiki/css/hayamiki.css")), js(js_file("select2/js/select2.full.js")), css(css_file("select2/css/select2.css"))], - div([], - sequence([ - table([core_attrs([id(uid+"_grid")])],[]), + div( + table(id(uid+"_grid"),[]) //DR 20170528 div_empty([id(uid+"_pager")]) - ]) ) ) . -public define HTML_Partial_Content +public define HTML view_table_page ( SQLite3DataBase db, @@ -560,26 +556,26 @@ public define HTML_Partial_Content with jqgrid_table = jqGrid_table(db, uid, current_view, filter_name, _T, lang, f_clause, table_referer), logDebug(show_duration_string("jqGrid_table : current_view '"+view_name+"' filter_name '"+filter_name+"'", start_time)); with result = - partial_content([ js(js_file("hayamiki/js/jscolor.min.js")) + head_tags([ js(js_file("hayamiki/js/jscolor.min.js")) ]+jq_dialog_init + jq_datetimepicker_init(lang), [html_wave_box_wide(_T(to_upper(current_view.table_name)), - sequence([ + [ //create the dialog - partial(jq_dialog_create(dialog_id(uid+action_name+"_dlg_ajax"), ajax(controller_action("hk_c", "ajax_edit_table&dialog_id="+uid+action_name+"_dlg_ajax&table_name="+current_view.table_name+filter_clause+referer_arg)))), - div([class("inline")], sequence([ + jq_dialog_create(dialog_id(uid+action_name+"_dlg_ajax"), ajax(controller_action("hk_c", "ajax_edit_table&dialog_id="+uid+action_name+"_dlg_ajax&table_name="+current_view.table_name+filter_clause+referer_arg))), + div(class("inline"), [ // (+) icon for adding new entry - partial(img_button(icn16_add, [class("icon_in_text"), event(onclick, jq_dialog_open(dialog_id(uid+action_name+"_dlg_ajax")))], "", [])), + img_button(icn16_add, [class("icon_in_text"), event(onclick, jq_dialog_open(dialog_id(uid+action_name+"_dlg_ajax")))], "", []), // view selector if there is more than one view name table_view_filter_selector(_T, vtm_v, view_name, filter_name), - ])), + ]), //grid with data - partial(jqgrid_table) + jqgrid_table //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)) - ]))]), + ])]), logDebug(show_duration_string("view_table_page: current_view '"+view_name+"' filter_name '"+filter_name+"'", start_time)); result. -public define HTML_Partial_Content +public define HTML table_in_list_view ( SQLite3DataBase db, @@ -602,21 +598,21 @@ public define HTML_Partial_Content with start_time = unow, with jqgrid_table = jqGrid_table(db, uid, current_view, filter_name, _T, lang, /*fk_clause*/ f_clause, table_referer), logDebug(show_duration_string("jqGrid_table : current_view '"+view_name+"' filter_name '"+filter_name+"'", start_time)); - with result = partial_content([ js(js_file("hayamiki/js/jscolor.min.js")) + with result = head_tags([ js(js_file("hayamiki/js/jscolor.min.js")) ]+ jq_dialog_init + jq_datetimepicker_init(lang), [ - partial(jq_dialog_create(dialog_id(uid+action_name+"_dlg_ajax"), ajax(controller_action("hk_c", "ajax_edit_table&dialog_id="+uid+action_name+"_dlg_ajax&table_name="+current_view.table_name+filter_clause+referer_arg)))), - partial(img_button(icn16_add, [class("icon_in_text"), event(onclick, jq_dialog_open(dialog_id(uid+action_name+"_dlg_ajax")))], "", [])), + jq_dialog_create(dialog_id(uid+action_name+"_dlg_ajax"), ajax(controller_action("hk_c", "ajax_edit_table&dialog_id="+uid+action_name+"_dlg_ajax&table_name="+current_view.table_name+filter_clause+referer_arg))), + img_button(icn16_add, [class("icon_in_text"), event(onclick, jq_dialog_open(dialog_id(uid+action_name+"_dlg_ajax")))], "", []), //table_view_selector(_T, vtm_v, view_name), - partial(jqgrid_table), + jqgrid_table, //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)) ]), logDebug(show_duration_string("table_in_list_view: current_view '"+view_name+"' filter_name '"+filter_name+"'", start_time)); result. -public define Maybe(HTML_Partial_Content) +public define Maybe(HTML) view_table_content ( SQLite3DataBase db, @@ -641,7 +637,7 @@ public define Maybe(HTML_Partial_Content) success(view_table_page(db, _T, lang, /*web_site_directory, */action_name, vtm_v, view_name, filter_name, f_clause, table_referer, fk_clause)) }. -public define Maybe(HTML_Partial_Content) +public define Maybe(HTML) view_table_content ( SQLite3DataBase db, @@ -655,7 +651,7 @@ public define Maybe(HTML_Partial_Content) ) = view_table_content(db, _T, lang, /*web_site_directory,*/ table_name, view_name, action_name, "", "", no_referer, "", vtm). -public define Maybe(HTML_Partial_Content) +public define Maybe(HTML) table_in_list_view_only ( SQLite3DataBase db, @@ -811,16 +807,16 @@ public define List(CXM_Form_Field) with init_script = "var newOption"+uid+foreign_table_name+"_"+c_name+"_selector = new Option("+to_JS_String(fk_show_string)+", '"+to_String(value)+"', true, true); $('#"+uid+foreign_table_name+"_"+c_name+"_selector').select2("+select2_option_str+").append(newOption"+uid+foreign_table_name+"_"+c_name+"_selector).trigger('change');", [ - partial(jq_dialog_create(dialog_id(uid+foreign_table_name+"_dlg_ajax"), ajax(controller_action("hk_c", "ajax_edit_table&dialog_id="+uid+foreign_table_name+"_dlg_ajax&sub_dialog=true&table_name="+foreign_table_name+"&after_close_cb="+refresh_func)))), + html(jq_dialog_create(dialog_id(uid+foreign_table_name+"_dlg_ajax"), ajax(controller_action("hk_c", "ajax_edit_table&dialog_id="+uid+foreign_table_name+"_dlg_ajax&sub_dialog=true&table_name="+foreign_table_name+"&after_close_cb="+refresh_func)))), one_line_fields([ - partial(partial_content([js_inline(refresh_script), - js_inline(jquery_ready(init_script)) - ],empty)), - selector_c([],label(_T(s_name), no_help), html_Id(uid+foreign_table_name+"_"+c_name+"_selector"), wan(c_name), 1, [],/*select.get(db, table_referer, fk_clause), */ success(init("")), mandatory), help_line(help, _T), + html(head_tags([js_inline(refresh_script), + js_inline(jquery_ready(init_script)) + ])), + selector_c([],label(_T(s_name), no_help), html_Id(uid+foreign_table_name+"_"+c_name+"_selector"), wan(c_name), 1, [],/*select.get(db, table_referer, fk_clause), */ success(init("")), mandatory), help_line(help, _T), if no_add then empty else - partial(img_button(icn16_add, [event(onclick, jq_dialog_open(dialog_id(uid+foreign_table_name+"_dlg_ajax")))], "", [])), + html(img_button(icn16_add, [event(onclick, jq_dialog_open(dialog_id(uid+foreign_table_name+"_dlg_ajax")))], "", [])), ]) ]), @@ -850,7 +846,7 @@ public define List(CXM_Form_Field) with combo_init = ajax_combo_init_parameter(uid, foreign_table_name, c_name, to_mb_Int(select), s_fields, active_filters), [ - partial(partial_content([ js(js_file("ajax-combobox/js/jquery.ajax-combobox.js")), + html(head_tags([ js(js_file("ajax-combobox/js/jquery.ajax-combobox.js")), css(css_file("ajax-combobox/css/jquery.ajax-combobox.css")), js_inline(jquery_ready(combo_init))], jq_dialog_create(dialog_id(uid+foreign_table_name+"_dlg_ajax"), ajax(controller_action("hk_c", "ajax_edit_table&dialog_id="+uid+foreign_table_name+"_dlg_ajax&sub_dialog=true&table_name="+foreign_table_name))))), @@ -861,7 +857,7 @@ public define List(CXM_Form_Field) if no_add then empty else - partial(img_button(icn16_add, [event(onclick, jq_dialog_open(dialog_id(uid+foreign_table_name+"_dlg_ajax")))], "", [])), + html(img_button(icn16_add, [event(onclick, jq_dialog_open(dialog_id(uid+foreign_table_name+"_dlg_ajax")))], "", [])), ]), help_line(help, _T) ] @@ -875,7 +871,7 @@ public define List(CXM_Form_Field) [ if txt_editor is { none then empty, - rich_editor then partial(partial_content( + rich_editor then html(head_tags( [ js(js_file("ckeditor/ckeditor.js")), js_inline(jquery_ready( " console.log('loading CKeditor for "+dialog_uid+"_"+c_name+"'); @@ -922,7 +918,7 @@ public define List(CXM_Form_Field) -public define HTML_Partial_Content +public define HTML renderer_edit_list_form ( SQLite3DataBase db, @@ -952,7 +948,7 @@ public define HTML_Partial_Content with button_name_and_new = if create then _T("CREATE_AND_EDIT_NEW") else _T("UPDATE_AND_EDIT_NEW"), with form_id = dialog_id+"_form", //println("renderer_edit_list_form dialog_id ["+dialog_id+"]"); - partial_content( + head_tags( [ js(js_file("hayamiki/js/jscolor.min.js")), js(js_file("xlib/js/dropzone.js")), js(js_file("select2/js/select2.full.min.js")), @@ -975,8 +971,8 @@ public define HTML_Partial_Content (if length(list_entries) > 5 then [ one_line_fields([ - partial(jquery_button(jQuery_button(button, dialog_id+button_name, button_name, button_label, jQuery_actioner(same, jqscript(jq_form_submit_and_close(dialog_id, form_id, if create then hkc_create_row else hkc_update_row, [("table_name", table_name), ("sub_dialog", sub_dialog)], after_close_cb)))))), - partial(jquery_button(jQuery_button(button, dialog_id+"cancel", "cancel", _T("CANCEL"), jQuery_actioner(same, jqscript("$('#"+dialog_id+"').dialog('close')"))))), + html(jquery_button(jQuery_button(button, dialog_id+button_name, button_name, button_label, jQuery_actioner(same, jqscript(jq_form_submit_and_close(dialog_id, form_id, if create then hkc_create_row else hkc_update_row, [("table_name", table_name), ("sub_dialog", sub_dialog)], after_close_cb)))))), + html(jquery_button(jQuery_button(button, dialog_id+"cancel", "cancel", _T("CANCEL"), jQuery_actioner(same, jqscript("$('#"+dialog_id+"').dialog('close')"))))), ]), hr ] @@ -995,16 +991,16 @@ public define HTML_Partial_Content with referer = hk_referer(table_name, id, fk_table_name, fk_col_name), if table_in_list_view_only(db, _T, lang, /* web_site_directory, */ fk_table_name, list_view_name, "", "edit", "", referer, fk_clause, vtm) is { - failure then empty, - success(p_content) then partial(p_content) + failure then html(empty), + success(p_content) then html(p_content) } //text("Foreign Key from table ["+fk_table_name+"] columns ["+fk_col_name+"] view to use ["+list_view_name+"]") ,list_tabs))+ [ hr, one_line_fields([ - partial(jquery_button(jQuery_button(button, dialog_id+button_name+"_bt", button_name, button_label, jQuery_actioner(same, jqscript(jq_form_submit_and_close(dialog_id, form_id, if create then hkc_create_row else hkc_update_row, [("table_name", table_name), ("sub_dialog", sub_dialog)], after_close_cb)))))), - partial(jquery_button(jQuery_button(button, dialog_id+"cancel_bt", "cancel", _T("CANCEL"), jQuery_actioner(same, jqscript("$('#"+dialog_id+"').dialog('close')"))))), + html(jquery_button(jQuery_button(button, dialog_id+button_name+"_bt", button_name, button_label, jQuery_actioner(same, jqscript(jq_form_submit_and_close(dialog_id, form_id, if create then hkc_create_row else hkc_update_row, [("table_name", table_name), ("sub_dialog", sub_dialog)], after_close_cb)))))), + html(jquery_button(jQuery_button(button, dialog_id+"cancel_bt", "cancel", _T("CANCEL"), jQuery_actioner(same, jqscript("$('#"+dialog_id+"').dialog('close')"))))), ]) ] // submit(if create then hkc_save_row else hkc_update_row, failure, button_name, [("table_name", table_name), ("sub_dialog", sub_dialog)]), @@ -1080,14 +1076,14 @@ public define List(CXM_Form_Field) //with load_script = "Xlib.load_content('"+uid+foreign_table_name+"_"+c_name+"_selector', '?aws_controller=hk_c&aws_action=selector&table_name="+foreign_table_name+"&fk_filter="+fk_clause+"&selected="+value+"');", with load_script = script("text/javascript","function "+refresh_func+"() { Xlib.load_content('"+uid+foreign_table_name+"_"+c_name+"_selector', '?aws_c=hk_c&aws_a=selector&table_name="+foreign_table_name+"&fk_filter="+fk_clause+"&selected="+value+"');} "+refresh_func+"(); "), [ - partial(jq_dialog_create(dialog_id(uid+foreign_table_name+"_dlg_ajax"), ajax(controller_action("hk_c", "ajax_edit_table&dialog_id="+uid+foreign_table_name+"_dlg_ajax&sub_dialog=true&table_name="+foreign_table_name)))), + html(jq_dialog_create(dialog_id(uid+foreign_table_name+"_dlg_ajax"), ajax(controller_action("hk_c", "ajax_edit_table&dialog_id="+uid+foreign_table_name+"_dlg_ajax&sub_dialog=true&table_name="+foreign_table_name)))), one_line_fields([ - partial(partial_content([js_inline(load_script)],empty)), + html(head_tags(js_inline(load_script))), selector_c([],label(_T(s_name), no_help), html_Id(uid+foreign_table_name+"_"+c_name+"_selector"), wan(c_name), 1, /*select.get(db, table_referer, fk_clause)*/ [], success(init("")), mandatory), help_line(help, _T), if no_add then - empty + html(empty) else - partial(img_button(icn16_add, [event(onclick, jq_dialog_open(dialog_id(uid+foreign_table_name+"_dlg_ajax")))], "", [])), + html(img_button(icn16_add, [event(onclick, jq_dialog_open(dialog_id(uid+foreign_table_name+"_dlg_ajax")))], "", [])), ]) ], @@ -1109,7 +1105,7 @@ public define List(CXM_Form_Field) with combo_init = ajax_combo_init_parameter(uid, foreign_table_name, c_name, to_mb_Int(select), s_fields, active_filters), [ - partial(partial_content([ + html(head_tags([ js(js_file("ajax-combobox/js/jquery.ajax-combobox.js")), css(css_file("ajax-combobox/css/jquery.ajax-combobox.css")), js(js_file("select2/js/select2.full.min.js")), @@ -1121,7 +1117,7 @@ public define List(CXM_Form_Field) if no_add then empty else - partial(img_button(icn16_add, [event(onclick, jq_dialog_open(dialog_id(uid+foreign_table_name+"_dlg_ajax")))], "", [])), + html(img_button(icn16_add, [event(onclick, jq_dialog_open(dialog_id(uid+foreign_table_name+"_dlg_ajax")))], "", [])), ]), help_line(help, _T) ] @@ -1135,7 +1131,7 @@ public define List(CXM_Form_Field) [ if txt_editor is { none then empty, - rich_editor then partial(partial_content( + rich_editor then html(head_tags( [js(js_file("ckeditor/ckeditor.js")), js_inline(jquery_ready( " console.log('loading CKeditor for "+c_name+"'); @@ -1146,7 +1142,7 @@ public define List(CXM_Form_Field) " cke_instance.on('blur', function() { cke_instance.updateElement(); }); "))],empty)) }, - text_area([],no_label, html_Id(c_name), wan(c_name), init(not_null_String(value)), narrow, (Int)5, mandatory), help_line(help, _T)], + text_area([],no_label, html_Id(c_name), wan(c_name), init(not_null_String(value)), narrow, (Int)5, mandatory), help_line(help, _T)], boolean(s_name, c_name, value, help) then [checkboxr([],label(_T(s_name), no_help), html_Id(c_name), wan(c_name), value, mandatory), help_line(help, _T)], @@ -1174,7 +1170,7 @@ public define List(CXM_Form_Field) [url_input([event(onclick, "hk_go_url(this)"), class("clickable")], [class("hk_input_url")], label(_T(s_name), no_help), html_Id(c_name), wan(c_name), init(not_null_String(value)), narrow, mandatory), help_line(help, _T)], }. -define List(Cell_Option) +define List(CoreAttrs) make_cell_option ( List(HK_Form_Table_Cell_Attribute) attributes @@ -1183,8 +1179,8 @@ define List(Cell_Option) |-> if attr is { - colspan(number) then columns(number), - rowspan(number) then rows(number) + colspan(number) then colspan(number), + rowspan(number) then rowspan(number) }, attributes ) @@ -1205,17 +1201,17 @@ define CXM_Form_Field table([class("striped")], map((HK_Form_Table_Line line) |-> //construct line - row( + tr( map((HK_Form_Table_Cell cell_content) |-> if cell_content is { //construct one cell hk_form_table_cell(cell_attributes, entry) then - cell(make_cell_option(cell_attributes), to_HTML_In_Form(edit_form_cell(db, table_referer, lwa, _T, entry, create, no_add, []), lwa, "form_field table", false)), + td(make_cell_option(cell_attributes), to_HTML(edit_form_cell(db, table_referer, lwa, _T, entry, create, no_add, []), lwa, "form_field table", false)), //construct table in one cell hk_form_table_cell_table(cell_attributes, lines) then - cell(make_cell_option(cell_attributes), to_HTML_In_Form([construct_edit_form_table(db, table_referer, _T, lwa, lines, create, no_add)], lwa, "form_field table", false)) + td(make_cell_option(cell_attributes), to_HTML([construct_edit_form_table(db, table_referer, _T, lwa, lines, create, no_add)], lwa, "form_field table", false)) }, line.form_table_cells ) @@ -1225,6 +1221,7 @@ define CXM_Form_Field ) ) . + public define List(CXM_Form_Field) get_hidden ( @@ -1235,7 +1232,7 @@ public define List(CXM_Form_Field) -public define HTML_Partial_Content +public define HTML renderer_edit_table_form ( SQLite3DataBase db, @@ -1263,7 +1260,7 @@ public define HTML_Partial_Content with button_name = if create then "create" else "update", with button_name_and_new = if create then _T("CREATE_AND_EDIT_NEW") else _T("UPDATE_AND_EDIT_NEW"), with form_id = dialog_id+"_form", - partial_content( + head_tags( [ js(js_file("hayamiki/js/jscolor.min.js")), js_script("jscolor.installByClassName('jscolor');") //js_script("jscolor.init;") @@ -1272,7 +1269,7 @@ public define HTML_Partial_Content jq_datetimepicker_init(lang), //get_editor_header(table_form.form_lines)+ //add editor header if need. Like init ck_editor //get_combo_header(table_name, table_form.form_lines), //add editor header if need. Like init ck_editor - sequence([ + [ cxm_form( form_id, [], lwa, get_hidden(table_form.table_attr)+ //collect hidden value from table form get_hidden(lwa)+ //collect hidden value from lwa @@ -1281,8 +1278,8 @@ public define HTML_Partial_Content // submit(if create then hkc_save_row else hkc_update_row, failure, button_name, [("table_name", table_name)]), // submit(if create then hkc_save_row_and_new else hkc_update_row_and_new, failure, button_name_and_new, [("table_name", table_name)]), // submit(hkc_cancel, failure, _T("CANCEL")) - partial(jquery_button(jQuery_button(button, dialog_id+button_name, button_name, button_label, jQuery_actioner(same, jqscript(jq_form_submit_and_close(dialog_id, form_id, if create then hkc_create_row else hkc_update_row, [("table_name", table_name), ("sub_dialog", sub_dialog)], after_close_cb)))))), - partial(jquery_button(jQuery_button(button, dialog_id+"cancel", "cancel", _T("CANCEL"), jQuery_actioner(same, jqscript("$('#"+dialog_id+"').dialog('close')"))))), + html(jquery_button(jQuery_button(button, dialog_id+button_name, button_name, button_label, jQuery_actioner(same, jqscript(jq_form_submit_and_close(dialog_id, form_id, if create then hkc_create_row else hkc_update_row, [("table_name", table_name), ("sub_dialog", sub_dialog)], after_close_cb)))))), + html(jquery_button(jQuery_button(button, dialog_id+"cancel", "cancel", _T("CANCEL"), jQuery_actioner(same, jqscript("$('#"+dialog_id+"').dialog('close')"))))), ]) ], @@ -1303,10 +1300,10 @@ public define HTML_Partial_Content // } // //text("Foreign Key from table ["+fk_table_name+"] columns ["+fk_col_name+"] view to use ["+list_view_name+"]") // ,list_tabs) - )) + ) . -public define Maybe(HTML_Partial_Content) +public define Maybe(HTML) edit_table_content ( SQLite3DataBase db, @@ -1335,7 +1332,7 @@ public define Maybe(HTML_Partial_Content) } }. -public define Maybe(HTML_Partial_Content) +public define Maybe(HTML) edit_table_content ( SQLite3DataBase db, -- libgit2 0.21.4