CC-3174 : showbuilder

fixing some css/js for display.
This commit is contained in:
Naomi Aro 2012-02-01 23:33:20 +01:00
parent f5b2a23eb1
commit 3aab811a3e
11 changed files with 89 additions and 22 deletions

View File

@ -239,7 +239,6 @@ class LibraryController extends Zend_Controller_Action
$params = $this->getRequest()->getParams(); $params = $this->getRequest()->getParams();
$datatables = Application_Model_StoredFile::searchFilesForPlaylistBuilder($params); $datatables = Application_Model_StoredFile::searchFilesForPlaylistBuilder($params);
//format clip lengh to 1 decimal
/* /*
foreach($datatables["aaData"] as &$data){ foreach($datatables["aaData"] as &$data){
if($data['ftype'] == 'audioclip'){ if($data['ftype'] == 'audioclip'){
@ -253,8 +252,6 @@ class LibraryController extends Zend_Controller_Action
$data['track_title'] .= '<span id="'.$data['id'].'" class="small-icon soundcloud"></span>'; $data['track_title'] .= '<span id="'.$data['id'].'" class="small-icon soundcloud"></span>';
} }
} }
$sec = Application_Model_Playlist::playlistTimeToSeconds($data['length']);
$data['length'] = Application_Model_Playlist::secondsToPlaylistTime($sec);
} }
*/ */

View File

@ -33,6 +33,7 @@ class ShowbuilderController extends Zend_Controller_Action
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/showbuilder/builder.js','text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/showbuilder/builder.js','text/javascript');
$this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.ui.timepicker.css'); $this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.ui.timepicker.css');
$this->view->headLink()->appendStylesheet($baseUrl.'/css/showbuilder.css');
$this->_helper->viewRenderer->setResponseSegment('builder'); $this->_helper->viewRenderer->setResponseSegment('builder');
} }

View File

@ -22,7 +22,7 @@
<div class="wrapper"> <div class="wrapper">
<!--Set to z-index 254 to make it lower than the top-panel and the ZFDebug info bar, but higher than the side-playlist--> <!--Set to z-index 254 to make it lower than the top-panel and the ZFDebug info bar, but higher than the side-playlist-->
<div id="library_content" class="tabs ui-widget ui-widget-content block-shadow alpha-block padded" style="z-index:254"><?php echo $this->layout()->library ?></div> <div id="library_content" class="tabs ui-widget ui-widget-content block-shadow alpha-block padded" style="z-index:254"><?php echo $this->layout()->library ?></div>
<div id="show_builder" class="ui-widget ui-widget-content block-shadow omega-block padded"><?php echo $this->layout()->builder ?></div> <div id="show_builder" style="width:600px;" class="ui-widget ui-widget-content block-shadow omega-block padded"><?php echo $this->layout()->builder ?></div>
</div> </div>
</body> </body>
</html> </html>

View File

