The javascript code for map navigation was redesigned between CartoWeb version 3.0 and 3.1. It has been rewritten as a real API and allows complex features draw and management. Following you will find the main changes that occured and should be considered to avoid incompatibilities.
Migration
This section describes which changes may affect customized projects and what to do to migrate from a "PRE_DHTML" project to a new one. First, what could be our best advice is to compare your customized templates and CSS or JS files with the standard CartoWeb3 repository.
CSS Files
dhtml_tools.css is now deprecated. It has been partially replaced by dhtml.css.
The keymap.css file has been modified to suit the new positions parameters.
In cartoweb.css, mainmapcell is now deprecated. You will also find new entries for floatScale, floatGeo, floatDistance and floatSurface.
JS Files
All the *.js files except carto.js, folder.js, keymap.js are deleted or replaced. You must notice that "onLoadString" is now deprecated. Use the following sentence instead in you javascript codes:
EventManager.Add(window, 'load', setupFolders, false);
Templates
cartoclient.tpl
A new javascript file link is used: EventManager.js.
<script type="text/javascript" src="{r type=js}EventManager.js{/r}"</script>
The "window.onload / onLoadString" section is no more used:
{if $views|default:'' || $viewsList|default:''}<script type="text/javascript" src="{r type=js plugin=views}views.js{/r}"</script>{/if} {include file="dhtmlcode.tpl"} - <script language="JavaScript" type="text/javascript"> - <!-- - {literal} - window.onload = function() { - if (typeof onLoadString == "string") { - eval(onLoadString); - } - } - {/literal} - //--> - </script>
Add following attribute to the form tag: onsubmit="doSubmit();"
<div id="banner"><h1>{t}Cartoclient Title{/t}</h1></div> + <form method="post" action="{$selfUrl}" name="carto_form" onsubmit="doSubmit();"> <input type="image" name="dummy" alt="" id="dummy" />
Add floatScale, floatDistance and floatSurface divs to your document anywhere you want.
<tr> <td colspan="3"> <table width="100%"><tr> <td width="50%"><div id="floatGeo" class="locationInfo">{t}Coords (m):{/t} %s / %s</div></td> <td width="50%"><div id="floatDistance" class="locationInfo">{t}Dist approx.:{/t} %s{if $factor == 1000} km{else} m{/if}</div> <div id="floatSurface" class="locationInfo">{t}Approx. surface :{/t} %s{if $factor == 1000} km²{else} m²{/if}</div></td> </tr></table> </td> </tr>
dhtmlcode.tpl
This template is almost completely modified. It shouldn't have been customized.
mainmap.tpl
Make sure that you have a map div included in a mapBorder div in your template. The loadBarDiv should also be included in mapBorder.
toolbar.tpl
In the case you customized the toolbar template, you'll need to modified it to integrate the new tool calling structure.
Check the radios value attribute:
value="{$tool->id}"
Check the onclick attributes:
onclick="mainmap.{$tool->id}('map');"
Exhaustive Files Modifications List
client
ClientPlugin.php modified (jsToolAttr deprecated)
FormRenderer.php (jsToolAttr deprecated for ToolDescription)
HttpRequestHandler.php modified
common
BasicTypes.php: Feature class added
client_conf
client.ini
- takes care of name of the default selected tool
zoom_in -> zoomin
coreplugins
location
client/ClientLocation.php modified (jsToolAttr deprecated)
htdocs/gfx
zoom_in.gif removed
zoom_out.gif removed
zoomin.gif added
zoomout.gif added
query/client/ClientQuery.php modified (jsToolAttr deprecated)
statictools/client/ClientStatictools.php modified (jsToolAttr deprecated)
css
dhtml_tools.css deprecated
cartoweb.css modified
dhtml.css added
transparent_orange.png added
transparent_yellow.png added
keymap.css modified to suit the new dhtml positions
js
dhtmlAPI.js added
dhtmlInit.js added
EventManager.js added
graphTools.js removed
navTools.js removed
x_core_n4.js removed
x_core.js removed
x_dom_n4.js removed
x_dom.js removed
x_event_n4.js removed
x_cartoweb.js added
wz_jsgraphics.js added
plugins
outline
client/ClientOutline.php modified (jsToolAttr deprecated)
templates/outlineLabel.tpl modified
htdocs/js/outline.js modified
projects
demo: some templates and css files changed
templates
cartoclient.tpl modified
toolbar.tpl modified
mainmap.tpl modified