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(
|
$criteriaOptions = array(
|
||||||
0 => "Select criteria",
|
0 => "Select criteria",
|
||||||
"track_title" => "Title",
|
"album_title" => "Album",
|
||||||
"artist_name" => "Artist",
|
"artist_name" => "Artist",
|
||||||
"bit_rate" => "Bit Rate",
|
"bit_rate" => "Bit Rate",
|
||||||
"sample_rate" => "Sample Rate",
|
|
||||||
"length" => "Length",
|
|
||||||
"album_title" => "Album",
|
|
||||||
"genre" => "Genre",
|
|
||||||
"year" => "Year",
|
|
||||||
"track_num" => "Track Number",
|
|
||||||
"bmp" => "Bpm",
|
"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",
|
"comments" => "Comments",
|
||||||
"orchestra" => "Orchestra",
|
|
||||||
"composer" => "Composer",
|
"composer" => "Composer",
|
||||||
"conductor" => "Conductor",
|
"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",
|
"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(
|
$stringCriteriaOptions = array(
|
||||||
|
@ -55,9 +58,9 @@ class Application_Form_SmartPlaylistCriteria extends Zend_Form_SubForm
|
||||||
);
|
);
|
||||||
|
|
||||||
$limitOptions = array(
|
$limitOptions = array(
|
||||||
"hours",
|
"hours" => "hours",
|
||||||
"minutes",
|
"minutes" => "minutes",
|
||||||
"items"
|
"items" => "items"
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->setDecorators(array(
|
$this->setDecorators(array(
|
||||||
|
@ -76,33 +79,36 @@ class Application_Form_SmartPlaylistCriteria extends Zend_Form_SubForm
|
||||||
$this->addElement($spType);
|
$this->addElement($spType);
|
||||||
|
|
||||||
$numElements = count($criteriaOptions);
|
$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 = new Zend_Form_Element_Select('sp_criteria_'.$i);
|
||||||
$criteria->setAttrib('class', 'input_select');
|
$criteria->setAttrib('class', 'input_select');
|
||||||
$criteria->setValue(0);
|
$criteria->setValue('Select criteria');
|
||||||
$criteria->setDecorators(array('viewHelper'));
|
$criteria->setDecorators(array('viewHelper'));
|
||||||
$criteria->setMultiOptions($criteriaOptions);
|
$criteria->setMultiOptions($criteriaOptions);
|
||||||
|
if ($i != 0){
|
||||||
|
$criteria->setAttrib('disabled', 'disabled');
|
||||||
|
}
|
||||||
$this->addElement($criteria);
|
$this->addElement($criteria);
|
||||||
|
|
||||||
$criteriaModifers = new Zend_Form_Element_Select('sp_criteria_modifier_'.$i);
|
$criteriaModifers = new Zend_Form_Element_Select('sp_criteria_modifier_'.$i);
|
||||||
$criteriaModifers->setValue(0);
|
$criteriaModifers->setValue('Select modifier');
|
||||||
$criteriaModifers->setAttrib('class', 'input_select');
|
$criteriaModifers->setAttrib('class', 'input_select');
|
||||||
$criteriaModifers->setDecorators(array('viewHelper'));
|
$criteriaModifers->setDecorators(array('viewHelper'));
|
||||||
$criteriaModifers->setMultiOptions($stringCriteriaOptions);
|
$criteriaModifers->setMultiOptions($stringCriteriaOptions);
|
||||||
|
if ($i != 0){
|
||||||
|
$criteriaModifers->setAttrib('disabled', 'disabled');
|
||||||
|
}
|
||||||
$this->addElement($criteriaModifers);
|
$this->addElement($criteriaModifers);
|
||||||
|
|
||||||
$criteriaValue = new Zend_Form_Element_Text('sp_criteria_value_'.$i);
|
$criteriaValue = new Zend_Form_Element_Text('sp_criteria_value_'.$i);
|
||||||
$criteriaValue->setAttrib('class', 'input_text');
|
$criteriaValue->setAttrib('class', 'input_text');
|
||||||
$criteriaValue->setDecorators(array('viewHelper'));
|
$criteriaValue->setDecorators(array('viewHelper'));
|
||||||
|
if ($i != 0){
|
||||||
|
$criteriaValue->setAttrib('disabled', 'disabled');
|
||||||
|
}
|
||||||
$this->addElement($criteriaValue);
|
$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 = new Zend_Form_Element_Select('sp_limit_options');
|
||||||
$limit->setAttrib('class', 'input_select');
|
$limit->setAttrib('class', 'input_select');
|
||||||
$limit->setDecorators(array('viewHelper'));
|
$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 = new Zend_Form_Element_Text('sp_limit_value');
|
||||||
$limitValue->setAttrib('class', 'input_text');
|
$limitValue->setAttrib('class', 'input_text');
|
||||||
|
$limitValue->setLabel('Limit to');
|
||||||
$limitValue->setDecorators(array('viewHelper'));
|
$limitValue->setDecorators(array('viewHelper'));
|
||||||
$this->addElement($limitValue);
|
$this->addElement($limitValue);
|
||||||
|
|
||||||
|
|
|
@ -17,16 +17,17 @@
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
<dd id='sp_criteria-element'>
|
<dd id='sp_criteria-element'>
|
||||||
<?php for($i = 1; $i <= $this->criteriasLength; $i++) {?>
|
<?php for ($i = 0; $i < $this->criteriasLength; $i++) {?>
|
||||||
<div <?php if(($i > 1) && ($this->element->getElement('sp_criteria_'.$i)->getValue() == "0" &&
|
<div <?php if (($i > 0) && ($this->element->getElement('sp_criteria_'.$i)->getAttrib('disabled') == 'disabled')) {
|
||||||
$this->element->getElement('sp_criteria_modifier_'.$i)->getValue() == "0")) {
|
|
||||||
echo 'style=display:none';
|
echo 'style=display:none';
|
||||||
} ?>>
|
} ?>>
|
||||||
|
|
||||||
<?php echo $this->element->getElement('sp_criteria_'.$i) ?>
|
<?php echo $this->element->getElement('sp_criteria_'.$i) ?>
|
||||||
<?php echo $this->element->getElement('sp_criteria_modifier_'.$i) ?>
|
<?php echo $this->element->getElement('sp_criteria_modifier_'.$i) ?>
|
||||||
<?php echo $this->element->getElement('sp_criteria_value_'.$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>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<a href='#' id='criteria_add'>Add</a>
|
<a href='#' id='criteria_add'>Add</a>
|
||||||
|
@ -34,8 +35,7 @@
|
||||||
|
|
||||||
<dd id='sp_limit-element'>
|
<dd id='sp_limit-element'>
|
||||||
<label>
|
<label>
|
||||||
<?php echo $this->element->getElement('sp_limit_check') ?>
|
<?php echo $this->element->getElement('sp_limit_value')->getLabel() ?>
|
||||||
<?php echo $this->element->getElement('sp_limit_check')->getLabel() ?>
|
|
||||||
<?php echo $this->element->getElement('sp_limit_value')?>
|
<?php echo $this->element->getElement('sp_limit_value')?>
|
||||||
<?php echo $this->element->getElement('sp_limit_options') ?>
|
<?php echo $this->element->getElement('sp_limit_options') ?>
|
||||||
</label>
|
</label>
|
||||||
|
|
|
@ -9,6 +9,7 @@ function setSmartPlaylistEvents() {
|
||||||
var div = $('dd[id="sp_criteria-element"]').children('div:visible:last').next();
|
var div = $('dd[id="sp_criteria-element"]').children('div:visible:last').next();
|
||||||
|
|
||||||
div.show();
|
div.show();
|
||||||
|
div.children().removeAttr('disabled');
|
||||||
div = div.next();
|
div = div.next();
|
||||||
if(div.length === 0) {
|
if(div.length === 0) {
|
||||||
$(this).hide();
|
$(this).hide();
|
||||||
|
@ -35,9 +36,10 @@ function setSmartPlaylistEvents() {
|
||||||
next = curr.next();
|
next = curr.next();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
list.find('div:visible:last').children().attr('disabled', 'disabled');
|
||||||
list.find("div:visible:last")
|
list.find("div:visible:last")
|
||||||
.find('[name^="sp_criteria"]').val('').end()
|
.find('[name^="sp_criteria"]').val(0).end()
|
||||||
.find('[name^="sp_criteria_modifier"]').val('').end()
|
.find('[name^="sp_criteria_modifier"]').val(0).end()
|
||||||
.find('[name^="sp_criteria_value"]').val('')
|
.find('[name^="sp_criteria_value"]').val('')
|
||||||
.end().hide();
|
.end().hide();
|
||||||
|
|
||||||
|
@ -47,7 +49,7 @@ function setSmartPlaylistEvents() {
|
||||||
form.find('button[id="save_button"]').click(function(event){
|
form.find('button[id="save_button"]').click(function(event){
|
||||||
var playlist_type = form.find('input:radio[name=sp_type]:checked').val(),
|
var playlist_type = form.find('input:radio[name=sp_type]:checked').val(),
|
||||||
data = $('form').serializeArray(),
|
data = $('form').serializeArray(),
|
||||||
static_action = 'Playlist/smart-playlist-criteria-generate',
|
static_action = 'Playlist/smart-playlist-generate',
|
||||||
dynamic_action ='Playlist/smart-playlist-criteria-save',
|
dynamic_action ='Playlist/smart-playlist-criteria-save',
|
||||||
action,
|
action,
|
||||||
callback;
|
callback;
|
||||||
|
@ -81,4 +83,4 @@ function staticCallback() {
|
||||||
|
|
||||||
function dynamicCallback() {
|
function dynamicCallback() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue