Merge pull request #364 from Robbt/feature/smart-block-dynamic-preview
Feature: Modified form to allow preview of tracks for dynamic smartblocks
This commit is contained in:
commit
63e97692b0
|
@ -163,6 +163,8 @@ final class LocaleController extends Zend_Controller_Action
|
||||||
"is greater than" => _("is greater than"),
|
"is greater than" => _("is greater than"),
|
||||||
"is less than" => _("is less than"),
|
"is less than" => _("is less than"),
|
||||||
"is in the range" => _("is in the range"),
|
"is in the range" => _("is in the range"),
|
||||||
|
"Preview" => _("Preview"),
|
||||||
|
"Generate" => _("Generate"),
|
||||||
//preferences/musicdirs.js
|
//preferences/musicdirs.js
|
||||||
"Choose Storage Folder" => _("Choose Storage Folder"),
|
"Choose Storage Folder" => _("Choose Storage Folder"),
|
||||||
"Choose Folder to Watch" => _("Choose Folder to Watch"),
|
"Choose Folder to Watch" => _("Choose Folder to Watch"),
|
||||||
|
|
|
@ -347,7 +347,12 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
||||||
$generate->setAttrib('class', 'sp-button btn');
|
$generate->setAttrib('class', 'sp-button btn');
|
||||||
$generate->setAttrib('title', _('Generate playlist content and save criteria'));
|
$generate->setAttrib('title', _('Generate playlist content and save criteria'));
|
||||||
$generate->setIgnore(true);
|
$generate->setIgnore(true);
|
||||||
$generate->setLabel(_('Generate'));
|
if ($blockType == 0) {
|
||||||
|
$generate->setLabel(_('Generate'));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$generate->setLabel(_('Preview'));
|
||||||
|
}
|
||||||
$generate->setDecorators(array('viewHelper'));
|
$generate->setDecorators(array('viewHelper'));
|
||||||
$this->addElement($generate);
|
$this->addElement($generate);
|
||||||
|
|
||||||
|
|
|
@ -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
|
* @param boolean $filterFiles if this is true, it will only return files that has
|
||||||
* file_exists flag set to true
|
* file_exists flag set to true
|
||||||
* @return array
|
* @return array
|
||||||
|
@ -273,7 +273,7 @@ SQL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The database stores fades in 00:00:00 Time format with optional millisecond resolution .000000
|
* 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.
|
* will normalize the fade so that it looks like 00.000000 to the user.
|
||||||
**/
|
**/
|
||||||
public function normalizeFade($fade)
|
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.
|
* tracks.
|
||||||
* @param array $p_criteria
|
* @param array $p_criteria
|
||||||
*/
|
*/
|
||||||
|
@ -1259,7 +1259,7 @@ SQL;
|
||||||
$this->saveSmartBlockCriteria($p_criteria);
|
$this->saveSmartBlockCriteria($p_criteria);
|
||||||
$insertList = $this->getListOfFilesUnderLimit();
|
$insertList = $this->getListOfFilesUnderLimit();
|
||||||
$this->deleteAllFilesFromBlock();
|
$this->deleteAllFilesFromBlock();
|
||||||
// constrcut id array
|
// construct id array
|
||||||
$ids = array();
|
$ids = array();
|
||||||
foreach ($insertList as $ele) {
|
foreach ($insertList as $ele) {
|
||||||
$ids[] = $ele['id'];
|
$ids[] = $ele['id'];
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
$items = $this->contents;
|
$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);
|
$isPlaylist = ($this->obj instanceof Application_Model_Playlist);
|
||||||
if (count($items) && ($isStaticSmartBlock || $isPlaylist)) : ?>
|
if (count($items) && ($isSmartBlock || $isPlaylist)) : ?>
|
||||||
<?php $i = 0; ?>
|
<?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) :
|
<?php foreach($items as $item) :
|
||||||
$staticBlock = null;
|
$staticBlock = null;
|
||||||
$nextFileUrl = null;
|
$nextFileUrl = null;
|
||||||
|
|
|
@ -385,11 +385,12 @@ function setupUI() {
|
||||||
if (playlist_type == "0") {
|
if (playlist_type == "0") {
|
||||||
shuffleButton.removeAttr("disabled");
|
shuffleButton.removeAttr("disabled");
|
||||||
generateButton.removeAttr("disabled");
|
generateButton.removeAttr("disabled");
|
||||||
|
generateButton.html($.i18n._("Generate"));
|
||||||
fadesButton.removeAttr("disabled");
|
fadesButton.removeAttr("disabled");
|
||||||
//sortable.children().show();
|
//sortable.children().show();
|
||||||
} else {
|
} else {
|
||||||
shuffleButton.attr("disabled", "disabled");
|
shuffleButton.attr("disabled", "disabled");
|
||||||
generateButton.attr("disabled", "disabled");
|
generateButton.html($.i18n._("Preview"));
|
||||||
fadesButton.attr("disabled", "disabled");
|
fadesButton.attr("disabled", "disabled");
|
||||||
//sortable.children().hide();
|
//sortable.children().hide();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue