From 6fb9c6a30c4ef4c478d7accad7de963590d0ab74 Mon Sep 17 00:00:00 2001 From: Duncan Sommerville Date: Thu, 25 Jun 2015 14:13:09 -0400 Subject: [PATCH] SAAS-885, SAAS-857, SAAS-878 - Cosmetic fixes, remove js widget box in preferences --- airtime_mvc/application/Bootstrap.php | 87 +++++++++---------- .../application/forms/GeneralPreferences.php | 52 ----------- .../application/layouts/scripts/layout.phtml | 2 +- .../scripts/form/preferences_general.phtml | 2 - .../airtime/audiopreview/preview_jplayer.js | 4 +- .../public/js/airtime/common/common.js | 3 +- 6 files changed, 46 insertions(+), 104 deletions(-) diff --git a/airtime_mvc/application/Bootstrap.php b/airtime_mvc/application/Bootstrap.php index 578181189..37888c9ed 100644 --- a/airtime_mvc/application/Bootstrap.php +++ b/airtime_mvc/application/Bootstrap.php @@ -139,13 +139,14 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap $baseUrl = Application_Common_OsPath::getBaseDir(); - $view->headLink()->appendStylesheet($baseUrl . 'css/bootstrap.css?' . $CC_CONFIG['airtime_version']); - $view->headLink()->appendStylesheet($baseUrl . 'css/redmond/jquery-ui-1.8.8.custom.css?' . $CC_CONFIG['airtime_version']); - $view->headLink()->appendStylesheet($baseUrl . 'css/pro_dropdown_3.css?' . $CC_CONFIG['airtime_version']); - $view->headLink()->appendStylesheet($baseUrl . 'css/qtip/jquery.qtip.min.css?' . $CC_CONFIG['airtime_version']); - $view->headLink()->appendStylesheet($baseUrl . 'css/styles.css?' . $CC_CONFIG['airtime_version']); - $view->headLink()->appendStylesheet($baseUrl . 'css/masterpanel.css?' . $CC_CONFIG['airtime_version']); - $view->headLink()->appendStylesheet($baseUrl . 'css/tipsy/jquery.tipsy.css?' . $CC_CONFIG['airtime_version']); + $view->headLink(array('rel' => 'icon', 'href' => $baseUrl . 'favicon.ico', 'type' => 'image/x-icon'), 'PREPEND') + ->appendStylesheet($baseUrl . 'css/bootstrap.css?' . $CC_CONFIG['airtime_version']) + ->appendStylesheet($baseUrl . 'css/redmond/jquery-ui-1.8.8.custom.css?' . $CC_CONFIG['airtime_version']) + ->appendStylesheet($baseUrl . 'css/pro_dropdown_3.css?' . $CC_CONFIG['airtime_version']) + ->appendStylesheet($baseUrl . 'css/qtip/jquery.qtip.min.css?' . $CC_CONFIG['airtime_version']) + ->appendStylesheet($baseUrl . 'css/styles.css?' . $CC_CONFIG['airtime_version']) + ->appendStylesheet($baseUrl . 'css/masterpanel.css?' . $CC_CONFIG['airtime_version']) + ->appendStylesheet($baseUrl . 'css/tipsy/jquery.tipsy.css?' . $CC_CONFIG['airtime_version']); } protected function _initHeadScript() @@ -156,22 +157,22 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap $baseUrl = Application_Common_OsPath::getBaseDir(); - $view->headScript()->appendFile($baseUrl . 'js/libs/jquery-1.8.3.min.js?' . $CC_CONFIG['airtime_version'], 'text/javascript'); - $view->headScript()->appendFile($baseUrl . 'js/libs/jquery-ui-1.8.24.min.js?' . $CC_CONFIG['airtime_version'], 'text/javascript'); - $view->headScript()->appendFile($baseUrl . 'js/bootstrap/bootstrap.js?' . $CC_CONFIG['airtime_version'], 'text/javascript'); + $view->headScript()->appendFile($baseUrl . 'js/libs/jquery-1.8.3.min.js?' . $CC_CONFIG['airtime_version'], 'text/javascript') + ->appendFile($baseUrl . 'js/libs/jquery-ui-1.8.24.min.js?' . $CC_CONFIG['airtime_version'], 'text/javascript') + ->appendFile($baseUrl . 'js/bootstrap/bootstrap.js?' . $CC_CONFIG['airtime_version'], 'text/javascript') + ->appendFile($baseUrl . 'js/libs/underscore-min.js?' . $CC_CONFIG['airtime_version'], 'text/javascript') - $view->headScript()->appendFile($baseUrl . 'js/libs/underscore-min.js?' . $CC_CONFIG['airtime_version'], 'text/javascript'); + // ->appendFile($baseUrl . 'js/libs/jquery.stickyPanel.js?' . $CC_CONFIG['airtime_version'], 'text/javascript') + ->appendFile($baseUrl . 'js/qtip/jquery.qtip.js?' . $CC_CONFIG['airtime_version'], 'text/javascript') + ->appendFile($baseUrl . 'js/jplayer/jquery.jplayer.min.js?' . $CC_CONFIG['airtime_version'], 'text/javascript') + ->appendFile($baseUrl . 'js/sprintf/sprintf-0.7-beta1.js?' . $CC_CONFIG['airtime_version'], 'text/javascript') + ->appendFile($baseUrl . 'js/cookie/jquery.cookie.js?' . $CC_CONFIG['airtime_version'], 'text/javascript') + ->appendFile($baseUrl . 'js/i18n/jquery.i18n.js?' . $CC_CONFIG['airtime_version'], 'text/javascript') + ->appendFile($baseUrl . 'locale/general-translation-table?' . $CC_CONFIG['airtime_version'], 'text/javascript') + ->appendFile($baseUrl . 'locale/datatables-translation-table?' . $CC_CONFIG['airtime_version'], 'text/javascript') - // $view->headScript()->appendFile($baseUrl . 'js/libs/jquery.stickyPanel.js?' . $CC_CONFIG['airtime_version'], 'text/javascript'); - $view->headScript()->appendFile($baseUrl . 'js/qtip/jquery.qtip.js?' . $CC_CONFIG['airtime_version'], 'text/javascript'); - $view->headScript()->appendFile($baseUrl . 'js/jplayer/jquery.jplayer.min.js?' . $CC_CONFIG['airtime_version'], 'text/javascript'); - $view->headScript()->appendFile($baseUrl . 'js/sprintf/sprintf-0.7-beta1.js?' . $CC_CONFIG['airtime_version'], 'text/javascript'); - $view->headScript()->appendFile($baseUrl . 'js/cookie/jquery.cookie.js?' . $CC_CONFIG['airtime_version'], 'text/javascript'); - $view->headScript()->appendFile($baseUrl . 'js/i18n/jquery.i18n.js?' . $CC_CONFIG['airtime_version'], 'text/javascript'); - $view->headScript()->appendFile($baseUrl . 'locale/general-translation-table?' . $CC_CONFIG['airtime_version'], 'text/javascript'); - $view->headScript()->appendFile($baseUrl . 'locale/datatables-translation-table?' . $CC_CONFIG['airtime_version'], 'text/javascript'); - $view->headScript()->appendScript("$.i18n.setDictionary(general_dict)"); - $view->headScript()->appendScript("var baseUrl='$baseUrl'"); + ->appendScript("$.i18n.setDictionary(general_dict)") + ->appendScript("var baseUrl='$baseUrl'"); //These timezones are needed to adjust javascript Date objects on the client to make sense to the user's set timezone //or the server's set timezone. @@ -188,14 +189,14 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap } //scripts for now playing bar - $view->headScript()->appendFile($baseUrl . 'js/airtime/airtime_bootstrap.js?' . $CC_CONFIG['airtime_version'], 'text/javascript'); - $view->headScript()->appendFile($baseUrl . 'js/airtime/dashboard/helperfunctions.js?' . $CC_CONFIG['airtime_version'], 'text/javascript'); - $view->headScript()->appendFile($baseUrl . 'js/airtime/dashboard/dashboard.js?' . $CC_CONFIG['airtime_version'], 'text/javascript'); - $view->headScript()->appendFile($baseUrl . 'js/airtime/dashboard/versiontooltip.js?' . $CC_CONFIG['airtime_version'], 'text/javascript'); - $view->headScript()->appendFile($baseUrl . 'js/tipsy/jquery.tipsy.js?' . $CC_CONFIG['airtime_version'], 'text/javascript'); + $view->headScript()->appendFile($baseUrl . 'js/airtime/airtime_bootstrap.js?' . $CC_CONFIG['airtime_version'], 'text/javascript') + ->appendFile($baseUrl . 'js/airtime/dashboard/helperfunctions.js?' . $CC_CONFIG['airtime_version'], 'text/javascript') + ->appendFile($baseUrl . 'js/airtime/dashboard/dashboard.js?' . $CC_CONFIG['airtime_version'], 'text/javascript') + ->appendFile($baseUrl . 'js/airtime/dashboard/versiontooltip.js?' . $CC_CONFIG['airtime_version'], 'text/javascript') + ->appendFile($baseUrl . 'js/tipsy/jquery.tipsy.js?' . $CC_CONFIG['airtime_version'], 'text/javascript') - $view->headScript()->appendFile($baseUrl . 'js/airtime/common/common.js?' . $CC_CONFIG['airtime_version'], 'text/javascript'); - $view->headScript()->appendFile($baseUrl . 'js/airtime/common/audioplaytest.js?' . $CC_CONFIG['airtime_version'], 'text/javascript'); + ->appendFile($baseUrl . 'js/airtime/common/common.js?' . $CC_CONFIG['airtime_version'], 'text/javascript') + ->appendFile($baseUrl . 'js/airtime/common/audioplaytest.js?' . $CC_CONFIG['airtime_version'], 'text/javascript'); $user = Application_Model_User::getCurrentUser(); if (!is_null($user)) { @@ -205,23 +206,19 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap } $view->headScript()->appendScript("var userType = '$userType';"); - if (array_key_exists('REQUEST_URI', $_SERVER)) { //Doesn't exist for unit tests - if (strpos($_SERVER['REQUEST_URI'], $baseUrl . 'Dashboard/stream-player') === false - && strpos($_SERVER['REQUEST_URI'], $baseUrl . 'audiopreview/audio-preview') === false - && strpos($_SERVER['REQUEST_URI'], $baseUrl . 'audiopreview/playlist-preview') === false - && strpos($_SERVER['REQUEST_URI'], $baseUrl . 'audiopreview/block-preview') === false - && $_SERVER['REQUEST_URI'] != "/" - ) { - $plan_level = strval(Application_Model_Preference::GetPlanLevel()); - // Since the Hobbyist plan doesn't come with Live Chat support, don't enable it - if (Application_Model_Preference::GetLiveChatEnabled() && $plan_level !== 'hobbyist') { - $client_id = strval(Application_Model_Preference::GetClientId()); - $station_url = $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; - $view->headScript()->appendScript("var livechat_client_id = '$client_id';\n" . - "var livechat_plan_type = '$plan_level';\n" . - "var livechat_station_url = 'http://$station_url';"); - $view->headScript()->appendFile($baseUrl . 'js/airtime/common/livechat.js?' . $CC_CONFIG['airtime_version'], 'text/javascript'); - } + if (array_key_exists('REQUEST_URI', $_SERVER) //Doesn't exist for unit tests + && strpos($_SERVER['REQUEST_URI'], 'Dashboard/stream-player') === false + && strpos($_SERVER['REQUEST_URI'], 'audiopreview') === false + && $_SERVER['REQUEST_URI'] != "/") { + $plan_level = strval(Application_Model_Preference::GetPlanLevel()); + // Since the Hobbyist plan doesn't come with Live Chat support, don't enable it + if (Application_Model_Preference::GetLiveChatEnabled() && $plan_level !== 'hobbyist') { + $client_id = strval(Application_Model_Preference::GetClientId()); + $station_url = $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; + $view->headScript()->appendScript("var livechat_client_id = '$client_id';\n" . + "var livechat_plan_type = '$plan_level';\n" . + "var livechat_station_url = 'http://$station_url';"); + $view->headScript()->appendFile($baseUrl . 'js/airtime/common/livechat.js?' . $CC_CONFIG['airtime_version'], 'text/javascript'); } } diff --git a/airtime_mvc/application/forms/GeneralPreferences.php b/airtime_mvc/application/forms/GeneralPreferences.php index b8a066e3e..aa2906d82 100644 --- a/airtime_mvc/application/forms/GeneralPreferences.php +++ b/airtime_mvc/application/forms/GeneralPreferences.php @@ -117,16 +117,6 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm )); $this->addElement($third_party_api); - // Add the description element - $this->addElement('textarea', 'widgetCode', array( - 'label' => 'Javascript Code:', - 'required' => false, - 'readonly' => true, - 'style' => 'font-family: Consolas, "Liberation Mono", Courier, - monospace;', - 'value' => self::getWidgetCode(), - )); - $locale = new Zend_Form_Element_Select("locale"); $locale->setLabel(_("Default Language")); $locale->setMultiOptions(Application_Model_Locale::getLocales()); @@ -148,48 +138,6 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm $this->addElement($week_start_day); } - private static function getWidgetCode() { - - $host = $_SERVER['SERVER_NAME']; - $code = << section of your HTML page --> - - - - - - -
-
-
- - -CODE; - - return $code; - } - private function getWeekStartDays() { $days = array( diff --git a/airtime_mvc/application/layouts/scripts/layout.phtml b/airtime_mvc/application/layouts/scripts/layout.phtml index c3f5f5e2d..780a5f69e 100644 --- a/airtime_mvc/application/layouts/scripts/layout.phtml +++ b/airtime_mvc/application/layouts/scripts/layout.phtml @@ -2,7 +2,7 @@ - headTitle() ?> + headTitle() ?> headLink() ?> headScript() ?> google_analytics)?$this->google_analytics:"" ?> diff --git a/airtime_mvc/application/views/scripts/form/preferences_general.phtml b/airtime_mvc/application/views/scripts/form/preferences_general.phtml index de1f1c73f..614416765 100644 --- a/airtime_mvc/application/views/scripts/form/preferences_general.phtml +++ b/airtime_mvc/application/views/scripts/form/preferences_general.phtml @@ -37,7 +37,5 @@ element->getElement('thirdPartyApi')->render() ?> - element->getElement('widgetCode')->render() ?> - diff --git a/airtime_mvc/public/js/airtime/audiopreview/preview_jplayer.js b/airtime_mvc/public/js/airtime/audiopreview/preview_jplayer.js index 01badc43d..e01c2a2b3 100644 --- a/airtime_mvc/public/js/airtime/audiopreview/preview_jplayer.js +++ b/airtime_mvc/public/js/airtime/audiopreview/preview_jplayer.js @@ -198,7 +198,7 @@ function buildplaylist(p_url, p_playIndex) { width = 490; } - window.resizeTo(width, height); + window.resizeTo(width, height); }); } @@ -247,6 +247,4 @@ function playOne(uri, mime) { _playlist_jplayer.setPlaylist(playlist); _playlist_jplayer.play(0); } - - window.resizeTo(490, 167); } diff --git a/airtime_mvc/public/js/airtime/common/common.js b/airtime_mvc/public/js/airtime/common/common.js index 31f4668bf..33e1fe300 100644 --- a/airtime_mvc/public/js/airtime/common/common.js +++ b/airtime_mvc/public/js/airtime/common/common.js @@ -143,7 +143,8 @@ function open_show_preview(p_showID, p_showIndex) { } function openPreviewWindow(url) { - _preview_window = window.open(url, $.i18n._('Audio Player'), 'width=450,height=100,scrollbars=yes'); + // Hardcoding this here is kinda gross, but the alternatives aren't much better... + _preview_window = window.open(url, $.i18n._('Audio Player'), 'width=482,height=110,scrollbars=yes'); return false; }