CC-3174 : showbuilder

testing newly returned times, fixing the secondsToPlaylistTime method
to not drop subsecond precision for the calculations.
This commit is contained in:
Naomi Aro 2012-02-07 14:58:16 +01:00
parent f651024a6e
commit 251f3a3e5b
6 changed files with 45 additions and 38 deletions

View File

@ -38,10 +38,10 @@ class Application_Model_Playlist {
//using propel's phpNames.
private $categories = array(
"dc:title" => "DbName",
"dc:creator" => "DbCreatorId",
"dc:description" => "DbDescription",
"dcterms:extent" => "DbLength"
"dc:title" => "Name",
"dc:creator" => "Creator",
"dc:description" => "Description",
"dcterms:extent" => "Length"
);
@ -115,6 +115,18 @@ class Application_Model_Playlist {
return $this->pl->getDbDescription();
}
public function getCreator() {
return $this->pl->getCcSubjs()->getDbLogin();
}
public function setCreator($p_id) {
$this->pl->setDbCreatorId($p_id);
$this->pl->setDbMtime(new DateTime("now"), new DateTimeZone("UTC"));
$this->pl->save($this->con);
}
public function getLastModified($format = null) {
return $this->pl->getDbMtime($format);
}
@ -143,17 +155,13 @@ class Application_Model_Playlist {
$offset = 0;
foreach ($rows as $row) {
$files[$i] = $row->toArray(BasePeer::TYPE_FIELDNAME, true, true);
// display only upto 1 decimal place by calling secondsToPlaylistTime
$clipSec = Application_Model_Playlist::playlistTimeToSeconds($files[$i]['cliplength']);
//$files[$i]['cliplength'] = Application_Model_Playlist::secondsToPlaylistTime($clipSec);
$offset += $clipSec;
$files[$i]['offset'] = Application_Model_Playlist::secondsToPlaylistTime($offset);
//Propel has been modified to only return SS.uuuuuu, might want this normalize
//feature to instead strip useless zeroes.
//$files[$i]['fadein'] = $this->normalizeFade($files[$i]['fadein']);
//$files[$i]['fadeout'] = $this->normalizeFade($files[$i]['fadeout']);
$i++;
}
@ -184,7 +192,8 @@ class Application_Model_Playlist {
//aggregate column on playlistcontents cliplength column.
public function getLength() {
$this->pl->getDbLength();
return $this->pl->getDbLength();
}
@ -660,7 +669,7 @@ class Application_Model_Playlist {
foreach($categories as $key => $val) {
$method = 'get' . $val;
$md[$key] = $this->pl->$method();
$md[$key] = $this->$method();
}
return $md;
@ -670,7 +679,7 @@ class Application_Model_Playlist {
{
$cat = $this->categories[$category];
$method = 'get' . $cat;
return $this->pl->$method();
return $this->$method();
}
public function setPLMetaData($category, $value)
@ -678,16 +687,14 @@ class Application_Model_Playlist {
$cat = $this->categories[$category];
$method = 'set' . $cat;
$this->pl->$method($value);
$this->pl->save($this->con);
$this->$method($value);
}
/**
- * Convert playlist time value to float seconds
- *
- * @param string $plt
- * playlist time value (HH:mm:ss.dddddd)
- * playlist interval value (HH:mm:ss.dddddd)
- * @return int
- * seconds
- */
@ -709,13 +716,11 @@ class Application_Model_Playlist {
- *
- * @param float $seconds
- * @return string
- * time in playlist time format (HH:mm:ss.d)
- * interval in playlist time format (HH:mm:ss.d)
- */
public static function secondsToPlaylistTime($p_seconds)
{
$seconds = $p_seconds;
$rounded = round($seconds, 1);
$info = explode('.', $rounded);
$info = explode('.', $p_seconds);
$seconds = $info[0];
if(!isset($info[1])){
$milliStr = 0;

View File

@ -627,8 +627,8 @@ class Application_Model_StoredFile {
$row['id'] = intval($row['id']);
$length = new DateTime($row['length']);
$row['length'] = self::formatDuration($length);
//$length = new DateTime($row['length']);
//$row['length'] = self::formatDuration($length);
// add checkbox row
$row['checkbox'] = "<input type='checkbox' name='cb_".$row['id']."'>";

View File

@ -15,7 +15,7 @@ class CcFiles extends BaseCcFiles {
public function getDbLength($format = "H:i:s.u")
{
return parent::getDbCliplength($format);
return parent::getDbLength($format);
}
public function setDbLength($v)

View File

@ -2,7 +2,7 @@ var AIRTIME = (function(AIRTIME){
var mod;
if (AIRTIME.library === undefined) {
AIRTIME.library = {}
AIRTIME.library = {};
}
AIRTIME.library.events = {};
@ -14,7 +14,7 @@ var AIRTIME = (function(AIRTIME){
$nRow.attr("id", aData["tr_id"])
.data("aData", aData)
.data("screen", "playlist");
}
};
mod.fnDrawCallback = function() {
@ -36,7 +36,7 @@ var AIRTIME = (function(AIRTIME){
cursor: 'pointer',
connectToSortable: '#spl_sortable'
});
}
};
/*
* @param oTable the datatables instance for the library.
@ -78,7 +78,7 @@ var AIRTIME = (function(AIRTIME){
["Add", "library_group_add", true, fnAddSelectedItems]];
addToolBarButtonsLibrary(aButtons);
}
};
return AIRTIME;

View File

@ -2,7 +2,7 @@ var AIRTIME = (function(AIRTIME){
var mod;
if (AIRTIME.library === undefined) {
AIRTIME.library = {}
AIRTIME.library = {};
}
AIRTIME.library.events = {};
@ -14,7 +14,7 @@ var AIRTIME = (function(AIRTIME){
$nRow.attr("id", aData["tr_id"])
.data("aData", aData)
.data("screen", "timeline");
}
};
mod.fnDrawCallback = function() {
@ -23,7 +23,7 @@ var AIRTIME = (function(AIRTIME){
cursor: 'pointer',
connectToSortable: '#show_builder_table'
});
}
};
mod.setupLibraryToolbar = function(oLibTable) {
var aButtons,
@ -85,7 +85,7 @@ var AIRTIME = (function(AIRTIME){
["Add", "library_group_add", true, fnAddSelectedItems]];
addToolBarButtonsLibrary(aButtons);
}
};
return AIRTIME;

View File

@ -248,8 +248,10 @@ var AIRTIME = (function(AIRTIME){
}
function redrawLib() {
var dt;
dt = $("#library_display").dataTable();
var dt = $("#library_display").dataTable(),
oLibTT = TableTools.fnGetInstance('library_display');
oLibTT.fnSelectNone();
dt.fnStandingRedraw();
}
@ -525,7 +527,7 @@ var AIRTIME = (function(AIRTIME){
openPlaylist(json);
redrawLib();
});
}
};
mod.fnEdit = function(id) {
var url;
@ -540,7 +542,7 @@ var AIRTIME = (function(AIRTIME){
openPlaylist(json);
//redrawLib();
});
}
};
mod.fnDelete = function(plid) {
var url, id, lastMod;
@ -556,7 +558,7 @@ var AIRTIME = (function(AIRTIME){
openPlaylist(json);
redrawLib();
});
}
};
mod.fnAddItems = function(aItems, iAfter, sAddType) {
@ -599,7 +601,7 @@ var AIRTIME = (function(AIRTIME){
setFadeEvents(playlist);
setUpPlaylist(playlist);
}
};
return AIRTIME;