summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-12-03 09:14:38 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-12-03 09:14:38 +0000
commit99baf7582de072847cf6307d5b291168520554b1 (patch)
tree237171eb19f3a9012488cd7f2c5b82608a17b861
parent28f7ad7026a864479feb92007315a22096c9e6d2 (diff)
downloadampache-99baf7582de072847cf6307d5b291168520554b1.tar.gz
ampache-99baf7582de072847cf6307d5b291168520554b1.tar.bz2
ampache-99baf7582de072847cf6307d5b291168520554b1.zip
added paging to the playlist view, corrected a few stupid parse errors / mistakes
-rw-r--r--admin/catalog.php6
-rw-r--r--artists.php40
-rwxr-xr-xdocs/CHANGELOG1
-rw-r--r--lib/class/browse.class.php51
-rw-r--r--lib/init.php2
-rw-r--r--lib/stream.lib.php2
-rw-r--r--play/index.php8
-rw-r--r--templates/show_album_art.inc.php2
-rw-r--r--templates/show_artist_box.inc.php1
-rw-r--r--templates/show_playlist.inc.php1
10 files changed, 80 insertions, 34 deletions
diff --git a/admin/catalog.php b/admin/catalog.php
index 9473b03e..90934875 100644
--- a/admin/catalog.php
+++ b/admin/catalog.php
@@ -82,11 +82,11 @@ switch ($_REQUEST['action']) {
/* This runs the clean/verify/add in that order */
foreach ($_REQUEST['catalogs'] as $catalog_id) {
$catalog = new Catalog($catalog_id);
- $catalog->clean_catalog();
+ $catalog->clean_catalog($catalog_id);
$catalog->count = 0;
- $catalog->verify_catalog();
+ $catalog->verify_catalog($catalog_id);
$catalog->count = 0;
- $catalog->add_to_catalog();
+ $catalog->add_to_catalog($catalog_id);
}
$url = Config::get('web_path') . '/admin/index.php';
$title = _('Catalog Updated');
diff --git a/artists.php b/artists.php
index f00d8fcf..4ce7c6f5 100644
--- a/artists.php
+++ b/artists.php
@@ -88,26 +88,26 @@ switch($_REQUEST['action']) {
break;
case 'show_similar':
- if (!$user->has_access('100')) { access_denied(); }
-
- if (isset($_REQUEST['artist'])) {
- $artist = new Artist($_REQUEST['artist']);
- //options
- $similar_artists = $artist->get_similar_artists(
- make_bool($_POST['n_rep_uml']),
- $_POST['n_filter'],
- $_POST['n_ignore'],
- $_POST['c_mode'],
- $_POST['c_count_w'],
- $_POST['c_percent_w'],
- $_POST['c_distance_l'],
- make_bool($_POST['c_ignins_l']));
- $artist_id = $artist->id;
- $artist_name = $artist->name;
- require (conf('prefix') . '/templates/show_similar_artists.inc.php');
- } else {
- $GLOBALS['error']->add_error('general',"Error: No artist given");
- }
+ if (!$GLOBALS['user']->has_access('75')) {
+ access_denied();
+ exit;
+ }
+
+ $artist = new Artist($_REQUEST['artist']);
+ //options
+ $similar_artists = $artist->get_similar_artists(
+ make_bool($_POST['n_rep_uml']),
+ $_POST['n_filter'],
+ $_POST['n_ignore'],
+ $_POST['c_mode'],
+ $_POST['c_count_w'],
+ $_POST['c_percent_w'],
+ $_POST['c_distance_l'],
+ make_bool($_POST['c_ignins_l']));
+ $artist_id = $artist->id;
+ $artist_name = $artist->name;
+ require Config::get('prefix') . '/templates/show_similar_artists.inc.php';
+
break;
case 'rename':
//die if not enough permissions
diff --git a/docs/CHANGELOG b/docs/CHANGELOG
index a68ebda1..ae26e35d 100755
--- a/docs/CHANGELOG
+++ b/docs/CHANGELOG
@@ -4,6 +4,7 @@
--------------------------------------------------------------------------
v.3.4-Alpha4
+ - Added paging to the Playlist Song view
- Fixed error on catalog Update All
- Fixed Public registration page, and simplified logic
- Added 'Add' button to recently played
diff --git a/lib/class/browse.class.php b/lib/class/browse.class.php
index 2fb346f5..61baebcf 100644
--- a/lib/class/browse.class.php
+++ b/lib/class/browse.class.php
@@ -95,6 +95,17 @@ class Browse {
} // reset_filters
/**
+ * reset_supplemental_objects
+ * This clears any sup objects we've added, normally called on every set_type
+ */
+ public static function reset_supplemental_objects() {
+
+
+ $_SESSION['browse']['supplemental'] = array();
+
+ } // reset_supplemental_objects
+
+ /**
* get_filter
* returns the specified filter value
*/
@@ -127,6 +138,7 @@ class Browse {
$_SESSION['browse']['type'] = $type;
// Resets the simple browse
self::set_simple_browse(0);
+ self::reset_supplemental_objects();
break;
default:
// Rien a faire
@@ -257,6 +269,33 @@ class Browse {
} // get_objects
/**
+ * get_supplemental_objects
+ * This returns an array of 'class','id' for additional objects that need to be
+ * created before we start this whole browsing thing
+ */
+ public static function get_supplemental_objects() {
+
+ $objects = $_SESSION['browse']['supplemental'];
+
+ if (!is_array($objects)) { $objects = array(); }
+
+ return $objects;
+
+ } // get_supplemental_objects
+
+ /**
+ * add_supplemental_object
+ * This will add a suplemental object that has to be created
+ */
+ public static function add_supplemental_object($class,$uid) {
+
+ $_SESSION['browse']['supplemental'][$class] = intval($uid);
+
+ return true;
+
+ } // add_supplemental_object
+
+ /**
* get_base_sql
* This returns the base SQL (select + from) for the different types
*/
@@ -537,13 +576,21 @@ class Browse {
if (count($object_ids) > self::$start) {
$object_ids = array_slice($object_ids,self::$start,$limit);
}
-print_r($object_ids);
+
// Format any matches we have so we can show them to the masses
$match = $_SESSION['browse']['filter']['alpha_match'] ? ' (' . $_SESSION['browse']['filter']['alpha_match'] . ')' : '';
// Set the correct classes based on type
$class = "box browse_".$_SESSION['browse']['type'];
+ // Load any additional object we need for this
+ $extra_objects = self::get_supplemental_objects();
+
+ foreach ($extra_objects as $class_name => $id) {
+ ${$class_name} = new $class_name($id);
+ }
+
+ // Switch on the type of browsing we're doing
switch ($_SESSION['browse']['type']) {
case 'song':
show_box_top(_('Songs') . $match, $class);
@@ -581,8 +628,6 @@ print_r($object_ids);
show_box_bottom();
break;
case 'playlist_song':
- // We need a playlist for this one man this is a hack, should figure out a better way
- $playlist = $GLOBALS['playlist'];
show_box_top(_('Playlist Songs') . $match,$class);
require_once Config::get('prefix') . '/templates/show_playlist_songs.inc.php';
show_box_bottom();
diff --git a/lib/init.php b/lib/init.php
index 668ae41f..0342b01f 100644
--- a/lib/init.php
+++ b/lib/init.php
@@ -81,7 +81,7 @@ if (!count($results)) {
}
/** This is the version.... fluf nothing more... **/
-$results['version'] = '3.4-Alpha4 Build (002)';
+$results['version'] = '3.4-Alpha4 Build (003)';
$results['int_config_version'] = '6';
$results['raw_web_path'] = $results['web_path'];
diff --git a/lib/stream.lib.php b/lib/stream.lib.php
index 30721837..588f9251 100644
--- a/lib/stream.lib.php
+++ b/lib/stream.lib.php
@@ -27,7 +27,7 @@ function show_now_playing() {
// GC!
Stream::gc_session();
- gc_now_playing();
+ Stream::gc_now_playing();
$web_path = Config::get('web_path');
$results = get_now_playing();
diff --git a/play/index.php b/play/index.php
index 2d9c2935..19bc1cd4 100644
--- a/play/index.php
+++ b/play/index.php
@@ -145,12 +145,12 @@ if (!$song->file OR ( !is_readable($song->file) AND $catalog->catalog_type != 'r
}
-/* Run Garbage Collection on Now Playing */
-Stream::gc_now_playing();
-
// If we are running in Legalize mode, don't play songs already playing
if (Config::get('lock_songs')) {
- if (!check_lock_songs($song->id)) { exit(); }
+ if (!check_lock_songs($song->id)) {
+ debug_event('Denied','Song ' . $song->id . ' is currently being played and lock songs is enabled','1');
+ exit();
+ }
}
/* Check to see if this is a 'remote' catalog */
diff --git a/templates/show_album_art.inc.php b/templates/show_album_art.inc.php
index 37ecca54..dc7afc47 100644
--- a/templates/show_album_art.inc.php
+++ b/templates/show_album_art.inc.php
@@ -38,7 +38,7 @@ while ($i <= $rows) {
?>
<td align="center">
<a href="<?php echo $image_url; ?>" target="_blank">
- <img src="<?php echo $image_url; ?>" alt="Album Art" height="175" width="175" /><br />
+ <img src="<?php echo $image_url; ?>" alt="Album Art" border="0" height="175" width="175" /><br />
</a>
<p align="center">
[<a href="<?php echo Config::get('web_path'); ?>/albums.php?action=select_art&amp;image=<?php echo $key; ?>&amp;album_id=<?php echo urlencode($_REQUEST['album_id']); ?>">Select</a>]
diff --git a/templates/show_artist_box.inc.php b/templates/show_artist_box.inc.php
index 48f81227..07307d8e 100644
--- a/templates/show_artist_box.inc.php
+++ b/templates/show_artist_box.inc.php
@@ -36,7 +36,6 @@ if (Config::get('ratings')) {
<?php echo Ajax::text('?action=basket&type=artist_random&id=' . $artist->id,_('Add Random Songs By') . ' ' . $artist->f_name,'play_random_artist'); ?><br />
<?php if ($GLOBALS['user']->has_access('50')) { ?>
<a href="<?php echo $web_path; ?>/artists.php?action=update_from_tags&amp;artist=<?php echo $artist->id; ?>"><?php echo _("Update from tags"); ?></a><br />
- <a href="<?php echo $web_path; ?>/artists.php?action=show_similar&amp;artist=<?php echo $artist->id; ?>"><?php echo _("Find duplicate artists"); ?></a><br />
<?php } ?>
<?php if (Plugin::is_installed('OpenStrands')) { ?>
<?php echo Ajax::text('?page=stats&action=show_recommend&type=artist&id=' . $artist->id,_('Recommend Similar'),'artist_recommend_similar'); ?>
diff --git a/templates/show_playlist.inc.php b/templates/show_playlist.inc.php
index a1855c79..1b8b899d 100644
--- a/templates/show_playlist.inc.php
+++ b/templates/show_playlist.inc.php
@@ -37,6 +37,7 @@ $web_path = Config::get('web_path');
<?php
$object_ids = $playlist->get_items();
Browse::set_type('playlist_song');
+ Browse::add_supplemental_object('playlist',$playlist->id);
Browse::save_objects($object_ids);
Browse::show_objects($object_ids);
?>