Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
0bb8e7d211
|
@ -680,7 +680,10 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$this->view->entries = 5;
|
||||
}
|
||||
|
||||
public function getFormAction(){
|
||||
public function getFormAction() {
|
||||
|
||||
$user = Application_Model_User::GetCurrentUser();
|
||||
|
||||
if($user->isUserType(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER)){
|
||||
Application_Model_Schedule::createNewFormSections($this->view);
|
||||
$this->view->form = $this->view->render('schedule/add-show-form.phtml');
|
||||
|
|
|
@ -23,6 +23,24 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
|
||||
$data = Application_Model_Preference::GetValue("library_datatable", true);
|
||||
if ($data != "") {
|
||||
$libraryTable = json_encode(unserialize($data));
|
||||
$this->view->headScript()->appendScript("localStorage.setItem( 'datatables-library', JSON.stringify($libraryTable) );");
|
||||
}
|
||||
else {
|
||||
$this->view->headScript()->appendScript("localStorage.setItem( 'datatables-library', '' );");
|
||||
}
|
||||
|
||||
$data = Application_Model_Preference::GetValue("timeline_datatable", true);
|
||||
if ($data != "") {
|
||||
$timelineTable = json_encode(unserialize($data));
|
||||
$this->view->headScript()->appendScript("localStorage.setItem( 'datatables-timeline', JSON.stringify($timelineTable) );");
|
||||
}
|
||||
else {
|
||||
$this->view->headScript()->appendScript("localStorage.setItem( 'datatables-timeline', '' );");
|
||||
}
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
|
@ -239,6 +257,8 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
|
||||
public function builderFeedAction() {
|
||||
|
||||
$start = microtime(true);
|
||||
|
||||
$request = $this->getRequest();
|
||||
$current_time = time();
|
||||
|
||||
|
@ -257,6 +277,11 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
|
||||
$this->view->schedule = $showBuilder->GetItems();
|
||||
$this->view->timestamp = $current_time;
|
||||
|
||||
$end = microtime(true);
|
||||
|
||||
Logging::debug("getting builder feed info took:");
|
||||
Logging::debug(floatval($end) - floatval($start));
|
||||
}
|
||||
|
||||
public function scheduleAddAction() {
|
||||
|
|
|
@ -53,19 +53,33 @@ class UsersettingsController extends Zend_Controller_Action
|
|||
|
||||
public function setTimelineDatatableAction() {
|
||||
|
||||
$start = microtime(true);
|
||||
|
||||
$request = $this->getRequest();
|
||||
$settings = $request->getParam("settings");
|
||||
|
||||
$data = serialize($settings);
|
||||
Application_Model_Preference::SetValue("timeline_datatable", $data, true);
|
||||
|
||||
$end = microtime(true);
|
||||
|
||||
Logging::debug("saving timeline datatables info took:");
|
||||
Logging::debug(floatval($end) - floatval($start));
|
||||
}
|
||||
|
||||
public function getTimelineDatatableAction() {
|
||||
|
||||
$start = microtime(true);
|
||||
|
||||
$data = Application_Model_Preference::GetValue("timeline_datatable", true);
|
||||
if ($data != "") {
|
||||
$this->view->settings = unserialize($data);
|
||||
}
|
||||
|
||||
$end = microtime(true);
|
||||
|
||||
Logging::debug("getting timeline datatables info took:");
|
||||
Logging::debug(floatval($end) - floatval($start));
|
||||
}
|
||||
|
||||
public function remindmeAction()
|
||||
|
|
|
@ -272,6 +272,8 @@ class Application_Model_Schedule {
|
|||
}
|
||||
|
||||
$sql .= " ORDER BY si.starts, sched.starts;";
|
||||
|
||||
Logging::debug($sql);
|
||||
|
||||
$rows = $CC_DBC->GetAll($sql);
|
||||
return $rows;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
require_once 'Log.php';
|
||||
|
||||
class Application_Model_Scheduler {
|
||||
|
||||
private $con;
|
||||
|
@ -251,11 +253,12 @@ class Application_Model_Scheduler {
|
|||
$itemEndDT = $this->findEndTime($itemStartDT, $item->getDbClipLength());
|
||||
|
||||
$item->setDbStarts($itemStartDT)
|
||||
->setDbEnds($itemEndDT)
|
||||
->save($this->con);
|
||||
->setDbEnds($itemEndDT);
|
||||
|
||||
$itemStartDT = $itemEndDT;
|
||||
}
|
||||
}
|
||||
|
||||
$schedule->save($this->con);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -277,6 +280,8 @@ class Application_Model_Scheduler {
|
|||
}
|
||||
}
|
||||
|
||||
$startProfile = microtime(true);
|
||||
|
||||
foreach ($scheduleItems as $schedule) {
|
||||
$id = intval($schedule["id"]);
|
||||
|
||||
|
@ -301,12 +306,19 @@ class Application_Model_Scheduler {
|
|||
}
|
||||
|
||||
if ($adjustSched === true) {
|
||||
|
||||
$pstart = microtime(true);
|
||||
|
||||
$followingSchedItems = CcScheduleQuery::create()
|
||||
->filterByDBStarts($nextStartDT->format("Y-m-d H:i:s.u"), Criteria::GREATER_EQUAL)
|
||||
->filterByDbInstanceId($instance->getDbId())
|
||||
->filterByDbId($excludeIds, Criteria::NOT_IN)
|
||||
->orderByDbStarts()
|
||||
->find($this->con);
|
||||
|
||||
$pend = microtime(true);
|
||||
Logging::debug("finding all following items.");
|
||||
Logging::debug(floatval($pend) - floatval($pstart));
|
||||
}
|
||||
|
||||
foreach($schedFiles as $file) {
|
||||
|
@ -337,34 +349,55 @@ class Application_Model_Scheduler {
|
|||
}
|
||||
|
||||
if ($adjustSched === true) {
|
||||
|
||||
|
||||
$pstart = microtime(true);
|
||||
|
||||
//recalculate the start/end times after the inserted items.
|
||||
foreach ($followingSchedItems as $item) {
|
||||
|
||||
|
||||
$endTimeDT = $this->findEndTime($nextStartDT, $item->getDbClipLength());
|
||||
|
||||
$item->setDbStarts($nextStartDT);
|
||||
$item->setDbEnds($endTimeDT);
|
||||
$item->save($this->con);
|
||||
|
||||
$nextStartDT = $endTimeDT;
|
||||
$nextStartDT = $endTimeDT;
|
||||
}
|
||||
|
||||
$pend = microtime(true);
|
||||
Logging::debug("adjusting all following items.");
|
||||
Logging::debug(floatval($pend) - floatval($pstart));
|
||||
}
|
||||
}
|
||||
|
||||
$endProfile = microtime(true);
|
||||
Logging::debug("finished adding scheduled items.");
|
||||
Logging::debug(floatval($endProfile) - floatval($startProfile));
|
||||
|
||||
//update the status flag in cc_schedule.
|
||||
$instances = CcShowInstancesQuery::create()
|
||||
->filterByPrimaryKeys($affectedShowInstances)
|
||||
->find($this->con);
|
||||
|
||||
$startProfile = microtime(true);
|
||||
|
||||
foreach ($instances as $instance) {
|
||||
$instance->updateScheduleStatus($this->con);
|
||||
}
|
||||
|
||||
$endProfile = microtime(true);
|
||||
Logging::debug("updating show instances status.");
|
||||
Logging::debug(floatval($endProfile) - floatval($startProfile));
|
||||
|
||||
$startProfile = microtime(true);
|
||||
|
||||
//update the last scheduled timestamp.
|
||||
CcShowInstancesQuery::create()
|
||||
->filterByPrimaryKeys($affectedShowInstances)
|
||||
->update(array('DbLastScheduled' => new DateTime("now", new DateTimeZone("UTC"))), $this->con);
|
||||
|
||||
$endProfile = microtime(true);
|
||||
Logging::debug("updating last scheduled timestamp.");
|
||||
Logging::debug(floatval($endProfile) - floatval($startProfile));
|
||||
}
|
||||
catch (Exception $e) {
|
||||
Logging::debug($e->getMessage());
|
||||
|
@ -407,12 +440,19 @@ class Application_Model_Scheduler {
|
|||
*/
|
||||
public function moveItem($selectedItems, $afterItems, $adjustSched = true) {
|
||||
|
||||
$startProfile = microtime(true);
|
||||
|
||||
$this->con->beginTransaction();
|
||||
$this->con->useDebug(true);
|
||||
|
||||
try {
|
||||
|
||||
$this->validateRequest($selectedItems);
|
||||
$this->validateRequest($afterItems);
|
||||
|
||||
$endProfile = microtime(true);
|
||||
Logging::debug("validating move request took:");
|
||||
Logging::debug(floatval($endProfile) - floatval($startProfile));
|
||||
|
||||
$afterInstance = CcShowInstancesQuery::create()->findPK($afterItems[0]["instance"], $this->con);
|
||||
|
||||
|
@ -450,10 +490,33 @@ class Application_Model_Scheduler {
|
|||
|
||||
//calculate times excluding the to be moved items.
|
||||
foreach ($modifiedMap as $instance => $schedIds) {
|
||||
$startProfile = microtime(true);
|
||||
|
||||
$this->removeGaps($instance, $schedIds);
|
||||
|
||||
$endProfile = microtime(true);
|
||||
Logging::debug("removing gaps from instance $instance:");
|
||||
Logging::debug(floatval($endProfile) - floatval($startProfile));
|
||||
}
|
||||
|
||||
$startProfile = microtime(true);
|
||||
|
||||
$this->insertAfter($afterItems, $movedData, $adjustSched);
|
||||
|
||||
$endProfile = microtime(true);
|
||||
Logging::debug("inserting after removing gaps.");
|
||||
Logging::debug(floatval($endProfile) - floatval($startProfile));
|
||||
|
||||
$afterInstanceId = $afterInstance->getDbId();
|
||||
$modified = array_keys($modifiedMap);
|
||||
//need to adjust shows we have moved items from.
|
||||
foreach($modified as $instanceId) {
|
||||
|
||||
$instance = CcShowInstancesQuery::create()->findPK($instanceId, $this->con);
|
||||
$instance->updateScheduleStatus($this->con);
|
||||
}
|
||||
|
||||
$this->con->useDebug(false);
|
||||
$this->con->commit();
|
||||
|
||||
Application_Model_RabbitMq::PushSchedule();
|
||||
|
|
|
@ -110,6 +110,8 @@ class CcShowInstances extends BaseCcShowInstances {
|
|||
|
||||
//post save hook to update the cc_schedule status column for the tracks in the show.
|
||||
public function updateScheduleStatus(PropelPDO $con) {
|
||||
|
||||
$this->updateDbTimeFilled($con);
|
||||
|
||||
//scheduled track is in the show
|
||||
CcScheduleQuery::create()
|
||||
|
@ -134,6 +136,32 @@ class CcShowInstances extends BaseCcShowInstances {
|
|||
->update(array('DbPlayoutStatus' => 0), $con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes the value of the aggregate column time_filled
|
||||
*
|
||||
* @param PropelPDO $con A connection object
|
||||
*
|
||||
* @return mixed The scalar result from the aggregate query
|
||||
*/
|
||||
public function computeDbTimeFilled(PropelPDO $con)
|
||||
{
|
||||
$stmt = $con->prepare('SELECT SUM(clip_length) FROM "cc_schedule" WHERE cc_schedule.INSTANCE_ID = :p1');
|
||||
$stmt->bindValue(':p1', $this->getDbId());
|
||||
$stmt->execute();
|
||||
return $stmt->fetchColumn();
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the aggregate column time_filled
|
||||
*
|
||||
* @param PropelPDO $con A connection object
|
||||
*/
|
||||
public function updateDbTimeFilled(PropelPDO $con)
|
||||
{
|
||||
$this->setDbTimeFilled($this->computeDbTimeFilled($con));
|
||||
$this->save($con);
|
||||
}
|
||||
|
||||
public function preInsert(PropelPDO $con = null) {
|
||||
$now = new DateTime("now", new DateTimeZone("UTC"));
|
||||
$this->setDbCreated($now);
|
||||
|
|
|
@ -62,17 +62,4 @@ class CcScheduleTableMap extends TableMap {
|
|||
$this->addRelation('CcFiles', 'CcFiles', RelationMap::MANY_TO_ONE, array('file_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
/**
|
||||
*
|
||||
* Gets the list of behaviors registered for this table
|
||||
*
|
||||
* @return array Associative array (name => parameters) of behaviors
|
||||
*/
|
||||
public function getBehaviors()
|
||||
{
|
||||
return array(
|
||||
'aggregate_column_relation' => array('foreign_table' => 'cc_show_instances', 'update_method' => 'updateDbTimeFilled', ),
|
||||
);
|
||||
} // getBehaviors()
|
||||
|
||||
} // CcScheduleTableMap
|
||||
|
|
|
@ -65,17 +65,4 @@ class CcShowInstancesTableMap extends TableMap {
|
|||
$this->addRelation('CcSchedule', 'CcSchedule', RelationMap::ONE_TO_MANY, array('id' => 'instance_id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
/**
|
||||
*
|
||||
* Gets the list of behaviors registered for this table
|
||||
*
|
||||
* @return array Associative array (name => parameters) of behaviors
|
||||
*/
|
||||
public function getBehaviors()
|
||||
{
|
||||
return array(
|
||||
'aggregate_column' => array('name' => 'time_filled', 'expression' => 'SUM(clip_length)', 'foreign_table' => 'cc_schedule', ),
|
||||
);
|
||||
} // getBehaviors()
|
||||
|
||||
} // CcShowInstancesTableMap
|
||||
|
|
|
@ -127,9 +127,6 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
|||
*/
|
||||
protected $alreadyInValidation = false;
|
||||
|
||||
// aggregate_column_relation behavior
|
||||
protected $oldCcShowInstances;
|
||||
|
||||
/**
|
||||
* Applies default values to this object.
|
||||
* This method should be called from the object's constructor (or
|
||||
|
@ -966,8 +963,6 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
|||
$this->postUpdate($con);
|
||||
}
|
||||
$this->postSave($con);
|
||||
// aggregate_column_relation behavior
|
||||
$this->updateRelatedCcShowInstances($con);
|
||||
CcSchedulePeer::addInstanceToPool($this);
|
||||
} else {
|
||||
$affectedRows = 0;
|
||||
|
@ -1491,10 +1486,6 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
|||
*/
|
||||
public function setCcShowInstances(CcShowInstances $v = null)
|
||||
{
|
||||
// aggregate_column_relation behavior
|
||||
if (null !== $this->aCcShowInstances && $v !== $this->aCcShowInstances) {
|
||||
$this->oldCcShowInstances = $this->aCcShowInstances;
|
||||
}
|
||||
if ($v === null) {
|
||||
$this->setDbInstanceId(NULL);
|
||||
} else {
|
||||
|
@ -1628,24 +1619,6 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
|||
$this->aCcFiles = null;
|
||||
}
|
||||
|
||||
// aggregate_column_relation behavior
|
||||
|
||||
/**
|
||||
* Update the aggregate column in the related CcShowInstances object
|
||||
*
|
||||
* @param PropelPDO $con A connection object
|
||||
*/
|
||||
protected function updateRelatedCcShowInstances(PropelPDO $con)
|
||||
{
|
||||
if ($ccShowInstances = $this->getCcShowInstances()) {
|
||||
$ccShowInstances->updateDbTimeFilled($con);
|
||||
}
|
||||
if ($this->oldCcShowInstances) {
|
||||
$this->oldCcShowInstances->updateDbTimeFilled($con);
|
||||
$this->oldCcShowInstances = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Catches calls to virtual methods
|
||||
*/
|
||||
|
|
|
@ -642,90 +642,4 @@ abstract class BaseCcScheduleQuery extends ModelCriteria
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Code to execute before every DELETE statement
|
||||
*
|
||||
* @param PropelPDO $con The connection object used by the query
|
||||
*/
|
||||
protected function basePreDelete(PropelPDO $con)
|
||||
{
|
||||
// aggregate_column_relation behavior
|
||||
$this->findRelatedCcShowInstancess($con);
|
||||
|
||||
return $this->preDelete($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Code to execute after every DELETE statement
|
||||
*
|
||||
* @param int $affectedRows the number of deleted rows
|
||||
* @param PropelPDO $con The connection object used by the query
|
||||
*/
|
||||
protected function basePostDelete($affectedRows, PropelPDO $con)
|
||||
{
|
||||
// aggregate_column_relation behavior
|
||||
$this->updateRelatedCcShowInstancess($con);
|
||||
|
||||
return $this->postDelete($affectedRows, $con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Code to execute before every UPDATE statement
|
||||
*
|
||||
* @param array $values The associatiove array of columns and values for the update
|
||||
* @param PropelPDO $con The connection object used by the query
|
||||
* @param boolean $forceIndividualSaves If false (default), the resulting call is a BasePeer::doUpdate(), ortherwise it is a series of save() calls on all the found objects
|
||||
*/
|
||||
protected function basePreUpdate(&$values, PropelPDO $con, $forceIndividualSaves = false)
|
||||
{
|
||||
// aggregate_column_relation behavior
|
||||
$this->findRelatedCcShowInstancess($con);
|
||||
|
||||
return $this->preUpdate($values, $con, $forceIndividualSaves);
|
||||
}
|
||||
|
||||
/**
|
||||
* Code to execute after every UPDATE statement
|
||||
*
|
||||
* @param int $affectedRows the number of udated rows
|
||||
* @param PropelPDO $con The connection object used by the query
|
||||
*/
|
||||
protected function basePostUpdate($affectedRows, PropelPDO $con)
|
||||
{
|
||||
// aggregate_column_relation behavior
|
||||
$this->updateRelatedCcShowInstancess($con);
|
||||
|
||||
return $this->postUpdate($affectedRows, $con);
|
||||
}
|
||||
|
||||
// aggregate_column_relation behavior
|
||||
|
||||
/**
|
||||
* Finds the related CcShowInstances objects and keep them for later
|
||||
*
|
||||
* @param PropelPDO $con A connection object
|
||||
*/
|
||||
protected function findRelatedCcShowInstancess($con)
|
||||
{
|
||||
$criteria = clone $this;
|
||||
if ($this->useAliasInSQL) {
|
||||
$alias = $this->getModelAlias();
|
||||
$criteria->removeAlias($alias);
|
||||
} else {
|
||||
$alias = '';
|
||||
}
|
||||
$this->ccShowInstancess = CcShowInstancesQuery::create()
|
||||
->joinCcSchedule($alias)
|
||||
->mergeWith($criteria)
|
||||
->find($con);
|
||||
}
|
||||
|
||||
protected function updateRelatedCcShowInstancess($con)
|
||||
{
|
||||
foreach ($this->ccShowInstancess as $ccShowInstances) {
|
||||
$ccShowInstances->updateDbTimeFilled($con);
|
||||
}
|
||||
$this->ccShowInstancess = array();
|
||||
}
|
||||
|
||||
} // BaseCcScheduleQuery
|
||||
|
|
|
@ -2049,34 +2049,6 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
|
|||
$this->aCcFiles = null;
|
||||
}
|
||||
|
||||
// aggregate_column behavior
|
||||
|
||||
/**
|
||||
* Computes the value of the aggregate column time_filled
|
||||
*
|
||||
* @param PropelPDO $con A connection object
|
||||
*
|
||||
* @return mixed The scalar result from the aggregate query
|
||||
*/
|
||||
public function computeDbTimeFilled(PropelPDO $con)
|
||||
{
|
||||
$stmt = $con->prepare('SELECT SUM(clip_length) FROM "cc_schedule" WHERE cc_schedule.INSTANCE_ID = :p1');
|
||||
$stmt->bindValue(':p1', $this->getDbId());
|
||||
$stmt->execute();
|
||||
return $stmt->fetchColumn();
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the aggregate column time_filled
|
||||
*
|
||||
* @param PropelPDO $con A connection object
|
||||
*/
|
||||
public function updateDbTimeFilled(PropelPDO $con)
|
||||
{
|
||||
$this->setDbTimeFilled($this->computeDbTimeFilled($con));
|
||||
$this->save($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Catches calls to virtual methods
|
||||
*/
|
||||
|
|
|
@ -168,11 +168,6 @@
|
|||
instances can be regenerated if we edit the show, which is unwanted behaviour. This column serves
|
||||
to ensure that we don't regenerate the instance. -->
|
||||
<column name="modified_instance" phpName="DbModifiedInstance" type="BOOLEAN" required="true" defaultValue="false" />
|
||||
<behavior name="aggregate_column">
|
||||
<parameter name="name" value="time_filled" />
|
||||
<parameter name="foreign_table" value="cc_schedule" />
|
||||
<parameter name="expression" value="SUM(clip_length)" />
|
||||
</behavior>
|
||||
<foreign-key foreignTable="cc_show" name="cc_show_fkey" onDelete="CASCADE">
|
||||
<reference local="show_id" foreign="id"/>
|
||||
</foreign-key>
|
||||
|
|
|
@ -34,7 +34,7 @@ var AIRTIME = (function(AIRTIME){
|
|||
.data("screen", "timeline");
|
||||
};
|
||||
|
||||
mod.fnDrawCallback = function() {
|
||||
mod.fnDrawCallback = function fnLibDrawCallback() {
|
||||
|
||||
$('#library_display tr:not(:first)').draggable({
|
||||
helper: function(){
|
||||
|
|
|
@ -118,28 +118,21 @@ var AIRTIME = (function(AIRTIME) {
|
|||
},
|
||||
"fnStateSave": function (oSettings, oData) {
|
||||
|
||||
$.ajax({
|
||||
url: "/usersettings/set-library-datatable",
|
||||
type: "POST",
|
||||
data: {settings : oData, format: "json"},
|
||||
dataType: "json"
|
||||
});
|
||||
localStorage.setItem('datatables-library', JSON.stringify(oData));
|
||||
|
||||
$.ajax({
|
||||
url: "/usersettings/set-library-datatable",
|
||||
type: "POST",
|
||||
data: {settings : oData, format: "json"},
|
||||
dataType: "json"
|
||||
});
|
||||
},
|
||||
"fnStateLoad": function (oSettings) {
|
||||
var o;
|
||||
|
||||
$.ajax({
|
||||
url: "/usersettings/get-library-datatable",
|
||||
type: "GET",
|
||||
data: {format: "json"},
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function(json){
|
||||
o = json.settings;
|
||||
}
|
||||
});
|
||||
|
||||
return o;
|
||||
"fnStateLoad": function fnLibStateLoad(oSettings) {
|
||||
var settings = localStorage.getItem('datatables-library');
|
||||
|
||||
if (settings !== "") {
|
||||
return JSON.parse(settings);
|
||||
}
|
||||
},
|
||||
"fnStateLoadParams": function (oSettings, oData) {
|
||||
var i,
|
||||
|
@ -148,13 +141,17 @@ var AIRTIME = (function(AIRTIME) {
|
|||
|
||||
//putting serialized data back into the correct js type to make
|
||||
//sure everything works properly.
|
||||
for (i = 0, length = a.length; i < length; i++) {
|
||||
a[i] = (a[i] === "true") ? true : false;
|
||||
for (i = 0, length = a.length; i < length; i++) {
|
||||
if (typeof(a[i]) === "string") {
|
||||
a[i] = (a[i] === "true") ? true : false;
|
||||
}
|
||||
}
|
||||
|
||||
a = oData.ColReorder;
|
||||
for (i = 0, length = a.length; i < length; i++) {
|
||||
a[i] = parseInt(a[i], 10);
|
||||
for (i = 0, length = a.length; i < length; i++) {
|
||||
if (typeof(a[i]) === "string") {
|
||||
a[i] = parseInt(a[i], 10);
|
||||
}
|
||||
}
|
||||
|
||||
oData.iEnd = parseInt(oData.iEnd, 10);
|
||||
|
@ -516,7 +513,7 @@ var AIRTIME = (function(AIRTIME) {
|
|||
return AIRTIME;
|
||||
|
||||
}(AIRTIME || {}));
|
||||
|
||||
|
||||
function checkImportStatus(){
|
||||
$.getJSON('/Preference/is-import-in-progress', function(data){
|
||||
var div = $('#import_status');
|
||||
|
|
|
@ -177,8 +177,10 @@ var AIRTIME = (function(AIRTIME){
|
|||
delete oData.oSearch;
|
||||
delete oData.aoSearchCols;
|
||||
},
|
||||
"fnStateSave": function (oSettings, oData) {
|
||||
"fnStateSave": function fnStateSave(oSettings, oData) {
|
||||
|
||||
localStorage.setItem('datatables-timeline', JSON.stringify(oData));
|
||||
|
||||
$.ajax({
|
||||
url: "/usersettings/set-timeline-datatable",
|
||||
type: "POST",
|
||||
|
@ -186,21 +188,12 @@ var AIRTIME = (function(AIRTIME){
|
|||
dataType: "json"
|
||||
});
|
||||
},
|
||||
"fnStateLoad": function (oSettings) {
|
||||
var o;
|
||||
|
||||
$.ajax({
|
||||
url: "/usersettings/get-timeline-datatable",
|
||||
type: "GET",
|
||||
data: {format: "json"},
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function(json){
|
||||
o = json.settings;
|
||||
}
|
||||
});
|
||||
|
||||
return o;
|
||||
"fnStateLoad": function fnBuilderStateLoad(oSettings) {
|
||||
var settings = localStorage.getItem('datatables-timeline');
|
||||
|
||||
if (settings !== "") {
|
||||
return JSON.parse(settings);
|
||||
}
|
||||
},
|
||||
"fnStateLoadParams": function (oSettings, oData) {
|
||||
var i,
|
||||
|
@ -210,19 +203,23 @@ var AIRTIME = (function(AIRTIME){
|
|||
//putting serialized data back into the correct js type to make
|
||||
//sure everything works properly.
|
||||
for (i = 0, length = a.length; i < length; i++) {
|
||||
a[i] = (a[i] === "true") ? true : false;
|
||||
if (typeof(a[i]) === "string") {
|
||||
a[i] = (a[i] === "true") ? true : false;
|
||||
}
|
||||
}
|
||||
|
||||
a = oData.ColReorder;
|
||||
for (i = 0, length = a.length; i < length; i++) {
|
||||
a[i] = parseInt(a[i], 10);
|
||||
if (typeof(a[i]) === "string") {
|
||||
a[i] = parseInt(a[i], 10);
|
||||
}
|
||||
}
|
||||
|
||||
oData.iCreate = parseInt(oData.iCreate, 10);
|
||||
},
|
||||
|
||||
"fnServerData": AIRTIME.showbuilder.fnServerData,
|
||||
"fnRowCallback": function ( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
|
||||
"fnRowCallback": function fnRowCallback( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
|
||||
var i,
|
||||
sSeparatorHTML,
|
||||
fnPrepareSeparatorRow,
|
||||
|
@ -233,7 +230,7 @@ var AIRTIME = (function(AIRTIME){
|
|||
$nRow = $(nRow),
|
||||
$image;
|
||||
|
||||
fnPrepareSeparatorRow = function(sRowContent, sClass, iNodeIndex) {
|
||||
fnPrepareSeparatorRow = function fnPrepareSeparatorRow(sRowContent, sClass, iNodeIndex) {
|
||||
|
||||
node = nRow.children[iNodeIndex];
|
||||
node.innerHTML = sRowContent;
|
||||
|
@ -413,7 +410,7 @@ var AIRTIME = (function(AIRTIME){
|
|||
//disable cancelling current show.
|
||||
AIRTIME.button.disableButton("sb-button-cancel");
|
||||
},
|
||||
"fnDrawCallback": function(oSettings, json) {
|
||||
"fnDrawCallback": function fnBuilderDrawCallback(oSettings, json) {
|
||||
var wrapperDiv,
|
||||
markerDiv,
|
||||
$td,
|
||||
|
@ -421,26 +418,40 @@ var AIRTIME = (function(AIRTIME){
|
|||
aData,
|
||||
elements,
|
||||
i, length, temp,
|
||||
$cursorRows;
|
||||
$cursorRows,
|
||||
$table = $(this),
|
||||
$parent = $table.parent(),
|
||||
//use this array to cache DOM heights then we can detach the table to manipulate it to increase speed.
|
||||
heights = [];
|
||||
|
||||
clearTimeout(AIRTIME.showbuilder.timeout);
|
||||
|
||||
//only create the cursor arrows if the library is on the page.
|
||||
if ($lib.length > 0 && $lib.filter(":visible").length > 0) {
|
||||
|
||||
$cursorRows = $sbTable.find("tbody tr.sb-future.sb-allowed:not(.sb-header, .sb-empty)");
|
||||
|
||||
$cursorRows = $sbTable.find("tbody tr:not(.sb-header, .sb-empty, .sb-now-playing, .sb-past, .sb-not-allowed)");
|
||||
//need to get heights of tds while elements are still in the DOM.
|
||||
for (i = 0, length = $cursorRows.length; i < length; i++) {
|
||||
$td = $($cursorRows.get(i)).find("td:first");
|
||||
heights.push($td.height());
|
||||
}
|
||||
|
||||
//create cursor arrows.
|
||||
$cursorRows.each(function(i, el) {
|
||||
$td = $(el).find("td:first");
|
||||
//detach the table to increase speed.
|
||||
$table.detach();
|
||||
|
||||
for (i = 0, length = $cursorRows.length; i < length; i++) {
|
||||
|
||||
$td = $($cursorRows.get(i)).find("td:first");
|
||||
if ($td.hasClass("dataTables_empty")) {
|
||||
$parent.append($table);
|
||||
return false;
|
||||
}
|
||||
|
||||
wrapperDiv = $("<div />", {
|
||||
"class": "innerWrapper",
|
||||
"css": {
|
||||
"height": $td.height()
|
||||
"height": heights[i]
|
||||
}
|
||||
});
|
||||
markerDiv = $("<div />", {
|
||||
|
@ -448,7 +459,7 @@ var AIRTIME = (function(AIRTIME){
|
|||
});
|
||||
|
||||
$td.append(markerDiv).wrapInner(wrapperDiv);
|
||||
});
|
||||
}
|
||||
|
||||
//if there is only 1 cursor on the page highlight it by default.
|
||||
if ($cursorRows.length === 1) {
|
||||
|
@ -457,6 +468,8 @@ var AIRTIME = (function(AIRTIME){
|
|||
$cursorRows.addClass("cursor-selected-row");
|
||||
}
|
||||
}
|
||||
|
||||
$parent.append($table);
|
||||
}
|
||||
|
||||
//order of importance of elements for setting the next timeout.
|
||||
|
|
|
@ -206,6 +206,7 @@ AIRTIME = (function(AIRTIME) {
|
|||
}
|
||||
});
|
||||
|
||||
/*
|
||||
//check if the timeline viewed needs updating.
|
||||
setInterval(function(){
|
||||
var data = {},
|
||||
|
@ -237,6 +238,7 @@ AIRTIME = (function(AIRTIME) {
|
|||
} );
|
||||
|
||||
}, 5 * 1000); //need refresh in milliseconds
|
||||
*/
|
||||
};
|
||||
|
||||
mod.onResize = function() {
|
||||
|
|
Loading…
Reference in New Issue