map: improved waypoint popup windows

This commit is contained in:
following 2013-03-12 01:03:28 +01:00
parent f87389362a
commit a592e04f5f
5 changed files with 20 additions and 19 deletions

View File

@ -46,6 +46,7 @@ function getWaypoints($cacheid)
$htmlcoordinate = $formatter->formatHtml($waypoint['coordinate'], '</td></tr><tr><td style="white-space:nowrap">'); $htmlcoordinate = $formatter->formatHtml($waypoint['coordinate'], '</td></tr><tr><td style="white-space:nowrap">');
$tmpline = mb_ereg_replace('{wp_coordinate}', $htmlcoordinate, $tmpline); $tmpline = mb_ereg_replace('{wp_coordinate}', $htmlcoordinate, $tmpline);
$tmpline = mb_ereg_replace('{wp_description}', htmlspecialchars($waypoint['description'], ENT_COMPAT, 'UTF-8'), $tmpline); $tmpline = mb_ereg_replace('{wp_description}', htmlspecialchars($waypoint['description'], ENT_COMPAT, 'UTF-8'), $tmpline);
$tmpline = mb_ereg_replace('{wp_show_description}', mb_ereg_replace('\r\n','<br />',htmlspecialchars($waypoint['description'], ENT_COMPAT, 'UTF-8')), $tmpline);
$tmpline = mb_ereg_replace('{cacheid}', htmlspecialchars($cacheid, ENT_COMPAT, 'UTF-8'), $tmpline); $tmpline = mb_ereg_replace('{cacheid}', htmlspecialchars($cacheid, ENT_COMPAT, 'UTF-8'), $tmpline);
$tmpline = mb_ereg_replace('{childid}', htmlspecialchars($waypoint['childid'], ENT_COMPAT, 'UTF-8'), $tmpline); $tmpline = mb_ereg_replace('{childid}', htmlspecialchars($waypoint['childid'], ENT_COMPAT, 'UTF-8'), $tmpline);

View File

@ -36,7 +36,7 @@
$picturelines = '{lines}<tr><td colspan="2">&nbsp;</td></tr>'; $picturelines = '{lines}<tr><td colspan="2">&nbsp;</td></tr>';
$nowaypoints = '<tr><td colspan="2">' . t('No waypoints available') . '</td></tr>'; $nowaypoints = '<tr><td colspan="2">' . t('No waypoints available') . '</td></tr>';
$waypointline = '<tr bgcolor="#ffffff"><td><table class="narrowtable" cellspacing="0" cellpadding="0"><tr><td><img src="{wp_image}" /></td><td>{wp_type}</td></tr></table></td><td><table class="narrowtable"><tr><td style="white-space:nowrap">{wp_coordinate}</td></tr></table></tp><td>{wp_description}</td><td>[<a href="childwp.php?cacheid={cacheid}&childid={childid}">' . t('Edit') . '</a>] [<a href="childwp.php?cacheid={cacheid}&deleteid={childid}">' . t('Delete') . '</a>]</td></tr>'; $waypointline = '<tr bgcolor="#ffffff"><td><table class="narrowtable" cellspacing="0" cellpadding="0"><tr><td><img src="{wp_image}" /></td><td>{wp_type}</td></tr></table></td><td><table class="narrowtable"><tr><td style="white-space:nowrap">{wp_coordinate}</td></tr></table></tp><td>{wp_show_description}</td><td>[<a href="childwp.php?cacheid={cacheid}&childid={childid}">' . t('Edit') . '</a>] [<a href="childwp.php?cacheid={cacheid}&deleteid={childid}">' . t('Delete') . '</a>]</td></tr>';
$waypointlines = '<tr><td colspan="2"><table class="edit_wptable">{lines}</table></td></tr><tr><td colspan="2">&nbsp;</td></tr>'; $waypointlines = '<tr><td colspan="2"><table class="edit_wptable">{lines}</table></td></tr><tr><td colspan="2">&nbsp;</td></tr>';
$cache_attrib_js = "new Array({id}, {selected}, '{img_undef}', '{img_large}')"; $cache_attrib_js = "new Array({id}, {selected}, '{img_undef}', '{img_large}')";

View File

