[pLog-svn] r5747 - in plog/trunk: class/action class/template/smarty/plugins class/view js/ui templates/admin
oscar at devel.lifetype.net
oscar at devel.lifetype.net
Sun Jul 29 06:50:47 EDT 2007
Author: oscar
Date: 2007-07-29 06:50:47 -0400 (Sun, 29 Jul 2007)
New Revision: 5747
Modified:
plog/trunk/class/action/locationdisplay.class.php
plog/trunk/class/template/smarty/plugins/function.location_display.php
plog/trunk/class/view/locationview.class.php
plog/trunk/js/ui/contentoverlay.js
plog/trunk/templates/admin/editlinks.template
Log:
Modified: plog/trunk/class/action/locationdisplay.class.php
===================================================================
--- plog/trunk/class/action/locationdisplay.class.php 2007-07-29 10:48:47 UTC (rev 5746)
+++ plog/trunk/class/action/locationdisplay.class.php 2007-07-29 10:50:47 UTC (rev 5747)
@@ -31,9 +31,7 @@
$this->_view = new LocationView( $this->_blogInfo );
$this->_view->setLocation( $location );
- $this->_view->setWidth( $this->_request->getValue( "width" ));
- $this->_view->setHeight( $this->_request->getValue( "height" ));
-
+ $this->_view->setValue( "url", $this->_blogInfo->getBlogRequestGenerator());
$this->setCommonData();
return( true );
Modified: plog/trunk/class/template/smarty/plugins/function.location_display.php
===================================================================
--- plog/trunk/class/template/smarty/plugins/function.location_display.php 2007-07-29 10:48:47 UTC (rev 5746)
+++ plog/trunk/class/template/smarty/plugins/function.location_display.php 2007-07-29 10:50:47 UTC (rev 5747)
@@ -5,7 +5,11 @@
* Generates all code necessary to call the location viewer
*/
function smarty_function_location_display($params, &$smarty)
-{
+{
+ static $scriptsAlreadyInPlace;
+
+ $code = "";
+
// parameter with the locations
if( !isset( $params["location"] )) {
$smarty->trigger_error( "Error in location_display: the location parameter is missing!" );
@@ -24,22 +28,42 @@
$baseUrl = $config->getValue( "base_url" );
if(( $scriptName = $config->getValue( "script_name" )) == "" )
$scriptName = "index.php";
- $ndexUrl = $baseUrl + "/".$scriptName;
+ $indexUrl = $baseUrl + "/".$scriptName;
}
- isset( $params["width"] ) ? $width = $params["width"] : $width = 390;
- isset( $params["height"] ) ? $height = $params["height"] : $height = 390;
+ $config =& Config::getConfig();
+ $google_maps_api_key = $config->getValue( "google_maps_api_key" );
- // random name for the object, in case we've got more than one per page
- $o = "o_".md5(time());
- $oo = "o".$o;
+ $scripts = Array(
+ "{$baseUrl}/js/yui/yahoo/yahoo-min.js",
+ "{$baseUrl}/js/yui/dom/dom-min.js",
+ "{$baseUrl}/js/yui/event/event-min.js",
+ "{$baseUrl}/js/yui/container/container-min.js",
+ "{$baseUrl}/js/yui/connection/connection-min.js",
+ "{$baseUrl}/js/yui/animation/animation-min.js",
+ "{$baseUrl}/js/ui/core.js",
+ "{$baseUrl}/js/ui/ui.js",
+ "{$baseUrl}/js/ui/contentoverlay.js",
+ "{$baseUrl}/js/ui/dom.js",
+ "http://maps.google.com/maps?file=api&v=2&key={$google_maps_api_key}",
+ "{$baseUrl}/js/location/location.js"
+ );
+
+ // we only need to load all these once
+ if( !$scriptsAlreadyInPlace ) {
+ foreach( $scripts as $script ) {
+ $code .= "<script type=\"text/javascript\" src=\"$script\"></script>";
+ }
+
+ $code .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"{$baseUrl}/js/yui/container/assets/container.css\" />";
+
+ $scriptsAlreadyInPlace = true;
+ }
- $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=\"javascript:void(0);\">".$location->getDescription()."</a>";
- $code .= "<script type=\"text/javascript\">$oo=new Lifetype.UI.Overlay({url:'".$indexUrl."?op=locationDisplay&width=".$width."&height=".$height."&locId=".$location->getId()."',width:".$width.",height:".$height.",context:'$o',showCloseButton:true});</script>";
+ $url = $url->getIndexUrl()."?op=locationDisplay&locId=".$location->getId()."&mapOnly=mapOnly";
+ $code .= "<a href=\"{$url}\" rel=\"overlay\">".$location->getDescription()."</a>";
+
return( $code );
}
?>
\ No newline at end of file
Modified: plog/trunk/class/view/locationview.class.php
===================================================================
--- plog/trunk/class/view/locationview.class.php 2007-07-29 10:48:47 UTC (rev 5746)
+++ plog/trunk/class/view/locationview.class.php 2007-07-29 10:50:47 UTC (rev 5747)
@@ -1,6 +1,6 @@
<?php
- include_once( PLOG_CLASS_PATH."class/view/view.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/view/view.class.php" );
lt_include( PLOG_CLASS_PATH.'class/template/templateservice.class.php' );
class LocationView extends View
@@ -17,12 +17,14 @@
$this->_blogInfo = $blogInfo;
- $ts = new TemplateService();
- $this->_template = $ts->Template( "location", "misc", $this->_blogInfo );
- $this->_template->useTemplateLoadOrder = true;
+ $ts = new TemplateService();
+ if( isset( $_REQUEST["mapOnly"] ))
+ $template = "location_map";
+ else
+ $template = "location";
+ $this->_template = $ts->Template( $template, "misc", $this->_blogInfo );
- $this->_width = 590;
- $this->_height = 500;
+ $this->_template->useTemplateLoadOrder = true;
}
function setLocation( $loc )
Modified: plog/trunk/js/ui/contentoverlay.js
===================================================================
--- plog/trunk/js/ui/contentoverlay.js 2007-07-29 10:48:47 UTC (rev 5746)
+++ plog/trunk/js/ui/contentoverlay.js 2007-07-29 10:50:47 UTC (rev 5747)
@@ -31,6 +31,16 @@
YAHOO.extend( Lifetype.UI.ContentOverlay, YAHOO.widget.Panel );
/**
+ * @static
+ */
+Lifetype.UI.ContentOverlay.createAndShow = function( url )
+{
+ o = new Lifetype.UI.ContentOverlay( YAHOO.util.Dom.generateId(), url );
+ o.show();
+ return( false );
+}
+
+/**
* Namespace for events generated by the ContentOverlay class
*/
Lifetype.UI.ContentOverlay.Events = function() {}
@@ -60,11 +70,12 @@
s.innerHTML = o.responseText;
Lifetype.execJS( s );
- Lifetype.UI.ContentOverlay.Events.dataLoaded.fire( o );
+ this.render( document.body );
+ Lifetype.UI.ContentOverlay.superclass.show.call( this );
+
+ Lifetype.UI.ContentOverlay.Events.dataLoaded.fire( o );
}
});
- this.render( document.body );
- Lifetype.UI.ContentOverlay.superclass.show.call( this );
return( false );
}
Modified: plog/trunk/templates/admin/editlinks.template
===================================================================
--- plog/trunk/templates/admin/editlinks.template 2007-07-29 10:48:47 UTC (rev 5746)
+++ plog/trunk/templates/admin/editlinks.template 2007-07-29 10:50:47 UTC (rev 5747)
@@ -76,4 +76,4 @@
</div>
</form>
{include file="$admintemplatepath/footernavigation.template"}
-{include file="$admintemplatepath/footer.template"}
+{include file="$admintemplatepath/footer.template"}
\ No newline at end of file
More information about the pLog-svn
mailing list