Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
c7b583c789
|
@ -29,7 +29,6 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
|||
"mood" => "Mood",
|
||||
"name" => "Name",
|
||||
"orchestra" => "Orchestra",
|
||||
"radio_station_name" => "Radio Station Name",
|
||||
"rating" => "Rating",
|
||||
"sample_rate" => "Sample Rate",
|
||||
"track_title" => "Title",
|
||||
|
@ -60,7 +59,6 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
|||
"mood" => "s",
|
||||
"name" => "s",
|
||||
"orchestra" => "s",
|
||||
"radio_station_name" => "s",
|
||||
"rating" => "n",
|
||||
"sample_rate" => "n",
|
||||
"track_title" => "s",
|
||||
|
|
|
@ -76,7 +76,6 @@ class Application_Model_Block
|
|||
"mood" => "DbMood",
|
||||
"name" => "DbName",
|
||||
"orchestra" => "DbOrchestra",
|
||||
"radio_station_name" => "DbRadioStationName",
|
||||
"rating" => "DbRating",
|
||||
"sample_rate" => "DbSampleRate",
|
||||
"track_title" => "DbTrackTitle",
|
||||
|
@ -1255,7 +1254,6 @@ EOT;
|
|||
"mood" => "Mood",
|
||||
"name" => "Name",
|
||||
"orchestra" => "Orchestra",
|
||||
"radio_station_name" => "Radio Station Name",
|
||||
"rating" => "Rating",
|
||||
"sample_rate" => "Sample Rate",
|
||||
"track_title" => "Title",
|
||||
|
|
|
@ -43,7 +43,7 @@ if ($item['type'] == 2) {
|
|||
<span class="spl_offset"><?php echo $item["offset"]?></span>
|
||||
</div>
|
||||
<?php //create the crossfade icon.
|
||||
if ($i < count($items) -1):
|
||||
if (($i < count($items) -1) && !($items[$i]['type'] == 2 && $items[$i+1]['type'])):
|
||||
?>
|
||||
<div id="fade_<?php echo $i ?>" class="spl_fade_control ui-state-default"></div>
|
||||
<?php endif; ?>
|
||||
|
@ -62,7 +62,7 @@ if ($item['type'] == 2) {
|
|||
|
||||
<?php //create a fade editor box
|
||||
//(fadeout of current position + fade in of next position)
|
||||
if($i < count($items) -1):
|
||||
if(($i < count($items) -1) && !($items[$i]['type'] == 2 && $items[$i+1]['type'])):
|
||||
?>
|
||||
<div id="crossfade_<?php echo $i ?>-<?php echo $i+1 ?>" class="crossfade clearfix" style="display: none">
|
||||
<?php echo $this->partial('playlist/set-fade.phtml', array(
|
||||
|
|
|
@ -17,6 +17,7 @@ function setSmartPlaylistEvents() {
|
|||
$(this).hide();
|
||||
}
|
||||
appendAddButton();
|
||||
appendModAddButton();
|
||||
removeButtonCheck();
|
||||
});
|
||||
|
||||
|
@ -87,6 +88,8 @@ function setSmartPlaylistEvents() {
|
|||
var count = list_length - curr_pos;
|
||||
var next = curr.next();
|
||||
var item_to_hide;
|
||||
var prev;
|
||||
var index;
|
||||
|
||||
//remove error message from current row, if any
|
||||
var error_element = curr.find('span[class="errors sp-errors"]');
|
||||
|
@ -98,6 +101,9 @@ function setSmartPlaylistEvents() {
|
|||
* the row getting removed
|
||||
*/
|
||||
for (var i=0; i<count; i++) {
|
||||
|
||||
index = getRowIndex(curr);
|
||||
|
||||
var criteria = next.find('[name^="sp_criteria_field"]').val();
|
||||
curr.find('[name^="sp_criteria_field"]').val(criteria);
|
||||
|
||||
|
@ -108,12 +114,6 @@ function setSmartPlaylistEvents() {
|
|||
var criteria_value = next.find('[name^="sp_criteria_value"]').val();
|
||||
curr.find('[name^="sp_criteria_value"]').val(criteria_value);
|
||||
|
||||
var id = curr.find('[name^="sp_criteria"]').attr('id'),
|
||||
delimiter = '_',
|
||||
start = 3,
|
||||
tokens = id.split(delimiter).slice(start),
|
||||
index = tokens.join(delimiter);
|
||||
|
||||
/* if current and next row have the extra criteria value
|
||||
* (for 'is in the range' modifier), then assign the next
|
||||
* extra value to current and remove that element from
|
||||
|
@ -143,8 +143,23 @@ function setSmartPlaylistEvents() {
|
|||
curr.find('[name^="sp_criteria_extra"]').val(criteria_extra);
|
||||
}
|
||||
|
||||
/* determine if current row is a modifier row
|
||||
* if it is, make the criteria select invisible
|
||||
*/
|
||||
prev = curr.prev();
|
||||
if (curr.find('[name^="sp_criteria_field"]').val() == prev.find('[name^="sp_criteria_field"]').val()) {
|
||||
if (!curr.find('select[name^="sp_criteria_field"]').hasClass('sp-invisible')) {
|
||||
curr.find('select[name^="sp_criteria_field"]').addClass('sp-invisible');
|
||||
}
|
||||
} else {
|
||||
if (curr.find('select[name^="sp_criteria_field"]').hasClass('sp-invisible')) {
|
||||
curr.find('select[name^="sp_criteria_field"]').removeClass('sp-invisible');
|
||||
}
|
||||
}
|
||||
|
||||
curr = next;
|
||||
next = curr.next();
|
||||
|
||||
}
|
||||
|
||||
/* Disable the last visible row since it holds the values the user removed
|
||||
|
@ -153,6 +168,9 @@ function setSmartPlaylistEvents() {
|
|||
*/
|
||||
item_to_hide = list.find('div:visible:last');
|
||||
item_to_hide.children().attr('disabled', 'disabled');
|
||||
if (item_to_hide.find('select[name^="sp_criteria_field"]').hasClass('sp-invisible')) {
|
||||
item_to_hide.find('select[name^="sp_criteria_field"]').removeClass('sp-invisible');
|
||||
}
|
||||
item_to_hide.find('[name^="sp_criteria_field"]').val(0).end()
|
||||
.find('[name^="sp_criteria_modifier"]').val(0).end()
|
||||
.find('[name^="sp_criteria_value"]').val('').end()
|
||||
|
@ -163,12 +181,22 @@ function setSmartPlaylistEvents() {
|
|||
|
||||
list.next().show();
|
||||
|
||||
//check if last row is a modifier row
|
||||
var last_row = list.find('div:visible:last');
|
||||
if (last_row.find('[name^="sp_criteria_field"]').val() == last_row.prev().find('[name^="sp_criteria_field"]').val()) {
|
||||
if (!last_row.find('select[name^="sp_criteria_field"]').hasClass('sp-invisible')) {
|
||||
last_row.find('select[name^="sp_criteria_field"]').addClass('sp-invisible');
|
||||
}
|
||||
}
|
||||
|
||||
// always put '+' button on the last enabled row
|
||||
appendAddButton();
|
||||
|
||||
reindexElements();
|
||||
|
||||
// always put '+' button on the last modifier row
|
||||
appendModAddButton();
|
||||
|
||||
reindexElements();
|
||||
// remove the 'x' button if only one row is enabled
|
||||
removeButtonCheck();
|
||||
});
|
||||
|
@ -246,13 +274,15 @@ function setSmartPlaylistEvents() {
|
|||
removeButtonCheck();
|
||||
}
|
||||
|
||||
var static_length = $('.playlist_title').children('h4[id$="_length"]').text();
|
||||
function getRowIndex(ele) {
|
||||
var id = ele.find('[name^="sp_criteria"]').attr('id'),
|
||||
delimiter = '_',
|
||||
start = 3,
|
||||
tokens = id.split(delimiter).slice(start),
|
||||
index = tokens.join(delimiter);
|
||||
|
||||
/*
|
||||
function setStaticLengthHolder(lenVal) {
|
||||
static_length = lenVal;
|
||||
return index;
|
||||
}
|
||||
*/
|
||||
|
||||
/* This function appends a '+' button for the last
|
||||
* modifier row of each criteria.
|
||||
|
@ -339,12 +369,10 @@ function setupUI() {
|
|||
$('button[id="generate_button"]').show();
|
||||
$('button[id="shuffle_button"]').show();
|
||||
$('#spl_sortable').show();
|
||||
//$('.playlist_title').children('h4[id$="_length"]').text(static_length);
|
||||
} else {
|
||||
$('button[id="generate_button"]').hide();
|
||||
$('button[id="shuffle_button"]').hide();
|
||||
$('#spl_sortable').hide();
|
||||
//$('.playlist_title').children('h4[id$="_length"]').text(dynamic_length);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -562,7 +590,6 @@ var criteriaTypes = {
|
|||
"mood" : "s",
|
||||
"name" : "s",
|
||||
"orchestra" : "s",
|
||||
"radio_station_name" : "s",
|
||||
"rating" : "n",
|
||||
"sample_rate" : "n",
|
||||
"track_title" : "s",
|
||||
|
|
Loading…
Reference in New Issue