Mapbender without iframes

From MapbenderWiki

Jump to: navigation, search

Contents

Objective

Remove all iframes in Mapbender. Iframes cause a lot of different problems, like synchronisation issues, JSON encoding, jQuery etc.

Pitfalls

  • wz_jsgraphics seem to work in the context of a "window". If the mapframe was no longer an iframe, the coordinates of the jsgraphics would have to be relative to the "div"s position
  • Namespacing: Now, DOM elements and JS variables in each iframe are isolated. If all was located in a single window, duplicates might occur

Points that cause incompartibility

  • mb_getMousePos() returns frame coordinates
    • use mapObj[].getMousePos(e) instead
  • loops like
for(var i=0; i<mb_mapObj.length; i++){
if(mb_mapObj[i].frameName == frameName){
mb_mapObj[i].blablabla
}}

replace with

myMapObj = getMapObjByName(frameName);
myMapObj.blablabla
  • window.frames[mod_pan_target].document
    • replace with myMapObj.getDomElement().ownerDocument if you need the document
    • or simply with myMapObj.getDomElement() if the dom element is what you really need (eg for events)
  • writeTag(target, "element", "")/mb_arrangeElement
    • writeTag(myMapObj.frameName, target+"_element", "")
    • be sure that target+"_element" exist (maybe you need a createElement) eg
var map_el = mb_boxMapObj.getDomElement();
if(!map_el.ownerDocument.getElementById(mb_boxMapObj.elementName+"_l_top")){
//create Box Elements
el_top = map_el.ownerDocument.createElement("div");
el_top.style.position = "absolute";
el_top.style.top = "0px";
el_top.style.left = "0px";
el_top.style.width = "0px";
el_top.style.height = "0px";
el_top.style.overflow = "hidden";
el_top.style.zIndex = "10";
el_top.style.visibility = "hidden";
el_top.style.cursor = "crosshair";
el_top.style.backgroundColor = "#ff0000";
el_top.id = mb_boxMapObj.elementName+"_l_top";
map_el.appendChild(el_top);
}

Application elements

TO DO

  1. mapframe1
  2. changeEPSG
  3. digitize
  4. FeatureInfoRedirect
  5. gazetteerMetadata
  6. gazetteerWFS
  7. imprint
  8. legend
  9. loadData
  10. meetingPoint
  11. printPDF
  12. wfs_conf
  13. wfsresult
  14. zoomCoords

Compartible Modules

List of modules that are compartible with Mapbender without iframes (version from noframes branch)

  • mod_box1.js
  • mod_pan.php
  • mod_selArea1.php
  • mod_center1.php
  • mod_freatureInfo.php
  • mod_coords_div.php
  • mod_measure.php
  • mod_treefolderPlain.php

Modules that are compartible without modification

  • mod_zoomIn1.php
  • mod_zoomOut1.php
  • mod_zoomFull.php
  • mod_repaint.php
  • mod_navFrame.php
  • mod_rubber.js
  • mod_closePolygon.js
  • mod_getArea.php
  • mod_dragMapSize.php
  • mod_back.php
  • mos_forward.php

new list

grep -lir window.frames ../php/*
./mod_changeEPSG_dynamic.php
./mod_map1.php
./mod_mapOV.php
./mod_meetingPoint.php  ok


grep -lir window.frames ../javascripts/*
../javascripts/geometry.js
../javascripts/jsTree.js
../javascripts/map.js
../javascripts/map_obj.js
../javascripts/mod_addWMSgeneralFunctions.js
../javascripts/mod_digitize_tab.php
../javascripts/mod_export_image.php offen
../javascripts/mod_featureInfo.php
../javascripts/mod_featureInfoRedirect.php
../javascripts/mod_featureInfoTunnel.php
../javascripts/mod_gazetteerSQL_client.php
../javascripts/mod_initWmc.php
../javascripts/mod_key.php
../javascripts/mod_perimeter.php offen
../javascripts/mod_permanentHighlight.js offen
../javascripts/mod_poi.php
../javascripts/mod_print1.php ### alter html druck , wird nicht mehr benötigt
../javascripts/mod_sandclock2.php ### kann die Datei gelöscht werden?
../javascripts/mod_selArea.php 
../javascripts/mod_selectMapsize.php
../javascripts/mod_tooltip.php
../javascripts/mod_treeConf.js
../javascripts/mod_usemap.php ###
../javascripts/mod_wfs_gazetteer_client.php
../javascripts/mod_wfs_SpatialRequest.php
../javascripts/wfs.php

Demo

Image:noFrameGUI.png

Views
Personal tools