Skip to content
Snippets Groups Projects
Commit 9767623b authored by Andreas Gohr's avatar Andreas Gohr
Browse files

fixed confirmation dialog on media delete

darcs-hash:20090116214118-7ad00-47a90e682e8ffab313fee7e775d82a3e892dc5bc.gz
parent 77d19185
No related branches found
No related tags found
No related merge requests found
...@@ -59,27 +59,32 @@ media = { ...@@ -59,27 +59,32 @@ media = {
addEvent(file,'change',media.suggest); addEvent(file,'change',media.suggest);
}, },
/** /**
* Attache deletion confirmation dialog to the delete buttons. * Attach deletion confirmation dialog to the delete buttons.
* *
* Michael Klier <chi@chimeric.de> * Michael Klier <chi@chimeric.de>
*/ */
confirmattach: function(obj){ confirmattach: function(obj){
if(!obj) return; if(!obj) return;
items = getElementsByClass('btn_media_delete',obj,'a'); items = getElementsByClass('btn_media_delete',obj,'a');
for(var i=0; i<items.length; i++){ for(var i=0; i<items.length; i++){
elem = items[i]; var elem = items[i];
addEvent(elem,'click',function(event){ addEvent(elem,'click',function(e){
if(!confirm(reallyDel + "\n" + elem.title)) { if(e.target.tagName == 'IMG'){
event.preventDefault(); var name = e.target.parentNode.title;
return false; }else{
} else { var name = e.target.title;
return true; }
} if(!confirm(reallyDel + "\n" + name)) {
}); e.preventDefault();
} return false;
}, } else {
return true;
}
});
}
},
/** /**
* Creates checkboxes for additional options * Creates checkboxes for additional options
...@@ -230,7 +235,7 @@ media = { ...@@ -230,7 +235,7 @@ media = {
ajax.elementObj = content; ajax.elementObj = content;
ajax.afterCompletion = function(){ ajax.afterCompletion = function(){
media.selectorattach(content); media.selectorattach(content);
media.confirmattach(content); media.confirmattach(content);
media.updatehide(); media.updatehide();
media.initFlashUpload(); media.initFlashUpload();
}; };
...@@ -314,7 +319,7 @@ media = { ...@@ -314,7 +319,7 @@ media = {
addInitEvent(function(){ addInitEvent(function(){
media.treeattach($('media__tree')); media.treeattach($('media__tree'));
media.selectorattach($('media__content')); media.selectorattach($('media__content'));
media.confirmattach($('media__content')); media.confirmattach($('media__content'));
media.attachoptions($('media__opts')); media.attachoptions($('media__opts'));
media.initFlashUpload(); media.initFlashUpload();
}); });
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment