Merge branch 'saas-dev' of github.com:sourcefabric/Airtime into saas-dev

This commit is contained in:
Albert Santoni 2015-09-02 15:07:31 -04:00
commit f05157c376
10 changed files with 110 additions and 37 deletions

View file

@ -55,7 +55,7 @@ class Application_Common_UsabilityHints
return _("Upload some tracks below to add them to your library!"); return _("Upload some tracks below to add them to your library!");
} else { } else {
return sprintf(_("It looks like you haven't uploaded any audio files yet. %sUpload a file now%s."), return sprintf(_("It looks like you haven't uploaded any audio files yet. %sUpload a file now%s."),
"<a href=\"/Plupload\">", "<a href=\"/plupload\">",
"</a>"); "</a>");
} }
} else if (!self::isFutureOrCurrentShowScheduled()) { } else if (!self::isFutureOrCurrentShowScheduled()) {
@ -63,7 +63,7 @@ class Application_Common_UsabilityHints
return _("Click the 'New Show' button and fill out the required fields."); return _("Click the 'New Show' button and fill out the required fields.");
} else { } else {
return sprintf(_("It looks like you don't have any shows scheduled. %sCreate a show now%s."), return sprintf(_("It looks like you don't have any shows scheduled. %sCreate a show now%s."),
"<a href=\"/Schedule\">", "<a href=\"/schedule\">",
"</a>"); "</a>");
} }
} else if (self::isCurrentShowEmpty()) { } else if (self::isCurrentShowEmpty()) {
@ -73,14 +73,14 @@ class Application_Common_UsabilityHints
return _("To start broadcasting, cancel the current linked show by clicking on it and selecting 'Cancel Show'."); return _("To start broadcasting, cancel the current linked show by clicking on it and selecting 'Cancel Show'.");
} else { } else {
return sprintf(_("Linked shows need to be filled with tracks before it starts. To start broadcasting cancel the current linked show and schedule an unlinked show. return sprintf(_("Linked shows need to be filled with tracks before it starts. To start broadcasting cancel the current linked show and schedule an unlinked show.
%sCreate an unlinked show now%s."), "<a href=\"/Schedule\">", "</a>"); %sCreate an unlinked show now%s."), "<a href=\"/schedule\">", "</a>");
} }
} else { } else {
if ($userIsOnCalendarPage) { if ($userIsOnCalendarPage) {
return _("To start broadcasting, click on the current show and select 'Schedule Show'"); return _("To start broadcasting, click on the current show and select 'Schedule Show'");
} else { } else {
return sprintf(_("It looks like the current show needs more tracks. %sAdd tracks to your show now%s."), return sprintf(_("It looks like the current show needs more tracks. %sAdd tracks to your show now%s."),
"<a href=\"/Schedule\">", "<a href=\"/schedule\">",
"</a>"); "</a>");
} }
} }
@ -89,7 +89,7 @@ class Application_Common_UsabilityHints
return _("Click on the show starting next and select 'Schedule Show'"); return _("Click on the show starting next and select 'Schedule Show'");
} else { } else {
return sprintf(_("It looks like the next show is empty. %sAdd tracks to your show now%s."), return sprintf(_("It looks like the next show is empty. %sAdd tracks to your show now%s."),
"<a href=\"/Schedule\">", "<a href=\"/schedule\">",
"</a>"); "</a>");
} }
} else { } else {

View file

@ -30,6 +30,7 @@ class PlaylistController extends Zend_Controller_Action
->addActionContext('get-block-info', 'json') ->addActionContext('get-block-info', 'json')
->addActionContext('shuffle', 'json') ->addActionContext('shuffle', 'json')
->addActionContext('empty-content', 'json') ->addActionContext('empty-content', 'json')
->addActionContext('change-playlist', 'json')
->initContext(); ->initContext();
//This controller writes to the session all over the place, so we're going to reopen it for writing here. //This controller writes to the session all over the place, so we're going to reopen it for writing here.
@ -201,6 +202,16 @@ class PlaylistController extends Zend_Controller_Action
$this->createFullResponse($obj); $this->createFullResponse($obj);
} }
public function changePlaylistAction() {
$this->view->layout()->disableLayout(); // Don't inject the standard Now Playing header.
$this->_helper->viewRenderer->setNoRender(true); // Don't use (phtml) templates
$id = $this->_getParam('id', null);
$type = $this->_getParam('type');
Application_Model_Library::changePlaylist($id, $type);
}
public function editAction() public function editAction()
{ {
$id = $this->_getParam('id', null); $id = $this->_getParam('id', null);
@ -241,7 +252,7 @@ class PlaylistController extends Zend_Controller_Action
Logging::info("Currently active {$type} {$obj_sess->id}"); Logging::info("Currently active {$type} {$obj_sess->id}");
if (in_array($obj_sess->id, $ids)) { if (in_array($obj_sess->id, $ids)) {
Logging::info("Deleting currently active {$type}"); Logging::info("Deleting currently active {$type}");
Application_Model_Library::changePlaylist(null, $type); // Application_Model_Library::changePlaylist(null, $type);
} else { } else {
Logging::info("Not deleting currently active {$type}"); Logging::info("Not deleting currently active {$type}");
$obj = new $objInfo['className']($obj_sess->id); $obj = new $objInfo['className']($obj_sess->id);

View file

@ -82,7 +82,7 @@ class Zend_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract
* @param string $module * @param string $module
* @return void * @return void
**/ **/
public function setErrorPage($action, $controller = 'error', $module = null) public function setErrorPage($action, $controller = 'error', $module = 'default')
{ {
$this->_errorPage = array('module' => $module, $this->_errorPage = array('module' => $module,
'controller' => $controller, 'controller' => $controller,
@ -204,11 +204,8 @@ class Zend_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract
$resourceName, $resourceName,
$request->getActionName())) { $request->getActionName())) {
/** Redirect to access denied page */ /** Redirect to access denied page */
$this->getResponse() $this->setErrorPage('error403');
->setHttpResponseCode(403) $this->denyAccess(); /* This results in a 404! */
->appendBody("You don't have permission to access this resource.")
->sendResponse();
// $this->denyAccess(); /* This results in a 404! */
} }
} }
} }

