mirror of
https://github.com/humhub/humhub.git
synced 2025-01-17 22:28:51 +01:00
Show modules README.md file in admin -> module area
This commit is contained in:
parent
5c83ee389a
commit
3a5bb69a58
@ -187,10 +187,10 @@ class ModuleController extends Controller
|
||||
throw new CHttpException(500, Yii::t('AdminModule.modules', 'Could not find requested module!'));
|
||||
}
|
||||
|
||||
if (Yii::app()->moduleManager->canUninstall($moduleId)) {
|
||||
if (!Yii::app()->moduleManager->canUninstall($moduleId)) {
|
||||
throw new CHttpException(500, Yii::t('AdminModule.modules', 'Could not uninstall module first! Module is protected.'));
|
||||
}
|
||||
|
||||
|
||||
// Remove old module files
|
||||
$module->removeModuleFolder();
|
||||
$this->install($moduleId);
|
||||
@ -231,6 +231,49 @@ class ModuleController extends Controller
|
||||
$this->render('listUpdates', array('modules' => $updates));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns more information about an installed module.
|
||||
*
|
||||
* @throws CHttpException
|
||||
*/
|
||||
public function actionInfo()
|
||||
{
|
||||
|
||||
$moduleId = Yii::app()->request->getQuery('moduleId');
|
||||
$module = Yii::app()->moduleManager->getModule($moduleId);
|
||||
|
||||
if ($module == null) {
|
||||
throw new CHttpException(500, Yii::t('AdminModule.modules', 'Could not find requested module!'));
|
||||
}
|
||||
|
||||
$readmeMd = "";
|
||||
$readmeMdFile = $module->getPath() . DIRECTORY_SEPARATOR . 'README.md';
|
||||
if (file_exists($readmeMdFile)) {
|
||||
$readmeMd = file_get_contents($readmeMdFile);
|
||||
}
|
||||
|
||||
$this->renderPartial('info', array('name' => $module->getName(), 'description' => $module->getDescription(), 'content' => $readmeMd), false, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns informations about a online not installed module
|
||||
*
|
||||
* @throws CHttpException
|
||||
*/
|
||||
public function actionInfoOnline()
|
||||
{
|
||||
|
||||
$moduleId = Yii::app()->request->getQuery('moduleId');
|
||||
|
||||
$moduleInfo = $this->getOnlineModuleInfo($moduleId);
|
||||
|
||||
if (!isset($moduleInfo['latestVersion'])) {
|
||||
throw new CException(Yii::t('AdminModule.modules', "No module version found!"));
|
||||
}
|
||||
|
||||
$this->renderPartial('info', array('name' => $moduleInfo['latestVersion']['name'], 'description' => $moduleInfo['latestVersion']['description'], 'content' => $moduleInfo['latestVersion']['README.md']), false, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Installs latest compatible module version
|
||||
*
|
||||
|
29
protected/modules_core/admin/views/module/info.php
Normal file
29
protected/modules_core/admin/views/module/info.php
Normal file
@ -0,0 +1,29 @@
|
||||
<div class="modal-dialog modal-dialog-small animated fadeIn">
|
||||
<div class="modal-content">
|
||||
|
||||
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title"
|
||||
id="myModalLabel"><?php echo Yii::t('AdminModule.modules', 'More information: %moduleName%', array('%moduleName%' => $name)); ?></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
<?php if ($content != ""): ?>
|
||||
<?php $this->beginWidget('CMarkdown'); ?>
|
||||
<?php echo $content; ?>
|
||||
<?php $this->endWidget(); ?>
|
||||
<?php else: ?>
|
||||
<?php echo $description; ?>
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<?php echo Yii::t('AdminModule.modules', 'This module doesn\'t provide further informations.'); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
@ -40,6 +40,8 @@
|
||||
· <?php echo HHtml::postLink(Yii::t('AdminModule.modules', 'Uninstall'), array('//admin/module/uninstall', 'moduleId' => $moduleId), array('confirm' => Yii::t('AdminModule.modules', 'Are you sure? - All module data will be lost!'))); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
· <?php echo HHtml::link(Yii::t('AdminModule.modules', 'More info'), array('//admin/module/info', 'moduleId' => $moduleId), array('data-target'=>'#globalModal', 'data-toggle'=>'modal')); ?>
|
||||
|
||||
</small></p>
|
||||
|
||||
</div>
|
||||
|
@ -36,7 +36,9 @@
|
||||
<?php else : ?>
|
||||
· <span style="color:red"><?php echo Yii::t('AdminModule.modules', 'No compatible module version found!'); ?></span>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
· <?php echo HHtml::link(Yii::t('AdminModule.modules', 'More info'), array('//admin/module/infoOnline', 'moduleId' => $module['id']), array('data-target'=>'#globalModal', 'data-toggle'=>'modal')); ?>
|
||||
|
||||
</small>
|
||||
</p>
|
||||
</div>
|
||||
|
@ -26,6 +26,7 @@
|
||||
<?php echo Yii::t('AdminModule.modules', 'Installed version:'); ?> <?php echo Yii::app()->moduleManager->getModule($module['id'])->getVersion(); ?>
|
||||
· <?php echo Yii::t('AdminModule.modules', 'Latest compatible Version:'); ?> <?php echo $module['latestCompatibleVersion']; ?>
|
||||
· <?php echo HHtml::postLink(Yii::t('AdminModule.modules', 'Update'), $this->createUrl('update', array('moduleId' => $module['id']))); ?>
|
||||
· <?php echo HHtml::link(Yii::t('AdminModule.modules', 'More info'), array('//admin/module/infoOnline', 'moduleId' => $module['id']), array('data-target'=>'#globalModal', 'data-toggle'=>'modal')); ?>
|
||||
<?php endif; ?>
|
||||
</small>
|
||||
</p>
|
||||
|
Loading…
x
Reference in New Issue
Block a user