You are not logged in Log in Join
You are here: Home » Members » wankyu » NeoPortal Content Pak 0.9a has been released. » View NewsItem

Log in
Name

Password

 

NeoPortal Content Pak 0.9a has been released.

I'm pleased to announce that NeoPortal Content Pak 0.9a has been released.

NeoPortal Content Pak is a collection of CMFPlone content types. It's dependent on Plone but I wouldn't call it Plone product since I don't fully follow the Plone developing guides.

You can download NeoPortal Content Pak from http://www.zoper.net/Downloads.

NeoPortal Content consists of three different types: Primitive, Container and Element types.

Primitive Types

Primitive NeoPortal Content Types are basic content types you'd find in an ordinary CMF site.

Container Types

Container types can contain Element types. Only a defined set of NeoPortal Elements can be added to a NeoPortal Container.

NeoPortal Containers give NeoPortal Elements sequenceable id's at the time of their addition. Any given id's via Elements' contructor methods are ignored unless the no_id_check argument is set to true when calling _setObject.

NeoPortal Containers can re-number its Elements' id's if needed.

Element Types

Only NeoPortal Containers can contain NeoPortal Element Types and Element types are container-dependent: for example, only an Advanced Container type can contain Advanced Element types.

Members Types

Ordinary portal members can add the following NeoPortal Content Types.

Primitive Types

  • NeoPortal Document : behaves just like CMF's Document with additional NeoPortal features
  • NeoPortal News Item : behaves just like CMF's News Item with additional NeoPortal features
  • NeoPortal Link : behaves just like CMF's Link with additional NeoPortal features; can open new window
  • NeoPortal File : behaves just like CMF's File with additional NeoPortal features
  • NeoPortal Image : behaves just like CMF's Image with additional NeoPortal features; can edit image-specific attributes ( border, align, scale, hspace, vspace, css_class, etc )
  • NeoPortal Media : NeoPortal Link + Content-type-aware icons
  • NeoPortal External File : NeoPortal File + Filesystem storage
  • NeoPortal Folder : PloneFolder with addtional NeoPortal features

Container Types

  • NeoPortal Article : NeoPortal Folder + Article features; as of 0.9a, all NeoPortal Element types are addable only to this container type

Element Types

  • NeoPortal Page Element : NeoPortal Document + Element features
  • NeoPortal Form Element : NeoPortal Document + Element features
  • NeoPortal Table Element : NeoPortal Document + Element features
  • NeoPortal Link Element : NeoPortal Link + Element features
  • NeoPortal Media Element : NeoPortal Media + Element features
  • NeoPortal File Element : NeoPortal File + Element features
  • NeoPortal Image Element : NeoPortal Image + Element features
  • NeoPortal External File Element : NeoPortal External File + Element features

Note that, as of version 0.9a, NeoPortal Form Element and NeoPortal Table Element behave exactly like NeoPortal Page Element. I have created these types for future versions of NeoPortal Content Pak so that I can easily extract HTML forms and tables from a document.

It is highly recommended users of NeoPortal Content Types use NeoPortal Form Element/NeoPortal Table Element when adding HTML form or table tags instead of directly inserting them into a Page Element.

Manager Types

Only managers or anyone with ManagePortal permissions can add the following NeoPortal Content Types.

Primitive Types

  • NeoPortal Advanced Document : NeoPortal Document + advanced features
  • NeoPortal Advanced News Item : NeoPortal News Item + advanced features
  • NeoPortal Advanced Link : NeoPortal Link + advanced features; can use Javascript
  • NeoPortal Advanced File : NeoPortal File + advanced features
  • NeoPortal Advanced Image : NeoPortal Image + advanced features
  • NeoPortal Advanced Media : NeoPortal Media + advanced features; can open
  • NeoPortal Advanced External File : NeoPortal External File + advanced features
  • NeoPortal Advanced Folder : NeoPortal Folder + advanced features

