[pLog-svn] r5762 - in plog/trunk: class/template/smarty/plugins js/location js/ui templates/admin

oscar at devel.lifetype.net oscar at devel.lifetype.net
Mon Jul 30 17:51:22 EDT 2007


Author: oscar
Date: 2007-07-30 17:51:22 -0400 (Mon, 30 Jul 2007)
New Revision: 5762

Added:
   plog/trunk/js/location/selector.js
Modified:
   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/js/ui/contentoverlay.js
   plog/trunk/templates/admin/editpost.template
   plog/trunk/templates/admin/editposts.template
   plog/trunk/templates/admin/editposts_table.template
   plog/trunk/templates/admin/header.template
   plog/trunk/templates/admin/newpost.template
Log:
Some more fixes.


Modified: plog/trunk/class/template/smarty/plugins/function.location_chooser.php
===================================================================
--- plog/trunk/class/template/smarty/plugins/function.location_chooser.php	2007-07-30 20:02:34 UTC (rev 5761)
+++ plog/trunk/class/template/smarty/plugins/function.location_chooser.php	2007-07-30 21:51:22 UTC (rev 5762)
@@ -65,7 +65,7 @@
 	// whether to include a link with a plus sign to add new locations
 	isset( $params["showAddNewLink"] ) ? $showAddNewLink = $params["showAddNewLink"] : $showAddNewLink = false;	
 	
-	$code = "<select name=\"locationId\" id=\"locationId\" onChange=\"Lifetype.UI.Location.Selector.onChangeHandler(this);\">";	
+	$code = "<select name=\"locationId\" id=\"locationId\" onChange=\"Lifetype.UI.LocationSelector.onChangeHandler(this);\">";	
 
 	if( $showAllOption ) {
 		$code .= "<option value=\"-1\"";
@@ -96,11 +96,11 @@
 	$code .= " </select>";
 
 	if( $showDisplayLink ) {
-		$code .= "&nbsp;<a href=\"#\" onClick=\"return(Lifetype.UI.Location.Selector.displaySelected(this))\"><img src=\"imgs/admin/icon_globe-16.png\" alt=\"Display\" style=\"border:0px\" /></a>";
+		$code .= "&nbsp;<a href=\"#\" onClick=\"return(Lifetype.UI.LocationSelector.displaySelected(this))\"><img src=\"imgs/admin/icon_globe-16.png\" alt=\"Display\" style=\"border:0px\" /></a>";
 	}
 	
 	if( $showAddNewLink )	{	
-		$code .= "&nbsp;<a href=\"#\" onClick=\"return(Lifetype.UI.Location.Selector.addNew(this))\"><img src=\"imgs/admin/icon_add-16.gif\" alt=\"New\" style=\"border:0px\" /></a>";		
+		$code .= "&nbsp;<a href=\"#\" onClick=\"return(Lifetype.UI.LocationSelector.addNew(this))\"><img src=\"imgs/admin/icon_add-16.gif\" alt=\"New\" 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-07-30 20:02:34 UTC (rev 5761)
+++ plog/trunk/class/template/smarty/plugins/function.location_display.php	2007-07-30 21:51:22 UTC (rev 5762)
@@ -46,6 +46,7 @@
 		"{$baseUrl}/js/ui/contentoverlay.js",
 		"{$baseUrl}/js/ui/dom.js",
 		"http://maps.google.com/maps?file=api&amp;v=2&amp;key={$google_maps_api_key}",
+		"{$baseUrl}/js/location/selector.js",
 		"{$baseUrl}/js/location/location.js"
 	);
 
@@ -63,7 +64,7 @@
 	$url = $url->getIndexUrl()."?op=locationDisplay&locId=".$location->getId();
 	//$url = "#";
 	
-	$code .= "<a id=\"loc_{$location->getId()}\" href=\"{$url}\" onClick=\"Lifetype.UI.Location.Selector.blogDisplay('{$url}&mapOnly=mapOnly');return(false);\">".$location->getDescription()."</a>";
+	$code .= "<a id=\"loc_{$location->getId()}\" href=\"{$url}\" onClick=\"Lifetype.UI.LocationSelector.blogDisplay('{$url}&mapOnly=mapOnly');return(false);\">".$location->getDescription()."</a>";
 	
 	return( $code );
 }

