Commit a48e1ea83bf70ec3c05d59bd9fa6b132004ee2e7

Authored by totoro
1 parent 43f4a3b4

add referer_row_id in web_arg

add init_value in ajax combo init
types/hayamiki.anubis
... ... @@ -57,6 +57,7 @@ public define String
57 57 __prefix__+"referer_table="+referer_table+"&"+
58 58 __prefix__+"referer_row_id="+referer_row_id+"&"+
59 59 __prefix__+"fk_table="+ fk_table+"&"+
60   - __prefix__+"fk_column="+ fk_column
  60 + __prefix__+"fk_column="+ fk_column+"&"+
  61 + __prefix__+fk_column+"="+referer_row_id //add the column which reference the foreign_key and set the foreign id
61 62 }
62 63 .
... ...
view/view_apps_renderer.anubis
... ... @@ -11,7 +11,7 @@ read hayamiki_lib/view/web_action.anubis
11 11 read hayamiki_lib/controller/hk_sql_utils.anubis
12 12 read calexium_lib/web/CXM_making_a_web_site.anubis
13 13  
14   -read calexium_lib/web/jQuery/CXM_jquery_dialog.anubis
  14 +read calexium_lib/web/jQuery/CXM_jquery_dialog.anubis
15 15 read calexium_lib/web/jQuery/CXM_jquery_button.anubis
16 16 read calexium_lib/web/jQuery/ui-addon/datetimepicker.anubis
17 17 read calexium_lib/web/widgets/button.anubis
... ...
view/view_table_renderer.anubis
... ... @@ -132,14 +132,19 @@ public define HK_Filter
132 132 define String
133 133 ajax_combo_init_parameter
134 134 (
135   - String combo_uid,
136   - String f_table, //db table name
137   - String c_name, //column name in the table
138   - List(String) s_fields //search fields
  135 + String combo_uid,
  136 + String f_table, //db table name
  137 + String c_name, //column name in the table
  138 + Maybe(Int) init_value, //
  139 + List(String) s_fields //search fields
139 140 )=
140 141 "$('#"+combo_uid+"').ajaxComboBox( '?aws_controller=hk_c&aws_action=combo_search',
141   - {
142   - lang: 'fr',
  142 + {"
  143 ++
  144 +if init_value is {failure then "", success(value) then
  145 +" init_record: "+value+",\n"}
  146 ++
  147 +" lang: 'fr',
143 148 per_page: 15,
144 149 db_table: '"+f_table+"',
145 150 button_img: 'ajax-combobox/btn.png',
... ... @@ -151,7 +156,7 @@ define String
151 156 else
152 157 " show_string: '"+join(", ", s_fields)+"',\n")
153 158 +
154   -" and_or: 'OR'
  159 +" and_or: 'OR'\n
155 160 });"
156 161 .
157 162  
... ... @@ -526,10 +531,10 @@ public define HTML_Partial_Content
526 531 //String web_site_directory,
527 532 String action_name,
528 533 VTM_view vtm_v,
529   - String view_name,
  534 + String view_name, //requested view name
530 535 String filter_name,
531 536 String f_clause, //filter for current table
532   - HK_Referer table_referer,
  537 + HK_Referer table_referer,//refer to caller table, useful for foreign key
533 538 String fk_clause //filter for foreign key of the table (one to many)
534 539 ) =
535 540 with filter_clause = if f_clause = "" then "" else "&clause="+url_quote(f_clause),
... ... @@ -693,7 +698,7 @@ public define List(CXM_Form_Field)
693 698 with uid = "_"+generate_random_string(20)+"_",
694 699 //Get the priority of the web argument content for the select, this means the value already set by the user or called with programmaticaly with it
695 700 with select = get_DB_id(lwa, c_name, _select),
696   - with combo_init = ajax_combo_init_parameter(uid, foreign_table_name, c_name, s_fields),
  701 + with combo_init = ajax_combo_init_parameter(uid, foreign_table_name, c_name, to_mb_Int(select), s_fields),
697 702 [
698 703  
699 704 partial(partial_content([ js(js_file("ajax-combobox/js/jquery.ajax-combobox.js")),
... ... @@ -916,7 +921,7 @@ public define List(CXM_Form_Field)
916 921 //[raw_in_form(literal("<input class=\"in\" id=\"acb_"+c_name+"\" data-init_record=\""+select+"\" size=\"50\" type=\"text\">"))]
917 922 with uid = "_"+generate_random_string(20)+"_",
918 923 with select = get_DB_id(lwa, c_name, _select),
919   - with combo_init = ajax_combo_init_parameter(uid, foreign_table_name, c_name, s_fields),
  924 + with combo_init = ajax_combo_init_parameter(uid, foreign_table_name, c_name, to_mb_Int(select), s_fields),
920 925 [
921 926 partial(partial_content([
922 927 js(js_file("ajax-combobox/js/jquery.ajax-combobox.js")),
... ...