diff --git a/application/configs/propel-config.php b/application/configs/propel-config.php index 1860e1090..22571384c 100644 --- a/application/configs/propel-config.php +++ b/application/configs/propel-config.php @@ -1,6 +1,6 @@ array ( @@ -9,7 +9,7 @@ $conf = array ( 'adapter' => 'pgsql', 'connection' => array ( - 'dsn' => 'pgsql:host=localhost;port=5432;dbname=airtime;user=airtime;password=airtime', + 'dsn' => 'pgsql:host=localhost;port=5432;dbname=campcaster;user=campcaster;password=campcaster', ), ), 'default' => 'campcaster', @@ -17,4 +17,4 @@ $conf = array ( 'generator_version' => '1.5.2', ); $conf['classmap'] = include(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'classmap-propel-config.php'); -return $conf; +return $conf; \ No newline at end of file diff --git a/application/controllers/LibraryController.php b/application/controllers/LibraryController.php index 99e3d7ec3..da98fae22 100644 --- a/application/controllers/LibraryController.php +++ b/application/controllers/LibraryController.php @@ -37,10 +37,6 @@ class LibraryController extends Zend_Controller_Action unset($this->search_sess->page); unset($this->search_sess->md); - - //if ($this->getRequest()->isGet()) { - // unset($this->search_sess->quick); - //} $this->_helper->actionStack('contents', 'library'); $this->_helper->actionStack('quick-search', 'library'); @@ -218,7 +214,7 @@ class LibraryController extends Zend_Controller_Action $search = $this->_getParam('search', null); $this->search_sess->quick_string = $search; - $categories = array("dc:title", "dc:creator", "dc:source"); + $categories = array("dc:title", "dc:creator", "dc:source", "ls:type"); $keywords = explode(" ", $search); $md = array(); diff --git a/application/models/StoredFile.php b/application/models/StoredFile.php index 490d19c93..d35a55800 100644 --- a/application/models/StoredFile.php +++ b/application/models/StoredFile.php @@ -6,6 +6,7 @@ require_once("Schedule.php"); global $g_metadata_xml_to_db_mapping; $g_metadata_xml_to_db_mapping = array( + "ls:type" => "ftype", "dc:format" => "format", "ls:bitrate" => "bit_rate", "ls:samplerate" => "sample_rate", @@ -1763,6 +1764,10 @@ class StoredFile { if($key === "dc:title"){ $plSelect .= "name AS ".$val.", "; $fileSelect .= $val.", "; + } + else if ($key === "ls:type"){ + $plSelect .= "'playlist' AS ".$val.", "; + $fileSelect .= $val.", "; } else if ($key === "dc:creator"){ $plSelect .= "creator AS ".$val.", "; @@ -1789,13 +1794,13 @@ class StoredFile { $selector = "SELECT *"; } - $from = " FROM ((".$plSelect."PL.id, 'playlist' AS ftype + $from = " FROM ((".$plSelect."PL.id FROM ".$CC_CONFIG["playListTable"]." AS PL LEFT JOIN ".$CC_CONFIG['playListTimeView']." PLT ON PL.id = PLT.id) UNION - (".$fileSelect."id, ftype FROM ".$CC_CONFIG["filesTable"]." AS FILES)) AS RESULTS "; + (".$fileSelect."id FROM ".$CC_CONFIG["filesTable"]." AS FILES)) AS RESULTS "; $sql = $selector." ".$from; diff --git a/application/models/campcaster/map/CcShowScheduleTableMap.php b/application/models/campcaster/map/CcShowScheduleTableMap.php index 3edc93611..cdd6205b7 100644 --- a/application/models/campcaster/map/CcShowScheduleTableMap.php +++ b/application/models/campcaster/map/CcShowScheduleTableMap.php @@ -40,6 +40,8 @@ class CcShowScheduleTableMap extends TableMap { // columns $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null); $this->addForeignKey('SHOW_ID', 'DbShowId', 'INTEGER', 'cc_show', 'ID', true, null, null); + $this->addColumn('SHOW_DAY', 'DbShowDay', 'DATE', true, null, null); + $this->addColumn('POSITION', 'DbPosition', 'INTEGER', false, null, null); $this->addColumn('GROUP_ID', 'DbGroupId', 'INTEGER', true, null, null); // validators } // initialize() diff --git a/application/models/campcaster/om/BaseCcShowSchedule.php b/application/models/campcaster/om/BaseCcShowSchedule.php index 4ac36f871..c3f5796df 100644 --- a/application/models/campcaster/om/BaseCcShowSchedule.php +++ b/application/models/campcaster/om/BaseCcShowSchedule.php @@ -36,6 +36,18 @@ abstract class BaseCcShowSchedule extends BaseObject implements Persistent */ protected $show_id; + /** + * The value for the show_day field. + * @var string + */ + protected $show_day; + + /** + * The value for the position field. + * @var int + */ + protected $position; + /** * The value for the group_id field. * @var int @@ -81,6 +93,49 @@ abstract class BaseCcShowSchedule extends BaseObject implements Persistent return $this->show_id; } + /** + * Get the [optionally formatted] temporal [show_day] column value. + * + * + * @param string $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the raw DateTime object will be returned. + * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL + * @throws PropelException - if unable to parse/validate the date/time value. + */ + public function getDbShowDay($format = '%x') + { + if ($this->show_day === null) { + return null; + } + + + + try { + $dt = new DateTime($this->show_day); + } catch (Exception $x) { + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->show_day, true), $x); + } + + if ($format === null) { + // Because propel.useDateTimeClass is TRUE, we return a DateTime object. + return $dt; + } elseif (strpos($format, '%') !== false) { + return strftime($format, $dt->format('U')); + } else { + return $dt->format($format); + } + } + + /** + * Get the [position] column value. + * + * @return int + */ + public function getDbPosition() + { + return $this->position; + } + /** * Get the [group_id] column value. * @@ -135,6 +190,75 @@ abstract class BaseCcShowSchedule extends BaseObject implements Persistent return $this; } // setDbShowId() + /** + * Sets the value of [show_day] column to a normalized version of the date/time value specified. + * + * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will + * be treated as NULL for temporal objects. + * @return CcShowSchedule The current object (for fluent API support) + */ + public function setDbShowDay($v) + { + // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') + // -- which is unexpected, to say the least. + if ($v === null || $v === '') { + $dt = null; + } elseif ($v instanceof DateTime) { + $dt = $v; + } else { + // some string/numeric value passed; we normalize that so that we can + // validate it. + try { + if (is_numeric($v)) { // if it's a unix timestamp + $dt = new DateTime('@'.$v, new DateTimeZone('UTC')); + // We have to explicitly specify and then change the time zone because of a + // DateTime bug: http://bugs.php.net/bug.php?id=43003 + $dt->setTimeZone(new DateTimeZone(date_default_timezone_get())); + } else { + $dt = new DateTime($v); + } + } catch (Exception $x) { + throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x); + } + } + + if ( $this->show_day !== null || $dt !== null ) { + // (nested ifs are a little easier to read in this case) + + $currNorm = ($this->show_day !== null && $tmpDt = new DateTime($this->show_day)) ? $tmpDt->format('Y-m-d') : null; + $newNorm = ($dt !== null) ? $dt->format('Y-m-d') : null; + + if ( ($currNorm !== $newNorm) // normalized values don't match + ) + { + $this->show_day = ($dt ? $dt->format('Y-m-d') : null); + $this->modifiedColumns[] = CcShowSchedulePeer::SHOW_DAY; + } + } // if either are not null + + return $this; + } // setDbShowDay() + + /** + * Set the value of [position] column. + * + * @param int $v new value + * @return CcShowSchedule The current object (for fluent API support) + */ + public function setDbPosition($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->position !== $v) { + $this->position = $v; + $this->modifiedColumns[] = CcShowSchedulePeer::POSITION; + } + + return $this; + } // setDbPosition() + /** * Set the value of [group_id] column. * @@ -189,7 +313,9 @@ abstract class BaseCcShowSchedule extends BaseObject implements Persistent $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; $this->show_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; - $this->group_id = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null; + $this->show_day = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->position = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null; + $this->group_id = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null; $this->resetModified(); $this->setNew(false); @@ -198,7 +324,7 @@ abstract class BaseCcShowSchedule extends BaseObject implements Persistent $this->ensureConsistency(); } - return $startcol + 3; // 3 = CcShowSchedulePeer::NUM_COLUMNS - CcShowSchedulePeer::NUM_LAZY_LOAD_COLUMNS). + return $startcol + 5; // 5 = CcShowSchedulePeer::NUM_COLUMNS - CcShowSchedulePeer::NUM_LAZY_LOAD_COLUMNS). } catch (Exception $e) { throw new PropelException("Error populating CcShowSchedule object", $e); @@ -532,6 +658,12 @@ abstract class BaseCcShowSchedule extends BaseObject implements Persistent return $this->getDbShowId(); break; case 2: + return $this->getDbShowDay(); + break; + case 3: + return $this->getDbPosition(); + break; + case 4: return $this->getDbGroupId(); break; default: @@ -560,7 +692,9 @@ abstract class BaseCcShowSchedule extends BaseObject implements Persistent $result = array( $keys[0] => $this->getDbId(), $keys[1] => $this->getDbShowId(), - $keys[2] => $this->getDbGroupId(), + $keys[2] => $this->getDbShowDay(), + $keys[3] => $this->getDbPosition(), + $keys[4] => $this->getDbGroupId(), ); if ($includeForeignObjects) { if (null !== $this->aCcShow) { @@ -604,6 +738,12 @@ abstract class BaseCcShowSchedule extends BaseObject implements Persistent $this->setDbShowId($value); break; case 2: + $this->setDbShowDay($value); + break; + case 3: + $this->setDbPosition($value); + break; + case 4: $this->setDbGroupId($value); break; } // switch() @@ -632,7 +772,9 @@ abstract class BaseCcShowSchedule extends BaseObject implements Persistent if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]); if (array_key_exists($keys[1], $arr)) $this->setDbShowId($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setDbGroupId($arr[$keys[2]]); + if (array_key_exists($keys[2], $arr)) $this->setDbShowDay($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setDbPosition($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setDbGroupId($arr[$keys[4]]); } /** @@ -646,6 +788,8 @@ abstract class BaseCcShowSchedule extends BaseObject implements Persistent if ($this->isColumnModified(CcShowSchedulePeer::ID)) $criteria->add(CcShowSchedulePeer::ID, $this->id); if ($this->isColumnModified(CcShowSchedulePeer::SHOW_ID)) $criteria->add(CcShowSchedulePeer::SHOW_ID, $this->show_id); + if ($this->isColumnModified(CcShowSchedulePeer::SHOW_DAY)) $criteria->add(CcShowSchedulePeer::SHOW_DAY, $this->show_day); + if ($this->isColumnModified(CcShowSchedulePeer::POSITION)) $criteria->add(CcShowSchedulePeer::POSITION, $this->position); if ($this->isColumnModified(CcShowSchedulePeer::GROUP_ID)) $criteria->add(CcShowSchedulePeer::GROUP_ID, $this->group_id); return $criteria; @@ -709,6 +853,8 @@ abstract class BaseCcShowSchedule extends BaseObject implements Persistent public function copyInto($copyObj, $deepCopy = false) { $copyObj->setDbShowId($this->show_id); + $copyObj->setDbShowDay($this->show_day); + $copyObj->setDbPosition($this->position); $copyObj->setDbGroupId($this->group_id); $copyObj->setNew(true); @@ -809,6 +955,8 @@ abstract class BaseCcShowSchedule extends BaseObject implements Persistent { $this->id = null; $this->show_id = null; + $this->show_day = null; + $this->position = null; $this->group_id = null; $this->alreadyInSave = false; $this->alreadyInValidation = false; diff --git a/application/models/campcaster/om/BaseCcShowSchedulePeer.php b/application/models/campcaster/om/BaseCcShowSchedulePeer.php index 966cf400e..83f2f63d6 100644 --- a/application/models/campcaster/om/BaseCcShowSchedulePeer.php +++ b/application/models/campcaster/om/BaseCcShowSchedulePeer.php @@ -26,7 +26,7 @@ abstract class BaseCcShowSchedulePeer { const TM_CLASS = 'CcShowScheduleTableMap'; /** The total number of columns. */ - const NUM_COLUMNS = 3; + const NUM_COLUMNS = 5; /** The number of lazy-loaded columns. */ const NUM_LAZY_LOAD_COLUMNS = 0; @@ -37,6 +37,12 @@ abstract class BaseCcShowSchedulePeer { /** the column name for the SHOW_ID field */ const SHOW_ID = 'cc_show_schedule.SHOW_ID'; + /** the column name for the SHOW_DAY field */ + const SHOW_DAY = 'cc_show_schedule.SHOW_DAY'; + + /** the column name for the POSITION field */ + const POSITION = 'cc_show_schedule.POSITION'; + /** the column name for the GROUP_ID field */ const GROUP_ID = 'cc_show_schedule.GROUP_ID'; @@ -56,12 +62,12 @@ abstract class BaseCcShowSchedulePeer { * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ private static $fieldNames = array ( - BasePeer::TYPE_PHPNAME => array ('DbId', 'DbShowId', 'DbGroupId', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbShowId', 'dbGroupId', ), - BasePeer::TYPE_COLNAME => array (self::ID, self::SHOW_ID, self::GROUP_ID, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'SHOW_ID', 'GROUP_ID', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'show_id', 'group_id', ), - BasePeer::TYPE_NUM => array (0, 1, 2, ) + BasePeer::TYPE_PHPNAME => array ('DbId', 'DbShowId', 'DbShowDay', 'DbPosition', 'DbGroupId', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbShowId', 'dbShowDay', 'dbPosition', 'dbGroupId', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::SHOW_ID, self::SHOW_DAY, self::POSITION, self::GROUP_ID, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID', 'SHOW_ID', 'SHOW_DAY', 'POSITION', 'GROUP_ID', ), + BasePeer::TYPE_FIELDNAME => array ('id', 'show_id', 'show_day', 'position', 'group_id', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, ) ); /** @@ -71,12 +77,12 @@ abstract class BaseCcShowSchedulePeer { * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 */ private static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbShowId' => 1, 'DbGroupId' => 2, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbShowId' => 1, 'dbGroupId' => 2, ), - BasePeer::TYPE_COLNAME => array (self::ID => 0, self::SHOW_ID => 1, self::GROUP_ID => 2, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'SHOW_ID' => 1, 'GROUP_ID' => 2, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'show_id' => 1, 'group_id' => 2, ), - BasePeer::TYPE_NUM => array (0, 1, 2, ) + BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbShowId' => 1, 'DbShowDay' => 2, 'DbPosition' => 3, 'DbGroupId' => 4, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbShowId' => 1, 'dbShowDay' => 2, 'dbPosition' => 3, 'dbGroupId' => 4, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::SHOW_ID => 1, self::SHOW_DAY => 2, self::POSITION => 3, self::GROUP_ID => 4, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'SHOW_ID' => 1, 'SHOW_DAY' => 2, 'POSITION' => 3, 'GROUP_ID' => 4, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'show_id' => 1, 'show_day' => 2, 'position' => 3, 'group_id' => 4, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, ) ); /** @@ -150,10 +156,14 @@ abstract class BaseCcShowSchedulePeer { if (null === $alias) { $criteria->addSelectColumn(CcShowSchedulePeer::ID); $criteria->addSelectColumn(CcShowSchedulePeer::SHOW_ID); + $criteria->addSelectColumn(CcShowSchedulePeer::SHOW_DAY); + $criteria->addSelectColumn(CcShowSchedulePeer::POSITION); $criteria->addSelectColumn(CcShowSchedulePeer::GROUP_ID); } else { $criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.SHOW_ID'); + $criteria->addSelectColumn($alias . '.SHOW_DAY'); + $criteria->addSelectColumn($alias . '.POSITION'); $criteria->addSelectColumn($alias . '.GROUP_ID'); } } diff --git a/application/models/campcaster/om/BaseCcShowScheduleQuery.php b/application/models/campcaster/om/BaseCcShowScheduleQuery.php index c2e4db1ca..cd64bba1d 100644 --- a/application/models/campcaster/om/BaseCcShowScheduleQuery.php +++ b/application/models/campcaster/om/BaseCcShowScheduleQuery.php @@ -8,10 +8,14 @@ * * @method CcShowScheduleQuery orderByDbId($order = Criteria::ASC) Order by the id column * @method CcShowScheduleQuery orderByDbShowId($order = Criteria::ASC) Order by the show_id column + * @method CcShowScheduleQuery orderByDbShowDay($order = Criteria::ASC) Order by the show_day column + * @method CcShowScheduleQuery orderByDbPosition($order = Criteria::ASC) Order by the position column * @method CcShowScheduleQuery orderByDbGroupId($order = Criteria::ASC) Order by the group_id column * * @method CcShowScheduleQuery groupByDbId() Group by the id column * @method CcShowScheduleQuery groupByDbShowId() Group by the show_id column + * @method CcShowScheduleQuery groupByDbShowDay() Group by the show_day column + * @method CcShowScheduleQuery groupByDbPosition() Group by the position column * @method CcShowScheduleQuery groupByDbGroupId() Group by the group_id column * * @method CcShowScheduleQuery leftJoin($relation) Adds a LEFT JOIN clause to the query @@ -27,10 +31,14 @@ * * @method CcShowSchedule findOneByDbId(int $id) Return the first CcShowSchedule filtered by the id column * @method CcShowSchedule findOneByDbShowId(int $show_id) Return the first CcShowSchedule filtered by the show_id column + * @method CcShowSchedule findOneByDbShowDay(string $show_day) Return the first CcShowSchedule filtered by the show_day column + * @method CcShowSchedule findOneByDbPosition(int $position) Return the first CcShowSchedule filtered by the position column * @method CcShowSchedule findOneByDbGroupId(int $group_id) Return the first CcShowSchedule filtered by the group_id column * * @method array findByDbId(int $id) Return CcShowSchedule objects filtered by the id column * @method array findByDbShowId(int $show_id) Return CcShowSchedule objects filtered by the show_id column + * @method array findByDbShowDay(string $show_day) Return CcShowSchedule objects filtered by the show_day column + * @method array findByDbPosition(int $position) Return CcShowSchedule objects filtered by the position column * @method array findByDbGroupId(int $group_id) Return CcShowSchedule objects filtered by the group_id column * * @package propel.generator.campcaster.om @@ -189,6 +197,68 @@ abstract class BaseCcShowScheduleQuery extends ModelCriteria return $this->addUsingAlias(CcShowSchedulePeer::SHOW_ID, $dbShowId, $comparison); } + /** + * Filter the query on the show_day column + * + * @param string|array $dbShowDay The value to use as filter. + * Accepts an associative array('min' => $minValue, 'max' => $maxValue) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcShowScheduleQuery The current query, for fluid interface + */ + public function filterByDbShowDay($dbShowDay = null, $comparison = null) + { + if (is_array($dbShowDay)) { + $useMinMax = false; + if (isset($dbShowDay['min'])) { + $this->addUsingAlias(CcShowSchedulePeer::SHOW_DAY, $dbShowDay['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbShowDay['max'])) { + $this->addUsingAlias(CcShowSchedulePeer::SHOW_DAY, $dbShowDay['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcShowSchedulePeer::SHOW_DAY, $dbShowDay, $comparison); + } + + /** + * Filter the query on the position column + * + * @param int|array $dbPosition The value to use as filter. + * Accepts an associative array('min' => $minValue, 'max' => $maxValue) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcShowScheduleQuery The current query, for fluid interface + */ + public function filterByDbPosition($dbPosition = null, $comparison = null) + { + if (is_array($dbPosition)) { + $useMinMax = false; + if (isset($dbPosition['min'])) { + $this->addUsingAlias(CcShowSchedulePeer::POSITION, $dbPosition['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbPosition['max'])) { + $this->addUsingAlias(CcShowSchedulePeer::POSITION, $dbPosition['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcShowSchedulePeer::POSITION, $dbPosition, $comparison); + } + /** * Filter the query on the group_id column * diff --git a/application/views/scripts/library/contents.phtml b/application/views/scripts/library/contents.phtml index 1ea505484..526bd37b8 100644 --- a/application/views/scripts/library/contents.phtml +++ b/application/views/scripts/library/contents.phtml @@ -8,6 +8,7 @@ Album Track Length + Type partialLoop('library/libraryTablePartial.phtml', $this->files); diff --git a/application/views/scripts/library/libraryTablePartial.phtml b/application/views/scripts/library/libraryTablePartial.phtml index 52074462d..7f8502fbe 100644 --- a/application/views/scripts/library/libraryTablePartial.phtml +++ b/application/views/scripts/library/libraryTablePartial.phtml @@ -5,4 +5,5 @@ album_title ?> track_number ?> length ?> + ftype ?> diff --git a/build/schema.xml b/build/schema.xml index 599b679e4..720e7126a 100644 --- a/build/schema.xml +++ b/build/schema.xml @@ -153,6 +153,8 @@ + + diff --git a/build/sql/schema.sql b/build/sql/schema.sql index ea794a500..d8d18744d 100644 --- a/build/sql/schema.sql +++ b/build/sql/schema.sql @@ -224,6 +224,8 @@ CREATE TABLE "cc_show_schedule" ( "id" serial NOT NULL, "show_id" INTEGER NOT NULL, + "show_day" DATE NOT NULL, + "position" INTEGER, "group_id" INTEGER NOT NULL, PRIMARY KEY ("id") ); diff --git a/build/sql/triggers.sql b/build/sql/triggers.sql index c059ffe80..a190be622 100644 --- a/build/sql/triggers.sql +++ b/build/sql/triggers.sql @@ -21,3 +21,27 @@ CREATE FUNCTION calculate_position() RETURNS trigger AS CREATE TRIGGER calculate_position AFTER INSERT OR DELETE ON cc_playlistcontents FOR EACH ROW EXECUTE PROCEDURE calculate_position(); + +---------------------------------------------------------------------------------- +--show_content() +---------------------------------------------------------------------------------- +DROP FUNCTION show_content() CASCADE; + +CREATE FUNCTION show_content() RETURNS trigger AS + ' + BEGIN + IF(TG_OP=''INSERT'') THEN + UPDATE cc_show_schedule SET position = (position + 1) + WHERE (id = new.id AND position >= new.position AND id != new.id); + END IF; + IF(TG_OP=''DELETE'') THEN + UPDATE cc_show_schedule SET position = (position - 1) + WHERE (id = old.id AND position > old.position); + END IF; + RETURN NULL; + END; + ' + LANGUAGE 'plpgsql'; + +CREATE TRIGGER show_content AFTER INSERT OR DELETE ON cc_show_schedule +FOR EACH ROW EXECUTE PROCEDURE show_content(); diff --git a/public/js/airtime/library/library.js b/public/js/airtime/library/library.js index 258278022..12ea190d5 100644 --- a/public/js/airtime/library/library.js +++ b/public/js/airtime/library/library.js @@ -66,6 +66,7 @@ function setUpLibrary() { $("#library_display tr:first-child span.album").data({'ob': 'dc:source', 'order' : 'asc'}); $("#library_display tr:first-child span.track").data({'ob': 'ls:track_num', 'order' : 'asc'}); $("#library_display tr:first-child span.length").data({'ob': 'dcterms:extent', 'order' : 'asc'}); + $("#library_display tr:first-child span.type").data({'ob': 'dcterms:extent', 'order' : 'asc'}); $("#library_display tr:first-child span").click(function(){ var url = "/Library/contents/format/html",