adding fields to allow for multiple playlists scheduled in a show

This commit is contained in:
Naomi 2011-01-06 16:20:51 -05:00
parent daf37fa548
commit 9854834b26
7 changed files with 37 additions and 7 deletions

View File

@ -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();

View File

@ -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;

View File

@ -8,6 +8,7 @@
<th><span class="album">Album</span></th>
<th><span class="track">Track</span></th>
<th><span class="length">Length</span></th>
<th><span class="type">Type</span></th>
</tr>
<?php
echo $this->partialLoop('library/libraryTablePartial.phtml', $this->files);

View File

@ -5,4 +5,5 @@
<td><?php echo $this->album_title ?></td>
<td><?php echo $this->track_number ?></td>
<td><?php echo $this->length ?></td>
<td><?php echo $this->ftype ?></td>
</tr>

View File

@ -153,6 +153,8 @@
<table name="cc_show_schedule" phpName="CcShowSchedule">
<column name="id" phpName="DbId" type="INTEGER" primaryKey="true" autoIncrement="true" required="true"/>
<column name="show_id" phpName="DbShowId" type="INTEGER" required="true"/>
<column name="show_day" phpName="DbShowDay" type="DATE" required="true"/>
<column name="position" phpName="DbPosition" type="INTEGER" required="false"/>
<column name="group_id" phpName="DbGroupId" type="INTEGER" required="true"/>
<foreign-key foreignTable="cc_show" name="cc_perm_show_fkey" onDelete="CASCADE">
<reference local="show_id" foreign="id"/>

View File

@ -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();

View File

@ -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",