4 |
5 |
--------------------------------------------------------------------------------
/bin/README.txt:
--------------------------------------------------------------------------------
1 | Command-line utilities, to be used on the filesystem.
2 |
3 | zwikiimport.py - import a directory tree into a wiki
4 | zwikiexport.py - export a wiki or wiki page to the filesystem
5 |
--------------------------------------------------------------------------------
/profiles/default/types.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
--------------------------------------------------------------------------------
/skins/zwiki/wikiheader.pt:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/skins/zwiki/pagefooter.pt:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/content/basic/WikiWikiWeb.stx:
--------------------------------------------------------------------------------
1 | Ward Cunningham's WikiWikiWeb is the original and still one of the largest
2 | and most active wikis. It contains a wealth of information about wiki and
3 | many other things.
4 |
5 | WikiWikiWeb:FrontPage
6 |
7 | RemoteWikiURL: http://c2.com/cgi/wiki?
8 |
--------------------------------------------------------------------------------
/skins/zwiki/sitefooter.pt:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/skins/zwiki/siteheader.pt:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/bin/summarize:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # summarize files in a python source tree
3 | # A code comprehension aid. Load SUMMARY into emacs for best formatting.
4 | # Tab once or twice on headings to hide/show code. M-x org-overview hides all.
5 |
6 | find -s . -name "*.py" -exec echo \; -exec echo "* {}" \; -exec egrep -i '^ *(class|def) ' {} \; >SUMMARY
7 | cat <>SUMMARY
8 |
--------------------------------------------------------------------------------
/scripts/README.txt:
--------------------------------------------------------------------------------
1 | Miscellaneous dtml methods and scripts which you can add to
2 | your wiki using the ZMI. These are not installed automatically.
3 |
4 | pagesByType.dtml - dtml method to list pages by type
5 | print.dtml - dtml method for flattening and page and subtopics
6 | toc.py - pythonscript for zwiki.org-style tables of contents
7 | view_source.dtml - dtml method for viewing source of things
8 | propreplace.py - pythonscript for modifying an attribute of all wiki pages
9 |
--------------------------------------------------------------------------------
/content/basic/ZWiki.stx:
--------------------------------------------------------------------------------
1 | Zwiki is the software which drives this wiki site.
2 | It has been developed by "Joyful Systems":http://joyful.com and
3 | "contributors":http://zwiki.org/ZwikiContributors around the world,
4 | and is available under the GNU GPL.
5 | For more information, see http://zwiki.org .
6 |
7 | Zwiki is inspired by the original WikiWikiWeb and powered by the
8 | "Zope":http://zope.org web application server.
9 |
10 | RemoteWikiURL: http://zwiki.org/
11 |
--------------------------------------------------------------------------------
/skins/zwiki/subtopics_outline.dtml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
10 |
subtopics:
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/skins/zwiki/README.txt:
--------------------------------------------------------------------------------
1 | Templates, scripts, styleshees, images for Zwiki's skin. This skin works
2 | in both "standard" and "CMF/Plone" wikis. See also Views.py.
3 |
4 | Also some ZMI forms. See Wiki.py.
5 |
6 | The wiki-named dtml files like RecentChanges.dtml are snapshots of the
7 | evolving dynamic wiki pages of the same name at zwiki.org. They are used
8 | as helpers by the similarly named page templates (eg recentpages.pt), or
9 | can be installed as editable wiki pages via /setupDtmlPages.
10 |
--------------------------------------------------------------------------------
/tests/Comments_tests.py:
--------------------------------------------------------------------------------
1 | from testsupport import *
2 | ZopeTestCase.installProduct('ZCatalog')
3 | ZopeTestCase.installProduct('ZWiki')
4 |
5 | def test_suite():
6 | suite = unittest.TestSuite()
7 | suite.addTest(unittest.makeSuite(Tests))
8 | return suite
9 |
10 | class Tests(ZwikiTestCase):
11 |
12 | def test_commentCount(self):
13 | p = self.page
14 | self.assertEqual(p.commentCount(),0)
15 | p.comment('test')
16 | self.assertEqual(p.commentCount(),1)
17 | p.comment('test')
18 | self.assertEqual(p.commentCount(),2)
19 |
20 |
--------------------------------------------------------------------------------
/index.txt:
--------------------------------------------------------------------------------
1 | .. Zwiki documentation master file, created by sphinx-quickstart on Fri Apr 25 21:54:52 2008.
2 | You can adapt this file completely to your liking, but it should at least
3 | contain the root `toctree` directive.
4 |
5 | Zwiki sphinx documentation
6 | ==========================
7 |
8 | The following developer-oriented docs are generated from restructured
9 | text files within the Zwiki codebase by Sphinx. For the main Zwiki
10 | documentation, see the wiki at http://zwiki.org.
11 |
12 |
13 |
14 | Contents:
15 |
16 | .. toctree::
17 | :maxdepth: 2
18 |
19 | README
20 | LICENSE
21 | CONTRIBUTORS
22 | DEVELOPERS
23 | tests/functional
24 | CHANGES
25 |
--------------------------------------------------------------------------------
/pagetypes/__init__.py:
--------------------------------------------------------------------------------
1 | # backwards compatibility
2 | try:
3 | import html
4 | ZwikiHtmlPageType = html.PageTypeHtml
5 | except ImportError: pass
6 | try:
7 | import moin
8 | ZwikiMoinPageType = moin.PageTypeMoin
9 | except ImportError: pass
10 | try:
11 | import plaintext
12 | ZwikiPlaintextPageType = plaintext.PageTypePlaintext
13 | except ImportError: pass
14 | try:
15 | import rst
16 | ZwikiRstPageType = rst.PageTypeRst
17 | except ImportError: pass
18 | try:
19 | import stx
20 | ZwikiStxPageType = stx.PageTypeStx
21 | except ImportError: pass
22 | try:
23 | import wwml
24 | ZwikiWwmlPageType = wwml.PageTypeWwml
25 | except ImportError: pass
26 |
--------------------------------------------------------------------------------
/skins/zwiki/content.pt:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
14 | Sorry, you need more identification to do that on this wiki.
15 | Perhaps you need to set a username in
16 | options
17 | or log in ?
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/README.txt:
--------------------------------------------------------------------------------
1 | README
2 | ######
3 |
4 | A wiki engine for Zope.
5 |
6 | For documentation and assistance, please see http://zwiki.org .
7 | All feedback, bug reports and other help appreciated.
8 |
9 | (c) 1999-2009 Simon Michael and contributors.
10 | This product is released under the GNU General Public License.
11 | All rights reserved, all disclaimers apply, etc.
12 |
13 | Overview of documentation files::
14 |
15 | README this file
16 | CHANGES release notes, same as http://zwiki.org/ReleaseNotes
17 | CONTRIBUTORS official Zwiki contributor list
18 | FILESYSTEM_VS_WIKI_DOCS meta-documentation
19 | LICENSE license text
20 | LINECOUNTS code line counts (generated by make linecount)
21 | REPO_POLICY policy for the main Zwiki repository
22 | STYLE developer style guide
23 | TESTS test notes
24 |
25 | See also subdirectories.
26 |
--------------------------------------------------------------------------------
/scripts/pagesByType.dtml:
--------------------------------------------------------------------------------
1 | # call this dtml method in the context of the wiki folder
2 | # to see zwiki pages grouped by page type. This should
3 | # work in a page pretty easily too.
4 | #
5 | # you might need to put the folder id before objectValues
6 | # in some vhost setups ? please report
7 |
8 |
9 |
13 |
14 |
15 | There was a problem locating one of this wiki's skin templates.
16 | There may be another object in the ZODB with the the same ID,
17 | obscuring the skin template. Or the template may be missing on the
18 | filesystem due to an incomplete Zwiki installation.
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/.authorspellings:
--------------------------------------------------------------------------------
1 | -- make (patched) darcs show authors list zwiki committers consistently
2 |
3 | Simon Michael , simon@blue$, simon@dynabook.joyful.com
4 | Frank Laurijssens
5 | Encolpe Degoute , darcs sendencolpe.degoute@colpi.info
6 | Stefan Rank , stefan.rank@ofai.at
7 | Michael Twomey
8 | Sascha Welter
9 | John Riley
10 | Alvaro Cantero
11 | Andreas Mayer
12 | Bill Page
13 | Bob McElrath
14 | Jakub Wiśniowski
15 | Jens Nachtigall
16 | Jordan Baker
17 | Juan Manuel Méndez Rey
18 | Lele Gaifax
19 | Michael Pedersen
20 | Michael Twomey
21 | Nicolas Laurent
22 | Raphaël Badin
23 | T. C. Chou
24 | Vladimír Linek
25 |
--------------------------------------------------------------------------------
/scripts/propreplace.py:
--------------------------------------------------------------------------------
1 | import string
2 |
3 | def propreplace(self,properties,old,new):
4 | """
5 | Do a text replace in certain properties of zwiki pages in this folder.
6 |
7 | For all zwiki pages in this folder, replace all occurrences of old
8 | with new in the specified property or properties (must be string
9 | properties). You could call this from your browser, eg like so:
10 |
11 | http://.../wikifolder/propreplace?properties:list=creation_time&properties:list=last_edit_time&old=Central Standard Time&new=CST
12 |
13 | Don't leave this method accessible to untrusted users.
14 | """
15 | if not old:
16 | return
17 | if type(properties) == type(''):
18 | properties = (properties,)
19 | # poor caching (ok)
20 | for page in self.pageObjects():
21 | for prop in properties:
22 | s = getattr(page,prop,'')
23 | if string.find(s,old) != -1:
24 | setattr(page,prop,string.replace(s,old,new))
25 | self.REQUEST.RESPONSE.write(
26 | "changed %s.%s from %s to %s\n" % \
27 | (page.id(),prop,s,getattr(page,prop)))
28 |
--------------------------------------------------------------------------------
/setup.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 | from setuptools import setup, find_packages
4 |
5 | setup(
6 | name = "Zwiki",
7 | version = "2.0b1",
8 | author = "Simon Michael & co.",
9 | author_email = "simon@joyful.com",
10 | description = "Zwiki, the Zope-based wiki engine.",
11 | long_description = "Zwiki, the Zope-based wiki engine.",
12 | url = "http://zwiki.org",
13 | platforms = [],
14 | keywords = "wiki zope",
15 | classifiers = [],
16 | license = "GPL",
17 | scripts = [],
18 | py_modules = [
19 | "__init__",
20 | "Admin",
21 | "CMF",
22 | "Catalog",
23 | "Comments",
24 | "Defaults",
25 | "Diff",
26 | "Editing",
27 | "History",
28 | "Mail",
29 | "Outline",
30 | "OutlineSupport",
31 | "PageTypes",
32 | "Permissions",
33 | "Regexps",
34 | "Splitter",
35 | "TextFormatter",
36 | "Utils",
37 | "Views",
38 | "ZWikiPage",
39 | ],
40 | packages = find_packages(),
41 | package_data = {
42 | '':['*.txt'],
43 | },
44 | install_requires = [
45 | 'Zope2>=2.12',
46 | ],
47 | )
48 |
--------------------------------------------------------------------------------
/skins/zwiki/Index.dtml:
--------------------------------------------------------------------------------
1 |
2 | All pages in this wiki, grouped alphabetically.
3 |
\n" % html_quote(t)
11 |
12 | def preRender(self, page, text=None):
13 | # a little different.. wrap document part in pre then run stx over the lot
14 | t = text or (self.format(page, page.document()) + '\n'+MIDSECTIONMARKER + \
15 | self.preRenderMessages(page))
16 | t = self.obfuscateEmailAddresses(page,t)
17 | return t
18 |
19 | def discussionSeparator(self,page):
20 | return '\n
9 |
10 | This will add a single wiki page to the current folder. You
11 | may want to "Add ZWiki" instead, to
12 | get a more complete wiki with sample content and fuzzy url
13 | handling.
14 |
15 |
\n')
25 | # double citation followed by single
26 | test('>> a\n> b\n',
27 | '
\n
\na
\nb
\n')
28 | # double with no following single
29 | test('>> a\n',
30 | '
\n
\na
\n
\n')
31 |
32 | def test_obfuscateEmailAddresses(self):
33 | f = lambda s:PageTypeBase().obfuscateEmailAddresses(self.p,s)
34 | self.assertEquals('abc', f('abc'))
35 | self.assertEquals('a@b.c', f('a@b.c'))
36 | self.assertEquals('a.a@b.c', f('a.a@b.c'))
37 | self.assertEquals('a@b.c', f('a@b.c'))
38 |
39 | def test_modernPageTypeFor(self):
40 | # test a few of the page type upgrades
41 | self.assertEqual(modernPageTypeFor('msgstxprelinkdtmlfitissuehtml'), 'stx')
42 | self.assertEqual(modernPageTypeFor('dtmlstxlinkhtml'), 'stx')
43 | self.assertEqual(modernPageTypeFor('nosuchtype'), self.page.defaultPageType())
44 | self.assertEqual(modernPageTypeFor(PageTypeRst()), 'rst')
45 | self.assertEqual(modernPageTypeFor(PageTypeHtml()), 'html')
46 | # simulate zodb broken object
47 | class Broken:
48 | def getId(self): return 'broken'
49 | self.assertEqual(modernPageTypeFor(Broken()), self.page.defaultPageType())
50 |
51 |
--------------------------------------------------------------------------------
/plugins/pagetypes/html.py:
--------------------------------------------------------------------------------
1 | from common import *
2 | from Products.ZWiki.i18n import _
3 | from Products.ZWiki.plugins.pagetypes import registerPageType
4 |
5 | class PageTypeHtml(PageTypeBaseHtml):
6 | _id = 'html'
7 | _name = 'HTML'
8 | supportsHtml = yes
9 | supportsDtml = yes
10 |
11 | def preRender(self, page, text=None):
12 | t = text or (page.document()+'\n'+MIDSECTIONMARKER + \
13 | self.preRenderMessages(page))
14 | t = page.applyWikiLinkLineEscapesIn(t)
15 | t = page.markLinksIn(t)
16 | t = self.obfuscateEmailAddresses(page,t)
17 | return t
18 |
19 | def render(self, page, REQUEST={}, RESPONSE=None, **kw):
20 | if page.dtmlAllowed() and page.hasDynamicContent():
21 | t = page.evaluatePreRenderedAsDtml(page,REQUEST,RESPONSE,**kw)
22 | else:
23 | t = page.preRendered()
24 | t = page.renderMarkedLinksIn(t)
25 | if page.isIssue() and kw.get('show_issueproperties',1):
26 | t = page.addIssueFormTo(t)
27 | t = page.renderMidsectionIn(t,**kw)
28 | t = page.addSkinTo(t,**kw)
29 | return t
30 |
31 | def makeCommentHeading(self, page,
32 | subject, username, time,
33 | message_id=None,in_reply_to=None):
34 | """
35 | Generate HTML markup for a comment heading in a HTML page.
36 |
37 | Note that we just work on the comment heading here. The content of the
38 | comment is left as is, not certain what to do with it. Users likely
39 | expect to be able to write comments like on every other page type
40 | (e.g. with two newlines to format paragraphs) - but what kind of markup
41 | would be expected on a html page? XXX
42 | """
43 | heading = '\n\n
'
44 | heading += '%s --' % (page.tounicode(subject) or '...')
45 | if username: heading = heading + '%s, ' % (page.tounicode(username))
46 | heading += time or ''
47 | heading += ' %s' % (
48 | page.pageUrl(),
49 | quote(subject or ''),
50 | ((message_id and '&in_reply_to='+quote(message_id))
51 | or ''),
52 | _("reply"),
53 | )
54 | heading += '\n\n
'
55 | return heading
56 |
57 | registerPageType(PageTypeHtml)
58 |
59 | # backwards compatibility - need this here for old zodb objects
60 | ZwikiHtmlPageType = PageTypeHtml
61 |
--------------------------------------------------------------------------------
/skins/zwiki/accesskeys.pt:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/tests/Utils_tests.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from testsupport import *
3 | #ZopeTestCase.installProduct('ZCatalog')
4 | ZopeTestCase.installProduct('ZWiki')
5 | from Products.ZWiki.Utils import TRACE, DEBUG, BLATHER, INFO, WARNING, ERROR
6 |
7 | def test_suite():
8 | suite = unittest.TestSuite()
9 | suite.addTest(unittest.makeSuite(Tests))
10 | return suite
11 |
12 | class Tests(ZwikiTestCase):
13 | def test_checkSufficientId(self):
14 | p, r = self.page, self.request
15 | self.assert_(p.checkSufficientId(r))
16 | p.edits_need_username = 1
17 | self.failIf(p.checkSufficientId(r))
18 | p.edits_need_username = 0
19 | self.assert_(p.checkSufficientId(r))
20 |
21 | def test_safe_hasattr(self):
22 | from Products.ZWiki.Utils import safe_hasattr
23 | p = self.page
24 | self.failIf(safe_hasattr(p,'muppets'))
25 | setattr(p, 'muppets', 'gonzo')
26 | self.assert_(safe_hasattr(p,'muppets'))
27 |
28 | def test_excerptAt(self):
29 | self.page.edit(text='This is a test of the \n excerptAt method,')
30 | self.assertEquals(self.page.excerptAt('excerptat',size=10,highlight=0),
31 | '\n excerptAt ')
32 | #self.assertEquals(self.page.excerptAt('this*',size=21,highlight=1),
33 | # 'This is a tes')
34 | #self.assertEquals(self.page.excerptAt('br',size=4),
35 | # 'e<br>\n')
36 | # XXX temp
37 | self.assertEquals(self.page.excerptAt('this*',size=21,highlight=1),
38 | 'This is a tes')
39 | self.assertEquals(self.page.excerptAt('br',size=4),
40 | 'e<br /')
41 | self.assertEquals(self.page.excerptAt(' ',size=4,highlight=0),
42 | '<br />')
43 | self.assertEquals(self.page.excerptAt('nomatch'), 'This is a test of the<br />\n excerptAt method,')
44 | self.assertEquals(self.page.excerptAt(''), 'This is a test of the<br />\n excerptAt method,')
45 |
46 | def test_summary(self):
47 | p = self.page
48 | p.edit(text=u'É')
49 | self.assertEqual(u'É',p.summary())
50 |
51 | def test_BLATHER(self):
52 | BLATHER('E') # ascii
53 | BLATHER('É') # utf-8
54 | BLATHER(u'\xc9') # unicode
55 |
56 |
--------------------------------------------------------------------------------
/plugins/__init__.py:
--------------------------------------------------------------------------------
1 | """
2 | The plugins package contains modules or packages that extend Zwiki's
3 | functionality, usually by providing a mixin for ZWikiPage, thereby
4 | adding extra features to all wiki pages at startup. A true plugin can
5 | (a) be removed without any ill effects aside from disabling the
6 | feature it provides, and (b) be provided by a separate product.
7 |
8 | Page types are another kind of plugin, residing in their own
9 | subpackage. It seems helpful to keep them separate for the moment.
10 |
11 | Non-core features which used to be in the main ZWiki package are
12 | gradually being moved here and pluginised. Some of them still have
13 | hard-coded dependencies in other parts of the code, such as:
14 |
15 | """
16 |
17 | from Products.ZWiki.Utils import BLATHER, formattedTraceback
18 |
19 | # a kludge to subclass a runtime list of classes, since we can't modify
20 | # __bases__ of an extension class. ZWikiPage subclasses each of these
21 | # slots. We could also subclass a class whose __bases__ we can modify,
22 | # see http://zwiki.org/1034Pluginization
23 | class Null: pass
24 | PLUGINS = [
25 | Null,
26 | Null,
27 | Null,
28 | Null,
29 | Null,
30 | Null,
31 | Null,
32 | Null,
33 | Null,
34 | Null,
35 | Null,
36 | Null,
37 | Null,
38 | Null,
39 | Null,
40 | Null,
41 | ]
42 |
43 | def registerPlugin(c):
44 | """
45 | Add a class to Zwiki's global plugin registry.
46 |
47 | >>> from Products.ZWiki.plugins import registerPlugin
48 | >>> registerPlugin(MyMixinClass)
49 |
50 | """
51 | name = '%s.%s' % (c.__module__,c.__name__)
52 | for i in range(len(PLUGINS)):
53 | if PLUGINS[i] == Null:
54 | PLUGINS[i] = c
55 | BLATHER('loaded plugin: %s' % name)
56 | return
57 | BLATHER('could not register %s plugin, need more plugin slots!' % name)
58 |
59 | # load plugins
60 | # import all modules and packages in this directory, each will register itself
61 | import os, re
62 | modules = [re.sub('.py$','',f) for f in os.listdir(__path__[0])
63 | if os.path.isdir(os.path.join(__path__[0], f))
64 | or (f.endswith('.py')
65 | and not f.endswith('_tests.py')
66 | and not f == '__init__.py'
67 | )
68 | ]
69 | for m in modules:
70 | if m.startswith('_'):
71 | BLATHER('%s plugin disabled with _ prefix, skipping\n' % m[1:])
72 | else:
73 | try:
74 | __import__('Products.ZWiki.plugins.%s' % m)
75 | except ImportError:
76 | BLATHER('could not load %s plugin, skipping (traceback follows)\n%s' % (
77 | m, formattedTraceback()))
78 |
--------------------------------------------------------------------------------
/plugins/tinymce.py:
--------------------------------------------------------------------------------
1 | from types import *
2 | import os, re, os.path
3 | from string import join, split, strip
4 |
5 | from AccessControl import getSecurityManager, ClassSecurityInfo
6 | from Globals import InitializeClass
7 |
8 | from Products.ZWiki import Permissions
9 | from Products.ZWiki.i18n import _
10 | from Products.ZWiki.Utils import BLATHER, DEBUG, formattedTraceback
11 | from Products.ZWiki.plugins import registerPlugin
12 |
13 |
14 | class TinyMCESupport:
15 | """
16 | This mix-in class provides ZTinyMCE wysiwyg editor integration.
17 | """
18 | security = ClassSecurityInfo()
19 |
20 | security.declareProtected(Permissions.View, 'tinyMCEInstalled')
21 | def tinyMCEInstalled(self):
22 | """Is TinyMCE installed and configured?"""
23 | installed = 'ZTinyMCE' in self.Control_Panel.Products.objectIds()
24 | return installed and getattr(self, 'tinymce.conf', None) is not None
25 |
26 | security.declareProtected(Permissions.View, 'supportsTinyMCE')
27 | def supportsTinyMCE(self):
28 | """Is TinyMCE editing available for this page?"""
29 | return self.tinyMCEInstalled() and self.pageTypeId() == 'html'
30 |
31 | security.declareProtected(Permissions.AddWiki, 'setupTinyMCE')
32 | def setupTinyMCE(self):
33 | """
34 | Setup ZTinyMCE - if installed - with a useful config object.
35 | """
36 | if not 'ZTinyMCE' in self.Control_Panel.Products.objectIds():
37 | return 'ZTinyMCE is not installed.' # XXX proper page, localize
38 | folder = self.folder()
39 | if 'TinyMCE' not in folder.objectIds():
40 | folder.manage_addProduct['ZTinyMCE'].manage_addZTinyMCE( \
41 | 'TinyMCE', 'WYSIWYG Editor Plugin')
42 | if 'tinymce.conf' not in folder.objectIds():
43 | conftext = """mode : "textareas",
44 | theme : "advanced",
45 | plugins : "table,advimage,advlink,emotions,contextmenu,paste,directionality,noneditable",
46 | theme_advanced_buttons2_add : "forecolor,backcolor",
47 | theme_advanced_buttons2_add_before: "cut,copy,paste,pastetext,pasteword,separator",
48 | theme_advanced_buttons3_add_before : "tablecontrols,separator",
49 | theme_advanced_buttons3_add : "emotions,separator,ltr,rtl,separator",
50 | theme_advanced_toolbar_location : "top",
51 | theme_advanced_toolbar_align : "left",
52 | extended_valid_elements : "hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]" """
53 | folder.manage_addProduct['ZTinyMCE'].manage_addZTinyConfiguration(
54 | 'tinymce.conf', conftext, optimize=True,
55 | title='TinyMCE in ZWiki config')
56 |
57 | InitializeClass(TinyMCESupport)
58 | registerPlugin(TinyMCESupport)
59 |
--------------------------------------------------------------------------------
/bin/prepmoin.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python2.4
2 |
3 | import sys
4 | import os
5 | import fnmatch
6 | import shutil
7 | import re
8 |
9 | def usage(exitcode, errmsg=None):
10 | print "Usage: %s " % (sys.argv[0])
11 | print " /path/to/moinmoin/wiki/data must exist, and point to the actual files used by a MoinMoin wiki"
12 | print " /path/to/exported/moinmoin/files must not exist"
13 | print " http://your.zwiki.com/url is the URL that will host your exported wiki"
14 | if errmsg is not None:
15 | print ""
16 | print "Usage error was %s" % (errmsg)
17 | if exitcode != 0:
18 | sys.exit(exitcode)
19 |
20 | def locate(pattern, root=os.curdir):
21 | for path, dirs, files in os.walk(os.path.abspath(root)):
22 | for filename in fnmatch.filter(files, pattern):
23 | yield os.path.join(path, filename)
24 |
25 | if len(sys.argv) != 4:
26 | usage(1)
27 |
28 | srcdir = sys.argv[1]
29 | destdir = sys.argv[2]
30 | desturl = "file: %s" % (sys.argv[3])
31 | attachreg = re.compile("attachment:")
32 |
33 | if not(os.path.exists(srcdir)):
34 | usage(2, "Wiki source directory must exist, and %s does not exist" % (srcdir))
35 |
36 | if not(os.path.isdir(srcdir)):
37 | usage(3, "Wiki source must be a directory, and %s is not a wiki source directory" % (srcdir))
38 |
39 | if not(os.path.exists(os.path.join(srcdir, "data"))):
40 | usage(4, "Directory %s does not have a data directory, which means it does not look like a MoinMoin wiki to me" % (srcdir))
41 |
42 | if os.path.exists(destdir):
43 | usage(5, "Destination must not exist, and %s does exist." % (destdir))
44 |
45 | try:
46 | os.mkdir(destdir)
47 | except OSError:
48 | usage(6, "Error making the destination directory %s" % (destdir))
49 |
50 | for file in locate("current", os.path.join(srcdir, "data")):
51 | src = os.path.split(file)[0]
52 | destfile = os.path.join(destdir, "%s%s" % (os.path.split(src)[1], ".moin"))
53 | vin = open(file, "r")
54 | rev = vin.readline().strip()
55 | vin.close()
56 | moinfile = os.path.join(src, "revisions", rev)
57 | if os.path.exists(moinfile):
58 | print "*** Processing %s " % (destfile)
59 | #shutil.copyfile(moinfile, destfile)
60 | fin = open(moinfile, "r")
61 | contents = fin.readlines()
62 | fin.close()
63 | out = map(lambda x: attachreg.sub(desturl, x), contents)
64 | fin = open(destfile, "w")
65 | fin.writelines(out)
66 | fin.close()
67 | for attach in locate("*", os.path.join(src, 'attachments')):
68 | attachname = os.path.split(attach)[1]
69 | destattach = os.path.join(destdir, attachname)
70 | if os.path.exists(destattach):
71 | print " --- Warning: Attachment %s already exists in the export directory" % (attachname)
72 | else:
73 | print " +++ Processing %s" % (attachname)
74 | shutil.copyfile(attach, destattach)
75 | else:
76 | print "!!! Missing current revision for %s" % (destfile)
77 |
78 |
--------------------------------------------------------------------------------
/bin/zwikiexport.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | """
3 | zwikiexport.py - export a zwiki folder or single page to the filesystem.
4 |
5 | (c) 2005-2010 SKWM, GNU GPL.
6 | """
7 |
8 | usage = """\
9 | $INSTANCE/bin/zopectl run %prog /path/to/wiki/folder
10 |
11 | Exports the specified wiki folder (or zwiki page) to the current directory.
12 | You'll need to stop the Zope instance first, unless it is a ZEO instance."""
13 |
14 | # stories:
15 | # -parse args, show help
16 | # -export a page
17 | # -page type is reflected in file suffix
18 | # -export a whole wiki
19 | # export offspring
20 | # export files & images
21 | # allow exporting only changed objects
22 | # allow round trip with zwikiimport
23 | # run from web ?
24 | # export to var directory
25 | # download as a tarball
26 |
27 | import sys, os, re
28 | from optparse import OptionParser
29 |
30 | parser = OptionParser(usage=usage)
31 | parser.add_option('-n', '--dry-run', action='store_true',dest='dryrun', help="Don't actually do anything")
32 | parser.add_option('-v', '--verbose', action='store_true', help="Be more verbose")
33 | parser.add_option('-q', '--quiet', action='store_true', help="Be less verbose")
34 |
35 | try: app
36 | except NameError: parser.error("this should be run with zopectl run.")
37 |
38 | def parseArgs():
39 | opts, args = parser.parse_args()
40 | if len(args) != 1: parser.error('one zope object path is required.')
41 | return opts, args
42 |
43 | def main():
44 | global opts, args
45 | opts, args = parseArgs()
46 | exportObjectAt(args[0], '.')
47 |
48 | def exportObjectAt(path, fsdir):
49 | """Export a zope folder/wikipage/file/image as one or more files."""
50 | vlog('%s: ' % path, newline=False)
51 | o = objectFromPath(path)
52 | vlog(getattr(o, 'meta_type', 'none'))
53 | if hasattr(o, 'meta_type'):
54 | if o.meta_type == 'ZWiki Page':
55 | basename, ext, content = o.pageId(), o.pageTypeId(), o.text()
56 | filepath = os.path.join(fsdir, '%s.%s'%(basename,ext))
57 | log('%s saved as %s' % (path, filepath))
58 | if not opts.dryrun:
59 | f = open(filepath,'w')
60 | f.write(content)
61 | f.close()
62 | elif o.isPrincipiaFolderish and not 'Catalog' in o.meta_type:
63 | fsdir2 = os.path.join(fsdir, o.getId())
64 | if not opts.dryrun:
65 | if not os.path.exists(fsdir2): os.mkdir(fsdir2)
66 | for o2 in o.objectValues(): exportObjectAt(o2.absolute_url_path(), fsdir2)
67 |
68 | def objectFromPath(path):
69 | """Get the object indicated by a ZODB path, or None if not found."""
70 | return app.restrictedTraverse(path, None)
71 |
72 | def log(msg='', newline=True):
73 | """Print some text and/or a newline unless quiet option is true."""
74 | if not opts.quiet:
75 | if newline:
76 | print '%s' % msg
77 | else:
78 | print '%s' % msg,
79 |
80 | def vlog(msg='', newline=True):
81 | """Print some text and/or a newline if verbose option is true."""
82 | if opts.verbose:
83 | if newline:
84 | print '%s' % msg
85 | else:
86 | print '%s' % msg,
87 |
88 | if __name__ == "__main__": main()
89 |
90 | #def _test():
91 | # import doctest, zwikiimport
92 | # return doctest.testmod(zwikiimport)
93 | #if __name__ == "__main__":
94 | # _test()
95 |
--------------------------------------------------------------------------------
/skins/zwiki/addwikiform.dtml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Add ZWiki
5 |
6 |
7 |
Add ZWiki
8 |
9 |
10 | This will add a ready-to-use wiki site in a subfolder. (To
11 | put a wiki in the zope root folder, just cut and paste the
12 | objects from the subfolder.)
13 |
14 |
51 |
52 | < dtml-in results sort=lastEditTime reverse prefix=x>
53 | had to use the catalog for sorting due to issue #1145 which breaks
54 | this in zope 2.8/2.9. As a result sorting no longer works when there
55 | is no catalog.
56 |
57 |
58 |