show readme of extension

This commit is contained in:
Uwe Steinmann 2022-10-11 18:15:18 +02:00
parent 57151b3b1f
commit 6dade497b6

View File

@ -175,6 +175,24 @@ class SeedDMS_View_ExtensionMgr extends SeedDMS_Theme_Style {
}
} /* }}} */
function readme() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$extdir = $this->params['extdir'];
$extmgr = $this->params['extmgr'];
$extname = $this->params['extname'];
$extconf = $extmgr->getExtensionConfiguration();
if(isset($extconf[$extname])) {
$extconf = $extconf[$extname];
if(file_exists($extdir."/".$extname."/README.md")) {
// echo '<div style="white-space: pre-wrap; font-family: monospace; padding: 0px;">'.file_get_contents($extdir."/".$extname."/README.md")."</div>";
$Parsedown = new Parsedown();
echo $Parsedown->text(file_get_contents($extdir."/".$extname."/README.md"));
}
}
} /* }}} */
function installedList() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
@ -219,6 +237,9 @@ class SeedDMS_View_ExtensionMgr extends SeedDMS_Theme_Style {
echo "</td>";
echo "<td nowrap>";
echo "<div class=\"list-action\">";
if(file_exists($extdir."/".$extname."/README.md")) {
echo $this->getModalBoxLink(array('target'=>'extensionReadme', 'remote'=>'out.ExtensionMgr.php?action=readme&extensionname='.$extname, 'class'=>'', 'title'=>'<i class="fa fa-question"></i>', 'attributes'=>array('title'=>getMLText('show_extension_readme'))));
}
if(!empty($extconf['changelog']) && file_exists($extdir."/".$extname."/".$extconf['changelog'])) {
echo $this->getModalBoxLink(array('target'=>'extensionChangelog', 'remote'=>'out.ExtensionMgr.php?action=changelog&extensionname='.$extname, 'class'=>'', 'title'=>'<i class="fa fa-reorder"></i>', 'attributes'=>array('title'=>getMLText('show_extension_changelog'))));
}
@ -363,6 +384,7 @@ class SeedDMS_View_ExtensionMgr extends SeedDMS_Theme_Style {
$this->rowEnd();
echo $this->getModalBox(array('id'=>'extensionInfo', 'title'=>getMLText('extension_version_list'), 'content'=>'<p>'.getMLText('extension_loading').'</p>', 'buttons'=>array(array('title'=>getMLText('close')))));
echo $this->getModalBox(array('id'=>'extensionChangelog', 'title'=>getMLText('extension_changelog'), 'content'=>'<p>'.getMLText('changelog_loading').'</p>', 'buttons'=>array(array('title'=>getMLText('close')))));
echo $this->getModalBox(array('id'=>'extensionReadme', 'title'=>getMLText('extension_readme'), 'content'=>'<p>'.getMLText('readme_loading').'</p>', 'buttons'=>array(array('title'=>getMLText('close')))));
$this->contentEnd();
$this->htmlEndPage();
} /* }}} */