web/hosts/wiki Makefile.in,1.8,1.9 moin_config.py,1.4,1.5 template.xml,1.9,1.10 wikiutil.py,1.1,1.2

Patrick Mauritz <[email protected]> Fri, 16 Apr 2004 19:17:41 +0000
Newsgroups gmane.comp.video.fresco.cvs
Message-ID <[email protected]>
Update of /cvs/fresco/web/hosts/wiki
In directory frida:/tmp/cvs-serv27931/hosts/wiki

Modified Files:
	Makefile.in moin_config.py template.xml wikiutil.py 
Log Message:
- adapted makefile to build a proper new-style template
- moin_config.py and wikiutil.py are more up-to-date


Index: Makefile.in
===================================================================
RCS file: /cvs/fresco/web/hosts/wiki/Makefile.in,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- Makefile.in	20 Aug 2003 11:33:56 -0000	1.8
+++ Makefile.in	16 Apr 2004 19:17:38 -0000	1.9
@@ -2,7 +2,7 @@
 
 include ../../config.mk
 
-pages	:= template.html
+pages	:= template.htmltmpl
 
 vpath %.xml $(srcdir)
 
@@ -21,5 +21,9 @@
                --stringparam title.glyph fresco_wiki.png \
                -o $@ $(topdir)/xsl/fresco.xsl $<
 
