added back button

This commit is contained in:
Roland Gruber 2013-02-10 19:21:56 +00:00
parent 38854bb665
commit fc6263be93
1 changed files with 32 additions and 29 deletions

View File

@ -98,7 +98,9 @@ if (isAccountTypeHidden($scope)) {
die(); die();
} }
echo '<form enctype="multipart/form-data" action="masscreate.php" method="post">';
echo '<div class="' . $scope . '-bright smallPaddingContent">'; echo '<div class="' . $scope . '-bright smallPaddingContent">';
$container = new htmlTable();
$selectedModules = explode(',', $_POST['selectedModules']); $selectedModules = explode(',', $_POST['selectedModules']);
if ($_FILES['inputfile'] && ($_FILES['inputfile']['size'] > 0)) { if ($_FILES['inputfile'] && ($_FILES['inputfile']['size'] > 0)) {
@ -168,8 +170,11 @@ if ($_FILES['inputfile'] && ($_FILES['inputfile']['size'] > 0)) {
// if input data is invalid just display error messages (max 50) // if input data is invalid just display error messages (max 50)
if (sizeof($errors) > 0) { if (sizeof($errors) > 0) {
for ($i = 0; $i < sizeof($errors); $i++) StatusMessage("ERROR", $errors[$i][0], $errors[$i][1]); for ($i = 0; $i < sizeof($errors); $i++) {
massPrintBackButton($scope, $selectedModules); $container->addElement(new htmlStatusMessage("ERROR", $errors[$i][0], $errors[$i][1]), true);
}
$container->addElement(new htmlSpacer(null, '10px'), true);
massPrintBackButton($scope, $selectedModules, $container);
} }
// let modules build accounts // let modules build accounts
@ -193,7 +198,9 @@ if ($_FILES['inputfile'] && ($_FILES['inputfile']['size'] > 0)) {
} }
// print errors if DN could not be built // print errors if DN could not be built
if (sizeof($errors) > 0) { if (sizeof($errors) > 0) {
for ($i = 0; $i < sizeof($errors); $i++) StatusMessage("ERROR", $errors[$i][0], $errors[$i][1], $errors[$i][2]); for ($i = 0; $i < sizeof($errors); $i++) {
$container->addElement(new htmlStatusMessage("ERROR", $errors[$i][0], $errors[$i][1], $errors[$i][2]), true);
}
} }
else { else {
// store accounts in session // store accounts in session
@ -218,34 +225,33 @@ if ($_FILES['inputfile'] && ($_FILES['inputfile']['size'] > 0)) {
$_SESSION['mass_pdf']['structure'] = null; $_SESSION['mass_pdf']['structure'] = null;
} }
// show links for upload and LDIF export // show links for upload and LDIF export
echo "<div class=\"title\">\n"; $container->addElement(new htmlTitle(_("LAM has checked your input and is now ready to create the accounts.")), true);
echo "<h2 class=\"titleText\">" . _("LAM has checked your input and is now ready to create the accounts.") . "</h2>\n"; $container->addElement(new htmlSpacer(null, '10px'), true);
echo "</div>"; $buttonContainer = new htmlTable();
echo "<p>&nbsp;</p>\n"; $buttonContainer->addElement(new htmlLink(_("Upload accounts to LDAP"), 'massDoUpload.php', '../graphics/up.gif', true));
echo "<a id=\"uploadLink\" href=\"massDoUpload.php\">" . _("Upload accounts to LDAP") . "</a>"; $buttonContainer->addElement(new htmlLink(_("Show LDIF file"), 'massBuildAccounts.php?showldif=true', '../graphics/edit.png', true));
echo "&nbsp;&nbsp;&nbsp;&nbsp;"; $buttonContainer->addElement(new htmlSpacer('10px', null));
echo "<a id=\"createLDIFLink\" href=\"massBuildAccounts.php?showldif=true\">" . _("Show LDIF file") . "</a>"; massPrintBackButton($scope, $selectedModules, $buttonContainer);
?> $container->addElement($buttonContainer, true);
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('#uploadLink').button();
jQuery('#createLDIFLink').button();
});
</script>
<?php
} }
} }
else { else {
massPrintBackButton($scope, $selectedModules); $container->addElement(new htmlSpacer(null, '10px'), true);
massPrintBackButton($scope, $selectedModules, $container);
} }
} }
} }
else { else {
StatusMessage('ERROR', _('Please provide a file to upload.')); $container->addElement(new htmlStatusMessage('ERROR', _('Please provide a file to upload.')), true);
massPrintBackButton($scope, $selectedModules); $container->addElement(new htmlSpacer(null, '10px'), true);
massPrintBackButton($scope, $selectedModules, $container);
} }
$tabindex = 1;
parseHtml(null, $container, array(), false, $tabindex, $scope);
echo '</div>'; echo '</div>';
echo '</form>';
include 'main_footer.php'; include 'main_footer.php';
/** /**
@ -253,12 +259,12 @@ include 'main_footer.php';
* *
* @param String $scope account type (e.g. user) * @param String $scope account type (e.g. user)
* @param array $selectedModules selected modules for upload * @param array $selectedModules selected modules for upload
* @param htmlTable $container table container
*/ */
function massPrintBackButton($scope, $selectedModules) { function massPrintBackButton($scope, $selectedModules, &$container) {
echo '<form enctype="multipart/form-data" action="masscreate.php" method="post">'; $backButton = new htmlButton('submit', _('Back'));
$container = new htmlTable(); $backButton->setIconClass('backButton');
$container->addElement(new htmlSpacer(null, '10px'), true); $container->addElement($backButton);
$container->addElement(new htmlButton('submit', _('Back')));
$container->addElement(new htmlHiddenInput('type', $scope)); $container->addElement(new htmlHiddenInput('type', $scope));
$createPDF = 0; $createPDF = 0;
if (isset($_POST['createPDF']) && ($_POST['createPDF'] == 'on')) { if (isset($_POST['createPDF']) && ($_POST['createPDF'] == 'on')) {
@ -269,9 +275,6 @@ function massPrintBackButton($scope, $selectedModules) {
for ($i = 0; $i < sizeof($selectedModules); $i++) { for ($i = 0; $i < sizeof($selectedModules); $i++) {
$container->addElement(new htmlHiddenInput($scope . '_' . $selectedModules[$i], 'on')); $container->addElement(new htmlHiddenInput($scope . '_' . $selectedModules[$i], 'on'));
} }
$tabindex = 1;
parseHtml(null, $container, array(), false, $tabindex, $scope);
echo '</form>';
} }
?> ?>