mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-03 09:49:30 +02:00
Add Label entity
This commit is contained in:
parent
3016b8f138
commit
0a1b46f437
23 changed files with 1194 additions and 5 deletions
|
@ -55,6 +55,7 @@ switch ($_REQUEST['action']) {
|
||||||
case 'movie':
|
case 'movie':
|
||||||
case 'clip':
|
case 'clip':
|
||||||
case 'personal_video':
|
case 'personal_video':
|
||||||
|
case 'label':
|
||||||
$browse->set_type($_REQUEST['action']);
|
$browse->set_type($_REQUEST['action']);
|
||||||
$browse->set_simple_browse(true);
|
$browse->set_simple_browse(true);
|
||||||
break;
|
break;
|
||||||
|
@ -181,6 +182,14 @@ switch ($_REQUEST['action']) {
|
||||||
$browse->update_browse_from_session();
|
$browse->update_browse_from_session();
|
||||||
$browse->show_objects();
|
$browse->show_objects();
|
||||||
break;
|
break;
|
||||||
|
case 'label':
|
||||||
|
if (AmpConfig::get('catalog_disable')) {
|
||||||
|
$browse->set_filter('catalog_enabled', '1');
|
||||||
|
}
|
||||||
|
$browse->set_sort('name','ASC');
|
||||||
|
$browse->update_browse_from_session();
|
||||||
|
$browse->show_objects();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
; if this config file is up to date
|
; if this config file is up to date
|
||||||
; this is compared against a value hard-coded
|
; this is compared against a value hard-coded
|
||||||
; into the init script
|
; into the init script
|
||||||
config_version = 27
|
config_version = 28
|
||||||
|
|
||||||
;###################
|
;###################
|
||||||
; Path Vars #
|
; Path Vars #
|
||||||
|
@ -493,6 +493,11 @@ wanted_types = "album,official"
|
||||||
; EchoNest provides several music services. Currently used for missing song 30 seconds preview.
|
; EchoNest provides several music services. Currently used for missing song 30 seconds preview.
|
||||||
;echonest_api_key = ""
|
;echonest_api_key = ""
|
||||||
|
|
||||||
|
; Labels
|
||||||
|
; Use labels to browse artists per label membership.
|
||||||
|
; DEFAULT: false
|
||||||
|
;label = "false"
|
||||||
|
|
||||||
; Broadcasts
|
; Broadcasts
|
||||||
; Allow users to broadcast music.
|
; Allow users to broadcast music.
|
||||||
; This feature requires advanced server configuration, please take a look on the wiki for more information.
|
; This feature requires advanced server configuration, please take a look on the wiki for more information.
|
||||||
|
|
83
labels.php
Normal file
83
labels.php
Normal file
|
@ -0,0 +1,83 @@
|
||||||
|
<?php
|
||||||
|
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||||
|
* Copyright 2001 - 2015 Ampache.org
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once 'lib/init.php';
|
||||||
|
|
||||||
|
UI::show_header();
|
||||||
|
|
||||||
|
// Switch on the incomming action
|
||||||
|
switch ($_REQUEST['action']) {
|
||||||
|
case 'add_label':
|
||||||
|
// Must be at least a content manager or edit upload enabled
|
||||||
|
if (!Access::check('interface','50') && !AmpConfig::get('upload_allow_edit')) {
|
||||||
|
UI::access_denied();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Core::form_verify('add_label','post')) {
|
||||||
|
UI::access_denied();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove unauthorized defined values from here
|
||||||
|
if (isset($_POST['user'])) {
|
||||||
|
unset($_POST['user']);
|
||||||
|
}
|
||||||
|
if (isset($_POST['creation_date'])) {
|
||||||
|
unset($_POST['creation_date']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$label_id = Label::create($_POST);
|
||||||
|
if (!$label_id) {
|
||||||
|
require_once AmpConfig::get('prefix') . '/templates/show_add_label.inc.php';
|
||||||
|
} else {
|
||||||
|
$body = T_('Label Added');
|
||||||
|
$title = '';
|
||||||
|
show_confirmation($title, $body, AmpConfig::get('web_path') . '/browse.php?action=label');
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'show':
|
||||||
|
$label_id = intval($_REQUEST['label']);
|
||||||
|
if (!$label_id) {
|
||||||
|
if (!empty($_REQUEST['name'])) {
|
||||||
|
$label_id = Label::lookup($_REQUEST);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($label_id > 0) {
|
||||||
|
$label = new Label($label_id);
|
||||||
|
$label->format();
|
||||||
|
$object_ids = $label->get_artists();
|
||||||
|
$object_type = 'artist';
|
||||||
|
require_once AmpConfig::get('prefix') . '/templates/show_label.inc.php';
|
||||||
|
UI::show_footer();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
case 'show_add_label':
|
||||||
|
if (Access::check('interface','50') || AmpConfig::get('upload_allow_edit')) {
|
||||||
|
require_once AmpConfig::get('prefix') . '/templates/show_add_label.inc.php';
|
||||||
|
} else {
|
||||||
|
echo T_('Label cannot be found.');
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
} // end switch
|
||||||
|
|
||||||
|
UI::show_footer();
|
|
@ -85,6 +85,14 @@ class Artist extends database_object implements library_item
|
||||||
* @var string $f_tags
|
* @var string $f_tags
|
||||||
*/
|
*/
|
||||||
public $f_tags;
|
public $f_tags;
|
||||||
|
/**
|
||||||
|
* @var array $labels
|
||||||
|
*/
|
||||||
|
public $labels;
|
||||||
|
/**
|
||||||
|
* @var string $f_labels
|
||||||
|
*/
|
||||||
|
public $f_labels;
|
||||||
/**
|
/**
|
||||||
* @var int $object_cnt
|
* @var int $object_cnt
|
||||||
*/
|
*/
|
||||||
|
@ -331,7 +339,7 @@ class Artist extends database_object implements library_item
|
||||||
if (AmpConfig::get('catalog_disable')) {
|
if (AmpConfig::get('catalog_disable')) {
|
||||||
$sql .= "AND `catalog`.`enabled` = '1' ";
|
$sql .= "AND `catalog`.`enabled` = '1' ";
|
||||||
}
|
}
|
||||||
$sql .= "ORDER BY album, track";
|
$sql .= "ORDER BY `song`.`album`, `song`.`track`";
|
||||||
$db_results = Dba::read($sql, array($this->id));
|
$db_results = Dba::read($sql, array($this->id));
|
||||||
|
|
||||||
$results = array();
|
$results = array();
|
||||||
|
@ -454,6 +462,11 @@ class Artist extends database_object implements library_item
|
||||||
$this->tags = Tag::get_top_tags('artist', $this->id);
|
$this->tags = Tag::get_top_tags('artist', $this->id);
|
||||||
$this->f_tags = Tag::get_display($this->tags, true, 'artist');
|
$this->f_tags = Tag::get_display($this->tags, true, 'artist');
|
||||||
|
|
||||||
|
if (AmpConfig::get('label')) {
|
||||||
|
$this->labels = Label::get_labels($this->id);
|
||||||
|
$this->f_labels = Label::get_display($this->labels, true);
|
||||||
|
}
|
||||||
|
|
||||||
$this->object_cnt = $extra_info['object_cnt'];
|
$this->object_cnt = $extra_info['object_cnt'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -789,6 +802,10 @@ class Artist extends database_object implements library_item
|
||||||
$this->update_tags($data['edit_tags'], $override_childs, $add_to_childs, $current_id, true);
|
$this->update_tags($data['edit_tags'], $override_childs, $add_to_childs, $current_id, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (AmpConfig::get('label') && isset($data['edit_labels'])) {
|
||||||
|
Label::update_label_list($data['edit_labels'], $this->id, true);
|
||||||
|
}
|
||||||
|
|
||||||
return $current_id;
|
return $current_id;
|
||||||
|
|
||||||
} // update
|
} // update
|
||||||
|
|
|
@ -326,6 +326,10 @@ class Browse extends Query
|
||||||
$video_type = $type;
|
$video_type = $type;
|
||||||
$box_req = AmpConfig::get('prefix') . '/templates/show_videos.inc.php';
|
$box_req = AmpConfig::get('prefix') . '/templates/show_videos.inc.php';
|
||||||
break;
|
break;
|
||||||
|
case 'label':
|
||||||
|
$box_title = T_('Labels');
|
||||||
|
$box_req = AmpConfig::get('prefix') . '/templates/show_labels.inc.php';
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
// Rien a faire
|
// Rien a faire
|
||||||
break;
|
break;
|
||||||
|
|
475
lib/class/label.class.php
Normal file
475
lib/class/label.class.php
Normal file
|
@ -0,0 +1,475 @@
|
||||||
|
<?php
|
||||||
|
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||||
|
* Copyright 2001 - 2015 Ampache.org
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Label class
|
||||||
|
*
|
||||||
|
* This is the class responsible for handling the Label object
|
||||||
|
* it is related to the label table in the database.
|
||||||
|
*/
|
||||||
|
class Label extends database_object implements library_item
|
||||||
|
{
|
||||||
|
/* Variables from DB */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int $id
|
||||||
|
*/
|
||||||
|
public $id;
|
||||||
|
/**
|
||||||
|
* @var string $name
|
||||||
|
*/
|
||||||
|
public $name;
|
||||||
|
/**
|
||||||
|
* @var string $category
|
||||||
|
*/
|
||||||
|
public $category;
|
||||||
|
/**
|
||||||
|
* @var string $address
|
||||||
|
*/
|
||||||
|
public $address;
|
||||||
|
/**
|
||||||
|
* @var string $email
|
||||||
|
*/
|
||||||
|
public $email;
|
||||||
|
/**
|
||||||
|
* @var string $website
|
||||||
|
*/
|
||||||
|
public $website;
|
||||||
|
/**
|
||||||
|
* @var string $summary
|
||||||
|
*/
|
||||||
|
public $summary;
|
||||||
|
/**
|
||||||
|
* @var int $user
|
||||||
|
*/
|
||||||
|
public $user;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $f_name
|
||||||
|
*/
|
||||||
|
public $f_name;
|
||||||
|
/**
|
||||||
|
* @var string $link
|
||||||
|
*/
|
||||||
|
public $link;
|
||||||
|
/**
|
||||||
|
* @var string $f_link
|
||||||
|
*/
|
||||||
|
public $f_link;
|
||||||
|
/**
|
||||||
|
* @var int $artists
|
||||||
|
*/
|
||||||
|
public $artists;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* __construct
|
||||||
|
*/
|
||||||
|
public function __construct($id=null)
|
||||||
|
{
|
||||||
|
if (!$id) { return false; }
|
||||||
|
|
||||||
|
$info = $this->get_info($id);
|
||||||
|
foreach ($info as $key=>$value) {
|
||||||
|
$this->$key = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function display_art($thumb)
|
||||||
|
{
|
||||||
|
if (Art::has_db($this->id, 'label')) {
|
||||||
|
Art::display('label', $this->id, $this->get_fullname(), $thumb, $this->link);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function format($details = true)
|
||||||
|
{
|
||||||
|
$this->f_name = scrub_out($this->name);
|
||||||
|
$this->link = AmpConfig::get('web_path') . '/labels.php?action=show&label=' . scrub_out($this->id);
|
||||||
|
$this->f_link = "<a href=\"" . $this->link . "\" title=\"" . $this->f_name . "\">" . $this->f_name;
|
||||||
|
$this->artists = count($this->get_artists());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get_catalogs()
|
||||||
|
{
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get_childrens()
|
||||||
|
{
|
||||||
|
$medias = array();
|
||||||
|
$artists = $this->get_artists();
|
||||||
|
foreach ($artists as $artist_id) {
|
||||||
|
$medias[] = array(
|
||||||
|
'object_type' => 'artist',
|
||||||
|
'object_id' => $album_id
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return array('artist' => $medias);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get_default_art_kind()
|
||||||
|
{
|
||||||
|
return 'default';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get_description()
|
||||||
|
{
|
||||||
|
return $this->summary;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get_fullname()
|
||||||
|
{
|
||||||
|
return $this->f_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get_keywords()
|
||||||
|
{
|
||||||
|
$keywords = array();
|
||||||
|
$keywords['label'] = array('important' => true,
|
||||||
|
'label' => T_('Label'),
|
||||||
|
'value' => $this->f_name);
|
||||||
|
return $keywords;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get_medias($filter_type = null)
|
||||||
|
{
|
||||||
|
$medias = array();
|
||||||
|
if (!$filter_type || $filter_type == 'song') {
|
||||||
|
$songs = $this->get_songs();
|
||||||
|
foreach ($songs as $song_id) {
|
||||||
|
$medias[] = array(
|
||||||
|
'object_type' => 'song',
|
||||||
|
'object_id' => $song_id
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $medias;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get_parent()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get_user_owner()
|
||||||
|
{
|
||||||
|
return $this->user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function search_childrens($name)
|
||||||
|
{
|
||||||
|
$search['type'] = "artist";
|
||||||
|
$search['rule_0_input'] = $name;
|
||||||
|
$search['rule_0_operator'] = 4;
|
||||||
|
$search['rule_0'] = "title";
|
||||||
|
$artists = Search::run($search);
|
||||||
|
|
||||||
|
$childrens = array();
|
||||||
|
foreach ($artists as $artist) {
|
||||||
|
$childrens[] = array(
|
||||||
|
'object_type' => 'artist',
|
||||||
|
'object_id' => $artist
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return $childrens;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function can_edit($user = null)
|
||||||
|
{
|
||||||
|
if (!$user) {
|
||||||
|
$user = $GLOBALS['user']->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$user)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (AmpConfig::get('upload_allow_edit')) {
|
||||||
|
if ($this->user !== null && $user == $this->user)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Access::check('interface', 50, $user);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(array $data)
|
||||||
|
{
|
||||||
|
if (self::lookup($data, $this->id) !== 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$name = isset($data['name']) ? $data['name'] : $this->name;
|
||||||
|
$category = isset($data['category']) ? $data['category'] : $this->category;
|
||||||
|
$summary = isset($data['summary']) ? $data['summary'] : $this->summary;
|
||||||
|
$address = isset($data['address']) ? $data['address'] : $this->address;
|
||||||
|
$email = isset($data['email']) ? $data['email'] : $this->email;
|
||||||
|
$website = isset($data['website']) ? $data['website'] : $this->website;
|
||||||
|
|
||||||
|
$sql = "UPDATE `label` SET `name` = ?, `category` = ?, `summary` = ?, `address` = ?, `email` = ?, `website` = ? WHERE `id` = ?";
|
||||||
|
Dba::write($sql, array($name, $category, $summary, $address, $email, $website, $this->id));
|
||||||
|
|
||||||
|
$this->name = $name;
|
||||||
|
$this->category = $category;
|
||||||
|
$this->summary = $summary;
|
||||||
|
$this->address = $address;
|
||||||
|
$this->email = $email;
|
||||||
|
$this->website = $website;
|
||||||
|
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function create(array $data)
|
||||||
|
{
|
||||||
|
if (self::lookup($data) !== 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$name = $data['name'];
|
||||||
|
$category = $data['category'];
|
||||||
|
$summary = $data['summary'];
|
||||||
|
$address = $data['address'];
|
||||||
|
$email = $data['email'];
|
||||||
|
$website = $data['website'];
|
||||||
|
$user = $data['user'] ?: $GLOBALS['user']->id;
|
||||||
|
$creation_date = $data['creation_date'] ?: time();
|
||||||
|
|
||||||
|
$sql = "INSERT INTO `label` (`name`, `category`, `summary`, `address`, `email`, `website`, `user`, `creation_date`) " .
|
||||||
|
"VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
|
||||||
|
Dba::write($sql, array($name, $category, $summary, $address, $email, $website, $user, $creation_date));
|
||||||
|
|
||||||
|
$id = Dba::insert_id();
|
||||||
|
return $id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function lookup(array $data, $id = 0)
|
||||||
|
{
|
||||||
|
$ret = -1;
|
||||||
|
$name = trim($data['name']);
|
||||||
|
if (!empty($name)) {
|
||||||
|
$ret = 0;
|
||||||
|
$sql = "SELECT `id` FROM `label` WHERE `name` = ?";
|
||||||
|
$params = array($name);
|
||||||
|
if ($id > 0) {
|
||||||
|
$sql .= " AND `id` != ?";
|
||||||
|
$params[] = $id;
|
||||||
|
}
|
||||||
|
$db_results = Dba::read($sql, $params);
|
||||||
|
if ($row = Dba::fetch_assoc($db_results)) {
|
||||||
|
$ret = $row['id'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function gc()
|
||||||
|
{
|
||||||
|
// Don't remove labels, it could still be used as description in a search
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get_artists()
|
||||||
|
{
|
||||||
|
$sql = "SELECT `artist` FROM `label_asso` WHERE `label` = ?";
|
||||||
|
$db_results = Dba::read($sql, array($this->id));
|
||||||
|
$results = array();
|
||||||
|
while ($row = Dba::fetch_assoc($db_results)) {
|
||||||
|
$results[] = $row['artist'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $results;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function add_artist_assoc($artist_id)
|
||||||
|
{
|
||||||
|
$sql = "INSERT INTO `label_asso` (`label`, `artist`, `creation_date`) VALUES (?, ?, ?)";
|
||||||
|
return Dba::write($sql, array($this->id, $artist_id, time()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function remove_artist_assoc($artist_id)
|
||||||
|
{
|
||||||
|
$sql = "DELETE FROM `label_asso` WHERE `label` = ? AND `artist` = ?";
|
||||||
|
return Dba::write($sql, array($this->id, $artist_id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get_songs
|
||||||
|
* gets the songs for this label
|
||||||
|
* @return int[]
|
||||||
|
*/
|
||||||
|
public function get_songs()
|
||||||
|
{
|
||||||
|
$sql = "SELECT `song`.`id` FROM `song` " .
|
||||||
|
"LEFT JOIN `label_asso` ON `label_asso`.`artist` = `song`.`artist` ";
|
||||||
|
if (AmpConfig::get('catalog_disable')) {
|
||||||
|
$sql .= "LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` ";
|
||||||
|
}
|
||||||
|
$sql .= "WHERE `label_asso`.`label` = ? ";
|
||||||
|
if (AmpConfig::get('catalog_disable')) {
|
||||||
|
$sql .= "AND `catalog`.`enabled` = '1' ";
|
||||||
|
}
|
||||||
|
$sql .= "ORDER BY `song`.`album`, `song`.`track`";
|
||||||
|
$db_results = Dba::read($sql, array($this->id));
|
||||||
|
|
||||||
|
$results = array();
|
||||||
|
while ($r = Dba::fetch_assoc($db_results)) {
|
||||||
|
$results[] = $r['id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $results;
|
||||||
|
|
||||||
|
} // get_songs
|
||||||
|
|
||||||
|
public static function get_all_labels()
|
||||||
|
{
|
||||||
|
$sql = "SELECT `id`, `name` FROM `label`";
|
||||||
|
$db_results = Dba::read($sql);
|
||||||
|
$results = array();
|
||||||
|
while ($row = Dba::fetch_assoc($db_results)) {
|
||||||
|
$results[$row['id']] = $row['name'];
|
||||||
|
}
|
||||||
|
return $results;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function get_labels($artist_id)
|
||||||
|
{
|
||||||
|
$sql = "SELECT `label`.`id`, `label`.`name` FROM `label` " .
|
||||||
|
"LEFT JOIN `label_asso` ON `label_asso`.`label` = `label`.`id` " .
|
||||||
|
"WHERE `label_asso`.`artist` = ?";
|
||||||
|
$db_results = Dba::read($sql, array($artist_id));
|
||||||
|
$results = array();
|
||||||
|
while ($row = Dba::fetch_assoc($db_results)) {
|
||||||
|
$results[$row['id']] = $row['name'];
|
||||||
|
}
|
||||||
|
return $results;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get_display
|
||||||
|
* This returns a csv formated version of the labels that we are given
|
||||||
|
*/
|
||||||
|
public static function get_display($labels, $link=false)
|
||||||
|
{
|
||||||
|
if (!is_array($labels)) { return ''; }
|
||||||
|
|
||||||
|
$results = '';
|
||||||
|
|
||||||
|
// Iterate through the labels, format them according to type and element id
|
||||||
|
foreach ($labels as $label_id=>$value) {
|
||||||
|
if ($link) {
|
||||||
|
$results .= '<a href="' . AmpConfig::get('web_path') . '/labels.php?action=show&label=' . $label_id . '" title="' . $value . '">';
|
||||||
|
}
|
||||||
|
$results .= $value;
|
||||||
|
if ($link) {
|
||||||
|
$results .= '</a>';
|
||||||
|
}
|
||||||
|
$results .= ', ';
|
||||||
|
}
|
||||||
|
|
||||||
|
$results = rtrim($results, ', ');
|
||||||
|
|
||||||
|
return $results;
|
||||||
|
|
||||||
|
} // get_display
|
||||||
|
|
||||||
|
/**
|
||||||
|
* update_label_list
|
||||||
|
* Update the labels list based on commated list (ex. label1,label2,label3,..)
|
||||||
|
*/
|
||||||
|
public static function update_label_list($labels_comma, $artist_id, $overwrite)
|
||||||
|
{
|
||||||
|
debug_event('label.class', 'Updating labels for values {'.$labels_comma.'} artist {'.$artist_id.'}', '5');
|
||||||
|
|
||||||
|
$clabels = Label::get_labels($artist_id);
|
||||||
|
$editedLabels = explode(",", $labels_comma);
|
||||||
|
|
||||||
|
if (is_array($clabels)) {
|
||||||
|
foreach ($clabels as $clid => $clv) {
|
||||||
|
if ($clid) {
|
||||||
|
$clabel = new Label($clid);
|
||||||
|
debug_event('label.class', 'Processing label {'.$clabel->name.'}...', '5');
|
||||||
|
$found = false;
|
||||||
|
|
||||||
|
foreach ($editedLabels as $lk => $lv) {
|
||||||
|
if ($clabel->name == $lv) {
|
||||||
|
$found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($found) {
|
||||||
|
debug_event('label.class', 'Already found. Do nothing.', '5');
|
||||||
|
unset($editedLabels[$lk]);
|
||||||
|
} else if ($overwrite) {
|
||||||
|
debug_event('label.class', 'Not found in the new list. Delete it.', '5');
|
||||||
|
$clabel->remove_artist_assoc($artist_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Look if we need to add some new labels
|
||||||
|
foreach ($editedLabels as $lk => $lv) {
|
||||||
|
if ($lv != '') {
|
||||||
|
debug_event('label.class', 'Adding new label {'.$lv.'}', '5');
|
||||||
|
$label_id = Label::lookup(array('name' => $lv));
|
||||||
|
if ($label_id === 0) {
|
||||||
|
debug_event('label.class', 'Creating a label directly from artist editing is not allowed.', '5');
|
||||||
|
//$label_id = Label::create(array('name' => $lv));
|
||||||
|
}
|
||||||
|
if ($label_id > 0) {
|
||||||
|
$clabel = new Label($label_id);
|
||||||
|
$clabel->add_artist_assoc($artist_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} // update_tag_list
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clean_to_existing
|
||||||
|
* Clean label list to existing label list only
|
||||||
|
* @param array|string $labels
|
||||||
|
* @return array|string
|
||||||
|
*/
|
||||||
|
public static function clean_to_existing($labels)
|
||||||
|
{
|
||||||
|
if (is_array($labels)) {
|
||||||
|
$ar = $labels;
|
||||||
|
} else {
|
||||||
|
$ar = explode(",", $labels);
|
||||||
|
}
|
||||||
|
|
||||||
|
$ret = array();
|
||||||
|
foreach ($ar as $label) {
|
||||||
|
$label = trim($label);
|
||||||
|
if (!empty($label)) {
|
||||||
|
if (Label::lookup(array('name' => $label)) > 0) {
|
||||||
|
$ret[] = $label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (is_array($labels) ? $ret : implode(",", $ret));
|
||||||
|
}
|
||||||
|
}
|
|
@ -213,6 +213,12 @@ class Query
|
||||||
),
|
),
|
||||||
'user' => array(
|
'user' => array(
|
||||||
'starts_with'
|
'starts_with'
|
||||||
|
),
|
||||||
|
'label' => array(
|
||||||
|
'alpha_match',
|
||||||
|
'regex_match',
|
||||||
|
'regex_not_match',
|
||||||
|
'starts_with'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -356,6 +362,11 @@ class Query
|
||||||
'length',
|
'length',
|
||||||
'codec',
|
'codec',
|
||||||
'release_date'
|
'release_date'
|
||||||
|
),
|
||||||
|
'label' => array(
|
||||||
|
'name',
|
||||||
|
'category',
|
||||||
|
'user'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -675,6 +686,7 @@ class Query
|
||||||
case 'movie':
|
case 'movie':
|
||||||
case 'personal_video':
|
case 'personal_video':
|
||||||
case 'clip':
|
case 'clip':
|
||||||
|
case 'label':
|
||||||
// Set it
|
// Set it
|
||||||
$this->_state['type'] = $type;
|
$this->_state['type'] = $type;
|
||||||
$this->set_base_sql(true, $custom_base);
|
$this->set_base_sql(true, $custom_base);
|
||||||
|
@ -1018,6 +1030,10 @@ class Query
|
||||||
$this->set_select("`personal_video`.`id`");
|
$this->set_select("`personal_video`.`id`");
|
||||||
$sql = "SELECT %%SELECT%% FROM `personal_video` ";
|
$sql = "SELECT %%SELECT%% FROM `personal_video` ";
|
||||||
break;
|
break;
|
||||||
|
case 'label':
|
||||||
|
$this->set_select("`label`.`id`");
|
||||||
|
$sql = "SELECT %%SELECT%% FROM `label` ";
|
||||||
|
break;
|
||||||
case 'playlist_song':
|
case 'playlist_song':
|
||||||
case 'song':
|
case 'song':
|
||||||
default:
|
default:
|
||||||
|
@ -1635,6 +1651,25 @@ class Query
|
||||||
break;
|
break;
|
||||||
} // end filter
|
} // end filter
|
||||||
break;
|
break;
|
||||||
|
case 'label':
|
||||||
|
switch ($filter) {
|
||||||
|
case 'alpha_match':
|
||||||
|
$filter_sql = " `label`.`name` LIKE '%" . Dba::escape($value) . "%' AND ";
|
||||||
|
break;
|
||||||
|
case 'regex_match':
|
||||||
|
if (!empty($value)) $filter_sql = " `label`.`name` REGEXP '" . Dba::escape($value) . "' AND ";
|
||||||
|
break;
|
||||||
|
case 'regex_not_match':
|
||||||
|
if (!empty($value)) $filter_sql = " `label`.`name` NOT REGEXP '" . Dba::escape($value) . "' AND ";
|
||||||
|
break;
|
||||||
|
case 'starts_with':
|
||||||
|
$filter_sql = " `label`.`name` LIKE '" . Dba::escape($value) . "%' AND ";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// Rien a faire
|
||||||
|
break;
|
||||||
|
} // end filter
|
||||||
|
break;
|
||||||
} // end switch on type
|
} // end switch on type
|
||||||
|
|
||||||
return $filter_sql;
|
return $filter_sql;
|
||||||
|
@ -1956,6 +1991,19 @@ class Query
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'label':
|
||||||
|
switch ($field) {
|
||||||
|
case 'name':
|
||||||
|
$sql = "`label`.`name`";
|
||||||
|
break;
|
||||||
|
case 'category':
|
||||||
|
$sql = "`label`.`category`";
|
||||||
|
break;
|
||||||
|
case 'user':
|
||||||
|
$sql = "`label`.`user`";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
// Rien a faire
|
// Rien a faire
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -238,6 +238,13 @@ class Search extends playlist_object
|
||||||
'widget' => array('input', 'text')
|
'widget' => array('input', 'text')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$this->types[] = array(
|
||||||
|
'name' => 'label',
|
||||||
|
'label' => T_('Label'),
|
||||||
|
'type' => 'text',
|
||||||
|
'widget' => array('input', 'text')
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
$this->types[] = array(
|
$this->types[] = array(
|
||||||
'name' => 'tag',
|
'name' => 'tag',
|
||||||
|
@ -498,6 +505,20 @@ class Search extends playlist_object
|
||||||
'widget' => array('input', 'text')
|
'widget' => array('input', 'text')
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
case 'label':
|
||||||
|
$this->types[] = array(
|
||||||
|
'name' => 'name',
|
||||||
|
'label' => T_('Name'),
|
||||||
|
'type' => 'text',
|
||||||
|
'widget' => array('input', 'text')
|
||||||
|
);
|
||||||
|
$this->types[] = array(
|
||||||
|
'name' => 'category',
|
||||||
|
'label' => T_('Category'),
|
||||||
|
'type' => 'text',
|
||||||
|
'widget' => array('input', 'text')
|
||||||
|
);
|
||||||
|
break;
|
||||||
} // end switch on searchtype
|
} // end switch on searchtype
|
||||||
|
|
||||||
} // end constructor
|
} // end constructor
|
||||||
|
@ -1112,7 +1133,7 @@ class Search extends playlist_object
|
||||||
|
|
||||||
switch ($rule[0]) {
|
switch ($rule[0]) {
|
||||||
case 'anywhere':
|
case 'anywhere':
|
||||||
$where[] = "(`artist`.`name` $sql_match_operator '$input' OR `album`.`name` $sql_match_operator '$input' OR `song_data`.`comment` $sql_match_operator '$input' OR `song`.`file` $sql_match_operator '$input' OR `song`.`title` $sql_match_operator '$input')";
|
$where[] = "(`artist`.`name` $sql_match_operator '$input' OR `album`.`name` $sql_match_operator '$input' OR `song_data`.`comment` $sql_match_operator '$input' OR `song_data`.`label` $sql_match_operator '$input' OR `song`.`file` $sql_match_operator '$input' OR `song`.`title` $sql_match_operator '$input')";
|
||||||
$join['album'] = true;
|
$join['album'] = true;
|
||||||
$join['artist'] = true;
|
$join['artist'] = true;
|
||||||
$join['song_data'] = true;
|
$join['song_data'] = true;
|
||||||
|
@ -1150,6 +1171,10 @@ class Search extends playlist_object
|
||||||
$where[] = "`song_data`.`comment` $sql_match_operator '$input'";
|
$where[] = "`song_data`.`comment` $sql_match_operator '$input'";
|
||||||
$join['song_data'] = true;
|
$join['song_data'] = true;
|
||||||
break;
|
break;
|
||||||
|
case 'label':
|
||||||
|
$where[] = "`song_data`.`label` $sql_match_operator '$input'";
|
||||||
|
$join['song_data'] = true;
|
||||||
|
break;
|
||||||
case 'played':
|
case 'played':
|
||||||
$where[] = " `song`.`played` = '$input'";
|
$where[] = " `song`.`played` = '$input'";
|
||||||
break;
|
break;
|
||||||
|
@ -1405,4 +1430,54 @@ class Search extends playlist_object
|
||||||
'having_sql' => $having_sql
|
'having_sql' => $having_sql
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* label_to_sql
|
||||||
|
*
|
||||||
|
* Handles the generation of the SQL for label searches.
|
||||||
|
*/
|
||||||
|
private function label_to_sql()
|
||||||
|
{
|
||||||
|
$sql_logic_operator = $this->logic_operator;
|
||||||
|
$where = array();
|
||||||
|
$table = array();
|
||||||
|
|
||||||
|
foreach ($this->rules as $rule) {
|
||||||
|
$type = $this->name_to_basetype($rule[0]);
|
||||||
|
$operator = array();
|
||||||
|
foreach ($this->basetypes[$type] as $op) {
|
||||||
|
if ($op['name'] == $rule[1]) {
|
||||||
|
$operator = $op;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$input = $this->_mangle_data($rule[2], $type, $operator);
|
||||||
|
$sql_match_operator = $operator['sql'];
|
||||||
|
|
||||||
|
switch ($rule[0]) {
|
||||||
|
case 'name':
|
||||||
|
$where[] = "`label`.`name` $sql_match_operator '$input'";
|
||||||
|
break;
|
||||||
|
case 'category':
|
||||||
|
$where[] = "`label`.`category` $sql_match_operator '$input'";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// Nihil
|
||||||
|
break;
|
||||||
|
} // switch on ruletype
|
||||||
|
} // foreach rule
|
||||||
|
|
||||||
|
$where_sql = implode(" $sql_logic_operator ", $where);
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'base' => 'SELECT DISTINCT(`label`.`id`) FROM `label`',
|
||||||
|
'join' => $join,
|
||||||
|
'where' => $where,
|
||||||
|
'where_sql' => $where_sql,
|
||||||
|
'table' => $table,
|
||||||
|
'table_sql' => '',
|
||||||
|
'group_sql' => '',
|
||||||
|
'having_sql' => ''
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -497,6 +497,9 @@ class Update
|
||||||
$update_string = " - Add WebDAV backend preference.<br />";
|
$update_string = " - Add WebDAV backend preference.<br />";
|
||||||
$version[] = array('version' => '370032','description' => $update_string);
|
$version[] = array('version' => '370032','description' => $update_string);
|
||||||
|
|
||||||
|
$update_string = " - Add Label tables.<br />";
|
||||||
|
$version[] = array('version' => '370033','description' => $update_string);
|
||||||
|
|
||||||
return $version;
|
return $version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3407,4 +3410,37 @@ class Update
|
||||||
|
|
||||||
return $retval;
|
return $retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* update_370033
|
||||||
|
*
|
||||||
|
* Add Label tables.
|
||||||
|
*/
|
||||||
|
public static function update_370033()
|
||||||
|
{
|
||||||
|
$retval = true;
|
||||||
|
|
||||||
|
$sql = "CREATE TABLE `label` (" .
|
||||||
|
"`id` int(11) unsigned NOT NULL AUTO_INCREMENT," .
|
||||||
|
"`name` varchar(80) NOT NULL," .
|
||||||
|
"`category` varchar(40) NULL," .
|
||||||
|
"`summary` TEXT CHARACTER SET utf8 NULL," .
|
||||||
|
"`address` varchar(256) NULL," .
|
||||||
|
"`email` varchar(128) NULL," .
|
||||||
|
"`website` varchar(256) NULL," .
|
||||||
|
"`user` int(11) unsigned NULL," .
|
||||||
|
"`creation_date` int(11) unsigned NULL," .
|
||||||
|
"PRIMARY KEY (`id`)) ENGINE = MYISAM";
|
||||||
|
$retval = Dba::write($sql) ? $retval : false;
|
||||||
|
|
||||||
|
$sql = "CREATE TABLE `label_asso` (" .
|
||||||
|
"`id` int(11) unsigned NOT NULL AUTO_INCREMENT," .
|
||||||
|
"`label` int(11) unsigned NOT NULL," .
|
||||||
|
"`artist` int(11) unsigned NOT NULL," .
|
||||||
|
"`creation_date` int(11) unsigned NULL," .
|
||||||
|
"PRIMARY KEY (`id`)) ENGINE = MYISAM";
|
||||||
|
$retval = Dba::write($sql) ? $retval : false;
|
||||||
|
|
||||||
|
return $retval;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ if (!empty($link)) {
|
||||||
$results['load_time_begin'] = $load_time_begin;
|
$results['load_time_begin'] = $load_time_begin;
|
||||||
/** This is the version.... fluf nothing more... **/
|
/** This is the version.... fluf nothing more... **/
|
||||||
$results['version'] = '3.8.0-develop';
|
$results['version'] = '3.8.0-develop';
|
||||||
$results['int_config_version'] = '27';
|
$results['int_config_version'] = '28';
|
||||||
|
|
||||||
if (!empty($results['force_ssl'])) {
|
if (!empty($results['force_ssl'])) {
|
||||||
$http_type = 'https://';
|
$http_type = 'https://';
|
||||||
|
|
|
@ -198,6 +198,7 @@ function handleShareAction(url) {
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
var tag_choices = undefined;
|
var tag_choices = undefined;
|
||||||
|
var label_choices = undefined;
|
||||||
|
|
||||||
function showEditDialog(edit_type, edit_id, edit_form_id, edit_title, refresh_row_prefix) {
|
function showEditDialog(edit_type, edit_id, edit_form_id, edit_title, refresh_row_prefix) {
|
||||||
var parent = this;
|
var parent = this;
|
||||||
|
@ -222,12 +223,29 @@ function showEditDialog(edit_type, edit_id, edit_form_id, edit_title, refresh_ro
|
||||||
}, type: 'post', dataType: 'xml'
|
}, type: 'post', dataType: 'xml'
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
parent.editLabelChoices = new Array();
|
||||||
|
if (label_choices == undefined && label_choices != '') {
|
||||||
|
// Load tag map
|
||||||
|
$.ajax(jsAjaxServer + '/ajax.server.php?page=tag&action=get_labels', {
|
||||||
|
success: function(data) {
|
||||||
|
label_choices = $(data).find('content').text();
|
||||||
|
if (label_choices != '') {
|
||||||
|
showEditDialog(edit_type, edit_id, edit_form_id, edit_title, refresh_row_prefix);
|
||||||
|
}
|
||||||
|
}, type: 'post', dataType: 'xml'
|
||||||
|
});
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
var splitted = tag_choices.split(',');
|
var splitted = tag_choices.split(',');
|
||||||
var i;
|
var i;
|
||||||
for (i = 0; i < splitted.length; ++i) {
|
for (i = 0; i < splitted.length; ++i) {
|
||||||
parent.editTagChoices.push($.trim(splitted[i]));
|
parent.editTagChoices.push($.trim(splitted[i]));
|
||||||
}
|
}
|
||||||
|
splitted = label_choices.split(',');
|
||||||
|
for (i = 0; i < splitted.length; ++i) {
|
||||||
|
parent.editLabelChoices.push($.trim(splitted[i]));
|
||||||
|
}
|
||||||
|
|
||||||
parent.dialog_buttons = {};
|
parent.dialog_buttons = {};
|
||||||
this.dialog_buttons[jsSaveTitle] = function () {
|
this.dialog_buttons[jsSaveTitle] = function () {
|
||||||
|
@ -289,6 +307,14 @@ function showEditDialog(edit_type, edit_id, edit_form_id, edit_title, refresh_ro
|
||||||
singleFieldDelimiter: ',',
|
singleFieldDelimiter: ',',
|
||||||
availableTags: parent.editTagChoices
|
availableTags: parent.editTagChoices
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
if ($('#edit_labels').length > 0) {
|
||||||
|
$("#edit_labels").tagit({
|
||||||
|
allowSpaces: true,
|
||||||
|
singleField: true,
|
||||||
|
singleFieldDelimiter: ',',
|
||||||
|
availableTags: parent.editLabelChoices
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -90,6 +90,7 @@ switch ($_REQUEST['action']) {
|
||||||
$libitem = new $object_type($_POST['id']);
|
$libitem = new $object_type($_POST['id']);
|
||||||
if ($libitem->get_user_owner() == $GLOBALS['user']->id && AmpConfig::get('upload_allow_edit') && !Access::check('interface', 50)) {
|
if ($libitem->get_user_owner() == $GLOBALS['user']->id && AmpConfig::get('upload_allow_edit') && !Access::check('interface', 50)) {
|
||||||
// TODO: improve this uniqueless check
|
// TODO: improve this uniqueless check
|
||||||
|
if (isset($_POST['user'])) unset($_POST['user']);
|
||||||
if (isset($_POST['artist'])) unset($_POST['artist']);
|
if (isset($_POST['artist'])) unset($_POST['artist']);
|
||||||
if (isset($_POST['artist_name'])) unset($_POST['artist_name']);
|
if (isset($_POST['artist_name'])) unset($_POST['artist_name']);
|
||||||
if (isset($_POST['album'])) unset($_POST['album']);
|
if (isset($_POST['album'])) unset($_POST['album']);
|
||||||
|
@ -99,6 +100,9 @@ switch ($_REQUEST['action']) {
|
||||||
if (isset($_POST['edit_tags'])) {
|
if (isset($_POST['edit_tags'])) {
|
||||||
$_POST['edit_tags'] = Tag::clean_to_existing($_POST['edit_tags']);
|
$_POST['edit_tags'] = Tag::clean_to_existing($_POST['edit_tags']);
|
||||||
}
|
}
|
||||||
|
if (isset($_POST['edit_labels'])) {
|
||||||
|
$_POST['edit_labels'] = Label::clean_to_existing($_POST['edit_labels']);
|
||||||
|
}
|
||||||
// Check mbid and *_mbid match as it is used as identifier
|
// Check mbid and *_mbid match as it is used as identifier
|
||||||
if (isset($_POST['mbid'])) {
|
if (isset($_POST['mbid'])) {
|
||||||
$_POST['mbid'] = $libitem->mbid;
|
$_POST['mbid'] = $libitem->mbid;
|
||||||
|
|
|
@ -127,6 +127,25 @@ switch ($_REQUEST['action']) {
|
||||||
$results['concerts'] = ob_get_clean();
|
$results['concerts'] = ob_get_clean();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'labels':
|
||||||
|
if (AmpConfig::get('label') && isset($_REQUEST['artist'])) {
|
||||||
|
$labels = Label::get_labels($_REQUEST['artist']);
|
||||||
|
$object_ids = array();
|
||||||
|
if (count($labels) > 0) {
|
||||||
|
foreach ($labels as $id => $label) {
|
||||||
|
$object_ids[] = $id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$browse = new Browse();
|
||||||
|
$browse->set_type('label');
|
||||||
|
$browse->set_simple_browse(true);
|
||||||
|
$browse->save_objects($object_ids);
|
||||||
|
$browse->store();
|
||||||
|
ob_start();
|
||||||
|
require_once AmpConfig::get('prefix') . '/templates/show_labels.inc.php';
|
||||||
|
$results['labels'] = ob_get_clean();
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 'wanted_missing_albums':
|
case 'wanted_missing_albums':
|
||||||
if (AmpConfig::get('wanted') && (isset($_REQUEST['artist']) || isset($_REQUEST['artist_mbid']))) {
|
if (AmpConfig::get('wanted') && (isset($_REQUEST['artist']) || isset($_REQUEST['artist_mbid']))) {
|
||||||
if (isset($_REQUEST['artist'])) {
|
if (isset($_REQUEST['artist'])) {
|
||||||
|
|
|
@ -34,6 +34,10 @@ switch ($_REQUEST['action']) {
|
||||||
$tags = Tag::get_display(Tag::get_tags());
|
$tags = Tag::get_display(Tag::get_tags());
|
||||||
$results['tags'] = $tags;
|
$results['tags'] = $tags;
|
||||||
break;
|
break;
|
||||||
|
case 'get_labels':
|
||||||
|
$labels = Label::get_display(Label::get_all_labels());
|
||||||
|
$results['labels'] = $labels;
|
||||||
|
break;
|
||||||
case 'add_tag':
|
case 'add_tag':
|
||||||
debug_event('tag.ajax', 'Adding new tag...', '5');
|
debug_event('tag.ajax', 'Adding new tag...', '5');
|
||||||
Tag::add_tag_map($_GET['type'],$_GET['object_id'],$_GET['tag_id']);
|
Tag::add_tag_map($_GET['type'],$_GET['object_id'],$_GET['tag_id']);
|
||||||
|
|
76
templates/show_add_label.inc.php
Normal file
76
templates/show_add_label.inc.php
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
<?php
|
||||||
|
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||||
|
* Copyright 2001 - 2015 Ampache.org
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
?>
|
||||||
|
<?php UI::show_box_top(T_('Add Label'), 'box box_add_label'); ?>
|
||||||
|
<form name="label" method="post" action="<?php echo AmpConfig::get('web_path'); ?>/labels.php?action=add_label">
|
||||||
|
<table class="tabledata" cellspacing="0" cellpadding="0">
|
||||||
|
<tr>
|
||||||
|
<td><?php echo T_('Name'); ?></td>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="name" value="<?php echo scrub_out($_REQUEST['name']); ?>" />
|
||||||
|
<?php Error::display('name'); ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo T_('Category'); ?></td>
|
||||||
|
<td>
|
||||||
|
<select name="category">
|
||||||
|
<option value="personal" <?php if (empty($_REQUEST['category']) || $_REQUEST['category'] === "personal") echo "selected"; ?>><?php echo T_('Personal'); ?></option>
|
||||||
|
<option value="association" <?php if ($_REQUEST['category'] === "association") echo "selected"; ?>><?php echo T_('Association'); ?></option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo T_('Summary'); ?></td>
|
||||||
|
<td>
|
||||||
|
<textarea name="summary" cols="44" rows="4"><?php echo scrub_out($_REQUEST['summary']); ?></textarea>
|
||||||
|
<?php Error::display('summary'); ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo T_('Address'); ?></td>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="address" value="<?php echo scrub_out($_REQUEST['address']); ?>" />
|
||||||
|
<?php Error::display('address'); ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo T_('Email'); ?></td>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="email" value="<?php echo scrub_out($_REQUEST['email']); ?>" />
|
||||||
|
<?php Error::display('email'); ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo T_('Website'); ?></td>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="website" value="<?php echo scrub_out($_REQUEST['website']); ?>" />
|
||||||
|
<?php Error::display('website'); ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<div class="formValidation">
|
||||||
|
<?php echo Core::form_register('add_label'); ?>
|
||||||
|
<input class="button" type="submit" value="<?php echo T_('Add'); ?>" />
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<?php UI::show_box_bottom(); ?>
|
|
@ -165,6 +165,9 @@ if (AmpConfig::get('show_played_times')) {
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if (AmpConfig::get('show_concerts')) { ?>
|
<?php if (AmpConfig::get('show_concerts')) { ?>
|
||||||
<li><a id="concerts_link" href="#concerts"><?php echo T_('Events'); ?></a></li>
|
<li><a id="concerts_link" href="#concerts"><?php echo T_('Events'); ?></a></li>
|
||||||
|
<?php } ?>
|
||||||
|
<?php if (AmpConfig::get('label')) { ?>
|
||||||
|
<li><a id="labels_link" href="#labels"><?php echo T_('Labels'); ?></a></li>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<!-- Needed to avoid the 'only one' bug -->
|
<!-- Needed to avoid the 'only one' bug -->
|
||||||
<li></li>
|
<li></li>
|
||||||
|
@ -212,6 +215,14 @@ if (AmpConfig::get('show_concerts')) {
|
||||||
<div id="concerts" class="tab_content">
|
<div id="concerts" class="tab_content">
|
||||||
<?php UI::show_box_top(T_('Events'), 'info-box'); echo T_('Loading...'); UI::show_box_bottom(); ?>
|
<?php UI::show_box_top(T_('Events'), 'info-box'); echo T_('Loading...'); UI::show_box_bottom(); ?>
|
||||||
</div>
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
<?php
|
||||||
|
if (AmpConfig::get('label')) {
|
||||||
|
echo Ajax::observe('labels_link','click', Ajax::action('?page=index&action=labels&artist='.$artist->id, 'labels'));
|
||||||
|
?>
|
||||||
|
<div id="labels" class="tab_content">
|
||||||
|
<?php UI::show_box_top(T_('Labels'), 'info-box'); echo T_('Loading...'); UI::show_box_bottom(); ?>
|
||||||
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -53,6 +53,12 @@
|
||||||
<td class="edit_dialog_content_header"><?php echo T_('Tags') ?></td>
|
<td class="edit_dialog_content_header"><?php echo T_('Tags') ?></td>
|
||||||
<td><input type="text" name="edit_tags" id="edit_tags" value="<?php echo Tag::get_display($libitem->tags); ?>" /></td>
|
<td><input type="text" name="edit_tags" id="edit_tags" value="<?php echo Tag::get_display($libitem->tags); ?>" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<?php if (AmpConfig::get('label')) { ?>
|
||||||
|
<tr>
|
||||||
|
<td class="edit_dialog_content_header"><?php echo T_('Labels') ?></td>
|
||||||
|
<td><input type="text" name="edit_labels" id="edit_labels" value="<?php echo Label::get_display($libitem->labels); ?>" /></td>
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="edit_dialog_content_header"></td>
|
<td class="edit_dialog_content_header"></td>
|
||||||
<td><input type="checkbox" name="overwrite_childs" value="checked" /> <?php echo T_('Overwrite tags of sub albums and sub songs') ?></td>
|
<td><input type="checkbox" name="overwrite_childs" value="checked" /> <?php echo T_('Overwrite tags of sub albums and sub songs') ?></td>
|
||||||
|
|
59
templates/show_edit_label_row.inc.php
Normal file
59
templates/show_edit_label_row.inc.php
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
<?php
|
||||||
|
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||||
|
* Copyright 2001 - 2015 Ampache.org
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
?>
|
||||||
|
<div>
|
||||||
|
<form method="post" id="edit_label_<?php echo $libitem->id; ?>" class="edit_dialog_content">
|
||||||
|
<table class="tabledata" cellspacing="0" cellpadding="0">
|
||||||
|
<tr>
|
||||||
|
<td class="edit_dialog_content_header"><?php echo T_('Name') ?></td>
|
||||||
|
<td><input type="text" name="name" value="<?php echo scrub_out($libitem->name); ?>" autofocus /></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="edit_dialog_content_header"><?php echo T_('Category') ?></td>
|
||||||
|
<td>
|
||||||
|
<select name="category">
|
||||||
|
<option value="personal" <?php if (empty($libitem->category) || $libitem->category === "personal") echo "selected" ?>><?php echo T_('Personal'); ?></option>
|
||||||
|
<option value="association" <?php if ($libitem->category === "association") echo "selected" ?>><?php echo T_('Association'); ?></option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="edit_dialog_content_header"><?php echo T_('Summary') ?></td>
|
||||||
|
<td><textarea name="summary" cols="44" rows="4"><?php echo scrub_out($libitem->summary); ?></textarea></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="edit_dialog_content_header"><?php echo T_('Address') ?></td>
|
||||||
|
<td><input type="text" name="address" value="<?php echo scrub_out($libitem->address); ?>" /></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="edit_dialog_content_header"><?php echo T_('Email') ?></td>
|
||||||
|
<td><input type="text" name="email" value="<?php echo scrub_out($libitem->email); ?>" /></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="edit_dialog_content_header"><?php echo T_('Website') ?></td>
|
||||||
|
<td><input type="text" name="website" value="<?php echo scrub_out($libitem->website); ?>" /></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<input type="hidden" name="id" value="<?php echo $libitem->id; ?>" />
|
||||||
|
<input type="hidden" name="type" value="label_row" />
|
||||||
|
</form>
|
||||||
|
</div>
|
104
templates/show_label.inc.php
Normal file
104
templates/show_label.inc.php
Normal file
|
@ -0,0 +1,104 @@
|
||||||
|
<?php
|
||||||
|
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||||
|
* Copyright 2001 - 2015 Ampache.org
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
?>
|
||||||
|
<?php
|
||||||
|
$browse = new Browse();
|
||||||
|
$browse->set_type($object_type);
|
||||||
|
|
||||||
|
UI::show_box_top($label->f_name, 'info-box');
|
||||||
|
?>
|
||||||
|
<div class="item_right_info">
|
||||||
|
<div class="external_links">
|
||||||
|
<a href="http://www.google.com/search?q=%22<?php echo rawurlencode($label->f_name); ?>%22" target="_blank"><?php echo UI::get_icon('google', T_('Search on Google ...')); ?></a>
|
||||||
|
<a href="http://en.wikipedia.org/wiki/Special:Search?search=%22<?php echo rawurlencode($label->f_name); ?>%22&go=Go" target="_blank"><?php echo UI::get_icon('wikipedia', T_('Search on Wikipedia ...')); ?></a>
|
||||||
|
<a href="http://www.last.fm/search?q=%22<?php echo rawurlencode($label->f_name); ?>%22&type=label" target="_blank"><?php echo UI::get_icon('lastfm', T_('Search on Last.fm ...')); ?></a>
|
||||||
|
</div>
|
||||||
|
<div id="artist_biography">
|
||||||
|
<div class="item_info">
|
||||||
|
<?php Art::display('label', $label->id, $label->f_name, 2); ?>
|
||||||
|
<div class="item_properties">
|
||||||
|
<?php
|
||||||
|
if ($label->address)
|
||||||
|
echo scrub_out($label->address) . "<br />";
|
||||||
|
if ($label->email)
|
||||||
|
echo "<a href=\"mailto:" . scrub_out($label->email) . "\">" . scrub_out($label->email) . "</a><br />";
|
||||||
|
if ($label->website)
|
||||||
|
echo "<a href=\"" . scrub_out($label->website) . "\">" . scrub_out($label->website) . "</a><br />";
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="item_summary">
|
||||||
|
<?php echo nl2br(scrub_out($label->summary)); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="information_actions">
|
||||||
|
<h3><?php echo T_('Actions'); ?>:</h3>
|
||||||
|
<ul>
|
||||||
|
<?php if (Access::check('interface','25')) { ?>
|
||||||
|
<?php if (AmpConfig::get('sociable')) { ?>
|
||||||
|
<li>
|
||||||
|
<a href="<?php echo AmpConfig::get('web_path'); ?>/shout.php?action=show_add_shout&type=label&id=<?php echo $label->id; ?>"><?php echo UI::get_icon('comment', T_('Post Shout')); ?></a>
|
||||||
|
<a href="<?php echo AmpConfig::get('web_path'); ?>/shout.php?action=show_add_shout&type=label&id=<?php echo $label->id; ?>"><?php echo T_('Post Shout'); ?></a>
|
||||||
|
</li>
|
||||||
|
<?php } ?>
|
||||||
|
<?php } ?>
|
||||||
|
<?php if (Access::check('interface','50')) { ?>
|
||||||
|
<?php if (AmpConfig::get('statistical_graphs')) { ?>
|
||||||
|
<li>
|
||||||
|
<a href="<?php echo AmpConfig::get('web_path'); ?>/stats.php?action=graph&object_type=label&object_id=<?php echo $label->id; ?>"><?php echo UI::get_icon('statistics', T_('Graphs')); ?></a>
|
||||||
|
<a href="<?php echo AmpConfig::get('web_path'); ?>/stats.php?action=graph&object_type=label&object_id=<?php echo $label->id; ?>"><?php echo T_('Graphs'); ?></a>
|
||||||
|
</li>
|
||||||
|
<?php } ?>
|
||||||
|
<?php } ?>
|
||||||
|
<?php if ($label->can_edit()) { ?>
|
||||||
|
<li>
|
||||||
|
<a id="<?php echo 'edit_label_'.$label->id ?>" onclick="showEditDialog('label_row', '<?php echo $label->id ?>', '<?php echo 'edit_label_'.$label->id ?>', '<?php echo T_('Label edit') ?>', '')">
|
||||||
|
<?php echo UI::get_icon('edit', T_('Edit')); ?>
|
||||||
|
</a>
|
||||||
|
<a id="<?php echo 'edit_label_'.$label->id ?>" onclick="showEditDialog('label_row', '<?php echo $label->id ?>', '<?php echo 'edit_label_'.$label->id ?>', '<?php echo T_('Label edit') ?>', '')">
|
||||||
|
<?php echo T_('Edit Label'); ?>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<?php } ?>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<?php UI::show_box_bottom(); ?>
|
||||||
|
<div class="tabs_wrapper">
|
||||||
|
<div id="tabs_container">
|
||||||
|
<ul id="tabs">
|
||||||
|
<li class="tab_active"><a href="#artists"><?php echo T_('Artists'); ?></a></li>
|
||||||
|
<!-- Needed to avoid the 'only one' bug -->
|
||||||
|
<li></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div id="tabs_content">
|
||||||
|
<div id="artists" class="tab_content" style="display: block;">
|
||||||
|
<?php
|
||||||
|
$browse->show_objects($object_ids, true);
|
||||||
|
$browse->store();
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
49
templates/show_label_row.inc.php
Normal file
49
templates/show_label_row.inc.php
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
<?php
|
||||||
|
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||||
|
* Copyright 2001 - 2015 Ampache.org
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
?>
|
||||||
|
<?php
|
||||||
|
if (Art::is_enabled()) {
|
||||||
|
$name = scrub_out($libitem->f_name);
|
||||||
|
?>
|
||||||
|
<td class="cel_cover">
|
||||||
|
<?php
|
||||||
|
Art::display('label', $libitem->id, $name, 1, AmpConfig::get('web_path') . '/labels.php?action=show&label=' . $libitem->id);
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
<?php } ?>
|
||||||
|
<td class="cel_label"><?php echo $libitem->f_link; ?></td>
|
||||||
|
<td class="cel_category"><?php echo $libitem->category; ?></td>
|
||||||
|
<td class="cel_artists"><?php echo $libitem->artists; ?></td>
|
||||||
|
<td class="cel_action">
|
||||||
|
<?php if (Access::check('interface','25')) { ?>
|
||||||
|
<?php if (AmpConfig::get('sociable')) { ?>
|
||||||
|
<a href="<?php echo AmpConfig::get('web_path'); ?>/shout.php?action=show_add_shout&type=label&id=<?php echo $libitem->id; ?>">
|
||||||
|
<?php echo UI::get_icon('comment', T_('Post Shout')); ?>
|
||||||
|
</a>
|
||||||
|
<?php } ?>
|
||||||
|
<?php } ?>
|
||||||
|
<?php if ($libitem->can_edit()) { ?>
|
||||||
|
<a id="<?php echo 'edit_label_'.$libitem->id ?>" onclick="showEditDialog('label_row', '<?php echo $libitem->id ?>', '<?php echo 'edit_label_'.$libitem->id ?>', '<?php echo T_('Label edit') ?>', 'label_')">
|
||||||
|
<?php echo UI::get_icon('edit', T_('Edit')); ?>
|
||||||
|
</a>
|
||||||
|
<?php } ?>
|
||||||
|
</td>
|
76
templates/show_labels.inc.php
Normal file
76
templates/show_labels.inc.php
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
<?php
|
||||||
|
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||||
|
* Copyright 2001 - 2015 Ampache.org
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
$thcount = 6;
|
||||||
|
?>
|
||||||
|
<?php if (Access::check('interface','50') || AmpConfig::get('upload_allow_edit')) { ?>
|
||||||
|
<div id="information_actions">
|
||||||
|
<ul>
|
||||||
|
<li><?php echo UI::get_icon('add', T_('Add')); ?> <a href="<?php echo AmpConfig::get('web_path'); ?>/labels.php?action=show_add_label"><?php echo T_('Create a new label'); ?></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
<?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?>
|
||||||
|
<table class="tabledata" cellpadding="0" cellspacing="0" data-objecttype="label">
|
||||||
|
<thead>
|
||||||
|
<tr class="th-top">
|
||||||
|
<?php if (Art::is_enabled()) { ++$thcount; ?>
|
||||||
|
<th class="cel_cover optional"><?php echo T_('Art'); ?></th>
|
||||||
|
<?php } ?>
|
||||||
|
<th class="cel_label essential persist"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=label&sort=name', T_('Label'),'label_sort_name'); ?></th>
|
||||||
|
<th class="cel_category essential"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=label&sort=category', T_('Category'),'label_sort_category'); ?></th>
|
||||||
|
<th class="cel_artists optional"><?php echo T_('Artists'); ?></th>
|
||||||
|
<th class="cel_action essential"><?php echo T_('Action'); ?></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
/* Foreach through every label that has been passed to us */
|
||||||
|
foreach ($object_ids as $label_id) {
|
||||||
|
$libitem = new Label($label_id);
|
||||||
|
$libitem->format();
|
||||||
|
?>
|
||||||
|
<tr id="label_<?php echo $libitem->id; ?>" class="<?php echo UI::flip_class(); ?>">
|
||||||
|
<?php require AmpConfig::get('prefix') . '/templates/show_label_row.inc.php'; ?>
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
|
<?php if (!count($object_ids)) { ?>
|
||||||
|
<tr class="<?php echo UI::flip_class(); ?>">
|
||||||
|
<td colspan="<?php echo $thcount; ?>"><span class="nodata"><?php echo T_('No label found'); ?></span></td>
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr class="th-bottom">
|
||||||
|
<?php if (Art::is_enabled()) { ?>
|
||||||
|
<th class="cel_cover"><?php echo T_('Art'); ?></th>
|
||||||
|
<?php } ?>
|
||||||
|
<th class="cel_label essential persist"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=label&sort=name', T_('Label'),'label_sort_name'); ?></th>
|
||||||
|
<th class="cel_category essential"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=label&sort=category', T_('Category'),'label_sort_category'); ?></th>
|
||||||
|
<th class="cel_artists optional"><?php echo T_('Artists'); ?></th>
|
||||||
|
<th class="cel_action essential"> <?php echo T_('Action'); ?> </th>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<?php show_table_render(); ?>
|
||||||
|
<?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?>
|
|
@ -117,7 +117,7 @@ $button_flip_state_id = 'button_flip_state_' . $song->id;
|
||||||
$songprops[gettext_noop('Links')] .= " <a href=\"http://www.last.fm/search?q=%22" . rawurlencode($song->f_artist) . "%22+%22" . rawurlencode($song->f_title) . "%22&type=track\" target=\"_blank\">" . UI::get_icon('lastfm', T_('Search on Last.fm ...')) . "</a>";
|
$songprops[gettext_noop('Links')] .= " <a href=\"http://www.last.fm/search?q=%22" . rawurlencode($song->f_artist) . "%22+%22" . rawurlencode($song->f_title) . "%22&type=track\" target=\"_blank\">" . UI::get_icon('lastfm', T_('Search on Last.fm ...')) . "</a>";
|
||||||
$songprops[gettext_noop('Length')] = scrub_out($song->f_time);
|
$songprops[gettext_noop('Length')] = scrub_out($song->f_time);
|
||||||
$songprops[gettext_noop('Comment')] = scrub_out($song->comment);
|
$songprops[gettext_noop('Comment')] = scrub_out($song->comment);
|
||||||
$songprops[gettext_noop('Label')] = scrub_out($song->label);
|
$songprops[gettext_noop('Label')] = AmpConfig::get('label') ? "<a href=\"" . AmpConfig::get('web_path') . "/labels.php?action=show&name=" . scrub_out($song->label) . "\">" . scrub_out($song->label) . "</a>" : scrub_out($song->label);
|
||||||
$songprops[gettext_noop('Song Language')]= scrub_out($song->language);
|
$songprops[gettext_noop('Song Language')]= scrub_out($song->language);
|
||||||
$songprops[gettext_noop('Catalog Number')] = scrub_out($song->catalog_number);
|
$songprops[gettext_noop('Catalog Number')] = scrub_out($song->catalog_number);
|
||||||
$songprops[gettext_noop('Bitrate')] = scrub_out($song->f_bitrate);
|
$songprops[gettext_noop('Bitrate')] = scrub_out($song->f_bitrate);
|
||||||
|
|
|
@ -32,6 +32,9 @@
|
||||||
<li id="sb_home_browse_music_songTitle"><a href="<?php echo $web_path; ?>/browse.php?action=song"><?php echo T_('Song Titles'); ?></a></li>
|
<li id="sb_home_browse_music_songTitle"><a href="<?php echo $web_path; ?>/browse.php?action=song"><?php echo T_('Song Titles'); ?></a></li>
|
||||||
<li id="sb_home_browse_music_album"><a href="<?php echo $web_path; ?>/browse.php?action=album"><?php echo T_('Albums'); ?></a></li>
|
<li id="sb_home_browse_music_album"><a href="<?php echo $web_path; ?>/browse.php?action=album"><?php echo T_('Albums'); ?></a></li>
|
||||||
<li id="sb_home_browse_music_artist"><a href="<?php echo $web_path; ?>/browse.php?action=artist"><?php echo T_('Artists'); ?></a></li>
|
<li id="sb_home_browse_music_artist"><a href="<?php echo $web_path; ?>/browse.php?action=artist"><?php echo T_('Artists'); ?></a></li>
|
||||||
|
<?php if (AmpConfig::get('label')) { ?>
|
||||||
|
<li id="sb_home_browse_music_label"><a href="<?php echo $web_path; ?>/browse.php?action=label"><?php echo T_('Labels'); ?></a></li>
|
||||||
|
<?php } ?>
|
||||||
<li id="sb_home_browse_music_tags"><a href="<?php echo $web_path; ?>/browse.php?action=tag"><?php echo T_('Tag Cloud'); ?></a></li>
|
<li id="sb_home_browse_music_tags"><a href="<?php echo $web_path; ?>/browse.php?action=tag"><?php echo T_('Tag Cloud'); ?></a></li>
|
||||||
<li id="sb_home_browse_music_playlist"><a href="<?php echo $web_path; ?>/browse.php?action=playlist"><?php echo T_('Playlists'); ?></a></li>
|
<li id="sb_home_browse_music_playlist"><a href="<?php echo $web_path; ?>/browse.php?action=playlist"><?php echo T_('Playlists'); ?></a></li>
|
||||||
<li id="sb_home_browse_music_smartPlaylist"><a href="<?php echo $web_path; ?>/browse.php?action=smartplaylist"><?php echo T_('Smart Playlists'); ?></a></li>
|
<li id="sb_home_browse_music_smartPlaylist"><a href="<?php echo $web_path; ?>/browse.php?action=smartplaylist"><?php echo T_('Smart Playlists'); ?></a></li>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue