Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: 1 [2] 3 4 5 6 ... 15   Go Down

Author Topic: Google Map in Coppermine Gallery, version 2 (of mod and api)  (Read 325040 times)

0 Members and 1 Guest are viewing this topic.

Tranz

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Female
  • Posts: 6149
Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
« Reply #20 on: May 07, 2006, 06:09:37 pm »

I cannot upload plugins, dont know why, I have chmod 777 ant  :'(
Could you please create a new thread in the 1.4 plugins support board so that the issue could be resolved?
Logged

pelhrimak

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 49
    • satelite photos of world
« Last Edit: May 07, 2006, 06:43:31 pm by pelhrimak »
Logged
satellite photos and photos of WORLD
(http://svet.pelhrim.cz/pic.php)

DocMedicus

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 6
    • hamburg-kompakt.de
Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
« Reply #22 on: May 07, 2006, 11:06:41 pm »

Hy Tranz,

really great work. It's working very well. :D
I have only one problem: the overviewmap appears a little beside center browser. I tried to set it to the right bottom of the map but I couldn't figure out yet. How it works on your site?

Btw. I changed again the "$query" in "map.inc.php" so that only a choosenone picture of an album appears in the map.
Tomorrow I will upgrade my side with your Version2 so I could post a link again for example.

Greetings
DocMedicus
Logged

Tranz

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Female
  • Posts: 6149
Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
« Reply #23 on: May 07, 2006, 11:41:47 pm »

Hy Tranz,

really great work. It's working very well. :D
I have only one problem: the overviewmap appears a little beside center browser. I tried to set it to the right bottom of the map but I couldn't figure out yet. How it works on your site?
Sorry, I keep forgetting to edit the notes. There is a bug in the current api version. If you go into config and switch to the dev version of the maps api, that should fix it. Of course, it's not perfect because it covers the ToU, but that's Google's problem. :)
Logged

Tranz

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Female
  • Posts: 6149
Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
« Reply #24 on: May 08, 2006, 03:06:41 am »

This is a different version of editOnePic.php. The difference is that instead of double-clicking to get the coordinate value, you drag the marker to the destination. The nice thing about this is that the coordinate values show up immediately, rather than after you submit the form.

FIND:
Code: [Select]
define('EDITPICS_PHP', true);
ADD:
Code: [Select]
define('GMAP_PHP', true);
define('REGISTER_PHP', true);


FIND:
Code: [Select]
$user4        = $_POST['user4'];
after it, ADD:
Code: [Select]
    $coordinates = explode(',',$_POST['coordinates']);
    $latitude        = $coordinates[0];
    $longitude        = $coordinates[1];


FIND:
Code: [Select]
$update .= ", user4 = '".addslashes($user4)."'";
after it, ADD:
Code: [Select]
    $update .= ", latitude = '".addslashes($latitude)."'";
    $update .= ", longitude = '".addslashes($longitude)."'";



FIND:
Code: [Select]
if (GALLERY_ADMIN_MODE && $CURRENT_PIC['owner_id'] != USER_ID) {
  get_user_albums($CURRENT_PIC['owner_id']);
} else {
  get_user_albums();
}

AFTER it, ADD:
Code: [Select]
$map_key = $CONFIG['gmap_api_key'];
$use_dev_version = $CONFIG['gmap_version'];
// if version config is set not to use development version, use 2 (current stable), otherwise, use 2.x (latest development)
if ($use_dev_version == 1) {
$version = '2.x';
} else {
$version = '2';
}

$default_zoom_level = $CONFIG['gmap_default_zoom'];

//Google Maps API mysql fun
$query = "SELECT *
FROM {$CONFIG['TABLE_PICTURES']}
WHERE
pid = {$CURRENT_PIC['pid']}
LIMIT 1;
";
$result = cpg_db_query($query);

if($row = mysql_fetch_array($result))
{
    $CURRENT_PIC = $row; //send a copy to get_pic_url it messes with the vars
$latitude = $row['latitude'];
$longitude = $row['longitude'];
// by default, the center coordinate is the picture's latitude and longitude
if (abs($latitude) + abs($longitude) > 0) {
$default_center_coord = $latitude . ',' . $longitude;
$coordinates = $latitude . ',' . $longitude;
} elseif ($CONFIG['gmap_default_center'] != NULL) { //if the picture doesn't have lat/long info, use the default value
//$coordinates = 'no data';
$def_coordinates = explode(',',$CONFIG['gmap_default_center']);
$default_center_coord = $def_coordinates[0] . ',' . $def_coordinates[1];
} else { //if there is no default center, use Google, Inc address
$default_center_coord = '37.42225327545478,-122.0855712890625';
}
}



FIND:
Code: [Select]
// If this is the users gallery icon then check it
BEFORE it, ADD:
Code: [Select]
//lat and long
echo <<<EOT
        <tr>
            <td class="tableb" style="white-space: nowrap;">
                {$lang_gmap_php['coordinates']}
                </td>
                <td width="100%" class="tableb" valign="top" colspan="2">
                <input type="text" style="width: 100%" name="coordinates" maxlength="255" value="{$coordinates}" class="textinput" id="coordinates"/>
                </td>
        </tr>
EOT;

//show map if configured
if ($CONFIG['gmap_editOnePic_map'] == 1) {

echo <<<EOT
        <tr>
            <td class="tableb" valign="top" style="white-space: nowrap;">
                {$lang_register_php['location']}
                </td>
                <td width="100%" class="tableb" valign="top" colspan="2">
<noscript>
{$lang_gmap_php['no_javascript']}
</noscript>
{$lang_gmap_php['coord_instructions']}
<div id="small_map"></div>
                </td>
        </tr>
EOT;
}


FIND:
Code: [Select]
pagefooter();
AFTER it, ADD:
Code: [Select]
if ($CONFIG['gmap_editOnePic_map'] == 1) {
$gmap_code = <<<EOT
<script src="http://maps.google.com/maps?file=api&amp;v=$version&amp;key=$map_key" type="text/javascript">
</script>
<script type="text/javascript">
//<![CDATA[
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("small_map"));
map.setCenter(new GLatLng({$default_center_coord}), {$default_zoom_level});
map.addControl(new GSmallMapControl());

// "tiny" marker icon
var icon = new GIcon();
icon.image = "http://labs.google.com/ridefinder/images/mm_20_red.png";
icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
icon.iconSize = new GSize(12, 20);
icon.shadowSize = new GSize(22, 20);
icon.iconAnchor = new GPoint(6, 20);
icon.infoWindowAnchor = new GPoint(5, 1);

/////Draggable markers

var point = new GLatLng({$default_center_coord});
var markerD = new GMarker(point, {icon:icon, draggable: true});
map.addOverlay(markerD);

markerD.enableDragging();

GEvent.addListener(markerD, "drag", function(){
document.getElementById("coordinates").value=markerD.getPoint().toUrlValue();
});

}   else {
  alert("Sorry, the Google Maps API is not compatible with this browser");
}
//]]>
</script>
EOT;

}

