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 @@
<!-- renderjs -->\n
<script src="RSVP.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
<!-- custom script -->\n
<script src="gadget_global.js" type="text/javascript"></script>\n
......@@ -270,7 +271,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>936.43174.43766.55927</string> </value>
<value> <string>936.43469.1612.61132</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -288,7 +289,7 @@
</tuple>
<state>
<tuple>
<float>1407143862.28</float>
<float>1407333743.03</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -138,12 +138,14 @@
.declareAcquiredMethod("jio_ajax", "jio_ajax")\n
.declareAcquiredMethod("pleaseRedirectMyHash", "pleaseRedirectMyHash")\n
.declareAcquiredMethod("whoWantToDisplayThisPage", "whoWantToDisplayThisPage")\n
.declareAcquiredMethod("whoWantToDisplayThis", "whoWantToDisplayThis")\n
\n
/////////////////////////////////////////////////////////////////\n
// declared methods\n
/////////////////////////////////////////////////////////////////\n
.declareMethod(\'render\', function (options) {\n
var erp5_document = options.erp5_document,\n
form_options = options.erp5_form || {},\n
form_gadget = this;\n
\n
form_gadget.props.id = erp5_document._id;\n
......@@ -155,8 +157,7 @@
return form_gadget.getDeclaredGadget("erp5_form")\n
\n
.push(function (erp5_form) {\n
var form_options = options.erp5_form || {},\n
title,\n
var title = options.form_definition.title,\n
i,\n
view_list = erp5_document._links.action_workflow || [];\n
\n
......@@ -208,8 +209,14 @@
}\n
});\n
})\n
.push(function (data) {\n
return form_gadget.whoWantToDisplayThisPage({name: "view"});\n
.push(function (evt) {\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
.push(function (url) {\n
return form_gadget.pleaseRedirectMyHash(url);\n
......@@ -362,7 +369,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>936.43426.13885.45516</string> </value>
<value> <string>936.46364.59346.52275</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -380,7 +387,7 @@
</tuple>
<state>
<tuple>
<float>1407158844.19</float>
<float>1407335049.69</float>
<string>GMT</string>
</tuple>
</state>
......
41
\ No newline at end of file
42
\ 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