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

This commit is contained in:
Albert Santoni 2015-08-27 19:04:18 -04:00
commit 099fc0107e
17 changed files with 496 additions and 391 deletions

View File

@ -52,9 +52,9 @@ class Application_Common_UsabilityHints
if (self::zeroFilesUploaded()) {
if ($userIsOnAddMediaPage) {
return _("Click the 'Add files' button and select files from your computer to upload.");
return _("Upload some tracks below to add them to your library!");
} else {
return sprintf(_("It looks like you have not 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>");
}
@ -70,14 +70,14 @@ class Application_Common_UsabilityHints
// If the current show is linked users cannot add content to it so we have to provide a different message.
if (self::isCurrentShowLinked()) {
if ($userIsOnCalendarPage) {
return _("To start broadcasting, first you need to cancel the current linked show by clicking on it and selecting 'Cancel Current Show'.");
return _("To start broadcasting, cancel the current linked show by clicking on it and selecting 'Cancel Show'.");
} 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.
%sCreate an unlinked show now%s."), "<a href=\"/Schedule\">", "</a>");
}
} else {
if ($userIsOnCalendarPage) {
return _("To start broadcasting, click on the current show and select 'Add / Remove Content'");
return _("To start broadcasting, click on the current show and select 'Schedule Show'");
} else {
return sprintf(_("It looks like the current show needs more tracks. %sAdd tracks to your show now%s."),
"<a href=\"/Schedule\">",
@ -86,7 +86,7 @@ class Application_Common_UsabilityHints
}
} else if (!self::getCurrentShow() && self::isNextShowEmpty()) {
if ($userIsOnCalendarPage) {
return _("Click on the show starting next and select 'Add / Remove Content'");
return _("Click on the show starting next and select 'Schedule Show'");
} else {
return sprintf(_("It looks like the next show is empty. %sAdd tracks to your show now%s."),
"<a href=\"/Schedule\">",

View File

@ -18,9 +18,9 @@ $pages = array(
array(
'label' => "<i class='icon-calendar icon-white'></i>"._('Calendar'),
'module' => 'default',
'controller' => 'Schedule',
'controller' => 'schedule',
'action' => 'index',
'resource' => 'schedule'
'resource' => 'schedule'
),
array(
'label' => "<i class='icon-wrench icon-white'></i>"._('Widgets'),
@ -48,13 +48,13 @@ $pages = array(
'resource' => 'preference',
'action' => 'index',
'module' => 'default',
'controller' => 'Preference',
'controller' => 'preference',
'title' => 'Settings',
'pages' => array(
array(
'label' => _('General'),
'module' => 'default',
'controller' => 'Preference'
'controller' => 'preference'
),
array(
'label' => _('My Profile'),
@ -72,7 +72,7 @@ $pages = array(
array(
'label' => _('Streams'),
'module' => 'default',
'controller' => 'Preference',
'controller' => 'preference',
'action' => 'stream-setting'
)
)
@ -167,11 +167,6 @@ $pages = array(
'uri' => USER_MANUAL_URL,
'target' => "_blank"
),
array(
'label' => _(sprintf("About %s", PRODUCT_NAME)),
'uri' => ABOUT_AIRTIME_URL,
'target' => "_blank"
),
array(
'label' => _(sprintf("Help Translate %s", PRODUCT_NAME)),
'uri' => AIRTIME_TRANSIFEX_URL,

View File

@ -28,7 +28,7 @@ class LoginController extends Zend_Controller_Action
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
$this->_redirect('Showbuilder');
$this->_redirect('showbuilder');
}
//uses separate layout without a navigation.
@ -76,7 +76,7 @@ class LoginController extends Zend_Controller_Action
//set the user locale in case user changed it in when logging in
Application_Model_Preference::SetUserLocale($locale);
$this->_redirect('Showbuilder');
$this->_redirect('showbuilder');
} else {
$email = $form->getValue('username');
$authAdapter = new WHMCS_Auth_Adapter("admin", $email, $password);
@ -87,7 +87,7 @@ class LoginController extends Zend_Controller_Action
//set the user locale in case user changed it in when logging in
Application_Model_Preference::SetUserLocale($locale);
$this->_redirect('Showbuilder');
$this->_redirect('showbuilder');
}
else {
$message = _("Wrong username or password provided. Please try again.");

View File

@ -34,10 +34,10 @@ class SetupController extends Zend_Controller_Action
Application_Model_Preference::setLangTimezoneSetupComplete(true);
$this->_redirect('/Showbuilder');
$this->_redirect('/showbuilder');
}
}
$this->_redirect('/Showbuilder');
$this->_redirect('/showbuilder');
}
}

View File

@ -22,7 +22,7 @@ class WhmcsLoginController extends Zend_Controller_Action
Application_Model_Locale::configureLocalization($request->getcookie('airtime_locale', 'en_CA'));
if (Zend_Auth::getInstance()->hasIdentity())
{
$this->_redirect('Showbuilder');
$this->_redirect('showbuilder');
}
$authAdapter = new WHMCS_Auth_Adapter($username, $email, $password);
@ -58,7 +58,7 @@ class WhmcsLoginController extends Zend_Controller_Action
//$locale = $form->getValue('locale');
//Application_Model_Preference::SetUserLocale($locale);
$this->_redirect('Showbuilder');
$this->_redirect('showbuilder');
}
else {
echo("Sorry, that username or password was incorrect.");

View File

@ -7,7 +7,7 @@ class Application_Form_RegisterAirtime extends Zend_Form
public function init()
{
$this->setAction(Application_Common_OsPath::getBaseDir().'Showbuilder');
$this->setAction(Application_Common_OsPath::getBaseDir().'showbuilder');
$this->setMethod('post');
$country_list = Application_Model_Preference::GetCountryList();

View File

@ -57,7 +57,8 @@ class Application_Service_CalendarService
}
} else {
$menu["content"] = array(
"name"=> _("Show Content"),
// "name"=> _("Show Content"),
"name"=> _("View"),
"icon" => "overview",
"url" => $baseUrl."schedule/show-content-dialog");
}
@ -76,45 +77,52 @@ class Application_Service_CalendarService
if (!$showIsLinked || ($showIsLinked && $currentShowId != $this->ccShow->getDbId())) {
$menu["schedule"] = array(
"name"=> _("Add / Remove Content"),
// "name"=> _("Add / Remove Content"),
"name" => _("Schedule Show"),
"icon" => "add-remove-content",
"url" => $baseUrl."showbuilder/builder-dialog/");
}
}
//user can remove all content if the show has not started
if ($now < $start && ($isAdminOrPM || $isHostOfShow) && !$this->ccShowInstance->isRecorded() ) {
//if the show is not linked OR if the show is linked AND not the current playing show
//the user can remove all content
if (!$showIsLinked || ($showIsLinked && $currentShowId != $this->ccShow->getDbId())) {
$menu["clear"] = array(
"name"=> _("Remove All Content"),
"icon" => "remove-all-content",
"url" => $baseUrl."schedule/clear-show");
}
}
//"Show Content" should be a menu item at all times except when
//the show is recorded
if (!$this->ccShowInstance->isRecorded()) {
$menu["content"] = array(
"name"=> _("Show Content"),
// "name"=> _("Show Content"),
"name"=> _("View"),
"icon" => "overview",
"url" => $baseUrl."schedule/show-content-dialog");
}
//user can remove all content if the show has not started
if ($now < $start && ($isAdminOrPM || $isHostOfShow) && !$this->ccShowInstance->isRecorded() ) {
//if the show is not linked OR if the show is linked AND not the current playing show
//the user can remove all content
if (!$showIsLinked || ($showIsLinked && $currentShowId != $this->ccShow->getDbId())) {
$menu["clear"] = array(
// "name"=> _("Remove All Content"),
"name"=> _("Clear Show"),
"icon" => "remove-all-content",
"url" => $baseUrl."schedule/clear-show");
}
}
//show is currently playing and user is admin
if ($start <= $now && $now < $end && $isAdminOrPM) {
// Menu separator
$menu["sep1"] = "-----------";
if ($this->ccShowInstance->isRecorded()) {
$menu["cancel_recorded"] = array(
"name"=> _("Cancel Current Show"),
// "name"=> _("Cancel Current Show"),
"name"=> _("Cancel Show"),
"icon" => "delete");
} else {
$menu["cancel"] = array(
"name"=> _("Cancel Current Show"),
// "name"=> _("Cancel Current Show"),
"name"=> _("Cancel Show"),
"icon" => "delete");
}
}
@ -128,6 +136,9 @@ class Application_Service_CalendarService
}
if (!$this->ccShowInstance->isRebroadcast() && $isAdminOrPM) {
// Menu separator
$menu["sep2"] = "-----------";
if ($isRepeating) {
if ($populateInstance) {
$menu["edit"] = array(
@ -165,6 +176,9 @@ class Application_Service_CalendarService
//show hasn't started yet and user is admin
if ($now < $start && $isAdminOrPM) {
// Menu separator
$menu["sep3"] = "-----------";
//show is repeating so give user the option to delete all
//repeating instances or just the one
if ($isRepeating) {

View File

@ -1,15 +1,17 @@
<div class="gray-logo"></div>
<div class="text-content">
<h2><?php echo sprintf(_("Welcome to %s!"), PRODUCT_NAME) ?></h2>
<p><?php echo sprintf(_("Here's how you can get started using %s to automate your broadcasts: "), PRODUCT_NAME)?></p>
<ol>
<li><?php echo _("Begin by adding your files to the library using the 'Add Media' menu button. You can drag and drop your files to this window too.")?></li>
<li><?php echo _("Create a show by going to 'Calendar' in the menu bar, and then clicking the '+ Show' icon. This can be either a one-time or repeating show. Only admins and program managers can add shows.")?></li>
<li><?php echo _("Add media to the show by going to your show in the Schedule calendar, left-clicking on it and selecting 'Add / Remove Content'")?>.</li>
<li><?php echo _("Select your media from the left pane and drag them to your show in the right pane."); ?></li>
<li><h4><?php echo _("Upload audio tracks");?></h4>
<?php echo _("Click the 'Upload' button in the left corner to upload tracks to your library.")?></li>
<li><h4><?php echo _("Schedule a show");?></h4>
<?php echo _("Click on 'Calendar' in the navigation bar on the left. From there click the '+ New Show' button and fill out the required fields.")?></li>
<li><h4><?php echo _("Add tracks to your show"); ?></h4>
</ol>
<p><strong><?php echo _("Then you're good to go!")?></strong><br />
<p><strong><?php echo _("Now you're good to go!")?></strong><br />
<?php
$userManualAnchorOpen = "<a href='" . USER_MANUAL_URL . "' target='_blank'>";
echo sprintf(_("For more detailed help, read the %suser manual%s."),

View File

@ -19,16 +19,15 @@
</form>
-->
<div id="upload_form" class="lib-content ui-widget ui-widget-content block-shadow padded wide-panel <?php if ($this->quotaLimitReached) { ?> hidden <?php } ?>">
<H2>Upload Audio Files</H2>
<?php
$partitions = Application_Model_Systemstatus::GetDiskInfo();
$status = new StdClass;
$partitions = $partitions;
$disk = $partitions[0];
$used = $disk->totalSpace-$disk->totalFreeSpace;
$total = $disk->totalSpace;
?>
<div style="height:100%">
<div id="upload_wrapper">
<H2>Upload Audio Files</H2>
<form action="/rest/media" method="post" id="add-media-dropzone" class="dropzone dz-clickable">
<?php echo $this->form->getElement('csrf') ?>
<div class="dz-message">
@ -44,15 +43,14 @@
    <a id="uploadfiles" href="javascript:;">[Upload files]</a>
</div>
-->
</div>
<div id="disk_usage" style="position:absolute;width:95%; margin-top:10px; bottom: 10px;">
<div style="padding-bottom: 2px;">Storage</div>
<div class="disk_usage_progress_bar" style="width:98%"></div>
<div class="disk_usage_percent_in_use" style="width:98%"><?php echo sprintf("%01.1f%% ", $used/$total*100) . _("in use") ?></div>
<div class="disk_usage_used" style="width:<?php echo sprintf("%01.1f%%", $used/$total*100) ?>;"></div>
<div style="margin-top: 17px; font-size: 12px;"><?php echo sprintf("%01.1fGB of %01.1fGB", $used/pow(2, 30), $total/pow(2, 30)); ?></div>
<div id="uploads_disk_usage">
<div style="padding-bottom: 2px;">Storage</div>
<div class="disk_usage_progress_bar"></div>
<div class="disk_usage_percent_in_use"><?php echo sprintf("%01.1f%% ", $used/$total*100) . _("in use") ?></div>
<div class="disk_usage_used" style="width:<?php echo sprintf("%01.1f%%", $used/$total*100) ?>;"></div>
<div style="margin-top: 17px; font-size: 12px;"><?php echo sprintf("%01.1fGB of %01.1fGB", $used/pow(2, 30), $total/pow(2, 30)); ?></div>
</div>
</div>
</div>
@ -61,19 +59,17 @@
</div>
<div id="recent_uploads_wrapper" class="lib-content ui-widget ui-widget-content block-shadow wide-panel">
<div id="recent_uploads" class="outer-datatable-wrapper padded">
<div id="recent_uploads_filter">
<div id="recent_uploads_filter">
<form>
<input type="radio" name="upload_status" id="upload_status_all" checked></input><label for="upload_status_all"><?php echo _("All")?></label>
<input type="radio" name="upload_status" id="upload_status_failed"></input><label for="upload_status_failed"><?php echo _("Failed")?></label>
<input type="radio" name="upload_status" id="upload_status_pending"></input><label for="upload_status_pending"><?php echo _("Pending")?></label>
<input type="radio" name="upload_status" id="upload_status_all" checked /><label for="upload_status_all"><?php echo _("All")?></label>
<input type="radio" name="upload_status" id="upload_status_failed" /><label for="upload_status_failed"><?php echo _("Failed")?></label>
<input type="radio" name="upload_status" id="upload_status_pending" /><label for="upload_status_pending"><?php echo _("Pending")?></label>
</form>
</div>
<H2><?php echo _("Recent Uploads")?></H2>
<div class="dataTables_scrolling padded">
<table id="recent_uploads_table" class="datatable lib-content ui-widget ui-widget-content block-shadow alpha-block "
<div class="dataTables_scrolling">
<table id="recent_uploads_table" class="datatable lib-content ui-widget ui-widget-content block-shadow"
cellpadding="0" cellspacing="0"></table>
</div>
</div>

View File

@ -20,7 +20,7 @@
<div id="show_builder" class="sb-content content-pane wide-panel">
<div class="panel-header">
<ul class="nav nav-tabs">
<li id="schedule-tab" role="presentation" class="active"><a href="#">Scheduled Shows</a></li>
<li id="schedule-tab" role="presentation" class="active"><a href="javascript:void(0)">Scheduled Shows</a></li>
</ul>
</div>
<div class="outer-datatable-wrapper active-tab">

View File

@ -1,21 +1,48 @@
@CHARSET "UTF-8";
#recent_uploads > .dataTables_scrolling
{
top: 41px;
bottom: 8px;
}
#recent_uploads_wrapper
{
position: relative;
min-height: 500px;
/*min-height: 500px;*/
}
#recent_uploads_table
{
width: 100%;
table-layout: fixed;
border: 0;
/*table-layout: fixed;*/
}
#recent_uploads_table_wrapper
{
position: absolute;
left: 8px;
right: 8px;
bottom: 0;
top: 0;
border: 1px solid #5b5b5b;
}
#recent_uploads_table_wrapper > .fg-toolbar
{
position: absolute;
left: 0;
right: 0;
bottom: 0;
border: none;
}
#recent_uploads_table_wrapper > .fg-toolbar:after
{
content: none;
}
table#recent_uploads_table td
@ -26,7 +53,7 @@ table#recent_uploads_table td
#recent_uploads_filter
{
float: right;
margin-top: 10px;
margin-top: 5px;
margin-right: 3px;
}
#recent_uploads_table_length
@ -260,16 +287,29 @@ table#recent_uploads_table td
}
}
#upload_wrapper {
height: 100%;
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-flex-flow: column;
flex-flow: column;
}
.dropzone, .dropzone * {
box-sizing: border-box
}
.dropzone {
min-height: 30%;
flex: 1 100%;
/*min-height: 30%;*/
border: 2px solid rgba(0, 0, 0, 0.3);
background: #333;
padding: 20px 20px;
max-height: 75%;
/*max-height: 75%;*/
overflow-y: auto;
}
@ -286,7 +326,8 @@ table#recent_uploads_table td
}
.dropzone.dz-started .dz-message {
display: none
margin-bottom: 16px;
/*display: none*/
}
.dropzone.dz-drag-hover {
@ -318,23 +359,25 @@ table#recent_uploads_table td
.dropzone .dz-preview {
position: relative;
display: inline-block;
/* display: inline-block; */
vertical-align: top;
margin: 16px;
margin-bottom: 16px;
width: 100%;
}
.dropzone .dz-preview:hover {
z-index: 1000
z-index: 1000;
}
.dropzone .dz-preview:hover .dz-details {
opacity: 1
opacity: 1;
}
.dropzone .dz-preview.dz-file-preview .dz-image {
border-radius: 3px;
background: #444;
/*background: linear-gradient(to bottom, #eee, #ddd)*/
/* background: linear-gradient(to bottom, #eee, #ddd); */
width: 100%;
}
.dropzone .dz-preview.dz-file-preview .dz-details {
@ -354,11 +397,14 @@ table#recent_uploads_table td
}
.dropzone .dz-preview .dz-remove {
font-size: 14px;
/*font-size: 14px;*/
text-align: center;
display: block;
cursor: pointer;
border: none
border: none;
color: #efefef;
float: right;
}
.dropzone .dz-preview .dz-remove:hover {
@ -378,7 +424,7 @@ table#recent_uploads_table td
font-size: 13px;
min-width: 100%;
max-width: 100%;
padding: 1em 1em;
padding: 1em 1em 0;
text-align: left;
color: rgba(0, 0, 0, 0.9);
/*line-height: 150%*/
@ -395,8 +441,8 @@ table#recent_uploads_table td
}
.dropzone .dz-preview .dz-details .dz-filename:hover span {
border: 1px solid rgba(200, 200, 200, 0.8);
background-color: rgba(255, 255, 255, 0.8)
/*border: 1px solid rgba(200, 200, 200, 0.8);*/
/*background-color: rgba(255, 255, 255, 0.8)*/
}
.dropzone .dz-preview .dz-details .dz-filename:not(:hover) {
@ -405,11 +451,12 @@ table#recent_uploads_table td
}
.dropzone .dz-preview .dz-details .dz-filename:not(:hover) span {
border: 1px solid transparent
/*border: 1px solid transparent*/
}
.dropzone .dz-preview .dz-details .dz-filename span, .dropzone .dz-preview .dz-details .dz-size span {
background-color: rgba(255, 255, 255, 0.4);
color: #efefef;
/*background-color: rgba(255, 255, 255, 0.4);*/
padding: 0 0.4em;
border-radius: 3px
}
@ -461,7 +508,7 @@ table#recent_uploads_table td
z-index: 500;
position: absolute;
display: block;
top: 50%;
top: 33px;
left: 50%;
margin-left: -27px;
margin-top: -27px
@ -469,8 +516,10 @@ table#recent_uploads_table td
.dropzone .dz-preview .dz-success-mark svg, .dropzone .dz-preview .dz-error-mark svg {
display: block;
width: 54px;
height: 54px
/*width: 54px;*/
/*height: 54px*/
width: 27px;
height: 27px
}
.dropzone .dz-preview.dz-processing .dz-progress {
@ -543,10 +592,9 @@ table#recent_uploads_table td
.dropzone .dz-preview .dz-error-message {
pointer-events: none;
z-index: 1000;
position: absolute;
display: block;
position: relative;
display: none;
opacity: 0;
/* opacity: 0; */
-webkit-transition: opacity 0.3s ease;
-moz-transition: opacity 0.3s ease;
-ms-transition: opacity 0.3s ease;
@ -554,23 +602,29 @@ table#recent_uploads_table td
transition: opacity 0.3s ease;
border-radius: 8px;
font-size: 13px;
top: 130px;
left: -10px;
width: 140px;
/* top: 130px; */
top: -27px;
/*left: -10px;*/
left: 33px;
/* width: 140px; */
background: #be2626;
background: linear-gradient(to bottom, #be2626, #a92222);
padding: 0.5em 1.2em;
color: white
color: white;
}
.dropzone .dz-preview .dz-error-message:after {
content: '';
position: absolute;
top: -6px;
left: 64px;
width: 0;
height: 0;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-bottom: 6px solid #be2626
content: none;
/*content: '';*/
/*position: absolute;*/
/*/!*top: -6px;*!/*/
/*top: 10px;*/
/*/!*left: 64px;*!/*/
/*left: -8px;*/
/*width: 0;*/
/*height: 0;*/
/*border-left: 6px solid transparent;*/
/*border-right: 6px solid transparent;*/
/*border-bottom: 6px solid #be2626;*/
/*transform: rotate(-90deg);*/
}

View File

@ -165,6 +165,7 @@ thead th.ui-state-default:focus {
left: -420px;
padding: 5px;
margin-top: -2px;
z-index: 1005;
}
#advanced_search label, #advanced_search span {
@ -190,7 +191,7 @@ thead th.ui-state-default:focus {
#advanced-options {
float: right;
z-index: 1;
z-index: 1004;
}
#advanced-options > button {

View File

@ -2120,7 +2120,7 @@ span.errors.sp-errors{
overflow:auto;
}
.text-content {
padding:20px 10px 40px 58px;
padding: 10px 22px;
/*background: url(images/sf_arror.png) no-repeat 60% 0; */
min-height: 300px;
}
@ -2128,6 +2128,9 @@ span.errors.sp-errors{
font-size:2.4em;
color:#efefef;
}
.text-content h4 {
margin-bottom: 3px;
}
.text-content p {
font-size:1.6em;
line-height:140%;
@ -2149,7 +2152,7 @@ span.errors.sp-errors{
}
.text-content ol li {
margin:0 0 6px 0;
margin:15px 0 6px 0;
font-size:1.7em;
display:list-item;
color:#efefef;
@ -3529,6 +3532,10 @@ button.btn-icon-text > i.icon-white {
flex-flow: row wrap;
}
.ui-dialog-content input {
z-index: 1003;
}
.ui-dialog-content .media_type_selector {
padding-left: 0;
flex: 1 auto;
@ -3646,7 +3653,7 @@ button.btn-icon-text > i.icon-white {
#upload_form {
/* width: 100%;
min-width: 555px;*/
margin-bottom: 10px;
/*margin-bottom: 10px;*/
margin-right: 10px;
height: 100%;
position:relative;
@ -3745,6 +3752,19 @@ hr {
margin-right:4px
}
#uploads_disk_usage {
position: relative;
margin-top: 8px;
border-radius: 1px;
font-size: 14px;
text-align: center;
padding: 5px;
background-color: #242424;
border: 1px solid #5b5b5b;
color: #ccc;
flex: 0 0 auto;
}
#disk_usage {
border-radius: 1px;
/*position: fixed;
@ -3760,22 +3780,26 @@ hr {
}
.disk_usage_progress_bar {
width:118px;
height:13px;
background:#444444;
position: absolute;
left: 4px;
right: 4px;
/* width: 118px; */
height: 13px;
background: #444444;
background: -moz-linear-gradient(top, #464646 0, #3e3e3e 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #3e3e3e), color-stop(100%, #464646));
margin: 0 auto;
/* margin: 0 auto; */
z-index: 1;
position:absolute;
}
.disk_usage_percent_in_use {
position: absolute;
left: 0;
right: 0;
color: #fff;
font-size: 10px;
z-index: 3;
position:absolute;
width: 120px;
/* width: 120px; */
line-height: 13px;
}

View File

@ -115,42 +115,52 @@ var AIRTIME = (function(AIRTIME) {
mod.createToolbarButtons = function () {
$menu = $("<div class='btn-toolbar' />");
$menu
.append("<div class='btn-group' title=" + $.i18n._('New') + ">" +
"<button class='btn btn-small' id='sb-new'>" +
"<i class='icon-white icon-plus'></i>" +
"<span>" + $.i18n._('New') + "</span>" +
"</button>" +
"</div>")
.append("<div class='btn-group' title=" + $.i18n._('Edit') + ">" +
"<button class='btn btn-small' id='sb-edit'>" +
"<i class='icon-white icon-pencil'></i>" +
"<span>" + $.i18n._('Edit') + "</span>" +
"</button>" +
"</div>")
if ($(".ui-dialog-content").length === 0) {
$menu
.append(
"<div class='btn-group' title=" + $.i18n._('New') + ">" +
"<button class='btn btn-small' id='sb-new'>" +
"<i class='icon-white icon-plus'></i>" +
"<span>" + $.i18n._('New') + "</span>" +
"</button>" +
"</div>"
).append(
"<div class='btn-group' title=" + $.i18n._('Edit') + ">" +
"<button class='btn btn-small' id='sb-edit'>" +
"<i class='icon-white icon-pencil'></i>" +
"<span>" + $.i18n._('Edit') + "</span>" +
"</button>" +
"</div>"
);
}
.append("<div class='btn-group'>" +
"<button class='btn btn-small' id='library-plus'>" +
"<i class='icon-white icon-plus'></i>" +
"<span id='lib-plus-text'></span>" +
"</button>" +
"</div>")
.append("<div class='btn-group' title=" + $.i18n._('Delete') + ">" +
"<button class='btn btn-small btn-danger' id='sb-trash'>" +
"<i class='icon-white icon-trash'></i>" +
"<span>" + $.i18n._('Delete') + "</span>" +
"</button>" +
"</div>")
.append("<div class='btn-group'>" +
"<button class='btn btn-small dropdown-toggle' data-toggle='dropdown'>" +
$.i18n._("Select") + " <span class='caret'></span>" +
"</button>" +
"<ul class='dropdown-menu'>" +
"<li id='sb-select-page'><a href='#'>" + $.i18n._("Select this page") + "</a></li>" +
"<li id='sb-dselect-page'><a href='#'>" + $.i18n._("Deselect this page") + "</a></li>" +
"<li id='sb-dselect-all'><a href='#'>" + $.i18n._("Deselect all") + "</a></li>" +
"</ul>" +
"</div>");
$menu
.append(
"<div class='btn-group'>" +
"<button class='btn btn-small' id='library-plus'>" +
"<i class='icon-white icon-plus'></i>" +
"<span id='lib-plus-text'></span>" +
"</button>" +
"</div>"
).append(
"<div class='btn-group' title=" + $.i18n._('Delete') + ">" +
"<button class='btn btn-small btn-danger' id='sb-trash'>" +
"<i class='icon-white icon-trash'></i>" +
"<span>" + $.i18n._('Delete') + "</span>" +
"</button>" +
"</div>"
).append(
"<div class='btn-group'>" +
"<button class='btn btn-small dropdown-toggle' data-toggle='dropdown'>" +
$.i18n._("Select") + " <span class='caret'></span>" +
"</button>" +
"<ul class='dropdown-menu'>" +
"<li id='sb-select-page'><a href='#'>" + $.i18n._("Select this page") + "</a></li>" +
"<li id='sb-dselect-page'><a href='#'>" + $.i18n._("Deselect this page") + "</a></li>" +
"<li id='sb-dselect-all'><a href='#'>" + $.i18n._("Deselect all") + "</a></li>" +
"</ul>" +
"</div>"
);
};
mod.moveSearchBarToHeader = function() {

View File

@ -1,265 +1,274 @@
$(document).ready(function() {
var uploader;
var self = this;
self.uploadFilter = "all";
self.IMPORT_STATUS_CODES = {
0 : { message: $.i18n._("Successfully imported")},
1 : { message: $.i18n._("Pending import")},
2 : { message: $.i18n._("Import failed.")},
UNKNOWN : { message: $.i18n._("Unknown")}
};
if (Object.freeze) {
Object.freeze(self.IMPORT_STATUS_CODES);
}
$(document).ready(function () {
console.log(acceptedMimeTypes.join());
Dropzone.options.addMediaDropzone = {
url:'/rest/media',
//clickable: false,
acceptedFiles: acceptedMimeTypes.join() + ",.flac",
init: function () {
this.on("sending", function (file, xhr, data) {
data.append("csrf_token", $("#csrf").val());
});
var uploadProgress;
var self = this;
self.uploadFilter = "all";
this.on("success", function(file, xhr, data) {
//Refresh the upload table:
self.recentUploadsTable.fnDraw(); //Only works because we're using bServerSide
//In DataTables 1.10 and greater, we can use .fnAjaxReload()
});
}
};
self.IMPORT_STATUS_CODES = {
0: {message: $.i18n._("Successfully imported")},
1: {message: $.i18n._("Pending import")},
2: {message: $.i18n._("Import failed.")},
UNKNOWN: {message: $.i18n._("Unknown")}
};
if (Object.freeze) {
Object.freeze(self.IMPORT_STATUS_CODES);
}
/*
var uploader = new plupload.Uploader({
runtimes: 'html5, flash, html4',
browse_button: 'pickfiles',
container: $("#container"),
url : baseUrl+'rest/media',
filters : [
{title: "Audio Files", extensions: "ogg,mp3,oga,flac,wav,m4a,mp4,opus,aac,oga,mp1,mp2,wma,au"}
],
multipart_params : {
"csrf_token" : $("#csrf").attr('value')
},
Dropzone.options.addMediaDropzone = {
url: '/rest/media',
//clickable: false,
acceptedFiles: acceptedMimeTypes.join() + ",.flac",
addRemoveLinks: true,
dictRemoveFile: $.i18n._("Remove"),
init: function () {
this.on("sending", function (file, xhr, data) {
data.append("csrf_token", $("#csrf").val());
});
init: {
PostInit: function() {
document.getElementById('filelist').innerHTML = '';
this.on("addedfile", function (file, xhr, data) {
var el = $(file.previewElement);
uploadProgress = true;
el.find(".dz-remove").prependTo(el.find(".dz-details"));
el.find(".dz-error-message").appendTo(el.find(".dz-error-mark"));
});
document.getElementById('uploadfiles').onclick = function() {
uploader.start();
return false;
};
},
this.on("success", function (file, xhr, data) {
//Refresh the upload table:
self.recentUploadsTable.fnDraw(); //Only works because we're using bServerSide
//In DataTables 1.10 and greater, we can use .fnAjaxReload()
});
this.on("complete", function() {
uploadProgress = false;
});
}
};
FilesAdded: function(up, files) {
plupload.each(files, function(file) {
document.getElementById('filelist').innerHTML += '<div id="' + file.id + '">' + file.name + ' (' + plupload.formatSize(file.size) + ') <b></b></div>';
});
},
/*
var uploader = new plupload.Uploader({
runtimes: 'html5, flash, html4',
browse_button: 'pickfiles',
container: $("#container"),
url : baseUrl+'rest/media',
filters : [
{title: "Audio Files", extensions: "ogg,mp3,oga,flac,wav,m4a,mp4,opus,aac,oga,mp1,mp2,wma,au"}
],
multipart_params : {
"csrf_token" : $("#csrf").attr('value')
},
UploadProgress: function(up, file) {
document.getElementById(file.id).getElementsByTagName('b')[0].innerHTML = '<span>' + file.percent + "%</span>";
},
init: {
PostInit: function() {
document.getElementById('filelist').innerHTML = '';
Error: function(up, err) {
document.getElementById('console').innerHTML += "\nError #" + err.code + ": " + err.message;
}
}
});
document.getElementById('uploadfiles').onclick = function() {
uploader.start();
return false;
};
},
uploader.init();
*/
FilesAdded: function(up, files) {
plupload.each(files, function(file) {
document.getElementById('filelist').innerHTML += '<div id="' + file.id + '">' + file.name + ' (' + plupload.formatSize(file.size) + ') <b></b></div>';
});
},
UploadProgress: function(up, file) {
document.getElementById(file.id).getElementsByTagName('b')[0].innerHTML = '<span>' + file.percent + "%</span>";
},
Error: function(up, err) {
document.getElementById('console').innerHTML += "\nError #" + err.code + ": " + err.message;
}
}
});
uploader.init();
*/
/*
$("#plupload_files").pluploadQueue({
// General settings
runtimes : 'gears, html5, html4',
url : baseUrl+'rest/media',
//chunk_size : '5mb', //Disabling chunking since we're using the File Upload REST API now
unique_names : 'true',
multiple_queues : 'true',
filters : [
{title: "Audio Files", extensions: "ogg,mp3,oga,flac,wav,m4a,mp4,opus,aac,oga,mp1,mp2,wma,au"}
],
multipart_params : {
"csrf_token" : $("#csrf").attr('value'),
}
});
/*
$("#plupload_files").pluploadQueue({
// General settings
runtimes : 'gears, html5, html4',
url : baseUrl+'rest/media',
//chunk_size : '5mb', //Disabling chunking since we're using the File Upload REST API now
unique_names : 'true',
multiple_queues : 'true',
filters : [
{title: "Audio Files", extensions: "ogg,mp3,oga,flac,wav,m4a,mp4,opus,aac,oga,mp1,mp2,wma,au"}
],
multipart_params : {
"csrf_token" : $("#csrf").attr('value'),
}
});
uploader = $("#plupload_files").pluploadQueue();
uploader = $("#plupload_files").pluploadQueue();
uploader.bind('FileUploaded', function(up, file, json)
{
//Refresh the upload table:
self.recentUploadsTable.fnDraw(); //Only works because we're using bServerSide
//In DataTables 1.10 and greater, we can use .fnAjaxReload()
});
var uploadProgress = false;
uploader.bind('QueueChanged', function(){
uploadProgress = (uploader.files.length > 0);
});
uploader.bind('UploadComplete', function(){
uploadProgress = false;
});*/
$(window).bind('beforeunload', function(){
if(uploadProgress){
uploader.bind('FileUploaded', function(up, file, json)
{
//Refresh the upload table:
self.recentUploadsTable.fnDraw(); //Only works because we're using bServerSide
//In DataTables 1.10 and greater, we can use .fnAjaxReload()
});
var uploadProgress = false;
uploader.bind('QueueChanged', function(){
uploadProgress = (uploader.files.length > 0);
});
uploader.bind('UploadComplete', function(){
uploadProgress = false;
});*/
$(window).bind('beforeunload', function () {
if (uploadProgress) {
return sprintf($.i18n._("You are currently uploading files. %sGoing to another screen will cancel the upload process. %sAre you sure you want to leave the page?"),
"\n", "\n");
}
});
self.renderImportStatus = function ( data, type, full ) {
if (typeof data !== "number") {
console.log("Invalid data type for the import_status.");
return;
}
var statusStr = self.IMPORT_STATUS_CODES.UNKNOWN.message;
var importStatusCode = data;
if (self.IMPORT_STATUS_CODES[importStatusCode]) {
statusStr = self.IMPORT_STATUS_CODES[importStatusCode].message;
};
"\n", "\n");
}
});
self.renderImportStatus = function (data, type, full) {
if (typeof data !== "number") {
console.log("Invalid data type for the import_status.");
return;
}
var statusStr = self.IMPORT_STATUS_CODES.UNKNOWN.message;
var importStatusCode = data;
if (self.IMPORT_STATUS_CODES[importStatusCode]) {
statusStr = self.IMPORT_STATUS_CODES[importStatusCode].message;
}
return statusStr;
};
self.renderFileActions = function ( data, type, full ) {
if (full.import_status == 0) {
return '<a class="deleteFileAction">' + $.i18n._('Delete from Library') + '</a>';
} else if (full.import_status == 1) {
//No actions for pending files
return $.i18n._('N/A');
} else { //Failed downloads
return '<a class="deleteFileAction">' + $.i18n._('Clear') + '</a>';
}
};
self.renderFileActions = function (data, type, full) {
if (full.import_status == 0) {
return '<a class="deleteFileAction">' + $.i18n._('Delete from Library') + '</a>';
} else if (full.import_status == 1) {
//No actions for pending files
return $.i18n._('N/A');
} else { //Failed downloads
return '<a class="deleteFileAction">' + $.i18n._('Clear') + '</a>';
}
};
$("#recent_uploads_table").on("click", "a.deleteFileAction", function () {
//Grab the file object for the row that was clicked.
// Some tips from the DataTables forums:
//Grab the file object for the row that was clicked.
// Some tips from the DataTables forums:
// fnGetData is used to get the object behind the row - you can also use
// fnGetPosition if you need to get the index instead
file = $("#recent_uploads_table").dataTable().fnGetData($(this).closest("tr")[0]);
$.ajax({
type: 'DELETE',
url: 'rest/media/' + file.id + "?csrf_token=" + $("#csrf").attr('value'),
success: function(resp) {
self.recentUploadsTable.fnDraw();
},
error: function() {
alert($.i18n._("Error: The file could not be deleted. Please try again later."));
}
});
file = $("#recent_uploads_table").dataTable().fnGetData($(this).closest("tr")[0]);
$.ajax({
type: 'DELETE',
url: 'rest/media/' + file.id + "?csrf_token=" + $("#csrf").attr('value'),
success: function (resp) {
self.recentUploadsTable.fnDraw();
},
error: function () {
alert($.i18n._("Error: The file could not be deleted. Please try again later."));
}
});
});
self.setupRecentUploadsTable = function() {
recentUploadsTable = $("#recent_uploads_table").dataTable({
self.setupRecentUploadsTable = function () {
recentUploadsTable = $("#recent_uploads_table").dataTable({
"bJQueryUI": true,
"bProcessing": false,
"bServerSide": true,
"sAjaxSource": '/Plupload/recent-uploads/format/json',
"sAjaxDataProp": 'files',
"bSearchable": false,
"bInfo": true,
//"sScrollY": "200px",
"bFilter": false,
"bSort": false,
"sDom": '<"H">frtip<"F"l>',
"bPaginate" : true,
"bProcessing": false,
"bServerSide": true,
"sAjaxSource": '/Plupload/recent-uploads/format/json',
"sAjaxDataProp": 'files',
"bSearchable": false,
"bInfo": true,
//"sScrollY": "200px",
"bFilter": false,
"bSort": false,
//"sDom": '<"H">frtip<"F"l>',
"sDom": 'frt<"F"lip>',
"bPaginate": true,
"sPaginationType": "full_numbers",
"oLanguage": getDatatablesStrings({
"sEmptyTable": $.i18n._("No files have been uploaded yet."),
"sInfoEmpty": $.i18n._("Showing 0 to 0 of 0 uploads"),
"sInfo": $.i18n._("Showing _START_ to _END_ of _TOTAL_ uploads"),
"sInfoEmpty": $.i18n._("Showing 0 to 0 of 0 uploads"),
"sInfoFiltered": $.i18n._("(filtered from _MAX_ total uploads)"),
"sInfoEmpty": $.i18n._("Showing 0 to 0 of 0 uploads"),
"sInfo": $.i18n._("Showing _START_ to _END_ of _TOTAL_ uploads"),
"sInfoFiltered": $.i18n._("(filtered from _MAX_ total uploads)"),
}),
"aoColumns": [
{ "mData" : "artist_name", "sTitle" : $.i18n._("Creator") },
{ "mData" : "track_title", "sTitle" : $.i18n._("Title") },
{ "mData" : "import_status", "sTitle" : $.i18n._("Import Status"),
"mRender": self.renderImportStatus
},
{ "mData" : "utime", "sTitle" : $.i18n._("Uploaded") },
{ "mData" : "id", "sTitle" : $.i18n._("Actions"),
"mRender": self.renderFileActions
}
],
"fnServerData": function ( sSource, aoData, fnCallback ) {
/* Add some extra data to the sender */
aoData.push( { "name": "uploadFilter", "value": self.uploadFilter } );
$.getJSON( sSource, aoData, function (json) {
fnCallback(json);
if (json.files) {
var areAnyFileImportsPending = false;
for (var i = 0; i < json.files.length; i++) {
//console.log(file);
var file = json.files[i];
if (file.import_status == 1)
{
areAnyFileImportsPending = true;
}
}
if (areAnyFileImportsPending) {
//alert("pending uploads, starting refresh on timer");
self.startRefreshingRecentUploads();
} else {
self.stopRefreshingRecentUploads();
}
{"mData": "artist_name", "sTitle": $.i18n._("Creator")},
{"mData": "track_title", "sTitle": $.i18n._("Title")},
{
"mData": "import_status", "sTitle": $.i18n._("Import Status"),
"mRender": self.renderImportStatus
},
{"mData": "utime", "sTitle": $.i18n._("Uploaded")},
{
"mData": "id", "sTitle": $.i18n._("Actions"),
"mRender": self.renderFileActions
}
],
"fnServerData": function (sSource, aoData, fnCallback) {
/* Add some extra data to the sender */
aoData.push({"name": "uploadFilter", "value": self.uploadFilter});
$.getJSON(sSource, aoData, function (json) {
fnCallback(json);
if (json.files) {
var areAnyFileImportsPending = false;
for (var i = 0; i < json.files.length; i++) {
//console.log(file);
var file = json.files[i];
if (file.import_status == 1) {
areAnyFileImportsPending = true;
}
}
if (areAnyFileImportsPending) {
//alert("pending uploads, starting refresh on timer");
self.startRefreshingRecentUploads();
} else {
self.stopRefreshingRecentUploads();
}
// Update usability hint - in common.js
getUsabilityHint();
}
} );
}
});
return recentUploadsTable;
};
self.startRefreshingRecentUploads = function()
{
if (self.isRecentUploadsRefreshTimerActive()) { //Prevent multiple timers from running
return;
}
self.recentUploadsRefreshTimer = setInterval("self.recentUploadsTable.fnDraw()", 3000);
};
self.isRecentUploadsRefreshTimerActive = function()
{
return (self.recentUploadsRefreshTimer != null);
};
self.stopRefreshingRecentUploads = function()
{
clearInterval(self.recentUploadsRefreshTimer);
self.recentUploadsRefreshTimer = null;
};
$("#upload_status_all").click(function() {
self.uploadFilter = "all";
self.recentUploadsTable.fnDraw();
});
$("#upload_status_pending").click(function() {
self.uploadFilter = "pending";
self.recentUploadsTable.fnDraw();
});
$("#upload_status_failed").click(function() {
self.uploadFilter = "failed";
self.recentUploadsTable.fnDraw();
});
// Update usability hint - in common.js
getUsabilityHint();
}
});
}
});
//Create the recent uploads table.
self.recentUploadsTable = self.setupRecentUploadsTable();
return recentUploadsTable;
};
//$("#recent_uploads_table.div.fg-toolbar").prepend('<b>Custom tool bar! Text/images etc.</b>');
self.startRefreshingRecentUploads = function () {
if (self.isRecentUploadsRefreshTimerActive()) { //Prevent multiple timers from running
return;
}
self.recentUploadsRefreshTimer = setInterval("self.recentUploadsTable.fnDraw()", 3000);
};
self.isRecentUploadsRefreshTimerActive = function () {
return (self.recentUploadsRefreshTimer != null);
};
self.stopRefreshingRecentUploads = function () {
clearInterval(self.recentUploadsRefreshTimer);
self.recentUploadsRefreshTimer = null;
};
$("#upload_status_all").click(function () {
self.uploadFilter = "all";
self.recentUploadsTable.fnDraw();
});
$("#upload_status_pending").click(function () {
self.uploadFilter = "pending";
self.recentUploadsTable.fnDraw();
});
$("#upload_status_failed").click(function () {
self.uploadFilter = "failed";
self.recentUploadsTable.fnDraw();
});
//Create the recent uploads table.
self.recentUploadsTable = self.setupRecentUploadsTable();
//$("#recent_uploads_table.div.fg-toolbar").prepend('<b>Custom tool bar! Text/images etc.</b>');
});

View File

@ -459,7 +459,7 @@ var AIRTIME = (function(AIRTIME){
: pane.append(json.html).find(".playlist_name_display").val(),
tab =
"<li data-tab-id='" + $tabCount + "' data-tab-type='" + json.type + "' id='pl-tab-" + $tabCount + "' role='presentation' class='active'>" +
"<a href='#'><span class='tab-name'></span>" +
"<a href='javascript:void(0)'><span class='tab-name'></span>" +
"<span href='#' class='lib_pl_close icon-remove'></span>" +
"</a>" +
"</li>",

View File

@ -121,6 +121,7 @@ AIRTIME = (function(AIRTIME) {
$(".media_type_selector:first").addClass("highlight");
var selected;
if (location.hash === "") {
location.hash = "tracks";
selected = $("a[href$='#tracks']");
} else {
selected = $("a[href$='"+location.hash+"']");
@ -137,10 +138,9 @@ AIRTIME = (function(AIRTIME) {
$(window).on('hashchange', function() {
var selected = $("a[href$='"+location.hash+"']");
// If we click Dashboard from one of the media views, do nothing
if (!location.hash) {
return;
}
var dashboardLink = $(".media_type_selector:first");
dashboardLink.find("a").attr("href", selected.attr("href"));
AIRTIME.library.selectNone();
$(".media_type_selector").each(function () {
$(this).removeClass("selected");
@ -149,7 +149,7 @@ AIRTIME = (function(AIRTIME) {
oTable.fnDraw();
$("#library_filter").text(selected.text());
// Highlight the dashboard link
$(".media_type_selector:first").addClass("highlight");
dashboardLink.addClass("highlight");
});
}