Module: nagvis
Branch: master
Commit: f9d4d7e7c9c6831ffdb4904b75a65bd51cb0bf96
URL:    
http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=f9d4d7e7c9c6831ffdb4904b75a65bd51cb0bf96

Author: LaMi <[email protected]>
Date:   Thu Jan  7 18:15:42 2010 +0100

Added json_decode function to give backward compatibility when using the 
MKLivestatus backend

---

 share/server/core/functions/oldPhpVersionFixes.php |   39 ++++++++++++++++++++
 share/userfiles/templates/default.css              |   25 +++++--------
 2 files changed, 48 insertions(+), 16 deletions(-)

diff --git a/share/server/core/functions/oldPhpVersionFixes.php 
b/share/server/core/functions/oldPhpVersionFixes.php
index b70d7e1..0b218b9 100644
--- a/share/server/core/functions/oldPhpVersionFixes.php
+++ b/share/server/core/functions/oldPhpVersionFixes.php
@@ -86,4 +86,43 @@ if (!function_exists('json_encode')) {
                }
        }
 }
+
+/**
+ * Implements handling of PHP to JSON conversion for NagVis
+ * (Needed for < PHP 5.2.0)
+ *
+ * Function taken from http://de.php.net/json_decode (www at walidator dot 
info 30-May-2009 02:16)
+ * hope thats okay...
+ *
+ * @param   String    Debug message
+ * @author  Lars Michelsen <[email protected]>
+ */
+if(!function_exists('json_decode')){
+       function json_decode($json) { 
+               $comment = false;
+               $out = '$x=';
+               
+               for ($i=0; $i<strlen($json); $i++) {
+                       if(!$comment) {
+                               if($json[$i] == '{') {
+                                       $out .= ' array(';
+                               } elseif($json[$i] == '}') {
+                                       $out .= ')';
+                               } elseif($json[$i] == ':') {
+                                       $out .= '=>';
+                               } else {
+                                       $out .= $json[$i];
+                               }
+                       } else {
+                               $out .= $json[$i];
+                       }
+                       if($json[$i] == '"') {
+                               $comment = !$comment;
+                       }
+               }
+               
+               eval($out . ';');
+               return $x;
+       }
+}
 ?>
diff --git a/share/userfiles/templates/default.css 
b/share/userfiles/templates/default.css
index 2a05208..4ebcd81 100644
--- a/share/userfiles/templates/default.css
+++ b/share/userfiles/templates/default.css
@@ -598,7 +598,7 @@ td#popupWindowContent fieldset.form label {
        margin: 0;
        padding: 0;
        
-       width: 204px;
+       width: 205px;
        list-style: none;
        border-top: none;
 }
@@ -610,29 +610,16 @@ td#popupWindowContent fieldset.form label {
        display: inline
 }
 
-.dropdown li.spacer {
-       height: 4px;
-}
-
-.dropdown li.spacer hr {
-       width:100%;
-       height: 3px;
-       color: #000;
-}
-
 .dropdown img {
        vertical-align: middle;
        margin-left: 10px;
 }
 
-.dropdown a, .dropdown a:active, .dropdown a:visited {
+.dropdown a, .dropdown a:active, .dropdown a:visited, .dropdown li.spacer {
        margin: 0;
-       padding: 0;
        
        display:block;
-       padding-top:5px;
-       padding-bottom:5px;
-       padding-left:5px;
+       padding:5px 0 5px 5px;
        color: #43B3CF;
        text-decoration: none;
        background: #eaf0f2;
@@ -647,6 +634,12 @@ td#popupWindowContent fieldset.form label {
        color:#779D2A;
 }
 
+.dropdown li.spacer hr {
+       width: 195px;
+       margin: 0 5px 0 5px;
+       color: #43B3CF;
+}
+
 .dropdown .underline {
        border-bottom: 1px solid #a4a4a4;
 }


------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to