changeset 471:9b6ba709da88

added header element ids: userhome, userprefs, login, logout imported from: moin--main--1.5--patch-475
author Thomas Waldmann <tw@waldmann-edv.de>
date Mon, 13 Mar 2006 20:05:27 +0000
parents 957d482215ac
children faeaf423ef69
files ChangeLog MoinMoin/theme/__init__.py MoinMoin/wikiutil.py
diffstat 3 files changed, 23 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Mar 13 19:31:36 2006 +0000
+++ b/ChangeLog	Mon Mar 13 20:05:27 2006 +0000
@@ -2,6 +2,20 @@
 # arch-tag: automatic-ChangeLog--arch@arch.thinkmo.de--2003-archives/moin--main--1.5
 #
 
+2006-03-13 21:05:27 GMT	Thomas Waldmann <tw@waldmann-edv.de>	patch-475
+
+    Summary:
+      added header element ids: userhome, userprefs, login, logout
+    Revision:
+      moin--main--1.5--patch-475
+
+    added header element ids: userhome, userprefs, login, logout
+    
+
+    modified files:
+     ChangeLog MoinMoin/theme/__init__.py MoinMoin/wikiutil.py
+
+
 2006-03-13 20:31:36 GMT	Thomas Waldmann <tw@waldmann-edv.de>	patch-474
 
     Summary:
--- a/MoinMoin/theme/__init__.py	Mon Mar 13 19:31:36 2006 +0000
+++ b/MoinMoin/theme/__init__.py	Mon Mar 13 20:05:27 2006 +0000
@@ -215,24 +215,24 @@
             if not aliasname:
                 aliasname = name
             title = "%s @ %s" % (aliasname, interwiki[0])
-            homelink = (request.formatter.interwikilink(1, title=title, *interwiki) +
+            homelink = (request.formatter.interwikilink(1, title=title, id="userhome", *interwiki) +
                         request.formatter.text(name) +
                         request.formatter.interwikilink(0))
             userlinks.append(homelink)        
             # Set pref page to localized Preferences page
             title = preferencesPage.split_title(request)
-            userlinks.append(preferencesPage.link_to(request, text=title))
+            userlinks.append(preferencesPage.link_to(request, text=title, id="userprefs"))
             
         if request.cfg.show_login:
             if request.user.valid:
                 userlinks.append("""\
-<form action="" method="POST">
+<form id="logout" action="" method="POST">
 <input type="hidden" name="action" value="userform">
 <input type="submit" name="logout" value="%(logout)s">
 </form>
 """ % { 'logout': _('Logout') })
             else:
-                userlinks.append(preferencesPage.link_to(request, text=_("Login")))
+                userlinks.append(preferencesPage.link_to(request, text=_("Login"), id="login"))
 
         userlinks = [u'<li>%s</li>' % link for link in userlinks]
         html = u'<ul id="username">%s</ul>' % ''.join(userlinks)
--- a/MoinMoin/wikiutil.py	Mon Mar 13 19:31:36 2006 +0000
+++ b/MoinMoin/wikiutil.py	Mon Mar 13 20:05:27 2006 +0000
@@ -988,6 +988,8 @@
 def link_tag(request, params, text=None, formatter=None, on=None, **kw):
     """ Create a link.
 
+    TODO: cleanup css_class
+
     @param request: the request object
     @param params: parameter string appended to the URL after the scriptname/
     @param text: text / inner part of the <a>...</a> link - does NOT get
@@ -999,6 +1001,7 @@
     @return: formatted link tag
     """
     css_class = kw.get('css_class', None)
+    id = kw.get('id', None)
     if text is None:
         text = params # default
     if formatter:
@@ -1016,6 +1019,8 @@
         attrs += ' ' + kw['attrs']
     if css_class:
         attrs += ' class="%s"' % css_class
+    if id:
+        attrs += ' id="%s"' % id
     result = '<a%s href="%s/%s">' % (attrs, request.getScriptname(), params)
     if on:
         return result