Commit 0555931cf45f083fa29cd976aadf081a4f3c1d78

Authored by David RENÉ
1 parent 1167a13b

add the managment of the overlay in load_content and change the code accordingly.

in same time add a new alternative into left_menu type with "left_menu_entry_load_content". This is better to understand when constructing a menu
@@ -103,7 +103,7 @@ public define String @@ -103,7 +103,7 @@ public define String
103 } 103 }
104 jqflink(link) then "document.location='"+link+"';", 104 jqflink(link) then "document.location='"+link+"';",
105 jqscript(script) then script 105 jqscript(script) then script
106 - jqload(target_id, web_action, extra_args) then load_content(target_id, web_action, extra_args, false) 106 + jqload(target_id, web_action, extra_args) then load_content(target_id, web_action, extra_args, false, true)
107 }, 107 },
108 same(label) then 108 same(label) then
109 if act_type is 109 if act_type is
@@ -132,7 +132,7 @@ public define String @@ -132,7 +132,7 @@ public define String
132 } 132 }
133 jqflink(link) then "document.location='"+link+"';", 133 jqflink(link) then "document.location='"+link+"';",
134 jqscript(script) then script 134 jqscript(script) then script
135 - jqload(target_id, web_action, extra_args) then load_content(target_id, web_action, extra_args, false) 135 + jqload(target_id, web_action, extra_args) then load_content(target_id, web_action, extra_args, false, true)
136 }, 136 },
137 other(window_name, window_options) then 137 other(window_name, window_options) then
138 if act_type is 138 if act_type is
@@ -164,7 +164,7 @@ public define String @@ -164,7 +164,7 @@ public define String
164 } 164 }
165 jqflink(link) then "document.location='"+link+"';", 165 jqflink(link) then "document.location='"+link+"';",
166 jqscript(script) then script 166 jqscript(script) then script
167 - jqload(target_id, web_action, extra_args) then load_content(target_id, web_action, extra_args, false) 167 + jqload(target_id, web_action, extra_args) then load_content(target_id, web_action, extra_args, false, true)
168 } 168 }
169 }. 169 }.
170 170
web/load_content.anubis
@@ -45,10 +45,11 @@ public define String @@ -45,10 +45,11 @@ public define String
45 String target, 45 String target,
46 WEB_Action_Name web_action, 46 WEB_Action_Name web_action,
47 List((String,String)) extra_args, 47 List((String,String)) extra_args,
48 - Bool replace 48 + Bool replace,
  49 + Bool overlay
49 )= 50 )=
50 51
51 - "Xlib.load_content('"+target+"', '"+format_web_action_name(web_action, extra_args)+"', "+to_String(replace)+");" 52 + "Xlib.load_content('"+target+"', '"+format_web_action_name(web_action, extra_args)+"', "+to_String(replace)+", "+to_String(replace)+");"
52 . 53 .
53 54
54 public define String 55 public define String
@@ -57,9 +58,10 @@ public define String @@ -57,9 +58,10 @@ public define String
57 String target, 58 String target,
58 WEB_Action_Name web_action, 59 WEB_Action_Name web_action,
59 List((String,String)) extra_args, 60 List((String,String)) extra_args,
60 - Bool replace 61 + Bool replace,
  62 + Bool overlay
