--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/fhiiqm/test/contract_upload.php Wed Aug 31 14:22:19 2011 +0200
@@ -0,0 +1,142 @@
+<?php
+
+/**
+ * @author B.Schwarzer, Fritz-Haber-Institut
+ * @copyright 05/2011
+ */
+
+ $ok = $_POST["ok"];
+ $okn = $_POST["okn"];
+ $submit = $_POST['submit'];
+ $conid = $_POST["contractid"];
+ $confile = $_POST["confilename"];
+
+ include_once("inc/dbconnect.inc.php");
+ $dbc = new dbconnection();
+
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+
+ <head>
+ <title>Vertragsdokumente</title>
+ <link href="css/db.css" rel="STYLESHEET" type="TEXT/CSS">
+ </head>
+
+ <body name="insert_vd">
+ <!-- content start -->
+ <div align="center">
+ <h3><font face="Verdana, Arial, Helvetica, sans-serif">Upload Vertragsdokument</font></h3>
+ </div>
+<?php
+ if (!$submit || !$ok || !$_FILES["vfile"]["name"])
+ {
+?>
+<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data" name="contract" target="_self">
+<div align="center">
+<h5>Bitte wählen Sie zuerst den Vertragsnamen und den Namen der zugehörigen Datei und drücken den submit Button.</h5>
+ <h5>Dann klicken Sie auf den Durchsuchenbutton, stellen das hochzuladene Vertragsdokument bereit und drücken den submit Button erneut.</h5>
+
+ <h5>Maximale Dokumentgröße: 10 MB.</h5>
+<p>[* - Felder sind erforderlich]</p>
+ <input type="hidden" name="MAX_FILE_SIZE" value="10240000">
+ <table border="1" cellpadding="0" cellspacing="0" bordercolor="#000066" bgcolor="#EEEEEE">
+ <tr><td>
+ <table width="100%" height="100%" border="0" cellspacing="6">
+ <tr>
+ <td>Vertragsbezeichnung *</td>
+ <td valign="top">
+ <select name="contractid" size="1">
+ <?php
+ if ($dbc->_connectionid)
+ {
+ $result=$dbc->queryObjectArray("SELECT contract_ID, contract_name FROM Vertrag ORDER BY contract_name");
+ foreach ($result as $row)
+ {
+ echo "<option value=$row->contract_ID";
+ if ($conid == $row->contract_ID)
+ {
+ echo " selected";
+ $okn = true;
+ }
+ echo ">$row->contract_name</option>\n";
+ }
+ if (!$conid) $okn = false;
+ }
+ ?>
+ </select>
+ </td>
+ </tr>
+ <td>Dateibezeichnung Dokument *</td>
+ <td><input name="confilename" type="text" size="50" maxlength="50" value="<?php echo $confile; ?>">
+ <?php
+ if (isset($confile) && $confile<'!')
+ {
+ echo "<br><span class=\"red\">Dateiname ist erforderlich!</span>\n";
+ $okn = false;
+ }
+ else
+ $okn = true;
+ ?>
+ </td>
+ </tr>
+ <?php
+ if ($okn && $submit)
+ {
+ echo "<tr>
+ <td class=\"red\" valign=\"top\" align=\"left\">Alle Eingaben ok?</td>
+ <td colspan=\"3\" align=\"left\"><input type=\"checkbox\" name=\"ok\" value=\"1\"";
+ if ($ok) echo "checked";
+ echo "></td>\n</tr>\n";
+ echo "<tr>
+ <td>Upload Vertragsdokument: </td>
+ <td><input type=\"file\" name=\"vfile\" size=\"30\"></td>
+ </tr>\n";
+
+ }
+ ?>
+ <tr>
+ <td> </td>
+ <td ><input class="button" type="submit" value="submit" name="submit" title="submit" >
+ <input class="button" type="reset" value="reset" name="reset" title="reset" ></td>
+ </tr>
+ </table>
+ </td></tr>
+ </div>
+</form>
+<?php
+ }
+ else // $submit && $ok
+ {
+//echo "alle Angaben vorhanden<br>\n";
+ if (!$dbc) $dbc = new dbconnection();
+
+ $query = sprintf("UPDATE Vertrag SET contract_file = '%s' WHERE contract_id = %d " ,
+ $dbc->escapestring($conid ."_".$confile),
+ $dbc->escapestring($conid));
+ $result=$dbc->execute($query);
+ if (!$result) echo "query = $query<br>" . $dbc->error ."\n";
+ echo "<div align=\"center\">\n";
+ echo "<table>\n";
+// $scid=1;
+ if ($result)
+ {
+ echo "<tr><th class=\"green\" align=\"left\">Information zum Vertrag '$conid' erfolgreich eingefuegt.</th></tr>\n";
+ // upload und update images
+ include ("inc/ct_upl_upd.inc.php");
+ }
+ else
+ {
+ echo "<tr><th class=\"red\" align=\"left\">Eingabe der Informationen zum Vertrag '$conid' fehlgeschlagen.</th></tr>\n";
+// echo "$query<br>\n";
+ }
+ echo "</table>\n";
+ echo "</div>\n";
+
+
+ }
+?>
+
+</body>
+</html>
\ No newline at end of file