added UI to toggle autoplaylist repeat option

This commit is contained in:
Robb Ebright 2017-03-31 00:00:19 -04:00
parent 7a944ac9ce
commit c12ad4ea4f
13 changed files with 64 additions and 2 deletions

View File

@ -0,0 +1 @@
ALTER TABLE cc_show DROP COLUMN IF EXISTS autoplaylist_repeat;

View File

@ -0,0 +1 @@
ALTER TABLE cc_show ADD COLUMN autoplaylist_repeat boolean default 'f' NOT NULL;

View File

@ -27,6 +27,13 @@ class Application_Form_AddShowAutoPlaylist extends Zend_Form_SubForm
$autoPlaylistSelect->setValue(null); $autoPlaylistSelect->setValue(null);
$autoPlaylistSelect->setDecorators(array('ViewHelper')); $autoPlaylistSelect->setDecorators(array('ViewHelper'));
$this->addElement($autoPlaylistSelect); $this->addElement($autoPlaylistSelect);
// Add autoplaylist checkbox element
$this->addElement('checkbox', 'add_show_autoplaylist_repeat', array(
'label' => _('Repeat AutoPlaylist Until Show is Full ?'),
'required' => false,
'class' => 'input_text',
'decorators' => array('ViewHelper')
));
} }
public function disable() public function disable()

View File

