<!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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var mw = pluginOutput.variables.mainmap_width;
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var mh = pluginOutput.variables.mainmap_height;
</i><br>
with<br>
<i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var mw = pluginOutput.variables.mainmap_width+'px;
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; <font color="#3333ff"><i>CartoWeb.trigger('Location.FullExtent',
"doSubmit()");&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; </i></font><br>
2. Modify location.ajax.js, buildPostRequest method<br>
&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <font color="#3333ff"><i>return
'full_extent=full_extent&amp;'+AjaxHandler.buildPostRequest();</i></font><br>
3. Modify ClientLocation.php<br>
&nbsp;&nbsp;&nbsp; a. handleHttpPostRequest method:<br>
<font color="#3333ff"><i>if (!empty($request['full_extent'])) {<br>
&nbsp;&nbsp;&nbsp; $this-&gt;locationRequest = $this-&gt;handleFullExtent();<br>
&nbsp;&nbsp;&nbsp; if (!is_null($this-&gt;locationRequest)) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return;<br>
&nbsp;&nbsp;&nbsp; }<br>
} </i></font><br>
&nbsp;&nbsp;&nbsp; b. ajaxHandleAction method to update other plugins:<br>
<font color="#3333ff"><i>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; case 'Location.FullExtent':<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $pluginEnabler-&gt;disableCoreplugins();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $pluginEnabler-&gt;enablePlugin('location');<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $pluginEnabler-&gt;enablePlugin('layers');<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $pluginEnabler-&gt;enablePlugin('images');&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;</i></font>
&nbsp;&nbsp;&nbsp; <br>
<br>
<b>Concerning MapSize in Ajax:<br>
</b>1. Modify mapsize select in cartoclient template to have:<br>
<font color="#3333ff"><i>&nbsp;&nbsp;&nbsp;
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>
&nbsp;&nbsp;&nbsp; buildPostRequest: function(argObject) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return AjaxHandler.buildPostRequest();<br>
&nbsp;&nbsp;&nbsp; },<br>
};</i></font><br>
3. Modify handleResponse from Images.ajax;js<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <font color="#3333ff"><i><font color="#009900">// Updates
mapsize elements</font><br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; var mw = pluginOutput.variables.mainmap_width+'px';<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; var mh = pluginOutput.variables.mainmap_height+'px';<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; AjaxHandler.updateDomElement('needJsDiv','style.width',mw);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; AjaxHandler.updateDomElement('needJsDiv','style.height',mh);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; AjaxHandler.updateDomElement('loadbarDiv','style.width',mw);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; AjaxHandler.updateDomElement('loadbarDiv','style.height',mh);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; AjaxHandler.updateDomElement('map','style.width',mw);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; AjaxHandler.updateDomElement('map','style.height',mh);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; AjaxHandler.updateDomElement('map_rootLayer','style.width',mw);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; AjaxHandler.updateDomElement('map_rootLayer','style.height',mh);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
AjaxHandler.updateDomElement('map_rootLayer','style.clip','rect(0pt,
'+mw+', '+mh+', 0pt)');<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; AjaxHandler.updateDomElement('map_raster','style.width',mw);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; AjaxHandler.updateDomElement('map_raster','style.height',mh);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
AjaxHandler.updateDomElement('map_raster','style.clip','rect(0px,
'+mw+', '+mh+', 0px)');<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; AjaxHandler.updateDomElement('map_eventPad','style.width',mw);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; AjaxHandler.updateDomElement('map_eventPad','style.height',mh);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
AjaxHandler.updateDomElement('map_eventPad','style.clip','rect(0px,
'+mw+', '+mh+', 0px)');<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; AjaxHandler.updateDomElement('map_drawing','style.width',mw);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; AjaxHandler.updateDomElement('map_drawing','style.height',mh);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
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 &eacute;crit&nbsp;:
<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&nbsp;
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>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Updates mapsize elements
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var mw = pluginOutput.variables.mainmap_width;
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var mh = pluginOutput.variables.mainmap_height;
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AjaxHandler.updateDomElement('needJsDiv','style.width',mw);
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AjaxHandler.updateDomElement('needJsDiv','style.height',mh);
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AjaxHandler.updateDomElement('loadbarDiv','style.width',mw);
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AjaxHandler.updateDomElement('loadbarDiv','style.height',mh);
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AjaxHandler.updateDomElement('map','style.width',mw);
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AjaxHandler.updateDomElement('map','style.height',mh);
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AjaxHandler.updateDomElement('map_rootLayer','style.width',mw);
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AjaxHandler.updateDomElement('map_rootLayer','style.height',mh);
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AjaxHandler.updateDomElement('map_rootLayer','clip','rect(0pt,
'+mw+'px, '+mh+'px, 0pt)');
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AjaxHandler.updateDomElement('map_raster','style.width',mw);
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AjaxHandler.updateDomElement('map_raster','style.height',mh);
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AjaxHandler.updateDomElement('map_raster','clip','rect(0px,
'+mw+'px, '+mh+'px, 0px)');
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AjaxHandler.updateDomElement('map_eventPad','style.width',mw);
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AjaxHandler.updateDomElement('map_eventPad','style.height',mh);
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AjaxHandler.updateDomElement('map_eventPad','clip','rect(0px,
'+mw+'px, '+mh+'px, 0px)');
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AjaxHandler.updateDomElement('map_drawing','style.width',mw);
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AjaxHandler.updateDomElement('map_drawing','style.height',mh);
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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 &eacute;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>
&nbsp;xShow(xGetElementById('loadbarDiv'));
      <br>
&nbsp;var param = AjaxHandler.buildPostRequest();
      <br>
&nbsp;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>
/&lt;?php
      <br>
$_ENV['CW3_PROJECT'] = 'aeag';
      <br>
require_once('client.php');
      <br>
      <br>
header('Content-Type: text/xml');
      <br>
?&gt;/
      <br>
      <br>
And then i modified the cartoclient.tpl so it produces an xml stream:
      <br>
/&lt;?xml version="1.0" encoding="UTF-8"?&gt;/
      <br>
/&lt;reponse&gt;
      <br>
&nbsp;&nbsp;
&lt;bbox&gt;{$bboxMinX},{$bboxMinY},{$bboxMaxX},{$bboxMaxY}&lt;/bbox&gt;
      <br>
&nbsp;&nbsp; &lt;factor&gt;{$factor}&lt;/factor&gt;
      <br>
&nbsp;&nbsp; &lt;mapunits&gt;{$mapUnits}&lt;/mapunits&gt;
&lt;scalebarUnits&gt;{$scalebarUnits}&lt;/scalebarUnits&gt;
      <br>
&nbsp;&nbsp; &lt;currentScale&gt;1:{$currentScale}&lt;/currentScale&gt;
      <br>
&nbsp;&nbsp; &lt;mainmap_path&gt;{$mainmap_path}&lt;/mainmap_path&gt;
      <br>
&nbsp;&nbsp; &lt;mainmap_width&gt;{$mainmap_width}&lt;/mainmap_width&gt;
      <br>
&nbsp;&nbsp; &lt;mainmap_height&gt;{$mainmap_height}&lt;/mainmap_height&gt;
      <br>
&nbsp;&nbsp; &lt;scalebar_path&gt;{$scalebar_path}&lt;/scalebar_path&gt;
      <br>
&nbsp;&nbsp; &lt;keymap_path&gt;{$keymap_path}&lt;/keymap_path&gt;
      <br>
&lt;/reponse&gt;/
      <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 &eacute;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">&lt;simon.ortet@silogic.fr&gt;</a>
        <br>
To: <a class="moz-txt-link-rfc2396E" href="mailto:cartoweb-users@lists.maptools.org">&lt;cartoweb-users@lists.maptools.org&gt;</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>