CC-3174 : Show Builder

data tables column resizing, starting separating out events.
This commit is contained in:
Naomi Aro 2012-01-17 11:18:17 +01:00
parent df33a457b1
commit 424206b9a9
8 changed files with 1156 additions and 77 deletions

View File

@ -27,6 +27,8 @@ class LibraryController extends Zend_Controller_Action
$this->_helper->layout->setLayout('library');
$this->view->headScript()->appendFile($this->view->baseUrl('/js/airtime/library/events/library_playlistbuilder.js'),'text/javascript');
$this->_helper->actionStack('library', 'library');
$this->_helper->actionStack('index', 'playlist');
}
@ -41,7 +43,7 @@ class LibraryController extends Zend_Controller_Action
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js','text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.fnSetFilteringDelay.js','text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.ColVis.js','text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.ColReorder.js','text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.ColReorderResize.js','text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.FixedColumns.js','text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/library.js','text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/advancedsearch.js','text/javascript');

View File

@ -29,6 +29,8 @@ class ShowbuilderController extends Zend_Controller_Action
if ($user->isAdmin() || $user->isHost($show_instance->getShowId())) {
$this->_helper->layout->setLayout('builder');
$this->view->headScript()->appendFile($this->view->baseUrl('/js/airtime/library/events/library_showbuilder.js'),'text/javascript');
$this->_helper->actionStack('library', 'library');
$this->_helper->actionStack('builder', 'showbuilder');
}
@ -56,5 +58,14 @@ class ShowbuilderController extends Zend_Controller_Action
public function scheduleAction() {
$request = $this->getRequest();
$show_instance_id = $request->getParam("sid", 0);
$scheduled_item_id = $request->getParam("time", 0);
$scheduled_start = $request->getParam("start", 0);
//snap to previous/next default.
$scheduled_type = $request->getParam("type", 0);
}
}

View File