61 )= 63 )=
62 - to_JS_String("Xlib.load_content('"+target+"', "+format_web_action_name_to_js(web_action, extra_args)+", "+to_String(replace)+")") 64 + to_JS_String("Xlib.load_content('"+target+"', "+format_web_action_name_to_js(web_action, extra_args)+", "+to_String(replace)+", "+to_String(replace)+")")
63 . 65 .
64 66
65 public define String 67 public define String
@@ -69,7 +71,7 @@ public define String @@ -69,7 +71,7 @@ public define String
69 WEB_Action_Name web_action, 71 WEB_Action_Name web_action,
70 List((String,String)) extra_args 72 List((String,String)) extra_args
71 )= 73 )=
72 - load_content(target, web_action, extra_args, true) 74 + load_content(target, web_action, extra_args, true, true)
73 . 75 .
74 76
75 public define String 77 public define String
@@ -79,7 +81,7 @@ public define String @@ -79,7 +81,7 @@ public define String
79 WEB_Action_Name web_action, 81 WEB_Action_Name web_action,
80 (String, String) extra_arg 82 (String, String) extra_arg
81 )= 83 )=
82 - load_content(target, web_action, [extra_arg], true) 84 + load_content(target, web_action, [extra_arg], true, true)
83 . 85 .
84 86
85 public define String 87 public define String
@@ -88,7 +90,7 @@ public define String @@ -88,7 +90,7 @@ public define String
88 String target, 90 String target,
89 WEB_Action_Name web_action 91 WEB_Action_Name web_action
90 )= 92 )=
91 - load_content(target, web_action, [], true) 93 + load_content(target, web_action, [], true, true)
92 . 94 .
93 95
94 96
@@ -99,7 +101,7 @@ public define String @@ -99,7 +101,7 @@ public define String
99 WEB_Action_Name web_action, 101 WEB_Action_Name web_action,
100 Bool replace 102 Bool replace
101 )= 103 )=
102 - load_content(target, web_action, [], replace) 104 + load_content(target, web_action, [], replace, true)
103 . 105 .
104 106
105 public define HTML_Partial_Content 107 public define HTML_Partial_Content
@@ -108,11 +110,12 @@ public define HTML_Partial_Content @@ -108,11 +110,12 @@ public define HTML_Partial_Content
108 String target, 110 String target,
109 WEB_Action_Name web_action, 111 WEB_Action_Name web_action,
110 List((String,String)) extra_args, 112 List((String,String)) extra_args,
111 - Bool replace 113 + Bool replace,
  114 + Bool overlay
112 )= 115 )=
113 partial_content([ 116 partial_content([
114 js(js_file("xlib/js/xlib.js")), 117 js(js_file("xlib/js/xlib.js")),
115 - js_inline(script("text/javascript","$(document).ready(function(){"+load_content(target, web_action, extra_args, replace)+"});")) 118 + js_inline(script("text/javascript","$(document).ready(function(){"+load_content(target, web_action, extra_args, replace, overlay)+"});"))
116 ], 119 ],
117 empty) 120 empty)
118 . 121 .
@@ -122,9 +125,20 @@ public define HTML_Partial_Content @@ -122,9 +125,20 @@ public define HTML_Partial_Content
122 ( 125 (
123 String target, 126 String target,
124 WEB_Action_Name web_action, 127 WEB_Action_Name web_action,
  128 + List((String,String)) extra_args,
  129 + Bool replace
  130 + )=
  131 + load_content_init(target, web_action, extra_args, replace, true)
  132 +.
  133 +
  134 +public define HTML_Partial_Content
  135 + load_content_init
  136 + (
  137 + String target,
  138 + WEB_Action_Name web_action,
125 List((String,String)) extra_args 139 List((String,String)) extra_args
126 )= 140 )=
127 - load_content_init(target, web_action, extra_args, false) 141 + load_content_init(target, web_action, extra_args, false, true)
128 . 142 .
129 143
130 public define HTML_Partial_Content 144 public define HTML_Partial_Content
@@ -133,7 +147,7 @@ public define HTML_Partial_Content @@ -133,7 +147,7 @@ public define HTML_Partial_Content
133 String target, 147 String target,
134 WEB_Action_Name web_action 148 WEB_Action_Name web_action
135 )= 149 )=
136 - load_content_init(target, web_action, [], false) 150 + load_content_init(target, web_action, [], false, true)
137 . 151 .
138 152
139 public define HTML_Partial_Content 153 public define HTML_Partial_Content
@@ -143,5 +157,5 @@ public define HTML_Partial_Content @@ -143,5 +157,5 @@ public define HTML_Partial_Content
143 WEB_Action_Name web_action, 157 WEB_Action_Name web_action,
144 Bool replace 158 Bool replace
145 )= 159 )=
146 - load_content_init(target, web_action, [], replace) 160 + load_content_init(target, web_action, [], replace, true)
147 . 161 .
web/widgets/button.anubis
@@ -140,10 +140,11 @@ public define HTML_Partial_Content @@ -140,10 +140,11 @@ public define HTML_Partial_Content
140 WEB_Action_Name web_action, 140 WEB_Action_Name web_action,
141 List((String, String)) extra_args, 141 List((String, String)) extra_args,
142 String target, 142 String target,
143 - Bool replace 143 + Bool replace,
  144 + Bool overlay
