Codice PHP:
onSuccess: function(txt, xml){
doc = xml.documentElement;
imgs = doc.getElementsByTagName("img");
imgs_length = imgs.length;
for(i=0; i<imgs_length; i++){
id = imgs[i].attributes.getNamedItem("id").value;
src= imgs[i].attributes.getNamedItem("src").value;
nome_img = imgs[i].attributes.getNamedItem("name").value;
w = imgs[i].attributes.getNamedItem("w").value;
h = imgs[i].attributes.getNamedItem("h").value;
wt = RT * w;
ht = RT * h;
var this_ = this;//unico modo trovato per trasmettere "this" all'interno di "new Element" in "events"
//con "el" creo l'elemento "img" uno per ogni immagine presente nella gallery, che rappresenta la thumbnail
el = new Element("img",{
"id":id,
"styles":{ "width":wt+"px", "height":ht+"px", "background-color":"black",
"float":"left", "margin":"20px", "border":"2px solid black"
},
"src":src+"/Thumbs/"+nome_img,
"title": nome_img,
//con un doppio click eliminiamo l'immagine sia dal "content_gallery" che dal file xml e dalla directory
"events":{"dblclick":function(){
if($("admin") ){//se sono dentro come "admin"
this_.conf();
if( this_.conf() ){//conf() per avere un box "confirm" più bello esteticamente, ma non riesco a restituire FALSE o TRUE
.
.
.
.
}.bind(this)//END onSuccess
conf: function(){
if(!$("box_conferma")){
box_conferma = new Element("div",{
"id":"box_conferma",
"styles":{"background-color":"black", "width":"200px", "height":"150px", "position":"absolute",
"z-index":"10", "top":(($("content_gallery").getStyle("height").toInt()/2)-75)+"px",
"left": (($("content_gallery").getStyle("width").toInt()/2)-100)+"px", "opacity":"0.0"
},
"morph":{duration:"500"}
}).inject("content_gallery").morph({opacity:0.8});
conferma_si = new Element("div",{
"id":"conferma_si",
"styles":{"background-color":"white", "width":"40px", "height":"25px", "float":"left", "text-align":"center", "font-weight":"bold",
"cursor":"pointer", "margin":(75-12.5 )+"px 0 0 50px", "line-height":"24px", "font-size":"14px",
},
"text":"SI",
"events":{"click":function(conferma){ $("box_conferma").morph({opacity:0}); $("gen").set("html", true); } }
}).inject("box_conferma");
conferma_no = new Element("div",{
"id":"conferma_no",
"styles":{"background-color":"white", "width":"40px", "height":"25px", "float":"left", "text-align":"center", "font-weight":"bold",
"cursor":"pointer", "margin": (75-12.5 )+"px 0 0 20px", "line-height":"24px", "font-size":"14px"
},
"text":"NO",
"events":{
"click":function(conferma){ $("box_conferma").morph({opacity:0}); $("gen").set("html", false); } }//END EVENTS
}).inject("box_conferma");
}//IF "box_conferma"
else{ $("box_conferma").morph({opacity:0.8}); }
}//END conf