Commit b618d4b38f91a86a29aab72ef5ed11aee124742d
1 parent
56b2af63
datetime to dojo date
Showing
1 changed file
with
73 additions
and
3 deletions
Show diff stats
calexium_lib/web/CXM_dojo.anubis
| @@ -73,7 +73,7 @@ public type Input_Type: | @@ -73,7 +73,7 @@ public type Input_Type: | ||
| 73 | password. | 73 | password. |
| 74 | 74 | ||
| 75 | public type InputDial: | 75 | public type InputDial: |
| 76 | - input_dial(String id, Input_Type input_type, String label), | 76 | + input_dial(String id, Input_Type input_type, String label, Maybe(String) class), |
| 77 | input_date(String id, String label), | 77 | input_date(String id, String label), |
| 78 | input_combo(String label, HtmlId id, WebArgName name, List((WebArgValue,String)) list_data). | 78 | input_combo(String label, HtmlId id, WebArgName name, List((WebArgValue,String)) list_data). |
| 79 | 79 | ||
| @@ -118,9 +118,19 @@ define HTML_Off_Form | @@ -118,9 +118,19 @@ define HTML_Off_Form | ||
| 118 | )= | 118 | )= |
| 119 | if input_data is | 119 | if input_data is |
| 120 | { | 120 | { |
| 121 | - input_dial(id, input, label) then | 121 | + input_dial(id, input, label, class) then |
| 122 | sequence([ | 122 | sequence([ |
| 123 | - literal("<div id=\"" + id +"_block\"><label for=\"" + id + "\"> " + label + "</label>"), | 123 | + literal("<div id=\"" + id +"_block\"" + |
| 124 | + if class is | ||
| 125 | + { | ||
| 126 | + failure then "", | ||
| 127 | + success(class_name) then " class=\"block_"+ class_name +"\"" | ||
| 128 | + }+"><label for=\"" + id + "\" id=\"label_" + id + "\"" + | ||
| 129 | + if class is | ||
| 130 | + { | ||
| 131 | + failure then "", | ||
| 132 | + success(class_name) then " class=\"label_" + class_name + "\"" | ||
| 133 | + }+">" + label + "</label>"), | ||
| 124 | literal("<input dojoType=dijit.form.TextBox " + | 134 | literal("<input dojoType=dijit.form.TextBox " + |
| 125 | if input is | 135 | if input is |
| 126 | { | 136 | { |
| @@ -686,3 +696,63 @@ public define HTML_Off_Form | @@ -686,3 +696,63 @@ public define HTML_Off_Form | ||
| 686 | div([id(html_id.id), class("progress_bar"), attr("indeterminate", "true"), attr("dojoType", "dijit.ProgressBar") . attributes], literal("")) | 696 | div([id(html_id.id), class("progress_bar"), attr("indeterminate", "true"), attr("dojoType", "dijit.ProgressBar") . attributes], literal("")) |
| 687 | ]). | 697 | ]). |
| 688 | 698 | ||
| 699 | +define Maybe(Int) | ||
| 700 | + string_to_month | ||
| 701 | + ( | ||
| 702 | + String month_s | ||
| 703 | + )= | ||
| 704 | + with month = to_lower(month_s), | ||
| 705 | + if month = "jan" then success(1) | ||
| 706 | + else if month = "feb" then success(2) | ||
| 707 | + else if month = "mar" then success(3) | ||
| 708 | + else if month = "apr" then success(4) | ||
| 709 | + else if month = "may" then success(5) | ||
| 710 | + else if month = "jun" then success(6) | ||
| 711 | + else if month = "jul" then success(7) | ||
| 712 | + else if month = "aug" then success(8) | ||
| 713 | + else if month = "sep" then success(9) | ||
| 714 | + else if month = "oct" then success(10) | ||
| 715 | + else if month = "nov" then success(11) | ||
| 716 | + else if month = "dec" then success(12) | ||
| 717 | + else failure | ||
| 718 | + . | ||
| 719 | + | ||
| 720 | + | ||
| 721 | +// 'Thu Jan 14 2010 00:00:00 GMT+0100' must be replaced by '2010-01-14 00:00:00' | ||
| 722 | + | ||
| 723 | + | ||
| 724 | + | ||
| 725 | +public define Maybe(String) | ||
| 726 | + dojo_date_to_db_datetime | ||
| 727 | + ( | ||
| 728 | + String data | ||
| 729 | + )= | ||
| 730 | + with list_data = split_by_token(data, ' '), | ||
| 731 | + if nth(2, list_data) is | ||
| 732 | + { | ||
| 733 | + failure then failure, | ||
| 734 | + success(day) then | ||
| 735 | + if nth(1, list_data) is | ||
| 736 | + { | ||
| 737 | + failure then failure, | ||
| 738 | + success(month) then | ||
| 739 | + if nth(3, list_data) is | ||
| 740 | + { | ||
| 741 | + failure then failure, | ||
| 742 | + success(year) then | ||
| 743 | + if nth(4, list_data) is | ||
| 744 | + { | ||
| 745 | + failure then failure, | ||
| 746 | + success(hour) then | ||
| 747 | + if string_to_month(month) is | ||
| 748 | + { | ||
| 749 | + failure then failure, | ||
| 750 | + success(month_int) then | ||
| 751 | + success(year+"-"+month_int+"-"+day+" "+hour) | ||
| 752 | + } | ||
| 753 | + } | ||
| 754 | + } | ||
| 755 | + } | ||
| 756 | + }. | ||
| 757 | + | ||
| 758 | + |