Allow smart blocks with no criteria
This commit is contained in:
parent
f05157c376
commit
01b3ae1bf0
|
@ -370,6 +370,10 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
||||||
// add elelments that needs to be added
|
// add elelments that needs to be added
|
||||||
// set multioption for modifier according to criteria_field
|
// set multioption for modifier according to criteria_field
|
||||||
$modRowMap = array();
|
$modRowMap = array();
|
||||||
|
if (!isset($data['criteria'])) {
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($data['criteria'] as $critKey=>$d) {
|
foreach ($data['criteria'] as $critKey=>$d) {
|
||||||
$count = 1;
|
$count = 1;
|
||||||
foreach ($d as $modKey=>$modInfo) {
|
foreach ($d as $modKey=>$modInfo) {
|
||||||
|
|
|
@ -1517,6 +1517,7 @@ SQL;
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// check if file exists
|
// check if file exists
|
||||||
$qry->add("file_exists", "true", Criteria::EQUAL);
|
$qry->add("file_exists", "true", Criteria::EQUAL);
|
||||||
|
@ -1537,7 +1538,6 @@ SQL;
|
||||||
Logging::warning("Unimplemented sortTracks type in ".__FILE__);
|
Logging::warning("Unimplemented sortTracks type in ".__FILE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
// construct limit restriction
|
// construct limit restriction
|
||||||
$limits = array();
|
$limits = array();
|
||||||
|
|
||||||
|
|
|
@ -89,9 +89,9 @@
|
||||||
}
|
}
|
||||||
$nextDisabled = $this->element->getElement("sp_criteria_field_".$nextIndex)->getAttrib('disabled') == 'disabled'?true:false;
|
$nextDisabled = $this->element->getElement("sp_criteria_field_".$nextIndex)->getAttrib('disabled') == 'disabled'?true:false;
|
||||||
?>
|
?>
|
||||||
<div <?php if (($i > 0) && $disabled) {
|
<div <?php if (/*($i > 0) && */ $disabled) {
|
||||||
echo 'style=display:none';
|
echo 'style=display:none';
|
||||||
} ?>>
|
} ?> >
|
||||||
<?php echo $this->element->getElement("sp_criteria_field_".$i."_".$j) ?>
|
<?php echo $this->element->getElement("sp_criteria_field_".$i."_".$j) ?>
|
||||||
<?php echo $this->element->getElement("sp_criteria_modifier_".$i."_".$j) ?>
|
<?php echo $this->element->getElement("sp_criteria_modifier_".$i."_".$j) ?>
|
||||||
<?php echo $this->element->getElement("sp_criteria_value_".$i."_".$j) ?>
|
<?php echo $this->element->getElement("sp_criteria_value_".$i."_".$j) ?>
|
||||||
|
|
|
@ -11,6 +11,17 @@ function setSmartBlockEvents() {
|
||||||
|
|
||||||
var div = $('dd[id="sp_criteria-element"]').children('div:visible:last');
|
var div = $('dd[id="sp_criteria-element"]').children('div:visible:last');
|
||||||
|
|
||||||
|
if (div.length == 0) {
|
||||||
|
div = $('dd[id="sp_criteria-element"]').children('div:first');
|
||||||
|
div.children().removeAttr('disabled');
|
||||||
|
div.show();
|
||||||
|
|
||||||
|
appendAddButton();
|
||||||
|
appendModAddButton();
|
||||||
|
removeButtonCheck();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
div.find('.db-logic-label').text('and').show();
|
div.find('.db-logic-label').text('and').show();
|
||||||
div = div.next().show();
|
div = div.next().show();
|
||||||
|
|
||||||
|
@ -23,6 +34,7 @@ function setSmartBlockEvents() {
|
||||||
appendAddButton();
|
appendAddButton();
|
||||||
appendModAddButton();
|
appendModAddButton();
|
||||||
removeButtonCheck();
|
removeButtonCheck();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/********** ADD MODIFIER ROW **********/
|
/********** ADD MODIFIER ROW **********/
|
||||||
|
@ -512,6 +524,8 @@ function callback(json, type) {
|
||||||
|
|
||||||
form.find('.success').show();
|
form.find('.success').show();
|
||||||
}
|
}
|
||||||
|
removeButtonCheck();
|
||||||
|
|
||||||
form.find('.smart-block-form').removeClass("closed");
|
form.find('.smart-block-form').removeClass("closed");
|
||||||
} else {
|
} else {
|
||||||
if (json.result == "0") {
|
if (json.result == "0") {
|
||||||
|
@ -524,6 +538,7 @@ function callback(json, type) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
AIRTIME.playlist.playlistResponse(json);
|
AIRTIME.playlist.playlistResponse(json);
|
||||||
|
removeButtonCheck();
|
||||||
}
|
}
|
||||||
form.find('.smart-block-form').removeClass("closed");
|
form.find('.smart-block-form').removeClass("closed");
|
||||||
}
|
}
|
||||||
|
@ -551,6 +566,7 @@ function appendAddButton() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeButtonCheck() {
|
function removeButtonCheck() {
|
||||||
|
/*
|
||||||
var rows = $('.active-tab dd[id="sp_criteria-element"]').children('div'),
|
var rows = $('.active-tab dd[id="sp_criteria-element"]').children('div'),
|
||||||
enabled = rows.find('select[name^="sp_criteria_field"]:enabled'),
|
enabled = rows.find('select[name^="sp_criteria_field"]:enabled'),
|
||||||
rmv_button = enabled.siblings('a[id^="criteria_remove"]');
|
rmv_button = enabled.siblings('a[id^="criteria_remove"]');
|
||||||
|
@ -560,7 +576,7 @@ function removeButtonCheck() {
|
||||||
} else {
|
} else {
|
||||||
rmv_button.removeAttr('disabled');
|
rmv_button.removeAttr('disabled');
|
||||||
rmv_button.show();
|
rmv_button.show();
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
function enableLoadingIcon() {
|
function enableLoadingIcon() {
|
||||||
|
|
Loading…
Reference in New Issue