You are not logged in Log in Join
You are here: Home » Members » jeffsasmor » Weblog and Filesystem File/Img content objs for Zope CMF » Filesystem images and files for CMF » View Document

Log in
Name

Password

 

Filesystem images and files for CMF

CMFOptions for the Zope CMF

THIS PRODUCT REQUIRES THAT THE ZOPE CMF BE INSTALLED FIRST!

It really won't work without it! CMF VERSION 1.2 is REQUIRED

This is Version 1.2 of CMFOptions for CMF 1.2 and Zope 2.4.3

Released on 29 January 2002

by Jeff Sasmor ([email protected])

Test Site for Blark Weblog

You can test the weblog here

Documentation from the README file

Note: the most current docs are here

*** * * * ***

CMFOptions for the Zope CMF

Feature set:

History

IMPORTANT:

  • standard_html_header is changed. more...
  • If you are going to install the weblog be sure to read the section about it carefully and set site policies prior to releasing it upon the world, especially the allowSelfReviewing policy.
  • There's a handy external method called blarkUtils.py in the Product folder. You can use it to display a list of Blarks. Install in Extensions directory.
  • As usual for CMF products, changes to dtml methods should be made via the portal skins tool and the custom folder. If not, upgrades to CMFOptions will overwrite changes you make if you do so in the filesystem itself. BE CAREFUL if you alter the DTML logic.
  • I welcome bug reports and suggestions: email them here
  • I can't explain the CMF, skins, dtml, and other zopeisms to you.
  • Please read all the documentation in here (and in the HELP for the Blark product once it is installed). If I left something out I'll be happy to explain it to you (if I can).
  • This software is released under the ZPL. PLEASE NOTE: There are no warranties regarding this software, it's operation, or anything else about it. If anything goes wrong it's not the responsibility of Janix Corp or Jeff Sasmor to do anything about it or be liable for any damages of any type, anywhere, in any country or parallel dimension. If you use this software you agree with these terms - otherwise do not use it!

RELEASE INFORMATION

  • This is Version 1.0 of CMFOptions
  • Released on 8 May 2001
  • By Jeff Sasmor ([email protected])

PREVIOUS

  • Version 1.0 beta released on 27 March 2001

COPYRIGHT INFORMATION

  • Copyright (C) 2001 Janix Corp and Jeff Sasmor

    [email protected]

    http://www.janix.com

  • Portions Copyright (C) Digital Creations
  • For CMFExtFile/ExtImage; Portions Copyright (c) 2000 Gregor Heine and

    Communications & Design Consultancy GmbH,

    Solmsstrasse 2, 60486 Frankfurt, Germany

    (http://www.cdc-group.com)

OTHER INFORMATION

Released under the ZPL and various disclaimers mentioned in this document.

WHATITIS

CMFOptions adds three skinnable content types to the CMF.

CMF External Image/File

These operate more-or-less identically to the existing Image and File content types, with the exception that the data is stored in the filesystem, specifically:

(ZopeRoot)/var/reposit/[a-z]

Where [a-z] refers to the first letter of the Portal member's name who creates the image or file.

These new content types were made by modifying the existing python classes for CMF Image and File. These classes wrap OFS.Image and OFS.File.

The new CMFExtImage and CMFExtFile classes wrap the ExtFile and ExtImage classes from the contributed Product "ExtFile"

Rather than rely on an installation of ExtFile in the Products directory, a modified copy of ExtFile is installed within the CMFOptions directory.

This has the advantage of allowing these new content types to work correctly within a Portal as well as within the Zope management interface.

Brief testing has been performed to ensure that this encapsulated version of ExtFile does not interfere with one that's located within the Products directory, but this remains to be demonstrated over a wider range of applications. Feedback on this subject would be appreciated.

Testing was performed using Zope 2.3.1b3 on a PC running RH Linux 7.

MORE INFO

You can get more information about ExtFile by examining CMFOptions/ExtFile/README.txt.

Please note that although ExtImage supports a preview image to go along with the mainimage, CMFExtImage does not, and won't.

Also, the DTML files in CMFOptions/ExtFile have been modified to show a consistent view when looking at Portal External Images and Portal External Files within the Zope management interface.

You can see the filesystem file name by looking at the object in the Zope management interface.

All changes to ExtFile/*.py are documented in the code.

FILE NAMES

The ExtFile product creates file names like:

(time)(id)

CMFExtFile/Image creates filenames like:

(user)_(time)_id

This makes it easier to delete files for a specific user or or even to implement quotas for each user.

Additionally, the repository has subfolders a-z. The first letter of the user's login is used to place his or her files in (ZopeDir)/var/reposit/[a-z].

If someone has a login beginning with something not in [a-z] then their files are stored in (ZopeDir)/var/reposit.

Actually, the portal won't let you create such a name, but maybe you could do it thru Zope.

IMPORTANT!

NOTE: if you click on the object within the Zope management interface and modify a CMFExtImage or CMFExtFile in a portal user's Member folder (or subfolder), YOUR user id (login) may be used for or substituted for the user id of the member when creating a new file name. If the first letter of your login is different, it will also be in another folder within ZopeDir/var/reposit/[a-z]).

This can happen if someone creates an ExtImage or Extfile within a portal but never uploads an image or file. When you do it, as a manager within the Zope Management Interface, your user id will be used to create the file and locate it in the lettered repository (ZopeDir)/var/reposit/[a-z]

It can also happen if you cut-and-paste within the Zope management interface.

This is transparent to the portal user as they never see the filename.

INSTALLATION

Copy the tarball to your Zope root directory and uncompress it

tar -xzvf CMFOptions_X_X.tgz

(x is version #)

Restart Zope and you should see CMFOptions in the Control_Panel/Products folder.

Configuration:

Since CMFOPtions is not a native part of the portal, you need to do a few things for it to work correctly.

Within an installed portal (this must be repeated for all portal instances)

  1. Click on portal_types. Click the drop down box and add a Factory-based Type Information item.

    Give the new item an id of "CMFExternalImage" BE SURE to select "CMFOptions: Portal External Image" from the "Use default type information" dropdown box.

    Repeat this to create a second Factory-based Type Information item with the id "CMFExternalFile" with the type information from "CMFOptions: Portal External File"

  2. Click on portal_skins. Add a new "FileSystem Directory View" item with an ID of CMFOptions (or Cmfo) and use "lib/python/Products/CMFOptions/skins" as the directory.
  3. Click on portal_skins, then Properties. For each skin, you need to add in CMFOptions (or Cmfo), right after custom. Be sure to click SAVE when you're done.

You should now be able to add External Images and Files from the "mystuff" page in a portal.

Note the one additional install step if you wish to use the Blark weblog. This is explained in the next section.

Blark Weblog

Blark adds a "Weblog" portal type, similar to Slashdot or Squishdot.

Blark skins will be installed when you install CMFOptions. This is discussed immediately above. You need to add the Blark portal type to complete the installation.

  • Click on portal_types. Click the drop down box and add a Factory-based Type Information item.
  • Give the new item an id of "Blark"

    BE SURE to select "CMFOptions: Blark Weblog" from the "Use default type information" dropdown box.

Customizable (skinnable) top, left, and right menus and content areas can be mucked around with.

If you want people to be able to add replies to posted articles, you MUST enable discussions for the Document portal-content type using the portal_types tool.

Zope Administrator Options

The Zope administrator can control various aspects of how weblogs act and how they can be created by setting various properties in the Members folder or any folder farther up the acquisition heirarchy. For greater granularity, most can be overridden on a member-by-member basis. This is done by having a site-wide default value higher up in the acquisition heirarchy (say, in Members) and having others on a per-member basis in a particular user folder.

Note: If you want to be able to create weblogs yourself, but not allow general portal users to be able to do so, then you will need to modify whatever dtml displays a list of things folks can add so that when the weblog's meta_type shows up it's skipped. You should be able to add a weblog to a particular Member folder manually by using the Zope ZMI and selecting CMF Options Content from the ADD dropdown box. You can use the noBlark property, explained below, to inhibit blark creation after you make one for yourself, but if the "New" selection list (as one sees with a stock CMF portal) has that selection but nothing happens then you'll get lots of emails :-)

Be sure to use the correct capitalizations: these are case sensitive.

  • bigBlarkEmergency. If this exists at all, the normal CMF actions box will be displayed. You should never need to use this.
  • allowPublic. If this does not exist at all, then portal members can create weblogs that can allow any member to add postings (Slash/Squish (newslog) mode) or only the member him or herself (weblog mode). If this does exist and is yes then the member has that choice. If this does exist and is no then the user doesn't have the option at all and the Blark is forced to be a private weblog. Note that the default (without allowPublic as a property somewhere) is for all created Blarks to initially be in in PUBLIC Newslog mode when they are first created. This is probably just fine for most installations.
  • allowSelfReviewing. If this does not exist at all, then all portal members manage their own reviewing. Probably the best thing unless you want to drive yourself nuts or you're a control freak :-). If it exists and is yes then the members manage their own reviewing. If it exists and is no then the only portal managers manage the review state of content. Note that this the mode of "only portal managers manage review state" has not been extensively tested.
    • IMPORTANT: decide on this one at installation time! When a blark instance is created it will modify the local role for the blark owner (that's added by the portal when the member area is created) to add the Review portal content permission. Due to the wonderfullness of acquisition, this will only affect postings within the Blark. If you change your mind later you'll need to use the ZMI to tweak all these local roles for blark folders manually (Setting it back to Owner or perhaps owner and manager)!
    • !! IMPORTANT: BLARK DEFAULTS TO SELF-REVIEWING!!
    • Even though Blark can somewhat subvert the normal reviewing process, images must be published or they will not appear. This includes images used in the top menu bar or in the right side "Feature Box" area. Images cannot be used as "Feature Box" items. Of course, portal members can link to non-portal images, but what can you do...
  • allowMailOut and portal_manager_mail. These control a feature that causes an email to be sent to an address specified by the Blark owner when a new Article is posted.
    • It's OFF by default. That is, unless you create an acquireable property with this name and set it to anything other than no, the feature is disabled. You can enable it in only a few Member accounts by placing this property in just those folders.
    • It assumes that the default MailHost created by the CMF upon installation is used. If not, you can modify blark_createNewItem.dtml in the filesystem or via the portal_skins tool.
    • The portal_manager_mail attribute must be defined somewhere in your Zope, say, in the as a property in the root folder. This provides the from address for the mail, and ought to be set to the something that will work properly on your email server. For example, if your web server zot.com is your email server (i.e., it's running sendmail and your Zope mailhost is set to use localhost) then you should use an email address like [email protected] or you may get errors.
    • You're advised to enable this on just your Member area first and try it out before enabling it for everyone.
    • Since new articles are created Empty (as are all CMF content items) it is impossible (or at least not easy) to send the body of the article along with the message. Not without the tag, anyway. The mail will be sent as soon as the article is created, so it might be a while before there's actually some content in the article.
  • noBlark. If this exists at all (i.e., if it exists and the value is blank or isn't no) or is yes then then the "Disable" checkbox on the weblog properties page won't appear. Also, a blark will not be created even if the method which ordinarily does so is invoked from DTML or from Python. Attempts to create a blark will produce :

    Error Type: RuntimeError

    Error Value: Locked out: No weblog creation

    If noBlark exists and is no, or if it doesn't exist at all then normal operation occurs. Note the reverse logic: if the property is yes then the mode is disable. If the property is no then the mode is enable.

    What is this for?

    • If you have a portal member who has created an offensive blark, use the Zope Management Interface to:
      • view the security page for the blark in question
      • turn off (uncheck) the View permission for the Anonymous role
      • switch to the Properies view (using the Properties tab) and add a property called noBlark. The property's value should be yes. If you want to stop that member from creating any other blarks, place the noBlark property in the Member's home folder (on the properties tab page for that folder).
    • If you only want one person or several persons to be able to create blarks
      • add a property noBlark with the value yes in the Members folder
      • add a property noBlark with the value no in the home folder of portal members who should be able to create them.

Miscellaneous Blark Knowledge Base

  • Only the portal member who created the log (and portal managers) can delete articles.
  • Blark uses the Zope CMF Document for postings. This type does not validate HTML for malicious content (as far as I know). Most of the standard viewing and editing forms have been altered, but this only affects documents created in a Blark folder.
  • The creator/owner of the log and Portal Managers have additional functionality when creating and maintaining articles. He or she can see the normal CMF left-hand menu if they wish by clicking Weblog Properties and checking the Actions Box checkbox. This is OFF by default, since it's (to me) too confusing for the application. Meta-what? Hey, I like plain English for this app. Of course, you can modify this sort of thing at the website level by playing with the DTML in the CMFOptions skins folder.
  • The dtml method called blarkActions_box substitutes for the normal actions_box method used by the CMF. You can't do without it or you lose a lot of the functionality.
  • The Blark home (article list) page can be viewed by any member or any anonymous viewer (unless locked out by access control within the Blark). Anonymous viewers will be able to see the Blark list of articles (each with some or all of the article text), but won't be able to view them in their entirety by clicking the open icon (without a login, anyway) - sort of prodding them to join, FWIW.
  • If you want your users to be able to have replies attached to postings, be sure that you use the Zope Management Interface to mosey on over to portal_types/Document, click ON the ALLOW DISCUSSION check box, and click SAVE CHANGES. Or they can't.

Standard_html_header changes

Blark has its own set of skins, and they are in the same folder as the skins for the file and image types. Noteworthy is the fact that the standard_html_header has been placed here: minor changes were required for optimal functionality.

Hence, if you have a modified standard_html_header in the portal_skins/custom folder, you'll need to modify it some more: look at the one in the CMFOptions/skins folder on your hard disk or portal_skins/CMFOptions thru the ZMI. There are two very minor changes and are things you probably didn't mess with. There are comments showing what was changed, just copy the changed dtml and paste it over the dtml within skins/custom/standard_html_header.

If you didn't modify standard_html_header then the modified one from portal_skins/CMFOptions will be used instead of the one from portal_skins/generic (if you followed step 3 in the install instructions for CMFExtFile/Image). Therefore, if you want to customize standard_html_header, customize the one in portal_skins/CMFOptions rather than the one in portal_skins/generic. If you don't, expect Blark to suddenly look a lot different. :-)

Since Blark and the two CMFExt... products share the same skins folder, the new standard_html_header affects all three products. However, the changes are only needed for Blark.

A Cute Trick

Blark has been designed so that a portal member can use it as his or her home page.

To do this, delete (or rename, if you want to reuse what's in it somewhere else) index_html in your home folder. This can be done from the ZMI. Then create a new Blark called (or rename an old one to) index_html. If you click view from within folder contents then you'll see your Blark folder. This also means that someone viewing your Blark can get to it by the URL for the member home page.

http://www/site.com/portal/Members/username

will render the Blark.

Bugs

Add to favorites is problematic: if you are barney and view fred's weblog and click Add To Favorites you get an access denied error. If you go to your favorites folder and add a new favorite manually and add the URL via the edit form then the favorite works as desired. Hence, for the time being, Add to Favorites won't show up in Blark at all.

History

Version 1.0 final of CMFOptions (CMFExtFile and CMFExtImage)

Bug Fixes

  • omitted import in CMFExtImage.py (StringIO). Jpeg imports would bomb.
  • changed form CMFExt_File_view so that when downloading you'd get the ID of the file as the filename.

Version 1.0 beta of CMFOptions (Blark)

First public release.

This is a new release.

(See the docs on netkook.com for an up-to-date version of this file.)