From 619142ae4b727e05a8dd20da4ada2e252b498d54 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Fri, 8 Jun 2012 18:48:09 +0000 Subject: [PATCH] document tools --- lam/docs/devel/index.htm | 7 +- lam/docs/devel/toolsHowTo.htm | 145 ++++++++++++++++++++++++++++++++++ 2 files changed, 150 insertions(+), 2 deletions(-) create mode 100644 lam/docs/devel/toolsHowTo.htm diff --git a/lam/docs/devel/index.htm b/lam/docs/devel/index.htm index a1213c05..7244fef0 100644 --- a/lam/docs/devel/index.htm +++ b/lam/docs/devel/index.htm @@ -3,6 +3,7 @@ +
@@ -100,8 +101,10 @@ browser

Howtos

diff --git a/lam/docs/devel/toolsHowTo.htm b/lam/docs/devel/toolsHowTo.htm new file mode 100644 index 00000000..ea686eb4 --- /dev/null +++ b/lam/docs/devel/toolsHowTo.htm @@ -0,0 +1,145 @@ + + + + + Tools HowTo + + + + + + + + + +

Tools HowTo
+

+ +

+
+ +

+
You can add your own tools easily. +Please follow the following steps to create a custom tool. Tools are +displayed in the tools menu in the upper right corner of LAM.
+
+

Create tool definition class

+All tools contain a definition class and a separate PHP page that displays the content itself.
+First, you need to create a new tool definition class in lib/tools. The file name does not need to follow any patterns but there must be a class included that implements the LAMTool interface.
+
+Example:
+
+
/**
+
 * Server information
+
 * 
+
 * @package tools
+
 */ 
+
class toolServerInformation implements LAMTool {
+
    
+
    /**
+
     * Returns the name of the tool.
+
     * 
+
     * @return string name
+
     */
+
     function getName() {
+
         return _("Server information");
+
     }
+
    
+
    /**
+
     * returns a description text for the tool.
+
     * 
+
     * @return string description
+
     */
+
    function getDescription() {
+
        return _("Information about the LDAP server.");
+
    }
+
    
+
    /**
+
     * Returns a link to the tool page (relative to templates/).
+
     * 
+
     * @return string link
+
     */
+
    function getLink() {
+
        return "serverInfo.php";
+
    }
+
    
+
    /** 
+
     * Returns if the tool requires write access to LDAP.
+
     * 
+
     * @return boolean true if write access is needed
+
     */
+
    function getRequiresWriteAccess() {
+
        return false;
+
    }
+
    
+
    /**
+
     * Returns if the tool requires password change rights.
+
     * 
+
     * @return boolean true if password change rights are needed
+
     */
+
    function getRequiresPasswordChangeRights() {
+
        return true;
+
    }
+
    
+
    /**
+
     * Returns the link to the tool image (relative to graphics/)
+
     *
+
     * @return string image URL
+
     */
+
    function getImageLink() {
+
        return 'tree_info.png';
+
    }
+
    
+
    /**
+
     * Returns the prefered position of this tool on the tools page.
+
     * The position may be between 0 and 1000. 0 is the top position.
+
     *
+
     * @return int prefered position
+
     */
+
    function getPosition() {
+
        return 600;
+
    }
+
    
+
    /**
+
     * Returns a list of sub tools or an empty array.
+
     * 
+
     * @return array list of subtools (LAMTool)
+
     */
+
    function getSubTools() {
+
        return array();
+
    }
+
    
+
    /**
+
     * Returns if the tool is visible in the menu.
+
     *
+
     * @return boolean visible
+
     */
+
    function isVisible() {
+
        return true;
+
    }
+
    
+
    /**
+
     * Returns if a tool may be hidden by configuration in the LAM server profile.
+
     * 
+
     * @return boolean hideable
+
     */
+
    function isHideable() {
+
        return true;
+
    }
+
    
+
}
+The functions are quite self-descriptive.
+LAM Pro provides multiple access levels. The functions getRequiresWriteAccess()/getRequiresPasswordChangeRights() can restrict the visibility of the tool.
+
+You will also need a logo for your tool. This can be any image in the folder graphics.
+
+Sometimes you may want to create a submenu to group multiple tools. This is possible by using the function getSubTools(). It returns a list of LAMSubTool objects.
+
+

Create the tool page

+Each tool definition provides the path to its tool page with the function getLink(). The tool page can be any PHP page inside the directory templates.
+
+This is all that you need to create your own tool for LAM. :)
+
+
+ + \ No newline at end of file