Peterbe.com

A blog and website by Peter Bengtsson

Filtered home page!
Currently only showing blog entries under the category: Plone. Clear filter

World Plone Day here in London, England

21 October 2008 0 comments   Plone

http://plone.org/events/wpd/2008/london-united-kingdom


On the 7th of November my company, Fry-IT is hosting the London arm of the World Plone Day in our office. It's basically an event for Plone developers, Plone companies and other people interested in Plone to meet up and promote or learn or share something about Plone. To quote the "FAQ":

"What is the goal of the World Plone Day?
The World Plone Day (WPD) is a worldwide event. Our goal is to promote and educate the worldwide public about of the benefits of using Plone in education, government, ngos, and in business."

The "invite" is here. I'm really looking forward to meeting everybody and put faces to people whose blogs and mailing lists posts I read. My colleague Lukasz has a nice map to our office and I recommend that you contact him to say you're coming.

Interesting lesson learnt on shortcut taking in usability

02 August 2007 3 comments   Plone


In Plone 2.1 (don't know about other versions) the default date input used by the CalendarWidget uses 5 dropdowns (year, month, day, hour, minute) plus a little popup calendar which you can use to avoid flipping the dropdowns. When the underlying value is not set the dropdowns look like this:

2007/--/-- [#] --:--

where the little [#] is the popup calendar widget. The year 2007 is preselected because they assume that most of the cases you'll just be selecting a month and a day since is highly likely that the year will be that of today's year. So far so good.

The problem is that people get confused. Where I'm doing some consulting work at the moment two people have "complained" that news items expire because the year is set to 2006 or 2007 or whatever is today's year. I assured them that it's built like that to save you (in most cases) the additional click of selecting the year. But even if I could convince these people of the motorical economics of the default year, they still found it confusing and so much on behalf of other people who might end up thinking the same thing.

So we decided to change the default to be just:

----/--/-- [#] --:--

and I must admit that this looks cleaner and makes it more immediately obvious that the date hasn't been set.

Lesson learnt: Don't take too many shortcuts just to save a few clicks. Stand back and think about what impressions a widget can give visually about it's functionality and value.

Before:
Interesting lesson learnt on shortcut taking in usability

After:
Interesting lesson learnt on shortcut taking in usability

Learning about ATFolder's security

22 March 2007 0 comments   Plone


I just learned something interesting about ATFolders in Plone. For the non-Plone readers, an ATFolder is Plone's take on a normal Zope Folder but based on Archetypes instead. To begin with, Plone overrides the function manage_addFolder which means that if you do context.portal_url.getPortalObject().manage_addFolder(...) in Plone you get an ATFolder instead of a normal Folder. Fair enough.

The problem I had was that ATFolders override the manage_delObjects() function not only is it's security defined in the container, it also does a security check within. I don't know why but I'm sure there's a reason. What this means is that you can't use some_at_folder.manage_delObjects([...]) in External Methods and expect no Unauthorized errors.

I solved this security problem I had by instead creating a normal Zope folder by doing it this way instead:

portal_root = self.portal_url.getPortalObject()
adder = portal_root.manage_addProduct['OFSP'].manage_addFolder
adder('PlainZopeFolder')

TAL here hack in Plone

28 April 2005 1 comment   Plone


Had to do a very useful and ugly but also smart hack in Plone today.

In the portal root I have a Document with Id index_html that the client is changing with the WYSIWYG editor. What I wanted to do was to change some METAL calls in the <head> tag of that one document. In fact, what I wanted to do was to cover up the left hand column which is done this way:

  <head>
       <metal:override fill-slot="column_one_slot" />
 </head>

The problem was that the index_html Document is a Document so I can't edit it's TAL. I could have customized document_view.pt but that would have applied for all Document objects in the site. Here's how I solved it:

I renamed index_html to index_html_content and created a Page Template object in the portal root. The code for this one I got from portal_skins/plone_content/document_view.pt. Then I added the metal:override as shown above.

But I wanted this new index_html to render the content of the index_html_content object so that in, index_html I can (continue to) do stuff like here/getBody and here/Title. So what did I do? Here's a cut down copy of the index_html code:

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
     lang="en"
     metal:use-macro="here/main_template/macros/master"
     i18n:domain="plone">
 <head>
       <metal:override fill-slot="column_one_slot" />
 </head>
 <body>
 <metal:main fill-slot="main">
   <!-- here's my hack! --> 
   <tal:hack define="here nocall:here/index_html_content">
     <tal:main-macro metal:define-macro="main"
          tal:define="len_text python:len(here.text);">
       <h1 tal:content="here/title_or_id" class="documentFirstHeading">
         Title or id
       </h1>
       [... stuff hidden ...]
     </tal:main-macro>
   </tal:hack>
 </metal:main>
 </body>
 </html>

That didn't hurt, did it?