summaryrefslogtreecommitdiff
path: root/http/src
diff options
context:
space:
mode:
authorhorchi <vdr@jwendel.de>2017-07-25 15:54:58 +0200
committerhorchi <vdr@jwendel.de>2017-07-25 15:54:58 +0200
commit1044ac9a2151e887b4bc1995f74b04715a0348f8 (patch)
tree225a2c05fb0bc08452f4b1c9964d471fe7433b5f /http/src
parent65e13cfa23db0c3481f53a0313ef35b9e2e61d19 (diff)
downloadvdr-epg-daemon-1044ac9a2151e887b4bc1995f74b04715a0348f8.tar.gz
vdr-epg-daemon-1044ac9a2151e887b4bc1995f74b04715a0348f8.tar.bz2
2017-07-25: version 1.1.120 (rechner)\n - added: show constable in eventdetail, if episodename is available\n - added: show constable extracol 1-3 in eventdetail \n - fixed: if recording view was reloaded the functionallity in bar was lost\n \n1.1.121
Diffstat (limited to 'http/src')
-rw-r--r--http/src/js/eventDetail.js155
-rw-r--r--http/src/js/pages.records.js367
2 files changed, 263 insertions, 259 deletions
diff --git a/http/src/js/eventDetail.js b/http/src/js/eventDetail.js
index 8ff8548..939b7ff 100644
--- a/http/src/js/eventDetail.js
+++ b/http/src/js/eventDetail.js
@@ -45,14 +45,14 @@ epgd.eventDetail.prototype.doRepeat = function (checkAvail) {
$repeatHdl = win.$con.find('.repeat'),
searchData;
if (!$repeatHdl.length) {
- if (!this.searchResultList) {
- this.searchResultList = new epgd.searchResultList(null, {
- resize: function () {
+ if (!this.searchResultList) {
+ this.searchResultList = new epgd.searchResultList(null, {
+ resize: function () {
win.$con.last().find('td[data-evId="' + win.detail.data.id + '"]').parent().remove();
win.$con.accordion("refresh");
- $repeatHdl.click();
- }
- });
+ $repeatHdl.click();
+ }
+ });
}
$repeatHdl = $('<h3 class="repeat">' + epgd.tr.pages.eventDetail.repeat + '</h3>').appendTo(win.$con);
searchData = { searchfields: 1, expression: this.data.title, searchmode: 1, casesensitiv: 1, fromEventDetail: true };
@@ -238,7 +238,7 @@ epgd.eventDetail.win.prototype.render = function (detail) {
terms = sc.episode;
if (terms) {
if (terms.episodeoverview){
- if ( e.longdescription && terms.episodeoverview.length > e.longdescription.length)
+ if ( e.longdescription && terms.episodeoverview.length > e.longdescription.length)
desc = desc.replace(/^<div.+<\/div>/i, '');
desc= '<div title="episodeoverview">' + terms.episodeoverview + '</div>' + desc;
}
@@ -290,47 +290,50 @@ epgd.eventDetail.win.prototype.render = function (detail) {
+ (e.year ? tr.year + '<b>' + e.year + '</b><br />' : '');
info2 = (ep.part ? tr.part + '<b>' + ep.part + (ep.parts ? ' / ' + ep.parts + '' : '') + '</b><br />' : '')
+ (ep.season ? tr.season + '<b>' + ep.season + '</b><br />' : '')
- + (ep.number ? tr.number + '<b>' + ep.number + '</b><br />' : '');
+ + (ep.number ? tr.number + '<b>' + ep.number + '</b><br />' : '')
+ + (ep.extracol1 ? ep.extracol1 + '<br />' : '')
+ + (ep.extracol2 ? ep.extracol2 + '<br />' : '')
+ + (ep.extracol3 ? ep.extracol3 + '<br />' : '');
/*
- e.recordings = [
- {
- "matchdensityshorttext": 12,
- "owner": "7F13E490-09B3-401C-B26C-8B7F2F111014",
- "name": "Star Wars: Episode III - Die Rache der Sith",
- "duration": 10736,
- "path": "Die_Biene_Maja/S03E04/2014-03-23.06.53.29-0.rec",
- "md5path": "f6abd21ea13f52626723b3321c7a8c42",
- "matchdensitytitle": 68,
- "starttime": 1395553980,
- "title": "Star Wars: Episode III - Die Rache der Sith",
- "shorttext": "Science-Fiction (USA 2005)"
- },
- {
- "matchdensityshorttext": 48,
- "owner": "7F13E490-09B3-401C-B26C-8B7F2F111014",
- "name": "Star Wars: Das Erwachen der Macht",
- "duration": 8783,
- "path": "Das_Traumhotel/2016-05-15.18.28.64-0.rec",
- "md5path": "0279b0d04b68e891ef2b7e6d8bcdd059",
- "matchdensitytitle": 70,
- "starttime": 1463329680,
- "title": "Star Wars: Das Erwachen der Macht",
- "sho__rttext": "Star Wars - Episode VII: The Force Awakens"
- }
- ];
+ e.recordings = [
+ {
+ "matchdensityshorttext": 12,
+ "owner": "7F13E490-09B3-401C-B26C-8B7F2F111014",
+ "name": "Star Wars: Episode III - Die Rache der Sith",
+ "duration": 10736,
+ "path": "Die_Biene_Maja/S03E04/2014-03-23.06.53.29-0.rec",
+ "md5path": "f6abd21ea13f52626723b3321c7a8c42",
+ "matchdensitytitle": 68,
+ "starttime": 1395553980,
+ "title": "Star Wars: Episode III - Die Rache der Sith",
+ "shorttext": "Science-Fiction (USA 2005)"
+ },
+ {
+ "matchdensityshorttext": 48,
+ "owner": "7F13E490-09B3-401C-B26C-8B7F2F111014",
+ "name": "Star Wars: Das Erwachen der Macht",
+ "duration": 8783,
+ "path": "Das_Traumhotel/2016-05-15.18.28.64-0.rec",
+ "md5path": "0279b0d04b68e891ef2b7e6d8bcdd059",
+ "matchdensitytitle": 70,
+ "starttime": 1463329680,
+ "title": "Star Wars: Das Erwachen der Macht",
+ "sho__rttext": "Star Wars - Episode VII: The Force Awakens"
+ }
+ ];
*/
if (e.recordings)
- for (i in e.recordings) {
- terms= e.recordings[i];
+ for (i in e.recordings) {
+ terms= e.recordings[i];
recordings += '<div class="rec" data-start="' + terms.starttime + '" data-owner="' + (terms.owner || '')
+ '" data-md5="' + terms.md5path + '" data-path="' + terms.path + '">'
+ '<em>' + epgd.utils.formatDateTime(terms.starttime) + '</em><u>' + parseInt(terms.duration / 60, 10) + ' ' + epgd.tr.minutes
+ '</u><b onclick="new epgd.recordDetail(this.parentNode).render()">'
- + '<div class="progress" title="' + terms.matchdensitytitle + '% ' + epgd.tr.pages.search.matchdensity + '"><div style="width:' + terms.matchdensitytitle + '%" ></div></div>' + terms.title
+ + '<div class="progress" title="' + terms.matchdensitytitle + '% ' + epgd.tr.pages.search.matchdensity + '"><div style="width:' + terms.matchdensitytitle + '%" ></div></div>' + terms.title
+ (terms.shorttext ? '<i><div class="progress" title="' + terms.matchdensityshorttext + '% ' + epgd.tr.pages.search.matchdensity + '"><div style="width:' + terms.matchdensityshorttext + '%" ></div></div>' + terms.shorttext + '</i>' : '')
- + '</b></div>';
+ + '</b></div>';
}
this.$con = $('<div><h3><div class="date">' + $.datepicker.formatDate(isMobile ? 'd. M y' : 'd. MM yy', epgd.utils.date(e.starttime)) + '</div>'
@@ -366,7 +369,7 @@ epgd.eventDetail.win.prototype.render = function (detail) {
+ '<div class="colFull desc">' + (desc ? desc.replace(/\n/g, '<br />') : '') + '</div>'
+ '</div>'
+ extInfo
- + (e.category == 'Serie' || sc.isSerie ? '<h3 data-conti="' + constTitle + '"><span>' + tr.constabelInfo + '</span></h3><div class="desc">'
+ + (e.category == 'Serie' || sc.isSerie || ep.episodename ? '<h3 data-conti="' + constTitle + '"><span>' + tr.constabelInfo + '</span></h3><div class="desc">'
+ '<a class="iAsButton i-edit" href="' + epgd.profile.constabelEditPath + encodeURIComponent(constTitle) + '.episodes' + '" target="constabel">' + epgd.tr.edit + '</a>'
+ '<a class="iAsButton i-link-ext" href="' + epgd.profile.constabelLinkPath + encodeURIComponent(constTitle) + '" target="constabel">' + epgd.tr.pages.eventDetail.addConstableLink + '</a>'
+ epgd.pages.help.getButton('constabel',true)
@@ -382,33 +385,33 @@ epgd.eventDetail.win.prototype.render = function (detail) {
active: 0,
beforeActivate: function(ev, ui){
if (ui.newHeader.attr('data-conti')) {
- epgd.utils.loader.process(function () {
- epgd.ajax({ url: epgd.login.url + 'data/proxy?id=constabel&title=' + encodeURIComponent(encodeURIComponent(ui.newHeader.attr('data-conti'))) + '&_' + new Date().getTime(), dataType: "html", contentType: "text/plain; charset=utf-8" }, function (data) {
- if (data.indexOf('Error:') == -1) {
+ epgd.utils.loader.process(function () {
+ epgd.ajax({ url: epgd.login.url + 'data/proxy?id=constabel&title=' + encodeURIComponent(encodeURIComponent(ui.newHeader.attr('data-conti'))) + '&_' + new Date().getTime(), dataType: "html", contentType: "text/plain; charset=utf-8" }, function (data) {
+ if (data.indexOf('Error:') == -1) {
var $pre = ui.newPanel.find('#cRaw'),
thead = '<thead><tr><th>' + tr.season + '</th><th>' + tr.part + '</th><th>' + tr.number + '</th><th>' + tr.title + '</th>',
tbody = '<tbody>',
lines = data.split(/\r?\n/),
line, m, i;
- for (i = 0; i < lines.length; i++) {
+ for (i = 0; i < lines.length; i++) {
line = lines[i];
- if (line.charAt(0) == '#') {
+ if (line.charAt(0) == '#') {
m = line.match(/EXTRACOL[0-9] (.+)/i);
if (m)
- thead += '<th>' + m[1] + '</th>';
- } else {
+ thead += '<th>' + m[1] + '</th>';
+ } else {
m = line.split(/\t/);
if (m.length > 3)
- tbody += '<tr><td>' + m.join('</td><td>') + '</td></tr>';
- }
+ tbody += '<tr><td>' + m.join('</td><td>') + '</td></tr>';
+ }
}
$pre.html(data).hide().before('<a href="#" onclick="return !!$(\'#cRaw\').toggle()[0].scrollIntoView()">Raw</a>');
- $pre.before('<table>' + thead + '</thead>' + tbody + '</tbody></table>');
- } else
- ui.newPanel.find('#cRaw').html(epgd.tr.error.noData);
- epgd.utils.loader.close();
- });
- ui.newHeader.removeAttr('data-conti');
+ $pre.before('<table>' + thead + '</thead>' + tbody + '</tbody></table>');
+ } else
+ ui.newPanel.find('#cRaw').html(epgd.tr.error.noData);
+ epgd.utils.loader.close();
+ });
+ ui.newHeader.removeAttr('data-conti');
},true);
}
}
@@ -430,8 +433,8 @@ epgd.eventDetail.win.prototype.render = function (detail) {
$(window).trigger("resize.eventDetail");
this.$openDialogs = $('.ui-dialog:visible:not(.ui-state-disabled)').addClass("ui-state-disabled");
$(document).bind("keyup.eventDetail", function (e) {
- if (e.keyCode == 27) {
- $(window).trigger("epgd_close.eventDetail");
+ if (e.keyCode == 27) {
+ $(window).trigger("epgd_close.eventDetail");
}
});
epgd.pages.help.initButtons(this.$con);
@@ -450,7 +453,7 @@ epgd.recordDetail.prototype.load = function () {
});
return this;
}
-epgd.recordDetail.prototype.doRecord = function (eData) {
+epgd.recordDetail.prototype.doRecord = function (eData) {
if (eData === true) return epgd.tr.pages.records.similarTimer; // eData = getTitle
epgd.eventDetail.prototype.doRecord.call(this, eData);
}
@@ -475,47 +478,47 @@ epgd.recordDetail.prototype.doNext = function (checkAvail) {
$elem.find('B').click();
}
-epgd.doneTimerDetail = epgd.utils.inherits(function (tr) {
+epgd.doneTimerDetail = epgd.utils.inherits(function (tr) {
this.tr = tr;
- return epgd.eventDetail.call(this);
+ return epgd.eventDetail.call(this);
}, epgd.eventDetail);
-epgd.doneTimerDetail.prototype.load= function () {
+epgd.doneTimerDetail.prototype.load= function () {
var self = this;
- epgd.ajax({ url: epgd.login.url + 'data/donetimer?id=' + this.tr.tData.id, async: false, cache: false }, function (data) {
+ epgd.ajax({ url: epgd.login.url + 'data/donetimer?id=' + this.tr.tData.id, async: false, cache: false }, function (data) {
var t = data.donetimer;
if (t.state)
t.cntlongdescription = epgd.pages.timerListDone.stateIcons[t.state];
- t.episode = { lang: t.episodelang, season: t.episodeseason, part: t.episodepart };
+ t.episode = { lang: t.episodelang, season: t.episodeseason, part: t.episodepart };
self.id = data.id;
- self.expire = epgd.utils.now().getTime() + 900000;
- delete t.timerid;
- delete t.id;
- self.data = t;
+ self.expire = epgd.utils.now().getTime() + 900000;
+ delete t.timerid;
+ delete t.id;
+ self.data = t;
});
- return this;
-};
-epgd.doneTimerDetail.prototype.doRecord= function (eData) {
+ return this;
+};
+epgd.doneTimerDetail.prototype.doRecord= function (eData) {
if (eData === true) return epgd.tr.pages.records.similarTimer;
epgd.eventDetail.prototype.doRecord.call(this, eData);
//epgd.pages.searchTimerList.dialog.render(eData || this.data);
};
-epgd.doneTimerDetail.prototype.doPlay= function (checkAvail) {
- return false;
+epgd.doneTimerDetail.prototype.doPlay= function (checkAvail) {
+ return false;
};
-epgd.doneTimerDetail.prototype.doPrev= function (checkAvail) {
+epgd.doneTimerDetail.prototype.doPrev= function (checkAvail) {
var $elem = $(this.tr).prev('tr');
if (!$elem.length)
return false;
if (checkAvail) return true;
- $elem.find('td').click();
+ $elem.find('td').click();
};
-epgd.doneTimerDetail.prototype.doNext= function (checkAvail) {
+epgd.doneTimerDetail.prototype.doNext= function (checkAvail) {
var $elem = $(this.tr).next('tr');
if (!$elem.length)
return false;
if (checkAvail) return true;
- $elem.find('td').click();
-};
+ $elem.find('td').click();
+};
$(document).ready(function () {
diff --git a/http/src/js/pages.records.js b/http/src/js/pages.records.js
index 640a27a..0aadd5d 100644
--- a/http/src/js/pages.records.js
+++ b/http/src/js/pages.records.js
@@ -1,180 +1,181 @@
-epgd.pages.records = {
+epgd.pages.records = {
render: function () {
- if (!(epgd.login.rights & epgd.rights.umRecordings) == epgd.rights.umRecordings) return epgd.utils.popup(epgd.tr.error.forbidden, { title: epgd.tr.error.error });
+ if (!(epgd.login.rights & epgd.rights.umRecordings) == epgd.rights.umRecordings) return epgd.utils.popup(epgd.tr.error.forbidden, { title: epgd.tr.error.error });
if (!epgd.profile.recordSubFolderSort)
epgd.profile.recordSubFolderSort = 1;
- $('#menu_records').addClass("menu-active");
- var tr = epgd.tr.pages.records;
-
+ $('#menu_records').addClass("menu-active");
+ var tr = epgd.tr.pages.records;
+
if (!this.$bar) {
- this.$bar = $('<div class="ui-widget ui-state-highlight ui-corner-all" style="padding:3px 10px">'
- + '<button class="iAsButton i-trash" title="' + epgd.tr.del + '"/>'
- + '<div id="recBar">'
- + '<button class="iAsButton i-refresh" onclick="epgd.pages.records.update()">' + epgd.tr.reload + '</button>'
- + epgd.pages.help.getIcon('recRefresh') + '&nbsp;&nbsp; '
- + epgd.tr.pages.search.search + epgd.pages.help.getIcon('recSearch') + '<button class="iAsButton" onclick="this.checked = !this.checked; $(this).toggleClass(\'ui-state-highlight\', this.checked); epgd.pages.records.search();">&nbsp;&#8727;</button>'
- + '<input id="rSVal" type="text" onkeyup="epgd.pages.records.search(this.value)" />'
- + '<button class="iAsButton" onclick="this.checked = !this.checked;$(this).toggleClass(\'ui-state-highlight\', this.checked); epgd.pages.records.search();">&#8727;&nbsp;</button>'
- + '<span style="display:none">'
- + '<button class="iAsButton i-rewind" onclick="epgd.pages.records.searchMove(1)"></button>'
- + '<span id="rSCnt">0</span>'
- + '<button class="iAsButton i-forward" onclick="epgd.pages.records.searchMove(-1)"></button>'
- + '</span>&nbsp;&nbsp; <input type="checkbox" id="dragdrop"' + ($.support.touch ? '' : ' checked="checked"') + ' onchange="epgd.pages.records.dd(this.checked)" />'
- + tr.ddLabel + epgd.pages.help.getIcon('recDD')
- + '</div>'
- +'</div>');
- this.$trash = this.$bar.find('.i-trash').droppable({
- accept: ".rec",
- hoverClass: "ui-state-hover",
- tolerance: "pointer",
- drop: function (ev, ui) {
- var elem = ui.helper.context;
- epgd.utils.confirm(epgd.tr.pages.records.deleteMessage.replace("$src$", elem.getAttribute('data-path')), function (ok) {
- ok && epgd.pages.records.del(elem);
- });
- return false;
- }
- }).click(function () {
- var $recs = $("#records").find('.rec.selected');
- $recs.length && epgd.utils.confirm(epgd.tr.confirmDelete + ($recs.length > 1 ? '<br />' + $recs.length + epgd.tr.entries : ''), function (ok) {
- ok && $recs.each(function () {
- epgd.pages.records.del(this);
- });
- });
- });
+ this.$bar = $('<div class="ui-widget ui-state-highlight ui-corner-all" style="padding:3px 10px">'
+ + '<button class="iAsButton i-trash" title="' + epgd.tr.del + '"/>'
+ + '<div id="recBar">'
+ + '<button class="iAsButton i-refresh" onclick="epgd.pages.records.update()">' + epgd.tr.reload + '</button>'
+ + epgd.pages.help.getIcon('recRefresh') + '&nbsp;&nbsp; '
+ + epgd.tr.pages.search.search + epgd.pages.help.getIcon('recSearch') + '<button class="iAsButton" onclick="this.checked = !this.checked; $(this).toggleClass(\'ui-state-highlight\', this.checked); epgd.pages.records.search();">&nbsp;&#8727;</button>'
+ + '<input id="rSVal" type="text" onkeyup="epgd.pages.records.search(this.value)" />'
+ + '<button class="iAsButton" onclick="this.checked = !this.checked;$(this).toggleClass(\'ui-state-highlight\', this.checked); epgd.pages.records.search();">&#8727;&nbsp;</button>'
+ + '<span style="display:none">'
+ + '<button class="iAsButton i-rewind" onclick="epgd.pages.records.searchMove(1)"></button>'
+ + '<span id="rSCnt">0</span>'
+ + '<button class="iAsButton i-forward" onclick="epgd.pages.records.searchMove(-1)"></button>'
+ + '</span>&nbsp;&nbsp; <input type="checkbox" id="dragdrop"' + ($.support.touch ? '' : ' checked="checked"') + ' onchange="epgd.pages.records.dd(this.checked)" />'
+ + tr.ddLabel + epgd.pages.help.getIcon('recDD')
+ + '</div>'
+ +'</div>');
+ this.$trash = this.$bar.find('.i-trash');
this.curSearch = {
pattern: '', searchValue: '', hits: $(), cur: 0, $count: this.$bar.find('#rSCnt')
, fromStart: this.$bar.find('#rSVal').prev('button')[0]
, toEnd: this.$bar.find('#rSVal').next('button')[0]
}
- epgd.pages.help.initButtons(this.$bar);
- }
- this.$bar.insertAfter(epgd.$menu);
- epgd.$menu.checkMenuSize();
+ }
+ this.$bar.insertAfter(epgd.$menu);
+ this.$trash.droppable({
+ accept: ".rec",
+ hoverClass: "ui-state-hover",
+ tolerance: "pointer",
+ drop: function (ev, ui) {
+ var elem = ui.helper.context;
+ epgd.utils.confirm(epgd.tr.pages.records.deleteMessage.replace("$src$", elem.getAttribute('data-path')), function (ok) {
+ ok && epgd.pages.records.del(elem);
+ });
+ return false;
+ }
+ }).click(function () {
+ var $recs = $("#records").find('.rec.selected');
+ $recs.length && epgd.utils.confirm(epgd.tr.confirmDelete + ($recs.length > 1 ? '<br />' + $recs.length + epgd.tr.entries : ''), function (ok) {
+ ok && $recs.each(function () {
+ epgd.pages.records.del(this);
+ });
+ });
+ });
+ epgd.pages.help.initButtons(this.$bar);
+ epgd.$menu.checkMenuSize();
$(window).bind("epgd_close.records", function () {
epgd.pages.records.$bar.remove();
epgd.$menu.checkMenuSize();
$(window).unbind(".records");
- });
- epgd.$con.html('<div id="records"></div>');
+ });
+ epgd.$con.html('<div id="records"></div>');
epgd.utils.loader.process(function () {
epgd.ajax({ url: epgd.login.url + "data/recordings", cache: false }, function (data) {
- var recs = data.recordings,
- rec, key, paths, t, p, i,
- tree = { f: {}, r: [] },
- vdrs = {},
- vdr, v,
- html = '',
- min = ' ' + epgd.tr.minutes,
- $divs,
- sortFunc = epgd.profile.recordSubFolderSort == 6 ? function (a, b) { return a.starttime > b.starttime ? -1 : 1 }
- : epgd.profile.recordSubFolderSort == 5 ? function (a, b) { return a.starttime > b.starttime ? 1 : -1 }
- : epgd.profile.recordSubFolderSort == 4 ? function (a, b) { return a.path > b.path ? -1 : 1 }
- : epgd.profile.recordSubFolderSort == 3 ? function (a, b) { return a.path > b.path ? 1 : -1 }
- : epgd.profile.recordSubFolderSort == 2 ? function (a, b) { return a.tit > b.tit ? -1 : 1 }
- : function (a, b) { return a.tit > b.tit ? 1 : -1 };
-
+ var recs = data.recordings,
+ rec, key, paths, t, p, i,
+ tree = { f: {}, r: [] },
+ vdrs = {},
+ vdr, v,
+ html = '',
+ min = ' ' + epgd.tr.minutes,
+ $divs,
+ sortFunc = epgd.profile.recordSubFolderSort == 6 ? function (a, b) { return a.starttime > b.starttime ? -1 : 1 }
+ : epgd.profile.recordSubFolderSort == 5 ? function (a, b) { return a.starttime > b.starttime ? 1 : -1 }
+ : epgd.profile.recordSubFolderSort == 4 ? function (a, b) { return a.path > b.path ? -1 : 1 }
+ : epgd.profile.recordSubFolderSort == 3 ? function (a, b) { return a.path > b.path ? 1 : -1 }
+ : epgd.profile.recordSubFolderSort == 2 ? function (a, b) { return a.tit > b.tit ? -1 : 1 }
+ : function (a, b) { return a.tit > b.tit ? 1 : -1 };
+
for (vdr in epgd.vdrs.list) {
- v = epgd.vdrs.list[vdr];
- if (!v.usecommonrecfolder)
- vdrs[vdr] = { f: {}, r: [] };
+ v = epgd.vdrs.list[vdr];
+ if (!v.usecommonrecfolder)
+ vdrs[vdr] = { f: {}, r: [] };
html += '<div>VDR - ' + v.name + ': ' + v.videodir + ' - ' + parseInt(v.videofree / 1000, 10) + ' GB ' + tr.available + ' / ' + parseInt(v.videototal / 1000, 10) + ' GB</div>';
- }
- if (!$('#dragdrop').parent().length) //.append(html)
- return false;
- epgd.$con.find('#records').before(html);
- html = '';
-
+ }
+ if (!$('#dragdrop').parent().length) //.append(html)
+ return false;
+ epgd.$con.find('#records').before(html);
+ html = '';
+
for (i in recs) {
- rec = recs[i];
- t = vdrs[rec.vdruuid] || tree;
- paths = rec.path.split('/');
- paths.pop();
+ rec = recs[i];
+ t = vdrs[rec.vdruuid] || tree;
+ paths = rec.path.split('/');
+ paths.pop();
for (p = 0; p < paths.length; p++) {
- key = paths[p].replace(/_/g, ' ');
+ key = paths[p].replace(/_/g, ' ');
t = t.f[key] || (t.f[key] = { f: {}, r: [] });
- }
+ }
t.r.push(rec);
- }
-
+ }
+
function checkTree(t) {
- var hasContent = false,
- subFolder, subTree;
- t.cnt = 0;
+ var hasContent = false,
+ subFolder, subTree;
+ t.cnt = 0;
for (subFolder in t.f) {
- subTree = t.f[subFolder];
- if (subTree.r.length == 1)
- t.r.push(subTree.r.pop());
- checkTree(subTree);
+ subTree = t.f[subFolder];
+ if (subTree.r.length == 1)
+ t.r.push(subTree.r.pop());
+ checkTree(subTree);
if (checkTree(subTree)) {
hasContent = true;
t.cnt += subTree.cnt;
- } else
+ } else
delete t.f[subFolder];
- }
- if (!hasContent)
- delete t.f;
- t.cnt += t.r.length;
+ }
+ if (!hasContent)
+ delete t.f;
+ t.cnt += t.r.length;
return hasContent || t.r.length > 0;
- }
-
+ }
+
function renderTree(t) {
Object.keys(t.f).sort().forEach(function (subFolder) {
- var subTree = t.f[subFolder],
- i;
- html += subFolder ? '<div class="folder"><h4><span class="i-folder-closed">(' + (subTree.cnt) + ')</span><m class="i-"/>' + subFolder + '</h4>' : '<div>';
- subTree.f && renderTree(subTree);
+ var subTree = t.f[subFolder],
+ i;
+ html += subFolder ? '<div class="folder"><h4><span class="i-folder-closed">(' + (subTree.cnt) + ')</span><m class="i-"/>' + subFolder + '</h4>' : '<div>';
+ subTree.f && renderTree(subTree);
if (subTree.r.length) {
for (i in subTree.r) {
- rec = subTree.r[i];
- rec.tit = ((rec.name != subFolder ? rec.name : '')
- + (subFolder != rec.title && (rec.title != rec.name) ? '<br />' + rec.title : '')
- + (rec.shorttext && (rec.shorttext != rec.name) ? '<i>' + rec.shorttext + '</i>' : '')) || subFolder;
- rec.html = '<div class="rec" data-start="' + rec.starttime + '" data-owner="' + (rec.owner || '')
- + '" data-md5="' + rec.md5path + '" data-path="' + rec.path + '">'
- + '<em>' + epgd.utils.formatDateTime(rec.starttime) + '</em><u>' + parseInt(rec.duration / 60, 10) + min + '</u><b>'
- + rec.tit
+ rec = subTree.r[i];
+ rec.tit = ((rec.name != subFolder ? rec.name : '')
+ + (subFolder != rec.title && (rec.title != rec.name) ? '<br />' + rec.title : '')
+ + (rec.shorttext && (rec.shorttext != rec.name) ? '<i>' + rec.shorttext + '</i>' : '')) || subFolder;
+ rec.html = '<div class="rec" data-start="' + rec.starttime + '" data-owner="' + (rec.owner || '')
+ + '" data-md5="' + rec.md5path + '" data-path="' + rec.path + '">'
+ + '<em>' + epgd.utils.formatDateTime(rec.starttime) + '</em><u>' + parseInt(rec.duration / 60, 10) + min + '</u><b>'
+ + rec.tit
+ '</b></div>';
};
subTree.r.sort(sortFunc);
for (i in subTree.r) { html += subTree.r[i].html; }
- }
+ }
html += '</div>';
});
- }
-
- p = {};
- if (checkTree(tree))
- p[tr.commonRecFolder] = tree;
+ }
+
+ p = {};
+ if (checkTree(tree))
+ p[tr.commonRecFolder] = tree;
for (vdr in vdrs) {
- t = vdrs[vdr];
+ t = vdrs[vdr];
if (checkTree(t)) {
p['VDR - ' + epgd.vdrs.list[vdr].name] = t;
}
- }
- renderTree({ f: p });
-
- $divs = epgd.$con.find('#records').html(html);
+ }
+ renderTree({ f: p });
+
+ $divs = epgd.$con.find('#records').html(html);
if (!$divs.length)
return false;
$divs = $divs.click(epgd.pages.records.action).find('>div');
- if ($divs.length == 1)
+ if ($divs.length == 1)
$divs.first().toggleClass('open');
- epgd.pages.records.$menu = $('<ul class="ui-menu ui-widget ui-widget-content" style="position:absolute">'
- + '<li class="ui-menu-item" data-type="title"><a class="iAsButton i-sort-name-up" data-sort="1"></a>&nbsp;<a class="iAsButton i-sort-name-down" data-sort="2"></a>&nbsp;' + epgd.tr.pages.eventDetail.title + '</li>'
- + '<li class="ui-menu-item" data-type="path"><a class="iAsButton i-sort-name-up" data-sort="3"></a>&nbsp;<a class="iAsButton i-sort-name-down" data-sort="4"></a>&nbsp;' + epgd.tr.pages.timerList.folder + '</li>'
- + '<li class="ui-menu-item" data-type="start"><a class="iAsButton i-sort-name-up" data-sort="5"></a>&nbsp;<a class="iAsButton i-sort-name-down" data-sort="6"></a>&nbsp;' + epgd.tr.pages.timerList.recordTime + '</li>'
+ epgd.pages.records.$menu = $('<ul class="ui-menu ui-widget ui-widget-content" style="position:absolute">'
+ + '<li class="ui-menu-item" data-type="title"><a class="iAsButton i-sort-name-up" data-sort="1"></a>&nbsp;<a class="iAsButton i-sort-name-down" data-sort="2"></a>&nbsp;' + epgd.tr.pages.eventDetail.title + '</li>'
+ + '<li class="ui-menu-item" data-type="path"><a class="iAsButton i-sort-name-up" data-sort="3"></a>&nbsp;<a class="iAsButton i-sort-name-down" data-sort="4"></a>&nbsp;' + epgd.tr.pages.timerList.folder + '</li>'
+ + '<li class="ui-menu-item" data-type="start"><a class="iAsButton i-sort-name-up" data-sort="5"></a>&nbsp;<a class="iAsButton i-sort-name-down" data-sort="6"></a>&nbsp;' + epgd.tr.pages.timerList.recordTime + '</li>'
+ '</ul>').hide().appendTo(epgd.$con);
$('#dragdrop').change();
epgd.pages.records.curSearch.$recs = null;
epgd.utils.loader.close();
});
},true);
- },
+ },
search: function (searchValue) {
var cs = this.curSearch,
- sLength,
- $recs,
+ sLength,
+ $recs,
pattern,
fromStart = cs.fromStart.checked,
toEnd = cs.toEnd.checked;
@@ -219,7 +220,7 @@ epgd.pages.records = {
this.searchMove(0);
} else
cs.$count.parent().hide();
- },
+ },
searchMove: function (dir) {
this.curSearch.cur += dir;
var n = this.curSearch.hits[this.curSearch.cur];
@@ -232,15 +233,15 @@ epgd.pages.records = {
$(n).css({ 'background-color': 'green' });
window.setTimeout(function () { $(n).css({ 'background-color': '' }); },1500);
}
- },
+ },
action: function (ev) {
- var elem = ev.target; // aktueller Sortiebutton, bzw. inital jquery-elment
- if (elem.nodeName == 'MARK')
- elem = elem.parentNode;
+ var elem = ev.target; // aktueller Sortiebutton, bzw. inital jquery-elment
+ if (elem.nodeName == 'MARK')
+ elem = elem.parentNode;
if (elem.nodeName == 'M') {
epgd.pages.records.$menu.show().position({
- my: "left top",
- at: "left bottom",
+ my: "left top",
+ at: "left bottom",
of: elem
}).find('a').removeClass('ui-state-highlight');
epgd.pages.records.$menu.find('a[data-sort=' + (elem.curSort || epgd.profile.recordSubFolderSort) +']').addClass('ui-state-highlight');
@@ -255,23 +256,23 @@ epgd.pages.records = {
epgd.pages.records.$menu.hide();
$(document).unbind('.recmenu');
}).bind("keyup.recmenu", function (e) {
- if (e.keyCode == 27)
+ if (e.keyCode == 27)
$(document).trigger("click.recmenu");
});
return false;
- }
-
- if (elem.nodeName == 'I' || elem.nodeName == 'SPAN')
- elem = elem.parentNode;
+ }
+
+ if (elem.nodeName == 'I' || elem.nodeName == 'SPAN')
+ elem = elem.parentNode;
if (elem.nodeName == 'B') {
- elem = elem.parentNode;
- if (!elem.recDetail)
- elem.recDetail = new epgd.recordDetail(elem);
+ elem = elem.parentNode;
+ if (!elem.recDetail)
+ elem.recDetail = new epgd.recordDetail(elem);
epgd.utils.loader.process(function () {
elem.recDetail.render();
});
} else if (elem.nodeName == 'H4') {
- elem = elem.parentNode;
+ elem = elem.parentNode;
if (elem.nodeName == 'DIV' && elem.className.indexOf('folder') >= 0) {
if (elem.className.indexOf('open') == -1) {
if ($(window).width() < 500) {
@@ -285,7 +286,7 @@ epgd.pages.records = {
}
} else
$(elem).closest('.rec').toggleClass('selected');
- },
+ },
dd: function (enable) {
var $records = $("#records"),
$recs = $records.find('.rec').has('.ui-draggable');
@@ -307,7 +308,7 @@ epgd.pages.records = {
document.body.style.paddingTop = epgd.pages.records.$bar.height() + 'px';
document.body.scrollTop -= ev.pageY - $(ev.delegateTarget).closest('.folder').offset().top;
/*$(document).bind("keyup.dd", [this], function (ev) {
- if (ev.keyCode == 27)
+ if (ev.keyCode == 27)
$.ui.ddmanager.dragStop($(ev.data[0]).draggable("instance"), ev); //$(ev.data[0]).draggable("cancel");
}); */
},
@@ -320,44 +321,44 @@ epgd.pages.records = {
} else if ($recs.length){
$recs.draggable(enable ? "enable" : "disable");
}
- },
+ },
__dropSettings: {
accept: ".rec",
hoverClass: "ui-state-hover",
tolerance: 'pointer',
drop: function (ev, ui) {
console.log("Dropped!", ev, ui);
- var $elem = $(ev.target),
- path = '';
+ var $elem = $(ev.target),
+ path = '';
do {
path = $elem.text().replace(/^\(.*\)/,'') + '/' + path;
$elem = $elem.parent();
- } while (($elem = $elem.prevAll('h4')).length);
+ } while (($elem = $elem.prevAll('h4')).length);
epgd.pages.records.move(ui.draggable.context, path.slice(path.indexOf('/', 2) + 1).replace(/ /g, '_'),ev.target.parentNode)
- return false;
+ return false;
}
- },
- update: function () {
- epgd.ajax({ url: epgd.login.url + "data/updaterecordings" }, function (data) {
- epgd.utils.topInfo(epgd.tr.pages.records.refreshMessage.replace('$sec$', 5), { autoClose: 5000 });
- $(window).trigger("epgd_close.records");
- window.setTimeout(function () { epgd.pages.records.render(); }, 5000);
- });
- },
- move: function (elem, path, folder) {
- var curPath = elem.getAttribute('data-path').split('/'),
- name = curPath.pop(), // 2016-08-21.11.18.59-0.rec entfernen
- i,
- endPos= 0;
- curPath = curPath.join('/') + '/';
+ },
+ update: function () {
+ epgd.ajax({ url: epgd.login.url + "data/updaterecordings" }, function (data) {
+ epgd.utils.topInfo(epgd.tr.pages.records.refreshMessage.replace('$sec$', 5), { autoClose: 5000 });
+ $(window).trigger("epgd_close.records");
+ window.setTimeout(function () { epgd.pages.records.render(); }, 5000);
+ });
+ },
+ move: function (elem, path, folder) {
+ var curPath = elem.getAttribute('data-path').split('/'),
+ name = curPath.pop(), // 2016-08-21.11.18.59-0.rec entfernen
+ i,
+ endPos= 0;
+ curPath = curPath.join('/') + '/';
for (i = 0; i < Math.min(path.length, curPath.length) && path[i] == curPath[i]; i++) {
if (path[i] == '/')
endPos= i;
- }
- curPath = window.prompt(epgd.tr.pages.records.moveMessage.replace("$src$", curPath), path.concat(curPath.slice(endPos)).replace(/\/{2,}/g, '/').replace(/\/$/, ''));
- if (curPath) {
- epgd.ajax({ url: epgd.login.url + 'data/renamerecording?starttime=' + elem.getAttribute('data-start') + '&md5path=' + elem.getAttribute('data-md5') + '&owner=' + elem.getAttribute('data-owner') + '&name=' + curPath.replace(/\//g, '~'), async: true }, function (data) {
- data = data.result;
+ }
+ curPath = window.prompt(epgd.tr.pages.records.moveMessage.replace("$src$", curPath), path.concat(curPath.slice(endPos)).replace(/\/{2,}/g, '/').replace(/\/$/, ''));
+ if (curPath) {
+ epgd.ajax({ url: epgd.login.url + 'data/renamerecording?starttime=' + elem.getAttribute('data-start') + '&md5path=' + elem.getAttribute('data-md5') + '&owner=' + elem.getAttribute('data-owner') + '&name=' + curPath.replace(/\//g, '~'), async: true }, function (data) {
+ data = data.result;
if (data && data.state == 200) {
var $elem = $(elem),
$counter = $elem.prevAll('h4').find('span'),
@@ -390,15 +391,15 @@ epgd.pages.records = {
epgd.pages.records.sort(folder);
epgd.utils.topInfo(epgd.tr.dataSaved);
epgd.pages.records.__updateRec(elem);
- }
+ }
else {
- epgd.utils.topInfo(data.message, { isError: 1 });
+ epgd.utils.topInfo(data.message, { isError: 1 });
return false;
- }
- });
- }
- return !!curPath;
- },
+ }
+ });
+ }
+ return !!curPath;
+ },
__updateRec: function (elem, cnt) {
epgd.ajax({ url: epgd.login.url + 'data/recording?starttime=' + elem.getAttribute('data-start') + '&path=' + elem.getAttribute('data-path') + '&owner=' + elem.getAttribute('data-owner') + '&'+cnt, async: true }, function (data) {
$(elem).attr('data-md5', data.recording.md5path).draggable("enable").removeClass("ui-state-disabled");
@@ -411,20 +412,20 @@ epgd.pages.records = {
window.setTimeout(epgd.pages.records.__updateRec, 3000,elem,++cnt);
return true;
});
- },
+ },
del: function (elem) {
epgd.ajax({ url: epgd.login.url + 'data/deleterecording?starttime=' + elem.getAttribute('data-start') + '&md5path=' + elem.getAttribute('data-md5') + '&owner=' + elem.getAttribute('data-owner'), async: true }, function (data) {
- data = data.result;
+ data = data.result;
if (data && data.state == 200) {
- epgd.utils.topInfo(elem.getAttribute('data-path') + '<br />' + epgd.tr.dataSaved);
+ epgd.utils.topInfo(elem.getAttribute('data-path') + '<br />' + epgd.tr.dataSaved);
$(elem).parents('.folder:not(:last)').find('>h4>span').each(function () {
this.innerHTML = '(' + (parseInt(this.innerHTML.slice(1, -1), 10) - 1) + ')';
- });
- $(elem).remove();
- } else
+ });
+ $(elem).remove();
+ } else
epgd.utils.topInfo(elem.getAttribute('data-path') + '<br />' + data.message, { isError: 1 });
- });
- },
+ });
+ },
sort: function (con, sort) {
var $elems = $(con).find('>div.rec'),
dir = sort % 2 ? 1 : -1,
@@ -440,9 +441,9 @@ epgd.pages.records = {
$(con).find('>div.folder').each(function () {
epgd.pages.records.sort(this, sort);
});
- }
-};
-/*
+ }
+};
+/*
$.widget("ui.draggable", $.ui.draggable, {
_mouseStart: function (ev) {
if (this.options.beforeStart && this.options.beforeStart(ev) === false)