Commit d3cc385e authored by Mukul's avatar Mukul

[erp5_officejs][erp5_web_renderjs_ui] Adds random play feature in officejs media player.

parent 94df7891
...@@ -72,7 +72,10 @@ ...@@ -72,7 +72,10 @@
} }
jio_options = { jio_options = {
type: 'dateupdater', type: 'dateupdater',
sub_storage: jio_options, sub_storage: {
type: 'random',
sub_storage: jio_options
},
property_list: ['modification_date'] property_list: ['modification_date']
}; };
try { try {
......
...@@ -222,7 +222,7 @@ ...@@ -222,7 +222,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>vincent</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -236,7 +236,7 @@ ...@@ -236,7 +236,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>962.36985.29761.10359</string> </value> <value> <string>966.54536.8656.36676</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -254,7 +254,7 @@ ...@@ -254,7 +254,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1507216488.77</float> <float>1524152028.08</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
.declareAcquiredMethod("getUrlFor", "getUrlFor") .declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("jio_allDocs", "jio_allDocs") .declareAcquiredMethod("jio_allDocs", "jio_allDocs")
.declareAcquiredMethod("getSetting", "getSetting") .declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod('redirect', 'redirect')
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// declared methods // declared methods
...@@ -83,6 +84,15 @@ ...@@ -83,6 +84,15 @@
['description', 'Description'], ['description', 'Description'],
['version', 'Version'], ['version', 'Version'],
['modification_date', 'Modification Date'] ['modification_date', 'Modification Date']
],
sort_list = [
['title', 'Title'],
['reference', 'Reference'],
['language', 'Language'],
['description', 'Description'],
['version', 'Version'],
['modification_date', 'Modification Date'],
['random', 'Random']
]; ];
return result[0].render({ return result[0].render({
erp5_document: { erp5_document: {
...@@ -100,7 +110,7 @@ ...@@ -100,7 +110,7 @@
result[1] + "%22", result[1] + "%22",
"portal_type": [], "portal_type": [],
"search_column_list": column_list, "search_column_list": column_list,
"sort_column_list": column_list, "sort_column_list": sort_list,
"sort": [['modification_date', 'descending']], "sort": [['modification_date', 'descending']],
"title": "Documents", "title": "Documents",
"type": "ListBox" "type": "ListBox"
......
...@@ -273,7 +273,7 @@ ...@@ -273,7 +273,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>966.44404.50238.55500</string> </value> <value> <string>967.4474.3819.63505</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -291,7 +291,7 @@ ...@@ -291,7 +291,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1523022279.07</float> <float>1524558413.59</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -10056,6 +10056,78 @@ return new Parser; ...@@ -10056,6 +10056,78 @@ return new Parser;
jIO.addStorage('uuid', UUIDStorage); jIO.addStorage('uuid', UUIDStorage);
}(jIO));
;/*jslint nomen: true*/
(function (jIO) {
"use strict";
/**
* The jIO RandomStorage extension
*
* @class RandomStorage
* @constructor
*/
function RandomStorage(spec) {
this._sub_storage = jIO.createJIO(spec.sub_storage);
}
RandomStorage.prototype.get = function () {
return this._sub_storage.get.apply(this._sub_storage, arguments);
};
RandomStorage.prototype.allAttachments = function () {
return this._sub_storage.allAttachments.apply(this._sub_storage, arguments);
};
RandomStorage.prototype.post = function () {
return this._sub_storage.post.apply(this._sub_storage, arguments);
};
RandomStorage.prototype.put = function () {
return this._sub_storage.put.apply(this._sub_storage, arguments);
};
RandomStorage.prototype.remove = function () {
return this._sub_storage.remove.apply(this._sub_storage, arguments);
};
RandomStorage.prototype.getAttachment = function () {
return this._sub_storage.getAttachment.apply(this._sub_storage, arguments);
};
RandomStorage.prototype.putAttachment = function () {
return this._sub_storage.putAttachment.apply(this._sub_storage, arguments);
};
RandomStorage.prototype.removeAttachment = function () {
return this._sub_storage.removeAttachment.apply(this._sub_storage,
arguments);
};
RandomStorage.prototype.hasCapacity = function (name) {
return this._sub_storage.hasCapacity(name);
};
RandomStorage.prototype.buildQuery = function (options) {
if (options.sort_on[0][0] === 'random') {
var limit = options.limit;
delete options.limit;
}
return this._sub_storage.buildQuery.apply(this._sub_storage,
arguments)
.push(function (result) {
// Random shuffle the result when random is present in the options.
if (options.sort_on[0][0] === 'random') {
var final_result = [],
random_number;
while (limit[1] && result.length - limit[0]) {
random_number = Math.floor(Math.random() * result.length);
random_number = random_number === result.length ? result.length - 1 : random_number;
final_result.push(result.splice(random_number, 1)[0]);
limit[1] -= 1;
}
return final_result;
}
return result;
});
};
jIO.addStorage('random', RandomStorage);
}(jIO)); }(jIO));
;/* ;/*
* Copyright 2013, Nexedi SA * Copyright 2013, Nexedi SA
......
...@@ -236,7 +236,7 @@ ...@@ -236,7 +236,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>966.12481.11377.36966</string> </value> <value> <string>967.4461.64143.42632</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -254,7 +254,7 @@ ...@@ -254,7 +254,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1522845747.33</float> <float>1524557708.76</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </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