CC-4735: Library: Edit metadata selection should be a popup instead of going to a new page
-done
This commit is contained in:
parent
1846f17bbc
commit
062740ef81
|
@ -18,6 +18,7 @@ class LibraryController extends Zend_Controller_Action
|
|||
->addActionContext('upload-file-soundcloud', 'json')
|
||||
->addActionContext('get-upload-to-soundcloud-status', 'json')
|
||||
->addActionContext('set-num-entries', 'json')
|
||||
->addActionContext('edit-file-md', 'json')
|
||||
->initContext();
|
||||
}
|
||||
|
||||
|
@ -384,12 +385,17 @@ class LibraryController extends Zend_Controller_Action
|
|||
}
|
||||
|
||||
$form = new Application_Form_EditAudioMD();
|
||||
$form->startForm($file_id);
|
||||
$form->populate($file->getDbColMetadata());
|
||||
|
||||
if ($request->isPost()) {
|
||||
if ($form->isValid($request->getPost())) {
|
||||
|
||||
$formdata = $form->getValues();
|
||||
$formValues = $this->_getParam('data', null);
|
||||
$formdata = array();
|
||||
foreach ($formValues as $val) {
|
||||
$formdata[$val["name"]] = $val["value"];
|
||||
}
|
||||
$file->setDbColMetadata($formdata);
|
||||
|
||||
$data = $file->getMetadata();
|
||||
|
@ -404,6 +410,7 @@ class LibraryController extends Zend_Controller_Action
|
|||
}
|
||||
|
||||
$this->view->form = $form;
|
||||
$this->view->dialog = $this->view->render('library/edit-file-md.phtml');
|
||||
}
|
||||
|
||||
public function getFileMetadataAction()
|
||||
|
|
|
@ -2,12 +2,18 @@
|
|||
|
||||
class Application_Form_EditAudioMD extends Zend_Form
|
||||
{
|
||||
public function init()
|
||||
|
||||
public function init() {}
|
||||
|
||||
public function startForm($p_id)
|
||||
{
|
||||
$baseUrl = Application_Common_OsPath::getBaseDir();
|
||||
// Set the method for the display form to POST
|
||||
$this->setMethod('post');
|
||||
|
||||
$this->addElement('hidden', 'file_id', array(
|
||||
'value' => $p_id
|
||||
));
|
||||
// Add title field
|
||||
$this->addElement('text', 'track_title', array(
|
||||
'label' => _('Title:'),
|
||||
|
@ -122,7 +128,7 @@ class Application_Form_EditAudioMD extends Zend_Form
|
|||
));
|
||||
|
||||
// Add the submit button
|
||||
$this->addElement('submit', 'submit', array(
|
||||
$this->addElement('button', 'editmdsave', array(
|
||||
'ignore' => true,
|
||||
'class' => 'btn',
|
||||
'label' => _('Save'),
|
||||
|
@ -142,7 +148,7 @@ class Application_Form_EditAudioMD extends Zend_Form
|
|||
)
|
||||
));
|
||||
|
||||
$this->addDisplayGroup(array('submit', 'cancel'), 'submitButtons', array(
|
||||
$this->addDisplayGroup(array('editmdsave', 'cancel'), 'submitButtons', array(
|
||||
'decorators' => array(
|
||||
'FormElements',
|
||||
'DtDdWrapper'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<div class="ui-widget ui-widget-content block-shadow simple-formblock clearfix padded-strong">
|
||||
<div class="ui-widget ui-widget-content block-shadow simple-formblock clearfix padded-strong" id="edit-md-dialog">
|
||||
<h2><? echo _("Edit Metadata") ?></h2>
|
||||
|
||||
<?php //$this->form->setAction($this->url());
|
||||
|
|
|
@ -796,7 +796,9 @@ var AIRTIME = (function(AIRTIME) {
|
|||
|
||||
if (data.ftype === "audioclip") {
|
||||
callback = function() {
|
||||
document.location.href = oItems.edit.url;
|
||||
$.get(oItems.edit.url, {format: "json"}, function(json){
|
||||
buildEditMetadataDialog(json);
|
||||
});
|
||||
};
|
||||
} else if (data.ftype === "playlist" || data.ftype === "block") {
|
||||
callback = function() {
|
||||
|
@ -940,6 +942,34 @@ var AIRTIME = (function(AIRTIME) {
|
|||
|
||||
}(AIRTIME || {}));
|
||||
|
||||
function buildEditMetadataDialog (json){
|
||||
var dialog = $(json.dialog);
|
||||
|
||||
dialog.dialog({
|
||||
autoOpen: false,
|
||||
title: $.i18n._("Edit Metadata"),
|
||||
width: 460,
|
||||
height: 700,
|
||||
modal: true,
|
||||
close: closeDialog,
|
||||
buttons: [
|
||||
{
|
||||
text: $.i18n._("Ok"),
|
||||
"class": "btn",
|
||||
click: function() {
|
||||
dialog.remove();
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
dialog.dialog('open');
|
||||
}
|
||||
|
||||
function closeDialog(event, ui) {
|
||||
$(this).remove();
|
||||
}
|
||||
|
||||
function checkImportStatus() {
|
||||
$.getJSON(baseUrl+'/Preference/is-import-in-progress', function(data){
|
||||
var div = $('#import_status');
|
||||
|
@ -1234,3 +1264,13 @@ var validationTypes = {
|
|||
"info_url" : "s",
|
||||
"year" : "i"
|
||||
};
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#editmdsave').live("click", function() {
|
||||
var file_id = $('#file_id').val(),
|
||||
data = $("#edit-md-dialog form").serializeArray();
|
||||
$.post(baseUrl+'/library/edit-file-md', {format: "json", id: file_id, data: data}, function() {
|
||||
$("#edit-md-dialog").dialog().remove();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue