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(); $userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new Application_Model_User($userInfo->id); $user = new Application_Model_User($userInfo->id);
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER)); $isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
$this->view->obj = $obj;
if($isAdminOrPM || $obj->getCreatorId() == $userInfo->id){ if($isAdminOrPM || $obj->getCreatorId() == $userInfo->id){
$this->view->obj = $obj;
if($this->obj_sess->type == "block"){ if($this->obj_sess->type == "block"){
$form = new Application_Form_SmartBlockCriteria(); $form = new Application_Form_SmartBlockCriteria();
$form->startForm($this->obj_sess->id); $form->startForm($this->obj_sess->id);
$this->view->form = $form; $this->view->form = $form;
} }
} }
$formatter = new LengthFormatter($obj->getLength()); $formatter = new LengthFormatter($obj->getLength());
$this->view->length = $formatter->format(); $this->view->length = $formatter->format();
$this->view->type = $this->obj_sess->type; $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 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_files AS f ON pc.file_id=f.id
LEFT JOIN cc_block AS bl ON pc.block_id = bl.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; EOT;
$con = Propel::getConnection(); $con = Propel::getConnection();
$rows = $con->query($sql)->fetchAll(); $rows = $con->query($sql)->fetchAll();
@ -882,6 +883,7 @@ EOT;
public function deleteAllFilesFromBlock() public function deleteAllFilesFromBlock()
{ {
CcBlockcontentsQuery::create()->findByDbBlockId($this->id)->delete(); CcBlockcontentsQuery::create()->findByDbBlockId($this->id)->delete();
$this->block->reload();
} }
// smart block functions start // smart block functions start
@ -943,7 +945,7 @@ EOT;
$error[] = "Limit cannot be empty or smaller than 0"; $error[] = "Limit cannot be empty or smaller than 0";
} else { } else {
$mins = $data['etc']['sp_limit_value'] * $multiplier; $mins = $data['etc']['sp_limit_value'] * $multiplier;
if ($mins > 14400) { if ($mins > 1440) {
$error[] = "Limit cannot be more than 24 hrs"; $error[] = "Limit cannot be more than 24 hrs";
} }
} }

View File

@ -172,19 +172,19 @@ class Application_Model_Playlist
*/ */
$sql = <<<"EOT" $sql = <<<"EOT"
(SELECT * FROM (SELECT * FROM
((SELECT pc.id as id, pc.type, pc.position, pc.cliplength as length, pc.cuein, pc.cueout, pc.fadein, pc.fadeout, ((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 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) JOIN cc_files AS f ON pc.file_id=f.id WHERE pc.playlist_id = {$this->id} AND type = 0)
UNION ALL UNION ALL
(SELECT pc.id as id, pc.type, pc.position, pc.cliplength as length, pc.cuein, pc.cueout, pc.fadein, pc.fadeout, (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 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 JOIN cc_webstream AS ws on pc.stream_id=ws.id
LEFT JOIN cc_subjs as sub on sub.id = ws.creator_id LEFT JOIN cc_subjs as sub on sub.id = ws.creator_id
WHERE pc.playlist_id = {$this->id} AND pc.type = 1) WHERE pc.playlist_id = {$this->id} AND pc.type = 1)
UNION ALL UNION ALL
(SELECT pc.id as id, pc.type, pc.position, pc.cliplength as length, pc.cuein, pc.cueout, pc.fadein, pc.fadeout, (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 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_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 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); ORDER BY temp.position);
EOT; EOT;
@ -343,7 +343,7 @@ EOT;
throw new Exception("Unknown file type"); throw new Exception("Unknown file type");
} }
if (isset($obj)) { if (isset($obj)) {
if (($obj instanceof CcFiles && $obj->getDbFileExists()) || $obj instanceof CcWebstream || $obj instanceof CcBlock) { if (($obj instanceof CcFiles && $obj->getDbFileExists()) || $obj instanceof CcWebstream || $obj instanceof CcBlock) {
$entry = $this->plItem; $entry = $this->plItem;
$entry["id"] = $obj->getDbId(); $entry["id"] = $obj->getDbId();
@ -559,8 +559,9 @@ EOT;
->filterByDbPosition($pos) ->filterByDbPosition($pos)
->findOne(); ->findOne();
if (!$row) {
return NULL;
}
#Propel returns values in form 00.000000 format which is for only seconds. #Propel returns values in form 00.000000 format which is for only seconds.
$fadeIn = $row->getDbFadein(); $fadeIn = $row->getDbFadein();
$fadeOut = $row->getDbFadeout(); $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){ private static function playlistsNotOwnedByUser($p_ids, $p_userId){
$ownedByUser = CcPlaylistQuery::create()->filterByDbCreatorId($p_userId)->find()->getData(); $ownedByUser = CcPlaylistQuery::create()->filterByDbCreatorId($p_userId)->find()->getData();
$selectedPls = $p_ids; $selectedPls = $p_ids;

View File

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

View File

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

View File

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

View File

@ -446,11 +446,7 @@ table.library-get-file-md.table-small{
white-space: nowrap; white-space: nowrap;
} }
.file-md-qtip-criteria-width-crit{ .file-md-qtip-criteria-width-small{
width:70px;
}
.file-md-qtip-criteria-width-mod{
width:70px; width:70px;
} }
@ -477,13 +473,29 @@ table.library-get-file-md.table-small{
font-style: italic; font-style: italic;
} }
.file-md-qtip-playlist.dynamic td{ .file-md-qtip-left{
color: #63a2f0; 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; color: #f09839;
} }
.dynamic {
color: #63a2f0;
}
.webstream {
color: #4eba70;
}
/***** LIBRARY QTIP METADATA SPECIFIC STYLES END *****/ /***** LIBRARY QTIP METADATA SPECIFIC STYLES END *****/

View File

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