Merge branch 'devel' of dev.sourcefabric.org:airtime into devel

This commit is contained in:
Martin Konecny 2012-09-17 15:55:53 -04:00
commit 0e82083ba1
15 changed files with 404 additions and 320 deletions

View File

@ -420,8 +420,9 @@ class ApiController extends Zend_Controller_Action
$this->uploadRecordedActionParam($show_instance_id, $file_id);
}
// The paramterized version of the uploadRecordedAction controller. We want this controller's action
// to be invokable from other controllers instead being of only through http
// The paramterized version of the uploadRecordedAction controller.
// We want this controller's action to be invokable from other
// controllers instead being of only through http
public function uploadRecordedActionParam($show_instance_id, $file_id)
{
$showCanceled = false;
@ -435,10 +436,10 @@ class ApiController extends Zend_Controller_Action
} catch (Exception $e) {
//we've reached here probably because the show was
//cancelled, and therefore the show instance does not
//exist anymore (ShowInstance constructor threw this error).
//We've done all we can do (upload the file and put it in
//the library), now lets just return.
//cancelled, and therefore the show instance does not exist
//anymore (ShowInstance constructor threw this error). We've
//done all we can do (upload the file and put it in the
//library), now lets just return.
$showCanceled = true;
}
@ -449,7 +450,7 @@ class ApiController extends Zend_Controller_Action
if (!$showCanceled && Application_Model_Preference::GetAutoUploadRecordedShowToSoundcloud()) {
$id = $file->getId();
$res = exec("/usr/lib/airtime/utils/soundcloud-uploader $id > /dev/null &");
Application_Model_Soundcloud::uploadSoundcloud($id);
}
}

View File

@ -25,9 +25,7 @@ class DashboardController extends Zend_Controller_Action
$user = new Application_Model_User($userInfo->id);
$show = Application_Model_Show::getCurrentShow();
$show_id = isset($show['id'])?$show['id']:0;
$show_id = isset($show[0]['id'])?$show[0]['id']:0;
$source_connected = Application_Model_Preference::GetSourceStatus($sourcename);
if ($user->canSchedule($show_id) && $source_connected) {

View File

@ -469,7 +469,7 @@ class LibraryController extends Zend_Controller_Action
public function uploadFileSoundcloudAction()
{
$id = $this->_getParam('id');
$res = exec("/usr/lib/airtime/utils/soundcloud-uploader $id > /dev/null &");
Application_Model_Soundcloud::uploadSoundcloud($id);
// we should die with ui info
die();
}
@ -490,6 +490,8 @@ class LibraryController extends Zend_Controller_Action
$this->view->sc_id = $file->getSoundCloudId();
$this->view->error_code = $file->getSoundCloudErrorCode();
$this->view->error_msg = $file->getSoundCloudErrorMsg();
} else {
Logging::warn("Trying to upload unknown type: $type with id: $id");
}
}
}

View File

@ -206,7 +206,6 @@ class ScheduleController extends Zend_Controller_Action
public function uploadToSoundCloudAction()
{
global $CC_CONFIG;
$show_instance = $this->_getParam('id');
try {
$show_inst = new Application_Model_ShowInstance($show_instance);
@ -218,7 +217,8 @@ class ScheduleController extends Zend_Controller_Action
$file = $show_inst->getRecordedFile();
$id = $file->getId();
$res = exec("/usr/lib/airtime/utils/soundcloud-uploader $id > /dev/null &");
//$res = exec("/usr/lib/airtime/utils/soundcloud-uploader $id > /dev/null &");
Application_Model_Soundcloud::uploadSoundcloud($id);
// we should die with ui info
die();
}

View File

@ -1100,7 +1100,17 @@ class Application_Model_Preference
return function ($x) { return $x; };
} else {
$ds = unserialize($v);
return function ($x) use ($ds) { return $ds['ColReorder'][$x]; } ;
return function ($x) use ($ds) {
if ( in_array($x, $ds['ColReorder'] ) ) {
return $ds['ColReorder'][$x];
} else {
Logging::warn("Index $x does not exist preferences");
Logging::warn("Defaulting to identity and printing
preferences");
Logging::warn($ds);
return $x;
}
} ;
}
}

