Commit 6fb49c15 authored by Mukul's avatar Mukul Committed by Vincent Bechu

[erp5_officejs][erp5_web_renderjs_ui] Adds erp5 storage support in media player app.

parent 62c8a741
......@@ -35,7 +35,10 @@ class Sound(File):
def index_html(self, REQUEST, RESPONSE, format=_MARKER, inline=_MARKER, **kw):
"""XXXXXX"""
range = REQUEST.get_header('Range', None)
if range is not None:
if range is None:
start = None
end = None
else:
ranges = HTTPRangeSupport.parseRange(range)
(start, end) = ranges[0]
......@@ -63,8 +66,11 @@ class Sound(File):
raise Forbidden('You are not allowed to get this document in this ' \
'format')
mime, data = self.convert(format, **kw)
data = data[start:end-1]
total_length = len(data)
if end is None:
end = total_length
if start is not None:
data = data[start:end-1]
RESPONSE.setHeader('Content-Length', len(data))
RESPONSE.setHeader('Content-Type', mime)
......@@ -74,5 +80,10 @@ class Sound(File):
RESPONSE.setHeader('Content-Disposition',
'attachment; filename="%s"' % filename)
RESPONSE.setHeader('Accept-Ranges', 'bytes')
RESPONSE.setStatus(206)
if start is None:
RESPONSE.setStatus(200)
else:
RESPONSE.setHeader('Content-Range',
'bytes %s-%s/%s' % (start, end-1, total_length))
RESPONSE.setStatus(206)
return str(data)
\ No newline at end of file
......@@ -115,6 +115,7 @@
<string>my_filename</string>
<string>my_translated_external_processing_state_title</string>
<string>my_revision</string>
<string>your_player</string>
</list>
</value>
</item>
......
......@@ -18,7 +18,7 @@
<script data-renderjs-configuration="document_title" type="text/x-renderjs-configuration">Sound</script>
<script data-renderjs-configuration="document_title_plural" type="text/x-renderjs-configuration">Sounds</script>
<script data-renderjs-configuration="parent_relative_url" type="text/x-renderjs-configuration">sound_module</script>
<script data-renderjs-configuration="erp5_attachment_synchro" type="text/x-renderjs-configuration">true</script>
<script data-renderjs-configuration="erp5_attachment_synchro" type="text/x-renderjs-configuration">/{+id}/Base_downloadWithCors</script>
<script data-renderjs-configuration="dropbox_app_key" type="text/x-renderjs-configuration">i73co5a6nmddy3m</script>
<div data-gadget-url="gadget_erp5_router.html" data-gadget-scope="erp5_router"></div>
</body>
......
......@@ -279,7 +279,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>965.45219.51840.21862</string> </value>
<value> <string>965.45199.37081.46216</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -297,7 +297,7 @@
</tuple>
<state>
<tuple>
<float>1522308345.15</float>
<float>1519397987.34</float>
<string>UTC</string>
</tuple>
</state>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ERP5 Form" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value> <string>Base_edit</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>form_view_editable\n
ooffice_view</string> </value>
</item>
<item>
<key> <string>edit_order</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>left</string>
<string>right</string>
<string>center</string>
<string>bottom</string>
<string>hidden</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>bottom</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>center</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value>
<list>
<string>my_title</string>
<string>your_modification_date</string>
<string>my_content_type</string>
<string>my_portal_type</string>
<string>my_reference</string>
<string>my_revision</string>
</list>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Sound_viewAsJio</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>WebTable_viewAsJio</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_view_editable</string> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>stored_encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>update_action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>update_action_title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
erp5_hal_json_style
erp5_web_renderjs_ui
\ No newline at end of file
erp5_web_renderjs_ui
erp5_multimedia
\ No newline at end of file
......@@ -261,7 +261,10 @@
.declareMethod('get', function (id) {
return wrapJioCall(this, 'get', [id]);
})
.declareMethod('getAttachment', function (id, name) {
.declareMethod('getAttachment', function (id, name, options) {
if (options) {
return wrapJioCall(this, 'getAttachment', [id, name, options]);
}
return wrapJioCall(this, 'getAttachment', [id, name, {format: "json"}]);
})
.declareMethod('putAttachment', function (id, name, json) {
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>965.65535.18355.17288</string> </value>
<value> <string>964.58846.58534.49066</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1520357812.73</float>
<float>1520612423.57</float>
<string>UTC</string>
</tuple>
</state>
......
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