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

@ -1,4 +1,4 @@
var AIRTIME = (function(AIRTIME){
var AIRTIME = (function(AIRTIME) {
var mod,
libraryInit;
@ -58,7 +58,7 @@ var AIRTIME = (function(AIRTIME){
/* Length */ {"sTitle": "Length", "mDataProp": "length", "sClass": "library_length", "sWidth": "80px"},
/* Upload Time */ {"sTitle": "Uploaded", "mDataProp": "utime", "sClass": "library_upload_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"},
/* BPM */ {"sTitle": "BPM", "mDataProp": "bpm", "bSearchable": false, "bVisible": false, "sClass": "library_bpm"},
/* 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),
viewport = findViewportDimensions(),
height = viewport.height * 0.96,
width = viewport.width * 0.96,
fnServer = AIRTIME.showbuilder.fnServerData;
height = Math.floor(viewport.height * 0.96),
width = Math.floor(viewport.width * 0.96),
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({
autoOpen: false,
title: json.title,
width: width,
height: height,
resizable: false,
draggable: false,
modal: true,
close: closeDialog,
buttons: {"Ok": function() {
@ -116,7 +133,7 @@ function buildScheduleDialog (json) {
$("#schedule_calendar").fullCalendar( 'refetchEvents' );
}}
});
//set the start end times so the builder datatables knows its time range.
fnServer.start = json.start;
fnServer.end = json.end;
@ -125,6 +142,13 @@ function buildScheduleDialog (json) {
AIRTIME.showbuilder.builderDataTable();
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){

View file

@ -1,9 +1,21 @@
$(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,
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 = {
dateFormat: 'yy-mm-dd',
onSelect: function(sDate, oDatePicker) {
@ -125,17 +137,17 @@ $(document).ready(function(){
if ($button.hasClass("sb-edit")) {
$lib.show();
$lib.width("45%");
$builder.width("50%");
$lib.width(Math.floor(screenWidth * 0.5));
$builder.width(Math.floor(screenWidth * 0.5));
$button.removeClass("sb-edit");
$button.addClass("sb-finish-edit");
$button.val("Close Library");
}
else if($button.hasClass("sb-finish-edit")) {
else if ($button.hasClass("sb-finish-edit")) {
$lib.hide();
$builder.width("95%");
$builder.width(screenWidth);
$button.removeClass("sb-finish-edit");
$button.addClass("sb-edit");
@ -149,7 +161,8 @@ $(document).ready(function(){
oRange = fnGetScheduleRange();
AIRTIME.showbuilder.fnServerData.start = oRange.start;
AIRTIME.showbuilder.fnServerData.end = oRange.end;
AIRTIME.library.libraryInit();
AIRTIME.showbuilder.builderDataTable();
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 || {}));