diff --git a/CREDITS b/CREDITS index b52ae289e..e0dade73d 100644 --- a/CREDITS +++ b/CREDITS @@ -25,6 +25,7 @@ Community Contributors: John Chewter + Version 2.5.0 ------------- diff --git a/airtime_mvc/application/forms/AddShowWhen.php b/airtime_mvc/application/forms/AddShowWhen.php index 43bba21f5..d6edbe0cd 100644 --- a/airtime_mvc/application/forms/AddShowWhen.php +++ b/airtime_mvc/application/forms/AddShowWhen.php @@ -209,8 +209,12 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm $interval = 'P21D'; } elseif ($formData["add_show_repeat_type"] == 5) { $interval = 'P28D'; - } elseif ($formData["add_show_repeat_type"] == 2) { + } elseif ($formData["add_show_repeat_type"] == 2 && $formData["add_show_monthly_repeat_type"] == 2) { $interval = 'P1M'; + } elseif ($formData["add_show_repeat_type"] == 2 && $formData["add_show_monthly_repeat_type"] == 3) { + list($weekNumberOfMonth, $dayOfWeek) = + Application_Service_ShowService::getMonthlyWeeklyRepeatInterval( + new DateTime($start_time, $showTimezone)); } /* Check first show @@ -274,12 +278,26 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm $this->getElement('add_show_duration')->setErrors(array(_('Cannot schedule overlapping shows'))); break 1; } else { - $repeatShowStart->setTimezone($showTimezone); - $repeatShowEnd->setTimezone($showTimezone); - $repeatShowStart->add(new DateInterval($interval)); - $repeatShowEnd->add(new DateInterval($interval)); - $repeatShowStart->setTimezone($utc); - $repeatShowEnd->setTimezone($utc); + if ($formData["add_show_repeat_type"] == 2 && $formData["add_show_monthly_repeat_type"] == 3) { + $monthlyWeeklyStart = new DateTime($repeatShowStart->format("Y-m"), + new DateTimeZone("UTC")); + $monthlyWeeklyStart->add(new DateInterval("P1M")); + $repeatShowStart = clone Application_Service_ShowService::getNextMonthlyWeeklyRepeatDate( + $monthlyWeeklyStart, + $formData["add_show_timezone"], + $formData['add_show_start_time'], + $weekNumberOfMonth, + $dayOfWeek); + $repeatShowEnd = clone $repeatShowStart; + $repeatShowEnd->add(new DateInterval("PT".$hours."H".$minutes."M")); + } else { + $repeatShowStart->setTimezone($showTimezone); + $repeatShowEnd->setTimezone($showTimezone); + $repeatShowStart->add(new DateInterval($interval)); + $repeatShowEnd->add(new DateInterval($interval)); + $repeatShowStart->setTimezone($utc); + $repeatShowEnd->setTimezone($utc); + } } } } diff --git a/airtime_mvc/application/forms/SmartBlockCriteria.php b/airtime_mvc/application/forms/SmartBlockCriteria.php index 990d5bde9..5423ab657 100644 --- a/airtime_mvc/application/forms/SmartBlockCriteria.php +++ b/airtime_mvc/application/forms/SmartBlockCriteria.php @@ -4,6 +4,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm private $criteriaOptions; private $stringCriteriaOptions; private $numericCriteriaOptions; + private $sortOptions; private $limitOptions; /* We need to know if the criteria value will be a string @@ -122,6 +123,17 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm } return $this->limitOptions; } + private function getSortOptions() + { + if (!isset($this->sortOptions)) { + $this->sortOptions = array( + "random" => _("random"), + "newest" => _("newest"), + "oldest" => _("oldest") + ); + } + return $this->sortOptions; + } public function init() @@ -288,6 +300,15 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm } $this->addElement($repeatTracks); + $sort = new Zend_Form_Element_Select('sp_sort_options'); + $sort->setAttrib('class', 'sp_input_select') + ->setDecorators(array('viewHelper')) + ->setMultiOptions($this->getSortOptions()); + if (isset($storedCrit["sort"])) { + $sort->setValue($storedCrit["sort"]["value"]); + } + $this->addElement($sort); + $limit = new Zend_Form_Element_Select('sp_limit_options'); $limit->setAttrib('class', 'sp_input_select') ->setDecorators(array('viewHelper')) @@ -344,7 +365,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm public function preValidation($params) { - $data = Application_Model_Block::organizeSmartPlyalistCriteria($params['data']); + $data = Application_Model_Block::organizeSmartPlaylistCriteria($params['data']); // add elelments that needs to be added // set multioption for modifier according to criteria_field $modRowMap = array(); diff --git a/airtime_mvc/application/models/Block.php b/airtime_mvc/application/models/Block.php index 8ea3593b1..4f87cd928 100644 --- a/airtime_mvc/application/models/Block.php +++ b/airtime_mvc/application/models/Block.php @@ -1156,7 +1156,7 @@ SQL; */ public function saveSmartBlockCriteria($p_criteria) { - $data = $this->organizeSmartPlyalistCriteria($p_criteria); + $data = $this->organizeSmartPlaylistCriteria($p_criteria); // saving dynamic/static flag $blockType = $data['etc']['sp_type'] == 0 ? 'static':'dynamic'; $this->saveType($blockType); @@ -1224,6 +1224,16 @@ SQL; } } + // insert sort info + $qry = new CcBlockcriteria(); + $qry->setDbCriteria("sort") + ->setDbModifier("N/A") + ->setDbValue($p_criteriaData['etc']['sp_sort_options']) + ->setDbBlockId($this->id) + ->save(); + + + // insert limit info $qry = new CcBlockcriteria(); $qry->setDbCriteria("limit") @@ -1231,7 +1241,8 @@ SQL; ->setDbValue($p_criteriaData['etc']['sp_limit_value']) ->setDbBlockId($this->id) ->save(); - + + // insert repeate track option $qry = new CcBlockcriteria(); $qry->setDbCriteria("repeat_tracks") @@ -1352,6 +1363,7 @@ SQL; "isrc_number" => _("ISRC"), "label" => _("Label"), "language" => _("Language"), + "utime" => _("Upload Time"), "mtime" => _("Last Modified"), "lptime" => _("Last Played"), "length" => _("Length"), @@ -1399,6 +1411,8 @@ SQL; "display_modifier"=>_($modifier)); } else if($criteria == "repeat_tracks") { $storedCrit["repeat_tracks"] = array("value"=>$value); + } else if($criteria == "sort") { + $storedCrit["sort"] = array("value"=>$value); } else { $storedCrit["crit"][$criteria][] = array( "criteria"=>$criteria, @@ -1507,8 +1521,20 @@ SQL; // check if file exists $qry->add("file_exists", "true", Criteria::EQUAL); $qry->add("hidden", "false", Criteria::EQUAL); + if (isset($storedCrit['sort'])) { + $sortTracks = $storedCrit['sort']['value']; + } + if ($sortTracks == 'newest') { + $qry->addDescendingOrderByColumn('utime'); + } + else if ($sortTracks == 'oldest') { + $qry->addAscendingOrderByColumn('utime'); + } + else { $qry->addAscendingOrderByColumn('random()'); } + + } // construct limit restriction $limits = array(); @@ -1537,9 +1563,8 @@ SQL; Logging::info($e); } } - - public static function organizeSmartPlyalistCriteria($p_criteria) - { + public static function organizeSmartPlaylistCriteria($p_criteria) + { $fieldNames = array('sp_criteria_field', 'sp_criteria_modifier', 'sp_criteria_value', 'sp_criteria_extra'); $output = array(); foreach ($p_criteria as $ele) { diff --git a/airtime_mvc/application/models/Webstream.php b/airtime_mvc/application/models/Webstream.php index a7e7d82b1..007e78938 100644 --- a/airtime_mvc/application/models/Webstream.php +++ b/airtime_mvc/application/models/Webstream.php @@ -88,11 +88,19 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable public static function deleteStreams($p_ids, $p_userId) { - $leftOver = self::streamsNotOwnedByUser($p_ids, $p_userId); - if (count($leftOver) == 0) { - CcWebstreamQuery::create()->findPKs($p_ids)->delete(); + $userInfo = Zend_Auth::getInstance()->getStorage()->read(); + $user = new Application_Model_User($userInfo->id); + $isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER)); + + if (!$isAdminOrPM) { + $leftOver = self::streamsNotOwnedByUser($p_ids, $p_userId); + if (count($leftOver) == 0) { + CcWebstreamQuery::create()->findPKs($p_ids)->delete(); + } else { + throw new WebstreamNoPermissionException; + } } else { - throw new WebstreamNoPermissionException; + CcWebstreamQuery::create()->findPKs($p_ids)->delete(); } } diff --git a/airtime_mvc/application/modules/rest/controllers/MediaController.php b/airtime_mvc/application/modules/rest/controllers/MediaController.php index 221cfb631..d0a015f16 100644 --- a/airtime_mvc/application/modules/rest/controllers/MediaController.php +++ b/airtime_mvc/application/modules/rest/controllers/MediaController.php @@ -26,8 +26,8 @@ class Rest_MediaController extends Zend_Rest_Controller public function init() { $this->view->layout()->disableLayout(); - // Remove reliance on .phtml files to render requests - $this->_helper->viewRenderer->setNoRender(true); + // Remove reliance on .phtml files to render requests + $this->_helper->viewRenderer->setNoRender(true); } public function indexAction() @@ -83,7 +83,7 @@ class Rest_MediaController extends Zend_Rest_Controller public function getAction() { if (!$this->verifyAuth(true, true)) - { + { return; } @@ -286,11 +286,7 @@ class Rest_MediaController extends Zend_Rest_Controller $observed_csrf_token = $token; $expected_csrf_token = $current_namespace->authtoken; - if($observed_csrf_token == $expected_csrf_token){ - return true; - }else{ - return false; - } + return ($observed_csrf_token === $expected_csrf_token); } private function verifyAuth($checkApiKey, $checkSession) @@ -301,7 +297,7 @@ class Rest_MediaController extends Zend_Rest_Controller if(!$this->verifyCSRFToken($this->_getParam('csrf_token'))){ $resp = $this->getResponse(); $resp->setHttpResponseCode(401); - $resp->appendBody("ERROR: Token Missmatch."); + $resp->appendBody("ERROR: Token Mismatch."); return false; } return true; @@ -331,24 +327,13 @@ class Rest_MediaController extends Zend_Rest_Controller $encodedRequestApiKey = substr($authHeader, strlen("Basic ")); $encodedStoredApiKey = base64_encode($CC_CONFIG["apiKey"][0] . ":"); - if ($encodedRequestApiKey === $encodedStoredApiKey) - { - return true; - } else { - return false; - } - - return false; + return ($encodedRequestApiKey === $encodedStoredApiKey); } private function verifySession() { $auth = Zend_Auth::getInstance(); - if ($auth->hasIdentity()) - { - return true; - } - return false; + return ($auth->hasIdentity()); //Token checking stub code. We'd need to change LoginController.php to generate a token too, but //but luckily all the token code already exists and works. @@ -458,7 +443,7 @@ class Rest_MediaController extends Zend_Rest_Controller return $service_user->getCurrentUser()->getDbId(); } else { $defaultOwner = CcSubjsQuery::create() - ->filterByDbType('A') + ->filterByDbType(array('A', 'S'), Criteria::IN) ->orderByDbId() ->findOne(); if (!$defaultOwner) { @@ -474,23 +459,21 @@ class Rest_MediaController extends Zend_Rest_Controller } /** - * + * * Strips out fields from incoming request data that should never be modified * from outside of Airtime - * @param array $data + * + * @param array $data */ - private static function removeBlacklistedFieldsFromRequestData($data) - { + private static function removeBlacklistedFieldsFromRequestData($data) { foreach (self::$blackList as $key) { unset($data[$key]); } - - return $data; - } + + return $data; + } - - private function removeEmptySubFolders($path) - { + private function removeEmptySubFolders($path) { exec("find $path -empty -type d -delete"); } diff --git a/airtime_mvc/application/services/ShowService.php b/airtime_mvc/application/services/ShowService.php index 362f3a327..9bd509bb8 100644 --- a/airtime_mvc/application/services/ShowService.php +++ b/airtime_mvc/application/services/ShowService.php @@ -1133,7 +1133,7 @@ SQL; $start = $this->getNextRepeatingPopulateStartDateTime($showDay); if (is_null($repeatInterval)&& $repeatType == REPEAT_MONTHLY_WEEKLY) { - $repeatInterval = $this->getMonthlyWeeklyRepeatInterval($start, $timezone); + $repeatInterval = self::getMonthlyWeeklyRepeatInterval($start, $timezone); } //DatePeriod in user's local time @@ -1236,7 +1236,7 @@ SQL; // We will only need this if the repeat type is MONTHLY_WEEKLY list($weekNumberOfMonth, $dayOfWeek) = - $this->getMonthlyWeeklyRepeatInterval( + self::getMonthlyWeeklyRepeatInterval( new DateTime($first_show, new DateTimeZone($timezone))); $this->repeatType = $showDay->getDbRepeatType(); @@ -1296,7 +1296,7 @@ SQL; $monthlyWeeklyStart = new DateTime($utcStartDateTime->format("Y-m"), new DateTimeZone("UTC")); $monthlyWeeklyStart->add(new DateInterval("P1M")); - $start = $this->getNextMonthlyWeeklyRepeatDate( + $start = self::getNextMonthlyWeeklyRepeatDate( $monthlyWeeklyStart, $timezone, $showDay->getDbStartTime(), @@ -1318,7 +1318,7 @@ SQL; * @param string $showStart * @param string $timezone user's local timezone */ - private function getMonthlyWeeklyRepeatInterval($showStart) + public static function getMonthlyWeeklyRepeatInterval($showStart) { $start = clone $showStart; $dayOfMonth = $start->format("j"); @@ -1393,7 +1393,7 @@ SQL; * @param string (i.e. 'first', 'second') $weekNumberOfMonth * @param string (i.e. 'Monday') $dayOfWeek */ - private function getNextMonthlyWeeklyRepeatDate( + public static function getNextMonthlyWeeklyRepeatDate( $start, $timezone, $startTime, diff --git a/airtime_mvc/application/views/scripts/form/smart-block-criteria.phtml b/airtime_mvc/application/views/scripts/form/smart-block-criteria.phtml index b0ccc274a..9da7ca765 100644 --- a/airtime_mvc/application/views/scripts/form/smart-block-criteria.phtml +++ b/airtime_mvc/application/views/scripts/form/smart-block-criteria.phtml @@ -95,7 +95,18 @@
- +
+ Sort tracks by + element->getElement('sp_sort_options') ?> + element->getElement("sp_sort_options")->hasErrors()) : ?> + element->getElement("sp_sort_options")->getMessages() as $error): ?> + + + + + +
+
element->getElement('sp_limit_value')->getLabel() ?> element->getElement('sp_limit_value')?> diff --git a/airtime_mvc/locale/hu_HU/LC_MESSAGES/airtime.mo b/airtime_mvc/locale/hu_HU/LC_MESSAGES/airtime.mo index 761abbc13..aa2396685 100644 Binary files a/airtime_mvc/locale/hu_HU/LC_MESSAGES/airtime.mo and b/airtime_mvc/locale/hu_HU/LC_MESSAGES/airtime.mo differ diff --git a/airtime_mvc/locale/hu_HU/LC_MESSAGES/airtime.po b/airtime_mvc/locale/hu_HU/LC_MESSAGES/airtime.po index 5413355a8..e44998f99 100644 --- a/airtime_mvc/locale/hu_HU/LC_MESSAGES/airtime.po +++ b/airtime_mvc/locale/hu_HU/LC_MESSAGES/airtime.po @@ -99,6 +99,8 @@ msgid "" "%1$s copyright © %2$s All rights reserved.%3$sMaintained and " "distributed under the %4$s by %5$s" msgstr "" +"%1$s szerzői & másolási jog; %2$s Minden jog fenntartva.%3$sFejleszti és " +"forgalmazza %4$s alatt a %5$s" #: airtime_mvc/application/layouts/scripts/livestream.phtml:9 #: airtime_mvc/application/views/scripts/dashboard/stream-player.phtml:2 @@ -1311,19 +1313,17 @@ msgstr "Állomás Logó:" msgid "Send support feedback" msgstr "Támogatási Visszajelzés Küldése" -#: airtime_mvc/application/forms/SupportSettings.php:121 -#: airtime_mvc/application/forms/RegisterAirtime.php:126 #: airtime_mvc/application/forms/SupportSettings.php:122 +#: airtime_mvc/application/forms/RegisterAirtime.php:126 #, php-format msgid "Promote my station on %s" -msgstr "" +msgstr "Az állomásom közzététele a %s-on" -#: airtime_mvc/application/forms/SupportSettings.php:133 -#: airtime_mvc/application/forms/RegisterAirtime.php:151 #: airtime_mvc/application/forms/SupportSettings.php:150 +#: airtime_mvc/application/forms/RegisterAirtime.php:151 #, php-format msgid "By checking this box, I agree to %s's %sprivacy policy%s." -msgstr "" +msgstr "A mező bejelölésével, elfogadom a %s %sadatvédelmi irányelveit%s." #: airtime_mvc/application/forms/SupportSettings.php:156 #: airtime_mvc/application/forms/RegisterAirtime.php:169 @@ -1364,7 +1364,7 @@ msgstr "Újraközvetítés?" #: airtime_mvc/application/forms/AddShowLiveStream.php:10 #, php-format msgid "Use %s Authentication:" -msgstr "" +msgstr "%s Hitelesítés Használata:" #: airtime_mvc/application/forms/AddShowLiveStream.php:16 msgid "Use Custom Authentication:" @@ -3198,15 +3198,12 @@ msgstr "Az Ön számára nem érhető el az alábbi erőforrás." msgid "You are not allowed to access this resource. " msgstr "Az Ön számára nem érhető el az alábbi erőforrás." -#: airtime_mvc/application/controllers/ApiController.php:848 -#: airtime_mvc/application/controllers/ApiController.php:868 -#: airtime_mvc/application/controllers/ApiController.php:880 #: airtime_mvc/application/controllers/ApiController.php:771 #: airtime_mvc/application/controllers/ApiController.php:791 #: airtime_mvc/application/controllers/ApiController.php:803 #, php-format msgid "File does not exist in %s" -msgstr "" +msgstr "A fájl nem elérhető itt: %s" #: airtime_mvc/application/controllers/ApiController.php:931 #: airtime_mvc/application/controllers/ApiController.php:854 @@ -3466,7 +3463,7 @@ msgstr "Memória" #: airtime_mvc/application/views/scripts/systemstatus/index.phtml:14 #, php-format msgid "%s Version" -msgstr "" +msgstr "%s Verzió" #: airtime_mvc/application/views/scripts/systemstatus/index.phtml:30 msgid "Disk Space" @@ -3548,12 +3545,16 @@ msgid "" "collected regularly in order to enhance your user experience.%2$sClick 'Yes, " "help %1$s' and we'll make sure the features you use are constantly improving." msgstr "" +"Segítsen az %1$s fejlesztésében, tudassa velünk az ötleteit. Az információk " +"gyűjtése fokozza a felhasználás élményét.%2$sKlikk 'Igen, segítek az %1$s-" +"nak' fejlesztésében, és igyekszek folyamatosan a funkciók használatának " +"javításain fáradozni. " #: airtime_mvc/application/views/scripts/form/register-dialog.phtml:29 #: airtime_mvc/application/views/scripts/form/support-setting.phtml:29 #, php-format msgid "Click the box below to promote your station on %s." -msgstr "" +msgstr "Jelöld be a mezőt az állomásod közzétételéhez a %s-on." #: airtime_mvc/application/views/scripts/form/register-dialog.phtml:67 #: airtime_mvc/application/views/scripts/form/register-dialog.phtml:81 @@ -3604,6 +3605,8 @@ msgid "" "Rescan watched directory (This is useful if it is network mount and may be " "out of sync with %s)" msgstr "" +"A figyelt mappa újraellenőrzése (Ez akkor hasznos, ha a hálózati csatolás " +"nincs szinkronban az %s-al)" #: airtime_mvc/application/views/scripts/form/preferences_watched_dirs.phtml:44 msgid "Remove watched directory" @@ -3932,12 +3935,13 @@ msgstr "Hallgatói Statisztika" #: airtime_mvc/application/views/scripts/dashboard/help.phtml:3 #, php-format msgid "Welcome to %s!" -msgstr "" +msgstr "Üdvözöljük az %s-nál!" #: airtime_mvc/application/views/scripts/dashboard/help.phtml:4 #, php-format msgid "Here's how you can get started using %s to automate your broadcasts: " msgstr "" +"Itt van, hogyan tudod elindítani adásaid automatizálását használva az %s-t:" #: airtime_mvc/application/views/scripts/dashboard/help.phtml:7 msgid "" @@ -3997,11 +4001,13 @@ msgid "" "%1$s %2$s, the open radio software for scheduling and remote station " "management." msgstr "" +"%1$s %2$s, a nyitott rádiós szoftver, az ütemezett és távoli állomás " +"menedzsment." #: airtime_mvc/application/views/scripts/dashboard/about.phtml:22 #, php-format msgid "%1$s %2$s is distributed under the %3$s" -msgstr "" +msgstr "%1$s %2$s-ot %3$s mellett terjesztik" #: airtime_mvc/application/views/scripts/login/password-change.phtml:3 msgid "New password" @@ -4037,6 +4043,8 @@ msgid "" "Welcome to the %s demo! You can log in using the username 'admin' and the " "password 'admin'." msgstr "" +"Üdvözöljük az %s demó változatában! Jelentkezzen be 'admin' " +"felhasználónévvel és 'admin' jelszóval." #: airtime_mvc/application/views/scripts/partialviews/header.phtml:3 msgid "Previous:" @@ -4421,6 +4429,7 @@ msgstr "" #: airtime_mvc/application/models/Scheduler.php:195 msgid "Cannot schedule a playlist that contains missing files." msgstr "" +"Nem lehet ütemezni olyan lejátszási listát, amely tartalmaz hiányzó fájlokat." #: airtime_mvc/application/models/Scheduler.php:216 #: airtime_mvc/application/models/Scheduler.php:305 @@ -4480,7 +4489,7 @@ msgstr "" #: airtime_mvc/application/models/Auth.php:36 #, php-format msgid "%s Password Reset" -msgstr "" +msgstr "%s Jelszó Visszaállítás" #: airtime_mvc/application/services/CalendarService.php:50 msgid "Record file doesn't exist" @@ -4679,11 +4688,16 @@ msgid "" "the 'Send support feedback' box and we'll make sure the features you use are " "constantly improving." msgstr "" +"Segítse az %s fejlesztését azáltal, hogy a %s tudja, hogy Ön, hogyan " +"használja azt. Információk összegyűjtése céljából, rendszerezve azokat, hogy " +"fokozza a felhasználás élményét.%sKlikkeljen a 'Támogatási Visszajelzés " +"Küldése' mezőbe és győződjön meg arról, hogy a funkciók használatának " +"minősége folyamatosan javul." #: airtime_mvc/application/views/scripts/partialviews/trialBox.phtml:9 #, php-format msgid "Purchase your copy of %s" -msgstr "" +msgstr "Vásárolja meg az Ön %s másolatát" #~ msgid "Promote my station on Sourcefabric.org" #~ msgstr "Az állomásom közzététele a Sourcefabric.org-on" diff --git a/airtime_mvc/public/css/styles.css b/airtime_mvc/public/css/styles.css index ccd5f201f..2e56c23d7 100644 --- a/airtime_mvc/public/css/styles.css +++ b/airtime_mvc/public/css/styles.css @@ -10,6 +10,7 @@ body { } html, body { height: 100%; + background: #7f7f7f; } #login-page { @@ -896,13 +897,23 @@ input[type="checkbox"] { } /*---//////////////////// LOGIN & PASSWORD RESET ////////////////////---*/ -#csrf-label, #csrf-element { - /* Remove any visible csrf form token footprint */ +/* Remove any visible csrf form token footprint */ +#csrf-label { height: 0; padding: 0; margin: 0; } +#csrf-element { + height: 8px; + padding: 0; + margin: 0; +} + +#csrf-label .errors li, #csrf-element .errors li { + margin: 0; +} + .login_box { margin: 0 auto 0 auto; text-align:center; diff --git a/airtime_mvc/public/js/airtime/showbuilder/builder.js b/airtime_mvc/public/js/airtime/showbuilder/builder.js index 4f03e6dfa..139660dd7 100644 --- a/airtime_mvc/public/js/airtime/showbuilder/builder.js +++ b/airtime_mvc/public/js/airtime/showbuilder/builder.js @@ -1059,7 +1059,10 @@ var AIRTIME = (function(AIRTIME){ ""); } - $toolbar.append($menu); + if (localStorage.getItem('user-type') != 'G') { + $toolbar.append($menu); + } + $menu = undefined; $('#timeline-sa').click(function(){mod.selectAll();}); diff --git a/utils/upgrade.py b/utils/upgrade.py new file mode 100755 index 000000000..d77ab86dc --- /dev/null +++ b/utils/upgrade.py @@ -0,0 +1,54 @@ +#!/usr/bin/python + +import ConfigParser +import argparse +import requests +from urlparse import urlparse +import sys + +CONFIG_PATH='/etc/airtime/airtime.conf' +GENERAL_CONFIG_SECTION = "general" + +def read_config_file(config_path): + """Parse the application's config file located at config_path.""" + config = ConfigParser.SafeConfigParser() + try: + config.readfp(open(config_path)) + except IOError as e: + print "Failed to open config file at " + config_path + ": " + e.strerror + exit(-1) + except Exception: + print e.strerror + exit(-1) + + return config + +if __name__ == '__main__': + config = read_config_file(CONFIG_PATH) + api_key = config.get(GENERAL_CONFIG_SECTION, 'api_key') + base_url = config.get(GENERAL_CONFIG_SECTION, 'base_url') + base_dir = config.get(GENERAL_CONFIG_SECTION, 'base_dir') + action = "upgrade" + airtime_url = "" + + parser = argparse.ArgumentParser() + parser.add_argument('--downgrade', help='Downgrade the station', action="store_true") + parser.add_argument('station_url', help='station URL', nargs='?', default='') + args = parser.parse_args() + + if args.downgrade: + action = "downgrade" + + if airtime_url == "": + airtime_url = "http://%s%s" % (base_url, base_dir) + + # Add http:// if you were lazy and didn't pass a scheme to this script + url = urlparse(airtime_url) + if not url.scheme: + airtime_url = "http://%s" % airtime_url + + print "Requesting %s..." % action + r = requests.get("%s/%s" % (airtime_url, action), auth=(api_key, '')) + print r.text + r.raise_for_status() +