At the Forge - CMF Types
Over the last few months, we have discussed content management systems (CMS) in general and Zope's content management framework (CMF) in particular. Zope's CMF is designed to give developers the tools they need to create their own content management systems. Of course, anyone who has worked with a CMS knows that even the most proprietary of the bunch requires extensive modification, reworking and customization before it can be used. Zope thus not only reduces the price of the base software, but provides a rich environment that makes it relatively easy to develop and customize the CMS.
When you create a CMF site, you (as the site manager) can add, modify and delete documents. Click on the folder contents link, click on the New... button, indicate which type of document you want to add and what ID it should have and then click on the add button. Enter the metadata (that is, title, description, subject and content type), click on the change & edit button, add some content and you're off and running.
However, although the existing content types are sufficient for simple sites, more sophisticated sites will want to create their own, custom types. CMF provides several ways to do exactly this. This month, we look at types in CMF—how we can work with them, customize their behavior, install new ones and even create new types to handle custom content.
The simplest way to create a new type is to use CMF's built-in, Web-based type extension system. It allows you to create a new type that shares its methods, properties, actions, presentation templates and icons with another type by default. When you create a new type using the Web-based extension system, you can modify any of these items, except for the methods and properties. In other words, the new type you create can have a different look and feel from its parent type, but it continues to behave much as the parent did.
For example, let's go to what is known as the types tool, available by clicking on portal_types within the management interface for a CMF site. If you don't have a CMF site already defined in Zope, you can create one by choosing CMF Site from the Add... menu in the upper-right corner of the Web-based Zope management interface. Once you have created the site, clicking on its icon from within the management interface displays a number of different customization tools, each with an icon that looks like a wrench.
When you first enter the types tool, you see a list of the currently defined CMF types, including folders, documents, news items, links and topics. You can examine and modify the properties and actions associated with these types by clicking on the name of the type you want to change. For example, if you want to examine or change the way the File content type does things, click on File. This brings up a new set of management tabs at the top of the page, with properties (the default) and actions being the only ones not standard to other parts of Zope. Actually, properties is a standard Zope tab, but CMF types have a number of unusual property names.
In addition to the standard properties you expect to see, each type has the following properties that affect what it does:
Icon: a string that describes which icon should be displayed for items of this type.
Product metatype: describes the Zope product meta-name. Meta-names are used in the Add... menu in the Zope Management Interface. This also is the name used in the similar Add... menu in the CMF.
Product name: indicates the Zope product in which the CMF type was defined. Because both the File and News item types were defined in the default CMF installation, they are listed as being in the CMFDefault product. And indeed, if you look in /lib/python/products/CMFDefault, which is a symbolic link to CMF-1.3/CMFDefault in CMF 1.3, you should see both File.py and NewsItem.py, Python modules that define the content types. To see how the initial values for properties are set, look at the factory_type_information variable in any module for any defined CMF type.
Product factory method: describes the method CMF should invoke to create a new instance of the type.
Filter content types and Allowed content types: these work together, even though they are separate properties. Although both of these properties exist for all CMF types, they are relevant only for folder-like objects, such as Folders and Topics. The first, Filter content types, is a boolean value that indicates whether Allowed content types is active. The second, Allow content types, lets you specify which types may be contained within the current type. So if you were interested in creating a folder that would contain only News items, you could do so by clicking yes and then indicating which types may be included.
|Using Salt Stack and Vagrant for Drupal Development||May 20, 2013|
|Making Linux and Android Get Along (It's Not as Hard as It Sounds)||May 16, 2013|
|Drupal Is a Framework: Why Everyone Needs to Understand This||May 15, 2013|
|Home, My Backup Data Center||May 13, 2013|
|Non-Linux FOSS: Seashore||May 10, 2013|
|Trying to Tame the Tablet||May 08, 2013|
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- RSS Feeds
- New Products
- Using Salt Stack and Vagrant for Drupal Development
- Drupal Is a Framework: Why Everyone Needs to Understand This
- A Topic for Discussion - Open Source Feature-Richness?
- Home, My Backup Data Center
- Validate an E-Mail Address with PHP, the Right Way
- New Products
- Tech Tip: Really Simple HTTP Server with Python
- Ahh, the Koolaid.
4 hours 55 min ago
- git-annex assistant
10 hours 54 min ago
- direct cable connection
11 hours 17 min ago
- Agreed on AirDroid. With my
11 hours 27 min ago
- I just learned this
11 hours 31 min ago
12 hours 1 min ago
- not living upto the mobile revolution
14 hours 53 min ago
- Deceptive Advertising and
15 hours 28 min ago
- Let\'s declare that you have
15 hours 29 min ago
- Alterations in Contest Due
15 hours 30 min ago
Enter to Win an Adafruit Prototyping Pi Plate Kit for Raspberry Pi
It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Prototyping Pi Plate Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- Next winner announced on 5-21-13!
Free Webinar: Linux Backup and Recovery
Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.
In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.