/**
@@ -45,8 +40,7 @@ object.
* @param array $attr an array as it is retured from
ldap_get_attributes
*/
- function load_attributes($attr) {
+ function load_attributes($attr) {
$this->attributes['objectClass'] = array();
@@ -81,15 +75,12 @@ $this->orig['macAddress'] = $attr['macAddress'];
2. 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 modules specification.
+each page to display it. The function must return meta HTML code as defined in the modules specification.
This function is called display_html_<page
name>() where <page
name> is the name of your subpage.
-Example:
+Example:
The
ieee802Device
@@ -100,8 +91,7 @@ second an input field for new values.
The variable $this->attributes
contains the LDAP attributes which are useful for this module.
-
+
/**
@@ -110,8 +100,7 @@ show a page with all attributes.
*
* @param array $post HTTP-POST values
*/
- function display_html_attributes($post) {
+ function display_html_attributes($post) {
$return = array();
// list current MACs
for ($i = 0; $i <
@@ -163,12 +152,10 @@ This function is called process_<page
name>() where <page
name> is the name of your subpage.
-If all input data is ok then return "0" or an array containing no error
-message. If you return one or more error messages then the user will be
+If all input data is ok then return an empty array. If you return one or more error messages then the user will be
redirected to your page.
-Example:
+Example:
The
ieee802Device
@@ -178,8 +165,7 @@ and therefore only process_attributes()
The function checks the input fields and fills the LDAP attributes. If
all is ok it will enable the user to move to another module page.
-
+
/**
@@ -188,8 +174,7 @@ checks
*
* @param array $post HTTP-POST values
*/
- function process_attributes($post) {
+ function process_attributes($post) {
$errors = array();
$this->attributes['macAddress'] = array();
@@ -215,8 +200,7 @@ $this->messages['mac'][0];
$message[] =
$post['macAddress' . $i];
- $errors[] =
-array($message);
+ $errors[] = $message;
}
@@ -244,7 +228,7 @@ $this->messages['mac'][0];
$message[] = $post['macAddress'];
- $errors[] = array($message);
+ $errors[] = $message;
}
}
@@ -260,13 +244,10 @@ array_unique($this->attributes['macAddress']);
4. Defining that your module is ready for user input and LDAP
add/modify
-In most cases you will not need to implement these functions. The baseModule will return true for both functions.
+In most cases you will not need to implement these functions. The baseModule will return true for both functions.
-There are two functions which control the module status:
+There are two functions which control the module status:
The module_ready() function
has to
@@ -278,14 +259,12 @@ modules (e.g. you need the user name from posixAccount first).
The second function is
module_complete(). The user
-cannot do the LDAP operation if one or more modules return false. This defines if all needed
+cannot do the LDAP operation if one or more modules return false. This defines if all needed
input data for your module was entered.
Use this function if you want to check that all required attributes are
set.
-Example:
+Example:
The sambaSamAccount
module needs the user's uidNumber
@@ -293,8 +272,7 @@ and gidNumber before it can
accept input and the account needs a sambaSID
before it can be saved.
-
+
/**
@@ -305,8 +283,7 @@ other modules which was not yet entered.
*
* @return boolean true, if page can be displayed
*/
- function module_ready() {
+ function module_ready() {
if
($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]=='')
return false;
@@ -324,8 +301,7 @@ for this module have been made.
*
* @return boolean true, if settings are complete
*/
- function module_complete() {
+ function module_complete() {
if (!$this->module_ready())
return false;
if
@@ -341,9 +317,7 @@ return false;
5. Saving the LDAP attributes
-In most cases you will not have to implement this option if you use $this->attributes and $this->orig to manage the LDAP
+In most cases you will not have to implement this option if you use $this->attributes and $this->orig to manage the LDAP
attributes. The baseModule
will generate the save comands for you.
@@ -352,15 +326,13 @@ 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().
-Example:
+Example:
The kolabUser module uses
this function to make sure that its object class is saved. Other
modules (e.g. quota) use it build the lamdaemon commands.
-
+
/**
@@ -402,5 +374,4 @@ $this->attributes['objectClass'][] = 'kolabInetOrgPerson';
-
-
+ | | | | |