Attachment 'quicklinksmenu.patch'
Download 1 diff -ur moin-1.5.0rc1.orig/MoinMoin/theme/__init__.py moin-1.5.0rc1/MoinMoin/theme/__init__.py
2 --- moin-1.5.0rc1.orig/MoinMoin/theme/__init__.py 2005-12-11 22:04:10.000000000 +0100
3 +++ moin-1.5.0rc1/MoinMoin/theme/__init__.py 2006-01-07 22:02:03.000000000 +0100
4 @@ -227,8 +227,10 @@
5 if request.user.valid:
6 userlinks.append("""\
7 <form action="" method="POST">
8 +<div>
9 <input type="hidden" name="action" value="userform">
10 <input type="submit" name="logout" value="%(logout)s">
11 +</div>
12 </form>
13 """ % { 'logout': _('Logout') })
14 else:
15 @@ -359,28 +361,14 @@
16 current = d['page_name']
17
18 # Process config navi_bar
19 - if request.cfg.navi_bar:
20 - for text in request.cfg.navi_bar:
21 - pagename, link = self.splitNavilink(text)
22 - if pagename == current:
23 - cls = 'wikilink current'
24 - else:
25 - cls = 'wikilink'
26 - items.append(item % (cls, link))
27 - found[pagename] = 1
28 + (items_found, pages_found) = self.config_navibar(d)
29 + items.extend([item % (i[2], i[0]) for i in items_found])
30 + found.update(pages_found)
31
32 # Add user links to wiki links, eliminating duplicates.
33 - userlinks = request.user.getQuickLinks()
34 - for text in userlinks:
35 - # Split text without localization, user knows what he wants
36 - pagename, link = self.splitNavilink(text, localize=0)
37 - if not pagename in found:
38 - if pagename == current:
39 - cls = 'userlink current'
40 - else:
41 - cls = 'userlink'
42 - items.append(item % (cls, link))
43 - found[pagename] = 1
44 + (items_found, pages_found) = self.user_navibar(d)
45 + items.extend([item % (i[2], i[0]) for i in items_found])
46 + found.update(pages_found)
47
48 # Add current page at end
49 if not current in found:
50 @@ -399,6 +387,57 @@
51 ''' % items
52 return html
53
54 + def config_navibar(self,d):
55 + """ Get the links from the configfile for the navibar
56 +
57 + @param d: parameter dictionary
58 + @rtype: unicode
59 + @return: list with navibar items from config, dictionary with found page
60 + """
61 + navi_bar = self.request.cfg.navi_bar
62 + found = {} # pages we found. prevent duplicates
63 + items = [] # navibar items
64 + current = d['page_name']
65 +
66 + # Process config navi_bar
67 + if navi_bar:
68 + for text in navi_bar:
69 + pagename, link = self.splitNavilink(text)
70 + if pagename == current:
71 + cls = 'wikilink current'
72 + else:
73 + cls = 'wikilink'
74 + items.append((link, pagename, cls))
75 + found[pagename] = 1
76 +
77 + return items, found
78 +
79 + def user_navibar(self,d):
80 + """ Get the quick links for the navibar
81 +
82 + @param d: parameter dictionary
83 + @rtype: unicode
84 + @return: list with navibar items, dictionary with found page
85 + """
86 + found = {} # pages we found. prevent duplicates
87 + items = [] # navibar items
88 + current = d['page_name']
89 +
90 + # Add user links to wiki links, eliminating duplicates.
91 + userlinks = self.request.user.getQuickLinks()
92 + for text in userlinks:
93 + # Split text without localization, user knows what he wants
94 + pagename, link = self.splitNavilink(text, localize=0)
95 + if not pagename in found:
96 + if pagename == current:
97 + cls = 'userlink current'
98 + else:
99 + cls = 'userlink'
100 + items.append((link, pagename, cls))
101 + found[pagename] = 1
102 +
103 + return (items, found)
104 +
105 def get_icon(self, icon):
106 """ Return icon data from self.icons
107
108 @@ -759,11 +798,11 @@
109 }
110 }
111
112 -function actionsMenuInit(title) {
113 - // Initialize action menu
114 +function menuInit(menu, title) {
115 + // Initialize a menu
116 for (i = 0; i < document.forms.length; i++) {
117 var form = document.forms[i];
118 - if (form.className == 'actionsmenu') {
119 + if (form.className == menu) {
120 // Check if this form needs update
121 var div = form.getElementsByTagName('div')[0];
122 var label = div.getElementsByTagName('label')[0];
123 @@ -778,11 +817,22 @@
124 item.appendChild(document.createTextNode(title));
125 item.value = 'show';
126 select.insertBefore(item, select.options[0]);
127 - select.selectedIndex = 0;
128 + // If there is no options with the selected attribute, we
129 + // don't want to select the newly added first item.
130 + // (We take a shortcut and do not loop over every item!)
131 + if (!select.options[select.selectedIndex].defaultSelected)
132 + select.selectedIndex = 0;
133 }
134 }
135 }
136 }
137 +
138 +function actionsMenuInit(title) {
139 + // Initialize action menu
140 + // This function is replaced by menuInit(), which can initialize
141 + // any menu. It remains here for backward compatibility.
142 + menuInit('actionsmenu', title);
143 +}
144 //-->
145 </script>
146 """ % {
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.