@ -135,6 +135,13 @@ class Application_Model_Show
$hasAutoPlaylist = $show->getDbHasAutoPlaylist(); $hasAutoPlaylist = $show->getDbHasAutoPlaylist();
return $hasAutoPlaylist; return $hasAutoPlaylist;
} }
public function getAutoPlaylistRepeat() {
$show = CcShowQuery::create()->findPK($this->_showId);
$AutoPlaylistRepeat = $show->getDbAutoPlaylistRepeat();
return $AutoPlaylistRepeat;
}
public function setHasAutoPlaylist($value) public function setHasAutoPlaylist($value)
{ {

View File

@ -96,7 +96,15 @@ SQL;
return $show->getDbAutoPlaylistId(); return $show->getDbAutoPlaylistId();
} }
public function getAutoPlaylistRepeat()
{
$show = CcShowQuery::create()->findPK($this->getShowId());
return $show->getDbAutoPlaylistRepeat();
}
/** /**
* Return the start time of the Show (UTC time) * Return the start time of the Show (UTC time)
* @return string in format DEFAULT_TIMESTAMP_FORMAT (PHP time notation) * @return string in format DEFAULT_TIMESTAMP_FORMAT (PHP time notation)

View File

@ -321,6 +321,7 @@ class CcShow extends BaseCcShow {
$info['linked'] = $this->getDbLinked(); $info['linked'] = $this->getDbLinked();
$info['has_autoplaylist'] = $this->getDbHasAutoPlaylist(); $info['has_autoplaylist'] = $this->getDbHasAutoPlaylist();
$info['autoplaylist_id'] = $this->getDbAutoPlaylistId(); $info['autoplaylist_id'] = $this->getDbAutoPlaylistId();
$info['autoplaylist_repeat'] = $this->getDbAutoPlaylistRepeat();
return $info; return $info;
} }

View File

@ -153,7 +153,8 @@ class Application_Service_ShowFormService
$form->populate( $form->populate(
array( array(
'add_show_has_autoplaylist' => $this->ccShow->getDbHasAutoPlaylist() ? 1 : 0, 'add_show_has_autoplaylist' => $this->ccShow->getDbHasAutoPlaylist() ? 1 : 0,
'add_show_autoplaylist_id' => $this->ccShow->getDbAutoPlaylistId() 'add_show_autoplaylist_id' => $this->ccShow->getDbAutoPlaylistId(),
'add_show_autoplaylist_repeat' => $this->ccShow->getDbAutoPlaylistRepeat()
)); ));
} }

View File

@ -1541,6 +1541,7 @@ SQL;
$ccShow->setDbLiveStreamUser($showData['custom_username']); $ccShow->setDbLiveStreamUser($showData['custom_username']);
$ccShow->setDbLiveStreamPass($showData['custom_password']); $ccShow->setDbLiveStreamPass($showData['custom_password']);
$ccShow->setDbHasAutoPlaylist($showData['add_show_has_autoplaylist'] == 1); $ccShow->setDbHasAutoPlaylist($showData['add_show_has_autoplaylist'] == 1);
$ccShow->setDbAutoPlaylistRepeat($showData['add_show_autoplaylist_repeat'] == 1);
// added to prevent errors with insert due to a lack of data // added to prevent errors with insert due to a lack of data
if ($showData['add_show_autoplaylist_id'] != '') { if ($showData['add_show_autoplaylist_id'] != '') {
$ccShow->setDbAutoPlaylistId($showData['add_show_autoplaylist_id']); $ccShow->setDbAutoPlaylistId($showData['add_show_autoplaylist_id']);

View File

@ -519,3 +519,15 @@ class AirtimeUpgrader300alpha1 extends AirtimeUpgrader
return '3.0.0-alpha.1'; return '3.0.0-alpha.1';
} }
} }
class AirtimeUpgrader300alpha2 extends AirtimeUpgrader
{
protected function getSupportedSchemaVersions() {
return array(
'3.0.0-alpha'
);
}
public function getNewVersion() {
return '3.0.0-alpha.2';
}
}

View File

@ -18,5 +18,17 @@
<dd> <dd>
<?php echo $this->element->getElement('add_show_autoplaylist_id') ?> <?php echo $this->element->getElement('add_show_autoplaylist_id') ?>
</div> </div>
<div id="add_show_autoplaylist_repeat">
<dt id="add_show_autoplaylist_repeat_label">
<label for="add_show_autoplaylist_repeat_label">
<?php echo $this->element->getElement('add_show_autoplaylist_repeat')->getLabel()?>
</label>
</dt>
<dd>
<?php echo $this->element->getElement('add_show_autoplaylist_repeat') ?>
</dd>
</div>
</dl> </dl>
</fieldset> </fieldset>

View File

@ -162,6 +162,7 @@ CREATE TABLE "cc_show"
"image_path" VARCHAR(255) DEFAULT '', "image_path" VARCHAR(255) DEFAULT '',
"has_autoplaylist" BOOLEAN DEFAULT 'f' NOT NULL, "has_autoplaylist" BOOLEAN DEFAULT 'f' NOT NULL,
"autoplaylist_id" INTEGER, "autoplaylist_id" INTEGER,
"autoplaylist_repeat" BOOLEAN DEFAULT 'f' NOT NULL,
PRIMARY KEY ("id") PRIMARY KEY ("id")
); );

View File

@ -269,6 +269,7 @@ function setAddShowEvents(form) {
if(!form.find("#add_show_has_autoplaylist").attr('checked')) { if(!form.find("#add_show_has_autoplaylist").attr('checked')) {
form.find("#add_show_playlist_dropdown").hide(); form.find("#add_show_playlist_dropdown").hide();
form.find("#add_show_autoplaylist_repeat").hide();
} }
else { else {
$("#add_show_playlist_dropdown").show(); $("#add_show_playlist_dropdown").show();
@ -300,12 +301,14 @@ function setAddShowEvents(form) {
form.find("#add_show_has_autoplaylist").click(function(){ form.find("#add_show_has_autoplaylist").click(function(){
$(this).blur(); $(this).blur();
form.find("#add_show_playlist_dropdown").toggle(); form.find("#add_show_playlist_dropdown").toggle();
form.find("#add_show_autoplaylist_repeat").toggle();
var checkBoxSelected = false; var checkBoxSelected = false;
//must switch rebroadcast displays //must switch rebroadcast displays
if(form.find("#add_show_has_autoplaylist").attr('checked')) { if(form.find("#add_show_has_autoplaylist").attr('checked')) {
form.find("#add_show_playlist_dropdown").show(); form.find("#add_show_playlist_dropdown").show();
form.find("#add_show_autoplaylist_repeat").show();
} }
else { else {
form.find("#add_show_playlist_downdown").hide(); form.find("#add_show_playlist_downdown").hide();

View File

@ -18,6 +18,7 @@ Class ShowServiceData
"add_show_duration" => "01h 00m", "add_show_duration" => "01h 00m",
"add_show_timezone" => "UTC", "add_show_timezone" => "UTC",
"add_show_has_autoplaylist" => false, "add_show_has_autoplaylist" => false,
"add_show_autoplaylist_repeat" => false,
"add_show_autoplaylist_id" => null, "add_show_autoplaylist_id" => null,
"add_show_repeats" => 0, "add_show_repeats" => 0,
"add_show_linked" => 0, "add_show_linked" => 0,
@ -95,6 +96,7 @@ Class ShowServiceData
"add_show_duration" => "01h 00m", "add_show_duration" => "01h 00m",
"add_show_timezone" => "UTC", "add_show_timezone" => "UTC",
"add_show_has_autoplaylist" => false, "add_show_has_autoplaylist" => false,
"add_show_autoplaylist_repeat" => false,
"add_show_autoplaylist_id" => null, "add_show_autoplaylist_id" => null,
"add_show_repeats" => 1, "add_show_repeats" => 1,
"add_show_linked" => 0, "add_show_linked" => 0,
@ -172,6 +174,7 @@ Class ShowServiceData
"add_show_duration" => "01h 00m", "add_show_duration" => "01h 00m",
"add_show_timezone" => "UTC", "add_show_timezone" => "UTC",
"add_show_has_autoplaylist" => false, "add_show_has_autoplaylist" => false,
"add_show_autoplaylist_repeat" => false,
"add_show_autoplaylist_id" => null, "add_show_autoplaylist_id" => null,
"add_show_repeats" => 1, "add_show_repeats" => 1,
"add_show_linked" => 0, "add_show_linked" => 0,
@ -260,6 +263,7 @@ Class ShowServiceData
"add_show_duration" => "01h 00m", "add_show_duration" => "01h 00m",
"add_show_timezone" => "UTC", "add_show_timezone" => "UTC",
"add_show_has_autoplaylist" => false, "add_show_has_autoplaylist" => false,
"add_show_autoplaylist_repeat" => false,
"add_show_autoplaylist_id" => null, "add_show_autoplaylist_id" => null,
"add_show_repeats" => 0, "add_show_repeats" => 0,
"add_show_linked" => 0, "add_show_linked" => 0,
@ -288,6 +292,7 @@ Class ShowServiceData
"add_show_duration" => "01h 00m", "add_show_duration" => "01h 00m",
"add_show_timezone" => "UTC", "add_show_timezone" => "UTC",
"add_show_has_autoplaylist" => false, "add_show_has_autoplaylist" => false,
"add_show_autoplaylist_repeat" => false,
"add_show_autoplaylist_id" => null, "add_show_autoplaylist_id" => null,
"add_show_repeats" => 1, "add_show_repeats" => 1,
"add_show_linked" => 0, "add_show_linked" => 0,
@ -366,6 +371,7 @@ Class ShowServiceData
"add_show_duration" => "01h 00m", "add_show_duration" => "01h 00m",
"add_show_timezone" => "UTC", "add_show_timezone" => "UTC",
"add_show_has_autoplaylist" => false, "add_show_has_autoplaylist" => false,
"add_show_autoplaylist_repeat" => false,
"add_show_autoplaylist_id" => null, "add_show_autoplaylist_id" => null,
"add_show_repeats" => 0, "add_show_repeats" => 0,
"add_show_linked" => 0, "add_show_linked" => 0,
@ -443,6 +449,7 @@ Class ShowServiceData
"add_show_duration" => "01h 00m", "add_show_duration" => "01h 00m",
"add_show_timezone" => "UTC", "add_show_timezone" => "UTC",
"add_show_has_autoplaylist" => false, "add_show_has_autoplaylist" => false,
"add_show_autoplaylist_repeat" => false,
"add_show_autoplaylist_id" => null, "add_show_autoplaylist_id" => null,
"add_show_repeats" => 1, "add_show_repeats" => 1,
"add_show_linked" => 0, "add_show_linked" => 0,