Modified: plog/trunk/js/location/location.js
===================================================================
--- plog/trunk/js/location/location.js	2007-07-30 20:02:34 UTC (rev 5761)
+++ plog/trunk/js/location/location.js	2007-07-30 21:51:22 UTC (rev 5762)
@@ -8,7 +8,7 @@
 }
 
 /**
- * Location selector
+ * Location display
  */
 Lifetype.UI.Location.prototype =
 {
@@ -27,7 +27,7 @@
 	/**
 	 * Whether to show the little display with the latitude and the longitude
 	 */
-	useCustomLatitudeAndLongitudeDisplay: true,
+	useCustomLatitudeAndLongitudeDisplay: false,
 	
 	/**
 	 * Whether to use the click handler or not
@@ -70,69 +70,6 @@
 	map: null
 }
 
-Lifetype.UI.Location.Selector = function() 
-{
-	this.o = null;
-}
-
-Lifetype.UI.Location.Selector.onChangeHandler = function( s )
-{
-	if( s.options[s.selectedIndex].value == -2 ) {
-		this.o = new Lifetype.UI.ContentOverlay( YAHOO.util.Dom.generateId(), '?op=locationChooser' );		
-		this.o.show();
-	}
-}
-
-Lifetype.UI.Location.Selector.addNew = function( a ) 
-{
-	this.o = new Lifetype.UI.ContentOverlay( YAHOO.util.Dom.generateId(), '?op=locationChooser' );		
-	this.o.show();
-	
-	return( false );
-}
-
-Lifetype.UI.Location.Selector.displaySelected = function( a )
-{
-	var lst = Lifetype.Dom.$('locationId');
-	if( lst.options[lst.selectedIndex].value <= 0 )
-		return false;
-		
-	locId = lst.options[lst.selectedIndex].value;
-
-	Lifetype.UI.Location.Selector.display( locId );
-}
-
-Lifetype.UI.Location.Selector.display = function( locId )
-{
-	var url = '?op=adminLocationDisplay&locId=' + locId;
-	
-	Lifetype.UI.ContentOverlay.Events.hideOverlay.subscribe( function() { GUnload(); });
-	
-	this.o = new Lifetype.UI.ContentOverlay( YAHOO.util.Dom.generateId(), url );
-	// and bind it to the onclick event
-	this.o.show();
-	
-	return( false );	
-}
-
-Lifetype.UI.Location.Selector.blogDisplay = function( url )
-{	
-	this.o = new Lifetype.UI.ContentOverlay( YAHOO.util.Dom.generateId(), url );
-	
-	Lifetype.UI.ContentOverlay.Events.hideOverlay.subscribe( function() { GUnload(); });	
-	
-	// and bind it to the onclick event
-	this.o.show();
-	
-	return( false );	
-}
-
-Lifetype.UI.Location.Selector.hide = function()
-{
-	this.o.hide();
-	this.o.destroy();
-}
-
 /**
  * Initializes and renders the selector
  *
@@ -170,7 +107,7 @@
 		this.map.addControl(new GLargeMapControl());
 		this.map.addControl(new GMapTypeControl());
 		/*if( this.useCustomLocationControl )
-			this.map.addControl(new Lifetype.UI.Location.SelectorControl( this ));*/
+			this.map.addControl(new Lifetype.UI.LocationSelectorControl( this ));*/
 		if( this.useCustomLatitudeAndLongitudeDisplay ) 
 			this.map.addControl(new Lifetype.UI.Location.LatitudeAndLongitudeDisplayControl());
 	

Added: plog/trunk/js/location/selector.js
===================================================================
--- plog/trunk/js/location/selector.js	                        (rev 0)
+++ plog/trunk/js/location/selector.js	2007-07-30 21:51:22 UTC (rev 5762)
@@ -0,0 +1,71 @@
+/**
+ * This class includes code that controls the drop-down location list
+ */
+Lifetype.UI.LocationSelector = function() 
+{
+	this.o = null;
+}
+
+/**
+ * event handler for the onChange event of the drop-down list
+ */
+Lifetype.UI.LocationSelector.onChangeHandler = function( s )
+{
+	if( s.options[s.selectedIndex].value == -2 ) {
+		this.o = new Lifetype.UI.ContentOverlay( YAHOO.util.Dom.generateId(), '?op=locationChooser' );		
+		this.o.show();
+	}
+}
+
+/**
+ * Event handler for the little 'plus' sign that appears next to the drop-down list and
+ * that allows to insert a new location 
+ */
+Lifetype.UI.LocationSelector.addNew = function( a ) 
+{
+	this.o = new Lifetype.UI.ContentOverlay( YAHOO.util.Dom.generateId(), '?op=locationChooser' );		
+	this.o.show();
+	
+	return( false );
+}
+
+/**
+ * Event handler for the icon that allows to display the currently selected location
+ * in the drop down list
+ */
+Lifetype.UI.LocationSelector.displaySelected = function( a )
+{
+	var lst = Lifetype.Dom.$('locationId');
+	if( lst.options[lst.selectedIndex].value <= 0 )
+		return false;
+		
+	locId = lst.options[lst.selectedIndex].value;
+
+	Lifetype.UI.LocationSelector.display( locId );
+}
+
+/**
+ * Displays the given location id
+ *
+ * @param locId
+ */
+Lifetype.UI.LocationSelector.display = function( locId )
+{
+	var url = '?op=adminLocationDisplay&locId=' + locId;
+	this.o = new Lifetype.UI.ContentOverlay( YAHOO.util.Dom.generateId(), url );	
+	this.o.show();
+	
+	return( false );	
+}
+
+Lifetype.UI.LocationSelector.blogDisplay = function( url )
+{	
+	this.o = new Lifetype.UI.ContentOverlay( YAHOO.util.Dom.generateId(), url );
+	this.o.show();
+	return( false );	
+}
+
+Lifetype.UI.LocationSelector.hide = function()
+{
+	this.o.hide();
+} 
\ No newline at end of file

Modified: plog/trunk/js/ui/contentoverlay.js
===================================================================
--- plog/trunk/js/ui/contentoverlay.js	2007-07-30 20:02:34 UTC (rev 5761)
+++ plog/trunk/js/ui/contentoverlay.js	2007-07-30 21:51:22 UTC (rev 5762)
@@ -31,6 +31,8 @@
 YAHOO.extend( Lifetype.UI.ContentOverlay, YAHOO.widget.Panel );
 
 /**
+ * Given a URL, creates and displays an overlay
+ *
  * @static
  */
 Lifetype.UI.ContentOverlay.createAndShow = function( url )
@@ -41,26 +43,35 @@
 }
 
 /**
- * Namespace for events generated by the ContentOverlay class
+ * Static method that can be used as the onclick event of an anchor tag
+ *
+ * @param The anchor tag (usually "this")
+ * @static
  */
