Removed:
branches/soashable_web_2_0_mvc/soashable-web/src/main/javascript/dojo.js
Modified:
branches/soashable_web_2_0_mvc/soashable-web/src/main/javascript/
(props changed)
branches/soashable_web_2_0_mvc/soashable-web/src/main/javascript/controller/AccountController.js
branches/soashable_web_2_0_mvc/soashable-web/src/main/webapp/application.html
Log:
moved dojo and hooked up login
Modified: branches/soashable_web_2_0_mvc/soashable-web/src/main/javascript/controller/AccountController.js
==============================================================================
---
branches/soashable_web_2_0_mvc/soashable-web/src/main/javascript/controller/AccountController.js (original)
+++
branches/soashable_web_2_0_mvc/soashable-web/src/main/javascript/controller/AccountController.js
Tue Aug 5 02:44:27 2008
@@ -51,18 +51,66 @@
},
loginClicked: function() {
- alert("Going to login: "+this.accountModel.node+", password="+this.accountModel.password);
+ this.stanzaProvider = new Xmpp4Js.Packet.StanzaProvider();
+ this.stanzaProvider.registerDefaultProviders();
- var self = this;
- setTimeout(function() {
-
- self.loginSuccess();
- }, 250);
+ this.extensionProvider = new Xmpp4Js.Ext.PacketExtensionProvider();
+ this.extensionProvider.register(
Xmpp4Js.Ext.MessageEvent.XMLNS, Xmpp4Js.Ext.MessageEvent );
+ this.extensionProvider.register( Xmpp4Js.Ext.ChatStates.XMLNS,
Xmpp4Js.Ext.ChatStates );
+
+ this.con = new Xmpp4Js.Connection({
+ transport: {
+ clazz: Xmpp4Js.Transport.Script,
+ endpoint: "http://bosh*.soashable.com:7070/http-bind/",
+ useKeys: true
+ },
+ stanzaProvider: this.stanzaProvider,
+ listeners: {
+ scope : this,
+ error : this.connectionError,
+ close : this.connectionClosed
+ }
+ });
+
+ this.con.on("connect", this.connectedForLogin, this, {single: true});
+
+ this.con.connect( this.accountModel.domain );
+
+ alert("connecting");
+
+ },
+
+ connectedForLogin: function() {
+ var loginFlow = new Xmpp4Js.Workflow.Login({
+ con: this.con,
+ listeners: {
+ scope: this,
+ success: this.loginSuccess,
+ failure: this.loginError
+ }
+ });
+
+ var type = this.accountModel.node ? "plaintext" : "anon";
+ loginFlow.start( type, this.accountModel.node,
this.accountModel.password );
+
+ },
+
+ connectionError: function() {
+ this.connectionClosed();
+ },
+
+ connectionClosed: function() {
+ this.loginView.render();
+ this.fireEvent("logged_out");
},
loginSuccess: function() {
this.loginView.destroy();
this.fireEvent("login_success");
+ },
+
+ loginError: function() {
+ this.fireEvent("login_error");
},
loggedOut: function() {
Modified: branches/soashable_web_2_0_mvc/soashable-web/src/main/webapp/application.html
==============================================================================
---
branches/soashable_web_2_0_mvc/soashable-web/src/main/webapp/application.html (original)
+++
branches/soashable_web_2_0_mvc/soashable-web/src/main/webapp/application.html
Tue Aug 5 02:44:27 2008
@@ -10,11 +10,12 @@
<!--
<script type="text/javascript"
src="http://o.aolcdn.com/dojo/1.1.1/dojo/dojo.xd.js"
djConfig="parseOnLoad: false"></script>
-->
- <script type="text/javascript" src="scripts/dojo.js"
djConfig="parseOnLoad: false"></script>
+ <script type="text/javascript" src="scripts/dojo/dojo.js"
djConfig="parseOnLoad: false, debugAtAllCosts: true"></script>
<script type="text/javascript">
// for some reason it knows to look under scripts.
relative to dojo?
- dojo.registerModulePath("soashable","../scripts");
+ dojo.registerModulePath("soashable","../../scripts");
</script>
+ <script type="text/javascript" src="scripts/lib/crypto/crypto.js"></script>
<script type="text/javascript"
src="scripts/lib/xml4script/dom-all.js"> </script>
<script type="text/javascript"
src="scripts/lib/log4js/log4js.js"> </script>
<script type="text/javascript"
src="scripts/lib/xmpp4js/xmpp4js.js"> </script>
@@ -25,11 +26,11 @@
<script type="text/javascript">
dojo.require("soashable.Application");
-
- window.addEventListener( "load", function(){
+
+ dojo.addOnLoad(function(){
application = new soashable.Application();
application.start();
- }, false);
+ });
</script>
</head>
<body>