144 )= 145 )=
145 partial_content( 146 partial_content(
146 - img([ event(onclick, load_content(target, web_action, extra_args, replace)), 147 + img([ event(onclick, load_content(target, web_action, extra_args, replace, overlay)),
147 style("cursor: pointer") . core_attrs 148 style("cursor: pointer") . core_attrs
148 ], img_path)) 149 ], img_path))
149 . 150 .
@@ -157,7 +158,7 @@ public define HTML_Partial_Content @@ -157,7 +158,7 @@ public define HTML_Partial_Content
157 String target, 158 String target,
158 Bool replace 159 Bool replace
159 )= 160 )=
160 - img_button(img_path, [], web_action, extra_args, target, replace) 161 + img_button(img_path, [], web_action, extra_args, target, replace, true)
161 . 162 .
162 163
163 public define HTML_Partial_Content 164 public define HTML_Partial_Content
@@ -168,7 +169,7 @@ public define HTML_Partial_Content @@ -168,7 +169,7 @@ public define HTML_Partial_Content
168 List((String, String)) extra_args, 169 List((String, String)) extra_args,
169 String target 170 String target
170 )= 171 )=
171 - img_button(img_path, [], web_action, extra_args, target, false) 172 + img_button(img_path, [], web_action, extra_args, target, false, true)
172 . 173 .
173 174
174 public define HTML_Partial_Content 175 public define HTML_Partial_Content
@@ -255,7 +256,7 @@ define List(CoreAttrs) @@ -255,7 +256,7 @@ define List(CoreAttrs)
255 with ok_action = if load_content_target = "" then 256 with ok_action = if load_content_target = "" then
256 to_JS_String("Xlib.jq_query("+format_web_action_name_to_js(web_action, extra_ops)+")") 257 to_JS_String("Xlib.jq_query("+format_web_action_name_to_js(web_action, extra_ops)+")")
257 else 258 else
258 - load_content_JS_String(load_content_target, web_action, extra_ops, true), 259 + load_content_JS_String(load_content_target, web_action, extra_ops, true, true),
259 //to_JS_String("Xlib.load_content('"++"', "+format_web_action_name_to_js(web_action, extra_ops)+", true)"), 260 //to_JS_String("Xlib.load_content('"++"', "+format_web_action_name_to_js(web_action, extra_ops)+", true)"),
260 261
261 core_attrs + [id(uid), style("cursor: pointer"), event(onclick, "Xlib.make_confirm_dialog(this, "+ ok_action +");")]. 262 core_attrs + [id(uid), style("cursor: pointer"), event(onclick, "Xlib.make_confirm_dialog(this, "+ ok_action +");")].
web/widgets/left_menu.anubis
@@ -17,8 +17,7 @@ public type Left_Menu_Entry: @@ -17,8 +17,7 @@ public type Left_Menu_Entry:
17 List(String) classes, //additional classes if need (for disabling entry, change background color, etc.) 17 List(String) classes, //additional classes if need (for disabling entry, change background color, etc.)
18 WEB_Action_Name action, //action (url to apply when click 18 WEB_Action_Name action, //action (url to apply when click
19 String text, //text to show 19 String text, //text to show
20 - List((String, String)) extra, //extra web arguments to send when click  
21 - Maybe(String) target_id //target_id use during load_content 20 + List((String, String)) extra //extra web arguments to send when click
22 ), 21 ),
23 left_menu_entry_js( //MENU entry with call to js 22 left_menu_entry_js( //MENU entry with call to js
24 String entry_id, //it's also use as icon prefix 23 String entry_id, //it's also use as icon prefix
@@ -27,6 +26,17 @@ public type Left_Menu_Entry: @@ -27,6 +26,17 @@ public type Left_Menu_Entry:
27 String js_call, //javascript to call on click event 26 String js_call, //javascript to call on click event
28 String text //text to show 27 String text //text to show
29 ), 28 ),
  29 + left_menu_entry_load_content( //MENU entry hence no selectable
  30 + String entry_id, //it's also use as icon prefix
  31 + Bool sub_entry,
  32 + List(String) classes, //additional classes if need (for disabling entry, change background color, etc.)
  33 + WEB_Action_Name action, //action (url to apply when click
  34 + String text, //text to show
  35 + List((String, String)) extra, //extra web arguments to send when click
  36 + String target_id //target_id use during load_content
  37 + Bool replace,
  38 + Bool overlay
  39 + ),
