Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gmap
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
drupal.org
gmap
Commits
12c70470
Commit
12c70470
authored
11 years ago
by
boobaa
Committed by
podarok
11 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue #901596 by Ambidex, Boobaa | Rob_Feature: Use libraries api module for storing markers.
parent
31d6aaf9
No related branches found
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
gmap.install
+1
-0
1 addition, 0 deletions
gmap.install
gmap.module
+0
-1
0 additions, 1 deletion
gmap.module
gmap_markerinfo.inc
+96
-68
96 additions, 68 deletions
gmap_markerinfo.inc
gmap_settings_ui.inc
+6
-0
6 additions, 0 deletions
gmap_settings_ui.inc
js/icon.js
+2
-2
2 additions, 2 deletions
js/icon.js
with
105 additions
and
71 deletions
gmap.install
+
1
−
0
View file @
12c70470
...
...
@@ -15,6 +15,7 @@ function gmap_uninstall() {
variable_del
(
'gmap_mm_type'
);
variable_del
(
'gmap_load_zoom_plugin'
);
variable_del
(
'gmap_markermanager'
);
variable_del
(
'gmap_marker_custom_dir'
);
variable_del
(
'gmap_markerfiles'
);
variable_del
(
'gmap_node_markers'
);
variable_del
(
'gmap_private_markerfile'
);
...
...
This diff is collapsed.
Click to expand it.
gmap.module
+
0
−
1
View file @
12c70470
...
...
@@ -497,7 +497,6 @@ function gmap_regenerate_markers() {
$contents
.
=
"// GMap marker image data.
\n
"
;
$contents
.
=
"Drupal.gmap = Drupal.gmap || {};
\n
"
;
$contents
.
=
"Drupal.gmap.iconpath = "
.
drupal_json_encode
(
base_path
()
.
variable_get
(
'gmap_markerfiles'
,
drupal_get_path
(
'module'
,
'gmap'
)
.
'/markers'
))
.
";
\n
"
;
$contents
.
=
"Drupal.gmap.icondata = "
.
drupal_json_encode
(
gmap_get_icondata
(
TRUE
))
.
";
\n
"
;
$dir
=
"public://js/"
;
...
...
This diff is collapsed.
Click to expand it.
gmap_markerinfo.inc
+
96
−
68
View file @
12c70470
...
...
@@ -22,64 +22,78 @@ function _gmap_get_icondata() {
'transparent'
,
);
$markerdir
=
variable_get
(
'gmap_markerfiles'
,
drupal_get_path
(
'module'
,
'gmap'
)
.
'/markers'
);
$markerdirs
=
variable_get
(
'gmap_markerfiles'
,
array
(
drupal_get_path
(
'module'
,
'gmap'
)
.
'/markers'
));
$markercustomdir
=
variable_get
(
'gmap_marker_custom_dir'
,
NULL
);
if
(
$markercustomdir
)
{
$markerdirs
[]
=
$markercustomdir
;
}
if
(
module_exists
(
'libraries'
))
{
$markercustomdir
=
libraries_get_path
(
'gmap_markers'
);
if
(
$markercustomdir
)
{
$markerdirs
[]
=
$markercustomdir
;
}
}
// The following routines are designed to be easy to comprehend, not fast.
// This whole process gets cached.
// Get the ini files.
$inifiles
=
file_scan_directory
(
$markerdir
,
'/.*\.ini$/'
);
// Parse the ini files and store by path
$inis
=
array
();
foreach
(
$inifiles
as
$file
)
{
$path
=
substr
(
$file
->
uri
,
strlen
(
$markerdir
),
-
strlen
(
$file
->
filename
));
if
(
!
isset
(
$inis
[
$path
]))
{
$inis
[
$path
]
=
array
();
}
$inis
[
$path
][]
=
parse_ini_file
(
$file
->
uri
,
TRUE
);
}
unset
(
$inifiles
);
// Per directory..
foreach
(
$inis
as
$path
=>
$path_inis
)
{
$icons
[
$path
]
=
array
(
'tempf'
=>
array
(),
'f'
=>
array
(),
'w'
=>
array
(),
'h'
=>
array
(),
'i'
=>
array
(),
// Sets of sets
);
// Part 1: Collect image names
$filenames
=
array
();
foreach
(
$path_inis
as
$ini
)
{
foreach
(
$ini
as
$k
=>
$v
)
{
// Is this definition for an icon? (anything with a dot is a file)
if
(
strpos
(
$k
,
'.'
)
!==
FALSE
)
{
// Add the icon name.
$filenames
[
$k
]
=
TRUE
;
if
(
is_array
(
$markerdirs
))
{
foreach
(
$markerdirs
as
$markerdir
)
{
$inifiles
=
file_scan_directory
(
$markerdir
,
'/.*\.ini$/'
);
// Parse the ini files and store by path.
$inis
=
array
();
foreach
(
$inifiles
as
$file
)
{
$path
=
substr
(
$file
->
uri
,
0
,
-
strlen
(
$file
->
filename
));
if
(
!
isset
(
$inis
[
$path
]))
{
$inis
[
$path
]
=
array
();
}
else
{
// Shadow / alternate search
foreach
(
$imagetypes
as
$check
)
{
if
(
isset
(
$v
[
$check
]))
{
$filenames
[
$v
[
$check
]]
=
TRUE
;
$inis
[
$path
][]
=
parse_ini_file
(
$file
->
uri
,
TRUE
);
}
unset
(
$inifiles
);
// Per directory.
foreach
(
$inis
as
$path
=>
$path_inis
)
{
$icons
[
$path
]
=
array
(
'tempf'
=>
array
(),
'f'
=>
array
(),
'w'
=>
array
(),
'h'
=>
array
(),
'i'
=>
array
(),
// Sets of sets.
);
// Part 1: Collect image names.
$filenames
=
array
();
foreach
(
$path_inis
as
$ini
)
{
foreach
(
$ini
as
$k
=>
$v
)
{
// Is this definition for an icon? (Anything with a dot is a file.)
if
(
strpos
(
$k
,
'.'
)
!==
FALSE
)
{
// Add the icon name.
$filenames
[
$k
]
=
TRUE
;
}
}
// A sequence is a list of image names.
if
(
isset
(
$v
[
'sequence'
]))
{
foreach
(
explode
(
','
,
$v
[
'sequence'
])
as
$f
)
{
$filenames
[
trim
(
$f
)]
=
TRUE
;
else
{
// Shadow / alternate search.
foreach
(
$imagetypes
as
$check
)
{
if
(
isset
(
$v
[
$check
]))
{
$filenames
[
$v
[
$check
]]
=
TRUE
;
}
}
// A sequence is a list of image names.
if
(
isset
(
$v
[
'sequence'
]))
{
foreach
(
explode
(
','
,
$v
[
'sequence'
])
as
$f
)
{
$filenames
[
trim
(
$f
)]
=
TRUE
;
}
}
}
}
}
$icons
[
$path
][
'tempf'
]
=
$filenames
;
}
unset
(
$filenames
);
}
$icons
[
$path
][
'tempf'
]
=
$filenames
;
}
unset
(
$filenames
);
// Part 2: Assign ids, get width and height
// Part 2: Assign ids, get width and height
.
foreach
(
$icons
as
$path
=>
$v
)
{
$counter
=
0
;
foreach
(
$icons
[
$path
][
'tempf'
]
as
$filename
=>
$fv
)
{
...
...
@@ -87,7 +101,7 @@ function _gmap_get_icondata() {
if
(
empty
(
$filename
))
{
continue
;
}
$size
=
getimagesize
(
$markerdir
.
$path
.
$filename
);
$size
=
getimagesize
(
$path
.
$filename
);
$icons
[
$path
][
'f'
][
$counter
]
=
$filename
;
$icons
[
$path
][
'w'
][
$counter
]
=
$size
[
0
];
$icons
[
$path
][
'h'
][
$counter
]
=
$size
[
1
];
...
...
@@ -120,7 +134,7 @@ function _gmap_get_icondata() {
$ini
[
$k
][
$t
]
=
$icons
[
$path
][
'tempf'
][
$ini
[
$k
][
$t
]];
}
}
// Setup key for compression
// Setup key for compression
.
$ini
[
$k
][
'key'
]
=
$k
;
}
...
...
@@ -215,35 +229,49 @@ function _gmap_compress_array(&$arr) {
}
function
_gmap_get_marker_titles
()
{
$markerdir
=
variable_get
(
'gmap_markerfiles'
,
drupal_get_path
(
'module'
,
'gmap'
)
.
'/markers'
);
$markerdirs
=
variable_get
(
'gmap_markerfiles'
,
array
(
drupal_get_path
(
'module'
,
'gmap'
)
.
'/markers'
));
$markercustomdir
=
variable_get
(
'gmap_marker_custom_dir'
,
NULL
);
if
(
$markercustomdir
)
{
$markerdirs
[]
=
$markercustomdir
;
}
if
(
module_exists
(
'libraries'
))
{
$markercustomdir
=
libraries_get_path
(
'gmap_markers'
);
if
(
$markercustomdir
)
{
$markerdirs
[]
=
$markercustomdir
;
}
}
// The following routines are designed to be easy to comprehend, not fast.
// This whole process gets cached.
// Get the ini files.
$inifiles
=
file_scan_directory
(
$markerdir
,
'/.*\.ini$/'
);
// Parse the ini files and store by path
$inis
=
array
();
foreach
(
$inifiles
as
$file
)
{
$data
=
parse_ini_file
(
$file
->
uri
,
TRUE
);
if
(
isset
(
$data
[
'defaults'
]))
{
// Ignore defaults
unset
(
$data
[
'defaults'
]);
}
foreach
(
$data
as
$k
=>
$v
)
{
if
(
strpos
(
$k
,
'.'
)
!==
FALSE
)
{
// Ignore files
unset
(
$data
[
$k
]);
if
(
is_array
(
$markerdirs
))
{
foreach
(
$markerdirs
as
$markerdir
)
{
$inifiles
=
file_scan_directory
(
$markerdir
,
'/.*\.ini$/'
);
// Parse the ini files and store by path.
$inis
=
array
();
foreach
(
$inifiles
as
$file
)
{
$data
=
parse_ini_file
(
$file
->
uri
,
TRUE
);
if
(
isset
(
$data
[
'defaults'
]))
{
// Ignore defaults.
unset
(
$data
[
'defaults'
]);
}
foreach
(
$data
as
$k
=>
$v
)
{
if
(
strpos
(
$k
,
'.'
)
!==
FALSE
)
{
// Ignore files.
unset
(
$data
[
$k
]);
}
}
$inis
[]
=
$data
;
}
}
$inis
[]
=
$data
;
}
unset
(
$inifiles
);
unset
(
$inifiles
);
$titles
=
array
();
foreach
(
$inis
as
$ini
=>
$inidata
)
{
foreach
(
$inidata
as
$k
=>
$v
)
{
$titles
[
$k
]
=
t
(
$inis
[
$ini
][
$k
][
'name'
]);
$titles
=
array
();
foreach
(
$inis
as
$ini
=>
$inidata
)
{
foreach
(
$inidata
as
$k
=>
$v
)
{
$titles
[
$k
]
=
t
(
$inis
[
$ini
][
$k
][
'name'
]);
}
}
}
}
return
$titles
;
...
...
This diff is collapsed.
Click to expand it.
gmap_settings_ui.inc
+
6
−
0
View file @
12c70470
...
...
@@ -580,6 +580,12 @@ if (file_default_scheme() != 'public') {
'#size'
=>
4
,
'#maxlength'
=>
4
,
);
$form
[
'gmap_marker_custom_dir'
]
=
array
(
'#type'
=>
'textfield'
,
'#title'
=>
t
(
'Custom markers path'
),
'#description'
=>
t
(
'Fill in your custom markers folder (absolute path).'
),
'#default_value'
=>
variable_get
(
'gmap_marker_custom_dir'
,
'no value'
),
);
// @@@ Convert to element level validation.
$form
[
'#validate'
][]
=
'gmap_admin_settings_validate'
;
...
...
This diff is collapsed.
Click to expand it.
js/icon.js
+
2
−
2
View file @
12c70470
...
...
@@ -49,7 +49,7 @@ Drupal.gmap.getIcon = function (setname, sequence) {
for
(
var
i
=
0
;
i
<
q
.
sequence
.
length
;
i
++
)
{
/*
t = new GIcon();
p =
Drupal.gmap.iconpath +
q.path;
p = q.path;
t.image = p + q.sequence[i].f;
if (q.shadow.f !== '') {
t.shadow = p + q.shadow.f;
...
...
@@ -59,7 +59,7 @@ Drupal.gmap.getIcon = function (setname, sequence) {
t.iconAnchor = new GPoint(q.anchorX, q.anchorY);
t.infoWindowAnchor = new GPoint(q.infoX, q.infoY);
*/
p
=
Drupal
.
gmap
.
iconpath
+
q
.
path
;
p
=
q
.
path
;
t
=
new
google
.
maps
.
MarkerImage
(
p
+
q
.
sequence
[
i
].
f
,
new
google
.
maps
.
Size
(
q
.
sequence
[
i
].
w
,
q
.
sequence
[
i
].
h
),
null
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment