Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5_rtl_support
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Romain Courteaud
erp5_rtl_support
Commits
26c65447
Commit
26c65447
authored
Dec 17, 2015
by
iv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OfficeJS: support cookie authentication based on the origin (used in flaskdav).
parent
c9a17d6e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
62 additions
and
50 deletions
+62
-50
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_js.xml
...thTemplateItem/web_page_module/gadget_officejs_jio_js.xml
+42
-37
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_jio_dav_configurator_js.xml
...e_module/gadget_officejs_page_jio_dav_configurator_js.xml
+4
-3
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_router_js.xml
...emplateItem/web_page_module/gadget_officejs_router_js.xml
+16
-10
No files found.
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_js.xml
View file @
26c65447
...
@@ -101,10 +101,38 @@
...
@@ -101,10 +101,38 @@
<key>
<string>
text_content
</string>
</key>
<key>
<string>
text_content
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
<value>
<string
encoding=
"cdata"
>
<![CDATA[
/*global window, rJS, jIO, FormData, XMLHttpRequestProgressEvent */\n
/*global window, rJS, jIO, FormData, XMLHttpRequestProgressEvent
, UriTemplate
*/\n
/*jslint indent: 2, maxerr: 3 */\n
/*jslint indent: 2, maxerr: 3 */\n
(function (window, rJS, jIO) {\n
(function (window, rJS, jIO) {\n
"use strict";\n
"use strict";\n
\n
// jIO call wrapper for redirection to authentication page if needed\n
function wrapJioCall(gadget, method_name, argument_list) {\n
var storage = gadget.state_parameter_dict.jio_storage;\n
return storage[method_name].apply(storage, argument_list)\n
.push(undefined, function (error) {\n
if (error instanceof XMLHttpRequestProgressEvent &&\n
error.target.status === 401) {\n
if (gadget.state_parameter_dict.jio_storage_name === "ERP5") {\n
return gadget.redirect({ page: "login" });\n
}\n
if (gadget.state_parameter_dict.jio_storage_name === "DAV") {\n
var regexp = /^Nayookie login_url=(http[s]?:\\/\\/[\\/\\-\\[\\]{}()*+=:?&.,\\\\\\^$|#\\s\\w%]+)$/,\n
auth_page = error.target.getResponseHeader(\'WWW-Authenticate\'),\n
site;\n
if (regexp.test(auth_page)) {\n
site = UriTemplate.parse(\n
regexp.exec(auth_page)[1]\n
).expand({back_url: window.location.href,\n
origin: window.location.protocol + \'//\' +\n
window.location.host});\n
return gadget.redirect({ toExternal: true, url: site});\n
}\n
}\n
}\n
throw error;\n
});\n
}\n
\n
\n
rJS(window)\n
rJS(window)\n
\n
\n
...
@@ -137,57 +165,34 @@
...
@@ -137,57 +165,34 @@
});\n
});\n
})\n
})\n
.declareMethod(\'allDocs\', function () {\n
.declareMethod(\'allDocs\', function () {\n
var storage = this.state_parameter_dict.jio_storage;\n
return wrapJioCall(this, \'allDocs\', arguments);\n
return storage.allDocs.apply(storage, arguments);\n
})\n
})\n
.declareMethod(\'allAttachments\', function () {\n
.declareMethod(\'allAttachments\', function () {\n
var storage = this.state_parameter_dict.jio_storage;\n
return wrapJioCall(this, \'allAttachments\', arguments);\n
return storage.allAttachments.apply(storage, arguments);\n
})\n
})\n
.declareMethod(\'get\', function () {\n
.declareMethod(\'get\', function () {\n
var storage = this.state_parameter_dict.jio_storage;\n
return wrapJioCall(this, \'get\', arguments);\n
return storage.get.apply(storage, arguments);\n
})\n
})\n
.declareMethod(\'put\', function () {\n
.declareMethod(\'put\', function () {\n
var storage = this.state_parameter_dict.jio_storage;\n
return wrapJioCall(this, \'put\', arguments);\n
return storage.put.apply(storage, arguments);\n
})\n
})\n
.declareMethod(\'post\', function () {\n
.declareMethod(\'post\', function () {\n
var storage = this.state_parameter_dict.jio_storage;\n
return wrapJioCall(this, \'post\', arguments);\n
return storage.post.apply(storage, arguments);\n
})\n
})\n
.declareMethod(\'remove\', function () {\n
.declareMethod(\'remove\', function () {\n
var storage = this.state_parameter_dict.jio_storage;\n
return wrapJioCall(this, \'remove\', arguments);\n
return storage.remove.apply(storage, arguments);\n
})\n
})\n
.declareMethod(\'getAttachment\', function () {\n
.declareMethod(\'getAttachment\', function () {\n
var storage = this.state_parameter_dict.jio_storage;\n
return wrapJioCall(this, \'gettAttachment\', arguments);\n
return storage.getAttachment.apply(storage, arguments);\n
})\n
})\n
.declareMethod(\'putAttachment\', function () {\n
.declareMethod(\'putAttachment\', function () {\n
var storage = this.state_parameter_dict.jio_storage;\n
return wrapJioCall(this, \'putAttachment\', arguments);\n
return storage.putAttachment.apply(storage, arguments);\n
})\n
})\n
.declareMethod(\'removeAttachment\', function () {\n
.declareMethod(\'removeAttachment\', function () {\n
var storage = this.state_parameter_dict.jio_storage;\n
return wrapJioCall(this, \'removeAttachment\', arguments);\n
return storage.removeAttachment.apply(storage, arguments);\n
})\n
})\n
.declareMethod(\'repair\', function () {\n
.declareMethod(\'repair\', function () {\n
var gadget = this,\n
return wrapJioCall(this, \'repair\', arguments);\n
storage = gadget.state_parameter_dict.jio_storage;\n
return storage.repair.apply(storage, arguments)\n
.push(undefined, function (error) {\n
if (error instanceof XMLHttpRequestProgressEvent &&\n
error.currentTarget.status === 401 &&\n
gadget.state_parameter_dict.jio_storage_name === "ERP5") {\n
return {\n
redirect: {\n
page: "login"\n
}\n
};\n
}\n
throw error;\n
});\n
});\n
});\n
\n
\n
}(window, rJS, jIO));
}(window, rJS, jIO));
...
@@ -313,7 +318,7 @@
...
@@ -313,7 +318,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
actor
</string>
</key>
<key>
<string>
actor
</string>
</key>
<value>
<string>
cedric.le.ninivin
</string>
</value>
<value>
<string>
zope
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
comment
</string>
</key>
<key>
<string>
comment
</string>
</key>
...
@@ -327,7 +332,7 @@
...
@@ -327,7 +332,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
94
5.63008.32756.3891
</string>
</value>
<value>
<string>
94
7.54207.48571.57002
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -345,7 +350,7 @@
...
@@ -345,7 +350,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
14
43118127.75
</float>
<float>
14
50281591.67
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_jio_dav_configurator_js.xml
View file @
26c65447
...
@@ -144,7 +144,8 @@
...
@@ -144,7 +144,8 @@
type: "dav",\n
type: "dav",\n
url: gadget.props.element.querySelector("input[name=\'dav_url\']").value,\n
url: gadget.props.element.querySelector("input[name=\'dav_url\']").value,\n
basic_login: btoa(gadget.props.element.querySelector("input[name=\'dav_username\']").value\n
basic_login: btoa(gadget.props.element.querySelector("input[name=\'dav_username\']").value\n
+ \':\' + gadget.props.element.querySelector("input[name=\'dav_password\']").value)\n
+ \':\' + gadget.props.element.querySelector("input[name=\'dav_password\']").value),\n
with_credentials: true\n
}\n
}\n
}\n
}\n
}\n
}\n
...
@@ -355,7 +356,7 @@
...
@@ -355,7 +356,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
94
6.59103.36885.15735
</string>
</value>
<value>
<string>
94
7.53845.25131.55500
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -373,7 +374,7 @@
...
@@ -373,7 +374,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
14
46741080.69
</float>
<float>
14
50259852.52
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_router_js.xml
View file @
26c65447
...
@@ -173,14 +173,20 @@
...
@@ -173,14 +173,20 @@
})\n
})\n
\n
\n
.declareMethod(\'redirect\', function (options) {\n
.declareMethod(\'redirect\', function (options) {\n
return this.getCommandUrlFor(options)\n
if (options !== undefined && options.toExternal) {\n
.push(function (hash) {\n
window.location.replace(options.url);\n
window.location.replace(hash);\n
return RSVP.timeout(REDIRECT_TIMEOUT); // timeout if not redirected\n
// prevent returning unexpected response\n
}\n
// wait for the hash change to occur\n
else {\n
// fail if nothing happens\n
return this.getCommandUrlFor(options)\n
return RSVP.timeout(REDIRECT_TIMEOUT);\n
.push(function (hash) {\n
});\n
window.location.replace(hash);\n
// prevent returning unexpected response\n
// wait for the hash change to occur\n
// fail if nothing happens\n
return RSVP.timeout(REDIRECT_TIMEOUT);\n
});\n
}\n
})\n
})\n
\n
\n
.declareMethod(\'route\', function (options) {\n
.declareMethod(\'route\', function (options) {\n
...
@@ -374,7 +380,7 @@
...
@@ -374,7 +380,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
94
6.59105.23936.34252
</string>
</value>
<value>
<string>
94
7.54085.31754.65399
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -392,7 +398,7 @@
...
@@ -392,7 +398,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
14
46740807.62
</float>
<float>
14
50274255.9
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment