commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnue] r9048 - in trunk/gnue-forms/src/uidrivers/html: . widgets


From: jan
Subject: [gnue] r9048 - in trunk/gnue-forms/src/uidrivers/html: . widgets
Date: Sun, 19 Nov 2006 18:24:20 -0600 (CST)

Author: jan
Date: 2006-11-19 18:24:07 -0600 (Sun, 19 Nov 2006)
New Revision: 9048

Added:
   trunk/gnue-forms/src/uidrivers/html/Generator.py
   trunk/gnue-forms/src/uidrivers/html/widgets/form.py
Removed:
   trunk/gnue-forms/src/uidrivers/html/widgets/form/
Modified:
   trunk/gnue-forms/src/uidrivers/html/GFServer.py
   trunk/gnue-forms/src/uidrivers/html/GFhtmlApp.py
   trunk/gnue-forms/src/uidrivers/html/MenuBar.py
   trunk/gnue-forms/src/uidrivers/html/ToolBar.py
   trunk/gnue-forms/src/uidrivers/html/UILoginHandler.py
   trunk/gnue-forms/src/uidrivers/html/UISplashScreen.py
   trunk/gnue-forms/src/uidrivers/html/UIdriver.py
   trunk/gnue-forms/src/uidrivers/html/common.py
   trunk/gnue-forms/src/uidrivers/html/widgets/_base.py
   trunk/gnue-forms/src/uidrivers/html/widgets/box.py
   trunk/gnue-forms/src/uidrivers/html/widgets/button.py
   trunk/gnue-forms/src/uidrivers/html/widgets/entry.py
   trunk/gnue-forms/src/uidrivers/html/widgets/image.py
   trunk/gnue-forms/src/uidrivers/html/widgets/label.py
   trunk/gnue-forms/src/uidrivers/html/widgets/page.py
Log:
first version of new HTML ui driver:
------------------------------------

- base functionality implemented
- Menu/Toolbar actions implemented
- Entry widget working through "onchange" mode
- Button/Label/Box full support
- multi-user, but just one-form support
- no getInput support

dojotoolkit.org and simplejson are necessary for startup


Modified: trunk/gnue-forms/src/uidrivers/html/GFServer.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/html/GFServer.py     2006-11-17 16:26:24 UTC 
(rev 9047)
+++ trunk/gnue-forms/src/uidrivers/html/GFServer.py     2006-11-20 00:24:07 UTC 
(rev 9048)
@@ -26,11 +26,32 @@
 # NOTES:
 #
 
+import os.path, sys
+from urllib import unquote
 from gnue.common.utils import http
+from gnue.common.utils.uuid import UUID
 from BaseHTTPServer import HTTPServer
+from SocketServer import ThreadingMixIn
+from gnue.common.apps.GClientApp import StartupError
 
+from gnue.common import events
+
 from UISplashScreen import SplashScreen
+from gnue.forms.GFInstance import GFInstance
+from gnue.common.apps import GConfig, errors
 
+try:
+    from simplejson import JSONEncoder # JSONDecoder
+except:
+    print "You need to install simplejson to use the html uidriver."
+    raise ImportError
+
+_iconpath = GConfig.getInstalledBase('form_images', 'common_images')
+_includepath = gConfigForms("htmlui_include_path")
+
+class ThreadingHTTPServer (ThreadingMixIn, HTTPServer):
+    pass
+
 # =============================================================================
 # GNUe Forms HTML UI driver Request handler
 # =============================================================================
@@ -38,97 +59,271 @@
 class GFServer:
 
 
-  def __init__(self):
-    self.splash = SplashScreen()    
+    def __init__(self, gfclient):
+        self.splash = SplashScreen()
+        self.instances = {}
+        self.gfclient = gfclient
+        self.jsonenc = JSONEncoder()
 
-  def serve(self):
-    print '\nGNUe Forms HTML UI driver is loaded.'
-    print '\n-- please point your browser to http://127.0.0.1:8000 --'
-    server = HTTPServer(('',8000), GFRequestHandler)
-    server.GFServer = self
-    server.serve_forever()
+    def serve(self):
+        print '\nGNUe Forms HTML UI driver is loaded.'
+        print '\n-- please point your browser to http://127.0.0.1:8000 --'
+        server = ThreadingHTTPServer(('',8000), GFRequestHandler)
+        server.GFServer = self
+        server.serve_forever()
 
-# =============================================================================
-# GNUe Forms HTML UI driver Request handler
-# =============================================================================
+    def createFormsInstance(self, uid, userParameters):
 
-class GFRequestHandler(http.HTTPRequestHandler):
+        # Create the instance that will control the loaded form(s)
+        assert gDebug (4, "Creating GFInstance object")
 
-  """
-  Handle  requests sent via HTTP connections.
+        instance = GFInstance (self, self.gfclient.connections, 
self.gfclient._ui,
+                               self.gfclient.disableSplash, userParameters)
 
-  @cvar protocol_version: Set to 'HTTP/1.1' so we do have persistent
-    connections.
-  """
+        self.instances[uid]=instance
 
-  # Make sure to support persistent connections
-  protocol_version = "HTTP/1.1"
+        # Assign the proper login handler based upon the user interface choice
+        #FIXME: IMHO, it would be much better if the login handler would be 
just a
+        # function, which could be a method of the GFUserInterfae object - much
+        # like _showException.  -- Reinhard
+        loginHandler = self.gfclient._ui.UILoginHandler ()
+        loginHandler.uiDriver = instance._uiinstance
+        self.gfclient.getConnectionManager ().setLoginHandler (loginHandler)
 
+        # assign form file from 1st free argument
+        if len (self.gfclient.ARGUMENTS):
+            formfile = self.gfclient.ARGUMENTS [0]
 
-  # ---------------------------------------------------------------------------
-  # log all requests at debug level 9
-  # ---------------------------------------------------------------------------
+        else:
+            basename = os.path.basename (sys.argv [0])
 
-  def log_request (self, code = '-', size = '-'):
-    """
-    Log all requests at debug level 9.
-    """
+            # If no form specified, then see if this is a symlinked form 
definition
+            if not basename.lower ().split ('.') [0] in ('gnue-forms', 
'gfclient'):
+                formfile = os.path.join (
+                  GConfig.getInstalledBase ('forms_appbase', 'common_appbase',
+                                            'install_prefix'),
+                  gConfigForms ('FormDir'), basename + ".gfd")
+            else:
+                raise StartupError, u_("No Forms Definition File Specified.")
 
-    assert gDebug (9, '"%s" %s %s' % (self.requestline, code, size))
-     
+        assert gDebug (4, "Parsing form definition")
+        instance.addFormFromFile (formfile)
 
-  # ---------------------------------------------------------------------------
-  # Process a GET request
-  # ---------------------------------------------------------------------------
+        # disable standart html drivers mainloop
+        self.gfclient._ui.GFhtmlApp.GFhtmlApp._mainLoop = 1
 
