Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
7f8b5ab92e
|
@ -96,10 +96,14 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$this->view->html = $this->view->render($viewPath);
|
||||
unset($this->view->obj);
|
||||
}
|
||||
} else {
|
||||
if ($isJson) {
|
||||
return $this->view->render($viewPath);
|
||||
} else {
|
||||
$this->view->html = $this->view->render($viewPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function playlistOutdated($e)
|
||||
{
|
||||
|
@ -112,13 +116,19 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$this->createFullResponse($obj);
|
||||
}
|
||||
|
||||
private function playlistNotFound($p_type)
|
||||
private function playlistNotFound($p_type, $p_isJson = false)
|
||||
{
|
||||
$p_type = ucfirst($p_type);
|
||||
$this->view->error = "{$p_type} not found";
|
||||
|
||||
Logging::info("{$p_type} not found");
|
||||
Application_Model_Library::changePlaylist(null, $p_type);
|
||||
|
||||
if (!$p_isJson) {
|
||||
$this->createFullResponse(null);
|
||||
} else {
|
||||
die(json_encode(array("error"=>$this->view->error, "result"=>1, "html"=>$this->createFullResponse(null, $p_isJson))));
|
||||
}
|
||||
}
|
||||
|
||||
private function playlistNoPermission($p_type)
|
||||
|
@ -278,6 +288,8 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$this->wrongTypeToPlaylist($obj);
|
||||
} catch (BlockDynamicException $e) {
|
||||
$this->blockDynamic($obj);
|
||||
} catch (BlockNotFoundException $e) {
|
||||
$this->playlistNotFound($obj_type);
|
||||
} catch (Exception $e) {
|
||||
$this->playlistUnknownError($e);
|
||||
}
|
||||
|
@ -447,13 +459,12 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$params = $request->getPost();
|
||||
$result = array();
|
||||
|
||||
$this->setPlaylistNameDescAction();
|
||||
|
||||
if ($params['type'] == 'block') {
|
||||
$form = new Application_Form_SmartBlockCriteria();
|
||||
$form->startForm($params['obj_id']);
|
||||
$bl = new Application_Model_Block($params['obj_id']);
|
||||
if ($form->isValid($params)) {
|
||||
$this->setPlaylistNameDescAction();
|
||||
$bl->saveSmartBlockCriteria($params['data']);
|
||||
$result['html'] = $this->createFullResponse($bl, true, true);
|
||||
$result['result'] = 0;
|
||||
|
@ -461,10 +472,14 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$this->view->obj = $bl;
|
||||
$this->view->id = $bl->getId();
|
||||
$this->view->form = $form;
|
||||
$this->view->unsavedName = $params['name'];
|
||||
$this->view->unsavedDesc = $params['description'];
|
||||
$viewPath = 'playlist/smart-block.phtml';
|
||||
$result['html'] = $this->view->render($viewPath);
|
||||
$result['result'] = 1;
|
||||
}
|
||||
} else if ($params['type'] == 'playlist') {
|
||||
$this->setPlaylistNameDescAction();
|
||||
}
|
||||
|
||||
$result["modified"] = $this->view->modified;
|
||||
|
@ -475,18 +490,16 @@ class PlaylistController extends Zend_Controller_Action
|
|||
{
|
||||
$request = $this->getRequest();
|
||||
$params = $request->getPost();
|
||||
|
||||
//make sure block exists
|
||||
try {
|
||||
$bl = new Application_Model_Block($params['obj_id']);
|
||||
|
||||
$form = new Application_Form_SmartBlockCriteria();
|
||||
$form->startForm($params['obj_id']);
|
||||
$bl = new Application_Model_Block($params['obj_id']);
|
||||
if ($form->isValid($params)) {
|
||||
$result = $bl->generateSmartBlock($params['data']);
|
||||
try {
|
||||
die(json_encode(array("result"=>0, "html"=>$this->createFullResponse($bl, true, true))));
|
||||
} catch (PlaylistNotFoundException $e) {
|
||||
$this->playlistNotFound('block');
|
||||
} catch (Exception $e) {
|
||||
$this->playlistUnknownError($e);
|
||||
}
|
||||
} else {
|
||||
$this->view->obj = $bl;
|
||||
$this->view->id = $bl->getId();
|
||||
|
@ -496,24 +509,31 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$result['result'] = 1;
|
||||
die(json_encode($result));
|
||||
}
|
||||
} catch (BlockNotFoundException $e) {
|
||||
$this->playlistNotFound('block', true);
|
||||
} catch (Exception $e) {
|
||||
$this->playlistUnknownError($e);
|
||||
}
|
||||
}
|
||||
|
||||
public function smartBlockShuffleAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$params = $request->getPost();
|
||||
try {
|
||||
$bl = new Application_Model_Block($params['obj_id']);
|
||||
$result = $bl->shuffleSmartBlock();
|
||||
|
||||
if ($result['result'] == 0) {
|
||||
try {
|
||||
die(json_encode(array("result"=>0, "html"=>$this->createFullResponse($bl, true))));
|
||||
} catch (PlaylistNotFoundException $e) {
|
||||
$this->playlistNotFound('block');
|
||||
}
|
||||
} else {
|
||||
die(json_encode($result));
|
||||
}
|
||||
} catch (BlockNotFoundException $e) {
|
||||
$this->playlistNotFound('block', true);
|
||||
} catch (Exception $e) {
|
||||
$this->playlistUnknownError($e);
|
||||
}
|
||||
}
|
||||
|
||||
public function getBlockInfoAction()
|
||||
|
|
|
@ -137,7 +137,7 @@ class Application_Form_EditAudioMD extends Zend_Form
|
|||
'ignore' => true,
|
||||
'class' => 'ui-button ui-state-default ui-button-text-only md-cancel',
|
||||
'label' => 'Cancel',
|
||||
'onclick' => 'javascript:document.location.href = "/Playlist"',
|
||||
'onclick' => 'javascript:document.location.href = "/Library"',
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
|
|
|
@ -18,8 +18,11 @@ class Application_Form_RegisterAirtime extends Zend_Form
|
|||
}
|
||||
|
||||
$this->setDecorators(array(
|
||||
array('ViewScript', array('viewScript' => 'form/register-dialog.phtml', 'privacyChecked'=>$privacyChecked)),
|
||||
array('File', array('viewScript' => 'form/register-dialog.phtml', 'placement' => false)))
|
||||
array('ViewScript', array('viewScript' =>
|
||||
'form/register-dialog.phtml', 'privacyChecked'=>$privacyChecked)),
|
||||
|
||||
array('File', array('viewScript' => 'form/register-dialog.phtml',
|
||||
'placement' => false)))
|
||||
);
|
||||
|
||||
// Station Name
|
||||
|
|
|
@ -9,8 +9,8 @@ class Application_Model_Datatables
|
|||
$isRange = false;
|
||||
if (strstr($term, '~')) {
|
||||
$info = explode('~', $term);
|
||||
$input1 = isset($info[0])?$info[0]:null;
|
||||
$input2 = isset($info[1])?$info[1]:null;
|
||||
$input1 = isset($info[0])?Application_Common_DateHelper::ConvertToUtcDateTimeString($info[0]):null;
|
||||
$input2 = isset($info[1])?Application_Common_DateHelper::ConvertToUtcDateTimeString($info[1]):null;
|
||||
$isRange = true;
|
||||
} else {
|
||||
$input1 = $term;
|
||||
|
|
|
@ -19,7 +19,12 @@ if (isset($this->obj)) {
|
|||
<input id='obj_type' type='hidden' value='block'></input>
|
||||
<div class="playlist_title">
|
||||
<h3 id="obj_name">
|
||||
<a id="playlist_name_display" contenteditable="true"><?php echo $this->obj->getName(); ?></a>
|
||||
<a id="playlist_name_display" contenteditable="true">
|
||||
<?php
|
||||
if (isset($this->unsavedName)) echo $this->unsavedName;
|
||||
else echo $this->obj->getName();
|
||||
?>
|
||||
</a>
|
||||
</h3>
|
||||
<h4 id="obj_length"><?php echo $this->length; ?></h4>
|
||||
</div>
|
||||
|
@ -30,7 +35,10 @@ if (isset($this->obj)) {
|
|||
<dl class="zend_form">
|
||||
<dt id="description-label"><label for="description">Description</label></dt>
|
||||
<dd id="description-element">
|
||||
<textarea cols="80" rows="24" id="description" name="description"><?php echo $this->obj->getDescription(); ?></textarea>
|
||||
<textarea cols="80" rows="24" id="description" name="description"><?php
|
||||
if (isset($this->unsavedDesc)) echo $this->unsavedDesc;
|
||||
else echo $this->obj->getDescription();?>
|
||||
</textarea>
|
||||
</dd>
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
|
|
@ -141,7 +141,11 @@ var AIRTIME = (function(AIRTIME){
|
|||
if (aMediaIds.length > 0) {
|
||||
AIRTIME.playlist.fnAddItems(aMediaIds, undefined, 'after');
|
||||
} else {
|
||||
if ($('#obj_type').val() == 'block') {
|
||||
alert('You can only add tracks to smart blocks.');
|
||||
} else if ($('#obj_type').val() == 'playlist') {
|
||||
alert('You can only add tracks and smart blocks to playlists.');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -437,6 +437,9 @@ function callback(data, type) {
|
|||
dt = $('table[id="library_display"]').dataTable();
|
||||
|
||||
if (type == 'shuffle' || type == 'generate') {
|
||||
if (json.error !== undefined) {
|
||||
alert(json.error);
|
||||
}
|
||||
AIRTIME.playlist.fnOpenPlaylist(json);
|
||||
var form = $('#smart-block-form');
|
||||
if (json.result == "0") {
|
||||
|
|
|
@ -109,6 +109,7 @@ CREATE TABLE cc_webstream_metadata (
|
|||
ALTER TABLE cc_files
|
||||
DROP COLUMN gunid,
|
||||
ADD COLUMN replay_gain character varying(16),
|
||||
ADD COLUMN owner_id integer;
|
||||
ALTER COLUMN bpm TYPE integer using airtime_to_int(bpm) /* TYPE change - table: cc_files original: character varying(8) new: integer */;
|
||||
|
||||
ALTER TABLE cc_playlistcontents
|
||||
|
@ -159,3 +160,9 @@ ALTER TABLE cc_webstream_metadata
|
|||
ADD CONSTRAINT cc_schedule_inst_fkey FOREIGN KEY (instance_id) REFERENCES cc_schedule(id) ON DELETE CASCADE;
|
||||
|
||||
DROP FUNCTION airtime_to_int(chartoconvert character varying);
|
||||
|
||||
UPDATE cc_files
|
||||
SET owner_id=(SELECT id FROM cc_subjs WHERE type='A' LIMIT 1)
|
||||
WHERE owner_id is NULL
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue