Created
June 10, 2010 04:52
-
-
Save anonymous/432567 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Pre-defined method. Gets called when module finishes loading to page | |
* @param {String} viewName The type of view | |
* @method onviewload | |
* @return {Void} | |
*/ | |
onviewload: function(viewName){ | |
this.viewNode = this.api.getViewNode(viewName); | |
this.viewNode.all(this.CSS_NAMES.BIZ_SUBMIT).on('click', this.handleBIZClick, this); | |
this.viewNode.all(this.CSS_NAMES.BIZ_PHOTOUP_START).on('click', this.handleBIZPhotoUpClick, this); | |
this.viewNode.all(this.CSS_NAMES.BIZ_PHOTOUP_STOP).on('click', this.handleBIZPhotoUpStopClick, this); | |
this.viewNode.all(this.CSS_NAMES.BIZ_PHOTOUP_SUBMIT).on('click', this.handleBIZPhotoUpSubmitClick, this); | |
if(this.Y.one('#mod_detail-card_editcontainer')){ | |
this.Y.later(5000, this, this.autosave, this, true); //when, o, fn, data, periodic | |
}; | |
return true; | |
}, | |
/** | |
* Autosave | |
* @method autosave | |
* @return {boolean} | |
*/ | |
autosave : function(_parent){ | |
var frm=document.forms.formDetailCardSubmit; | |
var changed=false; | |
if(frm.auto_title.value!=frm.biztitle.value){ | |
changed=true; | |
} | |
if(changed===false&&frm.auto_phone.value!=frm.bizphone.value){ | |
changed=true; | |
} | |
if(changed===false&&frm.auto_line1.value!=frm.bizaddr_line1.value){ | |
changed=true; | |
} | |
if(changed===false&&frm.auto_city.value!=frm.bizaddr_city.value){ | |
changed=true; | |
} | |
if(changed===false&&frm.auto_county.value!=frm.bizaddr_county.value){ | |
changed=true; | |
} | |
if(changed===false&&frm.auto_state.value!=frm.bizaddr_state.value){ | |
changed=true; | |
} | |
if(changed===false&&frm.auto_zip.value!=frm.bizzip.value){ | |
changed=true; | |
} | |
if(changed===false&&frm.auto_email.value!=frm.bizemail.value){ | |
changed=true; | |
} | |
//if(changed===false&&frm.auto_photos.value!=frm.bizphone.value){ | |
// changed=true; | |
//} | |
if(changed){ | |
_parent.loadContent('yes'); | |
} | |
} | |
/** | |
* Changes the currently opened tab. This involves making a request to | |
* the server. | |
* @param {String} autosave yes or no | |
* @method loadContent | |
* @return {Void} | |
*/ | |
loadContent: function(autosaveYN) { | |
var url = "/upload/sherpa/glfe_CardInsert.php"; | |
if(autosaveYN=="yes"){ | |
url+="?autosave=yes" | |
} | |
var cfg = { | |
method: 'POST', | |
form: { | |
id: 'formDetailCardSubmit', | |
useDisabled : true | |
} | |
}; | |
// Define a function to handle the start of a transaction | |
function start(id, args) {} | |
this.Y.on('io:start', start, this.Y, this); | |
// Subscribe to event "io:complete", and pass an array | |
// as an argument to the event handler "complete". | |
this.Y.on('io:complete', this.handleContentChange, this.Y, {_parent:this,autosave:autosaveYN}); | |
var request = this.Y.io(url, cfg); | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment