Module: nagvis
Branch: master
Commit: 3c08ff300350b946d80a32bfa769acf1f3c238ae
URL:    
http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis/commit/?id=3c08ff300350b946d80a32bfa769acf1f3c238ae

Author: Roman Kyrylych <[email protected]>
Date:   Thu Aug 13 17:26:39 2009 +0300

gmap: Added a new Settings class

Signed-off-by: Roman Kyrylych <[email protected]>

---

 share/netmap/Settings.php                |   69 ++++++++++++++++++++++++++++++
 share/netmap/amf-server.php              |    1 +
 uifx/src/modules/gmap/domain/Settings.as |   20 +++++++++
 3 files changed, 90 insertions(+), 0 deletions(-)

diff --git a/share/netmap/Settings.php b/share/netmap/Settings.php
new file mode 100644
index 0000000..bc43482
--- /dev/null
+++ b/share/netmap/Settings.php
@@ -0,0 +1,69 @@
+<?php
+
+/*****************************************************************************
+ *
+ * Copyright (C) 2009 NagVis Project
+ *
+ * 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.
+ *
+ *****************************************************************************/
+
+class Settings
+{
+       public $googleMapsKey;
+       public $defaultLocationAction;
+       public $openLinksInNewWindow;
+
+       public function __construct($googleMapsKey = "", $defaultLocationAction 
= "", $openLinksInNewWindow = false)
+       {
+               $this->googleMapsKey = $googleMapsKey;
+               $this->defaultLocationAction = $defaultLocationAction;
+               $this->openLinksInNewWindow = $openLinksInNewWindow;
+       }
+
+       /**
+        * @return array of Settings
+        */
+       public function load()
+       {
+               if (($xml = @simplexml_load_file('settings.xml')) === FALSE)
+                       throw new Exception('Could not read settings.xml');
+
+               return new Settings((string)$xml['googleMapsKey'],
+                               (string)$xml['defaultLocationAction'],
+                               (boolean)$xml['openLinksInNewWindow']);
+       }
+
+       /**
+        * @param  Settings $settings
+        * @return Settings
+        */
+       public function save($settings)
+       {
+               $xml = new SimpleXMLElement('<?xml version="1.0" 
standalone="yes"?>\n<settings/>\n');
+
+               $xml->addAttribute('googleMapsKey', $settings->googleMapsKey);
+               $xml->addAttribute('defaultLocationAction', 
$settings->defaultLocationAction);
+               $xml->addAttribute('openLinksInNewWindow', 
$settings->openLinksInNewWindow);
+
+               if (file_put_contents('settings.xml', $xml->asXML()) !== FALSE)
+                       return $settings;
+               else
+                       throw new Exception('Could not write settings.xml');
+    }
+}
+
+?>
diff --git a/share/netmap/amf-server.php b/share/netmap/amf-server.php
index 9965bd2..7bbf07b 100644
--- a/share/netmap/amf-server.php
+++ b/share/netmap/amf-server.php
@@ -42,6 +42,7 @@ class Custom_Zend_Amf_Server extends Zend_Amf_Server
 }
 
 $server = new Custom_Zend_Amf_Server();
+$server->setClassMap("Settings", "Settings");
 $server->setClassMap("Viewpoint", "Viewpoint");
 $server->setClassMap("Location", "Location");
 $server->setClassMap("Link", "Link");
diff --git a/uifx/src/modules/gmap/domain/Settings.as 
b/uifx/src/modules/gmap/domain/Settings.as
new file mode 100644
index 0000000..af39e7a
--- /dev/null
+++ b/uifx/src/modules/gmap/domain/Settings.as
@@ -0,0 +1,20 @@
+package modules.gmap.domain

+{

+       [Bindable]

+       [RemoteClass(alias="Settings")]

+       public class Settings

+       {

+               public var googleMapsKey : String;

+               public var defaultLocationAction : String;

+               public var openLinksInNewWindow : Boolean;

+

+               public function Settings(googleMapsKey : String = "",

+                       defaultLocationAction : String = "",

+                       openLinksInNewWindow : Boolean = false) : void

+               {

+                       this.googleMapsKey = googleMapsKey;

+                       this.defaultLocationAction = defaultLocationAction;

+                       this.openLinksInNewWindow = openLinksInNewWindow;

+               }

+       }

+}



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to