CC-84: Smart Playlists
-0-indexed form elements
This commit is contained in:
parent
4842f1a5a1
commit
c27b886817
3 changed files with 15 additions and 15 deletions
|
@ -58,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(
|
||||||
|
@ -79,23 +79,23 @@ 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 != 1){
|
if ($i != 0){
|
||||||
$criteria->setAttrib('disabled', 'disabled');
|
$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 != 1){
|
if ($i != 0){
|
||||||
$criteriaModifers->setAttrib('disabled', 'disabled');
|
$criteriaModifers->setAttrib('disabled', 'disabled');
|
||||||
}
|
}
|
||||||
$this->addElement($criteriaModifers);
|
$this->addElement($criteriaModifers);
|
||||||
|
@ -103,7 +103,7 @@ class Application_Form_SmartPlaylistCriteria extends Zend_Form_SubForm
|
||||||
$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 != 1){
|
if ($i != 0){
|
||||||
$criteriaValue->setAttrib('disabled', 'disabled');
|
$criteriaValue->setAttrib('disabled', 'disabled');
|
||||||
}
|
}
|
||||||
$this->addElement($criteriaValue);
|
$this->addElement($criteriaValue);
|
||||||
|
|
|
@ -17,15 +17,15 @@
|
||||||
</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)->getAttrib('disabled') == 'disabled')) {
|
<div <?php if (($i > 0) && ($this->element->getElement('sp_criteria_'.$i)->getAttrib('disabled') == 'disabled')) {
|
||||||
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) ?>
|
||||||
<?php if ($i != 1) { ?>
|
<?php if ($i != 0) { ?>
|
||||||
<a href='#' id='criteria_remove_<?php echo $i ?>'>Remove</a>
|
<a href='#' id='criteria_remove_<?php echo $i ?>'>Remove</a>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -38,8 +38,8 @@ function setSmartPlaylistEvents() {
|
||||||
|
|
||||||
list.find('div:visible:last').children().attr('disabled', 'disabled');
|
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();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue