Skip to content. | Skip to navigation

Personal tools
Sections
You are here: Home wiki RetaskNewsItem

RetaskNewsItem

Adapted from Chapter 8: Extending Plone

Repurposing existing content types

We want a new Course content type for the site. The initial example is based on the News Item but should be extended to include other useful data members like URL, teaching staff, time and location.

  1. From the ZMI select /portal_types, using the Add menu (top rhs), select Factory-based Type Information, provide an id of Course and for Use default type information select CMF Default: News Item, clickAdd to complete.

A new content type called Course is now listed in /portal_types

  1. Selecting the new Course type allows us to set default and initial values controlling appearance - don't do anything here though.
  2. Select the Actions tab and change the View action to point to a different page template. Change the Action string for View fromstring:${object_url}/newsitem_view tostring:${object_url}/course_view and click the Save button. This action loads the default page the user gets when the access a Course object. The course_view doesn't exist yet however so...
  3. From the ZMI select /portal_skins/plone_content/newsitem_view. We want to create a course_view template, so click on the Cusomize button. A copy of newsitem_view is moved to /portal_skins/custom/newsitem_view and you are probably looking at the edit page for this custom newsitem_view template.

Both the content of this custom template and its name need to change.

  1. From /portal_skins/custom select and rename the newsitem_view template to course_view
  2. Update the content of news_item_view template TAL to reflect what you want the Course object to look like.

Finished.

  • Next steps.
    • To do the same sort of things for the course_edit_form (steps above indicate how to do this),.
    • Note the TAL stuff in the new course_edit_form template like legend i18n:translate="legend_course_details". Should we rename these fields as if they had a i18n entry for them? Unfinished work if we want to make a package at a later date.
    • What happens when we create a course_edit_form, start to see errors like:
            Error Type
               ValueError
            Error Value
               No next action found for course_edit_form.success.Course.Save Metadata actions: ZMI actions: