Using LocalFS in the ZMI

Adding a Local File System

Local File System objects allow you to serve files and browse directories in Zope from the local file system.

When you add a Local File System object to a folder, the path to the file system object becomes the “mount point” for the file system. The object has a property called “basepath” which works just like the base path of a regular web server.

For example, if you create a file system object in the root folder with an id of images and set the base path to /usr/local/www/images, then the url http://zopeserver/images/bullet.gif will display the file /usr/local/www/images/bullet.gif.

  • Id: The id of the Local File System.

  • Title: The optional title of the Local File System.

  • Base Path: The path to the directory in the file system where the Local

    File System accesses its contents.

  • Username: The username for a Windows share that requires login

    information (Win32 only).

  • Password: The password for a Windows share that requires login

    information (Win32 only).

  • Add: Creates a new Local File System.

Contents tab: Edit contained objects

This view displays the contained objects and allows you to add, delete and change them.

Each contained object is displayed on a line and is identified by an icon, an id and a title in parenthesis. Additionally, the size (if applicable) and the date during which the object was last modified are displayed. You can manage an object by clicking on its identifying link.

Sorting

You can sort contained objects by type, name (id), size, or modification date. To do so, click on the appropriate column heading. Clicking a second time on any column heading will reverse the sort on that field.

Controls

  • [Checkbox] – Selects the object in order to perform operations on it. The operations you can perform are rename, cut, copy, delete, and export. Some operations may not be visible if they are not allowed.

  • Rename – Changes the ids of the selected objects.

  • Cut – Cuts selected objects and place them into the clipboard. This is similar to cut in most file managers. Cut objects can be pasted in a new location. When cut objects are pasted into another location the old objects are deleted.

  • Copy – Copies selected objects and place them in the clipboard. This is similar to copy in most file managers. Copied objects can be pasted in a new location.

  • Paste – Allows you to paste objects from the clipboard into this object. Note: This option will only appear if objects have previously been copied or cut.

  • Delete – Deletes the selected objects. Deleted objects are not placed in the clipboard.

  • Import/Export – Imports or exports a Zope object.

  • Select All (Deselect All) – Toggles between selecting and deselecting each item currently displayed in the contents view. Note: This control will only appear if your browser is javascript-enabled.

Properties tab: Manage the properties of a Local File System

This view allows you to edit and define properties on a Local File System object.

  • title – The optional title of the Local File System object.

  • basepath – The path to the directory in the file system where the Local

    File System accesses its contents.

  • username – The username for Windows share that requires login information.

  • password – The password for a Windows share that requires login information.

  • default_document – A space-delimited list of files that Local File

    System will display instead of the browsing the directory. For example, if the default document is index.html and a local directory contains a file by that name, it will be displayed instead of the default directory browse view.

  • type_map – Used to associate file extensions with content-types

    and Zope object classes. It consists of a list of mappings, one per line. Each line contains fields separated by tabs or spaces. The first field is a file extension. The second field is a content-type associated with that extension. The third field is optional and contains a Zope object class to associate with the extension. Zope object classes can be specified in one of several ways.

    • The class can be DTMLDocument, DTMLMethod, Image, or File. These object types are built into LocalFS. File is the default object class if none is specified.

    • The class can be specified using its full path including the module name, i.e. “Products.XMLDocument.XMLDocument.Document”. If the class defines a method createSelf(id, data) which returns an object of this class, then this method will be called as a static unbound member function to create the object. This allows products to provide their own factory functions to create objects from local files.

    • If the class doesn’t contain a factory function then an optional fourth parameter to the mapping is the name of a factory class. This class may be implemented in a file in the Extensions directory, in which case the class should be specified as “(module name).(class name)”, or it may be in the Extensions directory inside a product directory, in which case it should be specified as “(product name).(module name).(class name)”. The factory class should define a __call__(self, id, data) method which returns the object.

    • If all of these methods fail then the object is created with the default class of File.

  • icon_map – Associates a file’s content-type with the icon used to

    display the file in the directory browse view. The format is similar to the type map. The first field contains a content-type. The second field contains the path of the icon object displayed for that content-type in the directory browse view. The icon can exist anywhere in the object tree, but it must be a path that can be resolved by URL traversal. The default icon is misc_/LocalFS/generic.gif. All icons in the ‘www’ subdirectory of the LocalFS product are loaded into the misc_/LocalFS folder on startup.

  • catalog – Enabling this property causes objects in the local file system

    to be included in ZCatalog searches. This can cause a significant performance penalty especially when the file system contains many files or very large files. It may also incur performance penalties in other areas having nothing to do with cataloging. Enable this option only if necessary.

Property types

  • boolean – 1 or 0.

  • date – A DateTime value, for example 12/31/1999 15:42:52 PST.

  • float – A decimal number, for example 12.4.

  • int – An integer number, for example, 12.

  • lines – A list of strings, one per line.

  • long – A long integer, for example 12232322322323232323423.

  • string – A string of characters, for example This is a string.

  • text – A multi-line string, for example a paragraph.

  • tokens – A list of strings separated by white space, for example one two three.

  • selection – A string selected by a pop-up menu.

  • multiple selection – A list of strings selected by a selection list.

Controls

Existing properties can be edited by selecting them.

  • [Checkbox] – Select the properties to change.

  • Property – The value of the property.

  • Save Changes – Changes the value of the selected properties.

  • Delete – Deletes the selected properties.

Creating new properties

  • Id – The id of the property.

  • Type – The type of the property.

  • Value – The value of the property.

    Note: When creating ‘selection’ and ‘multiple selection’ properties, specify the name of another property (or method) as the ‘Value’. This property (or method) should return a list of strings will be used to provide choices for the selection.

  • Add – Creates a new property.

Security tab: Define security settings

This view allows you to define security settings.

Security settings are defined in terms of roles and permissions. When a role is assigned to a permission users with the given role will be able to perform tasks associated with the permission on the object.

Controls

  • Assign Roles to Permissions: Roles are listed in columns and permissions are listed in rows. To assign a role to a permission check the checkbox at the intersection of the row and column. You can also manage roles and permissions individually by clicking on their name links.

  • Create Roles: You can create new roles by entering the role name in the text entry field under the User defined roles heading and clicking the Add Role button. You can delete any existing user defined roles by selecting them from the selection list under the User defined roles heading and clicking the Delete Role button.

  • Local Roles: You can create and manage local roles by clicking the local roles link.

  • Assign Permissions to a Role: You can manage the permissions assigned to a role by clicking on the role name.

  • Assign Roles to a Permission: You can manage the roles assigned to a permission by clicking on the permission name.

  • Acquire Permissions: The Acquire permission settings check box next to each permission indicates whether this item should inherit security settings for this permission from its container object. The acquired permission settings may be augmented by selecting roles for a permission in addition to selecting to acquire permissions.

    You can manage the acquisition of permission settings individually by clicking the Acquire permission settings link.

Upload tab: Upload local files and create directories

This page allows you to upload files from the web browser to the Zope server’s file system.

Controls

  • Browse – Open a file browser to select a file.

  • Add – Add the selected file.

  • Directory Name – Name for the directory you would like to create.

  • Create Directory – Create the new directory.