View File

@ -344,12 +344,12 @@ SELECT showt.name AS show_name,
JOIN cc_show AS showt ON (showt.id = si.show_id)
WHERE si.modified_instance = FALSE
$showPredicate
AND (si.starts >= '{$p_start}'
AND ((si.starts >= '{$p_start}'
AND si.starts < '{$p_end}')
OR (si.ends > '{$p_start}'
AND si.ends <= '{$p_end}')
OR (si.starts <= '{$p_start}'
AND si.ends >= '{$p_end}')
AND si.ends >= '{$p_end}'))
ORDER BY si_starts,
sched_starts;
SQL;

View File

@ -23,7 +23,8 @@ class Application_Model_Soundcloud
return $token;
}
public function uploadTrack($filepath, $filename, $description, $tags=array(), $release=null, $genre=null)
public function uploadTrack($filepath, $filename, $description,
$tags=array(), $release=null, $genre=null)
{
if ($this->getToken()) {
if (count($tags)) {
@ -33,7 +34,7 @@ class Application_Model_Soundcloud
$tags = Application_Model_Preference::GetSoundCloudTags();
}
$downloadable = Application_Model_Preference::GetSoundCloudDownloadbleOption() == '1'?true:false;
$downloadable = Application_Model_Preference::GetSoundCloudDownloadbleOption() == '1';
$track_data = array(
'track[sharing]' => 'private',
@ -51,7 +52,6 @@ class Application_Model_Soundcloud
//YYYY-MM-DD-HH-mm-SS
$release = explode("-", $release);
$track_data['track[release_year]'] = $release[0];
$track_data['track[release_month]'] = $release[1];
$track_data['track[release_day]'] = $release[2];
@ -86,6 +86,13 @@ class Application_Model_Soundcloud
throw new NoSoundCloundToken();
}
}
public static function uploadSoundcloud($id)
{
$cmd = "/usr/lib/airtime/utils/soundcloud-uploader $id > /dev/null &";
Logging::info("Uploading soundcloud with command: $cmd");
exec($cmd);
}
}
class NoSoundCloundToken extends Exception {}

View File

