| 1 |
<?php
|
| 2 |
global $base_url;
|
| 3 |
?>
|
| 4 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
| 5 |
<html>
|
| 6 |
<head>
|
| 7 |
<title>Disknode - <?= $title ?></title>
|
| 8 |
<style type="text/css">
|
| 9 |
<?php readfile(dirname(__FILE__).'/disknode.style.css'); ?>
|
| 10 |
</style>
|
| 11 |
<script type="text/javascript">
|
| 12 |
function selectPath(selection) {
|
| 13 |
elm = window.opener.document.getElementById('edit-filepath');
|
| 14 |
if (elm) {
|
| 15 |
elm.value = selection;
|
| 16 |
elm = document.getElementById('remainOpen');
|
| 17 |
if (elm && elm.checked) return;
|
| 18 |
window.close();
|
| 19 |
return;
|
| 20 |
}
|
| 21 |
alert('Unable to set selection');
|
| 22 |
}
|
| 23 |
|
| 24 |
function setCookie(name, value)
|
| 25 |
{
|
| 26 |
document.cookie = name+'='+escape(value);
|
| 27 |
}
|
| 28 |
</script>
|
| 29 |
<base href="<?= $base_url ?>/" />
|
| 30 |
</head>
|
| 31 |
<body>
|
| 32 |
<h1><?= $title ?></h1>
|
| 33 |
<h2><?php
|
| 34 |
$relpath = "";
|
| 35 |
if (!empty($subdir)) $_r = "/".$subdir; else $_r = "";
|
| 36 |
foreach (explode("/", $_r) as $elm)
|
| 37 |
{
|
| 38 |
if (empty($elm)) $title = "root";
|
| 39 |
else $title = $elm;
|
| 40 |
if (!empty($relpath)) $relpath .= "/";
|
| 41 |
$relpath .= $elm;
|
| 42 |
if (strcmp($relpath, variable_get('disknode_base', '')) < 0) echo $title;
|
| 43 |
else echo "<a href=\"".url("disknode/browse", "subdir=".$relpath)."\">".$title."</a>";
|
| 44 |
echo " / ";
|
| 45 |
}
|
| 46 |
?></h2>
|
| 47 |
|
| 48 |
<?php
|
| 49 |
|
| 50 |
if (!is_writable(file_create_path($subdir))) $dirmodlink = array("class" => "disabled", "title" => "Directory is not writeable");
|
| 51 |
else $dirmodlink = null;
|
| 52 |
|
| 53 |
echo theme_status_messages();
|
| 54 |
?>
|
| 55 |
<ul>
|
| 56 |
<?php
|
| 57 |
|
| 58 |
if ($subdir != variable_get('disknode_base', '')) echo "<li><a href=\"".url("disknode/browse", "subdir=".dirname($subdir))."\">..</a></li>";
|
| 59 |
|
| 60 |
foreach ($entries as $entry)
|
| 61 |
{
|
| 62 |
if ($entry->isdir)
|
| 63 |
{
|
| 64 |
echo "<li title=\"Browse directory\"><a href=\"".url("disknode/browse", "subdir=".$entry->filename)."\">$entry->basename</a></li>\n";
|
| 65 |
}
|
| 66 |
else {
|
| 67 |
echo "<li><span onclick=\"selectPath('".addslashes($entry->filename)."')\" ".($entry->dbentry?"class=\"exists\" title=\"This file is already assigned to a node\"":"title=\"Select this file\"").">".$entry->basename."</span>
|
| 68 |
<span class=\"filecontrols\">".l("info", "disknode/info", null, "target=".$entry->filename)."</span>
|
| 69 |
</li>\n";
|
| 70 |
}
|
| 71 |
}
|
| 72 |
|
| 73 |
?>
|
| 74 |
</ul>
|
| 75 |
|
| 76 |
<div id="controls">
|
| 77 |
<span title="When checked the window will not be closed when an item is selected."><input type="checkbox" id="remainOpen" onclick="setCookie('remainOpen', this.checked);" <?= $_COOKIE["remainOpen"]=="true"?"checked=\"checked\"":"" ?> /><label for="remainOpen">Remain open</label></span>
|
| 78 |
|
|
| 79 |
<span title="Upload a file to this directory"><?= l("Upload", "disknode/upload", $dirmodlink, "subdir=".$subdir) ?></span>
|
| 80 |
|
|
| 81 |
<span title="Create a new subdirectory"><?= l("Create dir", "disknode/mkdir", $dirmodlink, "subdir=".$subdir) ?></span>
|
| 82 |
</div>
|
| 83 |
</body>
|
| 84 |
</html>
|