Fossil SCM

Fix some permissions problems on wiki pages. Always show "Empty Page" text for wiki pages that contain no text.

drh 2010-03-18 14:11 trunk
Commit f442eb2ae2e0ff8823dd696f26b034fd57e11deb
1 file changed +9 -4
+9 -4
--- src/wiki.c
+++ src/wiki.c
@@ -179,21 +179,22 @@
179179
blob_zero(&m.content);
180180
if( rid ){
181181
Blob content;
182182
content_get(rid, &content);
183183
manifest_parse(&m, &content);
184
- if( m.type==CFTYPE_WIKI ){
185
- zBody = m.zWiki;
184
+ if( m.type==CFTYPE_WIKI && m.zWiki ){
185
+ while( isspace(m.zWiki[0]) ) m.zWiki++;
186
+ if( m.zWiki[0] ) zBody = m.zWiki;
186187
}
187188
}
188189
}
189190
if( !g.isHome ){
190191
if( (rid && g.okWrWiki) || (!rid && g.okNewWiki) ){
191192
style_submenu_element("Edit", "Edit Wiki Page", "%s/wikiedit?name=%T",
192193
g.zTop, zPageName);
193194
}
194
- if( rid && g.okWrWiki && g.okAttach ){
195
+ if( rid && g.okApndWiki && g.okAttach ){
195196
style_submenu_element("Attach", "Add An Attachment",
196197
"%s/attachadd?page=%T&from=%s/wiki%%3fname=%T",
197198
g.zTop, zPageName, g.zTop, zPageName);
198199
}
199200
if( rid && g.okApndWiki ){
@@ -223,11 +224,15 @@
223224
if( cnt==0 ){
224225
@ <hr><h2>Attachments:</h2>
225226
@ <ul>
226227
}
227228
cnt++;
228
- @ <li><a href="%s(g.zTop)/attachview?page=%s(zPageName)&file=%t(zFile)">
229
+ if( g.okHistory ){
230
+ @ <li><a href="%s(g.zTop)/attachview?page=%s(zPageName)&file=%t(zFile)">
231
+ }else{
232
+ @ <li>
233
+ }
229234
@ %h(zFile)</a> add by %h(zUser) on
230235
hyperlink_to_date(zDate, ".");
231236
if( g.okWrWiki && g.okAttach ){
232237
@ [<a href="%s(g.zTop)/attachdelete?page=%s(zPageName)&file=%t(zFile)&from=%s(g.zTop)/wiki%%3fname=%s(zPageName)">delete</a>]
233238
}
234239
--- src/wiki.c
+++ src/wiki.c
@@ -179,21 +179,22 @@
179 blob_zero(&m.content);
180 if( rid ){
181 Blob content;
182 content_get(rid, &content);
183 manifest_parse(&m, &content);
184 if( m.type==CFTYPE_WIKI ){
185 zBody = m.zWiki;
 
186 }
187 }
188 }
189 if( !g.isHome ){
190 if( (rid && g.okWrWiki) || (!rid && g.okNewWiki) ){
191 style_submenu_element("Edit", "Edit Wiki Page", "%s/wikiedit?name=%T",
192 g.zTop, zPageName);
193 }
194 if( rid && g.okWrWiki && g.okAttach ){
195 style_submenu_element("Attach", "Add An Attachment",
196 "%s/attachadd?page=%T&from=%s/wiki%%3fname=%T",
197 g.zTop, zPageName, g.zTop, zPageName);
198 }
199 if( rid && g.okApndWiki ){
@@ -223,11 +224,15 @@
223 if( cnt==0 ){
224 @ <hr><h2>Attachments:</h2>
225 @ <ul>
226 }
227 cnt++;
228 @ <li><a href="%s(g.zTop)/attachview?page=%s(zPageName)&file=%t(zFile)">
 
 
 
 
229 @ %h(zFile)</a> add by %h(zUser) on
230 hyperlink_to_date(zDate, ".");
231 if( g.okWrWiki && g.okAttach ){
232 @ [<a href="%s(g.zTop)/attachdelete?page=%s(zPageName)&file=%t(zFile)&from=%s(g.zTop)/wiki%%3fname=%s(zPageName)">delete</a>]
233 }
234
--- src/wiki.c
+++ src/wiki.c
@@ -179,21 +179,22 @@
179 blob_zero(&m.content);
180 if( rid ){
181 Blob content;
182 content_get(rid, &content);
183 manifest_parse(&m, &content);
184 if( m.type==CFTYPE_WIKI && m.zWiki ){
185 while( isspace(m.zWiki[0]) ) m.zWiki++;
186 if( m.zWiki[0] ) zBody = m.zWiki;
187 }
188 }
189 }
190 if( !g.isHome ){
191 if( (rid && g.okWrWiki) || (!rid && g.okNewWiki) ){
192 style_submenu_element("Edit", "Edit Wiki Page", "%s/wikiedit?name=%T",
193 g.zTop, zPageName);
194 }
195 if( rid && g.okApndWiki && g.okAttach ){
196 style_submenu_element("Attach", "Add An Attachment",
197 "%s/attachadd?page=%T&from=%s/wiki%%3fname=%T",
198 g.zTop, zPageName, g.zTop, zPageName);
199 }
200 if( rid && g.okApndWiki ){
@@ -223,11 +224,15 @@
224 if( cnt==0 ){
225 @ <hr><h2>Attachments:</h2>
226 @ <ul>
227 }
228 cnt++;
229 if( g.okHistory ){
230 @ <li><a href="%s(g.zTop)/attachview?page=%s(zPageName)&file=%t(zFile)">
231 }else{
232 @ <li>
233 }
234 @ %h(zFile)</a> add by %h(zUser) on
235 hyperlink_to_date(zDate, ".");
236 if( g.okWrWiki && g.okAttach ){
237 @ [<a href="%s(g.zTop)/attachdelete?page=%s(zPageName)&file=%t(zFile)&from=%s(g.zTop)/wiki%%3fname=%s(zPageName)">delete</a>]
238 }
239

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button