Commit b4174bbae9f28a186b844afb962bda1ee083977e
1 parent
2cf7bf21
in javascipt code change the double quote by single quote which more readable under anubis source
Showing
2 changed files
with
117 additions
and
54 deletions
Show diff stats
view/jqgrid.anubis
| ... | ... | @@ -7,6 +7,7 @@ |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | read xlib/web/making_a_web_site.anubis |
| 10 | +read xlib/web/js_tools.anubis | |
| 10 | 11 | read hayamiki_lib/types/hayamiki.anubis |
| 11 | 12 | read hayamiki_lib/view/types/hk_form.anubis |
| 12 | 13 | read hayamiki_lib/view/types/hk_view.anubis |
| ... | ... | @@ -113,14 +114,14 @@ define String |
| 113 | 114 | with empty_referer = hk_referer("","","",""), |
| 114 | 115 | with result = if model is |
| 115 | 116 | { |
| 116 | - primary_key then "{ name: \"id\", hidden:true }", | |
| 117 | - information(label,column_name,width,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", autoResizable: true, "+search_options(column_name)+"}", | |
| 118 | - text(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, "+search_options(column_name)+" }", | |
| 119 | - password(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", autoResizable: true }", | |
| 117 | + primary_key then "{ name: 'id', hidden:true }", | |
| 118 | + information(label,column_name,width,help) then "{ name: '"+column_name+"', label: "+to_JS_String(_T(label))+", autoResizable: true, "+search_options(column_name)+"}", | |
| 119 | + text(label,column_name,help) then "{ name: '"+column_name+"', label: "+to_JS_String(_T(label))+", editable:true, autoResizable: true, "+search_options(column_name)+" }", | |
| 120 | + password(label,column_name,help) then "{ name: '"+column_name+"', label: "+to_JS_String(_T(label))+", autoResizable: true }", | |
| 120 | 121 | foreign_text(label,column_name,selector,help) then |
| 121 | 122 | logDebug("to_jqGrid_ColModel 1: foreign_text column_name "+column_name); |
| 122 | 123 | with jqgrid_selector = to_jqGrid_selector(selector.get(db,table_referer,"")), |
| 123 | - "{ name: '"+column_name+"', label: '"+_T(label)+"', editable:true, autoResizable: true, edittype:'select', editoptions: {value: "+jqgrid_selector+", dataInit: function (elem) { | |
| 124 | + "{ name: '"+column_name+"', label: "+to_JS_String(_T(label))+", editable:true, autoResizable: true, edittype:'select', editoptions: {value: "+jqgrid_selector+", dataInit: function (elem) { | |
| 124 | 125 | $(elem).select2({ |
| 125 | 126 | dropdownCssClass: 'ui-widget ui-jqdialog', |
| 126 | 127 | width: '100%' |
| ... | ... | @@ -132,7 +133,7 @@ define String |
| 132 | 133 | choices_text(label,column_name,selector,help) then |
| 133 | 134 | logDebug("to_jqGrid_ColModel 1: choices_text column_name "+column_name); |
| 134 | 135 | with jqgrid_selector = to_jqGrid_selector(selector.get(db, empty_referer, "")), |
| 135 | - "{ name: '"+column_name+"', label: '"+_T(label)+"', editable:true, autoResizable: true, edittype:'select', editoptions:{value: "+jqgrid_selector+",dataInit: function (elem) { | |
| 136 | + "{ name: '"+column_name+"', label: "+to_JS_String(_T(label))+", editable:true, autoResizable: true, edittype:'select', editoptions:{value: "+jqgrid_selector+",dataInit: function (elem) { | |
| 136 | 137 | $(elem).select2({ |
| 137 | 138 | dropdownCssClass: 'ui-widget ui-jqdialog', |
| 138 | 139 | width: '100%' |
| ... | ... | @@ -141,24 +142,24 @@ define String |
| 141 | 142 | //" formatter: \"select\","+ |
| 142 | 143 | //" formatoptions:{value: "+jqgrid_selector+"},"+ |
| 143 | 144 | "}", |
| 144 | - text_area(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\" }", | |
| 145 | - boolean(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, template: \"booleanCheckboxFa\" }", | |
| 146 | - integer(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, template: \"integer\" }", | |
| 147 | - float(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, template: \"number\" }", | |
| 145 | + text_area(label,column_name,help) then "{ name: '"+column_name+"', label: "+to_JS_String(_T(label))+" }", | |
| 146 | + boolean(label,column_name,help) then "{ name: '"+column_name+"', label: "+to_JS_String(_T(label))+", editable:true, autoResizable: true, template: 'booleanCheckboxFa' }", | |
| 147 | + integer(label,column_name,help) then "{ name: '"+column_name+"', label: "+to_JS_String(_T(label))+", editable:true, autoResizable: true, template: 'integer' }", | |
| 148 | + float(label,column_name,help) then "{ name: '"+column_name+"', label: "+to_JS_String(_T(label))+", editable:true, autoResizable: true, template: 'number' }", | |
| 148 | 149 | choices_int(label,column_name,selector,help) then |
| 149 | 150 | logDebug("to_jqGrid_ColModel 1: choices_int column_name "+column_name); |
| 150 | 151 | with jqgrid_selector = to_jqGrid_selector(selector.get(db, empty_referer, "")), |
| 151 | - "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, edittype:\"select\", editoptions:{value: "+jqgrid_selector+"},"+ | |
| 152 | - " formatter: \"select\","+ | |
| 152 | + "{ name: '"+column_name+"', label: "+to_JS_String(_T(label))+", editable:true, autoResizable: true, edittype:'select', editoptions:{value: "+jqgrid_selector+"},"+ | |
| 153 | + " formatter: 'select',"+ | |
| 153 | 154 | " formatoptions:{value: "+jqgrid_selector+"},"+ |
| 154 | 155 | "}", |
| 155 | - date(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, formatter: \"date\", formatoptions: { newformat: \"Y-M-d\" }}", | |
| 156 | - time(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true }", | |
| 157 | - datetime(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true }", | |
| 158 | - color(label, column_name, help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", width: 40, editable:true, autoResizable: true, edittype: 'custom', formatter:formatColor, unformat:unformatColor, "+custom_edit_color+" }", | |
| 159 | - phone(label,column_name, ph_type, help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, edittype: 'custom', formatter:formatPhone, unformat:unformatPhone, "+custom_edit_phone+"}", | |
| 160 | - email(label,column_name, help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, edittype: 'custom', formatter:formatEmail, unformat:unformatEmail, "+custom_edit_email+"}", | |
| 161 | - url(label, column_name, help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, "+search_options(column_name)+" }", | |
| 156 | + date(label,column_name,help) then "{ name: '"+column_name+"', label: "+to_JS_String(_T(label))+", editable:true, autoResizable: true, formatter: 'date', formatoptions: { newformat: 'Y-M-d' }}", | |
| 157 | + time(label,column_name,help) then "{ name: '"+column_name+"', label: "+to_JS_String(_T(label))+", editable:true, autoResizable: true }", | |
| 158 | + datetime(label,column_name,help) then "{ name: '"+column_name+"', label: "+to_JS_String(_T(label))+", editable:true, autoResizable: true }", | |
| 159 | + color(label, column_name, help) then "{ name: '"+column_name+"', label: "+to_JS_String(_T(label))+", width: 40, editable:true, autoResizable: true, edittype: 'custom', formatter:formatColor, unformat:unformatColor, "+custom_edit_color+" }", | |
| 160 | + phone(label,column_name, ph_type, help) then "{ name: '"+column_name+"', label: "+to_JS_String(_T(label))+", editable:true, autoResizable: true, edittype: 'custom', formatter:formatPhone, unformat:unformatPhone, "+custom_edit_phone+"}", | |
| 161 | + email(label,column_name, help) then "{ name: '"+column_name+"', label: "+to_JS_String(_T(label))+", editable:true, autoResizable: true, edittype: 'custom', formatter:formatEmail, unformat:unformatEmail, "+custom_edit_email+"}", | |
| 162 | + url(label, column_name, help) then "{ name: '"+column_name+"', label: "+to_JS_String(_T(label))+", editable:true, autoResizable: true, "+search_options(column_name)+" }", | |
| 162 | 163 | }, |
| 163 | 164 | logDebug(show_duration_string("to_jqGrid_ColModel 1: result", start_time)); |
| 164 | 165 | result | ... | ... |
view/view_table_renderer.anubis
| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | * |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | +read hayamiki_lib/controller/hk_utils.anubis | |
| 9 | 10 | read hayamiki_lib/view/types/hk_form_entry.anubis |
| 10 | 11 | read hayamiki_lib/view/types/hk_form.anubis |
| 11 | 12 | read hayamiki_lib/view/types/hk_view.anubis |
| ... | ... | @@ -380,7 +381,7 @@ define String |
| 380 | 381 | logDebug("jqGrid_options: entry"); |
| 381 | 382 | with result = " |
| 382 | 383 | editurl: '?aws_c=hk_c&aws_a=grid_action&table_name="+rows.table_name+"', |
| 383 | - iconSet: \"fontAwesome\", | |
| 384 | + iconSet: 'fontAwesome', | |
| 384 | 385 | cmTemplate: { autoResizable: true}, |
| 385 | 386 | autoResizing: { compact: true, resetWidthOrg: true }, |
| 386 | 387 | autoresizeOnLoad: true, |
| ... | ... | @@ -397,42 +398,42 @@ define String |
| 397 | 398 | cellurl: '?aws_c=hk_c&aws_a=grid_action&table_name="+rows.table_name+"', |
| 398 | 399 | editurl: '?aws_c=hk_c&aws_a=grid_action&table_name="+rows.table_name+"', |
| 399 | 400 | onSelectRow: function (rowid, status, e) { |
| 400 | - var $self = $(this), savedRow = $self.jqGrid(\"getGridParam\", \"savedRow\"); | |
| 401 | + var $self = $(this), savedRow = $self.jqGrid('getGridParam', 'savedRow'); | |
| 401 | 402 | if (savedRow.length > 0 && savedRow[0].id !== rowid) { |
| 402 | 403 | $self.jqGrid(\"restoreRow\", savedRow[0].id); |
| 403 | 404 | } |
| 404 | 405 | }, |
| 405 | 406 | ondblClickRow: function (rowid, iRow, iCol, e) { |
| 406 | - var $self = $(this), savedRow = $self.jqGrid(\"getGridParam\", \"savedRow\"); | |
| 407 | + var $self = $(this), savedRow = $self.jqGrid('getGridParam', 'savedRow'); | |
| 407 | 408 | if (savedRow.length > 0 && savedRow[0].id !== rowid) { |
| 408 | - $self.jqGrid(\"restoreRow\", savedRow[0].id); | |
| 409 | + $self.jqGrid('restoreRow', savedRow[0].id); | |
| 409 | 410 | } |
| 410 | - $self.jqGrid(\"editRow\", rowid, { focusField: e.target }); | |
| 411 | + $self.jqGrid('editRow', rowid, { focusField: e.target }); | |
| 411 | 412 | }, |
| 412 | 413 | |
| 413 | 414 | afterAddRow: function () { |
| 414 | 415 | recreateFilterToolbar.call(this); |
| 415 | - //updateAutocompleteSource.call(this, \"name\"); | |
| 416 | + //updateAutocompleteSource.call(this, 'name'); | |
| 416 | 417 | }, |
| 417 | 418 | afterSetRow: function () { |
| 418 | 419 | recreateFilterToolbar.call(this); |
| 419 | - //updateAutocompleteSource.call(this, \"name\"); | |
| 420 | + //updateAutocompleteSource.call(this, 'name'); | |
| 420 | 421 | }, |
| 421 | 422 | afterDelRow: function () { |
| 422 | - //updateAutocompleteSource.call(this, \"name\"); | |
| 423 | + //updateAutocompleteSource.call(this, 'name'); | |
| 423 | 424 | recreateFilterToolbar.call(this); |
| 424 | 425 | }, |
| 425 | 426 | caption:"+to_JSON_String(_T(to_upper(rows.table_name)))+", |
| 426 | 427 | actionsNavOptions: { |
| 427 | - openicon: \"fa-folder-open-o\", | |
| 428 | - opentitle: \"Open (Enter)\", | |
| 428 | + openicon: 'fa-folder-open-o', | |
| 429 | + opentitle: 'Open (Enter)', | |
| 429 | 430 | isDisplayButtons: function (options, rowData) { |
| 430 | 431 | if (options.rowData.closed) { // or rowData.closed |
| 431 | 432 | return { post: { hidden: true }, del: { display: false } }; |
| 432 | 433 | } |
| 433 | 434 | }, |
| 434 | 435 | custom: [ |
| 435 | - { action: \"open\", position: \"first\", | |
| 436 | + { action: 'open', position: 'first', | |
| 436 | 437 | onClick: function (options) {"+ |
| 437 | 438 | jq_dialog_open(dialog_id(uid+"edit_table_dlg_ajax"), "'id='+options.rowid")+ |
| 438 | 439 | " |
| ... | ... | @@ -466,7 +467,7 @@ public define HTML_Partial_Content |
| 466 | 467 | "var lastSel; |
| 467 | 468 | initAutocomplete = function (elem, cmName) { |
| 468 | 469 | $(elem).autocomplete({ |
| 469 | - source: $(this).jqGrid(\"getUniqueValueFromColumnIndex\", cmName), | |
| 470 | + source: $(this).jqGrid('getUniqueValueFromColumnIndex', cmName), | |
| 470 | 471 | delay: 0, |
| 471 | 472 | minLength: 0 |
| 472 | 473 | }); |
| ... | ... | @@ -477,11 +478,11 @@ public define HTML_Partial_Content |
| 477 | 478 | .jqGrid(\"filterToolbar\"); |
| 478 | 479 | }, |
| 479 | 480 | updateAutocompleteSource = function (cmName) { |
| 480 | - var newUniqueValues = $(this).jqGrid(\"getUniqueValueFromColumnIndex\", cmName); | |
| 481 | - $(\"#gs_\" + this.id + \"_\" + cmName) | |
| 482 | - .autocomplete(\"option\", \"source\", newUniqueValues); | |
| 481 | + var newUniqueValues = $(this).jqGrid('getUniqueValueFromColumnIndex', cmName); | |
| 482 | + $('#gs_' + this.id + '_' + cmName) | |
| 483 | + .autocomplete('option', 'source', newUniqueValues); | |
| 483 | 484 | }; |
| 484 | -$(\"#"+uid+"_grid\").jqGrid({ | |
| 485 | +$('#"+uid+"_grid').jqGrid({ | |
| 485 | 486 | url:'?aws_controller=hk_c&aws_action=grid_view&table_name="+rows.table_name+"&view_name="+rows.view_name+"&filter_name="+filter_name+filter_clause+referer_arg+"',"+ |
| 486 | 487 | "datatype: \"json\", |
| 487 | 488 | "+ |
| ... | ... | @@ -491,7 +492,7 @@ url:'?aws_controller=hk_c&aws_action=grid_view&table_name="+rows.table_name+"&vi |
| 491 | 492 | ",loadComplete: function () { |
| 492 | 493 | |
| 493 | 494 | } |
| 494 | - }).jqGrid(\"gridResize\"); | |
| 495 | + }).jqGrid('gridResize'); | |
| 495 | 496 | function formatColor(cellValue, options, rowObject) { |
| 496 | 497 | var color_container = \"<div class=\\\"hk_jscolor\\\" data-color=\\\"\"+ cellValue + \"\\\" style=\\\"background-color:#\"+ cellValue + \"\\\"></div>\"; |
| 497 | 498 | return color_container; |
| ... | ... | @@ -688,7 +689,36 @@ define CXM_Form_Field |
| 688 | 689 | help_text_TAG(tag) then explain(_T(tag)), |
| 689 | 690 | help_text(str) then explain(str) |
| 690 | 691 | }. |
| 691 | - | |
| 692 | + | |
| 693 | +define String | |
| 694 | + select2_option | |
| 695 | + ( | |
| 696 | + String url, | |
| 697 | + String initial_id, | |
| 698 | + String initial_text | |
| 699 | + ) | |
| 700 | + = | |
| 701 | +"{ | |
| 702 | +// initSelection : function (element, callback) { | |
| 703 | +// var data = [{id:"+initial_id+",text:'"+initial_text+"'}]; | |
| 704 | +// callback(data) | |
| 705 | +// }, | |
| 706 | + ajax:{ | |
| 707 | + url: '"+url+"&select2=true', | |
| 708 | + type: 'post', | |
| 709 | + dataType: 'json', | |
| 710 | + delay: 250, | |
| 711 | + data: function(params){ | |
| 712 | + return { | |
| 713 | + search: params.term | |
| 714 | + }; | |
| 715 | + }, | |
| 716 | + }, | |
| 717 | + width: '200px !important', | |
| 718 | + dropdownCssClass: 'ui-widget ui-jqdialog', | |
| 719 | +}" | |
| 720 | +. | |
| 721 | + | |
| 692 | 722 | |
| 693 | 723 | //Edit table part |
| 694 | 724 | public define List(CXM_Form_Field) |
| ... | ... | @@ -702,6 +732,7 @@ public define List(CXM_Form_Field) |
| 702 | 732 | List(HK_Form_Entry) list, |
| 703 | 733 | Bool new_entry, |
| 704 | 734 | Bool no_add, |
| 735 | + VTM vtm, | |
| 705 | 736 | List(CXM_Form_Field) so_far |
| 706 | 737 | )= |
| 707 | 738 | if list is |
| ... | ... | @@ -741,6 +772,11 @@ public define List(CXM_Form_Field) |
| 741 | 772 | ], |
| 742 | 773 | |
| 743 | 774 | foreign_text(s_name, c_name, _value, foreign_table_name, select, active_filters, help) then |
| 775 | + println("foreign_text -----"); | |
| 776 | + println("s_name :"+s_name); | |
| 777 | + println("c_name :"+c_name); | |
| 778 | + println("_value :"+to_String(_value)); | |
| 779 | + | |
| 744 | 780 | with dummy = if length(active_filters) > 0 then |
| 745 | 781 | println("ACTIVE FILTER for "+c_name); |
| 746 | 782 | println(join("", map((HK_Foreign_Key_Active_Filter a_filter) |-> |
| ... | ... | @@ -753,21 +789,39 @@ public define List(CXM_Form_Field) |
| 753 | 789 | unique, |
| 754 | 790 | with uid = "_"+generate_random_string(20)+"_", |
| 755 | 791 | with refresh_func = uid+foreign_table_name+"_"+c_name+"_selector_refresh", |
| 756 | - //Get the priority of the web argument content for the value, this means the value already set by the user or called with programmaticaly with it | |
| 792 | + | |
| 793 | + //Get the priority of the web argument content for the value, this means the value already set by the user or called with programmaticaly with it | |
| 757 | 794 | with value = get_DB_id(lwa, c_name, _value), |
| 758 | - //create refresh function and call it first to construct the dropdown | |
| 759 | - 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+"&"+to_Web_arg(table_referer, "")+"'); $('#"+uid+foreign_table_name+"_"+c_name+"_selector').select2();} "+refresh_func+"(); "), | |
| 760 | - [ | |
| 761 | - 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)))), | |
| 762 | - one_line_fields([ | |
| 763 | - partial(partial_content([js_inline(load_script)],empty)), | |
| 764 | - 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), | |
| 765 | - if no_add then | |
| 766 | - empty | |
| 767 | - else | |
| 768 | - partial(img_button(icn16_add, [event(onclick, jq_dialog_open(dialog_id(uid+foreign_table_name+"_dlg_ajax")))], "", [])), | |
| 769 | - ]) | |
| 770 | - ], | |
| 795 | + println("value :"+to_String(value)); | |
| 796 | + with view_only = get_Bool(lwa, "vo_"+c_name, false), | |
| 797 | + with fk_show_string = row_show_string(db, vtm, foreign_table_name, value), | |
| 798 | + if view_only then | |
| 799 | + //[input_readonly(label(_T(s_name), no_help), wan(c_name), init(not_null_String(fk_show_string)), narrow), help_line(help, _T)] | |
| 800 | + [ | |
| 801 | + hidden(html_Id(""), wan(c_name), wav(to_String(value))), | |
| 802 | + message(to_String(format_label(label(_T(s_name), no_help), html_Id("")))+not_null_String(fk_show_string))] | |
| 803 | + else | |
| 804 | + (with select2_option_str = select2_option("?aws_c=hk_c&aws_a=selector&table_name="+foreign_table_name+"&fk_filter="+fk_clause+"&selected="+value+"&"+to_Web_arg(table_referer, ""), | |
| 805 | + to_String(value), | |
| 806 | + fk_show_string), | |
| 807 | + //create refresh function and call it first to construct the dropdown | |
| 808 | + // 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+"&"+to_Web_arg(table_referer, "")+"'); $('#"+uid+foreign_table_name+"_"+c_name+"_selector').select2();} "+refresh_func+"(); "), | |
| 809 | + with refresh_script = script("text/javascript","function "+refresh_func+"() { $('#"+uid+foreign_table_name+"_"+c_name+"_selector').select2('destroy');$('#"+uid+foreign_table_name+"_"+c_name+"_selector').select2("+select2_option_str+");} "), | |
| 810 | + 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); | |
| 811 | + $('#"+uid+foreign_table_name+"_"+c_name+"_selector').select2("+select2_option_str+").append(newOption"+uid+foreign_table_name+"_"+c_name+"_selector).trigger('change');", | |
| 812 | + [ | |
| 813 | + 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)))), | |
| 814 | + one_line_fields([ | |
| 815 | + partial(partial_content([js_inline(refresh_script), | |
| 816 | + js_inline(jquery_ready(init_script)) | |
| 817 | + ],empty)), | |
| 818 | + 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), | |
| 819 | + if no_add then | |
| 820 | + empty | |
| 821 | + else | |
| 822 | + partial(img_button(icn16_add, [event(onclick, jq_dialog_open(dialog_id(uid+foreign_table_name+"_dlg_ajax")))], "", [])), | |
| 823 | + ]) | |
| 824 | + ]), | |
| 771 | 825 | |
| 772 | 826 | |
| 773 | 827 | foreign_text_search(s_name, c_name, _select, foreign_table_name, s_fields, active_filters, help) then |
| ... | ... | @@ -783,7 +837,15 @@ public define List(CXM_Form_Field) |
| 783 | 837 | unique, |
| 784 | 838 | with uid = "_"+generate_random_string(20)+"_", |
| 785 | 839 | //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 |
| 786 | - with select = get_DB_id(lwa, c_name, _select), | |
| 840 | + with select = get_DB_id(lwa, c_name, _select), | |
| 841 | + with view_only = get_Bool(lwa, "vo_"+c_name, false), | |
| 842 | + with fk_show_string = row_show_string(db, vtm, foreign_table_name, select), | |
| 843 | + if view_only then | |
| 844 | + //[input_readonly(label(_T(s_name), no_help), wan(c_name), init(not_null_String(fk_show_string)), narrow), help_line(help, _T)] | |
| 845 | + [ | |
| 846 | + hidden(html_Id(""), wan(c_name), wav(to_String(select))), | |
| 847 | + message(to_String(format_label(label(_T(s_name), no_help), html_Id("")))+not_null_String(fk_show_string))] | |
| 848 | + else | |
| 787 | 849 | with combo_init = ajax_combo_init_parameter(uid, foreign_table_name, c_name, to_mb_Int(select), s_fields, active_filters), |
| 788 | 850 | [ |
| 789 | 851 | |
| ... | ... | @@ -853,7 +915,7 @@ public define List(CXM_Form_Field) |
| 853 | 915 | url( s_name, c_name, value, help) then |
| 854 | 916 | [url_input([event(onclick, "hk_go_url(this)")], [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)], |
| 855 | 917 | }, |
| 856 | - edit_form_lines(db, fk_clause, table_referer, lwa, _T, t, new_entry, no_add, reverse(line)+so_far) | |
| 918 | + edit_form_lines(db, fk_clause, table_referer, lwa, _T, t, new_entry, no_add, vtm, reverse(line)+so_far) | |
| 857 | 919 | }. |
| 858 | 920 | |
| 859 | 921 | |
| ... | ... | @@ -921,7 +983,7 @@ public define HTML_Partial_Content |
| 921 | 983 | [] |
| 922 | 984 | ) |
| 923 | 985 | + |
| 924 | - edit_form_lines(db, "", table_referer, lwa, _T, list_entries, create, no_add, []) | |
| 986 | + edit_form_lines(db, "", table_referer, lwa, _T, list_entries, create, no_add, vtm, []) | |
| 925 | 987 | + |
| 926 | 988 | (if id = "none" then |
| 927 | 989 | [] | ... | ... |