diff --git a/airtime_mvc/application/common/Billing.php b/airtime_mvc/application/common/Billing.php index 5a28aff8c..137451172 100644 --- a/airtime_mvc/application/common/Billing.php +++ b/airtime_mvc/application/common/Billing.php @@ -329,150 +329,4 @@ class Billing $result = Billing::makeRequest($credentials["url"], $query_string); } - /** - * Returns an array of the current Airtime Pro plan IDs. - * This excludes any old, free, promotional, or custom plans. - */ - public static function getCurrentPaidProductIds() - { - $products = self::getProducts(); - $productIds = array(); - foreach ($products as $k => $p) { - array_push($productIds, $p["pid"]); - } - - return $productIds; - } - - /** - * Returns an array of the Awesome August 2015 Promotional plans - */ - public static function getAwesomeAugustPromoProducts() - { - $credentials = self::getAPICredentials(); - - $postfields = array(); - $postfields["username"] = $credentials["username"]; - $postfields["password"] = md5($credentials["password"]); - $postfields["action"] = "getproducts"; - $postfields["responsetype"] = "json"; - //gid is the Airtime product group id on whmcs - $postfields["gid"] = WHMCS_AIRTIME_GROUP_ID; - - $query_string = ""; - foreach ($postfields AS $k=>$v) $query_string .= "$k=".urlencode($v)."&"; - - $result = self::makeRequest($credentials["url"], $query_string); - $promoProducts = $result["products"]["product"]; - - foreach ($promoProducts as $k => $p) { - if (strpos($p["name"], "Awesome August 2015") === false) { - unset($promoProducts[$k]); - } - } - - return $promoProducts; - } - - /** - * Returns the eligible promo plan ID that corresponds to the regular paid plan. - * - * i.e. if the client wants to upgrade to the Plus plan this function returns the - * plan id of the Awesome August 2015 Plus plan. - */ - public static function getEligibleAwesomeAugustPromoPlanId($productName) - { - $promoPlans = self::getAwesomeAugustPromoProducts(); - $promoPlanId = ""; - - foreach($promoPlans as $k => $p) { - if (strpos($p["name"], $productName) !== false) { - $promoPlanId = $p["pid"]; - break; - } - } - - return $promoPlanId; - } - - public static function getProductName($productId) - { - $products = self::getProducts(); - $productName = ""; - - foreach($products as $k => $p) { - if ($p["pid"] == $productId) { - $productName = $p["name"]; - break; - } - } - - return $productName; - } - - public static function isClientEligibleForPromo($newProductId, $newProductBillingCycle) - { - // use this to check if client is upgrading from an old plan - $currentPaidPlanProductIds = self::getCurrentPaidProductIds(); - - $currentPlanProduct = self::getClientCurrentAirtimeProduct(); - $currentPlanProductId = $currentPlanProduct["pid"]; - $currentPlanBillingCycle = strtolower($currentPlanProduct["billingcycle"]); - - if (self::isClientOnAwesomeAugustPromoPlan($currentPlanProductId)) { - - $newEligiblePromoId = self::getEligibleAwesomeAugustPromoPlanId( - self::getProductName($newProductId) - ); - - if ($newProductBillingCycle == "annually" || $newEligiblePromoId > $currentPlanProductId) { - return true; - } else { - return false; - } - } - - // if client is on trial plan, YES - if ($currentPlanProductId == AIRTIME_PRO_FREE_TRIAL_PLAN_ID) { - return true; - } - - // if client is currently on monthly or annually or old/free plan AND (upgrading OR upgrading/downgrading to annual plan), YES - if ($currentPlanBillingCycle == "monthly" || $currentPlanBillingCycle == "free account" - || $currentPlanBillingCycle == "annually") { - // is the client changing billing cycle to annual? - if ($newProductBillingCycle == "annually") { - return true; - } - - // Is the client staying on monthly and upgrading? - // This won't hold true if the client is on an old/free plan because the - // old/free plan ids are higher than the current paid plan ids. - if ($newProductBillingCycle == "monthly" && $newProductId > $currentPlanProductId) { - return true; - } - - // Is the client staying on monthly and upgrading from an old plan? - if ($newProductBillingCycle == "monthly" && !in_array($currentPlanProductId, $currentPaidPlanProductIds) - && in_array($newProductId, $currentPaidPlanProductIds)) { - return true; - } - } - - return false; - } - - public static function isClientOnAwesomeAugustPromoPlan($currentPlanId) - { - $promoPlans = self::getAwesomeAugustPromoProducts(); - - foreach ($promoPlans as $k => $p) { - if ($p["pid"] == $currentPlanId) { - return true; - } - } - - return false; - } - } diff --git a/airtime_mvc/application/common/Timezone.php b/airtime_mvc/application/common/Timezone.php index 7da82f6f9..5e12338e2 100644 --- a/airtime_mvc/application/common/Timezone.php +++ b/airtime_mvc/application/common/Timezone.php @@ -18,7 +18,7 @@ class Application_Common_Timezone 'UTC' => DateTimeZone::UTC ); - $tzlist = array(); + $tzlist = array(NULL => "Use station default"); foreach ($regions as $name => $mask) { $ids = DateTimeZone::listIdentifiers($mask); diff --git a/airtime_mvc/application/common/UsabilityHints.php b/airtime_mvc/application/common/UsabilityHints.php index 934d89c2c..fb52de7b6 100644 --- a/airtime_mvc/application/common/UsabilityHints.php +++ b/airtime_mvc/application/common/UsabilityHints.php @@ -55,7 +55,7 @@ class Application_Common_UsabilityHints return _("Upload some tracks below to add them to your library!"); } else { return sprintf(_("It looks like you haven't uploaded any audio files yet. %sUpload a file now%s."), - "", + "", ""); } } else if (!self::isFutureOrCurrentShowScheduled()) { @@ -63,7 +63,7 @@ class Application_Common_UsabilityHints return _("Click the 'New Show' button and fill out the required fields."); } else { return sprintf(_("It looks like you don't have any shows scheduled. %sCreate a show now%s."), - "", + "", ""); } } else if (self::isCurrentShowEmpty()) { @@ -73,23 +73,23 @@ class Application_Common_UsabilityHints return _("To start broadcasting, cancel the current linked show by clicking on it and selecting 'Cancel Show'."); } else { return sprintf(_("Linked shows need to be filled with tracks before it starts. To start broadcasting cancel the current linked show and schedule an unlinked show. - %sCreate an unlinked show now%s."), "", ""); + %sCreate an unlinked show now%s."), "", ""); } } else { if ($userIsOnCalendarPage) { - return _("To start broadcasting, click on the current show and select 'Schedule Show'"); + return _("To start broadcasting, click on the current show and select 'Schedule Tracks'"); } else { return sprintf(_("It looks like the current show needs more tracks. %sAdd tracks to your show now%s."), - "", + "", ""); } } } else if (!self::getCurrentShow() && self::isNextShowEmpty()) { if ($userIsOnCalendarPage) { - return _("Click on the show starting next and select 'Schedule Show'"); + return _("Click on the show starting next and select 'Schedule Tracks'"); } else { return sprintf(_("It looks like the next show is empty. %sAdd tracks to your show now%s."), - "", + "", ""); } } else { diff --git a/airtime_mvc/application/controllers/BillingController.php b/airtime_mvc/application/controllers/BillingController.php index 2952d70ca..0e135e436 100644 --- a/airtime_mvc/application/controllers/BillingController.php +++ b/airtime_mvc/application/controllers/BillingController.php @@ -10,7 +10,6 @@ class BillingController extends Zend_Controller_Action { //Two of the actions in this controller return JSON because they're used for AJAX: $ajaxContext = $this->_helper->getHelper('AjaxContext'); $ajaxContext->addActionContext('vat-validator', 'json') - ->addActionContext('promo-eligibility-check', 'json') ->addActionContext('is-country-in-eu', 'json') ->initContext(); } @@ -20,33 +19,6 @@ class BillingController extends Zend_Controller_Action { $this->_redirect('billing/upgrade'); } - public function promoEligibilityCheckAction() - { - $this->view->layout()->disableLayout(); - $this->_helper->viewRenderer->setNoRender(true); - - $request = $this->getRequest(); - if (!$request->isPost()) { - throw new Exception("Must POST data to promoEligibilityCheckAction."); - } - $data = $request->getPost(); - - $current_namespace = new Zend_Session_Namespace('csrf_namespace'); - $observed_csrf_token = $this->_getParam('csrf_token'); - $expected_csrf_token = $current_namespace->authtoken; - - if($observed_csrf_token == $expected_csrf_token) { - $eligible = Billing::isClientEligibleForPromo( - $data["newproductid"], $data["newproductbillingcycle"]); - - //Set the return JSON value - $this->_helper->json(array("result"=>$eligible)); - } else { - $this->getResponse()->setHttpResponseCode(403); - $this->_helper->json(array("result"=>false, "error"=>"CSRF token did not match.")); - } - } - public function upgradeAction() { @@ -66,14 +38,6 @@ class BillingController extends Zend_Controller_Action { if ($form->isValid($formData)) { - // Check if client is eligible for promo and update the new product id if so - $eligibleForPromo = Billing::isClientEligibleForPromo( - $formData["newproductid"], $formData["newproductbillingcycle"]); - if ($eligibleForPromo) { - $newProductName = Billing::getProductName($formData["newproductid"]); - $formData["newproductid"] = Billing::getEligibleAwesomeAugustPromoPlanId($newProductName); - } - $credentials = Billing::getAPICredentials(); //Check if VAT should be applied or not to this invoice. diff --git a/airtime_mvc/application/controllers/LibraryController.php b/airtime_mvc/application/controllers/LibraryController.php index 2a04b66e8..1c85621e7 100644 --- a/airtime_mvc/application/controllers/LibraryController.php +++ b/airtime_mvc/application/controllers/LibraryController.php @@ -24,95 +24,6 @@ class LibraryController extends Zend_Controller_Action public function indexAction() { $this->_redirect("showbuilder"); -// $CC_CONFIG = Config::getConfig(); -// -// $request = $this->getRequest(); -// $baseUrl = Application_Common_OsPath::getBaseDir(); -// -// $this->view->headScript()->appendFile($baseUrl.'js/blockui/jquery.blockUI.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); -// $this->view->headScript()->appendFile($baseUrl.'js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); -// $this->view->headScript()->appendFile($baseUrl.'js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); -// $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); -// $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.fnSetFilteringDelay.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); -// $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.ColVis.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); -// $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.colReorder.min.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); -// $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.FixedColumns.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); -// $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.columnFilter.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); -// -// $this->view->headScript()->appendFile($baseUrl.'js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); -// $this->view->headScript()->appendFile($baseUrl.'js/airtime/utilities/utilities.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); -// $this->view->headScript()->appendFile($baseUrl.'js/airtime/library/library.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); -// $this->view->headScript()->appendFile($baseUrl.'js/airtime/library/events/library_playlistbuilder.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); -// -// $this->view->headLink()->appendStylesheet($baseUrl.'css/media_library.css?'.$CC_CONFIG['airtime_version']); -// $this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']); -// $this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/ColVis.css?'.$CC_CONFIG['airtime_version']); -// $this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/dataTables.colReorder.min.css?'.$CC_CONFIG['airtime_version']); -// $this->view->headLink()->appendStylesheet($baseUrl.'css/waveform.css?'.$CC_CONFIG['airtime_version']); -// -// $this->view->headScript()->appendFile($baseUrl.'js/airtime/library/spl.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); -// $this->view->headScript()->appendFile($baseUrl.'js/airtime/playlist/smart_blockbuilder.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); -// -// $this->view->headScript()->appendFile($baseUrl.'js/waveformplaylist/observer/observer.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); -// $this->view->headScript()->appendFile($baseUrl.'js/waveformplaylist/config.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); -// $this->view->headScript()->appendFile($baseUrl.'js/waveformplaylist/curves.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); -// $this->view->headScript()->appendFile($baseUrl.'js/waveformplaylist/fades.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); -// $this->view->headScript()->appendFile($baseUrl.'js/waveformplaylist/local_storage.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); -// $this->view->headScript()->appendFile($baseUrl.'js/waveformplaylist/controls.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); -// $this->view->headScript()->appendFile($baseUrl.'js/waveformplaylist/playout.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); -// $this->view->headScript()->appendFile($baseUrl.'js/waveformplaylist/track_render.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); -// $this->view->headScript()->appendFile($baseUrl.'js/waveformplaylist/track.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); -// $this->view->headScript()->appendFile($baseUrl.'js/waveformplaylist/time_scale.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); -// $this->view->headScript()->appendFile($baseUrl.'js/waveformplaylist/playlist.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); -// -// //arbitrary attributes need to be allowed to set an id for the templates. -// $this->view->headScript()->setAllowArbitraryAttributes(true); -// //$this->view->headScript()->appendScript(file_get_contents(APPLICATION_PATH.'/../public/js/waveformplaylist/templates/bottombar.tpl'), -// // 'text/template', array('id' => 'tpl_playlist_cues', 'noescape' => true)); -// -// $this->view->headLink()->appendStylesheet($baseUrl.'css/playlist_builder.css?'.$CC_CONFIG['airtime_version']); -// -// try { -// -// $obj_sess = new Zend_Session_Namespace(UI_PLAYLISTCONTROLLER_OBJ_SESSNAME); -// if (isset($obj_sess->id)) { -// $objInfo = Application_Model_Library::getObjInfo($obj_sess->type); -// $obj = new $objInfo['className']($obj_sess->id); -// $userInfo = Zend_Auth::getInstance()->getStorage()->read(); -// $user = new Application_Model_User($userInfo->id); -// $isAdminOrPM = $user->isUserType(array(UTYPE_SUPERADMIN, UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER)); -// -// if ($isAdminOrPM || $obj->getCreatorId() == $userInfo->id) { -// $this->view->obj = $obj; -// if ($obj_sess->type == "block") { -// $form = new Application_Form_SmartBlockCriteria(); -// $form->startForm($obj_sess->id); -// $this->view->form = $form; -// } -// } -// -// $formatter = new LengthFormatter($obj->getLength()); -// $this->view->length = $formatter->format(); -// $this->view->type = $obj_sess->type; -// } -// -// //get user settings and determine if we need to hide -// // or show the playlist editor -// $showPlaylist = false; -// $data = Application_Model_Preference::getLibraryScreenSettings(); -// if (!is_null($data)) { -// if ($data["playlist"] == "true") { -// $showPlaylist = true; -// } -// } -// $this->view->showPlaylist = $showPlaylist; -// } catch (PlaylistNotFoundException $e) { -// $this->playlistNotFound($obj_sess->type); -// } catch (Exception $e) { -// $this->playlistNotFound($obj_sess->type); -// Logging::info($e->getMessage()); -// //$this->playlistUnknownError($e); -// } } protected function playlistNotFound($p_type) diff --git a/airtime_mvc/application/controllers/LocaleController.php b/airtime_mvc/application/controllers/LocaleController.php index 0d7ce2281..2c539dc74 100644 --- a/airtime_mvc/application/controllers/LocaleController.php +++ b/airtime_mvc/application/controllers/LocaleController.php @@ -51,8 +51,14 @@ class LocaleController extends Zend_Controller_Action //library/events/library_showbuilder.js //already in library/events/library_playlistbuilder.js "Please select a cursor position on timeline." => _("Please select a cursor position on timeline."), - "You haven't added any " => _("You haven't added any "), - "Learn about " => _("Learn about "), + "You haven't added any tracks" => _("You haven't added any tracks"), + "You haven't added any playlists" => _("You haven't added any playlists"), + "You haven't added any smart blocks" => _("You haven't added any smart blocks"), + "You haven't added any webstreams" => _("You haven't added any webstreams"), + "Learn about tracks" => _("Learn about tracks"), + "Learn about playlists" => _("Learn about playlists"), + "Learn about smart blocks" => _("Learn about smart blocks"), + "Learn about webstreams" => _("Learn about webstreams"), "Click 'New' to create one." => _("Click 'New' to create one."), //"Adding 1 Item" => _("Adding 1 Item"), //"Adding %s Items" => _("Adding %s Items"), @@ -267,6 +273,9 @@ class LocaleController extends Zend_Controller_Action "Start" => _("Start"), "End" => _("End"), "Duration" => _("Duration"), + "Filtering out " => _("Filtering out "), + " of " => _(" of "), + " records" => _(" records"), //already in library/library.js //"Title" => _("Title"), //"Creator" => _("Creator"), diff --git a/airtime_mvc/application/controllers/PlaylistController.php b/airtime_mvc/application/controllers/PlaylistController.php index d94c34ec2..7bb425a7e 100644 --- a/airtime_mvc/application/controllers/PlaylistController.php +++ b/airtime_mvc/application/controllers/PlaylistController.php @@ -30,6 +30,7 @@ class PlaylistController extends Zend_Controller_Action ->addActionContext('get-block-info', 'json') ->addActionContext('shuffle', 'json') ->addActionContext('empty-content', 'json') + ->addActionContext('change-playlist', 'json') ->initContext(); //This controller writes to the session all over the place, so we're going to reopen it for writing here. @@ -201,6 +202,16 @@ class PlaylistController extends Zend_Controller_Action $this->createFullResponse($obj); } + public function changePlaylistAction() { + $this->view->layout()->disableLayout(); // Don't inject the standard Now Playing header. + $this->_helper->viewRenderer->setNoRender(true); // Don't use (phtml) templates + + $id = $this->_getParam('id', null); + $type = $this->_getParam('type'); + + Application_Model_Library::changePlaylist($id, $type); + } + public function editAction() { $id = $this->_getParam('id', null); @@ -241,7 +252,7 @@ class PlaylistController extends Zend_Controller_Action Logging::info("Currently active {$type} {$obj_sess->id}"); if (in_array($obj_sess->id, $ids)) { Logging::info("Deleting currently active {$type}"); - Application_Model_Library::changePlaylist(null, $type); + // Application_Model_Library::changePlaylist(null, $type); } else { Logging::info("Not deleting currently active {$type}"); $obj = new $objInfo['className']($obj_sess->id); @@ -595,10 +606,7 @@ class PlaylistController extends Zend_Controller_Action $this->view->obj = $bl; $this->view->id = $bl->getId(); $this->view->form = $form; - $viewPath = 'playlist/smart-block.phtml'; - $result['html'] = $this->view->render($viewPath); - $result['result'] = 1; - $this->_helper->json->sendJson($result); + $this->createFullResponse($bl, false, true); } } catch (BlockNotFoundException $e) { $this->playlistNotFound('block', true); diff --git a/airtime_mvc/application/controllers/PluploadController.php b/airtime_mvc/application/controllers/PluploadController.php index 4c46e5fde..3b20f71e1 100644 --- a/airtime_mvc/application/controllers/PluploadController.php +++ b/airtime_mvc/application/controllers/PluploadController.php @@ -26,6 +26,7 @@ class PluploadController extends Zend_Controller_Action $this->view->headLink()->appendStylesheet($baseUrl.'css/plupload.queue.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'css/addmedia.css?'.$CC_CONFIG['airtime_version']); + $this->view->headLink()->appendStylesheet($baseUrl.'css/dashboard.css?'.$CC_CONFIG['airtime_version']); $this->view->quotaLimitReached = false; if (Application_Model_Systemstatus::isDiskOverQuota()) { diff --git a/airtime_mvc/application/controllers/plugins/Acl_plugin.php b/airtime_mvc/application/controllers/plugins/Acl_plugin.php index c08533ab9..18f1c69a5 100644 --- a/airtime_mvc/application/controllers/plugins/Acl_plugin.php +++ b/airtime_mvc/application/controllers/plugins/Acl_plugin.php @@ -82,7 +82,7 @@ class Zend_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract * @param string $module * @return void **/ - public function setErrorPage($action, $controller = 'error', $module = null) + public function setErrorPage($action, $controller = 'error', $module = 'default') { $this->_errorPage = array('module' => $module, 'controller' => $controller, @@ -204,7 +204,8 @@ class Zend_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract $resourceName, $request->getActionName())) { /** Redirect to access denied page */ - $this->denyAccess(); + $this->setErrorPage('error403'); + $this->denyAccess(); /* This results in a 404! */ } } } diff --git a/airtime_mvc/application/forms/BillingClient.php b/airtime_mvc/application/forms/BillingClient.php index 87835d1de..7cbac545d 100644 --- a/airtime_mvc/application/forms/BillingClient.php +++ b/airtime_mvc/application/forms/BillingClient.php @@ -14,7 +14,7 @@ class Application_Form_BillingClient extends Zend_Form $emailValidator = Application_Form_Helper_ValidationTypes::overrideEmailAddressValidator(); $firstname = new Zend_Form_Element_Text('firstname'); - $firstname->setLabel(_('First Name:')) + $firstname->setLabel(_pro('First Name:')) ->setValue($client["firstname"]) ->setAttrib('class', 'input_text') ->setRequired(true) @@ -23,7 +23,7 @@ class Application_Form_BillingClient extends Zend_Form $this->addElement($firstname); $lastname = new Zend_Form_Element_Text('lastname'); - $lastname->setLabel(_('Last Name:')) + $lastname->setLabel(_pro('Last Name:')) ->setValue($client["lastname"]) ->setAttrib('class', 'input_text') ->setRequired(true) @@ -32,7 +32,7 @@ class Application_Form_BillingClient extends Zend_Form $this->addElement($lastname); $companyname = new Zend_Form_Element_Text('companyname'); - $companyname->setLabel(_('Company Name:')) + $companyname->setLabel(_pro('Company Name:')) ->setValue($client["companyname"]) ->setAttrib('class', 'input_text') ->setRequired(false) @@ -41,7 +41,7 @@ class Application_Form_BillingClient extends Zend_Form $this->addElement($companyname); $email = new Zend_Form_Element_Text('email'); - $email->setLabel(_('Email Address:')) + $email->setLabel(_pro('Email Address:')) ->setValue($client["email"]) ->setAttrib('class', 'input_text') ->setRequired(true) @@ -51,7 +51,7 @@ class Application_Form_BillingClient extends Zend_Form $this->addElement($email); $address1 = new Zend_Form_Element_Text('address1'); - $address1->setLabel(_('Address 1:')) + $address1->setLabel(_pro('Address 1:')) ->setValue($client["address1"]) ->setAttrib('class', 'input_text') ->setRequired(true) @@ -60,14 +60,14 @@ class Application_Form_BillingClient extends Zend_Form $this->addElement($address1); $address2 = new Zend_Form_Element_Text('address2'); - $address2->setLabel(_('Address 2:')) + $address2->setLabel(_pro('Address 2:')) ->setValue($client["address2"]) ->setAttrib('class', 'input_text') ->addFilter('StringTrim'); $this->addElement($address2); $city = new Zend_Form_Element_Text('city'); - $city->setLabel(_('City:')) + $city->setLabel(_pro('City:')) ->setValue($client["city"]) ->setAttrib('class', 'input_text') ->setRequired(true) @@ -77,7 +77,7 @@ class Application_Form_BillingClient extends Zend_Form //TODO: get list from whmcs? $state = new Zend_Form_Element_Text('state'); - $state->setLabel(_('State/Region:')) + $state->setLabel(_pro('State/Region:')) ->setValue($client["state"]) ->setAttrib('class', 'input_text') ->setRequired(true) @@ -86,7 +86,7 @@ class Application_Form_BillingClient extends Zend_Form $this->addElement($state); $postcode = new Zend_Form_Element_Text('postcode'); - $postcode->setLabel(_('Zip Code / Postal Code:')) + $postcode->setLabel(_pro('Zip Code / Postal Code:')) ->setValue($client["postcode"]) ->setAttrib('class', 'input_text') ->setRequired(true) @@ -99,7 +99,7 @@ class Application_Form_BillingClient extends Zend_Form asort($countries, SORT_LOCALE_STRING); $country = new Zend_Form_Element_Select('country'); - $country->setLabel(_('Country:')) + $country->setLabel(_pro('Country:')) ->setValue($client["country"]) ->setAttrib('class', 'input_text') ->setMultiOptions($countries) @@ -109,7 +109,7 @@ class Application_Form_BillingClient extends Zend_Form $this->addElement($country); $phonenumber = new Zend_Form_Element_Text('phonenumber'); - $phonenumber->setLabel(_('Phone Number:')) + $phonenumber->setLabel(_pro('Phone Number:')) ->setValue($client["phonenumber"]) ->setAttrib('class', 'input_text') ->setRequired(true) @@ -118,7 +118,7 @@ class Application_Form_BillingClient extends Zend_Form $this->addElement($phonenumber); $securityqid = new Zend_Form_Element_Select('securityqid'); - $securityqid->setLabel(_('Please choose a security question:')) + $securityqid->setLabel(_pro('Please choose a security question:')) ->setValue($client["securityqid"]) ->setAttrib('class', 'input_text') ->setRequired(true) @@ -132,7 +132,7 @@ class Application_Form_BillingClient extends Zend_Form $this->addElement($securityqid); $securityqans = new Zend_Form_Element_Text('securityqans'); - $securityqans->setLabel(_('Please enter an answer:')) + $securityqans->setLabel(_pro('Please enter an answer:')) ->setValue($client["securityqans"]) ->setAttrib('class', 'input_text') ->setRequired(true) @@ -149,7 +149,7 @@ class Application_Form_BillingClient extends Zend_Form } $vat = new Zend_Form_Element_Text("7"); - $vat->setLabel(_('VAT/Tax ID (EU only)')) + $vat->setLabel(_pro('VAT/Tax ID (EU only)')) ->setBelongsTo('customfields') ->setValue($vatvalue) ->setAttrib('class', 'input_text') @@ -159,7 +159,7 @@ class Application_Form_BillingClient extends Zend_Form $this->addElement($vat); $subscribe = new Zend_Form_Element_Checkbox('71'); - $subscribe->setLabel(_('Subscribe to Sourcefabric newsletter')) + $subscribe->setLabel(_pro('Subscribe to Sourcefabric newsletter')) ->setValue($subscribevalue) ->setBelongsTo('customfields') ->setAttrib('class', 'billing-details-checkbox') @@ -169,7 +169,7 @@ class Application_Form_BillingClient extends Zend_Form $this->addElement($subscribe); $password = new Zend_Form_Element_Password('password2'); - $password->setLabel(_('Password:')); + $password->setLabel(_pro('Password:')); $password->setAttrib('class', 'input_text'); $password->setValue("xxxxxx"); $password->setRequired(true); @@ -178,7 +178,7 @@ class Application_Form_BillingClient extends Zend_Form $this->addElement($password); $passwordVerify = new Zend_Form_Element_Password('password2verify'); - $passwordVerify->setLabel(_('Verify Password:')); + $passwordVerify->setLabel(_pro('Verify Password:')); $passwordVerify->setAttrib('class', 'input_text'); $passwordVerify->setValue("xxxxxx"); $passwordVerify->setRequired(true); @@ -190,7 +190,7 @@ class Application_Form_BillingClient extends Zend_Form $submit = new Zend_Form_Element_Submit("submit"); $submit->setIgnore(true) - ->setLabel(_("Save")); + ->setLabel(_pro("Save")); $this->addElement($submit); } } \ No newline at end of file diff --git a/airtime_mvc/application/forms/EditUser.php b/airtime_mvc/application/forms/EditUser.php index d9486113f..cbb2ec22f 100644 --- a/airtime_mvc/application/forms/EditUser.php +++ b/airtime_mvc/application/forms/EditUser.php @@ -121,11 +121,14 @@ class Application_Form_EditUser extends Zend_Form $locale->setValue(Application_Model_Preference::GetUserLocale($currentUserId)); $locale->setDecorators(array('ViewHelper')); $this->addElement($locale); - + + $stationTz = Application_Model_Preference::GetTimezone($currentUserId); + $userTz = Application_Model_Preference::GetUserTimezone($currentUserId); + $timezone = new Zend_Form_Element_Select("cu_timezone"); $timezone->setLabel(_("Interface Timezone:")); $timezone->setMultiOptions(Application_Common_Timezone::getTimezones()); - $timezone->setValue(Application_Model_Preference::GetUserTimezone($currentUserId)); + $timezone->setValue($userTz == $stationTz ? null : $userTz); $timezone->setDecorators(array('ViewHelper')); $this->addElement($timezone); diff --git a/airtime_mvc/application/forms/GeneralPreferences.php b/airtime_mvc/application/forms/GeneralPreferences.php index be12ea565..508561bac 100644 --- a/airtime_mvc/application/forms/GeneralPreferences.php +++ b/airtime_mvc/application/forms/GeneralPreferences.php @@ -1,4 +1,4 @@ -addElement('text', 'username', array( - 'label' => _('Username:'), - 'class' => 'input_text', - 'required' => true, - 'value' => (isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1)?'admin':'', - 'filters' => array('StringTrim'), - 'validators' => array( - 'NotEmpty', - ), - 'decorators' => array( - 'ViewHelper' - ) - )); + $username = new Zend_Form_Element_Text("username"); + $username->setLabel(_('Username:')) + ->setAttribs(array( + 'autofocus' => 'true', + 'class' => 'input_text', + 'required' => 'true')) + ->setValue((isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1)?'admin':'') + ->addFilter('StringTrim') + ->setDecorators(array('ViewHelper')) + ->setValidators(array('NotEmpty')); + $this->addElement($username); // Add password element $this->addElement('password', 'password', array( diff --git a/airtime_mvc/application/forms/SmartBlockCriteria.php b/airtime_mvc/application/forms/SmartBlockCriteria.php index 4c307cdb9..bc22b731d 100644 --- a/airtime_mvc/application/forms/SmartBlockCriteria.php +++ b/airtime_mvc/application/forms/SmartBlockCriteria.php @@ -370,6 +370,10 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm // add elelments that needs to be added // set multioption for modifier according to criteria_field $modRowMap = array(); + if (!isset($data['criteria'])) { + return $data; + } + foreach ($data['criteria'] as $critKey=>$d) { $count = 1; foreach ($d as $modKey=>$modInfo) { diff --git a/airtime_mvc/application/layouts/scripts/layout.phtml b/airtime_mvc/application/layouts/scripts/layout.phtml index 98ecccb3d..e2e486415 100644 --- a/airtime_mvc/application/layouts/scripts/layout.phtml +++ b/airtime_mvc/application/layouts/scripts/layout.phtml @@ -67,7 +67,9 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= - +