Hello,

I asked this similarly before, but I can't seem to find a solution a drives me 
mad.....

The code of my current solution is added below.
 
when my application gets loaded for the first time a login form gets displayed
(from line 38 to line 79). If I insert login-data and click the button, I send 
the 
loginname and the password via qx.io.remote.Request to the database. If the 
input 
data is correct, the request will return a valid customerid ( integer > 0 ) and 
which
gets alerted correctly in line 20. Then I store it in line 21 for further 
processing
in the program, but the values alerted in the lines 33,34,84,85 remain 0.
If I refresh the page via browser-button, the CustID alerted in 33 or 84 has 
the right value while
this.__IsLoggedIn remains 0.

How can I read a value from database for processing it in the same program run?
Somebody lately came up with asyncronous calls ... but like how ?

Can somebody give a working program snippet for this task ? Howtos ?

...would be grateful for your help!

1  qx.Class.define("newversion.Application",
2  {
3     extend : qx.application.Standalone,
4    members :
5    {
6      __IsLoggedIn : 0,
7  
8      checkInput : function()
9      {
10          param =  "http://www.ourdomain.com/php/auth.php?pass="; 
+this.__tpassword.getValue()+"&login="+this.__tuser.getValue();
11          var auth_proc = new qx.io.remote.Request(param);
12          auth_proc.addListener("completed", 
13              function(e){
14                  try {
15                      var content = e.getContent();
16                      if (content.length > 0){
17                          this.__IsLoggedIn= qx.util.Json.parse(content);
18                      }
19                  }catch (e){}
20                  alert("this.__IsLoggedIn  "+this.__IsLoggedIn);
21                  qx.bom.Cookie.set("logonstate" , this.__IsLoggedIn );
22              }
23          );
24          auth_proc.send();
25      },
26  
27      main: function()
28      {
29        this.base(arguments);
30        qx.locale.Manager.getInstance().setLocale("de_DE");
31        var CustID = qx.bom.Cookie.get(newversion.Application.COOKIE_KEY);
32  
33        alert("CustID "+CustID); 
34        alert("this.__IsLoggedIn "+this.__IsLoggedIn);
35  
36        if (CustID == null){
37          
38              /////////////////begin LOGIN-FORM////////////////////           
39              // Create a layout for the main container
40              var layout = new qx.ui.layout.Grid(4, 2);
41  
42              // Create the main container and set the layout
43              var container = new qx.ui.container.Composite(layout);
44         
45              // Create some labels for the form elements
46  
47              var luser = new qx.ui.basic.Label("User/Benutzer");
48              var lpassword = new qx.ui.basic.Label("Password/Passwort");
49         
50              // Add the labels to the container
51  
52              container.add(luser, {row: 1, column : 0});
53              container.add(lpassword, {row: 2, column : 0});
54  
55              // Create the text fields 
56              this.__tuser = new qx.ui.form.TextField();
57              this.__tpassword = new qx.ui.form.PasswordField();
58         
59              container.add(this.__tuser, {row: 1, column : 1});
60              container.add(this.__tpassword , {row: 2, column : 1});
61  
62              // And finally create a button to submit the form
63            
64  
65              var btSenden = new qx.ui.form.Button("Ok");
66  
67              btSenden.addListener("execute",  function(rep) {
68                   this.checkInput();
69                   this.main();
70               
71              }, this);
72           
73              this.checkInput();            
74  
75              container.add(btSenden, {row: 4, column : 1});
76              // Add the container to the application
77              this.getRoot().add(container, {left: "50%", top: "30%"});
78              /////////////////end LOGIN-FORM//////////////////////  
79  
80        }else{
81  
82        
qx.Class.patch(qx.ui.treevirtual.TreeVirtual,qx.ui.treevirtual.SimpleTreeDataModel);
83        qx.Class.include(qx.ui.treevirtual.TreeVirtual, 
qx.ui.treevirtual.MNode);
84        alert("CustID "+CustID); 
85        alert("this.__IsLoggedIn "+this.__IsLoggedIn);


Cheers 

Poc
-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to