refactoring

This commit is contained in:
Roland Gruber 2017-09-18 19:47:27 +02:00
parent 93e69bfb4c
commit 6ec7fb87f3
6 changed files with 11 additions and 9 deletions

View File

@ -532,10 +532,12 @@ function buildUploadAccounts($type, $data, $ids, $selectedModules) {
} }
} }
if (sizeof($errors) > 0) { if (sizeof($errors) > 0) {
for ($i = 0; (($i < sizeof($errors)) || ($i > 49)); $i++) call_user_func_array("StatusMessage", $errors[$i]); for ($i = 0; (($i < sizeof($errors)) || ($i > 49)); $i++) {
call_user_func_array("StatusMessage", $errors[$i]);
}
return false; return false;
} }
else return $partialAccounts; return $partialAccounts;
} }
/** /**

View File

@ -475,7 +475,7 @@ class courierMailAccount extends baseModule {
'description' => _('Home directory'), 'description' => _('Home directory'),
'help' => 'homeDirectory', 'help' => 'homeDirectory',
'example' => _('/home/smiller'), 'example' => _('/home/smiller'),
'required' => 'true' 'required' => true
); );
} }
return $return; return $return;

View File

@ -248,7 +248,7 @@ By default, the nodes are configured as H-Nodes which fits for small networks. I
'help' => 'subnet', 'help' => 'subnet',
'example' => '192.168.10.0', 'example' => '192.168.10.0',
'required' => true, 'required' => true,
'unique' => 'true' 'unique' => true
), ),
array( array(
'name' => 'dhcp_settings_domainName', 'name' => 'dhcp_settings_domainName',

View File

@ -161,7 +161,7 @@ class eduPerson extends baseModule {
'description' => _('Principal name'), 'description' => _('Principal name'),
'help' => 'eduPersonPrincipalName', 'help' => 'eduPersonPrincipalName',
'example' => _('user@company.com'), 'example' => _('user@company.com'),
'unique' => 'true' 'unique' => true
), ),
array( array(
'name' => 'eduPerson_primaryAffiliation', 'name' => 'eduPerson_primaryAffiliation',

View File

@ -140,7 +140,7 @@ if ($_FILES['inputfile'] && ($_FILES['inputfile']['size'] > 0)) {
$checkcolumns = array(); $checkcolumns = array();
$columns = call_user_func_array('array_merge', $columns); $columns = call_user_func_array('array_merge', $columns);
for ($i = 0; $i < sizeof($columns); $i++) { for ($i = 0; $i < sizeof($columns); $i++) {
if (isset($columns[$i]['required']) && ($columns[$i]['required'] == true)) { if (isset($columns[$i]['required']) && ($columns[$i]['required'] === true)) {
if (isset($ids[$columns[$i]['name']])) $checkcolumns[] = $ids[$columns[$i]['name']]; if (isset($ids[$columns[$i]['name']])) $checkcolumns[] = $ids[$columns[$i]['name']];
else $errors[] = array(_("A required column is missing in your CSV file."), $columns[$i]['name']); else $errors[] = array(_("A required column is missing in your CSV file."), $columns[$i]['name']);
} }
@ -201,7 +201,7 @@ if ($_FILES['inputfile'] && ($_FILES['inputfile']['size'] > 0)) {
// let modules build accounts // let modules build accounts
else { else {
$accounts = buildUploadAccounts($type, $data, $ids, $selectedModules); $accounts = buildUploadAccounts($type, $data, $ids, $selectedModules);
if ($accounts != false) { if ($accounts !== false) {
$rdnList = getRDNAttributes($type->getId(), $selectedModules); $rdnList = getRDNAttributes($type->getId(), $selectedModules);
$suffix = $type->getSuffix(); $suffix = $type->getSuffix();
// set DN // set DN

View File

@ -382,7 +382,7 @@ function showMainPage(\LAM\TYPES\ConfiguredType $type, $selectedModules) {
$columnContainer->addElement(new htmlSpacer(null, '10px'), true); $columnContainer->addElement(new htmlSpacer(null, '10px'), true);
$module = moduleCache::getModule($modules[$m], $scope); $module = moduleCache::getModule($modules[$m], $scope);
$icon = $module->getIcon(); $icon = $module->getIcon();
if (($icon != null) && !(strpos($icon, 'http') === 0) && !(strpos($icon, '/') === 0)) { if (!empty($icon) && !(strpos($icon, 'http') === 0) && !(strpos($icon, '/') === 0)) {
$icon = '../../graphics/' . $icon; $icon = '../../graphics/' . $icon;
} }
$moduleTitle = new htmlSubTitle(getModuleAlias($modules[$m], $scope), $icon); $moduleTitle = new htmlSubTitle(getModuleAlias($modules[$m], $scope), $icon);
@ -413,7 +413,7 @@ function showMainPage(\LAM\TYPES\ConfiguredType $type, $selectedModules) {
$odd = true; $odd = true;
for ($i = 0; $i < sizeof($columns[$modules[$m]]); $i++) { for ($i = 0; $i < sizeof($columns[$modules[$m]]); $i++) {
$required = false; $required = false;
if (isset($columns[$modules[$m]][$i]['required']) && ($columns[$modules[$m]][$i]['required'] == true)) { if (isset($columns[$modules[$m]][$i]['required']) && ($columns[$modules[$m]][$i]['required'] === true)) {
$required = true; $required = true;
} }
$rowCells = array(); $rowCells = array();