[pLog-svn] r4696 - in plog/trunk: class/action class/action/admin class/controller class/dao class/template/smarty/plugins js/location js/ui templates/admin templates/misc templates/standard

oscar at devel.lifetype.net oscar at devel.lifetype.net
Wed Feb 7 18:27:38 EST 2007


Author: oscar
Date: 2007-02-07 18:27:37 -0500 (Wed, 07 Feb 2007)
New Revision: 4696

Added:
   plog/trunk/class/action/admin/adminlocationdisplay.class.php
   plog/trunk/js/ui/overlay.js
Modified:
   plog/trunk/class/action/admin/adminaddpostaction.class.php
   plog/trunk/class/action/admin/adminaddresourceaction.class.php
   plog/trunk/class/action/admin/adminupdateblogsettingsaction.class.php
   plog/trunk/class/action/locationdisplay.class.php
   plog/trunk/class/controller/admincontrollermap.properties.php
   plog/trunk/class/dao/locationawaredbobject.class.php
   plog/trunk/class/template/smarty/plugins/function.location_chooser.php
   plog/trunk/class/template/smarty/plugins/function.location_display.php
   plog/trunk/js/location/location.js
   plog/trunk/templates/admin/header.template
   plog/trunk/templates/admin/resourceinfo.template
   plog/trunk/templates/admin/resources.template
   plog/trunk/templates/misc/location.template
   plog/trunk/templates/standard/footer.template
   plog/trunk/templates/standard/header.template
   plog/trunk/templates/standard/post.template
   plog/trunk/templates/standard/resource.template
Log:
some more changes to 1.3


Modified: plog/trunk/class/action/admin/adminaddpostaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddpostaction.class.php	2007-02-06 22:00:44 UTC (rev 4695)
+++ plog/trunk/class/action/admin/adminaddpostaction.class.php	2007-02-07 23:27:37 UTC (rev 4696)
@@ -84,12 +84,19 @@
 			// location data, if necessary
 			// check if we have to save the location data
 			$config =& Config::getConfig();
