Merge branch 'saas-dev-publishing' into saas-dev-publishing-schema-change

Conflicts:
	airtime_mvc/application/models/airtime/Podcast.php
This commit is contained in:
drigato 2015-10-14 11:04:41 -04:00
commit c166b4f00e
37 changed files with 540 additions and 277 deletions

View file

@ -22,7 +22,7 @@ final class TaskManager {
/**
* @var int TASK_INTERVAL_SECONDS how often, in seconds, to run the TaskManager tasks
*/
const TASK_INTERVAL_SECONDS = 300; // 5 minutes - will be run on every pypo request
const TASK_INTERVAL_SECONDS = 30;
/**
* @var $con PDO Propel connection object

View file

@ -21,6 +21,8 @@ define('ABOUT_AIRTIME_URL' , 'https://www.airtime.pro/support/');
define('AIRTIME_TRANSIFEX_URL' , 'https://www.transifex.com/projects/p/airtime/');
define('WHMCS_PASSWORD_RESET_URL' , 'https://account.sourcefabric.com/pwreset.php');
define('SUPPORT_TICKET_URL' , 'https://sourcefabricberlin.zendesk.com/hc/en-us/requests/new');
define('UI_REVAMP_EMBED_URL' , 'https://www.youtube.com/embed/nqpNnCKGluY');
define('UI_REVAMP_YOUTUBE_URL' , 'https://www.youtube.com/watch?v=nqpNnCKGluY&feature=youtu.be');
define('LICENSE_VERSION' , 'GNU AGPL v.3');
define('LICENSE_URL' , 'http://www.gnu.org/licenses/agpl-3.0-standalone.html');

View file

@ -172,6 +172,11 @@ $pages = array(
'label' => _(sprintf("Help Translate %s", PRODUCT_NAME)),
'uri' => AIRTIME_TRANSIFEX_URL,
'target' => "_blank"
),
array(
'label' => _('What\'s New?'),
'uri' => UI_REVAMP_YOUTUBE_URL,
'target' => "_blank"
)
)
),

View file

@ -426,8 +426,9 @@ class LocaleController extends Zend_Controller_Action
"Next",
"Previous",
": activate to sort column ascending",
": activate to sort column descending"
": activate to sort column descending",
//End of datatables
"Welcome to the new Airtime Pro!" => _("Welcome to the new Airtime Pro!")
);
$this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);

View file

@ -207,10 +207,6 @@ class PreferenceController extends Zend_Controller_Action
$values["s4_data"] = $s4_data;
if ($form->isValid($values)) {
$values['icecast_vorbis_metadata'] = $form->getValue('icecast_vorbis_metadata');
$values['streamFormat'] = $form->getValue('streamFormat');
Application_Model_StreamSetting::setStreamSetting($values);
/* If the admin password values are empty then we should not

View file

@ -55,6 +55,7 @@ class ShowbuilderController extends Zend_Controller_Action
$this->view->headScript()->appendFile($baseUrl.'js/airtime/showbuilder/main_builder.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
// MEDIA BUILDER
$this->view->headScript()->appendFile($baseUrl.'js/js-timezone-detect/jstz-1.0.4.min.js','text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/library/spl.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/library/podcast.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/library/publish.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
@ -84,6 +85,8 @@ class ShowbuilderController extends Zend_Controller_Action
$end = DateTime::createFromFormat("U", $to, $utcTimezone);
$end->setTimezone($displayTimeZone);
$this->checkAndShowSetupPopup($request);
$form = new Application_Form_ShowBuilder();
$form->populate(array(
'sb_date_start' => $start->format("Y-m-d"),

View file

@ -63,12 +63,16 @@ class WebstreamController extends Zend_Controller_Action
if (!$isAdminOrPM && $webstream->getDbCreatorId() != $user->getId()) {
$this->view->objType = "webstream";
$this->view->type = "webstream";
$this->view->obj = $obj;
$this->view->id = $id;
$this->view->html = $this->view->render('playlist/permission-denied.phtml');
return;
}
$this->view->obj = $obj;
$this->view->type = "webstream";
$this->view->id = $id;
$this->view->action = "edit";
$this->view->html = $this->view->render('webstream/webstream.phtml');
}

View file

@ -85,7 +85,11 @@ class Application_Form_ShowBuilder extends Zend_Form_SubForm
private function getShowNames()
{
$showNames = array("0" => _("Filter by Show"));
$user = Application_Model_User::getCurrentUser();
$showNames = array("0" => _("Filter by Show"));
if ($user->getType() === 'H') {
$showNames["-1"] = _("My Shows");
}
$shows = CcShowQuery::create()
->setFormatter(ModelCriteria::FORMAT_ON_DEMAND)

View file

@ -167,6 +167,56 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
</div>
</div>
</script>
<?php
// Show users the What's New dialog if they haven't seen it yet
// TODO: If you're updating this, be sure to update defaultdata! (Suboptimal, is there a better way?)
if (!Application_Model_Preference::getWhatsNewDialogViewed()) {
?>
<div id="whatsnew">
<div>
<div id="whatsnew_video">
<iframe width="560" height="315" src="<?php echo UI_REVAMP_EMBED_URL ?>" frameborder="0" allowfullscreen></iframe>
</div>
<h2><?php echo _("Airtime Pro has a new look!"); ?></h2>
<p><?php echo _("Your favorite features are now even easier to use - and we've even
added a few new ones! Check out the video above or read on to find out more."); ?></p>
<ul>
<li><?php echo _("Our new Dashboard view now has a powerful tabbed editing interface, so updating your tracks and playlists
is easier than ever."); ?></li>
<li><?php echo _("We've streamlined the Airtime interface to make navigation easier. With the most important tools
just a click away, you'll be on air and hands-free in no time."); ?></li>
<li><?php echo _("Got a huge music library? No problem! With the new Upload page, you can drag and drop whole folders to our private cloud."); ?></li>
<li><?php echo _("The new Airtime is smoother, sleeker, and faster - on even more devices! We're committed to improving the Airtime
experience, no matter how you're connected."); ?></li>
</ul>
</div>
<button id="whatsnew_close" class="btn btn-new">OK, got it!</button>
</div>
<script>
$(document).ready(function() {
var whatsnew = $("#whatsnew");
whatsnew.dialog({
title: $.i18n._("Welcome to the new Airtime Pro!"),
width: "auto",
height: "auto",
modal: true,
resizable: false,
close: function() {
$(this).dialog('destroy').remove();
}
});
$("#whatsnew_close").on("click", function() {
whatsnew.dialog("close");
});
});
</script>
<?php
Application_Model_Preference::setWhatsNewDialogViewed(true);
}
?>
</body>
</html>

View file

@ -138,7 +138,13 @@ class Application_Model_Preference
$st->execute();
}
private static function getValue($key, $isUserValue = false)
/**
* @param string $key the preference key string
* @param bool|false $isUserValue select the preference for the current user
* @param bool|false $forceDefault only look for default (no user ID) values
* @return mixed the preference value
*/
private static function getValue($key, $isUserValue = false, $forceDefault = false)
{
$cache = new Cache();
@ -164,6 +170,8 @@ class Application_Model_Preference
if ($isUserValue) {
$sql .= " AND subjid = :id";
$paramMap[':id'] = $userId;
} else if ($forceDefault) {
$sql .= " AND subjid IS NULL";
}
$result = Application_Common_Database::prepareAndExecute($sql, $paramMap, Application_Common_Database::COLUMN);
@ -1478,4 +1486,20 @@ class Application_Model_Preference
{
self::setValue("lang_tz_setup_complete", $value);
}
public static function getWhatsNewDialogViewed()
{
$val = self::getValue("whats_new_dialog_viewed", true);
if (empty($val)) {
// Check the default (no user ID) value if the user value is empty
// This is so that new stations won't see the popup
$val = self::getValue("whats_new_dialog_viewed", false, true);
}
return empty($val) ? false : $val;
}
public static function setWhatsNewDialogViewed($value)
{
self::setValue("whats_new_dialog_viewed", $value, true);
}
}

View file

@ -1035,7 +1035,11 @@ SQL;
self::createStreamScheduleEvent($data, $item, $media_id, $uri);
}
else {
throw new Exception("Unknown schedule type: ".print_r($item, true));
//throw new Exception("Unknown schedule type: ".print_r($item, true));
//It's currently possible (and normal) to get cc_schedule rows without
//a file_id or stream_id. If you're using linked shows, placeholder rows can be put
//in the schedule when you cancel a track or delete stuff, so we should not throw an exception
//here and instead just ignore it.
}
}

