diff -r d0cb8fde4957 -r 8d69ef5f086a web/views/tabs.py --- a/web/views/tabs.py Mon Aug 09 18:48:32 2010 +0200 +++ b/web/views/tabs.py Tue Aug 10 14:16:12 2010 +0200 @@ -55,18 +55,20 @@ urlparams['rql'] = uilib.rql_for_eid(eid) elif rset: urlparams['rql'] = rset.printable_rql() + if tabid is None: + tabid = uilib.domid(vid) w(u'
' % ( - tabid or vid, xml_escape(self._cw.build_url('json', **urlparams)))) + tabid, xml_escape(self._cw.build_url('json', **urlparams)))) if show_spinbox: w(u'%s' - % (tabid or vid, self._cw._('(loading ...)'))) + % (tabid, self._cw._('(loading ...)'))) else: - w(u'
' % (tabid or vid)) + w(u'
' % tabid) w(u'' - % (tabid or vid, xml_escape(self._cw.build_url(**urlparams)), xml_escape('%s (%s)') % - (tabid or vid, self._cw._('follow this link if javascript is deactivated')))) + % (tabid, xml_escape(self._cw.build_url(**urlparams)), xml_escape('%s (%s)') % + (tabid, self._cw._('follow this link if javascript is deactivated')))) w(u'
') - self._prepare_bindings(tabid or vid, reloadable) + self._prepare_bindings(tabid, reloadable) def forceview(self, vid): """trigger an event that will force immediate loading of the view @@ -91,15 +93,16 @@ cookiename = self.cookie_name activetab = cookies.get(cookiename) if activetab is None: - cookies[cookiename] = default + domid = uilib.domid(default) + cookies[cookiename] = domid self._cw.set_cookie(cookies, cookiename) - return default + return domid return activetab.value def prune_tabs(self, tabs, default_tab): selected_tabs = [] may_be_active_tab = self.active_tab(default_tab) - active_tab = default_tab + active_tab = uilib.domid(default_tab) viewsvreg = self._cw.vreg['views'] for tab in tabs: try: @@ -109,13 +112,14 @@ tabid, tabkwargs = tab, {} tabkwargs.setdefault('rset', self.cw_rset) vid = tabkwargs.get('vid', tabid) + domid = uilib.domid(tabid) try: viewsvreg.select(vid, self._cw, **tabkwargs) - selected_tabs.append((tabid, tabkwargs)) except NoSelectableObject: continue - if tabid == may_be_active_tab: - active_tab = tabid + selected_tabs.append((tabid, domid, tabkwargs)) + if domid == may_be_active_tab: + active_tab = domid return selected_tabs, active_tab def render_tabs(self, tabs, default, entity=None): @@ -135,21 +139,21 @@ w(u'
' % uid) w(u'') w(u'
') - for tabid, tabkwargs in tabs: - w(u'
' % tabid) - tabkwargs.setdefault('tabid', tabid) + for tabid, domid, tabkwargs in tabs: + w(u'
' % domid) + tabkwargs.setdefault('tabid', domid) tabkwargs.setdefault('vid', tabid) tabkwargs.setdefault('rset', self.cw_rset) self.lazyview(**tabkwargs) @@ -159,9 +163,9 @@ # XXX make work history: true self._cw.add_onload(u""" jQuery('#entity-tabs-%(eeid)s > ul').tabs( { selected: %(tabindex)s }); - set_tab('%(vid)s', '%(cookiename)s'); + set_tab('%(domid)s', '%(cookiename)s'); """ % {'tabindex' : active_tab_idx, - 'vid' : active_tab, + 'domid' : active_tab, 'eeid' : (entity and entity.eid or uid), 'cookiename' : self.cookie_name})