All pastes #792623 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-11-21 16:09 UTC
rendered paste body
OC.ConfirmProjectDelete = function(extEl) {
 	
 	  //get refs
 	  var button = extEl;
 	  var container = extEl.dom.parentNode;
 	  var form = button.up('form');
 	  var warning = Ext.query('#oc-project-delete-warning', container)[0].textContent;
 	  var confirm = true;
 	
 	  //check refs
 	  if (!button || !form || !container || !warning) {
 	    alert('ConfirmProjectDelete: could not get element refs');
 	    return;
 	  } 
 	  
 	  function _callback(response) {
        if (response == "yes") {
          confirm = false; /* stops the warning from being triggered on the simulated click */
          button.dom.click();
        }   
 	  } 
 	  
 	  function _catch_click(e, el) {
 	      if (confirm) {
 	        e.preventDefault();
 	        Ext.MessageBox.confirm('Confirm', warning, _callback);
 	      }
 	  }
 	  button.on('click', _catch_click);
}