|
|
Some notes
Layout
- truncate titles of items
- add full title as hover-help
- restore full title if item added to page
General
TODO: Cache mechanism
TODO: Make an admin interface for adding/enabling/disabling Source Methods
(-> Frontpage_userapi_registerSourceMethods/Frontpage_userapi_unregisterSourceMethods)
The module variable 'serializedSourceMethods' contains a (serialized) list of the functions who are called to get content.
It has the following structure:
$sourceMethods = array(
'sourcetype' =>
array( // for each sourcetype there are three functions defined:
'getSingle' => // getSingle defines an API function which is used to get a single item from a source
array(
'module' => 'modulename', // the module of the function
'type' => 'apitype', // the apitype of the function (user or admin)
'method' => 'functionname', // the name of the function
),
'getEntries' => // getEntries defines an API function which is used to get 'all' items from a source
array(
'module' => 'modulename', // the module of the function
'type' => 'apitype', // the apitype of the function (user or admin)
'method' => 'functionname', // the name of the function
),
'searchEntries' => // searchEntries defines an API function which is used to search items from a source
array(
'module' => 'modulename', // the module of the function
'type' => 'apitype', // the apitype of the function (user or admin)
'method' => 'functionname', // the name of the function
),
));
There are two function to control this list:
Frontpage_userapi_registerSourceMethods($args) adds new sourcetype & methods to the list $args should be an array in this style:
$args = array(
'srctype' => 'sourcetype', // the name/id of the new source type
'methodArray' => // the array with the function definitions
array(
'getSingle' => ...
'getEntries' => ...
'searchEntries' => ... (same as in sourceMethods)
),
);
Frontpage_userapi_unregisterSourceMethods($args) removes sourcetype & methods from the list $args should be an array of this type:
$args = array(
'srctype' => 'sourcetype' // the name/id of the source type
);
RSS
There a two methods of accessing RSS contents:
- copy an item from a feed and treat it like an HTML Block
- integrate as 'live' feed which is actualized automatically (srctype: rssfeed)
the number of items to show from a live feed is for the moment hardcoded in pnapi.php:getRSSFeed (once line 1196)
TODO: There are problems with some feeds who aren't recognized
Javascript
TODO: documentation with JSDoc (http://jsdoc.sourceforge.net/)
There is an assertion function assert(cond, desc) in mylib.js
The buttons at the top right of the items are generated by createDragItem and updated by updateHandles .
They use the following mechanism to do this:
Each item has in it's "title-div" a <span>-element with the class 'rm-handle'.
These <span>-elements can be turned into button bars by some helper functions:
turnIntoStandardButtonBar(span) creates a standard button bar with an add-button
turnIntoHTMLButtonBar(span) creates a HTML-Blocks button bar with an add-button, an edit-button and a delete-button
turnIntoRSSButtonBar(span) creates a RSS-Items button bar with a special add-button
turnIntoRemoveButtonBar(span) creates a remove button bar with a cross-button
turnIntoEditRemoveButtonBar(span) creates a HTML-Blocks remove button bar with an edit-button and a cross-button
These functions do not directly assign actions to the buttons, but they assign them
special-named classes, which in turn are used by Behaviour to assign the buttons onclick-actions.
Actually there are these classes:
- rss-edit-on-add which assigns
onclick="editRSSItem(..)"
- change-list which assigns
onclick="changeList(..)"
- edit-html which assigns
onclick="editHTMLBlock(..)"
- delete-html which assigns
onclick="deleteHTMLBlock(..)"
These 'assignments' are defined in the behaviour_rules variable. |
|
|