diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-12-24 00:57:36 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-12-24 00:57:36 +0000 |
commit | 3d8ff28ac56f30075bd9c485e2ee94f486717e6f (patch) | |
tree | 46413c2ccfc5d7f99a26ecb3fe6f23ac0a9278cd | |
parent | ee64379cf4c093d589502e72036759e66671cac7 (diff) | |
download | ampache-3d8ff28ac56f30075bd9c485e2ee94f486717e6f.tar.gz ampache-3d8ff28ac56f30075bd9c485e2ee94f486717e6f.tar.bz2 ampache-3d8ff28ac56f30075bd9c485e2ee94f486717e6f.zip |
fixed filters being applied incorrectly, and removed un-needed query on show album
-rw-r--r-- | albums.php | 8 | ||||
-rwxr-xr-x | docs/CHANGELOG | 1 | ||||
-rw-r--r-- | genre.php | 3 | ||||
-rw-r--r-- | lib/class/browse.class.php | 34 | ||||
-rw-r--r-- | lib/ui.lib.php | 2 | ||||
-rw-r--r-- | server/browse.ajax.php | 13 | ||||
-rw-r--r-- | templates/show_album.inc.php | 1 | ||||
-rw-r--r-- | templates/show_artist.inc.php | 2 | ||||
-rw-r--r-- | templates/show_playlist.inc.php | 1 | ||||
-rw-r--r-- | templates/sidebar_browse.inc.php | 3 |
10 files changed, 51 insertions, 17 deletions
@@ -151,12 +151,11 @@ switch ($_REQUEST['action']) { $album = new Album($album_id); $album->insert_art($image,$mime); - - show_confirmation(_('Album Art Inserted'),'',"/albums.php?action=show&album=$album_id"); + header("Location:" . Config::get('web_path') . "/albums.php?action=show&album=" . $album->id); break; case 'update_from_tags': // Make sure they are a 'power' user at least - if (!$GLOBALS['user']->has_access('75')) { + if (!Access::check('interface','75')) { access_denied(); exit; } @@ -176,9 +175,6 @@ switch ($_REQUEST['action']) { $album->format(); require Config::get('prefix') . '/templates/show_album.inc.php'; - - /* Get the song ids for this album */ - $song_ids = $album->get_songs(0,$_REQUEST['artist']); break; } // switch on view diff --git a/docs/CHANGELOG b/docs/CHANGELOG index 7eb72985..9eadb2a5 100755 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -4,6 +4,7 @@ -------------------------------------------------------------------------- v.3.4-Alpha4 + - Fixed filters applying incorrectly to non-browse displays - Fixed Flash Player issue when Playlist Method wasn't default - Fixed XML-RPC, now uses handshake method properly - Fixed bug where stream would start even with no songs @@ -38,6 +38,7 @@ switch($_REQUEST['action']) { Browse::reset_filters(); Browse::set_type('song'); Browse::set_sort('name','ASC'); + Browse::set_static_content(1); Browse::save_objects($object_ids); Browse::show_objects($object_ids); echo "</div>"; @@ -52,6 +53,7 @@ switch($_REQUEST['action']) { Browse::reset_filters(); Browse::set_type('album'); Browse::set_sort('name','ASC'); + Browse::set_static_content(1); Browse::save_objects($object_ids); Browse::show_objects($object_ids); echo "</div>"; @@ -64,6 +66,7 @@ switch($_REQUEST['action']) { Browse::reset_filters(); Browse::set_type('artist'); Browse::set_sort('name','ASC'); + Browse::set_static_content(1); Browse::save_objects($object_ids); Browse::show_objects($object_ids); echo "</div>"; diff --git a/lib/class/browse.class.php b/lib/class/browse.class.php index d74d2514..caaf79b5 100644 --- a/lib/class/browse.class.php +++ b/lib/class/browse.class.php @@ -36,6 +36,10 @@ class Browse { // Boolean if this is a simple browse method (use different paging code) public static $simple_browse; + // Static Content, this is defaulted to false, if set to true then wen can't + // apply any filters that would change the result set. + public static $static_content = false; + /** * constructor * This should never be called @@ -58,9 +62,6 @@ class Browse { switch ($key) { case 'show_art': - case 'min_count': - case 'unplayed': - case 'rated': $key = $_REQUEST['key']; if ($_SESSION['browse']['filter'][$key]) { unset($_SESSION['browse']['filter'][$key]); @@ -69,14 +70,23 @@ class Browse { $_SESSION['browse']['filter'][$key] = 1; } break; + case 'min_count': + case 'unplayed': + case 'rated': + + break; case 'alpha_match': + if (self::$static_content) { return false; } if ($value == _('All')) { $value = ''; } $_SESSION['browse']['filter'][$key] = $value; break; default: // Rien a faire + return false; break; } // end switch + + return true; } // set_filter @@ -100,7 +110,6 @@ class Browse { */ public static function reset_supplemental_objects() { - $_SESSION['browse']['supplemental'] = array(); } // reset_supplemental_objects @@ -138,6 +147,7 @@ class Browse { $_SESSION['browse']['type'] = $type; // Resets the simple browse self::set_simple_browse(0); + self::set_static_content(0); self::reset_supplemental_objects(); break; default: @@ -226,6 +236,21 @@ class Browse { } // set_simple_browse /** + * set_static_content + * This sets true/false if the content of this browse + * should be static, if they are then content filtering/altering + * methods will be skipped + */ + public static function set_static_content($value) { + + $value = make_bool($value); + self::$static_content = $value; + + $_SESSION['browse']['static'] = $value; + + } // set_static_content + + /** * get_saved * This looks in the session for the saved * stuff and returns what it finds @@ -723,6 +748,7 @@ class Browse { public static function _auto_init() { self::$simple_browse = make_bool($_SESSION['browse']['simple']); + self::$static_content = make_bool($_SESSION['browse']['static']); } // _auto_init diff --git a/lib/ui.lib.php b/lib/ui.lib.php index ad51b148..e932aaae 100644 --- a/lib/ui.lib.php +++ b/lib/ui.lib.php @@ -137,7 +137,7 @@ function show_alphabet_list () { $style_name = "style_" . strtolower($l); $class = "link"; if ($l==$selected) $class .=" active"; - echo "<span class=\"" . $class . "\" onclick=\"ajaxPut('". Config::get('ajax_url') ."?action=browse&key=alpha_match&value=$l');return true;\">" . + echo "<span class=\"" . $class . "\" onclick=\"ajaxPut('". Config::get('ajax_url') ."?page=browse&action=browse&key=alpha_match&value=$l');return true;\">" . $l . "</span>\n"; } echo "</div>"; diff --git a/server/browse.ajax.php b/server/browse.ajax.php index f8d67480..ef176d88 100644 --- a/server/browse.ajax.php +++ b/server/browse.ajax.php @@ -26,19 +26,24 @@ if (AJAX_INCLUDE != '1') { exit; } switch ($_REQUEST['action']) { case 'browse': + + $object_ids = array(); + if ($_REQUEST['key'] && $_REQUEST['value']) { // Set any new filters we've just added - Browse::set_filter($_REQUEST['key'],$_REQUEST['value']); + Browse::set_filter($_REQUEST['key'],$_REQUEST['value']); } if ($_REQUEST['sort']) { // Set the new sort value Browse::set_sort($_REQUEST['sort']); } - // Refresh the browse div with our new filter options - $object_ids = Browse::get_objects(); + // Refresh the browse div with our new filter options if we're not static + if (!Browse::$static_content) { + $object_ids = Browse::get_objects(); + } - ob_start(); + ob_start(); Browse::show_objects($object_ids); $results['browse_content'] = ob_get_contents(); ob_end_clean(); diff --git a/templates/show_album.inc.php b/templates/show_album.inc.php index 78944dbf..4bfd05e7 100644 --- a/templates/show_album.inc.php +++ b/templates/show_album.inc.php @@ -67,6 +67,7 @@ $title = scrub_out($album->name) . ' (' . $album->year . ') -- ' <?php $object_ids = $album->get_songs(); Browse::set_type('song'); + Browse::set_static_content(1); Browse::save_objects($object_ids); Browse::show_objects($object_ids); ?> diff --git a/templates/show_artist.inc.php b/templates/show_artist.inc.php index 9c598c08..720e36b5 100644 --- a/templates/show_artist.inc.php +++ b/templates/show_artist.inc.php @@ -26,7 +26,9 @@ require Config::get('prefix') . '/templates/show_artist_box.inc.php'; ?> <div id="browse_content"> <?php + Browse::reset_filters(); Browse::set_type('album'); + Browse::set_static_content(1); Browse::save_objects($albums); Browse::show_objects($albums); ?> diff --git a/templates/show_playlist.inc.php b/templates/show_playlist.inc.php index cd31488a..057fcec1 100644 --- a/templates/show_playlist.inc.php +++ b/templates/show_playlist.inc.php @@ -38,6 +38,7 @@ $web_path = Config::get('web_path'); $object_ids = $playlist->get_items(); Browse::set_type('playlist_song'); Browse::add_supplemental_object('playlist',$playlist->id); + Browse::set_static_content(1); Browse::save_objects($object_ids); Browse::show_objects($object_ids); ?> diff --git a/templates/sidebar_browse.inc.php b/templates/sidebar_browse.inc.php index 608f98bc..5c7ebe07 100644 --- a/templates/sidebar_browse.inc.php +++ b/templates/sidebar_browse.inc.php @@ -23,10 +23,9 @@ <?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 /> - <?php echo Ajax::observe('unplayedCB','click',Ajax::action('?page=browse&action=browse&key=unplayed&value=1','')); ?> + --> <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','')); ?> |