Skip to content

Commit da1ac73

Browse files
DeltaMikeCharlieFlole998
authored andcommitted
Global setting for 'Items per page'
1 parent 0eea8a5 commit da1ac73

9 files changed

Lines changed: 49 additions & 3 deletions

File tree

‎docs/property/page_size.md‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
:
2+
3+
Option | Description
4+
-----------------|------------
5+
**25** | List 25 items per page.
6+
**50** | List 50 items per page.
7+
**100** | List 100 items per page.
8+
**200** | List 200 items per page.
9+
**All** | List all items on a single page.
10+
11+
This setting can be overridden on a page-by-page basis using the drop-down box.

‎src/access.c‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,6 +1507,19 @@ theme_get_ui_list ( void *p, const char *lang )
15071507
return strtab2htsmsg_str(tab, 1, lang);
15081508
}
15091509

1510+
htsmsg_t *
1511+
page_size_get_ui_list ( void *p, const char *lang )
1512+
{
1513+
static struct strtab tab[] = {
1514+
{ "25", 25 },
1515+
{ "50", 50 },
1516+
{ "100", 100 },
1517+
{ "200", 200 },
1518+
{ N_("All"), 999999999 },
1519+
};
1520+
return strtab2htsmsg(tab, 1, lang);
1521+
}
1522+
15101523
static idnode_slist_t access_entry_class_change_slist[] = {
15111524
{
15121525
.id = "change_rights",

‎src/access.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ void access_done(void);
366366
htsmsg_t *language_get_list ( void *obj, const char *lang );
367367
htsmsg_t *language_get_ui_list ( void *obj, const char *lang );
368368
htsmsg_t *theme_get_ui_list ( void *obj, const char *lang );
369+
htsmsg_t *page_size_get_ui_list ( void *obj, const char *lang );
369370
htsmsg_t *user_get_userlist ( void *obj, const char *lang );
370371

371372
#endif /* ACCESS_H_ */

‎src/config.c‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1780,6 +1780,7 @@ config_boot
17801780
config.hdhomerun_ip = strdup("");
17811781
config.local_ip = strdup("");
17821782
config.local_port = 0;
1783+
config.page_size_ui = 50;
17831784

17841785
/* Generate default */
17851786
if (!path)
@@ -2164,6 +2165,7 @@ PROP_DOC(config_picon_path)
21642165
PROP_DOC(config_picon_servicetype)
21652166
PROP_DOC(viewlevel_config)
21662167
PROP_DOC(themes)
2168+
PROP_DOC(page_size)
21672169

21682170
const idclass_t config_class = {
21692171
.ic_snode = &config.idnode,
@@ -2259,6 +2261,17 @@ const idclass_t config_class = {
22592261
.opts = PO_DOC_NLIST,
22602262
.group = 2
22612263
},
2264+
{
2265+
.type = PT_U32,
2266+
.id = "page_size_ui",
2267+
.name = N_("Items per page"),
2268+
.desc = N_("The default web interface items per page."),
2269+
.doc = prop_doc_page_size,
2270+
.list = page_size_get_ui_list,
2271+
.off = offsetof(config_t, page_size_ui),
2272+
.opts = PO_DOC_NLIST,
2273+
.group = 2
2274+
},
22622275
{
22632276
.type = PT_BOOL,
22642277
.id = "ui_quicktips",

‎src/config.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ typedef struct config {
8383
#if ENABLE_VAAPI
8484
int enable_vainfo;
8585
#endif
86+
uint32_t page_size_ui;
8687
} config_t;
8788

8889
extern const idclass_t config_class;

‎src/webui/comet.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ comet_access_update(http_connection_t *hc, comet_mailbox_t *cmb)
180180
}
181181
}
182182
htsmsg_add_str(m, "theme", access_get_theme(hc->hc_access));
183+
htsmsg_add_u32(m, "page_size", config.page_size_ui);
183184
htsmsg_add_u32(m, "quicktips", config.ui_quicktips);
184185
htsmsg_add_u32(m, "chname_num", config.chname_num);
185186
htsmsg_add_u32(m, "chname_src", config.chname_src);

‎src/webui/static/app/config.js‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ tvheadend.baseconf = function(panel, index) {
4444
var n = data['theme_ui'];
4545
if (n !== tvheadend.theme)
4646
reload = 1;
47-
var n = data['uilevel_nochange'] ? true : false;
47+
var n = data['page_size_ui'];
48+
if (n !== tvheadend.page_size)
49+
reload = 1;
50+
var n = data['uilevel_nochange'] ? true : false;
4851
if (n !== tvheadend.uilevel_nochange)
4952
reload = 1;
5053
var n = data['ui_quicktips'] ? true : false;

‎src/webui/static/app/idnode.js‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1741,6 +1741,8 @@ tvheadend.idnode_grid = function(panel, conf)
17411741
if (conf.all) params['all'] = 1;
17421742
if (conf.extraParams) conf.extraParams(params);
17431743

1744+
if(!params['limit']) params['limit'] = tvheadend.page_size;
1745+
17441746
groupReader = new Ext.data.JsonReader({
17451747
totalProperty: 'total',
17461748
root: 'entries',
@@ -2036,7 +2038,7 @@ tvheadend.idnode_grid = function(panel, conf)
20362038
data: [[25, '25'], [50, '50'], [100, '100'],
20372039
[200, '200'], [999999999, _('All')]]
20382040
}),
2039-
value: 50,
2041+
value: tvheadend.page_size,
20402042
mode: 'local',
20412043
forceSelection: false,
20422044
triggerAction: 'all',

‎src/webui/static/app/tvheadend.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ tvheadend.loading = function(on) {
694694
tvheadend.PagingToolbarConf = function(conf, title, auto, count)
695695
{
696696
conf.width = 50;
697-
conf.pageSize = 50;
697+
conf.pageSize = tvheadend.page_size;
698698
conf.displayInfo = true;
699699
/// {0} start, {1} end, {2} total, {3} title
700700
conf.displayMsg = _('{3} {0} - {1} of {2}').replace('{3}', title);
@@ -1024,6 +1024,7 @@ function accessUpdate(o) {
10241024
tvheadend.chname_src = o.chname_src ? 1 : 0;
10251025
tvheadend.date_mask = o.date_mask;
10261026
tvheadend.label_formatting = o.label_formatting ? true : false;
1027+
tvheadend.page_size = o.page_size;
10271028

10281029
if (o.uilevel_nochange)
10291030
tvheadend.uilevel_nochange = true;

0 commit comments

Comments
 (0)