Merge branch 'saas-showbuilder' of github.com:sourcefabric/airtime into saas-showbuilder

This commit is contained in:
Duncan Sommerville 2015-08-25 17:09:17 -04:00
commit afa3b47e42
19 changed files with 422 additions and 104 deletions

View File

@ -95,8 +95,14 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
} }
$view->headScript()->appendScript("var userType = '$userType';"); $view->headScript()->appendScript("var userType = '$userType';");
// Dropzone also accept file extensions and doesn't correctly extract certain mimetypes (eg. FLAC - try it),
// so we append the file extensions to the list of mimetypes and that makes it work.
$mimeTypes = FileDataHelper::getAudioMimeTypeArray(); $mimeTypes = FileDataHelper::getAudioMimeTypeArray();
$view->headScript()->appendScript("var acceptedMimeTypes = ['".implode("','", array_keys($mimeTypes))."'];"); $fileExtensions = array_values($mimeTypes);
foreach($fileExtensions as &$extension) {
$extension = '.' . $extension;
}
$view->headScript()->appendScript("var acceptedMimeTypes = " . json_encode(array_merge(array_keys($mimeTypes), $fileExtensions)) . ";");
} }
/** /**

View File

@ -1,5 +1,8 @@
<?php <?php
define("AIRTIME_PRO_FREE_TRIAL_PLAN_ID", 34);
define("WHMCS_AIRTIME_GROUP_ID", 15);
class Billing class Billing
{ {
public static function getAPICredentials() public static function getAPICredentials()
@ -30,10 +33,10 @@ class Billing
{ {
//Making this static to cache the products during a single HTTP request. //Making this static to cache the products during a single HTTP request.
//This saves us roundtrips to WHMCS if getProducts() is called multiple times. //This saves us roundtrips to WHMCS if getProducts() is called multiple times.
static $result = array(); static $products = array();
if (!empty($result)) if (!empty($products))
{ {
return $result["products"]["product"]; return $products;
} }
$credentials = self::getAPICredentials(); $credentials = self::getAPICredentials();
@ -44,7 +47,7 @@ class Billing
$postfields["action"] = "getproducts"; $postfields["action"] = "getproducts";
$postfields["responsetype"] = "json"; $postfields["responsetype"] = "json";
//gid is the Airtime product group id on whmcs //gid is the Airtime product group id on whmcs
$postfields["gid"] = "15"; $postfields["gid"] = WHMCS_AIRTIME_GROUP_ID;
$query_string = ""; $query_string = "";
foreach ($postfields AS $k=>$v) $query_string .= "$k=".urlencode($v)."&"; foreach ($postfields AS $k=>$v) $query_string .= "$k=".urlencode($v)."&";
@ -54,9 +57,9 @@ class Billing
$products = $result["products"]["product"]; $products = $result["products"]["product"];
//Blacklist all free plans //Blacklist all free plans
//Hide the promo plans - we will tell the user if they are eligible for a promo plan
foreach ($products as $k => $p) { foreach ($products as $k => $p) {
Logging::info($p); if ($p["paytype"] === "free" || strpos($p["name"], "Awesome August 2015") !== false)
if ($p["paytype"] === "free")
{ {
unset($products[$k]); unset($products[$k]);
} }
@ -326,4 +329,150 @@ class Billing
$result = Billing::makeRequest($credentials["url"], $query_string); $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;
}
} }

View File

@ -13,7 +13,7 @@ class FileDataHelper {
"audio/x-aac" => "aac", "audio/x-aac" => "aac",
"audio/aac" => "aac", "audio/aac" => "aac",
"audio/aacp" => "aac", "audio/aacp" => "aac",
"audio/mp4" => "mp4", "audio/mp4" => "m4a",
"audio/x-flac" => "flac", "audio/x-flac" => "flac",
"audio/wav" => "wav", "audio/wav" => "wav",
"audio/x-wav" => "wav", "audio/x-wav" => "wav",
@ -66,4 +66,4 @@ class FileDataHelper {
} }
} }
} }

View File

@ -25,8 +25,12 @@ class ProvisioningHelper
*/ */
public function createAction() public function createAction()
{ {
$apikey = $_SERVER['PHP_AUTH_USER']; $apikey = "";
if (!isset($apikey) || $apikey != $this->apikey) { if (isset($_SERVER['PHP_AUTH_USER']))
{
$apikey = $_SERVER['PHP_AUTH_USER'];
}
if ($apikey != $this->apikey) {
Logging::info("Invalid API Key: $apikey"); Logging::info("Invalid API Key: $apikey");
http_response_code(403); http_response_code(403);
echo "ERROR: Incorrect API key"; echo "ERROR: Incorrect API key";

View File

@ -55,15 +55,15 @@ class Application_Common_UsabilityHints
return _("Click the 'Add files' button and select files from your computer to upload."); return _("Click the 'Add files' button and select files from your computer to upload.");
} else { } else {
return sprintf(_("It looks like you have not uploaded any audio files yet. %sUpload a file now%s."), return sprintf(_("It looks like you have not uploaded any audio files yet. %sUpload a file now%s."),
"<a href=\"/plupload\">", "<a href=\"/Plupload\">",
"</a>"); "</a>");
} }
} else if (!self::isFutureOrCurrentShowScheduled()) { } else if (!self::isFutureOrCurrentShowScheduled()) {
if ($userIsOnCalendarPage) { if ($userIsOnCalendarPage) {
return _("Click the 'Create New Show' button and fill out the required fields."); return _("Click the 'New Show' button and fill out the required fields.");
} else { } else {
return sprintf(_("It looks like you don't have any shows scheduled. %sCreate a show now%s."), return sprintf(_("It looks like you don't have any shows scheduled. %sCreate a show now%s."),
"<a href=\"/schedule\">", "<a href=\"/Schedule\">",
"</a>"); "</a>");
} }
} else if (self::isCurrentShowEmpty()) { } else if (self::isCurrentShowEmpty()) {
@ -73,14 +73,14 @@ class Application_Common_UsabilityHints
return _("To start broadcasting, first you need to cancel the current linked show by clicking on it and selecting 'Cancel Current Show'."); return _("To start broadcasting, first you need to cancel the current linked show by clicking on it and selecting 'Cancel Current Show'.");
} else { } 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. 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."), "<a href=\"/schedule\">", "</a>"); %sCreate an unlinked show now%s."), "<a href=\"/Schedule\">", "</a>");
} }
} else { } else {
if ($userIsOnCalendarPage) { if ($userIsOnCalendarPage) {
return _("To start broadcasting, click on the current show and select 'Add / Remove Content'"); return _("To start broadcasting, click on the current show and select 'Add / Remove Content'");
} else { } else {
return sprintf(_("It looks like the current show needs more tracks. %sAdd tracks to your show now%s."), return sprintf(_("It looks like the current show needs more tracks. %sAdd tracks to your show now%s."),
"<a href=\"/schedule\">", "<a href=\"/Schedule\">",
"</a>"); "</a>");
} }
} }
@ -89,7 +89,7 @@ class Application_Common_UsabilityHints
return _("Click on the show starting next and select 'Add / Remove Content'"); return _("Click on the show starting next and select 'Add / Remove Content'");
} else { } else {
return sprintf(_("It looks like the next show is empty. %sAdd tracks to your show now%s."), return sprintf(_("It looks like the next show is empty. %sAdd tracks to your show now%s."),
"<a href=\"/schedule\">", "<a href=\"/Schedule\">",
"</a>"); "</a>");
} }
} else { } else {

View File

@ -48,7 +48,7 @@ $pages = array(
'resource' => 'preference', 'resource' => 'preference',
'action' => 'index', 'action' => 'index',
'module' => 'default', 'module' => 'default',
'controller' => 'preference', 'controller' => 'Preference',
'title' => 'Settings', 'title' => 'Settings',
'pages' => array( 'pages' => array(
array( array(

View File

@ -10,6 +10,7 @@ class BillingController extends Zend_Controller_Action {
//Two of the actions in this controller return JSON because they're used for AJAX: //Two of the actions in this controller return JSON because they're used for AJAX:
$ajaxContext = $this->_helper->getHelper('AjaxContext'); $ajaxContext = $this->_helper->getHelper('AjaxContext');
$ajaxContext->addActionContext('vat-validator', 'json') $ajaxContext->addActionContext('vat-validator', 'json')
->addActionContext('promo-eligibility-check', 'json')
->addActionContext('is-country-in-eu', 'json') ->addActionContext('is-country-in-eu', 'json')
->initContext(); ->initContext();
} }
@ -19,6 +20,33 @@ class BillingController extends Zend_Controller_Action {
$this->_redirect('billing/upgrade'); $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() public function upgradeAction()
{ {
@ -31,21 +59,32 @@ class BillingController extends Zend_Controller_Action {
$request = $this->getRequest(); $request = $this->getRequest();
$form = new Application_Form_BillingUpgradeDowngrade(); $form = new Application_Form_BillingUpgradeDowngrade();
if ($request->isPost()) { if ($request->isPost()) {
$formData = $request->getPost(); $formData = $request->getPost();
if ($form->isValid($formData)) { 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(); $credentials = Billing::getAPICredentials();
//Check if VAT should be applied or not to this invoice. //Check if VAT should be applied or not to this invoice.
if (in_array("7", $formData["customfields"])) { if (in_array("7", $formData["customfields"])) {
$apply_vat = Billing::checkIfVatShouldBeApplied($formData["customfields"]["7"], $formData["country"]); $apply_vat = Billing::checkIfVatShouldBeApplied($formData["customfields"]["7"], $formData["country"]);
} else { } else {
$apply_vat = false; $apply_vat = false;
} }
$placeAnUpgradeOrder = true; $placeAnUpgradeOrder = true;
$currentPlanProduct = Billing::getClientCurrentAirtimeProduct(); $currentPlanProduct = Billing::getClientCurrentAirtimeProduct();
$currentPlanProductId = $currentPlanProduct["pid"]; $currentPlanProductId = $currentPlanProduct["pid"];
$currentPlanProductBillingCycle = strtolower($currentPlanProduct["billingcycle"]); $currentPlanProductBillingCycle = strtolower($currentPlanProduct["billingcycle"]);
@ -54,33 +93,33 @@ class BillingController extends Zend_Controller_Action {
//and it freaks out and does the wrong thing if we do it via the API //and it freaks out and does the wrong thing if we do it via the API
//so we have to do avoid that. //so we have to do avoid that.
if (($currentPlanProductId == $formData["newproductid"]) && if (($currentPlanProductId == $formData["newproductid"]) &&
($currentPlanProductBillingCycle == $formData["newproductbillingcycle"])) ($currentPlanProductBillingCycle == $formData["newproductbillingcycle"])
{ ) {
$placeAnUpgradeOrder = false; $placeAnUpgradeOrder = false;
} }
$postfields = array(); $postfields = array();
$postfields["username"] = $credentials["username"]; $postfields["username"] = $credentials["username"];
$postfields["password"] = md5($credentials["password"]); $postfields["password"] = md5($credentials["password"]);
$postfields["action"] = "upgradeproduct"; $postfields["action"] = "upgradeproduct";
$postfields["clientid"] = Application_Model_Preference::GetClientId(); $postfields["clientid"] = Application_Model_Preference::GetClientId();
$postfields["serviceid"] = Billing::getClientInstanceId(); $postfields["serviceid"] = Billing::getClientInstanceId();
$postfields["type"] = "product"; $postfields["type"] = "product";
$postfields["newproductid"] = $formData["newproductid"]; $postfields["newproductid"] = $formData["newproductid"];
$postfields["newproductbillingcycle"] = $formData["newproductbillingcycle"]; $postfields["newproductbillingcycle"] = $formData["newproductbillingcycle"];
$postfields["paymentmethod"] = $formData["paymentmethod"]; $postfields["paymentmethod"] = $formData["paymentmethod"];
$postfields["responsetype"] = "json"; $postfields["responsetype"] = "json";
$upgrade_query_string = ""; $upgrade_query_string = "";
foreach ($postfields AS $k=>$v) $upgrade_query_string .= "$k=".urlencode($v)."&"; foreach ($postfields AS $k => $v) $upgrade_query_string .= "$k=" . urlencode($v) . "&";
//update client info //update client info
$clientfields = array(); $clientfields = array();
$clientfields["username"] = $credentials["username"]; $clientfields["username"] = $credentials["username"];
$clientfields["password"] = md5($credentials["password"]); $clientfields["password"] = md5($credentials["password"]);
$clientfields["action"] = "updateclient"; $clientfields["action"] = "updateclient";
$clientfields["clientid"] = Application_Model_Preference::GetClientId(); $clientfields["clientid"] = Application_Model_Preference::GetClientId();
$clientfields["customfields"] = base64_encode(serialize($formData["customfields"])); $clientfields["customfields"] = base64_encode(serialize($formData["customfields"]));
unset($formData["customfields"]); unset($formData["customfields"]);
@ -93,8 +132,8 @@ class BillingController extends Zend_Controller_Action {
unset($clientfields["password2verify"]); unset($clientfields["password2verify"]);
unset($clientfields["submit"]); unset($clientfields["submit"]);
$client_query_string = ""; $client_query_string = "";
foreach ($clientfields AS $k=>$v) $client_query_string .= "$k=".urlencode($v)."&"; foreach ($clientfields AS $k => $v) $client_query_string .= "$k=" . urlencode($v) . "&";
//Update the client details in WHMCS first //Update the client details in WHMCS first
$result = Billing::makeRequest($credentials["url"], $client_query_string); $result = Billing::makeRequest($credentials["url"], $client_query_string);
Logging::info($result); Logging::info($result);
@ -103,33 +142,39 @@ class BillingController extends Zend_Controller_Action {
$this->view->form = $form; $this->view->form = $form;
return; return;
} }
//If there were no changes to the plan or billing cycle, we just redirect you to the //If there were no changes to the plan or billing cycle, we just redirect you to the
//invoices screen and show a message. //invoices screen and show a message.
if (!$placeAnUpgradeOrder) if (!$placeAnUpgradeOrder) {
{
$this->_redirect('billing/invoices?planupdated'); $this->_redirect('billing/invoices?planupdated');
return; return;
} }
//Then place an upgrade order in WHMCS //Then place an upgrade order in WHMCS
$result = Billing::makeRequest($credentials["url"], $upgrade_query_string); $result = Billing::makeRequest($credentials["url"], $upgrade_query_string);
if ($result["result"] == "error") { if ($result["result"] == "error") {
Logging::info($_SERVER['HTTP_HOST']." - Account upgrade failed. - ".$result["message"]); Logging::info($_SERVER['HTTP_HOST'] . " - Account upgrade failed. - " . $result["message"]);
$this->setErrorMessage(); $this->setErrorMessage();
$this->view->form = $form; $this->view->form = $form;
} else { } else {
Logging::info($_SERVER['HTTP_HOST']. "Account plan upgrade request:"); Logging::info($_SERVER['HTTP_HOST'] . "Account plan upgrade request:");
Logging::info($result); Logging::info($result);
// Disable the view and the layout here, squashes an error. // Disable the view and the layout here, squashes an error.
$this->view->layout()->disableLayout(); $this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true); $this->_helper->viewRenderer->setNoRender(true);
if ($apply_vat) { if ($apply_vat) {
Billing::addVatToInvoice($result["invoiceid"]); Billing::addVatToInvoice($result["invoiceid"]);
} }
self::viewInvoice($result["invoiceid"]);
// there may not be an invoice created if the client is downgrading
if (!empty($result["invoiceid"])) {
self::viewInvoice($result["invoiceid"]);
} else {
$this->_redirect('billing/invoices?planupdated');
return;
}
} }
} else { } else {
$this->view->form = $form; $this->view->form = $form;

View File

@ -3,6 +3,11 @@ class Application_Form_BillingUpgradeDowngrade extends Zend_Form
{ {
public function init() public function init()
{ {
$csrf_namespace = new Zend_Session_Namespace('csrf_namespace');
$csrf_element = new Zend_Form_Element_Hidden('csrf');
$csrf_element->setValue($csrf_namespace->authtoken)->setRequired('true')->removeDecorator('HtmlTag')->removeDecorator('Label');
$this->addElement($csrf_element);
$productPrices = array(); $productPrices = array();
$productTypes = array(); $productTypes = array();
list($productPrices, $productTypes) = Billing::getProductPricesAndTypes(); list($productPrices, $productTypes) = Billing::getProductPricesAndTypes();

View File

@ -203,7 +203,7 @@ class Application_Model_Preference
if (strlen($title) > 0) if (strlen($title) > 0)
$title .= " - "; $title .= " - ";
return $title."Airtime"; return $title.PRODUCT_NAME;
} }
public static function SetHeadTitle($title, $view=null) public static function SetHeadTitle($title, $view=null)

View File

@ -120,17 +120,43 @@ function configureByCountry(countryCode)
}); });
} }
function promoEligibilityCheck()
{
var newproductid = $("input[type='radio'][name='newproductid']:checked").val();
// newproductid can be undefined if the client is currently on an old plan
// and they just change the billing cycle value without selecting a new plan type.
// In this case, let's not check if they are eligible for the promo because
// they won't be able to upgrade without selecting a new plan first.
if (newproductid === undefined) {
return;
}
var newproductbillingcycle = $("input[type='radio'][name='newproductbillingcycle']:checked").val();
$.post("/billing/promo-eligibility-check", {"newproductid": newproductid,
"newproductbillingcycle": newproductbillingcycle, "csrf_token": $("#csrf").attr('value')})
.success(function(data) {
if (data.result == true) {
$("#promo-plan-eligible").show();
} else if ($("#promo-plan-eligible").is(":visible")) {
$("#promo-plan-eligible").hide();
}
});
}
$(document).ready(function() { $(document).ready(function() {
configureByCountry($("#country").val()); configureByCountry($("#country").val());
recalculateTotals(); recalculateTotals();
$("input[name='newproductid']").change(function() { $("input[name='newproductid']").change(function() {
validatePlan(); validatePlan();
recalculateTotals(); recalculateTotals();
promoEligibilityCheck();
}); });
$("input[name='newproductbillingcycle']").change(function() { $("input[name='newproductbillingcycle']").change(function() {
recalculateTotals(); recalculateTotals();
promoEligibilityCheck();
}); });
$("#country").change(function() { $("#country").change(function() {
@ -170,13 +196,17 @@ $(document).ready(function() {
<div class="ui-widget ui-widget-content block-shadow clearfix padded-strong billing-panel"> <div class="ui-widget ui-widget-content block-shadow clearfix padded-strong billing-panel">
<H2><?=_("Account Plans")?></H2> <H2><?=_("Account Plans")?></H2>
<H4><?=_("Upgrade today to get more listeners and storage space!")?></H4> <H4><?=_("Upgrade today to get more listeners and storage space!")?></H4>
<div>
<a href="https://www.airtime.pro/pricing#promo-details" target="_blank">
<img width="400px" height="133px" class="promo-banner" /></a>
</div>
<div class="pricing-grid"> <div class="pricing-grid">
<table> <table>
<tr> <tr>
<th>Hobbyist</th> <th>Awesome Hobbyist</th>
<th>Starter</th> <th>Awesome Starter</th>
<th>Plus</th> <th>Awesome Plus</th>
<th>Premium</th> <th>Awesome Premium</th>
</tr> </tr>
<tr> <tr>
<td>1 Stream <td>1 Stream
@ -198,24 +228,40 @@ $(document).ready(function() {
<td>64kbps, 128kbps, and 196kbps Stream Quality <td>64kbps, 128kbps, and 196kbps Stream Quality
</td> </td>
</tr> </tr>
<tr> <tr class="august-promo">
<td>5 Listeners <td>
<span>5 Listeners</span><br>
<div>10 Listeners</div>
</td> </td>
<td>40 Listeners per stream <td>
<span>40 Listeners per stream</span><br>
<div>80 Listeners per stream</div>
</td> </td>
<td>100 Listeners per stream <td>
<span>100 Listeners per stream</span><br>
<div>200 Listeners per stream</div>
</td> </td>
<td>500 Listeners per stream <td>
<span>500 Listeners per stream</span><br>
<div>1000 Listeners per stream</div>
</td> </td>
</tr> </tr>
<tr> <tr class="august-promo">
<td>2GB Storage <td>
<span>2GB Storage</span><br>
<div>4GB Storage</div>
</td> </td>
<td>5GB Storage <td>
<span>5GB Storage</span><br>
<div>10GB Storage</div>
</td> </td>
<td>30GB Storage <td>
<span>30GB Storage</span><br>
<div>60GB Storage</div>
</td> </td>
<td>150GB Storage <td>
<span>150GB Storage</span><br>
<div>300GB Storage</div>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -264,6 +310,8 @@ echo($currentProduct["name"]);
<h3>Choose a plan:</h3> <h3>Choose a plan:</h3>
<form id="<?php echo $form->getId(); ?>" method="<?php echo $form->getMethod() ?>" action="<?php echo <form id="<?php echo $form->getId(); ?>" method="<?php echo $form->getMethod() ?>" action="<?php echo
$form->getAction()?>" enctype="<?php echo $form->getEncType();?>"> $form->getAction()?>" enctype="<?php echo $form->getEncType();?>">
<?php echo $form->csrf ?>
<div id="plantype"> <div id="plantype">
<?php echo $form->newproductid ?> <?php echo $form->newproductid ?>
@ -274,6 +322,10 @@ echo($currentProduct["name"]);
<div id="billingcycle_disclaimer"> <div id="billingcycle_disclaimer">
Save 15% on annual plans (Hobbyist plan excluded). Save 15% on annual plans (Hobbyist plan excluded).
</div> </div>
<div class="clearfix"></div>
<div id="promo-plan-eligible" style="display:none;">
Congratulations, you are eligible for an Awesome Promotional Plan!
</div>
<div class="clearfix"></div> <div class="clearfix"></div>
<div id="subtotal_box"> <div id="subtotal_box">
<b>Subtotal:</b><br> <b>Subtotal:</b><br>

View File

@ -18,9 +18,17 @@
<div id="plupload_files"></div> <div id="plupload_files"></div>
</form> </form>
--> -->
<div id="upload_form" class="lib-content ui-widget ui-widget-content block-shadow padded <?php if ($this->quotaLimitReached) { ?> hidden <?php } ?>"> <div id="upload_form" class="lib-content ui-widget ui-widget-content block-shadow padded wide-panel <?php if ($this->quotaLimitReached) { ?> hidden <?php } ?>">
<H2>Upload Audio Files</H2> <H2>Upload Audio Files</H2>
<div> <?php
$partitions = Application_Model_Systemstatus::GetDiskInfo();
$status = new StdClass;
$partitions = $partitions;
$disk = $partitions[0];
$used = $disk->totalSpace-$disk->totalFreeSpace;
$total = $disk->totalSpace;
?>
<div style="height:100%">
<form action="/rest/media" method="post" id="add-media-dropzone" class="dropzone dz-clickable"> <form action="/rest/media" method="post" id="add-media-dropzone" class="dropzone dz-clickable">
<?php echo $this->form->getElement('csrf') ?> <?php echo $this->form->getElement('csrf') ?>
<div class="dz-message"> <div class="dz-message">
@ -37,14 +45,24 @@
</div> </div>
--> -->
</div> </div>
<div id="disk_usage" style="position:absolute;width:95%; margin-top:10px; bottom: 10px;">
<div style="padding-bottom: 2px;">Storage</div>
<div class="disk_usage_progress_bar" style="width:98%"></div>
<div class="disk_usage_percent_in_use" style="width:98%"><?php echo sprintf("%01.1f%% ", $used/$total*100) . _("in use") ?></div>
<div class="disk_usage_used" style="width:<?php echo sprintf("%01.1f%%", $used/$total*100) ?>;"></div>
<div style="margin-top: 17px; font-size: 12px;"><?php echo sprintf("%01.1fGB of %01.1fGB", $used/pow(2, 30), $total/pow(2, 30)); ?></div>
</div>
</div> </div>
<div id="plupload_error"> <div id="plupload_error">
<table></table> <table></table>
</div> </div>
<div id="recent_uploads_wrapper" class="lib-content ui-widget ui-widget-content block-shadow wide-panel">
<div id="recent_uploads_wrapper" class="lib-content ui-widget ui-widget-content block-shadow"> <div id="recent_uploads" class="outer-datatable-wrapper padded">
<div id="recent_uploads" class="padded">
<div id="recent_uploads_filter"> <div id="recent_uploads_filter">
<form> <form>
@ -54,8 +72,10 @@
</form> </form>
</div> </div>
<H2><?php echo _("Recent Uploads")?></H2> <H2><?php echo _("Recent Uploads")?></H2>
<div class="dataTables_scrolling padded">
<table id="recent_uploads_table" class="datatable lib-content ui-widget ui-widget-content block-shadow alpha-block " <table id="recent_uploads_table" class="datatable lib-content ui-widget ui-widget-content block-shadow alpha-block "
cellpadding="0" cellspacing="0"></table> cellpadding="0" cellspacing="0"></table>
</div>
</div> </div>
<div style="clear: both;"></div> <div style="clear: both;"></div>
</div> </div>

View File

@ -2,18 +2,20 @@
#recent_uploads_wrapper #recent_uploads_wrapper
{ {
width: 100%; position: relative;
margin-bottom: 40px; min-height: 500px;
} }
#recent_uploads_table #recent_uploads_table
{ {
width: 100%; width: 100%;
table-layout: fixed;
} }
#recent_uploads_table_wrapper #recent_uploads_table_wrapper
{ {
width: 100%; position: absolute;
} }
table#recent_uploads_table td table#recent_uploads_table td
@ -263,16 +265,16 @@ table#recent_uploads_table td
} }
.dropzone { .dropzone {
min-height: 150px; min-height: 30%;
border: 2px solid rgba(0, 0, 0, 0.3); border: 2px solid rgba(0, 0, 0, 0.3);
background: #333; background: #333;
padding: 20px 20px; padding: 20px 20px;
max-height: 300px; max-height: 75%;
overflow-y: auto; overflow-y: auto;
} }
.dropzone.dz-clickable { .dropzone.dz-clickable {
cursor: pointer cursor: pointer;
} }
.dropzone.dz-clickable * { .dropzone.dz-clickable * {
@ -303,7 +305,7 @@ table#recent_uploads_table td
border: 2px dashed rgba(255, 255, 255, 0.2); border: 2px dashed rgba(255, 255, 255, 0.2);
border-radius: 15px; border-radius: 15px;
display: block; display: block;
width: 50%; position: relative;
background-color: rgba(0, 0, 0, 0.1); background-color: rgba(0, 0, 0, 0.1);
-webkit-box-shadow: inset 0px -7px 27px -4px rgba(0,0,0,0.55); -webkit-box-shadow: inset 0px -7px 27px -4px rgba(0,0,0,0.55);
@ -319,7 +321,6 @@ table#recent_uploads_table td
display: inline-block; display: inline-block;
vertical-align: top; vertical-align: top;
margin: 16px; margin: 16px;
/*min-height: 100px*/
} }
.dropzone .dz-preview:hover { .dropzone .dz-preview:hover {

View File

@ -56,8 +56,8 @@
border-spacing: 0px; border-spacing: 0px;
border-collapse: separate; border-collapse: separate;
border: 1px solid #777; border: 1px solid #777;
width: 600px; width: 680px;
margin-left: -100px; margin-left: -140px;
/*background-color: #555;*/ /*background-color: #555;*/
table-layout: fixed; table-layout: fixed;
margin-top: 20px; margin-top: 20px;
@ -65,6 +65,19 @@
box-shadow: 0px 5px 5px rgba(0,0,0,0.5); box-shadow: 0px 5px 5px rgba(0,0,0,0.5);
} }
.pricing-grid .august-promo div {
display: inline-block;
background-color: #ff611f;
padding: 3px 5px;
border-radius: 5px;
margin-left: -5px;
color: #ffffff;
}
.pricing-grid .august-promo span {
text-decoration: line-through;
}
.pricing-grid td, .pricing-grid th .pricing-grid td, .pricing-grid th
{ {
border-bottom: 1px solid #999; border-bottom: 1px solid #999;
@ -223,4 +236,18 @@
{ {
/*text-align: right;*/ /*text-align: right;*/
width: 100%; width: 100%;
} }
#promo-plan-eligible {
margin-top: 10px;
font-size: 13px;
background-color: #ff611f;
padding: 3px 5px;
border-radius: 5px;
color: #ffffff;
}
.promo-banner {
margin-top:10px;
background: url('images/august_aweomse_promo_banner.png') no-repeat;
}

View File

@ -20,25 +20,6 @@
background-color: #242424; background-color: #242424;
} }
.wide-panel {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-flex-flow: column;
flex-flow: column;
/* Account for the left pane */
flex: 6 auto;
min-width: 555px;
}
.outer-datatable-wrapper {
position: relative;
flex: 1;
}
@media screen and (max-width: 1280px) { @media screen and (max-width: 1280px) {
.wrapper { .wrapper {
-webkit-flex-flow: column !important; -webkit-flex-flow: column !important;
@ -146,14 +127,6 @@ div.btn > span {
left: 4px; left: 4px;
} }
.dataTables_scrolling {
position: absolute;
bottom: 37px; /* 36 px is the size of the header/footer + 1px because there's no internal border */
top: 37px;
left: 0;
right: 0;
}
#library_display, #show_builder_table { #library_display, #show_builder_table {
border: none; border: none;
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

View File

@ -862,6 +862,11 @@ dl.inline-list dd {
color: #ccc; color: #ccc;
} }
#recent_uploads_table_wrapper .datatable tr td {
overflow: hidden;
text-overflow: ellipsis;
}
.datatable tr, .datatable td, .datatable tr, .datatable td,
.dataTable tr, .dataTable td .dataTable tr, .dataTable td
{ {
@ -3632,9 +3637,13 @@ button.btn-icon-text > i.icon-white {
/* Uploads/Dropzone */ /* Uploads/Dropzone */
#upload_form { #upload_form {
width: 100%; /* width: 100%;
min-width: 555px; min-width: 555px;*/
margin-bottom: 10px; margin-bottom: 10px;
margin-right: 10px;
height: 100%;
position:relative;
max-width: 50%;
} }
#sub-menu-wrapper { #sub-menu-wrapper {
@ -3783,3 +3792,29 @@ li .ui-state-hover {
border: 0px; border: 0px;
} }
.wide-panel {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-flex-flow: column;
flex-flow: column;
/* Account for the left pane */
flex: 6 auto;
min-width: 500px;
}
.outer-datatable-wrapper {
position: relative;
flex: 1;
}
.dataTables_scrolling {
position: absolute;
bottom: 37px; /* 36 px is the size of the header/footer + 1px because there's no internal border */
top: 37px;
left: 0;
right: 0;
}

View File

@ -231,7 +231,7 @@ function showHint(h) {
function getUsabilityHint() { function getUsabilityHint() {
var pathname = window.location.pathname; var pathname = window.location.pathname;
$.getJSON("/api/get-usability-hint", {"format": "json", "userPath": pathname}, function(json) { $.getJSON(baseUrl + "api/get-usability-hint", {"format": "json", "userPath": pathname}, function(json) {
var $hint_div = $('.usability_hint'); var $hint_div = $('.usability_hint');
var current_hint = $hint_div.html(); var current_hint = $hint_div.html();
if (json === "") { if (json === "") {

View File

@ -14,10 +14,11 @@ $(document).ready(function() {
Object.freeze(self.IMPORT_STATUS_CODES); Object.freeze(self.IMPORT_STATUS_CODES);
} }
console.log(acceptedMimeTypes.join());
Dropzone.options.addMediaDropzone = { Dropzone.options.addMediaDropzone = {
url:'/rest/media', url:'/rest/media',
//clickable: false, //clickable: false,
acceptedFiles: acceptedMimeTypes.join(), acceptedFiles: acceptedMimeTypes.join() + ",.flac",
init: function () { init: function () {
this.on("sending", function (file, xhr, data) { this.on("sending", function (file, xhr, data) {
data.append("csrf_token", $("#csrf").val()); data.append("csrf_token", $("#csrf").val());

View File

@ -7,7 +7,7 @@ audio/mpeg3 mp3
audio/x-aac aac audio/x-aac aac
audio/aac aac audio/aac aac
audio/aacp aac audio/aacp aac
audio/mp4 mp4 audio/mp4 m4a
audio/x-flac flac audio/x-flac flac
audio/wav wav audio/wav wav
audio/x-wav wav audio/x-wav wav