Add md support for plugins. The readme file must be README.md in order to load the markdown conversion.

pull/2487/head
jmontoyaa 10 years ago
parent c18487259b
commit dfa2039616
  1. 15
      main/admin/settings.lib.php
  2. 28
      main/inc/ajax/plugin.ajax.php
  3. 15
      plugin/vchamilo/README.md

@ -190,6 +190,21 @@ function handle_plugins()
]
);
}
$readmeFile = api_get_path(SYS_PLUGIN_PATH).$plugin.'/README.md';
if (file_exists($readmeFile)) {
echo Display::url(
"<em class='fa fa-file-text-o'></em> README.md",
api_get_path(WEB_AJAX_PATH).'plugin.ajax.php?a=md_to_html&plugin='.$plugin,
[
'class' => 'btn btn-default ajax',
'data-title' => $plugin_info['title'],
'data-size' => 'lg',
'_target' => '_blank'
]
);
}
echo '</div>';
echo '</td></tr>';
}

@ -0,0 +1,28 @@
<?php
/* For licensing terms, see /license.txt */
use \Michelf\MarkdownExtra;
/**
* Responses to AJAX calls
*/
require_once '../global.inc.php';
$action = $_REQUEST['a'];
switch ($action) {
case 'md_to_html':
$plugin = isset($_GET['plugin']) ? $_GET['plugin'] : '';
$appPlugin = new AppPlugin();
$pluginList = $appPlugin->get_installed_plugins();
$html = '';
if (in_array($plugin, $pluginList)) {
$file = api_get_path(SYS_PLUGIN_PATH).$plugin.'/README.md';
if (file_exists($file)) {
$content = file_get_contents($file);
$html = MarkdownExtra::defaultTransform($content);
}
}
echo $html;
break;
}

@ -1,5 +1,5 @@
Virtual Chamilo
##############################
===================
Author : Valery Fremaux (valery.fremaux@gmail.com), Julio Montoya
@ -7,14 +7,14 @@ Virtual chamilo is a feature that allows running several chamilo instances shari
code base.
Version features
##############################
===================
This is a yet prototypal version that is not full featured in back-office tools.
At the moment, the setup of virtual clones still is a technical operation and has no
middle-office GUI. Development is in progress to offer a sufficient medium-level
administrability of the process.
How to setup :
##############################
===================
You need :
@ -52,12 +52,14 @@ as the chamilo instance domain name.
the effective "configuration.php" information.
- an appropriate multiroot home root setup in the local chamilo instance
# Prerequisites for VChamilo working nice
Prerequisites for VChamilo working nice
-------------
Multiple URL access must be enabled :
```
# in <chamiloroot>/main/inc/config/configuration.php
$_configuration['multiple_access_urls'] = true;
```
In the administration, you will need configure an adequate home root definition for the instance finding
the dedicated home directory. You just need editing the http://localhost default host, and give the real domain
@ -65,7 +67,8 @@ name you are using.
Check you have the <chamilo>/home/<instancedomain> clone of the standard home directory.
# Important note about file system permissions
Important note about file system permissions
-------------
Vchamilos will use several side-directories apart from the standard installation (dedicated courses,
dedicated home page). Check you set the adequate filesystem permissions (usually let the server write
Loading…
Cancel
Save