Merge branch 'CC-3174' into devel

Conflicts:
	airtime_mvc/public/js/airtime/library/library.js
This commit is contained in:
Naomi Aro 2012-03-06 13:51:37 +01:00
commit 157078b963
12 changed files with 150 additions and 30 deletions

View file

@ -29,9 +29,15 @@ class LibraryController extends Zend_Controller_Action
public function indexAction() { public function indexAction() {
global $CC_CONFIG;
$this->_helper->layout->setLayout('library'); $this->_helper->layout->setLayout('library');
$request = $this->getRequest();
$baseUrl = $request->getBaseUrl();
$this->view->headScript()->appendFile($this->view->baseUrl('/js/airtime/library/events/library_playlistbuilder.js'),'text/javascript'); $this->view->headScript()->appendFile($this->view->baseUrl('/js/airtime/library/events/library_playlistbuilder.js'),'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/main_library.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->_helper->actionStack('library', 'library'); $this->_helper->actionStack('library', 'library');
$this->_helper->actionStack('index', 'playlist'); $this->_helper->actionStack('index', 'playlist');
@ -56,8 +62,8 @@ class LibraryController extends Zend_Controller_Action
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.TableTools.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.TableTools.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/utilities/utilities.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/library.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/library.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/main_library.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headLink()->appendStylesheet($baseUrl.'/css/media_library.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'/css/media_library.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']);

View file

@ -23,7 +23,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="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="ui-widget ui-widget-content block-shadow alpha-block padded" style="z-index:254"><?php echo $this->layout()->library ?></div>
<div id="side_playlist" class="ui-widget ui-widget-content block-shadow omega-block"><?php echo $this->layout()->spl ?></div> <div id="side_playlist" class="ui-widget ui-widget-content block-shadow omega-block padded"><?php echo $this->layout()->spl ?></div>
</div> </div>
</body> </body>
</html> </html>

View file

@ -19,6 +19,7 @@ class TimeFilledFormatter {
{ {
$formatted = ""; $formatted = "";
$sign = ($this->_seconds < 0) ? "-" : "+"; $sign = ($this->_seconds < 0) ? "-" : "+";
$perfect = true;
$time = Application_Model_Playlist::secondsToPlaylistTime(abs($this->_seconds)); $time = Application_Model_Playlist::secondsToPlaylistTime(abs($this->_seconds));
Logging::log("time is: ".$time); Logging::log("time is: ".$time);
@ -29,16 +30,24 @@ class TimeFilledFormatter {
if (intval($info[0]) > 0) { if (intval($info[0]) > 0) {
$info[0] = ltrim($info[0], "0"); $info[0] = ltrim($info[0], "0");
$formatted .= " {$info[0]}h"; $formatted .= " {$info[0]}h";
$perfect = false;
} }
if (intval($info[1]) > 0) { if (intval($info[1]) > 0) {
$info[1] = ltrim($info[1], "0"); $info[1] = ltrim($info[1], "0");
$formatted .= " {$info[1]}m"; $formatted .= " {$info[1]}m";
$perfect = false;
} }
if (intval($info[2]) > 0) { if (intval($info[2]) > 0) {
$sec = round($info[2], 0); $sec = round($info[2], 0);
$formatted .= " {$sec}s"; $formatted .= " {$sec}s";
$perfect = false;
}
//0 over/under lap of content.
if ($perfect === true) {
$formatted = "+ 0s";
} }
return $formatted; return $formatted;

View file

@ -1,7 +1,7 @@
#library_content { #library_content {
float: left; float: left;
width: 50%; width: 50%;
min-height: 475px; overflow: auto;
} }
#library_display { #library_display {
@ -10,7 +10,7 @@
} }
#library_display th { #library_display th {
text-align: left; text-align: left;
} }
#library_content #library_display { #library_content #library_display {
@ -80,7 +80,9 @@
text-align: center; text-align: center;
} }
.library_sr, td.library_track,
.library_bitrate { td.library_sr,
text-align: right; td.library_bitrate {
text-align: right;
padding-right: 1em !important;
} }

View file

@ -1,9 +1,7 @@
#side_playlist { #side_playlist {
width: 40%; width: 40%;
min-height: 475px;
padding: 8px;
padding-bottom: 0px;
font-size: 16px; font-size: 16px;
overflow: auto;
} }
#side_playlist, #side_playlist,

View file