@ -366,7 +366,7 @@ function output_cachexml($sWaypoint)
echo 'imagewidth="38" imageheight="38" '; echo 'imagewidth="38" imageheight="38" ';
echo 'latitude="' . xmlentities($waypoint['latitude']) . '" '; echo 'latitude="' . xmlentities($waypoint['latitude']) . '" ';
echo 'longitude="' . xmlentities($waypoint['longitude']) . '" '; echo 'longitude="' . xmlentities($waypoint['longitude']) . '" ';
echo 'description="' . xmlentities($waypoint['description']) . '" />\n'; echo 'description="' . xmlentities(mb_ereg_replace('\r\n','<br />',$waypoint['description'])) . '" />\n';
} }
echo ' </cache>\n'; echo ' </cache>\n';

View File

@ -1191,12 +1191,16 @@ td.mapheader_spacer {
div.mappopup { div.mappopup {
overflow:hidden; /* avoids double-scrollbars in MSIE; 'visible' wont work */ overflow:hidden; /* avoids double-scrollbars in MSIE; 'visible' wont work */
} }
table.mappopup td { table.mappopup td {
font-size: 11px; font-size: 11px;
white-space: nowrap; white-space: nowrap;
} }
td.wppopupheader {
font-size:1.15em;
}
.mapboxframe { .mapboxframe {
border:1px solid #777777; border:1px solid #777777;

View File

@ -884,7 +884,7 @@ function adjust_infowindow()
// alert("Before: " + iw_frame.style.width + " / " + iw_frame.style.height); // alert("Before: " + iw_frame.style.width + " / " + iw_frame.style.height);
iw_frame.style.width = String(iw_width + 2) + "px"; iw_frame.style.width = String(iw_width + 2) + "px";
// making it too wide would let additional wp text flow into the margin at MSIE // making it too wide would let additional wp text flow into the margin at MSIE
iw_frame.style.height = String(iw_height + 25) + "px"; iw_frame.style.height = String(iw_height + 10) + "px";
// alert("After: " + iw_frame.style.width + " / " + iw_frame.style.height); // alert("After: " + iw_frame.style.width + " / " + iw_frame.style.height);
} }
else else
@ -990,26 +990,22 @@ function init_waypoint_markers(aWaypoints)
var typename = maWpWaypoints[nearestwp].getAttribute('typename'); var typename = maWpWaypoints[nearestwp].getAttribute('typename');
var description = maWpWaypoints[nearestwp].getAttribute('description'); var description = maWpWaypoints[nearestwp].getAttribute('description');
{/literal} var maxwidth;
var typetext; if (description.length < 512)
if (wptype+0 == 0 && {if $help_note != ""}1{else}0{/if}) maxwidth = "320px";
typetext = "{$help_note}";
else if ({if $help_wps != ""}1{else}0{/if})
typetext = "{$help_wps}";
if (typetext != "")
typetext += typename + "</a>";
else else
typetext += typename; maxwidth = "480px";
var text = // MSIE needs max width to wrap long descriptions {/literal}
"<div id='mapinfowindow' style='max-width:400px; max-height:400px'><table class='mappopup'>" + var text =
"<div id='mapinfowindow' style='max-height:320px;" + {if $msie}" max-width:" + maxwidth + ";" +{/if} " overflow:auto'><table class='mappopup'>" +
"<tr><td><table cellspacing='0' cellpadding='0'><tr><td>" + "<tr><td><table cellspacing='0' cellpadding='0'><tr><td>" +
"<img src='" + image + "' width='" + imagewidth + "' height='" + imageheight + "' ></td>" + "<img src='" + image + "' width='" + imagewidth + "' height='" + imageheight + "' ></td>" +
"<td style='font-size:1.15em'><span style='white-space:normal'>" + typetext + " {t}for{/t}" + "</span></td>" + "<td class='wppopupheader'><span style='white-space:normal'>" + typename + "</span></td><td style='vertical-align:top'></td><td class='wppopupheader'>&nbsp;{t}for{/t}" + "</span></td>" +
"<td style='font-weight:bold; font-size:1.2em'>&nbsp;<a href='viewcache.php?wp=" + msPopupMarkerWP + "' target='_blank_'>" + msPopupMarkerWP + "</a></td>" + "<td class='wppopupheader' style='font-weight:bold'>&nbsp;<a href='viewcache.php?wp=" + msPopupMarkerWP + "' target='_blank_'>" + msPopupMarkerWP + "</a></td>" +
"</tr></table></td></tr>"; "</tr></table></td></tr>";
if (description != "") if (description != "")
text += "<tr><td style='padding:8px; max-width:350px; white-space:normal' colspan='4'>" + description + "</td></tr>"; text += "<tr><td style='padding:8px; max-width:" + maxwidth + "; white-space:normal' colspan='4'>" + description + "</td></tr>";
text += "</table></div>"; text += "</table></div>";
{literal} {literal}