Commit 00f5906e68d6bdd097e36452739ba76613d8dd4d

Authored by Julien Verneuil
1 parent 454773bb

add foreign link "jqflink" to JQuery_Actioner_type

add missing "make_state_cookie_headers" call if no actions are specified
Showing 2 changed files with 24 additions and 10 deletions   Show diff stats
web/CXM_jquery.anubis
... ... @@ -14,6 +14,7 @@ read tools/basis.anubis
14 14 public type JQuery_Actioner_type:
15 15 jqform,
16 16 jqlink,
  17 + jqflink,
17 18 jqscript.
18 19  
19 20 /* jQuery Actioner */
... ... @@ -71,6 +72,7 @@ public define String
71 72 {
72 73 jqform then "$('#"+str+"').submit();",
73 74 jqlink then "document.location='/?a="+str+"';",
  75 + jqflink then "document.location='"+str+"';",
74 76 jqscript then str
75 77 },
76 78 same(label) then
... ... @@ -78,6 +80,7 @@ public define String
78 80 {
79 81 jqform then "$('#"+str+"').submit();",
80 82 jqlink then "document.location='/?a="+str+"';",
  83 + jqflink then "document.location='"+str+"';",
81 84 jqscript then str
82 85 },
83 86 other(window_name, window_options) then
... ... @@ -85,6 +88,7 @@ public define String
85 88 {
86 89 jqform then "$('#"+str+"').submit();", //il s'agit d'une soumision d'un formulaire => cela se fait uniquement dans la même fenêtre !
87 90 jqlink then "window.open('"+str+"', '"+window_name+"', '"+jquery_button_get_onclick_action_window_options(window_options, "")+"');",
  91 + jqflink then "document.location='"+str+"';",
88 92 jqscript then str
89 93 }
90 94 }.
... ...
web/CXM_making_a_web_site.anubis
... ... @@ -2004,7 +2004,8 @@ define ($State s) -> String // the function constructed returns the name of t
2004 2004 ($State s) |->
2005 2005 with time_stamp = now+timeout,
2006 2006 to_be_saved = (time_stamp,s),
2007   - state_name = web_arg_encode(sha1(s)),
  2007 + state_name = to_ascii(sha1(s)),
  2008 + //println("make_save_state_function " + state_directory+"/s"+state_name);
2008 2009 if save(to_be_saved,state_directory+"/s"+state_name) is ok
2009 2010 then state_name
2010 2011 else (print("Cannot create state file in '"+state_directory+"'.\n"); "").
... ... @@ -2292,8 +2293,13 @@ define (List(Web_arg) lwa, HTTP_Info info) -> Separated_Web_Args($State)
2292 2293 //println("find_cookie(\"state_"+website_name+"\", ...");
2293 2294 if find_cookie("state_"+website_name, server_get_cookies(http_headers(info))) is
2294 2295 {
2295   - failure then swa(not_found,failure,[]),
2296   - success(cookie) then swa(retrieve_state(value(cookie)),failure,[])
  2296 + failure then
  2297 + /*println("find_cookie(\"state_"+website_name+"\" failure");*/
  2298 + swa(not_found,failure,[]),
  2299 +
  2300 + success(cookie) then
  2301 + /*println("find_cookie(\"state_"+website_name+"\" success");*/
  2302 + swa(retrieve_state(value(cookie)),failure,[])
2297 2303 },
2298 2304  
2299 2305 //swa(failure,failure,[]),
... ... @@ -2474,6 +2480,7 @@ define List(HTTP_header)
2474 2480 String state_name
2475 2481 )
2476 2482 =
  2483 + //println("Set-Cookie state_"+website_name+"="+state_name);
2477 2484 [
2478 2485 http_header("Set-Cookie", "state_"+website_name+"="+state_name)
2479 2486 ]
... ... @@ -2553,9 +2560,11 @@ public define Web_Site
2553 2560 },
2554 2561  
2555 2562 out_of_date(state) then
  2563 + //println("out_of_date");
2556 2564 ticket_expired_state(state, mb_action_name, http_info,operands,is_https),
2557 2565  
2558 2566 still_valid(state) then
  2567 + //println("still_valid");
2559 2568 if mb_action_name is
2560 2569 {
2561 2570 failure then state,
... ... @@ -2568,14 +2577,15 @@ public define Web_Site
2568 2577 //println("Cookie new STATE NAME "+state_name);
2569 2578 with cookie_headers = if mb_action_name is
2570 2579 {
2571   - failure then [],
  2580 + failure then
  2581 + make_state_cookie_headers(website_name, state_name),
2572 2582 success(action_name) then
2573   - if action_name = "none" then
2574   - []
2575   - else if substr(action_name, 0, 5)="ajax_" then
2576   - []
2577   - else
2578   - make_state_cookie_headers(website_name, state_name)
  2583 + if action_name = "none" then
  2584 + []
  2585 + else if substr(action_name, 0, 5)="ajax_" then
  2586 + []
  2587 + else
  2588 + make_state_cookie_headers(website_name, state_name)
2579 2589 },
2580 2590  
2581 2591 format(info(host_name, http_port, https_port, site_directory, secret),
... ...