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('status', 'json')
|
||||||
->addActionContext('register-component', 'json')
|
->addActionContext('register-component', 'json')
|
||||||
->addActionContext('update-liquidsoap-status', 'json')
|
->addActionContext('update-liquidsoap-status', 'json')
|
||||||
->addActionContext('library-init', 'json')
|
|
||||||
->addActionContext('live-chat', 'json')
|
->addActionContext('live-chat', 'json')
|
||||||
->addActionContext('update-file-system-mount', 'json')
|
->addActionContext('update-file-system-mount', 'json')
|
||||||
->addActionContext('handle-watched-dir-missing', '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()));
|
$jsonStr = json_encode(array("version"=>Application_Model_Preference::GetAirtimeVersion()));
|
||||||
echo $jsonStr;
|
echo $jsonStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets up and send init values used in the Calendar.
|
* Sets up and send init values used in the Calendar.
|
||||||
* This is only being used by schedule.js at the moment.
|
* This is only being used by schedule.js at the moment.
|
||||||
|
@ -72,16 +71,16 @@ class ApiController extends Zend_Controller_Action
|
||||||
public function calendarInitAction(){
|
public function calendarInitAction(){
|
||||||
$this->view->layout()->disableLayout();
|
$this->view->layout()->disableLayout();
|
||||||
$this->_helper->viewRenderer->setNoRender(true);
|
$this->_helper->viewRenderer->setNoRender(true);
|
||||||
|
|
||||||
if(is_null(Zend_Auth::getInstance()->getStorage()->read())) {
|
if(is_null(Zend_Auth::getInstance()->getStorage()->read())) {
|
||||||
header('HTTP/1.0 401 Unauthorized');
|
header('HTTP/1.0 401 Unauthorized');
|
||||||
print 'You are not allowed to access this resource.';
|
print 'You are not allowed to access this resource.';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->view->calendarInit = array(
|
$this->view->calendarInit = array(
|
||||||
"timestamp" => time(),
|
"timestamp" => time(),
|
||||||
"timezoneOffset" => date("Z"),
|
"timezoneOffset" => date("Z"),
|
||||||
"timeScale" => Application_Model_Preference::GetCalendarTimeScale(),
|
"timeScale" => Application_Model_Preference::GetCalendarTimeScale(),
|
||||||
"timeInterval" => Application_Model_Preference::GetCalendarTimeInterval(),
|
"timeInterval" => Application_Model_Preference::GetCalendarTimeInterval(),
|
||||||
"weekStartDay" => Application_Model_Preference::GetWeekStartDay()
|
"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.
|
* Retrieve the currently playing show as well as upcoming shows.
|
||||||
* Number of shows returned and the time interval in which to
|
* Number of shows returned and the time interval in which to
|
||||||
* get the next shows can be configured as GET parameters.
|
* get the next shows can be configured as GET parameters.
|
||||||
*
|
*
|
||||||
* TODO: in the future, make interval length a parameter instead of hardcode to 48
|
* TODO: in the future, make interval length a parameter instead of hardcode to 48
|
||||||
*
|
*
|
||||||
* Possible parameters:
|
* Possible parameters:
|
||||||
* type - Can have values of "endofday" or "interval". If set to "endofday",
|
* type - Can have values of "endofday" or "interval". If set to "endofday",
|
||||||
* the function will retrieve shows from now to end of day.
|
* 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;
|
$date = new Application_Model_DateHelper;
|
||||||
$utcTimeNow = $date->getUtcTimestamp();
|
$utcTimeNow = $date->getUtcTimestamp();
|
||||||
$utcTimeEnd = ""; // if empty, GetNextShows will use interval instead of end of day
|
$utcTimeEnd = ""; // if empty, GetNextShows will use interval instead of end of day
|
||||||
|
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$type = $request->getParam('type');
|
$type = $request->getParam('type');
|
||||||
if($type == "endofday") {
|
if($type == "endofday") {
|
||||||
// make GetNextShows use end of day
|
// make GetNextShows use end of day
|
||||||
$utcTimeEnd = Application_Model_DateHelper::GetDayEndTimestampInUtc();
|
$utcTimeEnd = Application_Model_DateHelper::GetDayEndTimestampInUtc();
|
||||||
}
|
}
|
||||||
|
|
||||||
$limit = $request->getParam('limit');
|
$limit = $request->getParam('limit');
|
||||||
if($limit == "" || !is_numeric($limit)) {
|
if($limit == "" || !is_numeric($limit)) {
|
||||||
$limit = "5";
|
$limit = "5";
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = array("env"=>APPLICATION_ENV,
|
$result = array("env"=>APPLICATION_ENV,
|
||||||
"schedulerTime"=>gmdate("Y-m-d H:i:s"),
|
"schedulerTime"=>gmdate("Y-m-d H:i:s"),
|
||||||
"currentShow"=>Application_Model_Show::GetCurrentShow($utcTimeNow),
|
"currentShow"=>Application_Model_Show::GetCurrentShow($utcTimeNow),
|
||||||
|
@ -219,7 +218,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
"timezone"=> date("T"),
|
"timezone"=> date("T"),
|
||||||
"timezoneOffset"=> date("Z"),
|
"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.
|
"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.
|
//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["currentShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
|
||||||
Application_Model_Show::ConvertToLocalTimeZone($result["nextShow"], 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;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function weekInfoAction()
|
public function weekInfoAction()
|
||||||
{
|
{
|
||||||
if (Application_Model_Preference::GetAllow3rdPartyApi()){
|
if (Application_Model_Preference::GetAllow3rdPartyApi()){
|
||||||
|
@ -244,7 +243,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
$date = new Application_Model_DateHelper;
|
$date = new Application_Model_DateHelper;
|
||||||
$dayStart = $date->getWeekStartDate();
|
$dayStart = $date->getWeekStartDate();
|
||||||
$utcDayStart = Application_Model_DateHelper::ConvertToUtcDateTimeString($dayStart);
|
$utcDayStart = Application_Model_DateHelper::ConvertToUtcDateTimeString($dayStart);
|
||||||
|
|
||||||
$dow = array("sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday");
|
$dow = array("sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday");
|
||||||
|
|
||||||
$result = array();
|
$result = array();
|
||||||
|
@ -252,9 +251,9 @@ class ApiController extends Zend_Controller_Action
|
||||||
$utcDayEnd = Application_Model_DateHelper::GetDayEndTimestamp($utcDayStart);
|
$utcDayEnd = Application_Model_DateHelper::GetDayEndTimestamp($utcDayStart);
|
||||||
$shows = Application_Model_Show::GetNextShows($utcDayStart, "0", $utcDayEnd);
|
$shows = Application_Model_Show::GetNextShows($utcDayStart, "0", $utcDayEnd);
|
||||||
$utcDayStart = $utcDayEnd;
|
$utcDayStart = $utcDayEnd;
|
||||||
|
|
||||||
Application_Model_Show::ConvertToLocalTimeZone($shows, array("starts", "ends", "start_timestamp", "end_timestamp"));
|
Application_Model_Show::ConvertToLocalTimeZone($shows, array("starts", "ends", "start_timestamp", "end_timestamp"));
|
||||||
|
|
||||||
$result[$dow[$i]] = $shows;
|
$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.
|
$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);
|
$now = new DateTime($today_timestamp);
|
||||||
$end_timestamp = $now->add(new DateInterval("PT2H"));
|
$end_timestamp = $now->add(new DateInterval("PT2H"));
|
||||||
$end_timestamp = $end_timestamp->format("Y-m-d H:i:s");
|
$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()),
|
Application_Model_DateHelper::ConvertToUtcDateTime($end_timestamp, date_default_timezone_get()),
|
||||||
$excludeInstance=NULL, $onlyRecord=TRUE);
|
$excludeInstance=NULL, $onlyRecord=TRUE);
|
||||||
|
|
||||||
|
@ -405,7 +404,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
$upload_dir = ini_get("upload_tmp_dir");
|
$upload_dir = ini_get("upload_tmp_dir");
|
||||||
$tempFilePath = Application_Model_StoredFile::uploadFile($upload_dir);
|
$tempFilePath = Application_Model_StoredFile::uploadFile($upload_dir);
|
||||||
$tempFileName = basename($tempFilePath);
|
$tempFileName = basename($tempFilePath);
|
||||||
|
|
||||||
$fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : '';
|
$fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : '';
|
||||||
$result = Application_Model_StoredFile::copyFileToStor($upload_dir, $fileName, $tempFileName);
|
$result = Application_Model_StoredFile::copyFileToStor($upload_dir, $fileName, $tempFileName);
|
||||||
if (isset($result)){
|
if (isset($result)){
|
||||||
|
@ -456,19 +455,19 @@ class ApiController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($show_name)) {
|
if (isset($show_name)) {
|
||||||
|
|
||||||
$show_name = str_replace(" ", "-", $show_name);
|
$show_name = str_replace(" ", "-", $show_name);
|
||||||
|
|
||||||
//2011-12-09-19-28-00-ofirrr-256kbps
|
//2011-12-09-19-28-00-ofirrr-256kbps
|
||||||
$filename = $file->getName();
|
$filename = $file->getName();
|
||||||
|
|
||||||
//replace the showname in the filepath incase it has been edited since the show started recording
|
//replace the showname in the filepath incase it has been edited since the show started recording
|
||||||
//(some old bug)
|
//(some old bug)
|
||||||
$filename_parts = explode("-", $filename);
|
$filename_parts = explode("-", $filename);
|
||||||
$new_name = array_slice($filename_parts, 0, 6);
|
$new_name = array_slice($filename_parts, 0, 6);
|
||||||
$new_name[] = $show_name;
|
$new_name[] = $show_name;
|
||||||
$new_name[] = $filename_parts[count($filename_parts)-1];
|
$new_name[] = $filename_parts[count($filename_parts)-1];
|
||||||
|
|
||||||
$tmpTitle = implode("-", $new_name);
|
$tmpTitle = implode("-", $new_name);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -533,7 +532,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->view->stor = Application_Model_MusicDir::getStorDir()->getDirectory();
|
$this->view->stor = Application_Model_MusicDir::getStorDir()->getDirectory();
|
||||||
|
|
||||||
$watchedDirs = Application_Model_MusicDir::getWatchedDirs();
|
$watchedDirs = Application_Model_MusicDir::getWatchedDirs();
|
||||||
$watchedDirsPath = array();
|
$watchedDirsPath = array();
|
||||||
foreach($watchedDirs as $wd){
|
foreach($watchedDirs as $wd){
|
||||||
|
@ -573,7 +572,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
$filepath = str_replace("//", "/", $filepath);
|
$filepath = str_replace("//", "/", $filepath);
|
||||||
|
|
||||||
$file = Application_Model_StoredFile::RecallByFilepath($filepath);
|
$file = Application_Model_StoredFile::RecallByFilepath($filepath);
|
||||||
|
|
||||||
if (is_null($file)) {
|
if (is_null($file)) {
|
||||||
$file = Application_Model_StoredFile::Insert($md);
|
$file = Application_Model_StoredFile::Insert($md);
|
||||||
}
|
}
|
||||||
|
@ -737,10 +736,10 @@ class ApiController extends Zend_Controller_Action
|
||||||
|
|
||||||
$this->view->msg = Application_Model_MusicDir::setStorDir($path);
|
$this->view->msg = Application_Model_MusicDir::setStorDir($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getStreamSettingAction() {
|
public function getStreamSettingAction() {
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
|
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$api_key = $request->getParam('api_key');
|
$api_key = $request->getParam('api_key');
|
||||||
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
|
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();
|
$this->view->msg = Application_Model_StreamSetting::getStreamSetting();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function statusAction() {
|
public function statusAction() {
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
|
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$api_key = $request->getParam('api_key');
|
$api_key = $request->getParam('api_key');
|
||||||
$getDiskInfo = $request->getParam('diskinfo') == "true";
|
$getDiskInfo = $request->getParam('diskinfo') == "true";
|
||||||
|
@ -767,7 +766,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$status = array(
|
$status = array(
|
||||||
"platform"=>Application_Model_Systemstatus::GetPlatformInfo(),
|
"platform"=>Application_Model_Systemstatus::GetPlatformInfo(),
|
||||||
"airtime_version"=>Application_Model_Preference::GetAirtimeVersion(),
|
"airtime_version"=>Application_Model_Preference::GetAirtimeVersion(),
|
||||||
|
@ -779,11 +778,11 @@ class ApiController extends Zend_Controller_Action
|
||||||
"media_monitor"=>Application_Model_Systemstatus::GetMediaMonitorStatus()
|
"media_monitor"=>Application_Model_Systemstatus::GetMediaMonitorStatus()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($getDiskInfo){
|
if ($getDiskInfo){
|
||||||
$status["partitions"] = Application_Model_Systemstatus::GetDiskInfo();
|
$status["partitions"] = Application_Model_Systemstatus::GetDiskInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->view->status = $status;
|
$this->view->status = $status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -796,40 +795,21 @@ class ApiController extends Zend_Controller_Action
|
||||||
|
|
||||||
Application_Model_ServiceRegister::Register($component, $remoteAddr);
|
Application_Model_ServiceRegister::Register($component, $remoteAddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateLiquidsoapStatusAction(){
|
public function updateLiquidsoapStatusAction(){
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
|
|
||||||
$msg = $request->getParam('msg');
|
$msg = $request->getParam('msg');
|
||||||
$stream_id = $request->getParam('stream_id');
|
$stream_id = $request->getParam('stream_id');
|
||||||
$boot_time = $request->getParam('boot_time');
|
$boot_time = $request->getParam('boot_time');
|
||||||
|
|
||||||
Application_Model_StreamSetting::setLiquidsoapError($stream_id, $msg, $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
|
// handles addition/deletion of mount point which watched dirs reside
|
||||||
public function updateFileSystemMountAction(){
|
public function updateFileSystemMountAction(){
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
|
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$api_key = $request->getParam('api_key');
|
$api_key = $request->getParam('api_key');
|
||||||
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
|
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
|
||||||
|
@ -842,16 +822,16 @@ class ApiController extends Zend_Controller_Action
|
||||||
$params = $request->getParams();
|
$params = $request->getParams();
|
||||||
$added_list = empty($params['added_dir'])?array():explode(',',$params['added_dir']);
|
$added_list = empty($params['added_dir'])?array():explode(',',$params['added_dir']);
|
||||||
$removed_list = empty($params['removed_dir'])?array():explode(',',$params['removed_dir']);
|
$removed_list = empty($params['removed_dir'])?array():explode(',',$params['removed_dir']);
|
||||||
|
|
||||||
// get all watched dirs
|
// get all watched dirs
|
||||||
$watched_dirs = Application_Model_MusicDir::getWatchedDirs(null,null);
|
$watched_dirs = Application_Model_MusicDir::getWatchedDirs(null,null);
|
||||||
|
|
||||||
foreach( $added_list as $ad){
|
foreach( $added_list as $ad){
|
||||||
foreach( $watched_dirs as $dir ){
|
foreach( $watched_dirs as $dir ){
|
||||||
$dirPath = $dir->getDirectory();
|
$dirPath = $dir->getDirectory();
|
||||||
|
|
||||||
$ad .= '/';
|
$ad .= '/';
|
||||||
|
|
||||||
// if mount path itself was watched
|
// if mount path itself was watched
|
||||||
if($dirPath == $ad){
|
if($dirPath == $ad){
|
||||||
Application_Model_MusicDir::addWatchedDir($dirPath, false);
|
Application_Model_MusicDir::addWatchedDir($dirPath, false);
|
||||||
|
@ -884,7 +864,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
// is new mount point within the watched dir?
|
// is new mount point within the watched dir?
|
||||||
// pyinotify doesn't notify anyhing in this case, so we walk through all files within
|
// pyinotify doesn't notify anyhing in this case, so we walk through all files within
|
||||||
// this watched dir in DB and mark them deleted.
|
// 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
|
// compare agaisnt all files in cc_files table
|
||||||
else if(substr($rd, 0, strlen($dirPath)) === $dirPath ){
|
else if(substr($rd, 0, strlen($dirPath)) === $dirPath ){
|
||||||
$watchDir = Application_Model_MusicDir::getDirByPath($rd);
|
$watchDir = Application_Model_MusicDir::getDirByPath($rd);
|
||||||
|
@ -903,13 +883,13 @@ class ApiController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// handles case where watched dir is missing
|
// handles case where watched dir is missing
|
||||||
public function handleWatchedDirMissingAction(){
|
public function handleWatchedDirMissingAction(){
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
|
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$api_key = $request->getParam('api_key');
|
$api_key = $request->getParam('api_key');
|
||||||
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
|
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.';
|
print 'You are not allowed to access this resource.';
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$dir = base64_decode($request->getParam('dir'));
|
$dir = base64_decode($request->getParam('dir'));
|
||||||
Application_Model_MusicDir::removeWatchedDir($dir, false);
|
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.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.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.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.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');
|
$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();
|
$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('is-import-in-progress', 'json')
|
||||||
->addActionContext('change-stream-setting', 'json')
|
->addActionContext('change-stream-setting', 'json')
|
||||||
->addActionContext('get-liquidsoap-status', 'json')
|
->addActionContext('get-liquidsoap-status', 'json')
|
||||||
|
->addActionContext('get-library-datatable', 'json')
|
||||||
|
->addActionContext('set-library-datatable', 'json')
|
||||||
->initContext();
|
->initContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function indexAction()
|
public function indexAction()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
|
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$baseUrl = $request->getBaseUrl();
|
$baseUrl = $request->getBaseUrl();
|
||||||
|
|
||||||
|
@ -59,7 +61,7 @@ class PreferenceController extends Zend_Controller_Action
|
||||||
public function supportSettingAction()
|
public function supportSettingAction()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
|
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$baseUrl = $request->getBaseUrl();
|
$baseUrl = $request->getBaseUrl();
|
||||||
|
|
||||||
|
@ -119,7 +121,7 @@ class PreferenceController extends Zend_Controller_Action
|
||||||
public function directoryConfigAction()
|
public function directoryConfigAction()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
|
|
||||||
if(Application_Model_Preference::GetPlanLevel() == 'disabled'){
|
if(Application_Model_Preference::GetPlanLevel() == 'disabled'){
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$baseUrl = $request->getBaseUrl();
|
$baseUrl = $request->getBaseUrl();
|
||||||
|
@ -136,7 +138,7 @@ class PreferenceController extends Zend_Controller_Action
|
||||||
public function streamSettingAction()
|
public function streamSettingAction()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
|
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$baseUrl = $request->getBaseUrl();
|
$baseUrl = $request->getBaseUrl();
|
||||||
|
|
||||||
|
@ -206,10 +208,10 @@ class PreferenceController extends Zend_Controller_Action
|
||||||
$values['output_sound_device'] = $form->getValue('output_sound_device');
|
$values['output_sound_device'] = $form->getValue('output_sound_device');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$values['icecast_vorbis_metadata'] = $form->getValue('icecast_vorbis_metadata');
|
$values['icecast_vorbis_metadata'] = $form->getValue('icecast_vorbis_metadata');
|
||||||
$values['output_sound_device_type'] = $form->getValue('output_sound_device_type');
|
$values['output_sound_device_type'] = $form->getValue('output_sound_device_type');
|
||||||
$values['streamFormat'] = $form->getValue('streamFormat');
|
$values['streamFormat'] = $form->getValue('streamFormat');
|
||||||
|
|
||||||
}
|
}
|
||||||
if(!$error){
|
if(!$error){
|
||||||
|
@ -331,6 +333,26 @@ class PreferenceController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
die(json_encode($out));
|
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 {
|
#show_builder input.input_text {
|
||||||
width:100px;
|
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 ) {
|
$(document).ready(function() {
|
||||||
|
var oTable;
|
||||||
//call the context menu so we can prevent the event from propagating.
|
|
||||||
$(nRow).find('td:not(.library_checkbox):not(.library_type)').click(function(e){
|
$('.tabs').tabs();
|
||||||
|
|
||||||
$(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;
|
|
||||||
|
|
||||||
oTable = $('#library_display').dataTable( {
|
oTable = $('#library_display').dataTable( {
|
||||||
"bProcessing": true,
|
"bProcessing": true,
|
||||||
"bServerSide": 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",
|
"sAjaxSource": "/Library/contents",
|
||||||
"fnServerData": function ( sSource, aoData, testCallback ) {
|
"fnServerData": function ( sSource, aoData, testCallback ) {
|
||||||
aoData.push( { name: "format", value: "json"} );
|
aoData.push( { name: "format", value: "json"} );
|
||||||
|
@ -293,7 +268,52 @@ function createDataTable(data) {
|
||||||
} );
|
} );
|
||||||
},
|
},
|
||||||
"fnRowCallback": AIRTIME.library.events.fnRowCallback,
|
"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,
|
"fnDrawCallback": AIRTIME.library.events.fnDrawCallback,
|
||||||
"fnHeaderCallback": function(nHead) {
|
"fnHeaderCallback": function(nHead) {
|
||||||
$(nHead).find("input[type=checkbox]").attr("checked", false);
|
$(nHead).find("input[type=checkbox]").attr("checked", false);
|
||||||
|
@ -319,8 +339,7 @@ function createDataTable(data) {
|
||||||
"oLanguage": {
|
"oLanguage": {
|
||||||
"sSearch": ""
|
"sSearch": ""
|
||||||
},
|
},
|
||||||
"iDisplayLength": getNumEntriesPreference(data),
|
|
||||||
|
|
||||||
// R = ColReorder, C = ColVis, T = TableTools
|
// R = ColReorder, C = ColVis, T = TableTools
|
||||||
"sDom": 'Rlfr<"H"T<"library_toolbar"C>>t<"F"ip>',
|
"sDom": 'Rlfr<"H"T<"library_toolbar"C>>t<"F"ip>',
|
||||||
|
|
||||||
|
@ -353,8 +372,7 @@ function createDataTable(data) {
|
||||||
"buttonText": "Show/Hide Columns",
|
"buttonText": "Show/Hide Columns",
|
||||||
"sAlign": "right",
|
"sAlign": "right",
|
||||||
"aiExclude": [0, 1],
|
"aiExclude": [0, 1],
|
||||||
"sSize": "css",
|
"sSize": "css"
|
||||||
"bShowAll": true
|
|
||||||
},
|
},
|
||||||
|
|
||||||
"oColReorder": {
|
"oColReorder": {
|
||||||
|
@ -377,13 +395,6 @@ function createDataTable(data) {
|
||||||
oTT.fnSelectNone();
|
oTT.fnSelectNone();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
|
||||||
$('.tabs').tabs();
|
|
||||||
|
|
||||||
$.ajax({url: "/Api/library-init/format/json", dataType:"json", success:createDataTable,
|
|
||||||
error:function(jqXHR, textStatus, errorThrown){}});
|
|
||||||
|
|
||||||
checkImportStatus();
|
checkImportStatus();
|
||||||
setInterval( checkImportStatus, 5000 );
|
setInterval( checkImportStatus, 5000 );
|
||||||
|
|
|
@ -205,7 +205,7 @@ $(document).ready(function() {
|
||||||
if (aData.header === true) {
|
if (aData.header === true) {
|
||||||
cl = 'sb-header';
|
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);
|
fnPrepareSeparatorRow(sSeparatorHTML, cl, 0);
|
||||||
}
|
}
|
||||||
else if (aData.footer === true) {
|
else if (aData.footer === true) {
|
||||||
|
@ -230,7 +230,7 @@ $(document).ready(function() {
|
||||||
|
|
||||||
node = nRow.children[0];
|
node = nRow.children[0];
|
||||||
if (aData.checkbox === true) {
|
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 {
|
else {
|
||||||
node.innerHTML = '';
|
node.innerHTML = '';
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* File: ColReorder.js
|
* File: ColReorder.js
|
||||||
* Version: 1.0.4
|
* Version: 1.0.5
|
||||||
* CVS: $Id$
|
* CVS: $Id$
|
||||||
* Description: Controls for column visiblity in DataTables
|
* Description: Controls for column visiblity in DataTables
|
||||||
* Author: Allan Jardine (www.sprymedia.co.uk)
|
* 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) */
|
/* Data column sorting (the column which the sort for a given column should take place on) */
|
||||||
for ( i=0, iLen=iCols ; i<iLen ; i++ )
|
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 */
|
/* Update the Get and Set functions for each column */
|
||||||
|
@ -464,12 +468,9 @@ ColReorder.prototype = {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* State saving */
|
/* State saving */
|
||||||
this.s.dt.aoStateSave.push( {
|
this.s.dt.oApi._fnCallbackReg( this.s.dt, 'aoStateSaveParams', function (oS, oData) {
|
||||||
"fn": function (oS, sVal) {
|
that._fnStateSave.call( that, oData );
|
||||||
return that._fnStateSave.call( that, sVal );
|
}, "ColReorder_State" );
|
||||||
},
|
|
||||||
"sName": "ColReorder_State"
|
|
||||||
} );
|
|
||||||
|
|
||||||
/* An initial column order has been specified */
|
/* An initial column order has been specified */
|
||||||
var aiOrder = null;
|
var aiOrder = null;
|
||||||
|
@ -556,72 +557,41 @@ ColReorder.prototype = {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function effectively replaces the state saving function in DataTables (this is needed
|
* Because we change the indexes of columns in the table, relative to their starting point
|
||||||
* because otherwise DataTables would state save the columns in their reordered state, not the
|
* we need to reorder the state columns to what they are at the starting point so we can
|
||||||
* original which is needed on first draw). This is sensitive to any changes in the DataTables
|
* then rearrange them again on state load!
|
||||||
* state saving method!
|
|
||||||
* @method _fnStateSave
|
* @method _fnStateSave
|
||||||
* @param string sCurrentVal
|
* @param object oState DataTables state
|
||||||
* @returns string JSON encoded cookie string for DataTables
|
* @returns string JSON encoded cookie string for DataTables
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
"_fnStateSave": function ( sCurrentVal )
|
"_fnStateSave": function ( oState )
|
||||||
{
|
{
|
||||||
var i, iLen, sTmp;
|
var i, iLen, aCopy, iOrigColumn;
|
||||||
var sValue = sCurrentVal.split('"aaSorting"')[0];
|
|
||||||
var a = [];
|
|
||||||
var oSettings = this.s.dt;
|
var oSettings = this.s.dt;
|
||||||
|
|
||||||
/* Sorting */
|
/* Sorting */
|
||||||
sValue += '"aaSorting":[ ';
|
for ( i=0 ; i<oState.aaSorting.length ; i++ )
|
||||||
for ( i=0 ; i<oSettings.aaSorting.length ; i++ )
|
|
||||||
{
|
{
|
||||||
sValue += '['+oSettings.aoColumns[ oSettings.aaSorting[i][0] ]._ColReorder_iOrigCol+
|
oState.aaSorting[i][0] = oSettings.aoColumns[ oState.aaSorting[i][0] ]._ColReorder_iOrigCol;
|
||||||
',"'+oSettings.aaSorting[i][1]+'"],';
|
|
||||||
}
|
}
|
||||||
sValue = sValue.substring(0, sValue.length-1);
|
|
||||||
sValue += "],";
|
aSearchCopy = $.extend( true, [], oState.aoSearchCols );
|
||||||
|
oState.ColReorder = [];
|
||||||
/* Column filter */
|
|
||||||
for ( i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ )
|
for ( i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ )
|
||||||
{
|
{
|
||||||
a[ oSettings.aoColumns[i]._ColReorder_iOrigCol ] = {
|
iOrigColumn = oSettings.aoColumns[i]._ColReorder_iOrigCol;
|
||||||
"sSearch": encodeURIComponent(oSettings.aoPreSearchCols[i].sSearch),
|
|
||||||
"bRegex": !oSettings.aoPreSearchCols[i].bRegex
|
/* Column filter */
|
||||||
};
|
oState.aoSearchCols[ iOrigColumn ] = aSearchCopy[i];
|
||||||
}
|
|
||||||
|
/* Visibility */
|
||||||
|
oState.abVisCols[ iOrigColumn ] = oSettings.aoColumns[i].bVisible;
|
||||||
|
|
||||||
sValue += '"aaSearchCols":[ ';
|
/* Column reordering */
|
||||||
for ( i=0 ; i<a.length ; i++ )
|
oState.ColReorder.push( iOrigColumn );
|
||||||
{
|
|
||||||
sValue += '["'+a[i].sSearch+'",'+a[i].bRegex+'],';
|
|
||||||
}
|
}
|
||||||
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
|
* @type String
|
||||||
* @default As code
|
* @default As code
|
||||||
*/
|
*/
|
||||||
ColReorder.VERSION = "1.0.4";
|
ColReorder.VERSION = "1.0.5";
|
||||||
ColReorder.prototype.VERSION = ColReorder.VERSION;
|
ColReorder.prototype.VERSION = ColReorder.VERSION;
|
||||||
|
|
||||||
|
|
||||||
|
@ -960,7 +930,7 @@ ColReorder.prototype.VERSION = ColReorder.VERSION;
|
||||||
*/
|
*/
|
||||||
if ( typeof $.fn.dataTable == "function" &&
|
if ( typeof $.fn.dataTable == "function" &&
|
||||||
typeof $.fn.dataTableExt.fnVersionCheck == "function" &&
|
typeof $.fn.dataTableExt.fnVersionCheck == "function" &&
|
||||||
$.fn.dataTableExt.fnVersionCheck('1.8.0') )
|
$.fn.dataTableExt.fnVersionCheck('1.9.0') )
|
||||||
{
|
{
|
||||||
$.fn.dataTableExt.aoFeatures.push( {
|
$.fn.dataTableExt.aoFeatures.push( {
|
||||||
"fnInit": function( oDTSettings ) {
|
"fnInit": function( oDTSettings ) {
|
||||||
|
@ -981,7 +951,7 @@ if ( typeof $.fn.dataTable == "function" &&
|
||||||
}
|
}
|
||||||
else
|
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
|
* File: ColVis.js
|
||||||
* Version: 1.0.7.dev
|
* Version: 1.0.7
|
||||||
* CVS: $Id$
|
* CVS: $Id$
|
||||||
* Description: Controls for column visiblity in DataTables
|
* Description: Controls for column visiblity in DataTables
|
||||||
* Author: Allan Jardine (www.sprymedia.co.uk)
|
* Author: Allan Jardine (www.sprymedia.co.uk)
|
||||||
|
@ -873,7 +873,7 @@ ColVis.prototype = {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Alter the colspan on any fnOpen rows
|
||||||
*/
|
*/
|
||||||
"_fnAdjustOpenRows": function ()
|
"_fnAdjustOpenRows": function ()
|
||||||
{
|
{
|
||||||
|
@ -958,7 +958,7 @@ ColVis.prototype.CLASS = "ColVis";
|
||||||
* @type String
|
* @type String
|
||||||
* @default See code
|
* @default See code
|
||||||
*/
|
*/
|
||||||
ColVis.VERSION = "1.0.7.dev";
|
ColVis.VERSION = "1.0.7";
|
||||||
ColVis.prototype.VERSION = ColVis.VERSION;
|
ColVis.prototype.VERSION = ColVis.VERSION;
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue