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

This commit is contained in:
Martin Konecny 2012-08-09 14:39:42 -04:00
commit 952f18dc3c
8 changed files with 105 additions and 58 deletions

View File

@ -195,15 +195,16 @@ class PlaylistController extends Zend_Controller_Action
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new Application_Model_User($userInfo->id);
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
$this->view->obj = $obj;
if($isAdminOrPM || $obj->getCreatorId() == $userInfo->id){
$this->view->obj = $obj;
if($this->obj_sess->type == "block"){
$form = new Application_Form_SmartBlockCriteria();
$form->startForm($this->obj_sess->id);
$this->view->form = $form;
}
}
$formatter = new LengthFormatter($obj->getLength());
$this->view->length = $formatter->format();
$this->view->type = $this->obj_sess->type;

View File

@ -196,7 +196,8 @@ class Application_Model_Block
f.id as item_id, f.track_title, f.artist_name as creator, f.file_exists as exists, f.filepath as path FROM cc_blockcontents AS pc
LEFT JOIN cc_files AS f ON pc.file_id=f.id
LEFT JOIN cc_block AS bl ON pc.block_id = bl.id
WHERE pc.block_id = {$this->id};
WHERE pc.block_id = {$this->id}
ORDER BY pc.position;
EOT;
$con = Propel::getConnection();
$rows = $con->query($sql)->fetchAll();
@ -882,6 +883,7 @@ EOT;
public function deleteAllFilesFromBlock()
{
CcBlockcontentsQuery::create()->findByDbBlockId($this->id)->delete();
$this->block->reload();
}
// smart block functions start
@ -943,7 +945,7 @@ EOT;
$error[] = "Limit cannot be empty or smaller than 0";
} else {
$mins = $data['etc']['sp_limit_value'] * $multiplier;
if ($mins > 14400) {
if ($mins > 1440) {
$error[] = "Limit cannot be more than 24 hrs";
}
}

View File

@ -172,19 +172,19 @@ class Application_Model_Playlist
*/
$sql = <<<"EOT"
(SELECT * FROM
((SELECT pc.id as id, pc.type, pc.position, pc.cliplength as length, pc.cuein, pc.cueout, pc.fadein, pc.fadeout,
f.id as item_id, f.track_title, f.artist_name as creator, f.file_exists as exists, f.filepath as path FROM cc_playlistcontents AS pc
((SELECT pc.id as id, pc.type, pc.position, pc.cliplength as length, pc.cuein, pc.cueout, pc.fadein, pc.fadeout,
f.id as item_id, f.track_title, f.artist_name as creator, f.file_exists as exists, f.filepath as path FROM cc_playlistcontents AS pc
JOIN cc_files AS f ON pc.file_id=f.id WHERE pc.playlist_id = {$this->id} AND type = 0)
UNION ALL
(SELECT pc.id as id, pc.type, pc.position, pc.cliplength as length, pc.cuein, pc.cueout, pc.fadein, pc.fadeout,
ws.id as item_id, (ws.name || ': ' || ws.url) as title, sub.login as creator, 't'::boolean as exists, ws.url as path FROM cc_playlistcontents AS pc
JOIN cc_webstream AS ws on pc.stream_id=ws.id
(SELECT pc.id as id, pc.type, pc.position, pc.cliplength as length, pc.cuein, pc.cueout, pc.fadein, pc.fadeout,
ws.id as item_id, (ws.name || ': ' || ws.url) as title, sub.login as creator, 't'::boolean as exists, ws.url as path FROM cc_playlistcontents AS pc
JOIN cc_webstream AS ws on pc.stream_id=ws.id
LEFT JOIN cc_subjs as sub on sub.id = ws.creator_id
WHERE pc.playlist_id = {$this->id} AND pc.type = 1)
UNION ALL
(SELECT pc.id as id, pc.type, pc.position, pc.cliplength as length, pc.cuein, pc.cueout, pc.fadein, pc.fadeout,
bl.id as item_id, bl.name as title, sbj.login as creator, 't'::boolean as exists, NULL::text as path FROM cc_playlistcontents AS pc
JOIN cc_block AS bl on pc.block_id=bl.id
(SELECT pc.id as id, pc.type, pc.position, pc.cliplength as length, pc.cuein, pc.cueout, pc.fadein, pc.fadeout,
bl.id as item_id, bl.name as title, sbj.login as creator, 't'::boolean as exists, NULL::text as path FROM cc_playlistcontents AS pc
JOIN cc_block AS bl on pc.block_id=bl.id
JOIN cc_subjs as sbj ON bl.creator_id=sbj.id WHERE pc.playlist_id = {$this->id} AND pc.type = 2)) as temp
ORDER BY temp.position);
EOT;
@ -343,7 +343,7 @@ EOT;
throw new Exception("Unknown file type");
}
if (isset($obj)) {
if (isset($obj)) {
if (($obj instanceof CcFiles && $obj->getDbFileExists()) || $obj instanceof CcWebstream || $obj instanceof CcBlock) {
$entry = $this->plItem;
$entry["id"] = $obj->getDbId();
@ -559,8 +559,9 @@ EOT;
->filterByDbPosition($pos)
->findOne();
if (!$row) {
return NULL;
}
#Propel returns values in form 00.000000 format which is for only seconds.
$fadeIn = $row->getDbFadein();
$fadeOut = $row->getDbFadeout();
@ -864,7 +865,7 @@ EOT;
}
}
// This function returns that are not owen by $p_user_id among $p_ids
// This function returns that are not owen by $p_user_id among $p_ids
private static function playlistsNotOwnedByUser($p_ids, $p_userId){
$ownedByUser = CcPlaylistQuery::create()->filterByDbCreatorId($p_userId)->find()->getData();
$selectedPls = $p_ids;

View File

@ -23,19 +23,31 @@
<?php endif; ?>
<?php if($this->type == "playlist" || $this->type == "block") : ?>
<div><span>Name:</span><span><?php echo ($this->md["dc:title"]);?></span></div>
<div><span>Creator:</span><span><?php echo ($this->md["dc:creator"]);?></span></div>
<?php if ($this->type == "block" && $this->blType == "Dynamic") { ?>
<div><span>Length:</span><span><?php echo $this->block->getFormattedLength();?></span></div>
<?php } else { ?>
<div><span>Length:</span><span><?php echo ($this->md["dcterms:extent"]);?></span></div>
<div class='file-md-qtip-left'>
<span>Name:</span><span><?php echo ($this->md["dc:title"]);?></span><br />
<span>Creator:</span><span><?php echo ($this->md["dc:creator"]);?></span><br />
<?php if ($this->type == "block" && $this->blType == "Dynamic") { ?>
<span>Length:</span><span><?php echo $this->block->getFormattedLength();?></span><br />
<?php } else { ?>
<span>Length:</span><span><?php echo ($this->md["dcterms:extent"]);?></span><br />
<?php } ?>
<span>Description:</span><span><?php echo ($this->md["dc:description"]);?></span>
</div>
<?php if ($this->type == "playlist") { ?>
<div class='file-md-qtip-legend'>
<span class='webstream'>o</span> <span>Web Stream</span><br />
<span class='dynamic'>o</span> <span>Dynamic Playlist</span><br />
<span class='static'>o</span> <span>Static Playlist</span><br />
<span>o</span> <span>Audio Track</span>
</div>
<?php } ?>
<div><span>Description:</span><span><?php echo ($this->md["dc:description"]);?></span></div>
<?php if ($this->type == "playlist" || ($this->type == "block" && $this->blType == "Static")) {?>
<?php if ($this->type == "playlist") { ?>
<div><span>Playlist Contents: </span></div>
<div class='file-md-qtip-left'><span>Playlist Contents: </span></div>
<?php } else { ?>
<div><span>Static Playlist Contents: </span></div>
<div class='file-md-qtip-left'><span>Static Playlist Contents: </span></div>
<?php } ?>
<table class='library-get-file-md'>
<?php foreach($this->contents as $row) : ?>
@ -52,14 +64,17 @@
<?php if ($row["type"] == 2) {
$bl = new Application_Model_Block($row["item_id"]);
$isStatic = $bl->isStatic(); ?>
<tr class='file-md-qtip-playlist <?php if ($isStatic) echo 'static'; else echo 'dynamic';?>'>
<td colspan="3"><?php if ($isStatic) echo 'Static Playlist'; else echo 'Dynamic Playlist';?></td>
</tr>
<tr class='file-md-qtip-playlist <?php if ($isStatic) echo 'static'; else echo 'dynamic';?>'>
<td class='file-md-qtip-row-width-title file-md-qtip-nowrap'><?php echo $row["track_title"] ?></td>
<td class='file-md-qtip-row-width-artist file-md-qtip-nowrap'><?php echo $row["creator"] ?></td>
<td class='file-md-qtip-row-width-small'><?php echo $bl->getFormattedLength(); ?></td>
</tr>
<?php } else if ($row["type"] == 1) {?>
<tr class='file-md-qtip-playlist webstream'>
<td class='file-md-qtip-row-width-title file-md-qtip-nowrap'><?php echo $row["track_title"] ?></td>
<td class='file-md-qtip-row-width-artist file-md-qtip-nowrap'><?php echo $row["creator"] ?></td>
<td class='file-md-qtip-row-width-small'><?php echo $row["length"] ?></td>
</tr>
<?php } else { ?>
<tr>
<td class='file-md-qtip-row-width-title file-md-qtip-nowrap'><?php echo $row["track_title"] ?></td>
@ -71,7 +86,7 @@
</table>
<?php } elseif ($this->blType == "Dynamic") { ?>
<div><span>Dynamic Playlist Criteria: </span></div>
<div class='file-md-qtip-left'><span>Dynamic Playlist Criteria: </span></div>
<table class='library-get-file-md table-small'>
<?php foreach ($this->contents["crit"] as $criterias) : ?>
<?php foreach ($criterias as $crit ) : ?>
@ -84,13 +99,14 @@
if (strlen($crit["display_name"]) > $critMaxStrLen) {
$crit["display_name"] = substr($crit["display_name"], 0, 12)."...";
}
if (strlen($crit["modifier"]) > $critMaxStrLen) {
$crit["modifier"] = substr($crit["modifier"], 0, 12)."...";
$modMaxStrLen = 16;
if (strlen($crit["modifier"]) > $modMaxStrLen) {
$crit["modifier"] = substr($crit["modifier"], 0, 15)."...";
}
?>
<tr>
<td class='file-md-qtip-criteria-width-crit file-md-qtip-nowrap'><?php echo $crit["display_name"] ?></td>
<td class='file-md-qtip-criteria-width-mod file-md-qtip-nowrap'><?php echo $crit["modifier"] ?></td>
<td class='file-md-qtip-criteria-width-small file-md-qtip-nowrap'><?php echo $crit["display_name"] ?></td>
<td class='file-md-qtip-criteria-width-small file-md-qtip-nowrap'><?php echo $crit["modifier"] ?></td>
<td class='file-md-qtip-criteria-width file-md-qtip-nowrap'><?php echo $crit["value"] ?>
<?php if (isset($crit["extra"])) { ?>
to <?php echo $crit["extra"] ?></td>

View File

@ -1,6 +1,8 @@
<?php
$contents = $this->obj->getContents();
$count = count($contents);
if (isset($this->obj)) {
$contents = $this->obj->getContents();
$count = count($contents);
}
?>
<button id="spl_new" class="ui-button ui-widget ui-state-default" role="button" aria-disabled="false">New</button>
<?php if (isset($this->obj)) : ?>
@ -15,10 +17,10 @@ $count = count($contents);
<input id="obj_lastMod" type="hidden" value="<?php echo $this->obj->getLastModified('U'); ?>"></input>
<input id='obj_type' type='hidden' value='playlist'></input>
<div class="playlist_title">
<h3 id="spl_name">
<h3 id="obj_name">
<a id="playlist_name_display" contenteditable="true"><?php echo $this->obj->getName(); ?></a>
</h3>
<h4 id="spl_length"><?php echo $this->length; ?></h4>
<h4 id="obj_length"><?php echo $this->length; ?></h4>
</div>
<fieldset class="toggle closed" id="fieldset-metadate_change">

View File

@ -1,6 +1,8 @@
<?php
$contents = $this->obj->getContents();
$count = count($contents);
if (isset($this->obj)) {
$contents = $this->obj->getContents();
$count = count($contents);
}
?>
<button id="spl_new" class="ui-button ui-widget ui-state-default" role="button" aria-disabled="false">New</button>
<?php if (isset($this->obj)) : ?>
@ -15,10 +17,10 @@ $count = count($contents);
<input id="obj_lastMod" type="hidden" value="<?php echo $this->obj->getLastModified('U'); ?>"></input>
<input id='obj_type' type='hidden' value='block'></input>
<div class="playlist_title">
<h3 id="bl_name">
<h3 id="obj_name">
<a id="playlist_name_display" contenteditable="true"><?php echo $this->obj->getName(); ?></a>
</h3>
<h4 id="bl_length"><?php echo $this->length; ?></h4>
<h4 id="obj_length"><?php echo $this->length; ?></h4>
</div>
<fieldset class="toggle closed" id="fieldset-metadate_change">

View File

@ -446,11 +446,7 @@ table.library-get-file-md.table-small{
white-space: nowrap;
}
.file-md-qtip-criteria-width-crit{
width:70px;
}
.file-md-qtip-criteria-width-mod{
.file-md-qtip-criteria-width-small{
width:70px;
}
@ -477,13 +473,29 @@ table.library-get-file-md.table-small{
font-style: italic;
}
.file-md-qtip-playlist.dynamic td{
color: #63a2f0;
.file-md-qtip-left{
float: left;
width: 60%;
}
.file-md-qtip-playlist.static td{
.file-md-qtip-legend {
float: right;
width: 30%;
font-size: 9px;
padding: 0px;
vertical-align:top;
line-height: 13px;
}
.static {
color: #f09839;
}
.dynamic {
color: #63a2f0;
}
.webstream {
color: #4eba70;
}
/***** LIBRARY QTIP METADATA SPECIFIC STYLES END *****/

View File

@ -296,7 +296,7 @@ var AIRTIME = (function(AIRTIME){
$('#spl_name > a')
.empty()
.append(json.name);
$('#spl_length')
$('#obj_length')
.empty()
.append(json.length);
$('#fieldset-metadate_change textarea')
@ -379,7 +379,6 @@ var AIRTIME = (function(AIRTIME){
var isStatic = data.isStatic;
delete data.type;
if (isStatic) {
console.log(data);
$.each(data, function(index, ele){
if (ele.track_title !== undefined) {
$html += "<div>"+ele.track_title+" "+ele.creator+" "+ele.length+"</div>";
@ -452,14 +451,26 @@ var AIRTIME = (function(AIRTIME){
playlistError(json);
}
else {
$pl.find("span.spl_main_fade_in")
.empty()
.append(json.fadeIn);
$pl.find("span.spl_main_fade_out")
.empty()
.append(json.fadeOut);
var fadeIn = $pl.find("span.spl_main_fade_in");
var fadeOut = $pl.find("span.spl_main_fade_out");
console.log(json);
if (json.fadeIn == null) {
console.log("fadein is null");
fadeIn.parent().prev().hide();
fadeIn.hide();
} else {
fadeIn.parent().prev().show();
fadeIn.show();
fadeIn.empty().append(json.fadeIn);
}
if (json.fadeOut == null) {
fadeOut.parent().prev().hide();
fadeOut.hide();
} else {
fadeOut.parent().prev().show();
fadeOut.show();
fadeOut.empty().append(json.fadeOut);
}
$pl.find("#crossfade_main").show();
}
});