Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
fa749c58f0
|
@ -249,7 +249,7 @@ class ApiController extends Zend_Controller_Action
|
|||
$request = $this->getRequest();
|
||||
$type = $request->getParam('type');
|
||||
/* This is some *extremely* lazy programming that needs to bi fixed. For some reason
|
||||
* we are using two entirely different codepaths for very similar functionality (type = endofday
|
||||
* we are using two entirely different codepaths for very similar functionality (type = endofday
|
||||
* vs type = interval). Needs to be fixed for 2.2 - MK */
|
||||
if ($type == "endofday") {
|
||||
$limit = $request->getParam('limit');
|
||||
|
@ -265,25 +265,25 @@ class ApiController extends Zend_Controller_Action
|
|||
"nextShow"=>Application_Model_Show::getNextShows($utcTimeNow, $limit, $utcTimeEnd)
|
||||
);
|
||||
|
||||
Application_Model_Show::convertToLocalTimeZone($result["currentShow"],
|
||||
Application_Model_Show::convertToLocalTimeZone($result["currentShow"],
|
||||
array("starts", "ends", "start_timestamp", "end_timestamp"));
|
||||
Application_Model_Show::convertToLocalTimeZone($result["nextShow"],
|
||||
Application_Model_Show::convertToLocalTimeZone($result["nextShow"],
|
||||
array("starts", "ends", "start_timestamp", "end_timestamp"));
|
||||
} else {
|
||||
$result = Application_Model_Schedule::GetPlayOrderRange();
|
||||
|
||||
//Convert from UTC to localtime for Web Browser.
|
||||
Application_Model_Show::ConvertToLocalTimeZone($result["currentShow"],
|
||||
Application_Model_Show::ConvertToLocalTimeZone($result["currentShow"],
|
||||
array("starts", "ends", "start_timestamp", "end_timestamp"));
|
||||
Application_Model_Show::ConvertToLocalTimeZone($result["nextShow"],
|
||||
Application_Model_Show::ConvertToLocalTimeZone($result["nextShow"],
|
||||
array("starts", "ends", "start_timestamp", "end_timestamp"));
|
||||
}
|
||||
|
||||
//used by caller to determine if the airtime they are running or widgets in use is out of date.
|
||||
$result['AIRTIME_API_VERSION'] = AIRTIME_API_VERSION;
|
||||
$result['AIRTIME_API_VERSION'] = AIRTIME_API_VERSION;
|
||||
header("Content-type: text/javascript");
|
||||
|
||||
// If a callback is not given, then just provide the raw JSON.
|
||||
// If a callback is not given, then just provide the raw JSON.
|
||||
echo isset($_GET['callback']) ? $_GET['callback'].'('.json_encode($result).')' : json_encode($result);
|
||||
} else {
|
||||
header('HTTP/1.0 401 Unauthorized');
|
||||
|
@ -317,8 +317,8 @@ class ApiController extends Zend_Controller_Action
|
|||
}
|
||||
$result['AIRTIME_API_VERSION'] = AIRTIME_API_VERSION; //used by caller to determine if the airtime they are running or widgets in use is out of date.
|
||||
header("Content-type: text/javascript");
|
||||
|
||||
// If a callback is not given, then just provide the raw JSON.
|
||||
Logging::log($result);
|
||||
// If a callback is not given, then just provide the raw JSON.
|
||||
echo isset($_GET['callback']) ? $_GET['callback'].'('.json_encode($result).')' : json_encode($result);
|
||||
} else {
|
||||
header('HTTP/1.0 401 Unauthorized');
|
||||
|
@ -456,8 +456,8 @@ class ApiController extends Zend_Controller_Action
|
|||
$this->view->watched_dirs = $watchedDirsPath;
|
||||
}
|
||||
|
||||
public function dispatchMetadataAction($md, $mode, $dry_run=false)
|
||||
{
|
||||
public function dispatchMetadataAction($md, $mode, $dry_run=false)
|
||||
{
|
||||
// Replace this compound result in a hash with proper error handling later on
|
||||
$return_hash = array();
|
||||
if ( $dry_run ) { // for debugging we return garbage not to screw around with the db
|
||||
|
@ -540,7 +540,7 @@ class ApiController extends Zend_Controller_Action
|
|||
}
|
||||
$return_hash['fileid'] = $file->getId();
|
||||
return $return_hash;
|
||||
}
|
||||
}
|
||||
|
||||
public function reloadMetadataGroupAction()
|
||||
{
|
||||
|
@ -585,7 +585,7 @@ class ApiController extends Zend_Controller_Action
|
|||
$response['key'] = $k;
|
||||
array_push($responses, $response);
|
||||
// On recorded show requests we do some extra work here. Not sure what it actually is and it
|
||||
// was usually called from the python api client. Now we just call it straight from the controller to
|
||||
// was usually called from the python api client. Now we just call it straight from the controller to
|
||||
// save the http roundtrip
|
||||
if( $info_json['is_record'] and !array_key_exists('error', $response) ) {
|
||||
$this->uploadRecordedActionParam($info_json['showinstanceid'],$info_json['fileid'],$dry_run=$dry);
|
||||
|
|
|
@ -109,8 +109,6 @@ class LibraryController extends Zend_Controller_Action
|
|||
$menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => "/library/delete");
|
||||
$menu["edit"] = array("name"=> "Edit", "icon" => "edit", "url" => "/library/edit-file-md/id/{$id}");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//SOUNDCLOUD MENU OPTIONS
|
||||
|
@ -137,6 +135,10 @@ class LibraryController extends Zend_Controller_Action
|
|||
|
||||
$menu["soundcloud"]["items"]["upload"] = array("name" => $text, "icon" => "soundcloud", "url" => "/library/upload-file-soundcloud/id/{$id}");
|
||||
}
|
||||
|
||||
if (empty($menu)) {
|
||||
$menu["noaction"] = array("name"=>"No action available");
|
||||
}
|
||||
|
||||
$this->view->items = $menu;
|
||||
}
|
||||
|
|
|
@ -565,8 +565,15 @@ class PlaylistController extends Zend_Controller_Action
|
|||
{
|
||||
$request = $this->getRequest();
|
||||
$params = $request->getPost();
|
||||
$bl = new Application_Model_Block($params['obj_id']);
|
||||
$result = $bl->shuffleSmartBlock();
|
||||
$bl = new Application_Model_Block($params['obj_id']);
|
||||
|
||||
//we need to save criteria in case user hasn't clicked Save or Generate yet
|
||||
$result = $bl->saveSmartBlockCriteria($params['data']);
|
||||
|
||||
//only shuffle if there are no criteria errors
|
||||
if ($result['result'] == 0) {
|
||||
$result = $bl->shuffleSmartBlock();
|
||||
}
|
||||
if ($result['result'] == 0) {
|
||||
try {
|
||||
die(json_encode(array("result"=>0, "html"=>$this->createFullResponse($bl, true))));
|
||||
|
|
|
@ -276,8 +276,8 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
|||
$files = $bl->getListofFilesMeetCriteria();
|
||||
|
||||
$save = new Zend_Form_Element_Button('save_button');
|
||||
$save->setAttrib('class', 'ui-button ui-state-default sp-button');
|
||||
$save->setAttrib('title', 'Save criteria only');
|
||||
$save->setAttrib('class', 'ui-button ui-state-default sp-save');
|
||||
$save->setAttrib('title', 'Save playlist');
|
||||
$save->setIgnore(true);
|
||||
$save->setLabel('Save');
|
||||
$save->setDecorators(array('viewHelper'));
|
||||
|
@ -285,7 +285,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
|||
|
||||
$generate = new Zend_Form_Element_Button('generate_button');
|
||||
$generate->setAttrib('class', 'ui-button ui-state-default sp-button');
|
||||
$generate->setAttrib('title', 'Save criteria and generate block content');
|
||||
$generate->setAttrib('title', 'Generate playlist content');
|
||||
$generate->setIgnore(true);
|
||||
$generate->setLabel('Generate');
|
||||
$generate->setDecorators(array('viewHelper'));
|
||||
|
@ -293,7 +293,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
|||
|
||||
$shuffle = new Zend_Form_Element_Button('shuffle_button');
|
||||
$shuffle->setAttrib('class', 'ui-button ui-state-default sp-button');
|
||||
$shuffle->setAttrib('title', 'Shuffle block content');
|
||||
$shuffle->setAttrib('title', 'Shuffle playlist content');
|
||||
$shuffle->setIgnore(true);
|
||||
$shuffle->setLabel('Shuffle');
|
||||
$shuffle->setDecorators(array('viewHelper'));
|
||||
|
|
|
@ -1104,6 +1104,9 @@ EOT;
|
|||
}
|
||||
} else {
|
||||
$length = $this->getStaticLength();
|
||||
if (!$length) {
|
||||
$length = "00:00:00";
|
||||
}
|
||||
$this->setLength($length);
|
||||
}
|
||||
$output['blockLength'] = $this->getFormattedLength();
|
||||
|
|
|
@ -1902,7 +1902,7 @@ class Application_Model_Show
|
|||
}
|
||||
|
||||
//TODO, returning starts + ends twice (once with an alias). Unify this after the 2.0 release. --Martin
|
||||
$sql = "SELECT si.starts as start_timestamp, si.ends as end_timestamp, s.name, s.id, si.id as instance_id, si.record, s.url, starts, ends"
|
||||
$sql = "SELECT si.starts as start_timestamp, si.ends as end_timestamp, s.name, s.id, si.id as instance_id, si.record, s.url, starts, ends FROM"
|
||||
." $CC_CONFIG[showInstances] si, $CC_CONFIG[showTable] s"
|
||||
." WHERE si.show_id = s.id"
|
||||
." AND si.starts >= TIMESTAMP '$timeStart'"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<form id="smart-playlist-form" method="post" action="">
|
||||
<fieldset class='sp-scrollable toggle <?php echo $this->openOption ? "" : "closed"?>' id='smart_playlist_options'>
|
||||
<fieldset class='toggle <?php echo $this->openOption ? "" : "closed"?>' id='smart_playlist_options'>
|
||||
<legend style='cursor: pointer;'><span class='ui-icon ui-icon-triangle-2-n-s'></span>Smart Playlist Options</legend>
|
||||
<dl class='zend_form'>
|
||||
<div id='sp-success' class='success' style='display:none'></div>
|
||||
|
|
|
@ -13,7 +13,7 @@ if (isset($this->obj)) {
|
|||
<?php endif; ?>
|
||||
|
||||
<?php if (isset($this->obj)) : ?>
|
||||
<button class="ui-button ui-state-default sp-button" type="button" id="save_button">Save</button>
|
||||
<button class="ui-button ui-state-default sp-save" type="button" id="save_button">Save</button>
|
||||
<input id="obj_id" type="hidden" value="<?php echo $this->obj->getId(); ?>"></input>
|
||||
<input id="obj_lastMod" type="hidden" value="<?php echo $this->obj->getLastModified('U'); ?>"></input>
|
||||
<input id='obj_type' type='hidden' value='playlist'></input>
|
||||
|
|
|
@ -500,11 +500,6 @@ table.library-get-file-md.table-small{
|
|||
|
||||
|
||||
/***** SMART PLAYLIST SPECIFIC STYLES BEGIN *****/
|
||||
.sp-scrollable{
|
||||
overflow-x: auto;
|
||||
width: 765px;
|
||||
}
|
||||
|
||||
.sp-invisible{
|
||||
visibility: hidden;
|
||||
}
|
||||
|
@ -559,6 +554,10 @@ input.input_text.sp_extra_input_text{
|
|||
margin-left: 10px !important;
|
||||
}
|
||||
|
||||
.sp-save{
|
||||
margin-left: 7px !important;
|
||||
}
|
||||
|
||||
.sp-checked-icon{
|
||||
width: 16px !important;
|
||||
display: inline-block !important;
|
||||
|
|
|
@ -23,9 +23,7 @@ function setSmartPlaylistEvents() {
|
|||
|
||||
/********** ADD MODIFIER ROW **********/
|
||||
form.find('a[id^="modifier_add"]').live('click', function(){
|
||||
var id = $(this).attr('id'),
|
||||
row_index = id.charAt(id.length-1),
|
||||
criteria_value = $(this).siblings('select[name^="sp_criteria_field"]').val();
|
||||
var criteria_value = $(this).siblings('select[name^="sp_criteria_field"]').val();
|
||||
|
||||
//make new modifier row
|
||||
var newRow = $(this).parent().clone(),
|
||||
|
@ -244,11 +242,7 @@ function setSmartPlaylistEvents() {
|
|||
/********** MODIFIER CHANGE **********/
|
||||
form.find('select[id^="sp_criteria_modifier"]').live("change", function(){
|
||||
var criteria_value = $(this).next(),
|
||||
index_name = criteria_value.attr('id'),
|
||||
delimiter = '_',
|
||||
start = 3,
|
||||
tokens = index_name.split(delimiter).slice(start),
|
||||
index_num = tokens.join(delimiter);
|
||||
index_num = getRowIndex($(this).parent());
|
||||
|
||||
if ($(this).val() == 'is in the range') {
|
||||
enableAndShowExtraField(criteria_value, index_num);
|
||||
|
@ -264,7 +258,7 @@ function setSmartPlaylistEvents() {
|
|||
}
|
||||
|
||||
function getRowIndex(ele) {
|
||||
var id = ele.find('[name^="sp_criteria"]').attr('id'),
|
||||
var id = ele.find('[name^="sp_criteria_field"]').attr('id'),
|
||||
delimiter = '_',
|
||||
start = 3,
|
||||
tokens = id.split(delimiter).slice(start),
|
||||
|
@ -465,6 +459,9 @@ function callback(data, type) {
|
|||
|
||||
if (json.result == "1") {
|
||||
form.find('.success').hide();
|
||||
if ($('#smart_playlist_options').hasClass('closed')) {
|
||||
$('#smart_playlist_options').removeClass('closed');
|
||||
}
|
||||
$.each(json.errors, function(index, error){
|
||||
$.each(error.msg, function(index, message){
|
||||
$('#'+error.element).parent().append("<span class='errors sp-errors'>"+message+"</span>");
|
||||
|
|
Loading…
Reference in New Issue