diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-11-10 19:05:42 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-11-10 19:05:42 +0000 |
commit | 0e26226af811a2a92c300ff28f3aa1ad47ae19f0 (patch) | |
tree | b5c083da4160cc61d0ac3aec21d9129f54f49937 /templates | |
parent | 7114792a08c65a5429bfdf6bfaba267b9f88b019 (diff) | |
download | ampache-0e26226af811a2a92c300ff28f3aa1ad47ae19f0.tar.gz ampache-0e26226af811a2a92c300ff28f3aa1ad47ae19f0.tar.bz2 ampache-0e26226af811a2a92c300ff28f3aa1ad47ae19f0.zip |
initial work on democratic play, not finished, added drop down select for playtype switching back in, thinking about changing it and making it a row of icons... not sure
Diffstat (limited to 'templates')
-rw-r--r-- | templates/csshover2.htc | 121 | ||||
-rw-r--r-- | templates/header.inc.php | 3 | ||||
-rw-r--r-- | templates/show_democratic.inc.php | 27 | ||||
-rw-r--r-- | templates/show_democratic_playlist.inc.php (renamed from templates/show_tv_playlist.inc.php) | 4 | ||||
-rw-r--r-- | templates/show_playtype_switch.inc.php | 24 | ||||
-rw-r--r-- | templates/show_tv.inc.php | 68 | ||||
-rw-r--r-- | templates/sidebar_home.inc.php | 8 |
7 files changed, 174 insertions, 81 deletions
diff --git a/templates/csshover2.htc b/templates/csshover2.htc new file mode 100644 index 00000000..e2dcced3 --- /dev/null +++ b/templates/csshover2.htc @@ -0,0 +1,121 @@ +<attach event="ondocumentready" handler="parseStylesheets" />
+<script>
+/**
+ * Whatever:hover - V2.02.060206 - hover, active & focus
+ * ------------------------------------------------------------
+ * (c) 2005 - Peter Nederlof
+ * Peterned - http://www.xs4all.nl/~peterned/
+ * License - http://creativecommons.org/licenses/LGPL/2.1/
+ *
+ * Whatever:hover is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Whatever:hover is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Credits and thanks to:
+ * Arnoud Berendsen, Martin Reurings, Robert Hanson
+ *
+ * howto: body { behavior:url("csshover.htc"); }
+ * ------------------------------------------------------------
+ */
+
+var csshoverReg = /(^|\s)((([^a]([^ ]+)?)|(a([^#.][^ ]+)+)):(hover|active))|((a|input|textarea)([#.][^ ]+)?:unknown)/i,
+currentSheet, doc = window.document, hoverEvents = [], activators = {
+ onhover:{on:'onmouseover', off:'onmouseout'},
+ onactive:{on:'onmousedown', off:'onmouseup'},
+ onunknown:{on:'onfocus', off:'onblur'}
+}
+
+function parseStylesheets() {
+ if(!/MSIE (5|6)/.test(navigator.userAgent)) return;
+ window.attachEvent('onunload', unhookHoverEvents);
+ var sheets = doc.styleSheets, l = sheets.length;
+ for(var i=0; i<l; i++)
+ parseStylesheet(sheets[i]);
+}
+ function parseStylesheet(sheet) {
+ if(sheet.imports) {
+ try {
+ var imports = sheet.imports, l = imports.length;
+ for(var i=0; i<l; i++) parseStylesheet(sheet.imports[i]);
+ } catch(securityException){}
+ }
+
+ try {
+ var rules = (currentSheet = sheet).rules, l = rules.length;
+ for(var j=0; j<l; j++) parseCSSRule(rules[j]);
+ } catch(securityException){}
+ }
+
+ function parseCSSRule(rule) {
+ var select = rule.selectorText, style = rule.style.cssText;
+ if(!csshoverReg.test(select) || !style) return;
+
+ var pseudo = select.replace(/[^:]+:([a-z-]+).*/i, 'on$1');
+ var newSelect = select.replace(/(\.([a-z0-9_-]+):[a-z]+)|(:[a-z]+)/gi, '.$2' + pseudo);
+ var className = (/\.([a-z0-9_-]*on(hover|active|unknown))/i).exec(newSelect)[1];
+ var affected = select.replace(/:(hover|active|unknown).*$/, '');
+ var elements = getElementsBySelect(affected);
+ if(elements.length == 0) return;
+
+ currentSheet.addRule(newSelect, style);
+ for(var i=0; i<elements.length; i++)
+ new HoverElement(elements[i], className, activators[pseudo]);
+ }
+
+function HoverElement(node, className, events) {
+ if(!node.hovers) node.hovers = {};
+ if(node.hovers[className]) return;
+ node.hovers[className] = true;
+ hookHoverEvent(node, events.on, function() { node.className += ' ' + className; });
+ hookHoverEvent(node, events.off, function() { node.className = node.className.replace(new RegExp('\\s+'+className, 'g'),''); });
+}
+ function hookHoverEvent(node, type, handler) {
+ node.attachEvent(type, handler);
+ hoverEvents[hoverEvents.length] = {
+ node:node, type:type, handler:handler
+ };
+ }
+
+ function unhookHoverEvents() {
+ for(var e,i=0; i<hoverEvents.length; i++) {
+ e = hoverEvents[i];
+ e.node.detachEvent(e.type, e.handler);
+ }
+ }
+
+function getElementsBySelect(rule) {
+ var parts, nodes = [doc];
+ parts = rule.split(' ');
+ for(var i=0; i<parts.length; i++) {
+ nodes = getSelectedNodes(parts[i], nodes);
+ } return nodes;
+}
+ function getSelectedNodes(select, elements) {
+ var result, node, nodes = [];
+ var identify = (/\#([a-z0-9_-]+)/i).exec(select);
+ if(identify) {
+ var element = doc.getElementById(identify[1]);
+ return element? [element]:nodes;
+ }
+
+ var classname = (/\.([a-z0-9_-]+)/i).exec(select);
+ var tagName = select.replace(/(\.|\#|\:)[a-z0-9_-]+/i, '');
+ var classReg = classname? new RegExp('\\b' + classname[1] + '\\b'):false;
+ for(var i=0; i<elements.length; i++) {
+ result = tagName? elements[i].all.tags(tagName):elements[i].all;
+ for(var j=0; j<result.length; j++) {
+ node = result[j];
+ if(classReg && !classReg.test(node.className)) continue;
+ nodes[nodes.length] = node;
+ }
+ }
+
+ return nodes;
+ }
+</script>
\ No newline at end of file diff --git a/templates/header.inc.php b/templates/header.inc.php index c6400ada..60a7b473 100644 --- a/templates/header.inc.php +++ b/templates/header.inc.php @@ -66,8 +66,9 @@ if (Config::get('use_rss')) { ?> </h1> <div id="headerbox"> <?php show_box_top('','box box_headerbox'); ?> - <span id="loginInfo"><?php echo _('You are currently logged in as') . " " . $GLOBALS['user']->fullname; ?></span> <?php require_once Config::get('prefix') . '/templates/show_search_bar.inc.php'; ?> + <?php require_once Config::get('prefix') . '/templates/show_playtype_switch.inc.php'; ?> + <span id="loginInfo"><?php echo $GLOBALS['user']->fullname; ?> [<a href="<?php echo Config::get('web_path'); ?>/logout.php"><?php echo _('Log out'); ?></a>]</span> <?php show_box_bottom(); ?> </div> <!-- End headerbox --> </div><!-- End header --> diff --git a/templates/show_democratic.inc.php b/templates/show_democratic.inc.php new file mode 100644 index 00000000..dc3972ba --- /dev/null +++ b/templates/show_democratic.inc.php @@ -0,0 +1,27 @@ +<?php +/* + + Copyright (c) 2001 - 2007 Ampache.org + All rights reserved. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License v2 + as published by the Free Software Foundation + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +show_box_top(_('Current Playlist')); +?> +<div id="democratic_playlist"> +<?php require_once Config::get('prefix') . '/templates/show_democratic_playlist.inc.php'; ?> +</div> +<?php show_box_bottom(); ?> diff --git a/templates/show_tv_playlist.inc.php b/templates/show_democratic_playlist.inc.php index f6fb87bb..4838457b 100644 --- a/templates/show_tv_playlist.inc.php +++ b/templates/show_democratic_playlist.inc.php @@ -1,7 +1,7 @@ <?php /* - Copyright (c) 2001 - 2006 Ampache.org + Copyright (c) 2001 - 2007 Ampache.org All rights reserved. This program is free software; you can redistribute it and/or @@ -18,8 +18,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* Some defaults */ -$web_path = conf('web_path'); ?> <table class="tabledata" cellpadding="0" cellspacing="0"> <colgroup> diff --git a/templates/show_playtype_switch.inc.php b/templates/show_playtype_switch.inc.php index 3f30002f..406329e5 100644 --- a/templates/show_playtype_switch.inc.php +++ b/templates/show_playtype_switch.inc.php @@ -6,8 +6,8 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. + as published by the Free Software Foundation; Version 2 of the + licence. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -22,20 +22,26 @@ <?php $name = "is_" . $GLOBALS['user']->prefs['play_type']; ${$name} = 'selected="selected" '; -if (has_preference_access('play_type')){ + +if (Preference::has_access('play_type')) { ?> -<!--<select id="play_type_switch" style="font-size:0.9em;" name="type"> --> -<select id="play_type_switch" name="type" onchange="ajaxPut('<?php echo $ajax_url; ?>?action=change_play_type<?php echo $required_info; ?>');return true;"> +<div id="play_type_switch"> +<form method="post" id="play_type_form" action="javascript.void(0);"> +<select id="play_type_select" name="type"> <?php if (Config::get('allow_stream_playback')) { ?> <option value="stream" <?php echo $is_stream; ?>><?php echo _('Stream'); ?></option> <?php } if (Config::get('allow_localplay_playback')) { ?> <option value="localplay" <?php echo $is_localplay; ?>><?php echo _('Localplay'); ?></option> - <?php } if (Config::get('allow_downsample_playback')) { ?> - <option value="downsample" <?php echo $is_downsample; ?>><?php echo _('Downsample'); ?></option> <?php } if (Config::get('allow_democratic_playback')) { ?> <option value="democratic" <?php echo $is_democratic; ?>><?php echo _('Democratic'); ?></option> <?php } ?> - <option value="xspf_player" <?php echo $is_xspf_player; ?>><?php echo _('XSPF Player'); ?></option> + <option value="xspf_player" <?php echo $is_xspf_player; ?>><?php echo _('Flash Player'); ?></option> </select> +<?php echo Ajax::observe('play_type_select','change',Ajax::action('?page=stream&action=set_play_type','play_type_select','play_type_form'),'1'); ?> +</form> <?php -} else { echo ucwords($GLOBALS['user']->prefs['play_type']);} +} // if they have access +// Else just show what it currently is +else { echo ucwords($GLOBALS['user']->prefs['play_type']);} +?> +</div> diff --git a/templates/show_tv.inc.php b/templates/show_tv.inc.php deleted file mode 100644 index c01517ed..00000000 --- a/templates/show_tv.inc.php +++ /dev/null @@ -1,68 +0,0 @@ -<?php -/* - - Copyright (c) 2001 - 2006 Ampache.org - All rights reserved. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License v2 - as published by the Free Software Foundation - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -*/ - -$htmllang = str_replace("_","-",conf('lang')); -$location = get_location(); - -show_template('header'); - -/** - * Check for the refresh mojo, if it's there then require the - * refresh_javascript include. Must be greater then 5, I'm not - * going to let them break their servers - */ -if (conf('refresh_limit') > 5) { - $ajax_url = conf('ajax_url') . '?action=reload_np_tv' . conf('ajax_info'); - /* Can't have the & stuff in the Javascript */ - $ajax_url = str_replace("&","&",$ajax_url); - require_once(conf('prefix') . '/templates/javascript_refresh.inc.php'); -} - -?> -<!-- Left Col --> -<div id="tv_left"> -<?php show_box_top(_('Controls')); ?> -<!-- Control DIV --> -<div id="tv_control"> -<?php -/* If they are a admin */ -if ($GLOBALS['user']->has_access(100)) { - require_once(conf('prefix') . '/templates/show_tv_adminctl.inc.php'); -} -/* Else normal User */ -else { - -} -?> -</div> -<?php show_box_bottom(); ?> -<?php show_box_top(_('Current Playlist')); ?> -<div id="tv_playlist"> -<?php require_once(conf('prefix') . '/templates/show_tv_playlist.inc.php'); ?> -</div> -<?php show_box_bottom(); ?> -<!-- End of Left --> -</div> -<?php show_box_top(_('Now Playing')); ?> -<div id="tv_np"> -<?php require_once(conf('prefix') . '/templates/show_tv_nowplaying.inc.php'); ?> -</div> -<?php show_box_bottom(); ?> diff --git a/templates/sidebar_home.inc.php b/templates/sidebar_home.inc.php index 62cf9a37..840fbfe1 100644 --- a/templates/sidebar_home.inc.php +++ b/templates/sidebar_home.inc.php @@ -6,6 +6,14 @@ <li id="sb_home_info_AddStationRadio"><a href="<?php echo $web_path; ?>/radio.php?action=show_create"><?php echo _('Add Radio Station'); ?></a></li> </ul> </li> +<?php if (Config::get('allow_democratic_playback')) { ?> + <li><h4><?php echo _('Democratic'); ?></h4> + <ul class="sb3" id="sb_home_democratic"> + <li id="sb_home_democratic_playlist"><a href="<?php echo $web_path; ?>/democratic.php?action=show_playlist"><?php echo _('Show Playlist'); ?></a></li> + <li id="sb_home_democratic_playlist"><a href="<?php echo $web_path; ?>/democratic.php?action=manage_playlists"><?php echo _('Manage Playlist'); ?></a></li> + </ul> + </li> +<?php } ?> <li><h4><?php echo _('Random'); ?></h4> <ul class="sb3" id="sb_home_random"> <li id="sb_home_random_album"><?php echo Ajax::text('?page=random&action=album',_('Album'),'home_random_album'); ?></li> |