Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function VilloRegisterAssistant() {
- /* this is the creator function for your scene assistant object. It will be passed all the
- additional parameters (after the scene name) that were passed to pushScene. The reference
- to the scene controller (this.controller) has not be established yet, so any initialization
- that needs the scene controller should be done in the setup function below. */
- }
- VilloRegisterAssistant.prototype.setup = function() {
- /* this function is for setup tasks that have to happen when the scene is first created */
- /* use Mojo.View.render to render view templates and add them to the scene, if needed */
- /* setup widgets here */
- this.controller.setupWidget("theUsername",
- this.attributes = {
- hintText: $L(""),
- multiline: false,
- enterSubmits: false,
- autoFocus: true
- },
- this.theusername = {
- value: "",
- disabled: false
- }
- );
- this.controller.setupWidget("thePassword",
- this.attributes = {
- hintText: $L(""),
- multiline: false,
- enterSubmits: false,
- autoFocus: false
- },
- this.thepassword = {
- value: "",
- disabled: false
- }
- );
- this.controller.setupWidget("confirmThePassword",
- this.attributes = {
- hintText: $L(""),
- multiline: false,
- enterSubmits: false,
- autoFocus: false
- },
- this.thepasswordconfirm = {
- value: "",
- disabled: false
- }
- );
- this.controller.setupWidget("theEmail",
- this.attributes = {
- hintText: $L(""),
- multiline: false,
- enterSubmits: false,
- autoFocus: false
- },
- this.theemail = {
- value: "",
- disabled: false
- }
- );
- this.controller.setupWidget("register",
- this.attributes = {
- },
- this.model = {
- label : "Register",
- disabled: false
- }
- );
- /* add event handlers to listen to events from widgets */
- Mojo.Event.listen(this.controller.get("register"),Mojo.Event.tap, this.villoRegister.bindAsEventListener(this));
- };
- VilloRegisterAssistant.prototype.activate = function(event) {
- /* put in event handlers here that should only be in effect when this scene is active. For
- example, key handlers that are observing the document */
- };
- VilloRegisterAssistant.prototype.deactivate = function(event) {
- /* remove any event handlers you added in activate and do any other cleanup that should happen before
- this scene is popped or another scene is pushed on top */
- };
- VilloRegisterAssistant.prototype.cleanup = function(event) {
- /* this function should do any cleanup needed before the scene is destroyed as
- a result of being popped off the scene stack */
- };
- VilloRegisterAssistant.prototype.villoRegister = function() {
- villo.user.register({
- username: this.theusername.value,
- password: this.thepassword.value,
- password_confirm: this.thepasswordconfirm.value,
- email: this.theemail.value,
- }, this.userLogin.bind(this));};
- VilloRegisterAssistant.prototype.userLogin = function(sof){
- if(sof === 0){
- this.controller.stageController.swapScene("villo");
- }else{
- Mojo.Controller.errorDialog("Error Registering!");
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement