From c3a3dfef98ee729300152ff32419d55cee3231e4 Mon Sep 17 00:00:00 2001 From: Ian Date: Tue, 10 Jun 2014 19:01:22 +0100 Subject: [PATCH] WebUI: Grid validation on programme duration filtering --- src/webui/static/app/dvr.js | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/src/webui/static/app/dvr.js b/src/webui/static/app/dvr.js index 7668ff99..6327fa09 100644 --- a/src/webui/static/app/dvr.js +++ b/src/webui/static/app/dvr.js @@ -510,6 +510,27 @@ tvheadend.dvrschedule = function(title, iconCls, dvrStore) { /** * */ +//IH -------- + +// Validation function for min/max duration in autorec grid + +Ext.apply(Ext.form.VTypes, { + durations: function(val,field) { + var thisvalue = field.getValue(); + var othervalue = Ext.getCmp(field.otherfield).getValue(); + + // Return if otherfield isn't set yet + if (!othervalue) return true; + + // Return if we've changed min and it's <= existing max + if (field.id == 'minfield' && thisvalue <= othervalue) return true; + + // Return if we've changed max and it's >= existing min + if (field.id == 'maxfield' && thisvalue >= othervalue) return true; + }, + durationsText: 'Minimum duration must be more than the maximum' +}); +//------------ /** * @@ -607,6 +628,11 @@ tvheadend.autoreceditor = function() { displayField: 'label', editable: false, triggerAction: 'all', + //IH ------------------ + id: 'minfield', + otherfield: 'maxfield', + vtype: 'durations' + // -------------------- }) }, { @@ -622,7 +648,12 @@ tvheadend.autoreceditor = function() { valueField: 'value', displayField: 'label', editable: false, - triggerAction: 'all' + triggerAction: 'all', + //IH ---------------------- + id: 'maxfield', + otherfield: 'minfield', + vtype: 'durations' + // ------------------------ }) }, // @@ -726,6 +757,8 @@ tvheadend.autoreceditor = function() { tvheadend.autorecRecord, [], tvheadend.autorecStore, 'autorec.html', 'wand'); }; +// ------------------------------- + /** * */