The Definitive Guide to Plone
The Definitive Guide to Plone by Enfold Systems
The Definitive Guide to Plone
First Edition
16th May 2005
1
Table of Contents
1 Chapter 1
1.1 Introducing Plone
1.1.1 What Is a Content Management System?
1.1.2 Do You Want a Content Management System?
1.1.3 Introducing Plone’s Features
1.1.4 Getting Involved in Plone’s Development
2 Chapter 2
2.1 Installing Plone
2.1.1 Installing Plone on Windows
2.1.2 Installing Plone on Mac OS X, Unix, and Linux
2.1.3 Installing from Source
2.1.4 Configuring the Web Server
3 Chapter 3
3.1 Adding and Editing Content
3.1.1 Joining a Site
3.1.2 Enabling Cookies
3.1.3 Setting Up Your Folder and Preferences
3.1.4 Adding and Editing Documents
3.1.5 Adding and Editing Other Types of Content
3.1.6 Organizing Content
3.1.7 Discussing and Finding Content
3.1.8 Example: Creating the Plone Book Web Site
4 Chapter 4
4.1 Making Simple Customizations
4.1.1 Administering Sites
4.1.2 Using the ZMI
4.1.3 Customizing Plone’s Look and Feel
5 Chapter 5
5.1 Introducing Basic Plone Templating
5.1.1 Understanding the Underlying Templating Machinery
5.1.2 Using the Zope Page Templates System
5.1.3 Understanding the Page Template Basic Syntax
6 Chapter 6
6.1 Introducing Advanced Plone Templating and Scripting
2
6.1.1 Understanding Advanced Plone Templating
6.1.2 Scripting Plone with Python
6.1.3 Useful Tips
6.1.4 Using Forms
7 Chapter 7
7.1 Customizing the Look and Feel of Plone
7.1.1 Introducing Plone Skins
7.1.2 Customizing Skins
7.1.3 Making New Skins and Layers
7.1.4 Case Study: Examining the NASA Skin
8 Chapter 8
8.1 Managing Workflow
8.1.1 What Is Workflow?
8.1.2 Understanding Workflow in Plone
8.1.3 Adding and Editing Workflow
8.1.4 Common Tasks and Examples
9 Chapter 9
9.1 Setting Up Security and Users
9.1.1 Administering Users
9.1.2 User Registration Tools
9.1.3 Setting Permissions
9.1.4 Scripting Users
9.1.5 Integrating Plone with Other Services
10 Chapter 10
10.1 Integrating with Other Systems
10.1.1 Open-Source Licensing
10.1.2 Installing Plone Products
10.1.3 Using a Different Web Server
10.1.4 Integrating Plone with the File System
11 Chapter 11
11.1 Manipulating and Categorizing Content Types
11.1.1 An Overview of Content Types
11.1.2 Searching and Categorizing Content
12 Chapter 12
12.1 Writing a Product in Python
3
12.1.1 Writing a Custom Content Type
12.1.2 Writing a Custom Tool
12.1.3 Adding Some User Interface Elements
13 Chapter 13
13.1 Developing with Archetypes
13.1.1 Introducing Archetypes
13.1.2 Putting Together the Rest of the Content Type
13.1.3 Archetypes based Development
13.1.4 Setting Up a Content Type
13.1.5 Setting Up a Transformation on Windows
13.1.6 Testing the Content Type
13.1.7 Making a Content Type Persist in a Relational Database
14 Chapter 14
14.1 Administering and Scaling Plone
14.1.1 Administering a Plone Site
14.1.2 Improving Plone Performance
14.1.3 Using Zope Enterprise Objects
1 Chapter 1
1.1 Introducing Plone
A company without a Web site is unthinkable—and most companies and organizations have
more than one site. Whether it’s an external site for communicating with clients, an intranet
for employees to use, or a site for direct client communication and feedback, all Web sites have
a common problem—how to manage the content on them. This is a challenge that can often
cost organizations large amounts of time and effort. Producing a powerful yet flexible system
for these sites that meets ever-changing requirements while growing to meet your company’s
emerging needs isn’t easy.
No matter what the requirements for your Web site are or the amount of content or users,
Plone is a user-friendly, powerful solution that lets you easily add and edit any type of content
through the Web, produce navigation and searches for that content, and apply security and
workflow to that content.
Plone enables you to put together almost any Web site and easily update it. This lets you
build content-rich sites quickly so you can gain a competitive advantage. Finally, probably the
best things about this system are that it’s free and it’s open source. With its large and impres-
sive feature set, it’s comparable, if not better than, many closed-source content management
systems that cost hundreds of thousands of dollars.
Mike Sugarbaker says the following when reporting on the Open Source
Content Management Conference (OSCOM) in 2002 for the Mindjack site
(http://www.mindjack.com/events/oscom.html):
“I won’t do the complete rundown of all the ’competing’ open-source content management
frameworks. I’ll cut to the chase: The winner is Plone. This ’productized’ take on the six-year-
old web application framework Zope was the package with the most tools, the most profes-
sionalism, the most traction, and, above all, the most buzz.”
You can find the Plone Web site at http://www.plone.org, as shown in Figure 1-1. To try Plone
easily, a demonstration site is available at http://demo.plone.org. There you can quickly and
easily add and edit content through the Web. Specifically, you can add events, upload pictures,
add documents, and process them all through the framework that Plone provides.
4
5
Figure 1-1. The Plone Web site
1.1.1 What Is a Content Management System?
One simple definition for a Content Management System (CMS) is that it’s a system for man-
aging content. This is a rather unhelpful definition, so I’ll break it down into smaller parts for
a fuller explanation. I’ll start with a broad definition of content: Content is a unit of data with
some extra information attached to it. That piece of data could be a Web page, information
about an upcoming event, a Microsoft Word document, an image, a movie clip, or any piece of
data that has meaning to the organization deploying the system.
6
All these items are called content, and they all share similar attributes, such as the need to be
added or edited by certain users and be published in various ways. A system called workflow
controls these attributes. Workflow is logic defined by the organization’s business rules, and it
describes a system for managing the content.
Historically there has been a difference between document management systems and CMSs,
but mostly these two systems have converged. The essential difference is the items being
managed; it’s often considered that content is any unit of information, and a document refers to
something that’s created and edited by humans using software such as Microsoft Office. Take,
for example, a book: A book contains many units of data and may require management slightly
different from that required by content. However, in most cases, this is a small difference, and
products such as Plone are able to manage the small units of a larger piece of content and
reassemble them.
With the ubiquitousness of the Web, many CMSs are now classified as Web CMSs, either be-
cause they have a Web-based interface or because they focus on a Web-based delivery system
over the Internet or an intranet. Plone provides a Web management interface and Web-based
delivery system.
The following is one definition of a CMS (http://www.contentmanager.eu.com/history.htm):
A CMS is a tool that enables a variety of (centralized) technical and (decentralized)
nontechnical staff to create, edit, manage and finally publish a variety of content
(such as text, graphics, video, and so on) whilst being constrained by a centralized
set of rules, process, and workflows that ensure a coherent, validated Web site
appearance.
1.1.2 Do You Want a Content Management System?
Although not the only advantage of a CMS, the most obvious benefit of a CMS is coordinating
a Web site easily. Take a situation where one person, a Webmaster, coordinates a Web site,
either an intranet or an external site. Content comes from users in a variety of formats, and
the Webmaster turns these into usable Web pages by converting them to Hypertext Markup
Language (HTML). If a user has to change those pages, then the user sends the changes to the
Webmaster, who changes the pages, and so on.
This presents many problems for the organization, the biggest being that all content
is flowing through one person - an obvious bottleneck. That one person can do
only so much work, and if that person is sick or leaves the company, a great deal of
productivity is lost in finding a replacement. The publishing process can be quite
frustrating as e-mails fly between the Webmaster and the user trying to get content
published.
What’s needed is a system that does the following:
Separates the content of a page from the presentation: If the actual content is
separate from the presentation method, then the content author doesn’t need to
know any HTML or how the page is delivered. In fact, one piece of content could
7
have many different templates applied to it, including formats other than HTML,
such as Portable Document Format (PDF), or Scalable Vector Graphics (SVG). When
you want to change the look and feel of the site, you have to change only that one
template rather than all the content.
Allows certain users to add and edit content: If specified users can add and edit
content easily, then there’s no need to send content to the Webmaster or Web team.
Instead, the user who wants to create a page can do so and edit it as much as
necessary.
Applies rules to whom can publish what and when: Your business rules might
not want just anybody publishing content on your Web site; for example, people in
marketing would be able to publish to the press release part of the site and not to
the engineering section.
Can apply business rules to content: If a person from marketing creates a press
release, somebody in legal might need to review that document. In this case, the
document will be passed through a review process that ensures it won’t go live until
these reviews are done.
Can search and index information intelligently: Since the CMS can keep track
of structured information about the content (such as author’s name, publication
date, modification dates, categories, and so on), it can produce listings of content
by author, recent content, and so on. It can also provide searching capabilities that
are much smarter and more useful than just a simple textual search.
Although this example portrays paybacks that are more significant for large organizations,
organizations of all levels benefit from this approach. In fact, typically small organizations
that don’t employ a full-time Webmaster can be one of the key beneficiaries of such a system.
By installing a CMS, you can resolve all these issues and more.
The key factor of any CMS is that it provides a clear separation of the key elements in it:
security, workflow, templates, and so on. For example, the templates presenting an item are
separate from the content. This allows you to easily modify the presentation.
1.1.3 Introducing Plone’s Features
Plone is open source, licensed under the General Public License (GPL), which is a common
open-source license that allows anyone to use the source for free. For more information about
the GPL, go to the Free Software Foundation Web site at http://ww.gnu.org. You can examine
any aspect of Plone’s code and alter it to fit your application. There are no licensing fees to
pay, there’s no license that will expire, and all the code is visible. This open-source philosophy
means that Plone already has a large user base and legion of developers, usability experts,
translators, technical writers, and graphic designers who are able to work on Plone. By choos-
ing Plone, you’re not locked into one company; rather, nearly a dozen companies offer different
Plone services.
8
1.1.3.1 Packaging
Plone maintains easy installers for Windows, Linux, and Mac. Other third-party products and
add-ons also come with the installers. Maintaining quality releases of these products makes
installation and management easy. Also, each new release maintains migration paths and
updates so that your Plone site will keep working and stay up-to-date.
1.1.3.2 Internationalization
The whole Plone user interface is translated into more than 20 languages, including Korean,
Japanese, French, Spanish, and German. Inserting your own translation is easy (see Chapter
4).
1.1.3.3 Usability
Plone offers an excellent user experience that provides high levels of usability and accessibility.
This isn’t just a matter of presenting pretty HTML but instead goes to the core of Plone. Plone
provides an interface that’s compatible with the industry and government standard WAI-AAA
and U.S. Section 508. This allows sites built with Plone to be used by people with vision
disabilities. In addition, this provides the unexpected but related benefit that your page may
index better in search engines such as Google.
1.1.3.4 Skinnable
Plone separates the content from the actual templates used to present the content, often called
skins. The skins are written in the excellent HTML templating system, Zope Page Templates,
and a large amount of Cascading Style Sheets (CSS). With little knowledge of Plone, you can
apply multiple skins, achieve multiple looks, and totally customize your Web site’s appearance.
1.1.3.5 Registration and Personalization
Plone features a complete user registration system. Users register with a Plone site using their
own username, password, and any other information you might want to add about the user.
You can then personalize the whole user interface for that user. In addition, with add-ons, you
can use information you already have about users, coming from many places, such as relational
databases, Lightweight Directory Access Protocol (LDAP), Active Directory, and more. Chapter
8 covers how to register and configure users.
1.1.3.6 Workflow and Security
Workflow controls the logic of processing content through the site. You can configure this logic
through the Web using graphical tools. Site administrators can make sites as complex or as
simple as they’d like; for example, you can add notification tools such as sending e-mails or
instant messages to users. Chapter 8 covers workflow in great detail.
9
For every item of content in a Plone site, you can set up access control lists to decide who has
access to that item and how they’ll be able to interact with it. Will they be able to edit it, view
it, or comment on it? All this is configurable through the Web (see Chapter 9).
1.1.3.7 Extensible
Since Plone is open source, it can be easily altered. You can change and configure almost any
aspect of Plone to suit your needs. Countless packages and tools for Plone provide a wide ar-
ray of options for smaller sites and for large-scale enterprises. Repositories of free add-ons for
Plone are available at http://www.plone.org. With development tools such as Archetypes (cov-
ered in Chapter 13), you can generate and alter Plone code easily through the Web or using
Unified Modeling Language (UML) tools. Chapter 10 covers integration of Plone with enter-
prise solutions such as LDAP Apache, Microsoft Internet Information Services (IIS), Macrome-
,
dia Dreamweaver, and so on.
1.1.3.8 Content Customization
Users of a Plone site can add all manner of content, but the data added isn’t limited or con-
strained. Plone developers can create their own content types so that almost any type of
content can be managed; the only limit is your own imagination. In Chapters 11 and 12,
I’ll discuss how to customize the content types. Chapter 13 will introduce Archetypes, which
is a very powerful system for generating content types that don’t require programming; for
instance, you can generate new types of content from UML tools.
1.1.3.9 Documentation
The Plone project maintains documentation, including this book, which is published under the
Creative Commons license. The best starting place for the community documentation is at
http://www.plone.org/documentation.
1.1.3.10 Community
One of the best things about Plone is the community of developers and companies that sup-
ports and develops Plone. With more than 60 developers involved to some degree in the project
around the world, it’s almost always possible to find a Plone developer online who is willing
and able to help you. Alan Runyan, Alexander Limi, and Vidar Andersen started Plone; how-
ever, it quickly grew into a thriving open-source project as more developers became involved.
The contributions from these developers form the Plone product that’s now available.
1.1.3.10.1 Example Plone Sites
Many Plone sites exist; some are obvious because of their looks, and some aren’t. The following
is just a small sample of the more diverse sites:
10
Plone (*http://www.plone.org*) Plone Demo Site (*http://demo.plone.org*) Zope.org
(*http://www.zope.org*) Liquidnet (*http://www.liquidnet.com*) Design Science Toys
(*http://www.dstoys.com*) Give Kids the World (*http://www.gktw.org*) Propane
(*http://www.usepropane.com*) Maestro Headquarters (*http://mars.telascience.org*)
More Plone sites are available at http://www.plone.org/about/sites, including sites that provide
a quite different user interface. Without knowing about the development of these sites, it
would in fact be hard to tell that these sites use Plone.
1.1.4 Getting Involved in Plone’s Development
Although Plone has an impressive list of features, its list of ’wants’ even more impressive. For
this reason, the project is always on the lookout for new people willing to contribute time for
the project.
Fortunately, because Plone is focused on the end user, there’s a need for a very broad spectrum
of disciplines. Volunteers in a range of areas, rather than just coders or Web developers,
are welcomed. Plone needs user interface developers, usability experts, graphic designers,
translators, writers, and testers. You can find the current development status on the Plone Web
site at http://plone.org/development, and the best way to get involved is to join the mailing
lists or join the developers on an Internet Relay Chat (IRC) channel.
Plone is built on top of Zope and the Content Management Framework (CMF). To understand
Plone, you have to understand Zope and the CMF as the underlying architecture. For this
reason, I’ll explain these two items and how they integrate with Plone in this section.
Zope is a powerful and flexible open-source Web application server developed
by Zope Corporation (http://www.zope.org). Originally, Zope was developed as
a stand-alone CMS, but over time it didn’t satisfy the needs of its users. Then
Zope Corporation developed the CMF an open-source project. The CMF provides
developers with the tools necessary to create complex CMSs; it enables workflow,
provides site skinning, and offers other functions.
The CMF is a framework for a system; in other words, it provides the tools for developers to
build a product, rather than just providing an out-of-the-box system that users can use imme-
diately. Plone takes this and many other features and improves upon them to provide the user
with a high-quality product. Plone is a layer on top of the CMF, which is an application running
on top of Zope. Understanding the CMF is key to understanding Plone. Most administration
functions require the use of Zope’s administration interface, and developing Plone requires an
understanding of Zope and its objects.
This book doesn’t go into depth about Zope; rather, it gives you enough information
to complete tasks in Plone. Just reading this book will give you enough information
to customize and modify almost anything you want in Plone. For more information on
Zope, I recommend The Zope Book. Originally published by New Riders, it has since
been placed online and is updated by community members. It’s available free online at
http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition.
Both Zope and the CMF are key technologies that Plone needs; without them, Plone wouldn’t
exist. The Plone team owes a great deal of thanks to everyone at Zope Corporation for having
11
the vision to create and then offer both Zope and the CMF as open source. The list of people
I’d like to thank there and in the CMF communities is long. Thank you, everyone involved.
Zope is written in Python, a powerful object-oriented, open-source programming language
comparable to Perl or Tcl. Knowledge of Python isn’t required to use Plone or even to do some
basic administration; however, customizing products and scripting Plone does require some
Python.
Tommy Burnette, a senior technical director at Industrial Light Magic, says this about Python
(http://www.python.org/Quotes.html):
Python plays a key role in our production pipeline. Without it a project the size of
Star Wars: Episode II
If you plan to do anything sophisticated with Plone, take a day or two to learn the basics of
Python. Not only will this allow you to customize Plone substantially, but it’ll also familiarize
you with objects and how they interact in the Plone environment. Teaching you Python is
outside the scope of this book; instead, I assume you have a basic knowledge of Python. That
fundamental knowledge of Python will be enough to get you through this book and allow you
to customize the Plone installation easily.
Fortunately, Python is an easy programming language to learn; on average, it takes an experi-
enced programmer a day to become productive in it. New programmers take a little longer. If
you’re installing Plone using the Windows or Mac installers, then the correct version of Python
will be included. To download Python as separate product, for almost any operating system,
go to http://www.python.org.
The best way to master Python is to try it from the command Python interpreter. If you have a
Windows installation of Plone, there’s a link for the Pythonwin, a Python Integrated Develop-
ment Environment (IDE) already in the Start menu; go to Start - Programs - Plone - Pythonwin
(see Figure 1-2).
12
Figure 1-2. The Python prompt on Windows
On Linux and Mac OS X, usually typing python will start the Python interpreter:
$ python
Pyython 2.3.2 (#1, Oct 6 2003, 10:07:16)
[GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
Since Python is an interpreted language, instead of the whole Python script being compiled
and run, you can just send lines of code to the interpreter as you write them. This makes the
interpreter an amazingly useful place for testing and debugging code. In the interpreter, each
line waiting for input is prefixed with >>>.
For example, the simplest ’Hello, World” program is as follows:
>>> print "Hello, world!"
Hello, world!
>>>
To exit the interpreter, press Ctrl+D (press the D key while holding down Ctrl) on Linux
or press Ctrl+Z on Windows. (You’ll also use this later for more advanced Zope and Plone
interaction.) You can execute normal Python scripts by passing them to the interpreter; for
example, given the following script called hello.py:
13
print "Hello, world!"
you can run this using the following command:
$ python hello.py
Hello, world!
The Python Web site at http://www.python.org has excellent documentation, especially the
tutorial. Also, the following books provide a good overview of Python:
• *Dive Into Python* (Apress,2004): Based on Mark Pilgrim’s popular Web-
based tutorial, this books treats readers to a fast-paced introduction to the
Python language. This is a great book geared toward experienced program-
mers.
• *Learning Python*, Second Edition (O’Reilly, 2003): This book covers ver-
sion 2.3 of Python and provides a good overview of Python and all the new
features. This is good for relatively new programmers.
• *Practical Python* (Apress, August 2002): This highly practical introduc-
tion to Python offers insight into the language’s array of features. The reader
can immediately put this knowledge into practice, following along with the
creation of ten interesting projects, including a Web-based bulletin board and
a Graphical User Interface–based file-sharing application.
• *Python Essential Reference*, Second Edition* *(Sams, 2001): A refer-
ence book that provides a great overview of all the key libraries and functions.
This is an excellent book for experienced programmers.
This book uses the following conventions:
• Italics: New terms are italicized. (Appendix C contains an extensive glossary
that defines all acronyms.) Also, links that appear in the user interface are
italicized.
• Bold: If there are instructions within the text that include something you
should type on your keyboard, these words are in bold.
• Code font: A monospaced font indicates filenames, folder paths, code, vari-
ables, and Uniform Resource Locators (URLs).
This book contains lots of screen shots of Zope, Python, and Plone. Since Plone is a rapidly
developing product, the screen shots might vary slightly from the version of software you’re
using; these changes should be minor and shouldn’t affect your understanding of the system.
For this book, the following versions of software are used; although this book is specifically
written with these versions in mind, all the software should work on these and later versions
for some time to come.
Plone 2.0 was the most recently released version of Plone at the time of writing. This is the
second major release of the software, and it provides many new features over 1.0, including
group user management, a new interface, and an improved Zope distribution. It’s strongly
14
suggested you start any new projects in 2.0 or later, rather than using the earlier versions of
Plone.
Version 2.0 of Plone has the following dependencies: Zope 2.7, CMF 1.4.2, and Python 2.3.3.
All of the code examples in this book have been specifically designed not to be dependent upon
these versions or a particular operating system. However, there may be situations where this
isn’t the case; I apologize for any inconvenience.
Originally, a group of Plone users keen to produce quality documentation came up with the
idea of this book. We released the first version of that book on the Plone Web site as an open-
source documentation project. All the content added to the Plone Web site was under the open
publication license.
Growing interest in Plone made a commercial book more feasible, and in the summer of
2003, Apress and I started this book. I used some of the material from the old book with
the original owners’ permissions. With the change to Plone 2, I added a large amount of
new material. This book is now published under the Creative Commons license, which al-
lows for the reuse of this work as long as the original author is attributed. However, you may
not use this work for commercial purposes. For more information, see the license online at
http://creativecommons.org/licenses/by-nc-sa/1.0/.
2 Chapter 2
2.1 Installing Plone
This chapter explains how to install Plone on a variety of platforms and set the basic configu-
ration options for Plone. If you want to try Plone really quickly, then your best bet is to go to
the live demonstration site at http://demo.plone.org; you can try adding and editing content
immediately without installing anything.
Unlike the other chapters, reading this chapter from one end to the other may not make the
most sense. Instead, I’ve broken this chapter down by operating system, so you can read only
the sections you need to in order to install Plone. Plone will install on any of the platforms
that Zope supports: Windows, Mac OS X, Linux, most Unix platforms, and Solaris.
For a Plone server, a high-performance computer will obviously make Plone perform better.
Plone is a complicated system that requires processing power and memory. In general, it’s
recommended you don’t go into production with a machine slower than 2GHz with less than
1GB of Random Access Memory (RAM) if you’re serving a large Web site. It works fine with
setups as low as 500MHz and 64MB of memory for more modest sites, however. For advanced
information about the performance, caching, and acceleration of Plone, see Chapter 14. For
a base installation of Plone, you’ll need about 50MB of hard drive space. If you already have
installations of Zope or Python, then this will be a great deal less; you’ll need about 2MB. You
must also account for the Plone object database, which can grow to almost any size depending
upon the amount of data you store.
To use Plone, you need a Web browser that can access the server. If users want to log into
your site, then they must have cookies enabled. JavaScript isn’t required but will provide a
richer user experience. Because of the large amount of Cascading Style Sheets (CSS) in Plone,
modern browsers will see the correct Plone interface in a richer, more attractive way; however,
it should be quite functional in any reasonable browser.
I recommend any of the following browsers:
• Microsoft Internet Explorer 5.5 and later
• Netscape 7.0 and later
• Mozilla 1.0 and later
• Opera 7.0 and later
• Konqueror 3.0 and later
• Safari 1.0 and later
15
16
Plone also is fully functional in the following browsers but may look different from the original
Plone:
• Netscape 4.*x*
• Microsoft Internet Explorer 5.0
• Microsoft Internet Explorer 4.0
• Konqueror 2.*x*
• Lynx (text-based)
• w3m (text-based)
• AWeb
• Links (text-based, with optional graphics)
• Any browser that handles a basic set of Hypertext Markup Language (HTML)
and form input cookies, including most mobile/Personal Digital Assistant
(PDA) browsers
2.1.1 Installing Plone on Windows
By far the easiest way to install Plone is to use the Plone Windows installer, which automates
the installation of Plone on Windows. The installation includes extra packages and options,
a Hypertext Transfer Protocol (HTTP)–loaded database, the setup of services, and Python for
Windows packages. You can download this installer from http://www.plone.org/download.
2.1.1.1 Using the Installer
The installer has been tested on Windows 9*x*, ME, NT 3.51+, 2000, and XP but it should
,
also work on other Windows versions. It’s recommended you have administrator access on the
computer you want to install on since the installer will try to set up as a service and install
settings into the Windows Registry. If you already have Zope or Python installed, you may
want to install the source separately to save hard drive space.
Before installing Plone, you should make note of any current Web servers you have running.
For example, later versions of Windows automatically install and start Microsoft Internet Infor-
mation Services (IIS), which listens to port 80. The installer starts Plone on ports 80 and 8080.
To test if something is using port 80 already, the easiest way to test is by opening a browser
to http://127.0.0.1/ and seeing if it finds a page. You can either disable that Web server or
change the ports for Plone; see ’Configuring the Web Server” later in this chapter. If you want
to run Plone behind IIS or run both Plone and IIS on the same server at the same time, then
see Chapter 14 for more information. At the moment, however, it’s easiest to just disable that
Web server.
Once you’ve downloaded the installer, double-click the installer to begin (see Figure 2-1).
17
Figure 2-1. The start of the Plone installer
The installer goes through the usual steps for installing software; click Next to
continue the setup or Cancel to exit. The Plone installer lets you choose a location
to install the software; the default is c:Program FilesPlone 2 (see Figure 2-2).
Figure 2-2. Selecting a directory
When you get to the password screen, as shown in Figure 2-3, you must enter a username and
a password. This will create a user for you, and this will make the Plone site in that user’s
name. Often people create one user called admin or similar for this role. You’ll need this
18
username and password later, so remember it; however, if you do lose this password, you can
enter a new one later.
Figure 2-3. Entering a username and password
The installation takes about five minutes, depending upon the speed of your computer. The
installation performs a few tasks at the end of the installation, such as compiling all the Python
files and setting up the database. When the installation has finished, a message displays to let
you know that it’s done (see Figure 2-4).
Figure 2-4. Final setup screen
19
To start Plone, access the Plone controller by going to Start - Programs TRA Plone TRA Plone.
The controller is an application that provides a nice user interface for starting and stopping
Plone. It begins with the Status page, which lets you easily start or stop your Plone installation
(see Figure 2-5).
Figure 2-5. Plone isn’t running.
As shown in Figure 2-5, the screen displays the status of your Plone installation. Plone doesn’t
start automatically; you’ll have to click Start to start Plone. Once you’ve clicked this, you may
have to wait a minute as it completes the startup process (see Figure 2-6).
20
Figure 2-6. Plone is now running.
When Plone has started, you can access the Plone site by clicking the View Plone button. This
starts a browser and accesses the Plone site; you should then see the Plone welcome page.
Note that the address in the browser is http://localhost/; this is the address to access your
Plone site. Clicking the Zope Management Interface button starts a browser and accesses the
management interface; the address in the browser for this is http://localhost::8080/manage,
which gives you access to the underlying application server. When you click the Manage button
and access Plone, it’ll ask you for your username and password. This is the username and
password you added in the installer.
The controller will know whether you’ve installed Plone as a service or not as a service. If
Plone has been installed as a Windows service, then you can stop and start Plone using the
standard service management screens and commands. If it hasn’t been installed as Windows
service, you’ll see a little icon appear in the task bar. At this point if you want to edit content,
move on to Chapter 3.
2.1.1.2 Configuring the Server on Windows
The configuration for Plone is contained in a text file that you can edit to configure your Plone
instance. You can change the ports Plone listens to, the log files used, and a whole host of
options. On Windows some of the key features are available through the controller and the
Graphical User Interface (GUI). If you want to alter some of the other configuration options,
refer to Appendix A for a full list of configuration options. To access the controller, select Start
- Programs - Plone - Plone; this will start the controller.
As discussed earlier, the first page you’ll see is the Status page, which allows you to stop or
start Plone. On the left of the controller are a few other screens that I’ll now discuss.
2.1.1.2.1 Changing the Ports
The Ports choice, as shown in Figure 2-7, allows you to specify the ports that Plone listens to for
incoming connections such as HTTP File Transfer Protocol (FTP), and Web-based Distributed
,
Authoring and Versioning (WebDAV).
21
Figure 2-7. The Ports page displays the ports on which Plone is running
As mentioned when installing Plone, you’ll want to ensure that no other server is listening to
the same port as Plone servers such as II:S, Apache, and Personal Web Server (PWS) could
be listening to port 80. At the time of writing, only the Plone HTTP and Zope Management
HTTP ports are enabled; to enable them, you have to go into a text file to configure them. The
following are the four fields on the Ports page:
Plone HTTP: This field specifies the port to access Plone for the user. The default
is port 80, the standard default for a Web server. Although this port isn’t required,
without it you won’t be able to access Plone with a Web browser. If this port is
enabled and Plone is running, the View Plone button is enabled on the Status page.
Zope Management HTTP: This field specifies the port to access Plone as the man-
ager. The default is port 8080. This port gives you access to Zope Management
Interface (ZMI) for the root of Zope. You can still get to this through the HTTP
port; however, it’s easier and more convenient to have a separate port. If this port
is enabled and Plone is running, the Manage Plone button is enabled on the Status
page.
FTP Access: This field specifies the port to access Plone via FTP The default is
.
blank, meaning that this isn’t enabled; if you want to enable this, the usual port is
21. You can use FTP to transfer large files to and from Plone.
WebDAV Source: This field specifies the port to access Plone via WebDAV The .
default is blank, meaning that this isn’t enabled; if you want to enable this, the
usual port is 8081. (WebDAV is a protocol for remotely authoring content in Plone.
With WebDAV you’re able to perform tasks such as mapping your Plone server to a
,
Windows drive letter.)
22
2.1.1.2.2 Using the Emergency User Page
Chapter 9 covers the Emergency User page, but, put briefly, it allows you to get emergency
access to your system should you forget your username or password.
2.1.1.2.3 Starting Plone in Debug Mode
Up to this point, you’ve started and stopped Plone in production mode. This is the fastest way
to run Plone and is recommended. For developing add-ons in Plone or debugging problems,
you’ll need to start Plone in debug mode. This mode is the recommended way of running Plone
when you’re developing products and skins, as you’ll do in later chapters. This method isn’t
the default because you’ll note that Plone is about ten times slower than normal.
To start Plone in debug mode, select Start - Programs - Plone - Plone (Debug Mode), and
a command prompt will appear; all the log information will be printed to this window (see
Figure 2-8).
Figure 2-8. Running Plone from the command line
To test that Plone is running, start a browser and go to http://localhost/; if Plone is installed
successfully, you’ll see the Plone welcome screen.
2.1.2 Installing Plone on Mac OS X, Unix, and Linux
The installations for Mac OS X, Unix, and Linux are different, but the configurations are similar.
Specific packages exist for different operating systems, including Mac OS X, Debian, Gentoo,
FreeBSD, OpenBSD, and RPM Package Managers (RPMs) for Red Hat, SuSE, and Mandrake.
In the following sections, I’ll cover some of the more popular: Mac OS X, Red Hat, and Debian.
For information about your specific operating system, consult the installation instructions for
the specific installation system.
23
2.1.2.1 Installing on Mac OS X
The installer automates the installation of Plone on Mac OS X and has been tested on ver-
sion 10.2.3 and later. You’ll need administrator access on the computer on which you want
to install. You can download this installer from http://ww.plone.org/download. Once you’ve
downloaded the installer, double-click the installer to decompress the archive, and double-click
the resulting installer package to begin the install. You should see the screen shown in Figure
2-9.
Figure 2-9. Authorizing the installation using your Mac OS X password
Enter your Mac OS X account password to authorize the installation; your account must have
administrator privileges to do this. If your account doesn’t have administrator privileges, log
out and log back in as someone who does and then relaunch the installer. You may want to
move the installer package to /Users/Shared before you log out so you can access it from the
other account. Once the installation is authorized, you’ll see the screen shown in Figure 2-10.
24
Figure 2-10. Welcome to the installer.
The installer goes through the usual steps for installing software. Click the Continue and Go
Back buttons at the bottom as necessary; most of the steps are self-explanatory. However,
when presented with the choice of volumes to install Plone on, you must choose the partition
on which Mac OS X is installed (see Figure 2-11).
::image:: img/3294f0211.png
Figure 2-11. Choosing the boot volume
The installation takes about five minutes, depending upon the speed of your computer. When
the installation has finished, Plone isn’t started by default. The ReadMe.rtf file in /Applica-
tions/Plone contains a lot of useful information about running and managing your Plone in-
stallation, including how to start Plone. For example, running the following command will
start Plone:
sudo /Library/StartupItems/Plone/Plone start
To test whether Plone has worked, use a browser to go to http://localhost:9090/; you should
see the Plone welcome page. Also in that ReadMe file you’ll find the username and password
that Plone has set up for you to access the server.
25
2.1.2.2 Installing Using an RPM
RPMs are available for the Red Hat, Mandrake, and SuSE distributions. You can download
the latest packages from http://www.plone.org/download. The RPM requires that Python 2.3 is
installed. To find out which version of Python you have, run the following command in a shell:
$ python -V
Python 2.3.2
In this case, Python 2.3.2 is installed; if you don’t have this, RPMs for Python are available
from the Python Web site at http://www.python.org. After downloading the files, install us-
ing the standard rpm command; fortunately, the Plone installation prints some really useful
information. For example:
[root@lappi i386]# rpm -ivh Plone2-2.0.0rh-2.i386.rpm
Preparing... ###########################################
[100%]
Making group plone (not altered if already exists).
Making user plone.
~ 1:Plone2 ###########################################
[100%]
Creating initial ’main’ instance...
Instance created. Listening on 127.0.0.1:8080, initial user: ’plone’
with password: ’plone’.
Setup of initial database in ’main’ instance...
/usr/lib/plone2/lib/python/AccessControl/Owned.py:79:
DeprecationWarning: Owned.getOwner(1) is deprecated; please use
getOwnerTuple() instead.
~ DeprecationWarning)
Created initial database content.
look at /etc/plone2/main/zope.conf.
Run then "/etc/rc.d/init.d/plone2 start" to start Plone2.
you may create new Plone instances with mkploneinstance.
As shown in the previous output, to start Plone, run the following:
/etc/rc.d/init.d/plone2 start
To test that Plone is working, use a browser to go to http://localhost:8080/; you should see
the Plone welcome page. The username plone* and the password *plone have been created for
you*.*
2.1.2.3 Installing on Debian Linux
Plone is a standard package in Debian and moves through the standard release process, so
you’ll want to either get the stable or get the unstable version of Plone, depending upon how
your Debian installation is configured. To install Plone, simple use Debian’s apt system to get
the package. This is an example installation:
26
agmweb:/home/andy# apt-get install plone
Reading Package Lists... Done
Building Dependency Tree... Done
The following extra packages will be installed:
zope zope-cmf zope-cmfcalendar zope-cmfcore zope-cmfdefault
zope-cmfplone zope-cmftopic zope-cmfworkflow
zope-formulator zopectl
Suggested packages:
zope-cmfwiki python-unit zope-devguide zope-book
Recommended packages:
zope-cmfforum zope-localizer
The following NEW packages will be installed:
plone zope zope-cmf zope-cmfcalendar zope-cmfcore zope-cmfdefault
zope-cmfplone zope-cmftopic zope-cmfworkflow
zope-formulator zopectl
0 upgraded, 11 newly installed, 0 to remove and 49 not upgraded.
Need to get 4743kB of archives.
After unpacking 24.9MB of additional disk space will be used.
Do you want to continue? [Y/n]
Press Y to continue and install all the required packages. To start and stop Zope, an install
script has been created in the init.d directory, called zope. To start Plone, run the following:
/etc/init.d/zope start
The Debian installer starts Zope on the nonstandard port 9673. Since the Debian installer
is quite unusual, it’s recommended that you read the documentation for the packages at
/usr/share/doc/zope and /usr/share/doc/zope-cmfplone.
2.1.3 Installing from Source
As an alternative to using an installer or package, you can install from the source tarball. If
you’re familiar with installing from source, it’s actually rather simple but does require famil-
iarity with basic tools such as tar. The following sections demonstrate how to install it on
Linux.
This installation assumes you’re familiar with basic operations such as ’untarring” files and
moving files. This requires a working Zope installation.
NOTE To install Zope, see the Zope installation instructions in the
doc/INSTALL.txt file of your Zope download. For more information, see
http://zope.org/Documentation/Books/ZopeBook/2_6Edition/InstallingZope.stx).
Follow these steps to install Plone:
1. Download Plone 2 from http://www.plone.org/download, and select the
tarball file.
27
2. Unzip the archive using the following: tar xzf CMFPlone2.0.tar.gz
3. You’ll find that a directory has been created called CMFPlone-xxx, where
xxx is the version (for example, CMFPlone-2.0).
4. Move the contents of that directory into your Zope installation’s Product
directory. For example, if the Zope Products directory is in /var/zope,
then do this: mv CMFPlone2.0/ /var/zope/Products*
After completing this installation, restart Zope. Once Zope has restarted, access Zope by open-
ing a browser and going to http://localhost:8080/manage. You’ll need a username and pass-
word for this (for example, the username and password you gave during the Zope installation).
In the ZMI, there’s a drop-down list of products you can add located in the top-right corner.
Ensure that Plone Site is one of the options. If so, your installation is complete (see Figure
2-12).
Figure 2-12. Plone Site in the drop-down list
2.1.3.1 Installing from CVS
Concurrent Versioning System (CVS) access is recommended only for experi-
enced users and developers. You can find current CVS access information at
http://ww.plone.org/development/cvs. The current CVS checkout command is as follows:
cvs -d:pserver:anonymous@cvs.sf.net:/cvsroot/plone login
cvs -d:pserver:anonymous@cvs.sf.net:/cvsroot/plone co CMFPlone
Plone 2 has a whole host of other dependencies (such as DCWorkflow, Formulator, Group User
Folder, and so on) that aren’t in Plone CVS, meaning users will have to go and find all these
dependencies. When you start Plone, it’ll print any errors regarding packages not found. For
example:
28
2003-11-21T12:23:11 ERROR(200) Plone Dependency
CMFActionIcons not found. Please download it from http://cvs.zope.org/Products/
2.1.3.2 Adding a Plone Site
Once you’ve installed Plone from source, you need to create an instance of Plone. To do
this, you’ll need to log into the ZMI and add a Plone site. You can access this by going
to the Uniform Resource Locator (URL) for the management interface, which is normally
http://localhost:8080/manage (this port will change depending upon your installation). You’ll
need a manager’s username and password for access to the ZMI; this password is created
during the Zope installation.
NOTE If you’ve forgotten the password for Plone that was created in the installa-
tion, don’t panic. You can create a new one; see Chapter 9 for more information.
You add all objects via the drop-down list in the top-right corner, as shown in Figure 2-12.
Scroll down the list until you find Plone Site, and click Add.
After selecting the option Plone Site, a form will display that prompts for some more informa-
tion (see Figure 2-13):
• Id: This is the unique ID of the Plone site (for example, enter Plone
or Site).
• Title: This is the title of the Plone site (for example, enter My Por-
tal).
• Membership source: For the moment, leave this as the default op-
tion, Create a New User Folder in the Portal. This allows you to have
user authentication somewhere other than the portal (see Chapter 9
for more information).
• Description: This is a description of the portal that members will
see in e-mails, (for example, enter A site all about the exciting
new widget technology). Don’t worry too much about this; you
can always change this later in the portal’s properties.
29
Figure 2-13. Adding a Plone site
After clicking Add Plone Site, a Plone site will be created. This may take a minute or two on
slower machines because a great deal of processing occurs. The screen will then redirect you
to the Plone welcome page.
2.1.4 Configuring the Web Server
Once Plone has been installed, you may want to configure the Plone site so that it runs on a
different port, has FTP capabilities, logs to a different file, and so on. This section covers these
basic setup issues. Note that you aren’t configuring the Plone sites themselves; you’re altering
the configuration of the underlying Web server.
NOTE If you’ve installed on Windows using the Windows installer, then most of this
configuration is provided through a nice user interface program; see ’Configuring
the Server on Windows” earlier in this chapter.
NOTE If you’ve installed using Mac OS X or the Windows installer, then you’ll find
one extra file (plone.conf), which contains port definitions used in the main Zope
configuration file.
30
Zope 2.7 creates a configuration file inside each instance installed. All the configuration for the
server is located in that one file. A full list of the configuration options is available in Appendix
A. To find the configuration file, look for a file called zope.conf located in the etc folder of your
Plone installation. Some installers (Windows and Mac OS X, for example) create a second
configuration file called plone.conf that contains Plone-specific configuration options. If your
installation contains a plone.conf file, then use that configuration file to make changes; they’ll
be included in the main configuration file.
The configuration file is extremely verbose and contains a great deal of useful comments and
examples. If you’re familiar with Unix configuration files such as Apache, then you’ll find the
Zope configuration file familiar. To alter Zope configuration, open the configuration in a text
editor, and change the lines as needed; after altering the configuration, you’ll need to restart
Zope.
It’s possible to run Plone 2.0 with a version of Zope prior to 2.7; however, Zope 2.7 offers
increased stability and new features, including easier configuration. If you’re using a version
of Zope prior to 2.7, you’ll need to read the documentation on how to change the configuration.
2.1.4.1 Adjusting the Ports
To change a port, add the address lines for that port. For example, to run Plone on port 80
instead of the default, change the following bold line in zope.conf:
<http-server>
# valid keys are "address" and "force-connection-close"
address 8080
# force-connection-close on
</http-server>
to the following:
<http-server>
# valid keys are "address" and "force-connection-close"
address 80
# force-connection-close on
</http-server>
If you used the Windows or Mac OS X installer, then you’ll find these port definitions in
plone.conf. These values are then imported into the main configuration file. So, on a Mac
to change the port, you’ll edit plone.conf from this:
## PLONE_WEBSERVER_PORT
## --------------------
## This is the port you will access your Plone site from. Set this to a port
## number above 1024 not used for any other server on your computer.
%define PLONE_WEBSERVER_PORT 8080
to the following:
%define PLONE_WEBSERVER_PORT 80
31
2.1.4.2 Using the Debug Mode
By default in Zope 2.7 debug mode is enabled. Note that Plone runs significantly slower in
debug mode, approximately 10-20 times slower. To turn this off, add the following line to the
configuration file:
debug-mode off
To make the out-of-the-box experience more impressive for Windows users (debug mode slows
Plone down on Windows even more than on Linux), it ships with debug mode off already.
If you have a Plone site running and want to know if debug mode is running, go to por-
tal_migration in the ZMI and look at the variables listed there; this will tell you if debug mode
is enabled.
2.1.4.3 Using Logs
By default there are two logs in Plone: an access log that you can produce site statistics from
and an event log that contains debug information about Plone products. The event log is the
place to find errors and messages in Plone. The default configuration looks like the following:
<eventlog>
level all
<logfile>
path $INSTANCE/log/event.log
level INFO
</logfile>
</eventlog>
<logger access>
level WARN
<logfile>
path $INSTANCE/log/Z2.log
format %(message)s
</logfile>
</logger>
This is where you can change the path to the file by defining a new file. The values that are
logged are based upon a level sent with error messages; more serious messages are sent with
higher levels. By default, only information and the previous message are sent to the log, but
that value could be one of the following: CRITICAL, ERROR, WARN, INFO, DEBUG, and ALL. If
you wanted to log only errors, then you’d change level INFO to level ERROR.
3 Chapter 3
3.1 Adding and Editing Content
Adding and editing content is a simplification of the sheer power that Plone has available to
leverage. Creating content-rich and feature-rich Web pages with Plone is an absolute breeze.
If you have Plone installed locally, then this chapter shows you how Plone works straight out
of the box. However, if you don’t have Plone installed, then don’t worry; you can try Plone
online by going to http://demo.plone.org.
Before you can alter or edit a Plone site, you need to log into a Plone site. If you installed
Plone, you should have the username and password that came with the installation. This user
has the role of an administrator user, which allows you to log in and alter any content. Most
users of a Plone site will join the site and log in through the login process described in the
’Joining a Site’ section. Users can, of course, view a Plone site without logging in, but they
won’t be able to add or edit content.
In this chapter, I’ll go through the steps a user takes to create content on a Plone site. First, I’ll
cover how to join the site and log in. Once you’ve accomplished this, I’ll cover how to create
and then edit a document. Finally, I’ll show how you can search and publish this content. In
short, this chapter covers how to use Plone.
3.1.1 Joining a Site
When you join a Plone site, you create an account on the server. That account gives you the
right as a member to add content such as images, documents, and so forth. To join a site, click
the join link in the top-right corner of the Web site (see Figure 3-1).
Figure 3-1. Clicking the join link in the top-right corner of the page
This will take you to a registration form that you’ll have to complete (see Figure 3-2). Because
this is the first Plone form you’ve encountered, take note of the following:
• Some fields are required; a little red box next to the text indicates
the required fields.
32
33
• For most fields, some grayed-out help text beneath the field name
indicates what you should enter.
Figure 3-2. The registration page
NOTE Because many of the Plone pages are quite large, the figures in this book
have been cropped to show only the key parts (in this case, the form) and not the
Plone logo or the footer. These elements are still there, but they’re superfluous.
34
To complete the form, complete the fields that are reasonably obvious. The values of the fields
are as follows:
Full Name: Enter your full name. This field is optional.
User Name: Enter the username you want to use. Most people choose an alphanu-
meric value without spaces, such as bob or jane97. This username will be used
throughout the Web site to refer to you. This field is required.
E-mail: A valid e-mail address is required. This will allow the site administrator
to contact you and to send a password to you. You can change this e-mail address
later by editing your member preferences. This field is required.
Password and Confirm Password: This is the password you want to use; it must
be more than four characters and can contain letters, numbers, and the underscore
(_) character. Passwords are case sensitive (in other words, SomePassword isn’t the
same as somepassword). These fields are required.
Send a mail with the password: Check this box if you’d like your password sent
to the e-mail address you provided. This field is optional.
Once you’ve completed this form, click Register to submit your information. If you’ve made
any errors on this form, then you’ll see a message at the top and the key fields that have an
error highlighted. In Figure 3-3 I entered a password but didn’t enter a value for the Confirm
Password field. Again, this is the standard way that Plone forms will show errors to you.
35
Figure 3-3. Errors on a form
If you’ve completed the form correctly, then you’ll be given the option of logging in immedi-
ately. Click the Log In button to log in. You’ll see the page shown in Figure 3-4.
36
Figure 3-4. After registering
If you already have a username and password or are returning to a site you’ve previously
joined, then you can enter your name and password in the boxes in the left column of the site
and click the Log In button.
3.1.2 Enabling Cookies
To log into a Plone site, you must have cookies enabled. If you access a Plone site and try to log
in with cookies disabled, you’ll get a friendly message telling you that cookies must be enabled
with a link to more information. To enable cookies, perform the following steps, depending on
your browser.
Internet Explorer 6.x 1. Select Tools > Internet Options.
2. Click the Privacy tab at the top of the screen.
3. Move the slider to Medium, and click OK.
Internet Explorer 5.x 1. Select Tools > Internet Options.
2. Click the Security tab at the top of the screen.
37
3. Click Custom Level, and scroll down to the Cookies section.
4. Set Allow Per-Session Cookies to Enable, and click OK.
Internet Explorer 4.x 1. Select View > Internet Options.
2. Click the Security tab at the top of the screen.
3. Click Custom Level, and scroll down to the Cookies section.
4. Select Always Accept Cookies or Prompt Before Accepting Cookies, and click
OK.
Mozilla 1.x 1. Select Edit > Preferences.
2. Find Privacy & Security in the menu on the left. If there’s a plus sign (+) to
the left of Privacy & Security, click it.
3. Select Cookies under Advanced.
4. Select Enable Cookies for the Originating Web Site Only or Enable All Cookies,
and click OK.
Opera 1. Press F12.
2. Click Enable Cookies.
Netscape Navigator 6.x 1. Select Edit > Preferences.
2. Find Privacy & Security in the menu on the left. If there’s a triangle pointing
to the right next to Privacy & Security, click it.
3. Select Cookies under Privacy & Security.
4. Select Enable Cookies for the Originating Web Site Only or Enable All Cookies,
and click OK.
If you forget your password at some point, you can get it sent to the e-mail address provided
when you registered with the Plone site. To have your password mailed to you, click the
Forgot your password? link located in the left column of the Web site. This will bring up the
forgotten password form, as shown in Figure 3-5; enter your login name, and a password will
be e-mailed to you.
38
Figure 3-5. Getting a forgotten password
Unfortunately, if you have no longer access to that e-mail account, or you can’t even remember
the username, you’ll have to contact a site administrator. Using the techniques discussed in
Chapter 9, the administrator can change your e-mail and find your user account. Once logged
in to the Plone site, you’ll see a log out link in the upper-right corner. When your work is
finished, it’s good practice to log out of Plone site, especially if you’re accessing it from a
computer that’s likely to be used by other people.
3.1.3 Setting Up Your Folder and Preferences
After you’ve logged in, the member bar in the top-right corner will change to represent the
options available to you as a member of the site (see Figure 3-6).
39
Figure 3-6. Your personal choices in the top-right corner have changed.
One of these options is that each member has a folder created for them when they join a site.
This folder is set up with particular security so only that member (and administrators) can add
and edit the content in that folder. To access your personal folder, click the my folder link in the
personal bar in the upper-right corner of the site. In the upper-right corner you’ll also see a my
preferences link; clicking this will open a list of personalization options. You’ll see two choices
at the moment; you can change your password, or you can go to the personal preferences and
change key preferences in your site.
The change password form allows you to change your password. To complete the form, give
your current password and the new password twice. After you’ve changed your password, the
change will be immediate. You don’t have to log in again; just remember your new password
when you return.
The personal preferences form allows you to set a number of preferences that change how you
see the site. These preferences are stored on the server so they’re retained between uses of the
site (see Figure 3-7).
40
Figure 3-7. Changing preferences
The options are as follows:
Full name: This is the full name you gave when you registered with the site.
E-mail: This is the e-mail address associated with your membership and is used
a number of places in a Plone site. Most important, if you lose or forget your
password, this is the address to which the system will send it.
41
Content editor: When editing complex content, you may want the help of an
editor. If your site administrator has made one available, you can select it here. It
will then be used when you click the edit tab of an object. If you’re unsure, leave
this as the default.
Listed status: This property specifies whether your profile will show up on the
members tab and when someone searches the members listing.
Editing of Short Names: Objects have an ID or Short Name property that’s used for
the internal representation of the content object. This also shows up in the item’s
Web address and the item’s Uniform Resource Locator (URL). By default these look
something like News_Item.2002-11-16.4102, but you could make it much simpler,
such as november_news, by changing the Short Name value.
NOTE When you change an object’s name value, anything that references the older
name will no longer be valid and will result in the page not being found. It’s best
not to change the name value after you submit an object for review or link to it
from elsewhere. For this reason, I recommend setting this option to No.
Portrait: In larger organizations and in community Web sites, it’s useful to see
pictures of other members. The Portrait field allows you to upload a picture of
yourself. The picture should be 75 by 100 pixels.
Once you’ve made the desired changes, click the Save button to commit the changes. Now that
you’ve logged in, it’s time to start adding and editing content.
3.1.4 Adding and Editing Documents
As mentioned, now that you’re a site member, a folder has been created for you where you
can store content. Of course, you can add content to any folder that the site administrator has
given you the right to do so, but by default every user can add content to their member folder.
Each type of content you can add is distinct, and you can edit and view it in different ways.
For this reason, Plone references each type of content differently; for example, you can add
images, links, documents, and so on. Out of the box, Plone provides the following content
types:
• Document: This is an item that presents some static information to the user.
This is the most common type of content added and most closely represents a
typical Web page.
• News item: This is a document that’s to be shown under the news tab (for
example, a press release).
• Link: This is a link to another item, which may be internal or external to
another Web site.
• Image: This is an image, such as a .gif or .jpeg file.
• Event: This is an upcoming event, meeting, conference, or other event.
• Folder: This is like a folder on a hard drive; this is a folder for putting content
into so that it’s easy to find later.
42
• Topic: This is a grouping of other content. This is essentially a saved search
criteria that you can reuse later. Only privileged site users can add topics.
• File: This is another piece of content such as a movie, sound clip, text file,
spreadsheet, compressed file, or anything else you’d like to upload.
I’ll go through each of these items using the document as an example, showing in detail how
to add and edit documents easily and quickly. Using these basic content types, I’ll show you
how to build a dynamic site through a browser, without doing any programming.
Actually, you have many ways of adding and editing content in a Plone site than just through a
Web browser. Access via File Transfer Protocol (FTP), via Web-based Distributed Authoring and
Versioning (WebDAV), or via scripts is all possible. I’ll discuss how to set these up in Chapter
10 and just deal with the Web browser interface for now. In Chapters 11 to 13 of this book, I’ll
discuss how to make new custom content types that you can tailor to a particular site’s needs.
3.1.4.1 Understanding the Document Content Types
Rather than detailing how to add and edit all the different types of content available, I’ll
cover adding one type of content, a document, in detail. After adding and editing a few of
these documents, the approach to adding content should be second nature, and editing other
content will be easy.
A document is a page of content, usually a self-contained piece of text. Although all items
added to Plone are accessible as Web pages, if there’s one content type you could think of as
a Web page, this is it. The default home page for a Plone site that you’ve seen already - the
now-famous Welcome to Plone page - is one example of a document (see Figure 3-8).
43
Figure 3-8. Welcome to Plone, a simple document
3.1.4.2 Adding a Document
You have two ways to add any piece of content using a Web browser. First, ensure you’re
logged in, because only logged-in users can add content. Second, select the my folder link from
the top-right navigation bar. This will take you to your home folder, an area that you control.
44
If you’re able to add content to a folder, then the folder will show up with the green border
around the top (see Figure 3-9).
Figure 3-9. My content
If the green border doesn’t appear, then you won’t be able to add content; this border contains
the actions you can perform in the current location. In Figure 3-9, you can see that the page
shows the contents of the folder, because that’s the highlighted tab. Other tabs appear such as
view, sharing, and properties for more advanced options. In the top-right corner of the green
border, you’ll see an Add New Item drop-down menu and a State drop-down menu. Click the
Add New Item menu to open a drop-down list of items to add (see Figure 3-10).
45
Figure 3-10. Adding a document from the green drop-down menu
To add a new document, select Document. Alternatively, if you look in the body of the page,
you can see another Add New Item drop-down box. Again, click the down arrow to open a list
of items that can be added and then select the item you’d like to add (see Figure 3-11).
Figure 3-11. Adding a document from the main folder’s content menu
Using the Add New Item list from the green border is a handy menu since it’s available most
of the time.
NOTE **If you’re familiar with Zope, you should never, never, never add con-
tent from the Zope Management Interface (ZMI). Depending upon how you’ve
installed Plone, you may have already seen the ZMI and used it for customiz-
ing and developing Plone through the Web. However, adding content through
the ZMI will create content items that are incomplete and don’t ***Begin Side-
bar*
3.1.4.3 Understanding Where to Add Content
The easiest place to add content at the beginning is in the user’s member folder, accessi-
ble by clicking the my folder link. Although this is useful, it’s probably not the best ap-
proach for a long-term solution. Most noticeably it creates long URLs (for example, /Mem-
bers/andy/Docum....). It also means your content isn’t accurately reflected in the navigation
tree.
As you’ll see later, a few solutions exist for this; the most common solution is to make a folder
and give certain users the right to access it. For example, that folder may be Help or News. The
’Using Folder” section later in this chapter discusses adding folders, and Chapter 9 discusses
using group workspaces and security.
3.1.4.4 Editing a Document
Once you’ve clicked to add a document, you’ll be taken directly to the edit page with a mes-
sage telling you that the document has been created. If this doesn’t happen, you can click a
document and then click the edit tab. Again, you’ll see that the edit tab becomes highlighted
in green (see Figure 3-12).
46
Figure 3-12. Editing a document
Now you can edit the document in your Web browser, using the form provided. If you look at
the URL in the address bar of your browser, you’ll note that a short name for the object has
been created for you, something such as Document.2003-12-29.43787. The following is a list
of the fields and their meanings:
Short name: The short name will become part of the document’s URL, so keep the
name short and descriptive, preferably without spaces. Keeping to these rules will
make URLs easier to read. For example, use something such as audit-report-2003.
If you don’t provide a name, Plone will create one for you.
47
NOTE This field won’t appear if you selected No for the short names in your pref-
erences page.
Title: This is the title for the item, and it’ll be shown throughout the site (for
example, at the top of the page, in the search interface, in the title of the browser,
and so on). This field is required.
Description: This is a short lead-in to the document, usually about 20 words to
introduce the document and provide a teaser for the remainder of the document.
This is useful for pages that show summaries of documents, such as search results
and folder contents.
Body text: This contains the body of the document. The format for the content is
set using the Format field (described next).
Format: You have three choices for the format of body content: Structured Text,
HTML, and Plain Text. These types of text are discussed in the ’Choosing a Text
Format” sidebar; if you’re unsure, leave this field alone and type the body text as
usual.
Upload document: If you do have your document as a file on your computer, you
can upload it instead of typing the content into the Body Text field. Use the Upload
button at the bottom of the page to select a file. The contents of an uploaded file
will replace any content in the Body Text field.
Once you’ve finished editing your document, click the Save button to commit your changes.
You’ll be returned to the view tab where you can see how the document will be shown to users
(see Figure 3-13); to edit it again, click the edit tab.
&
First Edition
16th May 2005
1
Table of Contents
1 Chapter 1
1.1 Introducing Plone
1.1.1 What Is a Content Management System?
1.1.2 Do You Want a Content Management System?
1.1.3 Introducing Plone’s Features
1.1.4 Getting Involved in Plone’s Development
2 Chapter 2
2.1 Installing Plone
2.1.1 Installing Plone on Windows
2.1.2 Installing Plone on Mac OS X, Unix, and Linux
2.1.3 Installing from Source
2.1.4 Configuring the Web Server
3 Chapter 3
3.1 Adding and Editing Content
3.1.1 Joining a Site
3.1.2 Enabling Cookies
3.1.3 Setting Up Your Folder and Preferences
3.1.4 Adding and Editing Documents
3.1.5 Adding and Editing Other Types of Content
3.1.6 Organizing Content
3.1.7 Discussing and Finding Content
3.1.8 Example: Creating the Plone Book Web Site
4 Chapter 4
4.1 Making Simple Customizations
4.1.1 Administering Sites
4.1.2 Using the ZMI
4.1.3 Customizing Plone’s Look and Feel
5 Chapter 5
5.1 Introducing Basic Plone Templating
5.1.1 Understanding the Underlying Templating Machinery
5.1.2 Using the Zope Page Templates System
5.1.3 Understanding the Page Template Basic Syntax
6 Chapter 6
6.1 Introducing Advanced Plone Templating and Scripting
2
6.1.1 Understanding Advanced Plone Templating
6.1.2 Scripting Plone with Python
6.1.3 Useful Tips
6.1.4 Using Forms
7 Chapter 7
7.1 Customizing the Look and Feel of Plone
7.1.1 Introducing Plone Skins
7.1.2 Customizing Skins
7.1.3 Making New Skins and Layers
7.1.4 Case Study: Examining the NASA Skin
8 Chapter 8
8.1 Managing Workflow
8.1.1 What Is Workflow?
8.1.2 Understanding Workflow in Plone
8.1.3 Adding and Editing Workflow
8.1.4 Common Tasks and Examples
9 Chapter 9
9.1 Setting Up Security and Users
9.1.1 Administering Users
9.1.2 User Registration Tools
9.1.3 Setting Permissions
9.1.4 Scripting Users
9.1.5 Integrating Plone with Other Services
10 Chapter 10
10.1 Integrating with Other Systems
10.1.1 Open-Source Licensing
10.1.2 Installing Plone Products
10.1.3 Using a Different Web Server
10.1.4 Integrating Plone with the File System
11 Chapter 11
11.1 Manipulating and Categorizing Content Types
11.1.1 An Overview of Content Types
11.1.2 Searching and Categorizing Content
12 Chapter 12
12.1 Writing a Product in Python
3
12.1.1 Writing a Custom Content Type
12.1.2 Writing a Custom Tool
12.1.3 Adding Some User Interface Elements
13 Chapter 13
13.1 Developing with Archetypes
13.1.1 Introducing Archetypes
13.1.2 Putting Together the Rest of the Content Type
13.1.3 Archetypes based Development
13.1.4 Setting Up a Content Type
13.1.5 Setting Up a Transformation on Windows
13.1.6 Testing the Content Type
13.1.7 Making a Content Type Persist in a Relational Database
14 Chapter 14
14.1 Administering and Scaling Plone
14.1.1 Administering a Plone Site
14.1.2 Improving Plone Performance
14.1.3 Using Zope Enterprise Objects
1 Chapter 1
1.1 Introducing Plone
A company without a Web site is unthinkable—and most companies and organizations have
more than one site. Whether it’s an external site for communicating with clients, an intranet
for employees to use, or a site for direct client communication and feedback, all Web sites have
a common problem—how to manage the content on them. This is a challenge that can often
cost organizations large amounts of time and effort. Producing a powerful yet flexible system
for these sites that meets ever-changing requirements while growing to meet your company’s
emerging needs isn’t easy.
No matter what the requirements for your Web site are or the amount of content or users,
Plone is a user-friendly, powerful solution that lets you easily add and edit any type of content
through the Web, produce navigation and searches for that content, and apply security and
workflow to that content.
Plone enables you to put together almost any Web site and easily update it. This lets you
build content-rich sites quickly so you can gain a competitive advantage. Finally, probably the
best things about this system are that it’s free and it’s open source. With its large and impres-
sive feature set, it’s comparable, if not better than, many closed-source content management
systems that cost hundreds of thousands of dollars.
Mike Sugarbaker says the following when reporting on the Open Source
Content Management Conference (OSCOM) in 2002 for the Mindjack site
(http://www.mindjack.com/events/oscom.html):
“I won’t do the complete rundown of all the ’competing’ open-source content management
frameworks. I’ll cut to the chase: The winner is Plone. This ’productized’ take on the six-year-
old web application framework Zope was the package with the most tools, the most profes-
sionalism, the most traction, and, above all, the most buzz.”
You can find the Plone Web site at http://www.plone.org, as shown in Figure 1-1. To try Plone
easily, a demonstration site is available at http://demo.plone.org. There you can quickly and
easily add and edit content through the Web. Specifically, you can add events, upload pictures,
add documents, and process them all through the framework that Plone provides.
4
5
Figure 1-1. The Plone Web site
1.1.1 What Is a Content Management System?
One simple definition for a Content Management System (CMS) is that it’s a system for man-
aging content. This is a rather unhelpful definition, so I’ll break it down into smaller parts for
a fuller explanation. I’ll start with a broad definition of content: Content is a unit of data with
some extra information attached to it. That piece of data could be a Web page, information
about an upcoming event, a Microsoft Word document, an image, a movie clip, or any piece of
data that has meaning to the organization deploying the system.
6
All these items are called content, and they all share similar attributes, such as the need to be
added or edited by certain users and be published in various ways. A system called workflow
controls these attributes. Workflow is logic defined by the organization’s business rules, and it
describes a system for managing the content.
Historically there has been a difference between document management systems and CMSs,
but mostly these two systems have converged. The essential difference is the items being
managed; it’s often considered that content is any unit of information, and a document refers to
something that’s created and edited by humans using software such as Microsoft Office. Take,
for example, a book: A book contains many units of data and may require management slightly
different from that required by content. However, in most cases, this is a small difference, and
products such as Plone are able to manage the small units of a larger piece of content and
reassemble them.
With the ubiquitousness of the Web, many CMSs are now classified as Web CMSs, either be-
cause they have a Web-based interface or because they focus on a Web-based delivery system
over the Internet or an intranet. Plone provides a Web management interface and Web-based
delivery system.
The following is one definition of a CMS (http://www.contentmanager.eu.com/history.htm):
A CMS is a tool that enables a variety of (centralized) technical and (decentralized)
nontechnical staff to create, edit, manage and finally publish a variety of content
(such as text, graphics, video, and so on) whilst being constrained by a centralized
set of rules, process, and workflows that ensure a coherent, validated Web site
appearance.
1.1.2 Do You Want a Content Management System?
Although not the only advantage of a CMS, the most obvious benefit of a CMS is coordinating
a Web site easily. Take a situation where one person, a Webmaster, coordinates a Web site,
either an intranet or an external site. Content comes from users in a variety of formats, and
the Webmaster turns these into usable Web pages by converting them to Hypertext Markup
Language (HTML). If a user has to change those pages, then the user sends the changes to the
Webmaster, who changes the pages, and so on.
This presents many problems for the organization, the biggest being that all content
is flowing through one person - an obvious bottleneck. That one person can do
only so much work, and if that person is sick or leaves the company, a great deal of
productivity is lost in finding a replacement. The publishing process can be quite
frustrating as e-mails fly between the Webmaster and the user trying to get content
published.
What’s needed is a system that does the following:
Separates the content of a page from the presentation: If the actual content is
separate from the presentation method, then the content author doesn’t need to
know any HTML or how the page is delivered. In fact, one piece of content could
7
have many different templates applied to it, including formats other than HTML,
such as Portable Document Format (PDF), or Scalable Vector Graphics (SVG). When
you want to change the look and feel of the site, you have to change only that one
template rather than all the content.
Allows certain users to add and edit content: If specified users can add and edit
content easily, then there’s no need to send content to the Webmaster or Web team.
Instead, the user who wants to create a page can do so and edit it as much as
necessary.
Applies rules to whom can publish what and when: Your business rules might
not want just anybody publishing content on your Web site; for example, people in
marketing would be able to publish to the press release part of the site and not to
the engineering section.
Can apply business rules to content: If a person from marketing creates a press
release, somebody in legal might need to review that document. In this case, the
document will be passed through a review process that ensures it won’t go live until
these reviews are done.
Can search and index information intelligently: Since the CMS can keep track
of structured information about the content (such as author’s name, publication
date, modification dates, categories, and so on), it can produce listings of content
by author, recent content, and so on. It can also provide searching capabilities that
are much smarter and more useful than just a simple textual search.
Although this example portrays paybacks that are more significant for large organizations,
organizations of all levels benefit from this approach. In fact, typically small organizations
that don’t employ a full-time Webmaster can be one of the key beneficiaries of such a system.
By installing a CMS, you can resolve all these issues and more.
The key factor of any CMS is that it provides a clear separation of the key elements in it:
security, workflow, templates, and so on. For example, the templates presenting an item are
separate from the content. This allows you to easily modify the presentation.
1.1.3 Introducing Plone’s Features
Plone is open source, licensed under the General Public License (GPL), which is a common
open-source license that allows anyone to use the source for free. For more information about
the GPL, go to the Free Software Foundation Web site at http://ww.gnu.org. You can examine
any aspect of Plone’s code and alter it to fit your application. There are no licensing fees to
pay, there’s no license that will expire, and all the code is visible. This open-source philosophy
means that Plone already has a large user base and legion of developers, usability experts,
translators, technical writers, and graphic designers who are able to work on Plone. By choos-
ing Plone, you’re not locked into one company; rather, nearly a dozen companies offer different
Plone services.
8
1.1.3.1 Packaging
Plone maintains easy installers for Windows, Linux, and Mac. Other third-party products and
add-ons also come with the installers. Maintaining quality releases of these products makes
installation and management easy. Also, each new release maintains migration paths and
updates so that your Plone site will keep working and stay up-to-date.
1.1.3.2 Internationalization
The whole Plone user interface is translated into more than 20 languages, including Korean,
Japanese, French, Spanish, and German. Inserting your own translation is easy (see Chapter
4).
1.1.3.3 Usability
Plone offers an excellent user experience that provides high levels of usability and accessibility.
This isn’t just a matter of presenting pretty HTML but instead goes to the core of Plone. Plone
provides an interface that’s compatible with the industry and government standard WAI-AAA
and U.S. Section 508. This allows sites built with Plone to be used by people with vision
disabilities. In addition, this provides the unexpected but related benefit that your page may
index better in search engines such as Google.
1.1.3.4 Skinnable
Plone separates the content from the actual templates used to present the content, often called
skins. The skins are written in the excellent HTML templating system, Zope Page Templates,
and a large amount of Cascading Style Sheets (CSS). With little knowledge of Plone, you can
apply multiple skins, achieve multiple looks, and totally customize your Web site’s appearance.
1.1.3.5 Registration and Personalization
Plone features a complete user registration system. Users register with a Plone site using their
own username, password, and any other information you might want to add about the user.
You can then personalize the whole user interface for that user. In addition, with add-ons, you
can use information you already have about users, coming from many places, such as relational
databases, Lightweight Directory Access Protocol (LDAP), Active Directory, and more. Chapter
8 covers how to register and configure users.
1.1.3.6 Workflow and Security
Workflow controls the logic of processing content through the site. You can configure this logic
through the Web using graphical tools. Site administrators can make sites as complex or as
simple as they’d like; for example, you can add notification tools such as sending e-mails or
instant messages to users. Chapter 8 covers workflow in great detail.
9
For every item of content in a Plone site, you can set up access control lists to decide who has
access to that item and how they’ll be able to interact with it. Will they be able to edit it, view
it, or comment on it? All this is configurable through the Web (see Chapter 9).
1.1.3.7 Extensible
Since Plone is open source, it can be easily altered. You can change and configure almost any
aspect of Plone to suit your needs. Countless packages and tools for Plone provide a wide ar-
ray of options for smaller sites and for large-scale enterprises. Repositories of free add-ons for
Plone are available at http://www.plone.org. With development tools such as Archetypes (cov-
ered in Chapter 13), you can generate and alter Plone code easily through the Web or using
Unified Modeling Language (UML) tools. Chapter 10 covers integration of Plone with enter-
prise solutions such as LDAP Apache, Microsoft Internet Information Services (IIS), Macrome-
,
dia Dreamweaver, and so on.
1.1.3.8 Content Customization
Users of a Plone site can add all manner of content, but the data added isn’t limited or con-
strained. Plone developers can create their own content types so that almost any type of
content can be managed; the only limit is your own imagination. In Chapters 11 and 12,
I’ll discuss how to customize the content types. Chapter 13 will introduce Archetypes, which
is a very powerful system for generating content types that don’t require programming; for
instance, you can generate new types of content from UML tools.
1.1.3.9 Documentation
The Plone project maintains documentation, including this book, which is published under the
Creative Commons license. The best starting place for the community documentation is at
http://www.plone.org/documentation.
1.1.3.10 Community
One of the best things about Plone is the community of developers and companies that sup-
ports and develops Plone. With more than 60 developers involved to some degree in the project
around the world, it’s almost always possible to find a Plone developer online who is willing
and able to help you. Alan Runyan, Alexander Limi, and Vidar Andersen started Plone; how-
ever, it quickly grew into a thriving open-source project as more developers became involved.
The contributions from these developers form the Plone product that’s now available.
1.1.3.10.1 Example Plone Sites
Many Plone sites exist; some are obvious because of their looks, and some aren’t. The following
is just a small sample of the more diverse sites:
10
Plone (*http://www.plone.org*) Plone Demo Site (*http://demo.plone.org*) Zope.org
(*http://www.zope.org*) Liquidnet (*http://www.liquidnet.com*) Design Science Toys
(*http://www.dstoys.com*) Give Kids the World (*http://www.gktw.org*) Propane
(*http://www.usepropane.com*) Maestro Headquarters (*http://mars.telascience.org*)
More Plone sites are available at http://www.plone.org/about/sites, including sites that provide
a quite different user interface. Without knowing about the development of these sites, it
would in fact be hard to tell that these sites use Plone.
1.1.4 Getting Involved in Plone’s Development
Although Plone has an impressive list of features, its list of ’wants’ even more impressive. For
this reason, the project is always on the lookout for new people willing to contribute time for
the project.
Fortunately, because Plone is focused on the end user, there’s a need for a very broad spectrum
of disciplines. Volunteers in a range of areas, rather than just coders or Web developers,
are welcomed. Plone needs user interface developers, usability experts, graphic designers,
translators, writers, and testers. You can find the current development status on the Plone Web
site at http://plone.org/development, and the best way to get involved is to join the mailing
lists or join the developers on an Internet Relay Chat (IRC) channel.
Plone is built on top of Zope and the Content Management Framework (CMF). To understand
Plone, you have to understand Zope and the CMF as the underlying architecture. For this
reason, I’ll explain these two items and how they integrate with Plone in this section.
Zope is a powerful and flexible open-source Web application server developed
by Zope Corporation (http://www.zope.org). Originally, Zope was developed as
a stand-alone CMS, but over time it didn’t satisfy the needs of its users. Then
Zope Corporation developed the CMF an open-source project. The CMF provides
developers with the tools necessary to create complex CMSs; it enables workflow,
provides site skinning, and offers other functions.
The CMF is a framework for a system; in other words, it provides the tools for developers to
build a product, rather than just providing an out-of-the-box system that users can use imme-
diately. Plone takes this and many other features and improves upon them to provide the user
with a high-quality product. Plone is a layer on top of the CMF, which is an application running
on top of Zope. Understanding the CMF is key to understanding Plone. Most administration
functions require the use of Zope’s administration interface, and developing Plone requires an
understanding of Zope and its objects.
This book doesn’t go into depth about Zope; rather, it gives you enough information
to complete tasks in Plone. Just reading this book will give you enough information
to customize and modify almost anything you want in Plone. For more information on
Zope, I recommend The Zope Book. Originally published by New Riders, it has since
been placed online and is updated by community members. It’s available free online at
http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition.
Both Zope and the CMF are key technologies that Plone needs; without them, Plone wouldn’t
exist. The Plone team owes a great deal of thanks to everyone at Zope Corporation for having
11
the vision to create and then offer both Zope and the CMF as open source. The list of people
I’d like to thank there and in the CMF communities is long. Thank you, everyone involved.
Zope is written in Python, a powerful object-oriented, open-source programming language
comparable to Perl or Tcl. Knowledge of Python isn’t required to use Plone or even to do some
basic administration; however, customizing products and scripting Plone does require some
Python.
Tommy Burnette, a senior technical director at Industrial Light Magic, says this about Python
(http://www.python.org/Quotes.html):
Python plays a key role in our production pipeline. Without it a project the size of
Star Wars: Episode II
If you plan to do anything sophisticated with Plone, take a day or two to learn the basics of
Python. Not only will this allow you to customize Plone substantially, but it’ll also familiarize
you with objects and how they interact in the Plone environment. Teaching you Python is
outside the scope of this book; instead, I assume you have a basic knowledge of Python. That
fundamental knowledge of Python will be enough to get you through this book and allow you
to customize the Plone installation easily.
Fortunately, Python is an easy programming language to learn; on average, it takes an experi-
enced programmer a day to become productive in it. New programmers take a little longer. If
you’re installing Plone using the Windows or Mac installers, then the correct version of Python
will be included. To download Python as separate product, for almost any operating system,
go to http://www.python.org.
The best way to master Python is to try it from the command Python interpreter. If you have a
Windows installation of Plone, there’s a link for the Pythonwin, a Python Integrated Develop-
ment Environment (IDE) already in the Start menu; go to Start - Programs - Plone - Pythonwin
(see Figure 1-2).
12
Figure 1-2. The Python prompt on Windows
On Linux and Mac OS X, usually typing python will start the Python interpreter:
$ python
Pyython 2.3.2 (#1, Oct 6 2003, 10:07:16)
[GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
Since Python is an interpreted language, instead of the whole Python script being compiled
and run, you can just send lines of code to the interpreter as you write them. This makes the
interpreter an amazingly useful place for testing and debugging code. In the interpreter, each
line waiting for input is prefixed with >>>.
For example, the simplest ’Hello, World” program is as follows:
>>> print "Hello, world!"
Hello, world!
>>>
To exit the interpreter, press Ctrl+D (press the D key while holding down Ctrl) on Linux
or press Ctrl+Z on Windows. (You’ll also use this later for more advanced Zope and Plone
interaction.) You can execute normal Python scripts by passing them to the interpreter; for
example, given the following script called hello.py:
13
print "Hello, world!"
you can run this using the following command:
$ python hello.py
Hello, world!
The Python Web site at http://www.python.org has excellent documentation, especially the
tutorial. Also, the following books provide a good overview of Python:
• *Dive Into Python* (Apress,2004): Based on Mark Pilgrim’s popular Web-
based tutorial, this books treats readers to a fast-paced introduction to the
Python language. This is a great book geared toward experienced program-
mers.
• *Learning Python*, Second Edition (O’Reilly, 2003): This book covers ver-
sion 2.3 of Python and provides a good overview of Python and all the new
features. This is good for relatively new programmers.
• *Practical Python* (Apress, August 2002): This highly practical introduc-
tion to Python offers insight into the language’s array of features. The reader
can immediately put this knowledge into practice, following along with the
creation of ten interesting projects, including a Web-based bulletin board and
a Graphical User Interface–based file-sharing application.
• *Python Essential Reference*, Second Edition* *(Sams, 2001): A refer-
ence book that provides a great overview of all the key libraries and functions.
This is an excellent book for experienced programmers.
This book uses the following conventions:
• Italics: New terms are italicized. (Appendix C contains an extensive glossary
that defines all acronyms.) Also, links that appear in the user interface are
italicized.
• Bold: If there are instructions within the text that include something you
should type on your keyboard, these words are in bold.
• Code font: A monospaced font indicates filenames, folder paths, code, vari-
ables, and Uniform Resource Locators (URLs).
This book contains lots of screen shots of Zope, Python, and Plone. Since Plone is a rapidly
developing product, the screen shots might vary slightly from the version of software you’re
using; these changes should be minor and shouldn’t affect your understanding of the system.
For this book, the following versions of software are used; although this book is specifically
written with these versions in mind, all the software should work on these and later versions
for some time to come.
Plone 2.0 was the most recently released version of Plone at the time of writing. This is the
second major release of the software, and it provides many new features over 1.0, including
group user management, a new interface, and an improved Zope distribution. It’s strongly
14
suggested you start any new projects in 2.0 or later, rather than using the earlier versions of
Plone.
Version 2.0 of Plone has the following dependencies: Zope 2.7, CMF 1.4.2, and Python 2.3.3.
All of the code examples in this book have been specifically designed not to be dependent upon
these versions or a particular operating system. However, there may be situations where this
isn’t the case; I apologize for any inconvenience.
Originally, a group of Plone users keen to produce quality documentation came up with the
idea of this book. We released the first version of that book on the Plone Web site as an open-
source documentation project. All the content added to the Plone Web site was under the open
publication license.
Growing interest in Plone made a commercial book more feasible, and in the summer of
2003, Apress and I started this book. I used some of the material from the old book with
the original owners’ permissions. With the change to Plone 2, I added a large amount of
new material. This book is now published under the Creative Commons license, which al-
lows for the reuse of this work as long as the original author is attributed. However, you may
not use this work for commercial purposes. For more information, see the license online at
http://creativecommons.org/licenses/by-nc-sa/1.0/.
2 Chapter 2
2.1 Installing Plone
This chapter explains how to install Plone on a variety of platforms and set the basic configu-
ration options for Plone. If you want to try Plone really quickly, then your best bet is to go to
the live demonstration site at http://demo.plone.org; you can try adding and editing content
immediately without installing anything.
Unlike the other chapters, reading this chapter from one end to the other may not make the
most sense. Instead, I’ve broken this chapter down by operating system, so you can read only
the sections you need to in order to install Plone. Plone will install on any of the platforms
that Zope supports: Windows, Mac OS X, Linux, most Unix platforms, and Solaris.
For a Plone server, a high-performance computer will obviously make Plone perform better.
Plone is a complicated system that requires processing power and memory. In general, it’s
recommended you don’t go into production with a machine slower than 2GHz with less than
1GB of Random Access Memory (RAM) if you’re serving a large Web site. It works fine with
setups as low as 500MHz and 64MB of memory for more modest sites, however. For advanced
information about the performance, caching, and acceleration of Plone, see Chapter 14. For
a base installation of Plone, you’ll need about 50MB of hard drive space. If you already have
installations of Zope or Python, then this will be a great deal less; you’ll need about 2MB. You
must also account for the Plone object database, which can grow to almost any size depending
upon the amount of data you store.
To use Plone, you need a Web browser that can access the server. If users want to log into
your site, then they must have cookies enabled. JavaScript isn’t required but will provide a
richer user experience. Because of the large amount of Cascading Style Sheets (CSS) in Plone,
modern browsers will see the correct Plone interface in a richer, more attractive way; however,
it should be quite functional in any reasonable browser.
I recommend any of the following browsers:
• Microsoft Internet Explorer 5.5 and later
• Netscape 7.0 and later
• Mozilla 1.0 and later
• Opera 7.0 and later
• Konqueror 3.0 and later
• Safari 1.0 and later
15
16
Plone also is fully functional in the following browsers but may look different from the original
Plone:
• Netscape 4.*x*
• Microsoft Internet Explorer 5.0
• Microsoft Internet Explorer 4.0
• Konqueror 2.*x*
• Lynx (text-based)
• w3m (text-based)
• AWeb
• Links (text-based, with optional graphics)
• Any browser that handles a basic set of Hypertext Markup Language (HTML)
and form input cookies, including most mobile/Personal Digital Assistant
(PDA) browsers
2.1.1 Installing Plone on Windows
By far the easiest way to install Plone is to use the Plone Windows installer, which automates
the installation of Plone on Windows. The installation includes extra packages and options,
a Hypertext Transfer Protocol (HTTP)–loaded database, the setup of services, and Python for
Windows packages. You can download this installer from http://www.plone.org/download.
2.1.1.1 Using the Installer
The installer has been tested on Windows 9*x*, ME, NT 3.51+, 2000, and XP but it should
,
also work on other Windows versions. It’s recommended you have administrator access on the
computer you want to install on since the installer will try to set up as a service and install
settings into the Windows Registry. If you already have Zope or Python installed, you may
want to install the source separately to save hard drive space.
Before installing Plone, you should make note of any current Web servers you have running.
For example, later versions of Windows automatically install and start Microsoft Internet Infor-
mation Services (IIS), which listens to port 80. The installer starts Plone on ports 80 and 8080.
To test if something is using port 80 already, the easiest way to test is by opening a browser
to http://127.0.0.1/ and seeing if it finds a page. You can either disable that Web server or
change the ports for Plone; see ’Configuring the Web Server” later in this chapter. If you want
to run Plone behind IIS or run both Plone and IIS on the same server at the same time, then
see Chapter 14 for more information. At the moment, however, it’s easiest to just disable that
Web server.
Once you’ve downloaded the installer, double-click the installer to begin (see Figure 2-1).
17
Figure 2-1. The start of the Plone installer
The installer goes through the usual steps for installing software; click Next to
continue the setup or Cancel to exit. The Plone installer lets you choose a location
to install the software; the default is c:Program FilesPlone 2 (see Figure 2-2).
Figure 2-2. Selecting a directory
When you get to the password screen, as shown in Figure 2-3, you must enter a username and
a password. This will create a user for you, and this will make the Plone site in that user’s
name. Often people create one user called admin or similar for this role. You’ll need this
18
username and password later, so remember it; however, if you do lose this password, you can
enter a new one later.
Figure 2-3. Entering a username and password
The installation takes about five minutes, depending upon the speed of your computer. The
installation performs a few tasks at the end of the installation, such as compiling all the Python
files and setting up the database. When the installation has finished, a message displays to let
you know that it’s done (see Figure 2-4).
Figure 2-4. Final setup screen
19
To start Plone, access the Plone controller by going to Start - Programs TRA Plone TRA Plone.
The controller is an application that provides a nice user interface for starting and stopping
Plone. It begins with the Status page, which lets you easily start or stop your Plone installation
(see Figure 2-5).
Figure 2-5. Plone isn’t running.
As shown in Figure 2-5, the screen displays the status of your Plone installation. Plone doesn’t
start automatically; you’ll have to click Start to start Plone. Once you’ve clicked this, you may
have to wait a minute as it completes the startup process (see Figure 2-6).
20
Figure 2-6. Plone is now running.
When Plone has started, you can access the Plone site by clicking the View Plone button. This
starts a browser and accesses the Plone site; you should then see the Plone welcome page.
Note that the address in the browser is http://localhost/; this is the address to access your
Plone site. Clicking the Zope Management Interface button starts a browser and accesses the
management interface; the address in the browser for this is http://localhost::8080/manage,
which gives you access to the underlying application server. When you click the Manage button
and access Plone, it’ll ask you for your username and password. This is the username and
password you added in the installer.
The controller will know whether you’ve installed Plone as a service or not as a service. If
Plone has been installed as a Windows service, then you can stop and start Plone using the
standard service management screens and commands. If it hasn’t been installed as Windows
service, you’ll see a little icon appear in the task bar. At this point if you want to edit content,
move on to Chapter 3.
2.1.1.2 Configuring the Server on Windows
The configuration for Plone is contained in a text file that you can edit to configure your Plone
instance. You can change the ports Plone listens to, the log files used, and a whole host of
options. On Windows some of the key features are available through the controller and the
Graphical User Interface (GUI). If you want to alter some of the other configuration options,
refer to Appendix A for a full list of configuration options. To access the controller, select Start
- Programs - Plone - Plone; this will start the controller.
As discussed earlier, the first page you’ll see is the Status page, which allows you to stop or
start Plone. On the left of the controller are a few other screens that I’ll now discuss.
2.1.1.2.1 Changing the Ports
The Ports choice, as shown in Figure 2-7, allows you to specify the ports that Plone listens to for
incoming connections such as HTTP File Transfer Protocol (FTP), and Web-based Distributed
,
Authoring and Versioning (WebDAV).
21
Figure 2-7. The Ports page displays the ports on which Plone is running
As mentioned when installing Plone, you’ll want to ensure that no other server is listening to
the same port as Plone servers such as II:S, Apache, and Personal Web Server (PWS) could
be listening to port 80. At the time of writing, only the Plone HTTP and Zope Management
HTTP ports are enabled; to enable them, you have to go into a text file to configure them. The
following are the four fields on the Ports page:
Plone HTTP: This field specifies the port to access Plone for the user. The default
is port 80, the standard default for a Web server. Although this port isn’t required,
without it you won’t be able to access Plone with a Web browser. If this port is
enabled and Plone is running, the View Plone button is enabled on the Status page.
Zope Management HTTP: This field specifies the port to access Plone as the man-
ager. The default is port 8080. This port gives you access to Zope Management
Interface (ZMI) for the root of Zope. You can still get to this through the HTTP
port; however, it’s easier and more convenient to have a separate port. If this port
is enabled and Plone is running, the Manage Plone button is enabled on the Status
page.
FTP Access: This field specifies the port to access Plone via FTP The default is
.
blank, meaning that this isn’t enabled; if you want to enable this, the usual port is
21. You can use FTP to transfer large files to and from Plone.
WebDAV Source: This field specifies the port to access Plone via WebDAV The .
default is blank, meaning that this isn’t enabled; if you want to enable this, the
usual port is 8081. (WebDAV is a protocol for remotely authoring content in Plone.
With WebDAV you’re able to perform tasks such as mapping your Plone server to a
,
Windows drive letter.)
22
2.1.1.2.2 Using the Emergency User Page
Chapter 9 covers the Emergency User page, but, put briefly, it allows you to get emergency
access to your system should you forget your username or password.
2.1.1.2.3 Starting Plone in Debug Mode
Up to this point, you’ve started and stopped Plone in production mode. This is the fastest way
to run Plone and is recommended. For developing add-ons in Plone or debugging problems,
you’ll need to start Plone in debug mode. This mode is the recommended way of running Plone
when you’re developing products and skins, as you’ll do in later chapters. This method isn’t
the default because you’ll note that Plone is about ten times slower than normal.
To start Plone in debug mode, select Start - Programs - Plone - Plone (Debug Mode), and
a command prompt will appear; all the log information will be printed to this window (see
Figure 2-8).
Figure 2-8. Running Plone from the command line
To test that Plone is running, start a browser and go to http://localhost/; if Plone is installed
successfully, you’ll see the Plone welcome screen.
2.1.2 Installing Plone on Mac OS X, Unix, and Linux
The installations for Mac OS X, Unix, and Linux are different, but the configurations are similar.
Specific packages exist for different operating systems, including Mac OS X, Debian, Gentoo,
FreeBSD, OpenBSD, and RPM Package Managers (RPMs) for Red Hat, SuSE, and Mandrake.
In the following sections, I’ll cover some of the more popular: Mac OS X, Red Hat, and Debian.
For information about your specific operating system, consult the installation instructions for
the specific installation system.
23
2.1.2.1 Installing on Mac OS X
The installer automates the installation of Plone on Mac OS X and has been tested on ver-
sion 10.2.3 and later. You’ll need administrator access on the computer on which you want
to install. You can download this installer from http://ww.plone.org/download. Once you’ve
downloaded the installer, double-click the installer to decompress the archive, and double-click
the resulting installer package to begin the install. You should see the screen shown in Figure
2-9.
Figure 2-9. Authorizing the installation using your Mac OS X password
Enter your Mac OS X account password to authorize the installation; your account must have
administrator privileges to do this. If your account doesn’t have administrator privileges, log
out and log back in as someone who does and then relaunch the installer. You may want to
move the installer package to /Users/Shared before you log out so you can access it from the
other account. Once the installation is authorized, you’ll see the screen shown in Figure 2-10.
24
Figure 2-10. Welcome to the installer.
The installer goes through the usual steps for installing software. Click the Continue and Go
Back buttons at the bottom as necessary; most of the steps are self-explanatory. However,
when presented with the choice of volumes to install Plone on, you must choose the partition
on which Mac OS X is installed (see Figure 2-11).
::image:: img/3294f0211.png
Figure 2-11. Choosing the boot volume
The installation takes about five minutes, depending upon the speed of your computer. When
the installation has finished, Plone isn’t started by default. The ReadMe.rtf file in /Applica-
tions/Plone contains a lot of useful information about running and managing your Plone in-
stallation, including how to start Plone. For example, running the following command will
start Plone:
sudo /Library/StartupItems/Plone/Plone start
To test whether Plone has worked, use a browser to go to http://localhost:9090/; you should
see the Plone welcome page. Also in that ReadMe file you’ll find the username and password
that Plone has set up for you to access the server.
25
2.1.2.2 Installing Using an RPM
RPMs are available for the Red Hat, Mandrake, and SuSE distributions. You can download
the latest packages from http://www.plone.org/download. The RPM requires that Python 2.3 is
installed. To find out which version of Python you have, run the following command in a shell:
$ python -V
Python 2.3.2
In this case, Python 2.3.2 is installed; if you don’t have this, RPMs for Python are available
from the Python Web site at http://www.python.org. After downloading the files, install us-
ing the standard rpm command; fortunately, the Plone installation prints some really useful
information. For example:
[root@lappi i386]# rpm -ivh Plone2-2.0.0rh-2.i386.rpm
Preparing... ###########################################
[100%]
Making group plone (not altered if already exists).
Making user plone.
~ 1:Plone2 ###########################################
[100%]
Creating initial ’main’ instance...
Instance created. Listening on 127.0.0.1:8080, initial user: ’plone’
with password: ’plone’.
Setup of initial database in ’main’ instance...
/usr/lib/plone2/lib/python/AccessControl/Owned.py:79:
DeprecationWarning: Owned.getOwner(1) is deprecated; please use
getOwnerTuple() instead.
~ DeprecationWarning)
Created initial database content.
look at /etc/plone2/main/zope.conf.
Run then "/etc/rc.d/init.d/plone2 start" to start Plone2.
you may create new Plone instances with mkploneinstance.
As shown in the previous output, to start Plone, run the following:
/etc/rc.d/init.d/plone2 start
To test that Plone is working, use a browser to go to http://localhost:8080/; you should see
the Plone welcome page. The username plone* and the password *plone have been created for
you*.*
2.1.2.3 Installing on Debian Linux
Plone is a standard package in Debian and moves through the standard release process, so
you’ll want to either get the stable or get the unstable version of Plone, depending upon how
your Debian installation is configured. To install Plone, simple use Debian’s apt system to get
the package. This is an example installation:
26
agmweb:/home/andy# apt-get install plone
Reading Package Lists... Done
Building Dependency Tree... Done
The following extra packages will be installed:
zope zope-cmf zope-cmfcalendar zope-cmfcore zope-cmfdefault
zope-cmfplone zope-cmftopic zope-cmfworkflow
zope-formulator zopectl
Suggested packages:
zope-cmfwiki python-unit zope-devguide zope-book
Recommended packages:
zope-cmfforum zope-localizer
The following NEW packages will be installed:
plone zope zope-cmf zope-cmfcalendar zope-cmfcore zope-cmfdefault
zope-cmfplone zope-cmftopic zope-cmfworkflow
zope-formulator zopectl
0 upgraded, 11 newly installed, 0 to remove and 49 not upgraded.
Need to get 4743kB of archives.
After unpacking 24.9MB of additional disk space will be used.
Do you want to continue? [Y/n]
Press Y to continue and install all the required packages. To start and stop Zope, an install
script has been created in the init.d directory, called zope. To start Plone, run the following:
/etc/init.d/zope start
The Debian installer starts Zope on the nonstandard port 9673. Since the Debian installer
is quite unusual, it’s recommended that you read the documentation for the packages at
/usr/share/doc/zope and /usr/share/doc/zope-cmfplone.
2.1.3 Installing from Source
As an alternative to using an installer or package, you can install from the source tarball. If
you’re familiar with installing from source, it’s actually rather simple but does require famil-
iarity with basic tools such as tar. The following sections demonstrate how to install it on
Linux.
This installation assumes you’re familiar with basic operations such as ’untarring” files and
moving files. This requires a working Zope installation.
NOTE To install Zope, see the Zope installation instructions in the
doc/INSTALL.txt file of your Zope download. For more information, see
http://zope.org/Documentation/Books/ZopeBook/2_6Edition/InstallingZope.stx).
Follow these steps to install Plone:
1. Download Plone 2 from http://www.plone.org/download, and select the
tarball file.
27
2. Unzip the archive using the following: tar xzf CMFPlone2.0.tar.gz
3. You’ll find that a directory has been created called CMFPlone-xxx, where
xxx is the version (for example, CMFPlone-2.0).
4. Move the contents of that directory into your Zope installation’s Product
directory. For example, if the Zope Products directory is in /var/zope,
then do this: mv CMFPlone2.0/ /var/zope/Products*
After completing this installation, restart Zope. Once Zope has restarted, access Zope by open-
ing a browser and going to http://localhost:8080/manage. You’ll need a username and pass-
word for this (for example, the username and password you gave during the Zope installation).
In the ZMI, there’s a drop-down list of products you can add located in the top-right corner.
Ensure that Plone Site is one of the options. If so, your installation is complete (see Figure
2-12).
Figure 2-12. Plone Site in the drop-down list
2.1.3.1 Installing from CVS
Concurrent Versioning System (CVS) access is recommended only for experi-
enced users and developers. You can find current CVS access information at
http://ww.plone.org/development/cvs. The current CVS checkout command is as follows:
cvs -d:pserver:anonymous@cvs.sf.net:/cvsroot/plone login
cvs -d:pserver:anonymous@cvs.sf.net:/cvsroot/plone co CMFPlone
Plone 2 has a whole host of other dependencies (such as DCWorkflow, Formulator, Group User
Folder, and so on) that aren’t in Plone CVS, meaning users will have to go and find all these
dependencies. When you start Plone, it’ll print any errors regarding packages not found. For
example:
28
2003-11-21T12:23:11 ERROR(200) Plone Dependency
CMFActionIcons not found. Please download it from http://cvs.zope.org/Products/
2.1.3.2 Adding a Plone Site
Once you’ve installed Plone from source, you need to create an instance of Plone. To do
this, you’ll need to log into the ZMI and add a Plone site. You can access this by going
to the Uniform Resource Locator (URL) for the management interface, which is normally
http://localhost:8080/manage (this port will change depending upon your installation). You’ll
need a manager’s username and password for access to the ZMI; this password is created
during the Zope installation.
NOTE If you’ve forgotten the password for Plone that was created in the installa-
tion, don’t panic. You can create a new one; see Chapter 9 for more information.
You add all objects via the drop-down list in the top-right corner, as shown in Figure 2-12.
Scroll down the list until you find Plone Site, and click Add.
After selecting the option Plone Site, a form will display that prompts for some more informa-
tion (see Figure 2-13):
• Id: This is the unique ID of the Plone site (for example, enter Plone
or Site).
• Title: This is the title of the Plone site (for example, enter My Por-
tal).
• Membership source: For the moment, leave this as the default op-
tion, Create a New User Folder in the Portal. This allows you to have
user authentication somewhere other than the portal (see Chapter 9
for more information).
• Description: This is a description of the portal that members will
see in e-mails, (for example, enter A site all about the exciting
new widget technology). Don’t worry too much about this; you
can always change this later in the portal’s properties.
29
Figure 2-13. Adding a Plone site
After clicking Add Plone Site, a Plone site will be created. This may take a minute or two on
slower machines because a great deal of processing occurs. The screen will then redirect you
to the Plone welcome page.
2.1.4 Configuring the Web Server
Once Plone has been installed, you may want to configure the Plone site so that it runs on a
different port, has FTP capabilities, logs to a different file, and so on. This section covers these
basic setup issues. Note that you aren’t configuring the Plone sites themselves; you’re altering
the configuration of the underlying Web server.
NOTE If you’ve installed on Windows using the Windows installer, then most of this
configuration is provided through a nice user interface program; see ’Configuring
the Server on Windows” earlier in this chapter.
NOTE If you’ve installed using Mac OS X or the Windows installer, then you’ll find
one extra file (plone.conf), which contains port definitions used in the main Zope
configuration file.
30
Zope 2.7 creates a configuration file inside each instance installed. All the configuration for the
server is located in that one file. A full list of the configuration options is available in Appendix
A. To find the configuration file, look for a file called zope.conf located in the etc folder of your
Plone installation. Some installers (Windows and Mac OS X, for example) create a second
configuration file called plone.conf that contains Plone-specific configuration options. If your
installation contains a plone.conf file, then use that configuration file to make changes; they’ll
be included in the main configuration file.
The configuration file is extremely verbose and contains a great deal of useful comments and
examples. If you’re familiar with Unix configuration files such as Apache, then you’ll find the
Zope configuration file familiar. To alter Zope configuration, open the configuration in a text
editor, and change the lines as needed; after altering the configuration, you’ll need to restart
Zope.
It’s possible to run Plone 2.0 with a version of Zope prior to 2.7; however, Zope 2.7 offers
increased stability and new features, including easier configuration. If you’re using a version
of Zope prior to 2.7, you’ll need to read the documentation on how to change the configuration.
2.1.4.1 Adjusting the Ports
To change a port, add the address lines for that port. For example, to run Plone on port 80
instead of the default, change the following bold line in zope.conf:
<http-server>
# valid keys are "address" and "force-connection-close"
address 8080
# force-connection-close on
</http-server>
to the following:
<http-server>
# valid keys are "address" and "force-connection-close"
address 80
# force-connection-close on
</http-server>
If you used the Windows or Mac OS X installer, then you’ll find these port definitions in
plone.conf. These values are then imported into the main configuration file. So, on a Mac
to change the port, you’ll edit plone.conf from this:
## PLONE_WEBSERVER_PORT
## --------------------
## This is the port you will access your Plone site from. Set this to a port
## number above 1024 not used for any other server on your computer.
%define PLONE_WEBSERVER_PORT 8080
to the following:
%define PLONE_WEBSERVER_PORT 80
31
2.1.4.2 Using the Debug Mode
By default in Zope 2.7 debug mode is enabled. Note that Plone runs significantly slower in
debug mode, approximately 10-20 times slower. To turn this off, add the following line to the
configuration file:
debug-mode off
To make the out-of-the-box experience more impressive for Windows users (debug mode slows
Plone down on Windows even more than on Linux), it ships with debug mode off already.
If you have a Plone site running and want to know if debug mode is running, go to por-
tal_migration in the ZMI and look at the variables listed there; this will tell you if debug mode
is enabled.
2.1.4.3 Using Logs
By default there are two logs in Plone: an access log that you can produce site statistics from
and an event log that contains debug information about Plone products. The event log is the
place to find errors and messages in Plone. The default configuration looks like the following:
<eventlog>
level all
<logfile>
path $INSTANCE/log/event.log
level INFO
</logfile>
</eventlog>
<logger access>
level WARN
<logfile>
path $INSTANCE/log/Z2.log
format %(message)s
</logfile>
</logger>
This is where you can change the path to the file by defining a new file. The values that are
logged are based upon a level sent with error messages; more serious messages are sent with
higher levels. By default, only information and the previous message are sent to the log, but
that value could be one of the following: CRITICAL, ERROR, WARN, INFO, DEBUG, and ALL. If
you wanted to log only errors, then you’d change level INFO to level ERROR.
3 Chapter 3
3.1 Adding and Editing Content
Adding and editing content is a simplification of the sheer power that Plone has available to
leverage. Creating content-rich and feature-rich Web pages with Plone is an absolute breeze.
If you have Plone installed locally, then this chapter shows you how Plone works straight out
of the box. However, if you don’t have Plone installed, then don’t worry; you can try Plone
online by going to http://demo.plone.org.
Before you can alter or edit a Plone site, you need to log into a Plone site. If you installed
Plone, you should have the username and password that came with the installation. This user
has the role of an administrator user, which allows you to log in and alter any content. Most
users of a Plone site will join the site and log in through the login process described in the
’Joining a Site’ section. Users can, of course, view a Plone site without logging in, but they
won’t be able to add or edit content.
In this chapter, I’ll go through the steps a user takes to create content on a Plone site. First, I’ll
cover how to join the site and log in. Once you’ve accomplished this, I’ll cover how to create
and then edit a document. Finally, I’ll show how you can search and publish this content. In
short, this chapter covers how to use Plone.
3.1.1 Joining a Site
When you join a Plone site, you create an account on the server. That account gives you the
right as a member to add content such as images, documents, and so forth. To join a site, click
the join link in the top-right corner of the Web site (see Figure 3-1).
Figure 3-1. Clicking the join link in the top-right corner of the page
This will take you to a registration form that you’ll have to complete (see Figure 3-2). Because
this is the first Plone form you’ve encountered, take note of the following:
• Some fields are required; a little red box next to the text indicates
the required fields.
32
33
• For most fields, some grayed-out help text beneath the field name
indicates what you should enter.
Figure 3-2. The registration page
NOTE Because many of the Plone pages are quite large, the figures in this book
have been cropped to show only the key parts (in this case, the form) and not the
Plone logo or the footer. These elements are still there, but they’re superfluous.
34
To complete the form, complete the fields that are reasonably obvious. The values of the fields
are as follows:
Full Name: Enter your full name. This field is optional.
User Name: Enter the username you want to use. Most people choose an alphanu-
meric value without spaces, such as bob or jane97. This username will be used
throughout the Web site to refer to you. This field is required.
E-mail: A valid e-mail address is required. This will allow the site administrator
to contact you and to send a password to you. You can change this e-mail address
later by editing your member preferences. This field is required.
Password and Confirm Password: This is the password you want to use; it must
be more than four characters and can contain letters, numbers, and the underscore
(_) character. Passwords are case sensitive (in other words, SomePassword isn’t the
same as somepassword). These fields are required.
Send a mail with the password: Check this box if you’d like your password sent
to the e-mail address you provided. This field is optional.
Once you’ve completed this form, click Register to submit your information. If you’ve made
any errors on this form, then you’ll see a message at the top and the key fields that have an
error highlighted. In Figure 3-3 I entered a password but didn’t enter a value for the Confirm
Password field. Again, this is the standard way that Plone forms will show errors to you.
35
Figure 3-3. Errors on a form
If you’ve completed the form correctly, then you’ll be given the option of logging in immedi-
ately. Click the Log In button to log in. You’ll see the page shown in Figure 3-4.
36
Figure 3-4. After registering
If you already have a username and password or are returning to a site you’ve previously
joined, then you can enter your name and password in the boxes in the left column of the site
and click the Log In button.
3.1.2 Enabling Cookies
To log into a Plone site, you must have cookies enabled. If you access a Plone site and try to log
in with cookies disabled, you’ll get a friendly message telling you that cookies must be enabled
with a link to more information. To enable cookies, perform the following steps, depending on
your browser.
Internet Explorer 6.x 1. Select Tools > Internet Options.
2. Click the Privacy tab at the top of the screen.
3. Move the slider to Medium, and click OK.
Internet Explorer 5.x 1. Select Tools > Internet Options.
2. Click the Security tab at the top of the screen.
37
3. Click Custom Level, and scroll down to the Cookies section.
4. Set Allow Per-Session Cookies to Enable, and click OK.
Internet Explorer 4.x 1. Select View > Internet Options.
2. Click the Security tab at the top of the screen.
3. Click Custom Level, and scroll down to the Cookies section.
4. Select Always Accept Cookies or Prompt Before Accepting Cookies, and click
OK.
Mozilla 1.x 1. Select Edit > Preferences.
2. Find Privacy & Security in the menu on the left. If there’s a plus sign (+) to
the left of Privacy & Security, click it.
3. Select Cookies under Advanced.
4. Select Enable Cookies for the Originating Web Site Only or Enable All Cookies,
and click OK.
Opera 1. Press F12.
2. Click Enable Cookies.
Netscape Navigator 6.x 1. Select Edit > Preferences.
2. Find Privacy & Security in the menu on the left. If there’s a triangle pointing
to the right next to Privacy & Security, click it.
3. Select Cookies under Privacy & Security.
4. Select Enable Cookies for the Originating Web Site Only or Enable All Cookies,
and click OK.
If you forget your password at some point, you can get it sent to the e-mail address provided
when you registered with the Plone site. To have your password mailed to you, click the
Forgot your password? link located in the left column of the Web site. This will bring up the
forgotten password form, as shown in Figure 3-5; enter your login name, and a password will
be e-mailed to you.
38
Figure 3-5. Getting a forgotten password
Unfortunately, if you have no longer access to that e-mail account, or you can’t even remember
the username, you’ll have to contact a site administrator. Using the techniques discussed in
Chapter 9, the administrator can change your e-mail and find your user account. Once logged
in to the Plone site, you’ll see a log out link in the upper-right corner. When your work is
finished, it’s good practice to log out of Plone site, especially if you’re accessing it from a
computer that’s likely to be used by other people.
3.1.3 Setting Up Your Folder and Preferences
After you’ve logged in, the member bar in the top-right corner will change to represent the
options available to you as a member of the site (see Figure 3-6).
39
Figure 3-6. Your personal choices in the top-right corner have changed.
One of these options is that each member has a folder created for them when they join a site.
This folder is set up with particular security so only that member (and administrators) can add
and edit the content in that folder. To access your personal folder, click the my folder link in the
personal bar in the upper-right corner of the site. In the upper-right corner you’ll also see a my
preferences link; clicking this will open a list of personalization options. You’ll see two choices
at the moment; you can change your password, or you can go to the personal preferences and
change key preferences in your site.
The change password form allows you to change your password. To complete the form, give
your current password and the new password twice. After you’ve changed your password, the
change will be immediate. You don’t have to log in again; just remember your new password
when you return.
The personal preferences form allows you to set a number of preferences that change how you
see the site. These preferences are stored on the server so they’re retained between uses of the
site (see Figure 3-7).
40
Figure 3-7. Changing preferences
The options are as follows:
Full name: This is the full name you gave when you registered with the site.
E-mail: This is the e-mail address associated with your membership and is used
a number of places in a Plone site. Most important, if you lose or forget your
password, this is the address to which the system will send it.
41
Content editor: When editing complex content, you may want the help of an
editor. If your site administrator has made one available, you can select it here. It
will then be used when you click the edit tab of an object. If you’re unsure, leave
this as the default.
Listed status: This property specifies whether your profile will show up on the
members tab and when someone searches the members listing.
Editing of Short Names: Objects have an ID or Short Name property that’s used for
the internal representation of the content object. This also shows up in the item’s
Web address and the item’s Uniform Resource Locator (URL). By default these look
something like News_Item.2002-11-16.4102, but you could make it much simpler,
such as november_news, by changing the Short Name value.
NOTE When you change an object’s name value, anything that references the older
name will no longer be valid and will result in the page not being found. It’s best
not to change the name value after you submit an object for review or link to it
from elsewhere. For this reason, I recommend setting this option to No.
Portrait: In larger organizations and in community Web sites, it’s useful to see
pictures of other members. The Portrait field allows you to upload a picture of
yourself. The picture should be 75 by 100 pixels.
Once you’ve made the desired changes, click the Save button to commit the changes. Now that
you’ve logged in, it’s time to start adding and editing content.
3.1.4 Adding and Editing Documents
As mentioned, now that you’re a site member, a folder has been created for you where you
can store content. Of course, you can add content to any folder that the site administrator has
given you the right to do so, but by default every user can add content to their member folder.
Each type of content you can add is distinct, and you can edit and view it in different ways.
For this reason, Plone references each type of content differently; for example, you can add
images, links, documents, and so on. Out of the box, Plone provides the following content
types:
• Document: This is an item that presents some static information to the user.
This is the most common type of content added and most closely represents a
typical Web page.
• News item: This is a document that’s to be shown under the news tab (for
example, a press release).
• Link: This is a link to another item, which may be internal or external to
another Web site.
• Image: This is an image, such as a .gif or .jpeg file.
• Event: This is an upcoming event, meeting, conference, or other event.
• Folder: This is like a folder on a hard drive; this is a folder for putting content
into so that it’s easy to find later.
42
• Topic: This is a grouping of other content. This is essentially a saved search
criteria that you can reuse later. Only privileged site users can add topics.
• File: This is another piece of content such as a movie, sound clip, text file,
spreadsheet, compressed file, or anything else you’d like to upload.
I’ll go through each of these items using the document as an example, showing in detail how
to add and edit documents easily and quickly. Using these basic content types, I’ll show you
how to build a dynamic site through a browser, without doing any programming.
Actually, you have many ways of adding and editing content in a Plone site than just through a
Web browser. Access via File Transfer Protocol (FTP), via Web-based Distributed Authoring and
Versioning (WebDAV), or via scripts is all possible. I’ll discuss how to set these up in Chapter
10 and just deal with the Web browser interface for now. In Chapters 11 to 13 of this book, I’ll
discuss how to make new custom content types that you can tailor to a particular site’s needs.
3.1.4.1 Understanding the Document Content Types
Rather than detailing how to add and edit all the different types of content available, I’ll
cover adding one type of content, a document, in detail. After adding and editing a few of
these documents, the approach to adding content should be second nature, and editing other
content will be easy.
A document is a page of content, usually a self-contained piece of text. Although all items
added to Plone are accessible as Web pages, if there’s one content type you could think of as
a Web page, this is it. The default home page for a Plone site that you’ve seen already - the
now-famous Welcome to Plone page - is one example of a document (see Figure 3-8).
43
Figure 3-8. Welcome to Plone, a simple document
3.1.4.2 Adding a Document
You have two ways to add any piece of content using a Web browser. First, ensure you’re
logged in, because only logged-in users can add content. Second, select the my folder link from
the top-right navigation bar. This will take you to your home folder, an area that you control.
44
If you’re able to add content to a folder, then the folder will show up with the green border
around the top (see Figure 3-9).
Figure 3-9. My content
If the green border doesn’t appear, then you won’t be able to add content; this border contains
the actions you can perform in the current location. In Figure 3-9, you can see that the page
shows the contents of the folder, because that’s the highlighted tab. Other tabs appear such as
view, sharing, and properties for more advanced options. In the top-right corner of the green
border, you’ll see an Add New Item drop-down menu and a State drop-down menu. Click the
Add New Item menu to open a drop-down list of items to add (see Figure 3-10).
45
Figure 3-10. Adding a document from the green drop-down menu
To add a new document, select Document. Alternatively, if you look in the body of the page,
you can see another Add New Item drop-down box. Again, click the down arrow to open a list
of items that can be added and then select the item you’d like to add (see Figure 3-11).
Figure 3-11. Adding a document from the main folder’s content menu
Using the Add New Item list from the green border is a handy menu since it’s available most
of the time.
NOTE **If you’re familiar with Zope, you should never, never, never add con-
tent from the Zope Management Interface (ZMI). Depending upon how you’ve
installed Plone, you may have already seen the ZMI and used it for customiz-
ing and developing Plone through the Web. However, adding content through
the ZMI will create content items that are incomplete and don’t ***Begin Side-
bar*
3.1.4.3 Understanding Where to Add Content
The easiest place to add content at the beginning is in the user’s member folder, accessi-
ble by clicking the my folder link. Although this is useful, it’s probably not the best ap-
proach for a long-term solution. Most noticeably it creates long URLs (for example, /Mem-
bers/andy/Docum....). It also means your content isn’t accurately reflected in the navigation
tree.
As you’ll see later, a few solutions exist for this; the most common solution is to make a folder
and give certain users the right to access it. For example, that folder may be Help or News. The
’Using Folder” section later in this chapter discusses adding folders, and Chapter 9 discusses
using group workspaces and security.
3.1.4.4 Editing a Document
Once you’ve clicked to add a document, you’ll be taken directly to the edit page with a mes-
sage telling you that the document has been created. If this doesn’t happen, you can click a
document and then click the edit tab. Again, you’ll see that the edit tab becomes highlighted
in green (see Figure 3-12).
46
Figure 3-12. Editing a document
Now you can edit the document in your Web browser, using the form provided. If you look at
the URL in the address bar of your browser, you’ll note that a short name for the object has
been created for you, something such as Document.2003-12-29.43787. The following is a list
of the fields and their meanings:
Short name: The short name will become part of the document’s URL, so keep the
name short and descriptive, preferably without spaces. Keeping to these rules will
make URLs easier to read. For example, use something such as audit-report-2003.
If you don’t provide a name, Plone will create one for you.
47
NOTE This field won’t appear if you selected No for the short names in your pref-
erences page.
Title: This is the title for the item, and it’ll be shown throughout the site (for
example, at the top of the page, in the search interface, in the title of the browser,
and so on). This field is required.
Description: This is a short lead-in to the document, usually about 20 words to
introduce the document and provide a teaser for the remainder of the document.
This is useful for pages that show summaries of documents, such as search results
and folder contents.
Body text: This contains the body of the document. The format for the content is
set using the Format field (described next).
Format: You have three choices for the format of body content: Structured Text,
HTML, and Plain Text. These types of text are discussed in the ’Choosing a Text
Format” sidebar; if you’re unsure, leave this field alone and type the body text as
usual.
Upload document: If you do have your document as a file on your computer, you
can upload it instead of typing the content into the Body Text field. Use the Upload
button at the bottom of the page to select a file. The contents of an uploaded file
will replace any content in the Body Text field.
Once you’ve finished editing your document, click the Save button to commit your changes.
You’ll be returned to the view tab where you can see how the document will be shown to users
(see Figure 3-13); to edit it again, click the edit tab.
&