@ -1170,7 +1170,9 @@ SQL;
$release = $file->getDbYear();
try {
$soundcloud = new Application_Model_Soundcloud();
$soundcloud_res = $soundcloud->uploadTrack($this->getFilePath(), $this->getName(), $description, $tag, $release, $genre);
$soundcloud_res = $soundcloud->uploadTrack(
$this->getFilePath(), $this->getName(), $description,
$tag, $release, $genre);
$this->setSoundCloudFileId($soundcloud_res['id']);
$this->setSoundCloudLinkToFile($soundcloud_res['permalink_url']);
$this->setSoundCloudUploadTime(new DateTime("now"), new DateTimeZone("UTC"));

View File

@ -35,7 +35,6 @@ class Application_Model_User
public function isHostOfShow($showId)
{
$userId = $this->_userInstance->getDbId();
return CcShowHostsQuery::create()
->filterByDbShow($showId)
->filterByDbHost($userId)->count() > 0;
@ -63,10 +62,9 @@ class Application_Model_User
if ($type === UTYPE_ADMIN ||
$type === UTYPE_PROGRAM_MANAGER ||
CcShowHostsQuery::create()->filterByDbShow($p_showId)->filterByDbHost($this->getId())->count() > 0) {
self::isHostOfShow($p_showId)) {
$result = true;
}
return $result;
}

View File

@ -35,9 +35,15 @@ if ($item['type'] == 2) {
<span class="spl_cue ui-state-default"></span>
<?php } else if ($item['type'] == 2) {
if ($staticBlock) {?>
<span class="spl_block_expand close" blockId="<?php echo $item["item_id"]; ?>" id="expand_block_<?php echo $item["id"]?>">Static Block Expand</span>
<span class="spl_block_expand close" blockId="<?php echo $item["item_id"]; ?>" id="expand_block_<?php echo $item["id"]?>">
<span class="ui-icon ui-icon-triangle-2-n-s"></span>
Expand Static Block
</span>
<?php } else { ?>
<span class="spl_block_expand close" blockId="<?php echo $item["item_id"]; ?>" id="expand_block_<?php echo $item["id"]?>">Dynamic Block</span>
<span class="spl_block_expand close" blockId="<?php echo $item["item_id"]; ?>" id="expand_block_<?php echo $item["id"]?>">
<span class="ui-icon ui-icon-triangle-2-n-s"></span>
Expand Dynamic Block
</span>
<?php }
} ?>
<span class="spl_title"><?php echo $item['track_title'] ?></span>
@ -79,7 +85,7 @@ if ($item['type'] == 2) {
</div>
<?php endif; ?>
<?php if ($item['type'] == 2) {?>
<div id="block_<?php echo $item["id"]?>_info"></div>
<ul style='display:none' id="block_<?php echo $item["id"]?>_info" class="smart-block-info"></ul>
<?php } ?>
</li>
<?php $i = $i+1; ?>

View File

@ -4,23 +4,15 @@
overflow: auto;
}
#side_playlist,
#side_playlist ul,
#side_playlist li {
#side_playlist,#side_playlist ul,#side_playlist li {
float: left;
}
#spl_sortable,
#spl_sortable > li,
#side_playlist > div,
#spl_editor,
.spl_artist,
.spl_cue_in,
.spl_fade_in,
.spl_cue_out,
.spl_fade_out {
#spl_sortable,#spl_sortable>li,#side_playlist>div,#spl_editor,.spl_artist,.spl_cue_in,.spl_fade_in,.spl_cue_out,.spl_fade_out
{
clear: left;
}
#spl_sortable>li {
width: 100%;
margin-bottom: -1px;
@ -29,15 +21,14 @@
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
/*#side_playlist button {
float: left;
font-size: 12px;
height: 28px;
margin: 0 7px 20px 0;
}*/
#side_playlist input,
#side_playlist textarea {
#side_playlist input,#side_playlist textarea {
width: 200px;
}
@ -55,7 +46,8 @@
margin-bottom: 0;
}
#side_playlist li div.list-item-container, #side_playlist li div.list-item-container.ui-state-active {
#side_playlist li div.list-item-container,#side_playlist li div.list-item-container.ui-state-active
{
height: 56px;
border: none;
}
@ -97,11 +89,13 @@
text-shadow: none;
opacity: 1;
}
.spl_block_expand:hover,.spl_block_expand.close:hover {
color: #FF611F;
text-shadow: none;
opacity: 1;
}
.spl_block_expand .ui-icon {
float: left;
}
@ -117,18 +111,17 @@
padding: 0 5px 0 0;
color: #D5D5D5;
}
.ui-state-active .spl_artist,.ui-state-active .spl_offset {
color: #606060 !important;
}
#spl_editor > div > span {
/* display: inline-block;
#spl_editor>div>span { /* display: inline-block;
width: 150px;*/
}
.ui-icon-closethick,
.spl_fade_control,
.spl_text_input {
.ui-icon-closethick,.spl_fade_control,.spl_text_input {
cursor: pointer;
}
@ -152,6 +145,7 @@
clear: both;
float: left;
}
#side_playlist h4 {
font-size: 15px;
margin: 8px 0 10px 0;
@ -161,9 +155,11 @@
clear: both;
float: left;
}
#side_playlist h3+h4 {
margin: 0 0 11px 0;
}
#spl_sortable div.big_play {
display: block;
width: 20px;
@ -174,8 +170,10 @@
float: left;
background-color: #707070;
background: -moz-linear-gradient(top, #707070 0, #666666 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #707070), color-stop(100%, #666666));
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #707070),
color-stop(100%, #666666) );
}
#spl_sortable div.big_play_disabled {
display: block;
width: 20px;
@ -186,34 +184,43 @@
float: left;
background-color: #707070;
background: -moz-linear-gradient(top, #707070 0, #666666 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #707070), color-stop(100%, #666666));
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #707070),
color-stop(100%, #666666) );
}
#spl_sortable div.big_play:hover {
border: 1px solid #282828;
background-color: #3b3b3b;
background: -moz-linear-gradient(top, #3b3b3b 0, #292929 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #3b3b3b), color-stop(100%, #292929));
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #3b3b3b),
color-stop(100%, #292929) );
cursor: pointer;
}
#spl_sortable div.big_play .ui-icon {
margin: 17px 0 0 1px;
}
#spl_sortable div.big_play_disabled .ui-icon {
margin: 17px 0 0 1px;
}
#spl_sortable div.big_play:hover .ui-icon-play, #spl_sortable div.big_play:hover .ui-icon-pause {
#spl_sortable div.big_play:hover .ui-icon-play,#spl_sortable div.big_play:hover .ui-icon-pause
{
background-image: url(redmond/images/ui-icons_ff5d1a_256x240.png);
}
#spl_sortable .ui-icon-closethick {
position: absolute;
top: 3px;
right: 6px;
z-index: 3;
}
#spl_sortable .ui-icon-closethick:hover {
background-image: url(redmond/images/ui-icons_ff5d1a_256x240.png)
}
#spl_sortable .spl_fade_control {
position: absolute;
right: 35px;
@ -227,6 +234,7 @@
#spl_sortable li .container {
}
#spl_sortable .text-row {
height: 20px;
line-height: 19px;
@ -236,31 +244,38 @@
margin: -1px 0 0 0;
float: none;
}
#spl_sortable .top {
padding-top: 9px;
}
#spl_sortable li .spl_fade_control.ui-state-default {
background: transparent url(images/crossfade_playlist.png) no-repeat 0 0;
border: none;
}
#spl_sortable li .spl_fade_control.ui-state-active {
background: transparent url(images/crossfade_playlist.png) no-repeat 0 -30px;
background: transparent url(images/crossfade_playlist.png) no-repeat 0
-30px;
border: none;
}
#spl_sortable li .crossfade,#spl_sortable li .cue-edit {
background: #debc9e url(images/crossfade_bg.png) repeat-x 0 0 !important;
border: 1px solid #5d5d5d;
border-width: 1px 0 0 0;
min-height: 35px;
}
#spl_sortable li .cue-edit {
background:#b6d1d5 url(images/cue-editor_bg.png) repeat-x 0 0 !important;
background: #b6d1d5 url(images/cue-editor_bg.png) repeat-x 0 0
!important;
}
#spl_sortable dl.inline-list {
margin: 10px 0 0 37px;
}
#spl_sortable li .spl_fade_start,#spl_sortable li .spl_fade_end {
background-color: transparent;
float: right;
@ -270,10 +285,12 @@
width: 33px;
margin-top: 2px;
}
#spl_sortable li .spl_fade_start.ui-state-default {
background: transparent url(images/fade_in.png) no-repeat 0 0;
border: none;
}
#spl_sortable li .spl_fade_start.ui-state-active {
background: transparent url(images/fade_in.png) no-repeat 0 -30px;
border: none;
@ -283,26 +300,30 @@
background: transparent url(images/fade_out.png) no-repeat 0 0;
border: none;
}
#spl_sortable li .spl_fade_end.ui-state-active {
background: transparent url(images/fade_out.png) no-repeat 0 -30px;
border: none;
}
.crossfade dl.inline-list, .cue-edit dl.inline-list, .crossfade-main dl.inline-list {
.crossfade dl.inline-list,.cue-edit dl.inline-list,.crossfade-main dl.inline-list
{
padding-bottom: 5px;
clear: left;
}
.crossfade dl.inline-list dt, .cue-edit dl.inline-list dt, .crossfade-main dl.inline-list dt {
.crossfade dl.inline-list dt,.cue-edit dl.inline-list dt,.crossfade-main dl.inline-list dt
{
min-width: 90px;
}
.crossfade dl.inline-list dd, .cue-edit dl.inline-list dd, .crossfade-main dl.inline-list dd {
.crossfade dl.inline-list dd,.cue-edit dl.inline-list dd,.crossfade-main dl.inline-list dd
{
float: left;
font-size: 12px;
margin: 0;
}
.edit-error {
color: #b80000;
margin: 0;
@ -317,6 +338,7 @@
.spl_text_input {
color: #fff;
}
.crossfade-main {
background: #debc9e;
border: 1px solid #5b5b5b;
@ -333,6 +355,7 @@
.crossfade-main .edit-error:last-child {
padding-bottom: 2px;
}
.crossfade-main .ui-icon-closethick {
position: absolute;
right: 6px;
@ -350,34 +373,40 @@
margin-top: 2px;
cursor: pointer;
}
#spl_sortable li .spl_cue.ui-state-default {
background: transparent url(images/cue_playlist.png) no-repeat 0 0;
border: none;
}
#spl_sortable li .spl_cue.ui-state-default:hover {
background: transparent url(images/cue_playlist.png) no-repeat 0 -15px;
border: none;
}
#spl_sortable li .spl_cue.ui-state-active, #spl_sortable li .spl_cue.ui-state-active:hover {
#spl_sortable li .spl_cue.ui-state-active,#spl_sortable li .spl_cue.ui-state-active:hover
{
background: transparent url(images/cue_playlist.png) no-repeat 0 -30px;
border: none;
}
/*--/////////////// Changes 16.05.2011 ////////////--*/
.playlist_title {
margin: 16px 0 10px 0;
height: 26px;
clear: both;
}
#side_playlist .playlist_title h3,#side_playlist .playlist_title h4 {
margin: 0;
padding: 0;
}
#side_playlist .playlist_title h3 {
float: left;
width: 84%;
}
#side_playlist .playlist_title h4 {
float: right;
clear: none;
@ -389,14 +418,16 @@
padding: 0 22px 0 2px;
background: url(images/icon_edit_l.png) no-repeat right center;
text-decoration: none;
}
#side_playlist .playlist_title h3 a:hover {
background-color: #D8D8D8;
}
.element_hidden {
display: none;
}
#side_playlist .playlist_title h3 input[type="text"] {
background-color: #dddddd;
border: 1px solid #8F8F8F;
@ -417,6 +448,7 @@
margin: 0;
padding: 0;
}
#side_playlist .zend_form dt,#side_playlist .zend_form dd {
display: block;
float: none;
@ -424,10 +456,12 @@
padding: 0;
width: 100%;
}
#side_playlist .zend_form dd.buttons {
margin-top: 8px;
text-align: right;
}
#side_playlist .zend_form dd.buttons .ui-button {
margin: 0 0 0 10px;
}
@ -461,26 +495,32 @@
margin: 0 0 8px 0;
padding: 8px;
}
#side_playlist fieldset.closed .zend_form {
display: none;
}
#side_playlist fieldset.closed {
border-width: 1px 0 0;
margin-bottom: -6px;
margin-left: 1px;
}
fieldset>legend {
color: #4f4f4f;
font-size: 12px;
line-height: 140%;
}
.ui-widget-content fieldset legend .ui-icon {
float: left;
background-image: url(redmond/images/ui-icons_454545_256x240.png);
}
#side_playlist .zend_form input,#side_playlist .zend_form textarea {
width: auto;
}
#fieldset-metadate_change {
clear: both;
}
@ -494,7 +534,6 @@ li.spl_empty {
}
/*---////// SMART BLOCK /////---*/
.smart-block-info {
padding: 5px 35px 10px 36px;
width: 100%;
@ -502,6 +541,7 @@ li.spl_empty {
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
.smart-block-info>li {
display: block;
float: none;
@ -509,19 +549,27 @@ li.spl_empty {
width: 100%;
font-size: 13px;
}
.smart-block-info>li span.block-item-time {
text-align: right;
float: right;
color: #D5D5D5;
font-size: 12px;
}
.smart-block-info>li span.block-item-title {
font-weight: bold;
display: inline-block;
padding-right: 6px;
}
.smart-block-info>li span.block-item-author {
font-weight: normal;
display: inline-block;
}
.smart-block-info>li span.block-item-criteria {
font-weight: normal;
display: inline-block;
padding-right: 6px;
}

View File

@ -529,7 +529,7 @@ input.input_text.sp_input_text{
}
input.input_text.sp_extra_input_text{
width: 87px !important;
width: 90px !important;
}
.sp_text_font{

View File

@ -17,6 +17,7 @@ var AIRTIME = (function(AIRTIME) {
"comments" : "s",
"composer" : "s",
"conductor" : "s",
"copyright" : "s",
"utime" : "n",
"mtime" : "n",
"lptime" : "n",
@ -382,14 +383,16 @@ var AIRTIME = (function(AIRTIME) {
}
var inputClass = 'filter_column filter_number_text';
var labelStyle = "style='margin-right:35px;'";
if (criteriaTypes[ele.mDataProp] != "s") {
inputClass = 'filterColumn filter_number_range';
labelStyle = "";
}
if (ele.bVisible) {
advanceSearchDiv.append("<div id='advanced_search_col_"+currentColId+" class='control-group'><label class='control-label'>"+ele.sTitle+label+" : </label><div id='"+ele.mDataProp+"' class='controls "+inputClass+"'></div></div>");
advanceSearchDiv.append("<div id='advanced_search_col_"+currentColId+" class='control-group'><label class='control-label'"+labelStyle+">"+ele.sTitle+label+" : </label><div id='"+ele.mDataProp+"' class='controls "+inputClass+"'></div></div>");
} else {
advanceSearchDiv.append("<div id='advanced_search_col_"+currentColId+"' class='control-group' style='display:none;'><label class='control-label'>"+ele.sTitle+label+"</label><div id='"+ele.mDataProp+"' class='controls "+inputClass+"'></div></div>");
advanceSearchDiv.append("<div id='advanced_search_col_"+currentColId+"' class='control-group' style='display:none;'><label class='control-label'"+labelStyle+">"+ele.sTitle+label+"</label><div id='"+ele.mDataProp+"' class='controls "+inputClass+"'></div></div>");
}
if (criteriaTypes[ele.mDataProp] == "s") {

View File

@ -369,7 +369,6 @@ var AIRTIME = (function(AIRTIME){
$.each($(".big_play"), function(index, value){
if ($(value).attr('blockId') === undefined) {
var mime = $(value).attr("data-mime-type");
console.log($(value));
if (isAudioSupported(mime)) {
$(value).bind("click", openAudioPreview);
} else {
@ -429,24 +428,33 @@ var AIRTIME = (function(AIRTIME){
if (isStatic) {
$.each(data, function(index, ele){
if (ele.track_title !== undefined) {
$html += "<div>"+ele.track_title+" "+ele.creator+" "+ele.length+"</div>";
$html += "<li>" +
"<span class='block-item-title'>"+ele.track_title+"</span>" +
"<span class='block-item-author'>"+ele.creator+"</span>" +
"<span class='block-item-time'>"+ele.length+"</span>" +
"</li>";
}
})
} else {
for (var key in data.crit){
$.each(data.crit[key], function(index, ele){
var extra = (ele['extra']==null)?"":ele['extra'];
$html += "<div>"+ele['display_name']+" "+ele['modifier']+" "+ele['value']+" "+extra+"</div>";
var extra = (ele['extra']==null)?"":"- "+ele['extra'];
$html += "<li>" +
"<span class='block-item-title'>"+ele['display_name']+"</span>" +
"<span class='block-item-criteria'>"+ele['modifier']+"</span>" +
"<span class='block-item-criteria'>"+ele['value']+"</span>" +
"<span class='block-item-criteria'>"+extra+"</span>" +
"</li>";
});
}
$html += "<div>"+data.limit.value+" "+data.limit.modifier;
$html += "<li><br /><span class='block-item-title'>Limit to: "+data.limit.value+" "+data.limit.modifier+"</span></li>";
}
$pl.find("#block_"+id+"_info").html($html);
$pl.find("#block_"+id+"_info").html($html).show();
mod.enableUI();
});
$(this).removeClass('close');
} else {
$pl.find("#block_"+id+"_info").html("");
$pl.find("#block_"+id+"_info").html("").hide();
$(this).addClass('close');
}
}});

View File

@ -33,6 +33,7 @@ set_include_path(implode(PATH_SEPARATOR, array(
require_once($CC_CONFIG['phpDir'].'/application/models/StoredFile.php');
require_once($CC_CONFIG['phpDir'].'/application/models/Preference.php');
require_once($CC_CONFIG['phpDir'].'/application/models/MusicDir.php');
require_once($CC_CONFIG['phpDir'].'/application/common/OsPath.php');
set_include_path($CC_CONFIG['phpDir'].'/library' . PATH_SEPARATOR . get_include_path());
require_once($CC_CONFIG['phpDir'].'/application/models/Soundcloud.php');