diff --git a/lam/templates/pdfedit/pdfmain.php b/lam/templates/pdfedit/pdfmain.php index b8babad0..421eaf35 100644 --- a/lam/templates/pdfedit/pdfmain.php +++ b/lam/templates/pdfedit/pdfmain.php @@ -141,7 +141,6 @@ if (!empty($_POST['import'])) { $errMessage = importStructures($_POST['typeId'], $options, $serverProfiles, $typeManager); } if ($errMessage !== null) { - $errMessage->colspan = 10; $container->add($errMessage, 12); } } @@ -166,7 +165,6 @@ if (!empty($_POST['export'])) { $errMessage = exportStructures($typeId, $name, $options, $serverProfiles, $typeManager); } if ($errMessage !== null) { - $errMessage->colspan = 10; $container->add($errMessage, 12); } } @@ -226,7 +224,6 @@ include '../../lib/adminHeader.inc'; $container->add(new htmlSubTitle(_('Create a new PDF structure')), 12); $newProfileSelect = new htmlSelect('typeId', $availableTypes); $newProfileSelect->setHasDescriptiveElements(true); - $newProfileSelect->setWidth('15em'); $container->addLabel($newProfileSelect); $container->addField(new htmlButton('createNewTemplate', _('Create'))); $container->addVerticalSpacer('2rem'); @@ -241,7 +238,6 @@ include '../../lib/adminHeader.inc'; $labelGroup->addElement(new htmlOutputText($templateClass['title'])); $container->add($labelGroup, 12, 4); $select = new htmlSelect('template_' . $templateClass['typeId'], $templateClass['templates']); - $select->setWidth('15em'); $container->add($select, 12, 4); $buttonGroup = new htmlGroup(); $exEditButton = new htmlButton('editTemplate_' . $templateClass['typeId'], 'edit.png', true); @@ -333,7 +329,6 @@ include '../../lib/adminHeader.inc'; $select->setMultiSelect(true); $select->setHasDescriptiveElements(true); $select->setContainsOptgroups(true); - $select->setWidth('290px'); $containerStructures->add($select, 11); $containerStructures->add(new htmlHelpLink('408'), 1); diff --git a/lam/templates/profedit/profilemain.php b/lam/templates/profedit/profilemain.php index 595b7208..0b661806 100644 --- a/lam/templates/profedit/profilemain.php +++ b/lam/templates/profedit/profilemain.php @@ -1,6 +1,5 @@ getConfiguredTypes(); + +$container = new htmlResponsiveRow(); +$container->add(new htmlTitle(_("Profile editor")), 12); + +if (isset($_POST['deleteProfile']) && ($_POST['deleteProfile'] == 'true')) { + $type = $typeManager->getConfiguredType($_POST['profileDeleteType']); + if ($type->isHidden()) { + logNewMessage(LOG_ERR, 'User tried to delete hidden account type profile: ' . $_POST['profileDeleteType']); + die(); + } + // delete profile + if (\LAM\PROFILES\delAccountProfile($_POST['profileDeleteName'], $_POST['profileDeleteType'])) { + $message = new htmlStatusMessage('INFO', _('Deleted profile.'), $type->getAlias() . ': ' . htmlspecialchars($_POST['profileDeleteName'])); + $container->add($message, 12); + } + else { + $message = new htmlStatusMessage('ERROR', _('Unable to delete profile!'), $type->getAlias() . ': ' . htmlspecialchars($_POST['profileDeleteName'])); + $container->add($message, 12); + } +} + +$configProfiles = getConfigProfiles(); +$serverProfiles = array(); +foreach ($configProfiles as $profileName) { + $serverProfiles[$profileName] = new \LAMConfig($profileName); +} + +// import profiles +if (!empty($_POST['import'])) { + $cfg = new LAMCfgMain(); + // check master password + $errMessage = null; + if (!$cfg->checkPassword($_POST['passwd_i_' . $_POST['typeId']])) { + $errMessage = new htmlStatusMessage('ERROR', _('Master password is wrong!')); + } + elseif (!empty($_POST['importProfiles'])) { + $options = array(); + foreach ($_POST['importProfiles'] as $importProfiles) { + $parts = explode('##', $importProfiles); + $options[] = array('conf' => $parts[0], 'typeId' => $parts[1], 'name' => $parts[2]); + } + $errMessage = importProfiles($_POST['typeId'], $options, $serverProfiles, $typeManager); + } + if ($errMessage !== null) { + $container->add($errMessage, 12); + } +} +// export profiles +if (!empty($_POST['export'])) { + $cfg = new LAMCfgMain(); + // check master password + $errMessage = null; + if (!$cfg->checkPassword($_POST['passwd_e_' . $_POST['typeId']])) { + $errMessage = new htmlStatusMessage('ERROR', _('Master password is wrong!')); + } + elseif (!empty($_POST['exportProfiles'])) { + $options = array(); + foreach ($_POST['exportProfiles'] as $importProfiles) { + $parts = explode('##', $importProfiles); + $options[] = array('conf' => $parts[0], 'typeId' => $parts[1]); + } + $typeId = $_POST['typeId']; + $name = $_POST['name_' . $typeId]; + $errMessage = exportProfiles($typeId, $name, $options, $serverProfiles, $typeManager); + } + if ($errMessage !== null) { + $container->add($errMessage, 12); + } +} + $profileClasses = array(); $profileClassesTemp = array(); foreach ($types as $type) { @@ -112,147 +182,67 @@ foreach ($profileClasses as $profileClass) { } } -include '../main_header.php'; +include '../../lib/adminHeader.inc'; echo "