From 6ba1d6f0358d75ecc7b4fc3a1064056c7134c8ae Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 10 Sep 2014 23:30:18 +0200 Subject: [PATCH] WEBUI JS: Fix rendering of weekdays in autorec --- src/webui/static/app/dvr.js | 30 +++++++++++++++++++++++++++++- src/webui/static/app/idnode.js | 8 +++----- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/src/webui/static/app/dvr.js b/src/webui/static/app/dvr.js index 3039e390..fba84b6c 100644 --- a/src/webui/static/app/dvr.js +++ b/src/webui/static/app/dvr.js @@ -354,8 +354,36 @@ tvheadend.autorec_editor = function(panel, index) { del: true, list: 'enabled,title,channel,tag,content_type,minduration,' + 'maxduration,weekdays,start,pri,config_name,creator,comment', + columns: { + weekdays: { + renderer: function(st) { + return function(v) { + var t = []; + var d = v.push ? v : [v]; + if (d.length == 7) { + v = "All days"; + } else if (d.length == 0) { + v = "No days"; + } else { + for (var i = 0; i < d.length; i++) { + var r = st.find('key', d[i]); + if (r !== -1) { + var nv = st.getAt(r).get('val'); + if (nv) + t.push(nv); + } else { + t.push(d[i]); + } + } + v = t.join(','); + } + return v; + } + } + } + }, sort: { - field: 'name', + field: 'title', direction: 'ASC' }, help: function() { diff --git a/src/webui/static/app/idnode.js b/src/webui/static/app/idnode.js index 89d3a6c0..175d7581 100644 --- a/src/webui/static/app/idnode.js +++ b/src/webui/static/app/idnode.js @@ -134,7 +134,6 @@ tvheadend.IdNodeField = function(conf) */ this.onrefresh = function(callback) { - this.rcallback = callback; var st = this.store; if (st && st instanceof Ext.data.JsonStore) st.on('load', callback); @@ -175,7 +174,7 @@ tvheadend.IdNodeField = function(conf) dataIndex: this.id, header: this.text, editor: this.editor({create: false}), - renderer: cfg.renderer ? cfg.renderer() : this.renderer(), + renderer: cfg.renderer ? cfg.renderer(this.store) : this.renderer(this.store), editable: !this.rdonly, hidden: this.hidden, filter: { @@ -194,7 +193,7 @@ tvheadend.IdNodeField = function(conf) return props; }; - this.renderer = function() + this.renderer = function(st) { if (this.password) return function(v) { @@ -224,10 +223,9 @@ tvheadend.IdNodeField = function(conf) } } - if (!this.store) + if (!st) return null; - var st = this.store; return function(v) { if (st && st instanceof Ext.data.JsonStore) { var t = [];