@ -2,6 +2,7 @@
#show_builder { #show_builder {
width:95%; width:95%;
overflow: auto;
} }
#show_builder_table th { #show_builder_table th {
@ -47,10 +48,22 @@ tr.cursor-selected-row .marker {
.ui-dialog .wrapper { .ui-dialog .wrapper {
margin: 0; margin: 0;
padding: 10px 0 0 0; padding: 10px 0 0 0;
overflow: hidden;
}
.ui-dialog #library_content {
margin: 0 10px 10px 0;
overflow: auto;
min-height: 0;
} }
.ui-dialog #show_builder { .ui-dialog #show_builder {
width:45%; margin: 0 0 10px 0;
overflow: auto;
}
.ui-dialog .padded {
padding: 5px 10px 5px 8px;
} }
.ui-dialog .ui-buttonset { .ui-dialog .ui-buttonset {

View file

@ -9,7 +9,7 @@ body {
padding: 0; padding: 0;
} }
html, body { html, body {
height: 100%; height: 100%;
} }
#login-page { #login-page {
@ -366,7 +366,7 @@ select {
.wrapper { .wrapper {
margin: 0 20px 0 20px; margin: 0 20px 0 20px;
padding:20px 0 0 0; padding:10px 0 0 0;
} }
.alpha-block { .alpha-block {
@ -577,7 +577,7 @@ dl.inline-list dd {
line-height:22px; line-height:22px;
} }
.dataTables_filter { .dataTables_filter {
margin:8px 0 0 8px; margin:0 0 0 8px;
} }
.dataTables_filter .auto-search { .dataTables_filter .auto-search {
width:55%; width:55%;
@ -623,7 +623,7 @@ dl.inline-list dd {
width: 55%; width: 55%;
border: 1px solid #5B5B5B; border: 1px solid #5B5B5B;
margin-left: -8px; margin-left: -8px;
padding: 4px 3px 4px 25px; padding: 5px 3px 4px 25px;
} }
.dataTables_length select { .dataTables_length select {
background-color: #DDDDDD; background-color: #DDDDDD;

View file

@ -1,4 +1,4 @@
var AIRTIME = (function(AIRTIME){ var AIRTIME = (function(AIRTIME) {
var mod, var mod,
libraryInit; libraryInit;
@ -58,7 +58,7 @@ var AIRTIME = (function(AIRTIME){
/* Length */ {"sTitle": "Length", "mDataProp": "length", "sClass": "library_length", "sWidth": "80px"}, /* Length */ {"sTitle": "Length", "mDataProp": "length", "sClass": "library_length", "sWidth": "80px"},
/* Upload Time */ {"sTitle": "Uploaded", "mDataProp": "utime", "sClass": "library_upload_time"}, /* Upload Time */ {"sTitle": "Uploaded", "mDataProp": "utime", "sClass": "library_upload_time"},
/* Last Modified */ {"sTitle": "Last Modified", "mDataProp": "mtime", "bVisible": false, "sClass": "library_modified_time"}, /* Last Modified */ {"sTitle": "Last Modified", "mDataProp": "mtime", "bVisible": false, "sClass": "library_modified_time"},
/* Track Number */ {"sTitle": "Track", "mDataProp": "track_number", "bSearchable": false, "bVisible": false, "sClass": "library_track"}, /* Track Number */ {"sTitle": "Track", "mDataProp": "track_number", "bSearchable": false, "bVisible": false, "sClass": "library_track", "sWidth": "65px"},
/* Mood */ {"sTitle": "Mood", "mDataProp": "mood", "bSearchable": false, "bVisible": false, "sClass": "library_mood"}, /* Mood */ {"sTitle": "Mood", "mDataProp": "mood", "bSearchable": false, "bVisible": false, "sClass": "library_mood"},
/* BPM */ {"sTitle": "BPM", "mDataProp": "bpm", "bSearchable": false, "bVisible": false, "sClass": "library_bpm"}, /* BPM */ {"sTitle": "BPM", "mDataProp": "bpm", "bSearchable": false, "bVisible": false, "sClass": "library_bpm"},
/* Composer */ {"sTitle": "Composer", "mDataProp": "composer", "bSearchable": false, "bVisible": false, "sClass": "library_composer"}, /* Composer */ {"sTitle": "Composer", "mDataProp": "composer", "bSearchable": false, "bVisible": false, "sClass": "library_composer"},

View file

@ -1 +1,16 @@
$(document).ready(AIRTIME.library.libraryInit); $(document).ready(function() {
var viewport = AIRTIME.utilities.findViewportDimensions(),
lib = $("#library_content"),
pl = $("#side_playlist"),
widgetHeight = viewport.height - 185,
width = Math.floor(viewport.width - 110);
lib.height(widgetHeight)
.width(Math.floor(width * 0.55));
pl.height(widgetHeight)
.width(Math.floor(width * 0.45));
AIRTIME.library.libraryInit();
});

View file

@ -100,15 +100,32 @@ function buildScheduleDialog (json) {
var dialog = $(json.dialog), var dialog = $(json.dialog),
viewport = findViewportDimensions(), viewport = findViewportDimensions(),
height = viewport.height * 0.96, height = Math.floor(viewport.height * 0.96),
width = viewport.width * 0.96, width = Math.floor(viewport.width * 0.96),
fnServer = AIRTIME.showbuilder.fnServerData; fnServer = AIRTIME.showbuilder.fnServerData,
//subtract padding in pixels
widgetWidth = width - 50,
libWidth = Math.floor(widgetWidth * 0.5),
builderWidth = Math.floor(widgetWidth * 0.5),
libLength,
libType,
libFilter;
dialog.find("#library_content")
.height(height - 110)
.width(libWidth);
dialog.find("#show_builder")
.height(height - 110)
.width(builderWidth);
dialog.dialog({ dialog.dialog({
autoOpen: false, autoOpen: false,
title: json.title, title: json.title,
width: width, width: width,
height: height, height: height,
resizable: false,
draggable: false,
modal: true, modal: true,
close: closeDialog, close: closeDialog,
buttons: {"Ok": function() { buttons: {"Ok": function() {
@ -125,6 +142,13 @@ function buildScheduleDialog (json) {
AIRTIME.showbuilder.builderDataTable(); AIRTIME.showbuilder.builderDataTable();
dialog.dialog('open'); dialog.dialog('open');
//calculate dynamically width fo the library search input.
libLength = dialog.find("#library_display_length");
libType = dialog.find("#library_display_type");
libFilter = dialog.find("#library_display_filter");
libFilter.find("input").width(libFilter.width() - libType.width() - libLength.width() - 80);
} }
function buildContentDialog (json){ function buildContentDialog (json){

View file

@ -1,9 +1,21 @@
$(document).ready(function(){ $(document).ready(function(){
var oBaseDatePickerSettings, var viewport = AIRTIME.utilities.findViewportDimensions(),
lib = $("#library_content"),
builder = $("#show_builder"),
widgetHeight = viewport.height - 185,
screenWidth = Math.floor(viewport.width - 110),
oBaseDatePickerSettings,
oBaseTimePickerSettings, oBaseTimePickerSettings,
oRange; oRange;
//set the heights of the main widgets.
lib.height(widgetHeight);
//builder takes all the screen on first load
builder.height(widgetHeight)
.width(screenWidth);
oBaseDatePickerSettings = { oBaseDatePickerSettings = {
dateFormat: 'yy-mm-dd', dateFormat: 'yy-mm-dd',
onSelect: function(sDate, oDatePicker) { onSelect: function(sDate, oDatePicker) {
@ -125,17 +137,17 @@ $(document).ready(function(){
if ($button.hasClass("sb-edit")) { if ($button.hasClass("sb-edit")) {
$lib.show(); $lib.show();
$lib.width("45%"); $lib.width(Math.floor(screenWidth * 0.5));
$builder.width("50%"); $builder.width(Math.floor(screenWidth * 0.5));
$button.removeClass("sb-edit"); $button.removeClass("sb-edit");
$button.addClass("sb-finish-edit"); $button.addClass("sb-finish-edit");
$button.val("Close Library"); $button.val("Close Library");
} }
else if($button.hasClass("sb-finish-edit")) { else if ($button.hasClass("sb-finish-edit")) {
$lib.hide(); $lib.hide();
$builder.width("95%"); $builder.width(screenWidth);
$button.removeClass("sb-finish-edit"); $button.removeClass("sb-finish-edit");
$button.addClass("sb-edit"); $button.addClass("sb-edit");
@ -150,6 +162,7 @@ $(document).ready(function(){
AIRTIME.showbuilder.fnServerData.start = oRange.start; AIRTIME.showbuilder.fnServerData.start = oRange.start;
AIRTIME.showbuilder.fnServerData.end = oRange.end; AIRTIME.showbuilder.fnServerData.end = oRange.end;
AIRTIME.library.libraryInit();
AIRTIME.showbuilder.builderDataTable(); AIRTIME.showbuilder.builderDataTable();
setInterval(function(){ setInterval(function(){

View file

@ -0,0 +1,40 @@
var AIRTIME = (function(AIRTIME){
var mod;
if (AIRTIME.utilities === undefined) {
AIRTIME.utilities = {};
}
mod = AIRTIME.utilities;
mod.findViewportDimensions = function() {
var viewportwidth,
viewportheight;
// the more standards compliant browsers (mozilla/netscape/opera/IE7) use
// window.innerWidth and window.innerHeight
if (typeof window.innerWidth != 'undefined') {
viewportwidth = window.innerWidth, viewportheight = window.innerHeight;
}
// IE6 in standards compliant mode (i.e. with a valid doctype as the first
// line in the document)
else if (typeof document.documentElement != 'undefined'
&& typeof document.documentElement.clientWidth != 'undefined'
&& document.documentElement.clientWidth != 0) {
viewportwidth = document.documentElement.clientWidth;
viewportheight = document.documentElement.clientHeight;
}
// older versions of IE
else {
viewportwidth = document.getElementsByTagName('body')[0].clientWidth;
viewportheight = document.getElementsByTagName('body')[0].clientHeight;
}
return {
width: viewportwidth,
height: viewportheight
};
};
return AIRTIME;
}(AIRTIME || {}));