use extended upload function

This commit is contained in:
Roland Gruber 2015-07-13 16:33:56 +00:00
parent 224c4ede8d
commit 435604544b
4 changed files with 24 additions and 43 deletions

View File

@ -40,7 +40,7 @@ class account extends baseModule {
/** /**
* Returns true if this module can manage accounts of the current type, otherwise false. * Returns true if this module can manage accounts of the current type, otherwise false.
* *
* @return boolean true if module fits * @return boolean true if module fits
*/ */
public function can_manage() { public function can_manage() {
@ -51,7 +51,7 @@ class account extends baseModule {
* Returns meta data that is interpreted by parent class * Returns meta data that is interpreted by parent class
* *
* @return array array with meta data * @return array array with meta data
* *
* @see baseModule::get_metaData() * @see baseModule::get_metaData()
*/ */
function get_metaData() { function get_metaData() {
@ -199,7 +199,7 @@ class account extends baseModule {
/** /**
* Returns the HTML meta data for the main account page. * Returns the HTML meta data for the main account page.
* *
* @return htmlElement HTML meta data * @return htmlElement HTML meta data
*/ */
function display_html_attributes() { function display_html_attributes() {
@ -259,7 +259,7 @@ class account extends baseModule {
} }
return $return; return $return;
} }
/** /**
* In this function the LDAP account is built up. * In this function the LDAP account is built up.
* *
@ -286,14 +286,7 @@ class account extends baseModule {
} }
if (!in_array('posixAccount', $selectedModules)) { if (!in_array('posixAccount', $selectedModules)) {
// user name // user name
if (get_preg($rawAccounts[$i][$ids['account_uid']], 'username')) { $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'account_uid', 'uid', 'username', $this->messages['uid'][1], $messages);
$partialAccounts[$i]['uid'] = $rawAccounts[$i][$ids['account_uid']];
}
else {
$errMsg = $this->messages['uid'][1];
array_push($errMsg, array($i));
$messages[] = $errMsg;
}
} }
} }
return $messages; return $messages;

View File

@ -860,7 +860,7 @@ class asteriskExtension extends baseModule {
if (!in_array("groupOfNames", $partialAccounts[$i]['objectClass'])) if (!in_array("groupOfNames", $partialAccounts[$i]['objectClass']))
$partialAccounts[$i]['objectClass'][] = "groupOfNames"; $partialAccounts[$i]['objectClass'][] = "groupOfNames";
// attributes // attributes
$partialAccounts[$i]['AstExtension'] = $rawAccounts[$i][$ids['asteriskExtension_AstExtension']]; $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'asteriskExtension_AstExtension', 'AstExtension');
$extensionName = $partialAccounts[$i]['AstExtension']; $extensionName = $partialAccounts[$i]['AstExtension'];
$astPriorityTmp = 0; $astPriorityTmp = 0;

View File

@ -52,7 +52,7 @@ class asteriskVoicemail extends baseModule implements passwordService {
/** /**
* Returns true if this module can manage accounts of the current type, otherwise false. * Returns true if this module can manage accounts of the current type, otherwise false.
* *
* @return boolean true if module fits * @return boolean true if module fits
*/ */
public function can_manage() { public function can_manage() {
@ -210,7 +210,7 @@ class asteriskVoicemail extends baseModule implements passwordService {
$this->messages['AstVoicemailMailbox'][1] = array('ERROR', _('The mailbox format is invalid.')); $this->messages['AstVoicemailMailbox'][1] = array('ERROR', _('The mailbox format is invalid.'));
$this->messages['AstVoicemailMailbox'][2] = array('ERROR', _('There is already another user with this mailbox name.')); $this->messages['AstVoicemailMailbox'][2] = array('ERROR', _('There is already another user with this mailbox name.'));
$this->messages['AstVoicemailMailbox'][3] = array('ERROR', _('Account %s:') . ' asteriskVoicemail_AstVoicemailMailbox', _('The mailbox format is invalid.')); $this->messages['AstVoicemailMailbox'][3] = array('ERROR', _('Account %s:') . ' asteriskVoicemail_AstVoicemailMailbox', _('The mailbox format is invalid.'));
$this->messages['AstContext'][0] = array('ERROR', _('Please enter the account context.')); $this->messages['AstContext'][0] = array('ERROR', _('Please enter the account context.'));
$this->messages['AstContext'][1] = array('ERROR', _('The account context is invalid.')); $this->messages['AstContext'][1] = array('ERROR', _('The account context is invalid.'));
$this->messages['AstContext'][2] = array('ERROR', _('Account %s:') . ' asteriskVoicemail_AstContext', _('The account context is invalid.')); $this->messages['AstContext'][2] = array('ERROR', _('Account %s:') . ' asteriskVoicemail_AstContext', _('The account context is invalid.'));
@ -230,7 +230,7 @@ class asteriskVoicemail extends baseModule implements passwordService {
/** /**
* Returns the HTML meta data for the main account page. * Returns the HTML meta data for the main account page.
* *
* @return htmlElement HTML meta data * @return htmlElement HTML meta data
*/ */
function display_html_attributes() { function display_html_attributes() {
@ -245,7 +245,7 @@ class asteriskVoicemail extends baseModule implements passwordService {
$this->addSimpleInputTextField($return, 'AstVoicemailMailbox', _("Mailbox"), true); $this->addSimpleInputTextField($return, 'AstVoicemailMailbox', _("Mailbox"), true);
// account context // account context
$this->addSimpleInputTextField($return, 'AstContext', _("Account context"), true); $this->addSimpleInputTextField($return, 'AstContext', _("Account context"), true);
$return->addElement(new htmlSpacer(null, '10px'), true); $return->addElement(new htmlSpacer(null, '10px'), true);
// full name // full name
@ -393,7 +393,7 @@ class asteriskVoicemail extends baseModule implements passwordService {
for ($i = 0; $i < sizeof($rawAccounts); $i++) { for ($i = 0; $i < sizeof($rawAccounts); $i++) {
// add object class // add object class
if (!in_array("AsteriskVoiceMail", $partialAccounts[$i]['objectClass'])) $partialAccounts[$i]['objectClass'][] = "AsteriskVoiceMail"; if (!in_array("AsteriskVoiceMail", $partialAccounts[$i]['objectClass'])) $partialAccounts[$i]['objectClass'][] = "AsteriskVoiceMail";
//add context //add context
if (empty($rawAccounts[$i][$ids['asteriskVoicemail_AstContext']])) { if (empty($rawAccounts[$i][$ids['asteriskVoicemail_AstContext']])) {
// default value // default value
@ -403,10 +403,10 @@ class asteriskVoicemail extends baseModule implements passwordService {
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'asteriskVoicemail_AstContext', 'AstContext', $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'asteriskVoicemail_AstContext', 'AstContext',
'realname', $this->messages['AstContext'][2], $messages); 'realname', $this->messages['AstContext'][2], $messages);
} }
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'asteriskVoicemail_AstVoicemailMailbox', 'AstVoicemailMailbox', $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'asteriskVoicemail_AstVoicemailMailbox', 'AstVoicemailMailbox',
'realname', $this->messages['AstVoicemailMailbox'][3], $messages); 'realname', $this->messages['AstVoicemailMailbox'][3], $messages);
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'asteriskVoicemail_AstVoicemailEmail', 'AstVoicemailEmail', $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'asteriskVoicemail_AstVoicemailEmail', 'AstVoicemailEmail',
'email', $this->messages['AstVoicemailEmail'][1], $messages); 'email', $this->messages['AstVoicemailEmail'][1], $messages);
@ -421,7 +421,7 @@ class asteriskVoicemail extends baseModule implements passwordService {
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'asteriskVoicemail_AstVoicemailContext', 'AstVoicemailContext', $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'asteriskVoicemail_AstVoicemailContext', 'AstVoicemailContext',
'realname', $this->messages['AstVoicemailContext'][1], $messages); 'realname', $this->messages['AstVoicemailContext'][1], $messages);
$partialAccounts[$i]['AstVoicemailPassword'] = $rawAccounts[$i][$ids['asteriskVoicemail_AstVoicemailPassword']]; $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'asteriskVoicemail_AstVoicemailPassword', 'AstVoicemailPassword');
} }
return $messages; return $messages;
} }
@ -436,7 +436,7 @@ class asteriskVoicemail extends baseModule implements passwordService {
if(!isset($this->attributes['AstVoicemailPassword'][0]) || $this->attributes['AstVoicemailPassword'][0] == "" ) { if(!isset($this->attributes['AstVoicemailPassword'][0]) || $this->attributes['AstVoicemailPassword'][0] == "" ) {
return false; return false;
} }
} }
return true; return true;
} }
@ -475,13 +475,13 @@ class asteriskVoicemail extends baseModule implements passwordService {
/** /**
* Specifies if this module supports to force that a user must change his password on next login. * Specifies if this module supports to force that a user must change his password on next login.
* *
* @return boolean force password change supported * @return boolean force password change supported
*/ */
public function supportsForcePasswordChange() { public function supportsForcePasswordChange() {
return false; return false;
} }
/** /**
* This function is called whenever the password should be changed. Account modules * This function is called whenever the password should be changed. Account modules
* must change their password attributes only if the modules list contains their module name. * must change their password attributes only if the modules list contains their module name.
@ -500,7 +500,7 @@ class asteriskVoicemail extends baseModule implements passwordService {
$this->attributes['AstVoicemailPassword'][0] = $password; $this->attributes['AstVoicemailPassword'][0] = $password;
return array(); return array();
} }
/** /**
* Checks if all input values are correct and returns the LDAP attributes which should be changed. * Checks if all input values are correct and returns the LDAP attributes which should be changed.
* <br>Return values: * <br>Return values:
@ -509,7 +509,7 @@ class asteriskVoicemail extends baseModule implements passwordService {
* <br>del: array of attributes to remove * <br>del: array of attributes to remove
* <br>mod: array of attributes to modify * <br>mod: array of attributes to modify
* <br>info: array of values with informational value (e.g. to be used later by pre/postModify actions) * <br>info: array of values with informational value (e.g. to be used later by pre/postModify actions)
* *
* Calling this method does not require the existence of an enclosing {@link accountContainer}. * Calling this method does not require the existence of an enclosing {@link accountContainer}.
* *
* @param string $fields input fields * @param string $fields input fields

View File

@ -51,7 +51,7 @@ class authorizedServiceObject extends baseModule {
/** /**
* Returns true if this module can manage accounts of the current type, otherwise false. * Returns true if this module can manage accounts of the current type, otherwise false.
* *
* @return boolean true if module fits * @return boolean true if module fits
*/ */
public function can_manage() { public function can_manage() {
@ -98,7 +98,7 @@ class authorizedServiceObject extends baseModule {
$configContainer = new htmlTable(); $configContainer = new htmlTable();
$configContainer->addElement(new htmlTableExtendedInputTextarea('authorizedServiceObject_services', "sshd\r\nimap", 30, 5, _('Predefined services'), 'predefinedServices')); $configContainer->addElement(new htmlTableExtendedInputTextarea('authorizedServiceObject_services', "sshd\r\nimap", 30, 5, _('Predefined services'), 'predefinedServices'));
$return['config_options']['all'] = $configContainer; $return['config_options']['all'] = $configContainer;
// upload fields // upload fields
$return['upload_columns'] = array( $return['upload_columns'] = array(
array( array(
'name' => 'authorizedService', 'name' => 'authorizedService',
@ -152,7 +152,7 @@ class authorizedServiceObject extends baseModule {
/** /**
* Returns the HTML meta data for the main account page. * Returns the HTML meta data for the main account page.
* *
* @return htmlElement HTML meta data * @return htmlElement HTML meta data
*/ */
function display_html_attributes() { function display_html_attributes() {
@ -175,7 +175,7 @@ class authorizedServiceObject extends baseModule {
$return->addElement(new htmlAccountPageButton('authorizedServiceObject', 'attributes', 'addObjectClass', _('Add Authorized Service extension'))); $return->addElement(new htmlAccountPageButton('authorizedServiceObject', 'attributes', 'addObjectClass', _('Add Authorized Service extension')));
} }
return $return; return $return;
} }
@ -215,19 +215,7 @@ class authorizedServiceObject extends baseModule {
// add object class // add object class
if (!in_array("authorizedServiceObject", $partialAccounts[$i]['objectClass'])) $partialAccounts[$i]['objectClass'][] = "authorizedServiceObject"; if (!in_array("authorizedServiceObject", $partialAccounts[$i]['objectClass'])) $partialAccounts[$i]['objectClass'][] = "authorizedServiceObject";
// add ASs // add ASs
if ($rawAccounts[$i][$ids['authorizedService']] != "") { $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'authorizedService', 'authorizedService', 'ascii', $this->messages['authorizedService'][1], $messages, '/,[ ]*/');
$services = explode(', ', $rawAccounts[$i][$ids['authorizedService']]);
for ($m = 0; $m < sizeof($services); $m++) {
if (get_preg($services[$m], 'ascii')) {
$partialAccounts[$i]['authorizedService'][] = $services[$m];
}
else {
$errMsg = $this->messages['authorizedService'][1];
array_push($errMsg, array($i));
$messages[] = $errMsg;
}
}
}
} }
return $messages; return $messages;
} }