Manual for Administrators and Zope-Programmers

peanutunderwearSoftware and s/w Development

Nov 7, 2013 (3 years and 10 months ago)

183 views


-

1

-


Manual

for
Administrators and

Zope
-
Programmers


ICG
-
Page


http://www.icg.tu
-
graz.ac.at


Werner Roth
, December 2005




PREFACE

................................
................................
................................
................................
..............................

2

W
HAT IS
P
LONE
?
................................
................................
................................
................................
.................

2

W
HAT IS
Z
OPE
?

................................
................................
................................
................................
...................

2

S
YSTEM INFORMATION

................................
................................
................................
................................
........

2

FILESYSTEM BASED PLO
NE PRODUCTS FOR ICG
-
PAGE

................................
................................
.....

3

ICGS
KINS

................................
................................
................................
................................
...........................

3

ICG

................................
................................
................................
................................
................................
.....

4

ICGTool
-
Test (Alumni)

................................
................................
................................
................................
..

4

P
UBLICATIONS

................................
................................
................................
................................
....................

6

USING THE ZOPE MANAG
EMENT INTERFACE

................................
................................
.......................

7

KUPU CONFIGURATION
................................
................................
................................
................................
..

7

HOW TO INSTALL A NEW

PRODUCT FOR PLONE

................................
................................
..................

7

DATABASE MANAGEMENT

................................
................................
................................
............................

8

HOW TO BACKUP ZOPE/P
LONE

................................
................................
................................
...................

8

M
ETHOD
1

-

R
EPOZO

................................
................................
................................
................................
...........

8

No Need to Stop

Zope

................................
................................
................................
................................
....

8

Backup

................................
................................
................................
................................
...........................

9

Restore

................................
................................
................................
................................
...........................

9

M
ETHOD
2

................................
................................
................................
................................
.........................

10

SOME LINKS FOR NEW Z
OPE
-
PROGRAMMERS

................................
................................
....................

10


M
anual for
Administrators and Zope Programmers





ICG
-
Page



-

2

-

Preface


What is Plone?


Plone is an open source Enterprise Content Management System (CMS) that runs on top of
Zope and CMF.


What is Zope?


Zo
pe is an open source web application server primarily written in the Python programming
language.

It features a transactional object database which can store not only content and
custom data,

but also dynamic HTML templates, scripts, a search engine, and r
elational
database (RDBMS)

connections and code. It features a strong through
-
the
-
web development
model,

allowing you to update your web site from anywhere in the world.

To allow for this,
Zope also features a tightly integrated security model. Built aroun
d the concept of "safe
delegation of control", Zope's security architecture also allows you to turn control over parts
of a web site to other organizations or individuals. The transactional model applies not only to
Zope's object database, but to many rela
tional database connectors as well, allowing for
strong data integrity. This transaction model happens automatically, ensuring that all data is
successfully stored in connected data sources by the time a response is returned to a web
browser or other clien
t.


System information


Zope Version



(Zope 2.8.1
-
final, python 2.3.5, linux2)


Python Version


2.3.
5


System Platform


linux2
(arnold)


SOFTWARE_HOME

/data/www/zope
-
2.8.1/lib/python


ZOPE_HOME


/data/www/zope
-
2.8.1


INSTANCE_HOME


/data/www/zope
-
2.8.1/instance


CLIENT_HOME


/data/www/zope
-
2.8.1/instance/var


Network Services

ZServer.HTTPServer.zhttp_server (Port: 8080)

ZServer.FTPServer.FTPServer (Port: 8021)


Plone Version

2.1.1



M
anual for
Administrators and Zope Programmers





ICG
-
Page



-

3

-

FileSystem based Plone Products for ICG
-
Page


All Products f
or Zope/Plone are installed
at

/data/www/zope
-
2.8.1/
instance/Products

S
pecial products for ICG
-
Page are

/data/www/zope
-
2.8.1/instance/Products
/ICGSkins

/data/www/zope
-
2.8.1/instance/Products
/ICG

/data/www/zope
-
2.8.1/instance/Products
/Publications

ICGSkins


This Product is responsible

for
the customized Style of the ICG
-
Page.




Two skins are defined
:



‘ICG Colo
u
r’ skin

Older style with more colo
u
rs. It is not used anymore.



