<?php $resourceID = $_GET['resourceID']; if (isset($_GET['attachmentID'])) { $attachmentID = $_GET['attachmentID']; } else { $attachmentID = ''; } $attachment = new Attachment(new NamedArguments(array('primaryKey' => $attachmentID))); //get all attachment types for output in drop down $attachmentTypeArray = array(); $attachmentTypeObj = new AttachmentType(); $attachmentTypeArray = $attachmentTypeObj->allAsArray(); ?> <div id='div_attachmentForm'> <form id='attachmentForm'> <input type='hidden' name='editResourceID' id='editResourceID' value='<?php echo $resourceID; ?> '> <input type='hidden' name='editAttachmentID' id='editAttachmentID' value='<?php echo $attachmentID; ?> '> <div class='formTitle' style='width:345px;'><span class='headerText' style='margin-left:7px;'><?php if ($attachmentID) { echo "Edit Attachment"; } else { echo "Add Attachment"; }
require_once "maintenance-page.php"; require_once "AttachmentType.class"; // Since there is no unique ID for this table other than the short name // we need to do some further mucking around. if (isset($_GET['type_code'])) { $old_type_code = clean_type_code($_GET['type_code']); $type_code = $old_type_code; } if (isset($_POST['type_code'])) { $new_type_code = clean_type_code($_POST['type_code']); $type_code = $new_type_code; } $att = new AttachmentType($old_type_code); if (!$session->just_logged_in && $att->AllowedTo("update") && isset($_POST['submit'])) { if ($att->Validate()) { $att->Write(); $att = new AttachmentType($new_type_code); } } if ($att->new_record) { unset($type_code); $edit = 1; $title = "New Attachment Type"; } else { $title = "{$att->type_code} - {$att->type_desc}"; } $show = 0; require_once "top-menu-bar.php"; require_once "page-header.php"; echo $att->Render(); include "page-footer.php";