Fossil
Check-in [f442eb2ae2]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview

SHA1 Hash:f442eb2ae2e0ff8823dd696f26b034fd57e11deb
Date: 2010-03-18 14:11:20
User: drh
Comment:Fix some permissions problems on wiki pages. Always show "Empty Page" text for wiki pages that contain no text.

Tags And Properties
Changes
[hide diffs]

Changes to src/wiki.c

@@ -179,21 +179,22 @@
     blob_zero(&m.content);
     if( rid ){
       Blob content;
       content_get(rid, &content);
       manifest_parse(&m, &content);
-      if( m.type==CFTYPE_WIKI ){
-        zBody = m.zWiki;
+      if( m.type==CFTYPE_WIKI && m.zWiki ){
+        while( isspace(m.zWiki[0]) ) m.zWiki++;
+        if( m.zWiki[0] ) zBody = m.zWiki;
       }
     }
   }
   if( !g.isHome ){
     if( (rid && g.okWrWiki) || (!rid && g.okNewWiki) ){
       style_submenu_element("Edit", "Edit Wiki Page", "%s/wikiedit?name=%T",
            g.zTop, zPageName);
     }
-    if( rid && g.okWrWiki && g.okAttach ){
+    if( rid && g.okApndWiki && g.okAttach ){
       style_submenu_element("Attach", "Add An Attachment",
            "%s/attachadd?page=%T&from=%s/wiki%%3fname=%T",
            g.zTop, zPageName, g.zTop, zPageName);
     }
     if( rid && g.okApndWiki ){
@@ -223,11 +224,15 @@
     if( cnt==0 ){
       @ <hr><h2>Attachments:</h2>
       @ <ul>
     }
     cnt++;
-    @ <li><a href="%s(g.zTop)/attachview?page=%s(zPageName)&file=%t(zFile)">
+    if( g.okHistory ){
+      @ <li><a href="%s(g.zTop)/attachview?page=%s(zPageName)&file=%t(zFile)">
+    }else{
+      @ <li>
+    }
     @ %h(zFile)</a> add by %h(zUser) on
     hyperlink_to_date(zDate, ".");
     if( g.okWrWiki && g.okAttach ){
       @ [<a href="%s(g.zTop)/attachdelete?page=%s(zPageName)&file=%t(zFile)&from=%s(g.zTop)/wiki%%3fname=%s(zPageName)">delete</a>]
     }