Commit 1ea67eb55022aaaa2c37b180530fa8d72e71f142
1 parent
a8e062d5
add phone (better management), email and url
try to debug color edit !! (seems to work with dialog but not in jqgrid)
Showing
4 changed files
with
71 additions
and
19 deletions
Show diff stats
view/jqgrid.anubis
| @@ -57,6 +57,28 @@ define String | @@ -57,6 +57,28 @@ define String | ||
| 57 | " | 57 | " |
| 58 | . | 58 | . |
| 59 | 59 | ||
| 60 | +define String | ||
| 61 | + custom_edit_color = | ||
| 62 | +" editoptions: { | ||
| 63 | + custom_element: function(value, options) { | ||
| 64 | + var el = document.createElement('input'); | ||
| 65 | + el.type='text'; | ||
| 66 | + el.value = value; | ||
| 67 | + var myPicker = new jscolor.color(el, {}); | ||
| 68 | + myPicker.fromString(value); | ||
| 69 | + return el; | ||
| 70 | + }, | ||
| 71 | + custom_value: function(elem, operation, value ) { | ||
| 72 | + if (operation === 'get') { | ||
| 73 | + return $(elem).val(); // change this to get value from color picker | ||
| 74 | + } else if (operation === 'set') { | ||
| 75 | + $('input',elem).val(value); // change this to set value of color picker | ||
| 76 | + } | ||
| 77 | + } | ||
| 78 | + } | ||
| 79 | +" | ||
| 80 | +. | ||
| 81 | + | ||
| 60 | define String | 82 | define String |
| 61 | search_options | 83 | search_options |
| 62 | ( | 84 | ( |
| @@ -108,10 +130,10 @@ define String | @@ -108,10 +130,10 @@ define String | ||
| 108 | date(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, formatter: \"date\", formatoptions: { newformat: \"Y-M-d\" }}", | 130 | date(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, formatter: \"date\", formatoptions: { newformat: \"Y-M-d\" }}", |
| 109 | time(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true }", | 131 | time(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true }", |
| 110 | datetime(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true }", | 132 | datetime(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true }", |
| 111 | - color(label, column_name, help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", width: 60, editable:false, autoResizable: true, formatter:formatColor}", | ||
| 112 | - phone(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, edittype: 'custom', formatter:formatPhone, unformat:unformatPhone, "+custom_edit_phone+"}", | ||
| 113 | - 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+"}", | ||
| 114 | - | 133 | + color(label, column_name, help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", width: 40, editable:true, autoResizable: true, formatter:formatColor, unformat:unformatColor, "+custom_edit_color+" }", |
| 134 | + 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+"}", | ||
| 135 | + 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+"}", | ||
| 136 | + url(label, column_name, help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, "+search_options(column_name)+" }", | ||
| 115 | } | 137 | } |
| 116 | . | 138 | . |
| 117 | 139 |
view/types/hk_form_entry.anubis
| @@ -36,8 +36,9 @@ public type HK_Form_Entry: //legacy VT_Edit | @@ -36,8 +36,9 @@ public type HK_Form_Entry: //legacy VT_Edit | ||
| 36 | time (String s_name, String c_name, String value, HK_Help_Text help), | 36 | time (String s_name, String c_name, String value, HK_Help_Text help), |
| 37 | datetime (String s_name, String c_name, String value, HK_Help_Text help), | 37 | datetime (String s_name, String c_name, String value, HK_Help_Text help), |
| 38 | color (String s_name, String c_name, String value, HK_Help_Text help), | 38 | color (String s_name, String c_name, String value, HK_Help_Text help), |
| 39 | - phone (String s_name, String c_name, String value, HK_Help_Text help), | ||
| 40 | - email (String s_name, String c_name, String value, HK_Help_Text help) | 39 | + phone (String s_name, String c_name, String value, HK_Phone_Field_Attr ph_attr, HK_Help_Text help), |
| 40 | + email (String s_name, String c_name, String value, HK_Help_Text help), | ||
| 41 | + url (String s_name, String c_name, String value, HK_Help_Text help) | ||
| 41 | . | 42 | . |
| 42 | 43 | ||
| 43 | public define HK_Form_Entry text (String s_name, String c_name, String value) = text (s_name, c_name, value, no_help_text). | 44 | public define HK_Form_Entry text (String s_name, String c_name, String value) = text (s_name, c_name, value, no_help_text). |
view/types/hk_view.anubis
| @@ -71,7 +71,7 @@ public type VT_view_model_entry: | @@ -71,7 +71,7 @@ public type VT_view_model_entry: | ||
| 71 | time (String label, String column_name, HK_Help_Text help), | 71 | time (String label, String column_name, HK_Help_Text help), |
| 72 | datetime (String label, String column_name, HK_Help_Text help), | 72 | datetime (String label, String column_name, HK_Help_Text help), |
| 73 | color (String label, String column_name, HK_Help_Text help), | 73 | color (String label, String column_name, HK_Help_Text help), |
| 74 | - phone (String label, String column_name, HK_Help_Text help), | 74 | + phone (String label, String column_name, HK_Phone_Field_Attr phone_attr, HK_Help_Text help), |
| 75 | email (String label, String column_name, HK_Help_Text help), | 75 | email (String label, String column_name, HK_Help_Text help), |
| 76 | url (String label, String column_name, HK_Help_Text help) | 76 | url (String label, String column_name, HK_Help_Text help) |
| 77 | . | 77 | . |
view/view_table_renderer.anubis
| @@ -40,8 +40,23 @@ read calexium_lib/web/jQuery/jqgrid.anubis | @@ -40,8 +40,23 @@ read calexium_lib/web/jQuery/jqgrid.anubis | ||
| 40 | read calexium_lib/web/CXM_form.anubis | 40 | read calexium_lib/web/CXM_form.anubis |
| 41 | read calexium_lib/web/widgets/css_helper.anubis | 41 | read calexium_lib/web/widgets/css_helper.anubis |
| 42 | read calexium_lib/web/widgets/button.anubis | 42 | read calexium_lib/web/widgets/button.anubis |
| 43 | +read calexium_lib/web/widgets/specialized_elements.anubis | ||
| 43 | read calexium_lib/web/CXM_urllib.anubis | 44 | read calexium_lib/web/CXM_urllib.anubis |
| 44 | 45 | ||
| 46 | +public define Phone_Type | ||
| 47 | + convert | ||
| 48 | + ( | ||
| 49 | + HK_Phone_Field_Attr phone_attr | ||
| 50 | + )= | ||
| 51 | + if phone_attr is | ||
| 52 | + { | ||
| 53 | + generic then generic, | ||
| 54 | + landline then landline, | ||
| 55 | + cellphone then cellphone, | ||
| 56 | + fax then fax | ||
| 57 | + } | ||
| 58 | +. | ||
| 59 | + | ||
| 45 | public define List(HK_Filter) | 60 | public define List(HK_Filter) |
| 46 | get_view_filters | 61 | get_view_filters |
| 47 | ( | 62 | ( |
| @@ -728,11 +743,17 @@ public define List(CXM_Form_Field) | @@ -728,11 +743,17 @@ public define List(CXM_Form_Field) | ||
| 728 | datetime(s_name, c_name, value, help) then | 743 | datetime(s_name, c_name, value, help) then |
| 729 | [input([class("datetimepicker")], label(_T(s_name), no_help), html_Id(c_name), wan(c_name), init(not_null_String(value)), custom(18), mandatory), help_line(help, _T)], | 744 | [input([class("datetimepicker")], label(_T(s_name), no_help), html_Id(c_name), wan(c_name), init(not_null_String(value)), custom(18), mandatory), help_line(help, _T)], |
| 730 | color( s_name, c_name, value, help) then | 745 | color( s_name, c_name, value, help) then |
| 731 | - [input([class("jscolor")], label(_T(s_name), no_help), wan(c_name), init(not_null_String(value)), narrow, mandatory), help_line(help, _T)], | ||
| 732 | - phone( s_name, c_name, value, help) then | ||
| 733 | - [phone_input([event(onclick, "hk_phone_call(this)")], [class("hk_input_phone")], label(_T(s_name), no_help), html_Id(c_name), wan(c_name), init(not_null_String(value)), narrow, mandatory), help_line(help, _T)], | 746 | + [input([class("jscolor"), style("background-color: #"+value+";")], label(_T(s_name), no_help), wan(c_name), init(not_null_String(value)), narrow, mandatory), help_line(help, _T)], |
| 747 | + phone( s_name, c_name, value, phone_type, help) then | ||
| 748 | + with event = (List(CoreAttrs))if phone_type = fax then [] else [event(onclick, "hk_phone_call(this)"), class("clickable")], | ||
| 749 | + //with class = (List(CoreAttrs))if phone_type = fax then [] else [class("clickable")], | ||
| 750 | + [phone_input(event, [], label(_T(s_name), no_help), html_Id(c_name), wan(c_name), init(not_null_String(value)), convert(phone_type), narrow, mandatory), help_line(help, _T)], | ||
| 751 | + | ||
| 734 | email( s_name, c_name, value, help) then | 752 | email( s_name, c_name, value, help) then |
| 735 | - [email_input([event(onclick, "hk_send_email(this)")], [class("hk_input_email")], label(_T(s_name), no_help), html_Id(c_name), wan(c_name), init(not_null_String(value)), narrow, mandatory), help_line(help, _T)], | 753 | + [email_input([event(onclick, "hk_send_email(this)")], [class("clickable")], label(_T(s_name), no_help), html_Id(c_name), wan(c_name), init(not_null_String(value)), narrow, mandatory), help_line(help, _T)], |
| 754 | + | ||
| 755 | + url( s_name, c_name, value, help) then | ||
| 756 | + [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)], | ||
| 736 | }, | 757 | }, |
| 737 | edit_form_lines(db, fk_clause, table_referer, lwa, _T, t, new_entry, reverse(line)+so_far) | 758 | edit_form_lines(db, fk_clause, table_referer, lwa, _T, t, new_entry, reverse(line)+so_far) |
| 738 | }. | 759 | }. |
| @@ -768,7 +789,7 @@ public define HTML_Partial_Content | @@ -768,7 +789,7 @@ public define HTML_Partial_Content | ||
| 768 | with button_name = if create then "create" else "update", | 789 | with button_name = if create then "create" else "update", |
| 769 | with button_name_and_new = if create then _T("CREATE_AND_EDIT_NEW") else _T("UPDATE_AND_EDIT_NEW"), | 790 | with button_name_and_new = if create then _T("CREATE_AND_EDIT_NEW") else _T("UPDATE_AND_EDIT_NEW"), |
| 770 | with form_id = dialog_id+"_form", | 791 | with form_id = dialog_id+"_form", |
| 771 | - println("renderer_edit_list_form dialog_id ["+dialog_id+"]"); | 792 | + //println("renderer_edit_list_form dialog_id ["+dialog_id+"]"); |
| 772 | partial_content( | 793 | partial_content( |
| 773 | [ js(js_file("js/jscolor.min.js")), | 794 | [ js(js_file("js/jscolor.min.js")), |
| 774 | js(js_file("js/dropzone.js")), | 795 | js(js_file("js/dropzone.js")), |
| @@ -777,7 +798,9 @@ public define HTML_Partial_Content | @@ -777,7 +798,9 @@ public define HTML_Partial_Content | ||
| 777 | dictDefaultMessage : \""+_T("DROP_FILE_HERE")+"\", | 798 | dictDefaultMessage : \""+_T("DROP_FILE_HERE")+"\", |
| 778 | dictFileTooBig : \""+_T("FILE_TOO_BIG")+"\", | 799 | dictFileTooBig : \""+_T("FILE_TOO_BIG")+"\", |
| 779 | }; | 800 | }; |
| 780 | - $('#my-awesome-dropzone').dropzone(); ")), | 801 | + $('#my-awesome-dropzone').dropzone(); |
| 802 | + console.log('renderer_edit_list_form: jscolor.installByClassName();');jscolor.installByClassName('jscolor'); | ||
| 803 | +")), | ||
| 781 | ]+ | 804 | ]+ |
| 782 | jq_datetimepicker_init(lang), | 805 | jq_datetimepicker_init(lang), |
| 783 | //get_editor_header(list_entries)+ //add editor header if need. Like init ck_editor | 806 | //get_editor_header(list_entries)+ //add editor header if need. Like init ck_editor |
| @@ -936,12 +959,15 @@ public define List(CXM_Form_Field) | @@ -936,12 +959,15 @@ public define List(CXM_Form_Field) | ||
| 936 | datetime(s_name, c_name, value, help) then | 959 | datetime(s_name, c_name, value, help) then |
| 937 | [input([class("datetimepicker")], no_label, html_Id(c_name), wan(c_name), init(not_null_String(value)), custom(18), mandatory), help_line(help, _T)], | 960 | [input([class("datetimepicker")], no_label, html_Id(c_name), wan(c_name), init(not_null_String(value)), custom(18), mandatory), help_line(help, _T)], |
| 938 | color( s_name, c_name, value, help) then | 961 | color( s_name, c_name, value, help) then |
| 939 | - [input([class("jscolor")], no_label, wan(c_name), init(not_null_String(value)), narrow, mandatory), help_line(help, _T)], | ||
| 940 | - phone( s_name, c_name, value, help) then | ||
| 941 | - [phone_input([event(onclick, "hk_phone_call(this)"), class("phone_click")], [class("hk_input_phone")], label(_T(s_name), no_help), html_Id(c_name), wan(c_name), init(not_null_String(value)), narrow, mandatory), help_line(help, _T)], | 962 | + [input([class("jscolor"), style("background-color: #"+value+";")], no_label, wan(c_name), init(not_null_String(value)), narrow, mandatory), help_line(help, _T)], |
| 963 | + phone( s_name, c_name, value, phone_type, help) then | ||
| 964 | + with event = (List(CoreAttrs))if phone_type = fax then [] else [event(onclick, "hk_phone_call(this)")], | ||
| 965 | + with class = (List(CoreAttrs))if phone_type = fax then [] else [class("clickable")], | ||
| 966 | + [phone_input(event, class, label(_T(s_name), no_help), html_Id(c_name), wan(c_name), init(not_null_String(value)), convert(phone_type), narrow, mandatory), help_line(help, _T)], | ||
| 942 | email( s_name, c_name, value, help) then | 967 | email( s_name, c_name, value, help) then |
| 943 | - [email_input([event(onclick, "hk_send_email(this)"), class("email_click")], [class("hk_input_email")], label(_T(s_name), no_help), html_Id(c_name), wan(c_name), init(not_null_String(value)), narrow, mandatory), help_line(help, _T)], | ||
| 944 | - | 968 | + [email_input([event(onclick, "hk_send_email(this)"), class("clickable")], [class("hk_input_email")], label(_T(s_name), no_help), html_Id(c_name), wan(c_name), init(not_null_String(value)), narrow, mandatory), help_line(help, _T)], |
| 969 | + url( s_name, c_name, value, help) then | ||
| 970 | + [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)], | ||
| 945 | }. | 971 | }. |
| 946 | 972 | ||
| 947 | define List(Cell_Option) | 973 | define List(Cell_Option) |
| @@ -1030,7 +1056,10 @@ public define HTML_Partial_Content | @@ -1030,7 +1056,10 @@ public define HTML_Partial_Content | ||
| 1030 | with button_name_and_new = if create then _T("CREATE_AND_EDIT_NEW") else _T("UPDATE_AND_EDIT_NEW"), | 1056 | with button_name_and_new = if create then _T("CREATE_AND_EDIT_NEW") else _T("UPDATE_AND_EDIT_NEW"), |
| 1031 | with form_id = dialog_id+"_form", | 1057 | with form_id = dialog_id+"_form", |
| 1032 | partial_content( | 1058 | partial_content( |
| 1033 | - [ js(js_file("js/jscolor.min.js")) | 1059 | + [ js(js_file("js/jscolor.min.js")), |
| 1060 | + js_script("console.log(renderer_edit_table_form: jscolor.installByClassName();');jscolor.installByClassName('jscolor');") | ||
| 1061 | + //js_script("jscolor.init;") | ||
| 1062 | + | ||
| 1034 | ]+ | 1063 | ]+ |
| 1035 | jq_datetimepicker_init(lang), | 1064 | jq_datetimepicker_init(lang), |
| 1036 | //get_editor_header(table_form.form_lines)+ //add editor header if need. Like init ck_editor | 1065 | //get_editor_header(table_form.form_lines)+ //add editor header if need. Like init ck_editor |