IF you FIND:
Code: [Select]
$THUMB_ROWSPAN=5;
REPLACE with:
Code: [Select]
$THUMB_ROWSPAN=6;
Logged

Tranz

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Female
  • Posts: 6149
Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
« Reply #25 on: May 08, 2006, 03:11:54 am »

This is a different version of editpics.php. The difference is that instead of double-clicking to get the coordinate value, you drag the marker to the destination. The nice thing about this is that the coordinate values show up immediately, rather than after you submit the form.

FIND:
Code: [Select]
define('EDITPICS_PHP', true);
ADD:
Code: [Select]
define('GMAP_PHP', true);
define('REGISTER_PHP', true);


FIND:
Code: [Select]
$THUMB_ROWSPAN=5;
REPLACE with:
Code: [Select]
$THUMB_ROWSPAN=6;

FIND:
Code: [Select]
array($CONFIG['user_field4_name'], 'user4', 0, 255),
after it, ADD:
Code: [Select]
        array($lang_gmap_php['coordinates'], 'coordinates', 10, 255, 'latitude', 'longitude'),

FIND:
Code: [Select]
$user4       = get_post_var('user4', $pid);
after it, ADD:
Code: [Select]
                $coordinates = get_post_var('coordinates', $pid);

FIND:
Code: [Select]
$update .= ", user4 = '".addslashes($user4)."'";
after it, ADD:
Code: [Select]
$coordinates = explode(',',$coordinates);
$latitude        = $coordinates[0];
$longitude        = $coordinates[1];
$update .= ", latitude = '".addslashes($latitude)."'";
$update .= ", longitude = '".addslashes($longitude)."'";


