Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
e6a3877c1e
|
@ -311,6 +311,22 @@ class LibraryController extends Zend_Controller_Action
|
||||||
|
|
||||||
$this->view->md = $md;
|
$this->view->md = $md;
|
||||||
$this->view->contents = $file->getContents();
|
$this->view->contents = $file->getContents();
|
||||||
|
} else if ($type == "block") {
|
||||||
|
$file = new Application_Model_Block($id);
|
||||||
|
$this->view->type = $type;
|
||||||
|
$md = $file->getAllPLMetaData();
|
||||||
|
|
||||||
|
$formatter = new LengthFormatter($md["dcterms:extent"]);
|
||||||
|
$md["dcterms:extent"] = $formatter->format();
|
||||||
|
|
||||||
|
$this->view->md = $md;
|
||||||
|
if ($file->isStatic()) {
|
||||||
|
$this->view->blType = 'Static';
|
||||||
|
$this->view->contents = $file->getContents();
|
||||||
|
} else {
|
||||||
|
$this->view->blType = 'Dynamic';
|
||||||
|
$this->view->contents = $file->getCriteria();
|
||||||
|
}
|
||||||
} else if ($type == "stream") {
|
} else if ($type == "stream") {
|
||||||
$file = new Application_Model_Webstream($id);
|
$file = new Application_Model_Webstream($id);
|
||||||
|
|
||||||
|
|
|
@ -965,59 +965,61 @@ EOT;
|
||||||
}
|
}
|
||||||
}// foreach
|
}// foreach
|
||||||
|
|
||||||
$modKeys = array_keys($data['modrow']);
|
if (isset($data['modrow'])) {
|
||||||
for ($i = 0; $i < count($modKeys); $i++) {
|
$modKeys = array_keys($data['modrow']);
|
||||||
foreach ($data['modrow'][$modKeys[$i]] as $key=>$d){
|
for ($i = 0; $i < count($modKeys); $i++) {
|
||||||
$error = array();
|
foreach ($data['modrow'][$modKeys[$i]] as $key=>$d){
|
||||||
// check for not selected select box
|
$error = array();
|
||||||
if ($d['sp_criteria_field'] == "0" || $d['sp_criteria_modifier'] == "0"){
|
// check for not selected select box
|
||||||
$error[] = "You must select Criteria and Modifier";
|
if ($d['sp_criteria_field'] == "0" || $d['sp_criteria_modifier'] == "0"){
|
||||||
} else {
|
$error[] = "You must select Criteria and Modifier";
|
||||||
$column = CcFilesPeer::getTableMap()->getColumnByPhpName(self::$criteria2PeerMap[$d['sp_criteria_field']]);
|
} else {
|
||||||
// validation on type of column
|
$column = CcFilesPeer::getTableMap()->getColumnByPhpName(self::$criteria2PeerMap[$d['sp_criteria_field']]);
|
||||||
if ($d['sp_criteria_field'] == 'length') {
|
// validation on type of column
|
||||||
if (!preg_match("/(\d{2}):(\d{2}):(\d{2})/", $d['sp_criteria_value'])) {
|
if ($d['sp_criteria_field'] == 'length') {
|
||||||
$error[] = "'Length' should be in '00:00:00' format";
|
if (!preg_match("/(\d{2}):(\d{2}):(\d{2})/", $d['sp_criteria_value'])) {
|
||||||
}
|
$error[] = "'Length' should be in '00:00:00' format";
|
||||||
} else if ($column->getType() == PropelColumnTypes::TIMESTAMP) {
|
}
|
||||||
if (!preg_match("/(\d{4})-(\d{2})-(\d{2})/", $d['sp_criteria_value'])) {
|
} else if ($column->getType() == PropelColumnTypes::TIMESTAMP) {
|
||||||
$error[] = "The value should be in timestamp format(eg. 0000-00-00 or 00-00-00 00:00:00";
|
if (!preg_match("/(\d{4})-(\d{2})-(\d{2})/", $d['sp_criteria_value'])) {
|
||||||
} else if (!Application_Common_DateHelper::checkDateTimeRangeForSQL($d['sp_criteria_value'])) {
|
|
||||||
// check for if it is in valid range( 1753-01-01 ~ 12/31/9999 )
|
|
||||||
$error[] = "$d[sp_criteria_value] is not a valid date/time string";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($d['sp_criteria_extra'])) {
|
|
||||||
if (!preg_match("/(\d{4})-(\d{2})-(\d{2})/", $d['sp_criteria_extra'])) {
|
|
||||||
$error[] = "The value should be in timestamp format(eg. 0000-00-00 or 00-00-00 00:00:00";
|
$error[] = "The value should be in timestamp format(eg. 0000-00-00 or 00-00-00 00:00:00";
|
||||||
} else if (!Application_Common_DateHelper::checkDateTimeRangeForSQL($d['sp_criteria_extra'])) {
|
} else if (!Application_Common_DateHelper::checkDateTimeRangeForSQL($d['sp_criteria_value'])) {
|
||||||
// check for if it is in valid range( 1753-01-01 ~ 12/31/9999 )
|
// check for if it is in valid range( 1753-01-01 ~ 12/31/9999 )
|
||||||
$error[] = "$d[sp_criteria_extra] is not a valid date/time string";
|
$error[] = "$d[sp_criteria_value] is not a valid date/time string";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($d['sp_criteria_extra'])) {
|
||||||
|
if (!preg_match("/(\d{4})-(\d{2})-(\d{2})/", $d['sp_criteria_extra'])) {
|
||||||
|
$error[] = "The value should be in timestamp format(eg. 0000-00-00 or 00-00-00 00:00:00";
|
||||||
|
} else if (!Application_Common_DateHelper::checkDateTimeRangeForSQL($d['sp_criteria_extra'])) {
|
||||||
|
// check for if it is in valid range( 1753-01-01 ~ 12/31/9999 )
|
||||||
|
$error[] = "$d[sp_criteria_extra] is not a valid date/time string";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if ($column->getType() == PropelColumnTypes::INTEGER) {
|
||||||
|
if (!is_numeric($d['sp_criteria_value'])) {
|
||||||
|
$error[] = "The value has to be numeric";
|
||||||
|
}
|
||||||
|
// length check
|
||||||
|
if (intval($d['sp_criteria_value']) >= pow(2,31)) {
|
||||||
|
$error[] = "The value should be less then 2147483648";
|
||||||
|
}
|
||||||
|
} else if ($column->getType() == PropelColumnTypes::VARCHAR) {
|
||||||
|
if (strlen($d['sp_criteria_value']) > $column->getSize()) {
|
||||||
|
$error[] = "The value should be less ".$column->getSize()." characters";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if ($column->getType() == PropelColumnTypes::INTEGER) {
|
|
||||||
if (!is_numeric($d['sp_criteria_value'])) {
|
|
||||||
$error[] = "The value has to be numeric";
|
|
||||||
}
|
|
||||||
// length check
|
|
||||||
if (intval($d['sp_criteria_value']) >= pow(2,31)) {
|
|
||||||
$error[] = "The value should be less then 2147483648";
|
|
||||||
}
|
|
||||||
} else if ($column->getType() == PropelColumnTypes::VARCHAR) {
|
|
||||||
if (strlen($d['sp_criteria_value']) > $column->getSize()) {
|
|
||||||
$error[] = "The value should be less ".$column->getSize()." characters";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if ($d['sp_criteria_value'] == "") {
|
||||||
if ($d['sp_criteria_value'] == "") {
|
$error[] = "Value cannot be empty";
|
||||||
$error[] = "Value cannot be empty";
|
}
|
||||||
}
|
if(count($error) > 0){
|
||||||
if(count($error) > 0){
|
$errors[] = array("element"=>"sp_criteria_field_".$modKeys[$i]."_".$key, "msg"=>$error);
|
||||||
$errors[] = array("element"=>"sp_criteria_field_".$modKeys[$i]."_".$key, "msg"=>$error);
|
}
|
||||||
}
|
}//end mod foreach
|
||||||
}//end mod foreach
|
}//for loop
|
||||||
}//for loop
|
}//if
|
||||||
|
|
||||||
$result = count($errors) > 0 ? 1 :0;
|
$result = count($errors) > 0 ? 1 :0;
|
||||||
$files["count"] = 0;
|
$files["count"] = 0;
|
||||||
|
@ -1060,19 +1062,21 @@ EOT;
|
||||||
}
|
}
|
||||||
|
|
||||||
//insert modifier rows
|
//insert modifier rows
|
||||||
$modKeys = array_keys($p_criteriaData['modrow']);
|
if (isset($p_criteriaData['modrow'])) {
|
||||||
for ($i = 0; $i < count($modKeys); $i++) {
|
$modKeys = array_keys($p_criteriaData['modrow']);
|
||||||
foreach( $p_criteriaData['modrow'][$modKeys[$i]] as $d){
|
for ($i = 0; $i < count($modKeys); $i++) {
|
||||||
$qry = new CcBlockcriteria();
|
foreach( $p_criteriaData['modrow'][$modKeys[$i]] as $d){
|
||||||
$qry->setDbCriteria($d['sp_criteria_field'])
|
$qry = new CcBlockcriteria();
|
||||||
->setDbModifier($d['sp_criteria_modifier'])
|
$qry->setDbCriteria($d['sp_criteria_field'])
|
||||||
->setDbValue($d['sp_criteria_value'])
|
->setDbModifier($d['sp_criteria_modifier'])
|
||||||
->setDbBlockId($this->id);
|
->setDbValue($d['sp_criteria_value'])
|
||||||
|
->setDbBlockId($this->id);
|
||||||
if (isset($d['sp_criteria_extra'])) {
|
|
||||||
$qry->setDbExtra($d['sp_criteria_extra']);
|
if (isset($d['sp_criteria_extra'])) {
|
||||||
|
$qry->setDbExtra($d['sp_criteria_extra']);
|
||||||
|
}
|
||||||
|
$qry->save();
|
||||||
}
|
}
|
||||||
$qry->save();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1264,8 +1268,10 @@ EOT;
|
||||||
*/
|
*/
|
||||||
$tempName = $ele['name'];
|
$tempName = $ele['name'];
|
||||||
preg_match('/^\D*(?=\d)/', $tempName, $r);
|
preg_match('/^\D*(?=\d)/', $tempName, $r);
|
||||||
$critIndexPos = strlen($r[0]);
|
if (isset($r[0])) {
|
||||||
$critIndex = $tempName[$critIndexPos];
|
$critIndexPos = strlen($r[0]);
|
||||||
|
$critIndex = $tempName[$critIndexPos];
|
||||||
|
}
|
||||||
|
|
||||||
$fieldName = substr($ele['name'], 0, $index);
|
$fieldName = substr($ele['name'], 0, $index);
|
||||||
|
|
||||||
|
|
|
@ -21,21 +21,103 @@
|
||||||
|
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php if($this->type == "playlist") : ?>
|
<?php if($this->type == "playlist" || $this->type == "block") : ?>
|
||||||
<div><span>Name:</span><span><?php echo ($this->md["dc:title"]);?></span></div>
|
<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>
|
<div><span>Creator:</span><span><?php echo ($this->md["dc:creator"]);?></span></div>
|
||||||
|
<?php if ($this->type == "block" && $this->blType == "Dynamic") { ?>
|
||||||
|
<?php if ($this->contents["limit"]["modifier"] == "items") { ?>
|
||||||
|
<?php $len = $this->contents["limit"]["value"]." tracks"; ?>
|
||||||
|
<?php } elseif ($this->contents["limit"]["modifier"] == "minutes") { ?>
|
||||||
|
<?php
|
||||||
|
$mins = $this->contents["limit"]["value"];
|
||||||
|
if ($mins > 59) {
|
||||||
|
$hours = intval($mins / 60);
|
||||||
|
$minutes = $mins % 60;
|
||||||
|
$len = $hours.":".str_pad($minutes, 2, "0", STR_PAD_LEFT).":00.0";
|
||||||
|
} else {
|
||||||
|
$len = $this->contents["limit"]["value"].":00.0";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<?php } else {?>
|
||||||
|
<?php $len = $this->contents["limit"]["value"].":00:00.0"; ?>
|
||||||
|
<?php } ?>
|
||||||
|
<div><span>Length:</span><span><?php echo $len;?></span></div>
|
||||||
|
<?php } else { ?>
|
||||||
<div><span>Length:</span><span><?php echo ($this->md["dcterms:extent"]);?></span></div>
|
<div><span>Length:</span><span><?php echo ($this->md["dcterms:extent"]);?></span></div>
|
||||||
|
<?php } ?>
|
||||||
<div><span>Description:</span><span><?php echo ($this->md["dc:description"]);?></span></div>
|
<div><span>Description:</span><span><?php echo ($this->md["dc:description"]);?></span></div>
|
||||||
<div><span>Contents: </span>
|
<?php if ($this->type == "playlist" || ($this->type == "block" && $this->blType == "Static")) {?>
|
||||||
<?php foreach($this->contents as $row) : ?>
|
<?php if ($this->type == "playlist") { ?>
|
||||||
<div>
|
<div><span>Playlist Contents: </span></div>
|
||||||
<span><?php echo $row["track_title"] ?></span>
|
<?php } else { ?>
|
||||||
<span><?php echo $row["creator"] ?></span>
|
<div><span>Static Playlist Contents: </span></div>
|
||||||
<span><?php echo $row["album_title"] ?></span>
|
<?php } ?>
|
||||||
<span><?php echo $row["length"] ?></span>
|
<table class='library-get-file-md'>
|
||||||
</div>
|
<?php foreach($this->contents as $row) : ?>
|
||||||
<?php endforeach; ?>
|
<?php
|
||||||
</div>
|
$titleMaxStrLen = 35;
|
||||||
|
if (strlen($row["track_title"]) > $titleMaxStrLen) {
|
||||||
|
$row["track_title"] = substr($row["track_title"], 0, 34)."...";
|
||||||
|
}
|
||||||
|
$artistMaxStrLen = 22;
|
||||||
|
if (strlen($row["creator"]) > $artistMaxStrLen) {
|
||||||
|
$row["creator"] = substr($row["creator"], 0, 21)."...";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<?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'><?php echo $row["track_title"] ?></td>
|
||||||
|
<td class='file-md-qtip-row-width-artist'><?php echo $row["creator"] ?></td>
|
||||||
|
<?php if (!$isStatic) { ?>
|
||||||
|
<?php $criteria = $bl->getCriteria();?>
|
||||||
|
<?php $len = $bl->getLength();?>
|
||||||
|
<td class='file-md-qtip-row-width-small'><?php echo $len ?></td>
|
||||||
|
<?php } else { ?>
|
||||||
|
<td class='file-md-qtip-row-width-small'><?php echo $row["length"] ?></td>
|
||||||
|
<?php } ?>
|
||||||
|
</tr>
|
||||||
|
<?php } else { ?>
|
||||||
|
<tr>
|
||||||
|
<td class='file-md-qtip-row-width-title'><?php echo $row["track_title"] ?></td>
|
||||||
|
<td class='file-md-qtip-row-width-artist'><?php echo $row["creator"] ?></td>
|
||||||
|
<td class='file-md-qtip-row-width-small'><?php echo $row["length"] ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<?php } elseif ($this->blType == "Dynamic") { ?>
|
||||||
|
<div><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 ) : ?>
|
||||||
|
<?php
|
||||||
|
$maxStrLen = 25;
|
||||||
|
if (strlen($crit["value"]) > $maxStrLen) {
|
||||||
|
$crit["value"] = substr($crit["value"], 0, 24)."...";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td class='file-md-qtip-criteria-width-small'><?php echo $crit["display_name"] ?></td>
|
||||||
|
<td class='file-md-qtip-criteria-width-small'><?php echo $crit["modifier"] ?></td>
|
||||||
|
<td class='file-md-qtip-criteria-width'><?php echo $crit["value"] ?>
|
||||||
|
<?php if (isset($crit["extra"])) { ?>
|
||||||
|
to <?php echo $crit["extra"] ?></td>
|
||||||
|
<?php } ?>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<tr>
|
||||||
|
<td>Limit to </td>
|
||||||
|
<td><?php echo $this->contents["limit"]["value"] ?> <?php echo $this->contents["limit"]["modifier"] ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</table>
|
||||||
|
<?php } ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php if ($this->type == "stream") : ?>
|
<?php if ($this->type == "stream") : ?>
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -417,6 +417,66 @@ input[type="text"]:focus, input[type="password"]:focus, textarea:focus, .input_t
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***** LIBRARY QTIP METADATA SPECIFIC STYLES BEGIN *****/
|
||||||
|
.ui-tooltip-dark.file-md-long{
|
||||||
|
max-width: 415px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.library-get-file-md tr td{
|
||||||
|
font-size:10px;
|
||||||
|
padding: 0px;
|
||||||
|
vertical-align:top;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.library-get-file-md{
|
||||||
|
margin-left:15px;
|
||||||
|
margin-right:15px;
|
||||||
|
width:350px;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.library-get-file-md.table-small{
|
||||||
|
width:290px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-md-qtip-criteria-width-small{
|
||||||
|
width:80px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-md-qtip-criteria-width{
|
||||||
|
width:120px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-md-qtip-row-width-title{
|
||||||
|
width:170px;
|
||||||
|
padding-right:5px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-md-qtip-row-width-artist{
|
||||||
|
width:110px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-md-qtip-row-width-small{
|
||||||
|
width:40x;
|
||||||
|
text-align:right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-md-qtip-playlist td{
|
||||||
|
font-weight: bold;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-md-qtip-playlist.dynamic td{
|
||||||
|
color: #63a2f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-md-qtip-playlist.static td{
|
||||||
|
color: #f09839;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***** LIBRARY QTIP METADATA SPECIFIC STYLES END *****/
|
||||||
|
|
||||||
|
|
||||||
/***** SMART PLAYLIST SPECIFIC STYLES BEGIN *****/
|
/***** SMART PLAYLIST SPECIFIC STYLES BEGIN *****/
|
||||||
.sp-invisible{
|
.sp-invisible{
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
|
|
|
@ -484,7 +484,7 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
effect: false // Disable positioning animation
|
effect: false // Disable positioning animation
|
||||||
},
|
},
|
||||||
style: {
|
style: {
|
||||||
classes: "ui-tooltip-dark"
|
classes: "ui-tooltip-dark file-md-long"
|
||||||
},
|
},
|
||||||
show: 'mousedown',
|
show: 'mousedown',
|
||||||
events: {
|
events: {
|
||||||
|
@ -495,7 +495,7 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
hide: 'mouseout'
|
hide: {event:'mouseout', delay: 50, fixed:true}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
//remove any selected nodes before the draw.
|
//remove any selected nodes before the draw.
|
||||||
|
|
|
@ -429,7 +429,8 @@ function getCriteriaOptionType(e) {
|
||||||
|
|
||||||
function callback(data, type) {
|
function callback(data, type) {
|
||||||
var form = $('#smart-playlist-form'),
|
var form = $('#smart-playlist-form'),
|
||||||
json = $.parseJSON(data);
|
json = $.parseJSON(data),
|
||||||
|
dt = $('table[id="library_display"]').dataTable();
|
||||||
|
|
||||||
form.find('span[class="errors sp-errors"]').remove();
|
form.find('span[class="errors sp-errors"]').remove();
|
||||||
|
|
||||||
|
@ -449,7 +450,6 @@ function callback(data, type) {
|
||||||
} else if (type == 'generate') {
|
} else if (type == 'generate') {
|
||||||
form.find('.success').text('Smart playlist generated and saved');
|
form.find('.success').text('Smart playlist generated and saved');
|
||||||
//redraw library table so the length gets updated
|
//redraw library table so the length gets updated
|
||||||
var dt = $('table[id="library_display"]').dataTable();
|
|
||||||
dt.fnStandingRedraw();
|
dt.fnStandingRedraw();
|
||||||
}
|
}
|
||||||
form.find('.success').show();
|
form.find('.success').show();
|
||||||
|
@ -457,6 +457,8 @@ function callback(data, type) {
|
||||||
} else {
|
} else {
|
||||||
form.find('.success').text('Criteria saved');
|
form.find('.success').text('Criteria saved');
|
||||||
form.find('.success').show();
|
form.find('.success').show();
|
||||||
|
//redraw library table incase block changed from static to dynamic or vice versa
|
||||||
|
dt.fnStandingRedraw();
|
||||||
|
|
||||||
/* Update number of files that meet criteria and change icon to success/warning
|
/* Update number of files that meet criteria and change icon to success/warning
|
||||||
* as appropriate. This is also done in the form but we do not pass the form
|
* as appropriate. This is also done in the form but we do not pass the form
|
||||||
|
|
Loading…
Reference in New Issue