Don't use Object.isUndefined() unless we know the variable has
authorMichael J. Rubinsky <mrubinsk@horde.org>
Fri, 31 Jul 2009 20:55:35 +0000 (16:55 -0400)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Fri, 31 Jul 2009 20:55:35 +0000 (16:55 -0400)
been declared.

ansel/lib/Ajax/Imple/ImageSaveGeotag.php
ansel/lib/Widget/Geodata.php
kronolith/js/src/views.js

index 49fcadc..3548391 100644 (file)
@@ -89,4 +89,14 @@ class Ansel_Ajax_Imple_ImageSaveGeotag extends Horde_Ajax_Imple_Base
         }
     }
 
+    protected function _point2Deg($value, $lat = false)
+    {
+        $letter = $lat ? ($value > 0 ? "N" : "S") : ($value > 0 ? "E" : "W");
+        $value = abs($value);
+        $deg = floor($value);
+        $min = floor(($value - $deg) * 60);
+        $sec = ($value - $deg - $min / 60) * 3600;
+        return $deg . "&deg; " . $min . '\' ' . round($sec, 2) . '" ' . $letter;
+    }
+
 }
index 3164d97..b4d3e05 100644 (file)
@@ -167,10 +167,11 @@ class Ansel_Widget_Geodata extends Ansel_Widget_Base
                 method: 'post',
                 parameters: params,
                 onComplete: function(transport) {
-                     if (!Object.isUndefined(ToolTips) ) {
-                         ToolTips.out();
+                     if (typeof Horde_ToolTips != 'undefined') {
+                         Horde_ToolTips.out();
                      }
                      if (transport.responseJSON.response == 1) {
+                     alert(transport.responseJSON.response);
                         w = new Element('div');
                         w.appendChild(new Element('div', {id: 'ansel_map'}));
                         ag = new Element('div', {'class': 'ansel_geolocation'});
@@ -210,7 +211,7 @@ class Ansel_Widget_Geodata extends Ansel_Widget_Base
             map = new Ansel_GMap(options);
             map.getLocationCallback_ = map.getLocationCallback;
             map.getLocationCallback = function(points, marker) {
-                map.getLocationCallback_(points, marker, Object.isUndefined(points.NoUpdate));
+                map.getLocationCallback_(points, marker, (typeof points.NoUpdate == 'undefined'));
             }.bind(map);
             map.addPoints(points);
             map.display();
index e19e2a7..eb3e90f 100644 (file)
@@ -28,7 +28,7 @@ var Views = {
 
 function ShowView(view, date, cache)
 {
-    if (Object.isUndefined(Ajax.Updater)) {
+    if (typeof Ajax.Updater == 'undefined') {
         return true;
     }
 
@@ -72,7 +72,7 @@ function _ShowView()
     if (Object.isFunction(stripeAllElements)) {
         stripeAllElements();
     }
-    if (!Object.isUndefined(Horde_ToolTips)) {
+    if (typeof Horde_ToolTips != 'undefined') {
         Horde_ToolTips.out();
         Horde_ToolTips.attachBehavior();
     }