View file

@ -80,7 +80,7 @@ class Application_Model_Scheduler
*
* @param array $items, an array containing pks of cc_schedule items.
*/
private function validateRequest($items, $addAction=false)
private function validateRequest($items, $addRemoveAction=false)
{
//$items is where tracks get inserted (they are schedule locations)
@ -164,7 +164,7 @@ class Application_Model_Scheduler
* currently playing?
* If yes, throw an exception
*/
if ($addAction) {
if ($addRemoveAction) {
$ccShow = $instance->getCcShow();
if ($ccShow->isLinked()) {
//get all the linked shows instances and check if
@ -175,7 +175,7 @@ class Application_Model_Scheduler
if ($ccShowInstance->getDbStarts() <= $timeNowUTC &&
$ccShowInstance->getDbEnds() > $timeNowUTC) {
throw new Exception(_("Content in linked shows must be scheduled before or after any one is broadcasted"));
throw new Exception(_("Content in linked shows cannot be changed while on air!"));
}
}
}
@ -1091,7 +1091,7 @@ class Application_Model_Scheduler
try {
$this->validateRequest($scheduledItems);
$this->validateRequest($scheduledItems, true);
$scheduledIds = array();
foreach ($scheduledItems as $item) {

View file

@ -1044,17 +1044,31 @@ SQL;
$event["nowPlaying"] = false;
}
//event colouring
if ($show["color"] != "") {
$event["textColor"] = "#".$show["color"];
}
if (!empty($show["background_color"])) {
$event["color"] = "#" . $show["background_color"];
} else {
$event["color"] = "#" . self::getDefaultBackgroundColor($startsDT);//DEFAULT_SHOW_COLOR;
}
//event colouring
if ($show["color"] != "") {
$event["textColor"] = "#".$show["color"];
} else {
$bg = $event["color"];
//Calculate the text colour (black or white) based on the brightness of the background.
$r = intval(substr($bg, 1, 2), 16);
$g = intval(substr($bg, 3, 2), 16);
$b = intval(substr($bg, 5, 2), 16);
$brightness = 0.299*floatval($r) + 0.587*floatval($g) + 0.114*floatval($b);
if ($brightness > 130) {
$event["textColor"] = "#000000";
} else {
$event["textColor"] = "#fcfcfc";
}
}
foreach ($options as $key => $value) {
$event[$key] = $value;
}
@ -1067,12 +1081,33 @@ SQL;
/** Get a palettized colour for the show. */
private static function getDefaultBackgroundColor($date) {
$basePalette = ['A22BE8', '2FFF8D', 'FF743C', '2ED4FF', 'E8D82B'];
// 'B23F11', 'FF7E4A', 'FF6C31'
/*
$palette = [['42d5a1', '56bd99', '65ab93', '7b938b'],
['42a4d5', '569bbd', '6594ab', '7b8b93'],
['4264d5', '566fbd', '6576ab', '7b8193']];
*/
$palette = [];
for ($baseColorIdx = 0; $baseColorIdx < count($basePalette); $baseColorIdx++) {
$dayPalette = [];
for ($shade = 0.0; $shade < 0.8; $shade += 0.1) {
$origColour = $basePalette[$baseColorIdx];
$r = intval(substr($origColour, 0, 2), 16);
$g = intval(substr($origColour, 2, 2), 16);
$b = intval(substr($origColour, 4, 2), 16);
$r = floatval($r) * (1.0 - $shade);
$g = floatval($g) * (1.0 - $shade);
$b = floatval($b) * (1.0 - $shade);
$color = sprintf("%02x%02x%02x", $r, $g, $b);
array_push($dayPalette, $color);
}
array_push($palette, $dayPalette);
}
//$hashValue = (md5($date->format('d'))[0] % $cols) + ((intval($date->format('h'))/24) % $rows);
$row = intval($date->format('d')) % sizeof($palette);
$row = intval($date->format('w')) % sizeof($palette);
$foo = $date->format('H');
$col = intval(intval($date->format('H'))/24.0 * sizeof($palette[0]));
//$color = $palette[$hashValue % sizeof($palette)];

View file

@ -92,9 +92,6 @@ class Rest_PodcastController extends Zend_Rest_Controller
$this->_helper->json->sendJson(array(
"podcast"=>json_encode($podcast),
"html"=>$this->view->render($path),
"type"=>"podcast", // TODO: get rid of these extraneous fields
"id"=>$podcast["id"]
// "id"=>$podcast->getDbId()
));
}
catch (PodcastLimitReachedException $e) {

View file

@ -9,8 +9,8 @@
<?php echo $this->element->getElement('sb_show_filter') ?>
<?php if ($this->element->getElement('sb_my_shows')):?>
<label><?php echo $this->element->getElement('sb_my_shows')->getLabel(); ?></label>
<?php echo $this->element->getElement('sb_my_shows'); ?>
<?php endif;?>
<!-- --><?php //if ($this->element->getElement('sb_my_shows')):?>
<!-- <label>--><?php //echo $this->element->getElement('sb_my_shows')->getLabel(); ?><!--</label>-->
<!-- --><?php //echo $this->element->getElement('sb_my_shows'); ?>
<!-- --><?php //endif;?>
</div>

View file

@ -7,7 +7,7 @@
<div class="panel-header">
<div id="advanced-options" class="btn-group">
<button class="btn btn-small dropdown-toggle" data-toggle="dropdown">
<span id="filter_message"></span>
<span id="lib-filter-message"></span>
<span class="caret"></span>
</button>
<div id="advanced_search" class="advanced_search form-horizontal dropdown-menu"></div>
@ -34,3 +34,4 @@
</div>
<?php echo $this->dialog ?>
<?php echo $this->lang_tz_popup_form; ?>