<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
My mistake:<br>
I changed the 2 lines<br>
<i> var mw = pluginOutput.variables.mainmap_width;
<br>
var mh = pluginOutput.variables.mainmap_height;
</i><br>
with<br>
<i> var mw = pluginOutput.variables.mainmap_width+'px;
<br>
var mh = pluginOutput.variables.mainmap_height+'px';
</i><br>
and it works fine! <span class="moz-smiley-s6"><span> :-[ </span></span><br>
<br>
So to sum up for anyone interested:<br>
<br>
<b>Concerning FullExtent in Ajax:</b><br>
1. Modify dhtmlInit.js, Map.prototype.fullextent<br>
<font color="#3333ff"><i>CartoWeb.trigger('Location.FullExtent',
"doSubmit()"); </i></font><br>
2. Modify location.ajax.js, buildPostRequest method<br>
<font color="#3333ff"><i>return
'full_extent=full_extent&'+AjaxHandler.buildPostRequest();</i></font><br>
3. Modify ClientLocation.php<br>
a. handleHttpPostRequest method:<br>
<font color="#3333ff"><i>if (!empty($request['full_extent'])) {<br>
$this->locationRequest = $this->handleFullExtent();<br>
if (!is_null($this->locationRequest)) {<br>
return;<br>
}<br>
} </i></font><br>
b. ajaxHandleAction method to update other plugins:<br>
<font color="#3333ff"><i> case 'Location.FullExtent':<br>
$pluginEnabler->disableCoreplugins();<br>
$pluginEnabler->enablePlugin('location');<br>
$pluginEnabler->enablePlugin('layers');<br>
$pluginEnabler->enablePlugin('images'); </i></font>
<br>
<br>
<b>Concerning MapSize in Ajax:<br>
</b>1. Modify mapsize select in cartoclient template to have:<br>
<font color="#3333ff"><i>
onchange=<a class="moz-txt-link-rfc2396E" href="javascript:CartoWeb.trigger('Images.changeMapSize','doSubmit()');">"javascript:CartoWeb.trigger('Images.changeMapSize',
'doSubmit()');"</a></i></font><br>
2. Add these lines to Images.ajax.js<br>
<font color="#3333ff"><i>AjaxPlugins.Images.Actions.changeMapSize = {<br>
buildPostRequest: function(argObject) {<br>
return AjaxHandler.buildPostRequest();<br>
},<br>
};</i></font><br>
3. Modify handleResponse from Images.ajax;js<br>
<font color="#3333ff"><i><font color="#009900">// Updates
mapsize elements</font><br>
var mw = pluginOutput.variables.mainmap_width+'px';<br>
var mh = pluginOutput.variables.mainmap_height+'px';<br>
<br>
AjaxHandler.updateDomElement('needJsDiv','style.width',mw);<br>
AjaxHandler.updateDomElement('needJsDiv','style.height',mh);<br>
AjaxHandler.updateDomElement('loadbarDiv','style.width',mw);<br>
AjaxHandler.updateDomElement('loadbarDiv','style.height',mh);<br>
AjaxHandler.updateDomElement('map','style.width',mw);<br>
AjaxHandler.updateDomElement('map','style.height',mh);<br>
AjaxHandler.updateDomElement('map_rootLayer','style.width',mw);<br>
AjaxHandler.updateDomElement('map_rootLayer','style.height',mh);<br>
AjaxHandler.updateDomElement('map_rootLayer','style.clip','rect(0pt,
'+mw+', '+mh+', 0pt)');<br>
AjaxHandler.updateDomElement('map_raster','style.width',mw);<br>
AjaxHandler.updateDomElement('map_raster','style.height',mh);<br>
AjaxHandler.updateDomElement('map_raster','style.clip','rect(0px,
'+mw+', '+mh+', 0px)');<br>
AjaxHandler.updateDomElement('map_eventPad','style.width',mw);<br>
AjaxHandler.updateDomElement('map_eventPad','style.height',mh);<br>
AjaxHandler.updateDomElement('map_eventPad','style.clip','rect(0px,
'+mw+', '+mh+', 0px)');<br>
AjaxHandler.updateDomElement('map_drawing','style.width',mw);<br>
AjaxHandler.updateDomElement('map_drawing','style.height',mh);<br>
AjaxHandler.updateDomElement('map_drawing','style.clip','rect(0px,
'+mw+', '+mh+', 0px)');</i></font><br>
<b><br>
</b>Thanks again Oliver for your helpfull advices.<br>
<br>
Simon Ortet<br>
<br>
<b><br>
</b>Simon ORTET a écrit :
<blockquote cite="mid:46A4B42D.9010904@silogic.fr" type="cite">Thanks
for your help.
<br>
I managed to deal with the fullextent.
<br>
Concerning mapsizes, it's tricky and here's what i've done:
<br>
<br>
I modified the handleResponse from Images.ajax.js to update the DOM.
<br>
I catch no error but this script is not working. The image map is at
requested size (so no problem in server side) but there's something i
don't understand: in the updateDomElement function, instead of
'style.width' the value of property parameter is 'undoClipping'.
<br>
I can't figure out why. I pass a string 'style.width' and i receive
'undoClipping'. But there are no instruction between the call of
updateDomElement and it's first line (i tested in step mode with
Firebug).
<br>
I didn't find anything on Google neither
<br>
<br>
<br>
Here is what i added in the handleResponse method
<br>
// Updates mapsize elements
<br>
var mw = pluginOutput.variables.mainmap_width;
<br>
var mh = pluginOutput.variables.mainmap_height;
<br>
AjaxHandler.updateDomElement('needJsDiv','style.width',mw);
<br>
AjaxHandler.updateDomElement('needJsDiv','style.height',mh);
<br>
AjaxHandler.updateDomElement('loadbarDiv','style.width',mw);
<br>
AjaxHandler.updateDomElement('loadbarDiv','style.height',mh);
<br>
AjaxHandler.updateDomElement('map','style.width',mw);
<br>
AjaxHandler.updateDomElement('map','style.height',mh);
<br>
AjaxHandler.updateDomElement('map_rootLayer','style.width',mw);
<br>
AjaxHandler.updateDomElement('map_rootLayer','style.height',mh);
<br>
AjaxHandler.updateDomElement('map_rootLayer','clip','rect(0pt,
'+mw+'px, '+mh+'px, 0pt)');
<br>
AjaxHandler.updateDomElement('map_raster','style.width',mw);
<br>
AjaxHandler.updateDomElement('map_raster','style.height',mh);
<br>
AjaxHandler.updateDomElement('map_raster','clip','rect(0px,
'+mw+'px, '+mh+'px, 0px)');
<br>
AjaxHandler.updateDomElement('map_eventPad','style.width',mw);
<br>
AjaxHandler.updateDomElement('map_eventPad','style.height',mh);
<br>
AjaxHandler.updateDomElement('map_eventPad','clip','rect(0px,
'+mw+'px, '+mh+'px, 0px)');
<br>
AjaxHandler.updateDomElement('map_drawing','style.width',mw);
<br>
AjaxHandler.updateDomElement('map_drawing','style.height',mh);
<br>
AjaxHandler.updateDomElement('map_drawing','clip','rect(0px,
'+mw+'px, '+mh+'px, 0px)');
<br>
<br>
<br>
Thanks
<br>
<br>
Simon Ortet
<br>
<br>
<br>
<br>
<br>
Oliver Christen a écrit :
<br>
<blockquote type="cite">The problem is some event are not handled in
the same way, so simply faking a post via ajax will not effectively
trigger the event.
<br>
And also Im not even talking about the returned value(s) which are not
formated in the same way.
<br>
<br>
For the fullextent, this was already discussed :
<br>
<a class="moz-txt-link-freetext" href="http://lists.maptools.org/pipermail/cartoweb-users/2007-February/002058.html">http://lists.maptools.org/pipermail/cartoweb-users/2007-February/002058.html</a>
<br>
<a class="moz-txt-link-freetext" href="http://lists.maptools.org/pipermail/cartoweb-users/2007-April/002402.html">http://lists.maptools.org/pipermail/cartoweb-users/2007-April/002402.html</a>
<br>
<br>
For mapsize, the idea is the same, but a bit more complicated, as there
are more element in the template that must be updated.
<br>
The mapsize change is intercepted in the "images" coreplugin. What you
should do is :
<br>
- change the mapsize template so the change trigger an ajax action
(look at other template for example),
<br>
- add new functions in images.ajax.js to update the corresponding
elements in the page with the new values. Simply look in the templates
files (cartoclient.tpl and maybe others) where the variables returned
by the images coreplugin (you can see these in function
renderFormPrepare) are used and do the same but with javascript.
<br>
I dont think you need to modify the ClientImages.php, as it already
contain the corresponding ajax related functions.
<br>
<br>
regards
<br>
Oliver
<br>
<br>
<br>
<blockquote type="cite">Hi
<br>
<br>
Thank for your answer. The functionnalities i need in ajax are
fullExtent and mapSize.
<br>
Well by now i'm trying to implement it on the full extent function.
Maybe you could tell me wether i took a wrong path.
<br>
On the doSubmit function, instead of the myform.submit(); i do a
x_submitForm(); wich looks like this:
<br>
<br>
/function x_submitForm(){
<br>
xShow(xGetElementById('loadbarDiv'));
<br>
var param = AjaxHandler.buildPostRequest();
<br>
var laRequete = new Ajax.Request('/cw/htdocs/x_aeag.php', {method:
'post',parameters: param,onComplete: afficherReponse} );
<br>
}
<br>
<br>
/The file x_aeag.php looks like this:
<br>
/<?php
<br>
$_ENV['CW3_PROJECT'] = 'aeag';
<br>
require_once('client.php');
<br>
<br>
header('Content-Type: text/xml');
<br>
?>/
<br>
<br>
And then i modified the cartoclient.tpl so it produces an xml stream:
<br>
/<?xml version="1.0" encoding="UTF-8"?>/
<br>
/<reponse>
<br>
<bbox>{$bboxMinX},{$bboxMinY},{$bboxMaxX},{$bboxMaxY}</bbox>
<br>
<factor>{$factor}</factor>
<br>
<mapunits>{$mapUnits}</mapunits>
<scalebarUnits>{$scalebarUnits}</scalebarUnits>
<br>
<currentScale>1:{$currentScale}</currentScale>
<br>
<mainmap_path>{$mainmap_path}</mainmap_path>
<br>
<mainmap_width>{$mainmap_width}</mainmap_width>
<br>
<mainmap_height>{$mainmap_height}</mainmap_height>
<br>
<scalebar_path>{$scalebar_path}</scalebar_path>
<br>
<keymap_path>{$keymap_path}</keymap_path>
<br>
</reponse>/
<br>
<br>
Now my problem is that cartoweb doesn't produce the full extent map
image. A new image is yet generated but with still the same extent. I
can't find why...
<br>
<br>
regards
<br>
Simon Ortet
<br>
<br>
<br>
Oliver Christen a écrit :
<br>
<blockquote type="cite">Hi
<br>
<br>
Some plugins and maybe some core functionnalities are not compatible
with ajax.
<br>
Simply changing the doSubmit function to only return xmlhttprequest
(ajax) is probably not a good idea as it will break in the cases said
above.
<br>
<br>
I would suggest to first identify precisely which functionnalities you
use are still using non-ajax mode and then see how to modify these
functionnalities so they work with ajax (if possible)
<br>
<br>
regards
<br>
Oliver
<br>
<br>
----- Original Message ----- From: "Simon ORTET"
<a class="moz-txt-link-rfc2396E" href="mailto:simon.ortet@silogic.fr"><simon.ortet@silogic.fr></a>
<br>
To: <a class="moz-txt-link-rfc2396E" href="mailto:cartoweb-users@lists.maptools.org"><cartoweb-users@lists.maptools.org></a>
<br>
Sent: Thursday, July 19, 2007 10:25 AM
<br>
Subject: [Cartoweb-users] Cartoweb and Ajax
<br>
<br>
<br>
<blockquote type="cite">Hi,
<br>
<br>
I'm trying to set Cartoweb as a full Ajax application. So i try to
change the doSubmit function of dhtmlInit.js to make it send the form
through an ajax function.
<br>
I'd like to know if someone as already done this work, and if possible
to post the code in the list.
<br>
<br>
Thanks
<br>
_______________________________________________
<br>
Cartoweb-users mailing list
<br>
<a class="moz-txt-link-abbreviated" href="mailto:Cartoweb-users@lists.maptools.org">Cartoweb-users@lists.maptools.org</a>
<br>
<a class="moz-txt-link-freetext" href="http://lists.maptools.org/mailman/listinfo/cartoweb-users">http://lists.maptools.org/mailman/listinfo/cartoweb-users</a>
<br>
<br>
</blockquote>
<br>
<br>
</blockquote>
<br>
</blockquote>
<br>
<br>
</blockquote>
_______________________________________________
<br>
Cartoweb-users mailing list
<br>
<a class="moz-txt-link-abbreviated" href="mailto:Cartoweb-users@lists.maptools.org">Cartoweb-users@lists.maptools.org</a>
<br>
<a class="moz-txt-link-freetext" href="http://lists.maptools.org/mailman/listinfo/cartoweb-users">http://lists.maptools.org/mailman/listinfo/cartoweb-users</a>
<br>
<br>
</blockquote>
</body>
</html>