Merge branch 'master' of dev.sourcefabric.org:campcaster

This commit is contained in:
mkonecny 2011-02-01 20:29:03 -05:00
commit 4f055788d4
14 changed files with 111 additions and 483 deletions

View file

@ -13,8 +13,7 @@ class LibraryController extends Zend_Controller_Action
}
$ajaxContext = $this->_helper->getHelper('AjaxContext');
$ajaxContext->addActionContext('contents', 'html')
->addActionContext('contents', 'json')
$ajaxContext->addActionContext('contents', 'json')
->addActionContext('delete', 'json')
->addActionContext('context-menu', 'json')
->initContext();
@ -28,16 +27,16 @@ class LibraryController extends Zend_Controller_Action
$this->view->headScript()->appendFile('/js/airtime/onready/library.js','text/javascript');
$this->view->headScript()->appendFile('/js/contextmenu/jjmenu.js','text/javascript');
$this->view->headScript()->appendFile('/js/jplayer/jquery.jplayer.min.js');
$this->view->headScript()->appendFile('/js/datatables/js/jquery.dataTables.js','text/javascript');
$this->view->headScript()->appendFile('/js/airtime/library/library.js','text/javascript');
$this->view->headLink()->appendStylesheet('/css/media_library.css');
$this->view->headLink()->appendStylesheet('/css/contextmenu.css');
$this->_helper->layout->setLayout('library');
unset($this->search_sess->page);
unset($this->search_sess->md);
$this->_helper->viewRenderer->setResponseSegment('library');
$this->_helper->actionStack('index', 'playlist');
$this->_helper->actionStack('contents', 'library');
}
public function contextMenuAction()
@ -118,23 +117,10 @@ class LibraryController extends Zend_Controller_Action
public function contentsAction()
{
$this->view->headScript()->appendFile('/js/datatables/js/jquery.dataTables.js','text/javascript');
$this->view->headScript()->appendFile('/js/airtime/library/library.js','text/javascript');
$post = $this->getRequest()->getPost();
$datatables = StoredFile::searchFilesForPlaylistBuilder($post);
$this->view->headLink()->appendStylesheet('/css/media_library.css');
$this->_helper->viewRenderer->setResponseSegment('library');
$format = $this->_getParam('format');
$post = $this->getRequest()->getPost();
if($format == "json") {
$datatables = StoredFile::searchFilesForPlaylistBuilder($post);
die(json_encode($datatables));
}
die(json_encode($datatables));
}
public function editFileMdAction()

View file

