some css and shit.

This commit is contained in:
nearwood 2014-10-15 17:11:23 -04:00
parent 38897f8052
commit cb3e57d6ea
5 changed files with 86 additions and 25 deletions

28
db.php
View File

@ -9,14 +9,33 @@ function connect()
}
catch(PDOException $e)
{
echo '<div id="dbError">Error connecting to database.</div>'; //$e->getMessage();
echo '<div class="error">Error connecting to database.</div>'; //$e->getMessage();
$db = null; //Redundant.
}
return $db;
}
function addFile($db, $file)
function addFiles($files)
{
$db = connect();
if ($db == null) return null;
foreach ($files as $file)
{
//echo 'Adding ' . $file['tmp_name'];
addFile($file);
}
}
function addFile($file, $db = null)
{
if ($db == null)
{
$db = connect();
if ($db == null) return null;
}
try
{
//TODO Compress?
@ -41,6 +60,9 @@ function addFile($db, $file)
function getMSQ($db, $id)
{
$db = connect();
if ($db == null) return null;
try
{
$st = $db->prepare("SELECT msqs.xml FROM msqs INNER JOIN metadata ON metadata.msq = msqs.id WHERE metadata.id = :id");
@ -56,4 +78,4 @@ function getMSQ($db, $id)
if (!$result) return null;
else return $result['xml'];
}
?>
?>

View File

@ -1,5 +1,5 @@
<div class="footer">
Apache PHP AngularJS
Apache PHP jQuery
</div>
</body>
</html>

View File

@ -12,12 +12,14 @@
</head>
<body>
<div id="navigation"><span><button id="btnUpload">Upload</button></span><span>Stats</span><span>About</span></div>
<div id="upload" style="display:none;">
<form action="index.php" method="post" enctype="multipart/form-data">
<div id="fileDropZone">Drop files here
<input type="file" id="fileSelect" name="files[]" multiple />
</div>
<output id="fileList"></output>
<input type="hidden" name="upload" value="upload" style="display:none;">
</form>
</div>
<span>
<div id="upload" style="display:none;">
<form action="index.php" method="post" enctype="multipart/form-data">
<div id="fileDropZone">Drop files here
<input type="file" id="fileSelect" name="files[]" multiple />
</div>
<output id="fileList"></output>
<input type="hidden" name="upload" value="upload" style="display:none;">
</form>
</span>
</div>

View File

@ -58,15 +58,14 @@ require('header.php');
<div id='content'>
<?php
if (isset($_GET['msq'])) {
$db = connect();
$msq = getMSQ($db, $_GET['msq']);
$msq = getMSQ($_GET['msq']);
parseMSQ($msq);
} else if (isset($_POST['upload']) && isset($_FILES)) {
//var_dump($_POST);
//var_dump($_FILES);
?>
<div class="info">Upload successful</div>
</div>
<?php
$files = checkUploads(fixFileArray($_FILES['files']));
if (count($files) == 0)
@ -77,15 +76,11 @@ if (count($files) == 0)
else
{
//parse the files
echo count($files) . " files made it";
$db = connect();
foreach ($files as $file)
{
//echo 'Adding ' . $file['tmp_name'];
addFile($db, $file);
}
echo '<div class="info">' . count($files) . ' files were uploaded.</div>';
addFiles($files);
}
}
?>
<?php require('footer.php'); ?>
</div>
<?php require('footer.php'); ?>

View File

@ -1,3 +1,45 @@
* {
font-family: "Verdana", sans-serif;
}
div.error {
color: red;
}
div.warning {
color: yellow;
}
div.info {
color: green;
}
div.debug {
color: dark-gray;
}
div#navigation {
background: #333;
color: white;
padding: 8px 24px 8px 24px;
}
div#navigation span {
font-weight: bold;
padding: 0px 8px 0px 8px;
}
div.footer {
font-size: 0.66em;
text-align: right;
color: light-gray;
position: fixed;
bottom: 4px;
right: 8px;
z-index: -999
}
#fileDropZone {
width: 320px;
border: 2px dashed #bbb;
@ -43,4 +85,4 @@ table th+th[scope=col] {
table th[scope=row] {
border-right: 2px solid #333;
}
}