Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
7f8b5ab92e
|
@ -405,9 +405,9 @@ class ApiController extends Zend_Controller_Action
|
|||
|
||||
public function uploadRecordedAction()
|
||||
{
|
||||
$show_instance_id = $this->_getParam('showinstanceid');
|
||||
$file_id = $this->_getParam('fileid');
|
||||
$this->view->fileid = $file_id;
|
||||
$show_instance_id = $this->_getParam('showinstanceid');
|
||||
$file_id = $this->_getParam('fileid');
|
||||
$this->view->fileid = $file_id;
|
||||
$this->view->showinstanceid = $show_instance_id;
|
||||
$this->uploadRecordedActionParam($show_instance_id, $file_id);
|
||||
}
|
||||
|
|
|
@ -271,10 +271,10 @@ class LibraryController extends Zend_Controller_Action
|
|||
$user = Application_Model_User::getCurrentUser();
|
||||
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
|
||||
|
||||
$files = array();
|
||||
$files = array();
|
||||
$playlists = array();
|
||||
$blocks = array();
|
||||
$streams = array();
|
||||
$blocks = array();
|
||||
$streams = array();
|
||||
|
||||
$message = null;
|
||||
|
||||
|
|
|
@ -97,7 +97,11 @@ class PlaylistController extends Zend_Controller_Action
|
|||
unset($this->view->obj);
|
||||
}
|
||||
} else {
|
||||
$this->view->html = $this->view->render($viewPath);
|
||||
if ($isJson) {
|
||||
return $this->view->render($viewPath);
|
||||
} else {
|
||||
$this->view->html = $this->view->render($viewPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
$this->createFullResponse(null);
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -446,14 +458,13 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$request = $this->getRequest();
|
||||
$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,26 +490,29 @@ class PlaylistController extends Zend_Controller_Action
|
|||
{
|
||||
$request = $this->getRequest();
|
||||
$params = $request->getPost();
|
||||
$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 {
|
||||
|
||||
//make sure block exists
|
||||
try {
|
||||
$bl = new Application_Model_Block($params['obj_id']);
|
||||
|
||||
$form = new Application_Form_SmartBlockCriteria();
|
||||
$form->startForm($params['obj_id']);
|
||||
if ($form->isValid($params)) {
|
||||
$result = $bl->generateSmartBlock($params['data']);
|
||||
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();
|
||||
$this->view->form = $form;
|
||||
$viewPath = 'playlist/smart-block.phtml';
|
||||
$result['html'] = $this->view->render($viewPath);
|
||||
$result['result'] = 1;
|
||||
die(json_encode($result));
|
||||
}
|
||||
} else {
|
||||
$this->view->obj = $bl;
|
||||
$this->view->id = $bl->getId();
|
||||
$this->view->form = $form;
|
||||
$viewPath = 'playlist/smart-block.phtml';
|
||||
$result['html'] = $this->view->render($viewPath);
|
||||
$result['result'] = 1;
|
||||
die(json_encode($result));
|
||||
} catch (BlockNotFoundException $e) {
|
||||
$this->playlistNotFound('block', true);
|
||||
} catch (Exception $e) {
|
||||
$this->playlistUnknownError($e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -502,17 +520,19 @@ class PlaylistController extends Zend_Controller_Action
|
|||
{
|
||||
$request = $this->getRequest();
|
||||
$params = $request->getPost();
|
||||
$bl = new Application_Model_Block($params['obj_id']);
|
||||
$result = $bl->shuffleSmartBlock();
|
||||
|
||||
if ($result['result'] == 0) {
|
||||
try {
|
||||
try {
|
||||
$bl = new Application_Model_Block($params['obj_id']);
|
||||
$result = $bl->shuffleSmartBlock();
|
||||
|
||||
if ($result['result'] == 0) {
|
||||
die(json_encode(array("result"=>0, "html"=>$this->createFullResponse($bl, true))));
|
||||
} catch (PlaylistNotFoundException $e) {
|
||||
$this->playlistNotFound('block');
|
||||
} else {
|
||||
die(json_encode($result));
|
||||
}
|
||||
} else {
|
||||
die(json_encode($result));
|
||||
} catch (BlockNotFoundException $e) {
|
||||
$this->playlistNotFound('block', true);
|
||||
} catch (Exception $e) {
|
||||
$this->playlistUnknownError($e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
@ -36,7 +39,7 @@ class Application_Form_RegisterAirtime extends Zend_Form
|
|||
'label' => 'Phone:',
|
||||
'required' => false,
|
||||
'filters' => array('StringTrim'),
|
||||
'value' => Application_Model_Preference::GetPhone(),
|
||||
'value' => Application_Model_Preference::GetPhone(),
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
|
@ -48,7 +51,7 @@ class Application_Form_RegisterAirtime extends Zend_Form
|
|||
'label' => 'Email:',
|
||||
'required' => false,
|
||||
'filters' => array('StringTrim'),
|
||||
'value' => Application_Model_Preference::GetEmail(),
|
||||
'value' => Application_Model_Preference::GetEmail(),
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
|
@ -68,10 +71,10 @@ class Application_Form_RegisterAirtime extends Zend_Form
|
|||
// county list dropdown
|
||||
$this->addElement('select', 'Country', array(
|
||||
'label' => 'Country:',
|
||||
'required' => false,
|
||||
'required' => false,
|
||||
'value' => Application_Model_Preference::GetStationCountry(),
|
||||
'multiOptions' => $country_list,
|
||||
'decorators' => array(
|
||||
'multiOptions' => $country_list,
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
|
@ -128,13 +131,13 @@ class Application_Form_RegisterAirtime extends Zend_Form
|
|||
|
||||
// text area for sending detail
|
||||
$this->addElement('textarea', 'SendInfo', array(
|
||||
'class' => 'sending_textarea',
|
||||
'class' => 'sending_textarea',
|
||||
'required' => false,
|
||||
'filters' => array('StringTrim'),
|
||||
'readonly' => true,
|
||||
'rows' => 5,
|
||||
'cols' => 61,
|
||||
'value' => Application_Model_Preference::GetSystemInfo(false, true),
|
||||
'readonly' => true,
|
||||
'rows' => 5,
|
||||
'cols' => 61,
|
||||
'value' => Application_Model_Preference::GetSystemInfo(false, true),
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
|
|
|
@ -2,86 +2,86 @@
|
|||
class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
||||
{
|
||||
private $criteriaOptions = array(
|
||||
0 => "Select criteria",
|
||||
"album_title" => "Album",
|
||||
"bit_rate" => "Bit Rate (Kbps)",
|
||||
"bpm" => "Bpm",
|
||||
"comments" => "Comments",
|
||||
"composer" => "Composer",
|
||||
"conductor" => "Conductor",
|
||||
"artist_name" => "Creator",
|
||||
"disc_number" => "Disc Number",
|
||||
"genre" => "Genre",
|
||||
"isrc_number" => "ISRC",
|
||||
"label" => "Label",
|
||||
"language" => "Language",
|
||||
"mtime" => "Last Modified",
|
||||
"lptime" => "Last Played",
|
||||
"length" => "Length",
|
||||
"lyricist" => "Lyricist",
|
||||
"mood" => "Mood",
|
||||
"name" => "Name",
|
||||
"orchestra" => "Orchestra",
|
||||
"rating" => "Rating",
|
||||
"sample_rate" => "Sample Rate (kHz)",
|
||||
"track_title" => "Title",
|
||||
0 => "Select criteria",
|
||||
"album_title" => "Album",
|
||||
"bit_rate" => "Bit Rate (Kbps)",
|
||||
"bpm" => "Bpm",
|
||||
"comments" => "Comments",
|
||||
"composer" => "Composer",
|
||||
"conductor" => "Conductor",
|
||||
"artist_name" => "Creator",
|
||||
"disc_number" => "Disc Number",
|
||||
"genre" => "Genre",
|
||||
"isrc_number" => "ISRC",
|
||||
"label" => "Label",
|
||||
"language" => "Language",
|
||||
"mtime" => "Last Modified",
|
||||
"lptime" => "Last Played",
|
||||
"length" => "Length",
|
||||
"lyricist" => "Lyricist",
|
||||
"mood" => "Mood",
|
||||
"name" => "Name",
|
||||
"orchestra" => "Orchestra",
|
||||
"rating" => "Rating",
|
||||
"sample_rate" => "Sample Rate (kHz)",
|
||||
"track_title" => "Title",
|
||||
"track_number" => "Track Number",
|
||||
"utime" => "Uploaded",
|
||||
"year" => "Year"
|
||||
"utime" => "Uploaded",
|
||||
"year" => "Year"
|
||||
);
|
||||
|
||||
private $criteriaTypes = array(
|
||||
0 => "",
|
||||
"album_title" => "s",
|
||||
"artist_name" => "s",
|
||||
"bit_rate" => "n",
|
||||
"bpm" => "n",
|
||||
"comments" => "s",
|
||||
"composer" => "s",
|
||||
"conductor" => "s",
|
||||
"utime" => "n",
|
||||
"mtime" => "n",
|
||||
"lptime" => "n",
|
||||
"disc_number" => "n",
|
||||
"genre" => "s",
|
||||
"isrc_number" => "s",
|
||||
"label" => "s",
|
||||
"language" => "s",
|
||||
"length" => "n",
|
||||
"lyricist" => "s",
|
||||
"mood" => "s",
|
||||
"name" => "s",
|
||||
"orchestra" => "s",
|
||||
"rating" => "n",
|
||||
"sample_rate" => "n",
|
||||
"track_title" => "s",
|
||||
0 => "",
|
||||
"album_title" => "s",
|
||||
"artist_name" => "s",
|
||||
"bit_rate" => "n",
|
||||
"bpm" => "n",
|
||||
"comments" => "s",
|
||||
"composer" => "s",
|
||||
"conductor" => "s",
|
||||
"utime" => "n",
|
||||
"mtime" => "n",
|
||||
"lptime" => "n",
|
||||
"disc_number" => "n",
|
||||
"genre" => "s",
|
||||
"isrc_number" => "s",
|
||||
"label" => "s",
|
||||
"language" => "s",
|
||||
"length" => "n",
|
||||
"lyricist" => "s",
|
||||
"mood" => "s",
|
||||
"name" => "s",
|
||||
"orchestra" => "s",
|
||||
"rating" => "n",
|
||||
"sample_rate" => "n",
|
||||
"track_title" => "s",
|
||||
"track_number" => "n",
|
||||
"year" => "n"
|
||||
"year" => "n"
|
||||
);
|
||||
|
||||
private $stringCriteriaOptions = array(
|
||||
"0" => "Select modifier",
|
||||
"contains" => "contains",
|
||||
"0" => "Select modifier",
|
||||
"contains" => "contains",
|
||||
"does not contain" => "does not contain",
|
||||
"is" => "is",
|
||||
"is not" => "is not",
|
||||
"starts with" => "starts with",
|
||||
"ends with" => "ends with"
|
||||
"is" => "is",
|
||||
"is not" => "is not",
|
||||
"starts with" => "starts with",
|
||||
"ends with" => "ends with"
|
||||
);
|
||||
|
||||
private $numericCriteriaOptions = array(
|
||||
"0" => "Select modifier",
|
||||
"is" => "is",
|
||||
"is not" => "is not",
|
||||
"0" => "Select modifier",
|
||||
"is" => "is",
|
||||
"is not" => "is not",
|
||||
"is greater than" => "is greater than",
|
||||
"is less than" => "is less than",
|
||||
"is less than" => "is less than",
|
||||
"is in the range" => "is in the range"
|
||||
);
|
||||
|
||||
private $limitOptions = array(
|
||||
"hours" => "hours",
|
||||
"hours" => "hours",
|
||||
"minutes" => "minutes",
|
||||
"items" => "items"
|
||||
"items" => "items"
|
||||
);
|
||||
|
||||
public function init()
|
||||
|
|
|
@ -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 {
|
||||
alert('You can only add tracks to smart blocks.');
|
||||
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