scalixScalixObject = false;
}
/** used for account pages, true if input data is correct */
var $inputCorrect = true;
var $scalixScalixObject;
var $scalixMailnode;
var $scalixEmailAddress;
/**
* Returns meta data that is interpreted by parent class
*
*/
function get_metaData() {
$return = array();
// manages user accounts
$return["account_types"] = array("group");
// alias name
$return["alias"] = _("Scalix");
// module dependencies
$return['dependencies'] = array('depends' => array(), 'conflicts' => array());
// help Entries
$return['help'] = array (
"scalixuser" => array(
"ext" => "FALSE", "Headline" => _("scalixScalixObject"),
"Text" => _("boolean TRUE or FALSE for creating scalix object")),
"mailnode" => array(
"ext" => "FALSE", "Headline" => _("scalixMailnode"),
"Text" => _("comma separated org units for object mailnode")),
"mboxaddr" => array(
"ext" => "FALSE", "Headline" => _("scalixEmailAddress"),
"Text" => _("E-Mail Adress of Scalix Group"))
);
$return['attributes'] = array('scalixScalixObject','scalixMailnode','scalixEmailAddress');
$return['objectClasses'] = array('scalixUserClass');
return $return;
}
/**
* 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) {
parent::load_attributes($attr);
//scalixScalixObject
if (is_string($this->attributes['scalixScalixObject'][0])) {
if ($this->attributes['scalixScalixObject'][0] == "TRUE") $this->scalixScalixObject = true;
else $this->scalixScalixObject = false;
}
//scalixMailnode
$this->attributes['objectClass'] = array();
$this->attributes['scalixMailnode'] = array();
$this->orig['objectClass'] = array();
$this->orig['scalixMailnode'] = array();
if (isset($attr['objectClass'])) {
$this->attributes['objectClass'] = $attr['objectClass'];
$this->orig['objectClass'] = $attr['objectClass'];
}
if (isset($attr['scalixMailnode'])) {
$this->attributes['scalixMailnode'] = $attr['scalixMailnode'];
$this->orig['scalixMailnode'] = $attr['scalixMailnode'];
}
//scalixEmailAddress
$this->attributes['objectClass'] = array();
$this->attributes['scalixEmailAddressx'] = array();
$this->orig['objectClass'] = array();
$this->orig['scalixEmailAddress'] = array();
if (isset($attr['objectClass'])) {
$this->attributes['objectClass'] = $attr['objectClass'];
$this->orig['objectClass'] = $attr['objectClass'];
}
if (isset($attr['scalixEmailAddress'])) {
$this->attributes['scalixEmailAddress'] = $attr['scalixEmailAddress'];
$this->orig['scalixEmailAddress'] = $attr['scalixEmailAddress'];
}
// add object class if needed
// if (! in_array('scalixUserClass', $this->orig['objectClass'])) {
// $this->attributes['objectClass'][] = 'scalixUserClass';
// }
if (! in_array('scalixUserClass', $this->orig['objectClass'])) {
$this->attributes['objectClass'][] = 'scalixUserClass';
}
return 0;
}
/**
* Returns a list of modifications which have to be made to the LDAP account.
*
* @return array list of modifications
*
This function returns an array with 3 entries:
*
array( DN1 ('add' => array($attr), 'remove' => array($attr), 'modify' => array($attr)), DN2 .... )
*
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)
*
"add" are attributes which have to be added to LDAP entry
*
"remove" are attributes which have to be removed from LDAP entry
*
"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);
}
/**
* This function will create the meta HTML code to show a page with all attributes.
*
* @param array $post HTTP-POST values
*/
function display_html_attributes() {
$return = array();
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Scalix User') ),
1 => array ( 'kind' => 'input', 'name' => 'scalixScalixObject', 'type' => 'checkbox', 'checked' => $this->scalixScalixObject, 'value' => 'true'),
2 => array ('kind' => 'help', 'value' => 'scalixuser'));
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Mailnode') ),
1 => array ( 'kind' => 'input', 'type' => 'text', 'name' => 'scalixMailnode', 'size' => '20', 'maxlength' => '255', 'value' => $this->attributes['scalixMailnode'][0]),
2 => array ( 'kind' => 'help', 'value' => 'mailnode' ));
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Mboxaddr') ),
1 => array ( 'kind' => 'input', 'type' => 'text', 'name' => 'scalixEmailAddress', 'size' => '20', 'maxlength' => '255', 'value' => $this->attributes['scalixEmailAddress'][0]),
2 => array ( 'kind' => 'help', 'value' => 'mboxaddr' ));
return $return;
}
function get_pdfEntries() {
return array(
'scalixUserClass_scalixScalixObject' => array('' . _('Scalix User') . '' . $this->attributes['scalixScalixObject'][0] . ''),
'scalixUserClass_scalixMailnode' => array('' . _('Mailnode') . '' . $this->attributes['scalixMailnode'][0] . ''),
'scalixUserClass_scalixMboxaddr' => array('' . _('Mboxaddr') . '' . $this->attributes['scalixEmailAddress'][0] . ''));
}
/**
* Processes user input of the primary module page.
* It checks if all input values are correct and updates the associated LDAP attributes.
*
* @param array $post HTTP-POST values
* @return array list of info/error messages
*/
function process_attributes() {
$this->triggered_messages = array();
if (isset($_POST['scalixScalixObject'])) {
$this->scalixScalixObject = true;
$this->attributes['scalixScalixObject'][0] = "TRUE";
} else {
$this->scalixScalixObject = false;
$this->attributes['scalixScalixObject'][0] = "FALSE";
}
$this->attributes['scalixMailnode'][0] = $_POST['scalixMailnode'];
$this->attributes['scalixEmailAddress'][0] = $_POST['scalixEmailAddress'];
if (sizeof($this->triggered_messages) > 0) {
$this->inputCorrect = false;
return $this->triggered_messages;
}
else {
$this->inputCorrect = true;
return 0;
}
}
/**
* This function returns true if all needed settings are done.
*/
function module_complete() {
return $this->inputCorrect;
}
/**
* Returns true if all settings on module page are correct.
*/
function module_ready() {
return $this->inputCorrect;
}
function get_profileOptions() {
$return = array();
// use Unix password as Samba password
$return[] = array(
0 => array('kind' => 'text', 'text' => _('Scalix User') . ': '),
1 => array('kind' => 'input', 'name' => 'scalixUserClass_scalixScalixObject', 'type' => 'checkbox', 'checked' => true),
2 => array('kind' => 'help', 'value' => 'scalixuser')
);
$mboxes = array(0 => 'LIMITED', 1 => 'FULL');
$return[] = array(
0 => array('kind' => 'text', 'text' => _('Mailnode') . ': '),
1 => array('kind' => 'input', 'type' => 'text', 'name' => 'scalixUserClass_scalixMailnode', 'size' => '30', 'maxlength' => '255', 'value' => ''),
2 => array('kind' => 'help', 'value' => 'mailnode')
);
$return[] = array(
0 => array('kind' => 'text', 'text' => _('Mboxaddr') . ': '),
1 => array('kind' => 'select', 'type' => 'text', 'name' => 'scalixUserClass_scalixEmailAddress', 'size' => '30', 'maxlength' => '255', 'value' => ''),
2 => array('kind' => 'help', 'value' => 'mboxaddr')
);
return $return;
}
/**
* Loads the values of an account profile into internal variables.
*
* @param array $profile hash array with profile values (identifier => value)
*/
function load_profile($profile) {
// profile mappings in meta data
parent::load_profile($profile);
// special profile options
if ($profile['scalixUserClass_scalixScalixObject'][0] == "true") {
$this->scalixScalixObject = true;
}
elseif ($profile['scalixUserClass_scalixScalixObject'][0] == "false") {
$this->scalixScalixObject = false;
}
if (isset($profile['scalixUserClass_scalixMailnode'][0])) {
$this->attributes['scalixMailnode'][0] = $profile['scalixUserClass_scalixMailnode'][0];
}
if (isset($profile['scalixUserClass_scalixEmailAddress'][0])) {
$this->attributes['scalixEmailAddress'][0] = $profile['scalixUserClass_scalixEmailAddress'][0];
}
}
}
?>