Commit 8d76df00 authored by Mukul's avatar Mukul Committed by Vincent Bechu

[erp5_officejs][erp5_multimedia]: Adds officejs music player app.

parent ab388d7f
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>OfficeJS Jio Custom Player</title>
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="gadget_custom_player.js"></script>
</head>
<body>
<div class="field_container">
<div class="audioplayer">
<div class="pDiv">
<button class="play-btn ui-btn ui-btn-icon-left ui-icon-play"></button>
</div>
<div class="duration">
<span class="current_time">00:00:00</span>
<span> / </span>
<span class="total_time">00:00:00</span>
</div>
<progress value="0"></progress>
<div class="pVolumn">
<button class="vol-btn ui-icon ui-icon-left ui-icon-volume-up"></button>
</div>
<div class="volTimeline">
<div class="volHead"></div>
</div>
</div>
</div>
<div class='controller'></div>
</body>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>gadget_custom_player.html</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
/*global window, rJS, RSVP, jIO, MediaSource,
loopEventListener
*/
/*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS) {
"use strict";
rJS(window)
.setState({ play: false, mute: false })
//////////////////////////////////////////////
// Acquire Method
//////////////////////////////////////////////
.declareAcquiredMethod("jio_get", "jio_get")
/////////////////////////////////////////////
// Declare Method
////////////////////////////////////////////
.allowPublicAcquisition('updateCurrentTime', function (time) {
this.element.querySelector('.current_time').textContent = new Date(time * 1000).toISOString().substr(11, 8);
this.element.querySelector('progress').value = time;
})
.allowPublicAcquisition('updateTotalTime', function (time) {
this.element.querySelector('.total_time').textContent = new Date(time * 1000).toISOString().substr(11, 8);
this.element.querySelector('progress').max = time;
})
.allowPublicAcquisition('onEnd', function () {
return this.changeState({ play: false, mute: false });
})
.declareMethod('togglePlayPause', function () {
var gadget = this,
play_button = gadget.element.querySelector('.play-btn');
if (gadget.state.play) {
play_button.classList.add('ui-icon-pause');
play_button.classList.remove('ui-icon-play');
} else {
play_button.classList.add('ui-icon-play');
play_button.classList.remove('ui-icon-pause');
}
return gadget.getDeclaredGadget('controller')
.push(function (controller) {
return controller.handlePlayPause(gadget.state.play);
});
})
.declareMethod('toggleSound', function () {
var gadget = this,
volume_button = gadget.element.querySelector('.vol-btn');
if (gadget.state.mute) {
volume_button.classList.remove('ui-icon-volume-up');
volume_button.classList.add('ui-icon-volume-off');
} else {
volume_button.classList.remove('ui-icon-volume-off');
volume_button.classList.add('ui-icon-volume-up');
}
return gadget.getDeclaredGadget('controller')
.push(function (controller) {
return controller.handleSound(gadget.state.mute);
});
})
.declareMethod('render', function (params) {
var gadget = this;
return gadget.jio_get(params.value)
.push(function (doc) {
var name_array = doc.title.split('.'),
type = name_array[name_array.length - 1];
if (type === 'mp3' && MediaSource.isTypeSupported('audio/mpeg')) {
return gadget.declareGadget('gadget_custom_player_controller.html', {
element: gadget.element.querySelector('.controller'),
scope: 'controller'
});
}
return gadget.declareGadget('gadget_custom_player_controller_fallback.html', {
element: gadget.element.querySelector('.controller'),
scope: 'controller'
});
})
.push(function (controller) {
return controller.render({
id: params.value,
name: params.name
});
});
})
.onStateChange(function (modification_dict) {
if (modification_dict.hasOwnProperty('play')) {
return this.togglePlayPause(modification_dict.play);
}
if (modification_dict.hasOwnProperty('mute')) {
return this.toggleSound(modification_dict.mute);
}
})
.declareService(function () {
var gadget = this;
return loopEventListener(
gadget.element.querySelector('.play-btn'),
'click',
false,
function () {
return gadget.changeState({ play: !gadget.state.play });
},
true
);
})
.declareService(function () {
var gadget = this;
return loopEventListener(
gadget.element.querySelector('.vol-btn'),
'click',
false,
function () {
return gadget.changeState({ mute: !gadget.state.mute });
},
true
);
});
}(window, rJS));
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>gadget_custom_player.js</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>application/javascript</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>OfficeJS Jio Media Player Controller</title>
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="gadget_custom_player_controller.js"></script>
</head>
<body>
<audio></audio>
</body>
</html>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>gadget_custom_player_controller.html</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
/*global window, rJS, RSVP, jIO, AudioContext,
URL, MediaSource, loopEventListener, document,
promiseEventListener, ArrayBuffer */
/*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS, RSVP, AudioContext, URL, MediaSource, loopEventListener) {
"use strict";
rJS(window)
.setState({ currentTime: 0 })
//////////////////////////////////////////////
// Acquire methods
/////////////////////////////////////////////
.declareAcquiredMethod('jio_get', 'jio_get')
.declareAcquiredMethod('getSetting', 'getSetting')
.declareAcquiredMethod('jio_getAttachment', 'jio_getAttachment')
.declareAcquiredMethod('updateCurrentTime', 'updateCurrentTime')
.declareAcquiredMethod('updateTotalTime', 'updateTotalTime')
.declareAcquiredMethod('notifySubmitted', 'notifySubmitted')
.declareAcquiredMethod('onEnd', 'onEnd')
//////////////////////////////////////////////
// Declare methods
/////////////////////////////////////////////
.declareMethod('configurePlayerContext', function () {
this.params.source.connect(this.params.gain);
this.params.gain.connect(this.params.audioContext.destination);
})
.declareMethod('getAudioChunk', function () {
var gadget = this, start, end;
start = gadget.params.index;
if (gadget.params.end) {
return;
}
end = start + 10e5;
// Call `getAttachment` method of jIO to fetch a chunk of data from IDB storage.
return new RSVP.Queue()
.push(function () {
return gadget.jio_getAttachment(gadget.params.id, gadget.params.name, {
'start': start,
'end': end,
'format': 'array_buffer'
}).push(function (buffer) {
if (buffer.byteLength < 10e5) {
gadget.params.end = true;
}
gadget.params.index += 10e5;
return buffer;
}, function (error) {
if ((error.constructor.name === 'jIOError' && error.status_code === 404) ||
(error.target && error.target.result === undefined)) {
return gadget.notifySubmitted({message: error.message || error.target.error, status: 'fail'});
}
throw error;
});
});
})
.declareMethod('handlePlayPause', function (play) {
var audio = this.element.querySelector('audio');
if (play) {
audio.play();
} else {
audio.pause();
}
})
.declareMethod('handleSound', function (mute) {
this.element.querySelector('audio').muted = mute;
})
.declareMethod('setSourceBuffer', function () {
this.params.sourceBuffer = this.params.mediaSource.addSourceBuffer('audio/mpeg');
return RSVP.all([this.setUpdateEvent(), this.timeUpdate()]);
})
.declareMethod('setUpdateEvent', function () {
var gadget = this;
return gadget.getAudioChunk()
.push(function (buffer) {
if (buffer instanceof ArrayBuffer && !gadget.params.sourceBuffer.updating) {
gadget.params.sourceBuffer.appendBuffer(buffer);
gadget.params.sourceBuffer.onupdateend = function () {
this.updateTotalTime(this.params.sourceBuffer.timestampOffset);
}.bind(gadget);
}
if (buffer === undefined && gadget.params.mediaSource.readyState === 'open') {
gadget.params.mediaSource.endOfStream();
}
if (gadget.params.replay) {
gadget.element.querySelector('audio').play();
gadget.params.replay = false;
}
});
})
.declareMethod('render', function (params) {
var gadget = this,
queue = new RSVP.Queue();
gadget.params.id = params.id;
gadget.params.name = params.name;
gadget.params.index = 0;
return queue
.push(function () {
return promiseEventListener(gadget.params.mediaSource, 'sourceopen', false);
})
.push(function () {
if (!gadget.params.name) {
return gadget.getSetting('hateoas_url');
}
})
.push(function (hateoas_url) {
if (!gadget.params.name) {
gadget.params.name = hateoas_url + gadget.params.id;
}
return RSVP.all([
gadget.setSourceBuffer(),
gadget.configurePlayerContext()
]);
});
})
.ready(function () {
var audioContext = new AudioContext(),
audio = this.element.querySelector('audio'),
gain = audioContext.createGain(),
source = audioContext.createMediaElementSource(audio),
mediaSource = new MediaSource();
audio.src = URL.createObjectURL(mediaSource);
this.params = {
audioContext: audioContext,
gain: gain,
source: source,
mediaSource: mediaSource
};
})
.onStateChange(function (modification_dict) {
if (modification_dict.hasOwnProperty('currentTime')) {
return this.updateCurrentTime(modification_dict.currentTime);
}
})
.declareJob('requestChunk', function () {
var gadget = this;
return gadget.getAudioChunk()
.push(function (buffer) {
gadget.params.requested = false;
if (buffer instanceof ArrayBuffer && !gadget.params.sourceBuffer.updating) {
return gadget.params.sourceBuffer.appendBuffer(buffer);
}
if (buffer === undefined && gadget.params.mediaSource.readyState === 'open') {
gadget.params.mediaSource.endOfStream();
}
})
.push(function () {
return gadget.changeState({ currentTime: gadget.element.querySelector('audio').currentTime });
});
})
.declareJob('timeUpdate', function () {
var gadget = this,
audio = gadget.element.querySelector('audio');
return loopEventListener(
audio,
'timeupdate',
false,
function () {
if ((gadget.params.sourceBuffer.timestampOffset - audio.currentTime) < 10 && !gadget.params.requested) {
gadget.params.requested = true;
return gadget.requestChunk();
}
return gadget.changeState({ currentTime: audio.currentTime });
},
true
);
})
.declareService(function () {
var gadget = this,
audio = gadget.element.querySelector('audio');
return new RSVP.Queue()
.push(function () {
return loopEventListener(
audio,
'ended',
false,
function () {
audio.currentTime = 0;
return gadget.onEnd();
},
true
);
})
.push(undefined, function (error) {
if (error instanceof RSVP.CancellationError) {
// Pause when gadget go out of scope { CancellationError }.
audio.pause();
gadget.params.source.disconnect(0);
gadget.params.gain.disconnect(0);
gadget.params.audioContext.close();
} else {
throw error;
}
});
});
}(window, rJS, RSVP, AudioContext, URL, MediaSource, loopEventListener));
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>gadget_custom_player_controller.js</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>application/javascript</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>OfficeJS Jio Player Controller Fallback</title>
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="gadget_custom_player_controller_fallback.js"></script>
</head>
<body>
<audio></audio>
</body>
</html>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>gadget_custom_player_controller_fallback.html</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
/*global window, rJS, RSVP, URL, Blob,
loopEventListener, document*/
/*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS, RSVP, URL, loopEventListener) {
"use strict";
rJS(window)
.setState({ currentTime: 0 })
//////////////////////////////////////////////
// Acquire methods
/////////////////////////////////////////////
.declareAcquiredMethod('jio_get', 'jio_get')
.declareAcquiredMethod('getSetting', 'getSetting')
.declareAcquiredMethod('jio_getAttachment', 'jio_getAttachment')
.declareAcquiredMethod('togglePlayPause', 'togglePlayPause')
.declareAcquiredMethod('toggleSound', 'toggleSound')
.declareAcquiredMethod('updateCurrentTime', 'updateCurrentTime')
.declareAcquiredMethod('updateTotalTime', 'updateTotalTime')
.declareAcquiredMethod('notifySubmitted', 'notifySubmitted')
.declareAcquiredMethod('onEnd', 'onEnd')
//////////////////////////////////////////////
// Declare methods
/////////////////////////////////////////////
.declareMethod('getAudioChunk', function () {
var gadget = this;
// Call `getAttachment` method of jIO to fetch a chunk of data from IDB storage.
return new RSVP.Queue()
.push(function () {
return gadget.jio_getAttachment(gadget.params.id, gadget.params.name, {
start: 0
});
})
.push(undefined, function (error) {
if ((error.constructor.name === 'jIOError' && error.status_code === 404) ||
(error.target && error.target.result === undefined)) {
return gadget.notifySubmitted({message: error.message || error.target.error, status: 'fail'});
}
throw error;
});
})
.declareMethod('handlePlayPause', function (play) {
var audio = this.element.querySelector('audio');
if (play) {
audio.play();
} else {
audio.pause();
}
})
.declareMethod('handleSound', function (mute) {
this.element.querySelector('audio').muted = mute;
})
.declareMethod('render', function (params) {
var gadget = this,
queue = new RSVP.Queue();
gadget.params = params;
if (gadget.params.id) {
if (!gadget.params.name) {
queue
.push(function () {
return gadget.getSetting('hateoas_url');
});
}
queue
.push(function (hateoas_url) {
if (!gadget.params.name) {
gadget.params.name = hateoas_url + gadget.params.id;
}
return gadget.getAudioChunk()
.push(function (blob) {
if (!(blob instanceof Blob)) {
blob = new Blob();
}
gadget.element.querySelector('audio').src = URL.createObjectURL(blob);
gadget.element.querySelector('audio').onloadeddata = function () {
gadget.updateTotalTime(gadget.element.querySelector('audio').duration);
}.bind(gadget);
});
});
}
return queue;
})
.onStateChange(function (modification_dict) {
if (modification_dict.hasOwnProperty('currentTime')) {
return this.updateCurrentTime(modification_dict.currentTime);
}
})
.declareService(function () {
var gadget = this,
audio = gadget.element.querySelector('audio');
return loopEventListener(
audio,
'timeupdate',
false,
function () {
return gadget.changeState({ currentTime: audio.currentTime });
},
true
);
})
.declareService(function () {
var gadget = this,
audio = gadget.element.querySelector('audio');
return RSVP.Queue()
.push(function () {
return loopEventListener(
audio,
'ended',
false,
function () {
audio.currentTime = 0;
return gadget.onEnd();
},
true
);
})
.push(undefined, function (error) {
if (error instanceof RSVP.CancellationError) {
// Pause when gadget go out of scope { CancellationError }.
audio.pause();
} else {
throw error;
}
});
});
}(window, rJS, RSVP, URL, loopEventListener));
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>gadget_custom_player_controller_fallback.js</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>application/javascript</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>OfficeJS Jio Media Player View</title>
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="handlebars.js"></script>
<script src="gadget_officejs_jio_sound_view.js"></script>
</head>
<body>
<form class="save_form ui-body-c" novalidate>
<button type="submit" class="ui-btn ui-btn-b ui-btn-inline
ui-icon-edit ui-btn-icon-right ui-screen-hidden"></button>
<div data-gadget-url="gadget_erp5_form.html"
data-gadget-scope="form_view"
data-gadget-sandbox="public">
</div>
</form>
</body>
</html>
/*global window, rJS, RSVP, jIO, URL,
promiseEventListener, document*/
/*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, jIO, rJS, RSVP) {
"use strict";
rJS(window)
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("getUrlParameter", "getUrlParameter")
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("updateDocument", "updateDocument")
.declareAcquiredMethod("notifySubmitting", "notifySubmitting")
.declareAcquiredMethod("notifySubmitted", 'notifySubmitted')
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("jio_get", "jio_get")
.declareAcquiredMethod("jio_put", "jio_put")
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")
.declareAcquiredMethod("jio_putAttachment", "jio_putAttachment")
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.declareMethod("render", function (options) {
var gadget = this;
return gadget.changeState({
jio_key: options.jio_key,
doc: options.doc
});
})
.onEvent('submit', function () {
var gadget = this;
return gadget.notifySubmitting()
.push(function () {
return gadget.getDeclaredGadget('form_view');
})
.push(function (form_gadget) {
return form_gadget.getContent();
})
.push(function (content) {
var list = [],
blob;
if (content.data) {
blob = jIO.util.dataURItoBlob(content.data.url);
content.title = content.data.file_name;
delete content.data;
list = [
gadget.updateDocument(content),
gadget.jio_putAttachment(gadget.state.jio_key, 'data', blob)
];
} else {
list = [gadget.updateDocument(content)];
}
return RSVP.all(list);
})
.push(function () {
return gadget.notifySubmitted({message: 'Data Updated', status: 'success'});
}, function (error) {
if (error.target && error.target.error.name === 'NotReadableError') {
return gadget.notifySubmitted({message: error.target.error.message, status: 'fail'});
}
throw error;
}).push(function () {
return gadget.redirect({
command: 'reload'
});
});
})
.declareMethod("triggerSubmit", function () {
return this.element.querySelector('button[type="submit"]').click();
})
.onStateChange(function () {
var gadget = this;
return gadget.getDeclaredGadget('form_view')
.push(function (form_gadget) {
return form_gadget.render({
erp5_document: {
"_embedded": {
"_view": {
"my_title": {
"description": "",
"title": "Title",
"default": gadget.state.doc.title,
"css_class": "",
"required": 1,
"editable": 1,
"key": "title",
"hidden": 0,
"type": "StringField"
},
"my_file": {
"description": "",
"title": "Upload",
"default": "",
"css_class": "",
"required": 1,
"editable": 1,
"key": "data",
"hidden": 0,
"type": "FileField"
},
"my_content": {
"default": gadget.state.jio_key,
"css_class": "",
"required": 1,
"editable": 0,
"key": "player_content",
"hidden": 0,
"type": "GadgetField",
"renderjs_extra": '{"name": "data"}',
"url": "gadget_custom_player.html",
"sandbox": "public"
}
}
},
"_links": {
"type": {
// form_list display portal_type in header
name: ""
}
}
},
form_definition: {
group_list: [[
"left",
[["my_title"], ["my_file"]]
], [
"bottom",
[["my_content"]]
]]
}
});
})
.push(function () {
return RSVP.all([
gadget.getUrlFor({command: 'history_previous'}),
gadget.getUrlFor({command: 'selection_previous'}),
gadget.getUrlFor({command: 'selection_next'})
]);
})
.push(function (url_list) {
return gadget.updateHeader({
page_title: gadget.state.doc.title,
save_action: true,
selection_url: url_list[0],
previous_url: url_list[1],
next_url: url_list[2]
});
});
});
}(window, jIO, rJS, RSVP));
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>OfficeJS Jio Media Player Document List</title>
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="gadget_erp5_page_ojs_media_player_document_list.js"></script>
</head>
<body>
<div data-gadget-url="gadget_erp5_pt_form_list.html" data-gadget-scope="form_list"></div>
</body>
</html>
/*global window, rJS, RSVP */
/*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS, RSVP) {
"use strict";
rJS(window)
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("getUrlParameter", "getUrlParameter")
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")
.declareAcquiredMethod("getSetting", "getSetting")
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.allowPublicAcquisition("jio_allDocs", function (param_list) {
var gadget = this;
return gadget.jio_allDocs(param_list[0])
.push(function (result) {
var i, date, len = result.data.total_rows;
for (i = 0; i < len; i += 1) {
if (result.data.rows[i].value.hasOwnProperty("modification_date")) {
date = new Date(result.data.rows[i].value.modification_date);
result.data.rows[i].value.modification_date = {
allow_empty_time: 0,
ampm_time_style: 0,
css_class: "date_field",
date_only: 0,
description: "The Date",
editable: 0,
hidden: 0,
hidden_day_is_last_day: 0,
"default": date.toUTCString(),
key: "modification_date",
required: 0,
timezone_style: 0,
title: "Modification Date",
type: "DateTimeField"
};
result.data.rows[i].value["listbox_uid:list"] = {
key: "listbox_uid:list",
value: 2713
};
}
}
return result;
});
})
.allowPublicAcquisition('notifySubmit', function () {
return this.triggerSubmit();
})
.declareMethod("triggerSubmit", function () {
var argument_list = arguments;
return this.getDeclaredGadget('form_list')
.push(function (gadget) {
return gadget.triggerSubmit.apply(gadget, argument_list);
});
})
.declareMethod("render", function () {
var gadget = this;
return new RSVP.Queue()
.push(function () {
return RSVP.all([
gadget.getDeclaredGadget('form_list'),
gadget.getSetting("portal_type")
]);
})
.push(function (result) {
var column_list = [
['title', 'Title'],
['reference', 'Reference'],
['language', 'Language'],
['description', 'Description'],
['version', 'Version'],
['modification_date', 'Modification Date']
];
return result[0].render({
erp5_document: {
"_embedded": {"_view": {
"listbox": {
"column_list": column_list,
"show_anchor": 0,
"default_params": {},
"editable": 1,
"editable_column_list": [],
"key": "field_listbox",
"lines": 30,
"list_method": "portal_catalog",
"query": "urn:jio:allDocs?query=portal_type%3A%22" +
result[1] + "%22",
"portal_type": [],
"search_column_list": column_list,
"sort_column_list": column_list,
"sort": [['modification_date', 'descending']],
"title": "Documents",
"type": "ListBox"
}
}},
"_links": {
"type": {
// form_list display portal_type in header
name: ""
}
}
},
form_definition: {
group_list: [[
"bottom",
[["listbox"]]
]]
}
});
})
.push(function () {
return RSVP.all([
gadget.getUrlFor({command: "change", options: {"page": "ojs_multi_upload"}}),
gadget.getSetting('document_title_plural')
]);
})
.push(function (result) {
return gadget.updateHeader({
page_title: result[1],
filter_action: true,
add_url: result[0]
});
});
});
}(window, rJS, RSVP));
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<title>OfficeJS Text Editor Panel Gadget</title>
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<script src="handlebars.js" type="text/javascript"></script>
<script src="gadget_global.js" type="text/javascript"></script>
<script src="jquery.js" type="text/javascript"></script>
<script src="jquerymobile.js" type="text/javascript"></script>
<script id="panel-template-header" type="text/x-handlebars-template">
<div data-role="header" class="ui-bar-inherit">
<div class="ui-controlgroup ui-controlgroup-horizontal ui-btn-left">
<div class="ui-controlgroup-controls">
<form action="#" method="post">
<input type="submit" data-i18n="[value]Close" data-icon="delete" data-iconpos="notext" value="Close" />
</form>
</div>
</div>
<img class="ui-title" alt="ERP5" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJcAAAA/CAMAAADaDqrIAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoTWFjaW50b3NoKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDowMEM5NUE4MzQ5NjQxMUUzOUZEQUU2NUY1RTI1RjdCQiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDowMEM5NUE4NDQ5NjQxMUUzOUZEQUU2NUY1RTI1RjdCQiI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjAwQzk1QTgxNDk2NDExRTM5RkRBRTY1RjVFMjVGN0JCIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjAwQzk1QTgyNDk2NDExRTM5RkRBRTY1RjVFMjVGN0JCIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+J9MJsAAAAwBQTFRF///////M//+Z//9m//8z//8A/8z//8zM/8yZ/8xm/8wz/8wA/5n//5nM/5mZ/5lm/5kz/5kA/2b//2bM/2aZ/2Zm/2Yz/2YA/zP//zPM/zOZ/zNm/zMz/zMA/wD//wDM/wCZ/wBm/wAz/wAAzP//zP/MzP+ZzP9mzP8zzP8AzMz/zMzMzMyZzMxmzMwzzMwAzJn/zJnMzJmZzJlmzJkzzJkAzGb/zGbMzGaZzGZmzGYzzGYAzDP/zDPMzDOZzDNmzDMzzDMAzAD/zADMzACZzABmzAAzzAAAmf//mf/Mmf+Zmf9mmf8zmf8Amcz/mczMmcyZmcxmmcwzmcwAmZn/mZnMmZmZmZlmmZkzmZkAmWb/mWbMmWaZmWZmmWYzmWYAmTP/mTPMmTOZmTNmmTMzmTMAmQD/mQDMmQCZmQBmmQAzmQAAZv//Zv/MZv+ZZv9mZv8zZv8AZsz/ZszMZsyZZsxmZswzZswAZpn/ZpnMZpmZZplmZpkzZpkAZmb/ZmbMZmaZZmZmZmYzZmYAZjP/ZjPMZjOZZjNmZjMzZjMAZgD/ZgDMZgCZZgBmZgAzZgAAM///M//MM/+ZM/9mM/8zM/8AM8z/M8zMM8yZM8xmM8wzM8wAM5n/M5nMM5mZM5lmM5kzM5kAM2b/M2bMM2aZM2ZmM2YzM2YAMzP/MzPMMzOZMzNmMzMzMzMAMwD/MwDMMwCZMwBmMwAzMwAAAP//AP/MAP+ZAP9mAP8zAP8AAMz/AMzMAMyZAMxmAMwzAMwAAJn/AJnMAJmZAJlmAJkzAJkAAGb/AGbMAGaZAGZmAGYzAGYAADP/ADPMADOZADNmADMzADMAAAD/AADMAACZAABmAAAzAAAAHHa7K3/AOojESZHJWZvNaKTSd63Whrbblb/fpMjks9Howtrt4e320uTx8Pb6AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAdfKHSQAAAOh0Uk5T////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////ALItoLoAAAJkSURBVHja7NlZsqsgEABQ979C5kGGddxo4os0Q8BAynoFn0nUU23TNGRB9xzLdE3XdE3XdP2fLnIzF2VSrsYvC72HizAh9eZ5DVuOl15S4/jWwC+kDC8HPzCSJVHcRY8QXV2PwQuujUYTsYrvYlBv1yKLrsXHsPghnvR3Lazoip/JKuwpF8sm6/bY01Ow9CBlTXi53PNoRcUktEZT1NV1PIPnXAjtMJIMlzerFIzU1dVWF7aPj3Tetae4gjdxktG2et/qQjJ4kZFrv6ED4bK4eR1qduHzvEi4+PbGwD0EGu9CQQLFrv1F4jBc6BcuW3YhkPiPX1hOfxQvnHfh0HVMRqc4HuqiQf5k3mO6dq1s8Hx0H/Le5kq9YaNcxAcrZLpOvAv+ClcgNcZFtnrucd5Fwx4mXj0drnbBYXMuJmFDAV3Uhm4qlbHh3ddOrmholHNxFTVC+xTl2mf6pI4uVe4LwSp0DPGOmh/hAnM94bKZjkHlWuiLeV+cTab4luMKk82wy/Px2fLJskvKUk03hRf9RZ0wiYiZ4uVwVwTb9E71y0XboTYXGuTaa33Y47W5zBjXM3P11y7TfR2ycFdxyaW7uwSc5m0un9ix91m3TWJfW+1ijfW+wcVAfjS5dOP62LyvZZdcLHnA1MkFAtbgwq+Vm47po8OA1buwyy/a1ec5urzveAes2sV8kfW963mFaHNhlT0b6+Yi5+StchH1CtaK0ThXELDPLiyOPZHldzm/J1z9O/B14g7/K+DtkP7U8ivSeD4xaPCTSQvy+YIfubZWzRgtRe1iMP+3mq7pmq7p6jv+BBgAPrgi/TzwWzkAAAAASUVORK5CYII="/>
<div class="ui-controlgroup ui-controlgroup-horizontal ui-btn-right">
<div class="ui-controlgroup-controls">
<a href="#" class="ui-btn ui-btn-icon-notext ui-icon-home" data-i18n="Home">Home</a>
</div>
</div>
</div>
</script>
<script id="panel-template-body" type="text/x-handlebars-template">
<div class="ui-content">
<ul data-role="listview" class="ui-listview">
<li><a href="#page=document_list" data-i18n="Document List">Document List</a></li>
<li><a href="#page=jio_configurator" data-i18n="Storage Configuration">Storage Configuration</a></li>
<li><a href="#page=sync&auto_repair=true" data-i18n="Synchronization">Synchronization</a></li>
<!-- Show crib edition control comment
<li><a href="https://www.cribjs.com/#page=jio_crib_configurator&application_name={{app_name}}&communication_gadget={{location}}gadget_officejs_liberator.html" data-i18n="Edit Me">Edit Me</a></li>
-->
</ul>
</div>
</script>
<!-- custom script -->
<script src="gadget_officejs_application_panel.js" type="text/javascript"></script>
</head>
<body>
<div class="jqm-navmenu-panel"></div>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<title>OfficeJS Media Player Router Gadget</title>
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<!-- custom script -->
<script src="gadget_officejs_router.js" type="text/javascript"></script>
</head>
<body>
<script data-renderjs-configuration="portal_type" type="text/x-renderjs-configuration">Sound</script>
<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="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>
</html>
\ No newline at end of file
...@@ -12,6 +12,7 @@ web_page_module/jio_* ...@@ -12,6 +12,7 @@ web_page_module/jio_*
web_page_module/officejs_audioplayer_* web_page_module/officejs_audioplayer_*
web_page_module/officejs_todomvc_* web_page_module/officejs_todomvc_*
web_page_module/ojs_* web_page_module/ojs_*
web_site_module/officejs_media_player
web_page_module/wallsearch_privacy_policy_html web_page_module/wallsearch_privacy_policy_html
web_site_module/officejs_audioplayer web_site_module/officejs_audioplayer
web_site_module/officejs_audioplayer/** web_site_module/officejs_audioplayer/**
...@@ -35,4 +36,5 @@ web_site_module/officejs_wallsearch ...@@ -35,4 +36,5 @@ web_site_module/officejs_wallsearch
web_site_module/officejs_wallsearch/** web_site_module/officejs_wallsearch/**
web_site_module/officejs_whiteboard web_site_module/officejs_whiteboard
web_site_module/officejsoldv1 web_site_module/officejsoldv1
web_site_module/officejsoldv1/** web_site_module/officejsoldv1/**
\ No newline at end of file web_site_module/officejs_media_player/**
\ No newline at end of file
...@@ -7,6 +7,7 @@ image_module/wallsearch_icon_svg ...@@ -7,6 +7,7 @@ image_module/wallsearch_icon_svg
web_page_module/dhtmlx_gantt_* web_page_module/dhtmlx_gantt_*
web_page_module/fb_sdk_js web_page_module/fb_sdk_js
web_page_module/gadget_field_* web_page_module/gadget_field_*
web_site_module/officejs_media_player
web_page_module/gadget_officejs_* web_page_module/gadget_officejs_*
web_page_module/jio_* web_page_module/jio_*
web_page_module/officejs_audioplayer_* web_page_module/officejs_audioplayer_*
...@@ -35,4 +36,5 @@ web_site_module/officejs_wallsearch ...@@ -35,4 +36,5 @@ web_site_module/officejs_wallsearch
web_site_module/officejs_wallsearch/** web_site_module/officejs_wallsearch/**
web_site_module/officejs_whiteboard web_site_module/officejs_whiteboard
web_site_module/officejsoldv1 web_site_module/officejsoldv1
web_site_module/officejsoldv1/** web_site_module/officejsoldv1/**
\ No newline at end of file web_site_module/officejs_media_player/**
\ No newline at end of file
...@@ -24,6 +24,8 @@ web_site_module/officejs_cribjs/** ...@@ -24,6 +24,8 @@ web_site_module/officejs_cribjs/**
web_site_module/officejs_drive_app web_site_module/officejs_drive_app
web_site_module/officejs_drive_app/** web_site_module/officejs_drive_app/**
web_site_module/officejs_export web_site_module/officejs_export
web_site_module/officejs_media_player
web_site_module/officejs_media_player/**
web_site_module/officejs_pdf_viewer web_site_module/officejs_pdf_viewer
web_site_module/officejs_pdf_viewer/** web_site_module/officejs_pdf_viewer/**
web_site_module/officejs_svg_editor web_site_module/officejs_svg_editor
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_jio_view</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_jio_view</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>jio_view</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Action Information</string> </value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>35.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>View</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/Sound_viewAsJio</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -5,6 +5,7 @@ PDF | jio_view ...@@ -5,6 +5,7 @@ PDF | jio_view
Presentation | jio_data Presentation | jio_data
Presentation | jio_view Presentation | jio_view
Presentation | jio_view_attachment Presentation | jio_view_attachment
Sound | jio_view
Spreadsheet | jio_data Spreadsheet | jio_data
Spreadsheet | jio_view Spreadsheet | jio_view
Spreadsheet | jio_view_attachment Spreadsheet | jio_view_attachment
......
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