1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-03 17:59:21 +02:00

removed random space on lastfm prefs, started work on managing shout and flagged items, cleaned up shoutbox css a bit

This commit is contained in:
Karl 'vollmerk' Vollmer 2007-12-25 17:32:50 +00:00
parent 8442e4c7db
commit c56aeb1b70
14 changed files with 134 additions and 94 deletions

View file

@ -1,7 +1,7 @@
<?php <?php
/* /*
Copyright (c) 2001 - 2006 Ampache.org Copyright (c) 2001 - 2007 Ampache.org
All rights reserved. All rights reserved.
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
@ -19,24 +19,16 @@
*/ */
/** require '../lib/init.php';
* Flag Admin Document
* This document handles the administrative aspects of
* flagging.
*/
require('../lib/init.php'); if (!Access::check('interface','100')) {
if (!$GLOBALS['user']->has_access('100')) {
access_denied(); access_denied();
exit(); exit();
} }
show_template('header'); show_header();
$action = scrub_in($_REQUEST['action']); switch ($_REQUEST['action']) {
switch ($action) {
case 'edit_song': case 'edit_song':
$catalog = new Catalog(); $catalog = new Catalog();
$song = new Song($_REQUEST['song_id']); $song = new Song($_REQUEST['song_id']);
@ -299,14 +291,12 @@ switch ($action) {
} // end else } // end else
show_confirmation(_('Songs Enabled'),_('The requested song(s) have been enabled'),return_referer()); show_confirmation(_('Songs Enabled'),_('The requested song(s) have been enabled'),return_referer());
break; 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: default:
case 'show_flagged':
$flagged = Flag::get_all();
Browse::set_type('flagged');
Browse::save_objects($flagged);
Browse::show_objects($flagged);
break; break;
} // end switch } // end switch

View file

@ -4,6 +4,7 @@
-------------------------------------------------------------------------- --------------------------------------------------------------------------
v.3.4-Beta2 v.3.4-Beta2
- Removed extra space on default Last.FM username/password
- Fixed LastFM plugin username and password checking to not even try - Fixed LastFM plugin username and password checking to not even try
if there is no username or password if there is no username or password

View file

@ -139,6 +139,7 @@ class Browse {
case 'playlist': case 'playlist':
case 'playlist_song': case 'playlist_song':
case 'song': case 'song':
case 'flagged':
case 'catalog': case 'catalog':
case 'album': case 'album':
case 'artist': case 'artist':
@ -346,6 +347,9 @@ class Browse {
case 'playlist': case 'playlist':
$sql = "SELECT `playlist`.`id` FROM `playlist` "; $sql = "SELECT `playlist`.`id` FROM `playlist` ";
break; break;
case 'flagged':
$sql = "SELECT `flagged`.`id` FROM `flagged` ";
break;
case 'playlist_song': case 'playlist_song':
case 'song': case 'song':
default: default:
@ -662,6 +666,11 @@ class Browse {
require_once Config::get('prefix') . '/templates/show_catalogs.inc.php'; require_once Config::get('prefix') . '/templates/show_catalogs.inc.php';
show_box_bottom(); show_box_bottom();
break; break;
case 'flagged':
show_box_top(_('Flagged Records'),$class);
require_once Config::get('prefix') . '/templates/show_flagged.inc.php';
show_box_bottom();
break;
default: default:
// Rien a faire // Rien a faire
break; break;

View file

@ -27,24 +27,24 @@
class Flag { class Flag {
/* DB based variables */ /* DB based variables */
var $id; public $id;
var $user; public $user;
var $object_id; public $object_id;
var $object_type; public $object_type;
var $comment; public $comment;
var $flag; public $flag;
var $date; public $date;
var $approved=0; public $approved=0;
/* Generated Values */ /* Generated Values */
var $name; // Blank public $name; // Blank
var $title; // Blank public $title; // Blank
/** /**
* Constructor * Constructor
* This takes a flagged.id and then pulls in the information for said flag entry * 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); $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 * This returns an array of ids of flagged songs if no limit is passed
* it gets everything * it gets everything
*/ */
function get_flagged($count=0) { public static function get_all($count=0) {
if ($count) { $limit_clause = "LIMIT " . intval($count); } if ($count) { $limit_clause = "LIMIT " . intval($count); }
$sql = "SELECT id FROM flagged ORDER BY id $limit_clause"; $sql = "SELECT `id` FROM `flagged` $limit_clause";
$db_results = mysql_query($sql, dbh()); $db_results = Dba::query($sql);
/* Default it to an array */ /* Default it to an array */
$results = array(); $results = array();
/* While the query */ /* While the query */
while ($r = mysql_fetch_assoc($db_results)) { while ($row = Dba::fetch_assoc($db_results)) {
$results[] = $r['id']; $results[] = $row['id'];
} }
return $results; return $results;
} // get_flagged } // get_all
/** /**
* get_approved * get_approved

View file

@ -132,14 +132,14 @@ class shoutBox {
switch ($this->object_type) { switch ($this->object_type) {
case 'album': case 'album':
$image_string = "<img height=\"75\" width=\"75\" src=\"" . Config::get('web_path') . "/image.php?id=" . $this->object_id . "&amp;thumb=1\" />"; $image_string = "<img class=\"shoutboximage\" height=\"75\" width=\"75\" src=\"" . Config::get('web_path') . "/image.php?id=" . $this->object_id . "&amp;thumb=1\" />";
break; break;
case 'artist': case 'artist':
break; break;
case 'song': case 'song':
$song = new Song($this->object_id); $song = new Song($this->object_id);
$image_string = "<img height=\"75\" width=\"75\" src=\"" . Config::get('web_path') . "/image.php?id=" . $song->album . "&amp;thumb=1\" />"; $image_string = "<img class=\"shoutboximage\" height=\"75\" width=\"75\" src=\"" . Config::get('web_path') . "/image.php?id=" . $song->album . "&amp;thumb=1\" />";
break; break;
default: default:
// Rien a faire // Rien a faire

View file

@ -58,8 +58,7 @@ function reload_util(target) {
document.getElementById('util_iframe').contentWindow.location.reload(true); document.getElementById('util_iframe').contentWindow.location.reload(true);
} }
else if (navigator.appName == 'Konqueror') { else if (navigator.appName == 'Konqueror') {
alert(document.getElementById('util_iframe').location.url); document.getElementById('util_iframe').contentDocument.location.reload(true);
document.getElementById('util_iframe').location.url = document.getElementById('util_iframe').location.url
} }
else { else {
document.getElementById('util_iframe').src = document.getElementById('util_iframe').src; document.getElementById('util_iframe').src = document.getElementById('util_iframe').src;

View file

@ -54,12 +54,12 @@ class AmpacheLastfm {
*/ */
public function install() { public function install() {
Preference::insert('lastfm_user','Last.FM Username',' ','25','string','plugins'); Preference::insert('lastfm_user','Last.FM Username','','25','string','plugins');
Preference::insert('lastfm_pass','Last.FM Password',' ','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_port','Last.FM Submit Port','','25','string','internal');
Preference::insert('lastfm_host','Last.FM Submit Host',' ','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_url','Last.FM Submit URL','','25','string','internal');
Preference::insert('lastfm_challenge','Last.FM Submit Challenge',' ','25','string','internal'); Preference::insert('lastfm_challenge','Last.FM Submit Challenge','','25','string','internal');
} // install } // install
@ -172,15 +172,15 @@ class AmpacheLastfm {
*/ */
public function load($data,$user_id) { public function load($data,$user_id) {
if (strlen($data['lastfm_user'])) { if (strlen(trim($data['lastfm_user']))) {
$this->username = $data['lastfm_user']; $this->username = trim($data['lastfm_user']);
} }
else { else {
debug_event('LastFM','No Username, not scrobbling','3'); debug_event('LastFM','No Username, not scrobbling','3');
return false; return false;
} }
if (strlen($data['lastfm_pass'])) { if (strlen(trim($data['lastfm_pass']))) {
$this->password = $data['lastfm_pass']; $this->password = trim($data['lastfm_pass']);
} }
else { else {
debug_event('LastFM','No Password, not scrobbling','3'); debug_event('LastFM','No Password, not scrobbling','3');

View file

@ -32,7 +32,7 @@ switch ($_REQUEST['action']) {
} }
$shout_id = shoutBox::create($_POST); $shout_id = shoutBox::create($_POST);
header("Location:" . Config::get('web_path'));
break; break;
case 'show_add_shout': case 'show_add_shout':
// Get our object first // 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 // 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'; require_once Config::get('prefix') . '/templates/show_add_shout.inc.php';
break;
case 'show_manage':
break; break;
default: default:

View file

@ -24,7 +24,6 @@ $web_path = Config::get('web_path');
<form id="songs" method="post" enctype="multipart/form-data" action="<?php echo Config::get('web_path'); ?>/admin/flag.php?action=reject_flags"> <form id="songs" method="post" enctype="multipart/form-data" action="<?php echo Config::get('web_path'); ?>/admin/flag.php?action=reject_flags">
<table class="tabledata" cellpadding="0" cellspacing="0"> <table class="tabledata" cellpadding="0" cellspacing="0">
<colgroup> <colgroup>
<col id="col_select" />
<col id="col_object" /> <col id="col_object" />
<col id="col_username" /> <col id="col_username" />
<col id="col_flag" /> <col id="col_flag" />
@ -33,7 +32,6 @@ $web_path = Config::get('web_path');
<col id="col_action" /> <col id="col_action" />
</colgroup> </colgroup>
<tr class="th-top"> <tr class="th-top">
<th class="cel_select"><a href="#" onclick="check_select('song'); return false;"><?php echo _('Select'); ?></a></th>
<th class="cel_object"><?php echo _('Object'); ?></th> <th class="cel_object"><?php echo _('Object'); ?></th>
<th class="cel_username"><?php echo _('User'); ?></th> <th class="cel_username"><?php echo _('User'); ?></th>
<th class="cel_flag"><?php echo _('Flag'); ?></th> <th class="cel_flag"><?php echo _('Flag'); ?></th>
@ -43,9 +41,6 @@ $web_path = Config::get('web_path');
</tr> </tr>
<?php foreach ($flagged as $data) { $flag = new Flag($data); ?> <?php foreach ($flagged as $data) { $flag = new Flag($data); ?>
<tr class="<?php echo flip_class(); ?>"> <tr class="<?php echo flip_class(); ?>">
<td class="cel_select">
<input type="checkbox" name="song[]" value="<?php echo $flag->id; ?>" id="song_<?php echo $flag->id; ?>" />
</td>
<td class="cel_object"><a href="<?php echo Config::get('web_path'); ?>/admin/flag.php?action=show_edit_song&song=<?php echo $flag->object_id; ?>"><?php $flag->print_name(); ?></a></td> <td class="cel_object"><a href="<?php echo Config::get('web_path'); ?>/admin/flag.php?action=show_edit_song&song=<?php echo $flag->object_id; ?>"><?php $flag->print_name(); ?></a></td>
<td class="cel_username"><?php echo scrub_out($flag->f_user_username); ?></td> <td class="cel_username"><?php echo scrub_out($flag->f_user_username); ?></td>
<td class="cel_flag"><?php $flag->print_flag(); ?></td> <td class="cel_flag"><?php $flag->print_flag(); ?></td>
@ -69,7 +64,6 @@ $web_path = Config::get('web_path');
</tr> </tr>
<?php } ?> <?php } ?>
<tr class="th-bottom"> <tr class="th-bottom">
<th class="cel_select"><a href="#" onclick="check_select('song'); return false;"><?php echo _('Select'); ?></a></th>
<th class="cel_object"><?php echo _('Object'); ?></th> <th class="cel_object"><?php echo _('Object'); ?></th>
<th class="cel_username"><?php echo _('User'); ?></th> <th class="cel_username"><?php echo _('User'); ?></th>
<th class="cel_flag"><?php echo _('Flag'); ?></th> <th class="cel_flag"><?php echo _('Flag'); ?></th>
@ -78,16 +72,4 @@ $web_path = Config::get('web_path');
<th class="cel_action"><?php echo _('Action'); ?></th> <th class="cel_action"><?php echo _('Action'); ?></th>
</tr> </tr>
</table> </table>
<div class="formValidation">
<select name="update_action">
<option value="reject"><?php echo _('Reject'); ?></option>
<option value="approve"><?php echo _('Approve'); ?></option>
</select>
<input class="button" type="submit" value="<?php echo _('Update'); ?>" />
</div>
</form> </form>
<div>
<a class="button" href="<?php echo $web_path; ?>/admin/flag.php?action=show_flagged">
<?php echo _('Show All'); ?>...
</a>
</div>

View file

@ -28,17 +28,6 @@ if (isset($_REQUEST['xspf']) && isset ($_REQUEST['play_info'])){
<div id="now_playing"> <div id="now_playing">
<?php show_now_playing(); ?> <?php show_now_playing(); ?>
</div> <!-- Close Now Playing Div --> </div> <!-- Close Now Playing Div -->
<!-- Sticky Objects, if sticky is enabled -->
<?php if (Config::get('shoutbox')) { ?>
<div id="shout_objects">
<?php
$shouts = shoutBox::get_top('5');
if (count($shouts)) {
require_once Config::get('prefix') . '/templates/show_shoutbox.inc.php';
}
?>
</div>
<?php } ?>
<!-- Randomly selected albums of the moment --> <!-- Randomly selected albums of the moment -->
<div id="random_selection"> <div id="random_selection">
<?php <?php
@ -55,3 +44,15 @@ if (isset($_REQUEST['xspf']) && isset ($_REQUEST['play_info'])){
show_box_bottom(); show_box_bottom();
?> ?>
</div> </div>
<!-- Shoutbox Objects, if shoutbox is enabled -->
<?php if (Config::get('shoutbox')) { ?>
<div id="shout_objects">
<?php
$shouts = shoutBox::get_top('5');
if (count($shouts)) {
require_once Config::get('prefix') . '/templates/show_shoutbox.inc.php';
}
?>
</div>
<?php } ?>

View file

@ -20,7 +20,7 @@
*/ */
?> ?>
<?php show_box_top(_('Shoutbox')); ?> <?php show_box_top(_('Shoutbox')); ?>
<table class="tabledata" cellpadding="0" cellspacing="0"> <div id="shoutbox">
<?php foreach ($shouts as $shout_id) { <?php foreach ($shouts as $shout_id) {
$shout = new shoutBox($shout_id); $shout = new shoutBox($shout_id);
$object = shoutBox::get_object($shout->object_type,$shout->object_id); $object = shoutBox::get_object($shout->object_type,$shout->object_id);
@ -28,17 +28,12 @@
$client = new User($shout->user); $client = new User($shout->user);
$client->format(); $client->format();
?> ?>
<tr> <div class="shout">
<td class="cel_image">
<?php echo $shout->get_image(); ?><br />
<strong><?php echo ucfirst($shout->object_type); ?>:</strong> <?php echo $object->f_link; ?><br /> <strong><?php echo ucfirst($shout->object_type); ?>:</strong> <?php echo $object->f_link; ?><br />
</td> <?php echo $shout->get_image(); ?><br />
<td valign="top" class="cel_comment"> <?php echo scrub_out($shout->text); ?><br />
<?php echo scrub_out($shout->text); ?> <span class="information"><?php echo $client->f_link; ?> <?php echo date("d/m H:i",$shout->date); ?></span>
<br /> </div>
<span class="information">- <?php echo $client->f_link; ?> <?php echo date("d/m/Y H:i",$shout->date); ?></span>
</td>
</tr>
<?php } ?> <?php } ?>
</table> </div>
<?php show_box_bottom(); ?> <?php show_box_bottom(); ?>

View file

@ -23,7 +23,11 @@
<li id="sb_admin_ot_Duplicates"><a href="<?php echo $web_path; ?>/admin/duplicates.php"><?php echo _('Find Duplicates'); ?></a></li> <li id="sb_admin_ot_Duplicates"><a href="<?php echo $web_path; ?>/admin/duplicates.php"><?php echo _('Find Duplicates'); ?></a></li>
<li id="sb_admin_ot_Mail"><a href="<?php echo $web_path; ?>/admin/mail.php"><?php echo _('Mail Users'); ?></a></li> <li id="sb_admin_ot_Mail"><a href="<?php echo $web_path; ?>/admin/mail.php"><?php echo _('Mail Users'); ?></a></li>
<li id="sb_admin_ot_ClearNowPlaying"><a href="<?php echo $web_path; ?>/admin/catalog.php?action=clear_now_playing"><?php echo _('Clear Now Playing'); ?></a></li> <li id="sb_admin_ot_ClearNowPlaying"><a href="<?php echo $web_path; ?>/admin/catalog.php?action=clear_now_playing"><?php echo _('Clear Now Playing'); ?></a></li>
<li id="sb_admin_ot_ClearCatStats"><a href="<?php echo $web_path; ?>/admin/catalog.php?action=clear_stats"><?php echo _('Clear Catalog Stats'); ?></a></li> <li id="sb_admin_ot_ClearCatStats"><a href="<?php echo $web_path; ?>/admin/catalog.php?action=clear_stats"><?php echo _('Clear Stats'); ?></a></li>
<li id="sb_admin_ot_ManageFlagged"><a href="<?php echo $web_path; ?>/admin/flag.php"><?php echo _('Manage Flagged'); ?></a></li>
<?php if (Config::get('shoutbox')) { ?>
<li id="sb_admin_ot_ManageShoutbox"><a href="<?php echo $web_path; ?>/admin/shout.php?action=show_manage"><?php echo _('Manage Shoutbox'); ?></a></li>
<?php } ?>
</ul> </ul>
</li> </li>

View file

@ -582,6 +582,29 @@ a.button{padding:1px 3px;}
font-size:0.8em; 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 */ /* List Header */
/************************************************/ /************************************************/

View file

@ -638,6 +638,28 @@ background:#000;
float:left; 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 */ /* List Header */
@ -706,6 +728,11 @@ background:#000;
margin:10px; margin:10px;
} }
#motd {
margin:0 auto 0 auto;
width: 437px;
}
/************************************************/ /************************************************/
/* Misc */ /* Misc */
@ -735,3 +762,9 @@ background:#000;
display: none; display: none;
} }
.information,.information a {
font-size: 0.9em;
font-style: italic;
color: #c0c0c0;
}