Commit 0d519c88 authored by Romain Courteaud's avatar Romain Courteaud Committed by Sebastien Robin

Follow redirection requested by the server.

It is used when creating a new document for example.
parent 3416c357
...@@ -115,6 +115,7 @@ ...@@ -115,6 +115,7 @@
<!-- renderjs -->\n <!-- renderjs -->\n
<script src="RSVP.js" type="text/javascript"></script>\n <script src="RSVP.js" type="text/javascript"></script>\n
<script src="renderjs.js" type="text/javascript"></script>\n <script src="renderjs.js" type="text/javascript"></script>\n
<script src="URI.js" type="text/javascript"></script>\n
\n \n
<!-- custom script -->\n <!-- custom script -->\n
<script src="gadget_global.js" type="text/javascript"></script>\n <script src="gadget_global.js" type="text/javascript"></script>\n
...@@ -270,7 +271,7 @@ ...@@ -270,7 +271,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>936.43174.43766.55927</string> </value> <value> <string>936.43469.1612.61132</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -288,7 +289,7 @@ ...@@ -288,7 +289,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1407143862.28</float> <float>1407333743.03</float>
<string>GMT</string> <string>GMT</string>
</tuple> </tuple>
</state> </state>
......
...@@ -138,12 +138,14 @@ ...@@ -138,12 +138,14 @@
.declareAcquiredMethod("jio_ajax", "jio_ajax")\n .declareAcquiredMethod("jio_ajax", "jio_ajax")\n
.declareAcquiredMethod("pleaseRedirectMyHash", "pleaseRedirectMyHash")\n .declareAcquiredMethod("pleaseRedirectMyHash", "pleaseRedirectMyHash")\n
.declareAcquiredMethod("whoWantToDisplayThisPage", "whoWantToDisplayThisPage")\n .declareAcquiredMethod("whoWantToDisplayThisPage", "whoWantToDisplayThisPage")\n
.declareAcquiredMethod("whoWantToDisplayThis", "whoWantToDisplayThis")\n
\n \n
/////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////\n
// declared methods\n // declared methods\n
/////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////\n
.declareMethod(\'render\', function (options) {\n .declareMethod(\'render\', function (options) {\n
var erp5_document = options.erp5_document,\n var erp5_document = options.erp5_document,\n
form_options = options.erp5_form || {},\n
form_gadget = this;\n form_gadget = this;\n
\n \n
form_gadget.props.id = erp5_document._id;\n form_gadget.props.id = erp5_document._id;\n
...@@ -155,8 +157,7 @@ ...@@ -155,8 +157,7 @@
return form_gadget.getDeclaredGadget("erp5_form")\n return form_gadget.getDeclaredGadget("erp5_form")\n
\n \n
.push(function (erp5_form) {\n .push(function (erp5_form) {\n
var form_options = options.erp5_form || {},\n var title = options.form_definition.title,\n
title,\n
i,\n i,\n
view_list = erp5_document._links.action_workflow || [];\n view_list = erp5_document._links.action_workflow || [];\n
\n \n
...@@ -208,8 +209,14 @@ ...@@ -208,8 +209,14 @@
}\n }\n
});\n });\n
})\n })\n
.push(function (data) {\n .push(function (evt) {\n
return form_gadget.whoWantToDisplayThisPage({name: "view"});\n var location = evt.target.getResponseHeader("X-Location");\n
if (location === undefined) {\n
// No redirection, stay on the same document\n
return form_gadget.whoWantToDisplayThisPage({name: "view"});\n
} else {\n
return form_gadget.whoWantToDisplayThis(new URI(location).segment(2));\n
}\n
})\n })\n
.push(function (url) {\n .push(function (url) {\n
return form_gadget.pleaseRedirectMyHash(url);\n return form_gadget.pleaseRedirectMyHash(url);\n
...@@ -362,7 +369,7 @@ ...@@ -362,7 +369,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>936.43426.13885.45516</string> </value> <value> <string>936.46364.59346.52275</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -380,7 +387,7 @@ ...@@ -380,7 +387,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1407158844.19</float> <float>1407335049.69</float>
<string>GMT</string> <string>GMT</string>
</tuple> </tuple>
</state> </state>
......
41 42
\ No newline at end of file \ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment