Module: nagvis Branch: master Commit: 5a9fbe88ce7ecc0ace6a424f51ad173a1197851e URL: http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=5a9fbe88ce7ecc0ace6a424f51ad173a1197851e
Author: Lars Michelsen <[email protected]> Date: Fri Oct 9 19:37:29 2009 +0200 Added missing url view files --- .../frontend/nagvis-js/classes/FrontendModUrl.php | 78 ++++++++++++++++++++ share/frontend/nagvis-js/classes/NagVisUrlView.php | 77 +++++++++++++++++++ share/userfiles/templates/pages/default.url.html | 8 ++ 3 files changed, 163 insertions(+), 0 deletions(-) diff --git a/share/frontend/nagvis-js/classes/FrontendModUrl.php b/share/frontend/nagvis-js/classes/FrontendModUrl.php new file mode 100644 index 0000000..244b09e --- /dev/null +++ b/share/frontend/nagvis-js/classes/FrontendModUrl.php @@ -0,0 +1,78 @@ +<?php +class FrontendModUrl extends FrontendModule { + private $CORE; + private $name = ''; + private $url = ''; + + public function __construct(GlobalCore $CORE) { + $this->CORE = $CORE; + + $UHANDLER = new CoreUriHandler($this->CORE); + $this->name = $UHANDLER->get('show'); + + // And parse the view specific options + $this->getUrlOptions($UHANDLER); + + $this->aActions = Array( + 'view' => REQUIRES_AUTHORISATION + ); + } + + public function handleAction() { + $sReturn = ''; + + if($this->offersAction($this->sAction)) { + switch($this->sAction) { + case 'view': + // Show the view dialog to the user + $sReturn = $this->showViewDialog(); + break; + } + } + + return $sReturn; + } + + private function getUrlOptions(CoreUriHandler $UHANDLER) { + // FIXME: The array should contain orders for validating the given value + // the options should be validated by the uri handler + + // Parse view specific uri params + $aKeys = Array('url' => ''); + + // Load the specific params to the UriHandler + $UHANDLER->parseModSpecificUri($aKeys); + + // Now get those params + $this->url = $UHANDLER->get('url'); + } + + private function showViewDialog() { + // Only show when map name given + if(!isset($this->url) || $this->url == '') { + //FIXME: Error handling + echo "No url given"; + exit(1); + } + + // Build index template + $INDEX = new NagVisIndexView($this->CORE); + + // Need to parse the header menu? + if($this->CORE->MAINCFG->getValue('index','headermenu')) { + // Parse the header menu + $HEADER = new GlobalHeaderMenu($this->CORE, $this->CORE->MAINCFG->getValue('index', 'headertemplate')); + $INDEX->setHeaderMenu($HEADER->__toString()); + } + + // Initialize map view + $this->VIEW = new NagVisUrlView($this->CORE, $this->url); + $INDEX->setContent($this->VIEW->parse()); + + return $INDEX->parse(); + + //FIXME: Rotation properties not supported atm + //$FRONTEND->addBodyLines($FRONTEND->parseJs('oRotationProperties = '.$FRONTEND->getRotationPropertiesJson(0).';')); + } +} +?> diff --git a/share/frontend/nagvis-js/classes/NagVisUrlView.php b/share/frontend/nagvis-js/classes/NagVisUrlView.php new file mode 100644 index 0000000..015eb3c --- /dev/null +++ b/share/frontend/nagvis-js/classes/NagVisUrlView.php @@ -0,0 +1,77 @@ +<?php +/***************************************************************************** + * + * NagVisUrlView.php - Class for parsing the NagVis urls in nagvis-js frontend + * + * Copyright (c) 2004-2009 NagVis Project (Contact: [email protected]) + * + * License: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + *****************************************************************************/ + +/** + * @author Lars Michelsen <[email protected]> + */ +class NagVisUrlView { + private $CORE = null; + private $url = ''; + private $content = ''; + + /** + * Class Constructor + * + * @param GlobalCore $CORE + * @param String $NAME + * @author Lars Michelsen <[email protected]> + */ + public function __construct(GlobalCore $CORE, $url) { + $this->CORE = $CORE; + + // FIXME: Already validated? + $this->url = $url; + } + + /** + * Set the page content + * + * @author Lars Michelsen <[email protected]> + */ + public function setContent($s) { + $this->content = $s; + } + + /** + * Parses the url and the objects for the nagvis-js frontend + * + * @return String String with JS Code + * @author Lars Michelsen <[email protected]> + */ + public function parse() { + // Initialize template system + $TMPL = New FrontendTemplateSystem($this->CORE); + $TMPLSYS = $TMPL->getTmplSys(); + + $aData = Array( + 'generalProperties' => $this->CORE->MAINCFG->parseGeneralProperties(), + 'workerProperties' => $this->CORE->MAINCFG->parseWorkerProperties(), + 'url' => $this->url + ); + + // Build page based on the template file and the data array + return $TMPLSYS->get($TMPL->getTmplFile('url'), $aData); + } +} +?> diff --git a/share/userfiles/templates/pages/default.url.html b/share/userfiles/templates/pages/default.url.html new file mode 100644 index 0000000..4139a60 --- /dev/null +++ b/share/userfiles/templates/pages/default.url.html @@ -0,0 +1,8 @@ +<div id="url" class="url"></div> +<script type="text/javascript"> +oGeneralProperties = {$generalProperties}; +oWorkerProperties = {$workerProperties}; + +// Kick of the worker +addDOMLoadEvent(function()\{runWorker(0, 'url', '{$url}')}); +</script> ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Nagvis-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nagvis-checkins
