Browse Source

Обновление модуля до версии 1.0.8b

master
root 7 years ago
parent
commit
999081d373
  1. 239
      gmap/class.gmap.php
  2. 491
      gmap/fm.gmap.php
  3. BIN
      gmap/img/no_image.png
  4. BIN
      gmap/img/phone.png
  5. BIN
      gmap/img/url.png
  6. 22
      gmap/js/filemanager_gmap.js
  7. 22
      gmap/js/filemanager_template.js
  8. 96
      gmap/lang/ru.txt
  9. 226
      gmap/module.php
  10. 34
      gmap/sql.php
  11. 170
      gmap/templates/admin_gmap_category.tpl
  12. 293
      gmap/templates/admin_gmap_edit_marker.tpl
  13. 395
      gmap/templates/admin_gmap_markers.tpl
  14. 142
      gmap/templates/map.tpl

239
gmap/class.gmap.php

@ -54,6 +54,167 @@ class Gmap
* ФУНКЦИИ АДМИНИСТРАТИВНОЙ ЧАСТИ
*/
/**
* КАТЕГОРИИ - СОЗДАНИЕ - ДОБАВЛЕНИЕ - РЕДАКТИРОВАНИЕ
*/
// Просмотр существующих категорий в админ панели
function gmapCategoryShow($tpl_dir)
{
global $AVE_DB, $AVE_Template;
$gcats = array();
$sql = $AVE_DB->Query("
SELECT *
FROM " . PREFIX . "_module_gmap_category
");
//$row_gcat = $sql->FetchRow();
while($row = $sql->FetchAssocArray())
{
array_push($gcats, $row);
}
$AVE_Template->assign('gcats', $gcats);
$AVE_Template->assign('content', $AVE_Template->fetch($tpl_dir . 'admin_gmap_category.tpl'));
}
// Редактирование маркеров
function gmapMarkerEdit($tpl_dir, $id)
{
global $AVE_DB, $AVE_Template;
$gmarkers = array();
$sql = $AVE_DB->Query("
SELECT *
FROM " . PREFIX . "_module_gmap_markers
WHERE id = '" . (int)$id. "'
");
while($row = $sql->FetchAssocArray())
{
array_push($gmarkers, $row);
}
$gcats = array();
$sql = $AVE_DB->Query("
SELECT *
FROM " . PREFIX . "_module_gmap_category
");
//$row_gcat = $sql->FetchRow();
while($row = $sql->FetchAssocArray())
{
array_push($gcats, $row);
}
$AVE_Template->assign('gcats', $gcats);
$AVE_Template->assign('gmarkers', $gmarkers);
$AVE_Template->assign('content', $AVE_Template->fetch($tpl_dir . 'admin_gmap_edit_marker.tpl'));
}
// Сохранение отредактированного маркера
function gmapMarkerEditSave($id){
if (isset($_POST['e_marker']))
{
global $AVE_DB;
$markerDataE = $_POST['e_marker'];
$sql = "UPDATE " . PREFIX . "_module_gmap_markers
SET
id = '" . $markerDataE['id'] . "',
gmap_id = '" . $markerDataE['gmap_id'] . "',
latitude = '" . $markerDataE['latitude'] . "',
longitude = '" . $markerDataE['longitude'] . "',
title = '" . $markerDataE['title'] . "',
title_link = '" . $markerDataE['title_link'] . "',
marker_cat_id = '" . $markerDataE['marker_cat_id'] . "',
marker_cat_title = '" . $markerDataE['marker_cat_title'] . "',
marker_cat_link = '" . $markerDataE['marker_cat_link'] . "',
img_title = '" . $markerDataE['img_title'] . "',
marker_city = '" . $markerDataE['marker_city'] . "',
marker_street = '" . $markerDataE['marker_street'] . "',
marker_building = '" . $markerDataE['marker_building'] . "',
marker_dopfield = '" . $markerDataE['marker_dopfield'] . "',
marker_phone = '" . $markerDataE['marker_phone'] . "',
marker_www = '" . $markerDataE['marker_www'] . "',
image = '" . $markerDataE['image']. "'
WHERE id = '" . (int)$id. "'
";
$AVE_DB->Query($sql);
//$markerDataE['id'] = $AVE_DB->InsertId();
echo json_encode($markerDataE);
exit;
}
}
// Добавление и сохранение новых категорий в админ панели модуля и вывод категории при создании
function gmapCategoryNewAdd(){
if (isset($_POST['category']))
{
global $AVE_DB;
$categoryData = $_POST['category'];
$sql = "
INSERT
INTO " . PREFIX . "_module_gmap_category
SET
id = '',
gcat_title = '" . $categoryData['gcatnewadd'] . "',
gcat_link = '" . $categoryData['gct_link'] . "'
";
$AVE_DB->Query($sql);
$categoryData['id'] = $AVE_DB->InsertId();
$sql = $AVE_DB->Query("
SELECT gcat_title
FROM " . PREFIX . "_module_gmap_category
ORDER BY id DESC
LIMIT 1
");
$row_gcat = $sql->FetchRow();
$categoryData['gcat_title'] = $row_gcat->gcat_title;
echo json_encode($categoryData);
exit;
}
}
/**
* Удаление категории
*
* @param int $id - идентификатор категории
*/
function gmapCategoryDel($id){
global $AVE_DB;
$sql = "DELETE FROM " . PREFIX . "_module_gmap_category WHERE id = '" . (int)$id. "'";
$AVE_DB->Query("DELETE FROM " . PREFIX . "_module_gmap_markers WHERE marker_cat_id = '" . (int)$id . "'");
$AVE_DB->Query($sql);
echo $id;
exit;
}
/**
* Просмотр маркеров карты и добавление новых в админке
*
@ -143,9 +304,25 @@ class Gmap
$page_nav = '';
}
$gcats = array();
$sql = $AVE_DB->Query("
SELECT *
FROM " . PREFIX . "_module_gmap_category
$AVE_Template->assign('api_key', GOOGLE_MAP_API_KEY);
");
//$row_gcat = $sql->FetchRow();
while($row = $sql->FetchAssocArray())
{
array_push($gcats, $row);
}
$AVE_Template->assign('gcats', $gcats);
$AVE_Template->assign('gcats_id', $row['id']);
$AVE_Template->assign('api_key', GOOGLE_MAP_API_KEY);
$AVE_Template->assign('page_nav', $page_nav);
$AVE_Template->assign('gmap', $row_gs);
$AVE_Template->assign('gmap_id', $row_gs['id']);
@ -239,6 +416,17 @@ class Gmap
latitude = '" . $markerData['latitude'] . "',
longitude = '" . $markerData['longitude'] . "',
title = '" . $markerData['title'] . "',
title_link = '" . $markerData['title_link'] . "',
marker_cat_id = '" . $markerData['marker_cat_id'] . "',
marker_cat_title = '" . $markerData['marker_cat_title'] . "',
marker_cat_link = '" . $markerData['marker_cat_link'] . "',
img_title = '" . $markerData['img_title'] . "',
marker_city = '" . $markerData['marker_city'] . "',
marker_street = '" . $markerData['marker_street'] . "',
marker_building = '" . $markerData['marker_building'] . "',
marker_dopfield = '" . $markerData['marker_dopfield'] . "',
marker_phone = '" . $markerData['marker_phone'] . "',
marker_www = '" . $markerData['marker_www'] . "',
image = '" . $markerData['image']. "'
";
$AVE_DB->Query($sql);
@ -307,11 +495,48 @@ class Gmap
WHERE id = '" . $id . "'
");
$row_gs = $sql->FetchRow();
echo $row_gs->title;
echo "<div style='white-space: nowrap; overflow:hidden; min-height: 64px;'>";
if ($row_gs->img_title != '/modules/gmap/img/no_image.png'){
echo "<img style='margin: 0px 10px 0px 0px;' src='/index.php?thumb=".$row_gs->img_title."&height=64&width=64&mode=f'>";
} else {
echo "<img style='margin: 0px 10px 0px 0px;' src='/modules/gmap/img/no_image.png'>";
}
echo "<ul style='list-style:none; margin-top:-68px; margin-left: 72px;'>";
if ($row_gs->marker_cat_title != ''){
if ($row_gs->marker_cat_link == '/' || $row_gs->marker_cat_link == 'javascript:void(0);'){
echo "<li><a style='font-size:11px; color:#828282; text-decoration:none;' onmouseover=\"this.style.color='#181818';\" onmouseout=\"this.style.color='#828282';\" href='".$row_gs->marker_cat_link."'>".$row_gs->marker_cat_title."</a></li>";
} else {
echo "<li><a style='font-size:11px; color:#828282; text-decoration:none;' onmouseover=\"this.style.color='#181818';\" onmouseout=\"this.style.color='#828282';\" href='/".$row_gs->marker_cat_link."/'>".$row_gs->marker_cat_title."</a></li>";
}
}
if ($row_gs->title != ''){
if ($row_gs->title_link == '/' || $row_gs->title_link == 'javascript:void(0);'){
echo "<li><a style='font-size:18px; color:#181818; text-decoration:none; border-bottom:2px solid;' onmouseover=\"this.style.color='#FF6600';\" onmouseout=\"this.style.color='#181818';\" href='".$row_gs->title_link."'><strong>".$row_gs->title."</strong></a></li>";
} else {
echo "<li><a style='font-size:18px; color:#181818; text-decoration:none; border-bottom:2px solid;' onmouseover=\"this.style.color='#FF6600';\" onmouseout=\"this.style.color='#181818';\" href='/".$row_gs->title_link."'><strong>".$row_gs->title."</strong></a></li>";
}
}
if ($row_gs->marker_street != '')
echo "<li style='margin-top:5px;'><span style='font-size:12px; color:#68809B;'>".$row_gs->marker_city.', '.$row_gs->marker_street.', '.$row_gs->marker_building."</span></li>";
if ($row_gs->marker_dopfield != '')
echo "<li style='margin-top:5px;'><div style='max-width:280px; white-space: normal !important; color:#828282;'>".$row_gs->marker_dopfield."</div></li></ul>";
echo "<ul style='margin-top:-8px; list-style:none; text-align: center;'>";
if ($row_gs->marker_phone != '')
echo "<li style='margin-top:10px;'><img style='position: relative; top:4px;' src='/modules/gmap/img/phone.png'>".$row_gs->marker_phone."</li>";
if ($row_gs->marker_www != ''){
$placeholders = array('http://www.', 'https://www.', 'http://', 'https://');
echo "<li><a style='font-size:12px; color:#828282; text-decoration:none;' onmouseover=\"this.style.color='#181818';\" onmouseout=\"this.style.color='#828282';\" href='".$row_gs->marker_www."'><img style='position: relative; top:4px;' src='/modules/gmap/img/url.png'>".str_replace($placeholders, 'www.', $row_gs->marker_www)."</a></li></ul>";
}
echo "</div>";
exit;
}
/**
@ -412,8 +637,6 @@ class Gmap
header('Location:index.php?do=modules&action=modedit&mod=gmap&moduleaction=1&amp;cp=' . SESSION);
exit;
}
}
?>

491
gmap/fm.gmap.php

@ -0,0 +1,491 @@
<?php
ob_start();
ob_implicit_flush(0);
define('BASE_DIR', str_replace("\\", "/", dirname(dirname(dirname(__FILE__)))));
require_once(BASE_DIR . '/inc/init.php');
if (! check_permission('adminpanel'))
{
header('Location:/index.php');
exit;
}
$fmgmap = $_POST['fmgmap'];
if ($fmgmap == 'dir_upl')
{
$gmfmen = '<?php
error_reporting(E_ALL); // Set E_ALL for debuging
if (function_exists("date_default_timezone_set")) {
date_default_timezone_set("Europe/Moscow");
}
include_once dirname(__FILE__).DIRECTORY_SEPARATOR."elFinderConnector.class.php";
include_once dirname(__FILE__).DIRECTORY_SEPARATOR."elFinder.class.php";
include_once dirname(__FILE__).DIRECTORY_SEPARATOR."elFinderVolumeDriver.class.php";
include_once dirname(__FILE__).DIRECTORY_SEPARATOR."elFinderVolumeLocalFileSystem.class.php";
include_once dirname(__FILE__).DIRECTORY_SEPARATOR."elFinderVolumeMySQL.class.php";
include_once "../../../../inc/config.php";
include_once "../../../../inc/config.inc.php";
function debug($o) {
echo "<pre>";
print_r($o);
}
function logger($cmd, $voumes, $result) {
$log = $cmd.": [".date("d.m H:s")."] ".$voumes[0]->id()." ";
if (isset($voumes[1])) {
$log .= $voumes[1]->id()." ";
}
switch ($cmd) {
case "mkdir":
case "mkfile":
case "upload":
$log .= $result["added"][0]["name"];
break;
case "rename":
$log .= "from ".$result["removedDetails"][0]["name"]." to ".$result["added"][0]["name"];
break;
case "duplicate":
$log .= "src: ".$result["src"]["name"]." copy: ".$result["added"][0]["name"];
break;
case "rm":
$log .= $result["removedDetails"][0]["name"];
break;
default:
$log = "";
}
if ($log && is_dir("../../../../cache/redactor") || @mkdir("../../../../cache/redactor")) {
$fp = fopen("../../../../cache/redactor/log.txt", "a");
if ($fp) {
fwrite($fp, $log."\n");
fclose($fp);
}
}
return $result;
}
class elFinderSimpleLogger {
public function write($cmd, $voumes, $result) {
$log = $cmd.": [".date("d.m H:s")."] ".$voumes[0]->id()." ";
if (isset($voumes[1])) {
$log .= $voumes[1]->id()." ";
}
switch ($cmd) {
case "mkdir":
case "mkfile":
case "upload":
case "paste":
$log .= $result["added"][0]["name"];
break;
case "rename":
$log .= "from ".$result["removedDetails"][0]["name"]." to ".$result["added"][0]["name"];
break;
case "duplicate":
$log .= "src: ".$result["src"]["name"]." copy: ".$result["added"][0]["name"];
break;
case "rm":
$log .= $result["removedDetails"][0]["name"];
break;
default:
$log = "";
}
if ($log && is_dir("../../../../cache/redactor") || @mkdir("../../../../cache/redactor")) {
$fp = fopen("../../../../cache/redactor/log.txt", "a");
if ($fp) {
fwrite($fp, $log."\n");
fclose($fp);
}
}
return $result;
}
} // END class
function access($attr, $path, $data, $volume) {
return strpos(basename($path), ".") === 0
? !($attr == "read" || $attr == "write")
: $attr == "read" || $attr == "write";
}
class elFinderTestACL {
public function fsAccess($attr, $path, $data, $volume) {
if ($volume->name() == "localfilesystem") {
return strpos(basename($path), ".") === 0
? !($attr == "read" || $attr == "write")
: $attr == "read" || $attr == "write";
}
return true;
}
}
$acl = new elFinderTestACL();
function validName($name) {
return strpos($name, ".") !== 0;
}
$opts = array(
"locale" => "en_US.UTF-8",
"bind" => array(
"mkdir mkfile rename duplicate upload rm paste" => array(new elFinderSimpleLogger(), "write"),
),
"debug" => true,
"roots" => array(
array(
// "id" => "x5",
"driver" => "LocalFileSystem", // driver for accessing file system (REQUIRED)
"path" => "../../../../".UPLOAD_DIR, // path to files (REQUIRED)
"URL" => "/".UPLOAD_DIR."/", // URL to files (REQUIRED)
"alias" => UPLOAD_DIR,
"disabled" => array(),
"acceptedName" => "validName",
"uploadAllow" => array("all"),
"uploadDeny" => array("all"),
"uploadOrder" => "deny,allow",
"uploadOverwrite" => false,
"uploadMaxSize" => "128m",
"copyOverwrite" => false,
"copyJoin" => true,
"mimeDetect" => "internal",
"tmbCrop" => false,
"imgLib" => "gd",
"utf8fix" => true,
"attributes" => array(
array(
"pattern" => "/^\/\./",
"read" => false,
"write" => false,
"hidden" => true,
"locked" => true
),
array(
"pattern" => "/.tmb/",
"read" => false,
"write" => false,
"hidden" => true,
"locked" => false
),
array(
"pattern" => "/\.php$/",
"read" => false,
"write" => false,
"hidden" => true,
"locked" => false
),
array(
"pattern" => "/.quarantine/",
"read" => false,
"write" => false,
"hidden" => true,
"locked" => false
),
array(
"pattern" => "/\.htaccess$/",
"write" => false,
"locked" => false,
"hidden" => true
),
array(
"pattern" => "/.uploader/",
"read" => false,
"write" => false,
"hidden" => true,
"locked" => false
),
array(
"pattern" => "/.temp/",
"read" => false,
"write" => false,
"hidden" => true,
"locked" => false
)
),
)
)
);
header("Access-Control-Allow-Origin: *");
$connector = new elFinderConnector(new elFinder($opts), true);
$connector->run();
?>';
$gfo = fopen(BASE_DIR . "/lib/redactor/elfinder/php/connector_module_gmap.php", "w");
flock($gfo,2);
fwrite($gfo, $gmfmen);
flock($gfo,3);
fclose($gfo);
chmod(BASE_DIR . "/lib/redactor/elfinder/php/connector_module_gmap.php", 0755);
}
if ($fmgmap == 'dir_uplgmi')
{
$gmfmen = '<?php
error_reporting(E_ALL); // Set E_ALL for debuging
if (function_exists("date_default_timezone_set")) {
date_default_timezone_set("Europe/Moscow");
}
include_once dirname(__FILE__).DIRECTORY_SEPARATOR."elFinderConnector.class.php";
include_once dirname(__FILE__).DIRECTORY_SEPARATOR."elFinder.class.php";
include_once dirname(__FILE__).DIRECTORY_SEPARATOR."elFinderVolumeDriver.class.php";
include_once dirname(__FILE__).DIRECTORY_SEPARATOR."elFinderVolumeLocalFileSystem.class.php";
include_once dirname(__FILE__).DIRECTORY_SEPARATOR."elFinderVolumeMySQL.class.php";
include_once "../../../../inc/config.php";
include_once "../../../../inc/config.inc.php";
function debug($o) {
echo "<pre>";
print_r($o);
}
function logger($cmd, $voumes, $result) {
$log = $cmd.": [".date("d.m H:s")."] ".$voumes[0]->id()." ";
if (isset($voumes[1])) {
$log .= $voumes[1]->id()." ";
}
switch ($cmd) {
case "mkdir":
case "mkfile":
case "upload":
$log .= $result["added"][0]["name"];
break;
case "rename":
$log .= "from ".$result["removedDetails"][0]["name"]." to ".$result["added"][0]["name"];
break;
case "duplicate":
$log .= "src: ".$result["src"]["name"]." copy: ".$result["added"][0]["name"];
break;
case "rm":
$log .= $result["removedDetails"][0]["name"];
break;
default:
$log = "";
}
if ($log && is_dir("../../../../cache/redactor") || @mkdir("../../../../cache/redactor")) {
$fp = fopen("../../../../cache/redactor/log.txt", "a");
if ($fp) {
fwrite($fp, $log."\n");
fclose($fp);
}
}
return $result;
}
class elFinderSimpleLogger {
public function write($cmd, $voumes, $result) {
$log = $cmd.": [".date("d.m H:s")."] ".$voumes[0]->id()." ";
if (isset($voumes[1])) {
$log .= $voumes[1]->id()." ";
}
switch ($cmd) {
case "mkdir":
case "mkfile":
case "upload":
case "paste":
$log .= $result["added"][0]["name"];
break;
case "rename":
$log .= "from ".$result["removedDetails"][0]["name"]." to ".$result["added"][0]["name"];
break;
case "duplicate":
$log .= "src: ".$result["src"]["name"]." copy: ".$result["added"][0]["name"];
break;
case "rm":
$log .= $result["removedDetails"][0]["name"];
break;
default:
$log = "";
}
if ($log && is_dir("../../../../cache/redactor") || @mkdir("../../../../cache/redactor")) {
$fp = fopen("../../../../cache/redactor/log.txt", "a");
if ($fp) {
fwrite($fp, $log."\n");
fclose($fp);
}
}
return $result;
}
} // END class
function access($attr, $path, $data, $volume) {
return strpos(basename($path), ".") === 0
? !($attr == "read" || $attr == "write")
: $attr == "read" || $attr == "write";
}
class elFinderTestACL {
public function fsAccess($attr, $path, $data, $volume) {
if ($volume->name() == "localfilesystem") {
return strpos(basename($path), ".") === 0
? !($attr == "read" || $attr == "write")
: $attr == "read" || $attr == "write";
}
return true;
}
}
$acl = new elFinderTestACL();
function validName($name) {
return strpos($name, ".") !== 0;
}
$opts = array(
"locale" => "en_US.UTF-8",
"bind" => array(
"mkdir mkfile rename duplicate upload rm paste" => array(new elFinderSimpleLogger(), "write"),
),
"debug" => true,
"roots" => array(
array(
// "id" => "x5",
"driver" => "LocalFileSystem", // driver for accessing file system (REQUIRED)
"path" => "../../../../".UPLOAD_DIR, // path to files (REQUIRED)
"URL" => "/".UPLOAD_DIR."/", // URL to files (REQUIRED)
"alias" => UPLOAD_DIR,
"disabled" => array(),
"acceptedName" => "validName",
"uploadAllow" => array("all"),
"uploadDeny" => array("all"),
"uploadOrder" => "deny,allow",
"uploadOverwrite" => false,
"uploadMaxSize" => "128m",
"copyOverwrite" => false,
"copyJoin" => true,
"mimeDetect" => "internal",
"tmbCrop" => false,
"imgLib" => "gd",
"utf8fix" => true,
"attributes" => array(
array(
"pattern" => "/^\/\./",
"read" => false,
"write" => false,
"hidden" => true,
"locked" => true
),
array(
"pattern" => "/.tmb/",
"read" => false,
"write" => false,
"hidden" => true,
"locked" => false
),
array(
"pattern" => "/\.php$/",
"read" => false,
"write" => false,
"hidden" => true,
"locked" => false
),
array(
"pattern" => "/.quarantine/",
"read" => false,
"write" => false,
"hidden" => true,
"locked" => false
),
array(
"pattern" => "/\.htaccess$/",
"write" => false,
"locked" => false,
"hidden" => true
),
array(
"pattern" => "/.uploader/",
"read" => false,
"write" => false,
"hidden" => true,
"locked" => false
),
array(
"pattern" => "/.temp/",
"read" => false,
"write" => false,
"hidden" => true,
"locked" => false
)
),
),
array(
// "id" => "x5",
"driver" => "LocalFileSystem", // driver for accessing file system (REQUIRED)
"path" => "../../../../modules/gmap/images", // path to files (REQUIRED)
"URL" => "/modules/gmap/images/", // URL to files (REQUIRED)
"alias" => "modules/gmap/images",
"disabled" => array(),
"acceptedName" => "validName",
"uploadAllow" => array("all"),
"uploadDeny" => array("all"),
"uploadOrder" => "deny,allow",
"uploadOverwrite" => false,
"uploadMaxSize" => "128m",
"copyOverwrite" => false,
"copyJoin" => true,
"mimeDetect" => "internal",
"tmbCrop" => false,
"imgLib" => "gd",
"utf8fix" => true,
"attributes" => array(
array(
"pattern" => "/^\/\./",
"read" => false,
"write" => false,
"hidden" => true,
"locked" => true
),
array(
"pattern" => "/.tmb/",
"read" => false,
"write" => false,
"hidden" => true,
"locked" => false
),
array(
"pattern" => "/\.php$/",
"read" => false,
"write" => false,
"hidden" => true,
"locked" => false
),
array(
"pattern" => "/.quarantine/",
"read" => false,
"write" => false,
"hidden" => true,
"locked" => false
),
array(
"pattern" => "/\.htaccess$/",
"write" => false,
"locked" => false,
"hidden" => true
),
array(
"pattern" => "/.uploader/",
"read" => false,
"write" => false,
"hidden" => true,
"locked" => false
),
array(
"pattern" => "/.temp/",
"read" => false,
"write" => false,
"hidden" => true,
"locked" => false
)
),
),
)
);
header("Access-Control-Allow-Origin: *");
$connector = new elFinderConnector(new elFinder($opts), true);
$connector->run();
?>';
$gfo = fopen(BASE_DIR . "/lib/redactor/elfinder/php/connector_module_gmap.php", "w");
flock($gfo,2);
fwrite($gfo, $gmfmen);
flock($gfo,3);
fclose($gfo);
chmod(BASE_DIR . "/lib/redactor/elfinder/php/connector_module_gmap.php", 0755);
}
if ($fmgmap != 'dir_upl' || $fmgmap != 'dir_uplgmi')
{
header('Location:/index.php');
exit;
}
?>

BIN
gmap/img/no_image.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
gmap/img/phone.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 B

BIN
gmap/img/url.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 457 B

22
gmap/js/filemanager_gmap.js

@ -0,0 +1,22 @@
$(function loadFM() {
// отдельный файловый менеджер
$('#finder').elfinder({
url : ave_path+'lib/redactor/elfinder/php/connector_module_gmap.php',
lang : 'ru',
height : 300,
title : 'Файловый менеджер'
}).elfinder('instance');
$('#elFinder a').hover(
function () {
$('#elFinder a').animate({
'background-position' : '0 -45px'
}, 300);
},
function () {
$('#elFinder a').delay(400).animate({
'background-position' : '0 0'
}, 300);
}
);
});

22
gmap/js/filemanager_template.js

@ -0,0 +1,22 @@
$(function() {
// отдельный файловый менеджер
$('#finder').elfinder({
url : ave_path+'lib/redactor/elfinder/php/connector_template.php',
lang : 'ru',
height : 500,
title : 'Файловый менеджер'
}).elfinder('instance');
$('#elFinder a').hover(
function () {
$('#elFinder a').animate({
'background-position' : '0 -45px'
}, 300);
},
function () {
$('#elFinder a').delay(400).animate({
'background-position' : '0 0'
}, 300);
}
);
});

96
gmap/lang/ru.txt

@ -18,16 +18,19 @@ CpTag = "Тег в системе"
GmapMainAddress = "Адрес для центрирования карты"
SetMarkerOnClick = "Создавать маркер по клику"
GmapZoom = "Масштаб"
AddMarkers = "Действия с маркерами - добавить, удалить, изменить или удалить описание маркеров"
AddMarkerButton = "Добавить маркер"
AddMarkers = "Установка маркеров на карту"
AddMarkerButton = "Добавить и сохранить маркер"
MarkerParam = "Параметры маркера"
MarkerSetVal = "Значения"
MarkerAdress = "Адрес"
MarkerDesc = "Описание"
MarkerSetVal = "Действия:"
MarkerAdress = "Местоположение <strong style='color:red;'>*</strong>"
MarkerDesc = "Категория маркера"
Markercat_h = "Выберите категорию из выпадающего списка и нажмите Применить"
Markerimg_t = "Добавьте миниатюру изображения объекта маркера предпочтительны размеры 64х64px"
Save = "Сохранить"
Delete = "Удалить"
MarkerImage = "Изображение"
MarkerView = "Настройки маркеров на карте"
MarkerImage = "Изображение - маркер на карте <strong style='color:red;'>*</strong>"
MarkerView = "Установка маркеров на карту"
MarkerAddmap = "Создание маркеров"
EditGmap = "Редактирование настроек карты"
DeleteGmap = "Удалить карту"
DeleteGmapC = "Вы уверены, что хотите удалить данную карту?"
@ -45,6 +48,7 @@ SaveSuccess = "Успешно сохранены"
SaveError = "Вызвали ошибку, попробуйте сохранить еще раз..."
Gmap_edit = "Перейти в раздел управления маркерами"
Gmap_esave = "Сохранить изменения"
Gmap_return_page = "На предыдущую страницу"
Gmap_return = "Вернуться к списку карт"
Gmap_maredit = "Управление маркерами"
Gmap_mapedit = "Настройки карты"
@ -52,13 +56,71 @@ Gmap_marcount_no = "Маркеров нет"
Gmap_marcount_info = "Количество маркеров на карте"
Gmap_marcount_yes = "Маркеров на карте: "
Gmap_copy_buf = "Скопировать тег в буфер обмена"
Gmap_edi_mark ="Настройки маркеров на карте"
Gmap_sv_mark ="Маркер"
Gmap_sv_mark1 ="успешно создан и сохранен"
Gmap_sv_mark2 ="Данные успешно сохранены"
Gmap_sv_mark3 ="выбранный маркер успешно удален!"
Gmap_api_key_no ="В системе не установлен GOOGLE MAP API KEY. Пожалуйста, установите ключ в системных настройках."
Gmap_api_key ="Используется GOOGLE MAP API KEY : "
Gmap_link_set_api_key ="Перейти в системные настройки и установить GOOGLE MAP API KEY <br /> После установки ключа в систему, Вы можете начать работу с модулем."
Gmap_link_get_api_key ="Перейти в Google Maps API и получить API KEY"
Gmap_link_get_api_info ="Переход по внешней ссылке, откроется в новом окне."
Gmap_edi_mark = "Установка маркеров на карту"
Gmap_sv_mark = "Маркер"
Gmap_sv_mark1 = "успешно создан и сохранен"
Gmap_sv_mark2 = "Данные успешно сохранены"
Gmap_sv_mark3 = "выбранный маркер успешно удален!"
Gmap_api_key_no = "В системе не установлен GOOGLE MAP API KEY. Пожалуйста, установите ключ в системных настройках."
Gmap_api_key = "Используется GOOGLE MAP API KEY : "
Gmap_link_set_api_key = "Перейти в системные настройки и установить GOOGLE MAP API KEY <br /> После установки ключа в систему, Вы можете начать работу с модулем."
Gmap_link_get_api_key = "Перейти в Google Maps API и получить API KEY"
Gmap_link_get_api_info = "Переход по внешней ссылке, откроется в новом окне."
Gmap_fm_inf = "Настройки файлового менеджера. Клик по кнопке - запомнить и подключить только директорию"
Gmap_fm_inf1 = "UPLOADS"
Gmap_fm_inf2 = "или директории"
Gmap_fm_inf3 = "UPLOADS + modules/gmap/images"
Gmap_fm = "Файловый менеджер"
Gmap_img_title = "Изображение объекта маркера"
Gmap_load_img_title = "Посмотреть на сервере"
Gmap_doc_title = "Документ маркера"
Gmap_btn_doc_title = "Связать с документом"
Gmap_link_single_marker = "Ссылка на документ, принадлежащий этому маркеру. Например: маркер на карте указывает на Московский зоопарк, далее вы создаете (или уже создали) документ Московский зоопарк, затем выбираете этот документ кликом по кнопке Связать с документом. Также вы можете просто ввести название с клавиатуры в это поле."
Gmap_link_single_image = "Изображение объекта маркера. Корневой директорией для хранения изображений является директория UPLOADS - в ней вы можете с помощью файлового менеджера создавать поддиректории и хранить там файлы изображений. Помните, что , при выводе маркера на карте , размер изображения в нем , будет 64х64 пикселя."
Gmap_link_category = "Это поле доступно только для ввода значений из выпадающего списка!<br> Если вы хотите ввести здесь просто название, без ссылки на конкретный документ-категорию, перейдите в раздел 'Редактирование категорий' и создайте категорию с нужным вам названием и без ссылки на документ. После этого созданная вами категория будет доступна в выпадающем списке."
Gmap_cat_sel = "Выбрать категорию"
Gmap_cat_create = "Создать категории"
Gmap_cat_edit = "Редактировать категории"
Gmap_cat_manage = "Управление категориями"
Gmap_cat_list = "Список категорий"
Gmap_cat_add = "Добавить категорию"
Gmap_cat_cs = "Выберите категорию!"
Gmap_cat_cnf = "Применить"
Gmap_cat_name = "Название категории"
Gmap_cat_save = "Сохранить"
Gmap_cat_nca = "Добавлена новая категория:"
Gmap_cat_i = "Категория"
Gmap_cat_in = "Успешно создана и сохранена"
Gmap_cat_ind = "категория и принадлежащие ей маркеры успешно удалены."
Gmap_cat_del = "Удалить категорию"
Gmap_cat_delconf = "Вы действительно хотите удалить категорию?"
Gmap_warndelcat1 = "В данном разделе, вы можете создавать или удалять категории к которым принадлежат маркеры.<br>Не забывайте, что, при удалении категории, <strong style='color:red;'>все маркеры,</strong> принадлежащие данной категории, будут так же удалены."
Gmap_cat_inf_dop = "Вывести при клике на маркер следующую информацию:"
Gmap_cat_inf_t = "Город или населенный пункт <strong style='color:red;'>*</strong>"
Gmap_cat_inf_tn = "Город или населенный пункт"
Gmap_cat_inf_tp = "Москва"
Gmap_cat_inf_stp = "Тверская"
Gmap_cat_inf_blp = "15, 77"
Gmap_cat_inf_dopfi = "Дополнительная информация"
Gmap_cat_inf_telp = "В произвольном формате"
Gmap_cat_inf_tt = "Это поле обязательно для заполнения !<br>"
Gmap_cat_inf_st = "<strong style='color:#F3A30E;'>Улица</strong> (это поле является ключом)"
Gmap_cat_inf_bi = "Строение, офис"
Gmap_cat_inf_ap = "Дополнительная информация"
Gmap_cat_inf_phone = "Телефон"
Gmap_cat_inf_www = "Вебсайт"
Gmap_cat_inf_wwwf = "Формат поля, например https://mysite.ru"
Gmap_cat_inf_wwwi = "Обязательно указывайте протокол <br> http:// или https://"
Gmap_not_mark_a = "Выберите изображение маркера!"
Gmap_not_mark_all = "Маркер не может быть сохранен, заполните обязательные поля: ' Местоположение '' и ' Город или населенный пункт! '"
Gmap_not_mark_t = "Маркер не может быть сохранен, заполните обязательное поле ' Город или населенный пункт! '"
Gmap_narker_edit = "Редактировать"
Gmap_narker_edit_not = "Это поле недоступно для редактирования"
MarkerAdress_not = "Местоположение"
MarkerAdress_e_brc = "Редактирование маркера ID "
MarkerAdress_m_e = "Раздел редактирования маркера"
Gmap_field_reset = "Сбросить значения всех полей"
Gmap_mar_map_ret = "Закончить редактирование и вернуться на карту"
Gmap_mar_map_retry = "Вернуться к созданию маркеров"
Gmap_mar_editsave = "Сохранить изменения"
Gmap_mar_key_street = "Это поле является ключом! Если оно заполнено - в маркере будет включен вывод строки, состоящей из полей: Город или населенный пункт, Улица, Строение-офис. Если это поле (Улица) незаполнено - перечисленные поля выводиться не будут!"

226
gmap/module.php

@ -14,10 +14,10 @@ if (defined('ACP'))
{
$modul['ModuleName'] = 'GMap';
$modul['ModuleSysName'] = 'gmap';
$modul['ModuleVersion'] = '1.0.6';
$modul['ModuleVersion'] = '1.0.8b';
$modul['ModuleDescription'] = 'Gmap<br/>Для того, чтобы осуществить просмотр карты, необходимо разместить системный тег <strong>[mod_gmap:XXX]</strong> в теле какого-либо документа';
$modul['ModuleAutor'] = 'OcPh upgrade Repellent';
$modul['ModuleCopyright'] = '&copy; 2016 OcPh & AVE.cms Team';
$modul['ModuleAutor'] = 'OcPh | Project Manager Duncan | Upgrade module Repellent';
$modul['ModuleCopyright'] = '&copy; 2016-2017 OcPh & AVE.cms Team';
$modul['ModuleIsFunction'] = 1;
$modul['ModuleAdminEdit'] = 1;
$modul['ModuleFunction'] = 'mod_gmap';
@ -67,8 +67,29 @@ if (defined('ACP') && !empty($_REQUEST['moduleaction']))
break;
case 'show': // Просмотр маркеров карты
$_SESSION['use_editor'] = get_settings('use_editor');
$gmap->gmapMarkersShow($tpl_dir, intval($_REQUEST['id']));
break;
case 'showcategory': // Просмотр категорий
$gmap->gmapCategoryShow($tpl_dir);
break;
case 'editmarker': // Редактирование маркера
$gmap->gmapMarkerEdit($tpl_dir, intval($_REQUEST['id']));
break;
case 'saveeditmarker': // Сохранение отредактированного маркера
$gmap->gmapMarkerEditSave(intval($_REQUEST['id']));
break;
case 'addnewcategory': // Добавление новой категории
$gmap->gmapCategoryNewAdd(intval($_REQUEST['id']));
break;
case 'gcatdel': // Удаление категории
$gmap->gmapCategoryDel(intval($_REQUEST['id']));
break;
case 'addmarker': // Добавление маркера
$gmap->gmapMarkersAdd(intval($_REQUEST['id']));
break;
@ -97,5 +118,204 @@ if (defined('ACP') && !empty($_REQUEST['moduleaction']))
}
}
// подключаем файловый менеджер проверяем , если файла нет - создаем, если есть ничего не делаем
$filename = BASE_DIR . '/lib/redactor/elfinder/php/connector_module_gmap.php';
if (!file_exists($filename)) {
$gmfmen = '<?php
error_reporting(E_ALL); // Set E_ALL for debuging
if (function_exists("date_default_timezone_set")) {
date_default_timezone_set("Europe/Moscow");
}
include_once dirname(__FILE__).DIRECTORY_SEPARATOR."elFinderConnector.class.php";
include_once dirname(__FILE__).DIRECTORY_SEPARATOR."elFinder.class.php";
include_once dirname(__FILE__).DIRECTORY_SEPARATOR."elFinderVolumeDriver.class.php";
include_once dirname(__FILE__).DIRECTORY_SEPARATOR."elFinderVolumeLocalFileSystem.class.php";
include_once dirname(__FILE__).DIRECTORY_SEPARATOR."elFinderVolumeMySQL.class.php";
include_once "../../../../inc/config.php";
include_once "../../../../inc/config.inc.php";
function debug($o) {
echo "<pre>";
print_r($o);
}
function logger($cmd, $voumes, $result) {
$log = $cmd.": [".date("d.m H:s")."] ".$voumes[0]->id()." ";
if (isset($voumes[1])) {
$log .= $voumes[1]->id()." ";
}
switch ($cmd) {
case "mkdir":
case "mkfile":
case "upload":
$log .= $result["added"][0]["name"];
break;
case "rename":
$log .= "from ".$result["removedDetails"][0]["name"]." to ".$result["added"][0]["name"];
break;
case "duplicate":
$log .= "src: ".$result["src"]["name"]." copy: ".$result["added"][0]["name"];
break;
case "rm":
$log .= $result["removedDetails"][0]["name"];
break;
default:
$log = "";
}
if ($log && is_dir("../../../../cache/redactor") || @mkdir("../../../../cache/redactor")) {
$fp = fopen("../../../../cache/redactor/log.txt", "a");
if ($fp) {
fwrite($fp, $log."\n");
fclose($fp);
}
}
return $result;
}
class elFinderSimpleLogger {
public function write($cmd, $voumes, $result) {
$log = $cmd.": [".date("d.m H:s")."] ".$voumes[0]->id()." ";
if (isset($voumes[1])) {
$log .= $voumes[1]->id()." ";
}
switch ($cmd) {
case "mkdir":
case "mkfile":
case "upload":
case "paste":
$log .= $result["added"][0]["name"];
break;
case "rename":
$log .= "from ".$result["removedDetails"][0]["name"]." to ".$result["added"][0]["name"];
break;
case "duplicate":
$log .= "src: ".$result["src"]["name"]." copy: ".$result["added"][0]["name"];
break;
case "rm":
$log .= $result["removedDetails"][0]["name"];
break;
default:
$log = "";
}
if ($log && is_dir("../../../../cache/redactor") || @mkdir("../../../../cache/redactor")) {
$fp = fopen("../../../../cache/redactor/log.txt", "a");
if ($fp) {
fwrite($fp, $log."\n");
fclose($fp);
}
}
return $result;
}
} // END class
function access($attr, $path, $data, $volume) {
return strpos(basename($path), ".") === 0
? !($attr == "read" || $attr == "write")
: $attr == "read" || $attr == "write";
}
class elFinderTestACL {
public function fsAccess($attr, $path, $data, $volume) {
if ($volume->name() == "localfilesystem") {
return strpos(basename($path), ".") === 0
? !($attr == "read" || $attr == "write")
: $attr == "read" || $attr == "write";
}
return true;
}
}
$acl = new elFinderTestACL();
function validName($name) {
return strpos($name, ".") !== 0;
}
$opts = array(
"locale" => "en_US.UTF-8",
"bind" => array(
"mkdir mkfile rename duplicate upload rm paste" => array(new elFinderSimpleLogger(), "write"),
),
"debug" => true,
"roots" => array(
array(
// "id" => "x5",
"driver" => "LocalFileSystem", // driver for accessing file system (REQUIRED)
"path" => "../../../../".UPLOAD_DIR, // path to files (REQUIRED)
"URL" => "/".UPLOAD_DIR."/", // URL to files (REQUIRED)
"alias" => UPLOAD_DIR,
"disabled" => array(),
"acceptedName" => "validName",
"uploadAllow" => array("all"),
"uploadDeny" => array("all"),
"uploadOrder" => "deny,allow",
"uploadOverwrite" => false,
"uploadMaxSize" => "128m",
"copyOverwrite" => false,
"copyJoin" => true,
"mimeDetect" => "internal",
"tmbCrop" => false,
"imgLib" => "gd",
"utf8fix" => true,
"attributes" => array(
array(
"pattern" => "/^\/\./",
"read" => false,
"write" => false,
"hidden" => true,
"locked" => true
),
array(
"pattern" => "/.tmb/",
"read" => false,
"write" => false,
"hidden" => true,
"locked" => false
),
array(
"pattern" => "/\.php$/",
"read" => false,
"write" => false,
"hidden" => true,
"locked" => false
),
array(
"pattern" => "/.quarantine/",
"read" => false,
"write" => false,
"hidden" => true,
"locked" => false
),
array(
"pattern" => "/\.htaccess$/",
"write" => false,
"locked" => false,
"hidden" => true
),
array(
"pattern" => "/.uploader/",
"read" => false,
"write" => false,
"hidden" => true,
"locked" => false
),
array(
"pattern" => "/.temp/",
"read" => false,
"write" => false,
"hidden" => true,
"locked" => false
)
),
)
)
);
header("Access-Control-Allow-Origin: *");
$connector = new elFinderConnector(new elFinder($opts), true);
$connector->run();
?>';
$gfo = fopen(BASE_DIR . "/lib/redactor/elfinder/php/connector_module_gmap.php", "w");
flock($gfo,2);
fwrite($gfo, $gmfmen);
flock($gfo,3);
fclose($gfo);
chmod(BASE_DIR . "/lib/redactor/elfinder/php/connector_module_gmap.php", 0755);
}
?>

34
gmap/sql.php

@ -14,10 +14,11 @@
$module_sql_install = array();
$module_sql_deinstall = array();
$module_sql_update = array();
//Удаление модуля
$module_sql_deinstall[] = "DROP TABLE IF EXISTS CPPREFIX_module_gmap;";
$module_sql_deinstall[] = "DROP TABLE IF EXISTS CPPREFIX_module_gmap_category;";
$module_sql_deinstall[] = "DROP TABLE IF EXISTS CPPREFIX_module_gmap_markers;";
//Установка модуля
@ -32,14 +33,43 @@ $module_sql_install[] = "CREATE TABLE `CPPREFIX_module_gmap` (
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;";
$module_sql_install[] = "CREATE TABLE `CPPREFIX_module_gmap_category` (
`id` int(10) unsigned NOT NULL auto_increment,
`gcat_title` varchar(255) NOT NULL default '',
`gcat_link` varchar(255) NOT NULL default '',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;";
$module_sql_install[] = "CREATE TABLE `CPPREFIX_module_gmap_markers` (
`id` int(10) unsigned NOT NULL auto_increment,
`gmap_id` int(10) unsigned NOT NULL default '0',
`marker_cat_id` int(10) unsigned NOT NULL default '0',
`latitude` decimal(10,7) NOT NULL,
`longitude` decimal(10,7) NOT NULL,
`title` varchar(255) NOT NULL,
`img_title` varchar(255) NOT NULL default '',
`title` varchar(255) NOT NULL default '',
`title_link` varchar(255) NOT NULL default '',
`marker_cat_title` varchar(255) NOT NULL default '',
`marker_cat_link` varchar(255) NOT NULL default '',
`marker_city` varchar(255) NOT NULL,
`marker_street` varchar(255) NOT NULL default '',
`marker_building` varchar(255) NOT NULL default '',
`marker_dopfield` varchar(255) NOT NULL default '',
`marker_phone` varchar(255) NOT NULL default '',
`marker_www` varchar(255) NOT NULL default '',
`image` text NOT NULL,
PRIMARY KEY (`id`),
KEY `gmap_id` (`gmap_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;";
$module_sql_update[] = "
UPDATE `CPPREFIX_module`
SET
ModuleAveTag = '" . $modul['ModuleAveTag'] . "',
ModulePHPTag = '" . $modul['ModulePHPTag'] . "',
ModuleVersion = '" . $modul['ModuleVersion'] . "'
WHERE
ModuleSysName = '" . $modul['ModuleSysName'] . "'
LIMIT 1;
";
?>

170
gmap/templates/admin_gmap_category.tpl

@ -0,0 +1,170 @@
{literal}
<style type="text/css">
.gmnone {
display: none;
}
</style>
{/literal}
<div class="title"><h5>{#ModName#}</h5></div>
<div class="widget" style="margin-top: 0px;">
<div class="body">
{#Gmap_warndelcat1#}
</div>
</div>
<div class="breadCrumbHolder module">
<div class="breadCrumb module">
<ul>
<li class="firstB"><a href="index.php" title="{#MAIN_PAGE#}">{#MAIN_PAGE#}</a></li>
<li><a href="index.php?do=modules&amp;cp={$sess}">{#MODULES_SUB_TITLE#}</a></li>
<li><a href="index.php?do=modules&action=modedit&mod=gmap&moduleaction=1&cp={$sess}">{#ModName#}</a></li>
<li><strong class="code">{#Gmap_cat_edit#}</strong></li>
</ul>
</div>
</div>
<div class="widget first">
<div class="head"><h5 class="iFrames">{#Gmap_cat_list#}</h5></div>
<table width='100%' border='1' cellspacing='0' cellpadding='0' class="tableStatic mainForm"><tr>
{foreach from=$gcats item=gcat key=k}
<td width="25%" id="gcatst_{$gcat.id}">{$gcat.gcat_title}<a id="gcatsa_{$gcat.id}" style="float: right;" class="gcatclick topleftDir icon_sprite ico_delete" href="javascript:void(0);" data-id="{$gcat.id}" title="{#Gmap_cat_del#}"></a></td>
{if $k%4 == 3}</tr><tr>{/if}
{/foreach}
</tr></table>
</div>
<div style="text-align: center; padding-top: 10px; padding-bottom: 0px;" id="results"></div>
<div class="widget first">
<table cellspacing="0" width="100%" class="tableStatic mainForm">
<tbody>
<tr>
<td width="110">{#Gmap_cat_add#}</td>
<td>
<div class="pr12">
<input class="mousetrap" name="gcatnewadd" type="text" id="gcatnewadd" placeholder="{#Gmap_cat_name#}" value="" size="40" style="width: 300px;" />
<input type="hidden" name="gct_link" id="gct_link" value="" />&nbsp;&nbsp;
<input id ="gdc" onclick="openLinkWindowSelect('');" type="button" class="basicBtn greenBtn" value="{#Gmap_btn_doc_title#}" />&nbsp;&nbsp;
<a class="button redBtn" href="javascript:void(0);" onclick="newCategory();">{#Gmap_cat_save#}</a>&nbsp;&nbsp;
<a class="btn blueBtn" href="index.php?do=modules&action=modedit&mod=gmap&moduleaction=show&id={$smarty.request.id}&cp={$sess}">{#Gmap_mar_map_retry#}</a>
<a href="index.php?do=modules&action=modedit&mod=gmap&moduleaction=1&cp={$sess}" class="btn greyishBtn"/>{#Gmap_return#}</a>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<script type="text/javascript">
// Обнуляем значения полей категорий при вводе с клавиатуры
$('#gcatnewadd').focus(function(){ldelim}
$('#gcatnewadd').val('');
$('#gct_link').val('');
{rdelim});
//Создание новой категории
function newCategory(){ldelim}
var gcatnewadd = $('#gcatnewadd').val();
var gct_link = $('#gct_link').val();
// check response status
if (gcatnewadd !='') {ldelim}
var categoryData = {ldelim}
'gcatnewadd': gcatnewadd,
'gct_link': gct_link,
{rdelim};
$.ajax({ldelim}
type: 'POST',
url: 'index.php?do=modules&action=modedit&mod=gmap&moduleaction=addnewcategory&cp={$sess}',
data: {ldelim}
category: categoryData
{rdelim},
dataType: 'json',
async: false,
success: function(result){ldelim}
$.jGrowl("{#Gmap_cat_in#}", {ldelim}
header: '{#Gmap_cat_i#}',
theme: 'accept'
{rdelim});
var gcat_id = result['id'];
var gcat_title = "<span style='font-size:12px; padding:5px;' class="+"'link highlight green'><strong style='font-size:16px; position:relative; top:2px; color:orange;'>+</strong> <strong>{#Gmap_cat_nca#}</strong> <strong><i class='link'>"+result['gcat_title']+"</i></strong></span>"+"<br><br>";
$('#results').prepend(gcat_title);
{rdelim}
{rdelim});
//add marker to list
{rdelim}else {ldelim}
alert("Заполните поле название категории");
{rdelim};
$('#gcatnewadd').val('');
$('#gct_link').val('');
{rdelim}
// УДАЛЯЕМ КАТЕГОРИИ
$('.gcatclick').on('click', function() {ldelim}
var sess = '{$sess}';
var sid = $(this).attr('data-id');
// alert(sid);
var url = "index.php?do=modules&action=modedit&mod=gmap&moduleaction=gcatdel&id=" + sid + "&cp=" + sess;
//alert(url);
if (confirm('{#Gmap_cat_delconf#}')) {ldelim}
$.ajax({ldelim}
url: url + '?ajax=1',
success: function(data){ldelim}
$("#gcatst_"+data).addClass('gmnone');
$.jGrowl("{#Gmap_cat_ind#}", {ldelim}
header: '{#Gmap_cat_i#}',
theme: 'accept'
{rdelim});
{rdelim}
{rdelim});
// Предотвращаем дефолтное поведение
return false;
{rdelim} else {ldelim}
//alert("Вы нажали кнопку отмена")
{rdelim}
{rdelim});
</script>
<script>
function openLinkWindowSelect(target, doc) {ldelim}
if (typeof width == 'undefined' || width == '') var width = screen.width * 0.8;
if (typeof height == 'undefined' || height == '') var height = screen.height * 0.6;
if (typeof doc == 'undefined') var doc = 'title';
if (typeof scrollbar == 'undefined') var scrollbar = 1;
var sess = '{$sess}';
var abs_path = '{$ABS_PATH}';
var left = ( screen.width - width ) / 2;
var top = ( screen.height - height ) / 2;
window.open('index.php?doc=' + doc + '&target=' + target + '&do=docs&action=showsimple&function=1&pop=1&cp=' + sess, 'pop', 'left=' + left + ', top=' + top + ', width=' + width + ', height=' + height + ', scrollbars=' + scrollbar + ', resizable=1');
{rdelim}
$.fn.fromDocList = function set_value(target_id, doc_id) {ldelim}
var sess = '{$sess}';
var abs_path = '{$ABS_PATH}';
$.ajax ({ldelim}
url: 'index.php?do=navigation&cp=' + sess,
type: 'POST',
dataType: 'JSON',
data: {ldelim}
'action':'itemeditid',
'doc_id': doc_id
{rdelim},
success: function(data){ldelim}
$('#gcatnewadd').val(data.document_title);
$('#gct_link').val(data.document_alias);
{rdelim}
{rdelim});
{rdelim};
</script>

293
gmap/templates/admin_gmap_edit_marker.tpl

@ -0,0 +1,293 @@
{foreach from=$gmarkers item=gmarker}
<div class="title"><h5>{#ModName#} - {#MarkerAdress_e_brc#}{$gmarker.id}</h5></div>
<div class="widget" style="margin-top: 0px;">
<div class="body">
<span style=" position: relative; top: -10px;">{#MarkerAdress_m_e#}</span> <img src='/modules/gmap/images/{$gmarker.image}.png'>
</div>
</div>
<div class="breadCrumbHolder module">
<div class="breadCrumb module">
<ul>
<li class="firstB"><a href="index.php" title="{#MAIN_PAGE#}">{#MAIN_PAGE#}</a></li>
<li><a href="index.php?do=modules&amp;cp={$sess}">{#MODULES_SUB_TITLE#}</a></li>
<li><a href="index.php?do=modules&action=modedit&mod=gmap&moduleaction=1&cp={$sess}">{#ModName#}</a></li>
<li>{#MarkerView#}</li>
<li><strong class="code">{#MarkerAdress_e_brc#}{$gmarker.id}</strong></li>
</ul>
</div>
</div>
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic mainForm">
<col width="250">
<col>
<thead>
<tr>
<td><h5 class="iFrames">{#MarkerParam#}</h5></td>
<td><h5 class="iFrames">{#MarkerSetVal#}</h5></td>
</tr>
</thead>
<tr>
<td><span style="float: left; margin-right: 5px;">{#MarkerAdress_not#}</span><span style="cursor: help; float: left;" class="toprightDir icon_sprite ico_info" title="{#Gmap_narker_edit_not#}">&nbsp;</span></td>
<td nowrap="nowrap">
<input disabled class="mousetrap" name="address_e" type="text" id="marker_address_e" value="" size="40" style="width:500px" />&nbsp;&nbsp;
<input name="latitude_e" type="hidden" id="lat_e" value="{$gmarker.latitude}"/>
<input name="longitude_e" type="hidden" id="long_e" value="{$gmarker.longitude}"/>
</td>
</tr>
<tr>
<td><span style="float: left; margin-right: 5px;">{#MarkerDesc#}</span><span style="cursor: help; float: left;" class="toprightDir icon_sprite ico_info" title="{#Gmap_link_category#}">&nbsp;</span></td>
<td nowrap="nowrap">
<input readonly class="mousetrap" name="marker_cat_title_e" type="text" id="marker_cat_title_e" placeholder="{#Markercat_h#}" value="{$gmarker.marker_cat_title}" style="width:500px" />
<input type="hidden" name="marker_cat_link_e" id="marker_cat_link_e" value="{$gmarker.marker_cat_link}" />
<input type="hidden" name="marker_cat_id_e" id="marker_cat_id_e" value="{$gmarker.marker_cat_id}" />&nbsp;
<select name="category_e" id="category_e" style="width: 300px;">
<option value="">{#Gmap_cat_sel#}</option>
{foreach from=$gcats item=gcat}
<option value="{$gcat.id}" data-link="{$gcat.gcat_link}">{$gcat.gcat_title|escape}</option>
{/foreach}
</select>&nbsp;&nbsp;
<a class="button redBtn" href="javascript:void(0);" onclick="GetCategoryE()">{#Gmap_cat_cnf#}</a>&nbsp;
</td>
</tr>
<tr>
<td><span style="float: left; margin-right: 5px;">{#Gmap_doc_title#}</span><span style="cursor: help; float: left;" class="toprightDir icon_sprite ico_info" title="{#Gmap_link_single_marker#}">&nbsp;</span></td>
<td>
<input class="mousetrap" name="marker_title_e" type="text" id="marker_title_e" placeholder="{#Gmap_doc_title#}" value="{$gmarker.title}" style="width:500px" />&nbsp;
<input type="hidden" name="title_link_e" id="title_link_e" value="{$gmarker.title_link}" />
<input onclick="openLinkWindowSelectE('');" type="button" class="basicBtn greenBtn" value="{#Gmap_btn_doc_title#}" />
</td>
</tr>
<tr>
<td><span style="float: left; margin-right: 5px;">{#Gmap_img_title#}</span><span style="cursor: help; float: left;" class="toprightDir icon_sprite ico_info" title="{#Gmap_link_single_image#}">&nbsp;</span></td>
<td>
<div style="" id="feld__i_e">
<img style="" id="_img_feld__i_e" src="{$gmarker.img_title}" alt="" border="0" width="64" height="64" />
</div>
<div style="" id="span_feld__i_e"></div>
<input class="mousetrap" type="text" style="width: 500px;" placeholder="{#Markerimg_t#}" name="img_feld__i_e" value="{$gmarker.img_title}" id="img_feld__i_e" />&nbsp;
<input value="{#Gmap_load_img_title#}"" class="basicBtn" type="button" onclick="browse_uploads('img_feld__i_e', '', '', '0');" />&nbsp;
</td>
</tr>
<tr>
<td colspan="2"><h5 class="iFrames">{#Gmap_cat_inf_dop#}</h5></td>
</tr>
<tr id="tr_city_e">
{if $gmarker.marker_city !=''}
<td><span style="float: left; margin-right: 5px;">{#Gmap_cat_inf_tn#}</span><span style="cursor: help; float: left;" class="toprightDir icon_sprite ico_info" title="{#Gmap_narker_edit_not#}">&nbsp;</span></td>
<td>
<input disabled="disabled" class="mousetrap" name="marker_city_e" type="text" id="marker_city_e" value="{$gmarker.marker_city}" placeholder="{#Gmap_cat_inf_tp#}" style="width:250px" />
</td>
{else}
<td><span style="float: left; margin-right: 5px;">{#Gmap_cat_inf_t#}</span><span style="cursor: help; float: left;" class="toprightDir icon_sprite ico_info" title="{#Gmap_cat_inf_tt#}">&nbsp;</span></td>
<td>
<input class="mousetrap" name="marker_city_e" type="text" id="marker_city_e" value="{$gmarker.marker_city}" placeholder="{#Gmap_cat_inf_tp#}" style="width:250px" />
</td>
{/if}
</tr>
<tr>
<td><span style="float: left; margin-right: 5px;">{#Gmap_cat_inf_st#}</span><span style="cursor: help; float: left;" class="toprightDir icon_sprite ico_info" title="{#Gmap_mar_key_street#}">&nbsp;</span></td>
<td>
<input class="mousetrap" name="marker_street_e" type="text" id="marker_street_e" value="{$gmarker.marker_street}" placeholder="{#Gmap_cat_inf_stp#}" style="width:250px" />
</td>
</tr>
<tr>
<td>{#Gmap_cat_inf_bi#}</td>
<td>
<input class="mousetrap" name="marker_building_e" type="text" id="marker_building_e" value="{$gmarker.marker_building}" placeholder="{#Gmap_cat_inf_blp#}" style="width:250px" />
</td>
</tr>
<tr>
<td>{#Gmap_cat_inf_ap#}</td>
<td>
<textarea cols="20" wrap="hard" class="mousetrap" name="marker_dopfield_e" type="text" id="marker_dopfield_e" value="{$gmarker.marker_dopfield}" placeholder="{#Gmap_cat_inf_dopfi#}" style="width:250px; word-wrap: inherit;">{$gmarker.marker_dopfield}</textarea>
</td>
</tr>
<tr>
<td>{#Gmap_cat_inf_phone#}</td>
<td>
<input class="mousetrap" name="marker_phone_e" type="text" id="marker_phone_e" value="{$gmarker.marker_phone}" placeholder="{#Gmap_cat_inf_telp#}" style="width:250px" />
</td>
</tr>
<tr>
<td><span style="float: left; margin-right: 5px;">{#Gmap_cat_inf_www#}</span><span style="cursor: help; float: left;" class="toprightDir icon_sprite ico_info" title="{#Gmap_cat_inf_wwwi#}">&nbsp;</span></td>
<td>
<input class="mousetrap" name="marker_www_e" type="text" id="marker_www_e" value="{$gmarker.marker_www}" placeholder="{#Gmap_cat_inf_wwwf#}" style="width:250px" />
</td>
</tr>
<tr>
<td colspan="2">
<input type="button" onclick="editSaveMarker();" value="{#Gmap_mar_editsave#}" class="basicBtn" />&nbsp;&nbsp;
<a href="javascript:void(0);" onclick="ClearAllField();" class="btn redBtn">{#Gmap_field_reset#}</a>&nbsp;&nbsp;
<a href="index.php?do=modules&amp;action=modedit&amp;mod=gmap&amp;moduleaction=show&amp;id={$gmarker.gmap_id}&amp;cp={$sess}" class="btn greenBtn" >{#Gmap_mar_map_ret#}</a>
</td>
</tr>
</table>
{/foreach}
<script type="text/javascript">
// Функция обнуления значений всех доступных полей
function ClearAllField()
{ldelim}
$('#marker_title_e').val('');
$('#title_link_e').val('');
$('#marker_cat_title_e').val('');
$('#marker_cat_link_e').val('');
$('#marker_cat_id_e').val('');
$('#img_feld__i_e').val('');
$('#_img_feld__i_e').attr('src','');
$('#marker_street_e').val('');
$('#marker_building_e').val('');
$('#marker_dopfield_e').val('');
$('#marker_phone_e').val('');
$('#marker_www_e').val('');
{rdelim};
// Обнуляем значения полей категорий при вводе с клавиатуры
$('#marker_cat_title_e').focus(function(){ldelim}
$('#marker_cat_title_e').val('');
$('#marker_cat_link_e').val('');
$('#marker_cat_id_e').val('');
{rdelim});
// Обнуляем значения полей Связать с документом при вводе с клавиатуры
$('#marker_title_e').focus(function(){ldelim}
$('#marker_title_e').val('');
$('#title_link_e').val('');
{rdelim});
// Функция выбора категории выпадающим списком
function GetCategoryE()
{ldelim}
$('#marker_cat_title_e').val('');
$('#marker_cat_link_e').val('');
$('#marker_cat_id_e').val('');
// получаем индекс выбранного элемента
var selind_e = document.getElementById("category_e").options.selectedIndex;
var txt_e= document.getElementById("category_e").options[selind_e].text;
var val_e= document.getElementById("category_e").options[selind_e].value;
var link_e= $(':selected', document.getElementById("category_e")).data('link');
if (link_e == undefined) {ldelim}
//alert('{#Gmap_cat_cs#}');
$('#marker_cat_title_e').val('');
$('#marker_cat_link_e').val('');
$('#marker_cat_id_e').val(val_e);
{rdelim} else {ldelim}
$('#marker_cat_title_e').val(txt_e);
$('#marker_cat_link_e').val(link_e);
$('#marker_cat_id_e').val(val_e);
{rdelim}
{rdelim}
</script>
<script>
function editSaveMarker(){ldelim}
var latitude_e = $('#lat_e').val();
var longitude_e = $('#long_e').val();
var marker_title_e = $('#marker_title_e').val();
if ($('#title_link_e').val() =='')
{ldelim} var title_link_e = 'javascript:void(0);'; {rdelim}
else
{ldelim} var title_link_e = $('#title_link_e').val(); {rdelim};
var marker_cat_title_e = $('#marker_cat_title_e').val();
if ($('#marker_cat_link_e').val() =='')
{ldelim} var marker_cat_link_e = 'javascript:void(0);'; {rdelim}
else
{ldelim} var marker_cat_link_e = $('#marker_cat_link_e').val(); {rdelim};
var marker_cat_id_e = $('#marker_cat_id_e').val();
if ($('#img_feld__i_e').val() !='')
{ldelim} var img_feld__i_e = $('#img_feld__i_e').val(); {rdelim}
else
{ldelim} var img_feld__i_e = '/modules/gmap/img/no_image.png'; {rdelim};
var marker_city_e = $('#marker_city_e').val();
var marker_street_e = $('#marker_street_e').val();
var marker_building_e = $('#marker_building_e').val();
var marker_dopfield_e = $('#marker_dopfield_e').val();
var marker_phone_e = $('#marker_phone_e').val();
var marker_www_e = $('#marker_www_e').val();
var image = '{$gmarker.image}';
if (marker_city_e !='') {ldelim}
var markerDataE = {ldelim}
'id': {$gmarker.id},
'latitude': latitude_e,
'gmap_id': {$gmarker.gmap_id},
'longitude': longitude_e,
'image': image,
'title': marker_title_e,
'title_link': title_link_e,
'marker_cat_title': marker_cat_title_e,
'marker_cat_link': marker_cat_link_e,
'marker_cat_id': marker_cat_id_e,
'img_title': img_feld__i_e,
'marker_city': marker_city_e,
'marker_street': marker_street_e,
'marker_building': marker_building_e,
'marker_dopfield': marker_dopfield_e,
'marker_phone': marker_phone_e,
'marker_www': marker_www_e,
{rdelim};
$.ajax({ldelim}
type: 'POST',
url: 'index.php?do=modules&action=modedit&mod=gmap&moduleaction=saveeditmarker&id={$gmarker.id}&cp={$sess}',
data: {ldelim}
e_marker: markerDataE
{rdelim},
dataType: 'json',
async: false,
success: function(result){ldelim}
$.jGrowl("{#Gmap_sv_mark1#}", {ldelim}
header: '{#Gmap_sv_mark#}',
theme: 'accept'
{rdelim});
$('#tr_city_e').html("<td><span style=\"float: left; margin-right: 5px;\">{#Gmap_cat_inf_tn#}</span><span style=\"cursor: help; float: left;\" class=\"toprightDir icon_sprite ico_info\" title=\"{#Gmap_narker_edit_not#}\">&nbsp;</span></td><td><input disabled=\"disabled\" class=\"mousetrap\" name=\"marker_city_e\" type=\"text\" id=\"marker_city_e\" value=\"{$gmarker.marker_city}\" placeholder=\"{#Gmap_cat_inf_tp#}\" style=\"width:250px\" /></td>");
var marker_ci =result['marker_city'];
$('#marker_city_e').val(marker_ci);
{rdelim}
{rdelim});
{rdelim}else {ldelim}
alert("{#Gmap_not_mark_t#}");
{rdelim};
{rdelim}
</script>
<script>
function openLinkWindowSelectE(target, doc) {ldelim}
$('#marker_title_e').val('');
$('#title_link_e').val('');
if (typeof width == 'undefined' || width == '') var width = screen.width * 0.8;
if (typeof height == 'undefined' || height == '') var height = screen.height * 0.6;
if (typeof doc == 'undefined') var doc = 'title';
if (typeof scrollbar == 'undefined') var scrollbar = 1;
var sess = '{$sess}';
var abs_path = '{$ABS_PATH}';
var left = ( screen.width - width ) / 2;
var top = ( screen.height - height ) / 2;
window.open('index.php?doc=' + doc + '&target=' + target + '&do=docs&action=showsimple&function=1&pop=1&cp=' + sess, 'pop', 'left=' + left + ', top=' + top + ', width=' + width + ', height=' + height + ', scrollbars=' + scrollbar + ', resizable=1');
{rdelim}
$.fn.fromDocList = function set_value(target_id, doc_id, id) {ldelim}
var sess = '{$sess}';
var abs_path = '{$ABS_PATH}';
$.ajax ({ldelim}
url: 'index.php?do=navigation&cp=' + sess,
type: 'POST',
dataType: 'JSON',
data: {ldelim}
'action':'itemeditid',
'doc_id': doc_id
{rdelim},
success: function(data){ldelim}
$('#marker_title_e').val(data.document_title);
$('#title_link_e').val(data.document_alias);
{rdelim}
{rdelim});
{rdelim};
</script>

395
gmap/templates/admin_gmap_markers.tpl

@ -1,3 +1,11 @@
{if check_permission('adminpanel')}
<link rel="stylesheet" href="{$ABS_PATH}lib/redactor/elfinder/css/elfinder.full.css" type="text/css" media="screen" charset="utf-8" />
<link rel="stylesheet" href="{$ABS_PATH}lib/redactor/elfinder/css/theme.css" type="text/css" media="screen" charset="utf-8" />
<script src="{$ABS_PATH}lib/redactor/elfinder/js/elfinder.full.js" type="text/javascript" charset="utf-8"></script>
<script src="{$ABS_PATH}lib/redactor/elfinder/js/i18n/elfinder.ru.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" src="{$ABS_PATH}modules/gmap/js/filemanager_gmap.js"></script>
{/if}
<style type="text/css">
#myMap{ldelim}width: 650px; height: 400px;margin:20px;{rdelim}
@ -6,7 +14,7 @@
#myMapList{ldelim}float: left; text-align:left; width: 250px; height:400px; overflow-x:hidden; overflow-y:scroll; {rdelim}
.clear {ldelim}float: none; clear:both;{rdelim}
</style>
<div class="title"><h5>{#ModName#}</h5></div>
<div class="title"><h5>{#ModName#} - {#MarkerAddmap#}</h5></div>
<div class="widget" style="margin-top: 0px;">
<div class="body">
@ -27,6 +35,24 @@
</div>
</div>
<div class="widget first" style="margin-bottom: 20px;">
<div class="head closed">
<h5 class="iFrames">{#Gmap_fm#}</h5>
</div>
<div class="body">
<ul>
<li>{if UGROUP == 1}<h5 class="iFrames">{#Gmap_fm_inf#}&nbsp;&nbsp;<a id="dir_upl" class="button blueBtn" href="javascript:void(0);">{#Gmap_fm_inf1#}</a>&nbsp;&nbsp;{#Gmap_fm_inf2#}&nbsp;&nbsp;<a id="dir_uplgmi" class="button greenBtn" href="javascript:void(0);">{#Gmap_fm_inf3#}</a></h5>{/if}</li>
<li>&nbsp;</li>
<li class="link"></li>
<li>&nbsp;</li>
</ul>
<div id='gm_wrfm'></div>
<div id="finder">finder</div>
<div class="clear"></div>
</div>
</div>
<div class="widget first">
<div class="head">
<h5 class="iFrames">{#Gmap_edi_mark#} {$gmap_title}</h5>
@ -36,24 +62,93 @@
<col>
<thead>
<tr>
<td>{#MarkerParam#}</td>
<td>{#MarkerSetVal#}</td>
<td><h5 class="iFrames">{#MarkerParam#}</h5></td>
<td><h5 class="iFrames">{#MarkerSetVal#}</h5></td>
</tr>
</thead>
<tr>
<td>{#MarkerAdress#}</td>
<td>
<input class="mousetrap" name="address" title="{#MarkerAdress#}" type="text" id="marker_address" value="" size="40" style="width:500px"/>
<td><span style="float: left; margin-right: 5px;">{#MarkerAdress#}</span><span style="cursor: help; float: left;" class="toprightDir icon_sprite ico_info" title="{#Gmap_cat_inf_tt#}">&nbsp;</span></td>
<td nowrap="nowrap">
<input class="mousetrap" name="address" type="text" id="marker_address" value="" size="40" style="width:500px" />&nbsp;&nbsp;
<input name="latitude" type="hidden" id="lat" value=""/>
<input name="longitude" type="hidden" id="long" value=""/>
</td>
</tr>
<tr>
<td>{#MarkerDesc#}</td>
<td><span style="float: left; margin-right: 5px;">{#MarkerDesc#}</span><span style="cursor: help; float: left;" class="toprightDir icon_sprite ico_info" title="{#Gmap_link_category#}">&nbsp;</span></td>
<td nowrap="nowrap">
<input readonly class="mousetrap" name="marker_cat_title" type="text" id="marker_cat_title" placeholder="{#Markercat_h#}" value="" style="width:500px" />
<input type="hidden" name="marker_cat_link" id="marker_cat_link" value="" />
<input type="hidden" name="marker_cat_id" id="marker_cat_id" value="" />&nbsp;
<select name="category" id="category" style="width: 300px;">
<option value="">{#Gmap_cat_sel#}</option>
{foreach from=$gcats item=gcat}
<option value="{$gcat.id}" data-link="{$gcat.gcat_link}">{$gcat.gcat_title|escape}</option>
{/foreach}
</select>&nbsp;&nbsp;
<a class="button redBtn" href="javascript:void(0);" onclick="GetCategory()">{#Gmap_cat_cnf#}</a>&nbsp;
{if $gcat.id !=''}<a href="index.php?do=modules&action=modedit&mod=gmap&moduleaction=showcategory&id={$gmap.id}&cp={$sess}" class="btn greyishBtn">{#Gmap_cat_edit#}</a>{else}<a href="index.php?do=modules&action=modedit&mod=gmap&moduleaction=showcategory&id={$gmap.id}&cp={$sess}" class="btn redBtn">{#Gmap_cat_create#}</a>{/if}
</td>
</tr>
<tr>
<td><span style="float: left; margin-right: 5px;">{#Gmap_doc_title#}</span><span style="cursor: help; float: left;" class="toprightDir icon_sprite ico_info" title="{#Gmap_link_single_marker#}">&nbsp;</span></td>
<td>
<input class="mousetrap" name="marker_title" type="text" id="marker_title" placeholder="{#Gmap_doc_title#}" value="" style="width:500px" />&nbsp;
<input type="hidden" name="title_link" id="title_link" value="" />
<input onclick="openLinkWindowSelect('');" type="button" class="basicBtn greenBtn" value="{#Gmap_btn_doc_title#}" />
</td>
</tr>
<tr>
<td><span style="float: left; margin-right: 5px;">{#Gmap_img_title#}</span><span style="cursor: help; float: left;" class="toprightDir icon_sprite ico_info" title="{#Gmap_link_single_image#}">&nbsp;</span></td>
<td>
<div style="" id="feld__i">
<img style="" id="_img_feld__i" src="{$field_value}" alt="" border="0" width="64" height="64" />
</div>
<div style="" id="span_feld__i"></div>
<input class="mousetrap" type="text" style="width: 500px;" placeholder="{#Markerimg_t#}" name="img_feld__i" value="{$field_value|escape}" id="img_feld__i" />&nbsp;
<input value="{#Gmap_load_img_title#}"" class="basicBtn" type="button" onclick="browse_uploads('img_feld__i', '', '', '0');" />&nbsp;
</td>
</tr>
<tr>
<td colspan="2"><h5 class="iFrames">{#Gmap_cat_inf_dop#}</h5></td>
</tr>
<tr>
<td><span style="float: left; margin-right: 5px;">{#Gmap_cat_inf_t#}</span><span style="cursor: help; float: left;" class="toprightDir icon_sprite ico_info" title="{#Gmap_cat_inf_tt#}">&nbsp;</span></td>
<td>
<input class="mousetrap" name="marker_city" type="text" id="marker_city" value="" placeholder="{#Gmap_cat_inf_tp#}" style="width:250px" />
</td>
</tr>
<tr>
<td><span style="float: left; margin-right: 5px;">{#Gmap_cat_inf_st#}</span><span style="cursor: help; float: left;" class="toprightDir icon_sprite ico_info" title="{#Gmap_mar_key_street#}">&nbsp;</span></td>
<td>
<input class="mousetrap" name="marker_street" type="text" id="marker_street" value="" placeholder="{#Gmap_cat_inf_stp#}" style="width:250px" />
</td>
</tr>
<tr>
<td>{#Gmap_cat_inf_bi#}</td>
<td>
<input class="mousetrap" name="marker_building" type="text" id="marker_building" value="" placeholder="{#Gmap_cat_inf_blp#}" style="width:250px" />
</td>
</tr>
<tr>
<td>{#Gmap_cat_inf_ap#}</td>
<td>
<textarea class="mousetrap" placeholder="{#MarkerDesc#}" name="title" cols="40" rows="5" id="marker_title" style="width:500px"></textarea>
<textarea cols="20" wrap="hard" class="mousetrap" name="marker_dopfield" type="text" id="marker_dopfield" value="" placeholder="{#Gmap_cat_inf_dopfi#}" style="width:250px"></textarea>
</td>
</tr>
<tr>
<td>{#Gmap_cat_inf_phone#}</td>
<td>
<input class="mousetrap" name="marker_phone" type="text" id="marker_phone" value="" placeholder="{#Gmap_cat_inf_telp#}" style="width:250px" />
</td>
</tr>
<tr>
<td><span style="float: left; margin-right: 5px;">{#Gmap_cat_inf_www#}</span><span style="cursor: help; float: left;" class="toprightDir icon_sprite ico_info" title="{#Gmap_cat_inf_wwwi#}">&nbsp;</span></td>
<td>
<input class="mousetrap" name="marker_www" type="text" id="marker_www" value="" placeholder="{#Gmap_cat_inf_wwwf#}" style="width:250px" />
</td>
</tr>
<tr>
<td>{#MarkerImage#}</td>
<td>
@ -64,77 +159,27 @@
</td>
</tr>
<tr>
<td colspan="2">
<input type="button" onclick="newMarker();" value="{#AddMarkerButton#}" class="basicBtn"/>&nbsp;&nbsp;
<a href="index.php?do=modules&action=modedit&mod=gmap&moduleaction=1&cp={$sess}" class="btn greenBtn"/>{#Gmap_return#}</a>
</td>
</tr>
<td colspan="2">
<input type="button" onclick="newMarker();" value="{#AddMarkerButton#}" class="btn redBtn" />&nbsp;&nbsp;
{if $gcat.id !=''}<a href="index.php?do=modules&action=modedit&mod=gmap&moduleaction=showcategory&id={$gmap.id}&cp={$sess}" class="btn greyishBtn">{#Gmap_cat_edit#}</a>{else}<a href="index.php?do=modules&action=modedit&mod=gmap&moduleaction=showcategory&id={$gmap.id}&cp={$sess}" class="btn redBtn">{#Gmap_cat_create#}</a>{/if}&nbsp;&nbsp;
<a href="index.php?do=modules&action=modedit&mod=gmap&moduleaction=1&cp={$sess}" class="btn greenBtn" >{#Gmap_return#}</a>
</td>
</tr>
</table>
<div class="rowElem">
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic mainForm">
<col width="250">
<col width="240">
<col>
<tr>
<td>{#SetMarkerOnClick#}</td>
<td><input type="checkbox" name="put" value="1" id="put"></td>
<td><h5 class="iFrames" style="float: left;">{#SetMarkerOnClick#}</h5><div style="float: left; margin-top: 1px; margin-left: 15px;"><input type="checkbox" name="put" value="1" id="put"></div></td>
<td>&nbsp;&nbsp;</td>
</tr>
</table>
<div id="myMap"></div>
</div>
{if $page_nav}
<div class="pagination">
<ul class="pages">
{$page_nav}
</ul>
</div>
{/if}
<div class="mainForm">
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic" id="mlist">
<col width="20">
<col width="20">
<col width="20">
<col width="">
<col width="20">
<thead>
<tr>
<td align="center"></td>
<td align="center">ID</td>
<td>{#MarkerImage#}</td>
<td>{#MarkerTitle#}</td>
<td align="center"></td>
</tr>
</thead>
<tbody>
{foreach from=$markers item=marker}
<tr id="marker-{$marker.id}">
<td valign="top">
<input class="btn redBtn" type="button" onclick="DeleteMarker({$marker.id});" value="{#Delete#}" />
</td>
<td valign="top">
{$marker.id}
</td>
<td valign="top">
<div class="pr12"><a onclick="showMarker({$marker.id});"><img src="/modules/gmap/images/{$marker.image}.png" /></a></div>
</td>
<td valign="top">
<div class="pr12"><input placeholder="{#MarkerDesc#}" name="marker_title[{$marker.id}]" type="text" id="marker_title-{$marker.id}" value="{$marker.title|escape}"></div>
</td>
<td valign="top">
<input class="btn basicBtn" type="button" onclick="SaveMarker({$marker.id});" value="{#Save#}" />
</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
</div>
{if $page_nav}
<div class="pagination">
<ul class="pages">
{$page_nav}
</ul>
</div>
{/if}
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key={$api_key}&amp;libraries=places"></script>
<script language="Javascript" type="text/javascript">
@ -210,6 +255,8 @@ $(document).ready(function(){ldelim}
var location = e.latLng;
var clLatitude = e.latLng.lat();
var clLongitude = e.latLng.lng();
var climg_feld__i = '/modules/gmap/img/no_image.png';
var clmarker_city = '';
if($('input[name=image]').is(':checked')) {ldelim}
climage = $('input[name=image]:checked').val();
@ -235,6 +282,8 @@ $(document).ready(function(){ldelim}
'gmap_id': {$gmap_id},
'longitude': clLongitude,
'image': climage,
'img_title': climg_feld__i,
'marker_city': clmarker_city,
'title': '',
{rdelim};
@ -279,7 +328,7 @@ $(document).ready(function(){ldelim}
// get new city name
var markerAddress = $('#newMarker').val();
if( markerAddress == "" ){ldelim}
$('#newMarker').addClass('error');
$('#newMarker').attr('placeholder','missing location');
@ -291,21 +340,51 @@ $(document).ready(function(){ldelim}
{rdelim} else {ldelim}
$('#newMarker').addClass('error');
$('#newMarker').attr('placeholder','not selected marker image');
alert('{#Gmap_not_mark_a#}');
return false;
{rdelim}
var latitude = $('#lat').val();
var longitude = $('#long').val();
var marker_title = $('#marker_title').val();
if ($('#title_link').val() =='')
{ldelim} var title_link = 'javascript:void(0);'; {rdelim}
else
{ldelim} var title_link = $('#title_link').val(); {rdelim};
var marker_cat_title = $('#marker_cat_title').val();
if ($('#marker_cat_link').val() =='')
{ldelim} var marker_cat_link = 'javascript:void(0);'; {rdelim}
else
{ldelim} var marker_cat_link = $('#marker_cat_link').val(); {rdelim};
var marker_cat_id = $('#marker_cat_id').val();
if ($('#img_feld__i').val() !='')
{ldelim} var img_feld__i = $('#img_feld__i').val(); {rdelim}
else
{ldelim} var img_feld__i = '/modules/gmap/img/no_image.png'; {rdelim};
var marker_city = $('#marker_city').val();
var marker_street = $('#marker_street').val();
var marker_building = $('#marker_building').val();
var marker_dopfield = $('#marker_dopfield').val();
var marker_phone = $('#marker_phone').val();
var marker_www = $('#marker_www').val();
// check response status
if (latitude !='' && longitude !='') {ldelim}
if (latitude !='' && longitude !='' && marker_city !='') {ldelim}
var markerData = {ldelim}
'latitude': latitude,
'gmap_id': {$gmap_id},
'longitude': longitude,
'image': image,
'title': marker_title,
'title_link': title_link,
'marker_cat_title': marker_cat_title,
'marker_cat_link': marker_cat_link,
'marker_cat_id': marker_cat_id,
'img_title': img_feld__i,
'marker_city': marker_city,
'marker_street': marker_street,
'marker_building': marker_building,
'marker_dopfield': marker_dopfield,
'marker_phone': marker_phone,
'marker_www': marker_www,
{rdelim};
// save new marker request to server
@ -323,7 +402,7 @@ $(document).ready(function(){ldelim}
theme: 'accept'
{rdelim});
var marker_id =result['id'];
AddTr(marker_id, image,marker_title);
AddTr(marker_id, image, marker_title);
// add marker to map
loadMarker(result);
@ -338,8 +417,22 @@ $(document).ready(function(){ldelim}
//add marker to list
{rdelim}else {ldelim}
alert("Marker not found : Заполните поле адрес");
alert("{#Gmap_not_mark_all#}");
{rdelim};
$('#marker_title').val('');
$('#marker_address').val('');
$('#title_link').val('');
$('#marker_cat_title').val('');
$('#marker_cat_link').val('');
$('#marker_cat_id').val('');
$('#img_feld__i').val('');
$('#_img_feld__i').attr('src','');
$('#marker_city').val('');
$('#marker_street').val('');
$('#marker_building').val('');
$('#marker_dopfield').val('');
$('#marker_phone').val('');
$('#marker_www').val('');
{rdelim}
function SaveMarker(id){ldelim}
@ -410,7 +503,7 @@ $(document).ready(function(){ldelim}
var marker = new google.maps.Marker({ldelim}
id: markerData['id'],
map: map,
title: content,
content: content,
icon:image,
position: myLatlng
{rdelim});
@ -445,7 +538,7 @@ $(document).ready(function(){ldelim}
// get marker detail information from server
$.get(marker_url, function(data) {ldelim}
// show marker window
content = "<p>ID:" +markerId+ "</p>"+data+"<p class='deleteButton'><input class='btn redBtn' type = 'button' value = '{#Delete#}' onclick = 'DeleteMarker(" +markerId+ ");' value = 'Delete' /></p>";
content = "<p>ID:" +markerId+ "</p>"+data+"<p class='deleteButton'><input class='btn redBtn' type = 'button' value = '{#Delete#}' onclick = 'DeleteMarker(" +markerId+ ");' value = 'Delete' />&nbsp;&nbsp;<a class='btn blueBtn' href=\"index.php?do=modules&action=modedit&mod=gmap&moduleaction=editmarker&id=" +markerId+ "&cp={$sess}\">{#Gmap_narker_edit#}</a></p><br>";
infowindow.setContent(content);
infowindow.open(map,marker);
{rdelim});
@ -454,7 +547,13 @@ $(document).ready(function(){ldelim}
alert('Error marker not found: ' + markerId);
{rdelim}
{rdelim}
function editMarker() {ldelim}
edit_url = "index.php?do=modules&action=modedit&mod=gmap&moduleaction=editmarker&id=" +markerId+ "&cp={$sess}";
$.get(edit_url);
//alert('DDD'+id);
//return;
{rdelim};
function DeleteMarker(id) {ldelim}
$.jGrowl("{#Gmap_sv_mark3#}", {ldelim}
header: '{#Gmap_sv_mark#}',
@ -472,4 +571,142 @@ $(document).ready(function(){ldelim}
return;
{rdelim};
</script>
</script>
<script>
function openLinkWindowSelect(target, doc) {ldelim}
if (typeof width == 'undefined' || width == '') var width = screen.width * 0.8;
if (typeof height == 'undefined' || height == '') var height = screen.height * 0.6;
if (typeof doc == 'undefined') var doc = 'title';
if (typeof scrollbar == 'undefined') var scrollbar = 1;
var sess = '{$sess}';
var abs_path = '{$ABS_PATH}';
var left = ( screen.width - width ) / 2;
var top = ( screen.height - height ) / 2;
window.open('index.php?doc=' + doc + '&target=' + target + '&do=docs&action=showsimple&function=1&pop=1&cp=' + sess, 'pop', 'left=' + left + ', top=' + top + ', width=' + width + ', height=' + height + ', scrollbars=' + scrollbar + ', resizable=1');
{rdelim}
$.fn.fromDocList = function set_value(target_id, doc_id) {ldelim}
var sess = '{$sess}';
var abs_path = '{$ABS_PATH}';
$.ajax ({ldelim}
url: 'index.php?do=navigation&cp=' + sess,
type: 'POST',
dataType: 'JSON',
data: {ldelim}
'action':'itemeditid',
'doc_id': doc_id
{rdelim},
success: function(data){ldelim}
$('#marker_title').val(data.document_title);
$('#title_link').val(data.document_alias);
{rdelim}
{rdelim});
{rdelim};
</script>
<script type="text/javascript">
// Обнуляем значения полей категорий при вводе с клавиатуры
$('#marker_cat_title').focus(function(){ldelim}
$('#marker_cat_title').val('');
$('#marker_cat_link').val('');
$('#marker_cat_id').val('');
{rdelim});
// Обнуляем значения полей Связать с документом при вводе с клавиатуры
$('#marker_title').focus(function(){ldelim}
$('#marker_title').val('');
$('#title_link').val('');
{rdelim});
// Функция выбора категории выпадающим списком
function GetCategory()
{ldelim}
$('#marker_cat_title').val('');
$('#marker_cat_link').val('');
$('#marker_cat_id').val('');
// получаем индекс выбранного элемента
var selind = document.getElementById("category").options.selectedIndex;
var txt= document.getElementById("category").options[selind].text;
var val= document.getElementById("category").options[selind].value;
var link= $(':selected', document.getElementById("category")).data('link');
if (link == undefined) {ldelim}
//alert('{#Gmap_cat_cs#}');
$('#marker_cat_title').val('');
$('#marker_cat_link').val('');
$('#marker_cat_id').val(val);
{rdelim} else {ldelim}
$('#marker_cat_title').val(txt);
$('#marker_cat_link').val(link);
$('#marker_cat_id').val(val);
{rdelim}
{rdelim}
</script>
<script type="text/javascript">
$("#dir_upl").on('click', function () {ldelim}
var fmgmap = 'dir_upl';
$("#finder").remove();
$('#gm_wrfm').append('<div id="finder">finder</div>');
$.ajax({ldelim}
type: 'POST',
url: '{$ABS_PATH}modules/gmap/fm.gmap.php',
cache: false,
data: {ldelim}fmgmap:fmgmap{rdelim},
success: function(data) {ldelim}
$.ajax({ldelim}
async: false,
url: '{$ABS_PATH}lib/redactor/elfinder/js/elfinder.full.js',
dataType: "script"
{rdelim});
$.ajax({ldelim}
async: false,
url: '{$ABS_PATH}lib/redactor/elfinder/js/i18n/elfinder.ru.js',
dataType: "script"
{rdelim});
$.ajax({ldelim}
async: false,
url: '{$ABS_PATH}modules/gmap/js/filemanager_gmap.js',
dataType: "script"
{rdelim});
{rdelim},
error: function(xhr, str){ldelim}
alert('Возникла ошибка: ' + xhr.responseCode);
{rdelim}
{rdelim});
{rdelim});
$("#dir_uplgmi").on('click', function () {ldelim}
var fmgmap = 'dir_uplgmi';
$("#finder").remove();
$('#gm_wrfm').append('<div id="finder">finder</div>');
$.ajax({ldelim}
type: 'POST',
url: '{$ABS_PATH}modules/gmap/fm.gmap.php',
cache: false,
data: {ldelim}fmgmap:fmgmap{rdelim},
success: function(data) {ldelim}
$.ajax({ldelim}
async: false,
url: '{$ABS_PATH}lib/redactor/elfinder/js/elfinder.full.js',
dataType: "script"
{rdelim});
$.ajax({ldelim}
async: false,
url: '{$ABS_PATH}lib/redactor/elfinder/js/i18n/elfinder.ru.js',
dataType: "script"
{rdelim});
$.ajax({ldelim}
async: false,
url: '{$ABS_PATH}modules/gmap/js/filemanager_gmap.js',
dataType: "script"
{rdelim});
{rdelim},
error: function(xhr, str){ldelim}
alert('Возникла ошибка: ' + xhr.responseCode);
{rdelim}
{rdelim});
{rdelim});
</script>

142
gmap/templates/map.tpl

@ -58,7 +58,12 @@ $(document).ready(function(){ldelim}
map{$gmap.id} = new google.maps.Map(document.getElementById("myMap{$gmap.id}"), myOptions{$gmap.id});
// create new info window for marker detail pop-up
infowindow{$gmap.id} = new google.maps.InfoWindow();
infowindow{$gmap.id} = new google.maps.InfoWindow(
{ldelim}
maxWidth: 700
{rdelim}
);
// load markers
loadMarkers{$gmap.id}();
@ -87,17 +92,105 @@ $(document).ready(function(){ldelim}
function loadMarker{$gmap.id}(markerData){ldelim}
// create new marker location
var myLatlng = new google.maps.LatLng(markerData['latitude'],markerData['longitude']);
var myLatlng = new google.maps.LatLng(markerData['latitude'],markerData['longitude']);
// create new marker
var image = '/modules/gmap/images/'+markerData['image']+'.png';
var content = markerData['title'];
var image = '/modules/gmap/images/'+markerData['image']+'.png';
if (markerData['img_title'] != '/modules/gmap/img/no_image.png')
{ldelim}
var a_stimg = "<img style=\"margin: 0px 10px 0px 0px;\" src=\"/index.php?thumb="+markerData['img_title']+"&height=64&width=64&mode=f\">";
{rdelim} else {ldelim}
var a_stimg = "<img style=\"margin: 0px 10px 10px 0px;\" src=\"/modules/gmap/img/no_image.png\">";
{rdelim};
if (markerData['marker_cat_title'] != '')
{ldelim}
if (markerData['marker_cat_link'] == '/' || markerData['marker_cat_link'] == 'javascript:void(0);'){ldelim}
var a_categ = "<li><a style=\"color:#828282; font-size:11px; text-decoration:none;\" onmouseover=\"this.style.color='#181818';\" onmouseout=\"this.style.color='#828282';\" href=\""+markerData['marker_cat_link']+"\">"+markerData['marker_cat_title']+"</a></li>";
{rdelim}
else {ldelim}
var a_categ = "<li><a style=\"color:#828282; font-size:11px; text-decoration:none;\" onmouseover=\"this.style.color='#181818';\" onmouseout=\"this.style.color='#828282';\" href=\"/"+markerData['marker_cat_link']+"\">"+markerData['marker_cat_title']+"</a></li>";
{rdelim}
{rdelim}
else
{ldelim}
var a_categ='';
{rdelim};
if (markerData['title'] != '')
{ldelim}
if (markerData['title_link'] == '/' || markerData['title_link'] == 'javascript:void(0);'){ldelim}
var a_title = "<li><a style=\"color:#181818; font-size:18px; text-decoration:none; border-bottom:2px solid;\" onmouseover=\"this.style.color='#FF6600';\" onmouseout=\"this.style.color='#181818';\" href=\""+markerData['title_link']+"\"><strong>"+markerData['title']+"</strong></a></li>";
{rdelim}
else {ldelim}
var a_title = "<li><a style=\"color:#181818; font-size:18px; text-decoration:none; border-bottom:2px solid;\" onmouseover=\"this.style.color='#FF6600';\" onmouseout=\"this.style.color='#181818';\" href=\"/"+markerData['title_link']+"\"><strong>"+markerData['title']+"</strong></a></li>";
{rdelim}
{rdelim}
else
{ldelim}
var a_title='';
{rdelim};
if (markerData['marker_street'] != '')
{ldelim}
var a_city = "<li><span style=\"font-size:12px; color:#68809B;\">"+markerData['marker_city']+", "+markerData['marker_street']+", "+markerData['marker_building']+"</span></li>";
{rdelim}
else
{ldelim}
var a_city='';
{rdelim};
if (markerData['marker_dopfield'] != '')
{ldelim}
var a_dopfield = "<li><div style=\"max-width:280px; white-space: normal !important; color:#828282;\">"+markerData['marker_dopfield']+"</div></li>";
{rdelim}
else
{ldelim}
var a_dopfield='';
{rdelim};
if (markerData['marker_phone'] != '')
{ldelim}
var a_phone = "<li><img src=\"{$ABS_PATH}modules/gmap/img/phone.png\">"+markerData['marker_phone']+"</li>";
{rdelim}
else
{ldelim}
var a_phone='';
{rdelim};
if (markerData['marker_www'] != '')
{ldelim}
var a_placeholders = new Array('http://www.', 'https://www.', 'http://', 'https://');
var a_www = "<li><a style=\"font-size:12px; color:#828282; text-decoration:none;\" onmouseover=\"this.style.color='#181818';\" onmouseout=\"this.style.color='#828282';\" href=\""+markerData['marker_www']+"\"><img src=\"{$ABS_PATH}modules/gmap/img/url.png\">"+str_replace(a_placeholders, 'www.', markerData['marker_www'])+"</a></li>";
{rdelim}
else
{ldelim}
var a_www='';
{rdelim};
// ПОЗИЦИОНИРУЕМ ЭЛЕМЕНТЫ МАРКЕРА
// div контейнер
var a_divs = "<div style=\"white-space: nowrap; overflow:hidden; min-height: 64px; \">";
var a_dive = "</div>";
// список включающий категорию, ссылку на документ и адрес
var a_uls = "<ul style=\"list-style:none; margin-top:-68px; margin-left: 30px;\">";
// список включающий телефон и вебсайт
var a_ultws = "<ul style=\"margin-top:-8px; list-style:none; text-align: center;\">";
// закрывающий тег </ul>
var a_ule = "</ul>";
// ФОРМИРУЕМ КОНТЕНТ МАРКЕРА
var content = a_divs+a_stimg+a_uls+a_categ+a_title+a_city+a_dopfield+a_ule+a_ultws+a_phone+a_www+a_ule+a_dive;
var marker = new google.maps.Marker({ldelim}
var marker = new google.maps.Marker({ldelim}
id: markerData['id'],
map: map{$gmap.id},
title: content,
content: content,
icon:image,
position: myLatlng
{rdelim});
@ -124,10 +217,41 @@ $(document).ready(function(){ldelim}
// check if marker was found
if( marker ){ldelim}
infowindow{$gmap.id}.setContent(marker.title);
infowindow{$gmap.id}.setContent(marker.content);
infowindow{$gmap.id}.open(map{$gmap.id},marker);
{rdelim}else{ldelim}
alert('Error marker not found: ' + markerId);
{rdelim}
{rdelim}
</script>
function str_replace ( search, replace, subject ) {ldelim}
if(!(replace instanceof Array)){ldelim}
replace=new Array(replace);
if(search instanceof Array){ldelim}
while(search.length>replace.length){ldelim}
replace[replace.length]=replace[0];
{rdelim}
{rdelim}
{rdelim}
if(!(search instanceof Array))search=new Array(search);
while(search.length>replace.length){ldelim}
replace[replace.length]='';
{rdelim}
if(subject instanceof Array){ldelim}
for(k in subject){ldelim}
subject[k]=str_replace(search,replace,subject[k]);
{rdelim}
return subject;
{rdelim}
for(var k=0; k<search.length; k++){ldelim}
var i = subject.indexOf(search[k]);
while(i>-1){ldelim}
subject = subject.replace(search[k], replace[k]);
i = subject.indexOf(search[k],i);
{rdelim}
{rdelim}
return subject;
{rdelim}
</script>

Loading…
Cancel
Save