From 8aa7cb83a20a5a36da0f83cb4cf61f0b51c5d26f Mon Sep 17 00:00:00 2001 From: Ian Date: Wed, 11 Jun 2014 15:54:50 +0100 Subject: [PATCH] WebUI: Duration filter - improved validation on autorec grid --- src/webui/static/app/dvr.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/webui/static/app/dvr.js b/src/webui/static/app/dvr.js index 2a89216f..71d273bf 100644 --- a/src/webui/static/app/dvr.js +++ b/src/webui/static/app/dvr.js @@ -517,8 +517,21 @@ 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 + + /* + * Workaround for extJS passing the display value instead of the raw value. + * + * Simply, see if we can find the value in the store label fields - if we can, + * over-write the passed (display) value with the lookup (raw) value. If we + * can't, we were passed a raw seconds value, so stick with that. + */ + + var index = tvheadend.DurationStore.find('label', thisvalue); + + if (index !== -1) + thisvalue = tvheadend.DurationStore.getById(index).data.value; + + // Return if otherfield isn't set yet if (!othervalue) return true; // Return if we've changed min and it's <= existing max @@ -526,6 +539,7 @@ Ext.apply(Ext.form.VTypes, { // 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' });