LDAPAccountManager/lam/templates/pdfedit/pdfmain.php

161 lines
4.6 KiB
PHP
Raw Normal View History

<?php
/*
$Id$
This code is part of LDAP Account Manager (http://www.sourceforge.net/projects/lam)
2007-12-30 13:15:39 +00:00
Copyright (C) 2003 - 2006 Michael D<EFBFBD>rgner
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* This is the main window of the pdf structure editor.
*
2007-12-30 13:15:39 +00:00
* @author Michael D<EFBFBD>rgner
* @package PDF
*/
2006-03-26 17:51:25 +00:00
/** security functions */
include_once("../../lib/security.inc");
/** access to PDF configuration files */
include_once("../../lib/pdfstruct.inc");
/** LDAP object */
include_once("../../lib/ldap.inc");
/** for language settings */
include_once("../../lib/config.inc");
/** module functions */
include_once("../../lib/modules.inc");
// start session
2006-03-26 17:51:25 +00:00
startSecureSession();
2007-12-30 13:15:39 +00:00
// die if no write access
if (!checkIfWriteAccessIsAllowed()) die();
setlanguage();
// Unset pdf structure definitions in session if set
if(isset($_SESSION['currentPDFStructure'])) {
session_unregister('currentPDFStructure');
session_unregister('availablePDFFields');
session_unregister('currentPageDefinitions');
2004-09-08 14:40:25 +00:00
unset($_SESSION['currentPDFStructure']);
unset($_SESSION['availablePDFFields']);
unset($_SESSION['currentPageDefinitions']);
}
// check if user is logged in, if not go to login
if (!$_SESSION['ldap'] || !$_SESSION['ldap']->server()) {
metaRefresh("../login.php");
exit;
}
// check if user has pressed submit or abort button
if ($_POST['forward'] == "yes") {
// on abort go back to main page
if ($_POST['abort']) {
2006-01-06 10:49:06 +00:00
metaRefresh("../tools.php");
}
// on submit forward to other pdf structure pages
else if($_POST['submit']) {
if($_POST['pdf'] == 'new') {
metaRefresh('pdfpage.php?type=' . $_POST['scope']);
}
else if($_POST['pdf'] == 'edit') {
$edit = split(':',$_POST['edit']);
metaRefresh('pdfpage.php?type=' . $edit[0] . '&edit=' . $edit[1]);
}
else if($_POST['pdf'] == 'delete') {
$delete = split(':',$_POST['delete']);
metaRefresh('pdfdelete.php?type=' . $delete[0] . '&delete=' . $delete[1]);
}
}
exit;
}
2006-01-01 16:30:05 +00:00
$scopes = $_SESSION['config']->get_ActiveTypes();
$availableStructureDefinitions = '';
$availableScopes = '';
foreach($scopes as $scope) {
$pdfStructDefs = getPDFStructureDefinitions($scope);
2006-02-05 18:06:49 +00:00
$availableScopes .= '<option value="' . $scope . '">' . getTypeAlias($scope) . "</option>\n";
foreach($pdfStructDefs as $pdfStructureDefinition) {
2006-02-05 18:06:49 +00:00
$availableStructureDefinitions .= '<option value="' . $scope . ':' . $pdfStructureDefinition . '">' . getTypeAlias($scope) . ' - ' . $pdfStructureDefinition . "</option>\n";
}
}
echo $_SESSION['header'];
?>
<title>LDAP Account Manager</title>
<link rel="stylesheet" type="text/css" href="../../style/layout.css">
2006-02-05 18:06:49 +00:00
<link rel="stylesheet" type="text/css" href="../../style/type_user.css">
</head>
<body>
2007-12-31 13:13:37 +00:00
<br>
<form action="pdfmain.php" method="post">
<!-- pdf structure options -->
2006-02-05 18:06:49 +00:00
<fieldset class="useredit">
<legend>
<b><?php echo _("PDF structures"); ?></b>
</legend>
<table border=0>
<!-- new pdf structure -->
<tr>
<td>
<input type="radio" name="pdf" value="new" checked="checked">
</td>
2006-02-05 18:06:49 +00:00
<td><?php echo _("Create a new PDF structure for scope: "); ?><select name="scope" size="1"><?php echo $availableScopes; ?></select></td>
</tr>
<!-- edit pdf structure -->
<tr>
<td>
<input type="radio" name="pdf" value="edit">
</td>
<td>
<select name="edit" size=1>
<?php echo $availableStructureDefinitions; ?>
</select>
2006-02-05 18:06:49 +00:00
<?php echo _("Edit PDF structure"); ?></td>
</tr>
<!-- delete pdf structure -->
<tr>
<td>
<input type="radio" name="pdf" value="delete">
</td>
<td>
<select name="delete" size=1>
<?php echo $availableStructureDefinitions; ?>
</select>
2006-02-05 18:06:49 +00:00
<?php echo _("Delete PDF structure"); ?></td>
</tr>
</table>
</fieldset>
2007-12-31 13:13:37 +00:00
<br>
<!-- forward is used to check if buttons were pressed -->
<p>
<input type="hidden" name="forward" value="yes">
2006-03-04 10:49:55 +00:00
<input type="submit" name="submit" value="<?php echo _("Ok"); ?>">
<input type="submit" name="abort" value="<?php echo _("Cancel"); ?>">
</p>
</form>
</body>
</html>