<?php
/*
* Created on Aug 29, 2008
* 2.0
*/
?>
<script type="text/javascript">
function checkAll()
{
var fileNames = document.getElementById("theForm");
for (i = 0; i < fileNames.length; i++)
{
fileNames[i].checked = true;
}
}
</script>
<big><b><a href='<?=$URLP->GetExtendedURL()?>p=Admin'>Admin Options:</a> Add Items Already On Server</b></big>
<form id='theForm' action='<?=$URLP->GetExtendedURL()?>p=AddItemsOnServer&path=<?=$path?>' method='post' enctype="multipart/form-data">
<p>
<table>
<tr>
<td colspan='2'><b>Information for all pictures</b></td>
<td>Visibility: <select name='hidden'>
<option value='0'>Public</option>
<option value='1'<?=(1==$this->hidden?' selected':null)?>>Members Only</option>
<option value='2'<?=(2==$this->hidden?' selected':null)?>>Privileged Only</option>
<option value='3'<?=(3==$this->hidden?' selected':null)?>>Admin Only</option>
</select>
</td>
</tr>
<tr>
<td>
Location: <input type="text" class="text" name="loc" id="loc" value="<?=$location?>" size="15" autocomplete="off" />
<span id='locHint' class='autocomplete'"></span>
</td>
<td>
Tags: <input type="text" class="text" name="tags" id="tags" value="<?=$tags?>" size="20" />
<span id='tagsHint' class='autocomplete'"></span>
<script type='text/javascript'>
new Ajax.Autocompleter("loc", "locHint", "ajax/getLocations.php", {frequency: 0.1});
new Ajax.Autocompleter("tags", "tagsHint", "ajax/getTags.php", {frequency: 0.1});
</script>
</td>
<td>Date if not found on picture: <input type="text" class="text" name="date" id="date" value="<?=$date?>" size="8" /></td>
</tr></table>
<input type='button' onClick='checkAll();' value='check all' /> <input type='submit' name='act' value='Add Files'/>
</p>
<table border='0'>
<tr><th colspan='4' align='left'>
<?=$parentPathHtml?>
</th></tr>
<?
if ($path)
echo '<tr><td> </td><td colspan="3"><a href="' . $pathURL . substr($path, 0, strrpos($path, '/', -2)) . '/">..up one level</a></td></tr>';
foreach ($files as $file)
{
if (is_file(PICS_PATH . $path . $file))
{
if ('' != $path)
{
$query = 'SELECT ItemId FROM ' . ITEM_TABLE .
" WHERE ItemPath='$path' AND ItemFilename='$file'" .
" LIMIT 1";
$result = $DB->Query($query);
if (1 == $result->num_rows)
$checkbox = ' ';
else
$checkbox = "<input type='checkbox' name='fileNames[]' value='$file' />";
$s = array (
'B',
'Kb',
'MB',
'GB'
);
$fileSize = filesize(PICS_PATH . $path . $file);
$e = floor(log($fileSize) / log(1024));
$fileSize = round(($fileSize / pow(1024, floor($e))), 1) . ' ' . $s[$e];
$fileDate = date('Y-m-d H:i', filemtime(PICS_PATH . $path . $file));
echo "<tr><td>$checkbox</td><td><a href='" . PICS_URL . "$path$file'>$file</a></td>" .
"<td> $fileSize</td><td>$fileDate</td>" .
"<td>" . (file_exists(PICS_PATH . $path . 't/' . $file) ? '<img src="' . PICS_URL . $path . 't/' . $file . '" height="40" />' : '') .
"</td></tr>";
}
}
else
{
if ('.' == substr($file, 0, 1) or 'r' == $file or 't' == $file or 'index.html' == $file)
echo '';
else
echo "<tr><td> </td><td><a href='$pathURL" . ($path ? $path : '') . "$file/'>$file/</a></td>" .
"<td> </td><td> </td></tr>";
}
}
?>
</table>
<input type='submit' name='act' value='Add Files'/>
</p>
</form>