30 40
31 title( //TITLE entry hence no selectable 41 title( //TITLE entry hence no selectable
32 String title_id, //it's also use as icon prefix 42 String title_id, //it's also use as icon prefix
@@ -150,7 +160,7 @@ public define Left_Menu_Entry @@ -150,7 +160,7 @@ public define Left_Menu_Entry
150 WEB_Action_Name action, 160 WEB_Action_Name action,
151 String text 161 String text
152 )= 162 )=
153 - left_menu_entry(entry_id, false, [], action, text, [], failure) 163 + left_menu_entry(entry_id, false, [], action, text, [])
154 . 164 .
155 165
156 public define Left_Menu_Entry 166 public define Left_Menu_Entry
@@ -160,7 +170,7 @@ public define Left_Menu_Entry @@ -160,7 +170,7 @@ public define Left_Menu_Entry
160 WEB_Action_Name action, 170 WEB_Action_Name action,
161 String text 171 String text
162 )= 172 )=
163 - left_menu_entry(entry_id, true, [], action, text, [], failure) 173 + left_menu_entry(entry_id, true, [], action, text, [])
164 . 174 .
165 175
166 public define Left_Menu_Entry 176 public define Left_Menu_Entry
@@ -170,7 +180,7 @@ public define Left_Menu_Entry @@ -170,7 +180,7 @@ public define Left_Menu_Entry
170 String action, 180 String action,
171 String text 181 String text
172 )= 182 )=
173 - left_menu_entry(entry_id, false, [], action_name(action), text, [], failure) 183 + left_menu_entry(entry_id, false, [], action_name(action), text, [])
174 . 184 .
175 185
176 public define Left_Menu_Entry 186 public define Left_Menu_Entry
@@ -180,7 +190,7 @@ public define Left_Menu_Entry @@ -180,7 +190,7 @@ public define Left_Menu_Entry
180 String action, 190 String action,
181 String text 191 String text
182 )= 192 )=
183 - left_menu_entry(entry_id, true, [], action_name(action), text, [], failure) 193 + left_menu_entry(entry_id, true, [], action_name(action), text, [])
184 . 194 .
185 195
186 public define Left_Menu_Entry 196 public define Left_Menu_Entry
@@ -191,7 +201,7 @@ public define Left_Menu_Entry @@ -191,7 +201,7 @@ public define Left_Menu_Entry
191 String text, //text to show 201 String text, //text to show
192 List((String, String)) extra //extra web arguments to send when click 202 List((String, String)) extra //extra web arguments to send when click
193 )= 203 )=
194 - left_menu_entry(entry_id, false, [], action, text, extra, failure) 204 + left_menu_entry(entry_id, false, [], action, text, extra)
195 . 205 .
196 206
197 public define Left_Menu_Entry 207 public define Left_Menu_Entry
@@ -202,11 +212,11 @@ public define Left_Menu_Entry @@ -202,11 +212,11 @@ public define Left_Menu_Entry
202 String text, //text to show 212 String text, //text to show
203 List((String, String)) extra //extra web arguments to send when click 213 List((String, String)) extra //extra web arguments to send when click
204 )= 214 )=
205 - left_menu_entry(entry_id, true, [], action, text, extra, failure) 215 + left_menu_entry(entry_id, true, [], action, text, extra)
206 . 216 .
207 217
208 public define Left_Menu_Entry 218 public define Left_Menu_Entry
209 - left_menu_entry 219 + left_menu_entry_load_content
210 ( 220 (
211 String entry_id, //it's also use as icon prefix 221 String entry_id, //it's also use as icon prefix
212 WEB_Action_Name action, //action (url to apply when click 222 WEB_Action_Name action, //action (url to apply when click
@@ -214,11 +224,11 @@ public define Left_Menu_Entry @@ -214,11 +224,11 @@ public define Left_Menu_Entry
214 List((String, String)) extra, //extra web arguments to send when click 224 List((String, String)) extra, //extra web arguments to send when click
215 String target_id 225 String target_id
216 )= 226 )=
217 - left_menu_entry(entry_id, false, [], action, text, extra, success(target_id)) 227 + left_menu_entry_load_content(entry_id, false, [], action, text, extra, target_id, false, true)
218 . 228 .
219 229
220 public define Left_Menu_Entry 230 public define Left_Menu_Entry
221 - left_menu_sub_entry 231 + left_menu_sub_entry_load_content
222 ( 232 (
223 String entry_id, //it's also use as icon prefix 233 String entry_id, //it's also use as icon prefix
224 WEB_Action_Name action, //action (url to apply when click 234 WEB_Action_Name action, //action (url to apply when click
@@ -226,7 +236,7 @@ public define Left_Menu_Entry @@ -226,7 +236,7 @@ public define Left_Menu_Entry
226 List((String, String)) extra, //extra web arguments to send when click 236 List((String, String)) extra, //extra web arguments to send when click
227 String target_id 237 String target_id
228 )= 238 )=
229 - left_menu_entry(entry_id, true, [], action, text, extra, success(target_id)) 239 + left_menu_entry_load_content(entry_id, true, [], action, text, extra, target_id, false, true)
230 . 240 .
231 241
232 public define Left_Menu_Entry 242 public define Left_Menu_Entry
@@ -237,7 +247,7 @@ public define Left_Menu_Entry @@ -237,7 +247,7 @@ public define Left_Menu_Entry
237 String text, //text to show 247 String text, //text to show
238 List((String, String)) extra //extra web arguments to send when click 248 List((String, String)) extra //extra web arguments to send when click
239 )= 249 )=
240 - left_menu_entry(entry_id, false, [], action_name(action), text, extra, failure) 250 + left_menu_entry(entry_id, false, [], action_name(action), text, extra)
241 . 251 .
242 252
243 public define Left_Menu_Entry 253 public define Left_Menu_Entry
@@ -248,11 +258,11 @@ public define Left_Menu_Entry @@ -248,11 +258,11 @@ public define Left_Menu_Entry
248 String text, //text to show 258 String text, //text to show
249 List((String, String)) extra //extra web arguments to send when click 259 List((String, String)) extra //extra web arguments to send when click
250 )= 260 )=
251 - left_menu_entry(entry_id, true, [], action_name(action), text, extra, failure) 261 + left_menu_entry(entry_id, true, [], action_name(action), text, extra)
252 . 262 .
253 263
254 public define Left_Menu_Entry 264 public define Left_Menu_Entry
255 - left_menu_entry 265 + left_menu_entry_load_content
256 ( 266 (
257 String entry_id, //it's also use as icon prefix 267 String entry_id, //it's also use as icon prefix
258 String action, //action (url to apply when click 268 String action, //action (url to apply when click
@@ -260,11 +270,11 @@ public define Left_Menu_Entry @@ -260,11 +270,11 @@ public define Left_Menu_Entry
260 List((String, String)) extra, //extra web arguments to send when click 270 List((String, String)) extra, //extra web arguments to send when click
261 String target_id 271 String target_id
262 )= 272 )=
263 - left_menu_entry(entry_id, false, [], action_name(action), text, extra, success(target_id)) 273 + left_menu_entry_load_content(entry_id, false, [], action_name(action), text, extra, target_id, false, true)
264 . 274 .
265 275
266 public define Left_Menu_Entry 276 public define Left_Menu_Entry
267 - left_menu_sub_entry 277 + left_menu_sub_entry_load_content
268 ( 278 (
269 String entry_id, //it's also use as icon prefix 279 String entry_id, //it's also use as icon prefix
270 String action, //action (url to apply when click 280 String action, //action (url to apply when click
@@ -272,7 +282,7 @@ public define Left_Menu_Entry @@ -272,7 +282,7 @@ public define Left_Menu_Entry
272 List((String, String)) extra, //extra web arguments to send when click 282 List((String, String)) extra, //extra web arguments to send when click
273 String target_id 283 String target_id
274 )= 284 )=
275 - left_menu_entry(entry_id, true, [], action_name(action), text, extra, success(target_id)) 285 + left_menu_entry_load_content(entry_id, true, [], action_name(action), text, extra, target_id, false, true)
276 . 286 .
277 287
278 public define Left_Menu_Entry 288 public define Left_Menu_Entry
web/widgets/left_menu_html.anubis
@@ -26,21 +26,21 @@ define List(HTML_Off_Form) @@ -26,21 +26,21 @@ define List(HTML_Off_Form)
26 with entry = 26 with entry =
27 if h is 27 if h is
28 { 28 {
29 - left_menu_entry(_menu_id, subentry, _classes, _action, _text, _extra, _target_id) then 29 + left_menu_entry(_menu_id, subentry, _classes, _action, _text, _extra) then
30 with item_class = if subentry then "subitem " else "item ", 30 with item_class = if subentry then "subitem " else "item ",
31 - if _target_id is  
32 - {  
33 - failure then p([class(item_class+_menu_id+"_icon"+(if _menu_id=selected then " selected" else "")+ " "+join(" ", _classes))],actioner(same,same, link(_T(_text)),_action,_extra)),  
34 - success(target_id) then  
35 - p([class(item_class+"clickable "+_menu_id+"_icon"+(if _menu_id=selected then " selected" else "")+ " "+join(" ", _classes)),  
36 - event(onclick, load_content(target_id, _action, _extra))],text(_T(_text))),  
37 - } 31 +
  32 + p([class(item_class+_menu_id+"_icon"+(if _menu_id=selected then " selected" else "")+ " "+join(" ", _classes))],actioner(same,same, link(_T(_text)),_action,_extra)),
38 33
39 left_menu_entry_js(_menu_id, subentry, _classes, _js_to_call, _text) then 34 left_menu_entry_js(_menu_id, subentry, _classes, _js_to_call, _text) then
40 with item_class = if subentry then "subitem " else "item ", 35 with item_class = if subentry then "subitem " else "item ",
41 p([class(item_class+"clickable "+_menu_id+"_icon"+(if _menu_id=selected then " selected" else "")+ " "+join(" ", _classes)), 36 p([class(item_class+"clickable "+_menu_id+"_icon"+(if _menu_id=selected then " selected" else "")+ " "+join(" ", _classes)),
42 event(onclick, _js_to_call)],text(_T(_text))), 37 event(onclick, _js_to_call)],text(_T(_text))),
43 38
  39 + left_menu_entry_load_content(_menu_id, subentry, _classes, _action, _text, _extra, _target_id, _replace, _overlay) then
  40 + with item_class = if subentry then "subitem " else "item ",
  41 + p([class(item_class+"clickable "+_menu_id+"_icon"+(if _menu_id=selected then " selected" else "")+ " "+join(" ", _classes)),
  42 + event(onclick, load_content(_target_id, _action, _extra, _replace, _overlay))],text(_T(_text))),
  43 +
44 title(_title_id, subtitle, _classes, _text) then 44 title(_title_id, subtitle, _classes, _text) then
45 p([class(if subtitle then "menu_subtitle" else "menu_title"), class((if _title_id=selected then " selected" else "")+ " "+join(" ", _classes))], text([],_T(_text))) 45 p([class(if subtitle then "menu_subtitle" else "menu_title"), class((if _title_id=selected then " selected" else "")+ " "+join(" ", _classes))], text([],_T(_text)))
46 // p([class("menu_title"), class("item "+_title_id+"_icon"+if _title_id=selected then " selected" else ""+ " "+join(" ", _classes))], text([],_T(_text))) 46 // p([class("menu_title"), class("item "+_title_id+"_icon"+if _title_id=selected then " selected" else ""+ " "+join(" ", _classes))], text([],_T(_text)))