diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2008-01-14 05:03:03 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2008-01-14 05:03:03 +0000 |
commit | 427c5ac163cd7a79c83102aaa3fcb6572ab59cfb (patch) | |
tree | af8a96374a62629c8439d37fdc812a697f068a6d | |
parent | 3c99e635ee70b89cf1689d3372c7526e638b2b25 (diff) | |
download | ampache-427c5ac163cd7a79c83102aaa3fcb6572ab59cfb.tar.gz ampache-427c5ac163cd7a79c83102aaa3fcb6572ab59cfb.tar.bz2 ampache-427c5ac163cd7a79c83102aaa3fcb6572ab59cfb.zip |
fixed the filter display and added a playlist_type filter for admins
-rw-r--r-- | browse.php | 39 | ||||
-rwxr-xr-x | docs/CHANGELOG | 2 | ||||
-rw-r--r-- | lib/class/browse.class.php | 28 | ||||
-rw-r--r-- | localplay.php | 4 | ||||
-rw-r--r-- | templates/sidebar_browse.inc.php | 47 |
5 files changed, 78 insertions, 42 deletions
@@ -34,47 +34,49 @@ /* Base Require */ require_once 'lib/init.php'; -/* Display the headers and menus */ +// This page is a little wonky we don't want the sidebar until we know what type we're dealing with +// so we've got a little switch here that creates the type.. this feels hackish... + +switch ($_REQUEST['action']) { + case 'file': + case 'album': + case 'artist': + case 'genre': + case 'playlist': + case 'live_stream': + case 'song': + Browse::reset_filters(); + Browse::set_type($_REQUEST['action']); + Browse::set_simple_browse(1); + break; +} // end switch + show_header(); switch($_REQUEST['action']) { case 'file': + break; case 'album': - Browse::reset_filters(); - Browse::set_type('album'); - Browse::set_simple_browse(1); Browse::set_sort('name','ASC'); $album_ids = Browse::get_objects(); Browse::show_objects($album_ids); break; case 'artist': - Browse::reset_filters(); - Browse::set_type('artist'); - Browse::set_simple_browse(1); Browse::set_sort('name','ASC'); $artist_ids = Browse::get_objects(); Browse::show_objects($artist_ids); break; case 'genre': - Browse::reset_filters(); - Browse::set_type('genre'); - Browse::set_simple_browse(1); Browse::set_sort('name','ASC'); $genre_ids = Browse::get_objects(); Browse::show_objects($genre_ids); break; case 'song': - Browse::reset_filters(); - Browse::set_type('song'); - Browse::set_simple_browse(1); Browse::set_sort('title','ASC'); $song_ids = Browse::get_objects(); Browse::show_objects($song_ids); break; case 'live_stream': - Browse::reset_filters(); - Browse::set_type('live_stream'); - Browse::set_simple_browse(1); Browse::set_sort('name','ASC'); $live_stream_ids = Browse::get_objects(); Browse::show_objects($live_stream_ids); @@ -83,9 +85,6 @@ switch($_REQUEST['action']) { break; case 'playlist': - Browse::reset_filters(); - Browse::set_type('playlist'); - Browse::set_simple_browse(1); Browse::set_sort('type','ASC'); Browse::set_filter('playlist_type','1'); $playlist_ids = Browse::get_objects(); @@ -93,8 +92,6 @@ switch($_REQUEST['action']) { break; default: - - break; } // end Switch $action diff --git a/docs/CHANGELOG b/docs/CHANGELOG index 83c29832..bf1033b2 100755 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -4,6 +4,8 @@ -------------------------------------------------------------------------- v.3.4-Beta2 + - Added Checkbox for All Playlists filter (Admin Only) also made + filters only appear when its logical for them to be there - Fixed filtering of Private Playlists and fixed editing of type of playlist. Default is still public on creation. - Fixed erronous fseek() when downsampling. diff --git a/lib/class/browse.class.php b/lib/class/browse.class.php index c6ad958e..1ba01e65 100644 --- a/lib/class/browse.class.php +++ b/lib/class/browse.class.php @@ -129,6 +129,34 @@ class Browse { } // get_filter + /** + * get_allowed_filters + * This returns an array of the allowed filters based on the type of object we are working + * with, this is used to display the 'filter' sidebar stuff, must be called post browse stuff + */ + public static function get_allowed_filters() { + + switch ($_SESSION['browse']['type']) { + case 'album': + $valid_array = array('show_art','alpha_match'); + break; + case 'artist': + case 'genre': + case 'song': + case 'live-stream': + $valid_array = array('alpha_match'); + break; + case 'playlist': + $valid_array = array('alpha_match'); + if (Access::check('interface','50')) { + array_push($valid_array,'playlist_type'); + } + break; + } // switch on the browsetype + + return $valid_array; + + } // get_allowed_filters /** * set_type diff --git a/localplay.php b/localplay.php index 989f75e9..f1593a4a 100644 --- a/localplay.php +++ b/localplay.php @@ -62,10 +62,6 @@ switch ($_REQUEST['action']) { $fields = $localplay->get_instance_fields(); require_once Config::get('prefix') . '/templates/show_localplay_edit_instance.inc.php'; break; - case 'test_instance': - // Check to make sure they've got the rights - if (!Access::check('localplay','75')) { access_denied(); break; } - break; case 'show_instances': // First build the localplay object and then get the instances if (!Access::check('localplay','5')) { access_denied(); break; } diff --git a/templates/sidebar_browse.inc.php b/templates/sidebar_browse.inc.php index fb888eb9..450108f9 100644 --- a/templates/sidebar_browse.inc.php +++ b/templates/sidebar_browse.inc.php @@ -20,7 +20,7 @@ */ $ajax_info = Config::get('ajax_url'); $web_path = Config::get('web_path'); - +$allowed_filters = Browse::get_allowed_filters(); ?> <ul class="sb2" id="sb_browse"> <li><h4><?php echo _('Browse By'); ?></h4> @@ -40,22 +40,35 @@ $ajax_info = Config::get('ajax_url'); $web_path = Config::get('web_path'); </li> <li><h4><?php echo _('Filters'); ?></h4> <div class="sb3"> - <?php show_alphabet_list($_REQUEST['alpha_match'],$_REQUEST['action']); ?> - <form id="multi_alpha_filter_form" method="post" action="javascript:void(0);"> - <input type="textbox" id="multi_alpha_filter" name="value" value="<?php echo scrub_out($_REQUEST['alpha_match']); ?>" onChange="<?php echo Ajax::action('?page=browse&action=browse&key=alpha_match','multi_alpha_filter','multi_alpha_filter_form'); ?>"> - <label id="multi_alpha_filterLabel" for="multi_art_filter"><?php echo _('Starts With'); ?></label> - </form> - <!-- - <input type="checkbox" onclick="ajaxPut('<?php echo $ajax_info; ?>?action=browse&key=min_count&value=1');return true;" value="1" /> - <?php echo _('Minimum Count'); ?><br /> - <input type="checkbox" onclick="ajaxPut('<?php echo $ajax_info; ?>?action=browse&key=rated&value=1');return true;" value="1" /> - <?php echo _('Rated'); ?><br /> - <input id="unplayedCB" type="checkbox" <?php echo $string = Browse::get_filter('unplayed') ? 'checked="checked"' : ''; ?>/> - <label id="unplayedLabel" for="unplayedCB"><?php echo _('Unplayed'); ?></label><br /> - --> - <input id="show_artCB" type="checkbox" <?php echo $string = Browse::get_filter('show_art') ? 'checked="checked"' : ''; ?>/> - <label id="show_artLabel" for="show_artCB"><?php echo _('Show Art'); ?></label><br /> - <?php echo Ajax::observe('show_artCB','click',Ajax::action('?page=browse&action=browse&key=show_art&value=1','')); ?> + <?php if (in_array('alpha_match',$allowed_filters)) { ?> + <?php show_alphabet_list($_REQUEST['alpha_match'],$_REQUEST['action']); ?> + <form id="multi_alpha_filter_form" method="post" action="javascript:void(0);"> + <input type="textbox" id="multi_alpha_filter" name="value" value="<?php echo scrub_out($_REQUEST['alpha_match']); ?>" onChange="<?php echo Ajax::action('?page=browse&action=browse&key=alpha_match','multi_alpha_filter','multi_alpha_filter_form'); ?>"> + <label id="multi_alpha_filterLabel" for="multi_art_filter"><?php echo _('Starts With'); ?></label> + </form> + <?php } // end if alpha_match ?> + <?php if (in_array('minimum_count',$allowed_filters)) { ?> + <input id="mincountCB" type="checkbox" onclick="ajaxPut('<?php echo $ajax_info; ?>?action=browse&key=min_count&value=1');return true;" value="1" /> + <label id="mincountLabel" for="mincountCB"><?php echo _('Minimum Count'); ?></label><br /> + <?php } ?> + <?php if (in_array('rated',$allowed_filters)) { ?> + <input id="ratedCB" type="checkbox" onclick="ajaxPut('<?php echo $ajax_info; ?>?action=browse&key=rated&value=1');return true;" value="1" /> + <label id="ratedLabel" for="ratedCB"><?php echo _('Rated'); ?></label><br /> + <?php } ?> + <?php if (in_array('unplayed',$allowed_filters)) { ?> + <input id="unplayedCB" type="checkbox" <?php echo $string = Browse::get_filter('unplayed') ? 'checked="checked"' : ''; ?>/> + <label id="unplayedLabel" for="unplayedCB"><?php echo _('Unplayed'); ?></label><br /> + <?php } ?> + <?php if (in_array('show_art',$allowed_filters)) { ?> + <input id="show_artCB" type="checkbox" <?php echo $string = Browse::get_filter('show_art') ? 'checked="checked"' : ''; ?>/> + <label id="show_artLabel" for="show_artCB"><?php echo _('Show Art'); ?></label><br /> + <?php echo Ajax::observe('show_artCB','click',Ajax::action('?page=browse&action=browse&key=show_art&value=1','')); ?> + <?php } // if show_art ?> + <?php if (in_array('playlist_type',$allowed_filters)) { ?> + <input id="show_allplCB" type="checkbox" <?php echo $string = Browse::get_filter('playlist_type') ? 'checked="checked"' : ''; ?>/> + <label id="show_allplLabel" for="showallplCB"><?php echo _('All Playlists'); ?></label><br /> + <?php echo Ajax::observe('show_allplCB','click',Ajax::action('?page=browse&action=browse&key=playlist_type&value=1','')); ?> + <?php } // if playlist_type ?> </div> </li> </ul> |