diff --git a/lam/docs/devel/mod_accountPages.htm b/lam/docs/devel/mod_accountPages.htm index 93592dd0..38d66d6d 100644 --- a/lam/docs/devel/mod_accountPages.htm +++ b/lam/docs/devel/mod_accountPages.htm @@ -11,7 +11,75 @@


-

1. Defining pages
+

1. Loading the LDAP attributes
+

+Every time the user selects an existing account to modify LAM will load +the complete LDAP entry of it. Your module then should select the +attributes which are useful for it.
+There are two variables in baseModule +which should be used to store the attributes. The $attributes variable stores the +current attributes including changes the user made. The $orig variable stores the attributes +as they were originally when the account was loaded. This allows you to +see what changes were made.
+
+The load_attributes() function +in your module gets the complete attribute list from LDAP.
+
+Example:
+
+The ieee802Device uses an +object class and the 'macAddress' +attribute. Therefore we will save this two values.
+
+ + + + + + +
    /**
+    * This function loads all needed attributes into the +object.
+    *
+    * @param array $attr an array as it is retured from +ldap_get_attributes
+    */
+    function load_attributes($attr) {
+        +$this->attributes['objectClass'] = array();
+        +$this->attributes['macAddress'] = array();
+        $this->orig['objectClass'] = +array();
+        $this->orig['macAddress'] = +array();
+        if (isset($attr['objectClass'])) {
+            +unset($attr['objectClass']['count']);
+            +$this->attributes['objectClass'] = $attr['objectClass'];
+            +$this->orig['objectClass'] = $attr['objectClass'];
+        }
+        if (isset($attr['macAddress'])) {
+            +unset($attr['macAddress']['count']);
+            +$this->attributes['macAddress'] = $attr['macAddress'];
+            +$this->orig['macAddress'] = $attr['macAddress'];
+        }
+        return 0;
+    }
+
+
+
+

2. Defining pages

You can define multiple subpages for your account page. Usually one page is enough but you may display certain attribute settings on an @@ -46,7 +114,7 @@ in this module.


-

2. Page display

+

3. Page display

Now that you have defined your subpages you will need one function for each page to display it. The function must return meta HTML code as defined in the 'attributes The first half of the code displays the existing MAC addresses and the second an input field for new values.
The variable $this->attributes -contains all LDAP attributes of an account.
+contains the LDAP attributes which are useful for this module.

@@ -122,7 +190,7 @@ sizeof($this->attributes['macAddress']), 'name' => 'mac_number'));


-

3. Processing input data
+

4. Processing input data

Every time the user clicks on a submit button while your page is displayed LAM will call a function in your module.
@@ -234,7 +302,7 @@ $this->inputCorrect = true;


-

4. Defining that your module is ready for LDAP add/modify

+

5. Defining that your module is ready for LDAP add/modify

Before a new account can be created or modified all modules are asked if they are ready.
There are two functions which control the module status. The     /** used for account pages, true if input data is correct */
-    var $inputCorrect = true;
+    var +$inputCorrect = true;

    /**
    * This function returns true if all needed settings are done.
    */
-    function module_complete() {
+    function module_complete() {
        return $this->inputCorrect;
    }
   
@@ -277,7 +347,8 @@ are done.
    * Returns true if all settings on module page are correct.
    */
-    function module_ready() {
+    function module_ready() {
        return $this->inputCorrect;
    }
@@ -286,20 +357,55 @@ correct.


-

5. Saving the LDAP attributes
+

6. Saving the LDAP attributes

-
+When all modules report that they are ready for LDAP add/modify and the +user clicks on the add/modify button your module will be asked what +changes have to be made.
+This is done in the function save_attributes() +which must be implemented by your module.

Example:

-
+The ieee802Device +module saves the attribute states in $attributes +and $orig and there are no +other DNs which may be modified. Therefore we can use the save_module_attributes() function in +accountContainer. You can +always access the current accountContainer +with $_SESSION[$this->base].

- diff --git a/lam/docs/devel/mod_pdf.htm b/lam/docs/devel/mod_pdf.htm new file mode 100644 index 00000000..6b045504 --- /dev/null +++ b/lam/docs/devel/mod_pdf.htm @@ -0,0 +1,107 @@ + + + + Module HowTo - PDF output + + + +
+

Module HowTo - PDF output
+

+
+
+

+

1. Defining possible PDF values
+

+The first step to PDF output is defining what values your module +provides. This is needed for the PDF editor, otherwise the user will +not be able to select values from your module.
+
+The PDF values are specified with get_pdfFields() +or meta['PDF_fields'].
+
+Example:
+
+The ieee802Device +module has only one attribute and therefore one PDF value: the MAC +address.
+
+
   
+
    /**
+    * Returns a list of modifications which have to be +made to the LDAP account.
+    *
+    * @return array list of modifications
+    * <br>This function returns an array with 3 +entries:
+    * <br>array( DN1 ('add' => array($attr), +'remove' => array($attr), 'modify' => array($attr)), DN2 .... )
+    * <br>DN is the DN to change. It may be +possible to change several DNs (e.g. create a new user and add him to +some groups via attribute memberUid)
+    * <br>"add" are attributes which have to be +added to LDAP entry
+    * <br>"remove" are attributes which have to be +removed from LDAP entry
+    * <br>"modify" are attributes which have to +been modified in LDAP entry
+    */
+    function save_attributes() {
+        return +$_SESSION[$this->base]->save_module_attributes($this->attributes, +$this->orig);
+    }
+ + + + + +
       +/**
+    * Returns meta data that is interpreted by parent +class
+    *
+    * @return array array with meta data
+    */
+    function +get_metaData() {
+        $return = array();
+[...]
+        // available PDF fields
+     +    $return['PDF_fields'] = array(
+     +        'macAddress'
+     +    );
+        return $return;
+    }
+
+
+
+
+

2. Providing data to put into the PDF file
+

+When the user wants to create a PDF file the LDAP account is loaded and +you module is asked for data to put into the PDF file.
+
+This is done with get_pdfEntries().
+
+Example:
+
+The ieee802Device +module will return the MAC address list of the account.
+
+ + + + + + +
    /**
+    * Returns a list of PDF entries
+    */
+    function get_pdfEntries() {
+        $return = array();
+        if +(sizeof($this->attributes['macAddress']) > 0) {
+            +$return['ieee802Device_macAddress'] = '<block><key>' . +_('MAC address list') . '</key><value>' . implode(', ', +$this->attributes['macAddress']) . '</value></block>';
+        }
+        return $return;
+    }
+
+
+
+
+
+ +

+
+ + +