diff options
author | Dieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de> | 2007-07-29 17:41:38 +0000 |
---|---|---|
committer | Dieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de> | 2007-07-29 17:41:38 +0000 |
commit | 6bd91ddffe86ebeb10420f05a232f8e779eaf86d (patch) | |
tree | 09fe2c9617c08799e2689afa2fc9d0366bd16ff9 | |
parent | c6754ca96830f5034ca56a4ca2987df4c50375db (diff) | |
download | vdr-plugin-live-6bd91ddffe86ebeb10420f05a232f8e779eaf86d.tar.gz vdr-plugin-live-6bd91ddffe86ebeb10420f05a232f8e779eaf86d.tar.bz2 |
- Made vdr ajax requests work also via a static page. This is for
browsers that don't support javascript (e.g. PDA browsers)
- Implemented for AJAX request a visual notification how requested action
performed.
- Adapted styles for this.
- Moded images for rounded boxes (formerly tip-hint-??.png) to central
image directory and renamed them according to their color. This
makes them reusable in different themes.
- Adapted themes to this move.
-rw-r--r-- | css/siteprefs.css | 60 | ||||
-rw-r--r-- | css/styles.css | 120 | ||||
-rw-r--r-- | doc/ChangeLog | 6 | ||||
-rw-r--r-- | i18n.cpp | 46 | ||||
-rw-r--r-- | live/img/rounded-box-blue-bl.png (renamed from live/img/tip-hint-bl.png) | bin | 528 -> 528 bytes | |||
-rw-r--r-- | live/img/rounded-box-blue-br.png (renamed from live/img/tip-hint-br.png) | bin | 336 -> 336 bytes | |||
-rw-r--r-- | live/img/rounded-box-blue-ml.png (renamed from live/img/tip-hint-ml.png) | bin | 110 -> 110 bytes | |||
-rw-r--r-- | live/img/rounded-box-blue-mr.png (renamed from live/img/tip-hint-mr.png) | bin | 112 -> 112 bytes | |||
-rw-r--r-- | live/img/rounded-box-blue-tl.png (renamed from live/img/tip-hint-tl.png) | bin | 470 -> 470 bytes | |||
-rw-r--r-- | live/img/rounded-box-blue-tr.png (renamed from live/img/tip-hint-tr.png) | bin | 346 -> 346 bytes | |||
-rw-r--r-- | live/img/rounded-box-green-bl.png (renamed from live/themes/veltliner/img/tip-hint-bl.png) | bin | 551 -> 551 bytes | |||
-rw-r--r-- | live/img/rounded-box-green-br.png (renamed from live/themes/veltliner/img/tip-hint-br.png) | bin | 356 -> 356 bytes | |||
-rw-r--r-- | live/img/rounded-box-green-ml.png (renamed from live/themes/veltliner/img/tip-hint-ml.png) | bin | 112 -> 112 bytes | |||
-rw-r--r-- | live/img/rounded-box-green-mr.png (renamed from live/themes/veltliner/img/tip-hint-mr.png) | bin | 112 -> 112 bytes | |||
-rw-r--r-- | live/img/rounded-box-green-tl.png (renamed from live/themes/veltliner/img/tip-hint-tl.png) | bin | 492 -> 492 bytes | |||
-rw-r--r-- | live/img/rounded-box-green-tr.png (renamed from live/themes/veltliner/img/tip-hint-tr.png) | bin | 370 -> 370 bytes | |||
-rw-r--r-- | live/img/rounded-box-orange-bl.png (renamed from live/themes/orange-blue/img/tip-hint-bl.png) | bin | 574 -> 574 bytes | |||
-rw-r--r-- | live/img/rounded-box-orange-br.png (renamed from live/themes/orange-blue/img/tip-hint-br.png) | bin | 386 -> 386 bytes | |||
-rw-r--r-- | live/img/rounded-box-orange-ml.png (renamed from live/themes/orange-blue/img/tip-hint-ml.png) | bin | 174 -> 174 bytes | |||
-rw-r--r-- | live/img/rounded-box-orange-mr.png (renamed from live/themes/orange-blue/img/tip-hint-mr.png) | bin | 173 -> 173 bytes | |||
-rw-r--r-- | live/img/rounded-box-orange-tl.png (renamed from live/themes/orange-blue/img/tip-hint-tl.png) | bin | 515 -> 515 bytes | |||
-rw-r--r-- | live/img/rounded-box-orange-tr.png (renamed from live/themes/orange-blue/img/tip-hint-tr.png) | bin | 392 -> 392 bytes | |||
-rw-r--r-- | live/js/live/infowin.js | 167 | ||||
-rw-r--r-- | live/js/live/liveajax.js | 2 | ||||
-rw-r--r-- | live/js/live/pageenhance.js | 50 | ||||
-rw-r--r-- | live/js/live/vdr_status.js | 8 | ||||
-rw-r--r-- | live/themes/orange-blue/css/theme.css | 12 | ||||
-rw-r--r-- | live/themes/veltliner/css/theme.css | 12 | ||||
-rw-r--r-- | pages/page_init.eh | 6 | ||||
-rw-r--r-- | pages/pageelems.ecpp | 6 | ||||
-rw-r--r-- | pages/switch_channel.ecpp | 29 | ||||
-rw-r--r-- | pages/whats_on.ecpp | 2 | ||||
-rw-r--r-- | pages/xmlresponse.ecpp | 8 | ||||
-rw-r--r-- | tntconfig.cpp | 8 |
34 files changed, 457 insertions, 85 deletions
diff --git a/css/siteprefs.css b/css/siteprefs.css index ed92cb0..61955c3 100644 --- a/css/siteprefs.css +++ b/css/siteprefs.css @@ -15,3 +15,63 @@ table { width: 100%; } */ + +/* comment this out, if you want epg images at their native size + * the popup windows. This here restricts their width to 120 px. + * You might also only change size. + */ +.info-win span.epg_images { + width: 120px; +} + + + + + +.notify-win { + margin: 0px auto; + max-width: 480px; /* depends on the tip backround image width */ + color: #fff; +} + +.notify-win .notify-win-top .notify-win-c, +.notify-win .notify-win-bot .notify-win-c { + font-size: 1px; /* ensure minimum height */ + height: 17px; +} + +.notify-win .notify-win-top { + background: transparent url(/img/rounded-box-green-tl.png) no-repeat 0px 0px; + margin-right: 17px; /* space for right corner */ +} + +.notify-win .notify-win-top .notify-win-c { + background: transparent url(/img/rounded-box-green-tr.png) no-repeat right 0px; + margin-right: -17px; /* pull right corner back over "empty" space (from above margin) */ +} + +.notify-win .notify-win-body { + background: transparent url(/img/rounded-box-green-ml.png) repeat-y 0px 0px; + margin-right: 17px; +} + +.notify-win .notify-win-body .notify-win-c { + background: transparent url(/img/rounded-box-green-mr.png) repeat-y right 0px; + margin-right: -17px; +} + +.notify-win .notify-win-body .notify-win-c .notify-win-s { /* optional gradient overlay */ + /* background: transparent url(/img/rounded-box-green-ms.jpg) repeat-x 0px 0px; */ + padding: 0px 17px 0px 17px; +} + +.notify-win .notify-win-bot { + background: transparent url(/img/rounded-box-green-bl.png) no-repeat 0px 0px; + margin-right: 17px; +} + +.notify-win .notify-win-bot .notify-win-c { + background: transparent url(/img/rounded-box-green-br.png) no-repeat right 0px; + margin-right: -17px; +} + diff --git a/css/styles.css b/css/styles.css index 8732e31..9bc25ea 100644 --- a/css/styles.css +++ b/css/styles.css @@ -119,37 +119,37 @@ a:active { } .hint-tip .hint-tip-top { - background: transparent url(img/tip-hint-tl.png) no-repeat 0px 0px; + background: transparent url(img/rounded-box-blue-tl.png) no-repeat 0px 0px; margin-right: 17px; /* space for right corner */ } .hint-tip .hint-tip-top .hint-tip-c { - background: transparent url(img/tip-hint-tr.png) no-repeat right 0px; + background: transparent url(img/rounded-box-blue-tr.png) no-repeat right 0px; margin-right: -17px; /* pull right corner back over "empty" space (from above margin) */ } .hint-tip .hint-tip-bdy { - background: transparent url(img/tip-hint-ml.png) repeat-y 0px 0px; + background: transparent url(img/rounded-box-blue-ml.png) repeat-y 0px 0px; margin-right: 17px; } .hint-tip .hint-tip-bdy .hint-tip-c { - background: transparent url(img/tip-hint-mr.png) repeat-y right 0px; + background: transparent url(img/rounded-box-blue-mr.png) repeat-y right 0px; margin-right: -17px; } .hint-tip .hint-tip-bdy .hint-tip-c .hint-tip-s { /* optional gradient overlay */ - /* background: transparent url(img/tip-hint-ms.jpg) repeat-x 0px 0px; */ + /* background: transparent url(img/rounded-box-blue-ms.jpg) repeat-x 0px 0px; */ padding: 0px 17px 0px 17px; } .hint-tip .hint-tip-bot { - background: transparent url(img/tip-hint-bl.png) no-repeat 0px 0px; + background: transparent url(img/rounded-box-blue-bl.png) no-repeat 0px 0px; margin-right: 17px; } .hint-tip .hint-tip-bot .hint-tip-c { - background: transparent url(img/tip-hint-br.png) no-repeat right 0px; + background: transparent url(img/rounded-box-blue-br.png) no-repeat right 0px; margin-right: -17px; } @@ -159,6 +159,112 @@ a:active { /* ###################### + # Style for positive notification popup + ###################### +*/ + +.ok-info { + margin: 0px auto; + max-width: 480px; /* depends on the tip backround image width */ + color: #fff; +} + +.ok-info .ok-info-top .ok-info-c, +.ok-info .ok-info-bot .ok-info-c { + font-size: 1px; /* ensure minimum height */ + height: 17px; +} + +.ok-info .ok-info-top { + background: transparent url(/img/rounded-box-green-tl.png) no-repeat 0px 0px; + margin-right: 17px; /* space for right corner */ +} + +.ok-info .ok-info-top .ok-info-c { + background: transparent url(/img/rounded-box-green-tr.png) no-repeat right 0px; + margin-right: -17px; /* pull right corner back over "empty" space (from above margin) */ +} + +.ok-info .ok-info-body { + background: transparent url(/img/rounded-box-green-ml.png) repeat-y 0px 0px; + margin-right: 17px; +} + +.ok-info .ok-info-body .ok-info-c { + background: transparent url(/img/rounded-box-green-mr.png) repeat-y right 0px; + margin-right: -17px; +} + +.ok-info .ok-info-body .ok-info-c .ok-info-s { /* optional gradient overlay */ + /* background: transparent url(/img/rounded-box-green-ms.jpg) repeat-x 0px 0px; */ + padding: 0px 17px 0px 17px; +} + +.ok-info .ok-info-bot { + background: transparent url(/img/rounded-box-green-bl.png) no-repeat 0px 0px; + margin-right: 17px; +} + +.ok-info .ok-info-bot .ok-info-c { + background: transparent url(/img/rounded-box-green-br.png) no-repeat right 0px; + margin-right: -17px; +} + + +.err-info { + margin: 0px auto; + max-width: 480px; /* depends on the tip backround image width */ + color: #fff; +} + + +/* ###################### + # Style for negative notification popup + ###################### +*/ + +.err-info .err-info-top .err-info-c, +.err-info .err-info-bot .err-info-c { + font-size: 1px; /* ensure minimum height */ + height: 17px; +} + +.err-info .err-info-top { + background: transparent url(/img/rounded-box-redwine-tl.png) no-repeat 0px 0px; + margin-right: 17px; /* space for right corner */ +} + +.err-info .err-info-top .err-info-c { + background: transparent url(/img/rounded-box-redwine-tr.png) no-repeat right 0px; + margin-right: -17px; /* pull right corner back over "empty" space (from above margin) */ +} + +.err-info .err-info-body { + background: transparent url(/img/rounded-box-redwine-ml.png) repeat-y 0px 0px; + margin-right: 17px; +} + +.err-info .err-info-body .err-info-c { + background: transparent url(/img/rounded-box-redwine-mr.png) repeat-y right 0px; + margin-right: -17px; +} + +.err-info .err-info-body .err-info-c .err-info-s { /* optional gradient overlay */ + /* background: transparent url(/img/rounded-box-redwine-ms.jpg) repeat-x 0px 0px; */ + padding: 0px 17px 0px 17px; +} + +.err-info .err-info-bot { + background: transparent url(/img/rounded-box-redwine-bl.png) no-repeat 0px 0px; + margin-right: 17px; +} + +.err-info .err-info-bot .err-info-c { + background: transparent url(/img/rounded-box-redwine-br.png) no-repeat right 0px; + margin-right: -17px; +} + +/* ###################### # General styles for epg info ###################### */ diff --git a/doc/ChangeLog b/doc/ChangeLog index 452126c..5743f77 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,9 @@ +2007-07-29 Dieter Hametner <dh+vdr at gekrumbel dot de> + + - Implemented status notification popup if ajax is active. + - Without Ajax it is now possible to request actions from vdr via + a static page. + 2007-07-22 Dieter Hametner <dh+vdr at gekrumbel dot de> Added toolbox buttons to epg info popup windows. @@ -4,7 +4,7 @@ extended version of i18n.cpp. (If you would like to submit a patch add more context like described below) - $Id: i18n.cpp,v 1.100 2007/07/22 22:33:56 tadi Exp $ + $Id: i18n.cpp,v 1.101 2007/07/29 17:41:38 tadi Exp $ Note to developers: How to safely integrate translations from third parties: @@ -1398,6 +1398,50 @@ const tI18nPhrase Phrases[] = { "", // Dansk "", // Czech }, + { "Request succeeded!", // English + "Aktion durchgeführt!", // Deutsch + "", // Slovenski + "", // Italiano + "", // Nederlands + "", // Português + "", // Français + "", // Norsk + "", // Finnish + "", // Polski + "", // Español + "", // Greek + "", // Svenska + "", // Românã + "", // Magyar + "", // Català + "", // Russian + "", // Hrvatski + "", // Eesti + "", // Dansk + "", // Czech + }, + { "Request failed!", // English + "Aktion fehlgeschlagen!", // Deutsch + "", // Slovenski + "", // Italiano + "", // Nederlands + "", // Português + "", // Français + "", // Norsk + "", // Finnish + "", // Polski + "", // Español + "", // Greek + "", // Svenska + "", // Românã + "", // Magyar + "", // Català + "", // Russian + "", // Hrvatski + "", // Eesti + "", // Dansk + "", // Czech + }, { "Show live logo image", // English "Zeige das Live Logo", // Deutsch "", // Slovenski diff --git a/live/img/tip-hint-bl.png b/live/img/rounded-box-blue-bl.png Binary files differindex 790a602..790a602 100644 --- a/live/img/tip-hint-bl.png +++ b/live/img/rounded-box-blue-bl.png diff --git a/live/img/tip-hint-br.png b/live/img/rounded-box-blue-br.png Binary files differindex 61eafcf..61eafcf 100644 --- a/live/img/tip-hint-br.png +++ b/live/img/rounded-box-blue-br.png diff --git a/live/img/tip-hint-ml.png b/live/img/rounded-box-blue-ml.png Binary files differindex b730b57..b730b57 100644 --- a/live/img/tip-hint-ml.png +++ b/live/img/rounded-box-blue-ml.png diff --git a/live/img/tip-hint-mr.png b/live/img/rounded-box-blue-mr.png Binary files differindex bf2465c..bf2465c 100644 --- a/live/img/tip-hint-mr.png +++ b/live/img/rounded-box-blue-mr.png diff --git a/live/img/tip-hint-tl.png b/live/img/rounded-box-blue-tl.png Binary files differindex 467ecec..467ecec 100644 --- a/live/img/tip-hint-tl.png +++ b/live/img/rounded-box-blue-tl.png diff --git a/live/img/tip-hint-tr.png b/live/img/rounded-box-blue-tr.png Binary files differindex a4c9b3f..a4c9b3f 100644 --- a/live/img/tip-hint-tr.png +++ b/live/img/rounded-box-blue-tr.png diff --git a/live/themes/veltliner/img/tip-hint-bl.png b/live/img/rounded-box-green-bl.png Binary files differindex cbfbfb4..cbfbfb4 100644 --- a/live/themes/veltliner/img/tip-hint-bl.png +++ b/live/img/rounded-box-green-bl.png diff --git a/live/themes/veltliner/img/tip-hint-br.png b/live/img/rounded-box-green-br.png Binary files differindex fa36fb5..fa36fb5 100644 --- a/live/themes/veltliner/img/tip-hint-br.png +++ b/live/img/rounded-box-green-br.png diff --git a/live/themes/veltliner/img/tip-hint-ml.png b/live/img/rounded-box-green-ml.png Binary files differindex 33f0a07..33f0a07 100644 --- a/live/themes/veltliner/img/tip-hint-ml.png +++ b/live/img/rounded-box-green-ml.png diff --git a/live/themes/veltliner/img/tip-hint-mr.png b/live/img/rounded-box-green-mr.png Binary files differindex 183ea20..183ea20 100644 --- a/live/themes/veltliner/img/tip-hint-mr.png +++ b/live/img/rounded-box-green-mr.png diff --git a/live/themes/veltliner/img/tip-hint-tl.png b/live/img/rounded-box-green-tl.png Binary files differindex 85e5c77..85e5c77 100644 --- a/live/themes/veltliner/img/tip-hint-tl.png +++ b/live/img/rounded-box-green-tl.png diff --git a/live/themes/veltliner/img/tip-hint-tr.png b/live/img/rounded-box-green-tr.png Binary files differindex 129233d..129233d 100644 --- a/live/themes/veltliner/img/tip-hint-tr.png +++ b/live/img/rounded-box-green-tr.png diff --git a/live/themes/orange-blue/img/tip-hint-bl.png b/live/img/rounded-box-orange-bl.png Binary files differindex efe53d7..efe53d7 100644 --- a/live/themes/orange-blue/img/tip-hint-bl.png +++ b/live/img/rounded-box-orange-bl.png diff --git a/live/themes/orange-blue/img/tip-hint-br.png b/live/img/rounded-box-orange-br.png Binary files differindex fde8f92..fde8f92 100644 --- a/live/themes/orange-blue/img/tip-hint-br.png +++ b/live/img/rounded-box-orange-br.png diff --git a/live/themes/orange-blue/img/tip-hint-ml.png b/live/img/rounded-box-orange-ml.png Binary files differindex 7a46670..7a46670 100644 --- a/live/themes/orange-blue/img/tip-hint-ml.png +++ b/live/img/rounded-box-orange-ml.png diff --git a/live/themes/orange-blue/img/tip-hint-mr.png b/live/img/rounded-box-orange-mr.png Binary files differindex 764361a..764361a 100644 --- a/live/themes/orange-blue/img/tip-hint-mr.png +++ b/live/img/rounded-box-orange-mr.png diff --git a/live/themes/orange-blue/img/tip-hint-tl.png b/live/img/rounded-box-orange-tl.png Binary files differindex 5b20b32..5b20b32 100644 --- a/live/themes/orange-blue/img/tip-hint-tl.png +++ b/live/img/rounded-box-orange-tl.png diff --git a/live/themes/orange-blue/img/tip-hint-tr.png b/live/img/rounded-box-orange-tr.png Binary files differindex da96860..da96860 100644 --- a/live/themes/orange-blue/img/tip-hint-tr.png +++ b/live/img/rounded-box-orange-tr.png diff --git a/live/js/live/infowin.js b/live/js/live/infowin.js index 1e35438..d12bd53 100644 --- a/live/js/live/infowin.js +++ b/live/js/live/infowin.js @@ -35,6 +35,7 @@ var InfoWin = new Class({ onShow: Class.empty, onHide: Class.empty, onDomExtend: Class.empty, + destroyOnHide: false, className: 'info', wm: false, // overide default window manager. draggable: true, @@ -42,15 +43,17 @@ var InfoWin = new Class({ buttonimg: 'transparent.png', bodyselect: 'div.content', titleselect: 'div.caption', - idSuffix: '-win-id', + classSuffix: '-win', + idSuffix: '-id', offsets: {'x': -16, 'y': -16} }, initialize: function(id, options){ this.setOptions(options); this.wm = this.options.wm || InfoWin.$wm; - this.winFrame = $(id + this.options.idSuffix); + this.winFrame = $(id + this.options.classSuffix + this.options.idSuffix); if (!$defined(this.winFrame)){ + this.buildFrame(id); this.build(id); this.wm.register(this); } @@ -63,40 +66,29 @@ var InfoWin = new Class({ // must return true if the body of the InfoWin has been filled // with the user data, false otherwise. build: function(id){ - this.winFrame = new Element('div', { - 'id': id + this.options.idSuffix, - 'class': this.options.className + '-win', - 'styles': { - 'position': 'absolute', - 'top': '0', - 'left': '0' - } - }); - // header of window: upper shadows, corners title and controls var top = new Element('div', { - 'class': this.options.className + '-win-top' + 'class': this.options.className + this.options.classSuffix + '-top' }).inject(this.winFrame); if (this.options.draggable) this.winFrame.makeDraggable({'handle': top}); top = new Element('div', { - 'class': this.options.className + '-win-c' + 'class': this.options.className + this.options.classSuffix + '-c' }).inject(top); this.titleBox = new Element('div', { - 'class': this.options.className + '-win-t' + 'class': this.options.className + this.options.classSuffix + '-t' }).inject(top); this.buttonBox = new Element('div', { - 'class': this.options.className + '-win-b' + 'class': this.options.className + this.options.classSuffix + '-b' }).inject(top); var cls = new Element('div', { 'class': 'close' }).inject(this.buttonBox); - var self = this; cls.addEvent('click', function(event){ var event = new Event(event); event.stop(); - return self.hide(); - }); + return this.hide(); + }.bind(this)); cls = new Element('img', { 'src': this.options.buttonimg, 'alt': 'close', @@ -106,22 +98,22 @@ var InfoWin = new Class({ // body of window: user content. var bdy = new Element('div', { - 'class': this.options.className + '-win-body' + 'class': this.options.className + this.options.classSuffix + '-body' }).inject(this.winFrame); bdy = new Element('div', { - 'class': this.options.className + '-win-c' + 'class': this.options.className + this.options.classSuffix + '-c' }).inject(bdy); this.winBody = new Element('div', { - 'class': this.options.className + '-win-s' + 'class': this.options.className + this.options.classSuffix + '-s' }).inject(bdy); // bottom border of window: lower shadows and corners, optional // resize handle. var bot = new Element('div', { - 'class': this.options.className + '-win-bot' + 'class': this.options.className + this.options.classSuffix + '-bot' }).inject(this.winFrame); bot = new Element('div', { - 'class': this.options.className + '-win-c' + 'class': this.options.className + this.options.classSuffix + '-c' }).inject(bot); if (this.options.resizable) { @@ -134,18 +126,37 @@ var InfoWin = new Class({ return this.fillBody(id); }, + buildFrame: function(id){ + this.winFrame = new Element('div', { + 'id': id + this.options.classSuffix + this.options.idSuffix, + 'class': this.options.className + this.options.classSuffix, + 'styles': { + 'position': 'absolute', + 'top': '0', + 'left': '0' + } + }); + }, + show: function(event){ - if (this.options.timeout) - this.timer = this.hide.delay(this.options.timeout, this); this.position(event); this.fireEvent('onShow', [this.winFrame]); this.wm.raise(this); + if (this.options.timeout) + this.timer = this.hide.delay(this.options.timeout, this); return false; }, hide: function(){ this.fireEvent('onHide', [this.winFrame]); - this.wm.bury(this); + if (this.options.destroyOnHide) { + this.wm.unregister(this); + for (var z in this) this[z] = null; + this.destroyed = true; + } + else { + this.wm.bury(this); + } return false; }, @@ -188,10 +199,10 @@ Class: InfoWin.Manager */ InfoWin.Manager = new Class({ options: { - zIndex: 100, closedContainer: 'infowin-closed', openedContainer: 'infowin-opened', onRegister: Class.empty, + onUnregister: Class.empty, onRaise: Class.empty, onBury: Class.empty }, @@ -216,23 +227,25 @@ InfoWin.Manager = new Class({ }, register: function(infoWin){ - var self = this; this.fireEvent('onRegister', [infoWin]); infoWin.winFrame.addEvent('click', function(){ - self.raise(infoWin); - }); + this.raise(infoWin); + }.bind(this)); infoWin.winFrame.inject(this.closedWins); }, + unregister: function(infoWin){ + this.fireEvent('onUnregister', [infoWin]); + infoWin.winFrame.remove(); + }, + raise: function(infoWin){ this.fireEvent('onRaise', [infoWin]); - infoWin.winFrame.remove(); infoWin.winFrame.inject(this.openedWins); }, bury: function(infoWin){ this.fireEvent('onBury', [infoWin]); - infoWin.winFrame.remove(); infoWin.winFrame.inject(this.closedWins); } }); @@ -260,21 +273,20 @@ InfoWin.Ajax = InfoWin.extend({ initialize: function(id, url, options){ this.parent(id, options); if ($defined(this.ajaxResponse)) { - var self = this; this.addEvent('onError', function(){ - self.hide.delay(1000, self); - }); + this.hide.delay(1000, this); + }.bind(this)); var ajax = new Ajax(url, { update: this.ajaxResponse, onComplete: function(text, xmldoc){ - self.fillTitle(id); - self.fillBody(id); - self.ajaxResponse.empty(); - }, + this.fillTitle(id); + this.fillBody(id); + this.ajaxResponse.remove(); + }.bind(this), onFailure: function(transport){ - self.titleBox.setHTML(self.options.errorMsg); - self.fireEvent('onError', [id, url]); - } + this.titleBox.setHTML(this.options.errorMsg); + this.fireEvent('onError', [id, url]); + }.bind(this) }).request('async=1'); } }, @@ -293,4 +305,71 @@ InfoWin.Ajax = InfoWin.extend({ } }); -InfoWin.Ajax.implement(new Events, new Options); + +/* +Class: Infowin.Notifier + + Creates a notification popup that disappears automaticaly. + Usefull for a confirmation message after a AJAX action request. + */ + +InfoWin.Notifier = InfoWin.extend({ + options: { + timeout: 2500, + destroyOnHide: true, + className: 'ok', + classSuffix: '-info', + message: '', + offsets: {'x': 16, 'y': 16} + }, + + initialize: function(id, options){ + this.parent(id, options); + }, + + build: function(id){ + /* top border of hint */ + var top = new Element('div', { + 'class': this.options.className + this.options.classSuffix + '-top' + }).inject(this.winFrame); + top = new Element('div', { + 'class': this.options.className + this.options.classSuffix + '-c' + }).inject(top); + + /* body of tip: some helper divs and content */ + var bdy = new Element('div', { + 'class': this.options.className + this.options.classSuffix + '-body' + }).inject(this.winFrame); + bdy = new Element('div', { + 'class': this.options.className + this.options.classSuffix + '-c' + }).inject(bdy); + this.winBody = new Element('div', { + 'class': this.options.className + this.options.classSuffix + '-s' + }).inject(bdy); + + /* bottom border of tip */ + var bot = new Element('div', { + 'class': this.options.className + this.options.classSuffix + '-bot' + }).inject(this.winFrame); + bot = new Element('div', { + 'class': this.options.className + this.options.classSuffix + '-c' + }).inject(bot); + + return this.fillBody(id); + }, + + fillBody: function(id){ + this.winFrame.setStyle('position', 'fixed'); + this.winBody.empty().setHTML(this.options.message); + return true; + }, + + position: function(event){ + var prop = {'x': 'left', 'y': 'top'}; + for (var z in prop) { + var pos = this.options.offsets[z]; + this.winFrame.setStyle(prop[z], pos); + } + } + }); + diff --git a/live/js/live/liveajax.js b/live/js/live/liveajax.js index a6a80ea..756727d 100644 --- a/live/js/live/liveajax.js +++ b/live/js/live/liveajax.js @@ -7,5 +7,5 @@ function LiveSimpleAjaxRequest(url, param, value) { var req = new Ajax(url, { method : 'post' - }).request(param + '=' + value); + }).request(param + '=' + value + '&async=1'); }; diff --git a/live/js/live/pageenhance.js b/live/js/live/pageenhance.js index 6d1ff10..cb2cbb1 100644 --- a/live/js/live/pageenhance.js +++ b/live/js/live/pageenhance.js @@ -11,16 +11,23 @@ var PageEnhance = new Class({ options: { epgLinkSelector: 'a[href^="epginfo.html?epgid"]', + actionLinkSelector: 'a[href^="vdr_request/"]', hintTipSelector: '*[title]', hintClassName: 'hint', + notifyIdPrefix: 'notify', infoWinStrings: { loadingMsg: 'loading', errorMsg: 'an error occured!' - } + }, + notifyStrings: { + successMsg: '<img src="active.png" alt=""> Success!', + errorMsg: '<img src="del.png" alt=""> failed!' + } }, initialize: function(options){ this.setOptions(options); + this.$notifyCount = 0; window.addEvent('domready', this.domReadySetup.bind(this)); window.addEvent('mousedown', this.mouseDownSetup.bind(this)); }, @@ -29,6 +36,7 @@ var PageEnhance = new Class({ domReadySetup: function(){ $$(this.options.epgLinkSelector).each(this.epgPopup.bind(this)); this.addHintTips($$(this.options.hintTipSelector)); + $$(this.options.actionLinkSelector).each(this.vdrRequest.bind(this)); }, // actions applied on mouse down. @@ -36,6 +44,15 @@ var PageEnhance = new Class({ $$('.' + this.options.hintClassName + '-tip').setStyle('visibility', 'hidden'); }, + // registered as 'onDomExtend' event for InfoWin. Takes care to + // enhance the new dom elements too. + domExtend: function(id, elems){ + var sel = '#' + id + ' ' + this.options.hintTipSelector; + elems = $$(sel); + this.addHintTips(elems); + $$('#' + id + ' ' + this.options.actionLinkSelector).each(this.vdrRequest.bind(this)); + }, + // Epg Popup function. Apply to all elements that should // pop up an Epg InfoWin window. epgPopup: function(el){ @@ -61,12 +78,31 @@ var PageEnhance = new Class({ } }, - // registered as 'onDomExtend' event for InfoWin. Takes care to - // enhance the new dom elements too. - domExtend: function(id, elems){ - var sel = '#' + id + ' ' + this.options.hintTipSelector; - elems = $$(sel); - this.addHintTips(elems); + // function that requests an action from the server vdr. + vdrRequest: function(el){ + el.addEvent('click', function(event, element){ + var href = $pick(element.href, ""); + if (href != "") { + this.$notifyCount++; + var req = new Ajax(href, { + method: 'post', + onComplete: function(text, xmldoc) { + try { + var success = xmldoc.getElementsByTagName('response').item(0).firstChild.nodeValue; + new InfoWin.Notifier(this.options.notifyIdPrefix + this.$notifyCount, { + className: success == '1' ? 'ok' : 'err', + message: success == '1' ? this.options.notifyStrings.successMsg : this.options.notifyStrings.errorMsg + }).show(event); + } catch(e) { + } + }.bind(this) + }); + req.request('async=1'); + event.stop(); + return false; + } + return true; + }.bindWithEvent(this, el)); }, // change normal 'title'-Attributes into enhanced hinttips diff --git a/live/js/live/vdr_status.js b/live/js/live/vdr_status.js index d16f2a3..c24ed72 100644 --- a/live/js/live/vdr_status.js +++ b/live/js/live/vdr_status.js @@ -117,7 +117,8 @@ var LiveVdrInfo = Ajax.extend({ case "prevchan": { if (textContent != "") { - docNode.href = "javascript:LiveSimpleAjaxRequest('switch_channel.xml', 'param', '" + textContent + "');"; + // docNode.href = "javascript:LiveSimpleAjaxRequest('switch_channel.xml', 'param', '" + textContent + "');"; + docNode.href = "vdr_request/switch_channel?param=" + textContent; docNode.style.visibility = "visible"; } else { @@ -128,11 +129,12 @@ var LiveVdrInfo = Ajax.extend({ case "pause": case "play": case "rwd": - case "ffw": + case "ffw": case "stop": { if (textContent != "") { - docNode.href = "javascript:LiveSimpleAjaxRequest('" + nodeName + "_recording.xml', 'param', '" + textContent + "');"; + // docNode.href = "javascript:LiveSimpleAjaxRequest('" + nodeName + "_recording.xml', 'param', '" + textContent + "');"; + docNode.href = "vdr_request/" + nodeName + "_recording?param=" + textContent; docNode.style.visibility = "visible"; } else { diff --git a/live/themes/orange-blue/css/theme.css b/live/themes/orange-blue/css/theme.css index 697642a..594c90c 100644 --- a/live/themes/orange-blue/css/theme.css +++ b/live/themes/orange-blue/css/theme.css @@ -35,27 +35,27 @@ a { } .hint-tip .hint-tip-top { - background: transparent url(../img/tip-hint-tl.png) no-repeat 0px 0px; + background: transparent url(/img/rounded-box-orange-tl.png) no-repeat 0px 0px; } .hint-tip .hint-tip-top .hint-tip-c { - background: transparent url(../img/tip-hint-tr.png) no-repeat right 0px; + background: transparent url(/img/rounded-box-orange-tr.png) no-repeat right 0px; } .hint-tip .hint-tip-bdy { - background: transparent url(../img/tip-hint-ml.png) repeat-y 0px 0px; + background: transparent url(/img/rounded-box-orange-ml.png) repeat-y 0px 0px; } .hint-tip .hint-tip-bdy .hint-tip-c { - background: transparent url(../img/tip-hint-mr.png) repeat-y right 0px; + background: transparent url(/img/rounded-box-orange-mr.png) repeat-y right 0px; } .hint-tip .hint-tip-bot { - background: transparent url(../img/tip-hint-bl.png) no-repeat 0px 0px; + background: transparent url(/img/rounded-box-orange-bl.png) no-repeat 0px 0px; } .hint-tip .hint-tip-bot .hint-tip-c { - background: transparent url(../img/tip-hint-br.png) no-repeat right 0px; + background: transparent url(/img/rounded-box-orange-br.png) no-repeat right 0px; } diff --git a/live/themes/veltliner/css/theme.css b/live/themes/veltliner/css/theme.css index ceb9524..7748da2 100644 --- a/live/themes/veltliner/css/theme.css +++ b/live/themes/veltliner/css/theme.css @@ -21,27 +21,27 @@ select { } .hint-tip .hint-tip-top { - background: transparent url(../img/tip-hint-tl.png) no-repeat 0px 0px; + background: transparent url(/img/rounded-box-green-tl.png) no-repeat 0px 0px; } .hint-tip .hint-tip-top .hint-tip-c { - background: transparent url(../img/tip-hint-tr.png) no-repeat right 0px; + background: transparent url(/img/rounded-box-green-tr.png) no-repeat right 0px; } .hint-tip .hint-tip-bdy { - background: transparent url(../img/tip-hint-ml.png) repeat-y 0px 0px; + background: transparent url(/img/rounded-box-green-ml.png) repeat-y 0px 0px; } .hint-tip .hint-tip-bdy .hint-tip-c { - background: transparent url(../img/tip-hint-mr.png) repeat-y right 0px; + background: transparent url(/img/rounded-box-green-mr.png) repeat-y right 0px; } .hint-tip .hint-tip-bot { - background: transparent url(../img/tip-hint-bl.png) no-repeat 0px 0px; + background: transparent url(/img/rounded-box-green-bl.png) no-repeat 0px 0px; } .hint-tip .hint-tip-bot .hint-tip-c { - background: transparent url(../img/tip-hint-br.png) no-repeat right 0px; + background: transparent url(/img/rounded-box-green-br.png) no-repeat right 0px; } diff --git a/pages/page_init.eh b/pages/page_init.eh index d09a392..5a367df 100644 --- a/pages/page_init.eh +++ b/pages/page_init.eh @@ -1,5 +1,7 @@ -<# do not add to Makefile #> <%pre> +// do not add to Makefile +// and do not write a ecpp comment into this file. It must produce no +// html output not even a empty line. #include <tnt/savepoint.h> #include "exception.h" </%pre> @@ -10,4 +12,4 @@ std::string pageTitle; try { reply.setHeader("Expires", "Mon, 26 Jul 1997 05:00:00 GMT"); tnt::Savepoint spoint( reply ); -</%cpp> +</%cpp>
\ No newline at end of file diff --git a/pages/pageelems.ecpp b/pages/pageelems.ecpp index 277d84c..0507b56 100644 --- a/pages/pageelems.ecpp +++ b/pages/pageelems.ecpp @@ -153,6 +153,10 @@ int update_status(1); infoWinStrings: { loadingMsg: '<$ tr("loading data") $>', errorMsg: '<$ tr("an error occured!") $>' + }, + notifyStrings: { + successMsg: '<img src="<$ LiveSetup().GetThemedLink("img", "active.png") $>" alt=""> <$ tr("Request succeeded!") $>', + errorMsg: '<img src="<$ LiveSetup().GetThemedLink("img", "del.png") $>" alt=""> <$ tr("Request failed!") $>' } }); --></script> @@ -188,7 +192,7 @@ int update_status(1); string alt; string id; </%args> -<%cpp> { </%cpp> <a <%cpp> if (!id.empty()) { </%cpp> id="<$ id $>" <%cpp> } </%cpp><& hide_element hide=(!id.empty()) &> href="javascript:LiveSimpleAjaxRequest('<$ action $>.xml', 'param', '<$ param $>');" <%cpp>if (!tip.empty()) { </%cpp><& tooltip.hint text=(tip) &> <%cpp> } </%cpp>><img src="<$ LiveSetup().GetThemedLink("img", image) $>" alt="<$ alt $>"></img></a> <%cpp> } </%cpp> +<%cpp> { </%cpp> <a <%cpp> if (!id.empty()) { </%cpp> id="<$ id $>" <%cpp> } </%cpp><& hide_element hide=(!id.empty()) &> href="vdr_request/<$ action $>?param=<$ param $>" <%cpp>if (!tip.empty()) { </%cpp><& tooltip.hint text=(tip) &> <%cpp> } </%cpp>><img src="<$ LiveSetup().GetThemedLink("img", image) $>" alt="<$ alt $>"></img></a> <%cpp> } </%cpp> </%def> <# ---------------------------------------------------------------------- #> diff --git a/pages/switch_channel.ecpp b/pages/switch_channel.ecpp index 0031f4e..9b8b48b 100644 --- a/pages/switch_channel.ecpp +++ b/pages/switch_channel.ecpp @@ -4,16 +4,43 @@ #include "tasks.h" #include "tools.h" +using namespace std; using namespace vdrlive; </%pre> <%args> tChannelID param; + string async; </%args> <%cpp> - reply.setContentType( "application/xml" ); + bool ajaxReq = !async.empty() && (lexical_cast<int>(async) != 0); + string referrer; + + if (ajaxReq) { + reply.setContentType( "application/xml" ); + } + else { + referrer = request.getHeader("Referer:"); + } SwitchChannelTask task( param ); LiveTaskManager().Execute( task ); + + if (!ajaxReq) { + if (!referrer.empty()) { + return reply.redirect(referrer); + } +</%cpp> +Normale Seite:<br/> +channel: <$ param $><br/> +result: <$ (task.Result()) $><br/> +error: <$ (task.Error()) $><br /> +Seitenende! +<%cpp> + } + else { </%cpp> <& xmlresponse.ajax name=("switch_channel") pname=("channel") value=(param) result=(task.Result()) error=(task.Error()) &> +<%cpp> + } +</%cpp> diff --git a/pages/whats_on.ecpp b/pages/whats_on.ecpp index dfba641..d724c23 100644 --- a/pages/whats_on.ecpp +++ b/pages/whats_on.ecpp @@ -21,7 +21,6 @@ type = "now"; string mode; string attime; string fixtime; - </%args> <%session scope="global"> bool logged_in(false); @@ -33,7 +32,6 @@ string current_attime; string current_fixtime; string current_displaytime; </%request> - <%include>page_init.eh</%include> <%cpp> if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); diff --git a/pages/xmlresponse.ecpp b/pages/xmlresponse.ecpp index 54fe088..4bca87f 100644 --- a/pages/xmlresponse.ecpp +++ b/pages/xmlresponse.ecpp @@ -3,6 +3,10 @@ #include "i18n.h" using namespace std; +using namespace vdrlive; + +string const XMLHEADER = "<?xml version=\"1.0\" encoding=\"" + LiveI18n().CharacterEncoding() + "\"?>"; + </%pre> <# ------------------------------------------------------------------------- #> @@ -15,7 +19,7 @@ using namespace std; bool result; string error; </%args> -<?xml version="1.0" encoding="<$ LiveI18n().CharacterEncoding() $>"?> +<$$ XMLHEADER $> <service> <request name="<$ name $>"> <param name="<$ pname $>"><$ value $></param> @@ -39,7 +43,7 @@ using namespace std; string prev_chan; string next_chan; </%args> -<?xml version="1.0" encoding="ISO-8859-1"?> +<$$ XMLHEADER $> <service> <request name="ibox"> <param name="update"><$ update $></param> diff --git a/tntconfig.cpp b/tntconfig.cpp index fc4217b..28ad521 100644 --- a/tntconfig.cpp +++ b/tntconfig.cpp @@ -37,16 +37,20 @@ void TntConfig::WriteConfig() // XXX modularize file << "MapUrl ^/$ login@" << endl; + // the following redirects vdr_request URL to the component + // specified by the action parameter. + file << "MapUrl ^/vdr_request/([^.]+) $1@" << endl; + // the following selects the theme specific 'theme.css' file file << "MapUrl ^/themes/([^/]*)/css.*/(.+\\.css) content@ themes/$1/css/$2 text/css" << endl; // the following rules provide a search scheme for images. The first // rule where a image is found, terminates the search. // 1. /themes/<theme>/img/<imgname>.<ext> - // 2. /dist/img/<imgname>.<ext> + // 2. /img/<imgname>.<ext> // 3. <imgname>.<ext> (builtin images) file << "MapUrl ^/themes/([^/]*)/img.*/(.+)\\.(.+) content@ themes/$1/img/$2.$3 image/$3" << endl; - file << "MapUrl ^/themes/([^/]*)/img.*/(.+)\\.(.+) content@ common/img/$2.$3 image/$3" << endl; + file << "MapUrl ^/themes/([^/]*)/img.*/(.+)\\.(.+) content@ img/$2.$3 image/$3" << endl; file << "MapUrl ^/themes/([^/]*)/img.*/(.+)\\.(.+) $2@" << endl; // Epg images |