‘ICG Default’ skin

This is the actual skin of the ICG
-
page.


The Files of the ICGSki
ns
-
Product




__init__.py

executes at Zope startup to initialise our classes to make them available
to Zope (but not yet to an

individual Plone instance; that's what the
in
stall
is for).



Extensions
contains the
Install.py
module with the
install
functi
on. The
portal quick installer is looking for this function and e
xecute
s

it.

So

the skin will be registered
to
P
lone.



skins/icg_color

this folder c
ont
ains files of the older
‘ICG Color’

skin.



skins/icg_default

this folder c
ont
ains
the following
f
iles
o
f the
actual

‘ICG
Default’

skin
:

base_properties.props
… some properties (colors
,

fonts …)

ploneCustom.css.dtml

… main
-
stylesheet
with most

customizations.

ploneCustom.css.dtml.metadata

… metadata for stylesheet (title, cache)

member.css

… different

colo
u
rs for different states of objects (red = private, …)

global_logo.pt

… PageTemplate for ICG
-
Logo and TU
-
Logo

colophon.pt

…’powered by plone’ at the bottom of the page.

footer.pt

… footer of th
e page with contact information
.



skins/icg_images

this folder c
ont
ains the images for the skins and the favicon.

M
anual for
Administrators and Zope Programmers





ICG
-
Page



-

4

-

ICG



The ‘ICG’
-
Product contains 3 archetypes (Course, JobOffer, Research) plus the ICG
-
Tool,
which contains various methods. The ICG
-
Tool is like a replacement for many e
xternal
-
methods. This tool installs automatically with the portal
-
quickinstaller (plone control
-
panel,
http://www.icg.tu
-
graz.ac.at/plone_control_panel
) and then resides in the portal
-
root w
ith ID
‘icg_tool’. Methods of this tool can be accessed from everywhere in the page by
PageTemplates or Python
-
Scripts.


Simple PageTemplate Example in ZMI ‘
/portal_skins/custom/ToolTestICG



<html>


<head>


<title tal:content="template/title">The titl
e</title>


</head>


<body>




<h2>ICGTool
-
Test (Alumni)</h2>


<div

tal:repeat="alumni python:
context.icg_tool.getIcgAlumni()
">


<span tal:content="alumni/lastname"></span><br />


</div>


</body>

</html>


Output of the example

(Dec, 200
5)
:

ICGTool
-
Test (Alumni)

Elbischger

Kehrer

Machado Coelho



The Files of the ICG
-
Product




__init__.py

executes at Zope startup to initialise our classes to make them available
to Zope (but not yet to an

individual Plone instance; that's what the
in
stall
is for).



Extensions
contains the
Install.py
module with the
install
function. The
portal quick installer is looking for this function and e
xecute
s it. So the skin will be registered
to plone.



config.py
declares some custom variables in one place i
n order to have oth
er parts as
generic as possible.



Course.py, JobOffer.py, Research.py
are

archetypes.



skins
provides the skin folders with view
-
templates for the archetypes and customized
plone templates:

M
anual for
Administrators and Zope Programmers





ICG
-
Page



-

5

-

Icons for the archetypes:



course_icon.g
if



joboffer_icon.gif



research_icon.gif


Custom view
-
templates for the archetypes:



course_view.pt



joboffer_view.pt



research_view.pt


Listing templates (table
-
style)
. Because the templates stay in the skin
-
folder, you can

use it everywhere at

the page. To s
et them to default
-
views of the corresponding

folders

a

python script with ID ‘
index_html
’ was

placed in

every folder, where these templates should be the default
-
views.
The script’s only
function is

to return the corresponding listing
-
template:




icg_cour
ses.pt


lists courses

(global
-
tab: Courses)



icg_members.pt



the Members
-
page

(global
-
tab: Staff)



publications.pt



lists publications

(global
-
tab: Publications)



researchlist.pt



lists research
-
projects

(global
-
tab: Research)



studprolist.pt



lists Stude
nt Projects

(global
-
tab: Student Projects)


The standard P
lone way for sorting tables (javascript, client’s browser)

shows

the
disadvantage, that only the items on the current displayed page will be sorted. To
prevent this, a click on a header of a table
-
c
olumn at this templates ends in

a new
request to the the ‘portal_catalog’
. Usernames and
y
ears are assigned to the
publication
-
template
via
request.traverse_subpath

to get human readable
links:
e.g.
http://www.icg.tu
-
graz.ac.at/pub/publications/bischof/2004



Customized P
lone templates
:



author.pt



author details
page

(
http://www.i
cg.tu
-
graz.ac.at/author/UserName)



personalize.cpy



personalize.cpy.metadata



personalize_form.cpt



persona
lize_form.cpt.metadata



prefs_icg_global_form.pt



prefs_icg_personal_form.pt



prefs_user_details.cpt



prefs_user_details.cpt.metadata



prefs_user_edit.cpy



prefs_user_edit.cpy.metadata


The templates starting with ‘personalize’ and ‘prefs’ are responsible for ed
iting

user
-
details. Some fields were added at the ‘portal_memberdata’ tool

(
http://www.icg.tu
-
graz.ac.at/portal_memberdata/manage_propertiesForm

),

so
an update of thi
s templates was necessary.


Customized javascript:

table_sorter.js


javascript for sorting a table (bug removed)

M
anual for
Administrators and Zope Programmers





ICG
-
Page



-

6

-

Publications


The Publications
-
product is a collection of archetypes for publications.







__init__.py

executes at Zope startup to initialise

our classes to make them available
to Zope (but not yet to an

individual Plone instance; that's what the
in
stall
is for),



Extensions
contains the
Install.py
module with the
install
function. The
portal quick installer is looking for this function and e
xecute
s it. So the skin will be registered
to
P
lone.



config.py
declares some custom variables in one place in order to

have other parts as
generic as possible,


Content


classes (Archetypes).

Some of the fields are indexed in

portal_catalog


for efficient listings.




Article.py



Book.py



InProceedings.py



MastersThesis.py



PhdThesis.py



TechnicalReport.py



skins
provides

the skin folder with icons
and
view
-
templates for the archetypes.




article_icon.gif



inproceedings_icon.gif



mastersthesis_icon.gif



phdthesis_icon.gif



pubbook_icon.gif



technicalreport_icon.gif




article_view.pt



book_view.pt



inproceedings_view.pt



mastersthesi
s_view.pt



phdthesis_view.pt



technicalreport_view.pt

M
anual for
Administrators and Zope Programmers





ICG
-
Page



-

7

-


Using The Zope Management Interface


http://www.icg.tu
-
graz.ac.at/manage
(
ZMI
,
Plone Root)


If you need access to the real zope
-
root via ZMI you have to call port 80
80

on arnold.


http://
arnold
.icg.tu
-
graz.ac.at
:8080
/manage

(
ZMI
,

Zope

Root)


In case a firewall is between your browser and arnold, you

can forward port 8080

with a
secure
-
shell
. F
or W
indows use ‘putty’
.

Configuration of

putty

:


Connection



SSH


Tunnels


Forwarded ports:

‘L8080 localh
ost:8080’

Then you can point your browser to:


http://
localhost:8080
/manage (ZMI,
Zope

Root)

When you log in to Zope, you are presented with the Zope Management Interface (ZMI). The
ZMI is a management and development environment that allows you to contro
l Zope,
manipulate Zope objects, and develop web applications.

The Zope Management Interface represents a view into the Zope
object hierarchy
. Almost
every link or button in the ZMI represents an action that is taken against an
object
. When you
build web
applications with Zope, you typically spend most of your time creating and
managing objects.

Kupu Configuration


Kupu

is the new WYSIWYG HTML
-
Editor in Plone. It can be selected as standard html
editor at your personal preferences (
http://www.icg.tu
-
graz.ac.at/personalize_form

). Many
settin
gs of kupu can be changed at it
s configuration
-
page (
http://www.icg.tu
-
graz.ac.at/
kupu_library_tool/kupu_config

).

How to install a new Product for Plone


Fo
r installing a new Product for
Plone
, the
s
e

steps are
common
:




Extract the

source tree of the product at


/data/www/zope
-
2.8.1/instance/Products/




Read the INSTALL.txt of the produ
ct.




Restart Zope. (in ZMI, or with init script in FileSystem)




Install the P
roduct in Plone with the portal
quickinstaller.

(
http://www.icg.tu
-
graz.ac.at/prefs_install_products_form
)




M
anual for
Administrators and Zope Programmers





ICG
-
Page



-

8

-

Database Management


The Database Manager allows you to view databa
se status information. It also allows you to
perform maintenance tasks such as database packing and cache management.


To pack the database
:




Login to the ZMI (Zope
-
Root)



Choose the

‘Control Panel’



Click on ‘Database Management’



Click on ‘main’ DB



Select a
n amount of days (e.g. 3)



Click on ‘Pack’
(this may

take several minutes.)


How to backup Zope/Plone


None of the following methods
are

tested by myself
, but both should work also when zope
-
process is running.

Method 1
-

Repozo


The repozo.py script is an
easy, efficient and effective way to do hot, incremental backups of
your Zope's ZODB.


repozo.py

can be found at
/data/www/zope
-
2.8.1/
bin
on arnold.

Data.fs

file is at
/data/www/zope
-
2.8.1/instance/var/

Example
repozo shell script

from
http://www.zettai.net/Support/Howto/repozoHowto

:

#!/bin/sh

#repozo backup that logs results


#example usage:

# Repozo Backups
--

Do Not Delete!

#14 3 * * * ~/bin/repozo.sh >> ~/zope/instance1/log/repozobackups.
log


#You may need to updated the Zope version being used according to your circumstances.

PYTHONPATH=~/zope/273/lib/python

export PYTHONPATH

REPOZOPATH=~/zope/273/utilities/ZODBTools/repozo.py


echo

echo "backup starting"

date


~/zope/py/bin/python $
REPOZOPATH
-
B
-
v
-
r ~/zope/backups
-
f ~/zope/instance1/var/Data.fs >>
~/zope/instance1/log/repozobackups.log 2>&1


echo "backup finished"

echo

No Need to Stop Zope

One of the most convenient aspects of using repozo.py is that don't have to stop your Zope
instance to run the backup. No need for regular downtimes or to worry about rsync producing
problematic backups.

M
anual for
Administrators and Zope Programmers





ICG
-
Page



-

9

-

The repozo.py script comes with Zope 2.7.0 and above. You can find it at

arnold:
/data/www/zope
-
2.8.1/
bin

Backup

To get started on using repoz
o.py to make incremental backups of your ZODB, first login via
SSH.

If you don't already have one, make yourself a bin directory.

mkdir ~/bin


Make a directory to hold the backup files.

mkdir ~/zope/backups

Symlink the repozo.py script into your bin dir
ectory:

ln
-
s ZOPE_HOME/utilities/ZODBTools/repozo.py ~/bin/

The backup script you can get here, if you don't already have it:
repozo.sh
.

(look above)

If you would like the script

to produce gzip
-
compressed files, add
-
z after the
-
v switch.

You will want the backups to happen automatically at regular times so you will want to add
the below to your crontab.

Open your crontab for editing.

crontab
-
e

Put these two lines in after w
hat is already there.

# Repozo Backups
--

Do Not Delete!

01 5 * * * ~/bin/repozo.sh >> ~/zope/instance1/log/repozobackups.log

Make sure and change the time to something else or everyone's backups will execute at the
same time a
nd cause problems for you. See the
Getting Cron to Do Our Bidding Howto

for
more information on using crontab.

Restore

Not covered at this time. Consult the source of the repoz
o.py script for more information.


M
anual for
Administrators and Zope Programmers





ICG
-
Page



-

10

-

Method 2

The
most important file

for you

is the Data.fs in
d
ata/www/zope
-
2.8.1/instance/var
. To
backup this file you can cp it to a directory, tar and gzip

it
. This process can even be scripted
and cron
-
ed.

Copy

the
Data
.fs to a
backup

directory.

cp /d
ata/www/zope
-
2.8.1/instance/var
/Data.fs ~/
backups
/

(this could take from one to several minutes.)

Compress the Data.fs.

tar czf Datafs.tar.gz Data.fs



Some links for new Zope
-
Programmers




Plone





http://plone.org




Zope





http://www.zope.org/





Python





http://www.python.org/





CMF






http://cmf.zope.org

(
Zopes Content Ma
nagement Framework
)




Archetypes




http://plone.org/products/archetypes





The MySite Tutorial



http://www.neuroinf.de/LabTools/MySite




DZUG




http://www.dzug.org

(Deutsche Zope User Group)