@ -90,7 +90,7 @@ class Application_Model_StoredFile {
}
$this->setDbColMetadata($dbMd);
}
$this->_file->setDbMtime(new DateTime("now"), new DateTimeZone("UTC"));
$this->_file->save();
}
@ -316,7 +316,7 @@ class Application_Model_StoredFile {
// don't delete from the playslist. We might want to put a flag
//Application_Model_Playlist::DeleteFileFromAllPlaylists($this->getId());
// set file_exists falg to false
$this->_file->setDbFileExists(false);
$this->_file->save();
@ -418,10 +418,10 @@ class Application_Model_StoredFile {
* @return string
*/
public function getFilePath()
{
{
$music_dir = Application_Model_MusicDir::getDirByPK($this->_file->getDbDirectory());
$directory = $music_dir->getDirectory();
$filepath = $this->_file->getDbFilepath();
return $directory.$filepath;
@ -435,7 +435,7 @@ class Application_Model_StoredFile {
public function setFilePath($p_filepath)
{
$path_info = Application_Model_MusicDir::splitFilePath($p_filepath);
if (is_null($path_info)) {
return -1;
}
@ -505,7 +505,7 @@ class Application_Model_StoredFile {
$storedFile->_file = $file;
if(isset($md['MDATA_KEY_FILEPATH'])) {
// removed "//" in the path. Always use '/' for path separator
// removed "//" in the path. Always use '/' for path separator
$filepath = str_replace("//", "/", $md['MDATA_KEY_FILEPATH']);
$res = $storedFile->setFilePath($filepath);
if ($res === -1) {
@ -684,8 +684,23 @@ class Application_Model_StoredFile {
LEFT JOIN ".$CC_CONFIG['playListTimeView']." AS PLT USING(id))
UNION
(".$fileSelect."id FROM ".$CC_CONFIG["filesTable"]." AS FILES WHERE file_exists = 'TRUE')) AS RESULTS";
$results = Application_Model_StoredFile::searchFiles($fromTable, $datatables);
/*
type = aData["ftype"].substring(0,2);
id = aData["id"];
if(type == "au") {
$('td.library_type', nRow).html( '<img src="css/images/icon_audioclip.png">' );
} else if(type == "pl") {
$('td.library_type', nRow).html( '<img src="css/images/icon_playlist.png">' );
}
$(nRow).attr("id", type+'_'+id);
*/
foreach($results['aaData'] as &$row){
// add checkbox row
$row['checkbox'] = "<input type='checkbox' name='cb_".$row['id']."'>";
@ -694,7 +709,22 @@ class Application_Model_StoredFile {
// split it and grab only the year info
$yearSplit = explode('-', $row['year']);
$row['year'] = $yearSplit[0];
$type = substr($row['ftype'], 0, 2);
$row['id'] = "{$type}_{$row['id']}";
//TODO url like this to work on both playlist/showbuilder screens.
//datatable stuff really needs to be pulled out and generalized within the project
//access to zend view methods to access url helpers is needed.
if($type == "au") {
$row['ftype'] = '<img src="/css/images/icon_audioclip.png">';
}
else {
$row['ftype'] = '<img src="/css/images/icon_playlist.png">';
}
}
return $results;
}
@ -773,9 +803,9 @@ class Application_Model_StoredFile {
else {
$sql = $selectorRows." FROM ".$fromTable." ORDER BY ".$orderby." OFFSET ".$data["iDisplayStart"]." LIMIT ".$data["iDisplayLength"];
}
$results = $CC_DBC->getAll($sql);
if(!isset($totalDisplayRows)) {
$totalDisplayRows = $totalRows;
}
@ -904,10 +934,10 @@ class Application_Model_StoredFile {
$audio_stor = $stor . DIRECTORY_SEPARATOR . $fileName;
Logging::log("copyFileToStor: moving file $audio_file to $audio_stor");
//Martin K.: changed to rename: Much less load + quicker since this is an atomic operation
$r = @rename($audio_file, $audio_stor);
//$r = @copy($audio_file, $audio_stor);
//$r = @unlink($audio_file);
}
@ -920,14 +950,14 @@ class Application_Model_StoredFile {
}
/**
*
*
* Enter description here ...
* @param $dir_id - if this is not provided, it returns all files with full path constructed.
* @param $propelObj - if this is true, it returns array of proepl obj
*/
public static function listAllFiles($dir_id=null, $propelObj=false){
global $CC_DBC;
if($propelObj){
$sql = "SELECT m.directory || f.filepath as fp"
." FROM CC_MUSIC_DIRS m"
@ -989,12 +1019,12 @@ class Application_Model_StoredFile {
public function getSoundCloudErrorMsg(){
return $this->_file->getDbSoundCloudErrorMsg();
}
public function setFileExistsFlag($flag){
$this->_file->setDbFileExists($flag)
->save();
}
public function getFileExistsFlag(){
return $this->_file->getDbFileExists();
}

View File

@ -0,0 +1,20 @@
function dtRowCallback( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
$(nRow).attr("id", aData["id"]);
return nRow;
}
function dtDrawCallback() {
addLibraryItemEvents();
addMetadataQtip();
//saveNumEntriesSetting();
setupGroupActions();
}
function setupLibraryToolbar() {
$("div.library_toolbar").html('<span class="fg-button ui-button ui-state-default" id="library_order_reset">Reset Order</span>' +
'<span class="fg-button ui-button ui-state-default ui-state-disabled" id="library_group_delete">Delete</span>' +
'<span class="fg-button ui-button ui-state-default ui-state-disabled" id="library_group_add">Add</span>');
}

View File

@ -0,0 +1,14 @@
function dtRowCallback( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
$(nRow).attr("id", aData["id"]);
$(nRow).data("show_builder", {"id": aData["id"], "length": aData["length"]});
return nRow;
}
function dtDrawCallback() {
addLibraryItemEvents();
//addMetadataQtip();
//setupGroupActions();
}

View File

@ -120,33 +120,6 @@ function addLibraryItemEvents() {
}
function dtRowCallback( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
var id, type, once;
type = aData["ftype"].substring(0,2);
id = aData["id"];
if(type == "au") {
$('td.library_type', nRow).html( '<img src="css/images/icon_audioclip.png">' );
} else if(type == "pl") {
$('td.library_type', nRow).html( '<img src="css/images/icon_playlist.png">' );
}
$(nRow).attr("id", type+'_'+id);
// insert id on lenth field
$('td.library_length', nRow).attr("id", "length");
return nRow;
}
function dtDrawCallback() {
addLibraryItemEvents();
addMetadataQtip();
saveNumEntriesSetting();
setupGroupActions();
}
function addProgressIcon(id) {
if($("#au_"+id).find("td.library_title").find("span").length > 0){
$("#au_"+id).find("td.library_title").find("span").removeClass();
@ -513,47 +486,43 @@ function createDataTable(data) {
"fnRowCallback": dtRowCallback,
"fnDrawCallback": dtDrawCallback,
"aoColumns": [
/* Checkbox */ {"sTitle": "<input type='checkbox' name='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"},
/* Title */ {"sTitle": "Title", "sName": "track_title", "mDataProp": "track_title", "sClass": "library_title"},
/* Creator */ {"sTitle": "Creator", "sName": "artist_name", "mDataProp": "artist_name", "sClass": "library_creator"},
/* Album */ {"sTitle": "Album", "sName": "album_title", "mDataProp": "album_title", "sClass": "library_album"},
/* Genre */ {"sTitle": "Genre", "sName": "genre", "mDataProp": "genre", "sWidth": "10%", "sClass": "library_genre"},
/* Year */ {"sTitle": "Year", "sName": "year", "mDataProp": "year", "sWidth": "8%", "sClass": "library_year"},
/* Length */ {"sTitle": "Length", "sName": "length", "mDataProp": "length", "sWidth": "10%", "sClass": "library_length"},
/* Type */ {"sTitle": "Type", "sName": "ftype", "bSearchable": false, "mDataProp": "ftype", "sWidth": "9%", "sClass": "library_type"},
/* 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"},
],
/* Checkbox */ {"sTitle": "<input type='checkbox' name='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"},
/* Title */ {"sTitle": "Title", "sName": "track_title", "mDataProp": "track_title", "sClass": "library_title"},
/* Creator */ {"sTitle": "Creator", "sName": "artist_name", "mDataProp": "artist_name", "sClass": "library_creator"},
/* Album */ {"sTitle": "Album", "sName": "album_title", "mDataProp": "album_title", "sClass": "library_album"},
/* Genre */ {"sTitle": "Genre", "sName": "genre", "mDataProp": "genre", "sWidth": "10%", "sClass": "library_genre"},
/* Year */ {"sTitle": "Year", "sName": "year", "mDataProp": "year", "sWidth": "8%", "sClass": "library_year"},
/* Length */ {"sTitle": "Length", "sName": "length", "mDataProp": "length", "sWidth": "10%", "sClass": "library_length"},
/* Type */ {"sTitle": "Type", "sName": "ftype", "bSearchable": false, "mDataProp": "ftype", "sWidth": "9%", "sClass": "library_type"},
/* 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"},
],
"aaSorting": [[2,'asc']],
"sPaginationType": "full_numbers",
"bJQueryUI": true,
"bAutoWidth": false,
"oLanguage": {
"sSearch": ""
},
"iDisplayLength": getNumEntriesPreference(data),
"bStateSave": true,
// R = ColReorder, C = ColVis, see datatables doc for others
"sDom": 'Rlfr<"H"C<"library_toolbar">>t<"F"ip>',
"oColVis": {
"buttonText": "Show/Hide Columns",
"sAlign": "right",
"aiExclude": [0, 1, 2],
"sSize": "css",
"bShowAll": true
"oLanguage": {
"sSearch": ""
},
"iDisplayLength": getNumEntriesPreference(data),
"bStateSave": true,
// R = ColReorder, C = ColVis, see datatables doc for others
"sDom": 'Rlfr<"H"C<"library_toolbar">>t<"F"ip>',
"oColVis": {
"buttonText": "Show/Hide Columns",
"sAlign": "right",
"aiExclude": [0, 1, 2],
"sSize": "css",
"bShowAll": true
},
"oColReorder": {
"aiOrder": [ 0, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] /* code this */,
"iFixedColumns": 3
"oColReorder": {
"aiOrder": [ 0, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], /* code this */
"iFixedColumns": 3
}
});
dTable.fnSetFilteringDelay(350);
$("div.library_toolbar").html('<span class="fg-button ui-button ui-state-default" id="library_order_reset">Reset Order</span>' +
'<span class="fg-button ui-button ui-state-default ui-state-disabled" id="library_group_delete">Delete</span>' +
'<span class="fg-button ui-button ui-state-default ui-state-disabled" id="library_group_add">Add</span>');
$('#library_order_reset').click(function() {
ColReorder.fnReset( dTable );
return false;

View File

@ -26,7 +26,7 @@ $(document).ready(function() {
events: getFullCalendarEvents,
axisFormat: 'H:mm:ss',
axisFormat: 'H:mm',
slotMinutes: 1,
timeFormat: {
agenda: 'H:mm:ss{ - H:mm:ss}'
@ -44,6 +44,18 @@ $(document).ready(function() {
// we need to copy it, so that multiple events don't have a reference to the same object
//var copiedEventObject = $.extend({}, originalEventObject);
var copiedEventObject = {};
var data = $(this).data("show_builder");
$.ajax({url: "/showbuilder/schedule",
data:{format: "json", sid:"", schedule_start: date},
dataType:"json",
success:function(json){
var x;
},
error:function(jqXHR, textStatus, errorThrown){
var x;
}
});
// assign it the date that was reported
copiedEventObject.title = "test title";
@ -56,8 +68,9 @@ $(document).ready(function() {
// render the event on the calendar
// the last `true` argument determines if the event "sticks" (http://arshaw.com/fullcalendar/docs/event_rendering/renderEvent/)
$('#show_builder').fullCalendar('renderEvent', copiedEventObject, true);
//$('#show_builder').fullCalendar('renderEvent', copiedEventObject, true);
$("#schedule_calendar").fullCalendar( 'refetchEvents' );
}
});
});

File diff suppressed because it is too large Load Diff