-Lifetype.UI.ContentOverlay.Events = function() {}
+Lifetype.UI.ContentOverlay.anchorOverlay = function( a )
+{
+	return( Lifetype.UI.ContentOverlay.createAndShow( a.href ));
+}
 
 /**
- * CustomEvent object fired when the data for the overlay has been loaded.
+ * Hides the overlay and resets the contents of its body
  */
-Lifetype.UI.ContentOverlay.Events.dataLoaded = new YAHOO.util.CustomEvent('dataLoaded');
-
-Lifetype.UI.ContentOverlay.Events.hideOverlay = new YAHOO.util.CustomEvent('hideOverlay');
-Lifetype.UI.ContentOverlay.Events.destroyOverlay = new YAHOO.util.CustomEvent('destroyOverlay');
-
 Lifetype.UI.ContentOverlay.prototype.hide = function()
 {
-	// this is doing nothing now, but I am planning to perform a check here 
-	// to see if the content of the dialog changed before it was submitted, so that
-	// we can inform the user that changes will be lost if the dialog is closed
 	Lifetype.UI.ContentOverlay.superclass.hide.call( this );
+	this.setBody( "" );
 }
 
+/**
+ * Namespace for events generated by the ContentOverlay class
+ */
+Lifetype.UI.ContentOverlay.Events = function() {}
+
+/**
+ * CustomEvent object fired when the data for the overlay has been loaded.
+ */
+Lifetype.UI.ContentOverlay.Events.dataLoaded = new YAHOO.util.CustomEvent('dataLoaded');
+
 Lifetype.UI.ContentOverlay.prototype.show = function()
 {
 	c = YAHOO.util.Connect.asyncRequest( 'GET', this.url, { scope:this, success: function(o) {
@@ -71,7 +82,7 @@
 			// XmlHttpRequest and assigned to a node via innerHTML
 			s = document.createElement( 'span' );
 			s.innerHTML = o.responseText;
-			Lifetype.execJS( s );								
+			Lifetype.execJS( s );
 		}
 	});
 	
@@ -81,22 +92,6 @@
 	return( false );	
 }
 
