Plugins - Improve partial plugin interface - refs BT#19044

pull/3996/head
Christian 3 years ago
parent 91e93a6606
commit 415d5e5f6f
  1. 35
      assets/js/app.js
  2. 1
      composer.json
  3. 24
      public/main/admin/settings.lib.php
  4. 6
      public/main/admin/settings.php
  5. 7
      public/main/inc/lib/api.lib.php
  6. 6
      public/main/inc/lib/pear/HTML/QuickForm/checkbox.php
  7. 3
      public/main/inc/lib/pear/HTML/QuickForm/element.php
  8. 6
      public/main/inc/lib/pear/HTML/QuickForm/radio.php
  9. 13
      public/main/inc/lib/pear/HTML/QuickForm/select.php
  10. 7
      public/main/inc/lib/pear/HTML/QuickForm/text.php

@ -162,29 +162,10 @@ $(function () {
self = $(this);
$.when(loadModalContent).done(function (modalContent) {
var modalDialog = $('#global-modal').find('.modal-dialog'),
modalSize = self.data('size') || get_url_params(contentUrl, 'modal_size'),
modalWidth = self.data('width') || get_url_params(contentUrl, 'width'),
modalTitle = self.data('title') || ' ';
modalDialog.removeClass('modal-lg modal-sm').css('width', '');
if (modalSize && modalSize.length != 0) {
switch (modalSize) {
case 'lg':
modalDialog.addClass('modal-lg');
break;
case 'sm':
modalDialog.addClass('modal-sm');
break;
}
} else if (modalWidth) {
modalDialog.css('width', modalWidth + 'px');
}
var modalTitle = self.data('title') || ' ';
$('#global-modal').find('.modal-title').text(modalTitle);
$('#global-modal').find('.modal-body').html(modalContent);
$('#global-modal').modal('show');
toggleModal('global-modal');
});
});
@ -192,6 +173,10 @@ $(function () {
$(".embed-responsive").find('iframe').remove();
});
$('#close-global-model').on('click', function () {
toggleModal('global-modal');
});
// Expands an image modal
$('a.expand-image').on('click', function (e) {
e.preventDefault();
@ -583,6 +568,14 @@ function copyTextToClipBoard(elementId)
document.execCommand('copy');
}
function toggleModal(modalID)
{
document.getElementById(modalID).classList.toggle("hidden");
document.getElementById(modalID + "-backdrop").classList.toggle("hidden");
document.getElementById(modalID).classList.toggle("flex");
document.getElementById(modalID + "-backdrop").classList.toggle("flex");
}
// Expose functions to be use inside chamilo.
// @todo check if there's a better way to expose functions.
window.expandColumnToggle = expandColumnToggle;

@ -70,6 +70,7 @@
"endroid/qr-code": "~4.2",
"essence/essence": "~3.0",
"ezyang/htmlpurifier": "~4.13",
"firebase/php-jwt": "^5.4",
"friendsofsymfony/jsrouting-bundle": "~2.0",
"graphp/algorithms": "~0.8",
"graphp/graphviz": "~0.2",

@ -181,9 +181,9 @@ function handlePlugins()
$pluginRow .= '<td>';
// Checkbox
if (in_array($pluginName, $installed_plugins)) {
$pluginRow .= '<input type="checkbox" name="plugin_'.$pluginName.'[]" checked="checked">';
$pluginRow .= '<input type="checkbox" name="plugin_'.$pluginName.'[]" checked="checked" class="border rounded">';
} else {
$pluginRow .= '<input type="checkbox" name="plugin_'.$pluginName.'[]">';
$pluginRow .= '<input type="checkbox" name="plugin_'.$pluginName.'[]" class="border rounded">';
}
$pluginRow .= '</td><td>';
$pluginRow .= '<h4>'.$plugin_info['title'].' <small>v '.$plugin_info['version'].'</small></h4>';
@ -252,6 +252,26 @@ function handlePlugins()
echo get_lang('Enable the selected plugins').'</button>';
echo '</div>';
echo '</form>';
echo '<div class="hidden overflow-x-hidden overflow-y-auto fixed inset-0 z-50 outline-none focus:outline-none justify-center items-center" id="global-modal">
<!--content-->
<div class="relative w-auto my-6 mx-auto max-w-3xl">
<div class="border-0 rounded-lg shadow-lg relative flex flex-col w-full bg-white outline-none focus:outline-none">
<!--header-->
<div class="flex items-start justify-between p-5 border-b border-solid border-gray-200 rounded-t">
<h3 class="text-3xl font-semibold modal-title" id="global-modal-title"></h3>
</div>
<!--body-->
<div class="relative p-6 flex-auto modal-body" id="global-modal-body"></div>
<!--footer-->
<div class="flex items-center justify-end p-6 border-t border-solid border-gray-200 rounded-b">
<button id="close-global-model" class="text-purple-500 background-transparent font-bold uppercase px-6 py-2 text-sm outline-none focus:outline-none mr-1 mb-1 ease-linear transition-all duration-150" type="button">
'.get_lang('Close').'
</button>
</div>
</div>
</div>
</div>
<div class="hidden opacity-25 fixed inset-0 z-40 bg-black" id="global-modal-backdrop"></div>';
}
/**

@ -442,9 +442,9 @@ if (!empty($_GET['category'])) {
handlePlugins();
echo '</div>';
echo '<div class="tab-pane fade" id="tab2" role="tabpanel" aria-labelledby="plugin-tab-2">';
DashboardManager::handle_dashboard_plugins();
echo '</div>';
//echo '<div class="tab-pane fade" id="tab2" role="tabpanel" aria-labelledby="plugin-tab-2">';
//DashboardManager::handle_dashboard_plugins();
//echo '</div>';
echo '<div class="tab-pane fade" id="tab3" role="tabpanel" aria-labelledby="plugin-tab-3">';
handleExtensions();

@ -3559,6 +3559,13 @@ function api_get_language_id($language)
if (empty($language)) {
return null;
}
// We check the language by iscocode
$langInfo = api_get_language_from_iso($language);
if (!empty($langInfo->getId())) {
return $langInfo->getId();
}
$language = Database::escape_string($language);
$sql = "SELECT id FROM $tbl_language
WHERE english_name = '$language' LIMIT 1";

@ -114,6 +114,12 @@ class HTML_QuickForm_checkbox extends HTML_QuickForm_input
*/
public function toHtml()
{
$extraClass = " border border-gray-200 text-gray-700 rounded leading-tight";
if (isset($this->_attributes['class'])) {
$this->_attributes['class'] .= $extraClass;
} else {
$this->_attributes['class'] = $extraClass;
}
if (0 == strlen($this->_text)) {
$label = '';
} elseif ($this->_flagFrozen) {

@ -644,13 +644,14 @@ class HTML_QuickForm_element extends HTML_Common
break;
case FormValidator::LAYOUT_HORIZONTAL:
$template = '
<div class="mb-6 '.$size[0].' {error_class}">
<div class="mb-6 '.$size[0].' {error_class}">
<label {label-for} class="
'.$height.'
block
text-sm
font-medium
text-gray-700
mb-2
" >
<!-- BEGIN required --><span class="form_required">*</span><!-- END required -->
{label}

@ -87,6 +87,12 @@ class HTML_QuickForm_radio extends HTML_QuickForm_input
*/
public function toHtml()
{
$extraClass = " border border-gray-200 text-gray-700 rounded leading-tight";
if (isset($this->_attributes['class'])) {
$this->_attributes['class'] .= $extraClass;
} else {
$this->_attributes['class'] = $extraClass;
}
if (0 == strlen($this->_text)) {
$label = '';
} elseif ($this->isFrozen()) {

@ -367,6 +367,19 @@ class HTML_QuickForm_select extends HTML_QuickForm_element
$strHtml .= $tabs . '<!-- ' . $this->getComment() . " //-->\n";
}
$layout = $this->getLayout();
$class = '';
if (FormValidator::LAYOUT_HORIZONTAL === $layout) {
$class = 'w-full mt-1';
}
$extraClass = "block appearance-none border border-gray-200 text-gray-700 rounded leading-tight focus:outline-none focus:bg-white focus:border-gray-500 $class";
if (isset($this->_attributes['class'])) {
$this->_attributes['class'] .= $extraClass;
} else {
$this->_attributes['class'] = $extraClass;
}
if (!$this->getMultiple()) {
$attrString = $this->_getAttrString($this->_attributes);
} else {

@ -120,6 +120,13 @@ class HTML_QuickForm_text extends HTML_QuickForm_input
bg-white
font-normal
h-10
rounded
border
shadow
appearance-none
leading-tight
focus:outline-none
focus:shadow-outline
$class
";
if (isset($this->_attributes['class'])) {

Loading…
Cancel
Save