+# necessary as python doesn't like "100%" html
+%.htmltmpl: %.html
+	cat $< |sed s,%[^\(],%%,g > $@
+
 clean:
-	rm -f *.html
+	rm -f *.html *.htmltmpl

Index: moin_config.py
===================================================================
RCS file: /cvs/fresco/web/hosts/wiki/moin_config.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- moin_config.py	19 Oct 2002 18:35:15 -0000	1.4
+++ moin_config.py	16 Apr 2004 19:17:38 -0000	1.5
@@ -45,48 +45,3 @@
 # char sets (WikiNames)
 upperletters = "A-ZÀÁÂÃÄÅÆÈÉÊËÌÍÎÏÒÓÔÕÖØÙÚÛÜÝÇÐÑÞ"
 lowerletters = "0-9a-zàáâãäåæèéêëìíîïòóôõöøùúûüýÿµßçðñþ"
-
-def fillinvalues(victim,title,user,message,clear,name):
-    #appropriate string mangling
-    if string.find(name,'Info for "')>-1:
-       name=name[10:-1]
-    if string.find(name,'Diff for "')>-1:
-       name=name[10:-1]
-    if string.find(name,'Edit "')>-1:
-       name=name[6:-1]
-
-    #what about users?
-    #
-    #user contains the username, so if it needs to be somewhere,
-    #just include it there
-    usermode="Login"
-    if user!="":
-       usermode="UserPreferences"
-    
-    #now tell me what to do with messages
-    messagestr=''
-    if message!="":
-       messagestr='%s<br />%s' % (message,clear)
-
-    #string replacement
-    tmp=title.join(string.split(victim,"###title###"))
-    tmp=name.join(string.split(tmp,"###name###"))
-    tmp=usermode.join(string.split(tmp,"###userstatus###"))
-    tmp=messagestr.join(string.split(tmp,"###wikimessage###"))
-    return tmp
-
-def handlepage(part,title,user,message,clear,name):
-    #read template and get first part
-    fil=open("template.html")
-    m=string.split(fil.read(),"###content###")[part]
-    fil.close()
-    #mangle stuff
-    m=fillinvalues(m,title,user,message,clear,name)
-    #write stuff
-    print m;
-
-def printhead(title,user,message,clear,name):
-    handlepage(0,title,user,message,clear,name)
-
-def printfoot(title,user,message,clear,name):
-    handlepage(1,title,user,message,clear,name)

Index: template.xml
===================================================================
RCS file: /cvs/fresco/web/hosts/wiki/template.xml,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- template.xml	4 Nov 2002 14:52:25 -0000	1.9
+++ template.xml	16 Apr 2004 19:17:38 -0000	1.10
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="ISO-8859-1" standalone="yes" ?>
 
 <page xmlns:xlink="http://www.w3.org/1999/xlink"
-      title="Fresco Wiki" id="Wiki">
+      title="Fresco Wiki - %(title)s" id="Wiki">
   <left-area>
     <menu>
       <item title="Home" site="www" url="index.html" info="Our homepage"/>	  
@@ -13,23 +13,27 @@
       <item title="Running" site="www" url="running.html" info="Items of interest to running Fresco"/>
       <item title="Developing" site="www" url="developing.html" info="Items of interest to develop Fresco"/>
       <item title="Wiki" site="wiki" url="FrontPage" info="Our Wiki run-time sandboxy kinda database">
-        <item title="###userstatus###" url="UserPreferences" info="Account Setup"/>
-        <item title="View page" url="###name###" info="View this page"/>
-        <item title="Print page" url="###name###?action=print" info="View this page in a format suitable for printing"/>
-        <item title="Edit page" url="###name###?action=edit" info="Edit this page"/>
-        <item title="Information" url="###name###?action=info" info="Information about this page"/>
-        <item title="Diff to last version" url="###name###?action=diff" info="Differences to last version"/>
-	<item title="Find page" url="FindPage?value=###name###" info="Find pages in Wiki"/>
+        <item title="%(userstatus)s" url="UserPreferences" info="Account Setup"/>
+        <item title="FrontPage" url="FrontPage" info="Our Wiki run-time sandboxy kinda database"/>
+        <item title="RecentChanges" url="RecentChanges" info="ChangeLog, wiki-style"/>
+        <item title="FAQ" url="FAQ" info="Frequently Asked Questions"/>
+        <item/>
+        <item title="View page" url="%(title)s" info="View this page"/>
+        <item title="Print page" url="%(title)s?action=print" info="View this page in a format suitable for printing"/>
+        <item title="Edit page" url="%(title)s?action=edit" info="Edit this page"/>
+        <item title="Information" url="%(title)s?action=info" info="Information about this page"/>
+        <item title="Diff to last version" url="%(title)s?action=diff" info="Differences to last version"/>
+	<item title="Find page" url="FindPage?%(title)s" info="Find pages in Wiki"/>
       </item>
       <item/>
       <item title="Sitemap" site="www" url="sitemap.html" info="This page"/>
       <item/>
       <item title="Search" site="search" url="index.html" info="Yes, you can search our site"/>
     </menu>
-    <notice>###wikimessage###</notice>
+    <notice>%(msg)s</notice>
   </left-area>
   <content-area lang="en">
-  <text-header>###title###</text-header>
+  <text-header>%(title)s</text-header>
   <text-body>
 ###content###
   </text-body>

Index: wikiutil.py
===================================================================
RCS file: /cvs/fresco/web/hosts/wiki/wikiutil.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- wikiutil.py	2 Oct 2002 19:22:16 -0000	1.1
+++ wikiutil.py	16 Apr 2004 19:17:38 -0000	1.2
@@ -1,99 +1,43 @@
+# -*- coding: iso-8859-1 -*-
 """
     MoinMoin - Wiki Utility Functions
 
-    Copyright (c) 2000, 2001, 2002 by Jürgen Hermann <[email protected]>
-    All rights reserved, see COPYING for details.
-
-    $Id$
+    @copyright: 2000 - 2004 by Jürgen Hermann <[email protected]>
+    @license: GNU GPL, see COPYING for details.
 """
[...1372 lines suppressed...]
+    for key in d:
+        if key.startswith('page_'):
+            if d[key]:
+                newdict['q_'+key] = quoteWikiname(d[key])
+            else:
+                newdict['q_'+key] = None
+    d.update(newdict)
 
-    config.printfoot (text_title,text_user,text_message,text_clear, text_name)
+    request.write('\n\n') # the content does not always end with a newline
+    request.write(request.theme.footer(d, **keywords))
+    
 
+    f=open('/home/oxygene/wikitest.html')
+    template=f.read()
+    template=split(template,"###content###")[1]
+    f.close()
+    request.write(template % { 'title': pagename,
+                               'msg': keywords.get('msg', None),
+                               } )