Merge pull request #636 from Robbt/dynamic-smartblock-default

Change dynamic smartblock to be default
This commit is contained in:
frecuencialibre 2018-12-12 15:43:00 -06:00 committed by GitHub
commit 5fba6d6374
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 34 additions and 15 deletions

View File

@ -0,0 +1 @@
ALTER TABLE cc_block ALTER COLUMN type SET DEFAULT 'static';

View File

@ -0,0 +1 @@
ALTER TABLE cc_block ALTER COLUMN type SET DEFAULT 'dynamic';

View File

@ -223,7 +223,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
{
// load type
$out = CcBlockQuery::create()->findPk($p_blockId);
if ($out->getDbType() == "static") {
if ($out->getDbType() == "dynamic") {
$blockType = 0;
} else {
$blockType = 1;
@ -233,8 +233,9 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
$spType->setLabel(_('Type:'))
->setDecorators(array('viewHelper'))
->setMultiOptions(array(
'static' => _('Static'),
'dynamic' => _('Dynamic')
'dynamic' => _('Dynamic'),
'static' => _('Static')
))
->setValue($blockType);
$this->addElement($spType);
@ -491,10 +492,10 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
$generate->setAttrib('title', _('Generate playlist content and save criteria'));
$generate->setIgnore(true);
if ($blockType == 0) {
$generate->setLabel(_('Generate'));
$generate->setLabel(_('Preview'));
}
else {
$generate->setLabel(_('Preview'));
$generate->setLabel(_('Generate'));
}
$generate->setDecorators(array('viewHelper'));
$this->addElement($generate);

View File

@ -361,10 +361,12 @@ SQL;
{
$result = CcBlockcriteriaQuery::create()->filterByDbBlockId($this->id)
->filterByDbCriteria('limit')->findOne();
$modifier = $result->getDbModifier();
$value = $result->getDbValue();
if ($result) {
$modifier = $result->getDbModifier();
$value = $result->getDbValue();
return array($value, $modifier);
}
return array($value, $modifier);
}
// this function returns sum of all track length under this block.
@ -1158,7 +1160,7 @@ SQL;
{
$data = $this->organizeSmartPlaylistCriteria($p_criteria);
// saving dynamic/static flag
$blockType = $data['etc']['sp_type'] == 0 ? 'static':'dynamic';
$blockType = $data['etc']['sp_type'] == 0 ? 'dynamic':'static';
$this->saveType($blockType);
$this->storeCriteriaIntoDb($data);

View File

@ -75,7 +75,7 @@ abstract class BaseCcBlock extends BaseObject implements Persistent
/**
* The value for the type field.
* Note: this column has a database default value of: 'static'
* Note: this column has a database default value of: 'dynamic'
* @var string
*/
protected $type;
@ -151,7 +151,7 @@ abstract class BaseCcBlock extends BaseObject implements Persistent
{
$this->name = '';
$this->length = '00:00:00';
$this->type = 'static';
$this->type = 'dynamic';
}
/**
@ -494,7 +494,7 @@ abstract class BaseCcBlock extends BaseObject implements Persistent
return false;
}
if ($this->type !== 'static') {
if ($this->type !== 'dynamic') {
return false;
}

View File

@ -532,3 +532,17 @@ class AirtimeUpgrader300alpha6 extends AirtimeUpgrader
return '3.0.0-alpha.6';
}
}
class AirtimeUpgrader300alpha7 extends AirtimeUpgrader
{
protected function getSupportedSchemaVersions() {
return array(
'3.0.0-alpha.6'
);
}
public function getNewVersion() {
return '3.0.0-alpha.7';
}
}

View File

@ -299,7 +299,7 @@ CREATE TABLE "cc_block"
"creator_id" INTEGER,
"description" VARCHAR(512),
"length" interval DEFAULT '00:00:00',
"type" VARCHAR(7) DEFAULT 'static',
"type" VARCHAR(7) DEFAULT 'dynamic',
PRIMARY KEY ("id")
);

View File

@ -1277,7 +1277,7 @@ var AIRTIME = (function(AIRTIME) {
}
// remove 'Add to smart block' option if the current
// block is dynamic
if ($('input:radio[name=sp_type]:checked').val() === "1") {
if ($('input:radio[name=sp_type]:checked').val() === "0") {
delete oItems.pl_add;
}
items = oItems;

View File

@ -473,7 +473,7 @@ function setupUI() {
}
if (activeTab.find('.obj_type').val() == 'block') {
if (playlist_type == "0") {
if (playlist_type == "1") {
shuffleButton.removeAttr("disabled");
generateButton.removeAttr("disabled");
generateButton.html($.i18n._("Generate"));