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

Conflicts:
	application/controllers/ScheduleController.php
	public/css/styles.css
This commit is contained in:
naomiaro 2011-03-15 17:02:22 -04:00
commit 8f86b05a4b
496 changed files with 442 additions and 49839 deletions

View file

@ -23,7 +23,7 @@ require_once 'Users.php';
global $CC_CONFIG, $CC_DBC;
$dsn = $CC_CONFIG['dsn'];
$CC_DBC = DB::connect($dsn, TRUE);
$CC_DBC = DB::connect($dsn, FALSE);
if (PEAR::isError($CC_DBC)) {
echo "ERROR: ".$CC_DBC->getMessage()." ".$CC_DBC->getUserInfo()."\n";
exit(1);

View file

@ -16,6 +16,16 @@ class ApiController extends Zend_Controller_Action
// action body
}
/**
* Returns Airtime version. i.e "1.7.0 alpha"
*
* First checks to ensure the correct API key was
* supplied, then returns AIRTIME_VERSION as defined
* in application/conf.php
*
* @return void
*
*/
public function versionAction()
{
global $CC_CONFIG;
@ -35,7 +45,12 @@ class ApiController extends Zend_Controller_Action
echo $jsonStr;
}
/**
* Allows remote client to download requested media file.
*
* @return void
* The given value increased by the increment amount.
*/
public function getMediaAction()
{
global $CC_CONFIG;
@ -67,23 +82,9 @@ class ApiController extends Zend_Controller_Action
// !! binary mode !!
$fp = fopen($filepath, 'rb');
$mtype = '';
/*
// magic_mime module installed?
if (function_exists('mime_content_type')) {
$mtype = mime_content_type($file_path);
}
// fileinfo module installed?
else if (function_exists('finfo_file')) {
$finfo = finfo_open(FILEINFO_MIME); // return mime type
$mtype = finfo_file($finfo, $file_path);
finfo_close($finfo);
}
//header("Content-Type: $mtype");
*/
// possibly use fileinfo module here in the future.
// http://www.php.net/manual/en/book.fileinfo.php
$ext = pathinfo($filename, PATHINFO_EXTENSION);
if ($ext == "ogg")
header("Content-Type: audio/ogg");
@ -92,17 +93,12 @@ class ApiController extends Zend_Controller_Action
header("Content-Length: " . filesize($filepath));
//header('Content-Disposition: attachment; filename="'.$media->getRealMetadataFileName().'"');
fpassthru($fp);
return;
}
else {
header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found");
exit;
}
} else {
header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found");
exit;
}
}
header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found");
exit;
}
public function scheduleAction()

View file

@ -162,12 +162,25 @@ class ScheduleController extends Zend_Controller_Action
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/schedule-show-dialog'.$params,
'callback' => 'window["buildScheduleDialog"]'), 'title' => 'Add Content');
$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 Content');
if (strtotime($show->getShowStart()) <= strtotime($today_timestamp) &&
strtotime($today_timestamp) < strtotime($show->getShowEnd())) {
$menu[] = array('action' => array('type' => 'fn',
//'url' => '/Schedule/cancel-current-show'.$params,
'callback' => "window['confirmCancelShow']($id)"),
'title' => 'Cancel Current Show');
}
if (strtotime($today_timestamp) < strtotime($show->getShowStart())) {
if ($user->isAdmin()) {
@ -177,12 +190,6 @@ class ScheduleController extends Zend_Controller_Action
$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');
}
}
//returns format jjmenu is looking for.
@ -421,6 +428,19 @@ class ScheduleController extends Zend_Controller_Action
$show->cancelShow($showInstance->getShowStart());
}
}
public function cancelCurrentShowAction()
{
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new User($userInfo->id);
if($user->isAdmin()) {
$showInstanceId = $this->_getParam('id');
$show = new ShowInstance($showInstanceId);
$show->clearShow();
$show->deleteShow();
}
}
}

View file

@ -81,7 +81,7 @@ class Application_Form_AddUser extends Zend_Form
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('class', 'ui-button ui-state-default right-floated');
$submit->setIgnore(true);
$submit->setLabel('submit');
$submit->setLabel('Submit');
$this->addElement($submit);
}

View file

@ -38,7 +38,6 @@ class Application_Form_Preferences extends Zend_Form
$stream_format->setLabel('Stream Label:');
$stream_format->setMultiOptions(array("Artist - Title",
"Show - Artist - Title",
"Show",
"Station name - Show name"));
$stream_format->setValue(Application_Model_Preference::GetStreamLabelFormat());
$this->addElement($stream_format);

