diff --git a/airtime_mvc/application/controllers/ScheduleController.php b/airtime_mvc/application/controllers/ScheduleController.php index 6e8e445fa..cc4acd49e 100644 --- a/airtime_mvc/application/controllers/ScheduleController.php +++ b/airtime_mvc/application/controllers/ScheduleController.php @@ -310,13 +310,9 @@ class ScheduleController extends Zend_Controller_Action return; } - $start = explode(" ", $start_timestamp); - $end = explode(" ", $end_timestamp); - $startTime = explode(":", $start[1]); - $endTime = explode(":", $end[1]); - $dateInfo_s = getDate(strtotime($start_timestamp)); - $dateInfo_e = getDate(strtotime($end_timestamp)); - + $dateInfo_s = getDate(strtotime(Application_Model_DateHelper::ConvertToLocalDateTimeString($start_timestamp))); + $dateInfo_e = getDate(strtotime(Application_Model_DateHelper::ConvertToLocalDateTimeString($end_timestamp))); + $this->view->showContent = $show->getShowContent(); $this->view->timeFilled = $show->getTimeScheduled(); $this->view->showName = $show->getName(); @@ -329,8 +325,8 @@ class ScheduleController extends Zend_Controller_Action $this->view->e_wday = $dateInfo_e['weekday']; $this->view->e_month = $dateInfo_e['month']; $this->view->e_day = $dateInfo_e['mday']; - $this->view->startTime = sprintf("%d:%02d", $startTime[0], $startTime[1]); - $this->view->endTime = sprintf("%d:%02d", $endTime[0], $endTime[1]); + $this->view->startTime = sprintf("%02d:%02d", $dateInfo_s['hours'], $dateInfo_s['minutes']); + $this->view->endTime = sprintf("%02d:%02d", $dateInfo_e['hours'], $dateInfo_e['minutes']); $this->view->chosen = $this->view->render('schedule/scheduled-content.phtml'); $this->view->dialog = $this->view->render('schedule/schedule-show-dialog.phtml'); diff --git a/airtime_mvc/application/forms/AddUser.php b/airtime_mvc/application/forms/AddUser.php index 43b76495c..1f00f7865 100644 --- a/airtime_mvc/application/forms/AddUser.php +++ b/airtime_mvc/application/forms/AddUser.php @@ -81,7 +81,7 @@ class Application_Form_AddUser extends Zend_Form $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('class', 'ui-button ui-state-default right-floated'); $submit->setIgnore(true); - $submit->setLabel('Submit'); + $submit->setLabel('Save'); $this->addElement($submit); } diff --git a/airtime_mvc/application/forms/AdvancedSearch.php b/airtime_mvc/application/forms/AdvancedSearch.php index ff074718b..4c15795b7 100644 --- a/airtime_mvc/application/forms/AdvancedSearch.php +++ b/airtime_mvc/application/forms/AdvancedSearch.php @@ -16,7 +16,7 @@ class Application_Form_AdvancedSearch extends Zend_Form // Add the submit button $this->addElement('button', 'search_submit', array( 'ignore' => true, - 'label' => 'Submit', + 'label' => 'Save', 'order' => '-1' )); $this->getElement('search_submit')->removeDecorator('DtDdWrapper'); diff --git a/airtime_mvc/application/forms/EditAudioMD.php b/airtime_mvc/application/forms/EditAudioMD.php index 423ef1025..a4968644f 100644 --- a/airtime_mvc/application/forms/EditAudioMD.php +++ b/airtime_mvc/application/forms/EditAudioMD.php @@ -134,7 +134,7 @@ class Application_Form_EditAudioMD extends Zend_Form $this->addElement('submit', 'submit', array( 'ignore' => true, 'class' => 'ui-button ui-state-default', - 'label' => 'Submit', + 'label' => 'Save', 'decorators' => array( 'ViewHelper' ) diff --git a/airtime_mvc/application/forms/PlaylistMetadata.php b/airtime_mvc/application/forms/PlaylistMetadata.php index 15de97699..d53a4ddab 100644 --- a/airtime_mvc/application/forms/PlaylistMetadata.php +++ b/airtime_mvc/application/forms/PlaylistMetadata.php @@ -24,7 +24,7 @@ class Application_Form_PlaylistMetadata extends Zend_Form{ // Add the comment element $this->addElement('button', 'new_playlist_submit', array( - 'label' => 'Submit', + 'label' => 'Save', 'ignore' => true )); } diff --git a/airtime_mvc/application/forms/RegisterAirtime.php b/airtime_mvc/application/forms/RegisterAirtime.php index 694224b9d..4ca52e27c 100644 --- a/airtime_mvc/application/forms/RegisterAirtime.php +++ b/airtime_mvc/application/forms/RegisterAirtime.php @@ -1,5 +1,7 @@ <?php +require_once 'customfilters/ImageSize.php'; + class Application_Form_RegisterAirtime extends Zend_Form { @@ -102,12 +104,8 @@ class Application_Form_RegisterAirtime extends Zend_Form ->setRequired(false) ->setDecorators(array('File')) ->addValidator('Count', false, 1) - ->addValidator('Extension', false, 'jpg,png,gif') - ->addValidator('ImageSize', false, array( - 'minwidth' => 200, - 'minheight' => 200, - 'maxwidth' => 600, - 'maxheight' => 600)); + ->addValidator('Extension', false, 'jpg,jpeg,png,gif') + ->addFilter('ImageSize'); $this->addElement($upload); //enable support feedback diff --git a/airtime_mvc/application/forms/SupportSettings.php b/airtime_mvc/application/forms/SupportSettings.php index 605e85878..ab97000e7 100644 --- a/airtime_mvc/application/forms/SupportSettings.php +++ b/airtime_mvc/application/forms/SupportSettings.php @@ -1,5 +1,7 @@ <?php +require_once 'customfilters/ImageSize.php'; + class Application_Form_SupportSettings extends Zend_Form { @@ -99,12 +101,8 @@ class Application_Form_SupportSettings extends Zend_Form ->setRequired(false) ->setDecorators(array('File')) ->addValidator('Count', false, 1) - ->addValidator('Extension', false, 'jpg,png,gif') - ->addValidator('ImageSize', false, array( - 'minwidth' => 200, - 'minheight' => 200, - 'maxwidth' => 600, - 'maxheight' => 600)); + ->addValidator('Extension', false, 'jpg,jpeg,png,gif') + ->addFilter('ImageSize'); $upload->setAttrib('accept', 'image/jpeg,image/gif,image/png,image/jpg'); $this->addElement($upload); @@ -153,7 +151,7 @@ class Application_Form_SupportSettings extends Zend_Form $submit = new Zend_Form_Element_Submit("submit"); $submit->class = 'ui-button ui-state-default right-floated'; $submit->setIgnore(true) - ->setLabel("Submit") + ->setLabel("Save") ->setDecorators(array('ViewHelper')); $this->addElement($submit); } diff --git a/airtime_mvc/application/forms/customfilters/ImageSize.php b/airtime_mvc/application/forms/customfilters/ImageSize.php new file mode 100644 index 000000000..9dcfffffe --- /dev/null +++ b/airtime_mvc/application/forms/customfilters/ImageSize.php @@ -0,0 +1,42 @@ +<?php + +class Zend_Filter_ImageSize implements Zend_Filter_Interface { + + public function filter($value) { + if(!file_exists($value)) { + throw new Zend_Filter_Exception('Image does not exist: ' . $value); + } + + $image = imageCreateFromString(file_get_contents($value)); + if(false === $image) { + throw new Zend_Filter_Exception('Can\'t load image: ' . $value); + } + + // find ratio to scale down to + // TODO: pass 600 as parameter in the future + $origWidth = imagesx($image); + $origHeight = imagesy($image); + $ratio = max($origWidth, $origHeight) / 600; + if($ratio < 1) { + return; + } + + // create a scaled down image + $newWidth = round($origWidth / $ratio); + $newHeight = round($origHeight / $ratio); + $resized = imagecreatetruecolor($newWidth, $newHeight); + imagecopyresampled($resized, $image, 0, 0, 0, 0, $newWidth, $newHeight, $origWidth, $origHeight); + + // determine type and store to disk + $explodeResult = explode(".", $value); + $type = $explodeResult[count($explodeResult) - 1]; + $writeFunc = 'image' . $type; + if($type == 'jpeg' || $type == 'jpg') { + imagejpeg($resized, $value, 100); + } else { + $writeFunc($resized, $value); + } + } +} + +?> diff --git a/airtime_mvc/application/models/Preference.php b/airtime_mvc/application/models/Preference.php index f7fca885e..af7ea4924 100644 --- a/airtime_mvc/application/models/Preference.php +++ b/airtime_mvc/application/models/Preference.php @@ -7,7 +7,7 @@ class Application_Model_Preference global $CC_CONFIG, $CC_DBC; //called from a daemon process - if(!Zend_Auth::getInstance()->hasIdentity()) { + if(!class_exists("Zend_Auth", false) || !Zend_Auth::getInstance()->hasIdentity()) { $id = NULL; } else { @@ -369,11 +369,16 @@ class Application_Model_Preference $outputArray['NUM_OF_SCHEDULED_PLAYLISTS'] = Application_Model_Schedule::getSchduledPlaylistCount(); $outputArray['NUM_OF_PAST_SHOWS'] = Application_Model_ShowInstance::GetShowInstanceCount(date("Y-m-d H:i:s")); $outputArray['UNIQUE_ID'] = self::GetUniqueId(); + $outputArray['SAAS'] = self::GetPlanLevel(); + $outputArray['INSTALL_METHOD'] = self::GetInstallMethod(); $outputArray = array_merge($systemInfoArray, $outputArray); $outputString = "\n"; foreach($outputArray as $key => $out){ + if($key == 'SAAS' && ($out != '' || $out != 'disabled')){ + continue; + } if($out != ''){ $outputString .= $key.' : '.$out."\n"; } @@ -386,6 +391,20 @@ class Application_Model_Preference return $outputString; } } + + public static function GetInstallMethod(){ + $easy_install = file_exists('/usr/bin/airtime-easy-install'); + $debian_install = file_exists('/var/lib/dpkg/info/airtime.config'); + if($debian_install){ + if($easy_install){ + return "easy_install"; + }else{ + return "debian_install"; + } + }else{ + return "manual_install"; + } + } public static function SetRemindMeDate($now){ $weekAfter = mktime(0, 0, 0, date("m") , date("d")+7, date("Y")); @@ -446,7 +465,11 @@ class Application_Model_Preference } public static function GetPlanLevel(){ - return self::GetValue("plan_level"); + $plan = self::GetValue("plan_level"); + if(trim($plan) == ''){ + $plan = 'disabled'; + } + return $plan; } public static function SetTrialEndingDate($date){ diff --git a/airtime_mvc/application/views/scripts/form/register-dialog.phtml b/airtime_mvc/application/views/scripts/form/register-dialog.phtml index acb461be5..8faeb5913 100644 --- a/airtime_mvc/application/views/scripts/form/register-dialog.phtml +++ b/airtime_mvc/application/views/scripts/form/register-dialog.phtml @@ -144,7 +144,7 @@ <?php }?> <?php echo $this->element->getElement('Logo') ?> - <p class="info-text">Min. size: 200x200 Max. size: 600x600</p> + <p class="info-text">Note: Anything larger than 600x600 will be resized.</p> <?php if($this->element->getElement('Logo')->hasErrors()) : ?> <ul class='errors'> <?php foreach($this->element->getElement('Logo')->getMessages() as $error): ?> diff --git a/airtime_mvc/application/views/scripts/form/support-setting.phtml b/airtime_mvc/application/views/scripts/form/support-setting.phtml index 9794f8159..e4b1621c4 100644 --- a/airtime_mvc/application/views/scripts/form/support-setting.phtml +++ b/airtime_mvc/application/views/scripts/form/support-setting.phtml @@ -138,7 +138,7 @@ <?php }?> <?php echo $this->element->getElement('Logo') ?> - <div class="info-text"><p>Min. size: 200x200 Max. size: 600x600</p></div> + <div class="info-text"><p>Note: Anything larger than 600x600 will be resized.</p></div> <?php if($this->element->getElement('Logo')->hasErrors()) : ?> <ul class='errors'> <?php foreach($this->element->getElement('Logo')->getMessages() as $error): ?> diff --git a/airtime_mvc/public/css/styles.css b/airtime_mvc/public/css/styles.css index 297cc30f3..9671cf476 100644 --- a/airtime_mvc/public/css/styles.css +++ b/airtime_mvc/public/css/styles.css @@ -1618,6 +1618,10 @@ div.success{ width: 500px; } +.preferences .padded { + margin-top: 5px; /* Firefox needs this */ +} + dt.block-display, dd.block-display { display: block; float: none; diff --git a/python_apps/media-monitor/airtimefilemonitor/airtimeprocessevent.py b/python_apps/media-monitor/airtimefilemonitor/airtimeprocessevent.py index af8658c2a..cfd605cf2 100644 --- a/python_apps/media-monitor/airtimefilemonitor/airtimeprocessevent.py +++ b/python_apps/media-monitor/airtimefilemonitor/airtimeprocessevent.py @@ -274,7 +274,8 @@ class AirtimeProcessEvent(ProcessEvent): # check if file exist # When whole directory is copied to the organized dir, # inotify doesn't fire IN_CLOSE_WRITE, hench we need special way of - # handling those cases. + # handling those cases. We are manully calling handle_created_file + # function. if os.path.exists(k): # check if file is open command = "lsof "+k