[pLog-svn] r4624 - in plog/trunk: class/action/admin class/action/admin/chooser class/controller class/dao class/gallery/dao class/template/smarty/plugins class/view/admin class/view/admin/chooser imgs/admin install js js/location templates/admin templates/admin/chooser
oscar at devel.lifetype.net
oscar at devel.lifetype.net
Tue Jan 30 08:04:45 EST 2007
Author: oscar
Date: 2007-01-30 08:04:45 -0500 (Tue, 30 Jan 2007)
New Revision: 4624
Added:
plog/trunk/class/action/admin/chooser/adminlocationchooseraction.class.php
plog/trunk/class/dao/location.class.php
plog/trunk/class/dao/locationawaredbobject.class.php
plog/trunk/class/dao/locations.class.php
plog/trunk/class/template/smarty/plugins/function.location_chooser.php
plog/trunk/class/view/admin/chooser/adminlocationchooserview.class.php
plog/trunk/imgs/admin/icon_globe-16.png
plog/trunk/imgs/admin/icon_globe-48.png
plog/trunk/js/location/
plog/trunk/js/location/location.js
plog/trunk/templates/admin/chooser/location.template
plog/trunk/templates/admin/globalsettings_location.template
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/controller/admincontrollermap.properties.php
plog/trunk/class/dao/article.class.php
plog/trunk/class/dao/articles.class.php
plog/trunk/class/dao/bloginfo.class.php
plog/trunk/class/dao/blogs.class.php
plog/trunk/class/dao/model.class.php
plog/trunk/class/gallery/dao/galleryresource.class.php
plog/trunk/class/gallery/dao/galleryresources.class.php
plog/trunk/class/view/admin/adminglobalsettingslistview.class.php
plog/trunk/class/view/admin/adminnewresourceview.class.php
plog/trunk/class/view/admin/adminview.class.php
plog/trunk/install/dbschemas.properties.php
plog/trunk/install/defaultconfig.properties.php
plog/trunk/templates/admin/blogsettings.template
plog/trunk/templates/admin/globalsettings.template
plog/trunk/templates/admin/menus.xml
plog/trunk/templates/admin/newpost.template
plog/trunk/templates/admin/newresource.template
plog/trunk/templates/admin/resourceinfo.template
plog/trunk/templates/admin/resources.template
Log:
All the work so far done regarding integrating Google Maps into an embrionary version of LT 1.3. Selecting a location or adding a new one is working for resources, posts and articles but there's still a few things missing. I'm checking it in now in case any of you wants to have an early look at this feature and so that I have a remote backup copy in case something happens to my computer after all this work :)
Modified: plog/trunk/class/action/admin/adminaddpostaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddpostaction.class.php 2007-01-30 09:49:45 UTC (rev 4623)
+++ plog/trunk/class/action/admin/adminaddpostaction.class.php 2007-01-30 13:04:45 UTC (rev 4624)
@@ -79,8 +79,19 @@
//print_r($article->_customFields);
// notifiy about this event
- $this->notifyEvent( EVENT_PRE_POST_ADD, Array( "article" => &$article ));
+ $this->notifyEvent( EVENT_PRE_POST_ADD, Array( "article" => &$article ));
+ // location data, if necessary
+ // check if we have to save the location data
+ $config =& Config::getConfig();
+ if( $config->getValue( "location_data_enabled", false )) {
+ 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 );
+ }
+
// in case the post is already in the db
if( $this->_postId != "" ) {
$article->setId( $this->_postId );
Modified: plog/trunk/class/action/admin/adminaddresourceaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddresourceaction.class.php 2007-01-30 09:49:45 UTC (rev 4623)
+++ plog/trunk/class/action/admin/adminaddresourceaction.class.php 2007-01-30 13:04:45 UTC (rev 4624)
@@ -11,6 +11,7 @@
lt_include( PLOG_CLASS_PATH."class/view/admin/chooser/adminsimpleresourceslistview.class.php" );
lt_include( PLOG_CLASS_PATH."class/view/admin/chooser/adminuserpictureselectview.class.php" );
lt_include( PLOG_CLASS_PATH."class/file/fileupload.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/dao/locations.class.php" );
/**
* \ingroup Action
@@ -25,6 +26,7 @@
var $_albumId;
var $_resource;
var $_destView;
+ var $_location;
/**
* Constructor. If nothing else, it also has to call the constructor of the parent
@@ -64,7 +66,7 @@
$this->_albumId = $this->_request->getValue( "albumId" );
$this->_resource = $this->_request->getValue( "resourceFile" );
$this->_destination = $this->_request->getValue( "destination" );
-
+
// check if there is any file uploaded
$files = HttpVars::getFiles();
// we probably need to rearrange the $files array a bit better...
@@ -107,7 +109,18 @@
$successMessage .= $this->_locale->pr("resource_added_ok", $file["name"])."<br/>";
// try to fetch the resource so that we can send it in the event
$resource = $resources->getResource( $res, $this->_blogInfo->getId());
- $this->notifyEvent( EVENT_POST_RESOURCE_ADD, Array( "resource" => &$resource ));
+
+ // check if we have to save the location data
+ $config =& Config::getConfig();
+ if( $config->getValue( "location_data_enabled", false )) {
+ $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 );
+ }
+
+ $this->notifyEvent( EVENT_POST_RESOURCE_ADD, Array( "resource" => &$resource ));
}
else {
if( $res == GALLERY_ERROR_RESOURCE_FORBIDDEN_EXTENSION )
Modified: plog/trunk/class/action/admin/adminupdateblogsettingsaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdateblogsettingsaction.class.php 2007-01-30 09:49:45 UTC (rev 4623)
+++ plog/trunk/class/action/admin/adminupdateblogsettingsaction.class.php 2007-01-30 13:04:45 UTC (rev 4624)
@@ -171,8 +171,18 @@
}
$this->_blogInfo->setCustomDomain( $blog_domain );
- }
+ }
+ // check if we have to save the location data
+ $config =& Config::getConfig();
+ if( $config->getValue( "location_data_enabled", false )) {
+ 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
$blogs = new Blogs();
Added: plog/trunk/class/action/admin/chooser/adminlocationchooseraction.class.php
===================================================================
--- plog/trunk/class/action/admin/chooser/adminlocationchooseraction.class.php (rev 0)
+++ plog/trunk/class/action/admin/chooser/adminlocationchooseraction.class.php 2007-01-30 13:04:45 UTC (rev 4624)
@@ -0,0 +1,19 @@
+<?php
+
+ lt_include( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/view/admin/chooser/adminlocationchooserview.class.php" );
+
+ class AdminLocationChooserAction extends AdminAction
+ {
+ function AdminLocationChooserAction( $actionInfo, $request )
+ {
+ $this->AdminAction( $actionInfo, $request );
+ }
+
+ function perform()
+ {
+ $this->_view = new AdminLocationChooserView( $this->_blogInfo );
+ $this->setCommonData();
+ }
+ }
+?>
\ No newline at end of file
Modified: plog/trunk/class/controller/admincontrollermap.properties.php
===================================================================
--- plog/trunk/class/controller/admincontrollermap.properties.php 2007-01-30 09:49:45 UTC (rev 4623)
+++ plog/trunk/class/controller/admincontrollermap.properties.php 2007-01-30 13:04:45 UTC (rev 4624)
@@ -316,4 +316,7 @@
// global plugin settings
$actions["pluginSettings"] = "AdminPluginSettingsAction";
$actions["updatePluginSettings"] = "AdminUpdatePluginSettingsAction";
+ // location chooser
+ $actions['locationChooser'] = 'AdminLocationChooserAction';
+ $actions['locationDisplay'] = 'AdminLocationDisplayAction';
?>
\ No newline at end of file
Modified: plog/trunk/class/dao/article.class.php
===================================================================
--- plog/trunk/class/dao/article.class.php 2007-01-30 09:49:45 UTC (rev 4623)
+++ plog/trunk/class/dao/article.class.php 2007-01-30 13:04:45 UTC (rev 4624)
@@ -1,7 +1,8 @@
<?php
- lt_include( PLOG_CLASS_PATH."class/database/dbobject.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/dao/locationawaredbobject.class.php" );
lt_include( PLOG_CLASS_PATH.'class/dao/articlestatus.class.php' );
lt_include( PLOG_CLASS_PATH.'class/dao/articlecommentstatus.class.php' );
+ lt_include( PLOG_CLASS_PATH.'class/data/timestamp.class.php' );
define( 'POST_EXTENDED_TEXT_MODIFIER', '[@more@]' );
@@ -9,7 +10,7 @@
* \ingroup DAO
* This class represents an article from the database, and provides methods to access all its objects.
*/
- class Article extends DbObject
+ class Article extends LocationAwareDbObject
{
/**
@@ -63,7 +64,7 @@
*/
function Article( $topic, $text, $categories, $user, $blog, $status, $numReads, $properties = Array(), $slug = "", $id = -1 )
{
- lt_include( PLOG_CLASS_PATH.'class/data/timestamp.class.php' );
+ $this->LocationAwareDbObject();
$this->_topic = $topic;
$this->_text = $text;
@@ -115,7 +116,8 @@
"num_nonspam_trackbacks" => "getNumTrackbacks",
"num_nonspam_comments" => "getNumComments",
"global_category_id" => "getGlobalCategoryId",
- "in_summary_page" => "getInSummary"
+ "in_summary_page" => "getInSummary",
+ "loc_id" => "getLocationId"
);
}
Modified: plog/trunk/class/dao/articles.class.php
===================================================================
--- plog/trunk/class/dao/articles.class.php 2007-01-30 09:49:45 UTC (rev 4623)
+++ plog/trunk/class/dao/articles.class.php 2007-01-30 13:04:45 UTC (rev 4624)
@@ -437,7 +437,8 @@
a.num_nonspam_comments AS num_nonspam_comments, a.num_trackbacks AS num_trackbacks,
a.num_nonspam_trackbacks AS num_nonspam_trackbacks,
a.global_category_id AS global_category_id,
- a.in_summary_page AS in_summary_page
+ a.in_summary_page AS in_summary_page,
+ a.loc_id AS loc_id
FROM {$prefix}articles a, {$prefix}articles_categories c,
{$prefix}article_categories_link l";
if( $searchTerms != "" )
@@ -1249,6 +1250,9 @@
// shown in summary or not
$article->setInSummary( $query_result['in_summary_page'] );
+
+ // location information
+ $article->setLocationId( $query_result['loc_id'] );
return $article;
Modified: plog/trunk/class/dao/bloginfo.class.php
===================================================================
--- plog/trunk/class/dao/bloginfo.class.php 2007-01-30 09:49:45 UTC (rev 4623)
+++ plog/trunk/class/dao/bloginfo.class.php 2007-01-30 13:04:45 UTC (rev 4624)
@@ -1,6 +1,6 @@
<?php
- lt_include( PLOG_CLASS_PATH."class/database/dbobject.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/dao/locationawaredbobject.class.php" );
lt_include( PLOG_CLASS_PATH."class/dao/blogsettings.class.php" );
/**
@@ -9,7 +9,7 @@
* This is the representation of a blog. It contains all the information we need to know,
* such as the name of the blog, the owner, description, etc.
*/
- class BlogInfo extends DbObject
+ class BlogInfo extends LocationAwareDbObject
{
var $_blog;
@@ -46,7 +46,7 @@
{
lt_include( PLOG_CLASS_PATH."class/data/timestamp.class.php" );
- $this->DbObject();
+ $this->LocationAwareDbObject();
$this->setBlog( $blog );
$this->_owner = $owner;
@@ -99,7 +99,8 @@
"num_posts" => "getTotalPosts",
"num_comments" => "getTotalComments",
"num_trackbacks" => "getTotalTrackbacks",
- "custom_domain" => "getCustomDomain"
+ "custom_domain" => "getCustomDomain",
+ "loc_id" => "getLocationId"
);
}
Modified: plog/trunk/class/dao/blogs.class.php
===================================================================
--- plog/trunk/class/dao/blogs.class.php 2007-01-30 09:49:45 UTC (rev 4623)
+++ plog/trunk/class/dao/blogs.class.php 2007-01-30 13:04:45 UTC (rev 4624)
@@ -363,6 +363,8 @@
// create date and update date
$blogInfo->setCreateDate( $row['create_date'] );
$blogInfo->setUpdateDate( $row['last_update_date'] );
+ // location data
+ $blogInfo->setLocationId( $row["loc_id"] );
return $blogInfo;
}
Added: plog/trunk/class/dao/location.class.php
===================================================================
--- plog/trunk/class/dao/location.class.php (rev 0)
+++ plog/trunk/class/dao/location.class.php 2007-01-30 13:04:45 UTC (rev 4624)
@@ -0,0 +1,61 @@
+<?php
+
+ include_once( PLOG_CLASS_PATH."class/database/dbobject.class.php" );
+
+ class Location extends DbObject
+ {
+ var $_lat;
+ var $_long;
+ var $_desc;
+ var $_id;
+ var $_blogId;
+
+ function Location( $lat, $long, $blogId, $desc = "", $id = -1 )
+ {
+ $this->_lat = $lat;
+ $this->_long = $long;
+ $this->_desc = $desc;
+ $this->_id = $id;
+ $this->_blogId = $blogId;
+
+ $this->_pk = "id";
+ $this->_fields = Array(
+ "latitude" => "getLatitude",
+ "longitude" => "getLongitude",
+ "description" => "getDescription",
+ "blog_id" => "getBlogId",
+ "id" => "getId"
+ );
+ }
+
+ function getId()
+ {
+ return( $this->_id );
+ }
+
+ function setId( $id )
+ {
+ $this->_id = $id;
+ }
+
+ function getLatitude()
+ {
+ return( $this->_lat );
+ }
+
+ function getLongitude()
+ {
+ return( $this->_long );
+ }
+
+ function getDescription()
+ {
+ return( $this->_desc );
+ }
+
+ function getBlogId()
+ {
+ return( $this->_blogId );
+ }
+ }
+?>
\ No newline at end of file
Added: plog/trunk/class/dao/locationawaredbobject.class.php
===================================================================
--- plog/trunk/class/dao/locationawaredbobject.class.php (rev 0)
+++ plog/trunk/class/dao/locationawaredbobject.class.php 2007-01-30 13:04:45 UTC (rev 4624)
@@ -0,0 +1,62 @@
+<?php
+
+ include_once( PLOG_CLASS_PATH."class/database/dbobject.class.php" );
+ include_once( PLOG_CLASS_PATH."class/dao/location.class.php" );
+
+ /**
+ * @see DbObject
+ */
+ class LocationAwareDbObject extends DbObject
+ {
+ var $_locationId;
+ var $_location;
+
+ /**
+ * @return Location
+ */
+ function getLocation()
+ {
+ if( $this->_location === null ) {
+ include_once( PLOG_CLASS_PATH."class/dao/locations.class.php" );
+ $locations = new Locations();
+ $this->_location = $locations->getLocation( $this->getLocationId());
+ }
+
+ return( $this->_location );
+ }
+
+ /**
+ * @param location Location
+ */
+ function setLocation( $location )
+ {
+ $this->_location = $location;
+ $this->setLocationId( $location->getId());
+ }
+
+ /**
+ * @return location id
+ */
+ function getLocationId()
+ {
+ return( $this->_locationId );
+ }
+
+ /**
+ * Set the location id
+ */
+ function setLocationId( $id )
+ {
+ $this->_locationId = $id;
+ $this->_location = null;
+ }
+
+ /**
+ * @return True if this resource has location data or false otherwise
+ */
+ function hasLocationData()
+ {
+ return( $this->getLocationId() != 0 );
+ }
+ }
+?>
\ No newline at end of file
Added: plog/trunk/class/dao/locations.class.php
===================================================================
--- plog/trunk/class/dao/locations.class.php (rev 0)
+++ plog/trunk/class/dao/locations.class.php 2007-01-30 13:04:45 UTC (rev 4624)
@@ -0,0 +1,102 @@
+<?php
+
+ include_once( PLOG_CLASS_PATH."class/dao/model.class.php" );
+ include_once( PLOG_CLASS_PATH."class/dao/location.class.php" );
+
+ define( "CACHE_LOCATION_BY_ID", "location_by_id" );
+ define( "CACHE_LOCATIONS_BY_BLOG", "locations_by_blog" );
+
+ class Locations extends Model
+ {
+ function Locations()
+ {
+ $this->Model();
+
+ $this->table = $this->getPrefix()."locations";
+ }
+
+ function getLocation( $locId )
+ {
+ return( $this->get( "id", $locId, CACHE_LOCATION_BY_ID ));
+ }
+
+ function getBlogLocations( $blogId )
+ {
+ $locations = $this->getMany( "blog_id", $blogId, CACHE_LOCATIONS_BY_BLOG );
+
+ if( !$locations )
+ $locations = Array();
+
+ return( $locations );
+ }
+
+ /**
+ * Finds a location given its latitude and longitude
+ *
+ * @param lat
+ * @param long
+ * @param blogId
+ * @return Location
+ */
+ function getLocationByLatLong( $lat, $long, $blogId )
+ {
+ $query = "SELECT id, latitude, longitude, description, blog_id ".
+ "FROM ".$this->getPrefix()."locations ".
+ "WHERE latitude = '".Db::qstr( $lat )."' AND longitude = '".Db::qstr( $long )."'";
+ if( $blogId != -1 )
+ $query .= " AND blog_id = '".Db::qstr( $blogId )."'";
+
+ $result = $this->Execute( $query );
+
+ if( !$result )
+ return false;
+
+ if( $result->RowCount() == 0 )
+ return false;
+
+ $row = $result->FetchRow();
+ return( $this->mapRow( $row ));
+ }
+
+ /**
+ * @param lat
+ * @param long
+ * @param blogId
+ * @param desc
+ * @return Location
+ */
+ function getLocationAddIfNotFound( $lat, $long, $blogId, $desc )
+ {
+ $location = $this->getLocationByLatLong( $lat, $long, $blogId );
+ if( !$location ) {
+ // it didn't exist so we have to add it
+ $location = new Location( $lat, $long, $blogId, $desc );
+ $this->addLocation( $location );
+ }
+
+ return( $location );
+ }
+
+ /**
+ * @param loc
+ */
+ function addLocation( $loc )
+ {
+ if(( $result = $this->add( $loc ))) {
+ $this->_cache->removeData( $loc->getBlogId(), CACHE_LOCATIONS_BY_BLOG );
+ }
+
+ return( $result );
+ }
+
+ function deleteLocation( $locId )
+ {
+ return( $this->delete( "id", $locId ));
+ }
+
+ function mapRow( $row )
+ {
+ return( new Location( $row["latitude"], $row["longitude"], $row["blog_id"], $row["description"], $row["id"] ));
+ }
+ }
+?>
\ No newline at end of file
Modified: plog/trunk/class/dao/model.class.php
===================================================================
--- plog/trunk/class/dao/model.class.php 2007-01-30 09:49:45 UTC (rev 4623)
+++ plog/trunk/class/dao/model.class.php 2007-01-30 13:04:45 UTC (rev 4624)
@@ -145,6 +145,12 @@
"generated the following error message = \n" .
$error );
}
+
+ if( true ) {
+ lt_include( PLOG_CLASS_PATH . "class/logger/loggermanager.class.php" );
+ $log =& LoggerManager::getLogger();
+ $log->error( $query."\n----\n" );
+ }
return( $result );
}
Modified: plog/trunk/class/gallery/dao/galleryresource.class.php
===================================================================
--- plog/trunk/class/gallery/dao/galleryresource.class.php 2007-01-30 09:49:45 UTC (rev 4623)
+++ plog/trunk/class/gallery/dao/galleryresource.class.php 2007-01-30 13:04:45 UTC (rev 4624)
@@ -1,6 +1,6 @@
<?php
- lt_include( PLOG_CLASS_PATH."class/database/dbobject.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/dao/locationawaredbobject.class.php" );
lt_include( PLOG_CLASS_PATH."class/gallery/galleryconstants.php" );
// Add this to avoid long file name error in windows server
@@ -17,7 +17,7 @@
* This class also provides methods for getting the correct metadata reader, for checking the type of the
* resource, for getting access to the thumbnail of the object, etc.
*/
- class GalleryResource extends DbObject
+ class GalleryResource extends LocationAwareDbObject
{
var $_id;
@@ -34,6 +34,8 @@
var $_thumbnailFormat;
var $_fileDescriptor;
var $_fileSize;
+ var $_location;
+ var $_locationId;
/**
* Constructor.
@@ -63,7 +65,7 @@
function GalleryResource( $ownerId, $albumId, $description, $flags, $resourceType,
$filePath, $fileName, $metadata, $date, $thumbnailFormat, $properties = Array(), $id = -1 )
{
- $this->DbObject();
+ $this->LocationAwareDbObject();
$this->_ownerId = $ownerId;
$this->_albumId = $albumId;
$this->_description = $description;
@@ -92,7 +94,8 @@
"thumbnail_format" => "getThumbnailFormat",
"normalized_description" => "getNormalizedDescription",
"properties" => "getProperties",
- "metadata" => "getMetadata"
+ "metadata" => "getMetadata",
+ "loc_id" => "getLocationId"
);
$this->_fileDescriptor = false;
}
@@ -506,6 +509,6 @@
}
return( $link );
- }
+ }
}
?>
\ No newline at end of file
Modified: plog/trunk/class/gallery/dao/galleryresources.class.php
===================================================================
--- plog/trunk/class/gallery/dao/galleryresources.class.php 2007-01-30 09:49:45 UTC (rev 4623)
+++ plog/trunk/class/gallery/dao/galleryresources.class.php 2007-01-30 13:04:45 UTC (rev 4624)
@@ -872,7 +872,8 @@
unserialize($row["properties"]),
$row["id"] );
- $res->setFileSize( $row["file_size"] );
+ $res->setFileSize( $row["file_size"] );
+ $res->setLocationId( $row["loc_id"] );
return $res;
}
Added: plog/trunk/class/template/smarty/plugins/function.location_chooser.php
===================================================================
--- plog/trunk/class/template/smarty/plugins/function.location_chooser.php (rev 0)
+++ plog/trunk/class/template/smarty/plugins/function.location_chooser.php 2007-01-30 13:04:45 UTC (rev 4624)
@@ -0,0 +1,55 @@
+<?php
+/**
+ * Smarty {location_chooser} function plugin
+ *
+ * Generates all code necessary to call the location chooser and gather
+ * its location data.
+ */
+function smarty_function_location_chooser($params, &$smarty)
+{
+ // parameter with the locations
+ if( isset( $params["locations"] )) {
+ $locs = $params["locations"];
+ }
+ else {
+ // load the locations if none is available
+ lt_include( PLOG_CLASS_PATH."class/dao/locations.class.php" );
+ $locations = new Locations();
+ if( isset( $params["blogId"] ))
+ $blogId = $params["blogId"];
+ else {
+ $blog = $smarty->_tpl_vars["blog"];
+ $blogId = $blog->getId();
+ }
+
+ $locs = $locations->getBlogLocations( $blogId );
+ }
+
+ // default location id, if any
+ isset( $params["default"] ) ? $default = $params["default"] : $default = null;
+
+ // message for the "add new" string
+ isset( $params["addNewString"] ) ? $addNewString = $params["addNewString"] : $addNewString = "Add New";
+
+ $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=540,width=620');\">";
+ foreach( $locs as $loc ) {
+ $code .= "<option value=\"".$loc->getLatitude().",".$loc->getLongitude()."\"";
+ if( $default ) {
+ if( $loc->getId() == $default->getId())
+ $code .= " selected=\"selected\"";
+ }
+ $code .= ">".$loc->getDescription();
+ if( isset( $params["displayLatLong"] ))
+ $code .= "(".$loc->getLatitude().",".$loc->getLongitude().")";
+ $code .= "</option>";
+ }
+ $code .= "<option value=\"-1\">$addNewString</option>";
+ $code .= " </select>";
+
+ $code .= "<input type=\"hidden\" name=\"locationDesc\" id=\"locationDesc\" value=\"\" />
+ <input type=\"hidden\" name=\"locationLat\" id=\"locationLat\" value=\"\" />
+ <input type=\"hidden\" name=\"locationLong\" id=\"locationLong\" value=\"\" />";
+
+ return( $code );
+}
+?>
Modified: plog/trunk/class/view/admin/adminglobalsettingslistview.class.php
===================================================================
--- plog/trunk/class/view/admin/adminglobalsettingslistview.class.php 2007-01-30 09:49:45 UTC (rev 4623)
+++ plog/trunk/class/view/admin/adminglobalsettingslistview.class.php 2007-01-30 13:04:45 UTC (rev 4624)
@@ -26,7 +26,7 @@
// array with the defined shows
$this->_shows = Array( "general", "summary", "templates", "urls", "email",
"upload", "helpers", "interfaces", "security",
- "bayesian", "resources", "search" );
+ "bayesian", "resources", "search", "location" );
}
function render()
Modified: plog/trunk/class/view/admin/adminnewresourceview.class.php
===================================================================
--- plog/trunk/class/view/admin/adminnewresourceview.class.php 2007-01-30 09:49:45 UTC (rev 4623)
+++ plog/trunk/class/view/admin/adminnewresourceview.class.php 2007-01-30 13:04:45 UTC (rev 4624)
@@ -19,8 +19,7 @@
// get all the albums
$albums = new GalleryAlbums();
$userAlbums = $albums->getNestedAlbumList( $this->_blogInfo->getId());
- $this->notifyEvent( EVENT_ALBUMS_LOADED, Array( "albums" => &$userAlbums ));
-
+ $this->notifyEvent( EVENT_ALBUMS_LOADED, Array( "albums" => &$userAlbums ));
$this->setValue( "albums", $userAlbums );
// transfer control to the parent class
Modified: plog/trunk/class/view/admin/adminview.class.php
===================================================================
--- plog/trunk/class/view/admin/adminview.class.php 2007-01-30 09:49:45 UTC (rev 4623)
+++ plog/trunk/class/view/admin/adminview.class.php 2007-01-30 13:04:45 UTC (rev 4624)
@@ -94,9 +94,14 @@
$this->setValue( 'baseurl', $config->getValue( 'base_url'));
$this->setValue( 'version', Version::getVersion());
$this->setValue( 'uploads_enabled', $config->getValue( 'uploads_enabled' ));
- $this->setValue( 'bayesian_filter_enabled', $config->getValue( 'bayesian_filter_enabled' ));
+ $this->setValue( 'bayesian_filter_enabled', $config->getValue( 'bayesian_filter_enabled' ));
//
+ // is location data enabled?
+ //
+ $this->setValue( 'location_data_enabled', $config->getValue( 'location_data_enabled', false ));
+
+ //
// stuff to generate the menu on the left
//
$menu =& Menu::getMenu();
Added: plog/trunk/class/view/admin/chooser/adminlocationchooserview.class.php
===================================================================
--- plog/trunk/class/view/admin/chooser/adminlocationchooserview.class.php (rev 0)
+++ plog/trunk/class/view/admin/chooser/adminlocationchooserview.class.php 2007-01-30 13:04:45 UTC (rev 4624)
@@ -0,0 +1,30 @@
+<?php
+
+ lt_include( PLOG_CLASS_PATH."class/view/admin/adminsiteblogslistview.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/dao/locations.class.php" );
+
+ /**
+ * \ingroup View
+ * @private
+ */
+ class AdminLocationChooserView extends AdminTemplatedView
+ {
+ function AdminLocationChooserView( $blogInfo, $params = Array())
+ {
+ $this->AdminTemplatedView( $blogInfo, "chooser/location" );
+ }
+
+ function render()
+ {
+ // load the list of currently defined locations
+ $locs = new Locations();
+ $blogLocations = $locs->getBlogLocations( $this->_blogInfo->getId());
+ $this->setValue( "locations", $blogLocations );
+ // google API key
+ $config =& Config::getConfig();
+ $this->setValue( "google_maps_api_key", $config->getValue( "google_maps_api_key" ));
+
+ return( parent::render());
+ }
+ }
+?>
\ No newline at end of file
Added: plog/trunk/imgs/admin/icon_globe-16.png
===================================================================
(Binary files differ)
Property changes on: plog/trunk/imgs/admin/icon_globe-16.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: plog/trunk/imgs/admin/icon_globe-48.png
===================================================================
(Binary files differ)
Property changes on: plog/trunk/imgs/admin/icon_globe-48.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: plog/trunk/install/dbschemas.properties.php
===================================================================
--- plog/trunk/install/dbschemas.properties.php 2007-01-30 09:49:45 UTC (rev 4623)
+++ plog/trunk/install/dbschemas.properties.php 2007-01-30 13:04:45 UTC (rev 4624)
@@ -16,6 +16,7 @@
num_nonspam_trackbacks I(10) NOTNULL DEFAULT '0',
global_category_id I(10) NOTNULL DEFAULT '0',
in_summary_page I1(1) NOTNULL DEFAULT '1',
+ loc_id I(10) NOTNULL DEFAULT '0',
INDEX num_reads (num_reads),
INDEX user_id (user_id),
INDEX slug (slug),
@@ -102,6 +103,7 @@
num_comments I(10) NOTNULL DEFAULT '0',
num_trackbacks I(10) NOTNULL DEFAULT '0',
custom_domain C(50),
+ loc_id I(10) NOTNULL DEFAULT '0',
INDEX owner_id (owner_id),
INDEX mangled_blog (mangled_blog),
INDEX blog_category_id(blog_category_id),
@@ -242,6 +244,7 @@
thumbnail_format varchar(4) NOTNULL DEFAULT 'same',
normalized_description TEXT NOTNULL DEFAULT '',
properties TEXT NOTNULL DEFAULT '',
+ loc_id I(10) NOTNULL DEFAULT 0,
INDEX owner_id (owner_id),
INDEX file_name (file_name),
INDEX album_id_owner_id (album_id, owner_id),
@@ -380,4 +383,14 @@
";
$Tables["global_articles_categories"]["options"] = "TYPE=MyISAM";
+$Tables["locations"]["schema"] = "
+ id I(10) UNSIGNED NOTNULL AUTOINCREMENT PRIMARY,
+ latitude C(30) NOTNULL DEFAULT '',
+ longitude C(30) NOTNULL DEFAULT '',
+ description C(255) NOTNULL DEFAULT '',
+ blog_id I(10) NOTNULL DEFAULT 0,
+ INDEX lat_long_blog_id(latitude,longitude,blog_id),
+ INDEX blog_id(blog_id)
+";
+$Tables["locations"]["options"] = "TYPE=MyISAM";
?>
Modified: plog/trunk/install/defaultconfig.properties.php
===================================================================
--- plog/trunk/install/defaultconfig.properties.php 2007-01-30 09:49:45 UTC (rev 4623)
+++ plog/trunk/install/defaultconfig.properties.php 2007-01-30 13:04:45 UTC (rev 4624)
@@ -126,5 +126,7 @@
$Inserts['hard_show_comments_max'] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('hard_show_comments_max','50',1);";
$Inserts['upload_allowed_files'] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('upload_allowed_files','', 3);";
$Inserts['template_load_order'] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('template_load_order','2', 1);";
-$Inserts['summary_service_name'] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('summary_service_name','Your Service Name', 3);";
+$Inserts['summary_service_name'] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('summary_service_name','Your Service Name', 3);";
+$Inserts['location_data_enabled'] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('location_data_enabled','0', 1);";
+$Inserts['google_maps_api_key'] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('google_maps_api_key','', 3);";
?>
\ No newline at end of file
Added: plog/trunk/js/location/location.js
===================================================================
--- plog/trunk/js/location/location.js (rev 0)
+++ plog/trunk/js/location/location.js 2007-01-30 13:04:45 UTC (rev 4624)
@@ -0,0 +1,264 @@
+/**
+ * The markerMode variable defines whether we can have multiple markers or
+ * more than one marker at the same time: 1 = one marker, any other value = multiple markers
+ */
+var markerMode = 1;
+
+/**
+ * Whether to show our custom control with the list of pre-defined locations
+ */
+var useCustomLocationControl = true;
+
+/**
+ * Array of predefined locations to show in the custom control
+ */
+var locations = new Array(
+ new Array( "0,0", "-- Select --" )
+);
+
+/**
+ * messages
+ */
+var locationLocaleNoMarkerHasBeenSetYet = "No marker has been set yet";
+var locationLocaleNoDescriptionError = "Please type a description for the new location";
+
+/**
+ * Used to control whether the marker is already in place or not, please
+ * do not modify these
+ */
+var markerAdded = false;
+var markerLat = 0;
+var markerLong = 0;
+var globalMarker = new GMarker( new GLatLng(0,0));
+
+/**
+ * The global GMap2 object, please do not modify this
+ */
+var map;
+
+function LocationChooserClickHandler( marker, point )
+{
+ // remove the marker if it was already there
+ if( markerMode != 1 ) {
+ lat = document.getElementById('lat');
+ lng = document.getElementById('long');
+ lat.value = point.lat();
+ lng.value = point.lng();
+ map.addOverlay( new GMarker( point ));
+ }
+ else {
+ if( markerAdded ) {
+ map.removeOverlay( globalMarker );
+ markerAdded = false;
+ }
+ if( !markerAdded ) {
+ lat = document.getElementById('lat');
+ lng = document.getElementById('long');
+ lat.value=point.lat();
+ lng.value=point.lng();
+ globalMarker= new GMarker( point );
+ markerLat = point.lat();
+ markerLong = point.lng();
+ map.addOverlay( globalMarker );
+ markerAdded = true;
+ map.setCenter( point );
+ }
+ }
+}
+
+function LocationChooserLoad()
+{
+ if (GBrowserIsCompatible()) {
+ mapOpts = { mapTypes: new Array( G_HYBRID_MAP ) };
+ map = new GMap2(document.getElementById("map"), mapOpts );
+ // place the centre of the map somewhere in the middle of the atlantic ocean
+ map.setCenter(new GLatLng(37.160316, -38.671875), 13);
+ map.setZoom( 2 );
+
+ // add two controls to our map
+ map.addControl(new GLargeMapControl());
+ map.addControl(new GMapTypeControl());
+ if( useCustomLocationControl )
+ map.addControl(new LifetypeLocationSelectorControl());
+
+ // add a click listener
+ GEvent.addListener(map, "click", LocationChooserClickHandler );
+ }
+}
+
+/**
+ * Jumps to a location when selected in the drop-down list
+ * This function is an event handler that handles the on-change event of the drop-down
+ * list with pre-defined locations
+ */
+function LocationChooserMyLocation( event )
+{
+ // get access to the element that fired the event
+ element = event.currentTarget;
+ // get the string with the coordinates from the selector
+ var coordString = element.options[element.selectedIndex].value;
+ // split them in latitude and longitude
+ var coords = coordString.split(",");
+ if( coords[0] != 0 && coords[1] != 0 ) {
+ // set them to the map
+ map.setCenter( new GLatLng( coords[0], coords[1] ));
+ LocationChooserClickHandler( null, new GLatLng( coords[0], coords[1] ));
+ }
+}
+
+/**
+ * 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 ) {
+ window.alert( "No marker has been set yet." );
+ return false;
+ }
+
+ // get the list that holds the locations
+ locationList = parent.opener.document.getElementById("locationId");
+
+ // is the location already in the list?
+ currentLatLng = new GLatLng(markerLat, markerLong);
+ for( i = 0; i < locationList.options.length; i++ ) {
+ coords = locationList.options[i].value.split(",");
+ optLatLng = new GLatLng( coords[0], coords[1] );
+ if( currentLatLng.equals( optLatLng )) {
+ window.alert("Location already exists!");
+ locationList.selectedIndex = i;
+ return true;
+ }
+ }
+
+ // get the description and quit if empty
+ locationDesc = document.getElementById( "locationDesc" );
+ if( locationDesc.value == "" ) {
+ window.alert( locationLocaleNoDescriptionError );
+ return false;
+ }
+
+ // save the "add_new" option so that it doesn't get removed
+ addNewText = locationList.options[locationList.selectedIndex].text;
+ addNewValue = locationList.options[locationList.selectedIndex].value;
+
+ // if not, then we have to add it
+ opt = parent.opener.document.createElement( "option" );
+ opt.text = locationDesc.value + " (" + markerLat + "," + markerLong + ")";
+ opt.value = markerLat + "," + markerLong;
+ locationList.options[locationList.options.length - 1] = opt;
+
+ // add the "add new" option
+ /*addNew = parent.opener.document.createElement( "option" );
+ addNew.text = addNewText;
+ addNew.value = addNewValue;
+ locationList.options[locationList.options.length - 1] = addNew; */
+
+ // and select the last but one option (the new one that was added)
+ locationList.selectedIndex = locationList.options.length - 1;
+
+ locationLatitude = parent.opener.document.getElementById("locationLat");
+ locationLatitude.value = markerLat;
+ locationLongitude = parent.opener.document.getElementById("locationLong");
+ locationLongitude.value = markerLong;
+ locationDesc = parent.opener.document.getElementById("locationDesc");
+ newLocationDesc = document.getElementById( "locationDesc" );
+ locationDesc.value = newLocationDesc.value;
+
+ return true;
+}
+
+///////////////////////////////////////////////////
+// code for the custom location selector
+///////////////////////////////////////////////////
+function LifetypeLocationSelectorControl() {
+}
+
+LifetypeLocationSelectorControl.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.
+LifetypeLocationSelectorControl.prototype.initialize = function(map) {
+ var container = document.createElement("div");
+
+ list = document.createElement("select");
+
+ // traverse the array with predefined locations
+ for( i = 0; i < locations.length; i++ ) {
+ // build the option
+ opt = document.createElement( "option" );
+ data = locations[i];
+ opt.text = data[1];
+ opt.value = data[0];
+ // and add it to the list
+ try {
+ // standards compliant, doesn't work in IE
+ list.add( opt, null)
+ }
+ catch( ex ) {
+ // IE-only
+ list.add( opt, list.selectedIndex );
+ }
+ }
+
+ // add an onclick event
+ GEvent.addDomListener( list, "change", LocationChooserMyLocation );
+
+ // add the container to the map
+ container.appendChild( list );
+ 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.
+LifetypeLocationSelectorControl.prototype.getDefaultPosition = function() {
+ return new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(7, 7));
+}
\ No newline at end of file
Modified: plog/trunk/templates/admin/blogsettings.template
===================================================================
--- plog/trunk/templates/admin/blogsettings.template 2007-01-30 09:49:45 UTC (rev 4623)
+++ plog/trunk/templates/admin/blogsettings.template 2007-01-30 13:04:45 UTC (rev 4624)
@@ -57,6 +57,16 @@
</select>
{include file="$admintemplatepath/validate.template" field=blogLocale message=$locale->tr("error_invalid_locale")}
</div>
+
+ {if $location_data_enabled}
+ <!-- location selector, this should only appear if location data is enabled -->
+ <div class="field">
+ <label for="locId">{$locale->tr("location")}</label>
+ <span class="required"*</span>
+ <div class="formHelp">{$locale->tr("blog_location_help")}</div>
+ {location_chooser blogId=$blog->getId() addNewString=$locale->tr("add_new") default=$blog->getLocation()}
+ </div>
+ {/if}
<div class="field">
<label for="blogLocale">{$locale->tr("blog_category")}</label>
@@ -72,7 +82,6 @@
</select>
{include file="$admintemplatepath/validate.template" field=blogCategory message=$locale->tr("error_invalid_blog_category")}
</div>
-
<div class="field">
<label for="blogMaxMainPageItems">{$locale->tr("max_main_page_items")}</label>
Added: plog/trunk/templates/admin/chooser/location.template
===================================================================
--- plog/trunk/templates/admin/chooser/location.template (rev 0)
+++ plog/trunk/templates/admin/chooser/location.template 2007-01-30 13:04:45 UTC (rev 4624)
@@ -0,0 +1,27 @@
+{include file="$admintemplatepath/chooser/header.template"}
+ <script src="http://maps.google.com/maps?file=api&v=2&key={$google_maps_api_key}"
+ type="text/javascript"></script>
+ <script type="text/javascript" src="js/location/location.js"></script>
+ <script type="text/javascript">
+ var locations = new Array(
+ new Array( "0,0", "-- {$locale->tr("select")} --" )
+ {foreach from=$locations item=loc name=locationsLoop}
+ {if $smarty.foreach.locationsLoop.first},{/if}
+ new Array( "{$loc->getLatitude()},{$loc->getLongitude()}", "{$loc->getDescription()}" ){if !$smarty.foreach.locationsLoop.last},{/if}
+ {/foreach}
+ );
+ // localized messages
+ var locationLocaleNoMarkerHasBeenSetYet = "{$locale->tr("error_no_marker_set")}";
+ var locationLocaleNoDescriptionError = "{$locale->tr("error_no_description_set")}";
+ </script>
+ <body onload="LocationChooserLoad()" onunload="GUnload()">
+ <div id="map" style="width: 590px; height: 500px;margin-bottom: 10px;"></div>
+ <div id="data" style="width:100%">
+ <input type="hidden" name="lat" value="" id="lat" />
+ <input type="hidden" name="long" value="" id="long" />
+ Description:
+ <input type="text" name="locationDesc" value="" id="locationDesc" style="width:60%" >
+ <input type="button" onClick="if( LocationChooserAddLocation()) window.close(); " value="{$locale->tr("add_location")}" />
+ </div>
+
+{include file="$admintemplatepath/chooser/footer.template"}
\ No newline at end of file
Modified: plog/trunk/templates/admin/globalsettings.template
===================================================================
--- plog/trunk/templates/admin/globalsettings.template 2007-01-30 09:49:45 UTC (rev 4623)
+++ plog/trunk/templates/admin/globalsettings.template 2007-01-30 13:04:45 UTC (rev 4624)
@@ -46,6 +46,10 @@
{assign var=file value="$admintemplatepath/globalsettings_search.template"}
{assign var=show value="search"}
{assign var=optName value="searchSettings"}
+{elseif $show == "location"}
+{assign var=file value="$admintemplatepath/globalsettings_location.template"}
+{assign var=show value="location"}
+{assign var=optName value="locationSettings"}
{else}
{assign var=file value="$admintemplatepath/globalsettings_general.template"}
{assign var=show value="general"}
Added: plog/trunk/templates/admin/globalsettings_location.template
===================================================================
--- plog/trunk/templates/admin/globalsettings_location.template (rev 0)
+++ plog/trunk/templates/admin/globalsettings_location.template 2007-01-30 13:04:45 UTC (rev 4624)
@@ -0,0 +1,15 @@
+<div style="padding-left:10px;" id="location">
+ <!-- location_data_enabled -->
+ <div class="field">
+ <label for="config[location_data_enabled]">location_data_enabled</label>
+ <div class="formHelp">{$locale->tr("help_location_data_enabled")}</div>
+ <input class="radio" type="radio" name="config[location_data_enabled]" value="1" {if $location_data_enabled == 1 } checked="checked" {/if} />{$locale->tr("yes")}
+ <input class="radio" type="radio" name="config[location_data_enabled]" value="0" {if $location_data_enabled == 0 } checked="checked" {/if} />{$locale->tr("no")}
+ </div>
+ <!-- google_maps_api_key -->
+ <div class="field">
+ <label for="config[google_maps_api_key]">google_maps_api_key</label>
+ <div class="formHelp">{$locale->tr("help_google_maps_api_key")}</div>
+ <input style="width:100%" type="text" id="config[google_maps_api_key]" name="config[google_maps_api_key]" value="{$google_maps_api_key}"/>
+ </div>
+</div>
\ No newline at end of file
Modified: plog/trunk/templates/admin/menus.xml
===================================================================
--- plog/trunk/templates/admin/menus.xml 2007-01-30 09:49:45 UTC (rev 4623)
+++ plog/trunk/templates/admin/menus.xml 2007-01-30 13:04:45 UTC (rev 4624)
@@ -79,6 +79,7 @@
<bayesianSettings url="?op=editSiteSettings&show=bayesian" andPerms="view_global_settings" admin="1"/>
<resourcesSettings url="?op=editSiteSettings&show=resources" andPerms="view_global_settings" admin="1"/>
<searchSettings url="?op=editSiteSettings&show=search" andPerms="view_global_settings" admin="1"/>
+ <locationSettings url="?op=editSiteSettings&show=location" andPerms="view_global_settings" admin="1"/>
</GlobalSettings>
<Plugins ignoreBreadCrumbs="1" admin="1" orPerms="view_plugins,update_plugin_settings">
<pluginCenter url="?op=pluginCenter" admin="1" andPerms="view_plugins"/>
Modified: plog/trunk/templates/admin/newpost.template
===================================================================
--- plog/trunk/templates/admin/newpost.template 2007-01-30 09:49:45 UTC (rev 4623)
+++ plog/trunk/templates/admin/newpost.template 2007-01-30 13:04:45 UTC (rev 4624)
@@ -135,6 +135,16 @@
{/foreach}
</select>
</div>
+
+ {if $location_data_enabled}
+ <!-- location selector, this should only appear if location data is enabled -->
+ <div class="field">
+ <label for="locId">{$locale->tr("location")}</label>
+ <span class="required"*</span>
+ <div class="formHelp">{$locale->tr("article_location_help")}</div>
+ {location_chooser blogId=$blog->getId() addNewString=$locale->tr("add_new")}
+ </div>
+ {/if}
<div class="field">
<label for="postCategories[]">{$locale->tr("categories")}</label>
Modified: plog/trunk/templates/admin/newresource.template
===================================================================
--- plog/trunk/templates/admin/newresource.template 2007-01-30 09:49:45 UTC (rev 4623)
+++ plog/trunk/templates/admin/newresource.template 2007-01-30 13:04:45 UTC (rev 4624)
@@ -35,6 +35,16 @@
{/foreach}
</select>
</div>
+
+ {if $location_data_enabled}
+ <div class="field">
+ <label for="locId">{$locale->tr("location")}</label>
+ <span class="required"*</span>
+ <div class="formHelp">{$locale->tr("location_help")}</div>
+ {location_chooser locations=$locations addNewString=$locale->tr("add_new")}
+ </div>
+ {/if}
+
</fieldset>
<div class="buttons" id="buttons">
<input type="reset" name="reset" value="{$locale->tr("reset")}" />
Modified: plog/trunk/templates/admin/resourceinfo.template
===================================================================
--- plog/trunk/templates/admin/resourceinfo.template 2007-01-30 09:49:45 UTC (rev 4623)
+++ plog/trunk/templates/admin/resourceinfo.template 2007-01-30 13:04:45 UTC (rev 4624)
@@ -47,6 +47,10 @@
{assign var=imgPath value="imgs/admin/icon_file-48.png"}
{$locale->tr("size")}: {$metadata->getFileSize()} {$locale->tr("bytes")}<br/>
{/if}
+ {if $resource->hasLocationData()}
+ {assign var=loc value=$resource->getLocation()}
+ {$locale->tr("location")}: <a onClick="window.open('?op=locationDisplay','Location Chooser','scrollbars=no,resizable=no,toolbar=no,height=540,width=620');return false;" href="#">{$loc->getDescription()}</a><br/>
+ {/if}
</span>
</div>
<div class="field">
Modified: plog/trunk/templates/admin/resources.template
===================================================================
--- plog/trunk/templates/admin/resources.template 2007-01-30 09:49:45 UTC (rev 4623)
+++ plog/trunk/templates/admin/resources.template 2007-01-30 13:04:45 UTC (rev 4624)
@@ -106,6 +106,9 @@
{/if}
{/if}
</a><br/>
+ {if $resource->hasLocationData()}
+ <img src="imgs/admin/icon_globe-16.png" alt="Location Data" />
+ {/if}
<a href="admin.php?op=resourceInfo&resourceId={$resource->getId()}">{$resource->getFileName()}</a>
</td>
<td>
More information about the pLog-svn
mailing list