diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-08-09 06:17:37 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-08-09 06:17:37 +0000 |
commit | 796c2692d0cfa4641e0c47700371c24a01412ed1 (patch) | |
tree | 33d8921798b9603c177a0dd2a025e09f3f32691f | |
parent | 905d434c669b634c6e070c60811a4a5ecfc1c67a (diff) | |
download | ampache-796c2692d0cfa4641e0c47700371c24a01412ed1.tar.gz ampache-796c2692d0cfa4641e0c47700371c24a01412ed1.tar.bz2 ampache-796c2692d0cfa4641e0c47700371c24a01412ed1.zip |
fixed lower paging horn, tweaked css for page-a-nation, added paging to playlists, genres and radio strations, added detection of purchase urls to find missing tracks on albums
-rwxr-xr-x | docs/CHANGELOG | 5 | ||||
-rw-r--r-- | images/icon_money.png | bin | 0 -> 738 bytes | |||
-rw-r--r-- | lib/class/metadata.class.php | 6 | ||||
-rw-r--r-- | modules/infotools/openstrands.class.php | 27 | ||||
-rw-r--r-- | templates/list_header.inc.php | 37 | ||||
-rw-r--r-- | templates/show_albums.inc.php | 4 | ||||
-rw-r--r-- | templates/show_artists.inc.php | 4 | ||||
-rw-r--r-- | templates/show_genres.inc.php | 8 | ||||
-rw-r--r-- | templates/show_live_streams.inc.php | 12 | ||||
-rw-r--r-- | templates/show_playlists.inc.php | 10 | ||||
-rw-r--r-- | templates/show_songs.inc.php | 4 | ||||
-rw-r--r-- | themes/classic/templates/default.css | 22 |
12 files changed, 92 insertions, 47 deletions
diff --git a/docs/CHANGELOG b/docs/CHANGELOG index 4aa9c172..eaaa4121 100755 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -4,6 +4,11 @@ -------------------------------------------------------------------------- v.3.4-Alpha2 + - Added 'Buy This Track' link on Find Missing Tracks if a purchase + url is given in the returned data + - Reduced # of pages at any one point on browse pages and tweaked + their display, and fixed the bottom paging stuff + - Massive improvement to sidebar (Thx Spocky) - Added default sort order for Song Titles, Albums & Artists has a dbl sort bug, leaving it in until true sorting is in so you can click twice to invert sort diff --git a/images/icon_money.png b/images/icon_money.png Binary files differnew file mode 100644 index 00000000..42c52d05 --- /dev/null +++ b/images/icon_money.png diff --git a/lib/class/metadata.class.php b/lib/class/metadata.class.php index f7cb3e32..4a90e59a 100644 --- a/lib/class/metadata.class.php +++ b/lib/class/metadata.class.php @@ -118,7 +118,7 @@ class metadata { if (!$mystrands_id) { return false; } - $tracks = $openstrands->lookup_album_tracks($mystrands_id); + $tracks = $openstrands->lookup_album_tracks($mystrands_id,Openstrands::$alias); // Recurse the data we've found and check the local album foreach ($tracks as $track) { @@ -128,6 +128,10 @@ class metadata { $data['disc'] = $track['DiscNumber']; $data['artist'] = $track['ArtistName']; $data['links'] = "<a target=\"_blank\" href=\"" . $track['URI'] . "\">" . get_user_icon('world_link','MyStrands') . "</a>"; + // If we've got a purchase URL + if ($track['UserPurchaseURI']) { + $data['links'] .= "<a target=\"_blank\" href=\"" . $track['UserPurchaseURI'] . "\">" . get_user_icon('money',_('Buy Track from MyStrands')) . "</a>"; + } $objects[] = Album::construct_from_array($data); } } // end foreach diff --git a/modules/infotools/openstrands.class.php b/modules/infotools/openstrands.class.php index b477b966..1994c084 100644 --- a/modules/infotools/openstrands.class.php +++ b/modules/infotools/openstrands.class.php @@ -163,8 +163,10 @@ class openStrands { * lookup_albums
* This returns the data for a given mystrands album (based on ID)
* If it's an array of ids pass as [] = ID, [] = ID
+ * You can optionally pass an alias to this, if you do you can get
+ * the 'buy' links as UserPurchaseURI
*/
- public function lookup_albums($ids) {
+ public function lookup_albums($ids,$alias='') {
// This allows multiple albums in a single query,
// so build it accordingly
@@ -179,6 +181,11 @@ class openStrands { $string = '?id=' . intval($ids);
}
+ // If they have passed an alias
+ if ($alias) {
+ $string .= '&alias=' . urlencode($alias);
+ }
+
$xml_doc = self::run_query("/lookup/albums$string");
// Set the right parent
@@ -194,8 +201,10 @@ class openStrands { * lookup_tracks
* This returns the data for a given mystrands track (based on ID)
* If it's an array of ids pass as [] = ID, [] = ID
+ * This can take an optional alias, if passed UserPurchaseURI will
+ * be returned
*/
- public function lookup_tracks($ids) {
+ public function lookup_tracks($ids,$alias='') {
// This allows for multiple entires, so build accordingly
if (is_array($ids)) {
@@ -209,6 +218,11 @@ class openStrands { $string = '?id=' . intval($ids);
}
+ // If they have passed an alias
+ if ($alias) {
+ $string .= '&alias=' . urlencode($alias);
+ }
+
$xml_doc = self::run_query("/lookup/tracks$string");
// Set the parent
@@ -224,11 +238,15 @@ class openStrands { * lookup_album_tracks
* This takes a album ID and then returns the track list for it
*/
- public function lookup_album_tracks($mystrands_album_id) {
+ public function lookup_album_tracks($mystrands_album_id,$alias='') {
$mystrands_album_id = intval($mystrands_album_id);
- $xml_doc = self::run_query("/lookup/album/tracks?id=$mystrands_album_id");
+ if ($alias) {
+ $alias_txt = '&alias=' . urlencode($alias);
+ }
+
+ $xml_doc = self::run_query("/lookup/album/tracks?id=$mystrands_album_id$alias_txt");
// Set the right parent
$this->_containerTag = 'AlbumTrack';
@@ -608,6 +626,7 @@ class openStrands { // Build the URL
$url = self::$base_url . $action . '&subscriberId=' . self::$auth_token;
+
$contents = file_get_contents($url);
return $contents;
diff --git a/templates/list_header.inc.php b/templates/list_header.inc.php index 8146261d..99589ae6 100644 --- a/templates/list_header.inc.php +++ b/templates/list_header.inc.php @@ -27,9 +27,13 @@ */ // Pull these variables out to allow shorthand (easier for lazy programmers) -$limit = $GLOBALS['user']->prefs['offset_limit'] ? $GLOBALS['user']->prefs['offset_limit'] : '25'; -$start = Browse::$start; -$total = Browse::$total_objects; +$limit = $GLOBALS['user']->prefs['offset_limit'] ? $GLOBALS['user']->prefs['offset_limit'] : '25'; +$start = Browse::$start; +$total = Browse::$total_objects; +$uid = Config::get('list_header_uid'); + +// ++ the uid +Config::set('list_header_uid',$uid+1); // Next $next_offset = $start + $limit; @@ -59,7 +63,7 @@ $page = $current_page; $i = 0; /* While we have pages left */ while ($page > 0) { - if ($i == '15') { $page_data['down'][1] = '...'; $page_data['down'][0] = '0'; break; } + if ($i == '10') { $page_data['down'][1] = '...'; $page_data['down'][0] = '0'; break; } $i++; $page = $page - 1; $page_data['down'][$page] = $page * $limit; @@ -71,7 +75,7 @@ $i = 0; /* While we have pages left */ while ($page <= $pages) { if ($page * $limit > $total) { break; } - if ($i == '15') { + if ($i == '10') { $key = $pages - 1; if (!$page_data['up'][$key]) { $page_data['up'][$key] = '...'; } $page_data['up'][$pages] = ($pages-1) * $limit; @@ -86,26 +90,13 @@ while ($page <= $pages) { ksort($page_data['up']); ksort($page_data['down']); -/* Detect the current script, this take a little work because we have to - * account for FastCGI - */ -preg_match("/.*\/(.+\.php)$/", $_SERVER['SCRIPT_NAME'], $matches); -// Must be running Fast CGI or something similar -if (!isset($matches['1'])) { - // Try PHP_SELF - preg_match("/.*\/(.+\.php)$/",$_SERVER['PHP_SELF'],$matches); -} - -$action = "action=" . scrub_in($_REQUEST['action']); -$script = Config::get('web_path') . "/" . $admin_menu . $matches[1]; - // are there enough items to even need this view? if ($pages > 1) { ?> <table class="list-header" cellpadding="1" cellspacing="0" width="100%"> <tr> <td valign="top"> - <?php echo Ajax::text('?action=page&start=' . $prev_offset,'[' . _('Prev') . ']','browse_prev','','list-header'); ?> + <?php echo Ajax::text('?action=page&start=' . $prev_offset,_('Prev'),'browse_' . $uid . 'prev','','list-header'); ?> </td> <td align="center"> <?php @@ -115,27 +106,27 @@ if ($pages > 1) { else { // Hack Alert $page++; - echo Ajax::text('?action=page&start=' . $offset,$page,'browse_page_' . $page,'','list-header'); + echo Ajax::text('?action=page&start=' . $offset,$page,'browse_' . $uid . 'page_' . $page,'','list-header'); } } // end foreach down /* Echo Out current Page */ $current_page = $current_page +1; ?> - <span class="list-header"><strong><?php echo $current_page; ?></strong></span> + <span class="list-header-selected"><?php echo $current_page; ?></span> <?php /* Echo Out Everything Above Us */ foreach ($page_data['up'] as $page=>$offset) { if ($offset === '...') { echo '... '; } else { - echo Ajax::text('?action=page&start=' . $offset,$page,'browse_page_' . $page,'','list-header'); + echo Ajax::text('?action=page&start=' . $offset,$page,'browse_' . $uid . 'page_' . $page,'','list-header'); } // end else } // end foreach up ?> </td> <td valign="top"> - <?php echo Ajax::text('?action=page&start=' . $next_offset,'[' . _('Next') . ']','browse_next','','list-header'); ?> + <?php echo Ajax::text('?action=page&start=' . $next_offset,_('Next'),'browse_' . $uid . 'next','','list-header'); ?> </td> </tr> </table> diff --git a/templates/show_albums.inc.php b/templates/show_albums.inc.php index 713112c9..7a692caf 100644 --- a/templates/show_albums.inc.php +++ b/templates/show_albums.inc.php @@ -22,7 +22,7 @@ $web_path = Config::get('web_path'); $ajax_url = Config::get('ajax_url'); ?> <table class="tabledata" cellspacing="0" cellpadding="0" border="0"> -<tr class="table-header"> +<tr> <td colspan="7"> <?php require Config::get('prefix') . '/templates/list_header.inc.php'; ?> </td> @@ -48,7 +48,7 @@ $ajax_url = Config::get('ajax_url'); <?php require Config::get('prefix') . '/templates/show_album_row.inc.php'; ?> </tr> <?php } //end foreach ($albums as $album) ?> -<tr class="table-header"> +<tr> <td colspan="7"> <?php require Config::get('prefix') . '/templates/list_header.inc.php'; ?> </td> diff --git a/templates/show_artists.inc.php b/templates/show_artists.inc.php index 3f4ef881..da95eadc 100644 --- a/templates/show_artists.inc.php +++ b/templates/show_artists.inc.php @@ -22,7 +22,7 @@ $web_path = Config::get('web_path'); ?> <table class="tabledata" cellspacing="0" cellpadding="0" border="0"> -<tr class="table-header" align="center"> +<tr> <td colspan="5"> <?php require Config::get('prefix') . '/templates/list_header.inc.php'; ?> </td> @@ -52,7 +52,7 @@ foreach ($object_ids as $artist_id) { <td><?php echo _('Action'); ?></td> </tr> -<tr class="table-header" align="center"> +<tr> <td colspan="5"> <?php require Config::get('prefix') . '/templates/list_header.inc.php'; ?> </td> diff --git a/templates/show_genres.inc.php b/templates/show_genres.inc.php index c170f7bb..1160d92a 100644 --- a/templates/show_genres.inc.php +++ b/templates/show_genres.inc.php @@ -25,9 +25,9 @@ */ ?> <table class="tabledata" cellspacing="0" cellpadding="0" border="0"> -<tr class="table-header" align="center"> +<tr> <td colspan="5"> - <?php if ($view->offset_limit) { require (conf('prefix') . "/templates/list_header.inc"); } ?> + <?php require Config::get('prefix') . '/templates/list_header.inc.php' ?> </td> </tr> <tr class="table-header"> @@ -61,9 +61,9 @@ foreach ($object_ids as $genre_id) { </td> </tr> <?php } // end foreach genres ?> -<tr class="even" align="center"> +<tr> <td colspan="5"> - <?php if ($view->offset_limit) { require (conf('prefix') . "/templates/list_header.inc"); } ?> + <?php require Config::get('prefix') . '/templates/list_header.inc.php' ?> </td> </tr> </table> diff --git a/templates/show_live_streams.inc.php b/templates/show_live_streams.inc.php index bd03bab6..b69e81d3 100644 --- a/templates/show_live_streams.inc.php +++ b/templates/show_live_streams.inc.php @@ -22,9 +22,9 @@ $web_path = Config::get('web_path'); ?> <table class="tabledata" cellspacing="0" cellpadding="0" border="0"> -<tr class="table-header" align="center"> - <td colspan="5"> - <?php if ($GLOBALS['view']->offset_limit) { require Config::get('prefix') . '/templates/list_header.inc'; } ?> +<tr> + <td colspan="6"> + <?php require Config::get('prefix') . '/templates/list_header.inc.php'; ?> </td> </tr> <tr class="table-header"> @@ -44,9 +44,9 @@ foreach ($object_ids as $radio_id) { <?php require Config::get('prefix') . '/templates/show_live_stream_row.inc.php'; ?> </tr> <?php } //end foreach ($artists as $artist) ?> -<tr class="even" align="center"> - <td colspan="4"> - <?php if ($view->offset_limit) { require (conf('prefix') . "/templates/list_header.inc"); } ?> +<tr> + <td colspan="6"> + <?php require Config::Get('prefix') . '/templates/list_header.inc.php'; ?> </td> </tr> </table> diff --git a/templates/show_playlists.inc.php b/templates/show_playlists.inc.php index 4b925fe8..81b7b22d 100644 --- a/templates/show_playlists.inc.php +++ b/templates/show_playlists.inc.php @@ -21,6 +21,11 @@ */ ?> <table class="tabledata" cellspacing="0" cellpadding="0" border="0"> <!-- Playlist Table --> +<tr> + <td colspan="5"> + <?php require Config::get('prefix') . '/templates/list_header.inc.php' ?> + </td> +</tr> <tr class="table-header"> <th> </th> <th><?php echo _('Playlist Name'); ?></th> @@ -38,4 +43,9 @@ foreach ($object_ids as $playlist_id) { <?php require Config::get('prefix') . '/templates/show_playlist_row.inc.php'; ?> </tr> <?php } // end foreach ($playlists as $playlist) ?> +<tr> + <td colspan="5"> + <?php require Config::get('prefix') . '/templates/list_header.inc.php' ?> + </td> +</tr> </table> diff --git a/templates/show_songs.inc.php b/templates/show_songs.inc.php index bedc49f1..2ad73b95 100644 --- a/templates/show_songs.inc.php +++ b/templates/show_songs.inc.php @@ -24,7 +24,7 @@ $web_path = Config::get('web_path'); $ajax_url = Config::get('ajax_url'); ?> <table class="tabledata" cellspacing="0" cellpadding="0"> -<tr class="table-header" align="center"> +<tr> <td colspan="8"> <?php require Config::get('prefix') . '/templates/list_header.inc.php'; ?> </td> @@ -50,7 +50,7 @@ $ajax_url = Config::get('ajax_url'); <?php require Config::get('prefix') . '/templates/show_song_row.inc.php'; ?> </tr> <?php } ?> -<tr class="table-header" align="center"> +<tr> <td colspan="8"> <?php require Config::get('prefix') . '/templates/list_header.inc.php'; ?> </td> diff --git a/themes/classic/templates/default.css b/themes/classic/templates/default.css index bb977f68..8d8142a6 100644 --- a/themes/classic/templates/default.css +++ b/themes/classic/templates/default.css @@ -504,12 +504,28 @@ span.five-stars:hover { width: 80px; } /* List Header Styles */ /************************************************/ .list-header { - text-decoration: none; + background:#ffffff; +} +table.list-header { + margin:3px; +} +span.list-header { cursor:pointer; + text-decoration: none; + font-size: 0.8em; + padding:0px 4px 0px 4px; + border: 1px solid #000; } -.list-header:hover { - color:#071fd4; +span.list-header-selected { + text-decoration: none; + font-size: 0.8em; + padding:0px 4px 0px 4px; + border: 1px solid #000; + background: #e0e0e0; } +span.list-header:hover { + background: #d0d0d0; +} /************************************************/ |