Modified smartblock form to allow preview of tracks meeting criteria for dynamic smartblocks

This commit is contained in:
Robb Ebright 2017-11-21 21:22:06 -05:00
parent 6bca9c8a6d
commit 6bdb570338
4 changed files with 17 additions and 8 deletions

View File

@ -347,7 +347,12 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
$generate->setAttrib('class', 'sp-button btn');
$generate->setAttrib('title', _('Generate playlist content and save criteria'));
$generate->setIgnore(true);
$generate->setLabel(_('Generate'));
if ($blockType == 0) {
$generate->setLabel(_('Generate'));
}
else {
$generate->setLabel(_('Preview'));
}
$generate->setDecorators(array('viewHelper'));
$this->addElement($generate);

View File

@ -179,7 +179,7 @@ class Application_Model_Block implements Application_Model_LibraryEditable
}
/**
* Get the entire block as a two dimentional array, sorted in order of play.
* Get the entire block as a two dimensional array, sorted in order of play.
* @param boolean $filterFiles if this is true, it will only return files that has
* file_exists flag set to true
* @return array
@ -273,7 +273,7 @@ SQL;
/**
* The database stores fades in 00:00:00 Time format with optional millisecond resolution .000000
* but this isn't practical since fades shouldn't be very long usuall 1 second or less. This function
* but this isn't practical since fades shouldn't be very long usually 1 second or less. This function
* will normalize the fade so that it looks like 00.000000 to the user.
**/
public function normalizeFade($fade)
@ -1250,7 +1250,7 @@ SQL;
}
/**
* generate list of tracks. This function saves creiteria and generate
* generate list of tracks. This function saves criteria and generate
* tracks.
* @param array $p_criteria
*/
@ -1259,7 +1259,7 @@ SQL;
$this->saveSmartBlockCriteria($p_criteria);
$insertList = $this->getListOfFilesUnderLimit();
$this->deleteAllFilesFromBlock();
// constrcut id array
// construct id array
$ids = array();
foreach ($insertList as $ele) {
$ids[] = $ele['id'];

View File

@ -1,9 +1,12 @@
<?php
$items = $this->contents;
$isStaticSmartBlock = ($this->obj instanceof Application_Model_Block && $this->obj->isStatic());
$isSmartBlock = ($this->obj instanceof Application_Model_Block);
$isPlaylist = ($this->obj instanceof Application_Model_Playlist);
if (count($items) && ($isStaticSmartBlock || $isPlaylist)) : ?>
if (count($items) && ($isSmartBlock || $isPlaylist)) : ?>
<?php $i = 0; ?>
<?php if (!($this->obj->isStatic())) {
echo _("</br>This is only a preview of possible content generated by the smart block based upon the above criteria.");}
?>
<?php foreach($items as $item) :
$staticBlock = null;
$nextFileUrl = null;

View File

@ -385,11 +385,12 @@ function setupUI() {
if (playlist_type == "0") {
shuffleButton.removeAttr("disabled");
generateButton.removeAttr("disabled");
generateButton.html($.i18n._("Generate"));
fadesButton.removeAttr("disabled");
//sortable.children().show();
} else {
shuffleButton.attr("disabled", "disabled");
generateButton.attr("disabled", "disabled");
generateButton.html($.i18n._("Preview"));
fadesButton.attr("disabled", "disabled");
//sortable.children().hide();
}