From c56aeb1b7003ed10da98a8bbc8305a5cb90357a6 Mon Sep 17 00:00:00 2001 From: Karl 'vollmerk' Vollmer Date: Tue, 25 Dec 2007 17:32:50 +0000 Subject: removed random space on lastfm prefs, started work on managing shout and flagged items, cleaned up shoutbox css a bit --- admin/flag.php | 30 ++++++++++-------------------- docs/CHANGELOG | 1 + lib/class/browse.class.php | 9 +++++++++ lib/class/flag.class.php | 34 +++++++++++++++++----------------- lib/class/shoutbox.class.php | 4 ++-- lib/javascript-base.js | 3 +-- modules/plugins/Lastfm.plugin.php | 20 ++++++++++---------- shout.php | 5 ++++- templates/show_flagged.inc.php | 18 ------------------ templates/show_index.inc.php | 23 ++++++++++++----------- templates/show_shoutbox.inc.php | 19 +++++++------------ templates/sidebar_admin.inc.php | 6 +++++- themes/classic/templates/default.css | 23 +++++++++++++++++++++++ themes/greysme/templates/default.css | 33 +++++++++++++++++++++++++++++++++ 14 files changed, 134 insertions(+), 94 deletions(-) diff --git a/admin/flag.php b/admin/flag.php index fc496615..e281dd6e 100644 --- a/admin/flag.php +++ b/admin/flag.php @@ -1,7 +1,7 @@ has_access('100')) { +if (!Access::check('interface','100')) { access_denied(); exit(); } -show_template('header'); - -$action = scrub_in($_REQUEST['action']); +show_header(); -switch ($action) { +switch ($_REQUEST['action']) { case 'edit_song': $catalog = new Catalog(); $song = new Song($_REQUEST['song_id']); @@ -299,14 +291,12 @@ switch ($action) { } // end else show_confirmation(_('Songs Enabled'),_('The requested song(s) have been enabled'),return_referer()); break; - case 'show_flagged': - $flag = new Flag(); - $flagged = $flag->get_flagged(); - show_box_top(_('Flagged Records')); - require (conf('prefix') . '/templates/show_flagged.inc.php'); - show_box_bottom(); - break; default: + case 'show_flagged': + $flagged = Flag::get_all(); + Browse::set_type('flagged'); + Browse::save_objects($flagged); + Browse::show_objects($flagged); break; } // end switch diff --git a/docs/CHANGELOG b/docs/CHANGELOG index f4b9fb9f..e5b36598 100755 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -4,6 +4,7 @@ -------------------------------------------------------------------------- v.3.4-Beta2 + - Removed extra space on default Last.FM username/password - Fixed LastFM plugin username and password checking to not even try if there is no username or password diff --git a/lib/class/browse.class.php b/lib/class/browse.class.php index caaf79b5..2e65a783 100644 --- a/lib/class/browse.class.php +++ b/lib/class/browse.class.php @@ -139,6 +139,7 @@ class Browse { case 'playlist': case 'playlist_song': case 'song': + case 'flagged': case 'catalog': case 'album': case 'artist': @@ -346,6 +347,9 @@ class Browse { case 'playlist': $sql = "SELECT `playlist`.`id` FROM `playlist` "; break; + case 'flagged': + $sql = "SELECT `flagged`.`id` FROM `flagged` "; + break; case 'playlist_song': case 'song': default: @@ -662,6 +666,11 @@ class Browse { require_once Config::get('prefix') . '/templates/show_catalogs.inc.php'; show_box_bottom(); break; + case 'flagged': + show_box_top(_('Flagged Records'),$class); + require_once Config::get('prefix') . '/templates/show_flagged.inc.php'; + show_box_bottom(); + break; default: // Rien a faire break; diff --git a/lib/class/flag.class.php b/lib/class/flag.class.php index ed833c1b..56256a39 100644 --- a/lib/class/flag.class.php +++ b/lib/class/flag.class.php @@ -27,24 +27,24 @@ class Flag { /* DB based variables */ - var $id; - var $user; - var $object_id; - var $object_type; - var $comment; - var $flag; - var $date; - var $approved=0; + public $id; + public $user; + public $object_id; + public $object_type; + public $comment; + public $flag; + public $date; + public $approved=0; /* Generated Values */ - var $name; // Blank - var $title; // Blank + public $name; // Blank + public $title; // Blank /** * Constructor * This takes a flagged.id and then pulls in the information for said flag entry */ - function Flag($flag_id=0) { + public function __construct($flag_id=0) { $this->id = intval($flag_id); @@ -125,24 +125,24 @@ class Flag { * This returns an array of ids of flagged songs if no limit is passed * it gets everything */ - function get_flagged($count=0) { + public static function get_all($count=0) { if ($count) { $limit_clause = "LIMIT " . intval($count); } - $sql = "SELECT id FROM flagged ORDER BY id $limit_clause"; - $db_results = mysql_query($sql, dbh()); + $sql = "SELECT `id` FROM `flagged` $limit_clause"; + $db_results = Dba::query($sql); /* Default it to an array */ $results = array(); /* While the query */ - while ($r = mysql_fetch_assoc($db_results)) { - $results[] = $r['id']; + while ($row = Dba::fetch_assoc($db_results)) { + $results[] = $row['id']; } return $results; - } // get_flagged + } // get_all /** * get_approved diff --git a/lib/class/shoutbox.class.php b/lib/class/shoutbox.class.php index 3cea772b..98d14548 100644 --- a/lib/class/shoutbox.class.php +++ b/lib/class/shoutbox.class.php @@ -132,14 +132,14 @@ class shoutBox { switch ($this->object_type) { case 'album': - $image_string = ""; + $image_string = ""; break; case 'artist': break; case 'song': $song = new Song($this->object_id); - $image_string = ""; + $image_string = ""; break; default: // Rien a faire diff --git a/lib/javascript-base.js b/lib/javascript-base.js index a51f7323..b6000238 100644 --- a/lib/javascript-base.js +++ b/lib/javascript-base.js @@ -58,8 +58,7 @@ function reload_util(target) { document.getElementById('util_iframe').contentWindow.location.reload(true); } else if (navigator.appName == 'Konqueror') { - alert(document.getElementById('util_iframe').location.url); - document.getElementById('util_iframe').location.url = document.getElementById('util_iframe').location.url + document.getElementById('util_iframe').contentDocument.location.reload(true); } else { document.getElementById('util_iframe').src = document.getElementById('util_iframe').src; diff --git a/modules/plugins/Lastfm.plugin.php b/modules/plugins/Lastfm.plugin.php index 6e4b2ab4..10f51344 100644 --- a/modules/plugins/Lastfm.plugin.php +++ b/modules/plugins/Lastfm.plugin.php @@ -54,12 +54,12 @@ class AmpacheLastfm { */ public function install() { - Preference::insert('lastfm_user','Last.FM Username',' ','25','string','plugins'); - Preference::insert('lastfm_pass','Last.FM Password',' ','25','string','plugins'); - Preference::insert('lastfm_port','Last.FM Submit Port',' ','25','string','internal'); - Preference::insert('lastfm_host','Last.FM Submit Host',' ','25','string','internal'); - Preference::insert('lastfm_url','Last.FM Submit URL',' ','25','string','internal'); - Preference::insert('lastfm_challenge','Last.FM Submit Challenge',' ','25','string','internal'); + Preference::insert('lastfm_user','Last.FM Username','','25','string','plugins'); + Preference::insert('lastfm_pass','Last.FM Password','','25','string','plugins'); + Preference::insert('lastfm_port','Last.FM Submit Port','','25','string','internal'); + Preference::insert('lastfm_host','Last.FM Submit Host','','25','string','internal'); + Preference::insert('lastfm_url','Last.FM Submit URL','','25','string','internal'); + Preference::insert('lastfm_challenge','Last.FM Submit Challenge','','25','string','internal'); } // install @@ -172,15 +172,15 @@ class AmpacheLastfm { */ public function load($data,$user_id) { - if (strlen($data['lastfm_user'])) { - $this->username = $data['lastfm_user']; + if (strlen(trim($data['lastfm_user']))) { + $this->username = trim($data['lastfm_user']); } else { debug_event('LastFM','No Username, not scrobbling','3'); return false; } - if (strlen($data['lastfm_pass'])) { - $this->password = $data['lastfm_pass']; + if (strlen(trim($data['lastfm_pass']))) { + $this->password = trim($data['lastfm_pass']); } else { debug_event('LastFM','No Password, not scrobbling','3'); diff --git a/shout.php b/shout.php index ba7ba796..a3514612 100644 --- a/shout.php +++ b/shout.php @@ -32,7 +32,7 @@ switch ($_REQUEST['action']) { } $shout_id = shoutBox::create($_POST); - + header("Location:" . Config::get('web_path')); break; case 'show_add_shout': // Get our object first @@ -40,6 +40,9 @@ switch ($_REQUEST['action']) { // Now go ahead and display the page where we let them add a comment etc require_once Config::get('prefix') . '/templates/show_add_shout.inc.php'; + break; + case 'show_manage': + break; default: diff --git a/templates/show_flagged.inc.php b/templates/show_flagged.inc.php index e8eb0b72..39c93c0e 100644 --- a/templates/show_flagged.inc.php +++ b/templates/show_flagged.inc.php @@ -24,7 +24,6 @@ $web_path = Config::get('web_path');
- @@ -33,7 +32,6 @@ $web_path = Config::get('web_path'); - @@ -43,9 +41,6 @@ $web_path = Config::get('web_path'); - @@ -69,7 +64,6 @@ $web_path = Config::get('web_path'); - @@ -78,16 +72,4 @@ $web_path = Config::get('web_path');
- - print_name(); ?> f_user_username); ?> print_flag(); ?>
-
- - -
-
- - ... - -
diff --git a/templates/show_index.inc.php b/templates/show_index.inc.php index 5dbdf08b..50637547 100644 --- a/templates/show_index.inc.php +++ b/templates/show_index.inc.php @@ -28,17 +28,6 @@ if (isset($_REQUEST['xspf']) && isset ($_REQUEST['play_info'])){
- - -
- -
-
+ + +
+ +
+ + diff --git a/templates/show_shoutbox.inc.php b/templates/show_shoutbox.inc.php index 8274f716..72da5ac1 100644 --- a/templates/show_shoutbox.inc.php +++ b/templates/show_shoutbox.inc.php @@ -20,7 +20,7 @@ */ ?> - +
object_type,$shout->object_id); @@ -28,17 +28,12 @@ $client = new User($shout->user); $client->format(); ?> -
- - - + get_image(); ?>
+ text); ?>
+ f_link; ?> date); ?> + -
- get_image(); ?>
+
object_type); ?>: f_link; ?>
-
- text); ?> -
- - f_link; ?> date); ?> -
+ diff --git a/templates/sidebar_admin.inc.php b/templates/sidebar_admin.inc.php index af1be577..843a1de3 100644 --- a/templates/sidebar_admin.inc.php +++ b/templates/sidebar_admin.inc.php @@ -23,7 +23,11 @@
  • -
  • +
  • +
  • + +
  • + diff --git a/themes/classic/templates/default.css b/themes/classic/templates/default.css index 96a67a40..52b62de1 100644 --- a/themes/classic/templates/default.css +++ b/themes/classic/templates/default.css @@ -582,6 +582,29 @@ a.button{padding:1px 3px;} font-size:0.8em; } +/************************************************/ +/* Shoutbox */ +/************************************************/ + +#shoutbox { + font-size:0.8em; +} + +#shoutbox div.shout { + float:left; + margin-right:5px; +} + +#shoutbox span.information { + float:left; + clear:left; +} + +img.shoutboximage { + float:left; + margin-right:3px; +} + /************************************************/ /* List Header */ /************************************************/ diff --git a/themes/greysme/templates/default.css b/themes/greysme/templates/default.css index e6354e70..7802e9ac 100644 --- a/themes/greysme/templates/default.css +++ b/themes/greysme/templates/default.css @@ -638,6 +638,28 @@ background:#000; float:left; } +/************************************************/ +/* Shoutbox */ +/************************************************/ + +#shoutbox { + font-size:0.8em; +} + +#shoutbox div.shout { + float:left; + margin-right:5px; +} + +#shoutbox span.information { + float:left; + clear:left; +} + +img.shoutboximage { + float:left; + margin-right:3px; +} /************************************************/ /* List Header */ @@ -706,6 +728,11 @@ background:#000; margin:10px; } +#motd { + margin:0 auto 0 auto; + width: 437px; +} + /************************************************/ /* Misc */ @@ -735,3 +762,9 @@ background:#000; display: none; } +.information,.information a { + font-size: 0.9em; + font-style: italic; + color: #c0c0c0; +} + -- cgit