Motivation
In building a content-oriented website, people need a way to specify
structure (how the pages and content items of the site inter-relate)
and provide navigation based on the structure.
Most existing tools for site-structuring and navigation in Drupal are problematic for two main reasons:
- They don't play nice with each other, often implementing similar functionality with no shared code.
- They serve only a few specialized use-cases.
Views module is the brightest star in the integration space, with the caveat that it is node-centric. In order for a navigation scheme using views to be entirely successful, your high-level objects should all be nodes.
On the structure side, the most generic and flexible tool is the CCK, although it is still missing many features such as support for pluggable validators.
This proposal defines a set of target use-cases and then lays out a plan to serve them by extending CCK reference fields with validation and automatic navigation. Ability to deliver these use-cases as profiles will serve as completion criteria.
Piggy-backing on CCK reference fields
The basic idea in this proposal is to augment nodereference and userreference field-types with optional field-level behaviors for creating CCK-based trees, containers, and access control groups. These options will be concise and simple to configure, and will enable the creation of structural types tailored to the needs of the application.
Default navigation views for structural fields will be created automatically, also menu items for nodes which participate in the structure. Both types of navigation can then be customized by the site architect.
Install Profiles as Use Cases
Even with these new behaviors, most users will still be lost on the dark sea of "how do I structure my site?" without some documentation on best practices. To fill this need, and to enable simple deployment of new sites, several install profiles will be created with pre-made content types for building content-rich sites. These profiles will correspond to three use-cases:
- Simple book-style page tree with automatic menu entries
- Ditto with containers instead of pages. It should be possible to display a "bubble up" view containing all items in the active container or a descendant.
- An access-control enabled version with groups as an additional container type. Privileges should cascade down the container tree. It should be possible to control access to child containers as well as access to contained items.
These profiles will serve as the criteria for project-completion, so that the details of the implementation given less weight than the overall usability and usefulness of the interface.
Profiles will make it easier to write tests for the supporting code, as test cases can simply call the profile to create a test environment. Functional and performance tests will be created using Apache JMeter and possibly Simpletest.
Deliverables
Nodereference Tree module:
- Depends: nodereference, views
- Provides UI on nodereference field admin form to activate tree behavior.
- Validate field input to ensure that there are no circular chains of references. This may be implemented as a view filter which is automatically added to the validation view for the field.
- Manage a menu for each tree field containing all participating nodes.
- Provide a default view "fieldname_children" displaying the children of the current node, and display it as a block on participating nodes.
- Support automatic population of a dependent "ancestors" field which stores the ancestors of the current item. This is an optimization to allow "deep" queries on the tree.
Nodereference Container module:
- Depends: nodereference_tree
- Provide UI on nodereference field admin form to activate container behavior
- Provide a default view displaying the contained items for the current container
Tree Access module:
- Depends: nodereference_tree
- Allow user reference field to grant privileges to referenced users on descendant nodes.
- UI on userreference field admin form to enable using the field as an access control list for descendants.
- also on field admin form, checkboxes for CRUD
- Privileges cascade down the tree
Container Access module:
- Depends: nodereference_container
- Same as above, but controlling access to contained items.
- Additional checkbox on field admin form to enable cascade to descendant containers.
