Plone-Blog

World Plone Day 2011

erstellt von Philip Bauer zuletzt geändert: 2011-07-14T16:13:12+01:00
Am Mittwoch, den 27. April ist es wieder soweit: Der inzwischen vierte World Plone Day steht an und wird in München wie gehabt in der Seidlvilla stattfinden. Vormittags gibt es Einführungsvorträge und nachmittags auch solche, die selbst gestandenen Plone-Kennern und Plone-Könnern etwas spannendes bieten.

Der fast schon traditionelle 'Pimp my Plone'-Vortrag wird diesmal ausfallen, weil ich mit Vorträgen über Deliverance, Through-the-web-development und die Zukunft von Plone mehr als ausgelastet bin. Doch gerade in letzterem zeige ich ein paar Funktionen künftiger Plone-Versionen, die getrost unter diese Kategorie fallen könnten. Also doch:

Pimp my Plone

Das beste wird trotzdem wie immer der Ausklang bei hoffentlich schönem Wetter im Biergarten sein.

Wer sich für Content Management-Systeme interessiert oder einfach nur wissen will ob Plone vielleicht eine gute Lösung für eine geplante Webseite ist sollte einen Blick riskieren. Die Münchner Plone-Usergruppe ist sich nicht zu schade alle Fragen zu beantworten.

Programm

Anmeldung

Plonator-sprint - report on day one

erstellt von Philip Bauer zuletzt geändert: 2011-04-04T08:28:58+01:00
Yesterday the Plonator-Sprint kicked off. We got some way to establish a common website for the german, austrian and swiss plone-communities.

The plonator-sprint takes place at the department of informatics at the University of Munich and aims at improving the visibility of the plone-community.

The munich plone-user-group managed to get plone.de online since January 2011 after a year of back and forth about the domain. We plan to run plone.at and plone.ch on the same site. To enable the austrian and swiss communities to excert some control over the page yesterday I wrote a view that forwards visitors to country-specific landing-pages. Visitors of plone.de will end up at www.plone.de/de and visitors of www.plone.at at www.plone.at/at - de and at being folders with a collection as default_page and custom teaser-images.

At the moment we are knee-deep in a discussion about plone, open-source and marketing. This afternoon we'll visit the munich strong-beer festival…

Securing Plone-Sites with https and nginx

erstellt von Philip Bauer zuletzt geändert: 2015-10-04T15:26:28+01:00
At the plonator-sprint I finished a nginx-config to secure all authenticated traffic via https.

Some noteable things:

  • There is more than one login-form. In fact I counted at least six different login-forms. Ever heard of 'failsafe_login_form'? Searching for /login_form will not be enough.
  • The page you get after logging out has it's own login-form. Since I use this page to switch back to http I chose to remove the form by customizing the template 'logged_out.pt'.
  • Since I redirect to https when Plone' s Authentication-cookie '__ac' is present calling '/logged_out' while still logged-in would result in an infinite recursion. That's why I break before the rule is called when '__ac' is still set.
  • Don't use the login-portlet since I don't see how it can be delivered via https if you want to deliver the site with normal http.
  • Never ever expose your zope-root or login using the zope-admin-Account via http since the zope-admins password is only uuencoded in a cookie!

Here is my config:

upstream myzope {
server localhost:8080;
}

ssl_certificate      /home/starzel/nginx/starzel.crt;
ssl_certificate_key  /home/starzel/nginx/starzel.key;

# http
server {
listen myserver.com:80;
server_name www.mysite.com;
access_log /var/log/nginx/mysite.com_access.log;
rewrite ^(.*)(/login_|/require_login|/failsafe_login_form)(.*) https://$server_name$1$2$3 redirect;
if ($http_cookie ~* "__ac=([^;]+)(?:;|$)" ) {
rewrite ^(.*) https://$host/$1 redirect;
}

location / {
proxy_pass http://myzope/VirtualHostBase/http/www.mysite.com:80/Plone/VirtualHostRoot/;
}
}

# https
server {
listen myserver.com:443 default ssl;
server_name www.mysite.com;
access_log /var/log/nginx/mysite.com_access.log;
if ($http_cookie ~* "__ac=([^;]+)(?:;|$)" ) {
# prevent infinite recursions between http and https
break;
}
rewrite ^(.*)(/logged_out)(.*) http://$server_name$1$2$3 redirect;
location / {
proxy_pass http://myzope/VirtualHostBase/https/www.mysite.com:443/Plone/VirtualHostRoot/;
}
}

# zmi
server {
listen myserver:443 ssl;
server_name manage.mysite.com;
access_log /var/log/nginx/heeschmusik_zmi.de_access.log;
location / {
proxy_pass http://myzope/VirtualHostBase/https/manage.myserver.com:443/VirtualHostRoot/;
}
}

