1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-05 19:41:55 +02:00

Artist/Album/Song edition working.

Tag are now editable through the same dialog.
This commit is contained in:
SUTJael 2013-11-22 18:58:06 +01:00
parent cb690e5eee
commit 3134e3ca8e
19 changed files with 258 additions and 90 deletions

View file

@ -351,7 +351,7 @@ class Album extends database_object
$tags = Tag::get_top_tags('album',$this->id);
$this->tags = $tags;
$this->f_tags = Tag::get_display($tags,$this->id,'album');
$this->f_tags = Tag::get_display($tags, $this->id, 'album');
} // format
@ -379,8 +379,8 @@ class Album extends database_object
*/
public function update($data)
{
$year = $data['year'];
$artist = $data['artist'];
$year = $data['year'];
$artist = $data['artist'];
$name = $data['name'];
$disk = $data['disk'];
$mbid = $data['mbid'];
@ -420,6 +420,7 @@ class Album extends database_object
Userflag::gc();
} // if updated
Tag::update_tag_list($data['edit_tags'], 'album', $current_id);
return $current_id;

View file

@ -405,6 +405,8 @@ class Artist extends database_object
Userflag::gc();
} // if updated
Tag::update_tag_list($data['edit_tags'], 'artist', $current_id);
return $current_id;
} // update

View file

@ -556,11 +556,11 @@ class Song extends database_object implements media
case 'artist':
// Don't do anything if we've negative one'd this baby
if ($value == '-1') {
$value = Catalog::check_artist($data['artist_name'], $data['mb_artistid']);
$value = Artist::check_artist($data['artist_name'], $data['mb_artistid']);
}
case 'album':
if ($value == '-1') {
$value = Catalog::check_album($data['album_name'], $data['year'], $data['disk'], $data['mb_albumid']);
$value = Album::check_album($data['album_name'], $data['year'], $data['disk'], $data['mb_albumid']);
}
case 'title':
case 'track':
@ -572,6 +572,9 @@ class Song extends database_object implements media
$updated = 1;
}
break;
case 'edit_tags':
Tag::update_tag_list($value, 'song', $this->id);
break;
default:
// Rien a faire
break;
@ -580,7 +583,7 @@ class Song extends database_object implements media
// If a field was changed then we need to flag this mofo
if ($updated) {
Flag::add($this->id,'song','retag','Interface Update');
Flag::add($this->id, 'song', 'retag', 'Interface Update');
}
return true;

View file

@ -473,7 +473,7 @@ class Tag extends database_object
* it also takes a type so that it knows how to return it, this is used
* by the formating functions of the different objects
*/
public static function get_display($tags,$element_id,$type='song')
public static function get_display($tags)
{
if (!is_array($tags)) { return ''; }
@ -482,8 +482,7 @@ class Tag extends database_object
// Iterate through the tags, format them according to type and element id
foreach ($tags as $tag_id=>$value) {
$tag = new Tag($tag_id);
$tag->format($type,$element_id);
$results .= $tag->f_name . ', ';
$results .= $tag->name . ', ';
}
$results = rtrim($results,', ');
@ -492,6 +491,40 @@ class Tag extends database_object
} // get_display
/**
* update_tag_list
* Update the tags list based on commated list (ex. tag1,tag2,tag3,..)
*/
public static function update_tag_list($tags_comma, $type, $object_id)
{
debug_event('tag.class', 'Updating tags for values {'.$tags_comma.'} type {'.$type.'} object_id {'.$object_id.'}', '5');
$ctags = Tag::get_top_tags($type, $object_id);
$editedTags = explode(",", $tags_comma);
foreach ($ctags as $ctid => $ctv) {
$ctag = new Tag($ctid);
foreach ($editedTags as $tk => $tv) {
if ($ctag->name == $tv) {
debug_event('tag.class', 'Tag {'.$ctag->name.'} already found. Do nothing.', '5');
// Removing the tag from the new tags array
unset($editedTags[$tk]);
break;
} else {
debug_event('tag.class', 'Tag {'.$ctag->name.'} not found in the new list. Delete it.', '5');
$ctag->remove_map($type, $object_id);
break;
}
}
}
// Look if we need to add some new tags
foreach ($editedTags as $tk => $tv) {
debug_event('tag.class', 'Adding new tag {'.$tv.'}', '5');
Tag::add($type, $object_id, $tv, false);
}
} // update_tag_list
/**
* count
* This returns the count for the all objects associated with this tag

View file

@ -208,14 +208,7 @@ if (session_id()) {
/* Add in some variables for ajax done here because we need the user */
Config::set('ajax_url', Config::get('web_path') . '/server/ajax.server.php', true);
?>
<script type="text/javascript">
// Using the following work-around to set ajex.server.php path available from any javascript script.
var jsAjaxUrl = "<?php echo Config::get('ajax_url') ?>";
</script>
<?php
// Load gettext mojo
load_gettext();

