Add error message when the upload has failed - refs BT#9082

1.10.x
Angel Fernando Quiroz Campos 11 years ago
parent 56aa4696af
commit 02f0faa770
  1. 6
      main/admin/skill_badge_create.php
  2. 11
      main/admin/skill_badge_list.php
  3. 4
      main/inc/lib/api.lib.php
  4. 5
      main/template/default/skill/badge_list.tpl

@ -5,6 +5,10 @@
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com> * @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
* @package chamilo.admin.openbadges * @package chamilo.admin.openbadges
*/ */
use \ChamiloSession as Session;
$language_file = array('document');
$cidReset = true; $cidReset = true;
require_once '../inc/global.inc.php'; require_once '../inc/global.inc.php';
@ -62,6 +66,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$imageExtraField->send_image($sysDataPath . $fileDir . $fileName, -1, 'png'); $imageExtraField->send_image($sysDataPath . $fileDir . $fileName, -1, 'png');
$params['icon'] = $fileDir . $fileName; $params['icon'] = $fileDir . $fileName;
} else {
Session::write('errorMessage', get_lang('UplUnableToSaveFile'));
} }
} }

@ -5,6 +5,8 @@
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com> * @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
* @package chamilo.admin.openbadges * @package chamilo.admin.openbadges
*/ */
use \ChamiloSession as Session;
$cidReset = true; $cidReset = true;
require_once '../inc/global.inc.php'; require_once '../inc/global.inc.php';
@ -15,6 +17,12 @@ if (!api_is_platform_admin() || api_get_setting('allow_skills_tool') !== 'true')
$this_section = SECTION_PLATFORM_ADMIN; $this_section = SECTION_PLATFORM_ADMIN;
$errorMessage = null;
if (Session::has('errorMessage')) {
$errorMessage = Session::read('errorMessage');
}
$objSkill = new Skill(); $objSkill = new Skill();
$skills = $objSkill->get_all(); $skills = $objSkill->get_all();
@ -30,9 +38,12 @@ $interbreadcrumb = array(
); );
$tpl = new Template(get_lang('Skills')); $tpl = new Template(get_lang('Skills'));
$tpl->assign('errorMessage', $errorMessage);
$tpl->assign('platformAdminEmail', get_setting('emailAdministrator')); $tpl->assign('platformAdminEmail', get_setting('emailAdministrator'));
$tpl->assign('skills', $skills); $tpl->assign('skills', $skills);
$contentTemplate = $tpl->get_template('skill/badge_list.tpl'); $contentTemplate = $tpl->get_template('skill/badge_list.tpl');
$tpl->display($contentTemplate); $tpl->display($contentTemplate);
Session::erase('errorMessage');

@ -7791,6 +7791,10 @@ function api_create_protected_dir($name, $parentDirectory)
{ {
$isCreated = false; $isCreated = false;
if (!is_writable($parentDirectory)) {
return false;
}
$fullPath = $parentDirectory . replace_dangerous_char($name); $fullPath = $parentDirectory . replace_dangerous_char($name);
if (mkdir($fullPath, api_get_permissions_for_new_directories(), true)) { if (mkdir($fullPath, api_get_permissions_for_new_directories(), true)) {

@ -16,6 +16,11 @@
</ul> </ul>
<div class="tab-content"> <div class="tab-content">
<div class="tab-pane active"> <div class="tab-pane active">
{% if not errorMessage is empty %}
<div class="alert alert-error">
{{ errorMessage }}
</div>
{% endif %}
<table class="table table-bordered table-striped"> <table class="table table-bordered table-striped">
<thead> <thead>
<tr> <tr>

Loading…
Cancel
Save