Merge pull request #1150 from zklosko/libraries

Refocus: Cleaning up libraries
This commit is contained in:
Lucas Bickel 2021-01-05 14:08:28 +01:00 committed by GitHub
commit ecd302068c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
70 changed files with 5 additions and 45432 deletions

View file

@ -331,39 +331,6 @@ class StationPodcastTask implements AirtimeTask {
}
/**
* TODO: this and the above StationPodcastTask should probably be unified since the
* behaviour is essentially identical
*
* Class BandwidthLimitTask
*
* Checks the bandwidth limit rollover timer and resets the allotted
* limit if enough time has passed (default: 1 month)
*/
class BandwidthLimitTask implements AirtimeTask {
const BANDWIDTH_LIMIT_RESET_TIMER_SECONDS = 2.628e+6;
/**
* Check whether the task should be run
*
* @return bool true if the task needs to be run, otherwise false
*/
public function shouldBeRun() {
$lastReset = Application_Model_Preference::getBandwidthLimitResetTimer();
return empty($lastReset) || (microtime(true) > ($lastReset + self::BANDWIDTH_LIMIT_RESET_TIMER_SECONDS));
}
/**
* Run the task
*/
public function run() {
Application_Model_Preference::resetStationPodcastDownloadCounter();
Application_Model_Preference::setBandwidthLimitResetTimer(microtime(true));
}
}
/**
* Class TaskFactory Factory class to abstract task instantiation
*/

View file

@ -69,18 +69,6 @@ class EmbedController extends Zend_Controller_Action
$this->view->availableDesktopStreams = json_encode($availableDesktopStreams);
}
public function currentDayProgramAction()
{
$this->view->layout()->disableLayout();
$CC_CONFIG = Config::getConfig();
$this->view->css = "/widgets/css/airtime-widgets.css?".$CC_CONFIG['airtime_version'];
$this->view->jquery = "/widgets/js/jquery-1.6.1.min.js?".$CC_CONFIG['airtime_version'];
$this->view->jquery_custom = "/widgets/js/jquery-ui-1.8.10.custom.min.js?".$CC_CONFIG['airtime_version'];
$this->view->widget_js = "/widgets/js/jquery.showinfo.js?".$CC_CONFIG['airtime_version'];
}
public function weeklyProgramAction()
{
$this->view->layout()->disableLayout();
@ -98,7 +86,7 @@ class EmbedController extends Zend_Controller_Action
$this->view->widgetStyle = "basic";
$this->view->css = "/css/embed/weekly-schedule-widget-basic.css?" . $CC_CONFIG['airtime_version'];
}
$this->view->jquery = "/widgets/js/jquery-1.6.1.min.js?".$CC_CONFIG['airtime_version'];
$this->view->jquery = "/js/libs/jquery-1.6.1.min.js?".$CC_CONFIG['airtime_version'];
$weeklyScheduleData = WidgetHelper::getWeekInfoV2();

View file

@ -436,7 +436,6 @@ final class LocaleController extends Zend_Controller_Action
": activate to sort column ascending",
": activate to sort column descending",
//End of datatables
"Welcome to the new Airtime Pro!" => _("Welcome to the new Airtime Pro!"),
//New entries from .js "" => _(""),
"First" => _("First"),

View file

@ -189,10 +189,9 @@ class PageLayoutInitPlugin extends Zend_Controller_Plugin_Abstract
$view->headScript()->appendFile($baseUrl . 'js/libs/jquery-1.8.3.min.js?' . $CC_CONFIG['airtime_version'], 'text/javascript')
->appendFile($baseUrl . 'js/libs/jquery-ui-1.8.24.min.js?' . $CC_CONFIG['airtime_version'], 'text/javascript')
->appendFile($baseUrl . 'js/libs/angular.min.js?' . $CC_CONFIG['airtime_version'], 'text/javascript')
->appendFile($baseUrl . 'js/bootstrap/bootstrap.js?' . $CC_CONFIG['airtime_version'], 'text/javascript')
->appendFile($baseUrl . 'js/bootstrap/bootstrap.min.js?' . $CC_CONFIG['airtime_version'], 'text/javascript')
->appendFile($baseUrl . 'js/libs/underscore-min.js?' . $CC_CONFIG['airtime_version'], 'text/javascript')
// ->appendFile($baseUrl . 'js/libs/jquery.stickyPanel.js?' . $CC_CONFIG['airtime_version'], 'text/javascript')
->appendFile($baseUrl . 'js/qtip/jquery.qtip.js?' . $CC_CONFIG['airtime_version'], 'text/javascript')
->appendFile($baseUrl . 'js/jplayer/jquery.jplayer.min.js?' . $CC_CONFIG['airtime_version'], 'text/javascript')
->appendFile($baseUrl . 'js/sprintf/sprintf-0.7-beta1.js?' . $CC_CONFIG['airtime_version'], 'text/javascript')