-Lifetype.UI.ContentOverlay.prototype.hide = function()
-{
-	Lifetype.UI.ContentOverlay.Events.hideOverlay.fire();
-	Lifetype.UI.ContentOverlay.superclass.hide.call( this );
-	
-	// we should clean up the DOM after we're done with the panel, otherwise IE
-	// and Safari seem to ahve problems showing it again
-	this.destroy();
-}
-
-Lifetype.UI.ContentOverlay.prototype.destroy = function()
-{
-	Lifetype.UI.ContentOverlay.Events.destroyOverlay.fire();
-	Lifetype.UI.ContentOverlay.superclass.destroy.call( this );
-}
-
 /**
  * Processes all the anchors whose "rel" attribute is set to
  * "overlay". Can be called as static
@@ -112,7 +107,8 @@
 		// create the object
 		objs[i] = new Lifetype.UI.ContentOverlay( YAHOO.util.Dom.generateId(), e.href );
 		// and bind it to the onclick event
-		e.onclick = Lifetype.bind( objs[i].show, objs[i] );
+		e.onclick = Lifetype.bind( objs[i].show, objs[i] );	
+		//e.onclick = Lifetype.UI.ContentOverlay.anchorOverlay;
 	}
 }
 

Modified: plog/trunk/templates/admin/editpost.template
===================================================================
--- plog/trunk/templates/admin/editpost.template	2007-07-30 20:02:34 UTC (rev 5761)
+++ plog/trunk/templates/admin/editpost.template	2007-07-30 21:51:22 UTC (rev 5762)
@@ -1,5 +1,11 @@
 {include file="$admintemplatepath/header.template"}
 {include file="$admintemplatepath/navigation.template" showOpt=editPosts title=$locale->tr("editPost")}
+{if $location_data_enabled}
+<!-- Location libraries -->
+{js src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=$google_maps_api_key"}
+{js src="js/location/location.js"}
+{js src="js/location/selector.js"}
+{/if}
 <link rel="stylesheet" type="text/css" media="all" href="js/jscalendar/calendar-win2k-cold-1.css" title="win2k-cold-1" />
 <script type="text/javascript" src="js/jscalendar/calendar_stripped.js"></script>
 <script type="text/javascript" src="js/jscalendar/lang/calendar-en.js"></script>

Modified: plog/trunk/templates/admin/editposts.template
===================================================================
--- plog/trunk/templates/admin/editposts.template	2007-07-30 20:02:34 UTC (rev 5761)
+++ plog/trunk/templates/admin/editposts.template	2007-07-30 21:51:22 UTC (rev 5762)
@@ -1,4 +1,10 @@
 {include file="$admintemplatepath/header.template"}
+{if $location_data_enabled}
+<!-- Location libraries -->
+{js src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=$google_maps_api_key"}
+{js src="js/location/location.js"}
+{js src="js/location/selector.js"}
+{/if}
 {include file="$admintemplatepath/navigation.template" showOpt=editPosts title=$locale->tr("editPosts")}
 {literal}
 <script type="text/javascript">

Modified: plog/trunk/templates/admin/editposts_table.template
===================================================================
--- plog/trunk/templates/admin/editposts_table.template	2007-07-30 20:02:34 UTC (rev 5761)
+++ plog/trunk/templates/admin/editposts_table.template	2007-07-30 21:51:22 UTC (rev 5762)
@@ -32,7 +32,7 @@
 				  {if $post->hasLocationData()}
 				    <br/><span style="font-weight:normal">
 				    {assign var=location value=$post->getLocation()}
-					{$locale->tr("location")}: <a href="#" onClick="Lifetype.UI.Location.Selector.display('{$location->getId()}');return(false)">{$location->getDescription()}</a>
+					{$locale->tr("location")}: <a href="#" onClick="Lifetype.UI.LocationSelector.display('{$location->getId()}');return(false)">{$location->getDescription()}</a>
 					</span>
 				  {/if}
 				{/if}

Modified: plog/trunk/templates/admin/header.template
===================================================================
--- plog/trunk/templates/admin/header.template	2007-07-30 20:02:34 UTC (rev 5761)
+++ plog/trunk/templates/admin/header.template	2007-07-30 21:51:22 UTC (rev 5762)
@@ -37,9 +37,7 @@
 {js src="js/ui/menu.js"}
 {js src="js/cookie/cookie.js"}
 {if $location_data_enabled}
-<!-- Location libraries -->
-{js src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=$google_maps_api_key"}
-{js src="js/location/location.js"}
+{js src="js/location/selector.js"}
 {/if}
 {if $blogEnablePullDownMenu}
   {js src="js/JSCookMenu/JSCookMenu.js"}

Modified: plog/trunk/templates/admin/newpost.template
===================================================================
--- plog/trunk/templates/admin/newpost.template	2007-07-30 20:02:34 UTC (rev 5761)
+++ plog/trunk/templates/admin/newpost.template	2007-07-30 21:51:22 UTC (rev 5762)
@@ -1,7 +1,11 @@
 {include file="$admintemplatepath/header.template"}
 {js src="js/ui/pages/posts.js"}
-<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key={$google_maps_api_key}" type="text/javascript"></script>
-<script type="text/javascript" src="js/location/location.js"></script>
+{if $location_data_enabled}
+<!-- Location libraries -->
+{js src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=$google_maps_api_key"}
+{js src="js/location/location.js"}
+{js src="js/location/selector.js"}
+{/if}
 {include file="$admintemplatepath/navigation.template" showOpt=newPost title=$locale->tr("newPost")}
 {assign var=htmlarea value=$blogsettings->getValue("htmlarea_enabled")}
  <link rel="stylesheet" type="text/css" media="all" href="js/jscalendar/calendar-win2k-cold-1.css" title="win2k-cold-1" />



More information about the pLog-svn mailing list