Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
iv
erp5
Commits
64828784
Commit
64828784
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
61d2f3cc
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 @
64828784
...
...
@@ -101,10 +101,38 @@
<key>
<string>
text_content
</string>
</key>
<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
(function (window, rJS, jIO) {\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
rJS(window)\n
\n
...
...
@@ -137,57 +165,34 @@
});\n
})\n
.declareMethod(\'allDocs\', function () {\n
var storage = this.state_parameter_dict.jio_storage;\n
return storage.allDocs.apply(storage, arguments);\n
return wrapJioCall(this, \'allDocs\', arguments);\n
})\n
.declareMethod(\'allAttachments\', function () {\n
var storage = this.state_parameter_dict.jio_storage;\n
return storage.allAttachments.apply(storage, arguments);\n
return wrapJioCall(this, \'allAttachments\', arguments);\n
})\n
.declareMethod(\'get\', function () {\n
var storage = this.state_parameter_dict.jio_storage;\n
return storage.get.apply(storage, arguments);\n
return wrapJioCall(this, \'get\', arguments);\n
})\n
.declareMethod(\'put\', function () {\n
var storage = this.state_parameter_dict.jio_storage;\n
return storage.put.apply(storage, arguments);\n
return wrapJioCall(this, \'put\', arguments);\n
})\n
.declareMethod(\'post\', function () {\n
var storage = this.state_parameter_dict.jio_storage;\n
return storage.post.apply(storage, arguments);\n
return wrapJioCall(this, \'post\', arguments);\n
})\n
.declareMethod(\'remove\', function () {\n
var storage = this.state_parameter_dict.jio_storage;\n
return storage.remove.apply(storage, arguments);\n
return wrapJioCall(this, \'remove\', arguments);\n
})\n
.declareMethod(\'getAttachment\', function () {\n
var storage = this.state_parameter_dict.jio_storage;\n
return storage.getAttachment.apply(storage, arguments);\n
return wrapJioCall(this, \'gettAttachment\', arguments);\n
})\n
.declareMethod(\'putAttachment\', function () {\n
var storage = this.state_parameter_dict.jio_storage;\n
return storage.putAttachment.apply(storage, arguments);\n
return wrapJioCall(this, \'putAttachment\', arguments);\n
})\n
.declareMethod(\'removeAttachment\', function () {\n
var storage = this.state_parameter_dict.jio_storage;\n
return storage.removeAttachment.apply(storage, arguments);\n
return wrapJioCall(this, \'removeAttachment\', arguments);\n
})\n
.declareMethod(\'repair\', function () {\n
var gadget = this,\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
return wrapJioCall(this, \'repair\', arguments);\n
});\n
\n
}(window, rJS, jIO));
...
...
@@ -313,7 +318,7 @@
</item>
<item>
<key>
<string>
actor
</string>
</key>
<value>
<string>
cedric.le.ninivin
</string>
</value>
<value>
<string>
zope
</string>
</value>
</item>
<item>
<key>
<string>
comment
</string>
</key>
...
...
@@ -327,7 +332,7 @@
</item>
<item>
<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>
<key>
<string>
state
</string>
</key>
...
...
@@ -345,7 +350,7 @@
</tuple>
<state>
<tuple>
<float>
14
43118127.75
</float>
<float>
14
50281591.67
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_jio_dav_configurator_js.xml
View file @
64828784
...
...
@@ -144,7 +144,8 @@
type: "dav",\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
+ \':\' + 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
...
...
@@ -355,7 +356,7 @@
</item>
<item>
<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>
<key>
<string>
state
</string>
</key>
...
...
@@ -373,7 +374,7 @@
</tuple>
<state>
<tuple>
<float>
14
46741080.69
</float>
<float>
14
50259852.52
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_router_js.xml
View file @
64828784
...
...
@@ -173,14 +173,20 @@
})\n
\n
.declareMethod(\'redirect\', function (options) {\n
return this.getCommandUrlFor(options)\n
.push(function (hash) {\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
if (options !== undefined && options.toExternal) {\n
window.location.replace(options.url);\n
return RSVP.timeout(REDIRECT_TIMEOUT); // timeout if not redirected\n
}\n
else {\n
return this.getCommandUrlFor(options)\n
.push(function (hash) {\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
.declareMethod(\'route\', function (options) {\n
...
...
@@ -374,7 +380,7 @@
</item>
<item>
<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>
<key>
<string>
state
</string>
</key>
...
...
@@ -392,7 +398,7 @@
</tuple>
<state>
<tuple>
<float>
14
46740807.62
</float>
<float>
14
50274255.9
</float>
<string>
UTC
</string>
</tuple>
</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