allow parent directory, add version selector in home page
This commit is contained in:
parent
e6a5ab0771
commit
42093faa3a
@ -21,6 +21,40 @@
|
|||||||
<?= ($params['author'])? '<div>' . $this->translate("author") . ': ' . $params['author'] . '</div>' : '' ?>
|
<?= ($params['author'])? '<div>' . $this->translate("author") . ': ' . $params['author'] . '</div>' : '' ?>
|
||||||
<?= ($params['moduledate'])? '<div>' . $this->translate("moduledate") . ': ' . $params['moduledate'] . '</div>' : '' ?>
|
<?= ($params['moduledate'])? '<div>' . $this->translate("moduledate") . ': ' . $params['moduledate'] . '</div>' : '' ?>
|
||||||
<?= ($params['moduleversion'])? '<div>' . $this->translate("version") . ': ' . $params['moduleversion'] . '</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>' : '' ?>
|
<?= ($params['editors'])? '<div>' . $this->translate("editors") . ': ' . $params['editors'] . '</div>' : '' ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -33,10 +33,11 @@
|
|||||||
<select onchange="window.location.href=this.options[this.selectedIndex].value" size="1">
|
<select onchange="window.location.href=this.options[this.selectedIndex].value" size="1">
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$path = str_replace($_SERVER[\'SCRIPT_NAME\'], "", $_SERVER[\'SCRIPT_FILENAME\']);
|
$versionpath = implode("/", array_slice(explode("/", $_SERVER[\'SCRIPT_NAME\']), '. $params['versiondirectoryindex'] .'));
|
||||||
|
$modulepath = implode("/", array_slice(explode("/", $_SERVER[\'SCRIPT_NAME\']), 0, '. $params['versiondirectoryindex'] .'));
|
||||||
$paths = explode(\'/\', $_SERVER[\'SCRIPT_NAME\']);
|
$path = str_replace($versionpath, "", $_SERVER[\'SCRIPT_FILENAME\']);
|
||||||
$currpath = $paths[1];
|
$paths = explode(\'/\', $versionpath);
|
||||||
|
$currpath = $paths[0];
|
||||||
|
|
||||||
$dirs = array_filter(glob($path . \'/*\'), \'is_dir\');
|
$dirs = array_filter(glob($path . \'/*\'), \'is_dir\');
|
||||||
arsort($dirs);
|
arsort($dirs);
|
||||||
@ -44,7 +45,7 @@
|
|||||||
foreach ($dirs as $dir) {
|
foreach ($dirs as $dir) {
|
||||||
$dir = str_replace($path.\'/\', \'\', $dir);
|
$dir = str_replace($path.\'/\', \'\', $dir);
|
||||||
$selected = ($dir === $currpath) ? \'selected="selected"\' : "";
|
$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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user