1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
...
// check data layers if they are visible
var checked= layer.getVisibility();
var inputElem= document.createElement("input");
inputElem.id= "input_" + layer.id;
inputElem.name= layer.name;
inputElem.type= "checkbox";
inputElem.value= layer.name;
inputElem.checked= checked;
inputElem.defaultChecked= checked;
inputElem.className= 'gpLayerVisibilityClass';
inputElem.style.autocomplete= "off";
if (!layer.inRange) {
inputElem.disabled= true;
}
...
// create span
var labelSpan= document.createElement("span");
labelSpan.id= 'label_' + layer.id;
var layerLab= OpenLayers.i18n(layer.name);
// convert HTML entities to get the right length :
var entityBuffer= document.createElement("textarea");
entityBuffer.innerHTML= layerLab.replace(/</g,"<").replace(/>/g,">");
layerLab= entityBuffer.value;
entityBuffer= null;
if (layerLab.length >= Geoportal.Control.LayerSwitcher.LAYER_LABEL_MAXLENGTH) {
// FIXME : HTML tags within string
layerLab= layerLab.substring(0,Geoportal.Control.LayerSwitcher.LAYER_LABEL_REPLACEMENT_INDEX)+
Geoportal.Control.LayerSwitcher.LAYER_LABEL_SUFFIX_REPLACEMENT;
}
labelSpan.innerHTML= layerLab;
labelSpan.className= "gpLayerSpanClass";
labelSpan.title= OpenLayers.i18n(layer.name);
if (!layer.inRange) {
labelSpan.className+= "NotInRange";
}
... |
Partager