-			if(( $config->getValue( "location_data_enabled", false )) && ($this->_request->getValue( "locationId") != "0" )) {
-				include_once( PLOG_CLASS_PATH."class/dao/locations.class.php" );
-				$locations = new Locations();
-				$coords = split(",", $this->_request->getValue( "locationId" ));
-				$location = $locations->getLocationAddIfNotFound( $coords[0], $coords[1], $this->_blogInfo->getId(), $this->_request->getValue( "locationDesc" ));
-				$article->setLocation( $location );
+			if( $config->getValue( "location_data_enabled", false )) {
+				if ($this->_request->getValue( "locationId") == "0" ) {
+					// no location set
+					$this->_blogInfo->setLocationId( 0 );
+				}
+				else {
+					// otherwise check the location data
+					include_once( PLOG_CLASS_PATH."class/dao/locations.class.php" );
+					$locations = new Locations();
+					$coords = split(",", $this->_request->getValue( "locationId" ));
+					$location = $locations->getLocationAddIfNotFound( $coords[0], $coords[1], $this->_blogInfo->getId(), $this->_request->getValue( "locationDesc" ));
+					$this->_blogInfo->setLocation( $location );
+				}
 			}					
 			
 			// in case the post is already in the db

Modified: plog/trunk/class/action/admin/adminaddresourceaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddresourceaction.class.php	2007-02-06 22:00:44 UTC (rev 4695)
+++ plog/trunk/class/action/admin/adminaddresourceaction.class.php	2007-02-07 23:27:37 UTC (rev 4696)
@@ -112,12 +112,19 @@
 					
 					// check if we have to save the location data
 					$config =& Config::getConfig();
-					if(( $config->getValue( "location_data_enabled", false )) && ($this->_request->getValue( "locationId") != "0" )) {
-						$locations = new Locations();
-						$coords = split(",", $this->_request->getValue( "locationId" ));
-						$location = $locations->getLocationAddIfNotFound( $coords[0], $coords[1], $this->_blogInfo->getId(), $this->_request->getValue( "locationDesc" ));
-						$resource->setLocation( $location );
-						$resources->updateResource( $resource );
+					if( $config->getValue( "location_data_enabled", false )) {
+						if ($this->_request->getValue( "locationId") == "0" ) {
+							// no location set
+							$this->_blogInfo->setLocationId( 0 );
+						}
+						else {
+							// otherwise check the location data
+							include_once( PLOG_CLASS_PATH."class/dao/locations.class.php" );
+							$locations = new Locations();
+							$coords = split(",", $this->_request->getValue( "locationId" ));
+							$location = $locations->getLocationAddIfNotFound( $coords[0], $coords[1], $this->_blogInfo->getId(), $this->_request->getValue( "locationDesc" ));
+							$this->_blogInfo->setLocation( $location );
+						}
 					}
 					
 					$this->notifyEvent( EVENT_POST_RESOURCE_ADD, Array( "resource" => &$resource ));					

Added: plog/trunk/class/action/admin/adminlocationdisplay.class.php
===================================================================
--- plog/trunk/class/action/admin/adminlocationdisplay.class.php	                        (rev 0)
+++ plog/trunk/class/action/admin/adminlocationdisplay.class.php	2007-02-07 23:27:37 UTC (rev 4696)
@@ -0,0 +1,22 @@
+<?php
+
+	lt_include( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/view/locationview.class.php" );
+	
+	class AdminLocationDisplayAction extends AdminAction
+	{
+		function perform()
+		{
+			$c = $this->_request->getValue( "c" );
+			$data = split(",", $c );
+			$lat = $data[0];
+			$long = $data[1];
+			$desc = $this->_request->getValue( "desc" );
+			
+			$this->_view = new LocationView( $this->_blogInfo );
+			$this->_view->setLatitude( $lat );
+			$this->_view->setLongitude( $long );
+			$this->_view->setDescription($desc );
+		}
+	}
+?>
\ No newline at end of file

Modified: plog/trunk/class/action/admin/adminupdateblogsettingsaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdateblogsettingsaction.class.php	2007-02-06 22:00:44 UTC (rev 4695)
+++ plog/trunk/class/action/admin/adminupdateblogsettingsaction.class.php	2007-02-07 23:27:37 UTC (rev 4696)
@@ -175,12 +175,19 @@
 
 			// check if we have to save the location data
 			$config =& Config::getConfig();
-			if(( $config->getValue( "location_data_enabled", false )) && ($this->_request->getValue( "locationId") != "0" )) {
-				include_once( PLOG_CLASS_PATH."class/dao/locations.class.php" );
-				$locations = new Locations();
-				$coords = split(",", $this->_request->getValue( "locationId" ));
-				$location = $locations->getLocationAddIfNotFound( $coords[0], $coords[1], $this->_blogInfo->getId(), $this->_request->getValue( "locationDesc" ));
-				$this->_blogInfo->setLocation( $location );
+			if( $config->getValue( "location_data_enabled", false )) {
+				if ($this->_request->getValue( "locationId") == "0" ) {
+					// no location set
+					$this->_blogInfo->setLocationId( 0 );
+				}
+				else {
+					// otherwise check the location data
+					include_once( PLOG_CLASS_PATH."class/dao/locations.class.php" );
+					$locations = new Locations();
+					$coords = split(",", $this->_request->getValue( "locationId" ));
+					$location = $locations->getLocationAddIfNotFound( $coords[0], $coords[1], $this->_blogInfo->getId(), $this->_request->getValue( "locationDesc" ));
+					$this->_blogInfo->setLocation( $location );
+				}
 			}
 
             // and now update the settings in the database

Modified: plog/trunk/class/action/locationdisplay.class.php
===================================================================
--- plog/trunk/class/action/locationdisplay.class.php	2007-02-06 22:00:44 UTC (rev 4695)
+++ plog/trunk/class/action/locationdisplay.class.php	2007-02-07 23:27:37 UTC (rev 4696)
@@ -21,6 +21,9 @@
 			$this->_view->setLongitude( $location->getLongitude());
 			$this->_view->setDescription( $location->getDescription());
 			
+			$this->_view->setWidth( $this->_request->getValue( "width" ));
+			$this->_view->setHeight( $this->_request->getValue( "height" ));
+			
 			$this->setCommonData();
 			
 			return( true );

Modified: plog/trunk/class/controller/admincontrollermap.properties.php
===================================================================
--- plog/trunk/class/controller/admincontrollermap.properties.php	2007-02-06 22:00:44 UTC (rev 4695)
+++ plog/trunk/class/controller/admincontrollermap.properties.php	2007-02-07 23:27:37 UTC (rev 4696)
@@ -318,4 +318,5 @@
 	$actions["updatePluginSettings"] = "AdminUpdatePluginSettingsAction";	
 	// location chooser
 	$actions['locationChooser'] = 'AdminLocationChooserAction';
+	$actions['adminLocationDisplay'] = 'AdminLocationDisplayAction';
 ?>
\ No newline at end of file

Modified: plog/trunk/class/dao/locationawaredbobject.class.php
===================================================================
--- plog/trunk/class/dao/locationawaredbobject.class.php	2007-02-06 22:00:44 UTC (rev 4695)
+++ plog/trunk/class/dao/locationawaredbobject.class.php	2007-02-07 23:27:37 UTC (rev 4696)
@@ -16,7 +16,7 @@
 		 */
 		function getLocation()
 		{
-			if( $this->_location === null ) {
+			if( $this->_location === null && $this->_locationId != 0 ) {
 				include_once( PLOG_CLASS_PATH."class/dao/locations.class.php" );
 				$locations = new Locations();
 				$this->_location = $locations->getLocation( $this->getLocationId());

Modified: plog/trunk/class/template/smarty/plugins/function.location_chooser.php
===================================================================
--- plog/trunk/class/template/smarty/plugins/function.location_chooser.php	2007-02-06 22:00:44 UTC (rev 4695)
+++ plog/trunk/class/template/smarty/plugins/function.location_chooser.php	2007-02-07 23:27:37 UTC (rev 4696)
@@ -34,7 +34,9 @@
 	// whether to use the location display icon next to the drop-down list
 	isset( $params["showDisplayLink"]) ? $showDisplayLink = true : $showDisplayLink = false;
 	
-	$code = "<select name=\"locationId\" id=\"locationId\" onChange=\"if(this.options[this.selectedIndex].value == 0) window.open('?op=locationChooser','Location Chooser','scrollbars=no,resizable=no,toolbar=no,height=530,width=590');\">";
+	$code = "<select name=\"locationId\" id=\"locationId\" onChange=\"if(this.options[this.selectedIndex].value == -1) window.open('?op=locationChooser','Location Chooser','scrollbars=no,resizable=no,toolbar=no,height=530,width=590');\">";
+	$code .= "<option value=\"0\"";
+	$code .= ">None</option>";	
 	foreach( $locs as $loc ) {
 		$code .= "<option value=\"".$loc->getLatitude().",".$loc->getLongitude()."\"";
 		if( $default ) {
@@ -48,25 +50,25 @@
 	}
     
     if( count( $locs ) == 0 )
-        $code .= "<option value=\"0\">-- Select --</option>";
+        $code .= "<option value=\"-1\">-- Select --</option>";
     
-	$code .= "<option value=\"0\">$addNewString</option>";
+	$code .= "<option value=\"-1\">$addNewString</option>";
     $code .= " </select>";
 
 	if( $showDisplayLink ) {
 		$code .= "<script type=\"text/javascript\">
 		  function displaySelectedLocation() {
 			list = document.getElementById('locationId');
-			if( list.options[list.selectedIndex].value == -1 )
+			if( list.options[list.selectedIndex].value == 0 )
 				return false;
 			coords = list.options[list.selectedIndex].value;
 			text = list.options[list.selectedIndex].text;
-			url = '?op=locationDisplay&c=' + coords + '&desc=' + text;
+			url = '?op=adminLocationDisplay&c=' + coords + '&desc=' + text;
 			window.open(url,'Location Viewer','scrollbars=no,resizable=no,toolbar=no,height=500,width=590');
 		  }
 		 </script> 
 		";
-		$code .= "&nbsp;<a href=\"#\" onClick=\"displaySelectedLocation()\"><img src=\"imgs/admin/icon_globe-16.png\" alt=\"Location Display\" style=\"border:0px\" /></a>";
+		$code .= "&nbsp;<a href=\"#\" onClick=\"displaySelectedLocation();return false;\"><img src=\"imgs/admin/icon_globe-16.png\" alt=\"Location Display\" style=\"border:0px\" /></a>";
 	}
 
     $code .= "<input type=\"hidden\" name=\"locationDesc\" id=\"locationDesc\" value=\"\" />

Modified: plog/trunk/class/template/smarty/plugins/function.location_display.php
===================================================================
--- plog/trunk/class/template/smarty/plugins/function.location_display.php	2007-02-06 22:00:44 UTC (rev 4695)
+++ plog/trunk/class/template/smarty/plugins/function.location_display.php	2007-02-07 23:27:37 UTC (rev 4696)
@@ -16,19 +16,29 @@
 	if( isset( $smarty->_tpl_vars["blog"] )) {
 		$blog = $smarty->_tpl_vars["blog"];
 		$url = $blog->getBlogRequestGenerator();
-		$baseUrl = $url->getIndexUrl();
+		$indexUrl = $url->getIndexUrl();
+		$baseUrl = $url->getBaseUrl();
 	}
 	else {
 		include_once( PLOG_CLASS_PATH."class/config/config.class.php" );
 		$baseUrl = $config->getValue( "base_url" );
 		if(( $scriptName = $config->getValue( "script_name" )) == "" )
 			$scriptName = "index.php";
-		$baseUrl = $baseUrl + "/".$scriptName;
+		$ndexUrl = $baseUrl + "/".$scriptName;
 	}
-
-	$code = "window.open('".$baseUrl."?op=locationDisplay&amp;locId=".$location->getId()."',".
-	       "'Location Viewer','scrollbars=no,resizable=no,toolbar=no,height=500,width=590')";
 	
+	isset( $params["width"] ) ? $width = $params["width"] : $width = 390;
+	isset( $params["height"] ) ? $height = $params["height"] : $height = 390;	
+	
+	// random name for the object, in case we've got more than one per page
+	$o = "o_".md5(time);
+	
+	$code = "<script type=\"text/javascript\" src=\"{$baseUrl}/js/yui/yahoo/yahoo-min.js\"></script>";
+	$code .= "<script type=\"text/javascript\" src=\"{$baseUrl}/js/yui/dom/dom-min.js\"></script>";
+	$code .= "<script type=\"text/javascript\" src=\"{$baseUrl}/js/yui/event/event-min.js\"></script>";
+	$code .= "<a id=\"$o\" href=\"#\">".$location->getDescription()."</a>";
+	$code .= "<script type=\"text/javascript\">$o=new LtOverlay({url:'".$indexUrl."?op=locationDisplay&width=".$width."&height=".$height."&locId=".$location->getId()."',width:".$width.",height:".$height.",context:'$o',showCloseButton:true});</script>";
+	
 	return( $code );
 }
 ?>
\ No newline at end of file

Modified: plog/trunk/js/location/location.js
===================================================================
--- plog/trunk/js/location/location.js	2007-02-06 22:00:44 UTC (rev 4695)
+++ plog/trunk/js/location/location.js	2007-02-07 23:27:37 UTC (rev 4696)
@@ -10,6 +10,11 @@
 var useCustomLocationControl = true;
 
 /**
+ * Whether to show the little display with the latitude and the longitude
+ */
+var useCustomLatitudeAndLongitudeDisplay = true;
+
+/**
  * Array of predefined locations to show in the custom control
  */
 var locations = new Array(
@@ -29,6 +34,7 @@
 var markerAdded = false;
 var markerLat = 0;
 var markerLong = 0;
+var markerDesc = "";
 var globalMarker = new GMarker( new GLatLng(0,0));
 
 /**
@@ -44,6 +50,9 @@
 
 function LocationChooserClickHandler( marker, point ) 
 {
+	if( !point )
+		return;
+
   // remove the marker if it was already there
   if( markerMode != 1 ) {
 	  lat = document.getElementById('lat');
@@ -68,6 +77,18 @@
 	      map.addOverlay( globalMarker );
 		  markerAdded = true;
 		  map.setCenter( point );	
+		  if( markerDesc ) {
+			markerDesc = markerDesc + "<br/>" + markerLat + ", " + markerLong;
+		  }
+		  else {
+			markerDesc = 
+			markerDesc = markerLat + ", " + markerLong;
+		  }
+		  // add the info window
+		GEvent.addListener(globalMarker, "click", function() {
+	    	globalMarker.openInfoWindowHtml( markerDesc );
+	  	});		
+		globalMarker.openInfoWindowHtml( markerDesc );		
 	  }
    }
 }
@@ -85,6 +106,9 @@
 	else { 
     	map.setCenter( new GLatLng(37.160316, -38.671875), 2 );
 	}
+	
+	// loop over all the locations and add them to the map as info windows
+	
 		
 
 	// add two controls to our map
@@ -92,6 +116,8 @@
 	map.addControl(new GMapTypeControl());
 	if( useCustomLocationControl )
 		map.addControl(new LifetypeLocationSelectorControl());
+	if( useCustomLatitudeAndLongitudeDisplay ) 
+		map.addControl(new LifetypeLatitudeAndLongitudeDisplayControl());
 	
 	// add a click listener
 	if( !displayOnlyMode ) {
@@ -120,54 +146,6 @@
    }
 }
 
-/** 
- * Jumps to the current position of the marker
- */
-function LocationChooserGotoMarker()
-{
-   if( !markerAdded )  {
-      window.alert( locationLocaleNoMarkerHasBeenSetYet );
-      return false;	
-   }
-
-   // if the marker is already in place, jump to it
-   map.setCenter( globalMarker );
-}
-
-/**
- * Pass the location data back to the calling window
- */
-function LocationChooserSetLocation()
-{
-	if( !markerAdded ) {
-		window.alert( locationLocaleNoMarkerHasBeenSetYet );
-		return false;
-	}
-	
-	// is the current location one of the pre-defined ones?
-	for( i = 0; i < locations.length; i++ ) {
-		
-	}
-	
-	// fill in all the fields that the form is expecting
-	locationLatitude = parent.opener.document.getElementById("locationLatitude");
-	locationLatitude.value = markerLat;
-	
-	locationLongitude = parent.opener.document.getElementById("locationLongitude");
-	locationLongitude.value = markerLong;
-	
-	locationLatLong = parent.opener.document.getElementById("locationLatLong");
-	locationLatLong.value = markerLat + "," + markerLong;
-	
-	locationId = parent.opener.document.getElementById("locationId");
-	locationId.value = '';
-	
-	locationDesc = parent.opener.document.getElementById("locationDesc");
-	locationDesc.value = '';
-	
-	return( true );
-}
-
 function LocationChooserAddLocation()
 {
 	if( !markerAdded ) {
@@ -274,4 +252,42 @@
 // map with 7 pixels of padding.
 LifetypeLocationSelectorControl.prototype.getDefaultPosition = function() {
   return new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(7, 7));
+}
+
+/////
+// shows the latitude and longitude on the top right corner
+////
+function LifetypeLatitudeAndLongitudeDisplayControl() {
+}
+
+LifetypeLatitudeAndLongitudeDisplayControl.prototype = new GControl();
+
+// Creates a one DIV for each of the buttons and places them in a container
+// DIV which is returned as our control element. We add the control to
+// to the map container and return the element for the map class to
+// position properly.
+LifetypeLatitudeAndLongitudeDisplayControl.prototype.initialize = function(map) {
+  var container = document.createElement("div");
+
+  text = document.createElement( "input" );
+  text.type = "text";
+  text.id = "latlong";
+
+  // add an onclick event
+  GEvent.addDomListener( map, "mousemove", function() {
+    latlong = document.getElementById( "latlong" );
+    d = new Date();
+	latlong.value = d.getTime();
+  });
+
+  // add the container to the map
+  container.appendChild( text );
+  map.getContainer().appendChild(container);
+  return container;
+}
+
+// By default, the control will appear in the top left corner of the
+// map with 7 pixels of padding.
+LifetypeLatitudeAndLongitudeDisplayControl.prototype.getDefaultPosition = function() {
+  return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(7, 7));
 }
\ No newline at end of file

Added: plog/trunk/js/ui/overlay.js
===================================================================
--- plog/trunk/js/ui/overlay.js	                        (rev 0)
+++ plog/trunk/js/ui/overlay.js	2007-02-07 23:27:37 UTC (rev 4696)
@@ -0,0 +1,188 @@
+/**
+ * @params object:
+ * { url: "xxx", width: xxx, height: xxx, context: element_id, showCloseButton:true|false }
+ *
+ */
+LtOverlay = function( params )
+{
+	// store the parameters as an attribute
+	this.params = params;
+	
+	// our container
+	this.container = null;
+	
+	// object name, so that we can reference it later
+	this.name = this.params.name;
+	
+	// attach to the onClick event of the context object. This method call is extremely handy because
+	// it will automatically transform 'this' in the event handler to the object that is passed as the fourth
+	// parameter, which means that 'this' refers to the LtOverlay object instead of referring to the element
+	// that generated the event
+	this.context = params.context;		
+	YAHOO.util.Event.addListener( this.context, "click", this.toggle, this, true );
+}
+
+/**
+ * enable/disable the pop-up whenever a mouse button is clicked
+ *
+ * @param e The event that was generated
+ * @param obj The object, so that 'this' actually points to this object.
+ */ 	
+LtOverlay.prototype.toggle = function( e, obj )
+{	
+	if( !this.container ) {
+		// render our LtOverlay if it hasn't been rendered yet
+		this.render();
+	}
+
+	// otherwise toggle its visibility status
+	if( this.container.style.display == "block" ) {
+		this.container.style.display = "none";
+	}
+	else {	
+		// is there enough space until the bottom of the page to display the pop-up downwards?		
+		winSize = this.getWindowSize();
+		y = this.mouseY(e);
+		x = this.mouseX(e);
+		if( y + 4 + this.params.height > winSize.height ) {
+			// display the pop-up upwards instead of downwards, unless there is no space upwards either...
+			top = (y - 8 - this.params.height);			
+			if( top < 0 ) {
+				// in that case we can show it as high as the screen goes
+				top = 0;
+			}
+		}
+		else {
+			top = y + 4;
+		}
+		
+		// is there enough space on the right hand side?
+		if( x + 4 + this.params.width > winSize.width ) {
+			left = (x - 8 - this.params.width);
+		}
+		else {
+			 left = x + 4;		
+		}
+				
+		this.container.style.display = "block";				
+		this.container.style.position = "absolute";
+		this.container.style.top = top + "px";
+		this.container.style.left = left + "px";
+	}
+	
+	// this method is called from the onclick event so we have to return false so that
+	// the browser ignores the bogus link in the href
+	return( false );
+}
+	
+/**
+ * Renders the pop-up. There is no need to call this function directly unless you want
+ * to get the popup called right away. Otherwise everything will be handled by the
+ * onClick event and the toggle() method
+ */
+LtOverlay.prototype.render = function()
+{	
+	// create the container and attach the iframe
+	this.container = document.createElement( "div" );
+	d = new Date();
+	// unique identifier for this LtOverlay
+	containerName = "LtOverlay-"+d.getTime()
+	this.container.id = containerName;
+	this.container.style.margin = 0;
+	this.container.style.border = "2px solid black";
+	this.container.style.width = (this.params.width) + "px";
+	if( this.params.showCloseButton )
+		this.container.style.height = (this.params.height) + 14 + "px";		
+	else
+		this.container.style.height = (this.params.height) + "px";
+	this.container.style.display = "none";
+	this.container.style.textAlign = "right";
+	this.container.style.backgroundColor = "#286DFE";
+	this.container.style.color = "red";
+	
+	if( this.params.showCloseButton ) {
+		div = document.createElement( "div" );
+		div.style.height = "14px";
+		div.style.width = "100%";
+		div.style.textAlign = "right";
+		div.style.fontSize = "12px";
+		
+		a = document.createElement( "a" );
+		a.innerHTML = "&nbsp;X&nbsp;";
+		a.href = "#";
+		a.style.textDecoration = "none";
+		YAHOO.util.Event.addListener( a, "click", this.toggle, this, true );
+		div.appendChild( a );
+		
+		this.container.appendChild( div );
+	}
+	
+	iframe = document.createElement( "iframe" );
+	iframe.src = this.params.url;
+	iframe.style.width = this.params.width + 40 + "px";
+	iframe.style.height = this.params.height + 40 + "px";
+	iframe.style.margin = 0;
+	iframe.style.border = 0;
+	this.container.appendChild( iframe );
+
+	document.body.appendChild( this.container );
+}
+
+/**
+ * Returns the current size of the window
+ *
+ * @return An object with attributes 'width' and 'height' containing the width and height of the window
+ */	
+LtOverlay.prototype.getWindowSize = function()
+{
+	var myWidth = 0, myHeight = 0;
+  	if( typeof( window.innerWidth ) == 'number' ) {
+    	//Non-IE
+    	myWidth = window.innerWidth;
+    	myHeight = window.innerHeight;
+  	} 
+	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
+    	//IE 6+ in 'standards compliant mode'
+    	myWidth = document.documentElement.clientWidth;
+    	myHeight = document.documentElement.clientHeight;
+  	} 
+	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
+    	//IE 4 compatible
+    	myWidth = document.body.clientWidth;
+    	myHeight = document.body.clientHeight;
+  	}
+  
+  	return({width:myWidth, height:myHeight});
+}
+
+/**
+ * Returns the X coordinate of an event
+ *
+ * @param evt An Event object
+ * @return An integer containing the X coordinate of the event
+ */
+LtOverlay.prototype.mouseX = function( evt ) 
+{
+	if (evt.pageX) 
+		return evt.pageX;
+	else if (evt.clientX)
+   		return evt.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
+	else 
+		return 0;
+}
+
+/**
+ * Returns the Y coordinate of an event
+ *
+ * @param evt An Event object
+ * @return An integer containing the Y coordinate of the event
+ */
+LtOverlay.prototype.mouseY = function (evt) 
+{
+	if (evt.pageY) 
+		return evt.pageY;
+	else if (evt.clientY)
+   		return evt.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
+	else 
+		return 0;
+}
\ No newline at end of file

Modified: plog/trunk/templates/admin/header.template
===================================================================
--- plog/trunk/templates/admin/header.template	2007-02-06 22:00:44 UTC (rev 4695)
+++ plog/trunk/templates/admin/header.template	2007-02-07 23:27:37 UTC (rev 4696)
@@ -20,6 +20,7 @@
     var blogLocale = '{$locale->getCharset()|upper}';
   	// base url where we can find the admin.php script
   	var plogBaseUrl = "{$url->getBaseUrl(false)}";
+	var scriptName = "{$config->getValue("script_name")}";
 	var plogAdminBaseUrl = "{$url->getBaseUrl(false)}/admin.php";
 	var plogBlogId = "{$blog->getId()}";
 </script>
@@ -29,6 +30,7 @@
 <script type="text/javascript" src="js/prototype/prototype.js"></script>
 <script type="text/javascript" src="js/rico/rico.js"></script>
 <script type="text/javascript" src="js/ui/forms.js"></script>
+<script type="text/javascript" src="js/ui/overlay.js"></script>
 {if $blogEnablePullDownMenu}
   <script type="text/javascript" src="js/JSCookMenu/JSCookMenu.js"></script>
   <link rel="stylesheet" href="js/JSCookMenu/ThemeOffice/theme.css" type="text/css" />

Modified: plog/trunk/templates/admin/resourceinfo.template
===================================================================
--- plog/trunk/templates/admin/resourceinfo.template	2007-02-06 22:00:44 UTC (rev 4695)
+++ plog/trunk/templates/admin/resourceinfo.template	2007-02-07 23:27:37 UTC (rev 4696)
@@ -49,7 +49,7 @@
 	{/if}
 	{if $resource->hasLocationData()}
 	  {assign var=loc value=$resource->getLocation()}
-      {$locale->tr("location")}: <a onClick="{location_display location=$loc}" href="#">{$loc->getDescription()}</a><br/>
+      {$locale->tr("location")}: {location_display location=$loc}
 	{/if}
 	</span>   
    </div>

Modified: plog/trunk/templates/admin/resources.template
===================================================================
--- plog/trunk/templates/admin/resources.template	2007-02-06 22:00:44 UTC (rev 4695)
+++ plog/trunk/templates/admin/resources.template	2007-02-07 23:27:37 UTC (rev 4696)
@@ -108,9 +108,12 @@
   </a><br/>
   {if $resource->hasLocationData()}
     {assign var=location value=$resource->getLocation()}
-    <a href="" onClick="{location_display location=$location}">
+    <a href="#" id="res_{$resource->getId()}">
       <img src="imgs/admin/icon_globe-16.png" alt="Location Data" />
     </a>
+    <script type="text/javascript">
+      o = new LtOverlay( {literal}{{/literal}url:plogBaseUrl + "/" + scriptName + "?op=locationDisplay&locId={$location->getId()}&height=350&width=350",height:350,width:350,context:"res_{$resource->getId()}",showCloseButton:true{literal}}{/literal});
+	</script>
   {/if}
   <a href="admin.php?op=resourceInfo&amp;resourceId={$resource->getId()}">{$resource->getFileName()}</a>
  </td>

Modified: plog/trunk/templates/misc/location.template
===================================================================
--- plog/trunk/templates/misc/location.template	2007-02-06 22:00:44 UTC (rev 4695)
+++ plog/trunk/templates/misc/location.template	2007-02-07 23:27:37 UTC (rev 4696)
@@ -5,7 +5,7 @@
  <head>
   <meta http-equiv="Content-Type" content="text/html; charset={$locale->getCharset()}"/> 
   <link rel="stylesheet" href="styles/admin.css" type="text/css" />
-  <title>LifeType Admin</title>
+  <title>{$locale->tr("location")}</title>
   <script type="text/javascript" src="js/ui/common.js"></script>
   <script type="text/javascript" src="js/ui/forms.js"></script>
   <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key={$google_maps_api_key}" type="text/javascript"></script>

Modified: plog/trunk/templates/standard/footer.template
===================================================================
--- plog/trunk/templates/standard/footer.template	2007-02-06 22:00:44 UTC (rev 4695)
+++ plog/trunk/templates/standard/footer.template	2007-02-07 23:27:37 UTC (rev 4696)
@@ -15,7 +15,7 @@
   	<div class="clearer">&nbsp;</div>
 	{if $blog->hasLocationData()}
 		{assign var=loc value=$blog->getLocation()}
-		{$locale->tr("location")}: <a href="#" onClick="javascript:{location_display location=$loc}">{$loc->getDescription()}</a>
+		{$locale->tr("location")}: {location_display location=$loc}
 	{/if}
   	</div>
 

Modified: plog/trunk/templates/standard/header.template
===================================================================
--- plog/trunk/templates/standard/header.template	2007-02-06 22:00:44 UTC (rev 4695)
+++ plog/trunk/templates/standard/header.template	2007-02-07 23:27:37 UTC (rev 4696)
@@ -14,6 +14,7 @@
  <link rel="alternate" type="application/xml" title="RSS 0.90" href="{$url->rssLink("rss090")}" />
  <link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="{$url->rssLink("atom")}" />  
  <link rel="shortcut icon" type="image/x-icon" href="{$url->getTemplateFile("favicon.ico")}" />
+ <script type="text/javascript" src="{$url->getBaseUrl(false)}/js/ui/overlay.js"></script>
  </head>
   <body> 
 <!-- Cached content created: {"0"|date_format:"%D %H:%M:%S"} -->

Modified: plog/trunk/templates/standard/post.template
===================================================================
--- plog/trunk/templates/standard/post.template	2007-02-06 22:00:44 UTC (rev 4695)
+++ plog/trunk/templates/standard/post.template	2007-02-07 23:27:37 UTC (rev 4696)
@@ -15,7 +15,8 @@
 {if $blogsettings->getValue("comments_enabled") && $post->getCommentsEnabled()==1 || $post->getNumComments() > 0 }<img src="{$url->getTemplateFile("imgs/comment.gif")}" alt="" /><a href="{$url->postPermalink($post)}#comments" title="{$locale->tr("comments")|capitalize} -> {$post->getTopic()}">{if $post->getNumComments() == 0 }{$locale->tr("add_comment")}{else if}{$locale->tr("comments")|capitalize} ({$post->getNumComments()}){/if}</a> | {/if} 
 <img src="{$url->getTemplateFile("imgs/trackback.gif")}" alt="" />{if $post->getNumTrackbacks() > 0}<a href="{$url->postTrackbackStatsLink($post)}" title="{$locale->tr("trackbacks")} -> {$post->getTopic()}">{$locale->tr("trackbacks")} ({$post->getNumTrackbacks()})</a>{else}{$locale->tr("trackbacks")} ({$post->getNumTrackbacks()}){/if}
 {if $post->hasLocationData()} 
-| {$locale->tr("location")}: {assign var=loc value=$post->getLocation()}<a href="#" onClick="javascript:{location_display location=$loc}">{$loc->getDescription()}</a>
+| {$locale->tr("location")}: 
+{assign var=loc value=$post->getLocation()}{location_display location=$loc width=350 height=350}
 {/if}
 </p>
 
@@ -28,7 +29,7 @@
 {if $blogsettings->getValue("comments_enabled") && $post->getCommentsEnabled()==1 || $post->getNumComments() > 0 }<img src="{$url->getTemplateFile("imgs/comment.gif")}" alt="" />{$locale->tr("comments")|capitalize} ({$post->getNumComments()}) | {/if}
 <img src="{$url->getTemplateFile("imgs/trackback.gif")}" alt="" />{if $post->getNumTrackbacks() > 0}<a href="{$url->postTrackbackStatsLink($post)}" title="{$locale->tr("trackbacks")} -> {$post->getTopic()}">{$locale->tr("trackbacks")} ({$post->getNumTrackbacks()})</a>{else}{$locale->tr("trackbacks")} ({$post->getNumTrackbacks()}){/if}
 {if $post->hasLocationData()} 
-| {$locale->tr("location")}: {assign var=loc value=$post->getLocation()}<a href="#" onClick="javascript:{location_display location=$loc}">{$loc->getDescription()}</a>
+| {$locale->tr("location")}: {assign var=loc value=$post->getLocation()}{location_display location=$loc width=350 height=350}
 {/if}
 </p>
 

Modified: plog/trunk/templates/standard/resource.template
===================================================================
--- plog/trunk/templates/standard/resource.template	2007-02-06 22:00:44 UTC (rev 4695)
+++ plog/trunk/templates/standard/resource.template	2007-02-07 23:27:37 UTC (rev 4696)
@@ -12,7 +12,7 @@
     	({$metadata->getRoundedSize()}) | {$locale->tr("created")} {$locale->formatDate($updated,"%d %b, %Y")}<br/>
 		{if $resource->hasLocationData()}
 		 {assign var=location value=$resource->getLocation()}
-		 {$locale->tr("location")}: <a href="#" onClick="{location_display location=$location}">{$location->getDescription()}</a>
+		 {$locale->tr("location")}: {location_display location=$location}
 		{/if}
 	</div>
  



More information about the pLog-svn mailing list