Skip to content

Instantly share code, notes, and snippets.

@mekras
Created February 10, 2012 12:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mekras/1789329 to your computer and use it in GitHub Desktop.
Save mekras/1789329 to your computer and use it in GitHub Desktop.
Возможность отключения автоопределения положения в плагине Location для LiveStreet
diff --git a/plugins/location/config/config.php b/plugins/location/config/config.php
index b838421..ad6f4ff 100644
--- a/plugins/location/config/config.php
+++ b/plugins/location/config/config.php
@@ -24,6 +24,9 @@
$config['map']['height'] = '300px'; // Высота карты в отображение/редактировании/создании топика
$config['map']['zoom'] = 13; // Зум карты в отображение/редактировании/создании топика
+$config['location']['autodetect'] = true; // Использовать ли автоопределение положения
+$config['location']['default'] = '55.93304,37.52454'; // Положение по умолчанию
+
// Для использования yandex карт.
$config['yandex']['use'] = false; // Использовать ли Яндекс.Карты. Если установленно false используюется Google.Maps
// АPI.Ключ. Получать тут http://api.yandex.ru/maps/form.xml
diff --git a/plugins/location/templates/skin/default/topic_add_location.tpl b/plugins/location/templates/skin/default/topic_add_location.tpl
index d5fa735..5279c41 100644
--- a/plugins/location/templates/skin/default/topic_add_location.tpl
+++ b/plugins/location/templates/skin/default/topic_add_location.tpl
@@ -25,18 +25,26 @@
devall.location.addMarker();
{/if}
- {if $_aRequest.location_latlng == 0 and !Config::Get('plugin.location.hide.map.add')}
- devall.location.geoLocation(function (loc) {
- devall.location.initMap();
- devall.location.draggable = true;
- devall.location.addMarker();
- });
- {/if}
-
- {if $_aRequest.location_latlng == 0 and Config::Get('plugin.location.hide.map.add')}
- devall.location.geoLocation(function (loc) {
- devall.location.draggable = true;
- });
+ {if $_aRequest.location_latlng == 0}
+
+ {if Config::Get('plugin.location.location.autodetect')}
+ {if Config::Get('plugin.location.hide.map.add')}
+ devall.location.geoLocation(function (loc) {
+ devall.location.draggable = true;
+ });
+ {else}
+ devall.location.geoLocation(function (loc) {
+ devall.location.initMap();
+ devall.location.draggable = true;
+ devall.location.addMarker();
+ });
+ {/if}
+ {else}
+ devall.location.position = [{Config::Get('plugin.location.location.default')}];
+ devall.location.initMap();
+ devall.location.draggable = true;
+ devall.location.addMarker();
+ {/if}
{/if}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment