summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-08-06 05:53:26 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-08-06 05:53:26 +0000
commitf0addeb4a1700b6ad625726fe8c0793cdafa9fed (patch)
treeed2e4fef6759867bed8229116ae2e91b3b3da239
parent69b204fb1dcca77c177d3ac5ec7fb686fb5a5b58 (diff)
downloadampache-f0addeb4a1700b6ad625726fe8c0793cdafa9fed.tar.gz
ampache-f0addeb4a1700b6ad625726fe8c0793cdafa9fed.tar.bz2
ampache-f0addeb4a1700b6ad625726fe8c0793cdafa9fed.zip
added ability to view album art on browse ablums and removed redundent code in show_artist, props to the first person who finds the bug with this re-use of code
-rwxr-xr-xdocs/CHANGELOG1
-rw-r--r--favicon.icobin4286 -> 1150 bytes
-rw-r--r--images/icon_mystrands.pngbin524 -> 0 bytes
-rw-r--r--images/icon_world_link.pngbin0 -> 957 bytes
-rw-r--r--lib/class/browse.class.php12
-rw-r--r--lib/class/metadata.class.php4
-rw-r--r--server/ajax.server.php4
-rw-r--r--server/browse.ajax.php53
-rw-r--r--templates/show_album_row.inc.php6
-rw-r--r--templates/show_albums.inc.php7
-rw-r--r--templates/show_artist.inc.php48
-rw-r--r--templates/show_edit_album_row.inc.php2
-rw-r--r--templates/sidebar_browse.inc.php8
13 files changed, 92 insertions, 53 deletions
diff --git a/docs/CHANGELOG b/docs/CHANGELOG
index 17958f94..cd3abbd6 100755
--- a/docs/CHANGELOG
+++ b/docs/CHANGELOG
@@ -4,6 +4,7 @@
--------------------------------------------------------------------------
v.3.4-Alpha2
+ - Added ability to show Album art on Browse -> Albums
- Added Similar Artists Link, requires MyStrands
- Fixed hovering on the static Ratings displays
- Added MyStrands Plugin, must be enabled under Plugins
diff --git a/favicon.ico b/favicon.ico
index a362d96f..39b8f4d5 100644
--- a/favicon.ico
+++ b/favicon.ico
Binary files differ
diff --git a/images/icon_mystrands.png b/images/icon_mystrands.png
deleted file mode 100644
index 3022229a..00000000
--- a/images/icon_mystrands.png
+++ /dev/null
Binary files differ
diff --git a/images/icon_world_link.png b/images/icon_world_link.png
new file mode 100644
index 00000000..b8edc126
--- /dev/null
+++ b/images/icon_world_link.png
Binary files differ
diff --git a/lib/class/browse.class.php b/lib/class/browse.class.php
index 7be9db02..a8fa538c 100644
--- a/lib/class/browse.class.php
+++ b/lib/class/browse.class.php
@@ -79,6 +79,18 @@ class Browse {
} // set_filter
/**
+ * get_filter
+ * returns the specified filter value
+ */
+ public static function get_filter($key) {
+
+ // Simple enough, but if we ever move this crap
+ return $_SESSION['browse']['filter'][$key];
+
+ } // get_filter
+
+
+ /**
* set_type
* This sets the type of object that we want to browse by
* we do this here so we only have to maintain a single whitelist
diff --git a/lib/class/metadata.class.php b/lib/class/metadata.class.php
index 39655f09..30a34f4b 100644
--- a/lib/class/metadata.class.php
+++ b/lib/class/metadata.class.php
@@ -66,14 +66,14 @@ class metadata {
$data['name'] = $item['ArtistName'];
$data['uid'] = $item['__attributes']['ArtistID'];
$data['mystrands_url'] = $item['URI'];
- $data['links'] = "<a target=\"_blank\" href=\"" . $item['URI'] . "\">" . get_user_icon('mystrands','MyStrands Link') . "</a>";
+ $data['links'] = "<a target=\"_blank\" href=\"" . $item['URI'] . "\">" . get_user_icon('world_link','MyStrands Link') . "</a>";
// Do a search for this artist in our instance
$artist_id = Catalog::check_artist($data['name'],1);
if ($artist_id) {
$artist = new Artist($artist_id);
$artist->format();
- $data['links'] .= "<a href=\"$artist->f_link\">" . get_user_icon('link','Ampache') . "</a>";
+ $data['links'] .= "<a href=\"$artist->f_link\">" . get_user_icon('ampache','Ampache') . "</a>";
}
$objects[] = Artist::construct_from_array($data);
diff --git a/server/ajax.server.php b/server/ajax.server.php
index f47c8856..9010ea5d 100644
--- a/server/ajax.server.php
+++ b/server/ajax.server.php
@@ -41,6 +41,10 @@ switch ($_REQUEST['page']) {
require_once Config::get('prefix') . '/server/stats.ajax.php';
exit;
break;
+ case 'browse':
+ require_once Config::get('prefix') . '/server/browse.ajax.php';
+ exit;
+ break;
default:
// A taste of compatibility
break;
diff --git a/server/browse.ajax.php b/server/browse.ajax.php
new file mode 100644
index 00000000..57019584
--- /dev/null
+++ b/server/browse.ajax.php
@@ -0,0 +1,53 @@
+<?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.
+
+*/
+
+/**
+ * Sub-Ajax page, requires AJAX_INCLUDE as one
+ */
+if (AJAX_INCLUDE != '1') { exit; }
+
+switch ($_REQUEST['action']) {
+ case 'browse':
+ if ($_REQUEST['key'] && $_REQUEST['value']) {
+ // Set any new filters we've just added
+ 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();
+
+ ob_start();
+ Browse::show_objects($object_ids);
+ $results['browse_content'] = ob_get_contents();
+ ob_end_clean();
+ break;
+ default:
+ $results['rfc3514'] = '0x1';
+ break;
+} // switch on action;
+
+// We always do this
+echo xml_from_array($results);
+?>
diff --git a/templates/show_album_row.inc.php b/templates/show_album_row.inc.php
index 5c1b7aaa..649888e6 100644
--- a/templates/show_album_row.inc.php
+++ b/templates/show_album_row.inc.php
@@ -23,6 +23,12 @@
<?php echo Ajax::button('?action=basket&type=album&id=' . $album->id,'add',_('Add'),'add_album_' . $album->id); ?>
<?php echo Ajax::button('?action=basket&type=album_random&id=' . $album->id,'random',_('Random'),'random_album_' . $album->id); ?>
</td>
+<?php if (Browse::get_filter('show_art')) { ?>
+<td height="87">
+ <a href="<?php echo Config::get('web_path'); ?>/albums.php?action=show&amp;album=<?php echo $album->id; ?>">
+ <img height="75" width="75" border="0" src="<?php echo Config::get('web_path'); ?>/image.php?id=<?php echo $album->id; ?>&amp;thumb=1&amp;sid=<?php echo session_id(); ?>"
+ </a>
+<?php } ?>
<td><?php echo $album->f_name_link; ?></td>
<td><?php echo $album->f_artist; ?></td>
<td><?php echo $album->song_count; ?></td>
diff --git a/templates/show_albums.inc.php b/templates/show_albums.inc.php
index 2741d16d..713112c9 100644
--- a/templates/show_albums.inc.php
+++ b/templates/show_albums.inc.php
@@ -23,12 +23,15 @@ $ajax_url = Config::get('ajax_url');
?>
<table class="tabledata" cellspacing="0" cellpadding="0" border="0">
<tr class="table-header">
- <td colspan="6">
+ <td colspan="7">
<?php require Config::get('prefix') . '/templates/list_header.inc.php'; ?>
</td>
</tr>
<tr class="table-header">
<th><?php echo _('Add'); ?></th>
+ <?php if (Browse::get_filter('show_art')) { ?>
+ <th><?php echo _('Cover'); ?></th>
+ <?php } ?>
<th><?php echo _('Album'); ?></th>
<th><?php echo _('Artist'); ?></th>
<th><?php echo _('Songs'); ?></th>
@@ -46,7 +49,7 @@ $ajax_url = Config::get('ajax_url');
</tr>
<?php } //end foreach ($albums as $album) ?>
<tr class="table-header">
- <td colspan="6">
+ <td colspan="7">
<?php require Config::get('prefix') . '/templates/list_header.inc.php'; ?>
</td>
</tr>
diff --git a/templates/show_artist.inc.php b/templates/show_artist.inc.php
index 17558b42..ae5d5006 100644
--- a/templates/show_artist.inc.php
+++ b/templates/show_artist.inc.php
@@ -23,49 +23,7 @@ $web_path = Config::get('web_path');
require Config::get('prefix') . '/templates/show_artist_box.inc.php';
-show_box_top();
?>
-<table class="tabledata" cellspacing="0" cellpadding="0" border="0">
-<tr class="table-header">
- <th align="center"><?php echo _('Add'); ?></th>
- <th><?php echo _('Cover'); ?></th>
- <th><?php echo _('Album Name'); ?></th>
- <th><?php echo _('Album Year'); ?></th>
- <th><?php echo _('Tracks'); ?></th>
- <th><?php echo _('Action'); ?></th>
-</tr>
-<?php
-foreach ($albums as $album_id) {
- $album = new Album($album_id);
- $album->format();
-?>
-<tr class="<?php echo flip_class(); ?>">
- <td align="center">
- <span onclick="ajaxPut('<?php echo Config::get('ajax_url'); ?>?action=basket&amp;type=album&amp;id=<?php echo $album->id; ?>');return true;" >
- <?php echo get_user_icon('add',_('Add')); ?>
- </span>
- <span onclick="ajaxPut('<?php echo Config::get('ajax_url'); ?>?action=basket&amp;type=album_random&amp;id=<?php echo $album->id; ?>');return true;" >
- <?php echo get_user_icon('random',_('Random')); ?>
- </span>
- </td>
- <td height="87">
- <a href="<?php echo $web_path; ?>/albums.php?action=show&amp;album=<?php echo $album->id; ?>&amp;artist=<?php echo $artist->id; ?>">
- <img border="0" src="<?php echo $web_path; ?>/image.php?id=<?php echo $album->id; ?>&amp;thumb=1&amp;sid=<?php echo session_id(); ?>" alt="<?php echo scrub_out($album->name); ?>" title="<?php echo scrub_out($album->name); ?>" height="75" width="75" />
- </a>
- </td>
- <td>
- <?php echo $album->f_name_link; ?>
- </td>
- <td><?php echo $album->year; ?></td>
- <td><?php echo $album->song_count; ?></td>
- <td>
- <?php if (Access::check_function('batch_download')) { ?>
- <a href="<?php echo $web_path; ?>/batch.php?action=album&amp;id=<?php echo $album->id; ?>">
- <?php echo get_user_icon('batch_download'); ?>
- </a>
- <?php } ?>
- </td>
-</tr>
-<?php } //end foreach ($albums as $album)?>
-</table>
-<?php show_box_bottom(); ?>
+<div id="browse_content">
+<?php Browse::set_type('album'); Browse::show_objects($albums); ?>
+</div>
diff --git a/templates/show_edit_album_row.inc.php b/templates/show_edit_album_row.inc.php
index 19bac5ef..be988776 100644
--- a/templates/show_edit_album_row.inc.php
+++ b/templates/show_edit_album_row.inc.php
@@ -19,7 +19,7 @@
*/
?>
-<td colspan="6">
+<td colspan="7">
<form method="post" id="edit_album_<?php echo $album->id; ?>">
<table border="0" cellpadding="3" cellspacing="0">
<tr>
diff --git a/templates/sidebar_browse.inc.php b/templates/sidebar_browse.inc.php
index f85b8c17..3ae18e0c 100644
--- a/templates/sidebar_browse.inc.php
+++ b/templates/sidebar_browse.inc.php
@@ -19,15 +19,17 @@
<div class="sb3">
<?php show_alphabet_list($_REQUEST['alpha_match'],$_REQUEST['action']); ?>
<!--
- <input type="checkbox" onclick="ajaxPut('<?php echo $ajax_info; ?>?action=browse&amp;key=show_art&amp;value=1');return true;" value="1" />
- <?php echo _('Show Art'); ?><br />
<input type="checkbox" onclick="ajaxPut('<?php echo $ajax_info; ?>?action=browse&amp;key=min_count&amp;value=1');return true;" value="1" />
<?php echo _('Minimum Count'); ?><br />
<input type="checkbox" onclick="ajaxPut('<?php echo $ajax_info; ?>?action=browse&amp;key=rated&amp;value=1');return true;" value="1" />
<?php echo _('Rated'); ?><br />
-->
- <input id="unplayedCB" type="checkbox" onclick="ajaxPut('<?php echo $ajax_info; ?>?action=browse&amp;key=unplayed&amp;value=1');return true;" value="1" />
+ <input id="unplayedCB" type="checkbox" <? 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" <? 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','')); ?>
</div>
</li>
</ul>