The cookie-regex explained (thanks to Hanno Schulz and Vlad Vorobiev for their wisdom): $http_cookie (which is a string) is searched for anything containing '__ac=' followed by 1 or more characters which is not ';' (which would mean the cookie has no value), followed by either an ';' (signaling the beginning of another cookie) or the end of the line. If you are as ignorant of regex as me you might consider keeping this regex-cheatsheet close.

By the way, this site neither uses nginx nor is it not secured. But this one is: www.heeschmusik.de. I plan to move most sites to nginx in the near future.

Feeback appreciated.

World Plone Day 2010 in Munich. Register now!

erstellt von Philip Bauer zuletzt geändert: 2014-06-30T13:03:36+01:00
Tuesday night at the usergroup-meeting we finalized the program for World Plone Day 2010 in Munich. I'm pretty exited about what I think will be the best World Plone Day ever.

This year the we mainly focus on how Plone enables communes and other public institutions to create complex portals and intranets. Therefore we have a very loooong session on the inclusion of various aspects of various stuff. LDAP, SQL-databases, design, internal applications like room-planners and content are normally already in-place when Plone comes along. So we try to show how to make all these things work together nicely without throwing them away or reinventing the wheel.

I also get a chance to give a updated version of my all-time-favorite presentation about some amazing add-ons for Plone that exists through the hard work of others. I was thinking about calling it "Plone — straight or on-the-rocks?" but stuck with "Pimp-my-Plone".

We have some non-technical talks about Plone in the morning and some more in-depth talks in the afternoon. Plus case-studies and enough time for discussions. And: we go to a pub afterwards :-)

Check out the full programm and register now at http://muenchen.worldploneday.de/anmeldung

How to get a different look for some pages of a plone-site

erstellt von Philip Bauer zuletzt geändert: 2014-06-30T13:03:27+01:00
It's pretty easy to attach a special look to whole sections. Styling only some pages is a different story.

I'm currently working on a site where the customer wanted some pages to look differently than others.

(I should really not do the "Hey you could also do this and that" when my time is limited!)

The pages should have a additional css and a line of text above the heading. I wanted it to look like this:

foo

Here "what if foo..." is the Name of the folder that contains the document "...hits the bar?", being the h1.

Since the old trick with body.section-foo only works for whole sections and I needed the additional text (what if foo...) anyway I decided to go with the beloved marker interfaces.

Here is how it works:

1. Add a marker interface

In your theme-product edit your browser/interfaces.py and add:

class IMySpecialStyle(Interface): 
    """Marker Interface for  Documents with a special style
    """

 

2. Register a viewlet pinned to the Interface

In your browser/configure.zcml add:

<browser:viewlet 
   name="myspecialstyle.viewlet " 
   manager="plone.app.layout.viewlets.interfaces.IAboveContentTitle" 
   template="templates/myspecialstyle_viewlet.pt" 
   layer=".interfaces.IThemeSpecific" 
   for=".interfaces.IMySpecialStyle" 
   permission="zope2.View" 
   /> 

<browser:resource 
   name="myspecialstyle.css" 
   file="resources/myspecialstyle.css" 
   /> 

The line for=".interfaces.MySpecialStyle" activates the viewlet only for content which have the marker-interface. The viewlet-manager IAboveContentTitle inserts the viewlet just before the h1-tag of the targeted document.

 

3. Add content and styles

Now add a file browser/templates/myspecialstyle_viewlet.pt containing:

<link href="myspecialstyle.css" rel="stylesheet" type="text/css" 
      tal:attributes="href string:${context/portal_url}/++resource++myspecialstyle.css"/>

<div id="myspecialstyle-viewlet">
   <h2 class="myspecialstyle-header" 
       tal:content="python: context.getParentNode().title">
          what if foo ...
   </h2>
</div>

Instead of "getParentNode.title" I could also enter the expected line of text by hand. But like this I can reuse it for other folders.

Keep in mind that for default-pages you might want the 'grandparent‘, so you could use this

tal:define="is_default_page context/@@plone_context_state/is_default_page"

to check if it's a default page, and

tal:condition="is_default_page"
tal:content="python context.getParentNode().getParentNode().title"

to get the grandparents title.

Now create browser/resources/myspecialstyle.css and add:

#myspecialstyle-viewlet {
	position: absolute;
}

.myspecialstyle-header {
	bottom:1.45em;
	font-family: "Arial Black";
	font-size: 500%;
	font-weight: bold;
	left:-22px;
	color: #e1e1e1 !important;
	position:relative;
	z-index: 0;
}

h1.documentFirstHeading {
	z-index: 1;
	position: relative;
	padding-top: 10px;
}

 

4. Use it