View file

@ -142,7 +142,8 @@ class Application_Service_CalendarService
if ($isRepeating) { if ($isRepeating) {
if ($populateInstance) { if ($populateInstance) {
$menu["edit"] = array( $menu["edit"] = array(
"name" => _("Edit This Instance"), // "name" => _("Edit This Instance"),
"name" => _("Edit Instance"),
"icon" => "edit", "icon" => "edit",
"url" => $baseUrl . "Schedule/populate-repeating-show-instance-form" "url" => $baseUrl . "Schedule/populate-repeating-show-instance-form"
); );
@ -160,7 +161,8 @@ class Application_Service_CalendarService
); );
$menu["edit"]["items"]["instance"] = array( $menu["edit"]["items"]["instance"] = array(
"name" => _("Edit This Instance"), // "name" => _("Edit This Instance"),
"name" => _("Edit Instance"),
"icon" => "edit", "icon" => "edit",
"url" => $baseUrl . "Schedule/populate-repeating-show-instance-form" "url" => $baseUrl . "Schedule/populate-repeating-show-instance-form"
); );
@ -188,12 +190,14 @@ class Application_Service_CalendarService
"items" => array()); "items" => array());
$menu["del"]["items"]["single"] = array( $menu["del"]["items"]["single"] = array(
"name"=> _("Delete This Instance"), // "name"=> _("Delete This Instance"),
"name"=> _("Delete Instance"),
"icon" => "delete", "icon" => "delete",
"url" => $baseUrl."schedule/delete-show-instance"); "url" => $baseUrl."schedule/delete-show-instance");
$menu["del"]["items"]["following"] = array( $menu["del"]["items"]["following"] = array(
"name"=> _("Delete This Instance and All Following"), // "name"=> _("Delete This Instance and All Following"),
"name"=> _("Delete Instance and All Following"),
"icon" => "delete", "icon" => "delete",
"url" => $baseUrl."schedule/delete-show"); "url" => $baseUrl."schedule/delete-show");
} elseif ($populateInstance) { } elseif ($populateInstance) {

View file

@ -150,6 +150,9 @@ div.btn > span {
#library_empty_image { #library_empty_image {
opacity: .3; opacity: .3;
width: 16px;
height: 20px;
top: -20px; top: -20px;
margin-top: -2px; margin-top: -2px;
padding-right: 2px; /* For the webstream icon */ padding-right: 2px; /* For the webstream icon */
@ -456,8 +459,10 @@ li.ui-state-default {
max-height: 60%; max-height: 60%;
overflow-x: hidden; overflow-x: hidden;
width: 100%; width: 100%;
flex: 1 0 100%; flex: 1 0 auto;
padding: 10px; padding: 10px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box; box-sizing: border-box;
} }
@ -500,6 +505,8 @@ li.ui-state-default {
padding: 5px; padding: 5px;
border: 1px solid #444; border: 1px solid #444;
border-radius: 3px; border-radius: 3px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box; box-sizing: border-box;
background-color: #111; background-color: #111;
display: flex; display: flex;
@ -559,6 +566,8 @@ li.ui-state-default {
} }
.side_playlist .zend_form input { .side_playlist .zend_form input {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box; box-sizing: border-box;
height: 26px; height: 26px;
} }

View file

@ -1357,6 +1357,8 @@ input[type="checkbox"] {
} }
#schedule_calendar { #schedule_calendar {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box; box-sizing: border-box;
width: 100%; width: 100%;
@ -1819,6 +1821,8 @@ button, input {
} }
.user-management .dataTables_filter input { .user-management .dataTables_filter input {
width: 100%; width: 100%;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box; box-sizing: border-box;
margin-bottom:8px; margin-bottom:8px;
} }
@ -1945,7 +1949,9 @@ div.success{
float: right; float: right;
height: 30px; height: 30px;
line-height: 24px; line-height: 24px;
box-sizing: border-box;; -webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
} }
div.errors, span.errors{ div.errors, span.errors{
@ -1957,7 +1963,9 @@ div.errors, span.errors{
border:1px solid #c83f3f; border:1px solid #c83f3f;
height: 30px; height: 30px;
line-height: 24px; line-height: 24px;
box-sizing: border-box;; -webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
} }
span.errors.sp-errors{ span.errors.sp-errors{
@ -2625,6 +2633,8 @@ label span {
fieldset > legend { fieldset > legend {
width: 100%; width: 100%;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box; box-sizing: border-box;
background: #333; background: #333;
@ -3462,9 +3472,15 @@ dd .stream-status {
min-width: 200px !important; min-width: 200px !important;
} }
.calendar-context-menu .context-menu-list {
min-width: 260px !important;
}
/* Add Media Page */ /* Add Media Page */
#upload_form, #recent_uploads_wrapper { #upload_form, #recent_uploads_wrapper {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box; box-sizing: border-box;
} }
@ -3593,6 +3609,8 @@ button.btn-icon-text > i.icon-white {
.dashboard_sub_nav { .dashboard_sub_nav {
padding: 0px 0px 0px 10px; padding: 0px 0px 0px 10px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box; box-sizing: border-box;
} }
@ -3722,6 +3740,8 @@ button.btn-icon-text > i.icon-white {
#listenerstat_content { #listenerstat_content {
width: 100%; width: 100%;
display: block; display: block;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box; box-sizing: border-box;
} }
@ -3734,6 +3754,12 @@ button.btn-icon-text > i.icon-white {
font-size: 12px; font-size: 12px;
} }
#flot_placeholder.processing {
width: 100%;
height: 100%;
background: url("img/loading.gif") no-repeat 50% 50% rgba(0, 0, 0, .25);
}
.dashboard-btn { .dashboard-btn {
width: 50%; width: 50%;
} }

View file

@ -77,6 +77,7 @@ var AIRTIME = (function(AIRTIME) {
cb.append("<input id='super-checkbox' type='checkbox'>"); cb.append("<input id='super-checkbox' type='checkbox'>");
} }
var libEmpty = $('#library_empty');
if (emptyRow.length > 0) { if (emptyRow.length > 0) {
emptyRow.hide(); emptyRow.hide();
var mediaType = parseInt($('.media_type_selector.selected').attr('data-selection-id')), var mediaType = parseInt($('.media_type_selector.selected').attr('data-selection-id')),
@ -92,13 +93,13 @@ var AIRTIME = (function(AIRTIME) {
$('#library_empty_text').html( $('#library_empty_text').html(
$.i18n._("You haven't added any " + opts.media + ".") $.i18n._("You haven't added any " + opts.media + ".")
+ "<br/>" + $.i18n._(opts.subtext) + "<br/>" + $.i18n._(opts.subtext)
+ "<br/><a href='" + opts.href + "'>" + $.i18n._("Learn about " + opts.media) + "</a>" + "<br/><a target='_blank' href='" + opts.href + "'>" + $.i18n._("Learn about " + opts.media) + "</a>"
); );
}) ; });
$('#library_empty').show(); libEmpty.show();
} else { } else {
$('#library_empty').hide(); libEmpty.hide();
} }
if ($("#show_builder_table").is(":visible")) { if ($("#show_builder_table").is(":visible")) {

View file

@ -421,17 +421,19 @@ var AIRTIME = (function(AIRTIME){
$('.zend_form + .spl-no-margin > div:has(*:visible):last').css('margin-left', 0); $('.zend_form + .spl-no-margin > div:has(*:visible):last').css('margin-left', 0);
} }
function getId() { function getId(pl) {
return parseInt($pl.find(".obj_id").val(), 10); pl = (pl === undefined) ? $pl : pl;
return parseInt(pl.find(".obj_id").val(), 10);
} }
mod.getModified = function() { mod.getModified = function(pl) {
return parseInt($pl.find(".obj_lastMod").val(), 10); pl = (pl === undefined) ? $pl : pl;
} return parseInt(pl.find(".obj_lastMod").val(), 10);
};
mod.setModified = function(modified) { mod.setModified = function(modified) {
$pl.find(".obj_lastMod").val(modified); $pl.find(".obj_lastMod").val(modified);
} };
function setTitleLabel(title) { function setTitleLabel(title) {
$pl.find(".title_obj_name").text(title); $pl.find(".title_obj_name").text(title);
@ -569,6 +571,10 @@ var AIRTIME = (function(AIRTIME){
if (pane.get(0) == curr.get(0)) { // Closing the current tab, otherwise we don't need to switch tabs if (pane.get(0) == curr.get(0)) { // Closing the current tab, otherwise we don't need to switch tabs
AIRTIME.showbuilder.switchTab(toPane, toTab); AIRTIME.showbuilder.switchTab(toPane, toTab);
} }
// If we close a tab that was causing tabs to wrap to the next row, we need to resize to change the
// margin for the tab nav
AIRTIME.playlist.onResize();
} }
mod.closeTab = function(id) { mod.closeTab = function(id) {
@ -1208,8 +1214,8 @@ var AIRTIME = (function(AIRTIME){
var url, id, lastMod, type, pl = (tabId === undefined) ? $pl : $('#pl-tab-content-' + tabId); var url, id, lastMod, type, pl = (tabId === undefined) ? $pl : $('#pl-tab-content-' + tabId);
stopAudioPreview(); stopAudioPreview();
id = (plid === undefined) ? getId() : plid; id = (plid === undefined) ? getId(pl) : plid;
lastMod = mod.getModified(); lastMod = mod.getModified(pl);
type = pl.find('.obj_type').val(); type = pl.find('.obj_type').val();
url = baseUrl+'playlist/delete'; url = baseUrl+'playlist/delete';
@ -1558,6 +1564,7 @@ var AIRTIME = (function(AIRTIME){
mod.setAsActive = function() { mod.setAsActive = function() {
$pl = $(".active-tab"); $pl = $(".active-tab");
$.post(baseUrl + "playlist/change-playlist", {"id": getId(), "type": $pl.find('.obj_type').val()});
}; };
mod.init = function() { mod.init = function() {

View file

@ -21,7 +21,17 @@ $(document).ready(function() {
}); });
}); });
function getDataAndPlot(startTimestamp, endTimestamp){ /**
* Toggle a spinner overlay so the user knows the page is processing
*/
function toggleOverlay() {
$('#flot_placeholder').toggleClass('processing');
}
function getDataAndPlot(startTimestamp, endTimestamp) {
// Turn on the processing overlay
toggleOverlay();
// get data // get data
$.get(baseUrl+'Listenerstat/get-data', {start: startTimestamp, end: endTimestamp}, function(data){ $.get(baseUrl+'Listenerstat/get-data', {start: startTimestamp, end: endTimestamp}, function(data){
out = new Object(); out = new Object();
@ -37,6 +47,8 @@ function getDataAndPlot(startTimestamp, endTimestamp){
out[mpName] = plotData; out[mpName] = plotData;
}); });
plot(out); plot(out);
// Turn off the processing overlay
toggleOverlay();
}) })
} }

View file

@ -43,10 +43,16 @@ function rowClickCallback(row_id){
}}); }});
} }
function removeUserCallback(row_id, nRow){ function removeUserCallback(row_id, nRow) {
$.ajax({ url: baseUrl+'User/remove-user/id/'+ row_id +'/format/json', dataType:"text", success:function(data){ if (confirm($.i18n._("Are you sure you want to delete this user?"))) {
$.ajax({
url: baseUrl + 'User/remove-user/id/' + row_id + '/format/json',
dataType: "text",
success: function (data) {
var o = $('#users_datatable').dataTable().fnDeleteRow(nRow); var o = $('#users_datatable').dataTable().fnDeleteRow(nRow);
}}); }
});
}
} }
function rowCallback( nRow, aData, iDisplayIndex ){ function rowCallback( nRow, aData, iDisplayIndex ){