Author: ianb
Date: 2004-04-17 15:43:46 -0600 (Sat, 17 Apr 2004)
New Revision: 82
Modified:
Wiki/Context/Main.py
Wiki/Context/SitePage.py
Wiki/Context/default.css
Wiki/Context/search.py
Wiki/lib/wikiconfig.py
Log:
Incorporated components into wiki; used NotifyComponent.
Modified: Wiki/Context/Main.py
===================================================================
--- Wiki/Context/Main.py 2004-04-17 21:42:52 UTC (rev 81)
+++ Wiki/Context/Main.py 2004-04-17 21:43:46 UTC (rev 82)
@@ -79,11 +79,12 @@
self.response().setCookie('username', req.field('username'),
expires='NEVER')
self.page.save()
- self.cancel()
+ self.message('Changes saved')
+ self.sendRedirectAndEnd(self.link(unversioned=True))
def cancel(self):
- self.response().sendRedirect(self.link(unversioned=True))
- self.write('redirecting...')
+ self.message('Edit cancelled')
+ self.sendRedirectAndEnd(self.link(unversioned=True))
def history(self):
self.view = 'writeHistory'
Modified: Wiki/Context/SitePage.py
===================================================================
--- Wiki/Context/SitePage.py 2004-04-17 21:42:52 UTC (rev 81)
+++ Wiki/Context/SitePage.py 2004-04-17 21:43:46 UTC (rev 82)
@@ -1,4 +1,4 @@
-from WebKit.Page import Page
+from Component import CPage
import sys
sys.path.append('/home/ianb/w4py.org/home/ianb/Wiki')
from lib import wiki
@@ -6,13 +6,18 @@
from lib.formatdate import formatDate
import os
import datetime
+from Component.NotifyComponent import NotifyComponent
+from Component.UserManager.PickleUserManager import PickleUserManager
+from Component.UserManager.UserComponent import UserComponent
__all__ = ['SitePage']
-class SitePage(Page):
+class SitePage(CPage):
+ components = [NotifyComponent()]
+
def awake(self, transaction):
- Page.awake(self, transaction)
+ CPage.awake(self, transaction)
domain = self.request().environ().get('HTTP_HOST', 'SERVER_NAME')
if ':' in domain:
domain = domain.split(':')[0]
@@ -28,12 +33,16 @@
"""
return self.request().adapterName() + '/' + name
+ def loginRequired(self):
+ return False
+
def writeStyleSheet(self):
self.write('<link rel="stylesheet" href="%s/default.css" type="text/css">\n'
% self.request().adapterName())
def writeBodyParts(self):
self.writeHeader()
+ self.writeMessages()
self.writeContent()
self.writeFooter()
@@ -103,11 +112,11 @@
if not self.response().cookies():
# If there aren't any cookies, then we always do the
# full redirect
- return Page.sendRedirectAndEnd(self, url)
+ return CPage.sendRedirectAndEnd(self, url)
req = self.request()
agent = req.environ().get('HTTP_USER_AGENT')
if not agent or agent.find('MSIE') == -1:
- return Page.sendRedirectAndEnd(self, url)
+ return CPage.sendRedirectAndEnd(self, url)
# Otherwise we're dealing with MSIE, which has problems
# with setting cookies and then immediately redirecting.
self.write('<html><head><meta http-equiv="refresh" '
@@ -135,3 +144,6 @@
TheGlobalWiki.addSpecialName(filename[:-3])
SitePage.TheGlobalWiki = TheGlobalWiki
+
+manager = PickleUserManager(path=TheGlobalWiki.config.userPath)
+SitePage.components.append(UserComponent(manager))
Modified: Wiki/Context/default.css
===================================================================
--- Wiki/Context/default.css 2004-04-17 21:42:52 UTC (rev 81)
+++ Wiki/Context/default.css 2004-04-17 21:43:46 UTC (rev 82)
@@ -410,4 +410,21 @@
/* summary/keyword pages */
-.modifiedDate { font-size: small }
\ No newline at end of file
+.modifiedDate { font-size: small }
+
+/* NotifyComponent */
+
+.notifyMessage {
+ border: thin black solid;
+ width: 70%;
+ background-color: #006600;
+ color: #ffffff;
+}
+
+.notifyMessage a {
+ color: #bbffbb;
+}
+
+.notifyMessage a:visited {
+ color: #ddddff;
+}
\ No newline at end of file
Modified: Wiki/Context/search.py
===================================================================
--- Wiki/Context/search.py 2004-04-17 21:42:52 UTC (rev 81)
+++ Wiki/Context/search.py 2004-04-17 21:43:46 UTC (rev 82)
@@ -31,6 +31,11 @@
self.explanation = 'Goto "%s"' % self.htmlEncode(self.gotoSearch)
self.results = self.wiki.searchNames(self.gotoSearch)
if self.results:
+ if len(self.results) > 1:
+ self.message('Also matched: %s'
+ % ', '.join(['<a href="%s">%s</a>'
+ % (page.link, page.title)
+ for page in self.results[1:]]))
self.sendRedirectAndEnd(self.results[0].link)
def writeContent(self):
Modified: Wiki/lib/wikiconfig.py
===================================================================
--- Wiki/lib/wikiconfig.py 2004-04-17 21:42:52 UTC (rev 81)
+++ Wiki/lib/wikiconfig.py 2004-04-17 21:43:46 UTC (rev 82)
@@ -32,6 +32,12 @@
config = DomainConfig(self, domain, canonical)
return config
+ def userPath__get(self):
+ try:
+ return self._config.get('wiki', 'userpath')
+ except NoOptionError:
+ return os.path.join(self.basePath, 'users')
+
class DomainConfig(object):
__metaclass__ = propertymeta.MakeProperties
|