Merge branch 'master' of dev.sourcefabric.org:airtime

Conflicts:
	public/js/playlist/nowplayingdatagrid.js
This commit is contained in:
martin 2011-02-14 10:40:22 -05:00
commit bb2d4c6795
36 changed files with 518 additions and 300 deletions

View File

@ -70,6 +70,7 @@
<actionMethod actionName="showContentDialog"/>
<actionMethod actionName="editShow"/>
<actionMethod actionName="addShow"/>
<actionMethod actionName="cancelShow"/>
</controllerFile>
<controllerFile controllerName="Api">
<actionMethod actionName="index"/>
@ -321,6 +322,9 @@
<viewControllerScriptsDirectory forControllerName="Dashboard">
<viewScriptFile forActionName="help"/>
</viewControllerScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="Schedule">
<viewScriptFile forActionName="cancelShow"/>
</viewControllerScriptsDirectory>
</viewScriptsDirectory>
<viewHelpersDirectory/>
<viewFiltersDirectory enabled="false"/>

View File

@ -1,27 +1,37 @@
This application uses the following 3rd Party software:
* Zend Framework (New BSD license, compatible with GPL)
* Liquidsoap (GPLv2, we only call this as an executable)
* PEAR (Ok to ship with GPLed code, see: http://pear.php.net/manual/en/faq.devs.php, see note [1])
* poc-streamer (mp3cut)
* PHP
* Zend Framework
- License: New BSD license
- Does this link with our code? Yes
- Compatible with GPLv3: Yes
[1] PEAR Note (from http://pear.php.net/manual/en/faq.devs.php):
"""
From time to time people raise concerns of using PEAR packages licensed under the PHP license in GPL'ed code. In a discussion about this topic, the creator of PHP, Rasmus Lerdorf, issued the following statement:
* Liquidsoap
- License: GPLv2
- Does this link with our code? No, we only call this as an executable
It all comes down to semantics of what linking means. The PHP license is pretty much identical to the Apache license and you could indeed make a case for not allowing any GPL'ed software to be "linked to" from Apache either.
* PEAR
- Notes: We only use the PEAR base class PEAR_Error, in the "PEAR" PEAR library.
- License: New BSD License
- Does this link with our code? Yes
- Compatible with GPLv3? Yes.
See http://www.apache.org/licenses/LICENSE-1.1.
* GetID3
- License: GPLv2
- Does this link with our code? Yes
- Compatible with GPLv3? Yes
The PHP license was chosen to match the Apache license because Apache and PHP are tied so closely to each other.
* mp3cut from the package poc-streamer
- Does this link with our code? No, it is an externally called executable file.
This hair splitting over linking, derivation and aggregation has been going on since the beginning of time. My stance is that you can indeed ship PHP licensed PEAR components on the same cd or in the same tarball as GPL'ed code because I see it as an aggregate work. This changes if you take PEAR code, modify it and copy-paste it directly into your own work. Then it moves from aggregate to derived. But the intent of the PEAR components is to be used in aggregate form. The PHP license allows you to use it in derived form as well, of course, but then you should be choosing a license other than the GPL for the derived work.
* PHP
- Does this link with our code? No, it is the interpreter.
The FSF has a FAQ on aggregation here: http://www.fsf.org/licensing/licenses/gpl-faq.html#MereAggregation
* Propel ORM
- License: MIT/Expat License
- Does this link with our code? Yes
- Compatible with the GPL: Yes. See http://www.gnu.org/licenses/license-list.html
That text is heavily biased towards compiled software and they talk about executables and memory spaces which don't really apply in this case. If you don't consider using a PEAR component as aggregation then it logically follows that you also cannot have Apache call your code so you will have to stipulate that nobody can use your code from Apache. I think this is an extreme interpretation that pretty much nobody out there shares.
In short, I don't see an issue here. Move along.
"""
* Phing
- Note: Only used for development, not needed to run Airtime.
- License: LGPLv3

View File

@ -1,6 +1,6 @@
<?php
// This file generated by Propel 1.5.2 convert-conf target
// from XML runtime conf file /home/martin/workspace/airtime/build/runtime-conf.xml
// from XML runtime conf file /home/naomiaro/dev-campcaster/campcaster/build/runtime-conf.xml
$conf = array (
'datasources' =>
array (
@ -17,4 +17,4 @@ $conf = array (
'generator_version' => '1.5.2',
);
$conf['classmap'] = include(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'classmap-airtime-conf.php');
return $conf;
return $conf;

View File

@ -16,11 +16,11 @@ $pages = array(
'resource' => 'nowplaying'
),
array(
'label' => 'Schedule',
'module' => 'default',
'controller' => 'Schedule',
'action' => 'index',
'resource' => 'schedule'
'label' => 'Add Audio',
'module' => 'default',
'controller' => 'Plupload',
'action' => 'plupload',
'resource' => 'plupload'
),
array(
'label' => 'Playlist Builder',
@ -30,15 +30,15 @@ $pages = array(
'resource' => 'library'
),
array(
'label' => 'Add Audio',
'module' => 'default',
'controller' => 'Plupload',
'action' => 'plupload',
'resource' => 'plupload'
'label' => 'Calendar',
'module' => 'default',
'controller' => 'Schedule',
'action' => 'index',
'resource' => 'schedule'
),
array(
'label' => 'Configure',
'uri' => 'javascript:void(null)',
'uri' => '#',
'resource' => 'preference',
'pages' => array(
array(

View File

@ -93,7 +93,8 @@ class PlaylistController extends Zend_Controller_Action
$this->changePlaylist($pl_id);
$form = new Application_Form_PlaylistMetadata();
$this->view->form = $form->__toString();
$this->view->fieldset = $form;
$this->view->form = $this->view->render('playlist/new.phtml');
}
public function metadataAction()
@ -115,26 +116,25 @@ class PlaylistController extends Zend_Controller_Action
}
if ($request->isPost()) {
if ($form->isValid($request->getPost())) {
$formdata = $form->getValues();
$title = $this->_getParam('title', null);
$description = $this->_getParam('description', null);
$pl = $this->getPlaylist();
if($formdata["title"])
$pl->setName($formdata["title"]);
if(isset($formdata["description"])) {
$pl->setPLMetaData(UI_MDATA_KEY_DESCRIPTION, $formdata["description"]);
}
$pl = $this->getPlaylist();
if($title)
$pl->setName($title);
if(isset($description)) {
$pl->setPLMetaData(UI_MDATA_KEY_DESCRIPTION, $description);
}
$this->view->pl = $pl;
$this->view->html = $this->view->render('playlist/index.phtml');
unset($this->view->pl);
}
$this->view->pl = $pl;
$this->view->html = $this->view->render('playlist/index.phtml');
unset($this->view->pl);
}
$this->view->form = $form->__toString();
$this->view->fieldset = $form;
$this->view->form = $this->view->render('playlist/new.phtml');
}
public function editAction()

View File

@ -24,6 +24,7 @@ class ScheduleController extends Zend_Controller_Action
->addActionContext('remove-group', 'json')
->addActionContext('edit-show', 'json')
->addActionContext('add-show', 'json')
->addActionContext('cancel-show', 'json')
->initContext();
$this->sched_sess = new Zend_Session_Namespace("schedule");
@ -123,7 +124,7 @@ class ScheduleController extends Zend_Controller_Action
public function deleteShowAction()
{
$showInstanceId = $this->_getParam('id');
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new User($userInfo->id);
@ -145,22 +146,23 @@ class ScheduleController extends Zend_Controller_Action
$params = '/format/json/id/#id#';
if(strtotime($today_timestamp) < strtotime($show->getShowStart())) {
if($user->isAdmin()) {
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/delete-show'.$params, 'callback' => 'window["scheduleRefetchEvents"]'), 'title' => 'Delete');
if (strtotime($today_timestamp) < strtotime($show->getShowStart())) {
if ($user->isHost($show->getShowId()) || $user->isAdmin()) {
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/schedule-show-dialog'.$params, 'callback' => 'window["buildScheduleDialog"]'), 'title' => 'Add Content');
}
if($user->isHost($show->getShowId()) || $user->isAdmin()) {
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/clear-show'.$params, 'callback' => 'window["scheduleRefetchEvents"]'), 'title' => 'Clear');
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/schedule-show-dialog'.$params, 'callback' => 'window["buildScheduleDialog"]'), 'title' => 'Schedule');
}
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/show-content-dialog'.$params, 'callback' => 'window["buildContentDialog"]'),
'title' => 'Show Content');
if (strtotime($today_timestamp) < strtotime($show->getShowStart())) {
if ($user->isAdmin()) {
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/delete-show'.$params, 'callback' => 'window["scheduleRefetchEvents"]'), 'title' => 'Delete This Instance');
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/cancel-show'.$params, 'callback' => 'window["scheduleRefetchEvents"]'), 'title' => 'Delete This Instance and All Following');
}
if ($user->isHost($show->getShowId()) || $user->isAdmin()) {
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/clear-show'.$params, 'callback' => 'window["scheduleRefetchEvents"]'), 'title' => 'Remove All Content');
}
}
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/show-content-dialog'.$params, 'callback' => 'window["buildContentDialog"]'),
'title' => 'Show Contents');
//returns format jjmenu is looking for.
die(json_encode($menu));
@ -211,7 +213,7 @@ class ScheduleController extends Zend_Controller_Action
public function findPlaylistsAction()
{
$post = $this->getRequest()->getPost();
$show = new ShowInstance($this->sched_sess->showInstanceId);
$playlists = $show->searchPlaylistsForShow($post);
@ -302,7 +304,7 @@ class ScheduleController extends Zend_Controller_Action
public function addShowAction()
{
$js = $this->_getParam('data');
$js = $this->_getParam('data');
$data = array();
//need to convert from serialized jQuery array.
@ -324,6 +326,12 @@ class ScheduleController extends Zend_Controller_Action
$formRepeats->removeDecorator('DtDdWrapper');
$formStyle->removeDecorator('DtDdWrapper');
$this->view->what = $formWhat;
$this->view->when = $formWhen;
$this->view->repeats = $formRepeats;
$this->view->who = $formWho;
$this->view->style = $formStyle;
$what = $formWhat->isValid($data);
$when = $formWhen->isValid($data);
if($when) {
@ -333,7 +341,7 @@ class ScheduleController extends Zend_Controller_Action
if($data["add_show_repeats"]) {
$repeats = $formRepeats->isValid($data);
if($repeats) {
$when = $formRepeats->checkReliantFields($data);
$repeats = $formRepeats->checkReliantFields($data);
}
}
else {
@ -352,37 +360,38 @@ class ScheduleController extends Zend_Controller_Action
}
//send back a new form for the user.
$formWhat = new Application_Form_AddShowWhat();
$formWho = new Application_Form_AddShowWho();
$formWhen = new Application_Form_AddShowWhen();
$formRepeats = new Application_Form_AddShowRepeats();
$formStyle = new Application_Form_AddShowStyle();
$formWhat->removeDecorator('DtDdWrapper');
$formWho->removeDecorator('DtDdWrapper');
$formWhen->removeDecorator('DtDdWrapper');
$formRepeats->removeDecorator('DtDdWrapper');
$formStyle->removeDecorator('DtDdWrapper');
$this->view->what = $formWhat;
$this->view->when = $formWhen;
$this->view->repeats = $formRepeats;
$this->view->who = $formWho;
$this->view->style = $formStyle;
$formWhat->reset();
$formWho->reset();
$formWhen->reset();
$formWhen->populate(array('add_show_start_date' => date("Y-m-d"),
'add_show_start_time' => '0:00',
'add_show_duration' => '1:00'));
$formRepeats->reset();
$formRepeats->populate(array('add_show_end_date' => date("Y-m-d")));
$formStyle->reset();
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
}
else {
$this->view->what = $formWhat;
$this->view->when = $formWhen;
$this->view->repeats = $formRepeats;
$this->view->who = $formWho;
$this->view->style = $formStyle;
$this->view->form = $this->view->render('schedule/add-show-form.phtml');
}
}
}
public function cancelShowAction()
{
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new User($userInfo->id);
if($user->isAdmin()) {
$showInstanceId = $this->_getParam('id');
$showInstance = new ShowInstance($showInstanceId);
$show = new Show($showInstance->getShowId());
$show->cancelShow($showInstance->getShowStart());
}
}
}
@ -390,3 +399,5 @@ class ScheduleController extends Zend_Controller_Action

View File

@ -23,6 +23,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
'label' => 'Start Time:',
'class' => 'input_text',
'required' => true,
'value' => '0:00',
'filters' => array('StringTrim'),
'validators' => array(
'NotEmpty',
@ -37,10 +38,12 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
'value' => '1:00',
'required' => true,
'filters' => array('StringTrim'),
'validators' => array(
'NotEmpty',
array('date', false, array('HH:mm', 'messages' => 'Show must be under 24 hours'))
)
'validators' => array(
'NotEmpty',
array('regex', false,
array('/^\d+:[0-5][0-9]$/',
'messages' => 'enter a duration: HH:mm'))
)
));
// Add repeats element

View File

@ -9,9 +9,10 @@ class Application_Form_EditAudioMD extends Zend_Form
$this->setMethod('post');
// Add title field
$this->addElement('text', 'track_title', array(
$this->addElement('text', 'dc:title', array(
'label' => 'Title:',
'required' => true,
'class' => 'input_text',
'filters' => array('StringTrim'),
'validators' => array(
'NotEmpty',
@ -19,70 +20,74 @@ class Application_Form_EditAudioMD extends Zend_Form
));
// Add artist field
$this->addElement('text', 'artist_name', array(
$this->addElement('text', 'dc:creator', array(
'label' => 'Artist:',
'required' => true,
'class' => 'input_text',
'filters' => array('StringTrim'),
'validators' => array(
'NotEmpty',
)
));
// Add bitrate field
// $this->addElement('text', 'bit_rate', array(
// 'label' => 'Bitrate:',
// 'attribs' => array('disabled' => 'disabled')
//));
// Add album field
$this->addElement('text', 'album_title', array(
$this->addElement('text', 'dc:source', 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(
$this->addElement('text', 'ls: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(
$this->addElement('text', 'dc:publisher', array(
'label' => 'Label:',
'class' => 'input_text',
'filters' => array('StringTrim')
));
// Add composer field
$this->addElement('text', 'composer', array(
$this->addElement('text', 'ls:composer', array(
'label' => 'Composer:',
'class' => 'input_text',
'filters' => array('StringTrim')
));
// Add mood field
$this->addElement('text', 'mood', array(
$this->addElement('text', 'ls:mood', array(
'label' => 'Mood:',
'class' => 'input_text',
'filters' => array('StringTrim')
));
// Add language field
$this->addElement('text', 'language', array(
$this->addElement('text', 'dc: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',
));
}

View File

@ -1,6 +1,6 @@
<?php
class Application_Form_PlaylistMetadata extends Zend_Form
class Application_Form_PlaylistMetadata extends Zend_Form_SubForm
{
public function init()
@ -8,6 +8,7 @@ class Application_Form_PlaylistMetadata extends Zend_Form
// Add username element
$this->addElement('text', 'title', array(
'label' => 'Title:',
'class' => 'input_text',
'required' => false,
'filters' => array('StringTrim'),
'validators' => array(
@ -18,10 +19,15 @@ class Application_Form_PlaylistMetadata extends Zend_Form
// 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
));
}
}

View File

@ -17,14 +17,21 @@ class Application_Form_Preferences extends Zend_Form
'value' => Application_Model_Preference::GetValue("station_name")
));
$defaultFade = Application_Model_Preference::GetValue("default_fade");
if($defaultFade == ""){
$defaultFade = '00:00:00.000000';
}
// Add login element
$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' => Application_Model_Preference::GetValue("default_fade")
'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
));
$this->addElement('submit', 'submit', array(
@ -34,4 +41,3 @@ class Application_Form_Preferences extends Zend_Form
));
}
}
///^[0-2][0-3]:[0-5][0-9]:[0-5][0-9]{.}[0-9]{0-6}/i

View File

@ -11,7 +11,7 @@
<div id="Panel">
<div class="logo"></div>
<?= $this->partial('partialviews/header.phtml', array("user" => $this->loggedInAs())) ?>
<?php echo $this->partial('partialviews/header.phtml', array("user" => $this->loggedInAs())) ?>
<?php $partial = array('menu.phtml', 'default');
$this->navigation()->menu()->setPartial($partial); ?>

View File

@ -11,7 +11,7 @@
<div id="Panel">
<div class="logo"></div>
<?= $this->partial('partialviews/header.phtml', array("user" => $this->loggedInAs())) ?>
<?php echo $this->partial('partialviews/header.phtml', array("user" => $this->loggedInAs())) ?>
<?php $partial = array('menu.phtml', 'default');
$this->navigation()->menu()->setPartial($partial); ?>

View File

@ -8,7 +8,7 @@
<?php echo $this->headLink() ?>
</head>
<body>
<div id="nowplayingbar"><?= $this->partial('partialviews/header.phtml', array("user" => $this->loggedInAs())) ?></div>
<div id="nowplayingbar"><?php echo $this->partial('partialviews/header.phtml', array("user" => $this->loggedInAs())) ?></div>
<div id="nav"><?php echo $this->navigation()->menu()->setRenderInvisible(true) ?></div>
<div class="wrapper">

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -5,9 +5,9 @@
<ol>
<li>Add your files to the library using the "Add Audio" button. You can drag and drop your files to this window too. </li>
<li>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.</li>
<li>Create a playlist in the Playlist Builder menu using your audio files. </li>
<li>Add the playlist to the show by going to your show in the Schedule calendar, right-clicking on it and selecting "Schedule." </li>
<li>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.</li>
<li>Add the playlist to the show by going to your show in the Schedule calendar, right-clicking on it and selecting "Add Content." </li>
<li>Select your playlist and drag and drop it to the "Items in this show" area.</li>
</ol>
<p><strong>Then you're good to go!</strong><br />

View File

@ -1,4 +1,6 @@
<?php
<div class="ui-widget ui-widget-content block-shadow simple-formblock clearfix padded-strong">
<h2>Edit Metadata</h2>
$this->form->setAction($this->url());
echo $this->form;
<?php $this->form->setAction($this->url());
echo $this->form; ?>
</div>

View File

@ -1,4 +1,4 @@
<div class="button-bar-top">
<a href="javascript:void(0)" class="toggle-button end-button" id="now_view">Now View</a><a href="javascript:void(0)" class="toggle-button-active" id="day_view">Day View</a><input type="text" id="datepicker" class="input_text">
<span class="toggle-button end-button" id="now_view">Now View</span><span class="toggle-button-active" id="day_view">Day View</span><input type="text" id="datepicker" class="input_text">
</div>
<div id='demo'></div>
<table cellpadding="0" cellspacing="0" border="0" class="datatable" id="nowplayingtable"></table>

View File

@ -1,4 +1,4 @@
<div class="button-bar-top">
<a href="javascript:void(0)" class="toggle-button-active end-button" id="now_view">Now View</a><a href="javascript:void(0)" class="toggle-button" id="day_view">Day View</a>
<span class="toggle-button-active end-button" id="now_view">Now View</span><span class="toggle-button" id="day_view">Day View</span>
</div>
<div id='demo'></div>
<table cellpadding="0" cellspacing="0" border="0" class="datatable" id="nowplayingtable"></table>

View File

@ -1 +1,3 @@
<?php echo $this->form; ?>
<form method="post" action="" enctype="application/x-www-form-urlencoded">
<?php echo $this->view->fieldset; ?>
</form>

View File

@ -1 +1,4 @@
<br /><br /><center>View script for controller <b>Playlist</b> and script/action name <b>new</b></center>
<h3 class="plain">Playlist Metadata</h3>
<form method="post" action="" enctype="application/x-www-form-urlencoded">
<?php echo $this->fieldset; ?>
</form>

View File

@ -0,0 +1 @@
<br /><br /><center>View script for controller <b>Schedule</b> and script/action name <b>cancelShow</b></center>

View File

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

View File

@ -142,7 +142,7 @@
<column name="first_show" phpName="DbFirstShow" type="DATE" required="true"/>
<column name="last_show" phpName="DbLastShow" type="DATE" required="false"/>
<column name="start_time" phpName="DbStartTime" type="TIME" required="true"/>
<column name="duration" phpName="DbDuration" type="TIME" required="true"/>
<column name="duration" phpName="DbDuration" type="VARCHAR" required="true"/>
<column name="day" phpName="DbDay" type="TINYINT" required="false"/>
<column name="repeat_type" phpName="DbRepeatType" type="TINYINT" required="true"/>
<column name="next_pop_date" phpName="DbNextPopDate" type="DATE" required="false"/>

View File

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

165
library/phing/LICENSE Normal file
View File

@ -0,0 +1,165 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
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.

View File

@ -104,4 +104,10 @@ label.wrapp-label input[type="checkbox"] {
padding:8px;
color:#902d2d;
display:none;
}
}
#add_show_hosts-element {
max-height: 80px;
min-width: 150px;
overflow: auto;
}

View File

@ -331,20 +331,8 @@ function closeSPL() {
function createPlaylistMetaForm(json) {
var submit, form;
submit = $('<button id="new_playlist_submit">Submit</button>')
.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() {

View File

@ -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<datagridData.rows.length; i++){
if (datagridData.rows[i][0] == "c")
datagridData.rows[i][0] = "p";
@ -42,7 +42,7 @@ function notifySongEnd(){
}
}
createDataGrid();
updateDataTable();
}
var columns = [{"sTitle": "type", "bVisible":false},
@ -87,8 +87,24 @@ function createDataGrid(){
} );
function notifyShowStart(show){
currentShowInstanceID = show.instance_id;
updateDataTable();
}
var columns = [{"sTitle": "type", "bVisible":false},
{"sTitle":"Date"},
{"sTitle":"Start"},
{"sTitle":"End"},
{"sTitle":"Duration"},
{"sTitle":"Song"},
{"sTitle":"Artist"},
{"sTitle":"Album"},
{"sTitle":"Playlist"},
{"sTitle":"Show"},
{"sTitle":"bgcolor", "bVisible":false},
{"sTitle":"group_id", "bVisible":false}];
function getDateString(){
var date0 = $("#datepicker").datepicker("getDate");
return (date0.getFullYear() + "-" + (parseInt(date0.getMonth())+1) + "-" + date0.getDate());
@ -106,16 +122,21 @@ function getAJAXURL(){
function updateDataTable(){
var table = $('#nowplayingtable').dataTable();
table.fnClearTable(false);
table.fnAddData(datagridData.rows, false);
table.fnDraw(true);
//Check if datagridData has been initialized since this update
//function can be called before ajax call has been returned.
if (datagridData != null){
table.fnClearTable(false);
table.fnAddData(datagridData.rows, false);
table.fnDraw(true);
}
}
function getData(){
$.ajax({ url: getAJAXURL(), dataType:"json", success:function(data){
datagridData = data.entries;
if (datagridData.currentShow.length > 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();

View File

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