Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
c69dac7ab6
|
@ -55,7 +55,7 @@ class PlaylistController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
|
|
||||||
private function changePlaylist($p_id, $p_type)
|
private function changePlaylist($p_id, $p_type)
|
||||||
{
|
{
|
||||||
if (is_null($p_id) || is_null($p_type)) {
|
if (is_null($p_id) || is_null($p_type)) {
|
||||||
unset($this->obj_sess->id);
|
unset($this->obj_sess->id);
|
||||||
unset($this->obj_sess->type);
|
unset($this->obj_sess->type);
|
||||||
|
@ -71,6 +71,7 @@ class PlaylistController extends Zend_Controller_Action
|
||||||
$this->view->length = $formatter->format();
|
$this->view->length = $formatter->format();
|
||||||
|
|
||||||
$this->view->obj = $obj;
|
$this->view->obj = $obj;
|
||||||
|
$this->view->contents = $obj->getContents();
|
||||||
$this->view->html = $this->view->render('playlist/update.phtml');
|
$this->view->html = $this->view->render('playlist/update.phtml');
|
||||||
$this->view->name = $obj->getName();
|
$this->view->name = $obj->getName();
|
||||||
$this->view->description = $obj->getDescription();
|
$this->view->description = $obj->getDescription();
|
||||||
|
@ -215,7 +216,7 @@ class PlaylistController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
|
|
||||||
public function newAction()
|
public function newAction()
|
||||||
{
|
{
|
||||||
//$pl_sess = $this->pl_sess;
|
//$pl_sess = $this->pl_sess;
|
||||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
$type = $this->_getParam('type');
|
$type = $this->_getParam('type');
|
||||||
|
@ -335,7 +336,7 @@ class PlaylistController extends Zend_Controller_Action
|
||||||
} else if ($e->getMessage() == 'track to dynamic') {
|
} else if ($e->getMessage() == 'track to dynamic') {
|
||||||
$this->blockDynamic($obj);
|
$this->blockDynamic($obj);
|
||||||
} else {
|
} else {
|
||||||
$this->playlistUnknownError($e);
|
$this->playlistUnknownError($e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,7 +101,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
||||||
|
|
||||||
|
|
||||||
$spType = new Zend_Form_Element_Radio('sp_type');
|
$spType = new Zend_Form_Element_Radio('sp_type');
|
||||||
$spType->setLabel('Set smart block type:')
|
$spType->setLabel('Set smart playlist type:')
|
||||||
->setDecorators(array('viewHelper'))
|
->setDecorators(array('viewHelper'))
|
||||||
->setMultiOptions(array(
|
->setMultiOptions(array(
|
||||||
'static' => 'Static',
|
'static' => 'Static',
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
|
<?php
|
||||||
|
$contents = $this->obj->getContents();
|
||||||
|
$count = count($contents);
|
||||||
|
?>
|
||||||
<button id="spl_new" class="ui-button ui-widget ui-state-default" role="button" aria-disabled="false">New</button>
|
<button id="spl_new" class="ui-button ui-widget ui-state-default" role="button" aria-disabled="false">New</button>
|
||||||
<?php if (isset($this->obj)) : ?>
|
<?php if (isset($this->obj)) : ?>
|
||||||
<button id="spl_delete" class="ui-button ui-widget ui-state-default" role="button" aria-disabled="false">Delete</button>
|
<button id="spl_delete" class="ui-button ui-widget ui-state-default" role="button" aria-disabled="false">Delete</button>
|
||||||
<a href="#" id="spl_crossfade" class="ui-button ui-button-icon-only ui-widget ui-state-default crossfade-main-button">
|
<a href="#" id="spl_crossfade" class="ui-button ui-button-icon-only ui-widget ui-state-default crossfade-main-button" style="display:<?php echo $count > 0 ?"block;":"none;"?>">
|
||||||
<span class="ui-icon crossfade-main-icon"></span><span class="ui-button-text">Playlist crossfade</span>
|
<span class="ui-icon crossfade-main-icon"></span><span class="ui-button-text">Playlist crossfade</span>
|
||||||
</a>
|
</a>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
@ -49,7 +53,8 @@
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
<div class="" style="clear:both; float:none; width:100%;">
|
<div class="" style="clear:both; float:none; width:100%;">
|
||||||
<ul id="spl_sortable">
|
<ul id="spl_sortable">
|
||||||
<?php echo $this->render('playlist/update.phtml') ?>
|
<?php $this->contents = $contents;
|
||||||
|
echo $this->render('playlist/update.phtml') ?>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
|
<?php
|
||||||
|
$contents = $this->obj->getContents();
|
||||||
|
$count = count($contents);
|
||||||
|
?>
|
||||||
<button id="spl_new" class="ui-button ui-widget ui-state-default" role="button" aria-disabled="false">New</button>
|
<button id="spl_new" class="ui-button ui-widget ui-state-default" role="button" aria-disabled="false">New</button>
|
||||||
<?php if (isset($this->obj)) : ?>
|
<?php if (isset($this->obj)) : ?>
|
||||||
<button id="spl_delete" class="ui-button ui-widget ui-state-default" role="button" aria-disabled="false">Delete</button>
|
<button id="spl_delete" class="ui-button ui-widget ui-state-default" role="button" aria-disabled="false">Delete</button>
|
||||||
<a href="#" id="spl_crossfade" class="ui-button ui-button-icon-only ui-widget ui-state-default crossfade-main-button">
|
<a href="#" id="spl_crossfade" class="ui-button ui-button-icon-only ui-widget ui-state-default crossfade-main-button" style="display:<?php echo ($this->obj->isStatic() && $count > 0) ?"block;":"none;"?>">
|
||||||
<span class="ui-icon crossfade-main-icon"></span><span class="ui-button-text">Playlist crossfade</span>
|
<span class="ui-icon crossfade-main-icon"></span><span class="ui-button-text">Playlist crossfade</span>
|
||||||
</a>
|
</a>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
@ -49,7 +53,8 @@
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
<div class="" style="clear:both; float:none; width:100%;">
|
<div class="" style="clear:both; float:none; width:100%;">
|
||||||
<ul id="spl_sortable">
|
<ul id="spl_sortable">
|
||||||
<?php echo $this->render('playlist/update.phtml') ?>
|
<?php $this->contents = $contents;
|
||||||
|
echo $this->render('playlist/update.phtml') ?>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
$items = $this->obj->getContents();
|
$items = $this->contents;
|
||||||
if (count($items)) : ?>
|
if (count($items)) : ?>
|
||||||
<?php $i = 0; ?>
|
<?php $i = 0; ?>
|
||||||
<?php foreach($items as $item) :
|
<?php foreach($items as $item) :
|
||||||
|
|
|
@ -305,11 +305,19 @@ var AIRTIME = (function(AIRTIME){
|
||||||
$('#spl_sortable')
|
$('#spl_sortable')
|
||||||
.empty()
|
.empty()
|
||||||
.append(json.html);
|
.append(json.html);
|
||||||
|
|
||||||
setModified(json.modified);
|
setModified(json.modified);
|
||||||
redrawLib();
|
redrawLib();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setFadeIcon(){
|
||||||
|
var empty = $(".spl_empty");
|
||||||
|
if (empty.length > 0) {
|
||||||
|
$("#spl_crossfade").hide();
|
||||||
|
} else {
|
||||||
|
$("#spl_crossfade").show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function getId() {
|
function getId() {
|
||||||
return parseInt($("#obj_id").val(), 10);
|
return parseInt($("#obj_id").val(), 10);
|
||||||
}
|
}
|
||||||
|
@ -804,6 +812,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setPlaylistContent(json);
|
setPlaylistContent(json);
|
||||||
|
setFadeIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
mod.enableUI();
|
mod.enableUI();
|
||||||
|
|
|
@ -25,18 +25,8 @@ function setSmartPlaylistEvents() {
|
||||||
form.find('a[id^="modifier_add"]').live('click', function(){
|
form.find('a[id^="modifier_add"]').live('click', function(){
|
||||||
var id = $(this).attr('id'),
|
var id = $(this).attr('id'),
|
||||||
row_index = id.charAt(id.length-1),
|
row_index = id.charAt(id.length-1),
|
||||||
mod_index,
|
|
||||||
criteria_value = $(this).siblings('select[name^="sp_criteria_field"]').val();
|
criteria_value = $(this).siblings('select[name^="sp_criteria_field"]').val();
|
||||||
|
|
||||||
//get index for the new modifier row
|
|
||||||
if ($(this).parent().find('select[name^="sp_criteria_modifier_'+row_index+'_"]').length == 0) {
|
|
||||||
mod_index = 0;
|
|
||||||
} else {
|
|
||||||
var last_mod = $(this).parent().find('select[name^="sp_criteria_modifier_'+row_index+'_"]:last');
|
|
||||||
var last_mod_id = last_mod.attr('id');
|
|
||||||
mod_index = parseInt(last_mod_id.substr(last_mod_id.length-1))+1;
|
|
||||||
}
|
|
||||||
|
|
||||||
//make new modifier row
|
//make new modifier row
|
||||||
var newRow = $(this).parent().clone(),
|
var newRow = $(this).parent().clone(),
|
||||||
newRowCrit = newRow.find('select[name^="sp_criteria_field"]'),
|
newRowCrit = newRow.find('select[name^="sp_criteria_field"]'),
|
||||||
|
@ -53,27 +43,21 @@ function setSmartPlaylistEvents() {
|
||||||
//hide the critieria field select box
|
//hide the critieria field select box
|
||||||
newRowCrit.addClass('sp-invisible');
|
newRowCrit.addClass('sp-invisible');
|
||||||
|
|
||||||
//append modifier index to the new modifier row
|
//keep criteria value the same
|
||||||
newRowCrit.attr('name', 'sp_criteria_field_'+row_index+'_'+mod_index);
|
|
||||||
newRowCrit.attr('id', 'sp_criteria_field_'+row_index+'_'+mod_index);
|
|
||||||
newRowCrit.val(criteria_value);
|
newRowCrit.val(criteria_value);
|
||||||
newRowMod.attr('name', 'sp_criteria_modifier_'+row_index+'_'+mod_index);
|
|
||||||
newRowMod.attr('id', 'sp_criteria_modifier_'+row_index+'_'+mod_index);
|
//reset all other values
|
||||||
newRowMod.val('0');
|
newRowMod.val('0');
|
||||||
newRowVal.attr('name', 'sp_criteria_value_'+row_index+'_'+mod_index);
|
|
||||||
newRowVal.attr('id', 'sp_criteria_value_'+row_index+'_'+mod_index);
|
|
||||||
newRowVal.val('');
|
newRowVal.val('');
|
||||||
newRowExtra.attr('name', 'sp_criteria_extra_'+row_index+'_'+mod_index);
|
|
||||||
newRowExtra.attr('id', 'sp_criteria_extra_'+row_index+'_'+mod_index);
|
|
||||||
newRowExtra.val('');
|
newRowExtra.val('');
|
||||||
disableAndHideExtraField(newRowVal);
|
disableAndHideExtraField(newRowVal);
|
||||||
sizeTextBoxes(newRowVal, 'sp_extra_input_text', 'sp_input_text');
|
sizeTextBoxes(newRowVal, 'sp_extra_input_text', 'sp_input_text');
|
||||||
newRowRemove.attr('id', 'criteria_remove_'+row_index+'_'+mod_index);
|
|
||||||
|
|
||||||
//remove the 'criteria add' button from new modifier row
|
//remove the 'criteria add' button from new modifier row
|
||||||
newRow.find('.criteria_add').remove();
|
newRow.find('.criteria_add').remove();
|
||||||
|
|
||||||
$(this).parent().after(newRow);
|
$(this).parent().after(newRow);
|
||||||
|
reindexElements();
|
||||||
appendAddButton();
|
appendAddButton();
|
||||||
appendModAddButton();
|
appendModAddButton();
|
||||||
removeButtonCheck();
|
removeButtonCheck();
|
||||||
|
@ -209,6 +193,7 @@ function setSmartPlaylistEvents() {
|
||||||
enableLoadingIcon();
|
enableLoadingIcon();
|
||||||
$.post(save_action, {format: "json", data: data, obj_id: obj_id}, function(data){
|
$.post(save_action, {format: "json", data: data, obj_id: obj_id}, function(data){
|
||||||
callback(data, "save");
|
callback(data, "save");
|
||||||
|
setFadeIcon();
|
||||||
disableLoadingIcon();
|
disableLoadingIcon();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -284,6 +269,16 @@ function getRowIndex(ele) {
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setFadeIcon(){
|
||||||
|
var contents = $("#spl_sortable");
|
||||||
|
var show = contents.is(":visible");
|
||||||
|
if (show) {
|
||||||
|
$("#spl_crossfade").show();
|
||||||
|
} else {
|
||||||
|
$("#spl_crossfade").hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* This function appends a '+' button for the last
|
/* This function appends a '+' button for the last
|
||||||
* modifier row of each criteria.
|
* modifier row of each criteria.
|
||||||
* If there are no modifier rows, the '+' button
|
* If there are no modifier rows, the '+' button
|
||||||
|
@ -429,26 +424,27 @@ function sizeTextBoxes(ele, classToRemove, classToAdd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function populateModifierSelect(e) {
|
function populateModifierSelect(e) {
|
||||||
/*var criteria = $(e).val(),
|
|
||||||
criteria_type = criteriaTypes[criteria],*/
|
|
||||||
var criteria_type = getCriteriaOptionType(e),
|
var criteria_type = getCriteriaOptionType(e),
|
||||||
div = $(e).siblings('select[id^="sp_criteria_modifier"]');
|
index = getRowIndex($(e).parent()),
|
||||||
|
divs = $(e).parents().find('select[id^="sp_criteria_modifier_'+index+'"]');
|
||||||
|
|
||||||
div.children().remove();
|
$.each(divs, function(i, div){
|
||||||
|
$(div).children().remove();
|
||||||
if (criteria_type == 's') {
|
|
||||||
$.each(stringCriteriaOptions, function(key, value){
|
if (criteria_type == 's') {
|
||||||
div.append($('<option></option>')
|
$.each(stringCriteriaOptions, function(key, value){
|
||||||
.attr('value', key)
|
$(div).append($('<option></option>')
|
||||||
.text(value));
|
.attr('value', key)
|
||||||
});
|
.text(value));
|
||||||
} else {
|
});
|
||||||
$.each(numericCriteriaOptions, function(key, value){
|
} else {
|
||||||
div.append($('<option></option>')
|
$.each(numericCriteriaOptions, function(key, value){
|
||||||
.attr('value', key)
|
$(div).append($('<option></option>')
|
||||||
.text(value));
|
.attr('value', key)
|
||||||
});
|
.text(value));
|
||||||
}
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCriteriaOptionType(e) {
|
function getCriteriaOptionType(e) {
|
||||||
|
|
Loading…
Reference in New Issue