@ -14,6 +14,7 @@ class ScheduleController extends Zend_Controller_Action
$ajaxContext = $this->_helper->getHelper('AjaxContext');
$ajaxContext->addActionContext('event-feed', 'json')
->addActionContext('make-context-menu', 'json')
->addActionContext('add-show-dialog', 'json')
->addActionContext('add-show', 'json')
->addActionContext('move-show', 'json')
@ -33,24 +34,13 @@ class ScheduleController extends Zend_Controller_Action
public function indexAction()
{
$this->view->headScript()->appendFile('/js/fullcalendar/fullcalendar.min.js','text/javascript');
$this->view->headScript()->appendFile('/js/contextmenu/jquery.contextMenu.js','text/javascript');
$this->view->headScript()->appendFile('/js/contextmenu/jjmenu.js','text/javascript');
$this->view->headScript()->appendFile('/js/datatables/js/jquery.dataTables.js','text/javascript');
$this->view->headScript()->appendFile('/js/airtime/schedule/full-calendar-functions.js','text/javascript');
$this->view->headScript()->appendFile('/js/airtime/schedule/schedule.js','text/javascript');
$this->view->headLink()->appendStylesheet('/css/jquery.contextMenu.css');
$this->view->headLink()->appendStylesheet('/css/contextmenu.css');
$this->view->headLink()->appendStylesheet('/css/fullcalendar.css');
$eventDefaultMenu = array();
//$eventDefaultMenu[] = array('action' => '/Schedule/delete-show', 'text' => 'Delete');
$this->view->eventDefaultMenu = $eventDefaultMenu;
$eventHostMenu[] = array('action' => '/Schedule/delete-show', 'text' => 'Delete');
$eventHostMenu[] = array('action' => '/Schedule/schedule-show', 'text' => 'Schedule');
$eventHostMenu[] = array('action' => '/Schedule/clear-show', 'text' => 'Clear');
$this->view->eventHostMenu = $eventHostMenu;
}
public function eventFeedAction()
@ -175,19 +165,42 @@ class ScheduleController extends Zend_Controller_Action
public function deleteShowAction()
{
$showId = $this->_getParam('showId');
$date = $this->_getParam('date');
$showId = $this->_getParam('id');
$start_timestamp = $this->_getParam('start');
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new User($userInfo->id, $userInfo->type);
$show = new Show($user, $showId);
$show->deleteShow($date);
$show->deleteShow($start_timestamp);
}
public function makeContextMenuAction()
{
// action body
$id = $this->_getParam('id');
$start_timestamp = $this->_getParam('start');
$today_timestamp = date("Y-m-d H:i:s");
$params = '/format/json/id/#id#/start/#start#/end/#end#';
if(strtotime($today_timestamp) < strtotime($start_timestamp)) {
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/delete-show'.$params, 'callback' => 'window["scheduleRefetchEvents"]'),
'title' => 'Delete');
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/clear-show'.$params, 'callback' => 'window["scheduleRefetchEvents"]'),
'title' => 'Clear');
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/schedule-show-dialog'.$params, 'callback' => 'window["buildScheduleDialog"]'),
'title' => 'Schedule');
}
else {
}
//returns format jjmenu is looking for.
die(json_encode($menu));
}
public function scheduleShowAction()
@ -221,7 +234,7 @@ class ScheduleController extends Zend_Controller_Action
public function clearShowAction()
{
$start = $this->_getParam('start');
$showId = $this->_getParam('showId');
$showId = $this->_getParam('id');
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new User($userInfo->id, $userInfo->type);
@ -278,7 +291,7 @@ class ScheduleController extends Zend_Controller_Action
{
$start_timestamp = $this->_getParam('start');
$end_timestamp = $this->_getParam('end');
$showId = $this->_getParam('showId');
$showId = $this->_getParam('id');
$this->sched_sess->showId = $showId;
$this->sched_sess->showStart = $start_timestamp;

View file

@ -88,7 +88,7 @@ class Show {
$start = $data['add_show_start_date'];
}
if(strtotime($start) < strtotime($endDate)) {
if(strtotime($start) < strtotime($endDate) || is_null($endDate)) {
$showDay = new CcShowDays();
$showDay->setDbFirstShow($start);
@ -584,7 +584,7 @@ class Show {
$shows[] = $this->makeFullCalendarEvent($row, $repeatDate);
}
//case for non-ending shows.
else if(is_null($show_end_epoch) && $repeat_epoch < $end_epoch) {
else if(!isset($show_end_epoch) && $repeat_epoch < $end_epoch) {
$shows[] = $this->makeFullCalendarEvent($row, $repeatDate);
}
else {

View file

@ -1,23 +0,0 @@
<ul>
<li><a href="#simpleSearch">Search</a></li>
<li><a href="#advancedSearch">Advanced Search</a></li>
</ul>
<div id="simpleSearch">
<table id="library_display" cellpadding="0" cellspacing="0" class="datatable">
<thead>
<tr>
<th>Id</th>
<th>Title</th>
<th>Creator</th>
<th>Album</th>
<th>Track</th>
<th>Length</th>
<th>Type</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
<div id="advancedSearch">
Some Text
</div>

View file

@ -0,0 +1,23 @@
<ul>
<li><a href="#simpleSearch">Search</a></li>
<li><a href="#advancedSearch">Advanced Search</a></li>
</ul>
<div id="simpleSearch">
<table id="library_display" cellpadding="0" cellspacing="0" class="datatable">
<thead>
<tr>
<th>Id</th>
<th>Title</th>
<th>Creator</th>
<th>Album</th>
<th>Track</th>
<th>Length</th>
<th>Type</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
<div id="advancedSearch">
Some Text
</div>

View file

@ -1,8 +1 @@
<div id='schedule_calendar' class="ui-widget-content block-shadow padded"></div>
<ul id="schedule_event_default_menu" class="contextMenu">
<?php echo $this->partialLoop('library/contextMenuPartial.phtml', $this->eventDefaultMenu) ?>
</ul>
<ul id="schedule_event_host_menu" class="contextMenu">
<?php echo $this->partialLoop('library/contextMenuPartial.phtml', $this->eventHostMenu) ?>
</ul>

View file

@ -5,6 +5,7 @@ div.jjmenu {
border-bottom:2px solid gray;
border-right:1px solid gray;
padding:0px;
z-index: 100;
}
div.jj_menu_item {

View file

@ -1,62 +0,0 @@
/* Generic context menu styles */
.contextMenu {
position: absolute;
width: 120px;
z-index: 99999;
border: solid 1px #CCC;
background: #EEE;
padding: 0px;
margin: 0px;
display: none;
}
.contextMenu LI {
list-style: none;
padding: 0px;
margin: 0px;
}
.contextMenu A {
color: #333;
text-decoration: none;
display: block;
line-height: 20px;
height: 20px;
background-position: 6px center;
background-repeat: no-repeat;
outline: none;
padding: 1px 5px;
padding-left: 28px;
}
.contextMenu LI.hover A {
color: #FFF;
background-color: #3399FF;
}
.contextMenu LI.disabled A {
color: #AAA;
cursor: default;
}
.contextMenu LI.hover.disabled A {
background-color: transparent;
}
.contextMenu LI.separator {
border-top: solid 1px #CCC;
}
/*
Adding Icons
You can add icons to the context menu by adding
classes to the respective LI element(s)
*/
.contextMenu LI.edit A { background-image: url(images/page_white_edit.png); }
.contextMenu LI.cut A { background-image: url(images/cut.png); }
.contextMenu LI.copy A { background-image: url(images/page_white_copy.png); }
.contextMenu LI.paste A { background-image: url(images/page_white_paste.png); }
.contextMenu LI.delete A { background-image: url(images/page_white_delete.png); }
.contextMenu LI.quit A { background-image: url(images/door.png); }

View file

@ -1,33 +0,0 @@
/*
function contextMenu(action, el, pos) {
var method = action.split('/').pop(),
url, tr_id, id;
tr_id = $(el).attr('id');
id = tr_id.split("_").pop();
url = '/'+action;
if (method === 'delete') {
url = url + '/format/json';
url = url + '/id/' + id;
$.post(url, function(json) {
if(json.message) {
alert(json.message);
return;
}
$("#library_display tr#" +tr_id).remove();
});
}
else if (method === 'add-item') {
url = url + '/format/json';
url = url + '/id/' + id;
$.post(url, setSPLContent);
}
}
*/
function contextMenu() {
alert("callback");
}

View file

@ -1,28 +0,0 @@
function setUpQuickSearch() {
$("#library_quick_search input").keyup(function(ev){
var url, string;
//alert(x);
url = "/Library/quick-search/format/json";
string = $(this).val();
$.post(url, {search: string}, function(json){
var html, data;
//hacky way until I can figure out paginator better.
html = json.html.replace(/quick-search\/format\/json/g, "index");
var el = $(html);
data = el.find("tr:not(:first-child)");
setLibraryContents(data);
var lib = $("#library_content");
lib.find("div.paginationControl").remove();
lib.append(el[2]);
});
});
}

View file

@ -120,7 +120,11 @@ $(document).ready(function() {
defaultView: 'agendaDay',
editable: false,
allDaySlot: false,
lazyFetching: false,
axisFormat: 'H:mm',
timeFormat: {
agenda: 'H:mm{ - H:mm}',
month: 'H:mm{ - H:mm}'
},
events: getFullCalendarEvents,

View file

@ -59,20 +59,22 @@ function eventRender(event, element, view) {
}
function eventAfterRender( event, element, view ) {
var today = new Date();
if(event.isHost === true && event.start > today) {
$(element).contextMenu(
{menu: 'schedule_event_host_menu'}, eventMenu
);
}
else{
$(element).contextMenu(
{menu: 'schedule_event_default_menu'}, eventMenu
);
}
function getStartTS() {
var start = makeTimeStamp(event.start);
return start;
}
$(element).data({'event': event});
function getEndTS() {
var start = makeTimeStamp(event.end);
return start;
}
$(element)
.jjmenu("rightClick",
[{get:"/Schedule/make-context-menu/format/json/id/#id#/start/#start#/end/#end#"}],
{id: event.id, start: getStartTS, end: getEndTS},
{xposition: "mouse", yposition: "mouse"});
}
function eventClick(event, jsEvent, view) {

View file

@ -165,69 +165,29 @@ function makeScheduleDialog(dialog, json) {
setScheduleDialogEvents(dialog);
}
function openScheduleDialog(show) {
var url, start_date, end_date;
function buildScheduleDialog(json){
var dialog = $(json.dialog);
url = '/Schedule/schedule-show-dialog/format/json';
start_date = makeTimeStamp(show.start);
end_date = makeTimeStamp(show.end);
makeScheduleDialog(dialog, json);
$.post(url,
{start: start_date, end: end_date, showId: show.id},
function(json){
var dialog = $(json.dialog);
dialog.dialog({
autoOpen: false,
title: 'Schedule Playlist',
width: 1100,
height: 500,
modal: true,
close: closeDialog,
buttons: {"Ok": function() {
dialog.remove();
$("#schedule_calendar").fullCalendar( 'refetchEvents' );
}}
});
makeScheduleDialog(dialog, json, show);
dialog.dialog({
autoOpen: false,
title: 'Schedule Playlist',
width: 1100,
height: 500,
modal: true,
close: closeDialog,
buttons: {"Ok": function() {
dialog.remove();
$("#schedule_calendar").fullCalendar( 'refetchEvents' );
}}
});
dialog.dialog('open');
});
dialog.dialog('open');
}
function eventMenu(action, el, pos) {
var method, event, start_timestamp, url;
method = action.split('/').pop();
event = $(el).data('event');
start_timestamp = makeTimeStamp(event.start);
if (method === 'delete-show') {
url = '/Schedule/delete-show';
$.post(action,
{format: "json", showId: event.id, date: start_timestamp},
function(json){
$("#schedule_calendar").fullCalendar( 'refetchEvents' );
});
}
else if (method === 'schedule-show') {
openScheduleDialog(event);
}
else if (method === 'clear-show') {
url = '/Schedule/clear-show';
$.post(url,
{format: "json", start: start_timestamp, showId: event.id},
function(json){
$("#schedule_calendar").fullCalendar( 'refetchEvents' );
});
}
function scheduleRefetchEvents() {
$("#schedule_calendar").fullCalendar( 'refetchEvents' );
}
$(document).ready(function() {
@ -241,10 +201,15 @@ $(document).ready(function() {
defaultView: 'agendaDay',
editable: false,
allDaySlot: false,
axisFormat: 'H:mm',
timeFormat: {
agenda: 'H:mm{ - H:mm}',
month: 'H:mm{ - H:mm}'
},
events: getFullCalendarEvents,
//callbacks (from full-calendar-functions.js
//callbacks (in full-calendar-functions.js)
dayClick: dayClick,
eventRender: eventRender,
eventAfterRender: eventAfterRender,
@ -253,9 +218,7 @@ $(document).ready(function() {
eventMouseout: eventMouseout,
eventDrop: eventDrop,
eventResize: eventResize
});
});
$(window).load(function() {

View file

@ -1,211 +0,0 @@
// jQuery Context Menu Plugin
//
// Version 1.01
//
// Cory S.N. LaViska
// A Beautiful Site (http://abeautifulsite.net/)
//
// More info: http://abeautifulsite.net/2008/09/jquery-context-menu-plugin/
//
// Terms of Use
//
// This plugin is dual-licensed under the GNU General Public License
// and the MIT License and is copyright A Beautiful Site, LLC.
//
if(jQuery)( function() {
$.extend($.fn, {
contextMenu: function(o, callback) {
// Defaults
if( o.menu == undefined ) return false;
if( o.inSpeed == undefined ) o.inSpeed = 150;
if( o.outSpeed == undefined ) o.outSpeed = 75;
// 0 needs to be -1 for expected results (no fade)
if( o.inSpeed == 0 ) o.inSpeed = -1;
if( o.outSpeed == 0 ) o.outSpeed = -1;
// Loop each context menu
$(this).each( function() {
var el = $(this);
var offset = $(el).offset();
// Add contextMenu class
$('#' + o.menu).addClass('contextMenu');
// Simulate a true right click
$(this).mousedown( function(e) {
var evt = e;
evt.stopPropagation();
$(this).mouseup( function(e) {
e.stopPropagation();
var srcElement = $(this);
$(this).unbind('mouseup');
if( evt.button == 2 ) {
// Hide context menus that may be showing
$(".contextMenu").hide();
// Get this context menu
var menu = $('#' + o.menu);
if( $(el).hasClass('disabled') ) return false;
// Detect mouse position
var d = {}, x, y;
if( self.innerHeight ) {
d.pageYOffset = self.pageYOffset;
d.pageXOffset = self.pageXOffset;
d.innerHeight = self.innerHeight;
d.innerWidth = self.innerWidth;
} else if( document.documentElement &&
document.documentElement.clientHeight ) {
d.pageYOffset = document.documentElement.scrollTop;
d.pageXOffset = document.documentElement.scrollLeft;
d.innerHeight = document.documentElement.clientHeight;
d.innerWidth = document.documentElement.clientWidth;
} else if( document.body ) {
d.pageYOffset = document.body.scrollTop;
d.pageXOffset = document.body.scrollLeft;
d.innerHeight = document.body.clientHeight;
d.innerWidth = document.body.clientWidth;
}
(e.pageX) ? x = e.pageX : x = e.clientX + d.scrollLeft;
(e.pageY) ? y = e.pageY : y = e.clientY + d.scrollTop;
// Show the menu
$(document).unbind('click');
$(menu).css({ top: y, left: x }).fadeIn(o.inSpeed);
// Hover events
$(menu).find('A').mouseover( function() {
$(menu).find('LI.hover').removeClass('hover');
$(this).parent().addClass('hover');
}).mouseout( function() {
$(menu).find('LI.hover').removeClass('hover');
});
// Keyboard
$(document).keypress( function(e) {
switch( e.keyCode ) {
case 38: // up
if( $(menu).find('LI.hover').size() == 0 ) {
$(menu).find('LI:last').addClass('hover');
} else {
$(menu).find('LI.hover').removeClass('hover').prevAll('LI:not(.disabled)').eq(0).addClass('hover');
if( $(menu).find('LI.hover').size() == 0 ) $(menu).find('LI:last').addClass('hover');
}
break;
case 40: // down
if( $(menu).find('LI.hover').size() == 0 ) {
$(menu).find('LI:first').addClass('hover');
} else {
$(menu).find('LI.hover').removeClass('hover').nextAll('LI:not(.disabled)').eq(0).addClass('hover');
if( $(menu).find('LI.hover').size() == 0 ) $(menu).find('LI:first').addClass('hover');
}
break;
case 13: // enter
$(menu).find('LI.hover A').trigger('click');
break;
case 27: // esc
$(document).trigger('click');
break
}
});
// When items are selected
$('#' + o.menu).find('A').unbind('click');
$('#' + o.menu).find('LI:not(.disabled) A').click( function() {
$(document).unbind('click').unbind('keypress');
$(".contextMenu").hide();
// Callback
if( callback ) callback( $(this).attr('href').substr(1), $(srcElement), {x: x - offset.left, y: y - offset.top, docX: x, docY: y} );
return false;
});
// Hide bindings
setTimeout( function() { // Delay for Mozilla
$(document).click( function() {
$(document).unbind('click').unbind('keypress');
$(menu).fadeOut(o.outSpeed);
return false;
});
}, 0);
}
});
});
// Disable text selection
if( $.browser.mozilla ) {
$('#' + o.menu).each( function() { $(this).css({ 'MozUserSelect' : 'none' }); });
} else if( $.browser.msie ) {
$('#' + o.menu).each( function() { $(this).bind('selectstart.disableTextSelect', function() { return false; }); });
} else {
$('#' + o.menu).each(function() { $(this).bind('mousedown.disableTextSelect', function() { return false; }); });
}
// Disable browser context menu (requires both selectors to work in IE/Safari + FF/Chrome)
$(el).add($('UL.contextMenu')).bind('contextmenu', function() { return false; });
});
return $(this);
},
// Disable context menu items on the fly
disableContextMenuItems: function(o) {
if( o == undefined ) {
// Disable all
$(this).find('LI').addClass('disabled');
return( $(this) );
}
$(this).each( function() {
if( o != undefined ) {
var d = o.split(',');
for( var i = 0; i < d.length; i++ ) {
$(this).find('A[href="' + d[i] + '"]').parent().addClass('disabled');
}
}
});
return( $(this) );
},
// Enable context menu items on the fly
enableContextMenuItems: function(o) {
if( o == undefined ) {
// Enable all
$(this).find('LI.disabled').removeClass('disabled');
return( $(this) );
}
$(this).each( function() {
if( o != undefined ) {
var d = o.split(',');
for( var i = 0; i < d.length; i++ ) {
$(this).find('A[href="' + d[i] + '"]').parent().removeClass('disabled');
}
}
});
return( $(this) );
},
// Disable context menu(s)
disableContextMenu: function() {
$(this).each( function() {
$(this).addClass('disabled');
});
return( $(this) );
},
// Enable context menu(s)
enableContextMenu: function() {
$(this).each( function() {
$(this).removeClass('disabled');
});
return( $(this) );
},
// Destroy context menu(s)
destroyContextMenu: function() {
// Destroy specified context menus
$(this).each( function() {
// Disable action
$(this).unbind('mousedown').unbind('mouseup');
});
return( $(this) );
}
});
})(jQuery);