webui: implement filter-specific clear options into autorec grid plus combo cosmetics

This commit is contained in:
Ian 2014-06-29 18:08:40 +01:00
parent a7c304a443
commit 88279741c9
3 changed files with 52 additions and 52 deletions

View file

@ -2,10 +2,8 @@
* Channel tags * Channel tags
*/ */
insertChannelTagsClearOption = function( scope, records, options ){ insertChannelTagsClearOption = function( scope, records, options ){
var placeholder = scope.getAt(1); //create a 'template' copy of an existing record var placeholder = Ext.data.Record.create(['identifier', 'name']);
placeholder.set('identifier',-1); scope.insert(0,new placeholder({identifier: '-1', name: '(Clear filter)'}));
placeholder.set('name',"(Clear filter)");
scope.insert(0, placeholder);
}; };
tvheadend.channelTags = new Ext.data.JsonStore({ tvheadend.channelTags = new Ext.data.JsonStore({
@ -37,10 +35,8 @@ tvheadend.channelrec = new Ext.data.Record.create(
'epg_post_end', 'number']); 'epg_post_end', 'number']);
insertChannelClearOption = function( scope, records, options ){ insertChannelClearOption = function( scope, records, options ){
var placeholder = scope.getAt(1); //create a 'template' copy of an existing record var placeholder = Ext.data.Record.create(['key', 'val']);
placeholder.set('key',-1); scope.insert(0,new placeholder({key: '-1', val: '(Clear filter)'}));
placeholder.set('val',"(Clear filter)");
scope.insert(0, placeholder);
}; };
tvheadend.channels = new Ext.data.JsonStore({ tvheadend.channels = new Ext.data.JsonStore({

View file

@ -539,7 +539,9 @@ tvheadend.autoreceditor = function() {
valueField: 'key', valueField: 'key',
store: tvheadend.channels, store: tvheadend.channels,
mode: 'local', mode: 'local',
editable: false, editable: true,
forceSelection: true,
typeAhead: true,
triggerAction: 'all', triggerAction: 'all',
emptyText: 'Only include channel...' emptyText: 'Only include channel...'
}), }),
@ -561,7 +563,9 @@ tvheadend.autoreceditor = function() {
displayField: 'name', displayField: 'name',
store: tvheadend.channelTags, store: tvheadend.channelTags,
mode: 'local', mode: 'local',
editable: false, editable: true,
forceSelection: true,
typeAhead: true,
triggerAction: 'all', triggerAction: 'all',
emptyText: 'Only include tag...' emptyText: 'Only include tag...'
}) })
@ -577,7 +581,9 @@ tvheadend.autoreceditor = function() {
displayField: 'name', displayField: 'name',
store: tvheadend.ContentGroupStore, store: tvheadend.ContentGroupStore,
mode: 'local', mode: 'local',
editable: false, editable: true,
forceSelection: true,
typeAhead: true,
triggerAction: 'all', triggerAction: 'all',
emptyText: 'Only include content...' emptyText: 'Only include content...'
}) })
@ -593,7 +599,9 @@ tvheadend.autoreceditor = function() {
mode: 'local', mode: 'local',
valueField: 'minvalue', valueField: 'minvalue',
displayField: 'label', displayField: 'label',
editable: false, editable: true,
forceSelection: true,
typeAhead: true,
triggerAction: 'all', triggerAction: 'all',
id: 'minfield' id: 'minfield'
}) })
@ -695,8 +703,8 @@ tvheadend.autoreceditor = function() {
}]}); }]});
tvheadend.autorecStore.on('update', function (store, record, operation) { tvheadend.autorecStore.on('update', function (store, record, operation) {
if (operation == 'edit' && record.isModified('minduration')) { if (operation == 'edit') {
if (record.isModified('minduration')) {
if (record.data.minduration == "") if (record.data.minduration == "")
record.set('maxduration',""); record.set('maxduration',"");
else { else {
@ -706,6 +714,16 @@ tvheadend.autoreceditor = function() {
record.set('maxduration', tvheadend.DurationStore.getById(index).data.maxvalue); record.set('maxduration', tvheadend.DurationStore.getById(index).data.maxvalue);
} }
} }
if (record.isModified('channel') && record.data.channel == -1)
record.set('channel',"");
if (record.isModified('tag') && record.data.tag == '(Clear filter)')
record.set('tag',"");
if (record.isModified('contenttype') && record.data.contenttype == -1)
record.set('contenttype',"");
}
}); });
return new tvheadend.tableEditor('Automatic Recorder', 'autorec', cm, return new tvheadend.tableEditor('Automatic Recorder', 'autorec', cm,

View file

@ -9,10 +9,8 @@ tvheadend.brands = new Ext.data.JsonStore({
}); });
insertContentGroupClearOption = function( scope, records, options ){ insertContentGroupClearOption = function( scope, records, options ){
var placeholder = scope.getAt(1); //create a 'template' copy of an existing record var placeholder = Ext.data.Record.create(['code', 'name']);
placeholder.set('code',-1); scope.insert(0,new placeholder({code: '-1', name: '(Clear filter)'}));
placeholder.set('name',"(Clear filter)");
scope.insert(0, placeholder);
}; };
//WIBNI: might want this store to periodically update //WIBNI: might want this store to periodically update
@ -72,11 +70,9 @@ tvheadend.DurationStore = new Ext.data.SimpleStore({
tvheadend.durationLookupRange = function(value) { tvheadend.durationLookupRange = function(value) {
durationString = ""; durationString = "";
var index = tvheadend.DurationStore.find('minvalue', value); var index = tvheadend.DurationStore.find('minvalue', value);
if (index !== -1) if (index !== -1)
var durationString = tvheadend.DurationStore.getById(index).data.label; var durationString = tvheadend.DurationStore.getAt(index).data.label;
return durationString; return durationString;
}; };
@ -430,7 +426,6 @@ tvheadend.epg = function() {
editable: true, editable: true,
forceSelection: true, forceSelection: true,
triggerAction: 'all', triggerAction: 'all',
forceSelection: true,
typeAhead: true, typeAhead: true,
emptyText: 'Filter channel...', emptyText: 'Filter channel...',
listeners: { listeners: {
@ -453,7 +448,6 @@ tvheadend.epg = function() {
editable: true, editable: true,
forceSelection: true, forceSelection: true,
triggerAction: 'all', triggerAction: 'all',
forceSelection: true,
typeAhead: true, typeAhead: true,
emptyText: 'Filter tag...', emptyText: 'Filter tag...',
listeners: { listeners: {
@ -478,7 +472,6 @@ tvheadend.epg = function() {
editable: true, editable: true,
forceSelection: true, forceSelection: true,
triggerAction: 'all', triggerAction: 'all',
forceSelection: true,
typeAhead: true, typeAhead: true,
emptyText: 'Filter content type...', emptyText: 'Filter content type...',
listeners: { listeners: {
@ -500,7 +493,6 @@ tvheadend.epg = function() {
editable: true, editable: true,
forceSelection: true, forceSelection: true,
triggerAction: 'all', triggerAction: 'all',
forceSelection: true,
typeAhead: true, typeAhead: true,
emptyText: 'Filter duration...', emptyText: 'Filter duration...',
listeners: { listeners: {
@ -573,12 +565,6 @@ tvheadend.epg = function() {
epgStore.reload(); epgStore.reload();
}); });
//IH
// TODO - check what gets saved and where, and how we filter out null tages - may happen automatically because there's
// already a null tag. I think this only applies to tags, as they're saved to config
//
// Also, check that the insert method is genuinely inserting and not over-writing the first record.
epgFilterContentGroup.on('select', function(c, r) { epgFilterContentGroup.on('select', function(c, r) {
if (r.data.code == -1) if (r.data.code == -1)
clearContentGroupFilter(); clearContentGroupFilter();