View file

@ -46,13 +46,13 @@ function flipField(field) {
else {
$(field).disabled = false;
}
} // flipField
}
// updateText
// Changes the specified elements innards. Used for the catalog mojo fluff.
function updateText(field, value) {
$('#'+field).html(value);
} // updateText
}
// toggleVisible
// Toggles display type between block and none. Used for ajax loading div.
@ -63,7 +63,7 @@ function toggleVisible(element) {
} else {
target.show();
}
} // toggleVisible
}
// delayRun
// This function delays the run of another function by X milliseconds
@ -79,7 +79,7 @@ function delayRun(element, time, method, page, source) {
element.zid = setTimeout(action, time);
} // delayRun
}
// reloadUtil
// Reload our util frame
@ -87,19 +87,23 @@ function delayRun(element, time, method, page, source) {
// Localplay, which don't actually prompt for a new file
function reloadUtil(target) {
$('#util_iframe').prop('src', target);
} // reloadUtil
}
// reloadRedirect
// Send them elsewhere
function reloadRedirect(target) {
window.location = target;
} // reloadRedirect
}
// This is kind of ugly. Let's not mess with it too much.
function check_inline_song_edit(type, song) {
var target = '#' + type + '_select_' + song;
if ($(target + ' option:selected').val() == -1) {
$(target).replaceWith('<input type="textbox" name="' + type + '_name" value="New ' + type + '" />');
var source = '#' + type + '_select_' + song;
if ($(source + ' option:selected').val() == -1) {
$(source).replaceWith('<input type="text" name="' + type + '_name" value="New ' + type + '" onclick="this.select();" />');
if (type == 'album') {
$(source).replaceWith('<label for="year">Year</label><input type="text" name="year" id="year" size="5" /><label for="disk">Disk #</label><input type="text" name="disk" id="disk" size="3" />');
}
}
}

View file

@ -19,23 +19,33 @@
//
function showEditDialog(edit_type, edit_id, edit_form_id, edit_title, save_title, cancel_title) {
var contentUrl = jsAjaxUrl + '?action=show_edit_object&id=' + edit_id + '&type=' + edit_type;
var saveUrl = jsAjaxUrl + '?action=edit_object&id=' + edit_id + '&type=' + edit_type;
var cancelUrl = jsAjaxUrl + '?action=cancel_edit_object&id=' + edit_id + '&type=' + edit_type; //No useful I think
var editDialogId = '<div id="editdialog"></div>';
var parent = this;
parent.editFormId = 'form#' + edit_form_id;
parent.contentUrl = jsAjaxUrl + '?action=show_edit_object&id=' + edit_id + '&type=' + edit_type;
parent.saveUrl = jsAjaxUrl + '?action=edit_object&id=' + edit_id + '&type=' + edit_type;
parent.editDialogId = '<div id="editdialog"></div>';
var dialog_buttons = {};
dialog_buttons[save_title] = function() {
$(parent.edit_form_id).submit();
ajaxPut(parent.saveUrl);
$("#editdialog").dialog("close");
parent.dialog_buttons = {};
this.dialog_buttons[save_title] = function() {
$.ajax({
url : parent.saveUrl,
type : 'POST',
data : $(parent.editFormId).serializeArray(),
success : function(resp){
$("#editdialog").dialog("close");
// Need to replace current div instead of refreshing frame.
window.location.reload();
},
error : function(resp){
$("#editdialog").dialog("close");
}
});
}
dialog_buttons[cancel_title] = function() {
this.dialog_buttons[cancel_title] = function() {
$("#editdialog").dialog("close");
}
$(editDialogId).dialog({
$(parent.editDialogId).dialog({
title: edit_title,
modal: true,
dialogClass: 'editdialogstyle',
@ -43,8 +53,16 @@ function showEditDialog(edit_type, edit_id, edit_form_id, edit_title, save_title
width: 600,
autoOpen: false,
open: function () {
$(this).load(contentUrl, function() {
$(this).load(parent.contentUrl, function() {
$(this).dialog('option', 'position', 'center');
if ($('#edit_tags').length > 0) {
$("#edit_tags").tagit({
allowSpaces: true,
singleField: true,
singleFieldDelimiter: ','
});
}
});
},
close: function (e) {

View file

@ -200,12 +200,15 @@ function show_album_select($name='album',$album_id=0,$allow_add=0,$song_id=0)
// Added ID field so we can easily observe this element
echo "<select name=\"$name\" id=\"$key\">\n";
$sql = "SELECT `id`, `name`, `prefix` FROM `album` ORDER BY `name`";
$sql = "SELECT `id`, `name`, `prefix`, `disk` FROM `album` ORDER BY `name`";
$db_results = Dba::read($sql);
while ($r = Dba::fetch_assoc($db_results)) {
$selected = '';
$album_name = trim($r['prefix'] . " " . $r['name']);
if ($r['disk'] >= 1) {
$album_name .= ' [Disk ' . $r['disk'] . ']';
}
if ($r['id'] == $album_id) {
$selected = "selected=\"selected\"";
}

View file

@ -0,0 +1,69 @@
ul.tagit {
padding: 1px 5px;
overflow: auto;
margin-left: inherit; /* usually we don't want the regular ul margins. */
margin-right: inherit;
}
ul.tagit li {
display: block;
float: left;
margin: 2px 5px 2px 0;
}
ul.tagit li.tagit-choice {
position: relative;
line-height: inherit;
}
input.tagit-hidden-field {
display: none;
}
ul.tagit li.tagit-choice-read-only {
padding: .2em .5em .2em .5em;
}
ul.tagit li.tagit-choice-editable {
padding: .2em 18px .2em .5em;
}
ul.tagit li.tagit-new {
padding: .25em 4px .25em 0;
}
ul.tagit li.tagit-choice a.tagit-label {
cursor: pointer;
text-decoration: none;
}
ul.tagit li.tagit-choice .tagit-close {
cursor: pointer;
position: absolute;
right: .1em;
top: 50%;
margin-top: -8px;
line-height: 17px;
}
/* used for some custom themes that don't need image icons */
ul.tagit li.tagit-choice .tagit-close .text-icon {
display: none;
}
ul.tagit li.tagit-choice input {
display: block;
float: left;
margin: 2px 5px 2px 0;
}
ul.tagit input[type="text"] {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
border: none;
margin: 0;
padding: 0;
width: inherit;
background-color: inherit;
outline: none;
}

17
modules/tag-it/tag-it.min.js vendored Normal file
View file

@ -0,0 +1,17 @@
(function(b){b.widget("ui.tagit",{options:{allowDuplicates:!1,caseSensitive:!0,fieldName:"tags",placeholderText:null,readOnly:!1,removeConfirmation:!1,tagLimit:null,availableTags:[],autocomplete:{},showAutocompleteOnFocus:!1,allowSpaces:!1,singleField:!1,singleFieldDelimiter:",",singleFieldNode:null,animate:!0,tabIndex:null,beforeTagAdded:null,afterTagAdded:null,beforeTagRemoved:null,afterTagRemoved:null,onTagClicked:null,onTagLimitExceeded:null,onTagAdded:null,onTagRemoved:null,tagSource:null},_create:function(){var a=
this;this.element.is("input")?(this.tagList=b("<ul></ul>").insertAfter(this.element),this.options.singleField=!0,this.options.singleFieldNode=this.element,this.element.addClass("tagit-hidden-field")):this.tagList=this.element.find("ul, ol").andSelf().last();this.tagInput=b('<input type="text" />').addClass("ui-widget-content");this.options.readOnly&&this.tagInput.attr("disabled","disabled");this.options.tabIndex&&this.tagInput.attr("tabindex",this.options.tabIndex);this.options.placeholderText&&this.tagInput.attr("placeholder",
this.options.placeholderText);this.options.autocomplete.source||(this.options.autocomplete.source=function(a,e){var d=a.term.toLowerCase(),c=b.grep(this.options.availableTags,function(a){return 0===a.toLowerCase().indexOf(d)});this.options.allowDuplicates||(c=this._subtractArray(c,this.assignedTags()));e(c)});this.options.showAutocompleteOnFocus&&(this.tagInput.focus(function(b,d){a._showAutocomplete()}),"undefined"===typeof this.options.autocomplete.minLength&&(this.options.autocomplete.minLength=
0));b.isFunction(this.options.autocomplete.source)&&(this.options.autocomplete.source=b.proxy(this.options.autocomplete.source,this));b.isFunction(this.options.tagSource)&&(this.options.tagSource=b.proxy(this.options.tagSource,this));this.tagList.addClass("tagit").addClass("ui-widget ui-widget-content ui-corner-all").append(b('<li class="tagit-new"></li>').append(this.tagInput)).click(function(d){var c=b(d.target);c.hasClass("tagit-label")?(c=c.closest(".tagit-choice"),c.hasClass("removed")||a._trigger("onTagClicked",
d,{tag:c,tagLabel:a.tagLabel(c)})):a.tagInput.focus()});var c=!1;if(this.options.singleField)if(this.options.singleFieldNode){var d=b(this.options.singleFieldNode),f=d.val().split(this.options.singleFieldDelimiter);d.val("");b.each(f,function(b,d){a.createTag(d,null,!0);c=!0})}else this.options.singleFieldNode=b('<input type="hidden" style="display:none;" value="" name="'+this.options.fieldName+'" />'),this.tagList.after(this.options.singleFieldNode);c||this.tagList.children("li").each(function(){b(this).hasClass("tagit-new")||
(a.createTag(b(this).text(),b(this).attr("class"),!0),b(this).remove())});this.tagInput.keydown(function(c){if(c.which==b.ui.keyCode.BACKSPACE&&""===a.tagInput.val()){var d=a._lastTag();!a.options.removeConfirmation||d.hasClass("remove")?a.removeTag(d):a.options.removeConfirmation&&d.addClass("remove ui-state-highlight")}else a.options.removeConfirmation&&a._lastTag().removeClass("remove ui-state-highlight");if(c.which===b.ui.keyCode.COMMA&&!1===c.shiftKey||c.which===b.ui.keyCode.ENTER||c.which==
b.ui.keyCode.TAB&&""!==a.tagInput.val()||c.which==b.ui.keyCode.SPACE&&!0!==a.options.allowSpaces&&('"'!=b.trim(a.tagInput.val()).replace(/^s*/,"").charAt(0)||'"'==b.trim(a.tagInput.val()).charAt(0)&&'"'==b.trim(a.tagInput.val()).charAt(b.trim(a.tagInput.val()).length-1)&&0!==b.trim(a.tagInput.val()).length-1))c.which===b.ui.keyCode.ENTER&&""===a.tagInput.val()||c.preventDefault(),a.options.autocomplete.autoFocus&&a.tagInput.data("autocomplete-open")||(a.tagInput.autocomplete("close"),a.createTag(a._cleanedInput()))}).blur(function(b){a.tagInput.data("autocomplete-open")||
a.createTag(a._cleanedInput())});if(this.options.availableTags||this.options.tagSource||this.options.autocomplete.source)d={select:function(b,c){a.createTag(c.item.value);return!1}},b.extend(d,this.options.autocomplete),d.source=this.options.tagSource||d.source,this.tagInput.autocomplete(d).bind("autocompleteopen.tagit",function(b,c){a.tagInput.data("autocomplete-open",!0)}).bind("autocompleteclose.tagit",function(b,c){a.tagInput.data("autocomplete-open",!1)}),this.tagInput.autocomplete("widget").addClass("tagit-autocomplete")},
destroy:function(){b.Widget.prototype.destroy.call(this);this.element.unbind(".tagit");this.tagList.unbind(".tagit");this.tagInput.removeData("autocomplete-open");this.tagList.removeClass("tagit ui-widget ui-widget-content ui-corner-all tagit-hidden-field");this.element.is("input")?(this.element.removeClass("tagit-hidden-field"),this.tagList.remove()):(this.element.children("li").each(function(){b(this).hasClass("tagit-new")?b(this).remove():(b(this).removeClass("tagit-choice ui-widget-content ui-state-default ui-state-highlight ui-corner-all remove tagit-choice-editable tagit-choice-read-only"),
b(this).text(b(this).children(".tagit-label").text()))}),this.singleFieldNode&&this.singleFieldNode.remove());return this},_cleanedInput:function(){return b.trim(this.tagInput.val().replace(/^"(.*)"$/,"$1"))},_lastTag:function(){return this.tagList.find(".tagit-choice:last:not(.removed)")},_tags:function(){return this.tagList.find(".tagit-choice:not(.removed)")},assignedTags:function(){var a=this,c=[];this.options.singleField?(c=b(this.options.singleFieldNode).val().split(this.options.singleFieldDelimiter),
""===c[0]&&(c=[])):this._tags().each(function(){c.push(a.tagLabel(this))});return c},_updateSingleTagsField:function(a){b(this.options.singleFieldNode).val(a.join(this.options.singleFieldDelimiter)).trigger("change")},_subtractArray:function(a,c){for(var d=[],f=0;f<a.length;f++)-1==b.inArray(a[f],c)&&d.push(a[f]);return d},tagLabel:function(a){return this.options.singleField?b(a).find(".tagit-label:first").text():b(a).find("input:first").val()},_showAutocomplete:function(){this.tagInput.autocomplete("search",
"")},_findTagByLabel:function(a){var c=this,d=null;this._tags().each(function(f){if(c._formatStr(a)==c._formatStr(c.tagLabel(this)))return d=b(this),!1});return d},_isNew:function(a){return!this._findTagByLabel(a)},_formatStr:function(a){return this.options.caseSensitive?a:b.trim(a.toLowerCase())},_effectExists:function(a){return Boolean(b.effects&&(b.effects[a]||b.effects.effect&&b.effects.effect[a]))},createTag:function(a,c,d){var f=this;a=b.trim(a);this.options.preprocessTag&&(a=this.options.preprocessTag(a));
if(""===a)return!1;if(!this.options.allowDuplicates&&!this._isNew(a))return a=this._findTagByLabel(a),!1!==this._trigger("onTagExists",null,{existingTag:a,duringInitialization:d})&&this._effectExists("highlight")&&a.effect("highlight"),!1;if(this.options.tagLimit&&this._tags().length>=this.options.tagLimit)return this._trigger("onTagLimitExceeded",null,{duringInitialization:d}),!1;var g=b(this.options.onTagClicked?'<a class="tagit-label"></a>':'<span class="tagit-label"></span>').text(a),e=b("<li></li>").addClass("tagit-choice ui-widget-content ui-state-default ui-corner-all").addClass(c).append(g);
this.options.readOnly?e.addClass("tagit-choice-read-only"):(e.addClass("tagit-choice-editable"),c=b("<span></span>").addClass("ui-icon ui-icon-close"),c=b('<a><span class="text-icon">\u00d7</span></a>').addClass("tagit-close").append(c).click(function(a){f.removeTag(e)}),e.append(c));this.options.singleField||(g=g.html(),e.append('<input type="hidden" value="'+g+'" name="'+this.options.fieldName+'" class="tagit-hidden-field" />'));!1!==this._trigger("beforeTagAdded",null,{tag:e,tagLabel:this.tagLabel(e),
duringInitialization:d})&&(this.options.singleField&&(g=this.assignedTags(),g.push(a),this._updateSingleTagsField(g)),this._trigger("onTagAdded",null,e),this.tagInput.val(""),this.tagInput.parent().before(e),this._trigger("afterTagAdded",null,{tag:e,tagLabel:this.tagLabel(e),duringInitialization:d}),this.options.showAutocompleteOnFocus&&!d&&setTimeout(function(){f._showAutocomplete()},0))},removeTag:function(a,c){c="undefined"===typeof c?this.options.animate:c;a=b(a);this._trigger("onTagRemoved",
null,a);if(!1!==this._trigger("beforeTagRemoved",null,{tag:a,tagLabel:this.tagLabel(a)})){if(this.options.singleField){var d=this.assignedTags(),f=this.tagLabel(a),d=b.grep(d,function(a){return a!=f});this._updateSingleTagsField(d)}if(c){a.addClass("removed");var d=this._effectExists("blind")?["blind",{direction:"horizontal"},"fast"]:["fast"],g=this;d.push(function(){a.remove();g._trigger("afterTagRemoved",null,{tag:a,tagLabel:g.tagLabel(a)})});a.fadeOut("fast").hide.apply(a,d).dequeue()}else a.remove(),
this._trigger("afterTagRemoved",null,{tag:a,tagLabel:this.tagLabel(a)})}},removeTagByLabel:function(a,b){var d=this._findTagByLabel(a);if(!d)throw"No such tag exists with the name '"+a+"'";this.removeTag(d,b)},removeAll:function(){var a=this;this._tags().each(function(b,d){a.removeTag(d,!1)})}})})(jQuery);

View file

@ -160,6 +160,7 @@ switch ($_REQUEST['action']) {
// Scrub the data
foreach ($_POST as $key => $data) {
$_POST[$key] = scrub_in($data);
debug_event('ajax_server', $key.'='.$_POST[$key], '5');
}
$level = '50';

View file

@ -30,12 +30,15 @@ switch ($_REQUEST['action']) {
break;
case 'add_tag':
debug_event('tag.ajax', 'Adding new tag...', '5');
Tag::add_tag_map($_GET['type'],$_GET['object_id'],$_GET['tag_id']);
break;
case 'add_tag_by_name':
debug_event('tag.ajax', 'Adding new tag by name...', '5');
Tag::add($_GET['type'],$_GET['object_id'],$_GET['tag_name'], false);
break;
case 'remove_tag':
debug_event('tag.ajax', 'Removing tag...', '5');
$tag = new Tag($_GET['tag_id']);
$tag->remove_map($_GET['type'],$_GET['object_id']);
break;

View file

@ -41,12 +41,14 @@ if (Config::get('use_rss')) { ?>
<title><?php echo scrub_out(Config::get('site_title')); ?> - <?php echo $location['title']; ?></title>
<?php require_once Config::get('prefix') . '/templates/stylesheets.inc.php'; ?>
<link rel="stylesheet" href="<?php echo $web_path; ?>/modules/jquery/jquery-ui.min.css" type="text/css" media="screen" />
<link rel="stylesheet" href="<?php echo $web_path; ?>/modules/tag-it/jquery.tagit.css" type="text/css" media="screen" />
<script src="<?php echo $web_path; ?>/modules/jquery/jquery.min.js" language="javascript" type="text/javascript"></script>
<script src="<?php echo $web_path; ?>/modules/jquery/jquery-ui.min.js" language="javascript" type="text/javascript"></script>
<script src="<?php echo $web_path; ?>/modules/prettyPhoto/js/jquery.prettyPhoto.js" language="javascript" type="text/javascript"></script>
<script src="<?php echo $web_path; ?>/modules/tag-it/tag-it.min.js" language="javascript" type="text/javascript"></script>
<script src="<?php echo $web_path; ?>/lib/javascript/base.js" language="javascript" type="text/javascript"></script>
<script src="<?php echo $web_path; ?>/lib/javascript/edit-dialog.js" language="javascript" type="text/javascript"></script>
<script src="<?php echo $web_path; ?>/lib/javascript/ajax.js" language="javascript" type="text/javascript"></script>
<script src="<?php echo $web_path; ?>/lib/javascript/edit-dialog.js" language="javascript" type="text/javascript"></script>
<?php
// If iframes, we check in javascript that parent container exist, otherwise we redirect to index. Otherwise HTML5 iframed Player will look broken.
if (Config::get('iframes') && $_SERVER['REQUEST_METHOD'] != 'POST') {
@ -58,6 +60,10 @@ function forceIframe()
document.location = '<?php echo $web_path; ?>?target_link=' + encodeURIComponent(document.location);
}
}
// Using the following work-around to set ajex.server.php path available from any javascript script.
var jsAjaxUrl = "<?php echo Config::get('ajax_url') ?>";
</script>
<?php
}

View file

@ -62,6 +62,8 @@ if (Art::is_enabled()) {
</a>
<?php } ?>
<?php if (Access::check('interface','50')) { ?>
<?php echo Ajax::button('?action=show_edit_object&type=album_row&id=' . $album->id,'edit', T_('Edit'),'edit_album_' . $album->id); ?>
<a id="<?php echo 'edit_song_'.$song->id ?>" onclick="showEditDialog('album_row', '<?php echo $album->id ?>', '<?php echo 'edit_album_'.$album->id ?>', '<?php echo T_('Album edit') ?>', '<?php echo T_('Save') ?>', '<?php echo T_('Cancel') ?>')">
<?php echo UI::get_icon('edit', T_('Edit')); ?>
</a>
<?php } ?>
</td>

View file

@ -47,6 +47,8 @@
</a>
<?php } ?>
<?php if (Access::check('interface','50')) { ?>
<?php echo Ajax::button('?action=show_edit_object&type=artist_row&id=' . $artist->id,'edit', T_('Edit'),'edit_artist_' . $artist->id); ?>
<a id="<?php echo 'edit_artist_'.$artist->id ?>" onclick="showEditDialog('artist_row', '<?php echo $artist->id ?>', '<?php echo 'edit_artist_'.$artist->id ?>', '<?php echo T_('Artist edit') ?>', '<?php echo T_('Save') ?>', '<?php echo T_('Cancel') ?>')">
<?php echo UI::get_icon('edit', T_('Edit')); ?>
</a>
<?php } ?>
</td>

View file

@ -20,35 +20,41 @@
*
*/
?>
<td colspan="7">
<form method="post" id="edit_album_<?php echo $album->id; ?>" action="#">
<table class="inline-edit" cellpadding="3" cellspacing="0">
<div>
<form method="post" id="edit_album_<?php echo $album->id; ?>" class="edit_dialog_content">
<table>
<tr>
<td>
<input type="text" name="name" value="<?php echo scrub_out($album->full_name); ?>" />
</td>
<td class="edit_dialog_content_header"><?php echo T_('Name') ?></td>
<td><input type="text" name="name" value="<?php echo scrub_out($album->full_name); ?>" /></td>
</tr>
<tr>
<td class="edit_dialog_content_header"><?php echo T_('Artist') ?></td>
<td>
<?php
if ($album->artist_count == '1') {
show_artist_select('artist',$album->artist_id);
show_artist_select('artist', $album->artist_id);
} else {
echo T_('Various');
}
?>
</td>
</tr>
<tr>
<td class="edit_dialog_content_header"><?php echo T_('Year') ?></td>
<td><input type="text" name="year" size="3" value="<?php echo scrub_out($album->year); ?>" /></td>
</tr>
<tr>
<td class="edit_dialog_content_header"><?php echo T_('Disk') ?></td>
<td><input type="text" name="disk" size="3" value="<?php echo scrub_out($album->disk); ?>" /></td>
</tr>
<tr>
<td class="edit_dialog_content_header"><?php echo T_('Tags') ?></td>
<td>
<input type="text" name="year" value="<?php echo scrub_out($album->year); ?>" />
</td>
<td>
<input type="text" name="disk" value="<?php echo scrub_out($album->disk); ?>" />
</td>
<td>
<input type="hidden" name="id" value="<?php echo $album->id; ?>" />
<input type="hidden" name="type" value="album_row" />
<?php echo Ajax::button('?action=edit_object&id=' . $album->id . '&type=album_row','download', T_('Save Changes'),'save_album_' . $album->id,'edit_album_' . $album->id); ?>
<?php echo Ajax::button('?action=cancel_edit_object&id=' . $album->id . '&type=album_row','cancel', T_('Cancel Changes'),'cancel_album_' . $album->id,'edit_album_' . $album->id); ?>
<input type="text" name="edit_tags" id="edit_tags" value="<?php echo Tag::get_display($album->tags); ?>" />
</td>
</tr>
</table>
<input type="hidden" name="id" value="<?php echo $album->id; ?>" />
<input type="hidden" name="type" value="album_row" />
</form>
</td>
</div>

View file

@ -20,20 +20,21 @@
*
*/
?>
<td colspan="5">
<form method="post" id="edit_artist_<?php echo $artist->id; ?>">
<table class="inline-edit" cellpadding="3" cellspacing="0">
<div>
<form method="post" id="edit_artist_<?php echo $artist->id; ?>" class="edit_dialog_content">
<table>
<tr>
<td class="edit_dialog_content_header"><?php echo T_('Name') ?></td>
<td><input type="text" name="name" value="<?php echo scrub_out($artist->f_full_name); ?>" /></td>
</tr>
<tr>
<td class="edit_dialog_content_header"><?php echo T_('Tags') ?></td>
<td>
<input type="text" name="name" value="<?php echo scrub_out($artist->f_full_name); ?>" />
</td>
<td>
<input type="hidden" name="id" value="<?php echo $artist->id; ?>" />
<input type="hidden" name="type" value="artist_row" />
<?php echo Ajax::button('?action=edit_object&id=' . $artist->id . '&type=artist_row','download', T_('Save Changes'),'save_artist_' . $artist->id,'edit_artist_' . $artist->id); ?>
<?php echo Ajax::button('?action=cancel_edit_object&id=' . $artist->id . '&type=artist_row','cancel', T_('Cancel Changes'),'cancel_artist_' . $artist->id,'edit_artist_' . $artist->id); ?>
<input type="text" name="edit_tags" id="edit_tags" value="<?php echo Tag::get_display($artist->tags); ?>" />
</td>
</tr>
</table>
<input type="hidden" name="id" value="<?php echo $artist->id; ?>" />
<input type="hidden" name="type" value="artist_row" />
</form>
</td>
</div>

View file

@ -29,16 +29,32 @@
</tr>
<tr>
<td class="edit_dialog_content_header"><?php echo T_('Artist') ?></td>
<td><?php show_artist_select('artist', $song->artist, true, $song->id); ?></td>
<td>
<?php show_artist_select('artist', $song->artist, true, $song->id); ?>
<div id="artist_select_song_<?php echo $song->id ?>">
<?php echo Ajax::observe('artist_select_'.$song->id, 'change', 'check_inline_song_edit("artist", '.$song->id.')'); ?>
</div>
</td>
</tr>
<tr>
<td class="edit_dialog_content_header"><?php echo T_('Album') ?></td>
<td><?php show_album_select('album',$song->album,true,$song->id); ?></td>
<td>
<?php show_album_select('album', $song->album, true, $song->id); ?>
<div id="album_select_song_<?php echo $song->id ?>">
<?php echo Ajax::observe('album_select_'.$song->id, 'change', 'check_inline_song_edit("album", '.$song->id.')'); ?>
</div>
</td>
</tr>
<tr>
<td class="edit_dialog_content_header"><?php echo T_('Track') ?></td>
<td><input type="text" name="track" size="3" value="<?php echo scrub_out($song->track); ?>" /></td>
</tr>
<tr>
<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($song->tags); ?>" />
</td>
</tr>
</table>
<input type="hidden" name="id" value="<?php echo $song->id; ?>" />
<input type="hidden" name="type" value="song_row" />

View file

@ -31,15 +31,7 @@
<td class="cel_song"><?php echo $song->f_link; ?></a></td>
<td class="cel_artist"><?php echo $song->f_artist_link; ?></td>
<td class="cel_album"><?php echo $song->f_album_link; ?></td>
<td class="cel_tags">
<span id="tag_song_<?php echo $song->id?>" onclick="showAddTagSlideout('#dialog_tag_item_<?php echo $song->id?>')"><?php echo UI::get_icon('add_tag', T_('Add')); ?></span><?php echo $song->f_tags; ?>
<div id="dialog_tag_item_<?php echo $song->id?>" style="display:none;" class="np_add_tag">
<div><?php echo T_('Enter tag:')?></div>
<div><input type="text" id="dialog_tag_item_tag_name_<?php echo $song->id?>"/></div>
<div><input type="button" value="<?php echo T_('Save')?>" onclick="saveTag(<?php echo $song->id?>, 'song', '<?php echo Config::get('web_path'); ?>')" /></div>
<div><input type="button" value="<?php echo T_('Close')?>" onclick="closeAddTagSlideout('#dialog_tag_item_<?php echo $song->id?>')" /> </div>
</div>
</td>
<td class="cel_tags"><?php echo $song->f_tags; ?></td>
<td class="cel_track"><?php echo $song->f_track; ?></td>
<td class="cel_time"><?php echo $song->f_time; ?></td>
<?php if (Config::get('ratings')) { ?>
@ -58,13 +50,9 @@
<?php if (Access::check_function('download')) { ?>
<a href="<?php echo Config::get('web_path'); ?>/stream.php?action=download&amp;song_id=<?php echo $song->id; ?>"><?php echo UI::get_icon('download', T_('Download')); ?></a><?php } ?>
<?php if (Access::check('interface','75')) { ?>
<span id="<?php echo 'edit_song_'.$song->id ?>" onclick="showEditDialog('song_row', '<?php echo $song->id ?>', '<?php echo 'edit_song_'.$song->id ?>', '<?php echo T_('Song edit') ?>', '<?php echo T_('Save') ?>', '<?php echo T_('Cancel') ?>')">
<a id="<?php echo 'edit_song_'.$song->id ?>" onclick="showEditDialog('song_row', '<?php echo $song->id ?>', '<?php echo 'edit_song_'.$song->id ?>', '<?php echo T_('Song edit') ?>', '<?php echo T_('Save') ?>', '<?php echo T_('Cancel') ?>')">
<?php echo UI::get_icon('edit', T_('Edit')); ?>
</span>
<?php /*echo Ajax::button('?action=show_edit_object&type=song_row&id=' . $song->id,'edit', T_('Edit'),'edit_song_' . $song->id);*/ ?>
</a>
<?php $icon = $song->enabled ? 'disable' : 'enable'; ?>
<?php $button_flip_state_id = 'button_flip_state_' . $song_id; ?>
<span id="<?php echo($button_flip_state_id); ?>">