| 
									
										
										
										
											2004-05-30 13:43:42 +00:00
										 |  |  |  | <?php | 
					
						
							|  |  |  |  | /* | 
					
						
							|  |  |  |  | $Id$ | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   This code is part of LDAP Account Manager (http://www.sourceforge.net/projects/lam) | 
					
						
							| 
									
										
										
										
											2004-05-31 12:19:42 +00:00
										 |  |  |  |   Copyright (C) 2003  Michael D<EFBFBD>rgner | 
					
						
							| 
									
										
										
										
											2004-05-30 13:43:42 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |   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. | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | */ | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | include_once("../../lib/pdfstruct.inc"); | 
					
						
							|  |  |  |  | include_once("../../lib/ldap.inc"); | 
					
						
							|  |  |  |  | include_once("../../lib/config.inc"); | 
					
						
							| 
									
										
										
										
											2004-07-16 06:33:37 +00:00
										 |  |  |  | include_once("../../lib/modules.inc"); | 
					
						
							| 
									
										
										
										
											2004-05-30 13:43:42 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | // start session
 | 
					
						
							|  |  |  |  | session_save_path("../../sess"); | 
					
						
							|  |  |  |  | @session_start(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | setlanguage(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-06-03 14:26:48 +00:00
										 |  |  |  | // Unset pdf structure definitions in session if set
 | 
					
						
							|  |  |  |  | if(isset($_SESSION['currentPDFStructure'])) { | 
					
						
							|  |  |  |  | 	session_unregister('currentPDFStructure'); | 
					
						
							|  |  |  |  | 	session_unregister('availablePDFFields'); | 
					
						
							| 
									
										
										
										
											2004-08-03 19:07:31 +00:00
										 |  |  |  | 	session_unregister('currentPageDefinitions'); | 
					
						
							| 
									
										
										
										
											2004-09-08 14:40:25 +00:00
										 |  |  |  | 	unset($_SESSION['currentPDFStructure']); | 
					
						
							|  |  |  |  | 	unset($_SESSION['availablePDFFields']); | 
					
						
							|  |  |  |  | 	unset($_SESSION['currentPageDefinitions']); | 
					
						
							| 
									
										
										
										
											2004-06-03 14:26:48 +00:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-05-30 13:43:42 +00:00
										 |  |  |  | // 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']) { | 
					
						
							|  |  |  |  | 		metaRefresh("../lists/listusers.php"); | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 	// on submit forward to other pdf structure pages
 | 
					
						
							|  |  |  |  | 	else if($_POST['submit']) { | 
					
						
							| 
									
										
										
										
											2004-07-16 06:33:37 +00:00
										 |  |  |  | 		if($_POST['pdf'] == 'new') { | 
					
						
							|  |  |  |  | 			metaRefresh('pdfpage.php?type=' . $_POST['scope']); | 
					
						
							| 
									
										
										
										
											2004-05-30 13:43:42 +00:00
										 |  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2004-07-16 06:33:37 +00:00
										 |  |  |  | 		else if($_POST['pdf'] == 'edit') { | 
					
						
							|  |  |  |  | 			$edit = split(':',$_POST['edit']); | 
					
						
							|  |  |  |  | 			metaRefresh('pdfpage.php?type=' . $edit[0] . '&edit=' . $edit[1]); | 
					
						
							| 
									
										
										
										
											2004-05-30 13:43:42 +00:00
										 |  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2004-07-16 06:33:37 +00:00
										 |  |  |  | 		else if($_POST['pdf'] == 'delete') { | 
					
						
							|  |  |  |  | 			$delete = split(':',$_POST['delete']); | 
					
						
							|  |  |  |  | 			metaRefresh('pdfdelete.php?type=' . $delete[0] . '&delete=' . $delete[1]); | 
					
						
							| 
									
										
										
										
											2004-05-30 13:43:42 +00:00
										 |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 	exit; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-07-16 06:33:37 +00:00
										 |  |  |  | $scopes = getAvailableScopes(); | 
					
						
							| 
									
										
										
										
											2004-05-30 13:43:42 +00:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-07-16 06:33:37 +00:00
										 |  |  |  | $availableStructureDefinitions = ''; | 
					
						
							|  |  |  |  | $availableScopes = ''; | 
					
						
							| 
									
										
										
										
											2004-05-30 13:43:42 +00:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-07-16 06:33:37 +00:00
										 |  |  |  | foreach($scopes as $scope) { | 
					
						
							|  |  |  |  | 	$pdfStructDefs = getPDFStructureDefinitions($scope); | 
					
						
							|  |  |  |  | 	$availableScopes .= '<option value="' . $scope . '">' . $scope . "</option>\n"; | 
					
						
							|  |  |  |  | 	 | 
					
						
							|  |  |  |  | 	foreach($pdfStructDefs as $pdfStructureDefinition) { | 
					
						
							|  |  |  |  | 		$availableStructureDefinitions .= '<option value="' . $scope . ':' . $pdfStructureDefinition . '.xml">' . $scope . ' - ' . $pdfStructureDefinition . "</option>\n"; | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2004-05-30 13:43:42 +00:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | echo $_SESSION['header']; | 
					
						
							|  |  |  |  | ?>
 | 
					
						
							|  |  |  |  | 		<title>LDAP Account Manager</title> | 
					
						
							|  |  |  |  | 		<link rel="stylesheet" type="text/css" href="../../style/layout.css"> | 
					
						
							|  |  |  |  | 	</head> | 
					
						
							|  |  |  |  | 	<body> | 
					
						
							|  |  |  |  | 		<p></p> | 
					
						
							|  |  |  |  | 		<form action="pdfmain.php" method="post"> | 
					
						
							| 
									
										
										
										
											2004-07-16 06:33:37 +00:00
										 |  |  |  | 		<!-- pdf structure options --> | 
					
						
							| 
									
										
										
										
											2004-05-30 13:43:42 +00:00
										 |  |  |  | 		<fieldset> | 
					
						
							|  |  |  |  | 			<legend> | 
					
						
							| 
									
										
										
										
											2004-07-16 06:33:37 +00:00
										 |  |  |  | 				<b><?php echo _("PDF structures"); ?></b>
 | 
					
						
							| 
									
										
										
										
											2004-05-30 13:43:42 +00:00
										 |  |  |  | 			</legend> | 
					
						
							|  |  |  |  | 			<table border=0> | 
					
						
							| 
									
										
										
										
											2004-07-16 06:33:37 +00:00
										 |  |  |  | 				<!-- new pdf structure --> | 
					
						
							| 
									
										
										
										
											2004-05-30 13:43:42 +00:00
										 |  |  |  | 				<tr> | 
					
						
							|  |  |  |  | 					<td> | 
					
						
							| 
									
										
										
										
											2004-07-16 06:33:37 +00:00
										 |  |  |  | 						<input type="radio" name="pdf" value="new" checked="checked"> | 
					
						
							| 
									
										
										
										
											2004-05-30 13:43:42 +00:00
										 |  |  |  | 					</td> | 
					
						
							| 
									
										
										
										
											2004-07-16 06:33:37 +00:00
										 |  |  |  | 					<td colspan=2><?php echo _("Create a new PDF structure for scope: "); ?><select name="scope" size="1"><?php echo $availableScopes; ?></select></td>
 | 
					
						
							| 
									
										
										
										
											2004-05-30 13:43:42 +00:00
										 |  |  |  | 				</tr> | 
					
						
							| 
									
										
										
										
											2004-07-16 06:33:37 +00:00
										 |  |  |  | 				<!-- edit pdf structure --> | 
					
						
							| 
									
										
										
										
											2004-05-30 13:43:42 +00:00
										 |  |  |  | 				<tr> | 
					
						
							|  |  |  |  | 					<td> | 
					
						
							| 
									
										
										
										
											2004-07-16 06:33:37 +00:00
										 |  |  |  | 						<input type="radio" name="pdf" value="edit"> | 
					
						
							| 
									
										
										
										
											2004-05-30 13:43:42 +00:00
										 |  |  |  | 					</td> | 
					
						
							|  |  |  |  | 					<td> | 
					
						
							| 
									
										
										
										
											2004-07-16 06:33:37 +00:00
										 |  |  |  | 						<select name="edit" size=1> | 
					
						
							|  |  |  |  | 							<?php echo $availableStructureDefinitions; ?>
 | 
					
						
							| 
									
										
										
										
											2004-05-30 13:43:42 +00:00
										 |  |  |  | 						</select> | 
					
						
							|  |  |  |  | 					</td> | 
					
						
							| 
									
										
										
										
											2004-07-16 06:33:37 +00:00
										 |  |  |  | 					<td><?php echo _("Edit PDF structure"); ?></td>
 | 
					
						
							| 
									
										
										
										
											2004-05-30 13:43:42 +00:00
										 |  |  |  | 				</tr> | 
					
						
							| 
									
										
										
										
											2004-07-16 06:33:37 +00:00
										 |  |  |  | 				<!-- delete pdf structure --> | 
					
						
							| 
									
										
										
										
											2004-05-30 13:43:42 +00:00
										 |  |  |  | 				<tr> | 
					
						
							|  |  |  |  | 					<td> | 
					
						
							| 
									
										
										
										
											2004-07-16 06:33:37 +00:00
										 |  |  |  | 						<input type="radio" name="pdf" value="delete"> | 
					
						
							| 
									
										
										
										
											2004-05-30 13:43:42 +00:00
										 |  |  |  | 					</td> | 
					
						
							|  |  |  |  | 					<td> | 
					
						
							| 
									
										
										
										
											2004-07-16 06:33:37 +00:00
										 |  |  |  | 						<select name="delete" size=1> | 
					
						
							|  |  |  |  | 							<?php echo $availableStructureDefinitions; ?>
 | 
					
						
							| 
									
										
										
										
											2004-05-30 13:43:42 +00:00
										 |  |  |  | 						</select> | 
					
						
							|  |  |  |  | 					</td> | 
					
						
							| 
									
										
										
										
											2004-07-16 06:33:37 +00:00
										 |  |  |  | 					<td><?php echo _("Delete PDF structure"); ?></td>
 | 
					
						
							| 
									
										
										
										
											2004-05-30 13:43:42 +00:00
										 |  |  |  | 				</tr> | 
					
						
							|  |  |  |  | 			</table> | 
					
						
							|  |  |  |  | 		</fieldset> | 
					
						
							|  |  |  |  | 		<p></p> | 
					
						
							|  |  |  |  | 		 | 
					
						
							|  |  |  |  | 		<!-- forward is used to check if buttons were pressed --> | 
					
						
							|  |  |  |  | 		<p> | 
					
						
							|  |  |  |  | 		<input type="hidden" name="forward" value="yes"> | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		<input type="submit" name="submit" value="<?php echo _("Submit"); ?>"> | 
					
						
							|  |  |  |  | 		<input type="submit" name="abort" value="<?php echo _("Abort"); ?>"> | 
					
						
							|  |  |  |  | 		</p> | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		</form> | 
					
						
							|  |  |  |  | 	</body> | 
					
						
							|  |  |  |  | </html> |