8
0

allow parent directory, add version selector in home page

Dieser Commit ist enthalten in:
Daniel Seifert 2018-07-10 21:57:31 +02:00
Ursprung 416681f8bd
Commit e56a30650c
2 geänderte Dateien mit 41 neuen und 7 gelöschten Zeilen

Datei anzeigen

@ -21,6 +21,40 @@
<?= ($params['author'])? '<div>' . $this->translate("author") . ': ' . $params['author'] . '</div>' : '' ?>
<?= ($params['moduledate'])? '<div>' . $this->translate("moduledate") . ': ' . $params['moduledate'] . '</div>' : '' ?>
<?= ($params['moduleversion'])? '<div>' . $this->translate("version") . ': ' . $params['moduleversion'] . '</div>' : '' ?>
<?php
if ($params['versionselector']) {
echo "<div>";
echo $this->translate("selectversion").': ';
$code = '
<select onchange="window.location.href=this.options[this.selectedIndex].value" size="1">
<?php
$versionpath = implode("/", array_slice(explode("/", $_SERVER[\'SCRIPT_NAME\']), '. $params['versiondirectoryindex'] .'));
$modulepath = implode("/", array_slice(explode("/", $_SERVER[\'SCRIPT_NAME\']), 0, '. $params['versiondirectoryindex'] .'));
$path = str_replace($versionpath, "", $_SERVER[\'SCRIPT_FILENAME\']);
$paths = explode(\'/\', $versionpath);
$currpath = $paths[0];
$dirs = array_filter(glob($path . \'/*\'), \'is_dir\');
arsort($dirs);
foreach ($dirs as $dir) {
$dir = str_replace($path.\'/\', \'\', $dir);
$selected = ($dir === $currpath) ? \'selected="selected"\' : "";
echo \'<option value="\'. $modulepath .\'/\'. $dir .\'" \'. $selected .\'>\'. $dir .\'</option>\';
}
?>
';
echo $code;
echo "</select>";
echo "</div>";
}
?>
<?= ($params['editors'])? '<div>' . $this->translate("editors") . ': ' . $params['editors'] . '</div>' : '' ?>
</div>
</div>

Datei anzeigen

@ -33,18 +33,19 @@
<select onchange="window.location.href=this.options[this.selectedIndex].value" size="1">
<?php
$path = str_replace($_SERVER[\'SCRIPT_NAME\'], "", $_SERVER[\'SCRIPT_FILENAME\']);
$paths = explode(\'/\', $_SERVER[\'SCRIPT_NAME\']);
$currpath = $paths[1];
$versionpath = implode("/", array_slice(explode("/", $_SERVER[\'SCRIPT_NAME\']), '. $params['versiondirectoryindex'] .'));
$modulepath = implode("/", array_slice(explode("/", $_SERVER[\'SCRIPT_NAME\']), 0, '. $params['versiondirectoryindex'] .'));
$path = str_replace($versionpath, "", $_SERVER[\'SCRIPT_FILENAME\']);
$paths = explode(\'/\', $versionpath);
$currpath = $paths[0];
$dirs = array_filter(glob($path . \'/*\'), \'is_dir\');
arsort($dirs);
foreach ($dirs as $dir) {
$dir = str_replace($path.\'/\', \'\', $dir);
$selected = ($dir === $currpath) ? \'selected="selected"\' : "";
echo \'<option value="/\'. $dir .\'" \'. $selected .\'>\'. $dir .\'</option>\';
echo \'<option value="\'. $modulepath .\'/\'. $dir .\'" \'. $selected .\'>\'. $dir .\'</option>\';
}
?>
';
@ -113,4 +114,3 @@
</div>
</div>
</div>