From 017b23e08c3d17d195a36b0587b29530eca4c29e Mon Sep 17 00:00:00 2001 From: sebastian Date: Wed, 7 Apr 2010 17:30:06 +0000 Subject: [PATCH] #2029 Campcaster-Web: 'Could not connect to scheduler' error message even when scheduler is running --- .../htmlUI/var/templates/scheduler/main.tpl | 2 +- .../htmlUI/var/templates/script/clock.js.tpl | 4 ++-- .../modules/htmlUI/var/templates/statusbar.tpl | 8 ++++++-- .../modules/htmlUI/var/ui_scheduler.class.php | 17 ++++++++++++++++- 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/campcaster/src/modules/htmlUI/var/templates/scheduler/main.tpl b/campcaster/src/modules/htmlUI/var/templates/scheduler/main.tpl index 4818bfee9..a58452466 100644 --- a/campcaster/src/modules/htmlUI/var/templates/scheduler/main.tpl +++ b/campcaster/src/modules/htmlUI/var/templates/scheduler/main.tpl @@ -1,4 +1,4 @@ -{if $SCHEDULER->getErrorMsg()} +{if !$SCHEDULER->getSchedulerTime()} diff --git a/campcaster/src/modules/htmlUI/var/templates/script/clock.js.tpl b/campcaster/src/modules/htmlUI/var/templates/script/clock.js.tpl index cd110f129..312d6c805 100644 --- a/campcaster/src/modules/htmlUI/var/templates/script/clock.js.tpl +++ b/campcaster/src/modules/htmlUI/var/templates/script/clock.js.tpl @@ -16,8 +16,8 @@ function incClock() { {/literal} -myClock({$smarty.now|date_format:"%Y"|string_format:"%d"}, {$smarty.now|date_format:"%m"|string_format:"%d"}, {$smarty.now|date_format:"%d"|string_format:"%d"}, - {$smarty.now|date_format:"%H"|string_format:"%d"}, {$smarty.now|date_format:"%M"|string_format:"%d"}, {$smarty.now|date_format:"%S"|string_format:"%d"}, +myClock({$_now|date_format:"%Y"|string_format:"%d"}, {$_now|date_format:"%m"|string_format:"%d"}, {$_now|date_format:"%d"|string_format:"%d"}, + {$_now|date_format:"%H"|string_format:"%d"}, {$_now|date_format:"%M"|string_format:"%d"}, {$_now|date_format:"%S"|string_format:"%d"}, 1000); diff --git a/campcaster/src/modules/htmlUI/var/templates/statusbar.tpl b/campcaster/src/modules/htmlUI/var/templates/statusbar.tpl index 667d8afa1..c9089c1bf 100644 --- a/campcaster/src/modules/htmlUI/var/templates/statusbar.tpl +++ b/campcaster/src/modules/htmlUI/var/templates/statusbar.tpl @@ -10,8 +10,12 @@
##Station Time## -

{$smarty.now|date_format:"%H:%M:%S"}

- {$smarty.now|date_format:"%Z"} + {assign var="_now value=$SCHEDULER->getSchedulerTime(true)} + {if !$_now} + {assign var="_now" value=$smarty.now} + {/if} +

{$_now|date_format:"%H:%M:%S"}

+ {$_now|date_format:"%Z"}
diff --git a/campcaster/src/modules/htmlUI/var/ui_scheduler.class.php b/campcaster/src/modules/htmlUI/var/ui_scheduler.class.php index 0c07d0fc2..db2566ed2 100644 --- a/campcaster/src/modules/htmlUI/var/ui_scheduler.class.php +++ b/campcaster/src/modules/htmlUI/var/ui_scheduler.class.php @@ -74,7 +74,7 @@ class uiScheduler extends uiCalendar { $this->scheduleAtTime =& $_SESSION[UI_CALENDAR_SESSNAME]['scheduleAtTime']; $this->schedulePrev =& $_SESSION[UI_CALENDAR_SESSNAME]['schedulePrev']; $this->scheduleNext =& $_SESSION[UI_CALENDAR_SESSNAME]['scheduleNext']; - $this->error =& $_SESSION['SCHEDULER']['error']; + #$this->error =& $_SESSION['SCHEDULER']['error']; if (!is_array($this->curr)) { $this->curr['view'] = UI_SCHEDULER_DEFAULT_VIEW; @@ -1261,6 +1261,21 @@ class uiScheduler extends uiCalendar { return $status; } // fn scheduleImportClose + + public function getSchedulerTime() + { + static $first, $cached; + if (!$first) { + $first = time(); + $r = $this->spc->GetSchedulerTimeMethod(); + if ($this->_isError($r)) { + return false; + } + $cached = self::datetimeToTimestamp($r['schedulerTime']); + } + $schedulerTime = $cached + time() - $first; + return $schedulerTime; + } } // class uiScheduler ?>