diff --git a/airtime_mvc/application/Bootstrap.php b/airtime_mvc/application/Bootstrap.php
index 4a5157f1e..26a6843c7 100644
--- a/airtime_mvc/application/Bootstrap.php
+++ b/airtime_mvc/application/Bootstrap.php
@@ -30,6 +30,8 @@ require_once "Timezone.php";
require_once "Auth.php";
require_once "interface/OAuth2.php";
require_once "TaskManager.php";
+require_once "UsabilityHints.php";
+require_once __DIR__.'/models/formatters/LengthFormatter.php';
require_once __DIR__.'/services/CeleryService.php';
require_once __DIR__.'/services/SoundcloudService.php';
require_once __DIR__.'/forms/helpers/ValidationTypes.php';
@@ -92,6 +94,15 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
$userType = "";
}
$view->headScript()->appendScript("var userType = '$userType';");
+
+ // Dropzone also accept file extensions and doesn't correctly extract certain mimetypes (eg. FLAC - try it),
+ // so we append the file extensions to the list of mimetypes and that makes it work.
+ $mimeTypes = FileDataHelper::getAudioMimeTypeArray();
+ $fileExtensions = array_values($mimeTypes);
+ foreach($fileExtensions as &$extension) {
+ $extension = '.' . $extension;
+ }
+ $view->headScript()->appendScript("var acceptedMimeTypes = " . json_encode(array_merge(array_keys($mimeTypes), $fileExtensions)) . ";");
}
/**
@@ -130,9 +141,9 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
protected function _initTasks() {
/* We need to wrap this here so that we aren't checking when we're running the unit test suite
*/
- $taskManager = TaskManager::getInstance();
- $taskManager->runTask(AirtimeTask::UPGRADE); // Run the upgrade on each request (if it needs to be run)
if (getenv("AIRTIME_UNIT_TEST") != 1) {
+ $taskManager = TaskManager::getInstance();
+ $taskManager->runTask(AirtimeTask::UPGRADE); // Run the upgrade on each request (if it needs to be run)
//This will do the upgrade too if it's needed...
$taskManager->runTasks();
}
diff --git a/airtime_mvc/application/cloud_storage/Amazon_S3StorageBackend.php b/airtime_mvc/application/cloud_storage/Amazon_S3StorageBackend.php
index 270015ae0..2f023aeea 100644
--- a/airtime_mvc/application/cloud_storage/Amazon_S3StorageBackend.php
+++ b/airtime_mvc/application/cloud_storage/Amazon_S3StorageBackend.php
@@ -42,12 +42,12 @@ class Amazon_S3StorageBackend extends StorageBackend
}
/** Returns a signed download URL from Amazon S3, expiring in 60 minutes */
- public function getDownloadURLs($resourceId)
+ public function getDownloadURLs($resourceId, $contentDispositionFilename)
{
$urls = array();
- $signedS3Url = $this->s3Client->getObjectUrl($this->getBucket(), $resourceId, '+60 minutes');
-
+ $s3args = array('ResponseContentDisposition' => 'attachment; filename="' . urlencode($contentDispositionFilename) . '"');
+ $signedS3Url = $this->s3Client->getObjectUrl($this->getBucket(), $resourceId, '+60 minutes', $s3args);
//If we're using the proxy cache, we need to modify the request URL after it has
//been generated by the above. (The request signature must be for the amazonaws.com,
@@ -65,7 +65,7 @@ class Amazon_S3StorageBackend extends StorageBackend
$p["path"] = substr($p["path"], 1 + strlen($this->getBucket()));
}
$proxyUrl = $p["scheme"] . "://" . $p["host"] . $p["path"] . "?" . $p["query"];
- //Add this proxy cache URL to the list of download URLs.
+ //Add this proxy cache URL to the list of download URLs.s
array_push($urls, $proxyUrl);
}
diff --git a/airtime_mvc/application/cloud_storage/FileStorageBackend.php b/airtime_mvc/application/cloud_storage/FileStorageBackend.php
index e7a87147e..1e111daf1 100644
--- a/airtime_mvc/application/cloud_storage/FileStorageBackend.php
+++ b/airtime_mvc/application/cloud_storage/FileStorageBackend.php
@@ -13,7 +13,7 @@ class FileStorageBackend extends StorageBackend
return $resourceId;
}
- public function getDownloadURLs($resourceId)
+ public function getDownloadURLs($resourceId, $contentDispositionFilename)
{
return "";
}
diff --git a/airtime_mvc/application/cloud_storage/ProxyStorageBackend.php b/airtime_mvc/application/cloud_storage/ProxyStorageBackend.php
index d99c62eef..391d34ac3 100644
--- a/airtime_mvc/application/cloud_storage/ProxyStorageBackend.php
+++ b/airtime_mvc/application/cloud_storage/ProxyStorageBackend.php
@@ -38,9 +38,9 @@ class ProxyStorageBackend extends StorageBackend
return $this->storageBackend->getAbsoluteFilePath($resourceId);
}
- public function getDownloadURLs($resourceId)
+ public function getDownloadURLs($resourceId, $contentDispositionFilename)
{
- return $this->storageBackend->getDownloadURLs($resourceId);
+ return $this->storageBackend->getDownloadURLs($resourceId, $contentDispositionFilename);
}
public function deletePhysicalFile($resourceId)
diff --git a/airtime_mvc/application/cloud_storage/StorageBackend.php b/airtime_mvc/application/cloud_storage/StorageBackend.php
index f0d58ba42..890611692 100644
--- a/airtime_mvc/application/cloud_storage/StorageBackend.php
+++ b/airtime_mvc/application/cloud_storage/StorageBackend.php
@@ -15,7 +15,7 @@ abstract class StorageBackend
/** Returns the file object's signed URL. The URL must be signed since they
* privately stored on the storage backend. */
- abstract public function getDownloadURLs($resourceId);
+ abstract public function getDownloadURLs($resourceId, $contentDispositionFilename);
/** Deletes the file from the storage backend. */
abstract public function deletePhysicalFile($resourceId);
diff --git a/airtime_mvc/application/common/Billing.php b/airtime_mvc/application/common/Billing.php
index fa716f6d1..137451172 100644
--- a/airtime_mvc/application/common/Billing.php
+++ b/airtime_mvc/application/common/Billing.php
@@ -1,5 +1,8 @@
$v) $query_string .= "$k=".urlencode($v)."&";
@@ -54,9 +57,9 @@ class Billing
$products = $result["products"]["product"];
//Blacklist all free plans
+ //Hide the promo plans - we will tell the user if they are eligible for a promo plan
foreach ($products as $k => $p) {
- Logging::info($p);
- if ($p["paytype"] === "free")
+ if ($p["paytype"] === "free" || strpos($p["name"], "Awesome August 2015") !== false)
{
unset($products[$k]);
}
@@ -106,7 +109,7 @@ class Billing
$result = self::makeRequest($credentials["url"], $query_string);
//XXX: Debugging / local testing
- if ($_SERVER['SERVER_NAME'] == "airtime.localhost") {
+ if ($_SERVER['SERVER_NAME'] == "localhost") {
$_SERVER['SERVER_NAME'] = "bananas.airtime.pro";
}
diff --git a/airtime_mvc/application/common/FileDataHelper.php b/airtime_mvc/application/common/FileDataHelper.php
index 2c5648f9f..568b25d4d 100644
--- a/airtime_mvc/application/common/FileDataHelper.php
+++ b/airtime_mvc/application/common/FileDataHelper.php
@@ -4,22 +4,23 @@ class FileDataHelper {
public static function getAudioMimeTypeArray() {
return array(
- "audio/ogg" => "ogg",
- "application/ogg" => "ogg",
- "audio/vorbis" => "ogg",
- "audio/mp3" => "mp3",
- "audio/mpeg" => "mp3",
- "audio/mpeg3" => "mp3",
- "audio/aac" => "aac",
- "audio/aacp" => "aac",
- "audio/mp4" => "mp4",
- "audio/x-flac" => "flac",
- "audio/wav" => "wav",
- "audio/x-wav" => "wav",
- "audio/mp2" => "mp2",
- "audio/mp1" => "mp1",
- "audio/x-ms-wma" => "wma",
- "audio/basic" => "au",
+ "audio/ogg" => "ogg",
+ "application/ogg" => "ogg",
+ "audio/vorbis" => "ogg",
+ "audio/mp3" => "mp3",
+ "audio/mpeg" => "mp3",
+ "audio/mpeg3" => "mp3",
+ "audio/x-aac" => "aac",
+ "audio/aac" => "aac",
+ "audio/aacp" => "aac",
+ "audio/mp4" => "m4a",
+ "audio/x-flac" => "flac",
+ "audio/wav" => "wav",
+ "audio/x-wav" => "wav",
+ "audio/mp2" => "mp2",
+ "audio/mp1" => "mp1",
+ "audio/x-ms-wma" => "wma",
+ "audio/basic" => "au",
);
}
@@ -65,4 +66,4 @@ class FileDataHelper {
}
}
-}
\ No newline at end of file
+}
diff --git a/airtime_mvc/application/common/ProvisioningHelper.php b/airtime_mvc/application/common/ProvisioningHelper.php
index cdd9818c0..113676e5e 100644
--- a/airtime_mvc/application/common/ProvisioningHelper.php
+++ b/airtime_mvc/application/common/ProvisioningHelper.php
@@ -11,6 +11,7 @@ class ProvisioningHelper
private $dbuser, $dbpass, $dbname, $dbhost, $dbowner, $apikey;
private $instanceId;
private $stationName, $description;
+ private $defaultIcecastPassword;
public function __construct($apikey)
{
@@ -24,8 +25,12 @@ class ProvisioningHelper
*/
public function createAction()
{
- $apikey = $_SERVER['PHP_AUTH_USER'];
- if (!isset($apikey) || $apikey != $this->apikey) {
+ $apikey = "";
+ if (isset($_SERVER['PHP_AUTH_USER']))
+ {
+ $apikey = $_SERVER['PHP_AUTH_USER'];
+ }
+ if ($apikey != $this->apikey) {
Logging::info("Invalid API Key: $apikey");
http_response_code(403);
echo "ERROR: Incorrect API key";
@@ -118,6 +123,9 @@ class ProvisioningHelper
if (isset($_POST['description'])) {
$this->description = $_POST['description'];
}
+ if (isset($_POST['icecast_pass'])) {
+ $this->defaultIcecastPassword = $_POST['icecast_pass'];
+ }
}
/**
@@ -208,6 +216,9 @@ class ProvisioningHelper
if ($this->description) {
Application_Model_Preference::SetStationDescription($this->description);
}
+ if (isset($this->defaultIcecastPassword)) {
+ Application_Model_Preference::setDefaultIcecastPassword($this->defaultIcecastPassword);
+ }
}
}
diff --git a/airtime_mvc/application/common/Timezone.php b/airtime_mvc/application/common/Timezone.php
index 7da82f6f9..5e12338e2 100644
--- a/airtime_mvc/application/common/Timezone.php
+++ b/airtime_mvc/application/common/Timezone.php
@@ -18,7 +18,7 @@ class Application_Common_Timezone
'UTC' => DateTimeZone::UTC
);
- $tzlist = array();
+ $tzlist = array(NULL => "Use station default");
foreach ($regions as $name => $mask) {
$ids = DateTimeZone::listIdentifiers($mask);
diff --git a/airtime_mvc/application/common/UsabilityHints.php b/airtime_mvc/application/common/UsabilityHints.php
new file mode 100644
index 000000000..fb52de7b6
--- /dev/null
+++ b/airtime_mvc/application/common/UsabilityHints.php
@@ -0,0 +1,211 @@
+getRequest()->getControllerName());
+
+ if ($currentController == "schedule") {
+ $userIsOnCalendarPage = true;
+ }
+
+ if ($currentController == "plupload") {
+ $userIsOnAddMediaPage = true;
+ }
+ }
+
+ if (self::zeroFilesUploaded()) {
+ if ($userIsOnAddMediaPage) {
+ return _("Upload some tracks below to add them to your library!");
+ } else {
+ return sprintf(_("It looks like you haven't uploaded any audio files yet. %sUpload a file now%s."),
+ "",
+ "");
+ }
+ } else if (!self::isFutureOrCurrentShowScheduled()) {
+ if ($userIsOnCalendarPage) {
+ return _("Click the 'New Show' button and fill out the required fields.");
+ } else {
+ return sprintf(_("It looks like you don't have any shows scheduled. %sCreate a show now%s."),
+ "",
+ "");
+ }
+ } else if (self::isCurrentShowEmpty()) {
+ // 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, 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."), "", "");
+ }
+ } else {
+ if ($userIsOnCalendarPage) {
+ return _("To start broadcasting, click on the current show and select 'Schedule Tracks'");
+ } else {
+ return sprintf(_("It looks like the current show needs more tracks. %sAdd tracks to your show now%s."),
+ "",
+ "");
+ }
+ }
+ } else if (!self::getCurrentShow() && self::isNextShowEmpty()) {
+ if ($userIsOnCalendarPage) {
+ return _("Click on the show starting next and select 'Schedule Tracks'");
+ } else {
+ return sprintf(_("It looks like the next show is empty. %sAdd tracks to your show now%s."),
+ "",
+ "");
+ }
+ } else {
+ return "";
+ }
+ }
+
+ /**
+ * Returns true if no files have been uploaded.
+ */
+ private static function zeroFilesUploaded()
+ {
+ $fileCount = CcFilesQuery::create()
+ ->filterByDbFileExists(true)
+ ->filterByDbHidden(false)
+ ->count();
+
+ if ($fileCount == 0) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Returns true if there is at least one show currently scheduled
+ * or in the future.
+ */
+ private static function isFutureOrCurrentShowScheduled()
+ {
+ $futureShow = self::getNextFutureShow();
+ $currentShow = self::getCurrentShow();
+
+ if (is_null($futureShow) && is_null($currentShow)) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+ private static function isCurrentShowEmpty()
+ {
+ $currentShow = self::getCurrentShow();
+
+ if (is_null($currentShow)) {
+ return false;
+ } else {
+ $now = new DateTime("now", new DateTimeZone("UTC"));
+ $scheduledTracks = CcScheduleQuery::create()
+ ->filterByDbInstanceId($currentShow->getDbId())
+ ->filterByDbEnds($now, Criteria::GREATER_EQUAL)
+ ->find();
+ if ($scheduledTracks->count() == 0) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ }
+
+ private static function isNextShowEmpty()
+ {
+ $futureShow = self::getNextFutureShow();
+
+ if (is_null($futureShow)) {
+ return false;
+ } else {
+ $now = new DateTime("now", new DateTimeZone("UTC"));
+ $scheduledTracks = CcScheduleQuery::create()
+ ->filterByDbInstanceId($futureShow->getDbId())
+ ->filterByDbStarts($now, Criteria::GREATER_EQUAL)
+ ->find();
+ if ($scheduledTracks->count() == 0) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ }
+
+ private static function getCurrentShow()
+ {
+ $now = new DateTime("now", new DateTimeZone("UTC"));
+
+ return CcShowInstancesQuery::create()
+ ->filterByDbStarts($now, Criteria::LESS_THAN)
+ ->filterByDbEnds($now, Criteria::GREATER_THAN)
+ ->filterByDbModifiedInstance(false)
+ ->findOne();
+ }
+
+ private static function getNextFutureShow()
+ {
+ $now = new DateTime("now", new DateTimeZone("UTC"));
+
+ return CcShowInstancesQuery::create()
+ ->filterByDbStarts($now, Criteria::GREATER_THAN)
+ ->filterByDbModifiedInstance(false)
+ ->orderByDbStarts()
+ ->findOne();
+ }
+
+ private static function isCurrentShowLinked()
+ {
+ $currentShow = self::getCurrentShow();
+ if (!is_null($currentShow)) {
+ $show = CcShowQuery::create()
+ ->filterByDbId($currentShow->getDbShowId())
+ ->findOne();
+ if ($show->isLinked()) {
+ return true;
+ } else {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ }
+}
\ No newline at end of file
diff --git a/airtime_mvc/application/configs/ACL.php b/airtime_mvc/application/configs/ACL.php
index 07ca7d822..843cfff30 100644
--- a/airtime_mvc/application/configs/ACL.php
+++ b/airtime_mvc/application/configs/ACL.php
@@ -40,7 +40,8 @@ $ccAcl->add(new Zend_Acl_Resource('library'))
->add(new Zend_Acl_Resource('provisioning'))
->add(new Zend_Acl_Resource('player'))
->add(new Zend_Acl_Resource('soundcloud'))
- ->add(new Zend_Acl_Resource('embeddablewidgets'));
+ ->add(new Zend_Acl_Resource('embeddablewidgets'))
+ ->add(new Zend_Acl_Resource('setup'));
/** Creating permissions */
$ccAcl->allow('G', 'index')
@@ -60,6 +61,8 @@ $ccAcl->allow('G', 'index')
->allow('G', 'downgrade')
->allow('G', 'rest:show-image', 'get')
->allow('G', 'rest:media', 'get')
+ ->allow('G', 'setup')
+ ->allow('G', 'embeddablewidgets')
->allow('H', 'soundcloud')
->allow('H', 'rest:show-image')
->allow('H', 'rest:media')
@@ -74,8 +77,6 @@ $ccAcl->allow('G', 'index')
->allow('A', 'user')
->allow('A', 'systemstatus')
->allow('A', 'preference')
- ->allow('A', 'player')
- ->allow('A', 'embeddablewidgets')
->allow('S', 'thank-you')
->allow('S', 'billing');
diff --git a/airtime_mvc/application/configs/constants.php b/airtime_mvc/application/configs/constants.php
index aaed5d901..c1b1edca1 100644
--- a/airtime_mvc/application/configs/constants.php
+++ b/airtime_mvc/application/configs/constants.php
@@ -9,6 +9,7 @@ define('COMPANY_NAME' , 'Sourcefabric');
define('COMPANY_SUFFIX' , 'z.รบ.');
define('COMPANY_SITE' , 'Sourcefabric.org');
define('COMPANY_SITE_URL' , 'http://sourcefabric.org/');
+define('SUPPORT_EMAIL_ADDRESS', "help@sourcefabric.org");
define('HELP_URL' , 'http://help.sourcefabric.org/');
define('FAQ_URL' , 'https://sourcefabricberlin.zendesk.com/hc/en-us/sections/200994309-Airtime-FAQ');
@@ -16,7 +17,10 @@ define('WHOS_USING_URL' , 'http://sourcefabric.org/en/airtime/whosus
define('TERMS_AND_CONDITIONS_URL' , 'http://www.sourcefabric.org/en/about/policy/');
define('PRIVACY_POLICY_URL' , 'http://www.sourcefabric.org/en/about/policy/');
define('USER_MANUAL_URL' , 'http://sourcefabric.booktype.pro/airtime-pro-for-broadcasters');
+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('LICENSE_VERSION' , 'GNU AGPL v.3');
define('LICENSE_URL' , 'http://www.gnu.org/licenses/agpl-3.0-standalone.html');
@@ -32,6 +36,9 @@ define('DEFAULT_LOGO_PLACEHOLDER', 1);
define('DEFAULT_LOGO_FILE', 'images/airtime_logo.png');
define('DEFAULT_TIMESTAMP_FORMAT', 'Y-m-d H:i:s');
define('DEFAULT_MICROTIME_FORMAT', 'Y-m-d H:i:s.u');
+define('DEFAULT_ICECAST_PORT', 8000);
+define('DEFAULT_ICECAST_PASS', 'hackme');
+define('DEFAULT_SHOW_COLOR', '76aca5');
// Metadata Keys for files
define('MDATA_KEY_FILEPATH' , 'filepath');
@@ -103,6 +110,7 @@ define('PROVISIONING_STATUS_ACTIVE' , 'Active');
define("TUNEIN_API_URL", "http://air.radiotime.com/Playing.ashx");
// SoundCloud
+define('SOUNDCLOUD', 'SoundCloud');
define('DEFAULT_SOUNDCLOUD_LICENSE_TYPE', 'all-rights-reserved');
define('DEFAULT_SOUNDCLOUD_SHARING_TYPE', 'public');
diff --git a/airtime_mvc/application/configs/navigation.php b/airtime_mvc/application/configs/navigation.php
index 6bfbb0d09..40bb48484 100644
--- a/airtime_mvc/application/configs/navigation.php
+++ b/airtime_mvc/application/configs/navigation.php
@@ -9,49 +9,59 @@
*/
$pages = array(
array(
- 'label' => _('Now Playing'),
- 'module' => 'default',
- 'controller' => 'Showbuilder',
- 'action' => 'index',
- 'resource' => 'showbuilder'
- ),
- array(
- 'label' => _('Add Media'),
- 'module' => 'default',
- 'controller' => 'Plupload',
- 'action' => 'index',
- 'resource' => 'plupload'
- ),
- array(
- 'label' => _('Library'),
- 'module' => 'default',
- 'controller' => 'Library',
- 'action' => 'index',
- 'resource' => 'playlist'
- ),
- array(
- 'label' => _('Calendar'),
- 'module' => 'default',
- 'controller' => 'Schedule',
- 'action' => 'index',
- 'resource' => 'schedule'
- ),
- array(
- 'label' => _('Radio Page'),
+ 'label' => ""._('Radio Page'),
'uri' => '/',
'resource' => '',
'pages' => array(
)
),
array(
- 'label' => _('System'),
- 'uri' => '#',
- 'resource' => 'preference',
- 'pages' => array(
+ 'label' => ""._('Calendar'),
+ 'module' => 'default',
+ 'controller' => 'schedule',
+ 'action' => 'index',
+ 'resource' => 'schedule'
+ ),
+ array(
+ 'label' => ""._('Widgets'),
+ 'module' => 'default',
+ 'controller' => 'embeddablewidgets',
+ 'action' => 'player',
+ 'resource' => 'embeddablewidgets',
+ 'title' => 'Widgets',
+ 'pages' => array(
array(
- 'label' => _('Preferences'),
+ 'label' => _('Player'),
'module' => 'default',
- 'controller' => 'Preference'
+ 'controller' => 'embeddablewidgets',
+ 'action' => 'player',
+ ),
+ array(
+ 'label' => _('Weekly Schedule'),
+ 'module' => 'default',
+ 'controller' => 'embeddablewidgets',
+ 'action' => 'schedule',
+ )
+ )
+ ),
+ array(
+ 'label' => ""._("Settings"),
+ 'resource' => 'preference',
+ 'action' => 'index',
+ 'module' => 'default',
+ 'controller' => 'preference',
+ 'title' => 'Settings',
+ 'pages' => array(
+ array(
+ 'label' => _('General'),
+ 'module' => 'default',
+ 'controller' => 'preference'
+ ),
+ array(
+ 'label' => _('My Profile'),
+ 'controller' => 'user',
+ 'action' => 'edit-user',
+ 'resource' => 'user'
),
array(
'label' => _('Users'),
@@ -60,26 +70,22 @@ $pages = array(
'action' => 'add-user',
'resource' => 'user'
),
- array(
- 'label' => _('Media Folders'),
- 'module' => 'default',
- 'controller' => 'Preference',
- 'action' => 'directory-config',
- 'id' => 'manage_folder'
- ),
array(
'label' => _('Streams'),
'module' => 'default',
- 'controller' => 'Preference',
+ 'controller' => 'preference',
'action' => 'stream-setting'
- ),
- array(
- 'label' => _('Status'),
- 'module' => 'default',
- 'controller' => 'systemstatus',
- 'action' => 'index',
- 'resource' => 'systemstatus'
- ),
+ )
+ )
+ ),
+ array(
+ 'label' => ""._("Analytics"),
+ 'module' => 'default',
+ 'controller' => 'listenerstat',
+ 'action' => 'index',
+ 'resource' => 'listenerstat',
+ 'title' => 'Analytics',
+ 'pages' => array(
array(
'label' => _('Listener Stats'),
'module' => 'default',
@@ -88,44 +94,58 @@ $pages = array(
'resource' => 'listenerstat'
),
array(
- 'label' => _('Embeddable Widgets'),
+ 'label' => _('Playout History'),
'module' => 'default',
- 'controller' => 'embeddablewidgets',
- 'action' => 'index'
+ 'controller' => 'playouthistory',
+ 'action' => 'index',
+ 'resource' => 'playouthistory'
+ ),
+ array(
+ 'label' => _('History Templates'),
+ 'module' => 'default',
+ 'controller' => 'playouthistorytemplate',
+ 'action' => 'index',
+ 'resource' => 'playouthistorytemplate'
)
)
),
- array(
- 'label' => _('History'),
- 'uri' => '#',
- 'resource' => 'playouthistory',
- 'pages' => array(
- array(
- 'label' => _('Playout History'),
- 'module' => 'default',
- 'controller' => 'playouthistory',
- 'action' => 'index',
- 'resource' => 'playouthistory'
- ),
- array(
- 'label' => _('History Templates'),
- 'module' => 'default',
- 'controller' => 'playouthistorytemplate',
- 'action' => 'index',
- 'resource' => 'playouthistorytemplate'
- ),
- )
- ),
array(
- 'label' => _('Help'),
- 'uri' => '#',
- 'resource' => 'dashboard',
- 'pages' => array(
+ 'label' => ""._('Billing'),
+ 'controller' => 'billing',
+ 'action' => 'upgrade',
+ 'resource' => 'billing',
+ 'title' => 'Billing',
+ 'pages' => array(
array(
- 'label' => _('Help Center'),
- 'uri' => HELP_URL,
- 'target' => "_blank"
+ 'label' => _('Account Plans'),
+ 'module' => 'default',
+ 'controller' => 'billing',
+ 'action' => 'upgrade',
+ 'resource' => 'billing'
),
+ array(
+ 'label' => _('Account Details'),
+ 'module' => 'default',
+ 'controller' => 'billing',
+ 'action' => 'client',
+ 'resource' => 'billing'
+ ),
+ array(
+ 'label' => _('View Invoices'),
+ 'module' => 'default',
+ 'controller' => 'billing',
+ 'action' => 'invoices',
+ 'resource' => 'billing'
+ )
+ )
+ ),
+ array(
+ 'label' => ""._('Help'),
+ 'controller' => 'dashboard',
+ 'action' => 'help',
+ 'resource' => 'dashboard',
+ 'title' => 'Help',
+ 'pages' => array(
array(
'label' => _('Getting Started'),
'module' => 'default',
@@ -144,11 +164,9 @@ $pages = array(
'target' => "_blank"
),
array(
- 'label' => _('About'),
- 'module' => 'default',
- 'controller' => 'dashboard',
- 'action' => 'about',
- 'resource' => 'dashboard'
+ 'label' => _('File a Support Ticket'),
+ 'uri' => SUPPORT_TICKET_URL,
+ 'target' => "_blank"
),
array(
'label' => _(sprintf("Help Translate %s", PRODUCT_NAME)),
@@ -157,34 +175,6 @@ $pages = array(
)
)
),
- array(
- 'label' => _('Billing'),
- 'uri' => '#',
- 'resource' => 'billing',
- 'pages' => array(
- array(
- 'label' => _('Account Details'),
- 'module' => 'default',
- 'controller' => 'billing',
- 'action' => 'client',
- 'resource' => 'billing'
- ),
- array(
- 'label' => _('Account Plans'),
- 'module' => 'default',
- 'controller' => 'billing',
- 'action' => 'upgrade',
- 'resource' => 'billing'
- ),
- array(
- 'label' => _('View Invoices'),
- 'module' => 'default',
- 'controller' => 'billing',
- 'action' => 'invoices',
- 'resource' => 'billing'
- )
- )
- )
);
diff --git a/airtime_mvc/application/controllers/ApiController.php b/airtime_mvc/application/controllers/ApiController.php
index 60b1e186b..cf1241e1e 100644
--- a/airtime_mvc/application/controllers/ApiController.php
+++ b/airtime_mvc/application/controllers/ApiController.php
@@ -64,6 +64,7 @@ class ApiController extends Zend_Controller_Action
->addActionContext('update-stream-setting-table' , 'json')
->addActionContext('update-replay-gain-value' , 'json')
->addActionContext('update-cue-values-by-silan' , 'json')
+ ->addActionContext('get-usability-hint' , 'json')
->initContext();
}
@@ -1466,5 +1467,13 @@ class ApiController extends Zend_Controller_Action
}
$this->_helper->json->sendJson(array(1));
}
+
+ public function getUsabilityHintAction()
+ {
+ $userPath = $this->_getParam("userPath");
+
+ $hint = Application_Common_UsabilityHints::getUsabilityHint($userPath);
+ $this->_helper->json->sendJson($hint);
+ }
}
diff --git a/airtime_mvc/application/controllers/BillingController.php b/airtime_mvc/application/controllers/BillingController.php
index fda5c881d..0e135e436 100644
--- a/airtime_mvc/application/controllers/BillingController.php
+++ b/airtime_mvc/application/controllers/BillingController.php
@@ -21,6 +21,9 @@ class BillingController extends Zend_Controller_Action {
public function upgradeAction()
{
+
+ Zend_Layout::getMvcInstance()->assign('parent_page', 'Billing');
+
$CC_CONFIG = Config::getConfig();
$baseUrl = Application_Common_OsPath::getBaseDir();
$this->view->headLink()->appendStylesheet($baseUrl.'css/billing.css?'.$CC_CONFIG['airtime_version']);
@@ -28,21 +31,24 @@ class BillingController extends Zend_Controller_Action {
$request = $this->getRequest();
$form = new Application_Form_BillingUpgradeDowngrade();
+
if ($request->isPost()) {
$formData = $request->getPost();
+
if ($form->isValid($formData)) {
+
$credentials = Billing::getAPICredentials();
-
+
//Check if VAT should be applied or not to this invoice.
if (in_array("7", $formData["customfields"])) {
$apply_vat = Billing::checkIfVatShouldBeApplied($formData["customfields"]["7"], $formData["country"]);
} else {
$apply_vat = false;
}
-
+
$placeAnUpgradeOrder = true;
-
+
$currentPlanProduct = Billing::getClientCurrentAirtimeProduct();
$currentPlanProductId = $currentPlanProduct["pid"];
$currentPlanProductBillingCycle = strtolower($currentPlanProduct["billingcycle"]);
@@ -51,33 +57,33 @@ class BillingController extends Zend_Controller_Action {
//and it freaks out and does the wrong thing if we do it via the API
//so we have to do avoid that.
if (($currentPlanProductId == $formData["newproductid"]) &&
- ($currentPlanProductBillingCycle == $formData["newproductbillingcycle"]))
- {
+ ($currentPlanProductBillingCycle == $formData["newproductbillingcycle"])
+ ) {
$placeAnUpgradeOrder = false;
}
-
+
$postfields = array();
$postfields["username"] = $credentials["username"];
$postfields["password"] = md5($credentials["password"]);
$postfields["action"] = "upgradeproduct";
$postfields["clientid"] = Application_Model_Preference::GetClientId();
-
+
$postfields["serviceid"] = Billing::getClientInstanceId();
$postfields["type"] = "product";
$postfields["newproductid"] = $formData["newproductid"];
$postfields["newproductbillingcycle"] = $formData["newproductbillingcycle"];
$postfields["paymentmethod"] = $formData["paymentmethod"];
$postfields["responsetype"] = "json";
-
+
$upgrade_query_string = "";
- foreach ($postfields AS $k=>$v) $upgrade_query_string .= "$k=".urlencode($v)."&";
-
+ foreach ($postfields AS $k => $v) $upgrade_query_string .= "$k=" . urlencode($v) . "&";
+
//update client info
$clientfields = array();
$clientfields["username"] = $credentials["username"];
$clientfields["password"] = md5($credentials["password"]);
- $clientfields["action"] = "updateclient";
+ $clientfields["action"] = "updateclient";
$clientfields["clientid"] = Application_Model_Preference::GetClientId();
$clientfields["customfields"] = base64_encode(serialize($formData["customfields"]));
unset($formData["customfields"]);
@@ -90,8 +96,8 @@ class BillingController extends Zend_Controller_Action {
unset($clientfields["password2verify"]);
unset($clientfields["submit"]);
$client_query_string = "";
- foreach ($clientfields AS $k=>$v) $client_query_string .= "$k=".urlencode($v)."&";
-
+ foreach ($clientfields AS $k => $v) $client_query_string .= "$k=" . urlencode($v) . "&";
+
//Update the client details in WHMCS first
$result = Billing::makeRequest($credentials["url"], $client_query_string);
Logging::info($result);
@@ -100,33 +106,39 @@ class BillingController extends Zend_Controller_Action {
$this->view->form = $form;
return;
}
-
+
//If there were no changes to the plan or billing cycle, we just redirect you to the
//invoices screen and show a message.
- if (!$placeAnUpgradeOrder)
- {
+ if (!$placeAnUpgradeOrder) {
$this->_redirect('billing/invoices?planupdated');
return;
}
-
+
//Then place an upgrade order in WHMCS
$result = Billing::makeRequest($credentials["url"], $upgrade_query_string);
if ($result["result"] == "error") {
- Logging::info($_SERVER['HTTP_HOST']." - Account upgrade failed. - ".$result["message"]);
+ Logging::info($_SERVER['HTTP_HOST'] . " - Account upgrade failed. - " . $result["message"]);
$this->setErrorMessage();
$this->view->form = $form;
} else {
- Logging::info($_SERVER['HTTP_HOST']. "Account plan upgrade request:");
+ Logging::info($_SERVER['HTTP_HOST'] . "Account plan upgrade request:");
Logging::info($result);
-
+
// Disable the view and the layout here, squashes an error.
$this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
-
+
if ($apply_vat) {
Billing::addVatToInvoice($result["invoiceid"]);
}
- self::viewInvoice($result["invoiceid"]);
+
+ // there may not be an invoice created if the client is downgrading
+ if (!empty($result["invoiceid"])) {
+ self::viewInvoice($result["invoiceid"]);
+ } else {
+ $this->_redirect('billing/invoices?planupdated');
+ return;
+ }
}
} else {
$this->view->form = $form;
@@ -207,6 +219,8 @@ class BillingController extends Zend_Controller_Action {
public function clientAction()
{
+ Zend_Layout::getMvcInstance()->assign('parent_page', 'Billing');
+
$CC_CONFIG = Config::getConfig();
$baseUrl = Application_Common_OsPath::getBaseDir();
$this->view->headLink()->appendStylesheet($baseUrl.'css/billing.css?'.$CC_CONFIG['airtime_version']);
@@ -257,6 +271,8 @@ class BillingController extends Zend_Controller_Action {
public function invoicesAction()
{
+ Zend_Layout::getMvcInstance()->assign('parent_page', 'Billing');
+
$CC_CONFIG = Config::getConfig();
$baseUrl = Application_Common_OsPath::getBaseDir();
$this->view->headLink()->appendStylesheet($baseUrl.'css/billing.css?'.$CC_CONFIG['airtime_version']);
diff --git a/airtime_mvc/application/controllers/DashboardController.php b/airtime_mvc/application/controllers/DashboardController.php
index 2dc134eec..660a6b61c 100644
--- a/airtime_mvc/application/controllers/DashboardController.php
+++ b/airtime_mvc/application/controllers/DashboardController.php
@@ -108,11 +108,12 @@ class DashboardController extends Zend_Controller_Action
public function helpAction()
{
- // action body
+ Zend_Layout::getMvcInstance()->assign('parent_page', 'Help');
}
public function aboutAction()
{
+ Zend_Layout::getMvcInstance()->assign('parent_page', 'Help');
$this->view->airtime_version = Application_Model_Preference::GetAirtimeVersion();
}
diff --git a/airtime_mvc/application/controllers/EmbeddablewidgetsController.php b/airtime_mvc/application/controllers/EmbeddablewidgetsController.php
index 7685d5c94..210edb969 100644
--- a/airtime_mvc/application/controllers/EmbeddablewidgetsController.php
+++ b/airtime_mvc/application/controllers/EmbeddablewidgetsController.php
@@ -8,8 +8,10 @@ class EmbeddableWidgetsController extends Zend_Controller_Action
}
- public function indexAction()
+ public function playerAction()
{
+ Zend_Layout::getMvcInstance()->assign('parent_page', 'Widgets');
+
$CC_CONFIG = Config::getConfig();
$baseUrl = Application_Common_OsPath::getBaseDir();
$this->view->headLink()->appendStylesheet($baseUrl.'css/player-form.css?'.$CC_CONFIG['airtime_version']);
@@ -27,6 +29,13 @@ class EmbeddableWidgetsController extends Zend_Controller_Action
1. Enable at least one MP3, AAC, or OGG stream under System -> Streams
2. Enable the Public Airtime API under System -> Preferences");
}
+ }
+
+ public function scheduleAction()
+ {
+ Zend_Layout::getMvcInstance()->assign('parent_page', 'Widgets');
+
+ $apiEnabled = Application_Model_Preference::GetAllow3rdPartyApi();
if (!$apiEnabled) {
$this->view->weekly_schedule_error_msg = _("To use the embeddable weekly schedule widget you must:
diff --git a/airtime_mvc/application/controllers/LibraryController.php b/airtime_mvc/application/controllers/LibraryController.php
index 2ad032973..1c85621e7 100644
--- a/airtime_mvc/application/controllers/LibraryController.php
+++ b/airtime_mvc/application/controllers/LibraryController.php
@@ -16,8 +16,6 @@ class LibraryController extends Zend_Controller_Action
->addActionContext('delete-group', 'json')
->addActionContext('context-menu', 'json')
->addActionContext('get-file-metadata', 'html')
- ->addActionContext('upload-file-soundcloud', 'json')
- ->addActionContext('get-upload-to-soundcloud-status', 'json')
->addActionContext('set-num-entries', 'json')
->addActionContext('edit-file-md', 'json')
->initContext();
@@ -25,95 +23,7 @@ class LibraryController extends Zend_Controller_Action
public function indexAction()
{
- $CC_CONFIG = Config::getConfig();
-
- $request = $this->getRequest();
- $baseUrl = Application_Common_OsPath::getBaseDir();
-
- $this->view->headScript()->appendFile($baseUrl.'js/blockui/jquery.blockUI.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.fnSetFilteringDelay.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.ColVis.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.ColReorder.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.FixedColumns.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.columnFilter.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
-
- $this->view->headScript()->appendFile($baseUrl.'js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'js/airtime/utilities/utilities.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'js/airtime/library/library.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'js/airtime/library/events/library_playlistbuilder.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
-
- $this->view->headLink()->appendStylesheet($baseUrl.'css/media_library.css?'.$CC_CONFIG['airtime_version']);
- $this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']);
- $this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/ColVis.css?'.$CC_CONFIG['airtime_version']);
- $this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/ColReorder.css?'.$CC_CONFIG['airtime_version']);
- $this->view->headLink()->appendStylesheet($baseUrl.'css/waveform.css?'.$CC_CONFIG['airtime_version']);
-
- $this->view->headScript()->appendFile($baseUrl.'js/airtime/library/spl.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'js/airtime/playlist/smart_blockbuilder.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
-
- $this->view->headScript()->appendFile($baseUrl.'js/waveformplaylist/observer/observer.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'js/waveformplaylist/config.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'js/waveformplaylist/curves.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'js/waveformplaylist/fades.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'js/waveformplaylist/local_storage.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'js/waveformplaylist/controls.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'js/waveformplaylist/playout.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'js/waveformplaylist/track_render.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'js/waveformplaylist/track.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'js/waveformplaylist/time_scale.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'js/waveformplaylist/playlist.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
-
- //arbitrary attributes need to be allowed to set an id for the templates.
- $this->view->headScript()->setAllowArbitraryAttributes(true);
- //$this->view->headScript()->appendScript(file_get_contents(APPLICATION_PATH.'/../public/js/waveformplaylist/templates/bottombar.tpl'),
- // 'text/template', array('id' => 'tpl_playlist_cues', 'noescape' => true));
-
- $this->view->headLink()->appendStylesheet($baseUrl.'css/playlist_builder.css?'.$CC_CONFIG['airtime_version']);
-
- try {
-
- $obj_sess = new Zend_Session_Namespace(UI_PLAYLISTCONTROLLER_OBJ_SESSNAME);
- if (isset($obj_sess->id)) {
- $objInfo = Application_Model_Library::getObjInfo($obj_sess->type);
- $obj = new $objInfo['className']($obj_sess->id);
- $userInfo = Zend_Auth::getInstance()->getStorage()->read();
- $user = new Application_Model_User($userInfo->id);
- $isAdminOrPM = $user->isUserType(array(UTYPE_SUPERADMIN, UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
-
- if ($isAdminOrPM || $obj->getCreatorId() == $userInfo->id) {
- $this->view->obj = $obj;
- if ($obj_sess->type == "block") {
- $form = new Application_Form_SmartBlockCriteria();
- $form->startForm($obj_sess->id);
- $this->view->form = $form;
- }
- }
-
- $formatter = new LengthFormatter($obj->getLength());
- $this->view->length = $formatter->format();
- $this->view->type = $obj_sess->type;
- }
-
- //get user settings and determine if we need to hide
- // or show the playlist editor
- $showPlaylist = false;
- $data = Application_Model_Preference::getLibraryScreenSettings();
- if (!is_null($data)) {
- if ($data["playlist"] == "true") {
- $showPlaylist = true;
- }
- }
- $this->view->showPlaylist = $showPlaylist;
- } catch (PlaylistNotFoundException $e) {
- $this->playlistNotFound($obj_sess->type);
- } catch (Exception $e) {
- $this->playlistNotFound($obj_sess->type);
- Logging::info($e->getMessage());
- //$this->playlistUnknownError($e);
- }
+ $this->_redirect("showbuilder");
}
protected function playlistNotFound($p_type)
@@ -219,6 +129,40 @@ class LibraryController extends Zend_Controller_Action
// is a cloud_file and handle it appropriately.
$url = $baseUrl."api/get-media/file/$id/download/true";
$menu["download"] = array("name" => _("Download"), "icon" => "download", "url" => $url);
+
+ // SOUNDCLOUD MENU OPTION
+ $ownerId = empty($obj) ? $file->getFileOwnerId() : $obj->getCreatorId();
+ if ($isAdminOrPM || $ownerId == $user->getId()) {
+ $soundcloudService = new SoundcloudService();
+ if ($type === "audioclip" && $soundcloudService->hasAccessToken()) {
+
+ //create a menu separator
+ $menu["sep1"] = "-----------";
+
+ //create a sub menu for Soundcloud actions.
+ $menu["soundcloud"] = array("name" => _(SOUNDCLOUD), "icon" => "soundcloud", "items" => array());
+
+ $serviceId = $soundcloudService->getServiceId($id);
+ if (!is_null($file) && $serviceId != 0) {
+ $menu["soundcloud"]["items"]["view"] = array("name" => _("View track"), "icon" => "soundcloud", "url" => $baseUrl . "soundcloud/view-on-sound-cloud/id/{$id}");
+ $menu["soundcloud"]["items"]["remove"] = array("name" => _("Remove track"), "icon" => "soundcloud", "url" => $baseUrl . "soundcloud/delete/id/{$id}");
+ } else {
+ // If a reference exists for this file ID, that means the user has uploaded the track
+ // but we haven't yet gotten a response from Celery, so disable the menu item
+ if ($soundcloudService->referenceExists($id)) {
+ $menu["soundcloud"]["items"]["upload"] = array(
+ "name" => _("Upload track"), "icon" => "soundcloud",
+ "url" => $baseUrl . "soundcloud/upload/id/{$id}", "disabled" => true
+ );
+ } else {
+ $menu["soundcloud"]["items"]["upload"] = array(
+ "name" => _("Upload track"), "icon" => "soundcloud",
+ "url" => $baseUrl . "soundcloud/upload/id/{$id}"
+ );
+ }
+ }
+ }
+ }
} elseif ($type === "playlist" || $type === "block") {
if ($type === 'playlist') {
$obj = new Application_Model_Playlist($id);
@@ -265,40 +209,6 @@ class LibraryController extends Zend_Controller_Action
}
}
- // SOUNDCLOUD MENU OPTION
- $ownerId = empty($obj) ? $file->getFileOwnerId() : $obj->getCreatorId();
- if ($isAdminOrPM || $ownerId == $user->getId()) {
- $soundcloudService = new SoundcloudService();
- if ($type === "audioclip" && $soundcloudService->hasAccessToken()) {
-
- //create a menu separator
- $menu["sep1"] = "-----------";
-
- //create a sub menu for Soundcloud actions.
- $menu["soundcloud"] = array("name" => _("Soundcloud"), "icon" => "soundcloud", "items" => array());
-
- $serviceId = $soundcloudService->getServiceId($id);
- if (!is_null($file) && $serviceId != 0) {
- $menu["soundcloud"]["items"]["view"] = array("name" => _("View track"), "icon" => "soundcloud", "url" => $baseUrl . "soundcloud/view-on-sound-cloud/id/{$id}");
- $menu["soundcloud"]["items"]["remove"] = array("name" => _("Remove track"), "icon" => "soundcloud", "url" => $baseUrl . "soundcloud/delete/id/{$id}");
- } else {
- // If a reference exists for this file ID, that means the user has uploaded the track
- // but we haven't yet gotten a response from Celery, so disable the menu item
- if ($soundcloudService->referenceExists($id)) {
- $menu["soundcloud"]["items"]["upload"] = array(
- "name" => _("Upload track"), "icon" => "soundcloud",
- "url" => $baseUrl . "soundcloud/upload/id/{$id}", "disabled" => true
- );
- } else {
- $menu["soundcloud"]["items"]["upload"] = array(
- "name" => _("Upload track"), "icon" => "soundcloud",
- "url" => $baseUrl . "soundcloud/upload/id/{$id}"
- );
- }
- }
- }
- }
-
if (empty($menu)) {
$menu["noaction"] = array("name"=>_("No action available"));
}
@@ -435,14 +345,17 @@ class LibraryController extends Zend_Controller_Action
$file_id = $this->_getParam('id', null);
$file = Application_Model_StoredFile::RecallById($file_id);
- if (!$isAdminOrPM && $file->getFileOwnerId() != $user->getId()) {
- return;
- }
-
$form = new Application_Form_EditAudioMD();
$form->startForm($file_id);
$form->populate($file->getDbColMetadata());
+ $this->view->permissionDenied = false;
+ if (!$isAdminOrPM && $file->getFileOwnerId() != $user->getId()) {
+ $form->makeReadOnly();
+ $form->removeActionButtons();
+ $this->view->permissionDenied = true;
+ }
+
if ($request->isPost()) {
$js = $this->_getParam('data');
@@ -461,7 +374,10 @@ class LibraryController extends Zend_Controller_Action
}
$this->view->form = $form;
- $this->view->dialog = $this->view->render('library/edit-file-md.phtml');
+ $this->view->id = $file_id;
+ $this->view->title = $file->getPropelOrm()->getDbTrackTitle();
+ $this->view->type = "md";
+ $this->view->html = $this->view->render('library/edit-file-md.phtml');
}
public function getFileMetadataAction()
diff --git a/airtime_mvc/application/controllers/ListenerstatController.php b/airtime_mvc/application/controllers/ListenerstatController.php
index d8ac220b5..15a7a9e3a 100644
--- a/airtime_mvc/application/controllers/ListenerstatController.php
+++ b/airtime_mvc/application/controllers/ListenerstatController.php
@@ -17,8 +17,11 @@ class ListenerstatController extends Zend_Controller_Action
$request = $this->getRequest();
$baseUrl = Application_Common_OsPath::getBaseDir();
+ Zend_Layout::getMvcInstance()->assign('parent_page', 'Analytics');
+
$this->view->headScript()->appendFile($baseUrl.'js/flot/jquery.flot.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/flot/jquery.flot.crosshair.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'js/flot/jquery.flot.resize.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/listenerstat/listenerstat.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/timepicker/jquery.ui.timepicker.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
diff --git a/airtime_mvc/application/controllers/LocaleController.php b/airtime_mvc/application/controllers/LocaleController.php
index 7d83a165e..81cebc183 100644
--- a/airtime_mvc/application/controllers/LocaleController.php
+++ b/airtime_mvc/application/controllers/LocaleController.php
@@ -51,6 +51,15 @@ class LocaleController extends Zend_Controller_Action
//library/events/library_showbuilder.js
//already in library/events/library_playlistbuilder.js
"Please select a cursor position on timeline." => _("Please select a cursor position on timeline."),
+ "You haven't added any tracks" => _("You haven't added any tracks"),
+ "You haven't added any playlists" => _("You haven't added any playlists"),
+ "You haven't added any smart blocks" => _("You haven't added any smart blocks"),
+ "You haven't added any webstreams" => _("You haven't added any webstreams"),
+ "Learn about tracks" => _("Learn about tracks"),
+ "Learn about playlists" => _("Learn about playlists"),
+ "Learn about smart blocks" => _("Learn about smart blocks"),
+ "Learn about webstreams" => _("Learn about webstreams"),
+ "Click 'New' to create one." => _("Click 'New' to create one."),
//"Adding 1 Item" => _("Adding 1 Item"),
//"Adding %s Items" => _("Adding %s Items"),
//library/library.js
@@ -62,7 +71,8 @@ class LocaleController extends Zend_Controller_Action
"Deselect all" => _("Deselect all"),
"Are you sure you want to delete the selected item(s)?" => _("Are you sure you want to delete the selected item(s)?"),
"Scheduled" => _("Scheduled"),
- "Playlist" => _("Playlist / Block"),
+ "Tracks" => _("Tracks"),
+ "Playlist" => _("Playlist"),
"Title" => _("Title"),
"Creator" => _("Creator"),
"Album" => _("Album"),
@@ -112,7 +122,7 @@ class LocaleController extends Zend_Controller_Action
//library/spl.js
"Open Media Builder" => _("Open Media Builder"),
"please put in a time '00:00:00 (.0)'" => _("please put in a time '00:00:00 (.0)'"),
- "please put in a time in seconds '00 (.0)'" => _("please put in a time in seconds '00 (.0)'"),
+ "Please enter a valid time in seconds. Eg. 0.5'" => _("Please enter a valid time in seconds. Eg. 0.5"),
"Your browser does not support playing this file type: " => _("Your browser does not support playing this file type: "),
"Dynamic block is not previewable" => _("Dynamic block is not previewable"),
"Limit to: " => _("Limit to: "),
@@ -171,8 +181,7 @@ class LocaleController extends Zend_Controller_Action
"Check this box to automatically switch on Master/Show source upon source connection." => _("Check this box to automatically switch on Master/Show source upon source connection."),
"If your Icecast server expects a username of 'source', this field can be left blank." => _("If your Icecast server expects a username of 'source', this field can be left blank."),
"If your live streaming client does not ask for a username, this field should be 'source'." => _("If your live streaming client does not ask for a username, this field should be 'source'."),
- "If you change the username or password values for an enabled stream the playout engine will be rebooted and your listeners will hear silence for 5-10 seconds. Changing the following fields will NOT cause a reboot: Stream Label (Global Settings), and Switch Transition Fade(s), Master Username, and Master Password (Input Stream Settings). If Airtime is recording, and if the change causes a playout engine restart, the recording will be interrupted."
- => _("If you change the username or password values for an enabled stream the playout engine will be rebooted and your listeners will hear silence for 5-10 seconds. Changing the following fields will NOT cause a reboot: Stream Label (Global Settings), and Switch Transition Fade(s), Master Username, and Master Password (Input Stream Settings). If Airtime is recording, and if the change causes a playout engine restart, the recording will be interrupted."),
+ "WARNING: This will restart your stream and may cause a short dropout for your listeners!" => _("WARNING: This will restart your stream and may cause a short dropout for your listeners!"),
"This is the admin username and password for Icecast/SHOUTcast to get listener statistics." => _("This is the admin username and password for Icecast/SHOUTcast to get listener statistics."),
//preferences/support-setting.js
"Image must be one of jpg, jpeg, png, or gif" => _("Image must be one of jpg, jpeg, png, or gif"),
@@ -233,10 +242,10 @@ class LocaleController extends Zend_Controller_Action
"Oct" => _("Oct"),
"Nov" => _("Nov"),
"Dec" => _("Dec"),
- "today" => _("today"),
- "day" => _("day"),
- "week" => _("week"),
- "month" => _("month"),
+ "Today" => _("Today"),
+ "Day" => _("Day"),
+ "Week" => _("Week"),
+ "Month" => _("Month"),
"Sunday" => _("Sunday"),
"Monday" => _("Monday"),
"Tuesday" => _("Tuesday"),
@@ -264,6 +273,9 @@ class LocaleController extends Zend_Controller_Action
"Start" => _("Start"),
"End" => _("End"),
"Duration" => _("Duration"),
+ "Filtering out " => _("Filtering out "),
+ " of " => _(" of "),
+ " records" => _(" records"),
//already in library/library.js
//"Title" => _("Title"),
//"Creator" => _("Creator"),
@@ -291,7 +303,7 @@ class LocaleController extends Zend_Controller_Action
//"Select" => _("Select"),
"Select all" => _("Select all"),
"Select none" => _("Select none"),
- "Remove overbooked tracks" => _("Remove overbooked tracks"),
+ "Trim overbooked shows" => _("Trim overbooked shows"),
"Remove selected scheduled items" => _("Remove selected scheduled items"),
"Jump to the current playing track" => _("Jump to the current playing track"),
"Cancel current show" => _("Cancel current show"),
@@ -391,7 +403,27 @@ class LocaleController extends Zend_Controller_Action
"No Show" => _("No Show"),
"All" => _("All"),
"Copied %s row%s to the clipboard" => _("Copied %s row%s to the clipboard"),
- "%sPrint view%sPlease use your browser's print function to print this table. Press escape when finished." => _("%sPrint view%sPlease use your browser's print function to print this table. Press escape when finished.")
+ "%sPrint view%sPlease use your browser's print function to print this table. Press escape when finished." => _("%sPrint view%sPlease use your browser's print function to print this table. Press escape when finished."),
+ "New Show" => _("New Show"),
+ "New Log Entry" => _("New Log Entry"),
+ //Datatables:
+ "No data available in table",
+ "Showing _START_ to _END_ of _TOTAL_ entries",
+ "Showing 0 to 0 of 0 entries",
+ "(filtered from _MAX_ total entries)",
+ "",
+ ",",
+ "Show _MENU_",
+ "Loading...",
+ "Processing...",
+ "No matching records found",
+ "First",
+ "Last",
+ "Next",
+ "Previous",
+ ": activate to sort column ascending",
+ ": activate to sort column descending"
+ //End of datatables
);
$this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
diff --git a/airtime_mvc/application/controllers/LoginController.php b/airtime_mvc/application/controllers/LoginController.php
index 920a258cc..708f9ac16 100644
--- a/airtime_mvc/application/controllers/LoginController.php
+++ b/airtime_mvc/application/controllers/LoginController.php
@@ -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.
@@ -38,11 +38,9 @@ class LoginController extends Zend_Controller_Action
$baseUrl = Application_Common_OsPath::getBaseDir();
- $this->view->headScript()->appendFile($baseUrl.'js/airtime/login/login.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
-
$form = new Application_Form_Login();
- $message = _("Please enter your user name and password");
+ $message = _("Please enter your username and password.");
if ($request->isPost()) {
// if the post contains recaptcha field, which means form had recaptcha field.
@@ -78,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);
@@ -89,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.");
@@ -132,34 +130,32 @@ class LoginController extends Zend_Controller_Action
$CC_CONFIG = Config::getConfig();
$baseUrl = Application_Common_OsPath::getBaseDir();
-
- $this->view->headScript()->appendFile($baseUrl.'js/airtime/login/password-restore.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
+
+ $this->view->headScript()->appendFile($baseUrl . 'js/airtime/login/password-restore.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
$request = $this->getRequest();
$stationLocale = Application_Model_Preference::GetDefaultLocale();
-
+
Application_Model_Locale::configureLocalization($request->getcookie('airtime_locale', $stationLocale));
- if (!Application_Model_Preference::GetEnableSystemEmail()) {
- $this->_redirect('login');
- } else {
- //uses separate layout without a navigation.
- $this->_helper->layout->setLayout('login');
+ //uses separate layout without a navigation.
+ $this->_helper->layout->setLayout('login');
- $form = new Application_Form_PasswordRestore();
+ $form = new Application_Form_PasswordRestore();
- $request = $this->getRequest();
- if ($request->isPost() && $form->isValid($request->getPost())) {
- if (is_null($form->username->getValue()) || $form->username->getValue() == '') {
- $user = CcSubjsQuery::create()
- ->filterByDbEmail($form->email->getValue())
- ->findOne();
+ $request = $this->getRequest();
+ if ($request->isPost()) {
+ if ($form->isValid($request->getPost())) {
+ $query = CcSubjsQuery::create();
+ if (empty($form->username->getValue())) {
+ $query->filterByDbEmail($form->email->getValue());
+ } else if (empty($form->email->getValue())) {
+ $query->filterByDbLogin($form->username->getValue());
} else {
- $user = CcSubjsQuery::create()
- ->filterByDbEmail($form->email->getValue())
- ->filterByDbLogin($form->username->getValue())
- ->findOne();
+ $query->filterByDbEmail($form->email->getValue())
+ ->filterByDbLogin($form->username->getValue());
}
+ $user = $query->findOne();
if (!empty($user)) {
$auth = new Application_Model_Auth();
@@ -171,12 +167,14 @@ class LoginController extends Zend_Controller_Action
$form->email->addError($this->view->translate(_("Email could not be sent. Check your mail server settings and ensure it has been configured properly.")));
}
} else {
- $form->email->addError($this->view->translate(_("Given email not found.")));
+ $form->email->addError($this->view->translate(sprintf(_pro("That username or email address could not be found. If you are the station owner, you should reset your here."), WHMCS_PASSWORD_RESET_URL)));
}
+ } else { //Form is not valid
+ $form->email->addError($this->view->translate(_("There was a problem with the username or email address you entered.")));
}
-
- $this->view->form = $form;
}
+
+ $this->view->form = $form;
}
public function passwordRestoreAfterAction()
diff --git a/airtime_mvc/application/controllers/PlaylistController.php b/airtime_mvc/application/controllers/PlaylistController.php
index 2bbe691e1..7bb425a7e 100644
--- a/airtime_mvc/application/controllers/PlaylistController.php
+++ b/airtime_mvc/application/controllers/PlaylistController.php
@@ -1,5 +1,6 @@
addActionContext('get-block-info', 'json')
->addActionContext('shuffle', 'json')
->addActionContext('empty-content', 'json')
+ ->addActionContext('change-playlist', 'json')
->initContext();
//This controller writes to the session all over the place, so we're going to reopen it for writing here.
@@ -41,6 +43,7 @@ class PlaylistController extends Zend_Controller_Action
$objInfo = Application_Model_Library::getObjInfo($p_type);
$obj_sess = new Zend_Session_Namespace(UI_PLAYLISTCONTROLLER_OBJ_SESSNAME);
+
if (isset($obj_sess->id)) {
$obj = new $objInfo['className']($obj_sess->id);
@@ -72,6 +75,16 @@ class PlaylistController extends Zend_Controller_Action
private function createFullResponse($obj = null, $isJson = false,
$formIsValid = false)
{
+ $user = Application_Model_User::getCurrentUser();
+ $isAdminOrPM = $user->isUserType(array(UTYPE_SUPERADMIN, UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
+
+ if (!$isAdminOrPM && $obj->getCreatorId() != $user->getId()) {
+ $this->view->objType = $obj instanceof Application_Model_Block ? "block" : "playlist";
+ $this->view->obj = $obj;
+ $this->view->html = $this->view->render('playlist/permission-denied.phtml');
+ return;
+ }
+
$isBlock = false;
$viewPath = 'playlist/playlist.phtml';
if ($obj instanceof Application_Model_Block) {
@@ -89,6 +102,7 @@ class PlaylistController extends Zend_Controller_Action
$this->view->form = $form;
$this->view->obj = $obj;
+ $this->view->type = "sb";
$this->view->id = $obj->getId();
if ($isJson) {
@@ -98,6 +112,7 @@ class PlaylistController extends Zend_Controller_Action
}
} else {
$this->view->obj = $obj;
+ $this->view->type = "pl";
$this->view->id = $obj->getId();
if ($isJson) {
return $this->view->html = $this->view->render($viewPath);
@@ -187,6 +202,16 @@ class PlaylistController extends Zend_Controller_Action
$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()
{
$id = $this->_getParam('id', null);
@@ -194,9 +219,9 @@ class PlaylistController extends Zend_Controller_Action
$objInfo = Application_Model_Library::getObjInfo($type);
Logging::info("editing {$type} {$id}");
- if (!is_null($id)) {
- Application_Model_Library::changePlaylist($id, $type);
- }
+// if (!is_null($id)) {
+ Application_Model_Library::changePlaylist($id, $type);
+// }
try {
$obj = new $objInfo['className']($id);
@@ -227,7 +252,7 @@ class PlaylistController extends Zend_Controller_Action
Logging::info("Currently active {$type} {$obj_sess->id}");
if (in_array($obj_sess->id, $ids)) {
Logging::info("Deleting currently active {$type}");
- Application_Model_Library::changePlaylist(null, $type);
+ // Application_Model_Library::changePlaylist(null, $type);
} else {
Logging::info("Not deleting currently active {$type}");
$obj = new $objInfo['className']($obj_sess->id);
@@ -519,7 +544,7 @@ class PlaylistController extends Zend_Controller_Action
$request = $this->getRequest();
$params = $request->getPost();
$result = array();
-
+
if ($params['type'] == 'block') {
try {
$bl = new Application_Model_Block($params['obj_id']);
@@ -531,24 +556,34 @@ class PlaylistController extends Zend_Controller_Action
if ($form->isValid($params)) {
$this->setPlaylistNameDescAction();
$bl->saveSmartBlockCriteria($params['data']);
+
+ $this->createUpdateResponse($bl);
+ $this->view->result = 0;
+ /*
$result['html'] = $this->createFullResponse($bl, true, true);
- $result['result'] = 0;
+ */
} else {
- $this->view->obj = $bl;
- $this->view->id = $bl->getId();
$this->view->form = $form;
$this->view->unsavedName = $params['name'];
$this->view->unsavedDesc = $params['description'];
$viewPath = 'playlist/smart-block.phtml';
- $result['html'] = $this->view->render($viewPath);
- $result['result'] = 1;
+ $this->view->obj = $bl;
+ $this->view->id = $bl->getId();
+ $this->view->html = $this->view->render($viewPath);
+ $this->view->result = 1;
}
+ $this->view->name = $bl->getName();
+ $this->view->type = "sb";
+ $this->view->id = $bl->getId();
+ $this->view->modified = $bl->getLastModified("U");
} else if ($params['type'] == 'playlist') {
$this->setPlaylistNameDescAction();
+ $this->view->modified = $this->view->modified;
+ $this->view->name = $params['name'];
}
- $result["modified"] = $this->view->modified;
- $this->_helper->json->sendJson($result);
+
+ //$this->_helper->json->sendJson($result);
}
public function smartBlockGenerateAction()
@@ -564,15 +599,14 @@ class PlaylistController extends Zend_Controller_Action
$form->startForm($params['obj_id']);
if ($form->isValid($params)) {
$result = $bl->generateSmartBlock($params['data']);
- $this->_helper->json->sendJson(array("result"=>0, "html"=>$this->createFullResponse($bl, true, true)));
+ $this->view->result = $result['result'];
+ $this->createUpdateResponse($bl);
+ #$this->_helper->json->sendJson(array("result"=>0, "html"=>$this->createFullResponse($bl, true, true)));
} else {
$this->view->obj = $bl;
$this->view->id = $bl->getId();
$this->view->form = $form;
- $viewPath = 'playlist/smart-block.phtml';
- $result['html'] = $this->view->render($viewPath);
- $result['result'] = 1;
- $this->_helper->json->sendJson($result);
+ $this->createFullResponse($bl, false, true);
}
} catch (BlockNotFoundException $e) {
$this->playlistNotFound('block', true);
@@ -589,12 +623,20 @@ class PlaylistController extends Zend_Controller_Action
try {
$bl = new Application_Model_Block($params['obj_id']);
$result = $bl->shuffleSmartBlock();
-
+
+ $this->view->result = $result["result"];
+ $this->createUpdateResponse($bl);
+
+ /*
if ($result['result'] == 0) {
- $this->_helper->json->sendJson(array("result"=>0, "html"=>$this->createFullResponse($bl, true)));
+ $this->_helper->json->sendJson(array(
+ "result"=>0,
+ "contents" => $bl->getContents());
+ ///"html"=>$this->viwe));
+
} else {
$this->_helper->json->sendJson($result);
- }
+ }*/
} catch (BlockNotFoundException $e) {
$this->playlistNotFound('block', true);
} catch (Exception $e) {
@@ -609,12 +651,18 @@ class PlaylistController extends Zend_Controller_Action
try {
$pl = new Application_Model_Playlist($params['obj_id']);
$result = $pl->shuffle();
-
+
+ $this->view->result = $result["result"];
+ $this->createUpdateResponse($pl);
+ /*
if ($result['result'] == 0) {
- $this->_helper->json->sendJson(array("result"=>0, "html"=>$this->createFullResponse($pl, true)));
+ $this->_helper->json->sendJson(array(
+ "result"=>0,
+ "contents" => $pl->getContents(),
+ "html"=>$this->createUpdateResponse($pl, true)));
} else {
$this->_helper->json->sendJson($result);
- }
+ }*/
} catch (PlaylistNotFoundException $e) {
$this->playlistNotFound('block', true);
} catch (Exception $e) {
diff --git a/airtime_mvc/application/controllers/PlayouthistoryController.php b/airtime_mvc/application/controllers/PlayouthistoryController.php
index 533f41d76..1d55266cb 100644
--- a/airtime_mvc/application/controllers/PlayouthistoryController.php
+++ b/airtime_mvc/application/controllers/PlayouthistoryController.php
@@ -24,6 +24,8 @@ class PlayouthistoryController extends Zend_Controller_Action
$CC_CONFIG = Config::getConfig();
$baseUrl = Application_Common_OsPath::getBaseDir();
+ Zend_Layout::getMvcInstance()->assign('parent_page', 'Analytics');
+
list($startsDT, $endsDT) = Application_Common_HTTPHelper::getStartEndFromRequest($this->getRequest());
$userTimezone = new DateTimeZone(Application_Model_Preference::GetUserTimezone());
diff --git a/airtime_mvc/application/controllers/PlayouthistorytemplateController.php b/airtime_mvc/application/controllers/PlayouthistorytemplateController.php
index c6651d8eb..72fea97d3 100644
--- a/airtime_mvc/application/controllers/PlayouthistorytemplateController.php
+++ b/airtime_mvc/application/controllers/PlayouthistorytemplateController.php
@@ -17,6 +17,8 @@ class PlayouthistorytemplateController extends Zend_Controller_Action
{
$CC_CONFIG = Config::getConfig();
$baseUrl = Application_Common_OsPath::getBaseDir();
+
+ Zend_Layout::getMvcInstance()->assign('parent_page', 'Analytics');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/playouthistory/template.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headLink()->appendStylesheet($baseUrl.'css/history_styles.css?'.$CC_CONFIG['airtime_version']);
@@ -31,6 +33,8 @@ class PlayouthistorytemplateController extends Zend_Controller_Action
$CC_CONFIG = Config::getConfig();
$baseUrl = Application_Common_OsPath::getBaseDir();
+
+ Zend_Layout::getMvcInstance()->assign('parent_page', 'Analytics');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/playouthistory/configuretemplate.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headLink()->appendStylesheet($baseUrl.'css/history_styles.css?'.$CC_CONFIG['airtime_version']);
diff --git a/airtime_mvc/application/controllers/PluploadController.php b/airtime_mvc/application/controllers/PluploadController.php
index 89065a4b4..3b20f71e1 100644
--- a/airtime_mvc/application/controllers/PluploadController.php
+++ b/airtime_mvc/application/controllers/PluploadController.php
@@ -22,9 +22,11 @@ class PluploadController extends Zend_Controller_Action
$this->view->headScript()->appendFile($baseUrl.'js/plupload/jquery.plupload.queue.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/library/plupload.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/plupload/i18n/'.$locale.'.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'js/libs/dropzone.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headLink()->appendStylesheet($baseUrl.'css/plupload.queue.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'css/addmedia.css?'.$CC_CONFIG['airtime_version']);
+ $this->view->headLink()->appendStylesheet($baseUrl.'css/dashboard.css?'.$CC_CONFIG['airtime_version']);
$this->view->quotaLimitReached = false;
if (Application_Model_Systemstatus::isDiskOverQuota()) {
diff --git a/airtime_mvc/application/controllers/PreferenceController.php b/airtime_mvc/application/controllers/PreferenceController.php
index 39b7a8613..359050510 100644
--- a/airtime_mvc/application/controllers/PreferenceController.php
+++ b/airtime_mvc/application/controllers/PreferenceController.php
@@ -23,6 +23,8 @@ class PreferenceController extends Zend_Controller_Action
{
$CC_CONFIG = Config::getConfig();
$request = $this->getRequest();
+
+ Zend_Layout::getMvcInstance()->assign('parent_page', 'Settings');
$baseUrl = Application_Common_OsPath::getBaseDir();
@@ -143,15 +145,14 @@ class PreferenceController extends Zend_Controller_Action
$request = $this->getRequest();
+ Zend_Layout::getMvcInstance()->assign('parent_page', 'Settings');
+
$baseUrl = Application_Common_OsPath::getBaseDir();
$this->view->headScript()->appendFile($baseUrl.'js/airtime/preferences/streamsetting.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
session_start(); //Open session for writing.
- // get current settings
- $setting = Application_Model_StreamSetting::getStreamSetting();
-
$name_map = array(
'ogg' => 'Ogg Vorbis',
'fdkaac' => 'AAC+',
@@ -160,55 +161,14 @@ class PreferenceController extends Zend_Controller_Action
'mp3' => 'MP3',
);
- // get predefined type and bitrate from pref table
- $temp_types = Application_Model_Preference::GetStreamType();
- $stream_types = array();
- foreach ($temp_types as $type) {
- $type = strtolower(trim($type));
- if (isset($name_map[$type])) {
- $name = $name_map[$type];
- } else {
- $name = $type;
- }
- $stream_types[$type] = $name;
- }
-
- $temp_bitrate = Application_Model_Preference::GetStreamBitrate();
- $max_bitrate = intval(Application_Model_Preference::GetMaxBitrate());
- $stream_bitrates = array();
- foreach ($temp_bitrate as $type) {
- if (intval($type) <= $max_bitrate) {
- $stream_bitrates[trim($type)] = strtoupper(trim($type))." kbit/s";
- }
- }
-
$num_of_stream = intval(Application_Model_Preference::GetNumOfStreams());
$form = new Application_Form_StreamSetting();
- // $form->addElement('hash', 'csrf', array(
- // 'salt' => 'unique'
- // ));
-
$csrf_namespace = new Zend_Session_Namespace('csrf_namespace');
$csrf_element = new Zend_Form_Element_Hidden('csrf');
$csrf_element->setValue($csrf_namespace->authtoken)->setRequired('true')->removeDecorator('HtmlTag')->removeDecorator('Label');
$form->addElement($csrf_element);
- $form->setSetting($setting);
- $form->startFrom();
-
- $live_stream_subform = new Application_Form_LiveStreamingPreferences();
- $form->addSubForm($live_stream_subform, "live_stream_subform");
-
- for ($i=1; $i<=$num_of_stream; $i++) {
- $subform = new Application_Form_StreamSettingSubForm();
- $subform->setPrefix($i);
- $subform->setSetting($setting);
- $subform->setStreamTypes($stream_types);
- $subform->setStreamBitrates($stream_bitrates);
- $subform->startForm();
- $form->addSubForm($subform, "s".$i."_subform");
- }
if ($request->isPost()) {
$params = $request->getPost();
/* Parse through post data and put in format
@@ -246,7 +206,6 @@ class PreferenceController extends Zend_Controller_Action
$values["s3_data"] = $s3_data;
$values["s4_data"] = $s4_data;
- $error = false;
if ($form->isValid($values)) {
$values['icecast_vorbis_metadata'] = $form->getValue('icecast_vorbis_metadata');
@@ -263,13 +222,8 @@ class PreferenceController extends Zend_Controller_Action
$s4_set_admin_pass = !empty($values["s4_data"]["admin_pass"]);
// this goes into cc_pref table
- Application_Model_Preference::SetStreamLabelFormat($values['streamFormat']);
- Application_Model_Preference::SetLiveStreamMasterUsername($values["master_username"]);
- Application_Model_Preference::SetLiveStreamMasterPassword($values["master_password"]);
- Application_Model_Preference::SetDefaultTransitionFade($values["transition_fade"]);
- Application_Model_Preference::SetAutoTransition($values["auto_transition"]);
- Application_Model_Preference::SetAutoSwitch($values["auto_switch"]);
-
+ $this->setStreamPreferences($values);
+
// compare new values with current value
$changeRGenabled = Application_Model_Preference::GetEnableReplayGain() != $values["enableReplayGain"];
$changeRGmodifier = Application_Model_Preference::getReplayGainModifier() != $values["replayGainModifier"];
@@ -294,34 +248,86 @@ class PreferenceController extends Zend_Controller_Action
}
Application_Model_RabbitMq::SendMessageToPypo("update_stream_setting", $data);
-
- $live_stream_subform->updateVariables();
- $this->view->enable_stream_conf = Application_Model_Preference::GetEnableStreamConf();
- $this->view->form = $form;
- $this->view->num_stream = $num_of_stream;
$this->view->statusMsg = "
'._('Getting information from the server...').'