Commit 3beac2a0731ec279280bd6a6e47b35fa4469694d

Authored by Steve MARECHAL
1 parent c75d15f9

input with a lot of rows

Showing 1 changed file with 51 additions and 27 deletions   Show diff stats
calexium_lib/web/CXM_dojo.anubis
@@ -67,39 +67,63 @@ public define HTML_Off_Form @@ -67,39 +67,63 @@ public define HTML_Off_Form
67 <button dojoType=\"dijit.form.Button\" id=\""+id+"\" onclick=\""+execute+"\">"+name+"</button>") 67 <button dojoType=\"dijit.form.Button\" id=\""+id+"\" onclick=\""+execute+"\">"+name+"</button>")
68 . 68 .
69 69
  70 +public type InputDial:
  71 + input_dial(String id, Bool file, String label).
  72 +
  73 +define HTML_Row(HTML_Off_Form)
  74 + input_in_dialog
  75 + (
  76 + InputDial input_data
  77 + )=
  78 + if input_data is input_dial(id, file, label) then
  79 + row([], [cell([], sequence([
  80 + literal("<label for=\"" + id + "\"> " + label + "</label>"),
  81 + literal("<input dojoType=dijit.form.TextBox " +
  82 + (if file then
  83 + "type=\"file\""
  84 + else
  85 + "type=\"text\"")
  86 + + " name=\""+id+"\" id=\""+id+"\" />")
  87 + ]))]).
  88 +
  89 +define List(HTML_Row(HTML_Off_Form))
  90 + inputs_in_dialog
  91 + (
  92 + List(InputDial) inputs_data
  93 + )=
  94 + if inputs_data is
  95 + {
  96 + [] then [],
  97 + [h . t] then [input_in_dialog(h) . inputs_in_dialog(t)]
  98 + }.
  99 +
70 public define HTML_Off_Form 100 public define HTML_Off_Form
71 dijit_dialog 101 dijit_dialog
72 ( 102 (
73 - String name,  
74 - String dialog_id,  
75 - String execute,  
76 - Bool file,  
77 - String ok_label,  
78 - Maybe(String) cancel, 103 + String name,
  104 + String dialog_id,
  105 + String execute,
  106 + String ok_label,
  107 + Maybe(String) cancel,
  108 + List(InputDial) inputs_data
79 ) 109 )
80 = 110 =
81 sequence[ 111 sequence[
82 div([attr("dojoType", "dijit.Dialog"), id(dialog_id), title(name), attr("execute", execute)], 112 div([attr("dojoType", "dijit.Dialog"), id(dialog_id), title(name), attr("execute", execute)],
83 table([], 113 table([],
84 empty, 114 empty,
85 - [  
86 - row([], [cell([], literal("<input dojoType=dijit.form.TextBox " +  
87 - (if file then  
88 - "type=\"file\""  
89 - else  
90 - "type=\"text\"")  
91 - + " name=\"name\" id=\"name_"+dialog_id+"\" />")  
92 -  
93 - )]),  
94 - row([], [cell([columns(2), h_center],  
95 - literal("<button dojoType=dijit.form.Button type=\"submit\" class=\"dialog_ok\">" + ok_label + "</button>" +  
96 - if cancel is  
97 - {  
98 - failure then "",  
99 - success(cancel_label) then "<button dojoType=dijit.form.Button type=\"cancel\" class=\"dialog_cancel\" onclick=\"dijit.byId('"+ dialog_id +"').hide()\">" + cancel_label + "</button>"  
100 - }  
101 - ))]),  
102 - ], 115 + append(
  116 + inputs_in_dialog(inputs_data),
  117 + [
  118 + row([], [cell([columns(2), h_center],
  119 + literal("<button dojoType=dijit.form.Button type=\"submit\" class=\"dialog_ok\">" + ok_label + "</button>" +
  120 + if cancel is
  121 + {
  122 + failure then "",
  123 + success(cancel_label) then "<button dojoType=dijit.form.Button type=\"cancel\" class=\"dialog_cancel\" onclick=\"dijit.byId('"+ dialog_id +"').hide()\">" + cancel_label + "</button>"
  124 + }
  125 + ))]),
  126 + ]),
103 empty)), 127 empty)),
104 literal("<br/>"), 128 literal("<br/>"),
105 ] 129 ]
@@ -111,14 +135,14 @@ public define HTML_Off_Form @@ -111,14 +135,14 @@ public define HTML_Off_Form
111 String name, 135 String name,
112 String dialog_id, 136 String dialog_id,
113 String execute, 137 String execute,
114 - Bool file,  
115 String ok_label, 138 String ok_label,
116 - Maybe(String) cancel 139 + Maybe(String) cancel,
  140 + List(InputDial) inputs_data
117 ) 141 )
118 = 142 =
119 sequence[ 143 sequence[
120 dojo_button(name,"dijit.byId('"+dialog_id+"').show()", dialog_id + "_button"), 144 dojo_button(name,"dijit.byId('"+dialog_id+"').show()", dialog_id + "_button"),
121 - dijit_dialog(name, dialog_id, execute, file, ok_label, cancel) 145 + dijit_dialog(name, dialog_id, execute, ok_label, cancel, inputs_data)
122 ] 146 ]
123 . 147 .
124 148