@ -642,6 +642,34 @@ class Application_Model_StoredFile {
return $res; return $res;
} }
/*
* @param DateInterval $p_interval
*
* @return string $runtime
*/
private static function formatDuration($dt){
$hours = $dt->format("H");
$min = $dt->format("i");
$sec = $dt->format("s");
$time = "PT{$hours}H{$min}M{$sec}S";
$p_interval = new DateInterval($time);
$hours = $p_interval->format("%h");
$mins = $p_interval->format("%i");
if( $hours == 0) {
$runtime = $p_interval->format("%i:%S");
}
else {
$runtime = $p_interval->format("%h:%I:%S");
}
return $runtime;
}
public static function searchFilesForPlaylistBuilder($datatables) public static function searchFilesForPlaylistBuilder($datatables)
{ {
global $CC_CONFIG; global $CC_CONFIG;
@ -691,6 +719,9 @@ class Application_Model_StoredFile {
$row['id'] = intval($row['id']); $row['id'] = intval($row['id']);
$length = new DateTime($row['length']);
$row['length'] = self::formatDuration($length);
// add checkbox row // add checkbox row
$row['checkbox'] = "<input type='checkbox' name='cb_".$row['id']."'>"; $row['checkbox'] = "<input type='checkbox' name='cb_".$row['id']."'>";
@ -701,7 +732,7 @@ class Application_Model_StoredFile {
$type = substr($row['ftype'], 0, 2); $type = substr($row['ftype'], 0, 2);
$row['row_id'] = "{$type}_{$row['id']}"; $row['tr_id'] = "{$type}_{$row['id']}";
//TODO url like this to work on both playlist/showbuilder screens. //TODO url like this to work on both playlist/showbuilder screens.
//datatable stuff really needs to be pulled out and generalized within the project //datatable stuff really needs to be pulled out and generalized within the project

View File

@ -15,6 +15,28 @@
*/ */
class CcSchedule extends BaseCcSchedule { class CcSchedule extends BaseCcSchedule {
public function getDbClipLength($format = 'H:i:s.u')
{
if ($this->clip_length === null) {
return null;
}
try {
$dt = new DateTime($this->clip_length);
} catch (Exception $x) {
throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->clip_length, true), $x);
}
if ($format === null) {
// Because propel.useDateTimeClass is TRUE, we return a DateTime object.
return $dt;
} elseif (strpos($format, '%') !== false) {
return strftime($format, $dt->format('U'));
} else {
return $dt->format($format);
}
}
/** /**
* Get the [optionally formatted] temporal [starts] column value. * Get the [optionally formatted] temporal [starts] column value.
* *

View File

@ -1,8 +1,6 @@
<div style="width:800px" id="show_builder"> <input type="text" id="show_builder_datepicker_start" class="input_text"></input>
<input type="text" id="show_builder_datepicker_start" class="input_text"></input> <input type="text" id="show_builder_timepicker_start" class="input_text"></input>
<input type="text" id="show_builder_timepicker_start" class="input_text"></input> <input type="text" id="show_builder_datepicker_end" class="input_text"></input>
<input type="text" id="show_builder_datepicker_end" class="input_text"></input> <input type="text" id="show_builder_timepicker_end" class="input_text"></input>
<input type="text" id="show_builder_timepicker_end" class="input_text"></input> <input type="button" id="show_builder_timerange_button" class="ui-button ui-state-default" value="GO"></input>
<input type="button" id="show_builder_timerange_button" class="ui-button ui-state-default" value="GO"></input> <table id="show_builder_table" cellpadding="0" cellspacing="0" class="datatable"></table>
<table id="show_builder_table" cellpadding="0" cellspacing="0" class="datatable"></table>
</div>

View File

@ -0,0 +1,5 @@
@CHARSET "UTF-8";
#show_builder > input.input_text {
width:100px;
}

View File

@ -1,15 +1,12 @@
function fnLibraryTableRowCallback( nRow, aData, iDisplayIndex, iDisplayIndexFull ) { function fnLibraryTableRowCallback( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
$(nRow).attr("id", aData["row_id"]); $(nRow).attr("id", aData["tr_id"]);
return nRow; return nRow;
} }
function fnLibraryTableDrawCallback() { function fnLibraryTableDrawCallback() {
addLibraryItemEvents();
addMetadataQtip(); addMetadataQtip();
//saveNumEntriesSetting();
//setupGroupActions();
} }
function addLibraryItemEvents() { function addLibraryItemEvents() {

View File

@ -1,6 +1,6 @@
function fnLibraryTableRowCallback( nRow, aData, iDisplayIndex, iDisplayIndexFull ) { function fnLibraryTableRowCallback( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
$(nRow).attr("id", aData["id"]); $(nRow).attr("id", aData["tr_id"]);
$(nRow).data("show_builder", {"id": aData["id"], "length": aData["length"]}); $(nRow).data("show_builder", {"id": aData["id"], "length": aData["length"]});
@ -15,7 +15,7 @@ function fnLibraryTableDrawCallback() {
function addLibraryItemEvents() { function addLibraryItemEvents() {
$('#library_display tr') $('#library_display tr:not(:first)')
.draggable({ .draggable({
helper: 'clone', helper: 'clone',
cursor: 'pointer', cursor: 'pointer',

View File

@ -318,6 +318,10 @@ function createDataTable(data) {
}, },
"fnRowCallback": fnLibraryTableRowCallback, "fnRowCallback": fnLibraryTableRowCallback,
"fnDrawCallback": fnLibraryTableDrawCallback, "fnDrawCallback": fnLibraryTableDrawCallback,
"fnHeaderCallback": function(nHead) {
$(nHead).find("input[type=checkbox]").attr("checked", false);
},
"aoColumns": [ "aoColumns": [
/* Checkbox */ {"sTitle": "<input type='checkbox' name='pl_cb_all'>", "bSortable": false, "bSearchable": false, "mDataProp": "checkbox", "sWidth": "25px", "sClass": "library_checkbox"}, /* Checkbox */ {"sTitle": "<input type='checkbox' name='pl_cb_all'>", "bSortable": false, "bSearchable": false, "mDataProp": "checkbox", "sWidth": "25px", "sClass": "library_checkbox"},
/* Id */ {"sName": "id", "bSearchable": false, "bVisible": false, "mDataProp": "id", "sClass": "library_id"}, /* Id */ {"sName": "id", "bSearchable": false, "bVisible": false, "mDataProp": "id", "sClass": "library_id"},
@ -327,7 +331,7 @@ function createDataTable(data) {
/* Genre */ {"sTitle": "Genre", "sName": "genre", "mDataProp": "genre", "sWidth": "10%", "sClass": "library_genre"}, /* Genre */ {"sTitle": "Genre", "sName": "genre", "mDataProp": "genre", "sWidth": "10%", "sClass": "library_genre"},
/* Year */ {"sTitle": "Year", "sName": "year", "mDataProp": "year", "sWidth": "8%", "sClass": "library_year"}, /* Year */ {"sTitle": "Year", "sName": "year", "mDataProp": "year", "sWidth": "8%", "sClass": "library_year"},
/* Length */ {"sTitle": "Length", "sName": "length", "mDataProp": "length", "sWidth": "10%", "sClass": "library_length"}, /* Length */ {"sTitle": "Length", "sName": "length", "mDataProp": "length", "sWidth": "10%", "sClass": "library_length"},
/* Type */ {"sTitle": "Type", "sName": "ftype", "bSearchable": false, "mDataProp": "image", "sWidth": "9%", "sClass": "library_type"}, /* Type */ {"sTitle": "", "sName": "ftype", "bSearchable": false, "mDataProp": "image", "sWidth": "25px", "sClass": "library_type"},
/* Upload Time */ {"sTitle": "Upload Time", "sName": "utime", "mDataProp": "utime", "sClass": "library_upload_time"}, /* Upload Time */ {"sTitle": "Upload Time", "sName": "utime", "mDataProp": "utime", "sClass": "library_upload_time"},
/* Last Modified */ {"sTitle": "Last Modified", "sName": "mtime", "bVisible": false, "mDataProp": "mtime", "sClass": "library_modified_time"}, /* Last Modified */ {"sTitle": "Last Modified", "sName": "mtime", "bVisible": false, "mDataProp": "mtime", "sClass": "library_modified_time"},
], ],
@ -340,7 +344,7 @@ function createDataTable(data) {
}, },
"iDisplayLength": getNumEntriesPreference(data), "iDisplayLength": getNumEntriesPreference(data),
// R = ColReorder, C = ColVis, see datatables doc for others // R = ColReorder, C = ColVis, T = TableTools
"sDom": 'Rlfr<"H"T<"library_toolbar"C>>t<"F"ip>', "sDom": 'Rlfr<"H"T<"library_toolbar"C>>t<"F"ip>',
"oTableTools": { "oTableTools": {
@ -374,7 +378,12 @@ function createDataTable(data) {
"aiExclude": [0, 1, 2], "aiExclude": [0, 1, 2],
"sSize": "css", "sSize": "css",
"bShowAll": true "bShowAll": true
},
"oColReorder": {
"iFixedColumns": 1
} }
}); });
oTable.fnSetFilteringDelay(350); oTable.fnSetFilteringDelay(350);

