From 3a4a827f1fb5b7a9188e53ce8fae99924111c458 Mon Sep 17 00:00:00 2001 From: denise Date: Wed, 8 Aug 2012 15:24:47 -0400 Subject: [PATCH 1/4] CC-4180: Smart Playlist Builder: modifier select boxes do not change when criteria changes -fixed --- .../airtime/playlist/smart_playlistbuilder.js | 37 ++++++++++--------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/airtime_mvc/public/js/airtime/playlist/smart_playlistbuilder.js b/airtime_mvc/public/js/airtime/playlist/smart_playlistbuilder.js index 81ba7acaa..8123e99c4 100644 --- a/airtime_mvc/public/js/airtime/playlist/smart_playlistbuilder.js +++ b/airtime_mvc/public/js/airtime/playlist/smart_playlistbuilder.js @@ -429,26 +429,27 @@ function sizeTextBoxes(ele, classToRemove, classToAdd) { } function populateModifierSelect(e) { - /*var criteria = $(e).val(), - criteria_type = criteriaTypes[criteria],*/ var criteria_type = getCriteriaOptionType(e), - div = $(e).siblings('select[id^="sp_criteria_modifier"]'); + index = getRowIndex($(e).parent()), + divs = $(e).parents().find('select[id^="sp_criteria_modifier_'+index+'"]'); - div.children().remove(); - - if (criteria_type == 's') { - $.each(stringCriteriaOptions, function(key, value){ - div.append($('') - .attr('value', key) - .text(value)); - }); - } else { - $.each(numericCriteriaOptions, function(key, value){ - div.append($('') - .attr('value', key) - .text(value)); - }); - } + $.each(divs, function(i, div){ + $(div).children().remove(); + + if (criteria_type == 's') { + $.each(stringCriteriaOptions, function(key, value){ + $(div).append($('') + .attr('value', key) + .text(value)); + }); + } else { + $.each(numericCriteriaOptions, function(key, value){ + $(div).append($('') + .attr('value', key) + .text(value)); + }); + } + }); } function getCriteriaOptionType(e) { From d1e6f8178bb6fcb98fe9d73f764e02e1dabb0a69 Mon Sep 17 00:00:00 2001 From: James Date: Wed, 8 Aug 2012 15:29:09 -0400 Subject: [PATCH 2/4] CC-4166: Playlist Builder -> Regular Playlist : clicking Fade in/out button for a empty playlist will cause PHP Fatal Error - fixed. Not displaying fade setting button if the playst/smartplaylist is empty. --- .../application/controllers/PlaylistController.php | 7 ++++--- .../application/views/scripts/playlist/playlist.phtml | 9 +++++++-- .../views/scripts/playlist/smart-block.phtml | 9 +++++++-- .../application/views/scripts/playlist/update.phtml | 2 +- airtime_mvc/public/js/airtime/library/spl.js | 11 ++++++++++- .../js/airtime/playlist/smart_playlistbuilder.js | 11 +++++++++++ 6 files changed, 40 insertions(+), 9 deletions(-) diff --git a/airtime_mvc/application/controllers/PlaylistController.php b/airtime_mvc/application/controllers/PlaylistController.php index c4472d843..da78aa47c 100644 --- a/airtime_mvc/application/controllers/PlaylistController.php +++ b/airtime_mvc/application/controllers/PlaylistController.php @@ -55,7 +55,7 @@ class PlaylistController extends Zend_Controller_Action } private function changePlaylist($p_id, $p_type) - { + { if (is_null($p_id) || is_null($p_type)) { unset($this->obj_sess->id); unset($this->obj_sess->type); @@ -71,6 +71,7 @@ class PlaylistController extends Zend_Controller_Action $this->view->length = $formatter->format(); $this->view->obj = $obj; + $this->view->contents = $obj->getContents(); $this->view->html = $this->view->render('playlist/update.phtml'); $this->view->name = $obj->getName(); $this->view->description = $obj->getDescription(); @@ -215,7 +216,7 @@ class PlaylistController extends Zend_Controller_Action } public function newAction() - { + { //$pl_sess = $this->pl_sess; $userInfo = Zend_Auth::getInstance()->getStorage()->read(); $type = $this->_getParam('type'); @@ -335,7 +336,7 @@ class PlaylistController extends Zend_Controller_Action } else if ($e->getMessage() == 'track to dynamic') { $this->blockDynamic($obj); } else { - $this->playlistUnknownError($e); + $this->playlistUnknownError($e); } } } diff --git a/airtime_mvc/application/views/scripts/playlist/playlist.phtml b/airtime_mvc/application/views/scripts/playlist/playlist.phtml index 3979bdfc6..5f0572b16 100644 --- a/airtime_mvc/application/views/scripts/playlist/playlist.phtml +++ b/airtime_mvc/application/views/scripts/playlist/playlist.phtml @@ -1,7 +1,11 @@ +obj->getContents(); +$count = count($contents); +?> obj)) : ?> - + "> Playlist crossfade @@ -49,7 +53,8 @@
    - render('playlist/update.phtml') ?> + contents = $contents; + echo $this->render('playlist/update.phtml') ?>
diff --git a/airtime_mvc/application/views/scripts/playlist/smart-block.phtml b/airtime_mvc/application/views/scripts/playlist/smart-block.phtml index 30d9c8664..ffa7b36a3 100644 --- a/airtime_mvc/application/views/scripts/playlist/smart-block.phtml +++ b/airtime_mvc/application/views/scripts/playlist/smart-block.phtml @@ -1,7 +1,11 @@ +obj->getContents(); +$count = count($contents); +?> obj)) : ?> - + "> Playlist crossfade @@ -49,7 +53,8 @@
    - render('playlist/update.phtml') ?> + contents = $contents; + echo $this->render('playlist/update.phtml') ?>
diff --git a/airtime_mvc/application/views/scripts/playlist/update.phtml b/airtime_mvc/application/views/scripts/playlist/update.phtml index 288b595e3..c876f1f26 100644 --- a/airtime_mvc/application/views/scripts/playlist/update.phtml +++ b/airtime_mvc/application/views/scripts/playlist/update.phtml @@ -1,5 +1,5 @@ obj->getContents(); +$items = $this->contents; if (count($items)) : ?> 0) { + $("#spl_crossfade").hide(); + } else { + $("#spl_crossfade").show(); + } + } + function getId() { return parseInt($("#obj_id").val(), 10); } @@ -803,6 +811,7 @@ var AIRTIME = (function(AIRTIME){ } else { setPlaylistContent(json); + setFadeIcon(); } mod.enableUI(); diff --git a/airtime_mvc/public/js/airtime/playlist/smart_playlistbuilder.js b/airtime_mvc/public/js/airtime/playlist/smart_playlistbuilder.js index d9b00c694..8c537770d 100644 --- a/airtime_mvc/public/js/airtime/playlist/smart_playlistbuilder.js +++ b/airtime_mvc/public/js/airtime/playlist/smart_playlistbuilder.js @@ -181,6 +181,7 @@ function setSmartPlaylistEvents() { enableLoadingIcon(); $.post(save_action, {format: "json", data: data, obj_id: obj_id}, function(data){ callback(data, "save"); + setFadeIcon(); disableLoadingIcon(); }); }); @@ -254,6 +255,16 @@ function setStaticLengthHolder(lenVal) { } */ +function setFadeIcon(){ + var contents = $("#spl_sortable"); + var show = contents.is(":visible"); + if (show) { + $("#spl_crossfade").show(); + } else { + $("#spl_crossfade").hide(); + } +} + /* This function appends a '+' button for the last * modifier row of each criteria. * If there are no modifier rows, the '+' button From 791989faf7d975bde01fe46a5de2c2e88d0737a7 Mon Sep 17 00:00:00 2001 From: denise Date: Wed, 8 Aug 2012 15:35:28 -0400 Subject: [PATCH 3/4] Smart Playlists: changed label 'block' to 'playlist' type --- airtime_mvc/application/forms/SmartBlockCriteria.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airtime_mvc/application/forms/SmartBlockCriteria.php b/airtime_mvc/application/forms/SmartBlockCriteria.php index e3dc91c92..8fb007aef 100644 --- a/airtime_mvc/application/forms/SmartBlockCriteria.php +++ b/airtime_mvc/application/forms/SmartBlockCriteria.php @@ -101,7 +101,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm $spType = new Zend_Form_Element_Radio('sp_type'); - $spType->setLabel('Set smart block type:') + $spType->setLabel('Set smart playlist type:') ->setDecorators(array('viewHelper')) ->setMultiOptions(array( 'static' => 'Static', From 90ec04685498943dabef9ef6b5a5b63877f7aadd Mon Sep 17 00:00:00 2001 From: denise Date: Wed, 8 Aug 2012 16:27:03 -0400 Subject: [PATCH 4/4] CC-4188: Playlist Builder -> Smart Playlist : sometimes elements do not index properly when add a new criteria row -fixed --- .../airtime/playlist/smart_playlistbuilder.js | 24 ++++--------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/airtime_mvc/public/js/airtime/playlist/smart_playlistbuilder.js b/airtime_mvc/public/js/airtime/playlist/smart_playlistbuilder.js index b3f761961..ae7ea76c5 100644 --- a/airtime_mvc/public/js/airtime/playlist/smart_playlistbuilder.js +++ b/airtime_mvc/public/js/airtime/playlist/smart_playlistbuilder.js @@ -25,18 +25,8 @@ function setSmartPlaylistEvents() { form.find('a[id^="modifier_add"]').live('click', function(){ var id = $(this).attr('id'), row_index = id.charAt(id.length-1), - mod_index, criteria_value = $(this).siblings('select[name^="sp_criteria_field"]').val(); - //get index for the new modifier row - if ($(this).parent().find('select[name^="sp_criteria_modifier_'+row_index+'_"]').length == 0) { - mod_index = 0; - } else { - var last_mod = $(this).parent().find('select[name^="sp_criteria_modifier_'+row_index+'_"]:last'); - var last_mod_id = last_mod.attr('id'); - mod_index = parseInt(last_mod_id.substr(last_mod_id.length-1))+1; - } - //make new modifier row var newRow = $(this).parent().clone(), newRowCrit = newRow.find('select[name^="sp_criteria_field"]'), @@ -53,27 +43,21 @@ function setSmartPlaylistEvents() { //hide the critieria field select box newRowCrit.addClass('sp-invisible'); - //append modifier index to the new modifier row - newRowCrit.attr('name', 'sp_criteria_field_'+row_index+'_'+mod_index); - newRowCrit.attr('id', 'sp_criteria_field_'+row_index+'_'+mod_index); + //keep criteria value the same newRowCrit.val(criteria_value); - newRowMod.attr('name', 'sp_criteria_modifier_'+row_index+'_'+mod_index); - newRowMod.attr('id', 'sp_criteria_modifier_'+row_index+'_'+mod_index); + + //reset all other values newRowMod.val('0'); - newRowVal.attr('name', 'sp_criteria_value_'+row_index+'_'+mod_index); - newRowVal.attr('id', 'sp_criteria_value_'+row_index+'_'+mod_index); newRowVal.val(''); - newRowExtra.attr('name', 'sp_criteria_extra_'+row_index+'_'+mod_index); - newRowExtra.attr('id', 'sp_criteria_extra_'+row_index+'_'+mod_index); newRowExtra.val(''); disableAndHideExtraField(newRowVal); sizeTextBoxes(newRowVal, 'sp_extra_input_text', 'sp_input_text'); - newRowRemove.attr('id', 'criteria_remove_'+row_index+'_'+mod_index); //remove the 'criteria add' button from new modifier row newRow.find('.criteria_add').remove(); $(this).parent().after(newRow); + reindexElements(); appendAddButton(); appendModAddButton(); removeButtonCheck();