Restart Zope. In ZMI go to the page in question (or rather add /manage_interfaces to it's url), select IMySpecialStyle from the available Marker Interfaces and add it.

If you remove everything from the viewlet except for the <link ...>-stuff you get a really simple way to style some selected pages.

 

 

Pydev Extensions now Open Source!

erstellt von Philip Bauer zuletzt geändert: 2014-06-30T13:03:12+01:00
A great tool for python (and Zope/Plone)-development just got better

The good News:

Pydev is a great eclipse-Plugin for which I primarily use for Plone- and Zope-Development. Pydev 1.5 now includes the formerly closed-source Pydev Extensions. Check out it's amazing features.

Learn more about Plone-Development with Eclipse and Pydev at my talk at the dzug-conference in Munich next week.

 

The bad news:

It happend only two weeks after I renewed my License for Pydev-Extensions :-(

Custom search forms for plone-sites

erstellt von Philip Bauer zuletzt geändert: 2015-10-04T15:45:59+01:00
Sites with a lot of content profit hugely from custom searches. Until recently adding a custom search to a Plone-Site was cumbersome and nothing your average editor or site-admin could do.

Ever since Ross Patterson wrote collective.formcriteria all will be well.

Stop writing search forms for each and every special case by hand and start thinking of search-forms as content just like collections are custom search-results as content. Ross saved us a lot of hassle by extending these almost all-powerfull collections to create custom forms searching through the collections content. And as added value displaying the results in a much nicer and more useful way than the default search.  

Say, you want a searchfield in your site only to search through the press-releases of all your departments.

  • First add collective.formcriteria to your buildout and install it via quickinstaller.
  • Create a new collection "Press-Releases".
  • Select "summary view" as Form Results Layout in the edit-tab of your collection (thus giving you the added value of preview-images being shown if the searchable content type has a image-field, e.g. news-items).
  • Edit the collections criteria and add the contenttype "News Item" (or the folder where you put the press-releases if you don't use a special contenttype) as a criterion.
  • Use "relevance" to sort the results.
  • Add "Searchable text" as criterion without entering a text (if you choose to enter something it'll populate the search-field as default-value) and select this field to show as "Form Fields".

Your new collection now shows you all your news items. Yawn! But when you switch the display to "Search form" the content of your collection disappears and a new search field is shown. Nice!

I prefer search-forms in portlets: Create a "Search form portlet", connect it to your collection. Voilá: custom search - whereever you want it. And that was a only an easy example.

More goodness in the most recent version include:

  • The "Content"-tab now works just like with a folder, meaning you can use content-actions like copy, rename, change state and such for your search results even if they are in different folders. With that collective.formcriteria outperforms the default search in almost every aspect.
  • The new "export"-Action allows you to save the results to CSV. You can specify the used columns via in the collection's "Table Columns" fields.

For custom searches using operators such as OR or NOT you still need to write your own search-forms using AdvancedQuery (and possibly anthill.querytool). But an implementation of these operators using subcollections is already on the ToDo-List.

Get it here: http://pypi.python.org/pypi/collective.formcriteria/

Interaktiver Stadtplan "Topographie des Nationalsozialismus in München"

erstellt von Philip Bauer zuletzt geändert: 2012-06-13T10:29:31+01:00
OpenLayers und Plone sind ein gutes Team zur Darstellung von geografischen Informationen.

Starzel.de hat für das geplante NS-Dokumentationszentrum München seit einiger Zeit einen interaktiven Stadtplan entwickelt der nun endlich online gegangen ist. Der Plan zeigt einen Querschnitt von historisch bedeutsamen Orten, die zwischen 1918 und 1945 Schauplätze von Aufstieg und Herrschaft des Nationalsozialismus waren sowie Orte die mit Resistenz und Widerstand gegen das NS-Regime verknüpft sind.

Erweiterungen um weitere Karten, z.B. zu Erinnerungsorte an den Nationalsozialismus in München sowie Orte der künstlerischen Auseinandersetzung sind in Vorbereitung. Für den ThemenGeschichtsPfad "Der Nationalsozialismus in München" entsteht zudem eine Online-Variante mit Audioguide-Einbindung.

Eine Vorversion der Software auf Basis von scriptaculous ohne Anbindung an Mapserver (d.h. mit statischen Bildern) haben wir u.a. für eine Seite über Bayerische Berufsschulen verwendet.

Developing Plone on Ubuntu 9.04 with virtualenv

erstellt von bleicher — zuletzt geändert: 2011-02-18T15:52:24+01:00
Technical notes to overcome some obstacles

Ubuntu 9.04 "Jaunty Jackalope" removed python 2.4 libraries from the distribution, which are necessary to run Zope/Plone.

To work in a more defined environment, where other as the system libraries are installed for a specific python, people use virtualenv.

Install virtualenv, python-2.4 from the distribution repository.

Create a 

virtualenv -p python2.4 --no-site-packages myappdir

In myappdir,

source bin/active

sets some environment variables.

I use zsh with the "nounset"-Option, which the script doesn't work with, so I had to

unsetopt nounset

Install ipython or zc.buildout or other eggs you need

easy-install ipython

PIL aka python-imaging is not longer available in a a 2.4 version in Ubuntu 9.04, but contains a lot of binary code so I didn't want to build it myself.  3 options: Install an old python-imaging-2.4-package,

Install it by hand - easy_install --find-links http://download.zope.org/distribution PILwoTK or untar and python setup.py install and before that, you have to install some other image handling libs to get all the features as explained here  http://sam.stainsby.id.au/blog/?p=28

sudo apt-get install libjpeg-dev libfreetype6-dev (zlib?)

or. what I did, install the current package and link to it from the virtualenv.

In myappdir/lib/site-packages

ln -s /usr/lib/python2.5/site-packages/PIL PIL

Python complains about differing C API versions, but it seems to work.

This all looks less than perfect, esp. the PIL link hack.

Too many packaging tools.

World Plone Day 2009 in Munich

erstellt von Philip Bauer zuletzt geändert: 2014-06-30T13:04:28+01:00
Set in a beautiful Seidlvilla in the heart of Munich the World Plone Day 2009 is an event not to miss.

22. April 2009

A great day for Plone ...

The morning session of the 2009 World Plone Day in munich is devoted to talks for beginners. Here we cover basic features, case-studies, theming and customisation of Plone.

In the afternoon we tackle the advanced stuff. Topic are: Professional intranets, internationalisation an high-end case-studies.

We will be there - not only as participants. Other than the basic walk-through the beauty that is Plone and a introduction into high-end intranets I also volunteered to give a fun new talk on the créme-de-la-créme of those 2422 products with which you can extend Plone and even make it have a pony

... and a great day for schools

As if that was not enough we have a parallel one-day-mini-sprint. The Plone-Community of Munich creates a complete new website for one lucky school for free. Including design, hosting, security, some workspace-tools and all the Plone-goodies that come out-of-the-box this is not only a great chance for a school to save a lot af cash but also a good opportunity for aspiring Plone-developers to learn the ropes in a crash-course.

See the full programm at:

muenchen.worldploneday.de

Don't miss it, register now.

Starzel.de auf dem WorldPloneDay München

erstellt von Philip Bauer zuletzt geändert: 2014-06-30T13:04:34+01:00
Mit knapp 70 Teilnehmern war der WorldPloneDay in München ein echter Erfolg. Starzel.de hat dabei vier Vorträge gehalten.

Von den Teilnehmerzahlen her scheint der World Plone Day in München der zweitgrößtegrößte weltweit gewesen zu sein. Anscheinend hat er  einen Nerv getroffen: MIt fast 70 Teilnehmern war der Saal in der Seidlvilla an der Kapazitätsgrenze. Neben dem einleitenden Vortrag "Was ist Plone und was kann es für sie tun?" haben wir uns noch mit drei weiteren Vorträgen beteiligt.

  • Der Vorstellung eines Plone-basiertem interaktiven Stadtplans ohne GoogleMaps, den wir im Auftrag des Kulturreferats für das geplante NS-Dokumentationszentrum München entwickeln.
  • Eine innovative Lernplattform zur Visualisierung und Vermittlung historischen Wissens auf Basis von Zope3 mit einer Flash-Oberfläche. Ein projekt, von dem wir hier sicher bald mehr berichten werden können...
  • Zuletzt noch eine "Skin-Session", bei der wir zeigten, dass sich mit Plone jedes beliebige Design umsetzten lässt.

Der World Plone Day war auch für uns eine tolle Erfahrung, nicht zuletzt dank der tollen Zusammenarbeit inerhalb der UserGroup RZUG München - nächstes Jahr sind wir wieder mit dabei!

How to add new content on top of a folder

By default Plone adds new content to the bottom of a folder. With zope3 event-handlers you can change that behaviour easily.

Here we use event handlers to push newly-created NewsItems to the top of the page. Usefull for blog-style folders. It doesn't apply when editing existing content.

Add a new subscriber to your configure.zcml (you might want to use your site-policy- or theme-product):

<subscriber 
   for="Products.ATContentTypes.interface.news.IATNewsItem
   zope.app.container.interfaces.IObjectAddedEvent"
   handler=".newsitemmover.moveToTop" />

Create the new file newsitemmover.py containing

def moveToTop(obj, event):
   """
   Moves Items to the top of its folder
   """
   folder = obj.getParentNode()
   if folder != None:
       folder.moveObjectsToTop(obj.id)

Restart Zope.

The tricky part is to choose the correct Interfaces for the subscriber. Keep in mind that IObjectAddedEvent is called several times during adding a NewsItem. It doen't matter in this case since the item can't be any more on top than on top :-)