diff --git a/airtime_mvc/application/Bootstrap.php b/airtime_mvc/application/Bootstrap.php
index d3f404b45..465698b2e 100644
--- a/airtime_mvc/application/Bootstrap.php
+++ b/airtime_mvc/application/Bootstrap.php
@@ -18,7 +18,6 @@ require_once "Auth.php";
require_once __DIR__.'/forms/helpers/ValidationTypes.php';
require_once __DIR__.'/controllers/plugins/RabbitMqPlugin.php';
-
require_once (APPLICATION_PATH."/logging/Logging.php");
Logging::setLogPath('/var/log/airtime/zendphp.log');
@@ -51,8 +50,9 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
$view = $this->getResource('view');
$baseUrl = Application_Common_OsPath::getBaseDir();
- $view->headScript()->appendScript("var baseUrl = '$baseUrl'");
-
+ $view->headScript()->appendScript("var baseUrl = '$baseUrl';");
+ $this->_initTranslationGlobals($view);
+
$user = Application_Model_User::GetCurrentUser();
if (!is_null($user)){
$userType = $user->getType();
@@ -60,7 +60,17 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
$userType = "";
}
$view->headScript()->appendScript("var userType = '$userType';");
-
+ }
+
+ /**
+ * Ideally, globals should be written to a single js file once
+ * from a php init function. This will save us from having to
+ * reinitialize them every request
+ */
+ private function _initTranslationGlobals($view) {
+ $view->headScript()->appendScript("var PRODUCT_NAME = '" . PRODUCT_NAME . "';");
+ $view->headScript()->appendScript("var USER_MANUAL_URL = '" . USER_MANUAL_URL . "';");
+ $view->headScript()->appendScript("var COMPANY_NAME = '" . COMPANY_NAME . "';");
}
protected function _initHeadLink()
diff --git a/airtime_mvc/application/configs/constants.php b/airtime_mvc/application/configs/constants.php
index 34f8cab41..7b27bc891 100644
--- a/airtime_mvc/application/configs/constants.php
+++ b/airtime_mvc/application/configs/constants.php
@@ -1,5 +1,21 @@
view->layout()->disableLayout();
diff --git a/airtime_mvc/application/controllers/LoginController.php b/airtime_mvc/application/controllers/LoginController.php
index 5e9b70e31..c808c2aee 100644
--- a/airtime_mvc/application/controllers/LoginController.php
+++ b/airtime_mvc/application/controllers/LoginController.php
@@ -12,12 +12,12 @@ class LoginController extends Zend_Controller_Action
$CC_CONFIG = Config::getConfig();
$request = $this->getRequest();
+ $stationLocale = Application_Model_Preference::GetDefaultLocale();
- Application_Model_Locale::configureLocalization($request->getcookie('airtime_locale', 'en_CA'));
+ Application_Model_Locale::configureLocalization($request->getcookie('airtime_locale', $stationLocale));
$auth = Zend_Auth::getInstance();
- if ($auth->hasIdentity())
- {
+ if ($auth->hasIdentity()) {
$this->_redirect('Showbuilder');
}
@@ -110,7 +110,9 @@ class LoginController extends Zend_Controller_Action
$this->view->headScript()->appendFile($baseUrl.'js/airtime/login/password-restore.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$request = $this->getRequest();
- Application_Model_Locale::configureLocalization($request->getcookie('airtime_locale', 'en_CA'));
+ $stationLocale = Application_Model_Preference::GetDefaultLocale();
+
+ Application_Model_Locale::configureLocalization($request->getcookie('airtime_locale', $stationLocale));
if (!Application_Model_Preference::GetEnableSystemEmail()) {
$this->_redirect('login');
@@ -154,7 +156,9 @@ class LoginController extends Zend_Controller_Action
public function passwordRestoreAfterAction()
{
$request = $this->getRequest();
- Application_Model_Locale::configureLocalization($request->getcookie('airtime_locale', 'en_CA'));
+ $stationLocale = Application_Model_Preference::GetDefaultLocale();
+
+ Application_Model_Locale::configureLocalization($request->getcookie('airtime_locale', $stationLocale));
//uses separate layout without a navigation.
$this->_helper->layout->setLayout('login');
@@ -172,8 +176,10 @@ class LoginController extends Zend_Controller_Action
$form = new Application_Form_PasswordChange();
$auth = new Application_Model_Auth();
$user = CcSubjsQuery::create()->findPK($user_id);
+
+ $stationLocale = Application_Model_Preference::GetDefaultLocale();
- Application_Model_Locale::configureLocalization($request->getcookie('airtime_locale', 'en_CA'));
+ Application_Model_Locale::configureLocalization($request->getcookie('airtime_locale', $stationLocale));
//check validity of token
if (!$auth->checkToken($user_id, $token, 'password.restore')) {
diff --git a/airtime_mvc/application/controllers/PlaylistController.php b/airtime_mvc/application/controllers/PlaylistController.php
index 1826bde3b..4f511f4b5 100644
--- a/airtime_mvc/application/controllers/PlaylistController.php
+++ b/airtime_mvc/application/controllers/PlaylistController.php
@@ -38,7 +38,7 @@ class PlaylistController extends Zend_Controller_Action
$obj = null;
$objInfo = Application_Model_Library::getObjInfo($p_type);
- $obj_sess = new Zend_Session_Namespace( UI_PLAYLISTCONTROLLER_OBJ_SESSNAME);
+ $obj_sess = new Zend_Session_Namespace(UI_PLAYLISTCONTROLLER_OBJ_SESSNAME);
if (isset($obj_sess->id)) {
$obj = new $objInfo['className']($obj_sess->id);
@@ -422,29 +422,29 @@ class PlaylistController extends Zend_Controller_Action
public function setCrossfadeAction()
{
- $id1 = $this->_getParam('id1', null);
- $id2 = $this->_getParam('id2', null);
- $type = $this->_getParam('type');
- $fadeIn = $this->_getParam('fadeIn', 0);
- $fadeOut = $this->_getParam('fadeOut', 0);
- $offset = $this->_getParam('offset', 0);
+ $id1 = $this->_getParam('id1', null);
+ $id2 = $this->_getParam('id2', null);
+ $type = $this->_getParam('type');
+ $fadeIn = $this->_getParam('fadeIn', 0);
+ $fadeOut = $this->_getParam('fadeOut', 0);
+ $offset = $this->_getParam('offset', 0);
- try {
- $obj = $this->getPlaylist($type);
- $response = $obj->createCrossfade($id1, $fadeOut, $id2, $fadeIn, $offset);
+ try {
+ $obj = $this->getPlaylist($type);
+ $response = $obj->createCrossfade($id1, $fadeOut, $id2, $fadeIn, $offset);
- if (!isset($response["error"])) {
- $this->createUpdateResponse($obj);
- } else {
- $this->view->error = $response["error"];
- }
- } catch (PlaylistOutDatedException $e) {
- $this->playlistOutdated($e);
- } catch (PlaylistNotFoundException $e) {
- $this->playlistNotFound($type);
- } catch (Exception $e) {
- $this->playlistUnknownError($e);
- }
+ if (!isset($response["error"])) {
+ $this->createUpdateResponse($obj);
+ } else {
+ $this->view->error = $response["error"];
+ }
+ } catch (PlaylistOutDatedException $e) {
+ $this->playlistOutdated($e);
+ } catch (PlaylistNotFoundException $e) {
+ $this->playlistNotFound($type);
+ } catch (Exception $e) {
+ $this->playlistUnknownError($e);
+ }
}
public function getPlaylistFadesAction()
diff --git a/airtime_mvc/application/controllers/UserController.php b/airtime_mvc/application/controllers/UserController.php
index fad0277db..c75e2b49e 100644
--- a/airtime_mvc/application/controllers/UserController.php
+++ b/airtime_mvc/application/controllers/UserController.php
@@ -69,12 +69,6 @@ class UserController extends Zend_Controller_Action
$user->setJabber($formData['jabber']);
$user->save();
- // Language and timezone settings are saved on a per-user basis
- // By default, the default language, and timezone setting on
- // preferences page is what gets assigned.
- Application_Model_Preference::SetUserLocale();
- Application_Model_Preference::SetUserTimezone();
-
$form->reset();
$this->view->form = $form;
@@ -83,7 +77,7 @@ class UserController extends Zend_Controller_Action
} else {
$this->view->successMessage = "
"._("User updated successfully!")."
";
}
-
+
$this->_helper->json->sendJson(array("valid"=>"true", "html"=>$this->view->render('user/add-user.phtml')));
} else {
$this->view->form = $form;
diff --git a/airtime_mvc/application/forms/AddShowLiveStream.php b/airtime_mvc/application/forms/AddShowLiveStream.php
index 65e2a19d3..923c6993d 100644
--- a/airtime_mvc/application/forms/AddShowLiveStream.php
+++ b/airtime_mvc/application/forms/AddShowLiveStream.php
@@ -7,7 +7,7 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm
public function init()
{
$cb_airtime_auth = new Zend_Form_Element_Checkbox("cb_airtime_auth");
- $cb_airtime_auth->setLabel(_("Use Airtime Authentication:"))
+ $cb_airtime_auth->setLabel(sprintf(_("Use %s Authentication:"), PRODUCT_NAME))
->setRequired(false)
->setDecorators(array('ViewHelper'));
$this->addElement($cb_airtime_auth);
diff --git a/airtime_mvc/application/forms/Login.php b/airtime_mvc/application/forms/Login.php
index 40f4da83f..b8d3989c2 100644
--- a/airtime_mvc/application/forms/Login.php
+++ b/airtime_mvc/application/forms/Login.php
@@ -53,13 +53,11 @@ class Application_Form_Login extends Zend_Form
$locale->setMultiOptions(Application_Model_Locale::getLocales());
$locale->setDecorators(array('ViewHelper'));
$this->addElement($locale);
+ $this->setDefaults(array(
+ "locale" => Application_Model_Locale::getUserLocale()
+ ));
- $recaptchaNeeded = false;
if (Application_Model_LoginAttempts::getAttempts($_SERVER['REMOTE_ADDR']) >= 3) {
- $recaptchaNeeded = true;
- }
- if ($recaptchaNeeded) {
- // recaptcha
$this->addRecaptcha();
}
diff --git a/airtime_mvc/application/forms/RegisterAirtime.php b/airtime_mvc/application/forms/RegisterAirtime.php
index 2da7083c8..1fcafc840 100644
--- a/airtime_mvc/application/forms/RegisterAirtime.php
+++ b/airtime_mvc/application/forms/RegisterAirtime.php
@@ -123,7 +123,7 @@ class Application_Form_RegisterAirtime extends Zend_Form
// checkbox for publicise
$checkboxPublicise = new Zend_Form_Element_Checkbox("Publicise");
- $checkboxPublicise->setLabel(_('Promote my station on Sourcefabric.org'))
+ $checkboxPublicise->setLabel(sprintf(_('Promote my station on %s'), COMPANY_SITE))
->setRequired(false)
->setDecorators(array('ViewHelper'))
->setValue(Application_Model_Preference::GetPublicise());
@@ -143,11 +143,14 @@ class Application_Form_RegisterAirtime extends Zend_Form
)
));
+ $privacyPolicyAnchorOpen = "";
// checkbox for privacy policy
$checkboxPrivacy = new Zend_Form_Element_Checkbox("Privacy");
$checkboxPrivacy->setLabel(
- sprintf(_("By checking this box, I agree to Sourcefabric's %sprivacy policy%s."),
- "",
+ sprintf(_('By checking this box, I agree to %s\'s %sprivacy policy%s.'),
+ COMPANY_NAME,
+ $privacyPolicyAnchorOpen,
""))
->setDecorators(array('ViewHelper'));
$this->addElement($checkboxPrivacy);
diff --git a/airtime_mvc/application/forms/SupportSettings.php b/airtime_mvc/application/forms/SupportSettings.php
index 7ce63bcf0..87e5588de 100644
--- a/airtime_mvc/application/forms/SupportSettings.php
+++ b/airtime_mvc/application/forms/SupportSettings.php
@@ -119,7 +119,7 @@ class Application_Form_SupportSettings extends Zend_Form
// checkbox for publicise
$checkboxPublicise = new Zend_Form_Element_Checkbox("Publicise");
- $checkboxPublicise->setLabel(_('Promote my station on Sourcefabric.org'))
+ $checkboxPublicise->setLabel(sprintf(_('Promote my station on %s'), COMPANY_SITE))
->setRequired(false)
->setDecorators(array('ViewHelper'))
->setValue(Application_Model_Preference::GetPublicise());
@@ -142,11 +142,14 @@ class Application_Form_SupportSettings extends Zend_Form
)
));
+ $privacyPolicyAnchorOpen = "";
// checkbox for privacy policy
$checkboxPrivacy = new Zend_Form_Element_Checkbox("Privacy");
$checkboxPrivacy->setLabel(
- sprintf(_("By checking this box, I agree to Sourcefabric's %sprivacy policy%s."),
- "",
+ sprintf(_('By checking this box, I agree to %s\'s %sprivacy policy%s.'),
+ COMPANY_NAME,
+ $privacyPolicyAnchorOpen,
""))
->setDecorators(array('ViewHelper'));
$this->addElement($checkboxPrivacy);
diff --git a/airtime_mvc/application/layouts/scripts/login.phtml b/airtime_mvc/application/layouts/scripts/login.phtml
index aa4030390..6a9879673 100644
--- a/airtime_mvc/application/layouts/scripts/login.phtml
+++ b/airtime_mvc/application/layouts/scripts/login.phtml
@@ -1,11 +1,11 @@
doctype() ?>
-
- headTitle() ?>
- headLink() ?>
- headScript() ?>
- google_analytics)?$this->google_analytics:"" ?>
+
+ headTitle() ?>
+ headLink() ?>
+ headScript() ?>
+ google_analytics)?$this->google_analytics:"" ?>
@@ -13,9 +13,20 @@
layout()->content ?>
diff --git a/airtime_mvc/application/models/Auth.php b/airtime_mvc/application/models/Auth.php
index fd39e0407..34e36bbe4 100644
--- a/airtime_mvc/application/models/Auth.php
+++ b/airtime_mvc/application/models/Auth.php
@@ -33,7 +33,8 @@ class Application_Model_Auth
$message = sprintf(_("Hi %s, \n\nClick this link to reset your password: "), $user->getDbLogin());
$message .= "{$e_link_protocol}://{$e_link_base}:{$e_link_port}{$e_link_path}";
- $success = Application_Model_Email::send(_('Airtime Password Reset'), $message, $user->getDbEmail());
+ $str = sprintf(_('%s Password Reset'), PRODUCT_NAME);
+ $success = Application_Model_Email::send($str, $message, $user->getDbEmail());
return $success;
}
diff --git a/airtime_mvc/application/models/Locale.php b/airtime_mvc/application/models/Locale.php
index 726302a82..e5ada5995 100644
--- a/airtime_mvc/application/models/Locale.php
+++ b/airtime_mvc/application/models/Locale.php
@@ -47,5 +47,22 @@ class Application_Model_Locale
textdomain($domain);
bind_textdomain_codeset($domain, $codeset);
}
+
+ /**
+ * We need this function for the case where a user has logged out, but
+ * has an airtime_locale cookie containing their locale setting.
+ *
+ * If the user does not have an airtime_locale cookie set, we default
+ * to the station locale.
+ *
+ * When the user logs in, the value set in the login form will be passed
+ * into the airtime_locale cookie. This cookie is also updated when
+ * a user updates their user settings.
+ */
+ public static function getUserLocale() {
+ $request = Zend_Controller_Front::getInstance()->getRequest();
+ $locale = $request->getCookie('airtime_locale', Application_Model_Preference::GetLocale());
+ return $locale;
+ }
}
diff --git a/airtime_mvc/application/models/Preference.php b/airtime_mvc/application/models/Preference.php
index e73069f43..848792318 100644
--- a/airtime_mvc/application/models/Preference.php
+++ b/airtime_mvc/application/models/Preference.php
@@ -4,45 +4,44 @@ require_once 'Cache.php';
class Application_Model_Preference
{
-
- private static function getUserId()
- {
- //pass in true so the check is made with the autoloader
- //we need this check because saas calls this function from outside Zend
- if (!class_exists("Zend_Auth", true) || !Zend_Auth::getInstance()->hasIdentity()) {
- $userId = null;
- }
- else {
- $auth = Zend_Auth::getInstance();
- $userId = $auth->getIdentity()->id;
- }
-
- return $userId;
- }
-
+
+ private static function getUserId()
+ {
+ //pass in true so the check is made with the autoloader
+ //we need this check because saas calls this function from outside Zend
+ if (!class_exists("Zend_Auth", true) || !Zend_Auth::getInstance()->hasIdentity()) {
+ $userId = null;
+ } else {
+ $auth = Zend_Auth::getInstance();
+ $userId = $auth->getIdentity()->id;
+ }
+
+ return $userId;
+ }
+
/**
*
* @param boolean $isUserValue is true when we are setting a value for the current user
*/
private static function setValue($key, $value, $isUserValue = false)
{
- $cache = new Cache();
-
+ $cache = new Cache();
+
try {
+
$con = Propel::getConnection(CcPrefPeer::DATABASE_NAME);
$con->beginTransaction();
$userId = self::getUserId();
- if ($isUserValue && is_null($userId)) {
- throw new Exception("User id can't be null for a user preference {$key}.");
- }
+ if ($isUserValue && is_null($userId))
+ throw new Exception("User id can't be null for a user preference {$key}.");
Application_Common_Database::prepareAndExecute("LOCK TABLE cc_pref");
//Check if key already exists
$sql = "SELECT COUNT(*) FROM cc_pref"
- ." WHERE keystr = :key";
+ ." WHERE keystr = :key";
$paramMap = array();
$paramMap[':key'] = $key;
@@ -64,37 +63,33 @@ class Application_Model_Preference
//this case should not happen.
throw new Exception("Invalid number of results returned. Should be ".
"0 or 1, but is '$result' instead");
- }
- elseif ($result == 1) {
-
+ } else if ($result == 1) {
+
// result found
if (!$isUserValue) {
// system pref
$sql = "UPDATE cc_pref"
- ." SET subjid = NULL, valstr = :value"
- ." WHERE keystr = :key";
- }
- else {
+ ." SET subjid = NULL, valstr = :value"
+ ." WHERE keystr = :key";
+ } else {
// user pref
$sql = "UPDATE cc_pref"
- . " SET valstr = :value"
- . " WHERE keystr = :key AND subjid = :id";
+ . " SET valstr = :value"
+ . " WHERE keystr = :key AND subjid = :id";
$paramMap[':id'] = $userId;
}
- }
- else {
-
+ } else {
+
// result not found
if (!$isUserValue) {
// system pref
$sql = "INSERT INTO cc_pref (keystr, valstr)"
- ." VALUES (:key, :value)";
- }
- else {
+ ." VALUES (:key, :value)";
+ } else {
// user pref
$sql = "INSERT INTO cc_pref (subjid, keystr, valstr)"
- ." VALUES (:id, :key, :value)";
+ ." VALUES (:id, :key, :value)";
$paramMap[':id'] = $userId;
}
@@ -109,8 +104,7 @@ class Application_Model_Preference
$con);
$con->commit();
- }
- catch (Exception $e) {
+ } catch (Exception $e) {
$con->rollback();
header('HTTP/1.0 503 Service Unavailable');
Logging::info("Database error: ".$e->getMessage());
@@ -118,26 +112,22 @@ class Application_Model_Preference
}
$cache->store($key, $value, $isUserValue, $userId);
- //Logging::info("SAVING {$key} {$userId} into cache. = {$value}");
}
private static function getValue($key, $isUserValue = false)
{
- $cache = new Cache();
-
+ $cache = new Cache();
+
try {
-
- $userId = self::getUserId();
-
- if ($isUserValue && is_null($userId)) {
- throw new Exception("User id can't be null for a user preference.");
- }
+
+ $userId = self::getUserId();
+
+ if ($isUserValue && is_null($userId))
+ throw new Exception("User id can't be null for a user preference.");
- $res = $cache->fetch($key, $isUserValue, $userId);
- if ($res !== false) {
- //Logging::info("returning {$key} {$userId} from cache. = {$res}");
- return $res;
- }
+ // If the value is already cached, return it
+ $res = $cache->fetch($key, $isUserValue, $userId);
+ if ($res !== false) return $res;
//Check if key already exists
$sql = "SELECT COUNT(*) FROM cc_pref"
@@ -147,7 +137,7 @@ class Application_Model_Preference
$paramMap[':key'] = $key;
//For user specific preference, check if id matches as well
- if ($isUserValue) {
+ if ($isUserValue) {
$sql .= " AND subjid = :id";
$paramMap[':id'] = $userId;
}
@@ -157,8 +147,7 @@ class Application_Model_Preference
//return an empty string if the result doesn't exist.
if ($result == 0) {
$res = "";
- }
- else {
+ } else {
$sql = "SELECT valstr FROM cc_pref"
." WHERE keystr = :key";
@@ -248,53 +237,53 @@ class Application_Model_Preference
public static function SetDefaultCrossfadeDuration($duration)
{
- self::setValue("default_crossfade_duration", $duration);
+ self::setValue("default_crossfade_duration", $duration);
}
public static function GetDefaultCrossfadeDuration()
{
- $duration = self::getValue("default_crossfade_duration");
+ $duration = self::getValue("default_crossfade_duration");
- if ($duration === "") {
- // the default value of the fade is 00.5
- return "0";
- }
+ if ($duration === "") {
+ // the default value of the fade is 00.5
+ return "0";
+ }
- return $duration;
+ return $duration;
}
public static function SetDefaultFadeIn($fade)
{
- self::setValue("default_fade_in", $fade);
+ self::setValue("default_fade_in", $fade);
}
public static function GetDefaultFadeIn()
{
- $fade = self::getValue("default_fade_in");
+ $fade = self::getValue("default_fade_in");
- if ($fade === "") {
- // the default value of the fade is 00.5
- return "00.5";
- }
+ if ($fade === "") {
+ // the default value of the fade is 00.5
+ return "00.5";
+ }
- return $fade;
+ return $fade;
}
public static function SetDefaultFadeOut($fade)
{
- self::setValue("default_fade_out", $fade);
+ self::setValue("default_fade_out", $fade);
}
public static function GetDefaultFadeOut()
{
- $fade = self::getValue("default_fade_out");
+ $fade = self::getValue("default_fade_out");
- if ($fade === "") {
- // the default value of the fade is 00.5
- return "00.5";
- }
+ if ($fade === "") {
+ // the default value of the fade is 00.5
+ return "00.5";
+ }
- return $fade;
+ return $fade;
}
public static function SetDefaultFade($fade)
@@ -556,9 +545,8 @@ class Application_Model_Preference
{
// When a new user is created they will get the default timezone
// setting which the admin sets on preferences page
- if (is_null($timezone)) {
+ if (is_null($timezone))
$timezone = self::GetDefaultTimezone();
- }
self::setValue("user_timezone", $timezone, true);
}
@@ -567,8 +555,7 @@ class Application_Model_Preference
$timezone = self::getValue("user_timezone", true);
if (!$timezone) {
return self::GetDefaultTimezone();
- }
- else {
+ } else {
return $timezone;
}
}
@@ -580,8 +567,7 @@ class Application_Model_Preference
if (!is_null($userId)) {
return self::GetUserTimezone();
- }
- else {
+ } else {
return self::GetDefaultTimezone();
}
}
@@ -612,9 +598,8 @@ class Application_Model_Preference
{
// When a new user is created they will get the default locale
// setting which the admin sets on preferences page
- if (is_null($locale)) {
+ if (is_null($locale))
$locale = self::GetDefaultLocale();
- }
self::setValue("user_locale", $locale, true);
}
@@ -624,8 +609,7 @@ class Application_Model_Preference
if (!is_null($userId)) {
return self::GetUserLocale();
- }
- else {
+ } else {
return self::GetDefaultLocale();
}
}
@@ -648,7 +632,7 @@ class Application_Model_Preference
public static function SetUniqueId($id)
{
- self::setValue("uniqueId", $id);
+ self::setValue("uniqueId", $id);
}
public static function GetUniqueId()
@@ -908,7 +892,7 @@ class Application_Model_Preference
public static function SetAirtimeVersion($version)
{
- self::setValue("system_version", $version);
+ self::setValue("system_version", $version);
}
public static function GetAirtimeVersion()
@@ -1404,12 +1388,11 @@ class Application_Model_Preference
return self::getValue("enable_replay_gain", false);
}
- public static function getReplayGainModifier(){
+ public static function getReplayGainModifier() {
$rg_modifier = self::getValue("replay_gain_modifier");
- if ($rg_modifier === "") {
+ if ($rg_modifier === "")
return "0";
- }
return $rg_modifier;
}
@@ -1420,18 +1403,18 @@ class Application_Model_Preference
}
public static function SetHistoryItemTemplate($value) {
- self::setValue("history_item_template", $value);
+ self::setValue("history_item_template", $value);
}
public static function GetHistoryItemTemplate() {
- return self::getValue("history_item_template");
+ return self::getValue("history_item_template");
}
public static function SetHistoryFileTemplate($value) {
- self::setValue("history_file_template", $value);
+ self::setValue("history_file_template", $value);
}
public static function GetHistoryFileTemplate() {
- return self::getValue("history_file_template");
+ return self::getValue("history_file_template");
}
}
diff --git a/airtime_mvc/application/services/ShowFormService.php b/airtime_mvc/application/services/ShowFormService.php
index 882d22c44..94cc0068a 100644
--- a/airtime_mvc/application/services/ShowFormService.php
+++ b/airtime_mvc/application/services/ShowFormService.php
@@ -362,33 +362,22 @@ class Application_Service_ShowFormService
}
/**
- *
* Before we send the form data in for validation, there
* are a few fields we may need to adjust first
+ *
* @param $formData
*/
public function preEditShowValidationCheck($formData)
{
- $validateStartDate = true;
- $validateStartTime = true;
+ // If the start date or time were disabled, don't validate them
+ $validateStartDate = $formData['start_date_disabled'] === "false";
+ $validateStartTime = $formData['start_time_disabled'] === "false";
//CcShowDays object of the show currently being edited
$currentShowDay = $this->ccShow->getFirstCcShowDay();
//DateTime object
$dt = $currentShowDay->getLocalStartDateAndTime();
-
- if (!array_key_exists('add_show_start_date', $formData)) {
- //Changing the start date was disabled, since the
- //array key does not exist. We need to repopulate this entry from the db.
- $formData['add_show_start_date'] = $dt->format("Y-m-d");
-
- if (!array_key_exists('add_show_start_time', $formData)) {
- $formData['add_show_start_time'] = $dt->format("H:i");
- $validateStartTime = false;
- }
- $validateStartDate = false;
- }
$formData['add_show_record'] = $currentShowDay->getDbRecord();
//if the show is repeating, set the start date to the next
@@ -412,11 +401,9 @@ class Application_Service_ShowFormService
$ccShowInstance = CcShowInstancesQuery::create()
->filterByDbShowId($this->ccShow->getDbId())
->filterByDbModifiedInstance(false)
- ->filterByDbEnds(gmdate("Y-m-d H:i:s"), Criteria::GREATER_THAN)
- ->orderByDbStarts()
- ->limit(1)
+ ->filterByDbStarts(gmdate("Y-m-d H:i:s"), Criteria::GREATER_THAN)
->findOne();
-
+
$starts = new DateTime($ccShowInstance->getDbStarts(), new DateTimeZone("UTC"));
$ends = new DateTime($ccShowInstance->getDbEnds(), new DateTimeZone("UTC"));
$showTimezone = $this->ccShow->getFirstCcShowDay()->getDbTimezone();
@@ -427,6 +414,7 @@ class Application_Service_ShowFormService
return array($starts, $ends);
}
+
/**
*
* Validates show forms
diff --git a/airtime_mvc/application/views/scripts/dashboard/about.phtml b/airtime_mvc/application/views/scripts/dashboard/about.phtml
index f2ccfa02d..98e93e724 100644
--- a/airtime_mvc/application/views/scripts/dashboard/about.phtml
+++ b/airtime_mvc/application/views/scripts/dashboard/about.phtml
@@ -2,19 +2,25 @@
jPlayer events that have occurred over the past 1 second:'
+ + ' (Backgrounds: Never occurredOccurred beforeOccurredMultiple occurrencesreset)
';
+
+ // MJP: Would use the next 3 lines for ease, but the events are just slapped on the page.
+ // $.each($.jPlayer.event, function(eventName,eventType) {
+ // structure += '
' + eventName + '
';
+ // });
+
+ var eventStyle = "float:left;margin:0 5px 5px 0;padding:0 5px;border:1px dotted #000;";
+ // MJP: Doing it longhand so order and layout easier to control.
+ structure +=
+ ''
+ + ''
+ + ''
+ + ''
+ + ''
+ + ''
+ + ''
+
+ + ''
+ + ''
+ + ''
+ + ''
+ + ''
+
+ + ''
+ + ''
+ + ''
+ + ''
+ + ''
+ + ''
+ + ''
+
+ + ''
+ + ''
+ + ''
+ + ''
+
+ + ''
+ + ''
+ + ''
+ + ''
+ + ''
+ + ''
+
+ + '';
+
+ // MJP: Would like a check here in case we missed an event.
+
+ // MJP: Check fails, since it is not on the page yet.
+/* $.each($.jPlayer.event, function(eventName,eventType) {
+ if($("#" + config.eventId[eventType])[0] === undefined) {
+ structure += '
";
+ $(this).data("jPlayerInspector").configJq.html(jPlayerInfo);
+ return this;
+ },
+ updateStatus: function() { // This displays information about jPlayer's status in the inspector
+ $(this).data("jPlayerInspector").statusJq.html(
+ "
"
+ );
+ return this;
+ }
+ };
+ $.fn.jPlayerInspector = function( method ) {
+ // Method calling logic
+ if ( methods[method] ) {
+ return methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ));
+ } else if ( typeof method === 'object' || ! method ) {
+ return methods.init.apply( this, arguments );
+ } else {
+ $.error( 'Method ' + method + ' does not exist on jQuery.jPlayerInspector' );
+ }
+ };
+})(jQuery);
diff --git a/airtime_mvc/public/js/jplayer/jquery.jplayer.min.js b/airtime_mvc/public/js/jplayer/jquery.jplayer.min.js
index 796e970e2..f7acb7704 100644
--- a/airtime_mvc/public/js/jplayer/jquery.jplayer.min.js
+++ b/airtime_mvc/public/js/jplayer/jquery.jplayer.min.js
@@ -2,113 +2,119 @@
* jPlayer Plugin for jQuery JavaScript Library
* http://www.jplayer.org
*
- * Copyright (c) 2009 - 2013 Happyworm Ltd
+ * Copyright (c) 2009 - 2014 Happyworm Ltd
* Licensed under the MIT license.
* http://opensource.org/licenses/MIT
*
* Author: Mark J Panaghiston
- * Version: 2.5.0
- * Date: 7th November 2013
+ * Version: 2.7.0
+ * Date: 1st September 2014
*/
(function(b,f){"function"===typeof define&&define.amd?define(["jquery"],f):b.jQuery?f(b.jQuery):f(b.Zepto)})(this,function(b,f){b.fn.jPlayer=function(a){var c="string"===typeof a,d=Array.prototype.slice.call(arguments,1),e=this;a=!c&&d.length?b.extend.apply(null,[!0,a].concat(d)):a;if(c&&"_"===a.charAt(0))return e;c?this.each(function(){var c=b(this).data("jPlayer"),h=c&&b.isFunction(c[a])?c[a].apply(c,d):c;if(h!==c&&h!==f)return e=h,!1}):this.each(function(){var c=b(this).data("jPlayer");c?c.option(a||
{}):b(this).data("jPlayer",new b.jPlayer(a,this))});return e};b.jPlayer=function(a,c){if(arguments.length){this.element=b(c);this.options=b.extend(!0,{},this.options,a);var d=this;this.element.bind("remove.jPlayer",function(){d.destroy()});this._init()}};"function"!==typeof b.fn.stop&&(b.fn.stop=function(){});b.jPlayer.emulateMethods="load play pause";b.jPlayer.emulateStatus="src readyState networkState currentTime duration paused ended playbackRate";b.jPlayer.emulateOptions="muted volume";b.jPlayer.reservedEvent=
-"ready flashreset resize repeat error warning";b.jPlayer.event={};b.each("ready flashreset resize repeat click error warning loadstart progress suspend abort emptied stalled play pause loadedmetadata loadeddata waiting playing canplay canplaythrough seeking seeked timeupdate ended ratechange durationchange volumechange".split(" "),function(){b.jPlayer.event[this]="jPlayer_"+this});b.jPlayer.htmlEvent="loadstart abort emptied stalled loadedmetadata loadeddata canplay canplaythrough".split(" ");b.jPlayer.pause=
-function(){b.each(b.jPlayer.prototype.instances,function(a,c){c.data("jPlayer").status.srcSet&&c.jPlayer("pause")})};b.jPlayer.timeFormat={showHour:!1,showMin:!0,showSec:!0,padHour:!1,padMin:!0,padSec:!0,sepHour:":",sepMin:":",sepSec:""};var m=function(){this.init()};m.prototype={init:function(){this.options={timeFormat:b.jPlayer.timeFormat}},time:function(a){var c=new Date(1E3*(a&&"number"===typeof a?a:0)),b=c.getUTCHours();a=this.options.timeFormat.showHour?c.getUTCMinutes():c.getUTCMinutes()+60*
-b;c=this.options.timeFormat.showMin?c.getUTCSeconds():c.getUTCSeconds()+60*a;b=this.options.timeFormat.padHour&&10>b?"0"+b:b;a=this.options.timeFormat.padMin&&10>a?"0"+a:a;c=this.options.timeFormat.padSec&&10>c?"0"+c:c;b=""+(this.options.timeFormat.showHour?b+this.options.timeFormat.sepHour:"");b+=this.options.timeFormat.showMin?a+this.options.timeFormat.sepMin:"";return b+=this.options.timeFormat.showSec?c+this.options.timeFormat.sepSec:""}};var n=new m;b.jPlayer.convertTime=function(a){return n.time(a)};
+"ready flashreset resize repeat error warning";b.jPlayer.event={};b.each("ready setmedia flashreset resize repeat click error warning loadstart progress suspend abort emptied stalled play pause loadedmetadata loadeddata waiting playing canplay canplaythrough seeking seeked timeupdate ended ratechange durationchange volumechange".split(" "),function(){b.jPlayer.event[this]="jPlayer_"+this});b.jPlayer.htmlEvent="loadstart abort emptied stalled loadedmetadata loadeddata canplay canplaythrough".split(" ");
+b.jPlayer.pause=function(){b.each(b.jPlayer.prototype.instances,function(a,c){c.data("jPlayer").status.srcSet&&c.jPlayer("pause")})};b.jPlayer.timeFormat={showHour:!1,showMin:!0,showSec:!0,padHour:!1,padMin:!0,padSec:!0,sepHour:":",sepMin:":",sepSec:""};var l=function(){this.init()};l.prototype={init:function(){this.options={timeFormat:b.jPlayer.timeFormat}},time:function(a){var c=new Date(1E3*(a&&"number"===typeof a?a:0)),b=c.getUTCHours();a=this.options.timeFormat.showHour?c.getUTCMinutes():c.getUTCMinutes()+
+60*b;c=this.options.timeFormat.showMin?c.getUTCSeconds():c.getUTCSeconds()+60*a;b=this.options.timeFormat.padHour&&10>b?"0"+b:b;a=this.options.timeFormat.padMin&&10>a?"0"+a:a;c=this.options.timeFormat.padSec&&10>c?"0"+c:c;b=""+(this.options.timeFormat.showHour?b+this.options.timeFormat.sepHour:"");b+=this.options.timeFormat.showMin?a+this.options.timeFormat.sepMin:"";return b+=this.options.timeFormat.showSec?c+this.options.timeFormat.sepSec:""}};var n=new l;b.jPlayer.convertTime=function(a){return n.time(a)};
b.jPlayer.uaBrowser=function(a){a=a.toLowerCase();var c=/(opera)(?:.*version)?[ \/]([\w.]+)/,b=/(msie) ([\w.]+)/,e=/(mozilla)(?:.*? rv:([\w.]+))?/;a=/(webkit)[ \/]([\w.]+)/.exec(a)||c.exec(a)||b.exec(a)||0>a.indexOf("compatible")&&e.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}};b.jPlayer.uaPlatform=function(a){var c=a.toLowerCase(),b=/(android)/,e=/(mobile)/;a=/(ipad|iphone|ipod|android|blackberry|playbook|windows ce|webos)/.exec(c)||[];c=/(ipad|playbook)/.exec(c)||!e.exec(c)&&b.exec(c)||
[];a[1]&&(a[1]=a[1].replace(/\s/g,"_"));return{platform:a[1]||"",tablet:c[1]||""}};b.jPlayer.browser={};b.jPlayer.platform={};var k=b.jPlayer.uaBrowser(navigator.userAgent);k.browser&&(b.jPlayer.browser[k.browser]=!0,b.jPlayer.browser.version=k.version);k=b.jPlayer.uaPlatform(navigator.userAgent);k.platform&&(b.jPlayer.platform[k.platform]=!0,b.jPlayer.platform.mobile=!k.tablet,b.jPlayer.platform.tablet=!!k.tablet);b.jPlayer.getDocMode=function(){var a;b.jPlayer.browser.msie&&(document.documentMode?
a=document.documentMode:(a=5,document.compatMode&&"CSS1Compat"===document.compatMode&&(a=7)));return a};b.jPlayer.browser.documentMode=b.jPlayer.getDocMode();b.jPlayer.nativeFeatures={init:function(){var a=document,c=a.createElement("video"),b={w3c:"fullscreenEnabled fullscreenElement requestFullscreen exitFullscreen fullscreenchange fullscreenerror".split(" "),moz:"mozFullScreenEnabled mozFullScreenElement mozRequestFullScreen mozCancelFullScreen mozfullscreenchange mozfullscreenerror".split(" "),
webkit:" webkitCurrentFullScreenElement webkitRequestFullScreen webkitCancelFullScreen webkitfullscreenchange ".split(" "),webkitVideo:"webkitSupportsFullscreen webkitDisplayingFullscreen webkitEnterFullscreen webkitExitFullscreen ".split(" ")},e=["w3c","moz","webkit","webkitVideo"],g,h;this.fullscreen=c={support:{w3c:!!a[b.w3c[0]],moz:!!a[b.moz[0]],webkit:"function"===typeof a[b.webkit[3]],webkitVideo:"function"===typeof c[b.webkitVideo[2]]},used:{}};g=0;for(h=e.length;gNumber(b.jPlayer.browser.version)||9>b.jPlayer.browser.documentMode)){d=['','','','',''];c=document.createElement('');
-for(var e=0;eNumber(b.jPlayer.browser.version)||9>b.jPlayer.browser.documentMode)){d=['','','','',''];c=document.createElement('');for(var e=0;e").join(">").split('"').join(""")},_qualifyURL:function(a){var c=document.createElement("div");c.innerHTML='x';return c.firstChild.href},_absoluteMediaUrls:function(a){var c=this;b.each(a,function(b,e){c.format[b]&&
-(a[b]=c._qualifyURL(e))});return a},setMedia:function(a){var c=this,d=!1,e=this.status.media.poster!==a.poster;this._resetMedia();this._resetGate();this._resetActive();a=this._absoluteMediaUrls(a);b.each(this.formats,function(e,f){var k="video"===c.format[f].media;b.each(c.solutions,function(b,e){if(c[e].support[f]&&c._validString(a[f])){var g="html"===e;k?(g?(c.html.video.gate=!0,c._html_setVideo(a),c.html.active=!0):(c.flash.gate=!0,c._flash_setVideo(a),c.flash.active=!0),c.css.jq.videoPlay.length&&
-c.css.jq.videoPlay.show(),c.status.video=!0):(g?(c.html.audio.gate=!0,c._html_setAudio(a),c.html.active=!0):(c.flash.gate=!0,c._flash_setAudio(a),c.flash.active=!0),c.css.jq.videoPlay.length&&c.css.jq.videoPlay.hide(),c.status.video=!1);d=!0;return!1}});if(d)return!1});d?(this.status.nativeVideoControls&&this.html.video.gate||!this._validString(a.poster)||(e?this.htmlElement.poster.src=a.poster:this.internal.poster.jq.show()),this.status.srcSet=!0,this.status.media=b.extend({},a),this._updateButtons(!1),
-this._updateInterface()):this._error({type:b.jPlayer.error.NO_SUPPORT,context:"{supplied:'"+this.options.supplied+"'}",message:b.jPlayer.errorMsg.NO_SUPPORT,hint:b.jPlayer.errorHint.NO_SUPPORT})},_resetMedia:function(){this._resetStatus();this._updateButtons(!1);this._updateInterface();this._seeked();this.internal.poster.jq.hide();clearTimeout(this.internal.htmlDlyCmdId);this.html.active?this._html_resetMedia():this.flash.active&&this._flash_resetMedia()},clearMedia:function(){this._resetMedia();
-this.html.active?this._html_clearMedia():this.flash.active&&this._flash_clearMedia();this._resetGate();this._resetActive()},load:function(){this.status.srcSet?this.html.active?this._html_load():this.flash.active&&this._flash_load():this._urlNotSetError("load")},focus:function(){this.options.keyEnabled&&(b.jPlayer.focus=this)},play:function(a){a="number"===typeof a?a:NaN;this.status.srcSet?(this.focus(),this.html.active?this._html_play(a):this.flash.active&&this._flash_play(a)):this._urlNotSetError("play")},
-videoPlay:function(){this.play()},pause:function(a){a="number"===typeof a?a:NaN;this.status.srcSet?this.html.active?this._html_pause(a):this.flash.active&&this._flash_pause(a):this._urlNotSetError("pause")},tellOthers:function(a,c){var d=this,e="function"===typeof c,g=Array.prototype.slice.call(arguments);"string"===typeof a&&(e&&g.splice(1,1),b.each(this.instances,function(){d.element!==this&&(e&&!c.call(this.data("jPlayer"),d)||this.jPlayer.apply(this,g))}))},pauseOthers:function(a){this.tellOthers("pause",
-function(){return this.status.srcSet},a)},stop:function(){this.status.srcSet?this.html.active?this._html_pause(0):this.flash.active&&this._flash_pause(0):this._urlNotSetError("stop")},playHead:function(a){a=this._limitValue(a,0,100);this.status.srcSet?this.html.active?this._html_playHead(a):this.flash.active&&this._flash_playHead(a):this._urlNotSetError("playHead")},_muted:function(a){this.mutedWorker(a);this.options.globalVolume&&this.tellOthers("mutedWorker",function(){return this.options.globalVolume},
-a)},mutedWorker:function(a){this.options.muted=a;this.html.used&&this._html_setProperty("muted",a);this.flash.used&&this._flash_mute(a);this.html.video.gate||this.html.audio.gate||(this._updateMute(a),this._updateVolume(this.options.volume),this._trigger(b.jPlayer.event.volumechange))},mute:function(a){a=a===f?!0:!!a;this._muted(a)},unmute:function(a){a=a===f?!0:!!a;this._muted(!a)},_updateMute:function(a){a===f&&(a=this.options.muted);this.css.jq.mute.length&&this.css.jq.unmute.length&&(this.status.noVolume?
-(this.css.jq.mute.hide(),this.css.jq.unmute.hide()):a?(this.css.jq.mute.hide(),this.css.jq.unmute.show()):(this.css.jq.mute.show(),this.css.jq.unmute.hide()))},volume:function(a){this.volumeWorker(a);this.options.globalVolume&&this.tellOthers("volumeWorker",function(){return this.options.globalVolume},a)},volumeWorker:function(a){a=this._limitValue(a,0,1);this.options.volume=a;this.html.used&&this._html_setProperty("volume",a);this.flash.used&&this._flash_volume(a);this.html.video.gate||this.html.audio.gate||
-(this._updateVolume(a),this._trigger(b.jPlayer.event.volumechange))},volumeBar:function(a){if(this.css.jq.volumeBar.length){var c=b(a.currentTarget),d=c.offset(),e=a.pageX-d.left,g=c.width();a=c.height()-a.pageY+d.top;c=c.height();this.options.verticalVolume?this.volume(a/c):this.volume(e/g)}this.options.muted&&this._muted(!1)},volumeBarValue:function(){},_updateVolume:function(a){a===f&&(a=this.options.volume);a=this.options.muted?0:a;this.status.noVolume?(this.css.jq.volumeBar.length&&this.css.jq.volumeBar.hide(),
+this._trigger(a);break;case b.jPlayer.event.seeked:this._seeked();this._trigger(a);break;case b.jPlayer.event.ready:break;default:this._trigger(a)}return!1},_getFlashStatus:function(a){this.status.seekPercent=a.seekPercent;this.status.currentPercentRelative=a.currentPercentRelative;this.status.currentPercentAbsolute=a.currentPercentAbsolute;this.status.currentTime=a.currentTime;this.status.duration=a.duration;this.status.remaining=a.duration-a.currentTime;this.status.videoWidth=a.videoWidth;this.status.videoHeight=
+a.videoHeight;this.status.readyState=4;this.status.networkState=0;this.status.playbackRate=1;this.status.ended=!1},_updateButtons:function(a){a===f?a=!this.status.paused:this.status.paused=!a;a?this.addStateClass("playing"):this.removeStateClass("playing");!this.status.noFullWindow&&this.options.fullWindow?this.addStateClass("fullScreen"):this.removeStateClass("fullScreen");this.options.loop?this.addStateClass("looped"):this.removeStateClass("looped");this.css.jq.play.length&&this.css.jq.pause.length&&
+(a?(this.css.jq.play.hide(),this.css.jq.pause.show()):(this.css.jq.play.show(),this.css.jq.pause.hide()));this.css.jq.restoreScreen.length&&this.css.jq.fullScreen.length&&(this.status.noFullWindow?(this.css.jq.fullScreen.hide(),this.css.jq.restoreScreen.hide()):this.options.fullWindow?(this.css.jq.fullScreen.hide(),this.css.jq.restoreScreen.show()):(this.css.jq.fullScreen.show(),this.css.jq.restoreScreen.hide()));this.css.jq.repeat.length&&this.css.jq.repeatOff.length&&(this.options.loop?(this.css.jq.repeat.hide(),
+this.css.jq.repeatOff.show()):(this.css.jq.repeat.show(),this.css.jq.repeatOff.hide()))},_updateInterface:function(){this.css.jq.seekBar.length&&this.css.jq.seekBar.width(this.status.seekPercent+"%");this.css.jq.playBar.length&&(this.options.smoothPlayBar?this.css.jq.playBar.stop().animate({width:this.status.currentPercentAbsolute+"%"},250,"linear"):this.css.jq.playBar.width(this.status.currentPercentRelative+"%"));var a="";this.css.jq.currentTime.length&&(a=this._convertTime(this.status.currentTime),
+a!==this.css.jq.currentTime.text()&&this.css.jq.currentTime.text(this._convertTime(this.status.currentTime)));var a="",a=this.status.duration,c=this.status.remaining;this.css.jq.duration.length&&("string"===typeof this.status.media.duration?a=this.status.media.duration:("number"===typeof this.status.media.duration&&(a=this.status.media.duration,c=a-this.status.currentTime),a=this.options.remainingDuration?(0").join(">").split('"').join(""")},
+_qualifyURL:function(a){var c=document.createElement("div");c.innerHTML='x';return c.firstChild.href},_absoluteMediaUrls:function(a){var c=this;b.each(a,function(b,e){e&&c.format[b]&&(a[b]=c._qualifyURL(e))});return a},addStateClass:function(a){this.ancestorJq.length&&this.ancestorJq.addClass(this.options.stateClass[a])},removeStateClass:function(a){this.ancestorJq.length&&this.ancestorJq.removeClass(this.options.stateClass[a])},setMedia:function(a){var c=this,
+d=!1,e=this.status.media.poster!==a.poster;this._resetMedia();this._resetGate();this._resetActive();this.androidFix.setMedia=!1;this.androidFix.play=!1;this.androidFix.pause=!1;a=this._absoluteMediaUrls(a);b.each(this.formats,function(e,f){var k="video"===c.format[f].media;b.each(c.solutions,function(e,g){if(c[g].support[f]&&c._validString(a[f])){var l="html"===g;k?(l?(c.html.video.gate=!0,c._html_setVideo(a),c.html.active=!0):(c.flash.gate=!0,c._flash_setVideo(a),c.flash.active=!0),c.css.jq.videoPlay.length&&
+c.css.jq.videoPlay.show(),c.status.video=!0):(l?(c.html.audio.gate=!0,c._html_setAudio(a),c.html.active=!0,b.jPlayer.platform.android&&(c.androidFix.setMedia=!0)):(c.flash.gate=!0,c._flash_setAudio(a),c.flash.active=!0),c.css.jq.videoPlay.length&&c.css.jq.videoPlay.hide(),c.status.video=!1);d=!0;return!1}});if(d)return!1});d?(this.status.nativeVideoControls&&this.html.video.gate||!this._validString(a.poster)||(e?this.htmlElement.poster.src=a.poster:this.internal.poster.jq.show()),this.css.jq.title.length&&
+"string"===typeof a.title&&(this.css.jq.title.html(a.title),this.htmlElement.audio&&this.htmlElement.audio.setAttribute("title",a.title),this.htmlElement.video&&this.htmlElement.video.setAttribute("title",a.title)),this.status.srcSet=!0,this.status.media=b.extend({},a),this._updateButtons(!1),this._updateInterface(),this._trigger(b.jPlayer.event.setmedia)):this._error({type:b.jPlayer.error.NO_SUPPORT,context:"{supplied:'"+this.options.supplied+"'}",message:b.jPlayer.errorMsg.NO_SUPPORT,hint:b.jPlayer.errorHint.NO_SUPPORT})},
+_resetMedia:function(){this._resetStatus();this._updateButtons(!1);this._updateInterface();this._seeked();this.internal.poster.jq.hide();clearTimeout(this.internal.htmlDlyCmdId);this.html.active?this._html_resetMedia():this.flash.active&&this._flash_resetMedia()},clearMedia:function(){this._resetMedia();this.html.active?this._html_clearMedia():this.flash.active&&this._flash_clearMedia();this._resetGate();this._resetActive()},load:function(){this.status.srcSet?this.html.active?this._html_load():this.flash.active&&
+this._flash_load():this._urlNotSetError("load")},focus:function(){this.options.keyEnabled&&(b.jPlayer.focus=this)},play:function(a){"object"===typeof a&&this.options.useStateClassSkin&&!this.status.paused?this.pause(a):(a="number"===typeof a?a:NaN,this.status.srcSet?(this.focus(),this.html.active?this._html_play(a):this.flash.active&&this._flash_play(a)):this._urlNotSetError("play"))},videoPlay:function(){this.play()},pause:function(a){a="number"===typeof a?a:NaN;this.status.srcSet?this.html.active?
+this._html_pause(a):this.flash.active&&this._flash_pause(a):this._urlNotSetError("pause")},tellOthers:function(a,c){var d=this,e="function"===typeof c,g=Array.prototype.slice.call(arguments);"string"===typeof a&&(e&&g.splice(1,1),b.each(this.instances,function(){d.element!==this&&(e&&!c.call(this.data("jPlayer"),d)||this.jPlayer.apply(this,g))}))},pauseOthers:function(a){this.tellOthers("pause",function(){return this.status.srcSet},a)},stop:function(){this.status.srcSet?this.html.active?this._html_pause(0):
+this.flash.active&&this._flash_pause(0):this._urlNotSetError("stop")},playHead:function(a){a=this._limitValue(a,0,100);this.status.srcSet?this.html.active?this._html_playHead(a):this.flash.active&&this._flash_playHead(a):this._urlNotSetError("playHead")},_muted:function(a){this.mutedWorker(a);this.options.globalVolume&&this.tellOthers("mutedWorker",function(){return this.options.globalVolume},a)},mutedWorker:function(a){this.options.muted=a;this.html.used&&this._html_setProperty("muted",a);this.flash.used&&
+this._flash_mute(a);this.html.video.gate||this.html.audio.gate||(this._updateMute(a),this._updateVolume(this.options.volume),this._trigger(b.jPlayer.event.volumechange))},mute:function(a){"object"===typeof a&&this.options.useStateClassSkin&&this.options.muted?this._muted(!1):(a=a===f?!0:!!a,this._muted(a))},unmute:function(a){a=a===f?!0:!!a;this._muted(!a)},_updateMute:function(a){a===f&&(a=this.options.muted);a?this.addStateClass("muted"):this.removeStateClass("muted");this.css.jq.mute.length&&this.css.jq.unmute.length&&
+(this.status.noVolume?(this.css.jq.mute.hide(),this.css.jq.unmute.hide()):a?(this.css.jq.mute.hide(),this.css.jq.unmute.show()):(this.css.jq.mute.show(),this.css.jq.unmute.hide()))},volume:function(a){this.volumeWorker(a);this.options.globalVolume&&this.tellOthers("volumeWorker",function(){return this.options.globalVolume},a)},volumeWorker:function(a){a=this._limitValue(a,0,1);this.options.volume=a;this.html.used&&this._html_setProperty("volume",a);this.flash.used&&this._flash_volume(a);this.html.video.gate||
+this.html.audio.gate||(this._updateVolume(a),this._trigger(b.jPlayer.event.volumechange))},volumeBar:function(a){if(this.css.jq.volumeBar.length){var c=b(a.currentTarget),d=c.offset(),e=a.pageX-d.left,g=c.width();a=c.height()-a.pageY+d.top;c=c.height();this.options.verticalVolume?this.volume(a/c):this.volume(e/g)}this.options.muted&&this._muted(!1)},_updateVolume:function(a){a===f&&(a=this.options.volume);a=this.options.muted?0:a;this.status.noVolume?(this.css.jq.volumeBar.length&&this.css.jq.volumeBar.hide(),
this.css.jq.volumeBarValue.length&&this.css.jq.volumeBarValue.hide(),this.css.jq.volumeMax.length&&this.css.jq.volumeMax.hide()):(this.css.jq.volumeBar.length&&this.css.jq.volumeBar.show(),this.css.jq.volumeBarValue.length&&(this.css.jq.volumeBarValue.show(),this.css.jq.volumeBarValue[this.options.verticalVolume?"height":"width"](100*a+"%")),this.css.jq.volumeMax.length&&this.css.jq.volumeMax.show())},volumeMax:function(){this.volume(1);this.options.muted&&this._muted(!1)},_cssSelectorAncestor:function(a){var c=
this;this.options.cssSelectorAncestor=a;this._removeUiClass();this.ancestorJq=a?b(a):[];a&&1!==this.ancestorJq.length&&this._warning({type:b.jPlayer.warning.CSS_SELECTOR_COUNT,context:a,message:b.jPlayer.warningMsg.CSS_SELECTOR_COUNT+this.ancestorJq.length+" found for cssSelectorAncestor.",hint:b.jPlayer.warningHint.CSS_SELECTOR_COUNT});this._addUiClass();b.each(this.options.cssSelector,function(a,b){c._cssSelector(a,b)});this._updateInterface();this._updateButtons();this._updateAutohide();this._updateVolume();
-this._updateMute()},_cssSelector:function(a,c){var d=this;"string"===typeof c?b.jPlayer.prototype.options.cssSelector[a]?(this.css.jq[a]&&this.css.jq[a].length&&this.css.jq[a].unbind(".jPlayer"),this.options.cssSelector[a]=c,this.css.cs[a]=this.options.cssSelectorAncestor+" "+c,this.css.jq[a]=c?b(this.css.cs[a]):[],this.css.jq[a].length&&this.css.jq[a].bind("click.jPlayer",function(c){c.preventDefault();d[a](c);b(this).blur()}),c&&1!==this.css.jq[a].length&&this._warning({type:b.jPlayer.warning.CSS_SELECTOR_COUNT,
+this._updateMute()},_cssSelector:function(a,c){var d=this;"string"===typeof c?b.jPlayer.prototype.options.cssSelector[a]?(this.css.jq[a]&&this.css.jq[a].length&&this.css.jq[a].unbind(".jPlayer"),this.options.cssSelector[a]=c,this.css.cs[a]=this.options.cssSelectorAncestor+" "+c,this.css.jq[a]=c?b(this.css.cs[a]):[],this.css.jq[a].length&&this[a]&&this.css.jq[a].bind("click.jPlayer",function(c){c.preventDefault();d[a](c);d.options.autoBlur&&b(this).blur()}),c&&1!==this.css.jq[a].length&&this._warning({type:b.jPlayer.warning.CSS_SELECTOR_COUNT,
context:this.css.cs[a],message:b.jPlayer.warningMsg.CSS_SELECTOR_COUNT+this.css.jq[a].length+" found for "+a+" method.",hint:b.jPlayer.warningHint.CSS_SELECTOR_COUNT})):this._warning({type:b.jPlayer.warning.CSS_SELECTOR_METHOD,context:a,message:b.jPlayer.warningMsg.CSS_SELECTOR_METHOD,hint:b.jPlayer.warningHint.CSS_SELECTOR_METHOD}):this._warning({type:b.jPlayer.warning.CSS_SELECTOR_STRING,context:c,message:b.jPlayer.warningMsg.CSS_SELECTOR_STRING,hint:b.jPlayer.warningHint.CSS_SELECTOR_STRING})},
-seekBar:function(a){if(this.css.jq.seekBar.length){var c=b(a.currentTarget),d=c.offset();a=a.pageX-d.left;c=c.width();this.playHead(100*a/c)}},playBar:function(){},playbackRate:function(a){this._setOption("playbackRate",a)},playbackRateBar:function(a){if(this.css.jq.playbackRateBar.length){var c=b(a.currentTarget),d=c.offset(),e=a.pageX-d.left,g=c.width();a=c.height()-a.pageY+d.top;c=c.height();this.playbackRate((this.options.verticalPlaybackRate?a/c:e/g)*(this.options.maxPlaybackRate-this.options.minPlaybackRate)+
-this.options.minPlaybackRate)}},playbackRateBarValue:function(){},_updatePlaybackRate:function(){var a=(this.options.playbackRate-this.options.minPlaybackRate)/(this.options.maxPlaybackRate-this.options.minPlaybackRate);this.status.playbackRateEnabled?(this.css.jq.playbackRateBar.length&&this.css.jq.playbackRateBar.show(),this.css.jq.playbackRateBarValue.length&&(this.css.jq.playbackRateBarValue.show(),this.css.jq.playbackRateBarValue[this.options.verticalPlaybackRate?"height":"width"](100*a+"%"))):
-(this.css.jq.playbackRateBar.length&&this.css.jq.playbackRateBar.hide(),this.css.jq.playbackRateBarValue.length&&this.css.jq.playbackRateBarValue.hide())},repeat:function(){this._loop(!0)},repeatOff:function(){this._loop(!1)},_loop:function(a){this.options.loop!==a&&(this.options.loop=a,this._updateButtons(),this._trigger(b.jPlayer.event.repeat))},currentTime:function(){},duration:function(){},gui:function(){},noSolution:function(){},option:function(a,c){var d=a;if(0===arguments.length)return b.extend(!0,
-{},this.options);if("string"===typeof a){var e=a.split(".");if(c===f){for(var d=b.extend(!0,{},this.options),g=0;g=
a&&(b=!0);return b},_validString:function(a){return a&&"string"===typeof a},_limitValue:function(a,b,d){return ad?d:a},_urlNotSetError:function(a){this._error({type:b.jPlayer.error.URL_NOT_SET,context:a,message:b.jPlayer.errorMsg.URL_NOT_SET,hint:b.jPlayer.errorHint.URL_NOT_SET})},_flashError:function(a){var c;c=this.internal.ready?"FLASH_DISABLED":"FLASH";this._error({type:b.jPlayer.error[c],context:this.internal.flash.swf,message:b.jPlayer.errorMsg[c]+a.message,hint:b.jPlayer.errorHint[c]});
this.internal.flash.jq.css({width:"1px",height:"1px"})},_error:function(a){this._trigger(b.jPlayer.event.error,a);this.options.errorAlerts&&this._alert("Error!"+(a.message?"\n"+a.message:"")+(a.hint?"\n"+a.hint:"")+"\nContext: "+a.context)},_warning:function(a){this._trigger(b.jPlayer.event.warning,f,a);this.options.warningAlerts&&this._alert("Warning!"+(a.message?"\n"+a.message:"")+(a.hint?"\n"+a.hint:"")+"\nContext: "+a.context)},_alert:function(a){a="jPlayer "+this.version.script+" : id='"+this.internal.self.id+
-"' : "+a;this.options.consoleAlerts?console&&console.log&&console.log(a):alert(a)},_emulateHtmlBridge:function(){var a=this;b.each(b.jPlayer.emulateMethods.split(/\s+/g),function(b,d){a.internal.domNode[d]=function(b){a[d](b)}});b.each(b.jPlayer.event,function(c,d){var e=!0;b.each(b.jPlayer.reservedEvent.split(/\s+/g),function(a,b){if(b===c)return e=!1});e&&a.element.bind(d+".jPlayer.jPlayerHtml",function(){a._emulateHtmlUpdate();var b=document.createEvent("Event");b.initEvent(c,!1,!0);a.internal.domNode.dispatchEvent(b)})})},
-_emulateHtmlUpdate:function(){var a=this;b.each(b.jPlayer.emulateStatus.split(/\s+/g),function(b,d){a.internal.domNode[d]=a.status[d]});b.each(b.jPlayer.emulateOptions.split(/\s+/g),function(b,d){a.internal.domNode[d]=a.options[d]})},_destroyHtmlBridge:function(){var a=this;this.element.unbind(".jPlayerHtml");b.each((b.jPlayer.emulateMethods+" "+b.jPlayer.emulateStatus+" "+b.jPlayer.emulateOptions).split(/\s+/g),function(b,d){delete a.internal.domNode[d]})}};b.jPlayer.error={FLASH:"e_flash",FLASH_DISABLED:"e_flash_disabled",
-NO_SOLUTION:"e_no_solution",NO_SUPPORT:"e_no_support",URL:"e_url",URL_NOT_SET:"e_url_not_set",VERSION:"e_version"};b.jPlayer.errorMsg={FLASH:"jPlayer's Flash fallback is not configured correctly, or a command was issued before the jPlayer Ready event. Details: ",FLASH_DISABLED:"jPlayer's Flash fallback has been disabled by the browser due to the CSS rules you have used. Details: ",NO_SOLUTION:"No solution can be found by jPlayer in this browser. Neither HTML nor Flash can be used.",NO_SUPPORT:"It is not possible to play any media format provided in setMedia() on this browser using your current options.",
-URL:"Media URL could not be loaded.",URL_NOT_SET:"Attempt to issue media playback commands, while no media url is set.",VERSION:"jPlayer "+b.jPlayer.prototype.version.script+" needs Jplayer.swf version "+b.jPlayer.prototype.version.needFlash+" but found "};b.jPlayer.errorHint={FLASH:"Check your swfPath option and that Jplayer.swf is there.",FLASH_DISABLED:"Check that you have not display:none; the jPlayer entity or any ancestor.",NO_SOLUTION:"Review the jPlayer options: support and supplied.",NO_SUPPORT:"Video or audio formats defined in the supplied option are missing.",
-URL:"Check media URL is valid.",URL_NOT_SET:"Use setMedia() to set the media URL.",VERSION:"Update jPlayer files."};b.jPlayer.warning={CSS_SELECTOR_COUNT:"e_css_selector_count",CSS_SELECTOR_METHOD:"e_css_selector_method",CSS_SELECTOR_STRING:"e_css_selector_string",OPTION_KEY:"e_option_key"};b.jPlayer.warningMsg={CSS_SELECTOR_COUNT:"The number of css selectors found did not equal one: ",CSS_SELECTOR_METHOD:"The methodName given in jPlayer('cssSelector') is not a valid jPlayer method.",CSS_SELECTOR_STRING:"The methodCssSelector given in jPlayer('cssSelector') is not a String or is empty.",
-OPTION_KEY:"The option requested in jPlayer('option') is undefined."};b.jPlayer.warningHint={CSS_SELECTOR_COUNT:"Check your css selector and the ancestor.",CSS_SELECTOR_METHOD:"Check your method name.",CSS_SELECTOR_STRING:"Check your css selector is a string.",OPTION_KEY:"Check your option name."}});
\ No newline at end of file
+"' : "+a;this.options.consoleAlerts?window.console&&window.console.log&&window.console.log(a):alert(a)},_emulateHtmlBridge:function(){var a=this;b.each(b.jPlayer.emulateMethods.split(/\s+/g),function(b,d){a.internal.domNode[d]=function(b){a[d](b)}});b.each(b.jPlayer.event,function(c,d){var e=!0;b.each(b.jPlayer.reservedEvent.split(/\s+/g),function(a,b){if(b===c)return e=!1});e&&a.element.bind(d+".jPlayer.jPlayerHtml",function(){a._emulateHtmlUpdate();var b=document.createEvent("Event");b.initEvent(c,
+!1,!0);a.internal.domNode.dispatchEvent(b)})})},_emulateHtmlUpdate:function(){var a=this;b.each(b.jPlayer.emulateStatus.split(/\s+/g),function(b,d){a.internal.domNode[d]=a.status[d]});b.each(b.jPlayer.emulateOptions.split(/\s+/g),function(b,d){a.internal.domNode[d]=a.options[d]})},_destroyHtmlBridge:function(){var a=this;this.element.unbind(".jPlayerHtml");b.each((b.jPlayer.emulateMethods+" "+b.jPlayer.emulateStatus+" "+b.jPlayer.emulateOptions).split(/\s+/g),function(b,d){delete a.internal.domNode[d]})}};
+b.jPlayer.error={FLASH:"e_flash",FLASH_DISABLED:"e_flash_disabled",NO_SOLUTION:"e_no_solution",NO_SUPPORT:"e_no_support",URL:"e_url",URL_NOT_SET:"e_url_not_set",VERSION:"e_version"};b.jPlayer.errorMsg={FLASH:"jPlayer's Flash fallback is not configured correctly, or a command was issued before the jPlayer Ready event. Details: ",FLASH_DISABLED:"jPlayer's Flash fallback has been disabled by the browser due to the CSS rules you have used. Details: ",NO_SOLUTION:"No solution can be found by jPlayer in this browser. Neither HTML nor Flash can be used.",
+NO_SUPPORT:"It is not possible to play any media format provided in setMedia() on this browser using your current options.",URL:"Media URL could not be loaded.",URL_NOT_SET:"Attempt to issue media playback commands, while no media url is set.",VERSION:"jPlayer "+b.jPlayer.prototype.version.script+" needs Jplayer.swf version "+b.jPlayer.prototype.version.needFlash+" but found "};b.jPlayer.errorHint={FLASH:"Check your swfPath option and that Jplayer.swf is there.",FLASH_DISABLED:"Check that you have not display:none; the jPlayer entity or any ancestor.",
+NO_SOLUTION:"Review the jPlayer options: support and supplied.",NO_SUPPORT:"Video or audio formats defined in the supplied option are missing.",URL:"Check media URL is valid.",URL_NOT_SET:"Use setMedia() to set the media URL.",VERSION:"Update jPlayer files."};b.jPlayer.warning={CSS_SELECTOR_COUNT:"e_css_selector_count",CSS_SELECTOR_METHOD:"e_css_selector_method",CSS_SELECTOR_STRING:"e_css_selector_string",OPTION_KEY:"e_option_key"};b.jPlayer.warningMsg={CSS_SELECTOR_COUNT:"The number of css selectors found did not equal one: ",
+CSS_SELECTOR_METHOD:"The methodName given in jPlayer('cssSelector') is not a valid jPlayer method.",CSS_SELECTOR_STRING:"The methodCssSelector given in jPlayer('cssSelector') is not a String or is empty.",OPTION_KEY:"The option requested in jPlayer('option') is undefined."};b.jPlayer.warningHint={CSS_SELECTOR_COUNT:"Check your css selector and the ancestor.",CSS_SELECTOR_METHOD:"Check your method name.",CSS_SELECTOR_STRING:"Check your css selector is a string.",OPTION_KEY:"Check your option name."}});
\ No newline at end of file
diff --git a/airtime_mvc/public/js/jplayer/popcorn/popcorn.jplayer.js b/airtime_mvc/public/js/jplayer/popcorn/popcorn.jplayer.js
new file mode 100644
index 000000000..31fead479
--- /dev/null
+++ b/airtime_mvc/public/js/jplayer/popcorn/popcorn.jplayer.js
@@ -0,0 +1,583 @@
+/*
+ * jPlayer Player Plugin for Popcorn JavaScript Library
+ * http://www.jplayer.org
+ *
+ * Copyright (c) 2012 - 2014 Happyworm Ltd
+ * Licensed under the MIT license.
+ * http://opensource.org/licenses/MIT
+ *
+ * Author: Mark J Panaghiston
+ * Version: 1.1.4
+ * Date: 1st September 2014
+ *
+ * For Popcorn Version: 1.3
+ * For jPlayer Version: 2.7.0
+ * Requires: jQuery 1.7+
+ * Note: jQuery dependancy cannot be removed since jPlayer 2 is a jQuery plugin. Use of jQuery will be kept to a minimum.
+ */
+
+/* Code verified using http://www.jshint.com/ */
+/*jshint asi:false, bitwise:false, boss:false, browser:true, curly:false, debug:false, eqeqeq:true, eqnull:false, evil:false, forin:false, immed:false, jquery:true, laxbreak:false, newcap:true, noarg:true, noempty:true, nonew:true, onevar:false, passfail:false, plusplus:false, regexp:false, undef:true, sub:false, strict:false, white:false, smarttabs:true */
+/*global Popcorn:false, console:false */
+
+(function(Popcorn) {
+
+ var JQUERY_SCRIPT = '//code.jquery.com/jquery-1.11.1.min.js', // Used if jQuery not already present.
+ JPLAYER_SCRIPT = '//www.jplayer.org/2.7.0/js/jquery.jplayer.min.js', // Used if jPlayer not already present.
+ JPLAYER_SWFPATH = '//www.jplayer.org/2.7.0/js/Jplayer.swf', // Used if not specified in jPlayer options via SRC Object.
+ SOLUTION = 'html,flash', // The default solution option.
+ DEBUG = false, // Decided to leave the debugging option and console output in for the time being. Overhead is trivial.
+ jQueryDownloading = false, // Flag to stop multiple instances from each pulling in jQuery, thus corrupting it.
+ jPlayerDownloading = false, // Flag to stop multiple instances from each pulling in jPlayer, thus corrupting it.
+ format = { // Duplicate of jPlayer 2.5.0 object, to avoid always requiring jQuery and jPlayer to be loaded before performing the _canPlayType() test.
+ mp3: {
+ codec: 'audio/mpeg;',
+ flashCanPlay: true,
+ media: 'audio'
+ },
+ m4a: { // AAC / MP4
+ codec: 'audio/mp4; codecs="mp4a.40.2"',
+ flashCanPlay: true,
+ media: 'audio'
+ },
+ m3u8a: { // AAC / MP4 / Apple HLS
+ codec: 'application/vnd.apple.mpegurl; codecs="mp4a.40.2"',
+ flashCanPlay: false,
+ media: 'audio'
+ },
+ m3ua: { // M3U
+ codec: 'audio/mpegurl',
+ flashCanPlay: false,
+ media: 'audio'
+ },
+ oga: { // OGG
+ codec: 'audio/ogg; codecs="vorbis, opus"',
+ flashCanPlay: false,
+ media: 'audio'
+ },
+ flac: { // FLAC
+ codec: 'audio/x-flac',
+ flashCanPlay: false,
+ media: 'audio'
+ },
+ wav: { // PCM
+ codec: 'audio/wav; codecs="1"',
+ flashCanPlay: false,
+ media: 'audio'
+ },
+ webma: { // WEBM
+ codec: 'audio/webm; codecs="vorbis"',
+ flashCanPlay: false,
+ media: 'audio'
+ },
+ fla: { // FLV / F4A
+ codec: 'audio/x-flv',
+ flashCanPlay: true,
+ media: 'audio'
+ },
+ rtmpa: { // RTMP AUDIO
+ codec: 'audio/rtmp; codecs="rtmp"',
+ flashCanPlay: true,
+ media: 'audio'
+ },
+ m4v: { // H.264 / MP4
+ codec: 'video/mp4; codecs="avc1.42E01E, mp4a.40.2"',
+ flashCanPlay: true,
+ media: 'video'
+ },
+ m3u8v: { // H.264 / AAC / MP4 / Apple HLS
+ codec: 'application/vnd.apple.mpegurl; codecs="avc1.42E01E, mp4a.40.2"',
+ flashCanPlay: false,
+ media: 'video'
+ },
+ m3uv: { // M3U
+ codec: 'audio/mpegurl',
+ flashCanPlay: false,
+ media: 'video'
+ },
+ ogv: { // OGG
+ codec: 'video/ogg; codecs="theora, vorbis"',
+ flashCanPlay: false,
+ media: 'video'
+ },
+ webmv: { // WEBM
+ codec: 'video/webm; codecs="vorbis, vp8"',
+ flashCanPlay: false,
+ media: 'video'
+ },
+ flv: { // FLV / F4V
+ codec: 'video/x-flv',
+ flashCanPlay: true,
+ media: 'video'
+ },
+ rtmpv: { // RTMP VIDEO
+ codec: 'video/rtmp; codecs="rtmp"',
+ flashCanPlay: true,
+ media: 'video'
+ }
+ },
+ isObject = function(val) { // Basic check for Object
+ if(val && typeof val === 'object' && val.hasOwnProperty) {
+ return true;
+ } else {
+ return false;
+ }
+ },
+ getMediaType = function(url) { // Function to gleam the media type from the URL
+ var mediaType = false;
+ if(/\.mp3$/i.test(url)) {
+ mediaType = 'mp3';
+ } else if(/\.mp4$/i.test(url) || /\.m4v$/i.test(url)) {
+ mediaType = 'm4v';
+ } else if(/\.m4a$/i.test(url)) {
+ mediaType = 'm4a';
+ } else if(/\.ogg$/i.test(url) || /\.oga$/i.test(url)) {
+ mediaType = 'oga';
+ } else if(/\.ogv$/i.test(url)) {
+ mediaType = 'ogv';
+ } else if(/\.webm$/i.test(url)) {
+ mediaType = 'webmv';
+ }
+ return mediaType;
+ },
+ getSupplied = function(url) { // Function to generate a supplied option from an src object. ie., When supplied not specified.
+ var supplied = '',
+ separator = '';
+ if(isObject(url)) {
+ // Generate supplied option from object's properties. Non-format properties would be ignored by jPlayer. Order is unpredictable.
+ for(var prop in url) {
+ if(url.hasOwnProperty(prop)) {
+ supplied += separator + prop;
+ separator = ',';
+ }
+ }
+ }
+ if(DEBUG) console.log('getSupplied(): Generated: supplied = "' + supplied + '"');
+ return supplied;
+ };
+
+ Popcorn.player( 'jplayer', {
+ _canPlayType: function( containerType, url ) {
+ // url : Either a String or an Object structured similar a jPlayer media object. ie., As used by setMedia in jPlayer.
+ // The url object may also contain a solution and supplied property.
+
+ // Define the src object structure here!
+
+ var cType = containerType.toLowerCase(),
+ srcObj = {
+ media:{},
+ options:{}
+ },
+ rVal = false, // Only a boolean false means it is not supported.
+ mediaType;
+
+ if(cType !== 'video' && cType !== 'audio') {
+
+ if(typeof url === 'string') {
+ // Check it starts with http, so the URL is absolute... Well, it is not a perfect check.
+ if(/^http.*/i.test(url)) {
+ mediaType = getMediaType(url);
+ if(mediaType) {
+ srcObj.media[mediaType] = url;
+ srcObj.options.solution = SOLUTION;
+ srcObj.options.supplied = mediaType;
+ }
+ }
+ } else {
+ srcObj = url; // Assume the url is an src object.
+ }
+
+ // Check for Object and appropriate minimum data structure.
+ if(isObject(srcObj) && isObject(srcObj.media)) {
+
+ if(!isObject(srcObj.options)) {
+ srcObj.options = {};
+ }
+
+ if(!srcObj.options.solution) {
+ srcObj.options.solution = SOLUTION;
+ }
+
+ if(!srcObj.options.supplied) {
+ srcObj.options.supplied = getSupplied(srcObj.media);
+ }
+
+ // Figure out how jPlayer will play it.
+ // This may not work properly when both audio and video is supplied. ie., A media player. But it should return truethy and jPlayer can figure it out.
+
+ var solution = srcObj.options.solution.toLowerCase().split(","), // Create the solution array, with prority based on the order of the solution string.
+ supplied = srcObj.options.supplied.toLowerCase().split(","); // Create the supplied formats array, with prority based on the order of the supplied formats string.
+
+ for(var sol = 0; sol < solution.length; sol++) {
+
+ var solutionType = solution[sol].replace(/^\s+|\s+$/g, ""), //trim
+ checkingHtml = solutionType === 'html',
+ checkingFlash = solutionType === 'flash',
+ mediaElem;
+
+ for(var fmt = 0; fmt < supplied.length; fmt++) {
+ mediaType = supplied[fmt].replace(/^\s+|\s+$/g, ""); //trim
+ if(format[mediaType]) { // Check format is valid.
+
+ // Create an HTML5 media element for the type of media.
+ if(!mediaElem && checkingHtml) {
+ mediaElem = document.createElement(format[mediaType].media);
+ }
+ // See if the HTML5 media element can play the MIME / Codec type.
+ // Flash also returns the object if the format is playable, so it is truethy, but that html property is false.
+ // This assumes Flash is available, but that should be dealt with by jPlayer if that happens.
+ var htmlCanPlay = !!(mediaElem && mediaElem.canPlayType && mediaElem.canPlayType(format[mediaType].codec)),
+ htmlWillPlay = htmlCanPlay && checkingHtml,
+ flashWillPlay = format[mediaType].flashCanPlay && checkingFlash;
+ // The first one found will match what jPlayer uses.
+ if(htmlWillPlay || flashWillPlay) {
+ rVal = {
+ html: htmlWillPlay,
+ type: mediaType
+ };
+ sol = solution.length; // Exit solution loop
+ fmt = supplied.length; // Exit supplied loop
+ }
+ }
+ }
+ }
+ }
+ }
+ return rVal;
+ },
+ // _setup: function( options ) { // Warning: options is deprecated.
+ _setup: function() {
+ var media = this,
+ myPlayer, // The jQuery selector of the jPlayer element. Usually a
+ jPlayerObj, // The jPlayer data instance. For performance and DRY code.
+ mediaType = 'unknown',
+ jpMedia = {},
+ jpOptions = {},
+ ready = false, // Used during init to override the annoying duration dependance in the track event padding during Popcorn's isReady(). ie., We is ready after loadeddata and duration can then be set real value at leisure.
+ duration = 0, // For the durationchange event with both HTML5 and Flash solutions. Used with 'ready' to keep control during the Popcorn isReady() via loadeddata event. (Duration=0 is bad.)
+ durationchangeId = null, // A timeout ID used with delayed durationchange event. (Because of the duration=NaN fudge to avoid Popcorn track event corruption.)
+ canplaythrough = false,
+ error = null, // The MediaError object.
+
+ dispatchDurationChange = function() {
+ if(ready) {
+ if(DEBUG) console.log('Dispatched event : durationchange : ' + duration);
+ media.dispatchEvent('durationchange');
+ } else {
+ if(DEBUG) console.log('DELAYED EVENT (!ready) : durationchange : ' + duration);
+ clearTimeout(durationchangeId); // Stop multiple triggers causing multiple timeouts running in parallel.
+ durationchangeId = setTimeout(dispatchDurationChange, 250);
+ }
+ },
+
+ jPlayerFlashEventsPatch = function() {
+
+ /* Events already supported by jPlayer Flash:
+ * loadstart
+ * loadedmetadata (M4A, M4V)
+ * progress
+ * play
+ * pause
+ * seeking
+ * seeked
+ * timeupdate
+ * ended
+ * volumechange
+ * error <- See the custom handler in jPlayerInit()
+ */
+
+ /* Events patched:
+ * loadeddata
+ * durationchange
+ * canplaythrough
+ * playing
+ */
+
+ /* Events NOT patched:
+ * suspend
+ * abort
+ * emptied
+ * stalled
+ * loadedmetadata (MP3)
+ * waiting
+ * canplay
+ * ratechange
+ */
+
+ // Triggering patched events through the jPlayer Object so the events are homogeneous. ie., The contain the event.jPlayer data structure.
+
+ var checkDuration = function(event) {
+ if(event.jPlayer.status.duration !== duration) {
+ duration = event.jPlayer.status.duration;
+ dispatchDurationChange();
+ }
+ },
+
+ checkCanPlayThrough = function(event) {
+ if(!canplaythrough && event.jPlayer.status.seekPercent === 100) {
+ canplaythrough = true;
+ setTimeout(function() {
+ if(DEBUG) console.log('Trigger : canplaythrough');
+ jPlayerObj._trigger($.jPlayer.event.canplaythrough);
+ }, 0);
+ }
+ };
+
+ myPlayer.bind($.jPlayer.event.loadstart, function() {
+ setTimeout(function() {
+ if(DEBUG) console.log('Trigger : loadeddata');
+ jPlayerObj._trigger($.jPlayer.event.loadeddata);
+ }, 0);
+ })
+ .bind($.jPlayer.event.progress, function(event) {
+ checkDuration(event);
+ checkCanPlayThrough(event);
+ })
+ .bind($.jPlayer.event.timeupdate, function(event) {
+ checkDuration(event);
+ checkCanPlayThrough(event);
+ })
+ .bind($.jPlayer.event.play, function() {
+ setTimeout(function() {
+ if(DEBUG) console.log('Trigger : playing');
+ jPlayerObj._trigger($.jPlayer.event.playing);
+ }, 0);
+ });
+
+ if(DEBUG) console.log('Created CUSTOM event handlers for FLASH');
+ },
+
+ jPlayerInit = function() {
+ (function($) {
+
+ myPlayer = $('#' + media.id);
+
+ if(typeof media.src === 'string') {
+ mediaType = getMediaType(media.src);
+ jpMedia[mediaType] = media.src;
+ jpOptions.supplied = mediaType;
+ jpOptions.solution = SOLUTION;
+ } else if(isObject(media.src)) {
+ jpMedia = isObject(media.src.media) ? media.src.media : {};
+ jpOptions = isObject(media.src.options) ? media.src.options : {};
+ jpOptions.solution = jpOptions.solution || SOLUTION;
+ jpOptions.supplied = jpOptions.supplied || getSupplied(media.src.media);
+ }
+
+ // Allow the swfPath to be set to local server. ie., If the jPlayer Plugin is local and already on the page, then you can also use the local SWF.
+ jpOptions.swfPath = jpOptions.swfPath || JPLAYER_SWFPATH;
+
+ myPlayer.bind($.jPlayer.event.ready, function(event) {
+ if(event.jPlayer.flash.used) {
+ jPlayerFlashEventsPatch();
+ }
+ // Set the media andd load it, so that the Flash solution behaves similar to HTML5 solution.
+ // This also allows the loadstart event to be used to know jPlayer is ready.
+ $(this).jPlayer('setMedia', jpMedia).jPlayer('load');
+ });
+
+ // Do not auto-bubble the reserved events, nor the loadeddata and durationchange event, since the duration must be carefully handled when loadeddata event occurs.
+ // See the duration property code for more details. (Ranting.)
+
+ var reservedEvents = $.jPlayer.reservedEvent + ' loadeddata durationchange',
+ reservedEvent = reservedEvents.split(/\s+/g);
+
+ // Generate event handlers for all the standard HTML5 media events. (Except durationchange)
+
+ var bindEvent = function(name) {
+ myPlayer.bind($.jPlayer.event[name], function(event) {
+ if(DEBUG) console.log('Dispatched event: ' + name + (event && event.jPlayer ? ' (' + event.jPlayer.status.currentTime + 's)' : '')); // Must be after dispatch for some reason on Firefox/Opera
+ media.dispatchEvent(name);
+ });
+ if(DEBUG) console.log('Created event handler for: ' + name);
+ };
+
+ for(var eventName in $.jPlayer.event) {
+ if($.jPlayer.event.hasOwnProperty(eventName)) {
+ var nativeEvent = true;
+ for(var iRes in reservedEvent) {
+ if(reservedEvent.hasOwnProperty(iRes)) {
+ if(reservedEvent[iRes] === eventName) {
+ nativeEvent = false;
+ break;
+ }
+ }
+ }
+ if(nativeEvent) {
+ bindEvent(eventName);
+ } else {
+ if(DEBUG) console.log('Skipped auto event handler creation for: ' + eventName);
+ }
+ }
+ }
+
+ myPlayer.bind($.jPlayer.event.loadeddata, function(event) {
+ if(DEBUG) console.log('Dispatched event: loadeddata' + (event && event.jPlayer ? ' (' + event.jPlayer.status.currentTime + 's)' : ''));
+ media.dispatchEvent('loadeddata');
+ ready = true;
+ });
+ if(DEBUG) console.log('Created CUSTOM event handler for: loadeddata');
+
+ myPlayer.bind($.jPlayer.event.durationchange, function(event) {
+ duration = event.jPlayer.status.duration;
+ dispatchDurationChange();
+ });
+ if(DEBUG) console.log('Created CUSTOM event handler for: durationchange');
+
+ // The error event is a special case. Plus jPlayer error event assumes it is a broken URL. (It could also be a decoder error... Or aborted or a Network error.)
+ myPlayer.bind($.jPlayer.event.error, function(event) {
+ // Not sure how to handle the error situation. Popcorn does not appear to have the error or error.code property documented here: http://popcornjs.org/popcorn-docs/media-methods/
+ // If any error event happens, then something has gone pear shaped.
+
+ error = event.jPlayer.error; // Saving object pointer, not a copy of the object. Possible garbage collection issue... But the player is dead anyway, so don't care.
+
+ if(error.type === $.jPlayer.error.URL) {
+ error.code = 4; // MEDIA_ERR_SRC_NOT_SUPPORTED since jPlayer makes this assumption. It is the most common error, then the decode error. Never seen either of the other 2 error types occur.
+ } else {
+ error.code = 0; // It was a jPlayer error, not an HTML5 media error.
+ }
+
+ if(DEBUG) console.log('Dispatched event: error');
+ if(DEBUG) console.dir(error);
+ media.dispatchEvent('error');
+ });
+ if(DEBUG) console.log('Created CUSTOM event handler for: error');
+
+ Popcorn.player.defineProperty( media, 'error', {
+ set: function() {
+ // Read-only property
+ return error;
+ },
+ get: function() {
+ return error;
+ }
+ });
+
+ Popcorn.player.defineProperty( media, 'currentTime', {
+ set: function( val ) {
+ if(jPlayerObj.status.paused) {
+ myPlayer.jPlayer('pause', val);
+ } else {
+ myPlayer.jPlayer('play', val);
+ }
+ return val;
+ },
+ get: function() {
+ return jPlayerObj.status.currentTime;
+ }
+ });
+
+ /* The joy of duration and the loadeddata event isReady() handler
+ * The duration is assumed to be a NaN or a valid duration.
+ * jPlayer uses zero instead of a NaN and this screws up the Popcorn track event start/end arrays padding.
+ * This line here:
+ * videoDurationPlus = duration != duration ? Number.MAX_VALUE : duration + 1;
+ * Not sure why it is not simply:
+ * videoDurationPlus = Number.MAX_VALUE; // Who cares if the padding is close to the real duration?
+ * So if you trigger loadeddata before the duration is correct, the track event padding is screwed up. (It pads the start, not the end... Well, duration+1 = 0+1 = 1s)
+ * That line makes the MP3 Flash fallback difficult to setup. The whole MP3 will need to load before the duration is known.
+ * Planning on using a NaN for duration until a >0 value is found... Except with MP3, where seekPercent must be 100% before setting the duration.
+ * Why not just use a NaN during init... And then correct the duration later?
+ */
+
+ Popcorn.player.defineProperty( media, 'duration', {
+ set: function() {
+ // Read-only property
+ if(ready) {
+ return duration;
+ } else {
+ return NaN;
+ }
+ },
+ get: function() {
+ if(ready) {
+ return duration; // Popcorn has initialized, we can now use duration zero or whatever without fear.
+ } else {
+ return NaN; // Keep the duration a NaN until after loadeddata event has occurred. Otherwise Popcorn track event padding is corrupted.
+ }
+ }
+ });
+
+ Popcorn.player.defineProperty( media, 'muted', {
+ set: function( val ) {
+ myPlayer.jPlayer('mute', val);
+ return jPlayerObj.options.muted;
+ },
+ get: function() {
+ return jPlayerObj.options.muted;
+ }
+ });
+
+ Popcorn.player.defineProperty( media, 'volume', {
+ set: function( val ) {
+ myPlayer.jPlayer('volume', val);
+ return jPlayerObj.options.volume;
+ },
+ get: function() {
+ return jPlayerObj.options.volume;
+ }
+ });
+
+ Popcorn.player.defineProperty( media, 'paused', {
+ set: function() {
+ // Read-only property
+ return jPlayerObj.status.paused;
+ },
+ get: function() {
+ return jPlayerObj.status.paused;
+ }
+ });
+
+ media.play = function() {
+ myPlayer.jPlayer('play');
+ };
+ media.pause = function() {
+ myPlayer.jPlayer('pause');
+ };
+
+ myPlayer.jPlayer(jpOptions); // Instance jPlayer. Note that the options should not have a ready event defined... Kill it by default?
+ jPlayerObj = myPlayer.data('jPlayer');
+
+ }(jQuery));
+ },
+
+ jPlayerCheck = function() {
+ if (!jQuery.jPlayer) {
+ if (!jPlayerDownloading) {
+ jPlayerDownloading = true;
+ Popcorn.getScript(JPLAYER_SCRIPT, function() {
+ jPlayerDownloading = false;
+ jPlayerInit();
+ });
+ } else {
+ setTimeout(jPlayerCheck, 250);
+ }
+ } else {
+ jPlayerInit();
+ }
+ },
+
+ jQueryCheck = function() {
+ if (!window.jQuery) {
+ if (!jQueryDownloading) {
+ jQueryDownloading = true;
+ Popcorn.getScript(JQUERY_SCRIPT, function() {
+ jQueryDownloading = false;
+ jPlayerCheck();
+ });
+ } else {
+ setTimeout(jQueryCheck, 250);
+ }
+ } else {
+ jPlayerCheck();
+ }
+ };
+
+ jQueryCheck();
+ },
+ _teardown: function() {
+ jQuery('#' + this.id).jPlayer('destroy');
+ }
+ });
+
+}(Popcorn));
\ No newline at end of file
diff --git a/install_full/ubuntu/airtime-full-install b/install_full/ubuntu/airtime-full-install
index 5b0522f73..5bd4a6485 100755
--- a/install_full/ubuntu/airtime-full-install
+++ b/install_full/ubuntu/airtime-full-install
@@ -29,10 +29,6 @@ echo "----------------------------------------------------"
dist=`lsb_release -is`
code=`lsb_release -cs`
-set +e
-apache2 -v | grep "2\.4" > /dev/null
-apacheversion=$?
-set -e
#enable squeeze backports to get lame packages
if [ "$dist" = "Debian" -a "$code" = "squeeze" ]; then
@@ -130,21 +126,27 @@ if [ "$server" = "nginx" ]; then
fi
else
apt-get -y --force-yes install apache2 libapache2-mod-php5
+ set +e
+ apache2 -v | grep "2\.4" > /dev/null
+ apacheversion=$?
+ set -e
+
+
# Apache Config File
echo "----------------------------------------------------"
echo "2.1 Apache Config File"
echo "----------------------------------------------------"
if [ "$apacheversion" != "1" ]; then
- airtimeconfigfile="airtime.conf"
+ airtimeconfigfile="airtime.conf"
else
- airtimeconfigfile="airtime"
+ airtimeconfigfile="airtime"
fi
if [ ! -f /etc/apache2/sites-available/$airtimeconfigfile ]; then
echo "Creating Apache config for Airtime..."
- cp $SCRIPTPATH/../apache/airtime-vhost /etc/apache2/sites-available/$airtimeconfigfile
+ cp $SCRIPTPATH/../apache/airtime-vhost /etc/apache2/sites-available/$airtimeconfigfile
a2dissite 000-default
a2ensite airtime
else