Commit 3948b4f1e5b93c8b6ed2599174eec0cf3ec358c2
1 parent
788cff0c
add phone and email fields in entry
Showing
3 changed files
with
47 additions
and
3 deletions
Show diff stats
view/jqgrid.anubis
| ... | ... | @@ -20,7 +20,43 @@ define String |
| 20 | 20 | join(";",map(((List(CoreAttrs), WebArgValue, String) select) |-> since select is (_, wav, show), wav.value+":"+show, from_hk_selector))+ |
| 21 | 21 | "\"" |
| 22 | 22 | . |
| 23 | - | |
| 23 | + | |
| 24 | +define String | |
| 25 | + custom_edit_phone = | |
| 26 | +" editoptions: { | |
| 27 | + custom_element: function(value, options) { | |
| 28 | + var elemStr = '<span class=\"hk_phone_call\"><img src=\"/icons/16x16/phone.png\" onclick=\"hk_phone_call(this);\"></img><input value=\"' + value + '\"></span>'; | |
| 29 | + var elem = $(elemStr)[0]; | |
| 30 | + // return DOM element from jQuery object | |
| 31 | + return elem; | |
| 32 | + }, | |
| 33 | + custom_value: function(elem) { | |
| 34 | + //var inputs = $(\"input\", $(elem)[0]); | |
| 35 | + //var first = inputs[0].value; | |
| 36 | + return $(elem).find('input')[0].value; | |
| 37 | + } | |
| 38 | + } | |
| 39 | +" | |
| 40 | +. | |
| 41 | + | |
| 42 | +define String | |
| 43 | + custom_edit_email = | |
| 44 | +" editoptions: { | |
| 45 | + custom_element: function(value, options) { | |
| 46 | + var elemStr = '<span class=\"hk_send_email\"><img src=\"/icons/16x16/email_edit.png\" onclick=\"hk_send_email(this);\"></img><input value=\"' + value + '\"></span>'; | |
| 47 | + var elem = $(elemStr)[0]; | |
| 48 | + // return DOM element from jQuery object | |
| 49 | + return elem; | |
| 50 | + }, | |
| 51 | + custom_value: function(elem) { | |
| 52 | + //var inputs = $(\"input\", $(elem)[0]); | |
| 53 | + //var first = inputs[0].value; | |
| 54 | + return $(elem).find('input')[0].value; | |
| 55 | + } | |
| 56 | + } | |
| 57 | +" | |
| 58 | +. | |
| 59 | + | |
| 24 | 60 | define String |
| 25 | 61 | to_jqGrid_ColModel |
| 26 | 62 | ( |
| ... | ... | @@ -58,6 +94,9 @@ define String |
| 58 | 94 | time(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true }", |
| 59 | 95 | datetime(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true }", |
| 60 | 96 | color(label, column_name, help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", width: 60, editable:false, formatter:formatColor}", |
| 97 | + phone(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, edittype: 'custom', formatter:formatPhone, unformat:unformatPhone, "+custom_edit_phone+"}", | |
| 98 | + email(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, edittype: 'custom', formatter:formatEmail, unformat:unformatEmail, "+custom_edit_email+"}", | |
| 99 | + | |
| 61 | 100 | } |
| 62 | 101 | . |
| 63 | 102 | ... | ... |
view/types/hk_form_entry.anubis
| ... | ... | @@ -34,7 +34,9 @@ public type HK_Form_Entry: //legacy VT_Edit |
| 34 | 34 | date (String s_name, String c_name, String value, HK_Help_Text help), |
| 35 | 35 | time (String s_name, String c_name, String value, HK_Help_Text help), |
| 36 | 36 | datetime (String s_name, String c_name, String value, HK_Help_Text help), |
| 37 | - color (String s_name, String c_name, String value, HK_Help_Text help) | |
| 37 | + color (String s_name, String c_name, String value, HK_Help_Text help), | |
| 38 | + phone (String s_name, String c_name, String value, HK_Help_Text help), | |
| 39 | + email (String s_name, String c_name, String value, HK_Help_Text help) | |
| 38 | 40 | . |
| 39 | 41 | |
| 40 | 42 | 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
| ... | ... | @@ -70,7 +70,10 @@ public type VT_view_model_entry: |
| 70 | 70 | date (String label, String column_name, HK_Help_Text help), |
| 71 | 71 | time (String label, String column_name, HK_Help_Text help), |
| 72 | 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), | |
| 75 | + email (String label, String column_name, HK_Help_Text help) | |
| 76 | +. | |
| 74 | 77 | |
| 75 | 78 | |
| 76 | 79 | public type VT_view_model: | ... | ... |