Container Types

  • NeoPortal Advanced Article : NeoPortal Article + advanced features; as of 0.9a, all NeoPortal Advanced Element types are addable only to this container type

Element Types

  • NeoPortal Advanced Page Element : NeoPortal Page Element + NeoPortal Advanced Document
  • NeoPortal Advanced Form Element : NeoPortal Form Element + NeoPortal Advanced Document
  • NeoPortal Advanced Table Element : NeoPortal Table Element + NeoPortal Advanced Document
  • NeoPortal Advanced Link Element : NeoPortal Link Element + NeoPortal Advanced Link
  • NeoPortal Advanced Media Element : NeoPortal Media Element + NeoPortal Advanced Media
  • NeoPortal Advanced File Element : NeoPortal File Element + NeoPortal Advanced File
  • NeoPortal Advanced Image Element : NeoPortal Image Element + NeoPortal Advanced Image
  • NeoPortal Advanced External File Element : NeoPortal External File Element + NeoPortal Advanced External File

Common Features for All NeoPortal Content Types

As of version 0.9a, NeoPortal Content Types come with the following common features.

Content Caching

Document-like types can cache rendered content. These types have two common properties: text and cooked_text.

The text property holds the raw content while the cooked_text property contains the rendered content.

You SHOULD never get text and cooked_text properties directly. You must let NeoPortal Content Objects examine their values first.

NeoPortal Content Types define the following methods to get and set their content:

  • getRawNeoPortalContent() : return raw content ( self.text )
  • setRawNeoPortalContent( self , text='' ): set text
  • getRenderedNeoPortalContent() : return cooked_text ( some NP objects re-render their raw content depending on REQUEST )

Content Renderers ( Cookers )

A NeoPortal renderable content class ( document-like classes ) define the _cookContent method which is used to pre-cook content.

The Format Dublin Core element defines the behavior of the _cookeContent method: structured-text, for example, causes the content to be rendered into Structured Text.

Embeddable NeoPortal Content Types also define a private method called _renderEmbeddedObjects. The method searches the content trying to find embedding markers ( note! I said markers, not objects, only references are stored in the content ) and render them by applying their call_view skins to the embedded object. NeoPortal content embedding works like OLE. Inline commenting capability common to all document-ish NeoPortal Content Objects is one good example of how NeoPortal content embedding works.

Another method iconizeNeoPortalContent is available to all NeoPortal content classes that inherit the NeoPortalIconizableContent mix-in class. As its name implies, NeoPortal Iconizable Content turn simple text notations into graphic icons, emoticons, for example:

            ':-)' becomes a smiling icon ( :-) ) when rendered.

Content cookers can be easily created. Only your imagination is the limit.

A NeoPortal Content Object, when being saved, refers to the _np_renderers Class property to get its list of renderers. For example:

            _np_renderers = ['_insertInlineCommentFormMarker', '_cookContent', \
                            '_renderInlineComments', '_renderEmbeddedObjects', \
                            'iconizeNeoPortalContent']

The above is the default list of NeoPortal Content ( NP_Content.py ). The _getNeoPortalContentRenderers method should be used to get this property.

Simply call _updateNeoPortalContent method and these renderers will be called in the defined order. If you want to skip a specific renderer you may directly call the _renderNeoPortalContent method with the new list of renders:

            _renderNeoPortalContent( content=None, renderers=None, **kw )

The _renderNeoPortalContent method pushes the content ( self.getRawNeoPortalContent() is called when the content argument is None ) through the list of the defined renders and return the rendered content.

The _updateNeoPortalContent method internall calls the _renderNeoPortalContent to set the cooked_text value:

            self.cooked_text = self._renderNeoPortalContent()

Note the _renderNeoPortalContent method's **kw arguments. All renderers may define their own set of arguements. For instance, _renderInlineComments method defined in NeoPortalInlineCommentableContent class accepts view_comment argument which is used to filter out inline comments based on the argument's value: 0 for removing all comments or a certain creator's name to view only his comments:

            _renderInlineComments( content, creator=None, REQUEST=None, **kw )

Object Embedding

Document-like types can embed other objects. Embedded objects are rendered automatically in embedding object's view. Any changes in embedded objects are automatically updated in embedding object's view. Even inline comments can embed and render other objects; NeoPortal object embedding follows the rules of acquisition.

Embeddable objects must provide a view named call_view. For instance. NeoPortal Document comes with a call_view template call_doc.pt, which returns only the rendered content without any HTML or site headers.

Embedding syntax is pretty simple:

  • __(id)__ # two underscores + opening '( + the id of the object to embed +closing )' + two underscores
  • __(image_1)__ # embeds an object whose id is image_1

Requested objects get rendered with their call_view templates or replaced with the following error messages.

  • __(REQUESTED_OBJECT_DOES_NOT_SUPPORT_EMBEDDING: image_1)__ # not NeoPortal Content Type objects
  • __(CANNOT_EMBED_UNAUTHORIZED_OBJECT_IN_THIS_CONTEXT: image_1)__ # pure authorization errors
  • __(CANNOT_CROSS_EMBED: page_1)__ # page_1 alread embeded the current object; might fall into an infinite loop
  • __(NOT_AUTHRIZED_TO_EMBED_REQUESTED_OBJECT_IN_THIS_CONTEXT: image_1)__ # not owner of the object and it's not published
  • __(REQUESTED_OBJECT_DOES_NOT_SUPPORT_EMBEDDING_NO_CALL_VIEW: image_1)__ # NeoPortal Content Type objects but no call views found
  • __(REQUESTED_OBJECT_NOT_FOUND: image_1)__ # not found

These error messages are only saved in the rendered ( cached ) content of the object. When embedded objects become available and you re-edit the embedding object, their call views will get rendered into the embedding object's cached content storage: cooked_text.

NeoBoard Articles also inherit from the NeoPortalEmbeddableContent class: an article can embed its attachments, for example, to render their call views anywhere in the article body.

Inline Commenting

Document-like types are inline-commentable. Backtalk like inline comments can be added and users can view only selected commentor's comments ( works like MS-Word's annotations ) or can choose to view or not to view all the comments on the fly.

When a user chooese not to view comments or to view only a certain person's commments, NeoPortal Content Objects re-render their content instead of resorting to their content caching machinery.

IP-based Spam Blocking

Document-like types are spam-blockable. IP-based spam blocking prevents duplicate postings in a given interval from the same IP address. One can't comment on an article twice in less than 10 seconds, for example, to prevent DOS-like malicious duplicate postings.

Daily Access Log

Daily access logs are saved in a special container inside a NeoPortal Content Object and the container is purgeable by a given interval. Logs are viewable via log object tab.

Content Rating

All NeoPortal Content Types are ratable. The max and min rating values can be changed via the np_options object tab.

Only one rating value can be stored from a single IP address: that is, one can't rate the same content twice but can change his/her rating value by rating the content again with a different value.

New Discussion Tool

NeoBoard gets instantiated instead of the stock CMF discussion container when discussion gets activated for a NeoPortal Content Object. Users can enjoy all the bells and whistles NeoBoard comes with.

When discussion is enabled, an object tab labeled discussion appears and clicking the tab leads to the NeoBoard instance.

A list of articles also appear at the bottom of the object's view if one or more articles found.

Note that NeoPortal Element Types cannot have their own discussion boards. They make use of their container's discussion board. ( It seemed awful lot of waste for every element to have its own NeoBoard instance. One board for a container should suffice. )

All options can be toggled on and off via np_options object tab

Common Features for NeoPortal Advanced Content Types

As of version 0.9a, NeoPortal Advanced Content Types come with the following common features.

DTML Handling

Document-like types can render DTML tags in a given context.

dtmlDescription Method

All NeoPortal Advanced Content Types defines a method dtmlDescription that returns the description attribute value after rendering any DTML tags found in it.

Advanced Features for Container Types

NeoPortal Containers give NeoPortal Elements sequenceable id's at the time of their addition. Any given id's via Elements' contructor methods are ignored unless the no_id_check argument is set to true when calling _setObject. In addition, NeoPortal Containers can re-number its Elements' id's if needed and navigation menus are automatically set up in a container view.

We can make use of this automatic-ordering feature of a NeoPortal Container to make a photo album in a few seconds, for example: just add any number of NeoPortal Images into a NeoPortal Article. That's your photo album.

NeoPortal External Files can be created in a batch inside a NeoPortal Container. For instance, a member can upload a set of image files to a directory under authorized file bases and import them as NeoPortal External Files. One can even add all the files found in subdirectories.

NeoPortal External File Security

You can set authorized file bases inside a file called file_bases.props that resides in the data directory under the NeoPortal Library package directory:

        NeoPortalLibrary/
                        /data/file_bases.props

        # filepath bases - multiple bases allowed
        # unused bases may be commented out
        # zero base means you'll allow any directory depending on Zope user's file permissions
        #/home/ZopeHome/archives for unix/linux
        #\\ZopeHime for windows

For example, if you set /home/ZopeHome/archives as the only authorized file base inside this file, members cannot set file paths of their NeoPortal External Files above this file base:

        authorized file path: /home/Zopehome/archives/cool_images.zip

        unauthorized file path: /home/cool_images.zip

NeoPortal Tools

As of version 0.9a, NeoPortal Content Pak comes with thre distinct NeoPortal Tools: NeoPortal External Access Tool, NeoPortal Discussion Tool and NeoPortal Properties Tool.

NeoPortal External Access Tool

NeoPortal External Access Tool makes it possible to access worlds outside of Zope: filesystem, RDBMS, for example.

As of version 0.9a, only filesystem can be accessed via NeoPortal External Files.

NeoPortal Discussion Tool

NeoPortal Discussion Tool allows NeoPortal Content Types to have NeoBoard instances as discussion container instead of CMF's stock discussion items container.

NeoBoard instance gets instantiated when an owner/manager of an instance turns on the Allow Content Discussion option.

NeoPortal Properties Tool

NeoPortal Properties Tool allows for site-wide configuration of NeoPortal Content Type options. Inidividual instances may override this site-wide configuration by setting their own values.

Setting Content Type Options

Zope's acquisition rules also apply to NeoPortal Content Types: an instance can set its properties individually or acquire them from its parent by context.

Site-wide configuration is possible with the NeoPortal Properties Tool.

Automatic Upgrade

Old NeoPortal Content Pak instances can detect updated NeoPortal classes when you install a newer version of NeoPortal Content Pak.

Upgrading from previous versions of products has never been easier: a click-and-go upgrade.

i18n

NeoPortal Content Pak has been built with i18n in mind since day one.

See the i18n.txt in the NeoPortal Library package directory for more info on how to activate the i18n machinery.

Note that all internal messages NeoPortal Content Pak spews out go into a neoportal domain message catalog. You should have a message catalog with neoportal domain for this to work.

Known Bugs

If you embed references to other objects when creating document-like content, do not change the name (id) of the content object.

NeoPortal Embedding System renders the references in the current context, which gets changed when you rename the context.

It's a minor issue and easily correctible by re-saving (re-editing) the content.

It's not a bug, but NeoPortal News Items won't show up in your recent news box slot. If you want them to appear in the box, edit the news.pt Plone skin:

        results1 python:container.portal_catalog(meta_type='News Item', \
        sort_on='created', sort_order='reverse',review_state='published');
        results2 python:container.portal_catalog(meta_type='NeoPortal News Item', \
        sort_on='created', sort_order='reverse',review_state='published');
        results3 python:container.portal_catalog(meta_type='NeoPortal Advanced News Item', \
        sort_on='created', sort_order='reverse',review_state='published');
        results python: results1 + results2 + results3;