Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
efa5f6ff6c
4 changed files with 57 additions and 9 deletions
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -382,14 +383,19 @@ class LibraryController extends Zend_Controller_Action
|
||||||
if (!$isAdminOrPM && $file->getFileOwnerId() != $user->getId()) {
|
if (!$isAdminOrPM && $file->getFileOwnerId() != $user->getId()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$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'),
|
||||||
|
@ -132,17 +138,16 @@ class Application_Form_EditAudioMD extends Zend_Form
|
||||||
));
|
));
|
||||||
|
|
||||||
// Add the submit button
|
// Add the submit button
|
||||||
$this->addElement('button', 'cancel', array(
|
$this->addElement('button', 'editmdcancel', array(
|
||||||
'ignore' => true,
|
'ignore' => true,
|
||||||
'class' => 'btn md-cancel',
|
'class' => 'btn md-cancel',
|
||||||
'label' => _('Cancel'),
|
'label' => _('Cancel'),
|
||||||
'onclick' => 'javascript:document.location.href="'.$baseUrl.'/Library"',
|
|
||||||
'decorators' => array(
|
'decorators' => array(
|
||||||
'ViewHelper'
|
'ViewHelper'
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->addDisplayGroup(array('submit', 'cancel'), 'submitButtons', array(
|
$this->addDisplayGroup(array('editmdsave', 'editmdcancel'), '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,25 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
|
|
||||||
}(AIRTIME || {}));
|
}(AIRTIME || {}));
|
||||||
|
|
||||||
|
function buildEditMetadataDialog (json){
|
||||||
|
var dialog = $(json.dialog);
|
||||||
|
|
||||||
|
dialog.dialog({
|
||||||
|
autoOpen: false,
|
||||||
|
title: $.i18n._("Edit Metadata"),
|
||||||
|
width: 460,
|
||||||
|
height: 660,
|
||||||
|
modal: true,
|
||||||
|
close: closeDialog
|
||||||
|
});
|
||||||
|
|
||||||
|
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 +1255,18 @@ 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();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#editmdcancel').live("click", function() {
|
||||||
|
$("#edit-md-dialog").dialog().remove();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue