With the introduction of the Metadata interface it was finally time to do some major rework of the core NAP code. While the Permalink feature outlined here was already part of the 2.2.0 release of MidCOM, it is picked up here again, as its general idea was one of the more important building blocks of this new NAP core.
The most interesting part about the NAP rewrite is the fact, that
invisible items are now hidden from the NAP client completly. This
essentially deprecates the MIDCOM_NAV_VISIBLE key outside of NAP. Main
reason for this API change is the fact, that it can't be that each and
every NAP code out there had to check wether an item should be hidden
or not. This has the rather convenient side effect, that the navigation
in AIS now hides ViewerGroups protected objects automagically.
Attributes affecting visibility
If an item is visible in NAP is determined by combining several
factors, which are in part configurable using the new unified MidCOM
If configured to do so, MidCOM will automatically hide all objects which are currently not approved; that is, if either the object has been edited since the last approval or the object has been newly created.
NAP checks for approval only on-site, AIS will always show unapproved objects.
Hidden or scheduled objects
This is a new feature of MidCOM 2.4, which should not be mixed up with the old MIDCOM_NAV_VISIBLE. Objects that are hidden do completly and unconditionally vanish from the Navigation on-site. At this time, no protection on the URL level has been implemented, but this will come in the near future (I'm just not sure if this will make it into the 2.4.0 release). At this time the PermaLink resolution does not work for hidden items already.
Any object, which is scheduled but not visible due to its scheduling settings is considered hidden in this respect.
NAP checks for hiding only on-site, AIS will allways show hidden objects.
Objects without an navigation entry
This is a less restrictive form of object hiding, roughly equivalent with the original MIDCOM_NAV_VISIBLE implementation. Any object which has somehow set the "noentry" Flag set, will not be included in any navigation listing returned by the navigation classes. The object is loaded and regularily available though, through PermaLinks and the regular URL. The corresponding NAP objects can be retrieved if the node/leaf ID is known.
Hiding objects this way is useful for "internal" pages like contact us thank-you pages, the n.n.discussion in-page comment threads and the like.
The interesting part here is that this is the only Metadata value that can be overriddern on runtime using the components NAP interface key MIDCOM_NAV_NOENTRY. This allows for dynamic hiding of selected elements from the navigation without having to hack the hiding code somehow. The above key is optional, you need only to set it if you actually use it, otherwise, it defaults to false.
In addition, the corresponding metadata key is in the default metadata schema. If it is set there, it will automatically take precedence, hiding the navigation entry always.
NAP checks for non-entry objects only on-site, AIS will show all objects unconditionally.
Implementation note: This feature is at this time (2004-02-14) only implemented for leaves, an correspondinge node implementation will follow soon.
ViewerGroups protected objects
NAP is now fully aware of the ViewerGroups protection system. Any node that is not accessible due to ViewerGroups in the context of the currently authenticated user is completly hidden from the Navigation unconditionally.
NAP checks this unconditionally, hiding protected topics even in AIS.
The current development tree still has compatibility code in it, which adds a MIDCOM_NAV_VISIBLE key (always set to true) to the NAP information. This will be removed in the next major relese (2.6) so that there is some transition time for site users.
Upgrading existing sites is actually relativly easy, as the major change is that hiding is done by NAP, not your nav code. You don't need to check the visibility each time, simplifying your code. MidCOM-Template will of course support this change in 2.4 already.
Components need a similar change, removing all MIDCOM_NAV_VISIBLE-style code. I have done this already for components in MidCOM CVS, but you should check your home-brew components in regard to this. Mainly you need to convert the visible settings either to the NOENTRY setting or the actual hiding, depending on the purpose you have. A good deal of the possible solutions are already covered by the new Metadata system, only specific, dynamic leaf or node hiding needs to be done by your code.
For content upgrading, check the scri9pt convert_legacy_metadata.php, it should be easily adaptable to include your custom components.