CXM_dojo.anubis
17.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
/*
* Created by PyramIDE.
* User: Steve Marechal
* Date: 11/06/2008
* Time: 09:54
*
*/
read tools/basis.anubis
read tools/base64.anubis
read locale/L3LanguageInfo.anubis
read system/string.anubis
read calexium_lib/web/CXM_common.anubis
read calexium_lib/web/CXM_making_a_web_site.anubis
read calexium_lib/web/CXM_multihost_http_server.anubis
read calexium_lib/net_services_protocols/logger_service.anubis
read mailfountain_constants.anubis
read mailfountain_types.anubis
read common/language_management.anubis
read tools/mf_loggers.anubis
read system/logger.anubis
public type Dojo_Grid_Data :
grid_data(String).
public type Position_Direction:
brup,
brleft,
blup,
blright,
trdown,
trleft,
tldown,
tlright.
define String
pos_dir_to_str
(
Position_Direction pos
)=
if pos is
{
brup then "br-up",
brleft then "br-left",
blup then "bl-up",
blright then "bl-right",
trdown then "tr-down",
trleft then "tr-left",
tldown then "tl-down",
tlright then "tl-right"
}.
public define HTML_Off_Form
dojo_button
(
String name,
String execute,
String id,
)
=
literal("
<button dojoType=\"dijit.form.Button\" id=\""+id+"\" onclick=\""+execute+"\">"+name+"</button>")
.
public type InputDial:
input_dial(String id, Bool file, String label).
define HTML_Row(HTML_Off_Form)
input_in_dialog
(
InputDial input_data
)=
if input_data is input_dial(id, file, label) then
row([], [cell([], sequence([
literal("<label for=\"" + id + "\"> " + label + "</label>"),
literal("<input dojoType=dijit.form.TextBox " +
(if file then
"type=\"file\""
else
"type=\"text\"")
+ " name=\""+id+"\" id=\""+id+"\" />")
]))]).
define List(HTML_Row(HTML_Off_Form))
inputs_in_dialog
(
List(InputDial) inputs_data
)=
if inputs_data is
{
[] then [],
[h . t] then [input_in_dialog(h) . inputs_in_dialog(t)]
}.
public define HTML_Off_Form
dijit_dialog
(
String name,
String dialog_id,
String execute,
String ok_label,
Maybe(String) cancel,
List(InputDial) inputs_data
)
=
sequence[
div([attr("dojoType", "dijit.Dialog"), id(dialog_id), title(name), attr("execute", execute)],
table([],
empty,
append(
inputs_in_dialog(inputs_data),
[
row([], [cell([columns(2), h_center],
literal("<button dojoType=dijit.form.Button type=\"submit\" class=\"dialog_ok\">" + ok_label + "</button>" +
if cancel is
{
failure then "",
success(cancel_label) then "<button dojoType=dijit.form.Button type=\"cancel\" class=\"dialog_cancel\" onclick=\"dijit.byId('"+ dialog_id +"').hide()\">" + cancel_label + "</button>"
}
))]),
]),
empty)),
literal("<br/>"),
]
.
public define HTML_Off_Form
dojo_dialog
(
String name,
String dialog_id,
String execute,
String ok_label,
Maybe(String) cancel,
List(InputDial) inputs_data
)
=
sequence[
dojo_button(name,"dijit.byId('"+dialog_id+"').show()", dialog_id + "_button"),
dijit_dialog(name, dialog_id, execute, ok_label, cancel, inputs_data)
]
.
public type DojoGridEditor:
inputEditor,
boolEditor,
selectEditor(List(String) options),
alwaysOnEditor.
public type DojoGridDefaultColumn:
dojo_grid_default_column(
String styles,
Maybe(String) width,
Maybe(DojoGridEditor) editor).
public type DojoGridColumn:
dojo_grid_column( String label,
String field_name,
Maybe(String) width,
Maybe(DojoGridEditor) editor).
public type DojoGridView:
dojo_grid_view(
Maybe(DojoGridDefaultColumn) default_column,
List(DojoGridColumn) columns).
public type DojoGridLayout:
dojo_grid_layout(
Maybe(String) selectable_row_header_width,
List(DojoGridView) views).
define String to_String(DojoGridEditor editor) =
"editor: " +
if editor is
{
inputEditor then "dojox.grid.editors.Input",
boolEditor then "dojox.grid.editors.Bool",
selectEditor(options) then "dojox.grid.editors.Select, options: [" + join(",", map((String o) |-> "\"" + o + "\"", options)) + "]",
alwaysOnEditor then "dojox.grid.editors.AlwaysOn"
}.
define String to_String(DojoGridView view) =
"{ " + (if view.default_column is success(col) then
(if col is dojo_grid_default_column(styles, mb_width, mb_editor) then
"defaultCell: {"
+ "styles: \"" + styles + "\""
+ (if mb_width is success(w) then ", width=\"" + w + "\"" else "")
+ (if mb_editor is success(e) then ", " + to_String(e) else "")
+ "}, ")
else "")
+ "cells: [[" + join(",", map((DojoGridColumn col) |->
if col is dojo_grid_column(label, field, mb_width, mb_editor) then
"{"
+ "name: \"" + label + "\""
+ "field: \"" + field + "\""
+ (if mb_width is success(w) then ", width=\"" + w + "\"" else "")
+ (if mb_editor is success(e) then ", " + to_String(e) else "")
+ "}",
view.columns)) + "]]"
+"}".
public define String
dojo_make_grid_script
(
HtmlId html_id,
DojoGridLayout layout,
String layout_name,
String store_name,
Bool can_edit
)
=
"<script type=\"text/javascript\">
" + layout_name + " = ["
+ (if layout.selectable_row_header_width is success(w) then "{ type: 'dojox.GridRowView', width: '" + w + "'}, " else "")
+ join(", ", map(to_String, layout.views))
+ "];
</script>".
public define HTML_Off_Form
dojo_make_grid_script
(
HtmlId html_id,
List(String) columns,
Bool can_edit
)
=
literal(
"<script type=\"text/javascript\">
var cols = ["+join(",", map((String col) |-> "\"" + col + "\"", columns)) + "];
dojo.addOnLoad(function(){
init_dojo_grid(\""+html_id.id+"\", cols, "+ (if can_edit then "1" else "0")+");
});
</script>").
public define HTML_Off_Form
dojo_grid
(
HtmlId html_id,
Int rowsPerPage,
List(Table_Option) attributes,
)=
table([attr("dojoType", "dojox.grid.DataGrid"), attr("id", html_id.id), attr("jsId", html_id.id),
attr("class", "soria"), attr("singleClickEdit", "true"), attr("rowsPerPage", to_decimal(rowsPerPage)) . attributes],
empty, [], empty).
public define HTML_Off_Form
dojo_grid
(
HtmlId html_id,
List(CoreAttrs) attributes,
// List(GridColumn) columns,
String colum1,
String colum2,
String colum3,
String colum4,
Bool can_edit
)
=
sequence([
literal(
"<script type=\"text/javascript\">
dojo.addOnLoad(function(){
init_dojo_grid(\""+html_id.id+"\", \""+colum1+"\",\""+colum2+"\", \""+colum3+"\", \""+colum4+"\", "+ (if can_edit then "1" else "0")+");
});
</script>"),
div_empty([id(html_id.id) . attributes /*attr("dojoType", "dojox.Grid"), */]),
]).
//<div id=\"gridContainer\"></div>").
public define HTML_Off_Form
dojo_message_box
(
HTML_Off_Form name1,
HTML_Off_Form name2,
)
=
sequence([
literal("<br/>"),
div([class("message_box")],
sequence([
div([id("node3"), class("box nopad hidden")], name1),
div([id("node4"), class("box two nopad")], name2),
])),
literal("<br/>"),
]).
public define HTML_Off_Form
dojo_tooltip
(
String title,
String keyword,
) =
actioner(same,same, link([id("dojo_tip_" + keyword),class("dojoToolTip")],title, success(title)), "show_address_mailing", [("address_mailing", keyword)], []).
//actioner(same, same, push_button([id("dojo_tip_" + keyword), class("in"), event(onclick,"new_search(this)")], keyword), "", [], []).
public type BorderContainerRegion:
center,
top,
bottom,
leading,
trailing,
left,
right.
define String
to_String
(
BorderContainerRegion region
)=
if region is
{
center then "center",
top then "top",
bottom then "bottom",
leading then "leading",
trailing then "trailing",
left then "left",
right then "right"
}.
public type BorderContainerDesign:
headline,
sidebar.
define String
to_String
(
BorderContainerDesign design
)=
if design is
{
headline then "headline",
sidebar then "sidebar"
}.
public define HTML_Off_Form
dojo_ContentPane
(
List(CoreAttrs) attributes,
BorderContainerRegion region,
Bool splitter,
HTML_Off_Form content
) =
div([ attr("dojoType", "dijit.layout.ContentPane"),
attr("region", to_String(region)),
attr("splitter", if splitter then "true" else "false") . attributes ],
content).
public define HTML_In_Form
dojo_ContentPane
(
List(CoreAttrs) attributes,
BorderContainerRegion region,
Bool splitter,
HTML_In_Form content
) =
div([ attr("dojoType", "dijit.layout.ContentPane"),
attr("region", to_String(region)),
attr("splitter", if splitter then "true" else "false") . attributes ],
content).
public define HTML_Off_Form
dojo_TabContainer
(
List(CoreAttrs) attributes,
HTML_Off_Form content
) =
div([attr("dojoType", "dijit.layout.TabContainer") . attributes ],
content).
public define HTML_Off_Form
dojo_BorderContainer
(
List(CoreAttrs) attributes,
Maybe(String) the_title,
BorderContainerDesign design,
Bool live_splitter,
Bool persist,
Bool closable,
String container,
HTML_Off_Form content
) =
with the_attributes = (List(CoreAttrs)) [attr("dojoType", "dijit.layout.BorderContainer"), attr("dojoAttachPoint", container),
attr("design", to_String(design)), attr("liveSplitters", live_splitter), attr("persist", persist),
attr("closable",closable) . attributes ],
total_attributes = if the_title is
{
failure then the_attributes,
success(t) then [title(t) . the_attributes]
},
div(total_attributes, content).
public define HTML_In_Form
dojo_BorderContainer
(
List(CoreAttrs) attributes,
Maybe(String) the_title,
BorderContainerDesign design,
Bool live_splitter,
Bool persist,
Bool closable,
String container,
HTML_In_Form content
) =
with the_attributes = (List(CoreAttrs)) [attr("dojoType", "dijit.layout.BorderContainer"), attr("dojoAttachPoint", container),
attr("design", to_String(design)), attr("liveSplitters", live_splitter), attr("persist", persist),
attr("closable",closable) . attributes ],
total_attributes = if the_title is
{
failure then the_attributes,
success(t) then [title(t) . the_attributes]
},
div(total_attributes, content).
public define HTML_Off_Form
dojo_tree
(
List(CoreAttrs) attributes,
)=
div_empty(attributes).
public define HTML_Off_Form
dojo_Toolbar
(
List(CoreAttrs) attributes,
HTML_Off_Form content
)=
div([attr("dojoType", "dijit.Toolbar") . attributes ],
content).
public define HTML_Off_Form
dojo_button
(
HtmlId html_id,
// Maybe(String) class,
String name,
String iconclass,
Maybe(String) tip_msg,
String execute,
)=
literal("
<button dojoType=\"dijit.form.Button\" id=\"" + html_id.id + "\" iconClass=\"" + iconclass + "\" >"
+ name
+ "<script type=\"dojo/method\" event=\"onClick\">"
+ execute
+ "</script>"
+ "</button>" +
if tip_msg is
{
failure then "",
success(tip) then
"<span dojoType=\"dijit.Tooltip\" connectId=\"" + html_id.id + "\">" + tip + "</span>"
}).
public define HTML_In_Form
dojo_button
(
HtmlId html_id,
// Maybe(String) class,
String name,
String iconclass,
Maybe(String) tip_msg,
String execute,
)=
literal("
<button dojoType=\"dijit.form.Button\" id=\"" + html_id.id + "\" iconClass=\"" + iconclass + "\" >"
+ name
+ "<script type=\"dojo/method\" event=\"onClick\">"
+ execute
+ "</script>"
+ "</button>" +
if tip_msg is
{
failure then "",
success(tip) then
"<span dojoType=\"dijit.Tooltip\" connectId=\"" + html_id.id + "\">" + tip + "</span>"
}).
public define HTML_Off_Form
dojo_declaration
(
String name,
List(CoreAttrs) attributes,
HTML_Off_Form content
)=
div([attr("dojoType", "dijit.Declaration"), attr("widgetClass", name) . attributes ],
content).
public define HTML_In_Form
dojo_declaration
(
String name,
List(CoreAttrs) attributes,
HTML_In_Form content
)=
div([attr("dojoType", "dijit.Declaration"), attr("widgetClass", name) . attributes ],
content).
public define HTML_Off_Form
dojo_editor
(
List(CoreAttrs) attributes,
HtmlId html_id,
WebArgName input_name,
HTML_Off_Form text,
)=
div([id(html_id.id), attr("name", input_name.name), attr("dojoType", "dijit.Editor")
,attr("extraPlugins", "['|', 'foreColor','hiliteColor',{name:'dojox.editor.plugins.FontChoice', command:'fontName', generic:true},'fontSize','formatBlock','|','createLink','insertImage']")
. attributes], text).
public define HTML_In_Form
dojo_button
(
HtmlId html_id,
String name,
String iconclass,
Maybe(String) tip_msg,
String execute,
)=
literal("<input id=\"realSubmitButton"+ html_id.id + "\" type=\"submit\" style=\"display:none\">
<button dojoType=\"dijit.form.Button\" id=\"" + html_id.id + "\" iconClass=\"" + iconclass + "\" onclick=\"dojo.byId('realSubmitButton" + html_id.id + "').click();" + execute + "\">" + name + "</button>" +
if tip_msg is
{
failure then "",
success(tip) then
"<span dojoType=\"dijit.Tooltip\" connectId=\"" + html_id.id + "\">" + tip + "</span>"
}).
public define HTML_In_Form
dojo_checkbox
(
List(InputAttrs) attributes,
WebArgName name,
HtmlId id,
String label,
WebArgValue val,
Bool checked,
)=
check_box_r([attr("dojoType", "dijit.form.CheckBox") . attributes] , label, id, name, val, checked).
public define HTML_In_Form
dojo_combobox
(
List(InputAttrs) attributes,
WebArgName name,
HtmlId id,
String label,
List((WebArgValue,String)) list_data,
InitialValue selected,
)=
// selector_c([attr("dojoType", "dijit.form.ComboBox") . attributes], label, id, name, 1, list_data, selected, non_mandatory).
selector_c(attributes, label, id, name, 1, list_data, selected).
public define HTML_Off_Form
dojo_toaster
(
List(CoreAttrs) attributes,
HtmlId html_id,
String message_topic,
Position_Direction position_direction,
Bool separator,
Maybe(Int) duration
)=
div(append(append(if separator then [attr("separator","<hr>")]
else [],
if duration is
{
failure then [],
success(dur) then [attr("duration", abs_to_decimal(dur))]
}),
[attr("dojoType", "dojox.widget.Toaster"), attr("messageTopic", message_topic),
attr("positionDirection", pos_dir_to_str(position_direction)), id(html_id.id)
. attributes ]),
literal("")).
public define HTML_Off_Form
dojo_progressBar
(
List(CoreAttrs) attributes,
List(Text_Option) attributes_text,
HtmlId html_id,
String label
)=
sequence([
text([id("text_" + html_id.id), class("progress_bar") . attributes_text], label),
div([id(html_id.id), class("progress_bar"), attr("indeterminate", "true"), attr("dojoType", "dijit.ProgressBar") . attributes], literal(""))
]).