-  def do_GET (self):
+        assert gDebug (4, "Activating form")
+        instance.activate ()
+        print "GNUe Forms Session %s started" % uid
+
+        assert gLeave (4)
+
+    def displayFormsInstance(self,uuid):
+        # TODO: thread safety: allow only one access to a
+        #       specific instance at one time
+        if self.instances.has_key(uuid):
+            response=self.instances[uuid]._uiinstance._UIform.get_html()
+        else:
+            response="""<HTML><HEAD></HEAD><BODY>
+            <H1>Wrong Session or Session timed out!</H1><BR>
+            <A HREF="/">Restart GNUe Forms</A></BODY></HTML>
+            """
+
+        return response
+
+    def executeCmd(self, uuid, cmd, args):
+
+        # TODO: thread safety: allow only one access to a
+        #       specific instance at one time
+        if cmd == "" or not self.instances.has_key(uuid):            
+            updates = [["status","","This session is invalid. Please 
restart!"]]
+            
+        elif cmd == "event":
+            # id = int(args["id"])
+            event = args["event"]
+            e = events.Event(event, \
+                 _form=self.instances[uuid]._formsDictionary['__main__'])
+            self.instances[uuid].dispatchEvent(e)
+            updates = self.instances[uuid]._uiinstance._UIform.get_updates()
+            # updates.append(["alert","","Menuitem clicked"])
+        elif cmd == "onChange":
+            id = int(args["id"])
+            text = args["text"]
+
+            gfObject = self.instances[uuid]._uiinstance._WidgetToGFObj [id]
+            e = events.Event('requestREPLACEVALUE', text = text, \
+                 _form=self.instances[uuid]._formsDictionary['__main__'])
+            self.instances[uuid].dispatchEvent(e)
+            updates = self.instances[uuid]._uiinstance._UIform.get_updates()
+
+        elif cmd == "onFocus":
+            id = int(args["id"])
+            UIObject = self.instances[uuid]._uiinstance._WidgetToUIObj [id]
+            widget = self.instances[uuid]._uiinstance._IdToWidget [id]
+            UIObject._focusInHandler (id)
+
+            updates = self.instances[uuid]._uiinstance._UIform.get_updates()
+
+        elif cmd == "btn":
+            id = int(args["id"])
+
+            gfObject = self.instances[uuid]._uiinstance._WidgetToGFObj [id]
+            gfObject._event_fire ()
+                        
+            updates = self.instances[uuid]._uiinstance._UIform.get_updates()
+            
+        else:
+            updates = []
+
+        return self.jsonenc.encode(updates)
+
+    def removeFormsInstance(self, uuid):
+        assert gDebug (4, "Closing all connections")
+        # FIXME: close all connections for the instance self.instances[uid]
+        # self.gfclient.getConnectionManager ().closeAll ()
+        del self.instances[uuid]
+
+
+# =============================================================================
+# GNUe Forms HTML UI driver Request handler
+# =============================================================================
+
+class GFRequestHandler(http.HTTPRequestHandler):
+
     """
-    ....
+    Handle  requests sent via HTTP connections.
+
+    @cvar protocol_version: Set to 'HTTP/1.1' so we do have persistent
+      connections.
     """
-    if self.path=="/":   
-      response = self.server.GFServer.splash.getHTML()
-      self.push_content(response)
-    elif self.path=="/splashscreen.png":
-      response = self.server.GFServer.splash.getPicture()
-      self.push_content(response,"image/png")
-    else:
-      self.send_response(404)
-      self.connection.shutdown (1)   
-      print self.path
-      
-    # If a shutdown of the connection is requested do so, although we assume to
-    # have a persistent connection.
-    if self.close_connection:
-      self.connection.shutdown (1)    
-      
-  def push_content(self, response, content_type="text/html"):
-    self.send_response (200, flush = False)
-    self.send_header ("Content-type", content_type, flush = False)
-    self.send_header ("Content-length", str (len (response)), flush = False)
-    self.end_headers (flush = False)
 
-    # Add the response to the send-queue and finally flush everything to the
-    # socket.
-    self.write (response, flush = True)
+    # Make sure to support persistent connections
+    protocol_version = "HTTP/1.1"
 
+    # 
---------------------------------------------------------------------------
+    # Process a GET request
+    # 
---------------------------------------------------------------------------
 
+    def do_GET (self):
+        """
+        ....
+        """
+        try:
+            if self.path=="/":
+                uuid = UUID.generate_random ()
+                forward_url = "session_%s.htm" % uuid
+                response = self.server.GFServer.splash.get_html(forward_url)
+                self.push_content(response)
+                self.server.GFServer.createFormsInstance(uuid, {})
+    
+            elif self.path=="/splashscreen.png":
+                response = self.server.GFServer.splash.getPicture()
+                self.push_content(response,"image/png")
+    
+            elif self.path[0:9]=="/session_" and self.path[41:]==".htm":
+                uuid=self.path[9:41]
+                response=self.server.GFServer.displayFormsInstance(uuid)
+                self.push_content(response)
+    
+            elif self.path[0:9]=="/jsonrpc_" and self.path[41:42]=="?":
+                uuid=self.path[9:41]
+                # FIXME: Use standart argument parser
+                arg_list = self.path[42:].split('&')
+                args = {}
+                for i in arg_list:
+                    z=i.split('=')
+                    args[z[0]]=unquote(z[1])
+    
+                try:
+                    cmd=args['cmd']
+                except:
+                    cmd=""
+    
+                response = self.server.GFServer.executeCmd(uuid,cmd,args)
+                self.push_content(response,"text/text")
+                print "JSON: %s -> %s" % (self.path,response)
+    
+            # Include file handling for libraries
+            elif self.path[0:6]=="/incl/":
+                self.deliver_file(_includepath, self.path[6:])            
+                    
+            # file handling for icons
+            elif self.path[0:6]=="/icon/":
+                self.deliver_file(_iconpath, self.path[6:])
+    
+            else:
+                self.send_response(404)
+                self.connection.shutdown (1)
+                print self.path
 
-  def send_head(self):
-    self.send_response(200)
-    self.send_header("Content-Type", "text/html")
-    self.end_headers()
+        except:
+            (group, name, message, detail) = errors.getException()
+            message = """<HTML><HEAD></HEAD><BODY><H1>Exception occured!</H1>
+            Group: %s<BR>
+            Name: %s<BR>
+            Message: %s<BR>
+            Details: <BR><PRE>%s</PRE></BODY></HTML>
+            """ % (group, name, message, detail)
+            self.push_content(message)
+            print message
+          
+        # If a shutdown of the connection is requested do so, although we 
assume to
+        # have a persistent connection.
+        if self.close_connection:
+            self.connection.shutdown (1)
+            
+    def deliver_file(self, base, path):
+        
+        # FIXME: implement security measures:
+        #        1: normalize path
+        #        2: remove all ".."
+        #
+        realpath=os.path.join(base, path)
+        
+        if realpath[-3:]==".js":
+            mimetype = "text/javascript"
+        elif realpath[-4:]==".css":
+            mimetype = "text/css"
+        elif realpath[-4:]==".htm" or realpath[-5:]==".html":
+            mimetype = "text/html"
+        elif realpath[-4:]==".gif":
+            mimetype = "image/gif"
+        elif realpath[-4:]==".png":
+            mimetype = "image/png"
+        elif realpath[-4:]==".jpg" or realpath[-5:]==".jpeg":
+            mimetype = "image/jpeg"
+        else:
+            mimetype = "failed"
 
-    self.wfile.write('''<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 
Strict//EN" 
-"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
-<html xmlns="http://www.w3.org/1999/xhtml";>
-<body bgcolor="#EFEFEF" style="font-size: 18px; font-family: courier"
-<form method="POST" action="http://127.0.0.1:8000";>
-</form></body></html>''')
-   
-    #elif fs.has_key('requestEXIT'):
-    #  
_htmlApp.uidriver._form._instance.dispatchEvent(events.Event('requestEXIT',_form=_htmlApp.uidriver._form))
+        if mimetype != "failed" and os.path.exists(realpath):
+            response = ""
+            for line in open(realpath,"rb"):
+                response+=line
+            self.push_content(response,mimetype)
 
-    
-def start_server():
-    GFServer().serve()
-    
\ No newline at end of file
+        else:
+            self.send_response(404)
+            self.connection.shutdown (1)
+            print self.path
+            if self.path=="/incl/dojo.js":
+                print 
"****************************************************************"
+                print " You need dojo (www.dojotoolkit.org) to use the html 
uidriver."
+                print " Please install dojo 4.0 or above on your computer and 
add the "
+                print " the install path to gnue.conf: 'htmlui_include_path = 
<path>'"
+                print 
"****************************************************************"
+            
+    def push_content(self, response, content_type="text/html"):
+        self.send_response (200, flush = False)
+        self.send_header ("Content-type", content_type, flush = False)
+        self.send_header ("Content-length", str (len (response)), flush = 
False)
+        self.send_header ("Cache-Control","no-cache, must-revalidate", flush = 
False)
+        self.send_header ("Pragma","no-cache", flush = False)
+        self.end_headers (flush = False)
+
+        # Add the response to the send-queue and finally flush everything to 
the
+        # socket.
+        self.write (response, flush = True)
+
+
+def start_server(GFClient):
+    GFServer(GFClient).serve()

Modified: trunk/gnue-forms/src/uidrivers/html/GFhtmlApp.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/html/GFhtmlApp.py    2006-11-17 16:26:24 UTC 
(rev 9047)
+++ trunk/gnue-forms/src/uidrivers/html/GFhtmlApp.py    2006-11-20 00:24:07 UTC 
(rev 9048)
@@ -1,113 +1,82 @@
-#
-# This file is part of GNU Enterprise.
-#
-# GNU Enterprise is free software; you can redistribute it
-# and/or modify it under the terms of the GNU General Public
-# License as published by the Free Software Foundation; either
-# version 2, or (at your option) any later version.
-#
-# GNU Enterprise is distributed in the hope that it will be
-# useful, but WITHOUT ANY WARRANTY; without even the implied
-# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-# PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public
-# License along with program; see the file COPYING. If not,
-# write to the Free Software Foundation, Inc., 59 Temple Place
-# - Suite 330, Boston, MA 02111-1307, USA.
-#
-# Copyright 2000-2006 Free Software Foundation
-#
-# FILE:
-# uidrivers/html/GFhtmlApp.py
-#
-# DESCRIPTION:
-#
-# NOTES:
-#
-
-import sys, cgi
-from BaseHTTPServer import HTTPServer
-from SimpleHTTPServer import SimpleHTTPRequestHandler
-
-from gnue.common import events
-
-_htmlApp = None
-_dhtml = {}
+#
+# This file is part of GNU Enterprise.
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2, or (at your option) any later version.
+#
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Copyright 2000-2006 Free Software Foundation
+#
+# FILE:
+# uidrivers/html/GFhtmlApp.py
+#
+# DESCRIPTION:
+#
+# NOTES:
+#
 
-
-def gethtmlApp(uidriver):
-  global _htmlApp
-  if not _htmlApp:
-    _htmlApp = GFhtmlApp(uidriver)
-  return _htmlApp
-
-
-class GFhtmlApp:
-
-  _mainLoop= None
-  _MainWindowList = []
-
-  def __init__(self, uidriver):
-    self.uidriver = uidriver
-    global _dhtml
-    global _htmlApp
-    self._dhtml = _dhtml
-    self._htmlApp = _htmlApp
-
-  def MainLoop (self):
-    if self._mainLoop==None:
-      self._mainLoop= 1
-      print 'BaseHTTPServer started at http://127.0.0.1:8000'
-      server = HTTPServer(('',8000), GFRequestHandler)
-      server.serve_forever()
-
-
-class GFRequestHandler(SimpleHTTPRequestHandler):
-
-  def send_head(self):
-    self.send_response(200)
-    self.send_header("Content-Type", "text/html")
-    self.end_headers()
+import sys, cgi, webbrowser
+from BaseHTTPServer import HTTPServer
+from SimpleHTTPServer import SimpleHTTPRequestHandler
+from GFServer import GFRequestHandler
 
-    self.wfile.write(
-'''<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
-"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
-<html xmlns="http://www.w3.org/1999/xhtml";>
-<body bgcolor="#EFEFEF" style="font-size: 18px; font-family: courier"
-<form method="POST" action="http://127.0.0.1:8000";>
-%s</form></body></html>''' % ''.join([textEncode(_dhtml[key]) for key in 
_dhtml.keys()]))
+from gnue.common import events
 
-
-  def do_POST(self):
-    fs = cgi.FieldStorage(fp=self.rfile,
-                          
headers={'content-length':int(self.headers["Content-Length"]),
-                                   'content-disposition':'form-data'},
-                          environ={'REQUEST_METHOD':'POST'})
-
-    if fs.has_key('requestCOMMIT'):
-      
_htmlApp.uidriver._form._instance.dispatchEvent(events.Event('requestCOMMIT',_form=_htmlApp.uidriver._form))
-    elif fs.has_key('requestNEWRECORD'):
-      
_htmlApp.uidriver._form._instance.dispatchEvent(events.Event('requestNEWRECORD',_form=_htmlApp.uidriver._form))
-    elif fs.has_key('requestMARKFORDELETE'):
-      
_htmlApp.uidriver._form._instance.dispatchEvent(events.Event('requestMARKFORDELETE',_form=_htmlApp.uidriver._form))
-    elif fs.has_key('requestFIRSTRECORD'):
-      
_htmlApp.uidriver._form._instance.dispatchEvent(events.Event('requestFIRSTRECORD',_form=_htmlApp.uidriver._form))
-    elif fs.has_key('requestPREVRECORD'):
-      
_htmlApp.uidriver._form._instance.dispatchEvent(events.Event('requestPREVRECORD',_form=_htmlApp.uidriver._form))
-    elif fs.has_key('requestNEXTRECORD'):
-      
_htmlApp.uidriver._form._instance.dispatchEvent(events.Event('requestNEXTRECORD',_form=_htmlApp.uidriver._form))
-    elif fs.has_key('requestLASTRECORD'):
-      
_htmlApp.uidriver._form._instance.dispatchEvent(events.Event('requestLASTRECORD',_form=_htmlApp.uidriver._form))
-    elif fs.has_key('requestRECORDNUMBER'):
-      
_htmlApp.uidriver._form._instance.dispatchEvent(events.Event('requestRECORDNUMBER',_form=_htmlApp.uidriver._form))
-    elif fs.has_key('requestENTERQUERY'):
-      
_htmlApp.uidriver._form._instance.dispatchEvent(events.Event('requestENTERQUERY',_form=_htmlApp.uidriver._form))
-    elif fs.has_key('requestEXECQUERY'):
-      
_htmlApp.uidriver._form._instance.dispatchEvent(events.Event('requestEXECQUERY',_form=_htmlApp.uidriver._form))
-    elif fs.has_key('requestROLLBACK'):
-      
_htmlApp.uidriver._form._instance.dispatchEvent(events.Event('requestROLLBACK',_form=_htmlApp.uidriver._form))
-    elif fs.has_key('requestEXIT'):
-      
_htmlApp.uidriver._form._instance.dispatchEvent(events.Event('requestEXIT',_form=_htmlApp.uidriver._form))
-
-    self.send_head()
+_htmlApp = None
+_dhtml = {}
+
+
+def gethtmlApp(uidriver):
+    global _htmlApp
+    if not _htmlApp:
+        _htmlApp = GFhtmlApp(uidriver)
+    return _htmlApp
+
+
+class GFhtmlApp:
+
+    _mainLoop= None
+    _MainWindowList = []
+    running = True
+
+    def __init__(self, uidriver):
+        self.uidriver = uidriver
+        global _dhtml
+        global _htmlApp
+        self._dhtml = _dhtml
+        self._htmlApp = _htmlApp
+        self._form = None
+
+    def setForm(self,form):
+        self._form = form
+
+    def MainLoop (self):
+
+        if self._mainLoop==None:
+            self._mainLoop=1
+            print 'BaseHTTPServer started at http://127.0.0.1:8000'
+            server = HTTPServer(('',8000), GFRequestHandler)
+            server.app = self
+
+            # open browser:
+            webbrowser.open("http://localhost:8000/";)
+            while self.running:
+                server.handle_request()
+
+    def quit(self):
+        self.running=False
+        sys.exit()
+
+def textEncode(a):
+    return a
\ No newline at end of file

Added: trunk/gnue-forms/src/uidrivers/html/Generator.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/html/Generator.py    2006-11-17 16:26:24 UTC 
(rev 9047)
+++ trunk/gnue-forms/src/uidrivers/html/Generator.py    2006-11-20 00:24:07 UTC 
(rev 9048)
@@ -0,0 +1,273 @@
+# GNU Enterprise Forms - HTML UI Driver - Widget Generator
+#
+# Copyright 2001-2006 Free Software Foundation
+#
+# This file is part of GNU Enterprise
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2, or (at your option) any later version.
+#
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# $Id: _base.py 8810 2006-10-17 10:11:19Z reinhard $
+
+
+FIX = 24
+FIX2 = 12
+
+def _on_click_event(event):
+    return ' onClick="sendCmd(\'event\',\'event=%s\');"' % event
+
+def _on_change_event(id):
+    return 'onchange="sendCmd(\'onChange\',\'id=%s&text=\'+this.value)"\n' % id
+
+def _on_focus_event(id):
+    return 'onfocus="sendCmd(\'onFocus\',\'id=%s&text=\'+this.value)"\n' % id
+
+def _css_position(x,y,width,height):
+    return ('style="position:absolute; top:%spx; left:%spx;'+\
+            ' width:%spx; height:%spx;"') % (FIX + y, x, width, height)
+
+def build_label(id, value, x, y, width, height):  
+    return ('<div id="%s" %s>%s</div>\n') % \
+           (id, _css_position(x,y,width,height-FIX2), value)  
+            
+def build_entry_label(id, value, x, y, width, height):  
+    return ('<div id="%s" %s>%s</div>\n') % \
+           (id, _css_position(x,y,width,height-FIX2), value)    
+           
+def build_entry_checkbox(id, value, x, y):  
+    return ('<input type="checkbox" id="%s" value="%s" %s %s '+\
+            'style="position:absolute; top:%spx; left:%spx"/>\n') % \
+           (id, value, _on_change_event(id),_on_focus_event(id), FIX + y, x)   
     
+           
+def build_entry_default(id, value, x, y, width, height):
+    return '<input type="text" id="%s" value="%s" %s\n %s\n %s/>\n' % \
+           (id, value, _css_position(x,y,width,height-FIX2), \
+           _on_change_event(id),_on_focus_event(id))
+           
+def build_entry_multiline(id, value, rowcount, x, y, width, height):
+    return '<textarea id="%s" rows="%s" %s\n %s\n %s/>%s</textarea>\n' % \
+           (id, rowcount, _css_position(x,y,width,height-4), \
+           _on_change_event(id),_on_focus_event(id), value)
+           
+def _build_choices(choices):
+    out = ""
+    for i in choices:
+        out+="<option>%s</option>\n" % i
+    return out
+        
+def build_entry_listbox(id, value, choices, rows, x, y, width, height):
+    return ('<select id="%s" value="%s" size="%s" %s\n %s\n'+ \
+            '%s>\n%s</select>\n') % \
+            (id, value, rows, _css_position(x,y,width,height),
+             _on_change_event(id),_on_focus_event(id), _build_choices(choices))
+            
+def build_entry_combobox(id, value, choices, rows, x, y, width, height):
+    return ('<select id="%s" value="%s" size="%s" dojoType="ComboBox" %s\n 
%s\n'+ \
+            '%s>\n%s</select>\n') % \
+            (id, value, rows, _css_position(x,y,width,height),
+             _on_change_event(id),_on_focus_event(id), 
_build_choices(choices))            
+                   
+def build_toolbutton(id, label, event, iconpath, tooltip, enabled):    
+    return ('<td><button id="%s" class="Toolbutton" widgetId="%s" '+\
+            'dojoType="Button" name="%s" %s %s>\n'+\
+            '<img src="%s">%s\n</button></td>\n') % \
+            (id, id, label, _on_click_event(event), enabled,
+             iconpath,"") # "<br>%s" % label)
+            
+    #return '<input id="%s" type="IMAGE" name="%s" src="%s" alt="%s" %s %s/>' 
% \
+    #       (id, label, iconpath, label, _on_click_event(event), enabled)
+           
+def build_toolbar(id, content):           
+    return '<table class="Toolbar"><tr>\n%s\n</tr></table>' % content
+
+def build_button(id, label, x, y, width, height):
+    return '<input id="%s" type="button" value="%s" %s %s/>\n' % \
+                (id, label, _css_position(x,y,width,height),
+                 _button_on_click(id))
+                 
+def _button_on_click(id):                 
+    return 'onclick="sendCmd(\'btn\',\'id=%s\')"' % id
+
+def build_image(id, value, x, y, width, height):
+    return '<image id="%s" src="/images/%s" %s>' % \
+           (id, value, _css_position(x,y,width,height))
+           
+def build_box(id, label, x, y, width, height):
+    return '<div id="%s" %s border-width: 1px; border-style: solid">%s</div>' 
% \
+            (id, _css_position(x,y+FIX2,width,height-FIX)[0:-1], label)
+           
+def build_page(id, pagename, content):
+    return ("<div id=\"%s\" dojoType=\"ContentPane\" label=\"%s\">\n" +\
+           " %s \n</div>\n") % (id, pagename, content)
+           
+def build_splashscreen(forward_url, VERSION):
+    return """<HTML><HEAD>
+<meta http-equiv="refresh" content="4; URL=%s">
+</HEAD>
+   <BODY>
+      <CENTER>
+         <IMAGE SRC="splashscreen.png">
+         <BR>
+         Version: %s
+      </CENTER>
+    <H1 ALIGN="CENTER"> Please wait while GNUe-Forms is loading ...</H1>
+    <A HREF="%s"> Press here!</A>
+   </BODY>
+</HTML>""" % (forward_url, VERSION, forward_url)
+               
+def build_form(title, header, pages, footer):
+    return """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 
"http://www.w3.org/TR/html4/strict.dtd";>
+      <html>
+      <head>
+      <title>"""+title+"""</title>
+
+      <script type="text/javascript">
+        var djConfig = {isDebug: true};
+        // djConfig.debugAtAllCosts = true;
+
+      </script>
+      <script type="text/javascript" src="/incl/dojo.js"></script>
+      <script language="JavaScript" type="text/javascript">
+        if (dojo==undefined) {
+           alert("Dojo Toolkit could not be loaded!\\nRestarting...")
+           window.location="\"
+        }
+        dojo.require("dojo.widget.Menu2")
+        dojo.require("dojo.widget.ContentPane")
+        dojo.require("dojo.widget.TabContainer")
+        dojo.require("dojo.widget.ComboBox")
+        dojo.require("dojo.debug.console")
+        dojo.require("dojo.io")
+        dojo.hostenv.writeIncludes()
+
+        var updates = {}
+        var bindArgs = {
+                       url: "/jsonrpc",
+                       type: "text/javascript",
+                       load: function(type, data, evt){
+                                updates = eval(data)
+                                execUpdates()
+                             }
+        }
+        function getUid() {
+           myURL = window.location.href
+           x=myURL.indexOf("/session_")
+           return myURL.substring(x+9,x+41)
+        }
+        function sendCmd(cmd, args) {
+          bindArgs.url="/jsonrpc_"+getUid()+"?cmd="+cmd+"&"+args
+          dojo.io.bind(bindArgs);
+        }
+        function execUpdates() {
+          for (i in updates) {
+            item=updates[i];
+            try  {
+              if (item[0]=="alert") {
+                 alert(item[2])
+              }
+              if (item[0]=="status") {
+                 window.status=item[2]
+              }
+
+              if (item[0]=="set") {
+                 elem = dojo.widget.getWidgetById(item[1])
+                 if (elem==undefined) {
+                    elem = document.getElementById(item[1])
+                }
+                elem.value=item[2]
+              }
+              if (item[0]=="replace") {
+                 elem = document.getElementById(item[1])
+                 elem.innerHTML=item[2]
+              }
+              if (item[0]=="disable") {  // disable id true/false
+                 elem = dojo.widget.getWidgetById(item[1])
+                 if (elem==undefined) {
+                    elem = document.getElementById(item[1])
+                    elem.disabled=item[2];
+                 } else {
+                    elem.setDisabled(item[2])
+                 }
+               }
+               if (item[0]=="grab_focus") {
+                    elem = document.getElementById(item[1])
+                    if (elem==undefined) {
+                       elem = dojo.widget.getWidgetById(item[1])
+                       elem.focus()
+                    } else {
+                       elem.focus()
+                    }
+               }
+               if (item[0]=="close") {
+                    // return to main page
+                    window.location="/"
+               }
+            }
+            catch(err)  {
+                   txt="There was an error on this page.\\n\\n"
+                   txt+="Id: " + item[1] + "\\n"
+                   txt+="Value: " + item[2] + "\\n"
+                   txt+="Error Name: " + err.name + "\\n"
+                   txt+="Error Message: " + err.message + "\\n\\n"
+                   txt+="Click OK to continue.\\n\\n"
+                   // err.fileName + err.lineNumber
+                   alert(txt)
+            }
+          }
+        }
+      </script>
+        <style>
+          html, body{
+          width: 100%;  /* make the body expand to fill the visible window */
+          height: 100%;
+          overflow: hidden;  /* erase window level scrollbars */
+          padding: 0 0 0 0;
+          margin: 0 0 0 0;
+          }
+        .dojoSplitPane{
+          margin: 5px;
+        }
+        #rightPane {
+          margin: 0;
+        }
+        .dojoMenuBar2 {
+          border-top:1px solid #d4d4d4;
+        }
+        .Toolbar {
+           background-color: #85AEEC;
+           background-image:soriaBarBg.gif;
+           background-repeat:repeat-x;
+        }
+        .Toolbar .dojoButton {
+            float: left;
+            margin-right: 10px;            
+        }
+        .dojoButton .dojoButtonContents {
+             font-size: 6pt;
+         }
+
+         </style>
+      </head>
+      <body>""" + header + """
+      <div dojoType="LayoutContainer"
+        layoutChildPriority='top-bottom'
+        style="width: 100%; height: 100%;">
+        <div id="mainTabContainer" dojoType="TabContainer" sizeMin="20" 
sizeShare="70" style="width: 100%; height: 100%;">
+      """ + pages + """
+      </div>
+      """ + footer + """
+      </body>
+      </html>
+      """
\ No newline at end of file

Modified: trunk/gnue-forms/src/uidrivers/html/MenuBar.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/html/MenuBar.py      2006-11-17 16:26:24 UTC 
(rev 9047)
+++ trunk/gnue-forms/src/uidrivers/html/MenuBar.py      2006-11-20 00:24:07 UTC 
(rev 9048)
@@ -1,56 +1,108 @@
-#
-# This file is part of GNU Enterprise.
-#
-# GNU Enterprise is free software; you can redistribute it
-# and/or modify it under the terms of the GNU General Public
-# License as published by the Free Software Foundation; either
-# version 2, or (at your option) any later version.
-#
-# GNU Enterprise is distributed in the hope that it will be
-# useful, but WITHOUT ANY WARRANTY; without even the implied
-# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-# PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public
-# License along with program; see the file COPYING. If not,
-# write to the Free Software Foundation, Inc., 59 Temple Place
-# - Suite 330, Boston, MA 02111-1307, USA.
-#
-# Copyright 2000-2006 Free Software Foundation
-#
-# FILE:
-# uidrivers/html/MenuBar.py
-#
-# DESCRIPTION:
-#
-# NOTES:
-#
-
-from gnue.forms.uidrivers._commonGuiToolkit.MenuBar import MenuBar as 
_BaseMenuBar
-
-class MenuBar(_BaseMenuBar):
-
-  # Create the menu
-  def init(self):
-    print 'MenuBar init'
-    
-  # Add a (sub)menu
-  def addMenu(self, name, parent):
-    print 'addMenu'
-
-  # Add a menu item (action)
-  def addAction(self, name, parent, userAction):
-    print 'addAction'
-
-  # Add a separator
-  def addSeparator(self, parent):
-    print 'addSeparator'
-
-  # Enable a menu item
-  def enableItem(self, item):
-    print 'enableItem'
-
-  # Disable a menu item
-  def disableItem(self, item):
-    print 'disableItem'
-
+#
+# This file is part of GNU Enterprise.
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2, or (at your option) any later version.
+#
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Copyright 2000-2006 Free Software Foundation
+#
+# FILE:
+# uidrivers/html/MenuBar.py
+#
+# DESCRIPTION:
+#
+# NOTES:
+#
+
+from gnue.forms.uidrivers._commonGuiToolkit.MenuBar import MenuBar as 
_BaseMenuBar
+from gnue.forms.uidrivers.html.widgets._base import HtmlWidget
+from gnue.forms.uidrivers.html.common import getNextId
+
+class MenuBar(_BaseMenuBar):
+
+    # Create the menu
+    def init(self):
+        self.container.MenuBar = self
+        self.menu = MenuWidget(self.container, self.driver, 'MENU', "", 
getNextId())
+        self.lastsubmenu = None
+
+
+    def get_html(self):
+        # TODO: add HTML caching
+        return self.menu.get_html()
+
+    # Add a (sub)menu
+    def addMenu(self, name, parent):
+        self.lastsubmenu = MenuWidget(self.menu, self.driver, 'SUBMENU', "", 
getNextId())
+        self.lastsubmenu.name = name.replace('&','')
+        return self.lastsubmenu
+
+    # Add a menu item (action)
+    def addAction(self, name, parent, userAction):
+        if self.lastsubmenu!=None:
+            item = MenuWidget(self.lastsubmenu, self.driver, 'MENUITEM', "", 
getNextId())
+            item.name = name.replace('&','')
+            item.action = userAction
+
+            return item
+
+    # Add a separator
+    def addSeparator(self, parent):
+        if self.lastsubmenu!=None:
+            item = MenuWidget(self.lastsubmenu, self.driver, 'SEPARATOR', "", 
getNextId())
+
+    # Enable a menu item
+    def enableItem(self, item):
+        item.set_sensitive(True)
+
+    # Disable a menu item
+    def disableItem(self, item):
+        item.set_sensitive(False)
+
+
+class MenuWidget(HtmlWidget):
+
+    def get_html(self):
+        if self._type == "MENU":
+            self.dhtml=""
+            # add submenu code
+            for child in self._children:
+                self.dhtml += child.get_html()
+            self.dhtml += '<div dojoType="MenuBar2">'
+            for child in self._children:
+                self.dhtml += ('<div dojoType="MenuBarItem2" '+\
+                               'caption="%s" submenuId="%s"></div>') % \
+                               (child.name, child._id)
+            self.dhtml += '</div>'
+            return self.dhtml
+        elif self._type == "SUBMENU":
+            self.dhtml = '<div dojoType="PopupMenu2" '+\
+                         'widgetId="%s" id="%s">\n' % (self._id,self._id)
+            for child in self._children:
+                self.dhtml += child.get_html()
+            self.dhtml += '</div>'
+            return self.dhtml
+        elif self._type == "MENUITEM":
+            event = "request%s" % self.action.event
+            self.dhtml = ('<div dojoType="MenuItem2" caption="%s"' +\
+                         ' onClick="sendCmd(\'event\',\'id=%s&event=%s\');"' +\
+                         ' id="%s" widgetId="%s"%s></div>') % \
+                         (self.name, self._id, event, self._id, self._id, \
+                          self._disabled and ' disabled="True"' or "")
+
+            return self.dhtml
+        elif self._type == "SEPARATOR":
+            # TODO add seperator
+            return '<div dojoType="MenuSeparator2"></div>'

Modified: trunk/gnue-forms/src/uidrivers/html/ToolBar.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/html/ToolBar.py      2006-11-17 16:26:24 UTC 
(rev 9047)
+++ trunk/gnue-forms/src/uidrivers/html/ToolBar.py      2006-11-20 00:24:07 UTC 
(rev 9048)
@@ -1,92 +1,96 @@
-#
-# This file is part of GNU Enterprise.
-#
-# GNU Enterprise is free software; you can redistribute it
-# and/or modify it under the terms of the GNU General Public
-# License as published by the Free Software Foundation; either
-# version 2, or (at your option) any later version.
-#
-# GNU Enterprise is distributed in the hope that it will be
-# useful, but WITHOUT ANY WARRANTY; without even the implied
-# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-# PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public
-# License along with program; see the file COPYING. If not,
-# write to the Free Software Foundation, Inc., 59 Temple Place
-# - Suite 330, Boston, MA 02111-1307, USA.
-#
-# Copyright 2000-2006 Free Software Foundation
-#
-# FILE:
-# uidrivers/html/ToolBar.py
-#
-# DESCRIPTION:
-#
-# NOTES:
-#
-
-from gnue.forms.uidrivers.html.widgets._base import HtmlWidget
-from gnue.forms.uidrivers.html.common import *
-from gnue.forms.uidrivers._commonGuiToolkit.ToolBar import ToolBar as 
_BaseToolBar
-from gnue.common.apps import GConfig
-from gnue.common import events
-
-
-class ToolBar(_BaseToolBar):
-
-  # Create the menu
-  def init(self):
-    dhtml = ''
-    self.toolbar = HtmlWidget(self.container, self.driver, 'TOOLBAR', dhtml, 
getNextId())
-    
-  # Add a menu item (action)
-  def addAction(self, name, userAction):
-    iconloc = userAction.getIconLocation(size="24x24")
-
-    # Set the action icon if available
-    if iconloc:
-      try:
-        # Some caching logic for faster second/third forms
-        icon = _cachedIcons[iconloc]
-      except KeyError:
-        icon = iconloc
-        _cachedIcons[iconloc] = icon
-    else:
-      print "** WARNING: Cannot add '%s' to toolbar; no icon" % 
userAction.event
-      return
-
-    parent = self.toolbar
-    label = name
-
-    # Create an event binding in windows
-    id = getNextId()
-    event = 'request' + userAction.event
-    self.container.Connect(id, lambda l=self.driver, e=event, f=self.form: 
l.dispatchEvent(events.Event(e,_form=f)))
-
-    dhtml = '<input type="IMAGE" name="%s" src="file://%s" value="%s" alt="%s" 
/>' % (event, icon, event, label)
-    newwidget = HtmlWidget(self.container, self.driver, 'TOOLBAR', dhtml, id)
-
-    return (parent, id)
-
-  # Add a separator
-  def addSeparator(self):
-    id = getNextId()
-    dhtml = ' '
-    newwidget = HtmlWidget(self.container, self.driver, 'SEPARATOR', dhtml, id)
-
-  # Enable a menu item
-  def enableItem(self, item):
-    pass
-
-  # Disable a menu item
-  def disableItem(self, item):
-    pass
-
-  def startingItem(self, item):
-    pass
-
-  def endingItem(self, item):
-    pass
-
-_cachedIcons = {}
+#
+# This file is part of GNU Enterprise.
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2, or (at your option) any later version.
+#
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Copyright 2000-2006 Free Software Foundation
+#
+# FILE:
+# uidrivers/html/ToolBar.py
+#
+# DESCRIPTION:
+#
+# NOTES:
+#
+
+from gnue.forms.uidrivers.html.widgets._base import HtmlWidget
+from gnue.forms.uidrivers.html.common import *
+from gnue.forms.uidrivers.html.Generator import build_toolbutton, build_toolbar
+from gnue.forms.uidrivers._commonGuiToolkit.ToolBar import ToolBar as 
_BaseToolBar
+from gnue.common.apps import GConfig
+
+_iconpath = GConfig.getInstalledBase('form_images', 'common_images')
+
+class ToolBar(_BaseToolBar):
+
+    # Create the menu
+    def init(self):
+        self.container.ToolBar = self
+        self.widget = ToolbarWidget(self.container, self.driver, 'TOOLBAR', 
"", getNextId())
+
+    # Add a menu item (action)
+    def addAction(self, name, userAction):
+        iconloc = userAction.getIconLocation(size="24x24")
+        
+        # make iconloc relative to iconpath 
+        iconloc = iconloc[len(_iconpath)+1:].replace("\\","/")
+
+        id = getNextId()
+        event = 'request' + userAction.event
+        label = name
+        tooltip = userAction.description
+                
+        dhtml = build_toolbutton(id, label, event, "/icon/%s" % iconloc, 
tooltip, "%s")
+        return ToolbarWidget(self.widget, self.driver, 'TOOLBUTTON', dhtml, id)
+        
+    def get_html(self):
+        return self.widget.get_html()
+
+    # Add a separator
+    def addSeparator(self):
+        id = getNextId()
+        dhtml = '&nbsp;&nbsp;&nbsp;&nbsp;'
+        return ToolbarWidget(self.widget, self.driver, 'SEPARATOR', dhtml, id)
+        
+    # Enable a menu item
+    def enableItem(self, item):
+        item.set_sensitive(True)
+
+    # Disable a menu item
+    def disableItem(self, item):
+        item.set_sensitive(False)
+
+    def startingItem(self, item):
+        item.set_active(True)
+
+    def endingItem(self, item):
+        item.set_active(False)
+        
+class ToolbarWidget(HtmlWidget):
+
+    def get_html(self):
+        
+        if self._type == "TOOLBAR":
+            dhtml = ""
+            for child in self._children:
+                dhtml += child.get_html()
+            return build_toolbar("toolbar",dhtml)
+
+        elif self._type == "TOOLBUTTON":
+            return self.dhtml % (self._disabled and ' disabled="True"' or "")
+        
+        elif self._type == "SEPARATOR":            
+            return self.dhtml

Modified: trunk/gnue-forms/src/uidrivers/html/UILoginHandler.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/html/UILoginHandler.py       2006-11-17 
16:26:24 UTC (rev 9047)
+++ trunk/gnue-forms/src/uidrivers/html/UILoginHandler.py       2006-11-20 
00:24:07 UTC (rev 9048)
@@ -1,40 +1,41 @@
-#
-# This file is part of GNU Enterprise.
-#
-# GNU Enterprise is free software; you can redistribute it
-# and/or modify it under the terms of the GNU General Public
-# License as published by the Free Software Foundation; either
-# version 2, or (at your option) any later version.
-#
-# GNU Enterprise is distributed in the hope that it will be
-# useful, but WITHOUT ANY WARRANTY; without even the implied
-# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-# PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public
-# License along with program; see the file COPYING. If not,
-# write to the Free Software Foundation, Inc., 59 Temple Place
-# - Suite 330, Boston, MA 02111-1307, USA.
-#
-# Copyright 2000-2006 Free Software Foundation
-#
-# FILE:
-# uidrivers/html/UILoginHandler.py
-#
-# DESCRIPTION:
-#
-# NOTES:
-#
-
-from gnue.common.datasources import GLoginHandler
-from gnue.common.apps import GConfig
-
-
-#
-# UILoginHandler
-#
-class UILoginHandler(GLoginHandler.LoginHandler):
-  def __init__(self):
-    pass
-  def getLogin(self, loginData, errortext=None):#"Invalid username/password"):
-    pass
\ No newline at end of file
+#
+# This file is part of GNU Enterprise.
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2, or (at your option) any later version.
+#
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Copyright 2000-2006 Free Software Foundation
+#
+# FILE:
+# uidrivers/html/UILoginHandler.py
+#
+# DESCRIPTION:
+#
+# NOTES:
+#
+
+from gnue.common.datasources import GLoginHandler
+from gnue.common.apps import GConfig
+
+
+#
+# UILoginHandler
+#
+class UILoginHandler(GLoginHandler.LoginHandler):
+    def __init__(self):
+        pass
+      
+    def getLogin(self, loginData, errortext=None):#"Invalid 
username/password"):
+        pass

Modified: trunk/gnue-forms/src/uidrivers/html/UISplashScreen.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/html/UISplashScreen.py       2006-11-17 
16:26:24 UTC (rev 9047)
+++ trunk/gnue-forms/src/uidrivers/html/UISplashScreen.py       2006-11-20 
00:24:07 UTC (rev 9048)
@@ -25,6 +25,7 @@
 
 from gnue.common.apps import GConfig
 from gnue.forms import VERSION
+from Generator import build_splashscreen
 
 # =============================================================================
 # Implementation of a splash screen
@@ -32,35 +33,23 @@
 
 class SplashScreen:
 
-  # ---------------------------------------------------------------------------
-  # Constructor
-  # ---------------------------------------------------------------------------
+    # 
---------------------------------------------------------------------------
+    # Constructor
+    # 
---------------------------------------------------------------------------
 
-  def __init__ (self):
+    def __init__ (self):
 
-    iDir    = GConfig.getInstalledBase ('forms_images', 'common_images')
-    picture = gConfigForms ('splashScreenPNG')
-    if not os.path.isabs (picture):
-      self.picture = os.path.join (iDir, picture)   
-      
-  def getPicture(self):
-    file = open(self.picture,"rb")
-    data = ""
-    for line in file:
-      data+=line
-    return data
-    
-  def getHTML(self):
-    html = """<HTML><HEAD>
-    </HEAD>
-    <BODY>
-    <CENTER>
-    <IMAGE SRC="splashscreen.png"><BR>
-    Version: %s
-    </CENTER>
-    <H1 ALIGN="CENTER"> Please wait while GNUe-Forms is loading ...</H1>
-    </BODY>    
-    </HTML>    
-    """ % (VERSION)
-    
-    return html
+        iDir    = GConfig.getInstalledBase ('forms_images', 'common_images')
+        picture = gConfigForms ('splashScreenPNG')
+        if not os.path.isabs (picture):
+            self.picture = os.path.join (iDir, picture)
+
+    def getPicture(self):
+        file = open(self.picture,"rb")
+        data = ""
+        for line in file:
+            data+=line
+        return data
+
+    def get_html(self, forward_url):
+        return build_splashscreen(forward_url, VERSION)

Modified: trunk/gnue-forms/src/uidrivers/html/UIdriver.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/html/UIdriver.py     2006-11-17 16:26:24 UTC 
(rev 9047)
+++ trunk/gnue-forms/src/uidrivers/html/UIdriver.py     2006-11-20 00:24:07 UTC 
(rev 9048)
@@ -1,56 +1,118 @@
-#
-# This file is part of GNU Enterprise.
-#
-# GNU Enterprise is free software; you can redistribute it
-# and/or modify it under the terms of the GNU General Public
-# License as published by the Free Software Foundation; either
-# version 2, or (at your option) any later version.
-#
-# GNU Enterprise is distributed in the hope that it will be
-# useful, but WITHOUT ANY WARRANTY; without even the implied
-# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-# PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public
-# License along with program; see the file COPYING. If not,
-# write to the Free Software Foundation, Inc., 59 Temple Place
-# - Suite 330, Boston, MA 02111-1307, USA.
-#
-# Copyright 2000-2006 Free Software Foundation
-#
-# FILE:
-# uidrivers/html/UIdriver.py
-#
-# DESCRIPTION:
-#
-# NOTES:
-#
-
-import sys
-import string
-
-from gnue.forms.uidrivers._base import Exceptions
-
-from gnue.common import events
-from gnue.common.apps import GConfig
-
-from gnue.forms import VERSION
-from gnue.forms.GFForm import *
-from gnue.forms.uidrivers._commonGuiToolkit import UIdriver as commonToolkit
-
-from gnue.forms.uidrivers.html.GFhtmlApp import *
-
-
-class GFUserInterface(commonToolkit.GFUserInterface):
-
-  def initialize(self):
-
-    self._htmlapp = gethtmlApp(self)
-
-    self.textWidth    = 12  # The pixel width of text inside a widget
-    self.textHeight   = 24  # The pixel height of text inside a widget
-    self.widgetWidth  = self.textWidth  # The pixel width of a 1 char widget 
(for things like buttons)
-    self.widgetHeight = self.textHeight + 5  # The pixel height of a 1 char 
widget (for things like buttons)
-
-  def mainLoop(self):
-    self._htmlapp.MainLoop() # simply call the wxApp's MainLoop method
+#
+# This file is part of GNU Enterprise.
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2, or (at your option) any later version.
+#
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Copyright 2000-2006 Free Software Foundation
+#
+# FILE:
+# uidrivers/html/UIdriver.py
+#
+# DESCRIPTION:
+#
+# NOTES:
+#
+
+import sys
+import string
+
+from gnue.forms.uidrivers._base import Exceptions
+
+from gnue.common import events
+from gnue.common.apps import GConfig
+
+from gnue.forms import VERSION
+from gnue.forms.GFForm import *
+from gnue.forms.uidrivers._commonGuiToolkit import UIdriver as commonToolkit
+
+from gnue.forms.uidrivers.html.GFhtmlApp import *
+
+
+class GFUserInterface(commonToolkit.GFUserInterface):
+    _WidgetToGFObj = {}
+    _WidgetToUIObj = {}
+    _IdToWidget = {}
+
+    def initialize(self):
+
+        self._htmlapp = gethtmlApp(self)
+
+        self.textWidth    = 12  # The pixel width of text inside a widget
+        self.textHeight   = 24  # The pixel height of text inside a widget
+        self.widgetWidth  = self.textWidth  # The pixel width of a 1 char 
widget (for things like buttons)
+        self.widgetHeight = self.textHeight + 5  # The pixel height of a 1 
char widget (for things like buttons)
+
+    def mainLoop(self):
+        self._htmlapp.MainLoop() # simply call the wxApp's MainLoop method
+
+    def show(self):
+        pass
+
+    def __repr__(self):
+        return "class GFUserInterface for the GNUe Forms HTML UI driver"
+
+    # 
---------------------------------------------------------------------------
+    # create a modal dialog box, asking for user input
+    # 
---------------------------------------------------------------------------
+
+    def _getInput (self, title, fields, cancel):
+        message = ("Input required by: >>%s<<\n" % title) +\
+                  "Input routines currently not supported!"
+        self._UIform._ui_show_message_(message, "", title, cancel)
+        # FIXME: connect to current open form
+        return False
+        
+        
+    # 
---------------------------------------------------------------------------
+    # create a modal message box
+    # 
---------------------------------------------------------------------------
+
+    def _ui_show_error_(self, message):
+
+        msg = u_("The following error occured in GNU Enterprise:\n%s") % 
message
+        print msg # FIXME: use logging function
+        
+        self._UIform._ui_show_message_(msg, "error", "Error Message", true)
+
+
+    # 
---------------------------------------------------------------------------
+    # Show an exception dialog
+    # 
---------------------------------------------------------------------------
+
+    def _ui_show_exception_(self, group, name, message, detail):
+        msg  = u_("Title: %s") % "GNU Enterprise"
+        msg += u_("Group: %s") % group
+        msg += u_("Name: %s") % name
+        msg += u_("Message: %s") % message
+        msg += u_("Detail: %s ") % detail
+        print msg # FIXME: use logging function
+        
+        self._UIform._ui_show_message_(msg, "error", "System Error", true)
+        
+    # 
---------------------------------------------------------------------------
+    # Exit the application
+    # 
---------------------------------------------------------------------------
+
+    def _ui_exit_(self):
+        """
+        Exit the application.
+        """
+
+        assert gEnter(6)
+
+        self._htmlapp.quit ()
+
+        assert gLeave(6)

Modified: trunk/gnue-forms/src/uidrivers/html/common.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/html/common.py       2006-11-17 16:26:24 UTC 
(rev 9047)
+++ trunk/gnue-forms/src/uidrivers/html/common.py       2006-11-20 00:24:07 UTC 
(rev 9048)
@@ -1,55 +1,55 @@
-#
-# This file is part of GNU Enterprise.
-#
-# GNU Enterprise is free software; you can redistribute it
-# and/or modify it under the terms of the GNU General Public
-# License as published by the Free Software Foundation; either
-# version 2, or (at your option) any later version.
-#
-# GNU Enterprise is distributed in the hope that it will be
-# useful, but WITHOUT ANY WARRANTY; without even the implied
-# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-# PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public
-# License along with program; see the file COPYING. If not,
-# write to the Free Software Foundation, Inc., 59 Temple Place
-# - Suite 330, Boston, MA 02111-1307, USA.
-#
-# Copyright 2000-2006 Free Software Foundation
-#
-# FILE:
-# uidrivers/html/common.py
-#
-# DESCRIPTION:
-#
-# NOTES:
-#
-
-import string
-from gnue.common import events
-from gnue.common.apps import GConfig
-from types import UnicodeType, StringType
-
-FIX = 24
-
-_idPos = -1
-
-def getNextId():
-  global _idPos
-  _idPos += 1
-  return _idPos
-
-
-def textEncode(u_string):    
-    if type(u_string)==UnicodeType:
-        return u_string.encode(gConfig('textEncoding'),'replace')
-    else:
-        return u_string
-
-
-def textDecode(string):    
-    if type(string)==StringType:
-        return unicode(string, gConfig('textEncoding'))
-    else:
-        return string
+#
+# This file is part of GNU Enterprise.
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2, or (at your option) any later version.
+#
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Copyright 2000-2006 Free Software Foundation
+#
+# FILE:
+# uidrivers/html/common.py
+#
+# DESCRIPTION:
+#
+# NOTES:
+#
+
+import string
+from gnue.common import events
+from gnue.common.apps import GConfig
+from types import UnicodeType, StringType
+
+FIX = 24
+
+_idPos = -1
+
+def getNextId():
+    global _idPos
+    _idPos += 1
+    return _idPos
+
+
+def textEncode(u_string):
+    if type(u_string)==UnicodeType:
+        return u_string.encode(gConfig('textEncoding'),'replace')
+    else:
+        return u_string
+
+
+def textDecode(string):
+    if type(string)==StringType:
+        return unicode(string, gConfig('textEncoding'))
+    else:
+        return string

Modified: trunk/gnue-forms/src/uidrivers/html/widgets/_base.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/html/widgets/_base.py        2006-11-17 
16:26:24 UTC (rev 9047)
+++ trunk/gnue-forms/src/uidrivers/html/widgets/_base.py        2006-11-20 
00:24:07 UTC (rev 9048)
@@ -1,142 +1,305 @@
-#
-# This file is part of GNU Enterprise.
-#
-# GNU Enterprise is free software; you can redistribute it
-# and/or modify it under the terms of the GNU General Public
-# License as published by the Free Software Foundation; either
-# version 2, or (at your option) any later version.
-#
-# GNU Enterprise is distributed in the hope that it will be
-# useful, but WITHOUT ANY WARRANTY; without even the implied
-# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-# PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public
-# License along with program; see the file COPYING. If not,
-# write to the Free Software Foundation, Inc., 59 Temple Place
-# - Suite 330, Boston, MA 02111-1307, USA.
-#
-# Copyright 2000-2006 Free Software Foundation
-#
-# FILE:
-# uidrivers/html/widgets/_base.py
-#
-# DESCRIPTION:
-#
-# NOTES:
-#
-
-from gnue.common import events
-from gnue.forms.GFForm import *
-from gnue.forms.uidrivers._base.widgets._base import *
-from gnue.forms.uidrivers.html.common import *
-
-
-class HtmlWidget:
-
-  _connectTable = {}
-
-  def __init__(self, parent, uidriver, type, dhtml, id):
-    self.dhtml = dhtml
-    self.value = None
-    self._type = type
-    self._parent = parent
-    self._children = []
-    
-    if parent:
-      parent._children.append(self)
-      
-    self._uiDriver = uidriver
-    self._id = id
-
-  def Show(self):
-    if self._type == "ENTRY":
-      try:
-        gfObject = self._uiDriver._IdToGFObj[self._id]
-        if gfObject.style == 'checkbox':
-          if self.value:
-            self._uiDriver._htmlapp._dhtml[self._id] = (self.dhtml % "checked")
-          else:
-            self._uiDriver._htmlapp._dhtml[self._id] = (self.dhtml % "")
-        else:
-          self._uiDriver._htmlapp._dhtml[self._id] = (self.dhtml % self.value)
-      except:
-        print '*'+self.dhtml+'*'
-        print '#'+self.value+'#'
-    else:
-      self._uiDriver._htmlapp._dhtml[self._id] = self.dhtml
-    for child in self._children:
-      child.Show()
-
-  def GetId(self):
-    return self._id
-
-  def SetValue(self, value):
-    self.value = value
-    self.Show()
-
-  def Connect(self, id, func):
-    self._connectTable[id] = func
-
-
-class UIHelper(UIWidget):
-  def _addToCrossRef(self, widget, gfobject, uiobject):
-    id = widget.GetId()
-    self._uiDriver._IdToGFObj[id]=gfobject
-    self._uiDriver._IdToUIObj[id]=uiobject
-
-  def _deleteFromCrossRef(self, widget, object):
-    id = widget.GetId()
-    try:
-      del self._uiDriver._IdToGFObj[id]
-      del self._uiDriver._IdToUIObj[id]
-    except:
-      pass
-
-  #
-  # Override the base UIWidget functions
-  #
-  def show(self):
-    for widget in self.widgets:
-      widget.Show()
-
-  def hide(self):
-    for widget in self.widgets:
-      widget.Hide()
-
-          
-  def show_modal(self):
-    for widget in self.widgets:
-      widget.Show()
-
-  def destroy(self):
-    for widget in self.widgets:
-      self.Destroy()
-
-
-  def indexed_focus(self, index):
-    pass
-
-  def set_value(self, value, index=0, enabled=1):
-    value = textEncode(value)
-    widget = self.widgets[index]
-    widget.SetValue(value)
-
-  def set_cursor_position(self, position, index=0):
-    pass
-
-  def set_selected_area(self, selection1, selection2, index=0):
-    pass
-
-  def create_widget(self, event, spacer):
-    newWidget = self._create_widget(event, spacer)
-    self._addToCrossRef(newWidget,event.object,self)
-    return newWidget
-
-  def cleanup(self, object):
-    for widget in self.widgets[:]:
-      id = widget.GetId()
-      del self._uiDriver._IdToGFObj[id]
-      del self._uiDriver._IdToUIObj[id]
-      self.widgets.pop(0)
-      self._deleteFromCrossRef(widget, object)
+# GNU Enterprise Forms - HTML UI Driver - base class for UI widgets
+#
+# Copyright 2001-2006 Free Software Foundation
+#
+# This file is part of GNU Enterprise
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2, or (at your option) any later version.
+#
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# $Id: _base.py 8810 2006-10-17 10:11:19Z reinhard $
+
+import types
+from gnue.common import events
+from gnue.common.apps import i18n
+from gnue.forms.GFForm import *
+from gnue.forms.uidrivers._base.widgets._base import UIWidget
+from gnue.forms.uidrivers.html.common import *
+from gnue.forms.uidrivers.html.Generator import *
+
+# =============================================================================
+# This class implements the common behaviour of HTML widgets
+# =============================================================================
+
+class UIHelper (UIWidget):
+    """
+    Implements the common behaviour of HTML widgets
+    """
+
+
+    def __repr__(self):
+        return "UIHelper: %s" % self._type
+
+    # 
---------------------------------------------------------------------------
+    # Create a new HTML widget
+    # 
---------------------------------------------------------------------------
+
+    def _create_widget_ (self, event, spacer):
+        """
+        This function creates a new HTML widget and adds it to the cross 
reference
+        table.
+        """
+        gfObject           = event.object
+        self._eventHandler = event.eventHandler
+
+        if hasattr (gfObject, 'Char__y'):
+            posY = gfObject.Char__y
+            gap  = gfObject._gap + 1
+            self.itemY = (posY + spacer * gap) * event.widgetHeight
+
+        if hasattr (gfObject, 'Char__height'):
+            self.itemHeight = gfObject.Char__height * event.widgetHeight
+
+        newWidget = self._create_widget (event, spacer)
+        if event.initialize:
+            self._addToCrossRef (newWidget, gfObject, self)
+
+        return newWidget
+
+
+    # 
---------------------------------------------------------------------------
+    # Add a widget to the cross reference tables
+    # 
---------------------------------------------------------------------------
+
+    def _addToCrossRef (self, widget, gfobject, uiobject):
+        self._uiDriver._WidgetToGFObj [widget._id] = gfobject
+        self._uiDriver._WidgetToUIObj [widget._id] = uiobject
+        self._uiDriver._IdToWidget [widget._id] = widget
+
+
+    # 
---------------------------------------------------------------------------
+    # Remove a widget from the cross reference tables
+    # 
---------------------------------------------------------------------------
+
+    def _deleteFromCrossRef (self, widget, object):
+        try:
+            del self._uiDriver._WidgetToGFObj [widget._id]
+            del self._uiDriver._WidgetToUIObj [widget._id]
+            del self._uiDriver._IdToWidget [widget._id]
+
+        except:
+            pass
+
+
+    # 
---------------------------------------------------------------------------
+    # Get the index of an widget by its widget ID
+    # 
---------------------------------------------------------------------------
+
+    def _index_for_id(self, widget_id):
+        index=0
+        for i in self.widgets:
+            if i._id == widget_id:
+                return index
+            index=index+1
+
+        return 0
+
+    # 
---------------------------------------------------------------------------
+    # Handle focus signals from widgets
+    # 
---------------------------------------------------------------------------
+
+    def _focusInHandler (self, widget_id):
+        assert gDebug (6, "FOCUS-IN-EVENT: %s" % (widget_id))
+        gfObject = self._uiDriver._WidgetToGFObj [widget_id]
+        gfObject._event_set_focus(self._index_for_id (widget_id))
+
+
+    # 
---------------------------------------------------------------------------
+    # Show all ui-widgets managed by this object
+    # 
---------------------------------------------------------------------------
+
+    def show (self):
+        pass
+
+
+    # 
---------------------------------------------------------------------------
+    # Hide all ui-widgets managed by this object
+    # 
---------------------------------------------------------------------------
+
+    def hide (self):
+        pass
+
+
+    def show_modal (self):
+        assert gDebug (1, "show_modal not implemented for HTML driver")
+
+    def destroy (self):
+        assert gDebug (1, "destroy not implemented for HTML driver")
+
+
+    # 
---------------------------------------------------------------------------
+    # Set the focus to a given widget
+    # 
---------------------------------------------------------------------------
+
+    def _ui_set_focus_ (self, index):
+        """
+        This function set's the focus to the HTML-widget specified by index. 
If the
+        widget has a focusHandler it will be blocked and unblocked to prevent a
+        recursion. The focused widget will have a highlight color if it is set
+        in gnue.conf.
+        """
+        widget = self.widgets [index]
+        assert gDebug (6, "indexed_focus: %s [%s]" % (widget, index))
+
+        widget.grab_focus()
+
+    # 
---------------------------------------------------------------------------
+
+    def _ui_focus_in_(self, index):
+
+        # FIXME: Can we remove this method?
+        # Change the background of a widget if requested via gnue.conf
+        widget = self.widgets [index]
+
+
+    # 
---------------------------------------------------------------------------
+
+    def _ui_focus_out_(self, index):
+
+        # FIXME: Can we remove this method?
+        widget = self.widgets[index]
+        assert gDebug (6, "Lose focus: %s" % widget)
+
+
+    # 
---------------------------------------------------------------------------
+    # Set the value of a widget
+    # 
---------------------------------------------------------------------------
+
+    def _ui_set_value_ (self, index, value):
+        """
+        This function sets the value of a widget and optionally enables or 
disables
+        the widget.
+        """
+        widget = self.widgets [index]
+        assert gDebug (6, "set_value %s [%s] %s" % (repr (value), index, 
widget))
+
+        if widget.style!="checkbox" and type (value) != types.UnicodeType:
+            assert gDebug (6, "converting %s to unicode using %s" % \
+                (repr (value), gConfigForms ('textEncoding')))
+            value = unicode (value, gConfigForms ('textEncoding'))
+
+        gfObject = self._uiDriver._WidgetToGFObj [widget._id]
+
+        # Check if list of allowed value (~= foreign keys, ~= dropdown content)
+        # changed
+        if gfObject.style == "dropdown":
+            self._updateChoices (widget, gfObject)
+
+        if hasattr(widget,"set_value"):
+            widget.set_value (value)
+
+
+    # 
---------------------------------------------------------------------------
+    # Make sure a string will be converted into unicode
+    # 
---------------------------------------------------------------------------
+
+    def _makeSafe (self, value):
+        if isinstance (value, types.StringType):
+            value = unicode (value, i18n.encoding)
+        return value
+
+
+
+
+class HtmlWidget:
+
+    def __repr__(self):
+        return "Html Widget: %s" % self._type
+
+    def __init__(self, parent, uidriver, type, dhtml, id):
+        self.dhtml = dhtml
+        self.value = None
+        self._type = type
+        self._parent = parent
+        self._children = []
+
+        if parent:
+            parent._children.append(self)
+
+        self._uiDriver = uidriver
+        self._id = id
+        self._disabled = False
+        if type=="FORM":
+            self.pno=1
+
+    def get_html(self):
+        if self._type == "PAGE" or self._type == "BOX":
+            dhtml = self.dhtml
+            for child in self._children:
+                dhtml += child.get_html()
+            return dhtml
+        
+        elif self._type == "FORM":  # DIALOG            
+            pno=1
+            pages=""
+            header=""
+            footer=""
+            for child in self._children:
+                # self.dhtml = self.dhtml % ("CT: %s<BR>%%s" % child._type)
+
+                if child._type == "PAGE":
+                    try:
+                        gfObj=self._uiDriver._WidgetToGFObj[child._id]
+                        pagename=gfObj.name and gfObj.name or pno
+                    except:
+                        pagename = pno
+                    pages+=build_page("page_%s" % pno, pagename, 
child.get_html())
+                    pno+=1
+
+            if hasattr(self,"MenuBar"):           
+                header = header + self.MenuBar.get_html()
+            
+            if hasattr(self,"ToolBar"):           
+                header = header + self.ToolBar.get_html()
+            
+            if hasattr(self,"StatusBar"):
+                footer = footer + self.ToolBar.get_html()
+                
+            return build_form("GNUe Forms", header, pages, footer)
+        
+        else:
+            return self.dhtml
+
+    def GetId(self):
+        return self._id
+
+    def set_value(self, value):
+        if value != None:
+            self.value = value
+        else:
+            self.value = ""
+
+        self._send_update(["set","%s" % self._id,self.value])
+
+    def set_sensitive(self, enabled):
+        self._send_update(["disable","%s" % self._id,not(enabled)])
+        self._disabled = not(enabled)
+        
+    def set_active(self, active):
+        self._send_update(["activate","%s" % self._id, active])
+        self._active = active    
+
+    def grab_focus(self):
+        self._send_update(["grab_focus","%s" % self._id,""])
+
+    def _send_update(self, update):
+        try:
+            p = self._parent
+            while p._type != "FORM" and p._type!="DIALOG":
+                p=p._parent
+            p.updates.append(update)
+        except:
+            print "couldn't sent update %s"
+

Modified: trunk/gnue-forms/src/uidrivers/html/widgets/box.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/html/widgets/box.py  2006-11-17 16:26:24 UTC 
(rev 9047)
+++ trunk/gnue-forms/src/uidrivers/html/widgets/box.py  2006-11-20 00:24:07 UTC 
(rev 9048)
@@ -1,61 +1,56 @@
-#
-# This file is part of GNU Enterprise.
-#
-# GNU Enterprise is free software; you can redistribute it
-# and/or modify it under the terms of the GNU General Public
-# License as published by the Free Software Foundation; either
-# version 2, or (at your option) any later version.
-#
-# GNU Enterprise is distributed in the hope that it will be
-# useful, but WITHOUT ANY WARRANTY; without even the implied
-# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-# PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public
-# License along with program; see the file COPYING. If not,
-# write to the Free Software Foundation, Inc., 59 Temple Place
-# - Suite 330, Boston, MA 02111-1307, USA.
-#
-# Copyright 2000-2006 Free Software Foundation
-#
-# FILE:
-# uidrivers/html/widgets/box.py
-#
-# DESCRIPTION:
-#
-# NOTES:
-#
-
-from gnue.forms.uidrivers.html.widgets._base import UIHelper, HtmlWidget
-from gnue.forms.uidrivers.html.common import *
-
-
-class UIBox(UIHelper):
-
-  def _create_widget(self, event, spacer):
-
-    object = event.object
-    dhtml = '<div id="" \
-              style="position:absolute; top:%spx; left:%spx; width:%spx; 
height:%spx;\
-              border-width: 1px;\
-              border-style: solid">%s</div>' % \
-              (object.Char__y*event.widgetHeight + FIX,\
-               object.Char__x*event.widgetWidth,\
-               self.itemWidth,\
-               self.itemHeight,\
-               textEncode(object.label))
-
-    newWidget = HtmlWidget(event.container, self._uiDriver, 'BOX', dhtml, 
getNextId())
-    
-    return newWidget
-
-
-#
-# Configuration data 
-#
-configuration = {
-    'baseClass'  : UIBox,
-    'provides'   : 'GFBox',
-    'container'  : 0,
-    }
-
+#
+# This file is part of GNU Enterprise.
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2, or (at your option) any later version.
+#
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Copyright 2000-2006 Free Software Foundation
+#
+# FILE:
+# uidrivers/html/widgets/box.py
+#
+# DESCRIPTION:
+#
+# NOTES:
+#
+
+from gnue.forms.uidrivers.html.widgets._base import UIHelper, HtmlWidget
+from gnue.forms.uidrivers.html.Generator import build_box
+from gnue.forms.uidrivers.html.common import getNextId, textEncode
+
+
+class UIBox(UIHelper):
+
+    def _create_widget(self, event, spacer):
+
+        object = event.object
+        id = getNextId()
+        dhtml = build_box(id, textEncode(object.label), \
+                          object.Char__x*event.widgetWidth, self.itemY,\
+                          self.itemWidth, self.itemHeight)
+        
+        newWidget = HtmlWidget(event.container, self._uiDriver, 'BOX', dhtml, 
id)
+
+        return newWidget
+
+
+#
+# Configuration data
+#
+configuration = {
+    'baseClass'  : UIBox,
+    'provides'   : 'GFBox',
+    'container'  : 0,
+    }

Modified: trunk/gnue-forms/src/uidrivers/html/widgets/button.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/html/widgets/button.py       2006-11-17 
16:26:24 UTC (rev 9047)
+++ trunk/gnue-forms/src/uidrivers/html/widgets/button.py       2006-11-20 
00:24:07 UTC (rev 9048)
@@ -1,55 +1,51 @@
-#
-# This file is part of GNU Enterprise.
-#
-# GNU Enterprise is free software; you can redistribute it
-# and/or modify it under the terms of the GNU General Public
-# License as published by the Free Software Foundation; either
-# version 2, or (at your option) any later version.
-#
-# GNU Enterprise is distributed in the hope that it will be
-# useful, but WITHOUT ANY WARRANTY; without even the implied
-# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-# PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public
-# License along with program; see the file COPYING. If not,
-# write to the Free Software Foundation, Inc., 59 Temple Place
-# - Suite 330, Boston, MA 02111-1307, USA.
-#
-# Copyright 2000-2006 Free Software Foundation
-#
-# FILE:
-# uidrivers/html/widgets/button.py
-#
-# DESCRIPTION:
-#
-# NOTES:
-#
-
-from gnue.forms.uidrivers.html.widgets._base import UIHelper, HtmlWidget
-from gnue.forms.uidrivers.html.common import *
-
-
-class UIButton(UIHelper):
-
-  def _create_widget(self, event, spacer):
-    object = event.object
-
-    dhtml = '<input type="button" name="entGnueName" 
id="blkGnue_class_fldCGnueName_field" \
-            style="position:absolute; top:%spx; left:%spx; width:%spx; 
height:%spx;\
-            value="%s" />' % \
-            (object.Char__y*event.widgetHeight + FIX,\
-             object.Char__x*event.widgetWidth,\
-             self.itemWidth,\
-             self.itemHeight,\
-             textEncode(object.label))
-
-    newWidget = HtmlWidget(event.container, self._uiDriver, 'BUTTON', dhtml, 
getNextId())
-
-    return newWidget
-
-configuration = {
-    'baseClass'  : UIButton,
-    'provides'   : 'GFButton',
-    'container'  : 0,
-    }
+#
+# This file is part of GNU Enterprise.
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2, or (at your option) any later version.
+#
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Copyright 2000-2006 Free Software Foundation
+#
+# FILE:
+# uidrivers/html/widgets/button.py
+#
+# DESCRIPTION:
+#
+# NOTES:
+#
+
+from gnue.forms.uidrivers.html.widgets._base import UIHelper, HtmlWidget
+from gnue.forms.uidrivers.html.Generator import build_button
+from gnue.forms.uidrivers.html.common import getNextId, textEncode
+
+
+class UIButton(UIHelper):
+
+    def _create_widget(self, event, spacer):
+        object = event.object
+        id = getNextId()
+        dhtml = build_button(id, textEncode(object.label), \
+                             object.Char__x*event.widgetWidth, self.itemY,\
+                             self.itemWidth, self.itemHeight)         
+
+        newWidget = HtmlWidget(event.container, self._uiDriver, 'BUTTON', 
dhtml, id)
+
+        return newWidget
+
+configuration = {
+    'baseClass'  : UIButton,
+    'provides'   : 'GFButton',
+    'container'  : 0,
+    }

Modified: trunk/gnue-forms/src/uidrivers/html/widgets/entry.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/html/widgets/entry.py        2006-11-17 
16:26:24 UTC (rev 9047)
+++ trunk/gnue-forms/src/uidrivers/html/widgets/entry.py        2006-11-20 
00:24:07 UTC (rev 9048)
@@ -1,105 +1,205 @@
-#
-# This file is part of GNU Enterprise.
-#
-# GNU Enterprise is free software; you can redistribute it
-# and/or modify it under the terms of the GNU General Public
-# License as published by the Free Software Foundation; either
-# version 2, or (at your option) any later version.
-#
-# GNU Enterprise is distributed in the hope that it will be
-# useful, but WITHOUT ANY WARRANTY; without even the implied
-# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-# PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public
-# License along with program; see the file COPYING. If not,
-# write to the Free Software Foundation, Inc., 59 Temple Place
-# - Suite 330, Boston, MA 02111-1307, USA.
-#
-# Copyright 2000-2006 Free Software Foundation
-#
-# FILE:
-# uidrivers/html/widgets/entry.py
-#
-# DESCRIPTION:
-#
-# NOTES:
-#
-
-from gnue.forms.uidrivers.html.widgets._base import UIHelper, HtmlWidget
-from gnue.forms.uidrivers.html.common import *
-
-
-class UIEntry(UIHelper):
-
-  def _create_widget(self, event, spacer):
-    object = event.object
-
-    if object.style == 'dropdown':
-      if event.initialize:
-        choices = []
-        for val in object._field.allowedValues()[1]:
-          choices.append('<option value=%s>' % val)
-      else:
-        choices = [""]
-
-      dhtml = '<select name="" id="" size="1"\
-                style="position:absolute; top:%spx; left:%spx; width:%spx; 
height:%spx;>\
-                %s</select>' % \
-                (object.Char__y*event.widgetHeight + FIX,\
-                 object.Char__x*event.widgetWidth,\
-                 self.itemWidth,\
-                 self.itemHeight,\
-                 ''.join(choices))
-
-    elif object.style == 'listbox':
-      dhtml = '<select name="" id="" size="4"\
-                style="position:absolute; top:%spx; left:%spx; width:%spx; 
height:%spx;>\
-                %s</select>' % \
-                (object.Char__y*event.widgetHeight + FIX,\
-                 object.Char__x*event.widgetWidth,\
-                 self.itemWidth,\
-                 self.itemHeight,\
-                 ''.join(choices))
-                 
-    elif object.style == 'label':
-      dhtml = ''
-
-    # multiline edit
-    elif hasattr(object,'Char__height') and object.Char__height > 1:
-      dhtml = '<textarea name="" id="" rows="%s"\
-                style="position:absolute; top:%spx; left:%spx; width:%spx; 
height:%spx;\
-                value="%%s"\
-                ></textarea>' % \
-                (object.Char__height,\
-                 object.Char__y*event.widgetHeight + FIX,\
-                 object.Char__x*event.widgetWidth,\
-                 self.itemWidth,\
-                 self.itemHeight)
-
-    elif object.style == 'checkbox':
-      dhtml = '<input type="checkbox" name="nameText" id="idText" \
-              style="position:absolute; top:%spx; left:%spx"\
-              "%%s" />' % \
-              (object.Char__y*event.widgetHeight + FIX,\
-               object.Char__x*event.widgetWidth)
-
-    else: # normal text box
-
-      dhtml = '<input type="text" name="nameText" id="idText" \
-              style="position:absolute; top:%spx; left:%spx; width:%spx; 
height:%spx"\
-              value="%%s" />' % \
-              (object.Char__y*event.widgetHeight + FIX,\
-               object.Char__x*event.widgetWidth,\
-               self.itemWidth,\
-               self.itemHeight-4)
-
-    newWidget = HtmlWidget(event.container, self._uiDriver, 'ENTRY', dhtml, 
getNextId())
-    
-    return newWidget
-
-configuration = {
-    'baseClass'  : UIEntry,
-    'provides'   : 'GFEntry',
-    'container'  : 0,
-  }
+#
+# This file is part of GNU Enterprise.
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2, or (at your option) any later version.
+#
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Copyright 2000-2006 Free Software Foundation
+#
+# FILE:
+# uidrivers/html/widgets/entry.py
+#
+# DESCRIPTION:
+#
+# NOTES:
+#
+
+from gnue.forms.uidrivers.html.widgets._base import UIHelper, HtmlWidget
+from gnue.forms.uidrivers.html.common import *
+from gnue.forms.uidrivers.html.Generator import *
+
+class UIEntry(UIHelper):
+
+    def _create_widget(self, event, spacer):
+        object = event.object
+        id = getNextId()
+
+        if object.style == 'dropdown' or \
+          object.style == 'listbox':
+            if event.initialize:
+                choices = []
+                for val in object._field.allowedValues()[1]:
+                    choices.append(val)
+
+            else:
+                choices = []
+                
+            if object.style == "listbox":
+                dhtml=build_entry_listbox(id, "%s", choices, 
object.Char__height,
+                                           object.Char__x*event.widgetWidth,\
+                                           self.itemY, self.itemWidth, \
+                                           self.itemHeight)
+
+            else:
+                dhtml=build_entry_combobox(id, "%s", choices, 
object.Char__height,
+                                           object.Char__x*event.widgetWidth,\
+                                           self.itemY, self.itemWidth, \
+                                           self.itemHeight)            
+                 
+        elif object.style == 'label':
+            dhtml = build_entry_label(id, "%s", 
object.Char__x*event.widgetWidth, \
+                                       self.itemY, self.itemWidth, 
self.itemHeight)
+
+        elif object.style == 'checkbox':
+            dhtml = build_entry_checkbox(id, "%s", 
object.Char__x*event.widgetWidth, self.itemY)
+            
+        # multiline edit
+        elif hasattr(object,'Char__height') and object.Char__height > 1:
+            dhtml = build_entry_multiline(id, "%s", object.Char__height, \
+                                          object.Char__x*event.widgetWidth,\
+                                          self.itemY, self.itemWidth, \
+                                          self.itemHeight)
+
+        else: # normal text box
+            dhtml = build_entry_default(id, "%s", 
object.Char__x*event.widgetWidth,\
+                                        self.itemY, self.itemWidth, 
self.itemHeight)
+            
+        newWidget = HtmlEntryWidget(event.container, self._uiDriver, 'ENTRY', 
dhtml, id)
+        newWidget.style=object.style
+
+        if object.style == 'dropdown' or object.style == 'listbox':
+            newWidget._origAllowedValues = object._field.allowedValues()
+            newWidget.height = object.Char__height
+
+        return newWidget
+
+
+    # 
---------------------------------------------------------------------------
+    # Update the list of allowed values on a Combo widget if neccessary
+    # 
---------------------------------------------------------------------------
+
+    def _updateChoices (self, widget, gfObject):
+
+        if widget.style == 'dropdown' or \
+          widget.style == 'listbox':
+
+            if widget._origAllowedValues != gfObject._field._allowedValues:
+                (self.reverse, self.choices) = gfObject._field.allowedValues ()
+                self.choices.sort ()
+
+                widget._origAllowedValues = gfObject._field._allowedValues
+
+                # TODO: replace the following by the method widget.update()
+                if widget.style=="listbox":
+                    dhtml=build_entry_listbox(id, "%s", self.choices, 
gfObject.Char__height,
+                                           self.itemX, self.itemY, 
self.itemWidth, \
+                                           self.itemHeight)
+
+                else:
+                    dhtml=build_entry_combobox(id, "%s", self.choices, 
gfObject.Char__height,
+                                           self.itemX, self.itemY, 
self.itemWidth, \
+                                           self.itemHeight) 
+
+
+    # 
---------------------------------------------------------------------------
+    # Enable/disable this entry
+    # 
---------------------------------------------------------------------------
+
+    def _ui_enable_(self, index):
+        self.widgets[index].set_sensitive(True)
+
+    # 
---------------------------------------------------------------------------
+
+    def _ui_disable_(self, index):
+        self.widgets[index].set_sensitive(False)
+
+
+    # 
---------------------------------------------------------------------------
+    # Set the cursor position in a widget to position
+    # 
---------------------------------------------------------------------------
+
+    def _ui_set_cursor_position_ (self, index, position):
+
+        widget = self.widgets [index]
+
+        assert gDebug (6, "set_cursor_position to %s in %s [%s]" % \
+            (position, widget, index))
+
+        widget.set_cursor_pos(position)
+
+
+    # 
---------------------------------------------------------------------------
+    # set the selected area
+    # 
---------------------------------------------------------------------------
+
+    def _ui_set_selected_area_ (self, index, selection1, selection2):
+
+        assert gDebug (6, "Set Selected Area %s/%s in %s [%s]" % \
+            (selection1, selection2, self, index))
+
+        widget = self.widgets [index]
+        widget.select_region (selection1, selection2)
+        
+
+class HtmlEntryWidget(HtmlWidget):
+
+    def __repr__(self):
+        return "Html Widget: %s" % self._type
+
+    def __init__(self, parent, uidriver, type, dhtml, id):
+        self.dhtml = dhtml
+        self.value = None
+        self._type = type
+        self._parent = parent
+        self._children = []
+
+        if parent:
+            parent._children.append(self)
+
+        self._uiDriver = uidriver
+        self._id = id
+        if type=="FORM":
+            self.pno=1
+            
+    def set_cursor_pos(self, pos):
+        self._send_update(["set_cursor","%s" % self._id, pos]) 
+
+    def select_region(self, selection1, selection2):
+        self._send_update(["select_region","%s" % self._id, \
+                            [selection1, selection2]]) 
+
+    def get_html(self):
+        if self._type == "ENTRY":
+            try:
+                gfObject = self._uiDriver._WidgetToGFObj[self._id]
+                if gfObject.style == 'checkbox':
+                    if self.value:
+                        return (self.dhtml % "checked")
+                    else:
+                        return (self.dhtml % "")
+                else:
+                    return (self.dhtml % self.value)
+            except Exception,e:
+                print e
+                print self.dhtml,self.value
+                return self.dhtml
+
+
+
+configuration = {
+    'baseClass'  : UIEntry,
+    'provides'   : 'GFEntry',
+    'container'  : 0,
+  }

Added: trunk/gnue-forms/src/uidrivers/html/widgets/form.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/html/widgets/form.py 2006-11-17 16:26:24 UTC 
(rev 9047)
+++ trunk/gnue-forms/src/uidrivers/html/widgets/form.py 2006-11-20 00:24:07 UTC 
(rev 9048)
@@ -0,0 +1,215 @@
+#
+# This file is part of GNU Enterprise.
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2, or (at your option) any later version.
+#
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Copyright 2000-2006 Free Software Foundation
+#
+# FILE:
+# uidrivers/html/widgets/form.py
+#
+# DESCRIPTION:
+#
+# NOTES:
+#
+
+import string, struct
+
+from gnue.forms.uidrivers.html.widgets._base import UIHelper, HtmlWidget
+from gnue.forms.uidrivers.html.MenuBar import MenuBar
+from gnue.forms.uidrivers.html.ToolBar import ToolBar
+from gnue.forms.uidrivers.html.common import *
+
+
+class UIForm(UIHelper):
+
+    def __init__(self, event):
+        self._uiPageList=[]
+        UIHelper.__init__(self, event)
+        self.controls = []
+
+    def _create_widget(self, event, spacer):
+        object = event.object
+        #
+        # Size based upon the form definition
+        #
+
+        formWidth = int(self._form._layout.Char__width)
+        formHeight = int(self._form._layout.Char__height)
+        self._visibleSize = (formWidth*self._uiDriver.widgetWidth,
+                          formHeight*self._uiDriver.widgetHeight)
+
+        self._formSize = formSize = (formWidth*self._uiDriver.widgetWidth,
+                          formHeight*self._uiDriver.widgetHeight)
+
+        dhtml = ""
+        if self._form.style == 'dialog':
+            newWidget = HtmlWidget(event.container, self._uiDriver, 'DIALOG', 
dhtml, getNextId())
+            # FIXME: add dialogs
+        else:
+            newWidget = HtmlWidget(event.container, self._uiDriver, 'FORM', 
dhtml, getNextId())
+            
+        self.mainWindow = newWidget
+        self.mainWindow.updates = []
+
+        # Add the menu
+        if not self._form._features['GUI:MENUBAR:SUPPRESS']:
+            MenuBar(self._uiDriver, self.mainWindow, self._form)
+
+        # and the Toolbar
+        if not self._form._features['GUI:TOOLBAR:SUPPRESS']:
+            ToolBar(self._uiDriver, self.mainWindow, self._form)
+
+        dhtml = "<hr/>"
+        HtmlWidget(self.mainWindow, self._uiDriver, 'LINE', dhtml, getNextId())
+
+        self._uiDriver._htmlapp.setForm(self.mainWindow)
+        self._container = newWidget
+        return newWidget
+
+    def show(self):
+        pass
+
+    def show_modal(self):
+        pass
+
+
+    # 
---------------------------------------------------------------------------
+    # Get HTML representation of current window
+    # 
---------------------------------------------------------------------------
+
+    def get_html(self):
+        # FIXME: updates should be cleared (Enable again after fixing 
enabling/disabling of widgets
+        # self.mainWindow.updates = []
+        return self.mainWindow.get_html()
+
+    def get_updates(self):
+        updates = self.mainWindow.updates
+        self.mainWindow.updates = []
+        return updates
+
+
+    # 
---------------------------------------------------------------------------
+    # Set the forms title
+    # 
---------------------------------------------------------------------------
+
+    def _ui_set_title_(self, title):
+        self.mainWindow.set_title(title)
+
+
+    # 
---------------------------------------------------------------------------
+    # Makes the requested page visible while hiding the others
+    # 
---------------------------------------------------------------------------
+
+    def _ui_goto_page_ (self, page):
+        self._wrapper.setPage (page)
+
+
+    # 
---------------------------------------------------------------------------
+    # Show a tip in the status bar. Used by the menu.
+    # 
---------------------------------------------------------------------------
+
+    def _show_tip (self, tip):
+        pass
+        # FIXME: has to be implemented on client side
+
+
+    # 
---------------------------------------------------------------------------
+    # User feedback functions
+    # 
---------------------------------------------------------------------------
+
+    def _ui_begin_wait_(self):
+        self.mainWindow.updates.append(["wait","",True])
+
+    # 
---------------------------------------------------------------------------
+
+    def _ui_end_wait_(self):
+        self.mainWindow.updates.append(["wait","",False])
+
+    # 
---------------------------------------------------------------------------
+
+    def _ui_beep_(self):
+        self.mainWindow.updates.append(["beep","",""])
+
+    # 
---------------------------------------------------------------------------
+
+    def _ui_update_status_ (self, tip, record_status, insert_status,
+            record_number, record_count, page_number, page_count):
+
+        # create and update status bar
+        pass
+
+
+    # 
---------------------------------------------------------------------------
+    # create a modal message box
+    # 
---------------------------------------------------------------------------
+
+    def _ui_show_message_(self, message, kind, title, cancel):
+        """
+        This function creates a message box of a given kind and returns True, 
False
+        or None depending on the button pressed.
+
+        @param message: the text of the messagebox
+        @param kind: type of the message box. Valid types are 'Info', 
'Warning',
+            'Question', 'Error'
+        @param title: title of the message box
+        @param cancel: If True a cancel button will be added to the dialog
+        @return: True if the Ok-, Close-, or Yes-button was pressed, False if 
the
+            No-button was pressed or None if the Cancel-button was pressed.
+        """
+        # FIXME: Display dialog box
+        self.mainWindow.updates.append(["alert","",message])
+        return False
+
+
+    # 
---------------------------------------------------------------------------
+    # Display an about box
+    # 
---------------------------------------------------------------------------
+
+    def _ui_show_about_(self, name, version, author, description):
+        message=u_("""GNUe Forms:
+    Name: %s
+    Version: %s
+    Author: %s
+    Description: %s
+        """) % (name, version, author, description)
+        self.mainWindow.updates.append(["alert","",message])
+
+    # 
---------------------------------------------------------------------------
+    # Print form screenshot
+    # 
---------------------------------------------------------------------------
+
+    def _ui_printout_(self, title, subtitle, user):
+        message = u_("Printout currently not supported")
+        self.mainWindow.updates.append(["alert","",message])
+
+
+    # 
---------------------------------------------------------------------------
+    # Close the window (actually only hide it)
+    # 
---------------------------------------------------------------------------
+
+    def _ui_close_(self):
+
+        self._visible = False
+        self.mainWindow.updates.append(["close","",""])
+        #FIXME: implement close dialog
+
+
+configuration = {
+    'baseClass'  : UIForm,
+    'provides'   : 'GFForm',
+    'container'  : 1,
+  }
\ No newline at end of file

Modified: trunk/gnue-forms/src/uidrivers/html/widgets/image.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/html/widgets/image.py        2006-11-17 
16:26:24 UTC (rev 9047)
+++ trunk/gnue-forms/src/uidrivers/html/widgets/image.py        2006-11-20 
00:24:07 UTC (rev 9048)
@@ -1,46 +1,49 @@
-#
-# This file is part of GNU Enterprise.
-#
-# GNU Enterprise is free software; you can redistribute it
-# and/or modify it under the terms of the GNU General Public
-# License as published by the Free Software Foundation; either
-# version 2, or (at your option) any later version.
-#
-# GNU Enterprise is distributed in the hope that it will be
-# useful, but WITHOUT ANY WARRANTY; without even the implied
-# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-# PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public
-# License along with program; see the file COPYING. If not,
-# write to the Free Software Foundation, Inc., 59 Temple Place
-# - Suite 330, Boston, MA 02111-1307, USA.
-#
-# Copyright 2000-2006 Free Software Foundation
-#
-# FILE:
-# uidrivers/html/widgets/image.py
-#
-# DESCRIPTION:
-#
-# NOTES:
-#
-
-from gnue.forms.uidrivers.html.widgets._base import UIHelper, HtmlWidget
-from gnue.forms.uidrivers.html.common import *
-
-class UIImage(UIHelper):
-
-  def _create_widget(self, event, spacer):
-    object = event.object
-    
-    dhtml = '<image>'
-    newWidget = HtmlWidget(event.container, self._uiDriver, 'IMAGE', dhtml, 
getNextId())
-    return newWidget
-
-
-configuration = {
-    'baseClass'  : UIImage,
-    'provides'   : 'GFImage',
-    'container'  : 0,
-    }
+#
+# This file is part of GNU Enterprise.
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2, or (at your option) any later version.
+#
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Copyright 2000-2006 Free Software Foundation
+#
+# FILE:
+# uidrivers/html/widgets/image.py
+#
+# DESCRIPTION:
+#
+# NOTES:
+#
+
+from gnue.forms.uidrivers.html.widgets._base import UIHelper, HtmlWidget
+from gnue.forms.uidrivers.html.common import getNextId
+from gnue.forms.uidrivers.html.Generator import build_image
+
+class UIImage(UIHelper):
+
+    def _create_widget(self, event, spacer):
+        object = event.object
+        id = getNextId()
+        dhtml = build_image(id, "%%s", object.Char__x*event.widgetWidth,
+                             self.itemY, self.itemWidth, self.itemHeight)
+        
+        newWidget = HtmlWidget(event.container, self._uiDriver, 'IMAGE', 
dhtml, id)
+        return newWidget
+
+
+configuration = {
+    'baseClass'  : UIImage,
+    'provides'   : 'GFImage',
+    'container'  : 0,
+    }

Modified: trunk/gnue-forms/src/uidrivers/html/widgets/label.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/html/widgets/label.py        2006-11-17 
16:26:24 UTC (rev 9047)
+++ trunk/gnue-forms/src/uidrivers/html/widgets/label.py        2006-11-20 
00:24:07 UTC (rev 9048)
@@ -1,55 +1,52 @@
-#
-# This file is part of GNU Enterprise.
-#
-# GNU Enterprise is free software; you can redistribute it
-# and/or modify it under the terms of the GNU General Public
-# License as published by the Free Software Foundation; either
-# version 2, or (at your option) any later version.
-#
-# GNU Enterprise is distributed in the hope that it will be
-# useful, but WITHOUT ANY WARRANTY; without even the implied
-# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-# PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public
-# License along with program; see the file COPYING. If not,
-# write to the Free Software Foundation, Inc., 59 Temple Place
-# - Suite 330, Boston, MA 02111-1307, USA.
-#
-# Copyright 2000-2006 Free Software Foundation
-#
-# FILE:
-# uidrivers/html/widgets/label.py
-#
-# DESCRIPTION:
-#
-# NOTES:
-#
-
-from gnue.forms.uidrivers.html.widgets._base import UIHelper, HtmlWidget
-from gnue.forms.uidrivers.html.common import *
-
-
-class UILabel(UIHelper):
-
-  def _create_widget(self, event, spacer):
-    object = event.object
-    
-    dhtml = '<div style="position:absolute;\
-              top: %spx; left: %spx; width: %spx; height: %spx;\
-              id="lblGnue_name_label">%s</div>' % \
-              (object.Char__y*event.widgetHeight + FIX,\
-               object.Char__x*event.widgetWidth,\
-               self.itemWidth,\
-               self.itemHeight-4,\
-               textEncode(object.text))
-
-    newWidget = HtmlWidget(event.container, self._uiDriver, 'LABEL', dhtml, 
getNextId())
-    
-    return newWidget
-  
-configuration = {
-    'baseClass'  : UILabel,
-    'provides'   : 'GFLabel',
-    'container'  : 0,
-    }
+#
+# This file is part of GNU Enterprise.
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2, or (at your option) any later version.
+#
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Copyright 2000-2006 Free Software Foundation
+#
+# FILE:
+# uidrivers/html/widgets/label.py
+#
+# DESCRIPTION:
+#
+# NOTES:
+#
+
+from gnue.forms.uidrivers.html.widgets._base import UIHelper, HtmlWidget
+from gnue.forms.uidrivers.html.Generator import build_label
+from gnue.forms.uidrivers.html.common import getNextId, textEncode
+
+
+class UILabel(UIHelper):
+
+    def _create_widget(self, event, spacer):
+        object = event.object
+        id = getNextId()
+        
+        dhtml = build_label(id, textEncode(object.text), \
+                            object.Char__x*event.widgetWidth, self.itemY,\
+                            self.itemWidth, self.itemHeight)
+        
+        newWidget = HtmlWidget(event.container, self._uiDriver, 'LABEL', 
dhtml, id)
+
+        return newWidget
+
+configuration = {
+    'baseClass'  : UILabel,
+    'provides'   : 'GFLabel',
+    'container'  : 0,
+    }

Modified: trunk/gnue-forms/src/uidrivers/html/widgets/page.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/html/widgets/page.py 2006-11-17 16:26:24 UTC 
(rev 9047)
+++ trunk/gnue-forms/src/uidrivers/html/widgets/page.py 2006-11-20 00:24:07 UTC 
(rev 9048)
@@ -1,47 +1,48 @@
-#
-# This file is part of GNU Enterprise.
-#
-# GNU Enterprise is free software; you can redistribute it
-# and/or modify it under the terms of the GNU General Public
-# License as published by the Free Software Foundation; either
-# version 2, or (at your option) any later version.
-#
-# GNU Enterprise is distributed in the hope that it will be
-# useful, but WITHOUT ANY WARRANTY; without even the implied
-# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-# PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public
-# License along with program; see the file COPYING. If not,
-# write to the Free Software Foundation, Inc., 59 Temple Place
-# - Suite 330, Boston, MA 02111-1307, USA.
-#
-# Copyright 2000-2006 Free Software Foundation
-#
-# FILE:
-# uidrivers/html/widgets/page.py
-#
-# DESCRIPTION:
-#
-# NOTES:
-#
-
-from gnue.forms.uidrivers.html.widgets._base import UIHelper, HtmlWidget
-from gnue.forms.uidrivers.html.common import *
-
-class UIPage(UIHelper):
-  def _create_widget(self, event, spacer):
-
-    object = event.object
-
-    dhtml = '<page>'
-    newWidget = HtmlWidget(event.container, self._uiDriver, 'PAGE', dhtml, 
getNextId())
-    self._container = newWidget
-    return newWidget
-
-
-configuration = {
-    'baseClass'  : UIPage,
-    'provides'   : 'GFPage',
-    'container'  : 1,
-    }
+#
+# This file is part of GNU Enterprise.
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2, or (at your option) any later version.
+#
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Copyright 2000-2006 Free Software Foundation
+#
+# FILE:
+# uidrivers/html/widgets/page.py
+#
+# DESCRIPTION:
+#
+# NOTES:
+#
+
+from gnue.forms.uidrivers.html.widgets._base import UIHelper, HtmlWidget
+from gnue.forms.uidrivers.html.common import *
+
+class UIPage(UIHelper):
+    def _create_widget(self, event, spacer):
+
+        object = event.object
+        id = getNextId()        
+        dhtml = ''
+        
+        self._container = HtmlWidget(event.container, self._uiDriver, \
+                                     'PAGE', dhtml, id)
+        
+        return self._container
+
+configuration = {
+    'baseClass'  : UIPage,
+    'provides'   : 'GFPage',
+    'container'  : 1,
+    }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]