Author: jmorliaguet Date: Sat Feb 18 16:26:42 2006 New Revision: 2416 Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/browser.py cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/cpsskins_treeview.pt Log:
- we only store the tree state in a cookie (not the entire tree data) now both the server and the client have access to the tree state information: the server will use the information to filter out unwanted nodes in getTreeData() Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/browser.py ============================================================================== --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/browser.py (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/browser.py Sat Feb 18 16:26:42 2006 @@ -1,4 +1,6 @@ +from urllib import unquote + from zope.app.publisher.browser import BrowserView from cpsskins import minjson as json @@ -18,9 +20,19 @@ class Views(BrowserView): def setTreeData(self, data): - print data + data = json.read(data) return json.write(data) def getTreeData(self): + + print self._getLocalStorageData(1) + + return json.write(data) + # TODO: moves this to an API + def _getLocalStorageData(self, id): + value = self.request.cookies.get('cpsskins_local_storage_%s' % id) + if value is not None: + return json.read(unquote(value)) + return None Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/cpsskins_treeview.pt ============================================================================== --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/cpsskins_treeview.pt (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/cpsskins_treeview.pt Sat Feb 18 16:26:42 2006 @@ -30,19 +30,17 @@ function openContainer(event) { var target = Event.element(event); var nodeid = target.getAttribute("nodeid"); - var model = CPSSkins.getModelById("tree"); - var state_data = model.getData(); + var state_data = CPSSkins.getModelById("tree-state").getData(); state_data['state'][nodeid] = "open"; - model.setData(state_data); + CPSSkins.getModelById("tree").setData(state_data); } function closeContainer(event) { var target = Event.element(event); var nodeid = target.getAttribute("nodeid"); - var model = CPSSkins.getModelById("tree"); - var state_data = model.getData(); + var state_data = CPSSkins.getModelById("tree-state").getData(); delete state_data['state'][nodeid]; - model.setData(state_data); + CPSSkins.getModelById("tree").setData(state_data); } CPSSkins.registerHandlers( -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins