CC-3174 : showbuilder
working on trying to save/load state serialized into the db for datatables.
This commit is contained in:
parent
378d3d3ef4
commit
9b5a0fc565
|
@ -24,7 +24,6 @@ class ApiController extends Zend_Controller_Action
|
|||
->addActionContext('status', 'json')
|
||||
->addActionContext('register-component', 'json')
|
||||
->addActionContext('update-liquidsoap-status', 'json')
|
||||
->addActionContext('library-init', 'json')
|
||||
->addActionContext('live-chat', 'json')
|
||||
->addActionContext('update-file-system-mount', 'json')
|
||||
->addActionContext('handle-watched-dir-missing', 'json')
|
||||
|
@ -64,7 +63,7 @@ class ApiController extends Zend_Controller_Action
|
|||
$jsonStr = json_encode(array("version"=>Application_Model_Preference::GetAirtimeVersion()));
|
||||
echo $jsonStr;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets up and send init values used in the Calendar.
|
||||
* This is only being used by schedule.js at the moment.
|
||||
|
@ -72,16 +71,16 @@ class ApiController extends Zend_Controller_Action
|
|||
public function calendarInitAction(){
|
||||
$this->view->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
|
||||
if(is_null(Zend_Auth::getInstance()->getStorage()->read())) {
|
||||
header('HTTP/1.0 401 Unauthorized');
|
||||
print 'You are not allowed to access this resource.';
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$this->view->calendarInit = array(
|
||||
"timestamp" => time(),
|
||||
"timezoneOffset" => date("Z"),
|
||||
"timestamp" => time(),
|
||||
"timezoneOffset" => date("Z"),
|
||||
"timeScale" => Application_Model_Preference::GetCalendarTimeScale(),
|
||||
"timeInterval" => Application_Model_Preference::GetCalendarTimeInterval(),
|
||||
"weekStartDay" => Application_Model_Preference::GetWeekStartDay()
|
||||
|
@ -178,9 +177,9 @@ class ApiController extends Zend_Controller_Action
|
|||
* Retrieve the currently playing show as well as upcoming shows.
|
||||
* Number of shows returned and the time interval in which to
|
||||
* get the next shows can be configured as GET parameters.
|
||||
*
|
||||
*
|
||||
* TODO: in the future, make interval length a parameter instead of hardcode to 48
|
||||
*
|
||||
*
|
||||
* Possible parameters:
|
||||
* type - Can have values of "endofday" or "interval". If set to "endofday",
|
||||
* the function will retrieve shows from now to end of day.
|
||||
|
@ -199,19 +198,19 @@ class ApiController extends Zend_Controller_Action
|
|||
$date = new Application_Model_DateHelper;
|
||||
$utcTimeNow = $date->getUtcTimestamp();
|
||||
$utcTimeEnd = ""; // if empty, GetNextShows will use interval instead of end of day
|
||||
|
||||
|
||||
$request = $this->getRequest();
|
||||
$type = $request->getParam('type');
|
||||
if($type == "endofday") {
|
||||
// make GetNextShows use end of day
|
||||
$utcTimeEnd = Application_Model_DateHelper::GetDayEndTimestampInUtc();
|
||||
}
|
||||
|
||||
|
||||
$limit = $request->getParam('limit');
|
||||
if($limit == "" || !is_numeric($limit)) {
|
||||
$limit = "5";
|
||||
}
|
||||
|
||||
|
||||
$result = array("env"=>APPLICATION_ENV,
|
||||
"schedulerTime"=>gmdate("Y-m-d H:i:s"),
|
||||
"currentShow"=>Application_Model_Show::GetCurrentShow($utcTimeNow),
|
||||
|
@ -219,7 +218,7 @@ class ApiController extends Zend_Controller_Action
|
|||
"timezone"=> date("T"),
|
||||
"timezoneOffset"=> date("Z"),
|
||||
"AIRTIME_API_VERSION"=>AIRTIME_API_VERSION); //used by caller to determine if the airtime they are running or widgets in use is out of date.
|
||||
|
||||
|
||||
//Convert from UTC to localtime for user.
|
||||
Application_Model_Show::ConvertToLocalTimeZone($result["currentShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
|
||||
Application_Model_Show::ConvertToLocalTimeZone($result["nextShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
|
||||
|
@ -233,7 +232,7 @@ class ApiController extends Zend_Controller_Action
|
|||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function weekInfoAction()
|
||||
{
|
||||
if (Application_Model_Preference::GetAllow3rdPartyApi()){
|
||||
|
@ -244,7 +243,7 @@ class ApiController extends Zend_Controller_Action
|
|||
$date = new Application_Model_DateHelper;
|
||||
$dayStart = $date->getWeekStartDate();
|
||||
$utcDayStart = Application_Model_DateHelper::ConvertToUtcDateTimeString($dayStart);
|
||||
|
||||
|
||||
$dow = array("sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday");
|
||||
|
||||
$result = array();
|
||||
|
@ -252,9 +251,9 @@ class ApiController extends Zend_Controller_Action
|
|||
$utcDayEnd = Application_Model_DateHelper::GetDayEndTimestamp($utcDayStart);
|
||||
$shows = Application_Model_Show::GetNextShows($utcDayStart, "0", $utcDayEnd);
|
||||
$utcDayStart = $utcDayEnd;
|
||||
|
||||
|
||||
Application_Model_Show::ConvertToLocalTimeZone($shows, array("starts", "ends", "start_timestamp", "end_timestamp"));
|
||||
|
||||
|
||||
$result[$dow[$i]] = $shows;
|
||||
}
|
||||
$result['AIRTIME_API_VERSION'] = AIRTIME_API_VERSION; //used by caller to determine if the airtime they are running or widgets in use is out of date.
|
||||
|
@ -373,8 +372,8 @@ class ApiController extends Zend_Controller_Action
|
|||
$now = new DateTime($today_timestamp);
|
||||
$end_timestamp = $now->add(new DateInterval("PT2H"));
|
||||
$end_timestamp = $end_timestamp->format("Y-m-d H:i:s");
|
||||
|
||||
$this->view->shows = Application_Model_Show::getShows(Application_Model_DateHelper::ConvertToUtcDateTime($today_timestamp, date_default_timezone_get()),
|
||||
|
||||
$this->view->shows = Application_Model_Show::getShows(Application_Model_DateHelper::ConvertToUtcDateTime($today_timestamp, date_default_timezone_get()),
|
||||
Application_Model_DateHelper::ConvertToUtcDateTime($end_timestamp, date_default_timezone_get()),
|
||||
$excludeInstance=NULL, $onlyRecord=TRUE);
|
||||
|
||||
|
@ -405,7 +404,7 @@ class ApiController extends Zend_Controller_Action
|
|||
$upload_dir = ini_get("upload_tmp_dir");
|
||||
$tempFilePath = Application_Model_StoredFile::uploadFile($upload_dir);
|
||||
$tempFileName = basename($tempFilePath);
|
||||
|
||||
|
||||
$fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : '';
|
||||
$result = Application_Model_StoredFile::copyFileToStor($upload_dir, $fileName, $tempFileName);
|
||||
if (isset($result)){
|
||||
|
@ -456,19 +455,19 @@ class ApiController extends Zend_Controller_Action
|
|||
}
|
||||
|
||||
if (isset($show_name)) {
|
||||
|
||||
|
||||
$show_name = str_replace(" ", "-", $show_name);
|
||||
|
||||
|
||||
//2011-12-09-19-28-00-ofirrr-256kbps
|
||||
$filename = $file->getName();
|
||||
|
||||
|
||||
//replace the showname in the filepath incase it has been edited since the show started recording
|
||||
//(some old bug)
|
||||
$filename_parts = explode("-", $filename);
|
||||
$new_name = array_slice($filename_parts, 0, 6);
|
||||
$new_name[] = $show_name;
|
||||
$new_name[] = $filename_parts[count($filename_parts)-1];
|
||||
|
||||
|
||||
$tmpTitle = implode("-", $new_name);
|
||||
}
|
||||
else {
|
||||
|
@ -533,7 +532,7 @@ class ApiController extends Zend_Controller_Action
|
|||
}
|
||||
|
||||
$this->view->stor = Application_Model_MusicDir::getStorDir()->getDirectory();
|
||||
|
||||
|
||||
$watchedDirs = Application_Model_MusicDir::getWatchedDirs();
|
||||
$watchedDirsPath = array();
|
||||
foreach($watchedDirs as $wd){
|
||||
|
@ -573,7 +572,7 @@ class ApiController extends Zend_Controller_Action
|
|||
$filepath = str_replace("//", "/", $filepath);
|
||||
|
||||
$file = Application_Model_StoredFile::RecallByFilepath($filepath);
|
||||
|
||||
|
||||
if (is_null($file)) {
|
||||
$file = Application_Model_StoredFile::Insert($md);
|
||||
}
|
||||
|
@ -737,10 +736,10 @@ class ApiController extends Zend_Controller_Action
|
|||
|
||||
$this->view->msg = Application_Model_MusicDir::setStorDir($path);
|
||||
}
|
||||
|
||||
|
||||
public function getStreamSettingAction() {
|
||||
global $CC_CONFIG;
|
||||
|
||||
|
||||
$request = $this->getRequest();
|
||||
$api_key = $request->getParam('api_key');
|
||||
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
|
||||
|
@ -752,10 +751,10 @@ class ApiController extends Zend_Controller_Action
|
|||
|
||||
$this->view->msg = Application_Model_StreamSetting::getStreamSetting();
|
||||
}
|
||||
|
||||
|
||||
public function statusAction() {
|
||||
global $CC_CONFIG;
|
||||
|
||||
|
||||
$request = $this->getRequest();
|
||||
$api_key = $request->getParam('api_key');
|
||||
$getDiskInfo = $request->getParam('diskinfo') == "true";
|
||||
|
@ -767,7 +766,7 @@ class ApiController extends Zend_Controller_Action
|
|||
exit;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
$status = array(
|
||||
"platform"=>Application_Model_Systemstatus::GetPlatformInfo(),
|
||||
"airtime_version"=>Application_Model_Preference::GetAirtimeVersion(),
|
||||
|
@ -779,11 +778,11 @@ class ApiController extends Zend_Controller_Action
|
|||
"media_monitor"=>Application_Model_Systemstatus::GetMediaMonitorStatus()
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
if ($getDiskInfo){
|
||||
$status["partitions"] = Application_Model_Systemstatus::GetDiskInfo();
|
||||
}
|
||||
|
||||
|
||||
$this->view->status = $status;
|
||||
}
|
||||
|
||||
|
@ -796,40 +795,21 @@ class ApiController extends Zend_Controller_Action
|
|||
|
||||
Application_Model_ServiceRegister::Register($component, $remoteAddr);
|
||||
}
|
||||
|
||||
|
||||
public function updateLiquidsoapStatusAction(){
|
||||
$request = $this->getRequest();
|
||||
|
||||
|
||||
$msg = $request->getParam('msg');
|
||||
$stream_id = $request->getParam('stream_id');
|
||||
$boot_time = $request->getParam('boot_time');
|
||||
|
||||
|
||||
Application_Model_StreamSetting::setLiquidsoapError($stream_id, $msg, $boot_time);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up and send init values used in the Library.
|
||||
* This is being used by library.js
|
||||
*/
|
||||
public function libraryInitAction(){
|
||||
$this->view->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
if(is_null(Zend_Auth::getInstance()->getStorage()->read())) {
|
||||
header('HTTP/1.0 401 Unauthorized');
|
||||
print 'You are not allowed to access this resource.';
|
||||
return;
|
||||
}
|
||||
|
||||
$this->view->libraryInit = array(
|
||||
"numEntries"=>Application_Model_Preference::GetLibraryNumEntries()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// handles addition/deletion of mount point which watched dirs reside
|
||||
public function updateFileSystemMountAction(){
|
||||
global $CC_CONFIG;
|
||||
|
||||
|
||||
$request = $this->getRequest();
|
||||
$api_key = $request->getParam('api_key');
|
||||
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
|
||||
|
@ -842,16 +822,16 @@ class ApiController extends Zend_Controller_Action
|
|||
$params = $request->getParams();
|
||||
$added_list = empty($params['added_dir'])?array():explode(',',$params['added_dir']);
|
||||
$removed_list = empty($params['removed_dir'])?array():explode(',',$params['removed_dir']);
|
||||
|
||||
|
||||
// get all watched dirs
|
||||
$watched_dirs = Application_Model_MusicDir::getWatchedDirs(null,null);
|
||||
|
||||
|
||||
foreach( $added_list as $ad){
|
||||
foreach( $watched_dirs as $dir ){
|
||||
$dirPath = $dir->getDirectory();
|
||||
|
||||
|
||||
$ad .= '/';
|
||||
|
||||
|
||||
// if mount path itself was watched
|
||||
if($dirPath == $ad){
|
||||
Application_Model_MusicDir::addWatchedDir($dirPath, false);
|
||||
|
@ -884,7 +864,7 @@ class ApiController extends Zend_Controller_Action
|
|||
// is new mount point within the watched dir?
|
||||
// pyinotify doesn't notify anyhing in this case, so we walk through all files within
|
||||
// this watched dir in DB and mark them deleted.
|
||||
// In case of h) of use cases, due to pyinotify behaviour of noticing mounted dir, we need to
|
||||
// In case of h) of use cases, due to pyinotify behaviour of noticing mounted dir, we need to
|
||||
// compare agaisnt all files in cc_files table
|
||||
else if(substr($rd, 0, strlen($dirPath)) === $dirPath ){
|
||||
$watchDir = Application_Model_MusicDir::getDirByPath($rd);
|
||||
|
@ -903,13 +883,13 @@ class ApiController extends Zend_Controller_Action
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// handles case where watched dir is missing
|
||||
public function handleWatchedDirMissingAction(){
|
||||
global $CC_CONFIG;
|
||||
|
||||
|
||||
$request = $this->getRequest();
|
||||
$api_key = $request->getParam('api_key');
|
||||
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
|
||||
|
@ -918,7 +898,7 @@ class ApiController extends Zend_Controller_Action
|
|||
print 'You are not allowed to access this resource.';
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$dir = base64_decode($request->getParam('dir'));
|
||||
Application_Model_MusicDir::removeWatchedDir($dir, false);
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ class LibraryController extends Zend_Controller_Action
|
|||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.fnSetFilteringDelay.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.ColVis.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.ColReorderResize.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.ColReorder.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.FixedColumns.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.TableTools.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
|
||||
|
@ -282,14 +282,4 @@ class LibraryController extends Zend_Controller_Action
|
|||
$this->view->error_msg = $file->getSoundCloudErrorMsg();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores the number of entries user chose to show in the Library
|
||||
* to the pref db
|
||||
*/
|
||||
public function setNumEntriesAction() {
|
||||
$request = $this->getRequest();
|
||||
$numEntries = $request->getParam('numEntries');
|
||||
Application_Model_Preference::SetLibraryNumEntries($numEntries);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,13 +14,15 @@ class PreferenceController extends Zend_Controller_Action
|
|||
->addActionContext('is-import-in-progress', 'json')
|
||||
->addActionContext('change-stream-setting', 'json')
|
||||
->addActionContext('get-liquidsoap-status', 'json')
|
||||
->addActionContext('get-library-datatable', 'json')
|
||||
->addActionContext('set-library-datatable', 'json')
|
||||
->initContext();
|
||||
}
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
|
||||
|
||||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
|
||||
|
@ -59,7 +61,7 @@ class PreferenceController extends Zend_Controller_Action
|
|||
public function supportSettingAction()
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
|
||||
|
||||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
|
||||
|
@ -119,7 +121,7 @@ class PreferenceController extends Zend_Controller_Action
|
|||
public function directoryConfigAction()
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
|
||||
|
||||
if(Application_Model_Preference::GetPlanLevel() == 'disabled'){
|
||||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
|
@ -136,7 +138,7 @@ class PreferenceController extends Zend_Controller_Action
|
|||
public function streamSettingAction()
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
|
||||
|
||||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
|
||||
|
@ -206,10 +208,10 @@ class PreferenceController extends Zend_Controller_Action
|
|||
$values['output_sound_device'] = $form->getValue('output_sound_device');
|
||||
}
|
||||
|
||||
|
||||
|
||||
$values['icecast_vorbis_metadata'] = $form->getValue('icecast_vorbis_metadata');
|
||||
$values['output_sound_device_type'] = $form->getValue('output_sound_device_type');
|
||||
$values['streamFormat'] = $form->getValue('streamFormat');
|
||||
$values['streamFormat'] = $form->getValue('streamFormat');
|
||||
|
||||
}
|
||||
if(!$error){
|
||||
|
@ -331,6 +333,26 @@ class PreferenceController extends Zend_Controller_Action
|
|||
}
|
||||
die(json_encode($out));
|
||||
}
|
||||
|
||||
public function setLibraryDatatableAction() {
|
||||
|
||||
$request = $this->getRequest();
|
||||
$settings = $request->getParam("settings");
|
||||
|
||||
$data = serialize($settings);
|
||||
Logging::log("library datatable");
|
||||
Logging::log($data);
|
||||
|
||||
Application_Model_Preference::SetValue("library_datatable", $data, true);
|
||||
|
||||
}
|
||||
|
||||
public function getLibraryDatatableAction() {
|
||||
|
||||
$data = Application_Model_Preference::GetValue("library_datatable", true);
|
||||
|
||||
$this->view->settings = unserialize($data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2,4 +2,11 @@
|
|||
|
||||
#show_builder input.input_text {
|
||||
width:100px;
|
||||
}
|
||||
}
|
||||
|
||||
#show_builder span.ui-icon-triangle-1-e {
|
||||
float: left;
|
||||
position: relative;
|
||||
left: -20px;
|
||||
top: 15px;
|
||||
}
|
||||
|
|
|
@ -211,76 +211,51 @@ function addQtipToSCIcons(){
|
|||
});
|
||||
}
|
||||
|
||||
function fnCreatedRow( nRow, aData, iDataIndex ) {
|
||||
|
||||
//call the context menu so we can prevent the event from propagating.
|
||||
$(nRow).find('td:not(.library_checkbox):not(.library_type)').click(function(e){
|
||||
|
||||
$(this).contextMenu();
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
//add a tool tip to appear when the user clicks on the type icon.
|
||||
$(nRow.children[1]).qtip({
|
||||
content: {
|
||||
text: "Loading...",
|
||||
title: {
|
||||
text: aData.track_title
|
||||
},
|
||||
ajax: {
|
||||
url: "/Library/get-file-meta-data",
|
||||
type: "get",
|
||||
data: ({format: "html", id : aData.id, type: aData.ftype}),
|
||||
success: function(data, status) {
|
||||
this.set('content.text', data);
|
||||
}
|
||||
}
|
||||
},
|
||||
position: {
|
||||
my: 'left center',
|
||||
at: 'right center', // Position the tooltip above the link
|
||||
viewport: $(window), // Keep the tooltip on-screen at all times
|
||||
effect: false // Disable positioning animation
|
||||
},
|
||||
style: {
|
||||
classes: "ui-tooltip-dark"
|
||||
},
|
||||
show: {
|
||||
event: 'click',
|
||||
solo: true // Only show one tooltip at a time
|
||||
},
|
||||
hide: 'mouseout'
|
||||
|
||||
}).click(function(event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates pref db when user changes the # of entries to show
|
||||
*/
|
||||
function saveNumEntriesSetting() {
|
||||
$('select[name=library_display_length]').change(function() {
|
||||
var url = '/Library/set-num-entries/format/json';
|
||||
$.post(url, {numEntries: $(this).val()});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Use user preference for number of entries to show
|
||||
*/
|
||||
function getNumEntriesPreference(data) {
|
||||
return parseInt(data.libraryInit.numEntries, 10);
|
||||
}
|
||||
|
||||
function createDataTable(data) {
|
||||
var oTable;
|
||||
$(document).ready(function() {
|
||||
var oTable;
|
||||
|
||||
$('.tabs').tabs();
|
||||
|
||||
oTable = $('#library_display').dataTable( {
|
||||
"bProcessing": true,
|
||||
"bServerSide": true,
|
||||
|
||||
"bStateSave": true,
|
||||
"fnStateSave": function (oSettings, oData) {
|
||||
|
||||
$.ajax({
|
||||
url: "/preference/set-library-datatable",
|
||||
type: "POST",
|
||||
data: {settings : oData, format: "json"},
|
||||
dataType: "json",
|
||||
success: function(){
|
||||
var x;
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
var x;
|
||||
}
|
||||
});
|
||||
},
|
||||
"fnStateLoad": function (oSettings) {
|
||||
var o;
|
||||
|
||||
$.ajax({
|
||||
url: "/preference/get-library-datatable",
|
||||
type: "GET",
|
||||
data: {format: "json"},
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function(json){
|
||||
o = json.settings;
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
var x;
|
||||
}
|
||||
});
|
||||
|
||||
return o;
|
||||
},
|
||||
|
||||
"sAjaxSource": "/Library/contents",
|
||||
"fnServerData": function ( sSource, aoData, testCallback ) {
|
||||
aoData.push( { name: "format", value: "json"} );
|
||||
|
@ -293,7 +268,52 @@ function createDataTable(data) {
|
|||
} );
|
||||
},
|
||||
"fnRowCallback": AIRTIME.library.events.fnRowCallback,
|
||||
"fnCreatedRow": fnCreatedRow,
|
||||
"fnCreatedRow": function( nRow, aData, iDataIndex ) {
|
||||
|
||||
//call the context menu so we can prevent the event from propagating.
|
||||
$(nRow).find('td:not(.library_checkbox):not(.library_type)').click(function(e){
|
||||
|
||||
$(this).contextMenu();
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
//add a tool tip to appear when the user clicks on the type icon.
|
||||
$(nRow.children[1]).qtip({
|
||||
content: {
|
||||
text: "Loading...",
|
||||
title: {
|
||||
text: aData.track_title
|
||||
},
|
||||
ajax: {
|
||||
url: "/Library/get-file-meta-data",
|
||||
type: "get",
|
||||
data: ({format: "html", id : aData.id, type: aData.ftype}),
|
||||
success: function(data, status) {
|
||||
this.set('content.text', data);
|
||||
}
|
||||
}
|
||||
},
|
||||
position: {
|
||||
my: 'left center',
|
||||
at: 'right center', // Position the tooltip above the link
|
||||
viewport: $(window), // Keep the tooltip on-screen at all times
|
||||
effect: false // Disable positioning animation
|
||||
},
|
||||
style: {
|
||||
classes: "ui-tooltip-dark"
|
||||
},
|
||||
show: {
|
||||
event: 'click',
|
||||
solo: true // Only show one tooltip at a time
|
||||
},
|
||||
hide: 'mouseout'
|
||||
|
||||
}).click(function(event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
});
|
||||
},
|
||||
"fnDrawCallback": AIRTIME.library.events.fnDrawCallback,
|
||||
"fnHeaderCallback": function(nHead) {
|
||||
$(nHead).find("input[type=checkbox]").attr("checked", false);
|
||||
|
@ -319,8 +339,7 @@ function createDataTable(data) {
|
|||
"oLanguage": {
|
||||
"sSearch": ""
|
||||
},
|
||||
"iDisplayLength": getNumEntriesPreference(data),
|
||||
|
||||
|
||||
// R = ColReorder, C = ColVis, T = TableTools
|
||||
"sDom": 'Rlfr<"H"T<"library_toolbar"C>>t<"F"ip>',
|
||||
|
||||
|
@ -353,8 +372,7 @@ function createDataTable(data) {
|
|||
"buttonText": "Show/Hide Columns",
|
||||
"sAlign": "right",
|
||||
"aiExclude": [0, 1],
|
||||
"sSize": "css",
|
||||
"bShowAll": true
|
||||
"sSize": "css"
|
||||
},
|
||||
|
||||
"oColReorder": {
|
||||
|
@ -377,13 +395,6 @@ function createDataTable(data) {
|
|||
oTT.fnSelectNone();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$('.tabs').tabs();
|
||||
|
||||
$.ajax({url: "/Api/library-init/format/json", dataType:"json", success:createDataTable,
|
||||
error:function(jqXHR, textStatus, errorThrown){}});
|
||||
|
||||
checkImportStatus();
|
||||
setInterval( checkImportStatus, 5000 );
|
||||
|
|
|
@ -205,7 +205,7 @@ $(document).ready(function() {
|
|||
if (aData.header === true) {
|
||||
cl = 'sb-header';
|
||||
|
||||
sSeparatorHTML = '<span>'+aData.title+'</span><span>'+aData.starts+'</span><span>'+aData.ends+'</span>';
|
||||
sSeparatorHTML = '<span>'+aData.title+'</span><span>'+aData.starts+'</span><span>'+aData.ends+'</span><span class="ui-icon ui-icon-triangle-1-e"></span>';
|
||||
fnPrepareSeparatorRow(sSeparatorHTML, cl, 0);
|
||||
}
|
||||
else if (aData.footer === true) {
|
||||
|
@ -230,7 +230,7 @@ $(document).ready(function() {
|
|||
|
||||
node = nRow.children[0];
|
||||
if (aData.checkbox === true) {
|
||||
node.innerHTML = '<input type="checkbox" name="'+aData.id+'"></input>';
|
||||
node.innerHTML = '<input type="checkbox" name="'+aData.id+'"></input><span class="ui-icon ui-icon-triangle-1-e"></span>';
|
||||
}
|
||||
else {
|
||||
node.innerHTML = '';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* File: ColReorder.js
|
||||
* Version: 1.0.4
|
||||
* Version: 1.0.5
|
||||
* CVS: $Id$
|
||||
* Description: Controls for column visiblity in DataTables
|
||||
* Author: Allan Jardine (www.sprymedia.co.uk)
|
||||
|
@ -163,7 +163,11 @@ $.fn.dataTableExt.oApi.fnColReorder = function ( oSettings, iFrom, iTo )
|
|||
/* Data column sorting (the column which the sort for a given column should take place on) */
|
||||
for ( i=0, iLen=iCols ; i<iLen ; i++ )
|
||||
{
|
||||
oSettings.aoColumns[i].iDataSort = aiInvertMapping[ oSettings.aoColumns[i].iDataSort ];
|
||||
oCol = oSettings.aoColumns[i];
|
||||
for ( j=0, jLen=oCol.aDataSort.length ; j<jLen ; j++ )
|
||||
{
|
||||
oCol.aDataSort[j] = aiInvertMapping[ oCol.aDataSort[j] ];
|
||||
}
|
||||
}
|
||||
|
||||
/* Update the Get and Set functions for each column */
|
||||
|
@ -464,12 +468,9 @@ ColReorder.prototype = {
|
|||
}
|
||||
|
||||
/* State saving */
|
||||
this.s.dt.aoStateSave.push( {
|
||||
"fn": function (oS, sVal) {
|
||||
return that._fnStateSave.call( that, sVal );
|
||||
},
|
||||
"sName": "ColReorder_State"
|
||||
} );
|
||||
this.s.dt.oApi._fnCallbackReg( this.s.dt, 'aoStateSaveParams', function (oS, oData) {
|
||||
that._fnStateSave.call( that, oData );
|
||||
}, "ColReorder_State" );
|
||||
|
||||
/* An initial column order has been specified */
|
||||
var aiOrder = null;
|
||||
|
@ -556,72 +557,41 @@ ColReorder.prototype = {
|
|||
|
||||
|
||||
/**
|
||||
* This function effectively replaces the state saving function in DataTables (this is needed
|
||||
* because otherwise DataTables would state save the columns in their reordered state, not the
|
||||
* original which is needed on first draw). This is sensitive to any changes in the DataTables
|
||||
* state saving method!
|
||||
* Because we change the indexes of columns in the table, relative to their starting point
|
||||
* we need to reorder the state columns to what they are at the starting point so we can
|
||||
* then rearrange them again on state load!
|
||||
* @method _fnStateSave
|
||||
* @param string sCurrentVal
|
||||
* @param object oState DataTables state
|
||||
* @returns string JSON encoded cookie string for DataTables
|
||||
* @private
|
||||
*/
|
||||
"_fnStateSave": function ( sCurrentVal )
|
||||
"_fnStateSave": function ( oState )
|
||||
{
|
||||
var i, iLen, sTmp;
|
||||
var sValue = sCurrentVal.split('"aaSorting"')[0];
|
||||
var a = [];
|
||||
var i, iLen, aCopy, iOrigColumn;
|
||||
var oSettings = this.s.dt;
|
||||
|
||||
|
||||
/* Sorting */
|
||||
sValue += '"aaSorting":[ ';
|
||||
for ( i=0 ; i<oSettings.aaSorting.length ; i++ )
|
||||
for ( i=0 ; i<oState.aaSorting.length ; i++ )
|
||||
{
|
||||
sValue += '['+oSettings.aoColumns[ oSettings.aaSorting[i][0] ]._ColReorder_iOrigCol+
|
||||
',"'+oSettings.aaSorting[i][1]+'"],';
|
||||
oState.aaSorting[i][0] = oSettings.aoColumns[ oState.aaSorting[i][0] ]._ColReorder_iOrigCol;
|
||||
}
|
||||
sValue = sValue.substring(0, sValue.length-1);
|
||||
sValue += "],";
|
||||
|
||||
/* Column filter */
|
||||
|
||||
aSearchCopy = $.extend( true, [], oState.aoSearchCols );
|
||||
oState.ColReorder = [];
|
||||
|
||||
for ( i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ )
|
||||
{
|
||||
a[ oSettings.aoColumns[i]._ColReorder_iOrigCol ] = {
|
||||
"sSearch": encodeURIComponent(oSettings.aoPreSearchCols[i].sSearch),
|
||||
"bRegex": !oSettings.aoPreSearchCols[i].bRegex
|
||||
};
|
||||
}
|
||||
iOrigColumn = oSettings.aoColumns[i]._ColReorder_iOrigCol;
|
||||
|
||||
/* Column filter */
|
||||
oState.aoSearchCols[ iOrigColumn ] = aSearchCopy[i];
|
||||
|
||||
/* Visibility */
|
||||
oState.abVisCols[ iOrigColumn ] = oSettings.aoColumns[i].bVisible;
|
||||
|
||||
sValue += '"aaSearchCols":[ ';
|
||||
for ( i=0 ; i<a.length ; i++ )
|
||||
{
|
||||
sValue += '["'+a[i].sSearch+'",'+a[i].bRegex+'],';
|
||||
/* Column reordering */
|
||||
oState.ColReorder.push( iOrigColumn );
|
||||
}
|
||||
sValue = sValue.substring(0, sValue.length-1);
|
||||
sValue += "],";
|
||||
|
||||
/* Visibility */
|
||||
a = [];
|
||||
for ( i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ )
|
||||
{
|
||||
a[ oSettings.aoColumns[i]._ColReorder_iOrigCol ] = oSettings.aoColumns[i].bVisible;
|
||||
}
|
||||
|
||||
sValue += '"abVisCols":[ ';
|
||||
for ( i=0 ; i<a.length ; i++ )
|
||||
{
|
||||
sValue += a[i]+",";
|
||||
}
|
||||
sValue = sValue.substring(0, sValue.length-1);
|
||||
sValue += "],";
|
||||
|
||||
/* Column reordering */
|
||||
a = [];
|
||||
for ( i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ ) {
|
||||
a.push( oSettings.aoColumns[i]._ColReorder_iOrigCol );
|
||||
}
|
||||
sValue += '"ColReorder":['+a.join(',')+']';
|
||||
|
||||
return sValue;
|
||||
},
|
||||
|
||||
|
||||
|
@ -944,7 +914,7 @@ ColReorder.prototype.CLASS = "ColReorder";
|
|||
* @type String
|
||||
* @default As code
|
||||
*/
|
||||
ColReorder.VERSION = "1.0.4";
|
||||
ColReorder.VERSION = "1.0.5";
|
||||
ColReorder.prototype.VERSION = ColReorder.VERSION;
|
||||
|
||||
|
||||
|
@ -960,7 +930,7 @@ ColReorder.prototype.VERSION = ColReorder.VERSION;
|
|||
*/
|
||||
if ( typeof $.fn.dataTable == "function" &&
|
||||
typeof $.fn.dataTableExt.fnVersionCheck == "function" &&
|
||||
$.fn.dataTableExt.fnVersionCheck('1.8.0') )
|
||||
$.fn.dataTableExt.fnVersionCheck('1.9.0') )
|
||||
{
|
||||
$.fn.dataTableExt.aoFeatures.push( {
|
||||
"fnInit": function( oDTSettings ) {
|
||||
|
@ -981,7 +951,7 @@ if ( typeof $.fn.dataTable == "function" &&
|
|||
}
|
||||
else
|
||||
{
|
||||
alert( "Warning: ColReorder requires DataTables 1.8.0 or greater - www.datatables.net/download");
|
||||
alert( "Warning: ColReorder requires DataTables 1.9.0 or greater - www.datatables.net/download");
|
||||
}
|
||||
|
||||
})(jQuery, window, document);
|
||||
})(jQuery, window, document);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* File: ColVis.js
|
||||
* Version: 1.0.7.dev
|
||||
* Version: 1.0.7
|
||||
* CVS: $Id$
|
||||
* Description: Controls for column visiblity in DataTables
|
||||
* Author: Allan Jardine (www.sprymedia.co.uk)
|
||||
|
@ -873,7 +873,7 @@ ColVis.prototype = {
|
|||
|
||||
|
||||
/**
|
||||
*
|
||||
* Alter the colspan on any fnOpen rows
|
||||
*/
|
||||
"_fnAdjustOpenRows": function ()
|
||||
{
|
||||
|
@ -958,7 +958,7 @@ ColVis.prototype.CLASS = "ColVis";
|
|||
* @type String
|
||||
* @default See code
|
||||
*/
|
||||
ColVis.VERSION = "1.0.7.dev";
|
||||
ColVis.VERSION = "1.0.7";
|
||||
ColVis.prototype.VERSION = ColVis.VERSION;
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue