Location: PHPKode > projects > ACollab > admin/file_types_create.php
<?php
/****************************************************************************************/
/* ACollab                                                                              */
/****************************************************************************************/
/* Copyright (c) 2002-2004  Adaptive Technology Resource Centre / University of Toronto */
/*                                                                                      */
/* http://atutor.ca/acollab                                                             */
/*                                                                                      */
/* This program is free software. You may 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 may access the GNU General Public License at:                                    */
/* http://www.opensource.org/licenses/gpl-license.php                                   */
/*                                                                                      */
/* You may contact the Adaptive Technology Resource Centre at                           */
/* Robarts Library, University of Toronto                                               */
/* 130 St. George Street, Toronto, Ontario, Canada M5S 1A5                              */
/* Further contact information is available at http://www.utoronto.ca/atrc/             */
/****************************************************************************************/
/* Programmer:                                                                          */
/* Joel Kronenberg - ATRC                                                               */
/****************************************************************************************/
// $Id: file_types_create.php 235 2004-06-07 19:55:47Z boonhau $

define('AC_INCLUDE_PATH', '../include/');

require(AC_INCLUDE_PATH.'vitals.inc.php');
authenticate(USER_ADMIN);

$_SECTION[0][0] = _AC('administration');
$_SECTION[0][1] = 'admin/';
$_SECTION[1][0] = _AC('file_types');
$_SECTION[1][1] = 'admin/file_types.php';
$_SECTION[2][0] = _AC('create_file_type');
$_SECTION[2][1] = 'admin/file_types_create.php';

if (isset($_POST['cancel'])) {
	header('Location: file_types.php');
	exit;
}
if (isset($_POST['submit'])) {
	$_POST['extension'] = trim($_POST['extension']);
	$_POST['description'] = trim($_POST['description']);

	if ($_POST['extension'] == '') {
		//$error[] = E_JURIS_EMPTY_title;
	}

	if ($_POST['description'] == '') {
		//$error[] = E_JURIS_EMPTY_FR_TITLE;
	}

	if (!isset($error)) {
		$sql	= "INSERT INTO ".TABLE_PREFIX."file_types VALUES (0, '$_POST[title]')";
		if (mysql_query($sql, $db)) {
			header('Location: file_types.php?f='.F_JURIS_CREATED);
			exit;
		} else {
			$error[] = E_JURIS_CREATE;
		}

	}
}

require(AC_INCLUDE_PATH.'admin/header.inc.php');
?>
<?php
	if (isset($error)) {
		print_errors($error);
	}
?>
<br />
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
	<table border="0" cellspacing="0" cellpadding="2" align="center" class="box2">
	<tr>
		<th colspan="5" class="box"><h3><?php echo _AC('create_file_type'); ?></h3></th>
	</tr>
	<tr>
		<td class="row1">&nbsp;</td>
		<td colspan="3" class="row1"><img src="images/clr.gif" height="1" width="1" alt="" /><br /><?php
			echo _AC('denotes_required', '<img src="images/required.gif" height="14" width="14" alt="'._AC('required_field').'" />');
		?><br /></td>
		<td class="row1">&nbsp;</td>
	</tr>
	<tr>
		<td class="row1">&nbsp;</td>
		<td class="row1" align="right"><label for="ext"><b><?php echo _AC('extension'); ?>:</b></label></td>
		<td class="row1"><img src="images/required.gif" height="14" width="14" alt="<?php echo _AC('required_field'); ?>" /></td>
		<td class="row1"><input type="text" name="extension" class="input" size="4" maxlength="5" id="ext" value="<?php echo $_POST['ext']; ?>" onfocus="this.className='input highlight'" onblur="this.className='input'" /> (Example: doc, pdf, xls)</td>
		<td class="row1">&nbsp;</td>
	</tr>
	<tr>
		<td class="row1">&nbsp;</td>
		<td class="row1" align="right"><label for="mime_type"><b><?php echo _AC('mime_type'); ?>:</b></label></td>
		<td class="row1"><img src="images/required.gif" height="14" width="14" alt="<?php echo _AC('required_field'); ?>" /></td>
		<td class="row1"><input type="text" name="mime_type" class="input" size="40" maxlength="100" id="mime_type" value="<?php echo $_POST['mime_type']; ?>" onfocus="this.className='input highlight'" onblur="this.className='input'" /></td>
		<td class="row1">&nbsp;</td>
	</tr>
	<tr>
		<td class="row1">&nbsp;</td>
		<td class="row1" align="right"><label for="description"><b><?php echo _AC('description'); ?>:</b></label></td>
		<td class="row1"><img src="images/required.gif" height="14" width="14" alt="<?php echo _AC('required_field'); ?>" /></td>
		<td class="row1"><input type="text" name="description" class="input" size="40" maxlength="100" id="description" value="<?php echo $_POST['description']; ?>" onfocus="this.className='input highlight'" onblur="this.className='input'" /></td>
		<td class="row1">&nbsp;</td>
	</tr>
	<tr>
		<td class="row1">&nbsp;</td>
		<td class="row1" colspan="3" align="right"><br /><input type="submit" name="submit" value="<?php echo _AC('create'); ?>" class="submitY" onfocus="this.className='submitY highlight'" onblur="this.className='submitY'" /> &nbsp; <input type="submit" name="cancel" value="<?php echo _AC('cancel'); ?>" class="submitN" onfocus="this.className='submitN highlight'" onblur="this.className='submitN'" /><br /><br /></td>
		<td class="row1">&nbsp;</td>
	</tr>
	</table>
</form>

<?php
require(AC_INCLUDE_PATH.'admin/footer.inc.php');
?>
Return current item: ACollab