Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix examples, infohierarchy and employeeadmin

git-svn-id: https://pyjamas.svn.sourceforge.net/svnroot/pyjamas/trunk@1164 7a2bd370-bda8-463c-979e-2900ccfb811e
  • Loading branch information...
commit f82251d44eb45f5dc5c6848b14403ba5b92f785f 1 parent 05226e8
lkcl authored
View
0  examples/employeeadmin/enumerate.py → examples/employeeadmin/consts.py
File renamed without changes
View
14 examples/employeeadmin/model.py
@@ -6,7 +6,7 @@
"""
import puremvc.patterns.proxy
-import enumerate, vo, EmployeeAdmin
+import consts, vo, EmployeeAdmin
class UserProxy(puremvc.patterns.proxy.Proxy):
@@ -14,9 +14,9 @@ class UserProxy(puremvc.patterns.proxy.Proxy):
def __init__(self):
super(UserProxy, self).__init__(UserProxy.NAME, [])
self.data = []
- self.addItem(vo.UserVO('lstooge','Larry', 'Stooge', "larry@stooges.com", 'ijk456',enumerate.DEPT_ACCT))
- self.addItem(vo.UserVO('cstooge','Curly', 'Stooge', "curly@stooges.com", 'xyz987',enumerate.DEPT_SALES))
- self.addItem(vo.UserVO('mstooge','Moe', 'Stooge', "moe@stooges.com", 'abc123',enumerate.DEPT_PLANT))
+ self.addItem(vo.UserVO('lstooge','Larry', 'Stooge', "larry@stooges.com", 'ijk456',consts.DEPT_ACCT))
+ self.addItem(vo.UserVO('cstooge','Curly', 'Stooge', "curly@stooges.com", 'xyz987',consts.DEPT_SALES))
+ self.addItem(vo.UserVO('mstooge','Moe', 'Stooge', "moe@stooges.com", 'abc123',consts.DEPT_PLANT))
def getUsers(self):
return self.data
@@ -42,9 +42,9 @@ class RoleProxy(puremvc.patterns.proxy.Proxy):
def __init__(self):
super(RoleProxy, self).__init__(RoleProxy.NAME, [])
self.data = []
- self.addItem(vo.RoleVO('lstooge', [enumerate.ROLE_PAYROLL,enumerate.ROLE_EMP_BENEFITS]))
- self.addItem(vo.RoleVO('cstooge', [enumerate.ROLE_ACCT_PAY,enumerate.ROLE_ACCT_RCV,enumerate.ROLE_GEN_LEDGER]))
- self.addItem(vo.RoleVO('mstooge', [enumerate.ROLE_INVENTORY,enumerate.ROLE_PRODUCTION,enumerate.ROLE_SALES,enumerate.ROLE_SHIPPING]))
+ self.addItem(vo.RoleVO('lstooge', [consts.ROLE_PAYROLL,consts.ROLE_EMP_BENEFITS]))
+ self.addItem(vo.RoleVO('cstooge', [consts.ROLE_ACCT_PAY,consts.ROLE_ACCT_RCV,consts.ROLE_GEN_LEDGER]))
+ self.addItem(vo.RoleVO('mstooge', [consts.ROLE_INVENTORY,consts.ROLE_PRODUCTION,consts.ROLE_SALES,consts.ROLE_SHIPPING]))
def getRoles(self):
print self.data
View
6 examples/employeeadmin/view.py
@@ -8,7 +8,7 @@
import puremvc.interfaces
import puremvc.patterns.mediator
-import model, enumerate, EmployeeAdmin, vo
+import model, consts, EmployeeAdmin, vo
from pyjamas.Window import alert
@@ -44,7 +44,7 @@ def __init__(self, viewComponent):
self.viewComponent.mediator = self
self.userProxy = self.facade.retrieveProxy(model.UserProxy.NAME)
- self.viewComponent.updateDepartmentCombo(enumerate.DeptList, enumerate.DEPT_NONE_SELECTED)
+ self.viewComponent.updateDepartmentCombo(consts.DeptList, consts.DEPT_NONE_SELECTED)
def listNotificationInterests(self):
return [
@@ -192,7 +192,7 @@ def __init__(self, viewComponent):
self.viewComponent.mediator = self
self.roleProxy = self.facade.retrieveProxy(model.RoleProxy.NAME)
- self.viewComponent.updateRoleCombo(enumerate.RoleList, enumerate.ROLE_NONE_SELECTED)
+ self.viewComponent.updateRoleCombo(consts.RoleList, consts.ROLE_NONE_SELECTED)
def getRolePanel(self):
return viewComponent
View
7 examples/infohierarchy/InfoDirectory.py
@@ -1,3 +1,5 @@
+import pyjd
+
from pyjamas.ui.RootPanel import RootPanel
from pyjamas.ui.HTML import HTML
from pyjamas.ui.Label import Label
@@ -353,7 +355,7 @@ def onModuleLoad(self):
self.horzpanel1 = HorizontalPanel()
self.horzpanel1.setSize("100%", "100%")
- self.horzpanel1.setBorderWidth("1px")
+ self.horzpanel1.setBorderWidth(1)
self.horzpanel1.setSpacing("10px")
self.rp = RightPanel()
@@ -475,5 +477,8 @@ def __init__(self):
if __name__ == '__main__':
+ pyjd.setup("http://127.0.0.1/examples/infohierarchy/public/InfoDirectory.html")
app = InfoDirectory()
app.onModuleLoad()
+ pyjd.run()
+
View
3  examples/infohierarchy/Trees.py
@@ -21,6 +21,9 @@ def __init__(self):
def protoise_tree(self, data):
+ if not data:
+ return []
+
res = []
for i in range(len(data)):
d = data[i]
View
36 library/pyjamas/HTTPRequest.py
@@ -73,16 +73,33 @@ def onReadyStateChange(self, xmlHttp, event, ignorearg):
else :
localHandler.onError(responseText, status)
+ def _convertUrlToAbsolute(self, url):
+
+ uri = pygwt.getModuleBaseURL()
+ if url[0] == '/':
+ # url is /somewhere.
+ sep = uri.find('://')
+ if not uri.startswith('file://'):
+
+ slash = uri.find('/', sep+3)
+ if slash > 0:
+ uri = uri[:slash]
+
+ return "%s%s" % (uri, url)
+
+ else:
+ if url[:7] != 'file://' and url[:7] != 'http://' and \
+ url[:8] != 'https://':
+ slash = uri.rfind('/')
+ return uri[:slash+1] + url
+
+ return url
+
def asyncPostImpl(self, user, pwd, url, postData, handler,
return_xml, content_type):
mf = get_main_frame()
xmlHttp = self.doCreateXmlHTTPRequest()
- if url[0] != '/':
- uri = pygwt.getModuleBaseURL()
- if url[:7] != 'file://' and url[:7] != 'http://' and \
- url[:8] != 'https://':
- slash = uri.rfind('/')
- url = uri[:slash+1] + url
+ url = self._convertUrlToAbsolute(url)
print "xmlHttp", user, pwd, url, postData, handler, dir(xmlHttp)
#try :
if mf.platform == 'webkit' or mf.platform == 'mshtml':
@@ -119,12 +136,7 @@ def asyncPostImpl(self, user, pwd, url, postData, handler,
def asyncGetImpl(self, user, pwd, url, handler):
mf = get_main_frame()
- if url[0] != '/':
- uri = pygwt.getModuleBaseURL()
- if url[:7] != 'file://' and url[:7] != 'http://' and \
- url[:8] != 'https://':
- slash = uri.rfind('/')
- url = uri[:slash+1] + url
+ url = self._convertUrlToAbsolute(url)
xmlHttp = self.doCreateXmlHTTPRequest()
print dir(xmlHttp)
print user, pwd, url, handler
Please sign in to comment.
Something went wrong with that request. Please try again.