View file

@ -82,7 +82,11 @@ class Application_Model_Nowplaying
$type = "n";
}
array_push($data, array($type, $item["item_starts"], $item["item_starts"], $item["item_ends"], $item["clip_length"], $item["track_title"], $item["artist_name"], $item["album_title"], $item["playlist_name"], $item["show_name"], $item["instance_id"]));
$over = "";
if (strtotime($item['item_ends']) > strtotime($item['show_ends']))
$over = "x";
array_push($data, array($type, $item["item_starts"], $item["item_starts"], $item["item_ends"], $item["clip_length"], $item["track_title"], $item["artist_name"], $item["album_title"], $item["playlist_name"], $item["show_name"], $over, $item["instance_id"]));
}
}

View file

@ -733,7 +733,8 @@ class Schedule {
}
$result = array();
$result['status'] = array('range' => array('start' => $range_start, 'end' => $range_end), 'version' => "1.1");
$result['status'] = array('range' => array('start' => $range_start, 'end' => $range_end),
'version' => "1.1");
$result['playlists'] = $playlists;
$result['check'] = 1;

View file

@ -795,7 +795,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, si.id as instance_id"
$sql = "SELECT si.starts as start_timestamp, si.ends as end_timestamp, s.name, s.id, si.id as instance_id, si.record"
." FROM $CC_CONFIG[showInstances] si, $CC_CONFIG[showTable] s"
." WHERE si.show_id = s.id"
." AND si.starts <= TIMESTAMP '$timeNow'"
@ -846,6 +846,7 @@ class Show_DAL{
." WHERE ((si.starts < TIMESTAMP '$timeNow' - INTERVAL '$start seconds' AND si.ends > TIMESTAMP '$timeNow' - INTERVAL '$start seconds')"
." OR (si.starts > TIMESTAMP '$timeNow' - INTERVAL '$start seconds' AND si.ends < TIMESTAMP '$timeNow' + INTERVAL '$end seconds')"
." OR (si.starts < TIMESTAMP '$timeNow' + INTERVAL '$end seconds' AND si.ends > TIMESTAMP '$timeNow' + INTERVAL '$end seconds'))"
//checking for st.starts IS NULL so that the query also returns shows that do not have any items scheduled.
." AND (st.starts < si.ends OR st.starts IS NULL)"
." ORDER BY st.starts";

View file

@ -9,13 +9,17 @@
</div>
<div class="text-row next-song"><strong>Next:</strong> <span id='next'></span> <span id='next-length'></span></div>
</div>
<div class="show-block">
<div class="text-row">&nbsp;</div>
<div class="now-playing-info show"> <span id='playlist'></span> <span class="length" id="show-length"></span> </div>
<div class="progressbar">
<div class="progress-show" id='progress-show' style="width:0%;"></div>
<div class="show-block">
<div class="text-row">&nbsp;</div>
<div class="now-playing-info show">
<div class="recording-show" style="display: none;"></div>
<span id="playlist"></span>
<span class="lenght">00:00</span>
</div>
<div class="progressbar">
<div class="progress-show" id='progress-show' style="width:0%;"></div>
</div>
</div>
</div>
<div class="on-air-block">
<div class="on-air-info off" id="on-air-info">ON AIR</div>
</div>

View file

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

View file

@ -1,13 +1,13 @@
<div class=
"ui-widget ui-widget-content block-shadow clearfix padded-strong user-management">
<h2>
Manage users
Manage Users
</h2>
<div class="user-list-wrapper">
<div id="users_wrapper" class="dataTables_wrapper">
<div class="button-holder">
<button type="button" id="add_user_button" name="search_add_group" class="ui-button ui-widget ui-state-default ui-button-text-icon-primary"><span class="ui-button-text">New user</span></button>
<button type="button" id="add_user_button" name="search_add_group" class="ui-button ui-widget ui-state-default ui-button-text-icon-primary"><span class="ui-button-text">New User</span></button>
</div>
<table cellspacing="0" cellpadding="0" style="" id="users_datatable" class="datatable">
@ -15,8 +15,8 @@
<tr>
<th>id</th>
<th>Username</th>
<th>Firstname</th>
<th>Lastname</th>
<th>First Name</th>
<th>Last Name</th>
<th>Role</th>
<th>&nbsp;</th>
</tr>