FIND:
Code: [Select]
                $isgalleryicon_disabled = ($CURRENT_PIC['category'] < FIRST_USER_CAT) ? 'disabled="disabled" ':'';
AFTER it, ADD:
Code: [Select]
    global $CONFIG, $pid, $map_key, $default_center_coord, $default_zoom_level, $map_code, $coordinates, $lang_register_php, $lang_gmap_php, $version;
    $pid = $CURRENT_PIC['pid'];
$coordinates = $latitude . ',' . $longitude;
$map_key = $CONFIG['gmap_api_key'];
$use_dev_version = $CONFIG['gmap_version'];
// if version config is set not to use development version, use 2 (current stable), otherwise, use 2.x (latest development)
if ($use_dev_version == 1) {
$version = '2.x';
} else {
$version = '2';
}

$default_zoom_level = $CONFIG['gmap_default_zoom'];

//Google Maps API mysql fun
$query = "SELECT *
FROM {$CONFIG['TABLE_PICTURES']}
WHERE
{$CONFIG['TABLE_PICTURES']}.pid = {$pid}
LIMIT 1;
";
$result = cpg_db_query($query);

if($row = mysql_fetch_array($result))
{
    $CURRENT_PIC = $row; //send a copy to get_pic_url it messes with the vars
$latitude = $row['latitude'];
$longitude = $row['longitude'];
// by default, the center coordinate is the picture's latitude and longitude
if (abs($latitude) + abs($longitude) > 0) {
$default_center_coord = $latitude . ',' . $longitude;
$coordinates = $latitude . ',' . $longitude;
} elseif ($CONFIG['gmap_default_center'] != NULL) { //if the picture doesn't have lat/long info, use the default value
$def_coordinates = explode(',',$CONFIG['gmap_default_center']);
$default_center_coord = $def_coordinates[0] . ',' . $def_coordinates[1];
} else { //if there is no default center, use Google, Inc address
$default_center_coord = '37.42225327545478,-122.0855712890625';
}
$map_code .= <<<EOT
var map$pid = new GMap2(document.getElementById("small_map$pid"));
map$pid.setCenter(new GLatLng({$default_center_coord}), {$default_zoom_level});
map$pid.addControl(new GSmallMapControl());

/////Draggable markers

var point = new GLatLng({$default_center_coord});
var markerD$pid = new GMarker(point, {icon:icon, draggable: true});
map$pid.addOverlay(markerD$pid);

markerD$pid.enableDragging();

GEvent.addListener(markerD$pid, "drag", function(){
document.getElementById("coordinates$pid").value=markerD$pid.getPoint().toUrlValue();
});

EOT;
}

//show map if configured
if ($CONFIG['gmap_editpics_map'] == 1) {
echo <<<EOT
        <tr>
            <td class="tableb" valign="top" style="white-space: nowrap;">
                {$lang_register_php['location']}
                </td>
                <td width="100%" class="tableb" valign="top" colspan="2">
<noscript>
{$lang_gmap_php['no_javascript']}
</noscript>
{$lang_gmap_php['coord_instructions']}
<div id="small_map$pid" style="width: 300px; height: 300px; color: black; margin: 5px auto;"></div>
                </td>
        </tr>
EOT;
}


FIND:
Code: [Select]
<input type="text" style="width: {$field_width}%" name="$name" maxlength="$max_length" value="$value" class="textinput" />
REPLACE with:
Code: [Select]
                <input type="text" style="width: {$field_width}%" name="$name" maxlength="$max_length" value="$value" class="textinput" id="$name" />
                </td>
        </tr>

EOT;
}       

//array($lang_gmap_php['coordinates'], 10, 255, 'latitude', 'longitude'),
//function form_input($text, $name, $max_length)

