epgd.sortTable = function (options) { this.o = $.extend({ conSel: epgd.$con, empty: '', right: 1 }, options); } epgd.sortTable.prototype = { sortIcons: '', update: function () { }, hideHead: function(){ var $ths = this.$con.find('thead:first').hide().find('>tr>th'); this.$con.find('tbody:first').html('' + this.o.empty + ($ths.last().find('.i-doc-new').wrapAll('
').parent().html() || '') + ''); }, showHead: function(){ this.$con.find('>table>thead').show(); this.filter(); this.sort(); }, getTable: function () { }, action: function ($el, iconName, data) { switch (iconName) { case 'refresh': this.update(); break; case 'detail': if (!$el[0].eventDetail) $el[0].eventDetail = new epgd.eventDetail(data); epgd.utils.loader.process(function () { $el[0].eventDetail.render(); }); break; } }, render: function ($con, searchData) { this.trs = []; this.$con = $con || $(this.o.conSel); this.$con.empty(); if (!(epgd.login.rights & this.o.right) == this.o.right) return epgd.utils.popup(epgd.tr.error.forbidden, { title: epgd.tr.error.error }); this.$con.html(this.getTable()); this.init(); this.update(searchData); }, init: function () { var list = this, cIndex = 0; this.$con.find('>table').click(function (ev) { var $el = $(ev.target), el = $el[0], data = el.getAttribute('data-evId'), d, $lastSel; if (data) list.action($el, 'detail', data); else if (ev.target.className == 'i-tv') { epgd.vdrs.current.switchChannel(ev.target.parentNode.id); } else { //if (!searchData || searchData.fromEventDetail != true) // $(window).trigger("epgd_close.eventDetail"); $el = $el.closest('span.sort'); if ($el.length) { $el.parent().parent().find('.ui-state-highlight').removeClass('ui-state-highlight'); $el.addClass("ui-state-highlight"); list.sort($el); } else { $el = $(el).closest('span.edit'); if ($el.length) { list.action($el, $el[0].className.match(/i-([a-z0-9-]+)/)[1]); } if (list.o.selectable) { if (el.nodeName == 'TD') { $el = $(el).parent().toggleClass('selected'); if (ev.shiftKey && this.lastSel) { $lastSel = $(this.lastSel); d = $el.index() - $lastSel.index(); if (d > 0) $lastSel.nextAll(':lt(' + d + '):visible').toggleClass('selected', $lastSel.hasClass('selected')); else $lastSel.prevAll(':lt(' + -d + '):visible').toggleClass('selected', $lastSel.hasClass('selected')); } else this.lastSel = $el[0]; } else if (el.nodeName == 'B') { d = el.getAttribute('data-t'); $(list.trs).filter(":visible").toggleClass('selected', d == 1 ? true : d == 0 ? false : undefined); return false; } } } return false; } }).find('>thead>tr').find('>th').each(function () { this.cIndex = cIndex; cIndex += this.colSpan; }).end().find('[data-defaultSort="1"]>span.sort:last,[data-defaultSort="-1"]>span.sort:first').addClass('ui-state-highlight'); this.$con.find('>table>thead input.filter').keyup(function () { list.filter(); }).each(function () { if (!this.result) this.result = $('').insertAfter(this)[0]; }); }, sort: function ($el) { $el = $el || this.$con.find('>table>thead .ui-state-highlight'); if (!$el.length) return; var i = $el.parent()[0], d = ($el.hasClass('i-sort-name-down') ? -1 : 1), trs = this.trs, l,td; if (!i.sortInfo) { i = i.cIndex; for (l = 0; l < trs.length; l++) { td = trs[l].cells[i]; td.sort = td.getAttribute('data-sort') || $(td).text().toLowerCase(); }; } else i = i.cIndex; trs.sort(function (a, b) { var va = a.cells[i].sort, vb = b.cells[i].sort; return (va > vb ? 1 * d : va == vb ? 0 : -1 * d); }); this.$con.find('>table>tbody').append(trs.slice()); }, filter: function(){ var cells = {}, l, i, tr, hide; this.$con.find('>table>thead input.filter').each(function () { if (this.value) cells[this.parentNode.cIndex] = [this.value.toLowerCase(),0,this.result || {}]; else if (this.result) this.result.innerHTML= ''; }); for (l = 0; l < this.trs.length; l++) { tr = this.trs[l]; hide = ''; for (i in cells) { if (tr.cells[i].innerHTML.toLowerCase().indexOf(cells[i][0]) == -1) hide = 'none'; else cells[i][1]++; } tr.style.display = hide; }; for (i in cells) if (cells[i][2].innerHTML = cells[i][1]); } } epgd.timerEditChFormat = function (input) { var formats = ',SD,HD,3D', values = input.value, i; if (values) { values = values.split(','); for (i = 0; i < values.length; i++) formats = formats.replace(',' + values[i] + ',', ','); } $('
    ' + (values.length ? '
  1. ' + values.join('
  2. ') + '
  3. ' : '') + '
') .dialog({ modal: true, buttons: [{ text: epgd.tr.apply, click: function () { var val = ''; $(this).find('ol > li').each(function () { val += ',' + this.innerHTML; }); input.value = val.slice(1); $(this).dialog("close"); } }, { text: epgd.tr.cancel, click: function () { $(this).dialog("close"); } }] }).find('ul,ol').sortable({ connectWith: "ul,ol" }).disableSelection(); }; // Timer Listen Base Klasse epgd.timerListBase = epgd.utils.inherits(function (options, dialog) { this.dialog = dialog; if (this.dialog) this.dialog.list = this; if (!options.conSel) options.conSel = '#content';//'#tabCon'; if (!options.empty) options.empty = epgd.tr.pages.timerList.empty; epgd.sortTable.call(this,options); }, epgd.sortTable); epgd.timerListBase.prototype.getTable = function () { var tr = epgd.tr.pages.timerList; return '
' + epgd.tr.channel + this.sortIcons + '' + tr.startTime + this.sortIcons + ' ' + tr.endTime + '' + epgd.tr.pages.eventDetail.title + this.sortIcons + ' VDR' + this.sortIcons + ' ' + this.sortIcons + (this.o.addNew ? '' + '' : '') + (this.o.selectable ? '
' + '
' : '') + '
'; } epgd.timerListBase.prototype.update = function () { var timerList = this; epgd.utils.loader.process(function () { timerList.$con.find('tbody').empty(); epgd.ajax({ url: epgd.login.url + timerList.o.updateUrl, async: false, cache: false }, function (data) { if (!data.timers.length) { timerList.hideHead(); } else { var trs = [], editIcons = timerList.editIcons, noEditStates = 'DF', stateIcons = { 'D': '
' + epgd.tr.pages.timerList.timerStates.D + '
', // gelöscht 'E': '
' + epgd.tr.pages.timerList.timerStates.E + '
', // Fehler 'F': '
' + epgd.tr.pages.timerList.timerStates.F + '
', // Aufnahme erfolgreich 'R': '
' + epgd.tr.pages.timerList.timerStates.R + '
', // nimmt gerade auf 'P': '
' + epgd.tr.pages.timerList.timerStates.P + '
', // wartet auf Aufnhemebeginn 'U': '
' + epgd.tr.pages.timerList.timerStates.U + '
' // unbekannt }, timerActions = epgd.tr.pages.timerList.timerActions, searchTimerIcon = '$title$'; $.each(data.timers, function (id, t) { t.action = t.action ? t.action.toUpperCase() : 'A'; t.state = t.state ? t.state.toUpperCase() : 'U'; var vdr = epgd.vdrs.list[t.vdruuid] || { name: '--' }, //start = t.day ? t.day + parseInt(t.starttime / 100, 10) * 60 * 60 + (t.starttime % 100) * 60 : new String(100 + parseInt(t.endtime / 100, 10)).slice(1) + ':' + (t.endtime % 100), // searchTimer = t.aux && t.aux.match(/.*([^<]+)<\/expression>/), tr = $('' + epgd.channels.getHtml(t.channelid) + '' + (t.action != 'A' ? '
' + timerActions[t.action] + '
' : stateIcons[t.state] ) + (t.info || '') + '' + '' + (t.day ? epgd.utils.formatDate(t.day) : '-') + '' + new String(100 + parseInt(t.starttime / 100, 10)).slice(1) + ':' + new String(100 + parseInt(t.starttime % 100, 10)).slice(1) + '' + new String(100 + parseInt(t.endtime / 100, 10)).slice(1) + ':' + new String(100 + parseInt(t.endtime % 100, 10)).slice(1) + '' + (t.title || '') + '
' + (t.shorttext || '') : '>') + '' + vdr.name + '
' + (t.directory ? t.directory + '~' : '') + (t.file || '') + '' + (t.autotimerid ? searchTimerIcon.replace('$id$', t.autotimerid).replace('$title$', t.autotimername || t.expression || epgd.tr.pages.timer.searchTimerList) : '') + (noEditStates.indexOf(t.state) == -1 ? editIcons : '') + '')[0]; tr.tData = t; trs.push(tr); }); timerList.trs = trs; timerList.showHead(); /*timerList.$con.find('>table>tbody>tr').find('>td:eq(1)').tooltip({ items: "div", content: function () { return this.innerHTML; } })*/ } epgd.utils.loader.close(); $(window).trigger('timerlist_updated', timerList); }); },true); } epgd.timerListBase.prototype.action = function ($el, iconName,data) { //this.dialog && this.dialog.close && this.dialog.close(); var id; switch (iconName) { case 'edit': case 'doc-new': this.dialog.render($el.closest('tr')[0].tData); break; case 'trash': this.del(this.getSelectedIds($el)); break; case 'flashlight': id = $el.attr('data-id'), list = this; $(window).one('searchTimerList_updated', function () { list.$con.find('tbody>tr').each(function () { if (this.tData.id == id) { epgd.pages.searchTimerList.dialog.render(this.tData); return false; } }); }); epgd.$menu.menu("select", { target: "#menu_searchTimerList" }); break; default: epgd.sortTable.prototype.action.call(this,$el, iconName, data); } }; epgd.timerListBase.prototype.editIcons = ''; epgd.timerListBase.prototype.getSelectedIds = function ($el) { var ids = []; if ($el[0].parentNode.nodeName == 'TH') { $(this.trs).filter(".selected:visible").each(function () { ids.push(this.tData.id); }); } else ids.push($el.closest('tr')[0].tData.id); return ids; } epgd.timerListBase.prototype.del = function (ids, succFunc, arrayName) { var self = this, allIDs= $.isArray(ids) ? ids : [parseInt(ids,10)]; ids && allIDs.length && epgd.utils.confirm(epgd.tr.confirmDelete + (allIDs.length > 1 ? '
' + allIDs.length + epgd.tr.entries : ''), function (ok) { ok && self.saveArray(allIDs, arrayName || "delete", succFunc); }); } epgd.timerListBase.prototype.saveArray = function (ids, arrayName, succFunc) { var self = this, allIDs= $.isArray(ids) ? ids : [parseInt(ids,10)], data= {}; data[arrayName] = allIDs; ids && allIDs.length && this.save(data, null, function (jqxhr) { try { var ids = ','; $(jqxhr.responseJSON.result.failed).each(function () { ids += allIDs[this] + ','; }); if (ids.length > 1) { $(self.trs).each(function () { if (ids.indexOf(',' + this.tData.id + ',') >= 0) this.style.backgroundColor = 'red'; }); } } catch (e) { } return false; }, succFunc); }; epgd.timerListBase.prototype.save = function (data, url, failFunc, succFunc) { if (!data) return false; var timerList = this; epgd.utils.loader.process(function () { epgd.ajax({ url: epgd.login.url + (url || timerList.o.saveUrl), type: 'post', data: JSON.stringify(data) }, function (data) { data = data.result; if (data.state == 200) epgd.utils.topInfo(epgd.tr.dataSaved); else epgd.utils.topInfo(data.message, { isError: 1 }); epgd.utils.loader.close(); timerList.$con && timerList.$con.parent().length && timerList.update(); succFunc && succFunc.call(timerList); }, failFunc); },true); return true; } // searchResult List - Klasse epgd.searchResultList = epgd.utils.inherits(function (options, dialog) { epgd.timerListBase.call(this, $.extend({ saveUrl: 'data/save-searchtimer' }, options),dialog); }, epgd.timerListBase); epgd.searchResultList.prototype.getTable = function () { var tr = epgd.tr.pages.timerList; return '
' + epgd.tr.channel + this.sortIcons + '' + tr.startTime + this.sortIcons + '' + tr.endTime + '' + epgd.tr.pages.eventDetail.title + this.sortIcons + '
'; } epgd.searchResultList.prototype.update = function (d) { if (!d) return false; var timerList = this; d.id && delete d.id; d.name && delete d.name; d.max = epgd.profile.maxListEntries; epgd.utils.loader.process(function () { timerList.$con.find('tbody').empty(); epgd.ajax({ url: epgd.login.url + "data/search", type: 'post', data: JSON.stringify(d) }, function (data) { var trs = [], i; if (!data.events || !data.events.length) { timerList.hideHead(); } else { data.count > d.max && epgd.utils.popup('Achtung! Es wurden ' + data.count + ' Ergebnisse gefunden. Angezeigt werden aber nur ' + d.max + '.
Das Nachladen ist noch nicht implementiert! Der Wert kann in den Einstellungen angepasst werden'); $.each(data.events, function (id, e) { var trClass = '', icons = '', d; if (e.dones) { for (i in e.dones) { d = e.dones[i]; icons += '' + d.state + ''; if (d.state == 'R') trClass = ' class="ui-state-disabled"'; } } trs.push($('' + epgd.channels.getHtml(e.channelid) + '' + epgd.utils.formatDate(e.starttime) + '' + epgd.utils.formatTime(e.starttime) + '' + epgd.utils.formatTime(e.starttime + e.duration) + '' + e.title + '
' + (e.shorttext || '') + '' + icons + '').tooltip()[0]); }); timerList.trs = trs; timerList.showHead(); } epgd.utils.loader.close(); timerList.dialog && timerList.dialog.resize && window.setTimeout(function(){timerList.dialog.resize();},100); }); },true); }; // Timerliste eines Suchtimers - Klasse epgd.searchTimerTimerList = epgd.utils.inherits(function (options, dialog) { epgd.timerListBase.call(this, $.extend({ saveUrl: 'data/save-timer', updateUrl: 'data/timers?state=P,R' }, options), dialog); }, epgd.timerListBase); epgd.searchTimerTimerList.prototype.getTable = function () { var tr = epgd.tr.pages.timerList; return '
' + epgd.tr.channel + this.sortIcons + '' + tr.startTime + this.sortIcons + '' + tr.endTime + '' + epgd.tr.pages.eventDetail.title + this.sortIcons + 'VDR' + this.sortIcons + '' + '
'; } epgd.searchTimerTimerList.prototype.update = function (d) { if (!d) return false; var timerList = this; epgd.utils.loader.process(function () { timerList.$con.find('tbody').empty(); epgd.ajax({ url: epgd.login.url + timerList.o.updateUrl + '&autotimerid=' + d.id, async: true, cache: false }, function (data) { var trs = [], editIcons = ''; if (!data.timers.length) { timerList.hideHead(); } else { $.each(data.timers, function (id, t) { var vdr = epgd.vdrs.list[t.vdruuid] || { name: '--' }, tr = $('' + epgd.channels.getHtml(t.channelid) + '' + (t.day ? $.datepicker.formatDate(epgd.tr.dateTimePicker.dateFormat, epgd.utils.date(t.day)) : '-') + '' + new String(100 + parseInt(t.starttime / 100, 10)).slice(1) + ':' + new String(100 + parseInt(t.starttime % 100, 10)).slice(1) + '' + new String(100 + parseInt(t.endtime / 100, 10)).slice(1) + ':' + new String(100 + parseInt(t.endtime % 100, 10)).slice(1) + '' + t.title + '
' + (t.shorttext || '') : '>') + '' + vdr.name + '
' + t.file + '' + editIcons + '')[0]; tr.tData = t; trs.push(tr); }); timerList.trs = trs; timerList.showHead(); } timerList.dialog && timerList.dialog.resize && window.setTimeout(function () { timerList.dialog.resize(); }, 100); epgd.utils.loader.close(); }); }); } // anstehende Timer epgd.pages.timerList = new epgd.timerListBase({ updateUrl: 'data/timers?state=P,R', saveUrl: 'data/save-timer', selectable: true, addNew: true, right: epgd.rights.umTimer }, new epgd.timerDialog()); // Küzlich erledigte Timer epgd.pages.timersDone = new epgd.timerListBase({ updateUrl: 'data/timers?state=D,F,E&action=A', right: epgd.rights.umTimer }); epgd.pages.timersDone.getTable = function () { return epgd.timerListBase.prototype.getTable.call(this).replace('data-defaultSort="1"', 'data-defaultSort="-1"') } // Timerhistorie epgd.pages.timerListDone = new epgd.timerListBase({ updateUrl: 'data/donetimers', saveUrl: 'data/store-donetimers', selectable: true, right: epgd.rights.umTimer }); epgd.pages.timerListDone.getTable = function () { return '
' + this.sortIcons + '' + epgd.tr.pages.timerList.recordTime + this.sortIcons + '' + epgd.tr.pages.eventDetail.title + ' ' + this.sortIcons + '' + epgd.tr.channel + this.sortIcons + '' + this.sortIcons + '' + '
' + '
'; } epgd.pages.timerListDone.action = function ($el, iconName,data) { if (iconName == 'detail' && !$el[0].eventDetail) $el[0].eventDetail = new epgd.doneTimerDetail($el.parent()[0]); epgd.timerListBase.prototype.action.call(this, $el, iconName, data); } epgd.pages.timerListDone.stateIcons = { 'D': '
' + epgd.tr.pages.timerList.doneStates.D + '
', // gelöscht 'F': '
' + epgd.tr.pages.timerList.doneStates.F + '
', // Aufnahme fehlgeschlagen 'f': '
' + epgd.tr.pages.timerList.doneStates.f + '
', // Timer konnte nicht erstellt werden 'R': '
' + epgd.tr.pages.timerList.doneStates.R + '
', // Aufnahme fertig 'C': '
' + epgd.tr.pages.timerList.doneStates.C + '
', // Timer bereits erstellt 'Q': '
' + epgd.tr.pages.timerList.doneStates.Q + '
' // Timer in Vorbereitung } epgd.pages.timerListDone.update = function () { var timerList = this; epgd.utils.loader.process(function () { epgd.ajax({ url: epgd.login.url + timerList.o.updateUrl, async: false, cache: false }, function (data) { timerList.$con.find('tbody').empty(); if (!data.donetimers.length) { timerList.hideHead(); } else { var trs = [], tr, i, t, searchTimerIcon = '$title$'; for (i in data.donetimers) { t = data.donetimers[i]; tr = $('' + (t.state && timerList.stateIcons[t.state] || '') + '' + '' + epgd.utils.formatDateTime(t.starttime) + '
' + parseInt(t.duration / 60, 10) + ' ' + epgd.tr.minutes + '' + (t.title || '') + '
' + (t.shorttext || '') + '' + epgd.channels.getHtml(t.channelid) + '' + '' + (t.autotimerid ? searchTimerIcon.replace('$id$', t.autotimerid).replace('$title$', t.autotimername || t.expression || epgd.tr.pages.timer.searchTimerList) : '') + '')[0]; tr.tData = t; trs.push(tr); }; timerList.trs = trs; timerList.showHead(); } epgd.utils.loader.close(); $(window).trigger('timerlist_updated', timerList); }); },true); } // ungesyncte Aufträge epgd.pages.timerJobList = new epgd.timerListBase({ updateUrl: "data/timers?notaction=A", saveUrl: 'data/delete-timerjobs', selectable: true, right: epgd.rights.umTimer }, new epgd.timerDialog()); // Suchtimer epgd.pages.searchTimerList = new epgd.timerListBase({ saveUrl: 'data/save-searchtimer', right: epgd.rights.umSearchTimer }, new epgd.searchTimerDialog()); epgd.pages.searchTimerList.getTable = function () { var tr = epgd.tr.pages.timerList; return '
' + epgd.tr.pages.search.searchName + '/' + epgd.tr.pages.search.searchExpression + ' ' + this.sortIcons + '' + 'hits' + this.sortIcons + 'VDR' + this.sortIcons + '' + '' + '' + '' + '
'; } epgd.pages.searchTimerList.action = function ($el, iconName, data) { epgd.timerListBase.prototype.action.call(this,$el, iconName, data); switch (iconName) { case 'link-ext': this.triggerUpdate(); break; case 'down-dir': if (!$el[0].tList) { var dialog={ $td: $el.parent().css("position", "relative"), tdHeight: $el.parent().outerHeight() + 10, data: $el.parent().parent()[0].tData, resize: function () { var $table = this.list.$con.find('>table').addClass("sub"); $table.width(this.$td.parent().outerWidth()); this.$td.height(this.tdHeight + $table.outerHeight(true) + 10); //this.$td.append(this.list.$con); }, toggle : function (doShow) { this.list.$con.toggle(doShow); if (doShow) { this.$td.css("height", "100px"); this.list.update(this.data); } else this.$td.css("height", "auto"); } }, options= { conSel: $('
').appendTo(document.body) }; $el[0].tList = dialog.data.type == 'S' ? new epgd.searchResultList(options, dialog) : new epgd.searchTimerTimerList(options, dialog); $el[0].tList.render(); dialog.$td.append(dialog.list.$con); } $el[0].tList.dialog.toggle(true); $el.removeClass('i-down-dir').addClass('i-right-dir'); break; case 'right-dir': $el.removeClass('i-right-dir').addClass('i-down-dir'); if ($el[0].tList) $el[0].tList.dialog.toggle(false); break; } } epgd.pages.searchTimerList.update = function () { var timerList = this; this.$con.find('tbody').empty(); epgd.utils.loader.process(function () { epgd.ajax({ url: epgd.login.url + "data/searchtimers", async: false, cache: false }, function (data) { var trs = [], editIcons = timerList.editIcons, typeIcons = { 'V': 'i-tv', 'R': 'i-record', 'S': 'i-search' }; if (!data.searchtimers.length) { timerList.hideHead(); } else { $.each(data.searchtimers, function (id, t) { var vdr = epgd.vdrs.list[t.vdruuid] || { name: '--' }, tr = $('' + '' + '
' + (t.name || t.expression) + '
--' : ' data-sort="' + new String('00000' + t.hits).slice(-5) + '">' + t.hits) + '' + vdr.name + '' + editIcons + '')[0]; tr.tData = t; trs.push(tr); }); timerList.trs = trs; timerList.showHead(); } epgd.utils.loader.close(); $(window).trigger('searchTimerList_updated', timerList); }); }); } epgd.pages.searchTimerList.triggerUpdate = function () { var timerList = this; epgd.ajax({url: epgd.login.url + 'data/updatesearchtimer'},function (data) { if (data.result.state == 200) epgd.utils.topInfo(epgd.tr.dataSaved); else epgd.utils.topInfo(data.message, { isError: 1 }); timerList.update(); }); } epgd.pages.search = new epgd.searchDialog(); //message List epgd.pages.messageList = new epgd.timerListBase({ saveUrl: 'data/markmessages', selectable: true }) epgd.pages.messageList.getTable = function () { return '' + '' + '' + '' + '' + '' + '
id' + this.sortIcons + '' + 'Typ' + ' ' + this.sortIcons + '' + 'Zeit' + this.sortIcons + '' + 'Titel' + ' ' + this.sortIcons + '' + 'infotext' + ' ' + this.sortIcons + '
' +'
' + 'Status' + ' ' + '
' + this.sortIcons + '' + '' + '' + '
'; } epgd.pages.messageList.update = function (d) { var messList = this; epgd.utils.loader.process(function () { epgd.ajax({ url: epgd.login.url + "data/messages", async: false, cache: false }, function (data) { messList.$con.find('tbody').empty(); if (!data.messages.length) { messList.hideHead(); } else { var trs = [], tr, i, t, icons = { 'N': '' + epgd.tr.pages.timerList.messageStates.N + '', 'R': '' + epgd.tr.pages.timerList.messageStates.R + '' }, types = { 'E': '
' + epgd.tr.pages.timerList.timerStates.E + '
', 'F': '
' + epgd.tr.pages.timerList.timerStates.F + '
', 'I': '
' + epgd.tr.pages.timerList.messageTypes.I + '
', 'W': '
' + epgd.tr.pages.timerList.messageTypes.W + '
' }; for (i in data.messages) { t = data.messages[i]; tr = $('' + t.id + '' + '' + (types[t.type] ||'') +'' + '' + epgd.utils.formatDateTime(t.updsp) + '' + '' + t.title + '' + '' + t.text + '' + '' + (icons[t.state] || '') + '' + '')[0]; tr.tData = t; trs.push(tr); }; messList.trs = trs; messList.$con.find('>table>tbody').append(trs.sort(function (a,b) { return a.tData.state == b.tData.state ? a.tData.state.updsp > b.tData.state.updsp ? -1 : 1 : a.tData.state > b.tData.state }).slice()); messList.showHead(); } epgd.utils.loader.close(); $(window).trigger('messagelist_updated', messList); }); }, true); }; epgd.pages.messageList.action = function ($el, iconName, data) { var ids = this.getSelectedIds($el), state= null, i; if (ids) { switch (iconName) { case 'check': state = $el[0].parentNode.nodeName == 'TH' ? 'R' : 'N'; break; case 'check-empty': state = $el[0].parentNode.nodeName == 'TH' ? 'N' : 'R'; break; case 'trash': state = 'D' break; } if (state) { for (i in ids) ids[i]= {"id":ids[i], "state":state} state == 'D' ? this.del(ids, null,"messages") : this.saveArray(ids, "messages"); return true; } } return epgd.timerListBase.prototype.action.call(this, $el, iconName, data); }