Merge branch 'cc-84-smart-playlist' of dev.sourcefabric.org:airtime into cc-84-smart-playlist
This commit is contained in:
commit
765a739b58
|
@ -6,33 +6,36 @@ class Application_Form_SmartPlaylistCriteria extends Zend_Form_SubForm
|
|||
|
||||
$criteriaOptions = array(
|
||||
0 => "Select criteria",
|
||||
"track_title" => "Title",
|
||||
"album_title" => "Album",
|
||||
"artist_name" => "Artist",
|
||||
"bit_rate" => "Bit Rate",
|
||||
"sample_rate" => "Sample Rate",
|
||||
"length" => "Length",
|
||||
"album_title" => "Album",
|
||||
"genre" => "Genre",
|
||||
"year" => "Year",
|
||||
"track_num" => "Track Number",
|
||||
"bmp" => "Bpm",
|
||||
"rating" => "Rating",
|
||||
"disc_number" => "Disc Number",
|
||||
"mood" => "Mood",
|
||||
"label" => "Label",
|
||||
"composer" => "Composer",
|
||||
"lyricist" => "Lyricist",
|
||||
"name" => "Name",
|
||||
"isrc_number" => "ISRC Number",
|
||||
"language" => "Language",
|
||||
"utime" => "Date Added",
|
||||
"mtime" => "Date Modified",
|
||||
"comments" => "Comments",
|
||||
"orchestra" => "Orchestra",
|
||||
"composer" => "Composer",
|
||||
"conductor" => "Conductor",
|
||||
"utime" => "Date Added",
|
||||
"mtime" => "Date Modified",
|
||||
"disc_number" => "Disc Number",
|
||||
"genre" => "Genre",
|
||||
"isrc_number" => "ISRC Number",
|
||||
"label" => "Label",
|
||||
"language" => "Language",
|
||||
"length" => "Length",
|
||||
"lyricist" => "Lyricist",
|
||||
"mood" => "Mood",
|
||||
"name" => "Name",
|
||||
"orchestra" => "Orchestra",
|
||||
"radio_station_name" => "Radio Station Name",
|
||||
"soundcloud_id" => "Soundcloud Upload"
|
||||
"rating" => "Rating",
|
||||
"sample_rate" => "Sample Rate",
|
||||
"soundcloud_id" => "Soundcloud Upload",
|
||||
"track_title" => "Title",
|
||||
"track_num" => "Track Number",
|
||||
"year" => "Year"
|
||||
);
|
||||
|
||||
$criteriaTypes = array(
|
||||
|
||||
);
|
||||
|
||||
$stringCriteriaOptions = array(
|
||||
|
@ -55,9 +58,9 @@ class Application_Form_SmartPlaylistCriteria extends Zend_Form_SubForm
|
|||
);
|
||||
|
||||
$limitOptions = array(
|
||||
"hours",
|
||||
"minutes",
|
||||
"items"
|
||||
"hours" => "hours",
|
||||
"minutes" => "minutes",
|
||||
"items" => "items"
|
||||
);
|
||||
|
||||
$this->setDecorators(array(
|
||||
|
@ -76,33 +79,36 @@ class Application_Form_SmartPlaylistCriteria extends Zend_Form_SubForm
|
|||
$this->addElement($spType);
|
||||
|
||||
$numElements = count($criteriaOptions);
|
||||
for($i = 1; $i <= $numElements; $i++) {
|
||||
for ($i = 0; $i < $numElements; $i++) {
|
||||
$criteria = new Zend_Form_Element_Select('sp_criteria_'.$i);
|
||||
$criteria->setAttrib('class', 'input_select');
|
||||
$criteria->setValue(0);
|
||||
$criteria->setValue('Select criteria');
|
||||
$criteria->setDecorators(array('viewHelper'));
|
||||
$criteria->setMultiOptions($criteriaOptions);
|
||||
if ($i != 0){
|
||||
$criteria->setAttrib('disabled', 'disabled');
|
||||
}
|
||||
$this->addElement($criteria);
|
||||
|
||||
$criteriaModifers = new Zend_Form_Element_Select('sp_criteria_modifier_'.$i);
|
||||
$criteriaModifers->setValue(0);
|
||||
$criteriaModifers->setValue('Select modifier');
|
||||
$criteriaModifers->setAttrib('class', 'input_select');
|
||||
$criteriaModifers->setDecorators(array('viewHelper'));
|
||||
$criteriaModifers->setMultiOptions($stringCriteriaOptions);
|
||||
if ($i != 0){
|
||||
$criteriaModifers->setAttrib('disabled', 'disabled');
|
||||
}
|
||||
$this->addElement($criteriaModifers);
|
||||
|
||||
$criteriaValue = new Zend_Form_Element_Text('sp_criteria_value_'.$i);
|
||||
$criteriaValue->setAttrib('class', 'input_text');
|
||||
$criteriaValue->setDecorators(array('viewHelper'));
|
||||
if ($i != 0){
|
||||
$criteriaValue->setAttrib('disabled', 'disabled');
|
||||
}
|
||||
$this->addElement($criteriaValue);
|
||||
}
|
||||
|
||||
$limitCheck = new Zend_Form_Element_Checkbox('sp_limit_check');
|
||||
$limitCheck->setLabel('Limit to');
|
||||
$limitCheck->setDecorators(array('viewHelper'));
|
||||
$limitCheck->setValue(true);
|
||||
$this->addElement($limitCheck);
|
||||
|
||||
$limit = new Zend_Form_Element_Select('sp_limit_options');
|
||||
$limit->setAttrib('class', 'input_select');
|
||||
$limit->setDecorators(array('viewHelper'));
|
||||
|
@ -111,6 +117,7 @@ class Application_Form_SmartPlaylistCriteria extends Zend_Form_SubForm
|
|||
|
||||
$limitValue = new Zend_Form_Element_Text('sp_limit_value');
|
||||
$limitValue->setAttrib('class', 'input_text');
|
||||
$limitValue->setLabel('Limit to');
|
||||
$limitValue->setDecorators(array('viewHelper'));
|
||||
$this->addElement($limitValue);
|
||||
|
||||
|
|
|
@ -17,16 +17,17 @@
|
|||
</dd>
|
||||
|
||||
<dd id='sp_criteria-element'>
|
||||
<?php for($i = 1; $i <= $this->criteriasLength; $i++) {?>
|
||||
<div <?php if(($i > 1) && ($this->element->getElement('sp_criteria_'.$i)->getValue() == "0" &&
|
||||
$this->element->getElement('sp_criteria_modifier_'.$i)->getValue() == "0")) {
|
||||
<?php for ($i = 0; $i < $this->criteriasLength; $i++) {?>
|
||||
<div <?php if (($i > 0) && ($this->element->getElement('sp_criteria_'.$i)->getAttrib('disabled') == 'disabled')) {
|
||||
echo 'style=display:none';
|
||||
} ?>>
|
||||
|
||||
<?php echo $this->element->getElement('sp_criteria_'.$i) ?>
|
||||
<?php echo $this->element->getElement('sp_criteria_modifier_'.$i) ?>
|
||||
<?php echo $this->element->getElement('sp_criteria_value_'.$i) ?>
|
||||
<a href='#' id='criteria_remove_<?php echo $i ?>'>Remove</a>
|
||||
<?php if ($i != 0) { ?>
|
||||
<a href='#' id='criteria_remove_<?php echo $i ?>'>Remove</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<a href='#' id='criteria_add'>Add</a>
|
||||
|
@ -34,8 +35,7 @@
|
|||
|
||||
<dd id='sp_limit-element'>
|
||||
<label>
|
||||
<?php echo $this->element->getElement('sp_limit_check') ?>
|
||||
<?php echo $this->element->getElement('sp_limit_check')->getLabel() ?>
|
||||
<?php echo $this->element->getElement('sp_limit_value')->getLabel() ?>
|
||||
<?php echo $this->element->getElement('sp_limit_value')?>
|
||||
<?php echo $this->element->getElement('sp_limit_options') ?>
|
||||
</label>
|
||||
|
|
|
@ -9,6 +9,7 @@ function setSmartPlaylistEvents() {
|
|||
var div = $('dd[id="sp_criteria-element"]').children('div:visible:last').next();
|
||||
|
||||
div.show();
|
||||
div.children().removeAttr('disabled');
|
||||
div = div.next();
|
||||
if(div.length === 0) {
|
||||
$(this).hide();
|
||||
|
@ -35,9 +36,10 @@ function setSmartPlaylistEvents() {
|
|||
next = curr.next();
|
||||
}
|
||||
|
||||
list.find('div:visible:last').children().attr('disabled', 'disabled');
|
||||
list.find("div:visible:last")
|
||||
.find('[name^="sp_criteria"]').val('').end()
|
||||
.find('[name^="sp_criteria_modifier"]').val('').end()
|
||||
.find('[name^="sp_criteria"]').val(0).end()
|
||||
.find('[name^="sp_criteria_modifier"]').val(0).end()
|
||||
.find('[name^="sp_criteria_value"]').val('')
|
||||
.end().hide();
|
||||
|
||||
|
@ -47,7 +49,7 @@ function setSmartPlaylistEvents() {
|
|||
form.find('button[id="save_button"]').click(function(event){
|
||||
var playlist_type = form.find('input:radio[name=sp_type]:checked').val(),
|
||||
data = $('form').serializeArray(),
|
||||
static_action = 'Playlist/smart-playlist-criteria-generate',
|
||||
static_action = 'Playlist/smart-playlist-generate',
|
||||
dynamic_action ='Playlist/smart-playlist-criteria-save',
|
||||
action,
|
||||
callback;
|
||||
|
@ -81,4 +83,4 @@ function staticCallback() {
|
|||
|
||||
function dynamicCallback() {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue