Commit 80430d20 authored by Romain Courteaud's avatar Romain Courteaud

romain_dev: forum link to last page

parent d5d0219d
...@@ -10,7 +10,9 @@ ...@@ -10,7 +10,9 @@
var DISPLAY_READER = 'display_reader', var DISPLAY_READER = 'display_reader',
DISPLAY_THREAD = 'display_thread', DISPLAY_THREAD = 'display_thread',
DISPLAY_POST = 'display_post', DISPLAY_POST = 'display_post',
MAIN_SCOPE = 'child_scope'; MAIN_SCOPE = 'child_scope',
DISPLAYED_POST_COUNT = 15,
THREAD_READER_FIELD_KEY = 'field_listbox';
function loadChildGadget(gadget, gadget_url, must_declare, callback) { function loadChildGadget(gadget, gadget_url, must_declare, callback) {
var queue, var queue,
...@@ -151,8 +153,8 @@ ...@@ -151,8 +153,8 @@
"default_params": {}, "default_params": {},
"editable": 1, "editable": 1,
"editable_column_list": [], "editable_column_list": [],
"key": "field_nutnut", "key": THREAD_READER_FIELD_KEY,
"lines": 15, "lines": DISPLAYED_POST_COUNT,
"list_method": "portal_catalog", "list_method": "portal_catalog",
"query": "urn:jio:allDocs?query=" + Query.objectToSearchText( "query": "urn:jio:allDocs?query=" + Query.objectToSearchText(
new ComplexQuery({ new ComplexQuery({
...@@ -205,8 +207,8 @@ ...@@ -205,8 +207,8 @@
type: "complex" type: "complex"
}) })
), ),
sort: [['modification_date', 'ASC']], sort: [['modification_date', 'ASC'], ['uid', 'ASC']],
lines: 15, lines: DISPLAYED_POST_COUNT,
}), }),
"hidden": 0 "hidden": 0
}; };
...@@ -510,7 +512,8 @@ ...@@ -510,7 +512,8 @@
var i, date, var i, date,
len = result.data.total_rows, len = result.data.total_rows,
key, key,
url_value; url_value,
last_url_value;
for (i = 0; i < len; i += 1) { for (i = 0; i < len; i += 1) {
url_value = { url_value = {
command: 'index', command: 'index',
...@@ -519,6 +522,16 @@ ...@@ -519,6 +522,16 @@
page: gadget.state.page page: gadget.state.page
} }
}; };
last_url_value = {
command: 'index',
options: {
jio_key: result.data.rows[i].id,
page: gadget.state.page,
}
};
last_url_value.options[THREAD_READER_FIELD_KEY + '_begin_from'] =
result.data.rows[i].value.DiscussionThread_getDiscussionPostCount -
(result.data.rows[i].value.DiscussionThread_getDiscussionPostCount % DISPLAYED_POST_COUNT);
for (key in result.data.rows[i].value) { for (key in result.data.rows[i].value) {
if (result.data.rows[i].value.hasOwnProperty(key)) { if (result.data.rows[i].value.hasOwnProperty(key)) {
...@@ -531,6 +544,8 @@ ...@@ -531,6 +544,8 @@
if (result.data.rows[i].value.hasOwnProperty("modification_date")) { if (result.data.rows[i].value.hasOwnProperty("modification_date")) {
date = new Date(result.data.rows[i].value.modification_date.default); date = new Date(result.data.rows[i].value.modification_date.default);
console.log(last_url_value);
result.data.rows[i].value.modification_date.url_value = last_url_value;
result.data.rows[i].value.modification_date.field_gadget_param = { result.data.rows[i].value.modification_date.field_gadget_param = {
allow_empty_time: 0, allow_empty_time: 0,
ampm_time_style: 0, ampm_time_style: 0,
......
...@@ -240,7 +240,7 @@ ...@@ -240,7 +240,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>989.21920.50173.26606</string> </value> <value> <string>989.23331.40399.10871</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -258,7 +258,7 @@ ...@@ -258,7 +258,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1610644020.77</float> <float>1610728771.86</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -281,7 +281,7 @@ ...@@ -281,7 +281,7 @@
limit: limit_options, limit: limit_options,
select_list: ['asStrippedHTML', 'modification_date', select_list: ['asStrippedHTML', 'modification_date',
'source_title'], 'source_title'],
sort_on: [['modification_date', 'ASC']] sort_on: [['modification_date', 'ASC'], ['uid', 'ASC']]
}) })
.push(function (result) { .push(function (result) {
return gadget.changeState({ return gadget.changeState({
......
...@@ -240,7 +240,7 @@ ...@@ -240,7 +240,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>989.23313.43269.31948</string> </value> <value> <string>989.23313.49582.17834</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -258,7 +258,7 @@ ...@@ -258,7 +258,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1610727465.34</float> <float>1610727867.53</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