function form_input_gmap($text, $name, $max_length, $latitude, $longitude,$field_width=100)
{
    global $CURRENT_PIC, $coordinates;

    $latitude = $CURRENT_PIC[$latitude];
    $longitude = $CURRENT_PIC[$longitude];
if (abs($latitude) + abs($longitude) > 0) {
$coordinates = $latitude . ',' . $longitude;
} else {
$coordinates = '';
}
    $value = $coordinates;
    $name .= $CURRENT_PIC['pid'];
    if ($text == '') {
        echo "        <input type=\"hidden\" name=\"$name\" value=\"\" />\n";
        return;
    }

    echo <<<EOT
        <tr>
            <td class="tableb" style="white-space: nowrap;">
                        $text
        </td>
        <td width="100%" class="tableb" valign="top">
                <input type="text" style="width: {$field_width}%" name="$name" maxlength="$max_length" value="$value" class="textinput" id="$name" />


FIND:
Code: [Select]
                            case 4 :
                                    form_options();
                                    break;

AFTER it, ADD:
Code: [Select]
case 10 :
                                    form_input_gmap($element[0], $element[1], $element[3], $element[4], $element[5]);
                                    break;


FIND:
Code: [Select]
pagefooter();
AFTER it, ADD:
Code: [Select]
if ($CONFIG['gmap_editpics_map'] == 1) {
$gmap_code =  <<<EOT
<script src="http://maps.google.com/maps?file=api&amp;v=$version&amp;key=$map_key" type="text/javascript">
</script>
<script type="text/javascript">
//<![CDATA[
if (GBrowserIsCompatible()) {
// "tiny" marker icon
var icon = new GIcon();
icon.image = "http://labs.google.com/ridefinder/images/mm_20_red.png";
icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
icon.iconSize = new GSize(12, 20);
icon.shadowSize = new GSize(22, 20);
icon.iconAnchor = new GPoint(6, 20);
icon.infoWindowAnchor = new GPoint(5, 1);

$map_code;
}   else {
  alert("Sorry, the Google Maps API is not compatible with this browser");
}
//]]>
</script>
EOT;
}
Logged

DocMedicus

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 6
    • hamburg-kompakt.de
Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
« Reply #26 on: May 08, 2006, 11:40:20 pm »

Hy Tranz,

thanks for your fast support yesterday. Now its working.

Here is a demolink for V2:http://www.hamburg-kompakt.de/cpg143/map.php

Thanks again  :-* and have a nice day.
DocMedicus
Logged

tibu

  • Contributor
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 59
    • Creative Foto Solutions
Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
« Reply #27 on: May 16, 2006, 02:35:29 pm »

Is there a way to install this mod without using the master template plugin?
The reason is I have installed a DigiBug photo/gift ordering plugin and the master template plugin conflicts with it. :(

Would It be better to use V1 of this mod?

EDIT TO ADD:
It seems that the sample section of the master template is what was conflciting with digibug (the Google Analytics section). So I no longer need to install without using the master template, I am going to remove the google analytics section from the master template plugin and reinstall it. I don't know how may of you are using the DigiBug plugin, but if you are hopefully this information helps you out.
« Last Edit: May 16, 2006, 05:26:12 pm by tibu »
Logged

Tranz

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Female
  • Posts: 6149
Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
« Reply #28 on: May 16, 2006, 05:50:51 pm »

Just so you know, you don't need to reinstall the plugin every time you edit codebase.php

So is the issue resolved? :)
Logged

tibu

  • Contributor
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 59
    • Creative Foto Solutions
Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
« Reply #29 on: May 16, 2006, 07:02:46 pm »

Oh yes, thanks for mentioning that I don't need to reinstall, I was only doing that because I don't have access to ftp where I am at right now. (I was using the plugin upload in pluginmgr.php to upload changes).

YES the issue is resolved.  ;D

Thanks again for a great mod with clear instructions.
Logged

lgpfort

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
« Reply #30 on: May 16, 2006, 10:00:10 pm »

Hi Thu,
Ver 1 is working on http://www.mobipics.net/vspace/mobimaps3.php
So I installed cpg145 on another site http://www.mobilogs.net/cpg/vistamap.php
and added the Ver 2 using the master template, but no success.
Not sure what to check next.
Logged

Tranz

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Female
  • Posts: 6149
Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
« Reply #31 on: May 17, 2006, 04:27:51 am »

Review the changes in this file: http://www.mobilogs.net/cpg/plugins/master_template/codebase.php, which is showing a parse error.
Logged

tibu

  • Contributor
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 59
    • Creative Foto Solutions
Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
« Reply #32 on: May 17, 2006, 06:05:10 pm »

The map shows up on the My Favorites/Lightbox page. Since it is on your site, I assume this is by design. Is there a way to remove it from appearing on that page?
Logged

Tranz

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Female
  • Posts: 6149
Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
« Reply #33 on: May 18, 2006, 06:37:01 am »

That's because My Favorites is just another type of album that is displayed in thumbnails.php. If you want to filter it out, change the modified code in thumbnails.php to this:
Code: [Select]
if ($album != 'favpics') {
$center_avg_coords = TRUE;
include('include/map.inc.php');
}
Logged

rafynet

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
« Reply #34 on: May 18, 2006, 02:24:28 pm »

I know my problem most likely has to do with the CSS for gmap (codebase.php) but i followed the instructions to the tee and the map displays all funny ... outside of the 'designated' area.

Please help

www.rafy.net/gallery/map.php
login: test
pw: test
Logged

Tranz

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Female
  • Posts: 6149
Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
« Reply #35 on: May 18, 2006, 03:14:36 pm »

Find:
Code: [Select]
$uacct='NN-NNNNNN-N';
Comment it like this:
Code: [Select]
//$uacct='NN-NNNNNN-N';
You can also remove the stuff between <script> in codebase.php that has to do with Google Analytics if you are not using it.
Logged

teamsand

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
« Reply #36 on: May 23, 2006, 06:16:22 pm »

Hi Im really interested in the coppermine capabilities of the map mod, and so far yourslooks great, I love the multi-tab feature. I was wondering If you had any plans to allow for registered users to tag thier albums or photos onto the map? This would be pretty awsome as no other app does this yet ( trust me ive spend weeks/months testing the only thing that comes close is the gallery2 map mod which Ive helped work on, but the gallery2 user control is awful). I would be more than willing to pay/donate a nice amount for this kind of user permission functionality.
Logged

Tranz

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Female
  • Posts: 6149
Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
« Reply #37 on: May 24, 2006, 05:10:52 am »

Hi Im really interested in the coppermine capabilities of the map mod, and so far yourslooks great, I love the multi-tab feature. I was wondering If you had any plans to allow for registered users to tag thier albums or photos onto the map? This would be pretty awsome as no other app does this yet ( trust me ive spend weeks/months testing the only thing that comes close is the gallery2 map mod which Ive helped work on, but the gallery2 user control is awful). I would be more than willing to pay/donate a nice amount for this kind of user permission functionality.
Yes, I would like an easy way for people to click a point on the map and get a popup to upload a file. If I don't have anything else to do this three day weekend, I'll look into.

However, your registered users can still add images to the map, in a roundabout way. They upload the file(s), then if you permit them, when they go to edit the files, a map will display just as it does for admin. Unfortunately, I haven't been able to get it to work on the upload.php file, which is the form they see as they upload. They have to edit the file after the fact. This has been fixed, so the user can enter coordinate info when the upload the file.
« Last Edit: July 30, 2006, 07:12:52 pm by TranzNDance »
Logged

teamsand

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
« Reply #38 on: May 24, 2006, 05:24:27 am »

Ah ok that would be nice, I actually havn't installed coppermine yet since Ive been with gallery2 for so long but its persistent lack of user control and permission has me leaving. I will throw this up and test it out.

You can see my oldish gallery2 map here ( http://gallery.dotnature.com/main.php?g2_view=map.ShowMap) that I made a custom infowindow and style for, the directions and meta data come in handy.

looking forward to helping out, thanks.
Logged

Tranz

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Female
  • Posts: 6149
Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
« Reply #39 on: May 24, 2006, 06:37:57 am »

You can see my oldish gallery2 map here ( http://gallery.dotnature.com/main.php?g2_view=map.ShowMap) that I made a custom infowindow and style for, the directions and meta data come in handy.

looking forward to helping out, thanks.
The map you are using has some nice features.

I'm looking forward to your help. :) Frankly, I don't always know what I'm doing. I just know to search, and copy/paste/edit. It would be great to collaborate with someone more versed than I am in the maps api.
Logged
Pages: 1 [2] 3 4 5 6 ... 15   Go Up
 

Page created in 0.062 seconds with 21 queries.