CC-2166: Packaging Improvements. Moved the Zend app into airtime_mvc. It is now installed to /var/www/airtime. Storage is now set to /srv/airtime/stor. Utils are now installed to /usr/lib/airtime/utils/. Added install/airtime-dircheck.php as a simple test to see if everything is install/uninstalled correctly.
This commit is contained in:
parent
514777e8d2
commit
b11cbd8159
4546 changed files with 138 additions and 51 deletions
|
@ -0,0 +1,73 @@
|
|||
<?php
|
||||
|
||||
class Application_Form_AddShowAbsoluteRebroadcastDates extends Zend_Form_SubForm
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->setDecorators(array(
|
||||
array('ViewScript', array('viewScript' => 'form/add-show-rebroadcast-absolute.phtml'))
|
||||
));
|
||||
|
||||
for($i=1; $i<=10; $i++) {
|
||||
|
||||
$text = new Zend_Form_Element_Text("add_show_rebroadcast_date_absolute_$i");
|
||||
$text->setAttrib('class', 'input_text');
|
||||
$text->addFilter('StringTrim');
|
||||
$text->addValidator('date', false, array('YYYY-MM-DD'));
|
||||
$text->setRequired(false);
|
||||
$text->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($text);
|
||||
|
||||
$text = new Zend_Form_Element_Text("add_show_rebroadcast_time_absolute_$i");
|
||||
$text->setAttrib('class', 'input_text');
|
||||
$text->addFilter('StringTrim');
|
||||
$text->addValidator('date', false, array('HH:mm'));
|
||||
$text->addValidator('regex', false, array('/^[0-9:]+$/', 'messages' => 'Invalid character entered'));
|
||||
$text->setRequired(false);
|
||||
$text->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($text);
|
||||
}
|
||||
}
|
||||
|
||||
public function checkReliantFields($formData) {
|
||||
|
||||
$valid = true;
|
||||
|
||||
for($i=1; $i<=10; $i++) {
|
||||
|
||||
$day = $formData['add_show_rebroadcast_date_absolute_'.$i];
|
||||
|
||||
if(trim($day) == "") {
|
||||
continue;
|
||||
}
|
||||
|
||||
$time = $formData['add_show_rebroadcast_time_absolute_'.$i];
|
||||
if (trim($time) == ""){
|
||||
$this->getElement('add_show_rebroadcast_time_absolute_'.$i)->setErrors(array("Time must be specified"));
|
||||
$valid = false;
|
||||
}
|
||||
|
||||
$show_start_time = $formData['add_show_start_date']."".$formData['add_show_start_time'];
|
||||
$show_end = new DateTime($show_start_time);
|
||||
|
||||
$duration = $formData['add_show_duration'];
|
||||
$duration = explode(":", $duration);
|
||||
|
||||
$show_end->add(new DateInterval("PT$duration[0]H"));
|
||||
$show_end->add(new DateInterval("PT$duration[1]M"));
|
||||
$show_end->add(new DateInterval("PT1H"));//min time to wait until a rebroadcast
|
||||
|
||||
$rebroad_start = $day."".$formData['add_show_rebroadcast_time_absolute_'.$i];
|
||||
$rebroad_start = new DateTime($rebroad_start);
|
||||
|
||||
if($rebroad_start < $show_end) {
|
||||
$this->getElement('add_show_rebroadcast_time_absolute_'.$i)->setErrors(array("Must wait at least 1 hour to rebroadcast"));
|
||||
$valid = false;
|
||||
}
|
||||
}
|
||||
|
||||
return $valid;
|
||||
}
|
||||
}
|
||||
|
23
airtime_mvc/application/forms/AddShowRR.php
Normal file
23
airtime_mvc/application/forms/AddShowRR.php
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
class Application_Form_AddShowRR extends Zend_Form_SubForm
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
// Add record element
|
||||
$this->addElement('checkbox', 'add_show_record', array(
|
||||
'label' => 'Record?',
|
||||
'required' => false,
|
||||
));
|
||||
|
||||
// Add record element
|
||||
$this->addElement('checkbox', 'add_show_rebroadcast', array(
|
||||
'label' => 'Rebroadcast?',
|
||||
'required' => false,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
82
airtime_mvc/application/forms/AddShowRebroadcastDates.php
Normal file
82
airtime_mvc/application/forms/AddShowRebroadcastDates.php
Normal file
|
@ -0,0 +1,82 @@
|
|||
<?php
|
||||
|
||||
class Application_Form_AddShowRebroadcastDates extends Zend_Form_SubForm
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->setDecorators(array(
|
||||
array('ViewScript', array('viewScript' => 'form/add-show-rebroadcast.phtml'))
|
||||
));
|
||||
|
||||
$relativeDates = array();
|
||||
$relativeDates[""] = "";
|
||||
for($i=0; $i<=30; $i++) {
|
||||
$relativeDates["$i days"] = "+$i days";
|
||||
}
|
||||
|
||||
for($i=1; $i<=10; $i++) {
|
||||
|
||||
$select = new Zend_Form_Element_Select("add_show_rebroadcast_date_$i");
|
||||
$select->setAttrib('class', 'input_select');
|
||||
$select->setMultiOptions($relativeDates);
|
||||
$select->setRequired(false);
|
||||
$select->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($select);
|
||||
|
||||
$text = new Zend_Form_Element_Text("add_show_rebroadcast_time_$i");
|
||||
$text->setAttrib('class', 'input_text');
|
||||
$text->addFilter('StringTrim');
|
||||
$text->addValidator('date', false, array('HH:mm'));
|
||||
$text->addValidator('regex', false, array('/^[0-9:]+$/', 'messages' => 'Invalid character entered'));
|
||||
$text->setRequired(false);
|
||||
$text->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($text);
|
||||
}
|
||||
}
|
||||
|
||||
public function checkReliantFields($formData) {
|
||||
|
||||
$valid = true;
|
||||
|
||||
for($i=1; $i<=5; $i++) {
|
||||
|
||||
$days = $formData['add_show_rebroadcast_date_'.$i];
|
||||
|
||||
if(trim($days) == "") {
|
||||
continue;
|
||||
}
|
||||
|
||||
$time = $formData['add_show_rebroadcast_time_'.$i];
|
||||
if (trim($time) == ""){
|
||||
$this->getElement('add_show_rebroadcast_time_'.$i)->setErrors(array("Time must be specified"));
|
||||
$valid = false;
|
||||
}
|
||||
|
||||
$days = explode(" ", $days);
|
||||
$day = $days[0];
|
||||
|
||||
$show_start_time = $formData['add_show_start_date']."".$formData['add_show_start_time'];
|
||||
$show_end = new DateTime($show_start_time);
|
||||
|
||||
$duration = $formData['add_show_duration'];
|
||||
$duration = explode(":", $duration);
|
||||
|
||||
$show_end->add(new DateInterval("PT$duration[0]H"));
|
||||
$show_end->add(new DateInterval("PT$duration[1]M"));
|
||||
$show_end->add(new DateInterval("PT1H"));//min time to wait until a rebroadcast
|
||||
|
||||
$rebroad_start = $formData['add_show_start_date']."".$formData['add_show_rebroadcast_time_'.$i];
|
||||
$rebroad_start = new DateTime($rebroad_start);
|
||||
$rebroad_start->add(new DateInterval("P".$day."D"));
|
||||
|
||||
if($rebroad_start < $show_end) {
|
||||
$this->getElement('add_show_rebroadcast_time_'.$i)->setErrors(array("Must wait at least 1 hour to rebroadcast"));
|
||||
$valid = false;
|
||||
}
|
||||
}
|
||||
|
||||
return $valid;
|
||||
}
|
||||
}
|
||||
|
77
airtime_mvc/application/forms/AddShowRepeats.php
Normal file
77
airtime_mvc/application/forms/AddShowRepeats.php
Normal file
|
@ -0,0 +1,77 @@
|
|||
<?php
|
||||
|
||||
class Application_Form_AddShowRepeats extends Zend_Form_SubForm
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
//Add type select
|
||||
$this->addElement('select', 'add_show_repeat_type', array(
|
||||
'required' => true,
|
||||
'label' => 'Repeat Type:',
|
||||
'class' => ' input_select',
|
||||
'multiOptions' => array(
|
||||
"0" => "weekly",
|
||||
"1" => "bi-weekly",
|
||||
"2" => "monthly"
|
||||
),
|
||||
));
|
||||
|
||||
// Add days checkboxes
|
||||
$this->addElement(
|
||||
'multiCheckbox',
|
||||
'add_show_day_check',
|
||||
array(
|
||||
'label' => 'Select Days:',
|
||||
'required' => false,
|
||||
'multiOptions' => array(
|
||||
"0" => "Sun",
|
||||
"1" => "Mon",
|
||||
"2" => "Tue",
|
||||
"3" => "Wed",
|
||||
"4" => "Thu",
|
||||
"5" => "Fri",
|
||||
"6" => "Sat",
|
||||
),
|
||||
));
|
||||
|
||||
// Add end date element
|
||||
$this->addElement('text', 'add_show_end_date', array(
|
||||
'label' => 'Date End:',
|
||||
'class' => 'input_text',
|
||||
'value' => date("Y-m-d"),
|
||||
'required' => false,
|
||||
'filters' => array('StringTrim'),
|
||||
'validators' => array(
|
||||
'NotEmpty',
|
||||
array('date', false, array('YYYY-MM-DD'))
|
||||
)
|
||||
));
|
||||
|
||||
// Add no end element
|
||||
$this->addElement('checkbox', 'add_show_no_end', array(
|
||||
'label' => 'No End?',
|
||||
'required' => false,
|
||||
));
|
||||
}
|
||||
|
||||
public function checkReliantFields($formData) {
|
||||
|
||||
if (!$formData['add_show_no_end']){
|
||||
$start_timestamp = $formData['add_show_start_date'];
|
||||
$end_timestamp = $formData['add_show_end_date'];
|
||||
|
||||
$start_epoch = strtotime($start_timestamp);
|
||||
$end_epoch = strtotime($end_timestamp);
|
||||
|
||||
if($end_epoch < $start_epoch) {
|
||||
$this->getElement('add_show_end_date')->setErrors(array('End date must be after start date'));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
39
airtime_mvc/application/forms/AddShowStyle.php
Normal file
39
airtime_mvc/application/forms/AddShowStyle.php
Normal file
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
class Application_Form_AddShowStyle extends Zend_Form_SubForm
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
// Add show background-color input
|
||||
$this->addElement('text', 'add_show_background_color', array(
|
||||
'label' => 'Background Colour:',
|
||||
'class' => 'input_text',
|
||||
'filters' => array('StringTrim')
|
||||
));
|
||||
|
||||
$bg = $this->getElement('add_show_background_color');
|
||||
|
||||
$bg->setDecorators(array(array('ViewScript', array(
|
||||
'viewScript' => 'form/add-show-style.phtml',
|
||||
'class' => 'big'
|
||||
))));
|
||||
|
||||
// Add show color input
|
||||
$this->addElement('text', 'add_show_color', array(
|
||||
'label' => 'Text Colour:',
|
||||
'class' => 'input_text',
|
||||
'filters' => array('StringTrim')
|
||||
));
|
||||
|
||||
$c = $this->getElement('add_show_color');
|
||||
|
||||
$c->setDecorators(array(array('ViewScript', array(
|
||||
'viewScript' => 'form/add-show-style.phtml',
|
||||
'class' => 'big'
|
||||
))));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
58
airtime_mvc/application/forms/AddShowWhat.php
Normal file
58
airtime_mvc/application/forms/AddShowWhat.php
Normal file
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
|
||||
class Application_Form_AddShowWhat extends Zend_Form_SubForm
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
// Hidden element to indicate whether the show is new or
|
||||
// whether we are updating an existing show.
|
||||
$this->addElement('hidden', 'add_show_id', array(
|
||||
'decorators' => array('ViewHelper')
|
||||
));
|
||||
|
||||
// Add name element
|
||||
$this->addElement('text', 'add_show_name', array(
|
||||
'label' => 'Name:',
|
||||
'class' => 'input_text',
|
||||
'required' => true,
|
||||
'filters' => array('StringTrim'),
|
||||
'validators' => array('NotEmpty')
|
||||
));
|
||||
|
||||
// Add URL element
|
||||
$this->addElement('text', 'add_show_url', array(
|
||||
'label' => 'URL:',
|
||||
'class' => 'input_text',
|
||||
'required' => false,
|
||||
'filters' => array('StringTrim'),
|
||||
'validators' => array('NotEmpty')
|
||||
));
|
||||
|
||||
// Add genre element
|
||||
$this->addElement('text', 'add_show_genre', array(
|
||||
'label' => 'Genre:',
|
||||
'class' => 'input_text',
|
||||
'required' => false,
|
||||
'filters' => array('StringTrim')
|
||||
));
|
||||
|
||||
// Add the description element
|
||||
$this->addElement('textarea', 'add_show_description', array(
|
||||
'label' => 'Description:',
|
||||
'required' => false,
|
||||
'class' => 'input_text_area'
|
||||
));
|
||||
|
||||
$descText = $this->getElement('add_show_description');
|
||||
|
||||
$descText->setDecorators(array(array('ViewScript', array(
|
||||
'viewScript' => 'form/add-show-block.phtml',
|
||||
'class' => 'block-display'
|
||||
))));
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
86
airtime_mvc/application/forms/AddShowWhen.php
Normal file
86
airtime_mvc/application/forms/AddShowWhen.php
Normal file
|
@ -0,0 +1,86 @@
|
|||
<?php
|
||||
|
||||
class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
|
||||
//$this->setDisableLoadDefaultDecorators(true);
|
||||
//$this->removeDecorator('DtDdWrapper');
|
||||
|
||||
// Add start date element
|
||||
$this->addElement('text', 'add_show_start_date', array(
|
||||
'label' => 'Date Start:',
|
||||
'class' => 'input_text',
|
||||
'required' => true,
|
||||
'value' => date("Y-m-d"),
|
||||
'filters' => array('StringTrim'),
|
||||
'validators' => array(
|
||||
'NotEmpty',
|
||||
array('date', false, array('YYYY-MM-DD'))
|
||||
)
|
||||
));
|
||||
|
||||
// Add start time element
|
||||
$this->addElement('text', 'add_show_start_time', array(
|
||||
'label' => 'Start Time:',
|
||||
'class' => 'input_text',
|
||||
'required' => true,
|
||||
'value' => '0:00',
|
||||
'filters' => array('StringTrim'),
|
||||
'validators' => array(
|
||||
'NotEmpty',
|
||||
array('date', false, array('HH:mm')),
|
||||
array('regex', false, array('/^[0-9:]+$/', 'messages' => 'Invalid character entered'))
|
||||
)
|
||||
));
|
||||
|
||||
// Add duration element
|
||||
$this->addElement('text', 'add_show_duration', array(
|
||||
'label' => 'Duration:',
|
||||
'class' => 'input_text',
|
||||
'value' => '1:00',
|
||||
'required' => true,
|
||||
'filters' => array('StringTrim'),
|
||||
'validators' => array(
|
||||
'NotEmpty',
|
||||
array('regex', false,
|
||||
array('/^\d+:[0-5][0-9]$/',
|
||||
'messages' => 'enter a duration: HH:mm'))
|
||||
)
|
||||
));
|
||||
|
||||
// Add repeats element
|
||||
$this->addElement('checkbox', 'add_show_repeats', array(
|
||||
'label' => 'Repeats?',
|
||||
'required' => false,
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
public function checkReliantFields($formData) {
|
||||
|
||||
$valid = true;
|
||||
|
||||
$now_timestamp = date("Y-m-d H:i:s");
|
||||
$start_timestamp = $formData['add_show_start_date']."".$formData['add_show_start_time'];
|
||||
|
||||
$now_epoch = strtotime($now_timestamp);
|
||||
$start_epoch = strtotime($start_timestamp);
|
||||
|
||||
if($start_epoch < $now_epoch) {
|
||||
$this->getElement('add_show_start_time')->setErrors(array('Cannot create show in the past'));
|
||||
$valid = false;
|
||||
}
|
||||
|
||||
if(strtotime("00:00") == strtotime($formData["add_show_duration"])) {
|
||||
$this->getElement('add_show_duration')->setErrors(array('Cannot have duration 00:00'));
|
||||
$valid = false;
|
||||
}
|
||||
|
||||
return $valid;
|
||||
}
|
||||
|
||||
}
|
||||
|
32
airtime_mvc/application/forms/AddShowWho.php
Normal file
32
airtime_mvc/application/forms/AddShowWho.php
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
class Application_Form_AddShowWho extends Zend_Form_SubForm
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
// Add hosts autocomplete
|
||||
$this->addElement('text', 'add_show_hosts_autocomplete', array(
|
||||
'label' => 'Search Users:',
|
||||
'class' => 'input_text ui-autocomplete-input',
|
||||
'required' => false
|
||||
));
|
||||
|
||||
$options = array();
|
||||
$hosts = User::getHosts();
|
||||
|
||||
foreach ($hosts as $host) {
|
||||
$options[$host['value']] = $host['label'];
|
||||
}
|
||||
|
||||
//Add hosts selection
|
||||
$hosts = new Zend_Form_Element_MultiCheckbox('add_show_hosts');
|
||||
$hosts->setLabel('Hosts:')
|
||||
->setMultiOptions($options);
|
||||
|
||||
$this->addElement($hosts);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
103
airtime_mvc/application/forms/AddUser.php
Normal file
103
airtime_mvc/application/forms/AddUser.php
Normal file
|
@ -0,0 +1,103 @@
|
|||
<?php
|
||||
|
||||
class Application_Form_AddUser extends Zend_Form
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
/*
|
||||
$this->addElementPrefixPath('Application_Validate',
|
||||
'../application/validate',
|
||||
'validate');
|
||||
* */
|
||||
|
||||
$hidden = new Zend_Form_Element_Hidden('user_id');
|
||||
$hidden->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($hidden);
|
||||
|
||||
$login = new Zend_Form_Element_Text('login');
|
||||
$login->setLabel('Username:');
|
||||
$login->setAttrib('class', 'input_text');
|
||||
$login->setRequired(true);
|
||||
$login->addFilter('StringTrim');
|
||||
//$login->addValidator('UserNameValidate');
|
||||
$this->addElement($login);
|
||||
|
||||
$password = new Zend_Form_Element_Password('password');
|
||||
$password->setLabel('Password:');
|
||||
$password->setAttrib('class', 'input_text');
|
||||
$password->setRequired(true);
|
||||
$password->addFilter('StringTrim');
|
||||
$password->addValidator('NotEmpty');
|
||||
$this->addElement($password);
|
||||
|
||||
$firstName = new Zend_Form_Element_Text('first_name');
|
||||
$firstName->setLabel('Firstname:');
|
||||
$firstName->setAttrib('class', 'input_text');
|
||||
$firstName->setRequired(true);
|
||||
$firstName->addFilter('StringTrim');
|
||||
$firstName->addValidator('NotEmpty');
|
||||
$this->addElement($firstName);
|
||||
|
||||
$lastName = new Zend_Form_Element_Text('last_name');
|
||||
$lastName->setLabel('Lastname:');
|
||||
$lastName->setAttrib('class', 'input_text');
|
||||
$lastName->setRequired(true);
|
||||
$lastName->addFilter('StringTrim');
|
||||
$lastName->addValidator('NotEmpty');
|
||||
$this->addElement($lastName);
|
||||
|
||||
$email = new Zend_Form_Element_Text('email');
|
||||
$email->setLabel('Email:');
|
||||
$email->setAttrib('class', 'input_text');
|
||||
$email->addFilter('StringTrim');
|
||||
$email->addValidator('EmailAddress');
|
||||
$this->addElement($email);
|
||||
|
||||
$skype = new Zend_Form_Element_Text('skype');
|
||||
$skype->setLabel('Skype:');
|
||||
$skype->setAttrib('class', 'input_text');
|
||||
$skype->addFilter('StringTrim');
|
||||
$this->addElement($skype);
|
||||
|
||||
$jabber = new Zend_Form_Element_Text('jabber');
|
||||
$jabber->setLabel('Jabber:');
|
||||
$jabber->setAttrib('class', 'input_text');
|
||||
$jabber->addFilter('StringTrim');
|
||||
$jabber->addValidator('EmailAddress');
|
||||
$this->addElement($jabber);
|
||||
|
||||
$select = new Zend_Form_Element_Select('type');
|
||||
$select->setLabel('User Type:');
|
||||
$select->setAttrib('class', 'input_select');
|
||||
$select->setAttrib('style', 'width: 40%');
|
||||
$select->setMultiOptions(array(
|
||||
"G" => "Guest",
|
||||
"H" => "Host",
|
||||
"A" => "Admin"
|
||||
));
|
||||
$select->setRequired(true);
|
||||
$this->addElement($select);
|
||||
|
||||
$submit = new Zend_Form_Element_Submit('submit');
|
||||
$submit->setAttrib('class', 'ui-button ui-state-default right-floated');
|
||||
$submit->setIgnore(true);
|
||||
$submit->setLabel('Submit');
|
||||
$this->addElement($submit);
|
||||
}
|
||||
|
||||
public function validateLogin($data){
|
||||
|
||||
if (strlen($data['user_id']) == 0){
|
||||
$count = CcSubjsQuery::create()->filterByDbLogin($data['login'])->count();
|
||||
|
||||
if ($count != 0){
|
||||
$this->getElement('login')->setErrors(array("login name is not unique."));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
65
airtime_mvc/application/forms/AdvancedSearch.php
Normal file
65
airtime_mvc/application/forms/AdvancedSearch.php
Normal file
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
|
||||
class Application_Form_AdvancedSearch extends Zend_Form
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
// Add the add button
|
||||
$this->addElement('button', 'search_add_group', array(
|
||||
'ignore' => true,
|
||||
'label' => 'Add',
|
||||
'order' => '-2'
|
||||
));
|
||||
$this->getElement('search_add_group')->removeDecorator('DtDdWrapper');
|
||||
|
||||
// Add the submit button
|
||||
$this->addElement('button', 'search_submit', array(
|
||||
'ignore' => true,
|
||||
'label' => 'Submit',
|
||||
'order' => '-1'
|
||||
));
|
||||
$this->getElement('search_submit')->removeDecorator('DtDdWrapper');
|
||||
}
|
||||
|
||||
public function addGroup($group_id, $row_id=null) {
|
||||
|
||||
$this->addSubForm(new Application_Form_AdvancedSearchGroup(), 'group_'.$group_id, $group_id);
|
||||
$this->getSubForm('group_'.$group_id)->removeDecorator('DtDdWrapper');
|
||||
|
||||
if(!is_null($row_id)) {
|
||||
$subGroup = $this->getSubForm('group_'.$group_id);
|
||||
$subGroup->addRow($row_id);
|
||||
}
|
||||
}
|
||||
|
||||
public function preValidation(array $data) {
|
||||
|
||||
function findId($name) {
|
||||
$t = explode("_", $name);
|
||||
return $t[1];
|
||||
}
|
||||
|
||||
function findFields($field) {
|
||||
return strpos($field, 'group') !== false;
|
||||
}
|
||||
|
||||
$groups = array_filter(array_keys($data), 'findFields');
|
||||
|
||||
foreach ($groups as $group) {
|
||||
|
||||
$group_id = findId($group);
|
||||
$this->addGroup($group_id);
|
||||
|
||||
$subGroup = $this->getSubForm($group);
|
||||
|
||||
foreach (array_keys($data[$group]) as $row) {
|
||||
|
||||
$row_id = findId($row);
|
||||
$subGroup->addRow($row_id, $data[$group][$row]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
37
airtime_mvc/application/forms/AdvancedSearchGroup.php
Normal file
37
airtime_mvc/application/forms/AdvancedSearchGroup.php
Normal file
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
class Application_Form_AdvancedSearchGroup extends Zend_Form_SubForm
|
||||
{
|
||||
public function init()
|
||||
{
|
||||
// Add the add button
|
||||
$this->addElement('button', 'search_add_row', array(
|
||||
'ignore' => true,
|
||||
'label' => 'Add',
|
||||
'order' => '-2'
|
||||
));
|
||||
$this->getElement('search_add_row')->removeDecorator('DtDdWrapper');
|
||||
|
||||
// Add the add button
|
||||
$this->addElement('button', 'search_remove_group', array(
|
||||
'ignore' => true,
|
||||
'label' => 'Remove',
|
||||
'order' => '-1'
|
||||
));
|
||||
$this->getElement('search_remove_group')->removeDecorator('DtDdWrapper');
|
||||
}
|
||||
|
||||
public function addRow($row_id, $data=null) {
|
||||
|
||||
$this->addSubForm(new Application_Form_AdvancedSearchRow(), 'row_'.$row_id, $row_id);
|
||||
$row = $this->getSubForm('row_'.$row_id);
|
||||
$row->removeDecorator('DtDdWrapper');
|
||||
|
||||
if(!is_null($data)) {
|
||||
$row->setDefaults($data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
70
airtime_mvc/application/forms/AdvancedSearchRow.php
Normal file
70
airtime_mvc/application/forms/AdvancedSearchRow.php
Normal file
|
@ -0,0 +1,70 @@
|
|||
<?php
|
||||
|
||||
class Application_Form_AdvancedSearchRow extends Zend_Form_SubForm
|
||||
{
|
||||
public function init()
|
||||
{
|
||||
$this->addElement(
|
||||
'select',
|
||||
'metadata',
|
||||
array(
|
||||
'required' => true,
|
||||
'multiOptions' => array(
|
||||
"dc:title" => "Title",
|
||||
"dc:format" => "Format",
|
||||
"dc:creator" => "Artist/Creator",
|
||||
"dc:source" => "Album",
|
||||
"ls:bitrate" => "Bitrate",
|
||||
"ls:samplerate" => "Samplerate",
|
||||
"dcterms:extent" => "Length",
|
||||
"dc:description" => "Comments",
|
||||
"dc:type" => "Genre",
|
||||
"ls:channels" => "channels",
|
||||
"ls:year" => "Year",
|
||||
"ls:track_num" => "track_number",
|
||||
"ls:mood" => "mood",
|
||||
"ls:bpm" => "BPM",
|
||||
"ls:rating" => "rating",
|
||||
"ls:encoded_by" => "encoded_by",
|
||||
"dc:publisher" => "label",
|
||||
"ls:composer" => "Composer",
|
||||
"ls:encoder" => "Encoder",
|
||||
"ls:lyrics" => "lyrics",
|
||||
"ls:orchestra" => "orchestra",
|
||||
"ls:conductor" => "conductor",
|
||||
"ls:lyricist" => "lyricist",
|
||||
"ls:originallyricist" => "original_lyricist",
|
||||
"ls:isrcnumber" => "isrc_number",
|
||||
"dc:language" => "Language",
|
||||
),
|
||||
)
|
||||
);
|
||||
$this->getElement('metadata')->removeDecorator('Label')->removeDecorator('HtmlTag');
|
||||
|
||||
$this->addElement(
|
||||
'select',
|
||||
'match',
|
||||
array(
|
||||
'required' => true,
|
||||
'multiOptions' => array(
|
||||
"0" => "partial",
|
||||
"1" => "=",
|
||||
"2" => "<",
|
||||
"3" => "<=",
|
||||
"4" => ">",
|
||||
"5" => ">=",
|
||||
"6" => "!=",
|
||||
),
|
||||
)
|
||||
);
|
||||
$this->getElement('match')->removeDecorator('Label')->removeDecorator('HtmlTag');
|
||||
|
||||
$this->addElement('text', 'search', array(
|
||||
'required' => true,
|
||||
));
|
||||
$this->getElement('search')->removeDecorator('Label')->removeDecorator('HtmlTag');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
118
airtime_mvc/application/forms/EditAudioMD.php
Normal file
118
airtime_mvc/application/forms/EditAudioMD.php
Normal file
|
@ -0,0 +1,118 @@
|
|||
<?php
|
||||
|
||||
class Application_Form_EditAudioMD extends Zend_Form
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
// Set the method for the display form to POST
|
||||
$this->setMethod('post');
|
||||
|
||||
// Add title field
|
||||
$this->addElement('text', 'track_title', array(
|
||||
'label' => 'Title:',
|
||||
'required' => true,
|
||||
'class' => 'input_text',
|
||||
'filters' => array('StringTrim'),
|
||||
'validators' => array(
|
||||
'NotEmpty',
|
||||
)
|
||||
));
|
||||
|
||||
// Add artist field
|
||||
$this->addElement('text', 'artist_name', array(
|
||||
'label' => 'Artist:',
|
||||
'required' => true,
|
||||
'class' => 'input_text',
|
||||
'filters' => array('StringTrim'),
|
||||
'validators' => array(
|
||||
'NotEmpty',
|
||||
)
|
||||
));
|
||||
|
||||
// Add album field
|
||||
$this->addElement('text', 'album_title', array(
|
||||
'label' => 'Album:',
|
||||
'class' => 'input_text',
|
||||
'filters' => array('StringTrim')
|
||||
));
|
||||
|
||||
// Add genre field
|
||||
$this->addElement('text', 'genre', array(
|
||||
'label' => 'Genre:',
|
||||
'class' => 'input_text',
|
||||
'filters' => array('StringTrim')
|
||||
));
|
||||
|
||||
// Add year field
|
||||
$this->addElement('text', 'year', array(
|
||||
'label' => 'Year:',
|
||||
'class' => 'input_text',
|
||||
'filters' => array('StringTrim'),
|
||||
'validators' => array(
|
||||
array('date', false, array('YYYY-MM-DD')),
|
||||
array('date', false, array('YYYY-MM')),
|
||||
array('date', false, array('YYYY'))
|
||||
)
|
||||
));
|
||||
|
||||
// Add label field
|
||||
$this->addElement('text', 'label', array(
|
||||
'label' => 'Label:',
|
||||
'class' => 'input_text',
|
||||
'filters' => array('StringTrim')
|
||||
));
|
||||
|
||||
// Add composer field
|
||||
$this->addElement('text', 'composer', array(
|
||||
'label' => 'Composer:',
|
||||
'class' => 'input_text',
|
||||
'filters' => array('StringTrim')
|
||||
));
|
||||
|
||||
// Add mood field
|
||||
$this->addElement('text', 'mood', array(
|
||||
'label' => 'Mood:',
|
||||
'class' => 'input_text',
|
||||
'filters' => array('StringTrim')
|
||||
));
|
||||
|
||||
// Add language field
|
||||
$this->addElement('text', 'language', array(
|
||||
'label' => 'Language:',
|
||||
'class' => 'input_text',
|
||||
'filters' => array('StringTrim')
|
||||
));
|
||||
|
||||
// Add the submit button
|
||||
$this->addElement('submit', 'submit', array(
|
||||
'ignore' => true,
|
||||
'class' => 'ui-button ui-state-default',
|
||||
'label' => 'Submit',
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
|
||||
// Add the submit button
|
||||
$this->addElement('button', 'cancel', array(
|
||||
'ignore' => true,
|
||||
'class' => 'ui-button ui-state-default ui-button-text-only md-cancel',
|
||||
'label' => 'Cancel',
|
||||
'onclick' => 'javascript:document.location="/Library"',
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
|
||||
$this->addDisplayGroup(array('submit', 'cancel'), 'submitButtons', array(
|
||||
'decorators' => array(
|
||||
'FormElements',
|
||||
'DtDdWrapper'
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
65
airtime_mvc/application/forms/GeneralPreferences.php
Normal file
65
airtime_mvc/application/forms/GeneralPreferences.php
Normal file
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
|
||||
class Application_Form_GeneralPreferences extends Zend_Form_SubForm
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->setDecorators(array(
|
||||
array('ViewScript', array('viewScript' => 'form/preferences_general.phtml'))
|
||||
));
|
||||
|
||||
//Station name
|
||||
$this->addElement('text', 'stationName', array(
|
||||
'class' => 'input_text',
|
||||
'label' => 'Station Name:',
|
||||
'required' => true,
|
||||
'filters' => array('StringTrim'),
|
||||
'validators' => array('NotEmpty'),
|
||||
'value' => Application_Model_Preference::GetValue("station_name"),
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
|
||||
$defaultFade = Application_Model_Preference::GetDefaultFade();
|
||||
if($defaultFade == ""){
|
||||
$defaultFade = '00:00:00.000000';
|
||||
}
|
||||
|
||||
//Default station fade
|
||||
$this->addElement('text', 'stationDefaultFade', array(
|
||||
'class' => 'input_text',
|
||||
'label' => 'Default Fade:',
|
||||
'required' => false,
|
||||
'filters' => array('StringTrim'),
|
||||
'validators' => array(array('regex', false,
|
||||
array('/^[0-2][0-3]:[0-5][0-9]:[0-5][0-9](\.\d{1,6})?$/',
|
||||
'messages' => 'enter a time 00:00:00{.000000}'))),
|
||||
'value' => $defaultFade,
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
|
||||
$stream_format = new Zend_Form_Element_Radio('streamFormat');
|
||||
$stream_format->setLabel('Stream Label:');
|
||||
$stream_format->setMultiOptions(array("Artist - Title",
|
||||
"Show - Artist - Title",
|
||||
"Station name - Show name"));
|
||||
$stream_format->setValue(Application_Model_Preference::GetStreamLabelFormat());
|
||||
$stream_format->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($stream_format);
|
||||
|
||||
$third_party_api = new Zend_Form_Element_Radio('thirdPartyApi');
|
||||
$third_party_api->setLabel('Allow Remote Websites To Access "Schedule" Info?<br> (Enable this to make front-end widgets work.)');
|
||||
$third_party_api->setMultiOptions(array("Disabled",
|
||||
"Enabled"));
|
||||
$third_party_api->setValue(Application_Model_Preference::GetAllow3rdPartyApi());
|
||||
$third_party_api->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($third_party_api);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
44
airtime_mvc/application/forms/Login.php
Normal file
44
airtime_mvc/application/forms/Login.php
Normal file
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
class Application_Form_Login extends Zend_Form
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
// Set the method for the display form to POST
|
||||
$this->setMethod('post');
|
||||
|
||||
// Add username element
|
||||
$this->addElement('text', 'username', array(
|
||||
'label' => 'Username:',
|
||||
'class' => 'input_text',
|
||||
'required' => true,
|
||||
'filters' => array('StringTrim'),
|
||||
'validators' => array(
|
||||
'NotEmpty',
|
||||
)
|
||||
));
|
||||
|
||||
// Add password element
|
||||
$this->addElement('password', 'password', array(
|
||||
'label' => 'Password:',
|
||||
'class' => 'input_text',
|
||||
'required' => true,
|
||||
'filters' => array('StringTrim'),
|
||||
'validators' => array(
|
||||
'NotEmpty',
|
||||
)
|
||||
));
|
||||
|
||||
// Add the submit button
|
||||
$this->addElement('submit', 'submit', array(
|
||||
'ignore' => true,
|
||||
'label' => 'Login',
|
||||
'class' => 'ui-button ui-widget ui-state-default ui-button-text-only'
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
33
airtime_mvc/application/forms/PlaylistMetadata.php
Normal file
33
airtime_mvc/application/forms/PlaylistMetadata.php
Normal file
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
class Application_Form_PlaylistMetadata extends Zend_Form_SubForm
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
// Add username element
|
||||
$this->addElement('text', 'title', array(
|
||||
'label' => 'Title:',
|
||||
'class' => 'input_text',
|
||||
'required' => false,
|
||||
'filters' => array('StringTrim'),
|
||||
'validators' => array(
|
||||
'NotEmpty',
|
||||
)
|
||||
));
|
||||
|
||||
// Add the comment element
|
||||
$this->addElement('textarea', 'description', array(
|
||||
'label' => 'Description:',
|
||||
'class' => 'input_text_area',
|
||||
'required' => false,
|
||||
));
|
||||
|
||||
// Add the comment element
|
||||
$this->addElement('button', 'new_playlist_submit', array(
|
||||
'label' => 'Submit',
|
||||
'ignore' => true
|
||||
));
|
||||
}
|
||||
}
|
||||
|
30
airtime_mvc/application/forms/Preferences.php
Normal file
30
airtime_mvc/application/forms/Preferences.php
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
class Application_Form_Preferences extends Zend_Form
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->setAction('/Preference');
|
||||
$this->setMethod('post');
|
||||
|
||||
$this->setDecorators(array(
|
||||
array('ViewScript', array('viewScript' => 'form/preferences.phtml'))
|
||||
));
|
||||
|
||||
$general_pref = new Application_Form_GeneralPreferences();
|
||||
$this->addSubForm($general_pref, 'preferences_general');
|
||||
|
||||
$soundcloud_pref = new Application_Form_SoundcloudPreferences();
|
||||
$this->addSubForm($soundcloud_pref, 'preferences_soundcloud');
|
||||
|
||||
$this->addElement('submit', 'submit', array(
|
||||
'class' => 'ui-button ui-state-default right-floated',
|
||||
'ignore' => true,
|
||||
'label' => 'Submit',
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
}
|
||||
}
|
13
airtime_mvc/application/forms/ScheduleShow.php
Normal file
13
airtime_mvc/application/forms/ScheduleShow.php
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
class Application_Form_ScheduleShow extends Zend_Form
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
/* Form Elements & Other Definitions Here ... */
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
115
airtime_mvc/application/forms/SoundcloudPreferences.php
Normal file
115
airtime_mvc/application/forms/SoundcloudPreferences.php
Normal file
|
@ -0,0 +1,115 @@
|
|||
<?php
|
||||
|
||||
class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->setDecorators(array(
|
||||
array('ViewScript', array('viewScript' => 'form/preferences_soundcloud.phtml'))
|
||||
));
|
||||
|
||||
//enable soundcloud uploads
|
||||
$this->addElement('checkbox', 'UseSoundCloud', array(
|
||||
'label' => 'Upload Recorded Shows To SoundCloud',
|
||||
'required' => false,
|
||||
'value' => Application_Model_Preference::GetDoSoundCloudUpload(),
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
|
||||
//SoundCloud Username
|
||||
$this->addElement('text', 'SoundCloudUser', array(
|
||||
'class' => 'input_text',
|
||||
'label' => 'SoundCloud Email:',
|
||||
'required' => false,
|
||||
'filters' => array('StringTrim'),
|
||||
'value' => Application_Model_Preference::GetSoundCloudUser(),
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
|
||||
//SoundCloud Password
|
||||
$this->addElement('password', 'SoundCloudPassword', array(
|
||||
'class' => 'input_text',
|
||||
'label' => 'SoundCloud Password:',
|
||||
'required' => false,
|
||||
'filters' => array('StringTrim'),
|
||||
'value' => Application_Model_Preference::GetSoundCloudPassword(),
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
|
||||
// Add the description element
|
||||
$this->addElement('textarea', 'SoundCloudTags', array(
|
||||
'label' => 'SoundCloud Tags: (separate tags with spaces)',
|
||||
'required' => false,
|
||||
'class' => 'input_text_area',
|
||||
'value' => Application_Model_Preference::GetSoundCloudTags(),
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
|
||||
//SoundCloud default genre
|
||||
$this->addElement('text', 'SoundCloudGenre', array(
|
||||
'class' => 'input_text',
|
||||
'label' => 'Default Genre:',
|
||||
'required' => false,
|
||||
'filters' => array('StringTrim'),
|
||||
'value' => Application_Model_Preference::GetSoundCloudGenre(),
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
|
||||
$select = new Zend_Form_Element_Select('SoundCloudTrackType');
|
||||
$select->setLabel('Default Track Type:');
|
||||
$select->setAttrib('class', 'input_select');
|
||||
$select->setMultiOptions(array(
|
||||
"" => "",
|
||||
"original" => "Original",
|
||||
"remix" => "Remix",
|
||||
"live" => "Live",
|
||||
"recording" => "Recording",
|
||||
"spoken" => "Spoken",
|
||||
"podcast" => "Podcast",
|
||||
"demo" => "Demo",
|
||||
"in progress" => "Work in progress",
|
||||
"stem" => "Stem",
|
||||
"loop" => "Loop",
|
||||
"sound effect" => "Sound Effect",
|
||||
"sample" => "One Shot Sample",
|
||||
"other" => "Other"
|
||||
));
|
||||
$select->setRequired(false);
|
||||
$select->setValue(Application_Model_Preference::GetSoundCloudTrackType());
|
||||
$select->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($select);
|
||||
|
||||
$select = new Zend_Form_Element_Select('SoundCloudLicense');
|
||||
$select->setLabel('Default License:');
|
||||
$select->setAttrib('class', 'input_select');
|
||||
$select->setMultiOptions(array(
|
||||
"" => "",
|
||||
"no-rights-reserved" => "The work is in the public domain",
|
||||
"all-rights-reserved" => "All rights are reserved",
|
||||
"cc-by" => "Creative Commons Attribution",
|
||||
"cc-by-nc" => "Creative Commons Attribution Noncommercial",
|
||||
"cc-by-nd" => "Creative Commons Attribution No Derivative Works",
|
||||
"cc-by-sa" => "Creative Commons Attribution Share Alike",
|
||||
"cc-by-nc-nd" => "Creative Commons Attribution Noncommercial Non Derivate Works",
|
||||
"cc-by-nc-sa" => "Creative Commons Attribution Noncommercial Share Alike"
|
||||
));
|
||||
$select->setRequired(false);
|
||||
$select->setValue(Application_Model_Preference::GetSoundCloudLicense());
|
||||
$select->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($select);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue