From e3e8f1002127179921fc170119fb87fb5b776f2e Mon Sep 17 00:00:00 2001 From: naomiaro Date: Thu, 17 Mar 2011 18:23:05 -0400 Subject: [PATCH] CC-1985 : Automatic rebroadcast of recorded content added url column to cc_shows table, logic to show/hide form components for rebroadcast --- .../controllers/ScheduleController.php | 12 +- .../forms/AddShowAbsoluteRebroadcastDates.php | 158 +++++++++++++++++- application/forms/AddShowRebroadcastDates.php | 157 +++++++++++++++-- application/forms/AddShowWhat.php | 15 +- application/forms/AddShowWhen.php | 4 + application/models/Shows.php | 7 +- .../models/airtime/map/CcShowTableMap.php | 1 + application/models/airtime/om/BaseCcShow.php | 82 +++++++-- .../models/airtime/om/BaseCcShowPeer.php | 31 ++-- .../models/airtime/om/BaseCcShowQuery.php | 26 +++ .../form/add-show-rebroadcast-absolute.phtml | 18 ++ .../scripts/form/add-show-rebroadcast.phtml | 18 ++ .../views/scripts/form/add-show-what.phtml | 0 build/schema.xml | 1 + build/sql/schema.sql | 1 + public/js/airtime/schedule/add-show.js | 58 ++++++- 16 files changed, 529 insertions(+), 60 deletions(-) create mode 100644 application/views/scripts/form/add-show-rebroadcast-absolute.phtml create mode 100644 application/views/scripts/form/add-show-rebroadcast.phtml create mode 100644 application/views/scripts/form/add-show-what.phtml diff --git a/application/controllers/ScheduleController.php b/application/controllers/ScheduleController.php index d3df6f232..8bfab2fd3 100644 --- a/application/controllers/ScheduleController.php +++ b/application/controllers/ScheduleController.php @@ -64,8 +64,7 @@ class ScheduleController extends Zend_Controller_Action $formRepeats->removeDecorator('DtDdWrapper'); $formStyle->removeDecorator('DtDdWrapper'); $formRecord->removeDecorator('DtDdWrapper'); - $formAbsoluteRebroadcast->removeDecorator('DtDdWrapper'); - $formRebroadcast->removeDecorator('DtDdWrapper'); + $this->view->what = $formWhat; $this->view->when = $formWhen; @@ -368,6 +367,7 @@ class ScheduleController extends Zend_Controller_Action $this->view->rr = $formRecord; $this->view->absoluteRebroadcast = $formAbsoluteRebroadcast; $this->view->rebroadcast = $formRebroadcast; + $what = $formWhat->isValid($data); $when = $formWhen->isValid($data); if($when) { @@ -386,8 +386,11 @@ class ScheduleController extends Zend_Controller_Action $who = $formWho->isValid($data); $style = $formStyle->isValid($data); + $record = $formRecord->isValid($data); + $rebroadAb = $formAbsoluteRebroadcast->isValid($data); + $rebroad = $formRebroadcast->isValid($data); - if ($what && $when && $repeats && $who && $style) { + if ($what && $when && $repeats && $who && $style && $record && $rebroadAb && $rebroad) { $userInfo = Zend_Auth::getInstance()->getStorage()->read(); $user = new User($userInfo->id); @@ -405,6 +408,9 @@ class ScheduleController extends Zend_Controller_Action $formRepeats->reset(); $formRepeats->populate(array('add_show_end_date' => date("Y-m-d"))); $formStyle->reset(); + $formRecord->reset(); + $formAbsoluteRebroadcast->reset(); + $formRebroadcast->reset(); $this->view->newForm = $this->view->render('schedule/add-show-form.phtml'); } diff --git a/application/forms/AddShowAbsoluteRebroadcastDates.php b/application/forms/AddShowAbsoluteRebroadcastDates.php index 322f8843d..27e78422c 100644 --- a/application/forms/AddShowAbsoluteRebroadcastDates.php +++ b/application/forms/AddShowAbsoluteRebroadcastDates.php @@ -5,31 +5,177 @@ class Application_Form_AddShowAbsoluteRebroadcastDates extends Zend_Form_SubForm public function init() { + //$this->setDisableLoadDefaultDecorators(true); + + $this->setDecorators(array( + array('ViewScript', array('viewScript' => 'form/add-show-rebroadcast-absolute.phtml')) + )); + // Add start date element $this->addElement('text', 'add_show_rebroadcast_absolute_date_1', array( 'label' => 'Rebroadcast Date:', 'class' => 'input_text', - 'required' => true, - 'value' => date("Y-m-d"), + 'required' => false, + 'value' => '', 'filters' => array('StringTrim'), 'validators' => array( 'NotEmpty', array('date', false, array('YYYY-MM-DD')) - ) + ), + 'decorators' => array( + 'ViewHelper' + ) )); + // Add start time element $this->addElement('text', 'add_show_rebroadcast_absolute_time_1', array( 'label' => 'Rebroadcast Time:', 'class' => 'input_text', - 'required' => true, - 'value' => '0:00', + 'required' => false, + 'value' => '', 'filters' => array('StringTrim'), 'validators' => array( 'NotEmpty', array('date', false, array('HH:mm')) - ) + ), + 'decorators' => array( + 'ViewHelper' + ) )); + + // Add start date element + $this->addElement('text', 'add_show_rebroadcast_absolute_date_2', array( + 'label' => 'Rebroadcast Date:', + 'class' => 'input_text', + 'required' => false, + 'value' => '', + 'filters' => array('StringTrim'), + 'validators' => array( + 'NotEmpty', + array('date', false, array('YYYY-MM-DD')) + ), + 'decorators' => array( + 'ViewHelper' + ) + )); + + + // Add start time element + $this->addElement('text', 'add_show_rebroadcast_absolute_time_2', array( + 'label' => 'Rebroadcast Time:', + 'class' => 'input_text', + 'required' => false, + 'value' => '', + 'filters' => array('StringTrim'), + 'validators' => array( + 'NotEmpty', + array('date', false, array('HH:mm')) + ), + 'decorators' => array( + 'ViewHelper' + ) + )); + + // Add start date element + $this->addElement('text', 'add_show_rebroadcast_absolute_date_3', array( + 'label' => 'Rebroadcast Date:', + 'class' => 'input_text', + 'required' => false, + 'value' => '', + 'filters' => array('StringTrim'), + 'validators' => array( + 'NotEmpty', + array('date', false, array('YYYY-MM-DD')) + ), + 'decorators' => array( + 'ViewHelper' + ) + )); + + + // Add start time element + $this->addElement('text', 'add_show_rebroadcast_absolute_time_3', array( + 'label' => 'Rebroadcast Time:', + 'class' => 'input_text', + 'required' => false, + 'value' => '', + 'filters' => array('StringTrim'), + 'validators' => array( + 'NotEmpty', + array('date', false, array('HH:mm')) + ), + 'decorators' => array( + 'ViewHelper' + ) + )); + + // Add start date element + $this->addElement('text', 'add_show_rebroadcast_absolute_date_4', array( + 'label' => 'Rebroadcast Date:', + 'class' => 'input_text', + 'required' => false, + 'value' => '', + 'filters' => array('StringTrim'), + 'validators' => array( + 'NotEmpty', + array('date', false, array('YYYY-MM-DD')) + ), + 'decorators' => array( + 'ViewHelper' + ) + )); + + + // Add start time element + $this->addElement('text', 'add_show_rebroadcast_absolute_time_4', array( + 'label' => 'Rebroadcast Time:', + 'class' => 'input_text', + 'required' => false, + 'value' => '', + 'filters' => array('StringTrim'), + 'validators' => array( + 'NotEmpty', + array('date', false, array('HH:mm')) + ), + 'decorators' => array( + 'ViewHelper' + ) + )); + + // Add start date element + $this->addElement('text', 'add_show_rebroadcast_absolute_date_5', array( + 'label' => 'Rebroadcast Date:', + 'class' => 'input_text', + 'required' => false, + 'value' => '', + 'filters' => array('StringTrim'), + 'validators' => array( + 'NotEmpty', + array('date', false, array('YYYY-MM-DD')) + ), + 'decorators' => array( + 'ViewHelper' + ) + )); + + + // Add start time element + $this->addElement('text', 'add_show_rebroadcast_absolute_time_5', array( + 'label' => 'Rebroadcast Time:', + 'class' => 'input_text', + 'required' => false, + 'value' => '', + 'filters' => array('StringTrim'), + 'validators' => array( + 'NotEmpty', + array('date', false, array('HH:mm')) + ), + 'decorators' => array( + 'ViewHelper' + ) + )); + } diff --git a/application/forms/AddShowRebroadcastDates.php b/application/forms/AddShowRebroadcastDates.php index 794917bc4..a8e0a67d0 100644 --- a/application/forms/AddShowRebroadcastDates.php +++ b/application/forms/AddShowRebroadcastDates.php @@ -5,33 +5,164 @@ class Application_Form_AddShowRebroadcastDates extends Zend_Form_SubForm public function init() { - //Add type select + $this->setDecorators(array( + array('ViewScript', array('viewScript' => 'form/add-show-rebroadcast.phtml')) + )); + + //Add date select $this->addElement('select', 'add_show_rebroadcast_date_1', array( - 'label' => 'Rebroadcast Day:', - 'required' => true, + 'required' => false, 'class' => ' input_select', 'multiOptions' => array( - "0 days" => "+0 days ", - "1 day" => "+1 day ", + "" => "", + "0 days" => "+0 days", + "1 day" => "+1 day", "2 days" => "+2 days", "3 days" => "+3 days" - ), + ), + 'decorators' => array( + 'ViewHelper' + ) )); // Add start time element - $this->addElement('text', 'add_show_start_time_1', array( - 'label' => 'Rebroadcast Time:', + $this->addElement('text', 'add_show_rebroadcast_time_1', array( 'class' => 'input_text', - 'required' => true, - 'value' => '0:00', + 'required' => false, + 'value' => '', 'filters' => array('StringTrim'), 'validators' => array( 'NotEmpty', array('date', false, array('HH:mm')) - ) + ), + 'decorators' => array( + 'ViewHelper' + ) + )); + + //Add date select + $this->addElement('select', 'add_show_rebroadcast_date_2', array( + 'required' => false, + 'class' => ' input_select', + 'multiOptions' => array( + "" => "", + "0 days" => "+0 days", + "1 day" => "+1 day", + "2 days" => "+2 days", + "3 days" => "+3 days" + ), + 'decorators' => array( + 'ViewHelper' + ) + )); + + // Add start time element + $this->addElement('text', 'add_show_rebroadcast_time_2', array( + 'class' => 'input_text', + 'required' => false, + 'value' => '', + 'filters' => array('StringTrim'), + 'validators' => array( + 'NotEmpty', + array('date', false, array('HH:mm')) + ), + 'decorators' => array( + 'ViewHelper' + ) + )); + + //Add date select + $this->addElement('select', 'add_show_rebroadcast_date_3', array( + 'required' => false, + 'class' => ' input_select', + 'multiOptions' => array( + "" => "", + "0 days" => "+0 days", + "1 day" => "+1 day", + "2 days" => "+2 days", + "3 days" => "+3 days" + ), + 'decorators' => array( + 'ViewHelper' + ) + )); + + // Add start time element + $this->addElement('text', 'add_show_rebroadcast_time_3', array( + 'class' => 'input_text', + 'required' => false, + 'value' => '', + 'filters' => array('StringTrim'), + 'validators' => array( + 'NotEmpty', + array('date', false, array('HH:mm')) + ), + 'decorators' => array( + 'ViewHelper' + ) + )); + + //Add date select + $this->addElement('select', 'add_show_rebroadcast_date_4', array( + 'required' => false, + 'class' => ' input_select', + 'multiOptions' => array( + "" => "", + "0 days" => "+0 days", + "1 day" => "+1 day", + "2 days" => "+2 days", + "3 days" => "+3 days" + ), + 'decorators' => array( + 'ViewHelper' + ) + )); + + // Add start time element + $this->addElement('text', 'add_show_rebroadcast_time_4', array( + 'class' => 'input_text', + 'required' => false, + 'value' => '', + 'filters' => array('StringTrim'), + 'validators' => array( + 'NotEmpty', + array('date', false, array('HH:mm')) + ), + 'decorators' => array( + 'ViewHelper' + ) + )); + + //Add date select + $this->addElement('select', 'add_show_rebroadcast_date_5', array( + 'required' => false, + 'class' => ' input_select', + 'multiOptions' => array( + "" => "", + "0 days" => "+0 days", + "1 day" => "+1 day", + "2 days" => "+2 days", + "3 days" => "+3 days" + ), + 'decorators' => array( + 'ViewHelper' + ) + )); + + // Add start time element + $this->addElement('text', 'add_show_rebroadcast_time_5', array( + 'class' => 'input_text', + 'required' => false, + 'value' => '', + 'filters' => array('StringTrim'), + 'validators' => array( + 'NotEmpty', + array('date', false, array('HH:mm')) + ), + 'decorators' => array( + 'ViewHelper' + ) )); } - - } diff --git a/application/forms/AddShowWhat.php b/application/forms/AddShowWhat.php index 599f5fdc4..7fafdb46e 100644 --- a/application/forms/AddShowWhat.php +++ b/application/forms/AddShowWhat.php @@ -14,13 +14,14 @@ class Application_Form_AddShowWhat extends Zend_Form_SubForm 'validators' => array('NotEmpty') )); - $nameInput = $this->getElement('add_show_name'); - - $nameInput->setDecorators(array(array('ViewScript', array( - 'viewScript' => 'form/add-show-block.phtml', - 'class' => 'block-display' - )))); - + // Add URL element + $this->addElement('text', 'add_show_url', array( + 'label' => 'Show URL:', + 'class' => 'input_text', + 'required' => false, + 'filters' => array('StringTrim'), + 'validators' => array('NotEmpty') + )); // Add the description element $this->addElement('textarea', 'add_show_description', array( diff --git a/application/forms/AddShowWhen.php b/application/forms/AddShowWhen.php index b6e6fa48a..295354c36 100644 --- a/application/forms/AddShowWhen.php +++ b/application/forms/AddShowWhen.php @@ -5,6 +5,10 @@ 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:', diff --git a/application/models/Shows.php b/application/models/Shows.php index a1faadc07..2f9d60de3 100644 --- a/application/models/Shows.php +++ b/application/models/Shows.php @@ -111,6 +111,7 @@ class Show { $show = new CcShow(); $show->setDbName($data['add_show_name']); $show->setDbDescription($data['add_show_description']); + $show->setDbUrl($data['add_show_url']); $show->setDbColor($data['add_show_color']); $show->setDbBackgroundColor($data['add_show_background_color']); $show->save(); @@ -174,7 +175,7 @@ class Show { } //adding rows to cc_show_rebroadcast - if($repeat_type != -1) { + if($data['add_show_record'] && $data['add_show_rebroadcast'] && $repeat_type != -1) { for($i=1; $i<=1; $i++) { @@ -185,9 +186,9 @@ class Show { $showRebroad->save(); } } - else { + else if($data['add_show_record'] && $data['add_show_rebroadcast'] && $repeat_type == -1){ - for($i=1; $i<=1; $i++) { + for($i=1; $i<=5; $i++) { if($data['add_show_rebroadcast_absolute_date_'.$i]) { diff --git a/application/models/airtime/map/CcShowTableMap.php b/application/models/airtime/map/CcShowTableMap.php index c9db01d0b..6d466e7a2 100644 --- a/application/models/airtime/map/CcShowTableMap.php +++ b/application/models/airtime/map/CcShowTableMap.php @@ -40,6 +40,7 @@ class CcShowTableMap extends TableMap { // columns $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null); $this->addColumn('NAME', 'DbName', 'VARCHAR', true, 255, ''); + $this->addColumn('URL', 'DbUrl', 'VARCHAR', false, 255, ''); $this->addColumn('DESCRIPTION', 'DbDescription', 'VARCHAR', false, 512, null); $this->addColumn('COLOR', 'DbColor', 'VARCHAR', false, 6, null); $this->addColumn('BACKGROUND_COLOR', 'DbBackgroundColor', 'VARCHAR', false, 6, null); diff --git a/application/models/airtime/om/BaseCcShow.php b/application/models/airtime/om/BaseCcShow.php index d6c57cac6..7c1ec043d 100644 --- a/application/models/airtime/om/BaseCcShow.php +++ b/application/models/airtime/om/BaseCcShow.php @@ -37,6 +37,13 @@ abstract class BaseCcShow extends BaseObject implements Persistent */ protected $name; + /** + * The value for the url field. + * Note: this column has a database default value of: '' + * @var string + */ + protected $url; + /** * The value for the description field. * @var string @@ -98,6 +105,7 @@ abstract class BaseCcShow extends BaseObject implements Persistent public function applyDefaultValues() { $this->name = ''; + $this->url = ''; } /** @@ -130,6 +138,16 @@ abstract class BaseCcShow extends BaseObject implements Persistent return $this->name; } + /** + * Get the [url] column value. + * + * @return string + */ + public function getDbUrl() + { + return $this->url; + } + /** * Get the [description] column value. * @@ -200,6 +218,26 @@ abstract class BaseCcShow extends BaseObject implements Persistent return $this; } // setDbName() + /** + * Set the value of [url] column. + * + * @param string $v new value + * @return CcShow The current object (for fluent API support) + */ + public function setDbUrl($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->url !== $v || $this->isNew()) { + $this->url = $v; + $this->modifiedColumns[] = CcShowPeer::URL; + } + + return $this; + } // setDbUrl() + /** * Set the value of [description] column. * @@ -274,6 +312,10 @@ abstract class BaseCcShow extends BaseObject implements Persistent return false; } + if ($this->url !== '') { + return false; + } + // otherwise, everything was equal, so return TRUE return true; } // hasOnlyDefaultValues() @@ -298,9 +340,10 @@ abstract class BaseCcShow extends BaseObject implements Persistent $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; $this->name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; - $this->description = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; - $this->color = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; - $this->background_color = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; + $this->url = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->description = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; + $this->color = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; + $this->background_color = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; $this->resetModified(); $this->setNew(false); @@ -309,7 +352,7 @@ abstract class BaseCcShow extends BaseObject implements Persistent $this->ensureConsistency(); } - return $startcol + 5; // 5 = CcShowPeer::NUM_COLUMNS - CcShowPeer::NUM_LAZY_LOAD_COLUMNS). + return $startcol + 6; // 6 = CcShowPeer::NUM_COLUMNS - CcShowPeer::NUM_LAZY_LOAD_COLUMNS). } catch (Exception $e) { throw new PropelException("Error populating CcShow object", $e); @@ -687,12 +730,15 @@ abstract class BaseCcShow extends BaseObject implements Persistent return $this->getDbName(); break; case 2: - return $this->getDbDescription(); + return $this->getDbUrl(); break; case 3: - return $this->getDbColor(); + return $this->getDbDescription(); break; case 4: + return $this->getDbColor(); + break; + case 5: return $this->getDbBackgroundColor(); break; default: @@ -720,9 +766,10 @@ abstract class BaseCcShow extends BaseObject implements Persistent $result = array( $keys[0] => $this->getDbId(), $keys[1] => $this->getDbName(), - $keys[2] => $this->getDbDescription(), - $keys[3] => $this->getDbColor(), - $keys[4] => $this->getDbBackgroundColor(), + $keys[2] => $this->getDbUrl(), + $keys[3] => $this->getDbDescription(), + $keys[4] => $this->getDbColor(), + $keys[5] => $this->getDbBackgroundColor(), ); return $result; } @@ -761,12 +808,15 @@ abstract class BaseCcShow extends BaseObject implements Persistent $this->setDbName($value); break; case 2: - $this->setDbDescription($value); + $this->setDbUrl($value); break; case 3: - $this->setDbColor($value); + $this->setDbDescription($value); break; case 4: + $this->setDbColor($value); + break; + case 5: $this->setDbBackgroundColor($value); break; } // switch() @@ -795,9 +845,10 @@ abstract class BaseCcShow extends BaseObject implements Persistent if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]); if (array_key_exists($keys[1], $arr)) $this->setDbName($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setDbDescription($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setDbColor($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setDbBackgroundColor($arr[$keys[4]]); + if (array_key_exists($keys[2], $arr)) $this->setDbUrl($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setDbDescription($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setDbColor($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setDbBackgroundColor($arr[$keys[5]]); } /** @@ -811,6 +862,7 @@ abstract class BaseCcShow extends BaseObject implements Persistent if ($this->isColumnModified(CcShowPeer::ID)) $criteria->add(CcShowPeer::ID, $this->id); if ($this->isColumnModified(CcShowPeer::NAME)) $criteria->add(CcShowPeer::NAME, $this->name); + if ($this->isColumnModified(CcShowPeer::URL)) $criteria->add(CcShowPeer::URL, $this->url); if ($this->isColumnModified(CcShowPeer::DESCRIPTION)) $criteria->add(CcShowPeer::DESCRIPTION, $this->description); if ($this->isColumnModified(CcShowPeer::COLOR)) $criteria->add(CcShowPeer::COLOR, $this->color); if ($this->isColumnModified(CcShowPeer::BACKGROUND_COLOR)) $criteria->add(CcShowPeer::BACKGROUND_COLOR, $this->background_color); @@ -876,6 +928,7 @@ abstract class BaseCcShow extends BaseObject implements Persistent public function copyInto($copyObj, $deepCopy = false) { $copyObj->setDbName($this->name); + $copyObj->setDbUrl($this->url); $copyObj->setDbDescription($this->description); $copyObj->setDbColor($this->color); $copyObj->setDbBackgroundColor($this->background_color); @@ -1472,6 +1525,7 @@ abstract class BaseCcShow extends BaseObject implements Persistent { $this->id = null; $this->name = null; + $this->url = null; $this->description = null; $this->color = null; $this->background_color = null; diff --git a/application/models/airtime/om/BaseCcShowPeer.php b/application/models/airtime/om/BaseCcShowPeer.php index e883cb5ec..15426809c 100644 --- a/application/models/airtime/om/BaseCcShowPeer.php +++ b/application/models/airtime/om/BaseCcShowPeer.php @@ -26,7 +26,7 @@ abstract class BaseCcShowPeer { const TM_CLASS = 'CcShowTableMap'; /** The total number of columns. */ - const NUM_COLUMNS = 5; + const NUM_COLUMNS = 6; /** The number of lazy-loaded columns. */ const NUM_LAZY_LOAD_COLUMNS = 0; @@ -37,6 +37,9 @@ abstract class BaseCcShowPeer { /** the column name for the NAME field */ const NAME = 'cc_show.NAME'; + /** the column name for the URL field */ + const URL = 'cc_show.URL'; + /** the column name for the DESCRIPTION field */ const DESCRIPTION = 'cc_show.DESCRIPTION'; @@ -62,12 +65,12 @@ abstract class BaseCcShowPeer { * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ private static $fieldNames = array ( - BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbDescription', 'DbColor', 'DbBackgroundColor', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbDescription', 'dbColor', 'dbBackgroundColor', ), - BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::DESCRIPTION, self::COLOR, self::BACKGROUND_COLOR, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'DESCRIPTION', 'COLOR', 'BACKGROUND_COLOR', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'description', 'color', 'background_color', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, ) + BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbUrl', 'DbDescription', 'DbColor', 'DbBackgroundColor', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbUrl', 'dbDescription', 'dbColor', 'dbBackgroundColor', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::URL, self::DESCRIPTION, self::COLOR, self::BACKGROUND_COLOR, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'URL', 'DESCRIPTION', 'COLOR', 'BACKGROUND_COLOR', ), + BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'url', 'description', 'color', 'background_color', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, ) ); /** @@ -77,12 +80,12 @@ abstract class BaseCcShowPeer { * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 */ private static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbDescription' => 2, 'DbColor' => 3, 'DbBackgroundColor' => 4, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbDescription' => 2, 'dbColor' => 3, 'dbBackgroundColor' => 4, ), - BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::DESCRIPTION => 2, self::COLOR => 3, self::BACKGROUND_COLOR => 4, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'DESCRIPTION' => 2, 'COLOR' => 3, 'BACKGROUND_COLOR' => 4, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'description' => 2, 'color' => 3, 'background_color' => 4, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, ) + BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbUrl' => 2, 'DbDescription' => 3, 'DbColor' => 4, 'DbBackgroundColor' => 5, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbUrl' => 2, 'dbDescription' => 3, 'dbColor' => 4, 'dbBackgroundColor' => 5, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::URL => 2, self::DESCRIPTION => 3, self::COLOR => 4, self::BACKGROUND_COLOR => 5, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'URL' => 2, 'DESCRIPTION' => 3, 'COLOR' => 4, 'BACKGROUND_COLOR' => 5, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'url' => 2, 'description' => 3, 'color' => 4, 'background_color' => 5, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, ) ); /** @@ -156,12 +159,14 @@ abstract class BaseCcShowPeer { if (null === $alias) { $criteria->addSelectColumn(CcShowPeer::ID); $criteria->addSelectColumn(CcShowPeer::NAME); + $criteria->addSelectColumn(CcShowPeer::URL); $criteria->addSelectColumn(CcShowPeer::DESCRIPTION); $criteria->addSelectColumn(CcShowPeer::COLOR); $criteria->addSelectColumn(CcShowPeer::BACKGROUND_COLOR); } else { $criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.NAME'); + $criteria->addSelectColumn($alias . '.URL'); $criteria->addSelectColumn($alias . '.DESCRIPTION'); $criteria->addSelectColumn($alias . '.COLOR'); $criteria->addSelectColumn($alias . '.BACKGROUND_COLOR'); diff --git a/application/models/airtime/om/BaseCcShowQuery.php b/application/models/airtime/om/BaseCcShowQuery.php index ea2e416df..27f3ab381 100644 --- a/application/models/airtime/om/BaseCcShowQuery.php +++ b/application/models/airtime/om/BaseCcShowQuery.php @@ -8,12 +8,14 @@ * * @method CcShowQuery orderByDbId($order = Criteria::ASC) Order by the id column * @method CcShowQuery orderByDbName($order = Criteria::ASC) Order by the name column + * @method CcShowQuery orderByDbUrl($order = Criteria::ASC) Order by the url column * @method CcShowQuery orderByDbDescription($order = Criteria::ASC) Order by the description column * @method CcShowQuery orderByDbColor($order = Criteria::ASC) Order by the color column * @method CcShowQuery orderByDbBackgroundColor($order = Criteria::ASC) Order by the background_color column * * @method CcShowQuery groupByDbId() Group by the id column * @method CcShowQuery groupByDbName() Group by the name column + * @method CcShowQuery groupByDbUrl() Group by the url column * @method CcShowQuery groupByDbDescription() Group by the description column * @method CcShowQuery groupByDbColor() Group by the color column * @method CcShowQuery groupByDbBackgroundColor() Group by the background_color column @@ -43,12 +45,14 @@ * * @method CcShow findOneByDbId(int $id) Return the first CcShow filtered by the id column * @method CcShow findOneByDbName(string $name) Return the first CcShow filtered by the name column + * @method CcShow findOneByDbUrl(string $url) Return the first CcShow filtered by the url column * @method CcShow findOneByDbDescription(string $description) Return the first CcShow filtered by the description column * @method CcShow findOneByDbColor(string $color) Return the first CcShow filtered by the color column * @method CcShow findOneByDbBackgroundColor(string $background_color) Return the first CcShow filtered by the background_color column * * @method array findByDbId(int $id) Return CcShow objects filtered by the id column * @method array findByDbName(string $name) Return CcShow objects filtered by the name column + * @method array findByDbUrl(string $url) Return CcShow objects filtered by the url column * @method array findByDbDescription(string $description) Return CcShow objects filtered by the description column * @method array findByDbColor(string $color) Return CcShow objects filtered by the color column * @method array findByDbBackgroundColor(string $background_color) Return CcShow objects filtered by the background_color column @@ -200,6 +204,28 @@ abstract class BaseCcShowQuery extends ModelCriteria return $this->addUsingAlias(CcShowPeer::NAME, $dbName, $comparison); } + /** + * Filter the query on the url column + * + * @param string $dbUrl The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcShowQuery The current query, for fluid interface + */ + public function filterByDbUrl($dbUrl = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbUrl)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbUrl)) { + $dbUrl = str_replace('*', '%', $dbUrl); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcShowPeer::URL, $dbUrl, $comparison); + } + /** * Filter the query on the description column * diff --git a/application/views/scripts/form/add-show-rebroadcast-absolute.phtml b/application/views/scripts/form/add-show-rebroadcast-absolute.phtml new file mode 100644 index 000000000..090d3c5e5 --- /dev/null +++ b/application/views/scripts/form/add-show-rebroadcast-absolute.phtml @@ -0,0 +1,18 @@ +
+
+
+ +
+
+
    + +
  • + element->getElement('add_show_rebroadcast_absolute_date_'.$i) ?> + @ + element->getElement('add_show_rebroadcast_absolute_time_'.$i) ?> +
  • + +
+
+
+
diff --git a/application/views/scripts/form/add-show-rebroadcast.phtml b/application/views/scripts/form/add-show-rebroadcast.phtml new file mode 100644 index 000000000..a698b3bac --- /dev/null +++ b/application/views/scripts/form/add-show-rebroadcast.phtml @@ -0,0 +1,18 @@ +
+
+
+ +
+
+
    + +
  • + element->getElement('add_show_rebroadcast_date_'.$i) ?> + @ + element->getElement('add_show_rebroadcast_time_'.$i) ?> +
  • + +
+
+
+
diff --git a/application/views/scripts/form/add-show-what.phtml b/application/views/scripts/form/add-show-what.phtml new file mode 100644 index 000000000..e69de29bb diff --git a/build/schema.xml b/build/schema.xml index 1e32c58fa..36941da37 100644 --- a/build/schema.xml +++ b/build/schema.xml @@ -124,6 +124,7 @@ + diff --git a/build/sql/schema.sql b/build/sql/schema.sql index 9eb57a4e0..ee2f9b109 100644 --- a/build/sql/schema.sql +++ b/build/sql/schema.sql @@ -162,6 +162,7 @@ CREATE TABLE "cc_show" ( "id" serial NOT NULL, "name" VARCHAR(255) default '' NOT NULL, + "url" VARCHAR(255) default '', "description" VARCHAR(512), "color" VARCHAR(6), "background_color" VARCHAR(6), diff --git a/public/js/airtime/schedule/add-show.js b/public/js/airtime/schedule/add-show.js index e6e3fd08d..50ca4058a 100644 --- a/public/js/airtime/schedule/add-show.js +++ b/public/js/airtime/schedule/add-show.js @@ -66,8 +66,48 @@ function setAddShowEvents() { form.find("#schedule-show-when > fieldset:last").hide(); } + if(!form.find("#add_show_record").attr('checked')) { + form.find("#add_show_rebroadcast").hide(); + } + + if(!form.find("#add_show_rebroadcast").attr('checked')) { + form.find("#schedule-record-rebroadcast > fieldset:not(:first-child)").hide(); + } + form.find("#add_show_repeats").click(function(){ + $(this).blur(); form.find("#schedule-show-when > fieldset:last").toggle(); + + //must switch rebroadcast displays + if(form.find("#add_show_rebroadcast").attr('checked')) { + + if($(this).attr('checked')){ + form.find("#schedule-record-rebroadcast > fieldset:eq(1)").hide(); + form.find("#schedule-record-rebroadcast > fieldset:last").show(); + } + else { + form.find("#schedule-record-rebroadcast > fieldset:eq(1)").show(); + form.find("#schedule-record-rebroadcast > fieldset:last").hide(); + } + } + }); + + form.find("#add_show_record").click(function(){ + $(this).blur(); + form.find("#add_show_rebroadcast").toggle(); + }); + + form.find("#add_show_rebroadcast").click(function(){ + $(this).blur(); + if($(this).attr('checked') && !form.find("#add_show_repeats").attr('checked')) { + form.find("#schedule-record-rebroadcast > fieldset:eq(1)").show(); + } + else if($(this).attr('checked') && form.find("#add_show_repeats").attr('checked')) { + form.find("#schedule-record-rebroadcast > fieldset:last").show(); + } + else { + form.find("#schedule-record-rebroadcast > fieldset:not(:first-child)").hide(); + } }); form.find("#add_show_repeat_type").change(function(){ @@ -91,12 +131,23 @@ function setAddShowEvents() { createDateInput(form.find("#add_show_start_date"), startDpSelect); createDateInput(form.find("#add_show_end_date"), endDpSelect); - form.find("#add_show_start_time").timepicker(); + form.find("#add_show_start_time").timepicker({ + amPmText: ['', ''] + }); form.find("#add_show_duration").timepicker({ amPmText: ['', ''], defaultTime: '01:00' }); + form.find('input[name^="add_show_rebroadcast_absolute_date"]').datepicker({ + //minDate: new Date(), + dateFormat: 'yy-mm-dd' + }); + form.find('input[name^="add_show_rebroadcast_absolute_time"], input[name^="add_show_rebroadcast_time"]').timepicker({ + amPmText: ['', ''], + defaultTime: '' + }); + form.find("#add_show_hosts_autocomplete").autocomplete({ source: findHosts, select: autoSelect, @@ -194,5 +245,10 @@ function showErrorSections() { $(document).ready(function() { + //setAddShowEvents(); +}); + +$(window).load(function() { + setAddShowEvents(); });