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('upload-file-soundcloud', 'json')
|
||||||
->addActionContext('get-upload-to-soundcloud-status', 'json')
|
->addActionContext('get-upload-to-soundcloud-status', 'json')
|
||||||
->addActionContext('set-num-entries', 'json')
|
->addActionContext('set-num-entries', 'json')
|
||||||
|
->addActionContext('edit-file-md', 'json')
|
||||||
->initContext();
|
->initContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -384,12 +385,17 @@ class LibraryController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
|
|
||||||
$form = new Application_Form_EditAudioMD();
|
$form = new Application_Form_EditAudioMD();
|
||||||
|
$form->startForm($file_id);
|
||||||
$form->populate($file->getDbColMetadata());
|
$form->populate($file->getDbColMetadata());
|
||||||
|
|
||||||
if ($request->isPost()) {
|
if ($request->isPost()) {
|
||||||
if ($form->isValid($request->getPost())) {
|
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);
|
$file->setDbColMetadata($formdata);
|
||||||
|
|
||||||
$data = $file->getMetadata();
|
$data = $file->getMetadata();
|
||||||
|
@ -404,6 +410,7 @@ class LibraryController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->view->form = $form;
|
$this->view->form = $form;
|
||||||
|
$this->view->dialog = $this->view->render('library/edit-file-md.phtml');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFileMetadataAction()
|
public function getFileMetadataAction()
|
||||||
|
|
|
@ -2,12 +2,18 @@
|
||||||
|
|
||||||
class Application_Form_EditAudioMD extends Zend_Form
|
class Application_Form_EditAudioMD extends Zend_Form
|
||||||
{
|
{
|
||||||
public function init()
|
|
||||||
|
public function init() {}
|
||||||
|
|
||||||
|
public function startForm($p_id)
|
||||||
{
|
{
|
||||||
$baseUrl = Application_Common_OsPath::getBaseDir();
|
$baseUrl = Application_Common_OsPath::getBaseDir();
|
||||||
// Set the method for the display form to POST
|
// Set the method for the display form to POST
|
||||||
$this->setMethod('post');
|
$this->setMethod('post');
|
||||||
|
|
||||||
|
$this->addElement('hidden', 'file_id', array(
|
||||||
|
'value' => $p_id
|
||||||
|
));
|
||||||
// Add title field
|
// Add title field
|
||||||
$this->addElement('text', 'track_title', array(
|
$this->addElement('text', 'track_title', array(
|
||||||
'label' => _('Title:'),
|
'label' => _('Title:'),
|
||||||
|
@ -122,7 +128,7 @@ class Application_Form_EditAudioMD extends Zend_Form
|
||||||
));
|
));
|
||||||
|
|
||||||
// Add the submit button
|
// Add the submit button
|
||||||
$this->addElement('submit', 'submit', array(
|
$this->addElement('button', 'editmdsave', array(
|
||||||
'ignore' => true,
|
'ignore' => true,
|
||||||
'class' => 'btn',
|
'class' => 'btn',
|
||||||
'label' => _('Save'),
|
'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(
|
'decorators' => array(
|
||||||
'FormElements',
|
'FormElements',
|
||||||
'DtDdWrapper'
|
'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>
|
<h2><? echo _("Edit Metadata") ?></h2>
|
||||||
|
|
||||||
<?php //$this->form->setAction($this->url());
|
<?php //$this->form->setAction($this->url());
|
||||||
|
|
|
@ -796,7 +796,9 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
|
|
||||||
if (data.ftype === "audioclip") {
|
if (data.ftype === "audioclip") {
|
||||||
callback = function() {
|
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") {
|
} else if (data.ftype === "playlist" || data.ftype === "block") {
|
||||||
callback = function() {
|
callback = function() {
|
||||||
|
@ -940,6 +942,34 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
|
|
||||||
}(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() {
|
function checkImportStatus() {
|
||||||
$.getJSON(baseUrl+'/Preference/is-import-in-progress', function(data){
|
$.getJSON(baseUrl+'/Preference/is-import-in-progress', function(data){
|
||||||
var div = $('#import_status');
|
var div = $('#import_status');
|
||||||
|
@ -1234,3 +1264,13 @@ var validationTypes = {
|
||||||
"info_url" : "s",
|
"info_url" : "s",
|
||||||
"year" : "i"
|
"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