plugin_geotag:

* If post was updated the location was cleared.
* Added "clear location" button, because it was not possible to clear.
This commit is contained in:
Grischa Brockhaus 2012-06-08 01:07:56 +02:00
parent 4c580d4c7b
commit 9b56a515a2
7 changed files with 28 additions and 6 deletions

View file

@ -1,3 +1,8 @@
1.29 (brockhaus)
----------------------------------
* If post was updated the location was cleared.
* Added "clear location" button, because it was not possible to clear.
1.28 (brockhaus)
----------------------------------
* Deleting entries did not delete GeoTag db entries.

View file

@ -19,14 +19,22 @@ class GeoTagDb {
foreach($supported_properties AS $prop_key) {
$prop_val = (isset($properties[$prop_key]) ? $properties[$prop_key] : null);
if (!$deleteMissing && empty($prop_val)) continue; // Don't clear data if not allowed.
$q = '';
if (!isset($property[$prop_key]) && !empty($prop_val)) {
$q = "INSERT INTO {$serendipity['dbPrefix']}entryproperties (entryid, property, value) VALUES (" . (int)$entryId . ", '" . serendipity_db_escape_string($prop_key) . "', '" . serendipity_db_escape_string($prop_val) . "')";
if ($prop_val!='#') {
$q = "INSERT INTO {$serendipity['dbPrefix']}entryproperties (entryid, property, value) VALUES (" . (int)$entryId . ", '" . serendipity_db_escape_string($prop_key) . "', '" . serendipity_db_escape_string($prop_val) . "')";
}
} elseif ($property[$prop_key] != $prop_val && !empty($prop_val)) {
$q = "UPDATE {$serendipity['dbPrefix']}entryproperties SET value = '" . serendipity_db_escape_string($prop_val) . "' WHERE entryid = " . (int)$entryId . " AND property = '" . serendipity_db_escape_string($prop_key) . "'";
} else {
if ($prop_val=='#') {
$q = "DELETE FROM {$serendipity['dbPrefix']}entryproperties WHERE entryid = " . (int)$entryId . " AND property = '" . serendipity_db_escape_string($prop_key) . "'";
}
else {
$q = "UPDATE {$serendipity['dbPrefix']}entryproperties SET value = '" . serendipity_db_escape_string($prop_val) . "' WHERE entryid = " . (int)$entryId . " AND property = '" . serendipity_db_escape_string($prop_key) . "'";
}
} elseif (empty($property[$prop_key])){
$q = "DELETE FROM {$serendipity['dbPrefix']}entryproperties WHERE entryid = " . (int)$entryId . " AND property = '" . serendipity_db_escape_string($prop_key) . "'";
}
serendipity_db_query($q);
}
if (!empty($q)) serendipity_db_query($q);
}
}

View file

@ -108,3 +108,4 @@
@define('PLUGIN_GEOTAG_GMAP_GEOCODE_MSG_PROGRESS', "Versuche, die Koordinaten zu ermitteln...");
@define('PLUGIN_GEOTAG_GMAP_GEOCODE_NOT_FOUND', "nicht gefunden");
@define('PLUGIN_GEOTAG_GMAP_GEOCODE_OK', "OK");
@define('PLUGIN_EVENT_CLEAR_LOCATION', "Koordinaten löschen");

View file

@ -107,3 +107,4 @@
@define('PLUGIN_GEOTAG_GMAP_GEOCODE_MSG_PROGRESS', "Versuche, die Koordinaten zu ermitteln...");
@define('PLUGIN_GEOTAG_GMAP_GEOCODE_NOT_FOUND', "nicht gefunden");
@define('PLUGIN_GEOTAG_GMAP_GEOCODE_OK', "OK");
@define('PLUGIN_EVENT_CLEAR_LOCATION', "Koordinaten löschen");

View file

@ -108,3 +108,4 @@
@define('PLUGIN_GEOTAG_GMAP_GEOCODE_MSG_PROGRESS', "Trying to find the coordinates...");
@define('PLUGIN_GEOTAG_GMAP_GEOCODE_NOT_FOUND', "not found");
@define('PLUGIN_GEOTAG_GMAP_GEOCODE_OK', "OK");
@define('PLUGIN_EVENT_CLEAR_LOCATION', "Clear location");

View file

@ -1,5 +1,5 @@
<?php
// Actual version of both plugins
@define('PLUGIN_EVENT_GEOTAG_VERSION', '1.28');
@define('PLUGIN_EVENT_GEOTAG_VERSION', '1.29');
@define('PLUGIN_EVENT_GEOTAG_AUTHOR', 'Zoran Kovacevic, Grischa Brockhaus, Matthias Gutjahr');

View file

@ -347,6 +347,7 @@ class serendipity_event_geotag extends serendipity_event
<label title="<?php echo PLUGIN_EVENT_GEOTAG_LONG; ?>" for="properties_geo_long">&nbsp;<?php echo PLUGIN_EVENT_GEOTAG_LONG; ?>&nbsp;&nbsp;</label>
<?php if ($this->get_config('api_key') !== ''): ?>
<input type="button" onClick="getCurrentPosition(true)" value="<?php echo PLUGIN_GEOTAG_GMAP_GEOCODE_GET_CODE; ?>" />
<input type="button" onClick="clearLocation();" value="<?php echo PLUGIN_EVENT_CLEAR_LOCATION; ?>" />
<p /><p>
<input type="text" id="geoTagAddress" value="<?php echo PLUGIN_GEOTAG_GMAP_GEOCODE_TYPE_ADDRESS; ?>" onkeydown="if (event.keyCode == 13) {geoCode(); return false;}" onClick="clearAdressInput();"/>
<input type="button" onClick="geoCode()" value="<?php echo PLUGIN_GEOTAG_GMAP_GEOCODE; ?>" />
@ -358,6 +359,11 @@ class serendipity_event_geotag extends serendipity_event
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=<?php echo $this->get_config('api_key') ?>" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
function clearLocation() {
document.getElementById('properties_geo_lat').value = '#';
document.getElementById('properties_geo_long').value = '#';
}
var map;
function GLocationPicker(
pickerDivId,