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
Sebastien Robin
erp5
Commits
3c43b7db
Commit
3c43b7db
authored
Feb 22, 2016
by
iv
Committed by
Romain Courteaud
Feb 23, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OfficeJS drive: Start ERP5 support, switch to 'enclosure' attachment.
parent
a5291ef8
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
580 additions
and
83 deletions
+580
-83
bt5/erp5_officejs_drive/PathTemplateItem/web_page_module/gadget_officejs_drive_jio_html.xml
...teItem/web_page_module/gadget_officejs_drive_jio_html.xml
+5
-2
bt5/erp5_officejs_drive/PathTemplateItem/web_page_module/gadget_officejs_drive_jio_js.xml
...lateItem/web_page_module/gadget_officejs_drive_jio_js.xml
+30
-17
bt5/erp5_officejs_drive/PathTemplateItem/web_page_module/gadget_officejs_drive_jio_superstorage_js.xml
...page_module/gadget_officejs_drive_jio_superstorage_js.xml
+454
-0
bt5/erp5_officejs_drive/PathTemplateItem/web_page_module/gadget_officejs_drive_page_browse_js.xml
.../web_page_module/gadget_officejs_drive_page_browse_js.xml
+53
-34
bt5/erp5_officejs_drive/PathTemplateItem/web_page_module/gadget_officejs_drive_page_browse_storage_html.xml
...module/gadget_officejs_drive_page_browse_storage_html.xml
+11
-7
bt5/erp5_officejs_drive/PathTemplateItem/web_page_module/gadget_officejs_drive_page_edit_html.xml
.../web_page_module/gadget_officejs_drive_page_edit_html.xml
+3
-5
bt5/erp5_officejs_drive/PathTemplateItem/web_page_module/gadget_officejs_drive_page_edit_js.xml
...em/web_page_module/gadget_officejs_drive_page_edit_js.xml
+21
-15
bt5/erp5_officejs_drive/PathTemplateItem/web_site_module/officejs_drive.xml
...drive/PathTemplateItem/web_site_module/officejs_drive.xml
+3
-3
No files found.
bt5/erp5_officejs_drive/PathTemplateItem/web_page_module/gadget_officejs_drive_jio_html.xml
View file @
3c43b7db
...
...
@@ -118,6 +118,9 @@
\n
<!-- custom script -->
\n
<script
src=
"gadget_officejs_drive_jio.js"
type=
"text/javascript"
></script>
\n
\n
<!-- temporary file, to be included into jIO once clean and tested -->
\n
<script
src=
"gadget_officejs_drive_jio_superstorage.js"
type=
"text/javascript"
></script>
\n
\n
</head>
\n
<body>
\n
...
...
@@ -259,7 +262,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
94
8.8664.63043.42717
</string>
</value>
<value>
<string>
94
9.758.22453.57804
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -277,7 +280,7 @@
</tuple>
<state>
<tuple>
<float>
145
1481186.3
</float>
<float>
145
6159009.84
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs_drive/PathTemplateItem/web_page_module/gadget_officejs_drive_jio_js.xml
View file @
3c43b7db
...
...
@@ -101,9 +101,9 @@
<key>
<string>
text_content
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
/*global window, rJS, jIO, XMLHttpRequestProgressEvent, UriTemplate */\n
/*global window, rJS, jIO,
alert,
XMLHttpRequestProgressEvent, UriTemplate */\n
/*jslint indent: 2, maxerr: 3 */\n
(function (window, rJS, jIO, XMLHttpRequestProgressEvent, UriTemplate) {\n
(function (window, rJS, jIO,
alert,
XMLHttpRequestProgressEvent, UriTemplate) {\n
"use strict";\n
\n
// jIO call wrapper for redirection to authentication page if needed\n
...
...
@@ -113,10 +113,10 @@
.push(undefined, function (error) {\n
if (error instanceof XMLHttpRequestProgressEvent &&\n
error.target.status === 401) {\n
if (gadget.state_parameter_dict.jio_storage_name === "
ERP
5") {\n
if (gadget.state_parameter_dict.jio_storage_name === "
erp
5") {\n
return gadget.redirect({ page: "login" });\n
}\n
if (gadget.state_parameter_dict.jio_storage_name === "
DAV
") {\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
...
...
@@ -126,9 +126,20 @@
).expand({back_url: window.location.href,\n
origin: window.location.protocol + \'//\' +\n
window.location.host});\n
return gadget.redirect({ toExternal: true, url: site});\n
return gadget.redirect({ toExternal: true, url: site
});\n
}\n
}\n
} else if (gadget.state_parameter_dict.jio_storage_name === "dav" &&\n
error instanceof XMLHttpRequestProgressEvent &&\n
error.target.status === 0) {\n
// XXX: need more precision, not all errors with 0 status should be redirected...\n
alert("Unable to access the WebDAV server. It may have an invalid" +\n
" SSL certificate, or is just not running.\\n" +\n
"You will be redirected to this server...");\n
return gadget.redirect({ toExternal: true,\n
url: gadget.state_parameter_dict.jio_storage_url +\n
\'/../redirect?back_url=\' + window.location.href\n
});\n
}\n
throw error;\n
});\n
...
...
@@ -139,21 +150,23 @@
.ready(function (gadget) {\n
// Initialize the gadget local parameters\n
// XXX Hardcoded\n
gadget.state_parameter_dict = {jio_storage_name: "DAV"};\n
gadget.state_parameter_dict = {jio_storage_name: "dav", // "erp5"\n
jio_storage_url: "https://localhost:5000/webdav"}; // for ERP5: <instance>
/web_site_module/hateoas/\n
})\n
\n
.declareAcquiredMethod("redirect", "redirect")\n
.declareAcquiredMethod("getSetting", "getSetting")\n
\n
.declareMethod(\'createJio\', function (jio_options) {\n
if (jio_options !== \'XXX couscous\') {\n
jio_options = {\n
type: "dav",\n
// XXX Hardcoded\n
url: "https://localhost:5000/webdav",\n
with_credentials: true\n
};\n
type: \'daverp5mapping\',\n
sub_storage: {\n
type: this.state_parameter_dict.jio_storage_name,\n
url: this.state_parameter_dict.jio_storage_url,\n
with_credentials: true, // webdav\n
default_view_reference: \'view\' // erp5\n
}\n
};\n
this.state_parameter_dict.jio_storage = jIO.createJIO(jio_options);\n
})\n
.declareMethod(\'allDocs\', function () {\n
...
...
@@ -187,7 +200,7 @@
return wrapJioCall(this, \'repair\', arguments);\n
});\n
\n
}(window, rJS, jIO, XMLHttpRequestProgressEvent, UriTemplate));
}(window, rJS, jIO,
alert,
XMLHttpRequestProgressEvent, UriTemplate));
]]>
</string>
</value>
</item>
...
...
@@ -324,7 +337,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
94
8.36185.35957.25497
</string>
</value>
<value>
<string>
94
9.20746.21257.48042
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -342,7 +355,7 @@
</tuple>
<state>
<tuple>
<float>
145
3132424.5
9
</float>
<float>
145
6138293.
9
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs_drive/PathTemplateItem/web_page_module/gadget_officejs_drive_jio_superstorage_js.xml
0 → 100644
View file @
3c43b7db
This diff is collapsed.
Click to expand it.
bt5/erp5_officejs_drive/PathTemplateItem/web_page_module/gadget_officejs_drive_page_browse_js.xml
View file @
3c43b7db
...
...
@@ -111,9 +111,9 @@
<key>
<string>
text_content
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
/*globals window, rJS, RSVP, loopEventListener, document */\n
/*globals window, rJS, RSVP,
jIO,
loopEventListener, document */\n
/*jslint indent: 2, nomen: true, maxlen: 80*/\n
(function (window, rJS, RSVP, loopEventListener, document) {\n
(function (window, rJS, RSVP,
jIO,
loopEventListener, document) {\n
"use strict";\n
\n
var gadget_klass = rJS(window);\n
...
...
@@ -127,7 +127,9 @@
});\n
})\n
\n
.declareAcquiredMethod("jio_allAttachments", "jio_allAttachments")\n
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")\n
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")\n
\n
.declareAcquiredMethod("redirect", "redirect")\n
\n
.declareMethod("parse", function (text) {\n
...
...
@@ -137,13 +139,12 @@
index;\n
// command is the first token\n
command = args.shift();\n
index = args.length;\n
\n
/* begin from the end because removing some values from the list\n
while looping */\n
while (index
--) {\n
//
only keep useful args (no options, no emtpy string)
\n
if (args[index] === \'\'
|| args[index].startsWith(\'-\')
) {\n
for (index = args.length ; index >
0 ; index
--) {\n
//
remove emply strings from argument list
\n
if (args[index] === \'\') {\n
args.splice(index, 1);\n
}\n
}\n
...
...
@@ -151,45 +152,59 @@
})\n
\n
.declareMethod("browse", function (command, args) {\n
var gadget = this;\n
var gadget = this,\n
requireSingleArgError = new Error(\n
\'This command requires one argument.\'\n
);\n
\n
function absolutePosition(current, requested) {\n
var pos;\n
if (requested.startsWith(\'/\')) {\n
pos = \'/\' + requested
+ \'/\'
;\n
pos = \'/\' + requested;\n
} else {\n
pos =
\'/\' + current + \'/\' + requested + \'/\'
;\n
pos =
current + \'/\' + requested
;\n
}\n
return pos.replace(/\\/+/g, \'/\');\n
}\n
\n
// if command given: proceed\n
\n
if (command) {\n
try {\n
switch (command) {\n
case \'cd\':\n
if (args.length === 1) {\n
return gadget.redirect({\n
position: absolutePosition(gadget.props.currentPosition, args[0])\n
position: absolutePosition(gadget.props.currentPosition,\n
args[0] + \'/\')\n
});\n
}\n
throw
new Error(\'Usage of \' + command + \' requires a single argument.\')
;\n
throw
requireSingleArgError
;\n
\n
case \'vim\':\n
case \'vi\':\n
var position = args[0].split(\'/\'),\n
resource = position.pop();\n
if (args.length === 1) {\n
return gadget.redirect({\n
page: \'edit\',\n
position: absolutePosition(\n
resource: absolutePosition(gadget.props.currentPosition,\n
args[0]),\n
back: gadget.props.currentPosition\n
});\n
}\n
throw requireSingleArgError;\n
case \'share\':\n
if (args.length === 1) {\n
return gadget.jio_getAttachment(absolutePosition(\n
gadget.props.currentPosition,\n
position.join(\'/\')\n
),\n
resource: resource\n
args[0]\n
), \'enclosure\')\n
.push(function (resp) {\n
return jIO.util.readBlobAsDataURL(resp);\n
})\n
.push(function (e) {\n
gadget.props.element.querySelector(\'.output\').textContent = e.target.result;\n
});\n
}\n
throw
new Error(\'Usage of \' + command + \' requires a single argument.\')
;\n
throw
requireSingleArgError
;\n
default:\n
throw new Error(\'Unknown command: \' + command);\n
}\n
...
...
@@ -218,23 +233,27 @@
while (ul.hasChildNodes()) {\n
ul.removeChild(ul.firstChild);\n
}\n
\n
return gadget.jio_allAttachments(options.position)\n
return gadget.jio_allDocs({id: options.position})\n
.push(function (all) {\n
var key,\n
li,\n
id,\n
liContent,\n
resourceName;\n
for (key in all) {\n
if (all.hasOwnProperty(key)) {\n
for (key in all.data.rows) {\n
if (all.data.rows.hasOwnProperty(key)) {\n
id = all.data.rows[key].value.id;\n
li = document.createElement(\'li\');\n
resourceName = document.createTextNode(key);\n
if (key.endsWith(\'.txt\') || key.endsWith(\'.js\') ||\n
key.endsWith(\'.html\') || key.endsWith(\'.py\')) {\n
resourceName = document.createTextNode(id);\n
\n
if (id.endsWith(\'.txt\') || id.endsWith(\'.js\') ||\n
id.endsWith(\'.html\') || id.endsWith(\'.py\') ||\n
id.endsWith(\'_js\')) {\n
liContent = document.createElement(\'a\');\n
\n
liContent.setAttribute(\'href\', \'#page=edit
&
resource=\' +\n
key + \'&position=\' + options.position);\n
[options.position, id].join(\'/\') +\n
\'
&
back=\' + options.position);\n
liContent.appendChild(resourceName);\n
} else {\n
liContent = resourceName;\n
...
...
@@ -268,7 +287,7 @@
});\n
});\n
\n
}(window, rJS, RSVP, loopEventListener, document));
}(window, rJS, RSVP,
jIO,
loopEventListener, document));
]]>
</string>
</value>
</item>
...
...
@@ -407,7 +426,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
94
8.41948.13894.58197
</string>
</value>
<value>
<string>
94
9.20889.54493.42188
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -425,7 +444,7 @@
</tuple>
<state>
<tuple>
<float>
145
3478465.02
</float>
<float>
145
6146835.69
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs_drive/PathTemplateItem/web_page_module/gadget_officejs_drive_page_browse_storage_html.xml
View file @
3c43b7db
...
...
@@ -127,18 +127,22 @@
<script
src=
"renderjs.js"
></script>
\n
<script
src=
"handlebars.js"
></script>
\n
<script
src=
"gadget_officejs_drive_page_browse.js"
></script>
\n
\n
\n
</head>
\n
\n
<body>
\n
<h1>
Super OfficeJS Drive
</h1>
\n
\n
<form>
\n
<input
type=
"text"
>
\n
</form>
\n
<div><a
class=
"error"
></a></div>
\n
<ul>
\n
</ul>
\n
<div>
\n
<a
class=
"error"
></a>
\n
<p
class=
"output"
></p>
\n
</div>
\n
<ul></ul>
\n
\n
\n
</body>
\n
</html>
\n
...
...
@@ -280,7 +284,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
94
8.27123.59534.19558
</string>
</value>
<value>
<string>
94
9.798.48752.10376
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -298,7 +302,7 @@
</tuple>
<state>
<tuple>
<float>
145
2589359.42
</float>
<float>
145
4941615.65
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs_drive/PathTemplateItem/web_page_module/gadget_officejs_drive_page_edit_html.xml
View file @
3c43b7db
...
...
@@ -118,8 +118,6 @@
\n
</head>
\n
<body>
\n
<noscript>
Javascript needed.
</noscript>
\n
\n
<p
class=
message
></p>
\n
<form
class=
"view-web-page-form"
>
\n
<button
type=
"submit"
class=
"ui-btn ui-btn-b ui-btn-inline ui-icon-edit ui-btn-icon-right ui-screen-hidden"
>
Save
</button>
\n
...
...
@@ -132,7 +130,7 @@
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
OfficeJS Drive
Save
</string>
</value>
<value>
<string>
OfficeJS Drive
Edit
</string>
</value>
</item>
<item>
<key>
<string>
version
</string>
</key>
...
...
@@ -263,7 +261,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
94
8.35794.23372.40226
</string>
</value>
<value>
<string>
94
9.1983.24454.60228
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -281,7 +279,7 @@
</tuple>
<state>
<tuple>
<float>
145
3109726.99
</float>
<float>
145
6158941.46
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs_drive/PathTemplateItem/web_page_module/gadget_officejs_drive_page_edit_js.xml
View file @
3c43b7db
...
...
@@ -98,9 +98,9 @@
</item>
<item>
<key>
<string>
text_content
</string>
</key>
<value>
<string>
/*globals window, rJS, RSVP, loopEventListener*/\n
<value>
<string>
/*globals window, rJS, RSVP, loopEventListener
, Blob
*/\n
/*jslint indent: 2, nomen: true, maxlen: 80*/\n
(function (window, RSVP, rJS, loopEventListener) {\n
(function (window, RSVP, rJS, loopEventListener
, Blob
) {\n
"use strict";\n
\n
var gadget_klass = rJS(window);\n
...
...
@@ -133,11 +133,13 @@
.declareMethod(\'render\', function (options) {\n
var gadget = this,\n
format = \'text\';\n
gadget.props.position = options.position || \'/\';\n
gadget.props.resourceName = options.resource;\n
return gadget.jio_getAttachment(gadget.props.position,\n
gadget.props.resourceName,\n
{format: format})\n
\n
return gadget.jio_getAttachment(\n
[gadget.props.resourceName].join(\'/\'),\n
\'enclosure\',\n
{format: format}\n
)\n
.push(function (data) {\n
return gadget.getDeclaredGadget(\'codemirror\')\n
.push(function (editorGadget) {\n
...
...
@@ -148,12 +150,15 @@
});\n
});\n
})\n
\n
\n
.push(function () {\n
return gadget.updateHeader({\n
title: \'Editing \' + gadget.props.resourceName +\n
\' at \' + gadget.props.position,\n
save_action: true\n
title: \'Editing \' + gadget.props.resourceName,\n
save_action: true,\n
panel_action: false,\n
back_url: (typeof options.back === \'string\' ?\n
"#position=" + options.back : \'#\')\n
});\n
});\n
})\n
...
...
@@ -173,10 +178,11 @@
function () {\n
return gadget.props.editorGadget.getData()\n
.push(function (data) {\n
var blob = new Blob([data], {"type" : "text/plain"});\n
return gadget.jio_putAttachment(\n
gadget.props.position,\n
gadget.props.resourceName,\n
data\n
\'enclosure\',\n
blob\n
);\n
});\n
}\n
...
...
@@ -184,11 +190,11 @@
});\n
});\n
\n
}(window, RSVP, rJS, loopEventListener));
</string>
</value>
}(window, RSVP, rJS, loopEventListener
, Blob
));
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
OfficeJS Drive
Save
JS
</string>
</value>
<value>
<string>
OfficeJS Drive
Edit
JS
</string>
</value>
</item>
<item>
<key>
<string>
version
</string>
</key>
...
...
@@ -321,7 +327,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
94
8.41958.9547.3754
</string>
</value>
<value>
<string>
94
9.20738.20231.13619
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -339,7 +345,7 @@
</tuple>
<state>
<tuple>
<float>
145
3478990.59
</float>
<float>
145
6137983.0
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs_drive/PathTemplateItem/web_site_module/officejs_drive.xml
View file @
3c43b7db
...
...
@@ -329,7 +329,7 @@
</item>
<item>
<key>
<string>
configuration_content_security_policy
</string>
</key>
<value>
<string>
default-src \'none\'; img-src \'self\' data:; media-src \'self\' blob:; connect-src \'self\' https://localhost:5000 data:; script-src \'self\' \'unsafe-eval\'; style-src \'self\' \'unsafe-inline\' https://netdna.bootstrapcdn.com data:; frame-src \'self\' data: ; font-src \'self\' https://netdna.bootstrapcdn.com
</string>
</value>
<value>
<string>
default-src \'none\'; img-src \'self\' data:; media-src \'self\' blob:
data:
; connect-src \'self\' https://localhost:5000 data:; script-src \'self\' \'unsafe-eval\'; style-src \'self\' \'unsafe-inline\' https://netdna.bootstrapcdn.com data:; frame-src \'self\' data: ; font-src \'self\' https://netdna.bootstrapcdn.com
</string>
</value>
</item>
<item>
<key>
<string>
configuration_default_view_action_reference
</string>
</key>
...
...
@@ -606,7 +606,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
948.3766
0.22124.61781
</string>
</value>
<value>
<string>
948.3766
1.57011.20445
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -624,7 +624,7 @@
</tuple>
<state>
<tuple>
<float>
1453
220992.18
</float>
<float>
1453
985211.99
</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