From 603be72552dec1465ae49fc392930a678f28bef1 Mon Sep 17 00:00:00 2001 From: horchi Date: Fri, 9 Feb 2018 21:08:00 +0100 Subject: 2018-02-09: version 1.1.130 (rechner)\n - added: Icons for timertypes\n - added: switchtimer on eventDetail \n \n --- http/src/js/5_timerDialog.js | 511 ++++++++++++++++++++-------------------- http/src/js/eventDetail.js | 16 +- http/src/js/pages.timer.js | 539 ++++++++++++++++++++++--------------------- 3 files changed, 540 insertions(+), 526 deletions(-) (limited to 'http/src/js') diff --git a/http/src/js/5_timerDialog.js b/http/src/js/5_timerDialog.js index ad13bce..113e7a9 100644 --- a/http/src/js/5_timerDialog.js +++ b/http/src/js/5_timerDialog.js @@ -1,12 +1,12 @@ // Timer Dialoge - Basis Klasse -epgd.timerDialogBase = function (options) { - this.$win = null; - this.list = null; - if ( options ) - this.options= $.extend({}, this.options, options); +epgd.timerDialogBase = function (options) { + this.$win = null; + this.list = null; + if ( options ) + this.options= $.extend({}, this.options, options); } -epgd.timerDialogBase.prototype = { - options: { +epgd.timerDialogBase.prototype = { + options: { id: "baseDialog", modal: true, draggable: true, @@ -14,59 +14,59 @@ epgd.timerDialogBase.prototype = { autoOpen: false, width: 'auto', maxHeight: $(window).height(), - close: function () { + close: function () { this.list.dialog.form.reset(); $(this.list.dialog.form).next().remove(); //allFields.removeClass("ui-state-error"); - }, - buttons: [{ + }, + buttons: [{ text: epgd.tr.del, icons: { primary: "ui-icon-trash" }, id: 'tBDel', - click: function () { + click: function () { $(this).dialog("close"); - this.list.del(this.list.dialog.form.tID.value); - } - }, { + this.list.del(this.list.dialog.form.tID.value); + } + }, { text: epgd.tr.cancel, icons: { primary: "ui-icon-close" }, - click: function () { - $(this).dialog("close"); - } - }, { + click: function () { + $(this).dialog("close"); + } + }, { text: epgd.tr.save, icons: { primary: "ui-icon-disk" }, - click: function () { this.list.dialog.save() } - }] + click: function () { this.list.dialog.save() } + }] }, save: function (data, url, failFunc, succFunc) { this.list.save(data || this.getData(), url, failFunc, succFunc) && !this.options.embed && this.$win.dialog("close"); }, - showError: function (msg, field) { + showError: function (msg, field) { epgd.utils.popup((field && field.id ? '' + $('label[for="' + field.id + '"]').text() + '' : '') + '
' + msg + '
', { autoClose: 3000 }); field && field.focus(); - return false; - }, - loadFolder: function () { + return false; + }, + loadFolder: function () { var dialog = this; - epgd.ajax({ url: epgd.login.url + "data/recordingdirs" }, function (data) { - if (data.recordingdirs.length) { + epgd.ajax({ url: epgd.login.url + "data/recordingdirs" }, function (data) { + if (data.recordingdirs.length) { var folder = [], vdrs = epgd.vdrs.list, vdr; - $.each(data.recordingdirs, function (id, f) { + $.each(data.recordingdirs, function (id, f) { vdr = vdrs[f.vdruuid]; - folder.push({ value: f.directory, category: vdr ? vdr.name : '-' }); + folder.push({ value: f.directory, category: vdr ? vdr.name : '-' }); }); - $(dialog.form.tFolder).catcomplete("option", "source", folder); - } - }); - }, - close: function () { + $(dialog.form.tFolder).catcomplete("option", "source", folder); + } + }); + }, + close: function () { if (this.$win) - this.$win.dialog("close"); - }, - create: function () { + this.$win.dialog("close"); + }, + create: function () { var o = this.options, tr = epgd.tr.pages.timerList, week = '', @@ -94,27 +94,27 @@ epgd.timerDialogBase.prototype = { !o.embed && this.$win.appendTo(document.body).dialog(o); this.$win[0].list = this.list; this.form = this.$win.find('form')[0]; - $(this.form.tFolder).catcomplete({ + $(this.form.tFolder).catcomplete({ minLength: 0, - maxHeight: 300 - }).focus(function () { - $(this).catcomplete("search", ""); + maxHeight: 300 + }).focus(function () { + $(this).catcomplete("search", ""); }); - $(this.form.tType).change(function () { + $(this.form.tType).change(function () { if (this.selectedIndex < 0) - this.selectedIndex = 0; - this.form.className = this.form.className.replace(/ ?type./, '') + ' type' + this[this.selectedIndex].value; - // $('.onlyTypeR', this.form).toggle(this[this.selectedIndex].value == 'R'); - // $('#tSName').parent().toggle(this[this.selectedIndex].value == 'S'); - // $('#tRepeat,#tChFormat').parent().toggle(this[this.selectedIndex].value != 'S'); + this.selectedIndex = 0; + this.form.className = this.form.className.replace(/ ?type./, '') + ' type' + this[this.selectedIndex].value; + // $('.onlyTypeR', this.form).toggle(this[this.selectedIndex].value == 'R'); + // $('#tSName').parent().toggle(this[this.selectedIndex].value == 'S'); + // $('#tRepeat,#tChFormat').parent().toggle(this[this.selectedIndex].value != 'S'); }); - $(this.form.tNameMode).change(function () { - this.form.tTemplate.parentNode.style.display = (this.selectedIndex == 6) ? 'block': 'none'; + $(this.form.tNameMode).change(function () { + this.form.tTemplate.parentNode.style.display = (this.selectedIndex == 6) ? 'block': 'none'; }); epgd.utils.addPlaceholders(this.form.tTemplate, '%', tr.templateFields); - this.loadFolder(); - }, - render : function (t) { + this.loadFolder(); + }, + render : function (t) { t = t || {}; if (!this.$win) this.create(); @@ -122,14 +122,14 @@ epgd.timerDialogBase.prototype = { var form = this.form, d, i; form.tSName.focus(); - if (t.id) { + if (t.id) { form.tID.value = t.id; this.$win.parent().find('#tBDel').show(); - this.$win.parent().find('#tBToggle').hide(); - } else { + this.$win.parent().find('#tBToggle').hide(); + } else { form.tID.value = ''; this.$win.parent().find('#tBDel').hide(); - this.$win.parent().find('#tBToggle').show(); + this.$win.parent().find('#tBToggle').show(); } $(form.tType).val(t.type || 'R').change(); $(form.tVdr).val(t.vdruuid || epgd.profile.timerDefaultVDRuuid); @@ -141,43 +141,43 @@ epgd.timerDialogBase.prototype = { form.tVPS.checked = t.vps == 1; form.tInactive.checked = t.active === 0; form.tFolder.value = t.directory || ''; - form.tSName.value = t.name || ''; - epgd.pages.help.initButtons(this.$win); - this.resize(); - }, - resize: function () { - /*var dlgOpt = this.$win.dialog("instance").options; - dlgOpt.position.my = "center top"; - dlgOpt.position.at = "center top"; */ - this.$win.dialog("option", "maxHeight", $(window).height()); + form.tSName.value = t.name || ''; + epgd.pages.help.initButtons(this.$win); + this.resize(); + }, + resize: function () { + /*var dlgOpt = this.$win.dialog("instance").options; + dlgOpt.position.my = "center top"; + dlgOpt.position.at = "center top"; */ + this.$win.dialog("option", "maxHeight", $(window).height()); } - }; + }; // Timerdialog - Klasse -epgd.timerDialog = epgd.utils.inherits(function () { - epgd.timerDialogBase.call(this,{ +epgd.timerDialog = epgd.utils.inherits(function () { + epgd.timerDialogBase.call(this,{ id: 'timerDialog', title: epgd.tr.pages.timer.timerList + ' ' + epgd.tr.edit, - buttons: [{ + buttons: [{ text: epgd.tr.pages.timer.searchTimerList, icons: { primary: "ui-icon-transferthick-e-w" }, id: "tBToggle", - click: function () { + click: function () { var t = this.list.dialog.getData(true); - if (t) { + if (t) { $(this).dialog("close"); //t.channelid && (t.channelids = t.channelid); - if (t.title) { - t.expression = t.title; - t.searchfields = 1; + if (t.title) { + t.expression = t.title; + t.searchfields = 1; } - epgd.pages.searchTimerList.dialog.render(t); - } - } - }].concat(epgd.timerDialog.base.options.buttons) - }); + epgd.pages.searchTimerList.dialog.render(t); + } + } + }].concat(epgd.timerDialog.base.options.buttons) + }); }, epgd.timerDialogBase); -epgd.timerDialog.prototype.create = function () { +epgd.timerDialog.prototype.create = function () { epgd.timerDialog.base.create.call(this); var tr = epgd.tr.pages.timerList, @@ -189,8 +189,8 @@ epgd.timerDialog.prototype.create = function () { $(form.tNameMode).after(' '); $(form.tFolder).parent().after('
'); - $(this.form.tStart).datetimepicker({ - minDateTime: epgd.utils.now(), + $(this.form.tStart).datetimepicker({ + minDateTime: epgd.utils.now(), }); $(this.form.tEnd).timepicker({ // minDateTime: epgd.utils.now() @@ -198,15 +198,15 @@ epgd.timerDialog.prototype.create = function () { epgd.utils.addAutoComplete(form.tChannel, { source: epgd.channels.autoCompleteData }); form.tFile = $(form).find('#tFile')[0]; form.tEvTime = $(form).find('#tEvTime')[0]; - form.tTitle = $(form).find('#tTitle').click(function () { - if (form.tEvID.value) { - epgd.utils.loader.process(function () { - new epgd.eventDetail(form.tEvID.value).render(); - }); - } - })[0]; + form.tTitle = $(form).find('#tTitle').click(function () { + if (form.tEvID.value) { + epgd.utils.loader.process(function () { + new epgd.eventDetail(form.tEvID.value).render(); + }); + } + })[0]; }; -epgd.timerDialog.prototype.render = function (t) { +epgd.timerDialog.prototype.render = function (t) { t = t || {}; epgd.timerDialog.base.render.call(this, t); var form = this.form, @@ -219,7 +219,7 @@ epgd.timerDialog.prototype.render = function (t) { form.tEvTime.innerHTML = t.evStartTime ? epgd.utils.formatDateTime(t.evStartTime) + ' - ' + epgd.utils.formatTime(t.evStartTime + t.evDuration) : ''; $([form.tStart, form.tEnd]).datetimepicker("option", "disabled", !!t.eventid); - if (t.day || !t.evStartTime) { + if (t.day || !t.evStartTime) { if (t.starttime) d = epgd.utils.date((t.day + parseInt(t.starttime / 100, 10) * 60 * 60 + (t.starttime % 100) * 60)); else if (t.day) @@ -232,29 +232,29 @@ epgd.timerDialog.prototype.render = function (t) { d = epgd.utils.date((t.day + parseInt(t.endtime / 100, 10) * 60 * 60 + (t.endtime % 100) * 60)); else d = new Date(d.getTime() + 2 * 60 * 60000); - $(form.tEnd).datetimepicker('setTime', d); - } else { - $([form.tStart, form.tEnd]).val('...'); + $(form.tEnd).datetimepicker('setTime', d); + } else { + $([form.tStart, form.tEnd]).val('...'); } //form.tNameMode.defaultIndex = parseInt(t.category == 'Serie' ? epgd.profile.namingModeSerie : epgd.profile.namingModeMovie, 10); - form.tNameMode.selectedIndex = typeof t.namingmode == "undefined" ? parseInt(t.category == 'Serie' ? epgd.profile.namingModeSerie : epgd.profile.namingModeMovie, 10) : t.namingmode; - form.tTemplate.value = t.template || (t.category == 'Serie' ? epgd.profile.namingModeSerieTemplate : epgd.profile.namingModeMovieTemplate); - $(form.tNameMode).change(); + form.tNameMode.selectedIndex = typeof t.namingmode == "undefined" ? parseInt(t.category == 'Serie' ? epgd.profile.namingModeSerie : epgd.profile.namingModeMovie, 10) : t.namingmode; + form.tTemplate.value = t.template || (t.category == 'Serie' ? epgd.profile.namingModeSerieTemplate : epgd.profile.namingModeMovieTemplate); + $(form.tNameMode).change(); }; -epgd.timerDialog.prototype.getData = function (dontValid) { +epgd.timerDialog.prototype.getData = function (dontValid) { var form = this.form, d, i, data = {}; if (form.tEvID.value) data.eventid = parseInt(form.tEvID.value, 10); data.active = form.tInactive.checked ? 0 : 1; if (form.tID.value) data.id = parseInt(form.tID.value, 10); - if (form.tStart.value && form.tStart.value != '...') { + if (form.tStart.value && form.tStart.value != '...') { d = $(form.tStart).datepicker('getDate'); data.starttime = d.getHours() * 100 + d.getMinutes(); d.setHours(0); d.setMinutes(0); data.day = parseInt(d.getTime() / 1000, 10); - data.endtime = parseInt(form.tEnd.value.replace(':', ''), 10); + data.endtime = parseInt(form.tEnd.value.replace(':', ''), 10); } else if (!data.eventid && !dontValid) return this.showError(epgd.tr.error.emptyField.replace("$field$", epgd.tr.pages.timerList.recordTime), form.tStart); data.weekdays = 0; @@ -272,72 +272,75 @@ epgd.timerDialog.prototype.getData = function (dontValid) { if (form.tFolder.value) data.file = form.tFolder.value + '~' + data.file; */ + data.type = $(form.tType).val(); d = $(form.tVdr).val(); - if (d) data.vdruuid = d; + if (!d && data.type == 'V') + d= epgd.vdrs.current.uuid || ''; + if (d) + data.vdruuid = d; //if (!dontValid || form.tNameMode.defaultIndex != form.tNameMode.selectedIndex) data.namingmode = form.tNameMode.selectedIndex; data.template = form.tTemplate.value; - data.type = $(form.tType).val(); if (data.type == 'V' && !d && !dontValid) return this.showError(epgd.tr.error.emptyField.replace("$field$", "VDR"), form.tVdr); data.directory = form.tFolder.value; data.title = form.tTitle.innerHTML || ''; data.name = form.tSName.value; - return data; + return data; } // Suchtimerdialog - Klasse epgd.searchTimerDialog = epgd.utils.inherits(function (options) { this.searchResultList = null; - epgd.timerDialogBase.call(this,$.extend({},{ + epgd.timerDialogBase.call(this,$.extend({},{ id: 'searchTimerDialog', width: 530, title: epgd.tr.pages.timer.searchTimerList + ' ' + epgd.tr.edit, - buttons: [{ + buttons: [{ text: epgd.tr.pages.timer.timerList, icons: { primary: "ui-icon-transferthick-e-w" }, id: "tBToggle", - click: function () { + click: function () { var t = this.list.dialog.getData(true); - if (t) { + if (t) { $(this).dialog("close"); t.channelids && (t.channelid = t.channelids.split(',')[0]); t.expression && (t.title = t.expression); - epgd.pages.timerList.dialog.render(t); - } - } - }, { + epgd.pages.timerList.dialog.render(t); + } + } + }, { text: epgd.tr.test, - click: function () { - this.list.dialog.search(); - } - }].concat(epgd.searchTimerDialog.base.options.buttons, { + click: function () { + this.list.dialog.search(); + } + }].concat(epgd.searchTimerDialog.base.options.buttons, { text: epgd.tr.copy, icons: { primary: "ui-icon-copy" }, id: "tBCopy", - click: function (ev) { - $(ev.currentTarget).hide(); - this.list.dialog.form.tID.value = ''; - this.list.dialog.form.tSName.value += ' copy'; - this.list.dialog.form.tSName.select(); - } - }) + click: function (ev) { + $(ev.currentTarget).hide(); + this.list.dialog.form.tID.value = ''; + this.list.dialog.form.tSName.value += ' copy'; + this.list.dialog.form.tSName.select(); + } + }) },options)); }, epgd.timerDialogBase); -epgd.searchTimerDialog.prototype.search = function ($con, searchData) { - if (!this.searchResultList) - this.searchResultList = new epgd.searchResultList(null);//,this); - if (!this.searchResultList.$con || ($con && $con[0] != this.searchResultList.$con[0])) - this.searchResultList.render($con || ($('
').insertAfter(this.form))); - else - this.searchResultList.$con.find('tbody').empty(); - if (!this.searchResultList.$con.parent().length) { - this.searchResultList.$con.insertAfter(this.form); - this.searchResultList.init(); - } - this.searchResultList.update(searchData || this.getData()); - this.searchResultList.$con[0].scrollIntoView(true); +epgd.searchTimerDialog.prototype.search = function ($con, searchData) { + if (!this.searchResultList) + this.searchResultList = new epgd.searchResultList(null);//,this); + if (!this.searchResultList.$con || ($con && $con[0] != this.searchResultList.$con[0])) + this.searchResultList.render($con || ($('
').insertAfter(this.form))); + else + this.searchResultList.$con.find('tbody').empty(); + if (!this.searchResultList.$con.parent().length) { + this.searchResultList.$con.insertAfter(this.form); + this.searchResultList.init(); + } + this.searchResultList.update(searchData || this.getData()); + this.searchResultList.$con[0].scrollIntoView(true); } -epgd.searchTimerDialog.prototype.create = function () { +epgd.searchTimerDialog.prototype.create = function () { epgd.searchTimerDialog.base.create.call(this); var tr = epgd.tr.pages.timerList, @@ -348,13 +351,13 @@ epgd.searchTimerDialog.prototype.create = function () { for (key in trS.searchModes) sModes += ''; - if (!epgd.categories) { + if (!epgd.categories) { epgd.categories = []; - epgd.ajax({ url: 'data/categories', async: false }, function (data) { epgd.categories = data.categories; }); + epgd.ajax({ url: 'data/categories', async: false }, function (data) { epgd.categories = data.categories; }); } - if (!epgd.genres) { + if (!epgd.genres) { epgd.genres = []; - epgd.ajax({ url: 'data/genres', async: false }, function (data) { epgd.genres = data.genres; }); + epgd.ajax({ url: 'data/genres', async: false }, function (data) { epgd.genres = data.genres; }); } $(form.tSName).parent().parent().after('
' @@ -381,23 +384,23 @@ epgd.searchTimerDialog.prototype.create = function () { + '
'); $(form.tWeek[0]).before('' + epgd.tr.dateTimePicker.timeTextBetween + ' - ') .parent().append('
' + tr.nextDays.replace('$field$','') + '').insertAfter(form.tTime.parentNode); - $([form.tStart,form.tEnd]).timepicker({ - alwaysSetTime: false + $([form.tStart,form.tEnd]).timepicker({ + alwaysSetTime: false }); - $([form.tTime, form.tRepeat, form.tAdv]).change(function () { - $(this).parent().next().toggle(this.checked); + $([form.tTime, form.tRepeat, form.tAdv]).change(function () { + $(this).parent().next().toggle(this.checked); }); - $([form.tSFSeason, form.tSFSPart, form.tSFYear]).change(function () { + $([form.tSFSeason, form.tSFSPart, form.tSFYear]).change(function () { this.value = this.value.replace(/[^0-9-]/g, ''); if (this.value.length == 1 && this.value == '-') - this.value = ''; + this.value = ''; }); $(form.tType).append(''); epgd.utils.addAutoComplete(form.tChannels, { source: epgd.channels.autoCompleteData, multiselect: true }); epgd.utils.addAutoComplete(form.tSFCat, { source: epgd.categories, multiselect: true }); epgd.utils.addAutoComplete(form.tSFGenre, { source: epgd.genres, multiselect: true }); }; -epgd.searchTimerDialog.prototype.render = function (t) { +epgd.searchTimerDialog.prototype.render = function (t) { t = t || { searchfields: 1 }; epgd.searchTimerDialog.base.render.call(this, t); var form = this.form, @@ -408,12 +411,12 @@ epgd.searchTimerDialog.prototype.render = function (t) { d = t.searchfields || 0; for (i = 0, f = 1; i < form.tSFields.length; i++, f *= 2) form.tSFields[i].checked = (d & f); - if (t.starttime || t.endtime || t.weekdays || t.nextdays) { + if (t.starttime || t.endtime || t.weekdays || t.nextdays) { form.tTime.checked = true; t.starttime ? $(form.tStart).datetimepicker('setTime', new Date(0, 0, 0, parseInt(t.starttime / 100, 10), (t.starttime % 100))) : form.tStart.value = ''; - t.endtime ? $(form.tEnd).datetimepicker('setTime', new Date(0, 0, 0, parseInt(t.endtime / 100, 10), (t.endtime % 100))) : form.tEnd.value; - form.tNextDays.value = t.nextdays || ''; - } else + t.endtime ? $(form.tEnd).datetimepicker('setTime', new Date(0, 0, 0, parseInt(t.endtime / 100, 10), (t.endtime % 100))) : form.tEnd.value; + form.tNextDays.value = t.nextdays || ''; + } else form.tTime.checked = false; $(form.tTime).change(); d = t.repeatfields || 0; @@ -445,18 +448,18 @@ epgd.searchTimerDialog.prototype.render = function (t) { form.tChFormat.value = t.chformat || (t.id ? '' : epgd.profile.chFormat); form.tNameMode.defaultIndex = parseInt(t.category == 'Serie' ? epgd.profile.namingModeSearchSerie : epgd.profile.namingModeSearchMovie, 10); form.tNameMode.selectedIndex = typeof t.namingmode == "undefined" ? form.tNameMode.defaultIndex : t.namingmode; - form.tTemplate.value = typeof t.template == "undefined" ? (t.category == 'Serie' ? epgd.profile.namingModeSearchSerieTemplate : epgd.profile.namingModeSearchMovieTemplate) : t.template; - $(form.tNameMode).change(); - this.$win.parent().find('#tBCopy').toggle(!!t.id); + form.tTemplate.value = typeof t.template == "undefined" ? (t.category == 'Serie' ? epgd.profile.namingModeSearchSerieTemplate : epgd.profile.namingModeSearchMovieTemplate) : t.template; + $(form.tNameMode).change(); + this.$win.parent().find('#tBCopy').toggle(!!t.id); }; -epgd.searchTimerDialog.prototype.getData = function (dontValid) { +epgd.searchTimerDialog.prototype.getData = function (dontValid) { var form = this.form, d, i, data = { expression: form.tExpr.value }; if (form.tSFSeason.value) data.season = form.tSFSeason.value; if (form.tSFSPart.value) data.seasonpart = form.tSFSPart.value; if (form.tSFYear.value) data.year = form.tSFYear.value; - if (!dontValid) { + if (!dontValid) { if (!data.expression) return this.showError(epgd.tr.error.emptyField.replace("$field$", epgd.tr.pages.search.searchExpression), form.tExpr); if (data.season && !/^[0-9]{0,3}-?[0-9]{0,3}$/.test(data.season)) @@ -464,7 +467,7 @@ epgd.searchTimerDialog.prototype.getData = function (dontValid) { if (data.seasonpart && !/^[0-9]{0,3}-?[0-9]{0,3}$/.test(data.seasonpart)) return this.showError(epgd.tr.error.invalid, form.tSFSPart); if (data.year && !/^((19|20)[0-9]{2})?(-|-(19|20)[0-9]{2})?$/.test(data.year)) - return this.showError(epgd.tr.error.invalid, form.tSFYear); + return this.showError(epgd.tr.error.invalid, form.tSFYear); } if (form.tID.value) data.id = parseInt(form.tID.value, 10); if (form.tSFEpisode.value) data.episodename = form.tSFEpisode.value; @@ -483,23 +486,23 @@ epgd.searchTimerDialog.prototype.getData = function (dontValid) { data.searchfields += f; data.casesensitiv = form.tCaseSens.checked ? 1 : 0; data.repeatfields = 0; - if (form.tRepeat.checked) { + if (form.tRepeat.checked) { for (i = 0, f = 1; i < form.tRFields.length; i++, f *= 2) if (form.tRFields[i].checked) - data.repeatfields += f; + data.repeatfields += f; } data.active = form.tInactive.checked ? 0 : 1; data.channelids = epgd.utils.getAutoCompleteValues(form.tChannels); data.chformat = form.tChFormat.value; data.chexclude = form.tChExclude1.checked ? 1 : 0; - if (form.tTime.checked) { + if (form.tTime.checked) { data.starttime = parseInt(form.tStart.value.replace(':', ''), 10); - data.endtime = parseInt(form.tEnd.value.replace(':', ''), 10); + data.endtime = parseInt(form.tEnd.value.replace(':', ''), 10); data.weekdays = 0; for (i = 0, f = 1; i < form.tWeek.length; i++, f *= 2) if (form.tWeek[i].checked) - data.weekdays += f; + data.weekdays += f; } data.vps = form.tVPS.checked ? 1 : 0; if (form.tPrio.value) data.priority = parseInt(form.tPrio.value, 10); @@ -516,125 +519,125 @@ epgd.searchTimerDialog.prototype.getData = function (dontValid) { return this.showError(epgd.tr.error.emptyField.replace("$field$", "VDR"), form.tVdr); data.name = form.tSName.value; if (form.tNextDays.value) data.nextdays = parseInt(form.tNextDays.value,10); - return data; + return data; } -epgd.searchTimerDialog.prototype.save = function (d, url, failFunc, succFunc) { - d = d || this.getData(); - var self = this, - id= d.id, - name= d.name; - d.max = 0; - d.id && delete d.id; - d.name && delete d.name; - epgd.utils.loader.process(function () { - epgd.ajax({ +epgd.searchTimerDialog.prototype.save = function (d, url, failFunc, succFunc) { + d = d || this.getData(); + var self = this, + id= d.id, + name= d.name; + d.max = 0; + d.id && delete d.id; + d.name && delete d.name; + epgd.utils.loader.process(function () { + epgd.ajax({ url: epgd.login.url + "data/search", type: 'post', - data: JSON.stringify(d) - }, function (data) { - d.id = id; - d.name = name; - if (data.count > 50) { - epgd.utils.confirm(epgd.tr.pages.timerList.confirmSaveBigResult.replace('$cnt$', data.count), function (ok) { - ok && epgd.searchTimerDialog.base.save.call(self, d); - }); - } else - epgd.searchTimerDialog.base.save.call(self, d, url, failFunc, succFunc); - epgd.utils.loader.close(); - }); - },true); + data: JSON.stringify(d) + }, function (data) { + d.id = id; + d.name = name; + if (data.count > 50) { + epgd.utils.confirm(epgd.tr.pages.timerList.confirmSaveBigResult.replace('$cnt$', data.count), function (ok) { + ok && epgd.searchTimerDialog.base.save.call(self, d); + }); + } else + epgd.searchTimerDialog.base.save.call(self, d, url, failFunc, succFunc); + epgd.utils.loader.close(); + }); + },true); } // Suche - Klasse -epgd.searchDialog = epgd.utils.inherits(function () { - epgd.searchTimerDialog.call(this, { +epgd.searchDialog = epgd.utils.inherits(function () { + epgd.searchTimerDialog.call(this, { id: 'search', - embed: true, - buttons: null + embed: true, + buttons: null }); - this.searchResultList = new epgd.searchResultList({ - empty: epgd.tr.pages.search.empty + this.searchResultList = new epgd.searchResultList({ + empty: epgd.tr.pages.search.empty }, this); }, epgd.searchTimerDialog); -epgd.searchDialog.prototype.create = function () { - epgd.searchDialog.base.create.call(this); - var form = this.form, - search= this, - $result = $('
').appendTo(this.$win); - $('') - .insertAfter(form.tExpr) - .after('  '); - $(form.tType).parent().hide().parent().css('border-top','1px solid #ccc').insertAfter($(form.tVdr.parentNode.parentNode).hide()); - $('').insertAfter(form.tSName).click(function () { - search.form.tID.value = ''; - search.form.tSName.value += ' copy'; - search.form.tSName.select(); - }).prop("disabled", true); - $('').insertAfter(form.tSName).click(function () { - search.list.del(this.form.tID.value, function () { search.form.tID.value = '';search.loadSavedSearch() }); - }).prop("disabled", true); $('').insertAfter(form.tSName).click(function () { - var d = search.getData(); - if (!d.name) - return this.showError(epgd.tr.error.invalid, form.tSName); - search.save(d, null, null, function () { search.loadSavedSearch() }); - }); - $(form).submit(function () { - search.search($result); - return false; +epgd.searchDialog.prototype.create = function () { + epgd.searchDialog.base.create.call(this); + var form = this.form, + search= this, + $result = $('
').appendTo(this.$win); + $('') + .insertAfter(form.tExpr) + .after('  '); + $(form.tType).parent().hide().parent().css('border-top','1px solid #ccc').insertAfter($(form.tVdr.parentNode.parentNode).hide()); + $('').insertAfter(form.tSName).click(function () { + search.form.tID.value = ''; + search.form.tSName.value += ' copy'; + search.form.tSName.select(); + }).prop("disabled", true); + $('').insertAfter(form.tSName).click(function () { + search.list.del(this.form.tID.value, function () { search.form.tID.value = '';search.loadSavedSearch() }); + }).prop("disabled", true); $('').insertAfter(form.tSName).click(function () { + var d = search.getData(); + if (!d.name) + return this.showError(epgd.tr.error.invalid, form.tSName); + search.save(d, null, null, function () { search.loadSavedSearch() }); + }); + $(form).submit(function () { + search.search($result); + return false; }); this.$win.find('#sExpr').keyup(function (ev) { if (ev.keyCode == 13) { this.form.sSearch.click(); $(this).blur(); } }).focus(); //$(form.tExpr).parent().next().nextAll().wrapAll('
'); - this.$win.find('#sAdv').change(function () { + this.$win.find('#sAdv').change(function () { $(form).toggleClass("noAdv", !this.checked); search.resize(); }).prop('checked', epgd.profile.searchAdv == "1").change(); - $(form.tSName).autocomplete({ + $(form.tSName).autocomplete({ minLength: 0, - maxHeight: 300, - source:function(){return false}, // damit bei einem focus kein error ausgel�st wird - select: function (ev, ui) { - var d = ui.item.data || { id: '' }; - if (d.id) { - search.render(d); - search.form.sSearch.click(); - $([form.tDel, form.tCopy, form.tInactive]).prop("disabled", false); - return false; - } else { - form.tID.value = ''; - $([form.tDel, form.tCopy, form.tInactive]).prop("disabled", true); - } - } - }).focus(function () { - $(this).autocomplete("search", ""); + maxHeight: 300, + source:function(){return false}, // damit bei einem focus kein error ausgel�st wird + select: function (ev, ui) { + var d = ui.item.data || { id: '' }; + if (d.id) { + search.render(d); + search.form.sSearch.click(); + $([form.tDel, form.tCopy, form.tInactive]).prop("disabled", false); + return false; + } else { + form.tID.value = ''; + $([form.tDel, form.tCopy, form.tInactive]).prop("disabled", true); + } + } + }).focus(function () { + $(this).autocomplete("search", ""); }); - this.loadSavedSearch(); + this.loadSavedSearch(); } -epgd.searchDialog.prototype.loadSavedSearch = function () { - var form = this.form; - epgd.ajax({ url: epgd.login.url + "data/searchtimers?type=S" }, function (data) { - var list = []; - $.each(data.searchtimers, function (id, t) { - list.push({ value: t.name || t.expression, label: t.name || t.expression, data: t }); - }); - $(form.tSName).autocomplete("option", "source", list); - }); +epgd.searchDialog.prototype.loadSavedSearch = function () { + var form = this.form; + epgd.ajax({ url: epgd.login.url + "data/searchtimers?type=S" }, function (data) { + var list = []; + $.each(data.searchtimers, function (id, t) { + list.push({ value: t.name || t.expression, label: t.name || t.expression, data: t }); + }); + $(form.tSName).autocomplete("option", "source", list); + }); } -epgd.searchDialog.prototype.resize = function () { +epgd.searchDialog.prototype.resize = function () { var $result = this.$win.find('#searchResult'), h = $(window).height() - $result.offset().top - 20; if (h < 100) $result.css({ 'height': 'auto', 'overflow-y': 'visible' }); else - $result.css({ 'height': h + 'px', 'overflow-y': 'auto' }); + $result.css({ 'height': h + 'px', 'overflow-y': 'auto' }); } -epgd.searchDialog.prototype.render = function (t) { - if (!epgd.$con.find('#search').length) { +epgd.searchDialog.prototype.render = function (t) { + if (!epgd.$con.find('#search').length) { $('#menu_search').addClass("menu-active"); - this.create(); + this.create(); epgd.$con.html(''); this.$win.appendTo(epgd.$con); } - t = t || { searchfields: 1 }; - t.type = 'S'; - epgd.searchDialog.base.render.call(this, t); -} -epgd.searchDialog.prototype.close = function () { } + t = t || { searchfields: 1 }; + t.type = 'S'; + epgd.searchDialog.base.render.call(this, t); +} +epgd.searchDialog.prototype.close = function () { } diff --git a/http/src/js/eventDetail.js b/http/src/js/eventDetail.js index 939b7ff..6574aab 100644 --- a/http/src/js/eventDetail.js +++ b/http/src/js/eventDetail.js @@ -66,10 +66,20 @@ epgd.eventDetail.prototype.doRepeat = function (checkAvail) { } epgd.eventDetail.prototype.doPlay = function (checkAvail) { var t = parseInt(epgd.utils.now().getTime() / 1000, 10) - this.data.starttime; - if (t < 0 || t > this.data.duration) + if (t > this.data.duration) return false; - if (checkAvail) return true; - epgd.vdrs.current.switchChannel(this.data.channelid); + if (checkAvail) return !!epgd.vdrs.current.uuid; + if (t < 0 ){ // Umschalttimer + epgd.pages.timerList.save({ + type: 'V', + active: 1, + vdruuid: epgd.vdrs.current.uuid, + eventid: this.data.id, + channelid: this.data.channelid, + title: this.data.title + }); + } else + epgd.vdrs.current.switchChannel(this.data.channelid); } epgd.eventDetail.prototype.doPrev = function (checkAvail) { var t = this.data.starttime - 500, diff --git a/http/src/js/pages.timer.js b/http/src/js/pages.timer.js index 44b1cd7..c6501f0 100644 --- a/http/src/js/pages.timer.js +++ b/http/src/js/pages.timer.js @@ -14,9 +14,9 @@ epgd.sortTable.prototype = { + ($ths.last().find('.i-doc-new').wrapAll('
').parent().html() || '') + ''); }, showHead: function(){ - this.$con.find('>table>thead').show(); - this.filter(); - this.sort(); + this.$con.find('>table>thead').show(); + this.filter(); + this.sort(); }, getTable: function () { }, action: function ($el, iconName, data) { @@ -42,10 +42,10 @@ epgd.sortTable.prototype = { this.init(); this.update(searchData); }, - init: function () { + init: function () { var list = this, - cIndex = 0; - this.$con.find('>table').click(function (ev) { + cIndex = 0; + this.$con.find('>table').click(function (ev) { var $el = $(ev.target), el = $el[0], data = el.getAttribute('data-evId'), @@ -53,133 +53,133 @@ epgd.sortTable.prototype = { $lastSel; if (data) list.action($el, 'detail', data); - else if (ev.target.className == 'i-tv') { - epgd.vdrs.current.switchChannel(ev.target.parentNode.id); - } else { + 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) { + if ($el.length) { $el.parent().parent().find('.ui-state-highlight').removeClass('ui-state-highlight'); $el.addClass("ui-state-highlight"); - list.sort($el); - } else { + 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') { + 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) { + 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')); + $lastSel.prevAll(':lt(' + -d + '):visible').toggleClass('selected', $lastSel.hasClass('selected')); } else - this.lastSel = $el[0]; - } else if (el.nodeName == 'B') { + 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; + } + } } - return false; - } - }).find('>thead>tr').find('>th').each(function () { - this.cIndex = cIndex; - cIndex += this.colSpan; + 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]; + 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; + 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) { + if (!i.sortInfo) { i = i.cIndex; - for (l = 0; l < trs.length; l++) { + for (l = 0; l < trs.length; l++) { td = trs[l].cells[i]; - td.sort = td.getAttribute('data-sort') || $(td).text().toLowerCase(); - }; + td.sort = td.getAttribute('data-sort') || $(td).text().toLowerCase(); + }; } else i = i.cIndex; - trs.sort(function (a, b) { + 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); + 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]); + 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) { +epgd.timerEditChFormat = function (input) { var formats = ',SD,HD,3D', values = input.value, i; - if (values) { + if (values) { values = values.split(','); for (i = 0; i < values.length; i++) - formats = formats.replace(',' + values[i] + ',', ','); + formats = formats.replace(',' + values[i] + ',', ','); } $('
    ' + (values.length ? '
  1. ' + values.join('
  2. ') + '
  3. ' : '') + '
    ' + (formats.length > 1 ? '
  • ' + formats.slice(1).replace(/,/g, '
  • ') + '
  • ' : '') + '
') - .dialog({ + .dialog({ modal: true, - buttons: [{ + buttons: [{ text: epgd.tr.apply, - click: function () { + click: function () { var val = ''; $(this).find('ol > li').each(function () { val += ',' + this.innerHTML; }); input.value = val.slice(1); - $(this).dialog("close"); - } - }, { + $(this).dialog("close"); + } + }, { text: epgd.tr.cancel, - click: function () { - $(this).dialog("close"); - } - }] - }).find('ul,ol').sortable({ - connectWith: "ul,ol" - }).disableSelection(); + click: function () { + $(this).dialog("close"); + } + }] + }).find('ul,ol').sortable({ + connectWith: "ul,ol" + }).disableSelection(); }; @@ -208,16 +208,16 @@ epgd.timerListBase.prototype.getTable = function () { } epgd.timerListBase.prototype.update = function () { var timerList = this; - epgd.utils.loader.process(function () { + 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 { + 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 = { + 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 @@ -225,9 +225,10 @@ epgd.timerListBase.prototype.update = function () { 'P': '
' + epgd.tr.pages.timerList.timerStates.P + '
', // wartet auf Aufnhemebeginn 'U': '
' + epgd.tr.pages.timerList.timerStates.U + '
' // unbekannt }, + typeIcons = { 'V': 'i-tv', 'R': 'i-record', 'S': 'i-search' }, timerActions = epgd.tr.pages.timerList.timerActions, searchTimerIcon = '$title$'; - $.each(data.timers, function (id, t) { + $.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: '--' }, @@ -245,12 +246,12 @@ epgd.timerListBase.prototype.update = function () { + 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 || '') : '>') + '' + + '' + (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); + trs.push(tr); }); timerList.trs = trs; timerList.showHead(); @@ -258,11 +259,11 @@ epgd.timerListBase.prototype.update = function () { items: "div", content: function () { return this.innerHTML; } - })*/ + })*/ } epgd.utils.loader.close(); - $(window).trigger('timerlist_updated', timerList); - }); + $(window).trigger('timerlist_updated', timerList); + }); },true); } epgd.timerListBase.prototype.action = function ($el, iconName,data) { @@ -294,107 +295,107 @@ epgd.timerListBase.prototype.action = function ($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.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) { +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); - }); + 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 { + ids && allIDs.length && this.save(data, null, function (jqxhr) { + try { var ids = ','; - $(jqxhr.responseJSON.result.failed).each(function () { - ids += allIDs[this] + ','; + $(jqxhr.responseJSON.result.failed).each(function () { + ids += allIDs[this] + ','; }); - if (ids.length > 1) { - $(self.trs).each(function () { + if (ids.length > 1) { + $(self.trs).each(function () { if (ids.indexOf(',' + this.tData.id + ',') >= 0) - this.style.backgroundColor = 'red'; - }); - } + this.style.backgroundColor = 'red'; + }); + } } catch (e) { } - return false; + 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({ + epgd.utils.loader.process(function () { + epgd.ajax({ url: epgd.login.url + (url || timerList.o.saveUrl), type: 'post', - data: JSON.stringify(data) - }, function (data) { + 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); + 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.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 () { +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 + '
'; + + tr.endTime + '' + epgd.tr.pages.eventDetail.title + this.sortIcons + ''; } -epgd.searchResultList.prototype.update = function (d) { +epgd.searchResultList.prototype.update = function (d) { if (!d) return false; var timerList = this; - d.id && delete d.id; - d.name && delete d.name; + 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({ + 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) { + 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) { + 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) { + if (e.dones) { + for (i in e.dones) { d = e.dones[i]; icons += '' + d.state + ''; if (d.state == 'R') - trClass = ' class="ui-state-disabled"'; - } + trClass = ' class="ui-state-disabled"'; + } } trs.push($('' + epgd.channels.getHtml(e.channelid) + '' @@ -402,42 +403,42 @@ epgd.searchResultList.prototype.update = function (d) { + epgd.utils.formatTime(e.starttime) + '' + epgd.utils.formatTime(e.starttime + e.duration) + '' + e.title + '
' + (e.shorttext || '') - + '' + icons + '').tooltip()[0]); + + '' + icons + '').tooltip()[0]); }); timerList.trs = trs; - timerList.showHead(); + timerList.showHead(); } epgd.utils.loader.close(); timerList.dialog && timerList.dialog.resize && window.setTimeout(function(){timerList.dialog.resize();},100); - }); - },true); + }); + },true); }; // Timerliste eines Suchtimers - Klasse -epgd.searchTimerTimerList = epgd.utils.inherits(function (options, dialog) { - epgd.timerListBase.call(this, $.extend({ +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); + updateUrl: 'data/timers?state=P,R' + }, options), dialog); }, epgd.timerListBase); -epgd.searchTimerTimerList.prototype.getTable = function () { +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) { +epgd.searchTimerTimerList.prototype.update = function (d) { if (!d) - return false; + 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) { + 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) { + 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) + '' @@ -450,38 +451,38 @@ epgd.searchTimerTimerList.prototype.update = function (d) { + vdr.name + '
' + t.file + '' + editIcons + '')[0]; tr.tData = t; - trs.push(tr); + trs.push(tr); }); timerList.trs = trs; - timerList.showHead(); + timerList.showHead(); } timerList.dialog && timerList.dialog.resize && window.setTimeout(function () { timerList.dialog.resize(); }, 100); - epgd.utils.loader.close(); - }); - }); + 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 +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 = 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"') +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 = new epgd.timerListBase({ + updateUrl: 'data/donetimers', saveUrl: 'data/store-donetimers', + selectable: true, + right: epgd.rights.umTimer }); epgd.pages.timerListDone.getTable = function () { return '
' @@ -494,12 +495,12 @@ epgd.pages.timerListDone.getTable = function () { + '" data-t="0">' + '
'; } -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.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 = { +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 @@ -509,16 +510,16 @@ epgd.pages.timerListDone.stateIcons = { } 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) { + 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 { + if (!data.donetimers.length) { + timerList.hideHead(); + } else { var trs = [], tr, i, t, searchTimerIcon = '$title$'; - for (i in data.donetimers) { + for (i in data.donetimers) { t = data.donetimers[i]; tr = $('' + (t.state && timerList.stateIcons[t.state] || '') + '' @@ -530,28 +531,28 @@ epgd.pages.timerListDone.update = function () { + (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); + trs.push(tr); }; timerList.trs = trs; - timerList.showHead(); + timerList.showHead(); } epgd.utils.loader.close(); - $(window).trigger('timerlist_updated', timerList); - }); + $(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 +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 +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; @@ -571,26 +572,26 @@ epgd.pages.searchTimerList.action = function ($el, iconName, data) { 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 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) { + }, + toggle : function (doShow) { this.list.$con.toggle(doShow); - if (doShow) { - this.$td.css("height", "100px"); - this.list.update(this.data); + if (doShow) { + this.$td.css("height", "100px"); + this.list.update(this.data); } else - this.$td.css("height", "auto"); + this.$td.css("height", "auto"); } }, - options= { + options= { conSel: $('
').appendTo(document.body) }; $el[0].tList = dialog.data.type == 'S' ? new epgd.searchResultList(options, dialog) : new epgd.searchTimerTimerList(options, dialog); @@ -610,15 +611,15 @@ epgd.pages.searchTimerList.action = function ($el, iconName, data) { 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) { + 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) { + if (!data.searchtimers.length) { + timerList.hideHead(); + } else { + $.each(data.searchtimers, function (id, t) { var vdr = epgd.vdrs.list[t.vdruuid] || { name: '--' }, tr = $('' + '' @@ -626,14 +627,14 @@ epgd.pages.searchTimerList.update = function () { + (t.type == 'S' ? '>--' : ' data-sort="' + new String('00000' + t.hits).slice(-5) + '">' + t.hits) + '' + vdr.name + '' + editIcons + '')[0]; tr.tData = t; - trs.push(tr); + trs.push(tr); }); timerList.trs = trs; - timerList.showHead(); + timerList.showHead(); } epgd.utils.loader.close(); - $(window).trigger('searchTimerList_updated', timerList); - }); + $(window).trigger('searchTimerList_updated', timerList); + }); }); } epgd.pages.searchTimerList.triggerUpdate = function () { @@ -650,11 +651,11 @@ epgd.pages.searchTimerList.triggerUpdate = function () { epgd.pages.search = new epgd.searchDialog(); //message List -epgd.pages.messageList = new epgd.timerListBase({ - saveUrl: 'data/markmessages', - selectable: true +epgd.pages.messageList = new epgd.timerListBase({ + saveUrl: 'data/markmessages', + selectable: true }) -epgd.pages.messageList.getTable = function () { +epgd.pages.messageList.getTable = function () { return '' + '' + '' @@ -667,29 +668,29 @@ epgd.pages.messageList.getTable = function () { + '' + '' + '' - + '
id' + this.sortIcons + '' + 'Typ' + ' ' + this.sortIcons + '' + 'Zeit' + this.sortIcons + '
'; + + ''; } -epgd.pages.messageList.update = function (d) { +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) { + 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 { + if (!data.messages.length) { + messList.hideHead(); + } else { var trs = [], tr, i, t, - icons = { + icons = { 'N': '' + epgd.tr.pages.timerList.messageStates.N + '', - 'R': '' + epgd.tr.pages.timerList.messageStates.R + '' + 'R': '' + epgd.tr.pages.timerList.messageStates.R + '' }, - types = { + 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 + '
' + 'I': '
' + epgd.tr.pages.timerList.messageTypes.I + '
', + 'W': '
' + epgd.tr.pages.timerList.messageTypes.W + '
' }; - for (i in data.messages) { + for (i in data.messages) { t = data.messages[i]; tr = $('' + t.id + '' + '' + (types[t.type] ||'') +'' @@ -700,44 +701,44 @@ epgd.pages.messageList.update = function (d) { + '' + (icons[t.state] || '') + '' + '')[0]; tr.tData = t; - trs.push(tr); + 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 + : a.tData.state > b.tData.state }).slice()); - messList.showHead(); + messList.showHead(); } epgd.utils.loader.close(); - $(window).trigger('messagelist_updated', messList); - }); - }, true); -}; -epgd.pages.messageList.action = function ($el, iconName, data) { + $(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) { + 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; + 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); -} - + 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); +} + -- cgit v1.2.3