var uuids = [];
for (var i = 0; i < r.length; i++)
uuids.push(r[i].id);
- tvheadend.Ajax({
+ tvheadend.AjaxConfirm({
url: 'api/dvr/entry/cancel',
params: {
uuid: Ext.encode(uuids)
},
success: function(d) {
store.reload();
- }
+ },
+ question: 'Do you really want to abort/unschedule the selection?'
});
}
}
var uuids = [];
for (var i = 0; i < r.length; i++)
uuids.push(r[i].id);
- tvheadend.Ajax({
+ tvheadend.AjaxConfirm({
url: 'api/idnode/delete',
params: {
uuid: Ext.encode(uuids)
var abuttons = {};
var plugins = conf.plugins || [];
var current = null;
+ var selectuuid = null;
/* Store */
store = new Ext.data.JsonStore({
}
});
- store.on('load', function(st) {
- if (!current)
- grid.getSelectionModel().selectFirstRow();
+ store.on('load', function(records) {
+ var s = false;
+ if (selectuuid) {
+ records.each(function(r) {
+ if (r.id === selectuuid) {
+ select.selectRecords([r]);
+ s = true;
+ }
+ });
+ selectuuid = null;
+ } else if (!current && !select.getSelected())
+ select.selectFirstRow();
});
/* Model */
node: Ext.encode(node)
},
success: function() {
- store.reload()
+ selectuuid = current.uuid;
+ roweditor_destroy();
+ store.reload();
}
});
}
disabled: true,
handler: function() {
if (current) {
- tvheadend.Ajax({
+ tvheadend.AjaxConfirm({
url: 'api/idnode/delete',
params: {
uuid: current.uuid
},
- success: function(d)
- {
+ success: function(d) {
+ roweditor_destroy();
store.reload();
- grid.getSelectionModel().selectFirstRow();
}
});
}
});
}
+ function roweditor_destroy() {
+ if (current)
+ mpanel.remove(current.editor);
+ current = null;
+ }
+
function roweditor(r) {
if (!r || !r.id)
return;
+ if (current && current.uuid == r.id)
+ return;
tvheadend.Ajax({
url: 'api/idnode/load',
params: {
},
success: function(d) {
d = json_decode(d);
- if (current)
- mpanel.remove(current.editor);
+ roweditor_destroy();
var editor = new tvheadend.idnode_editor(d[0], {
title: 'Parameters',
labelWidth: 300,
render : {
fn : function() {
if (!current)
- grid.getSelectionModel().selectFirstRow();
+ select.selectFirstRow();
}
}
}
Ext.Ajax.request(conf);
};
+tvheadend.AjaxConfirm = function(conf) {
+ Ext.MessageBox.confirm(
+ conf.title || 'Message',
+ conf.question || 'Do you really want to delete the selection?',
+ function (btn) {
+ if (btn == 'yes')
+ tvheadend.Ajax(conf);
+ }
+ );
+};
+
tvheadend.loading = function(on) {
if (on)
Ext.getBody().mask('Loading... Please, wait...', 'loading');