View File

@ -223,11 +223,18 @@ $(document).ready(function() {
"fnServerData": fnServerData, "fnServerData": fnServerData,
"fnRowCallback": fnShowBuilderRowCallback, "fnRowCallback": fnShowBuilderRowCallback,
"fnHeaderCallback": function(nHead) {
$(nHead).find("input[type=checkbox]").attr("checked", false);
},
"oColVis": { "oColVis": {
"aiExclude": [ 0, 1 ] "aiExclude": [ 0, 1 ]
}, },
"oColReorder": {
"iFixedColumns": 1
},
"oTableTools": { "oTableTools": {
"sRowSelect": "multi", "sRowSelect": "multi",
"aButtons": [], "aButtons": [],
@ -312,7 +319,7 @@ $(document).ready(function() {
placeholder: "placeholder show-builder-placeholder", placeholder: "placeholder show-builder-placeholder",
forceHelperSize: true, forceHelperSize: true,
forcePlaceholderSize: true, forcePlaceholderSize: true,
items: 'tr:not(.show-builder-header):not(.show-builder-footer):not(.show-builder-not-allowed):not(.show-builder-empty)', items: 'tr:not(:first):not(.show-builder-header):not(.show-builder-footer):not(.show-builder-not-allowed):not(.show-builder-empty)',
//cancel: ".show-builder-header .show-builder-footer", //cancel: ".show-builder-header .show-builder-footer",
receive: function(event, ui) { receive: function(event, ui) {
var x; var x;