View file

@ -182,7 +182,7 @@
$(document).ready(function() {
var whatsnew = $("#whatsnew");
whatsnew.dialog({
title: $.i18n._("Welcome to the new Airtime Pro!"),
title: $.i18n._("Welcome to the Libretime!"),
width: "auto",
height: "auto",
modal: true,

View file

@ -1573,68 +1573,6 @@ class Application_Model_Preference
self::setValue("station_podcast_privacy", $value);
}
/**
* Accessors for station bandwidth limit.
*/
public static function getBandwidthLimit() {
return self::getValue("bandwidth_limit");
}
public static function setBandwidthLimit($value) {
self::setValue("bandwidth_limit", $value);
}
/**
* Accessors for bandwidth limit counter.
* Tracks bandwidth usage.
*
* @see ApiController::bandwidthUsageAction()
* @see BandwidthLimitTask
*/
public static function getBandwidthLimitCounter() {
return self::getValue("bandwidth_limit_counter");
}
public static function incrementBandwidthLimitCounter($value) {
$counter = intval(self::getValue("bandwidth_limit_counter"));
self::setValue("bandwidth_limit_counter", $counter + intval($value));
}
public static function resetBandwidthLimitCounter() {
self::setValue("bandwidth_limit_counter", 0);
}
/**
* Accessors for bandwidth limit reset timer.
* Used to determine when to reset the bandwidth counter for the station.
*
* @see BandwidthLimitTask
*/
public static function getBandwidthLimitResetTimer() {
return self::getValue("bandwidth_limit_reset_timer");
}
public static function setBandwidthLimitResetTimer($value) {
self::setValue("bandwidth_limit_reset_timer", $value);
}
/**
* Accessors for bandwidth limit update timer.
* Used to determine when the bandwidth was last updated for this station.
*
* @see ApiController::bandwidthUsageAction()
*/
public static function getBandwidthLimitUpdateTimer() {
return self::getValue("bandwidth_limit_update_timer");
}
public static function setBandwidthLimitUpdateTimer() {
self::setValue("bandwidth_limit_update_timer", microtime(true));
}
/**
* Getter for CORS URLs
*

View file

@ -15,17 +15,4 @@
</fieldset>
</div>
<div style="clear: both;"></div>
<?php $bandwidthLimit = Application_Model_Preference::getBandwidthLimit(); ?>
<?php if ($bandwidthLimit): ?>
<?php $bandwidthUsage = Application_Model_Preference::getBandwidthLimitCounter(); ?>
<?php $percentInUse = sprintf("%01.1f%% ", $bandwidthUsage/$bandwidthLimit*100); ?>
<div id="bandwidth_usage">
<div style="padding-bottom: 2px;"><?php echo _("Monthly Listener Bandwidth Usage") ?></div>
<div class="bandwidth_usage_progress_bar"></div>
<div class="bandwidth_usage_percent_in_use"><?php echo $percentInUse . _("in use") ?></div>
<div class="bandwidth_usage_used" style="width:<?php echo sprintf("%01.1f%%", min(100, $bandwidthUsage/$bandwidthLimit*100)) ?>;"></div>
<div style="margin-top: 17px; font-size: 12px;"><?php echo sprintf("%01.1fGB of %01.1fGB", $bandwidthUsage/pow(2, 30), $bandwidthLimit/pow(2, 30)); ?></div>
</div>
<?php endif; ?>
</div>