diff --git a/application/models/Nowplaying.php b/application/models/Nowplaying.php
index 966470528..43d6bdc4b 100644
--- a/application/models/Nowplaying.php
+++ b/application/models/Nowplaying.php
@@ -75,23 +75,27 @@ class Application_Model_Nowplaying
foreach ($previous as $item){
array_push($rows, array("p", $item["starts"], $item["starts"], $item["ends"], $item["clip_length"], $item["track_title"], $item["artist_name"],
- $item["album_title"], $item["name"], $item["show_name"], $item["current_show"], $item["group_id"]));
+ $item["album_title"], $item["name"], $item["show_name"], $item["instance_id"], $item["group_id"]));
}
foreach ($current as $item){
array_push($rows, array("c", $item["starts"], $item["starts"], $item["ends"], $item["clip_length"], $item["track_title"], $item["artist_name"],
- $item["album_title"], $item["name"], $item["show_name"], $item["current_show"], $item["group_id"]));
+ $item["album_title"], $item["name"], $item["show_name"], $item["instance_id"], $item["group_id"]));
}
foreach ($next as $item){
array_push($rows, array("n", $item["starts"], $item["starts"], $item["ends"], $item["clip_length"], $item["track_title"], $item["artist_name"],
- $item["album_title"], $item["name"], $item["show_name"], $item["current_show"], $item["group_id"]));
+ $item["album_title"], $item["name"], $item["show_name"], $item["instance_id"], $item["group_id"]));
}
-
+
+
$rows = Application_Model_Nowplaying::FindGaps($rows);
- $data = array("rows"=>$rows);
+
+ $date = new Application_Model_DateHelper;
+ $timeNow = $date->getDate();
+
+ $data = array("currentShow"=>Show_DAL::GetCurrentShow($timeNow), "rows"=>$rows);
return $data;
}
}
-
diff --git a/application/models/Schedule.php b/application/models/Schedule.php
index d1f9830be..87ff2193b 100644
--- a/application/models/Schedule.php
+++ b/application/models/Schedule.php
@@ -467,9 +467,10 @@ class Schedule {
* want to search the database. For example "5 days", "18 hours", "60 minutes",
* "30 seconds" etc.
*/
- public static function Get_Scheduled_Item_Data($timeNow, $timePeriod=0, $count = 0, $interval="0 hours"){
+ public static function Get_Scheduled_Item_Data($timeStamp, $timePeriod=0, $count = 0, $interval="0 hours"){
global $CC_CONFIG, $CC_DBC;
- $sql = "SELECT DISTINCT pt.name, ft.track_title, ft.artist_name, ft.album_title, st.starts, st.ends, st.clip_length, st.group_id, show.name as show_name, (si.starts <= TIMESTAMP '$timeNow' AND si.ends > TIMESTAMP '$timeNow') as current_show"
+
+ $sql = "SELECT DISTINCT pt.name, ft.track_title, ft.artist_name, ft.album_title, st.starts, st.ends, st.clip_length, st.group_id, show.name as show_name, st.instance_id"
." FROM $CC_CONFIG[scheduleTable] st, $CC_CONFIG[filesTable] ft, $CC_CONFIG[playListTable] pt, $CC_CONFIG[showInstances] si, $CC_CONFIG[showTable] show"
." WHERE st.playlist_id = pt.id"
." AND st.file_id = ft.id"
@@ -477,16 +478,16 @@ class Schedule {
." AND si.show_id = show.id";
if ($timePeriod < 0){
- $sql .= " AND st.ends < TIMESTAMP '$timeNow'"
- ." AND st.ends > (TIMESTAMP '$timeNow' - INTERVAL '$interval')"
+ $sql .= " AND st.ends < TIMESTAMP '$timeStamp'"
+ ." AND st.ends > (TIMESTAMP '$timeStamp' - INTERVAL '$interval')"
." ORDER BY st.starts DESC"
." LIMIT $count";
} else if ($timePeriod == 0){
- $sql .= " AND st.starts < TIMESTAMP '$timeNow'"
- ." AND st.ends > TIMESTAMP '$timeNow'";
+ $sql .= " AND st.starts <= TIMESTAMP '$timeStamp'"
+ ." AND st.ends >= TIMESTAMP '$timeStamp'";
} else if ($timePeriod > 0){
- $sql .= " AND st.starts > TIMESTAMP '$timeNow'"
- ." AND st.starts < (TIMESTAMP '$timeNow' + INTERVAL '$interval')"
+ $sql .= " AND st.starts > TIMESTAMP '$timeStamp'"
+ ." AND st.starts < (TIMESTAMP '$timeStamp' + INTERVAL '$interval')"
." ORDER BY st.starts"
." LIMIT $count";
}
diff --git a/application/models/Shows.php b/application/models/Shows.php
index 1f7d5661f..c6902fa80 100644
--- a/application/models/Shows.php
+++ b/application/models/Shows.php
@@ -49,6 +49,21 @@ class Show {
$show->setDbBackgroundColor($backgroundColor);
}
+ public function cancelShow($day_timestamp) {
+ global $CC_DBC;
+
+ $timeinfo = explode(" ", $day_timestamp);
+
+ CcShowDaysQuery::create()
+ ->filterByDbShowId($this->_showId)
+ ->update(array('DbLastShow' => $timeinfo[0]));
+
+ $sql = "DELETE FROM cc_show_instances
+ WHERE starts >= '{$day_timestamp}' AND show_id = {$this->_showId}";
+
+ $CC_DBC->query($sql);
+ }
+
//end dates are non inclusive.
public static function addShow($data) {
@@ -718,7 +733,7 @@ class Show_DAL{
$date = $timestamp[0];
$time = $timestamp[1];
- $sql = "SELECT si.starts as start_timestamp, si.ends as end_timestamp, s.name, s.id"
+ $sql = "SELECT si.starts as start_timestamp, si.ends as end_timestamp, s.name, s.id, si.id as instance_id"
." FROM $CC_CONFIG[showInstances] si, $CC_CONFIG[showTable] s"
." WHERE si.show_id = s.id"
." AND si.starts <= TIMESTAMP '$timeNow'"
@@ -734,7 +749,7 @@ class Show_DAL{
$sql = "SELECT *, si.starts as start_timestamp, si.ends as end_timestamp FROM "
." $CC_CONFIG[showInstances] si, $CC_CONFIG[showTable] s"
." WHERE si.show_id = s.id"
- ." AND si.starts > TIMESTAMP '$timeNow'"
+ ." AND si.starts >= TIMESTAMP '$timeNow'"
." AND si.starts < TIMESTAMP '$timeNow' + INTERVAL '48 hours'"
." ORDER BY si.starts"
." LIMIT 1";
diff --git a/application/models/StoredFile.php b/application/models/StoredFile.php
index c4d379b3a..9190c48f1 100644
--- a/application/models/StoredFile.php
+++ b/application/models/StoredFile.php
@@ -1792,7 +1792,7 @@ class StoredFile {
$fromTable = "cc_playlist AS pl LEFT JOIN cc_playlisttimes AS plt USING(id) LEFT JOIN cc_subjs AS sub ON pl.editedby = sub.id";
$datatables["optWhere"][] = "plt.length <= INTERVAL '{$p_length}'";
-
+ $datatables["optWhere"][] = "plt.length > INTERVAL '00:00:00'";
return StoredFile::searchFiles($fromTable, $datatables);
}
diff --git a/application/models/Users.php b/application/models/Users.php
index ca3bdf448..8a2574505 100644
--- a/application/models/Users.php
+++ b/application/models/Users.php
@@ -139,13 +139,15 @@ class User {
$sql_type = "type = {$type}";
}
- $sql = $sql_gen ." WHERE (". $sql_type.")";
+ $sql = $sql_gen ." WHERE (". $sql_type.") ";
if(!is_null($search)) {
$like = "login ILIKE '%{$search}%'";
- $sql = $sql . " AND ".$like." ORDER BY login";
+ $sql = $sql . " AND ".$like;
}
+
+ $sql = $sql ." ORDER BY login";
return $CC_DBC->GetAll($sql);
}
diff --git a/application/models/airtime/map/CcShowDaysTableMap.php b/application/models/airtime/map/CcShowDaysTableMap.php
index 3a8535635..ecd03ac15 100644
--- a/application/models/airtime/map/CcShowDaysTableMap.php
+++ b/application/models/airtime/map/CcShowDaysTableMap.php
@@ -42,7 +42,7 @@ class CcShowDaysTableMap extends TableMap {
$this->addColumn('FIRST_SHOW', 'DbFirstShow', 'DATE', true, null, null);
$this->addColumn('LAST_SHOW', 'DbLastShow', 'DATE', false, null, null);
$this->addColumn('START_TIME', 'DbStartTime', 'TIME', true, null, null);
- $this->addColumn('DURATION', 'DbDuration', 'TIME', true, null, null);
+ $this->addColumn('DURATION', 'DbDuration', 'VARCHAR', true, 255, null);
$this->addColumn('DAY', 'DbDay', 'TINYINT', false, null, null);
$this->addColumn('REPEAT_TYPE', 'DbRepeatType', 'TINYINT', true, null, null);
$this->addColumn('NEXT_POP_DATE', 'DbNextPopDate', 'DATE', false, null, null);
diff --git a/application/models/airtime/om/BaseCcShowDays.php b/application/models/airtime/om/BaseCcShowDays.php
index b905be677..c45567ec9 100644
--- a/application/models/airtime/om/BaseCcShowDays.php
+++ b/application/models/airtime/om/BaseCcShowDays.php
@@ -207,36 +207,13 @@ abstract class BaseCcShowDays extends BaseObject implements Persistent
}
/**
- * Get the [optionally formatted] temporal [duration] column value.
+ * Get the [duration] 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.
+ * @return string
*/
- public function getDbDuration($format = '%X')
+ public function getDbDuration()
{
- if ($this->duration === null) {
- return null;
- }
-
-
-
- try {
- $dt = new DateTime($this->duration);
- } catch (Exception $x) {
- throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->duration, 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);
- }
+ return $this->duration;
}
/**
@@ -470,50 +447,21 @@ abstract class BaseCcShowDays extends BaseObject implements Persistent
} // setDbStartTime()
/**
- * Sets the value of [duration] column to a normalized version of the date/time value specified.
+ * Set the value of [duration] column.
*
- * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
- * be treated as NULL for temporal objects.
+ * @param string $v new value
* @return CcShowDays The current object (for fluent API support)
*/
public function setDbDuration($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 ($v !== null) {
+ $v = (string) $v;
}
- if ( $this->duration !== null || $dt !== null ) {
- // (nested ifs are a little easier to read in this case)
-
- $currNorm = ($this->duration !== null && $tmpDt = new DateTime($this->duration)) ? $tmpDt->format('H:i:s') : null;
- $newNorm = ($dt !== null) ? $dt->format('H:i:s') : null;
-
- if ( ($currNorm !== $newNorm) // normalized values don't match
- )
- {
- $this->duration = ($dt ? $dt->format('H:i:s') : null);
- $this->modifiedColumns[] = CcShowDaysPeer::DURATION;
- }
- } // if either are not null
+ if ($this->duration !== $v) {
+ $this->duration = $v;
+ $this->modifiedColumns[] = CcShowDaysPeer::DURATION;
+ }
return $this;
} // setDbDuration()
diff --git a/application/models/airtime/om/BaseCcShowDaysQuery.php b/application/models/airtime/om/BaseCcShowDaysQuery.php
index 418cd2012..a91994d5f 100644
--- a/application/models/airtime/om/BaseCcShowDaysQuery.php
+++ b/application/models/airtime/om/BaseCcShowDaysQuery.php
@@ -278,29 +278,20 @@ abstract class BaseCcShowDaysQuery extends ModelCriteria
/**
* Filter the query on the duration column
*
- * @param string|array $dbDuration The value to use as filter.
- * Accepts an associative array('min' => $minValue, 'max' => $maxValue)
+ * @param string $dbDuration 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 CcShowDaysQuery The current query, for fluid interface
*/
public function filterByDbDuration($dbDuration = null, $comparison = null)
{
- if (is_array($dbDuration)) {
- $useMinMax = false;
- if (isset($dbDuration['min'])) {
- $this->addUsingAlias(CcShowDaysPeer::DURATION, $dbDuration['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbDuration['max'])) {
- $this->addUsingAlias(CcShowDaysPeer::DURATION, $dbDuration['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
+ if (null === $comparison) {
+ if (is_array($dbDuration)) {
$comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbDuration)) {
+ $dbDuration = str_replace('*', '%', $dbDuration);
+ $comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcShowDaysPeer::DURATION, $dbDuration, $comparison);
diff --git a/application/views/scripts/dashboard/help.phtml b/application/views/scripts/dashboard/help.phtml
index 8483a9580..7a5b0d4f8 100644
--- a/application/views/scripts/dashboard/help.phtml
+++ b/application/views/scripts/dashboard/help.phtml
@@ -5,9 +5,9 @@
Add your files to the library using the "Add Audio" button. You can drag and drop your files to this window too.
-
Create a show by going to "Schedule" in the menu bar, and then clicking the "+ Show" icon. This can be either a one-time or repeating show. Only admins can add shows.
Create a playlist in the Playlist Builder menu using your audio files.
-
Add the playlist to the show by going to your show in the Schedule calendar, right-clicking on it and selecting "Schedule."
+
Create a show by going to "Calendar" in the menu bar, and then clicking the "+ Show" icon. This can be either a one-time or repeating show. Only admins can add shows.
+
Add the playlist to the show by going to your show in the Schedule calendar, right-clicking on it and selecting "Add Content."
Select your playlist and drag and drop it to the "Items in this show" area.
Then you're good to go!
diff --git a/application/views/scripts/library/edit-file-md.phtml b/application/views/scripts/library/edit-file-md.phtml
index 41276c253..6b7696c0a 100644
--- a/application/views/scripts/library/edit-file-md.phtml
+++ b/application/views/scripts/library/edit-file-md.phtml
@@ -1,4 +1,6 @@
-
+
View script for controller Playlist and script/action name new
\ No newline at end of file
+
Playlist Metadata
+
diff --git a/application/views/scripts/schedule/cancel-show.phtml b/application/views/scripts/schedule/cancel-show.phtml
new file mode 100644
index 000000000..1f2c21d35
--- /dev/null
+++ b/application/views/scripts/schedule/cancel-show.phtml
@@ -0,0 +1 @@
+
View script for controller Schedule and script/action name cancelShow
\ No newline at end of file
diff --git a/build/build.properties b/build/build.properties
index cd25e41b3..75a77da70 100644
--- a/build/build.properties
+++ b/build/build.properties
@@ -1,6 +1,6 @@
#Note: project.home is automatically generated by the propel-install script.
#Any manual changes to this value will be overwritten.
-project.home = /home/naomi/dev-campcaster/campcaster
+project.home = /home/naomiaro/dev-campcaster/campcaster
project.build = ${project.home}/build
#Database driver
diff --git a/build/schema.xml b/build/schema.xml
index 0bac4bd57..ea1512560 100644
--- a/build/schema.xml
+++ b/build/schema.xml
@@ -142,7 +142,7 @@
-
+
diff --git a/build/sql/schema.sql b/build/sql/schema.sql
index fb6b548ce..4627d2d23 100644
--- a/build/sql/schema.sql
+++ b/build/sql/schema.sql
@@ -205,7 +205,7 @@ CREATE TABLE "cc_show_days"
"first_show" DATE NOT NULL,
"last_show" DATE,
"start_time" TIME NOT NULL,
- "duration" TIME NOT NULL,
+ "duration" VARCHAR(255) NOT NULL,
"day" INT2,
"repeat_type" INT2 NOT NULL,
"next_pop_date" DATE,
diff --git a/library/phing/LICENSE b/library/phing/LICENSE
new file mode 100644
index 000000000..fc8a5de7e
--- /dev/null
+++ b/library/phing/LICENSE
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
diff --git a/public/css/add-show.css b/public/css/add-show.css
index 3f53ff6b0..f78f515eb 100644
--- a/public/css/add-show.css
+++ b/public/css/add-show.css
@@ -104,4 +104,10 @@ label.wrapp-label input[type="checkbox"] {
padding:8px;
color:#902d2d;
display:none;
-}
\ No newline at end of file
+}
+
+#add_show_hosts-element {
+ max-height: 80px;
+ min-width: 150px;
+ overflow: auto;
+}
diff --git a/public/js/airtime/library/spl.js b/public/js/airtime/library/spl.js
index 101ef9a2d..e32e83f62 100644
--- a/public/js/airtime/library/spl.js
+++ b/public/js/airtime/library/spl.js
@@ -331,20 +331,8 @@ function closeSPL() {
function createPlaylistMetaForm(json) {
var submit, form;
- submit = $('')
- .button()
- .click(function(){
- var url, data;
-
- url = '/Playlist/metadata/format/json';
- data = $("#side_playlist form").serialize();
-
- $.post(url, data, function(json){
- openDiffSPL(json);
- })
- });
-
form = $(json.form);
+ form.find("fieldset").addClass("simple-formblock metadata");
form.find("input, textarea")
.keydown(function(event){
@@ -355,10 +343,24 @@ function createPlaylistMetaForm(json) {
}
})
+ form.find("#new_playlist_submit")
+ .button()
+ .click(function(event){
+ event.preventDefault();
+
+ var url, data;
+
+ url = '/Playlist/metadata/format/json';
+ data = $("#side_playlist form").serialize();
+
+ $.post(url, data, function(json){
+ openDiffSPL(json);
+ })
+ });
+
$("#side_playlist")
.empty()
- .append(form)
- .append(submit);
+ .append(form);
}
function newSPL() {
diff --git a/public/js/playlist/nowplayingdatagrid.js b/public/js/playlist/nowplayingdatagrid.js
index 89eb2230b..d1d08fab2 100644
--- a/public/js/playlist/nowplayingdatagrid.js
+++ b/public/js/playlist/nowplayingdatagrid.js
@@ -1,5 +1,5 @@
-var registered = false;
-var datagridData;
+var datagridData = null;
+var currentShowInstanceID = -1;
function getDateText(obj){
var str = obj.aData[ obj.iDataColumn ].toString();
@@ -32,7 +32,7 @@ function changeTimePrecision(str){
return str;
}
-function notifySongEnd(){
+function notifySongStart(){
for (var i=0; i 0)
+ currentShowInstanceID = datagridData.currentShow[0].instance_id;
updateDataTable();
}});
}
@@ -123,19 +144,41 @@ function getData(){
function init2(){
getData();
- if (typeof registerSongEndListener == 'function' && !registered){
- registered = true;
- registerSongEndListener(notifySongEnd);
- }
-
setTimeout(init2, 5000);
-
}
function redirect(url){
document.location.href = url;
}
+function createDataGrid(){
+
+ columns[1]["fnRender"] = getDateText;
+ columns[2]["fnRender"] = getTimeText;
+ columns[3]["fnRender"] = getTimeText;
+ columns[4]["fnRender"] = changeTimePrecisionInit;
+
+ $('#nowplayingtable').dataTable( {
+ "bSort" : false,
+ "bJQueryUI": true,
+ "bFilter": false,
+ "bInfo": false,
+ "bLengthChange": false,
+ "bPaginate": false,
+ "aoColumns": columns,
+ "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
+ if (aData[aData.length-2] == currentShowInstanceID)
+ $(nRow).addClass("playing-list");
+ if (aData[0] == "c")
+ $(nRow).attr("class", "playing-song");
+ else if (aData[0] == "b")
+ $(nRow).attr("class", "gap");
+ return nRow;
+ },
+ "bAutoWidth":false
+ } );
+}
+
$(document).ready(function() {
createDataGrid();
diff --git a/public/js/playlist/playlist.js b/public/js/playlist/playlist.js
index b48f25a65..17e48082f 100644
--- a/public/js/playlist/playlist.js
+++ b/public/js/playlist/playlist.js
@@ -13,8 +13,6 @@ var currentElem;
var serverUpdateInterval = 5000;
var uiUpdateInterval = 200;
-var songEndFunc;
-
//set to "development" if we are developing :). Useful to disable alerts
//when entering production mode.
var APPLICATION_ENV = "";
@@ -25,20 +23,6 @@ var APPLICATION_ENV = "";
var nextSongPrepare = true;
var nextShowPrepare = true;
-/* Another script can register its function here
- * when it wishes to know when a song ends. */
-function registerSongEndListener(func){
- songEndFunc = func;
-}
-
-function notifySongEndListener(){
- if (typeof songEndFunc == "function"){
- //create a slight pause in execution to allow the browser
- //to update the display.
- setTimeout(songEndFunc, 50);
- }
-}
-
function getTrackInfo(song){
var str = "";
@@ -57,6 +41,7 @@ function secondsTimer(){
var date = new Date();
estimatedSchedulePosixTime = date.getTime() - localRemoteTimeOffset;
updateProgressBarValue();
+ updatePlaybar();
}
setTimeout(secondsTimer, uiUpdateInterval);
}
@@ -64,15 +49,16 @@ function secondsTimer(){
function newSongStart(){
nextSongPrepare = true;
currentSong[0] = nextSongs.shift();
- updatePlaybar();
- notifySongEndListener();
+ notifySongStart();
}
function nextShowStart(){
nextShowPrepare = true;
currentShow[0] = nextShow.shift();
- updatePlaybar();
+
+ //call function in nowplayingdatagrid.js
+ notifyShowStart(currentShow[0]);
}
/* Called every "uiUpdateInterval" mseconds. */
@@ -129,8 +115,6 @@ function updateProgressBarValue(){
setTimeout(nextShowStart, diff);
}
}
-
- updatePlaybar();
}
function updatePlaybar(){
@@ -230,7 +214,7 @@ function parseItems(obj){
function getScheduleFromServer(){
$.ajax({ url: "/Schedule/get-current-playlist/format/json", dataType:"json", success:function(data){
parseItems(data.entries);
- }});
+ }, error:function(jqXHR, textStatus, errorThrown){}});
setTimeout(getScheduleFromServer, serverUpdateInterval);
}
@@ -241,27 +225,31 @@ function init() {
//begin consumer "thread"
secondsTimer();
-
- $('#about-link').qtip({
- content: $('#about-txt').html(),
- show: 'mouseover',
- hide: { when: 'mouseout', fixed: true },
- position: {
- corner: {
- target: 'center',
- tooltip: 'topRight'
- }
- },
- style: {
- border: {
- width: 0,
- radius: 4
+
+ var qtipElem = $('#about-link');
+
+ if (qtipElem.length > 0)
+ qtipElem.qtip({
+ content: $('#about-txt').html(),
+ show: 'mouseover',
+ hide: { when: 'mouseout', fixed: true },
+ position: {
+ corner: {
+ target: 'center',
+ tooltip: 'topRight'
+ }
},
- name: 'light', // Use the default light style
- }
- });
+ style: {
+ border: {
+ width: 0,
+ radius: 4
+ },
+ name: 'light', // Use the default light style
+ }
+ });
}
$(document).ready(function() {
- init();
+ if ($('#master-panel').length > 0)
+ init();
});