Browse Source

Merge remote-tracking branch 'origin/1.11.x' into 1.11.x

Yannick Warnier 7 years ago
parent
commit
5480b7e9b6

+ 25 - 5
main/admin/course_add.php

@@ -42,7 +42,14 @@ $form = new FormValidator('update_course');
 $form->addElement('header', $tool_name);
 
 // Title
-$form->addText('title', get_lang('Title'), true);
+$form->addText(
+    'title',
+    get_lang('Title'),
+    true,
+    array(
+        'aria-label' => get_lang('Title')
+    )
+);
 $form->applyFilter('title', 'html_filter');
 $form->applyFilter('title', 'trim');
 
@@ -57,7 +64,8 @@ $form->addText(
     [
         'maxlength' => CourseManager::MAX_COURSE_LENGTH_CODE,
         'pattern' => '[a-zA-Z0-9]+',
-        'title' => get_lang('OnlyLettersAndNumbers')
+        'title' => get_lang('OnlyLettersAndNumbers'),
+        'id' => 'visual_code'
     ]
 );
 
@@ -92,12 +100,22 @@ $form->addElement(
 );
 
 // Course department
-$form->addText('department_name', get_lang('CourseDepartment'), false, array('size' => '60'));
+$form->addText(
+    'department_name',
+    get_lang('CourseDepartment'),
+    false,
+    array('size' => '60', 'id' => 'department_name')
+);
 $form->applyFilter('department_name', 'html_filter');
 $form->applyFilter('department_name', 'trim');
 
 // Department URL
-$form->addText('department_url', get_lang('CourseDepartmentURL'), false, array('size' => '60'));
+$form->addText(
+    'department_url',
+    get_lang('CourseDepartmentURL'),
+    false,
+    array('size' => '60', 'id' => 'department_url')
+);
 $form->applyFilter('department_url', 'html_filter');
 
 // Course language.
@@ -148,7 +166,9 @@ $group[] = $form->createElement('radio', 'unsubscribe', get_lang('Unsubscription
 $group[] = $form->createElement('radio', 'unsubscribe', null, get_lang('NotAllowedToUnsubscribe'), 0);
 $form->addGroup($group, '', get_lang('Unsubscription'));
 
-$form->addElement('text', 'disk_quota', array(get_lang('CourseQuota'), null, get_lang('MB')));
+$form->addElement('text', 'disk_quota', array(get_lang('CourseQuota'), null, get_lang('MB')), array(
+    'id' => 'disk_quota'
+));
 $form->addRule('disk_quota', get_lang('ThisFieldShouldBeNumeric'), 'numeric');
 
 $obj = new GradeModel();

+ 6 - 1
main/admin/course_list.php

@@ -358,7 +358,12 @@ if (isset($_GET['search']) && $_GET['search'] === 'advanced') {
         array(),
         FormValidator::LAYOUT_INLINE
     );
-    $form->addElement('text', 'keyword', null, array('id' => 'course-search-keyword'));
+    $form->addElement(
+        'text',
+        'keyword',
+        null,
+        array('id' => 'course-search-keyword', 'aria-label' => get_lang('SearchCourse'))
+    );
     $form->addButtonSearch(get_lang('SearchCourse'));
     $advanced = '<a class="btn btn-default" href="'.api_get_path(WEB_CODE_PATH).'admin/course_list.php?search=advanced"><em class="fa fa-search"></em> '.get_lang('AdvancedSearch').'</a>';
 

+ 13 - 4
main/admin/index.php

@@ -82,7 +82,8 @@ if (api_is_platform_admin()) {
     $search_form = '
         <form method="get" class="form-inline" action="user_list.php">
             <div class="form-group">
-                <input class="form-control" type="text" name="keyword" value="">
+                <input class="form-control" type="text" name="keyword" value=""
+                 aria-label="'.get_lang('Search').'">
                 <button class="btn btn-default" type="submit">
                     <em class="fa fa-search"></em> ' . get_lang('Search').'
                 </button>
@@ -140,7 +141,8 @@ if (api_is_platform_admin()) {
 
     $search_form = ' <form method="get" class="form-inline" action="course_list.php">
             <div class="form-group">
-                <input class="form-control" type="text" name="keyword" value="">
+                <input class="form-control" type="text" name="keyword" value=""
+                 aria-label="'.get_lang('Search').'">
                 <button class="btn btn-default" type="submit">
                     <em class="fa fa-search"></em> ' . get_lang('Search').'
                 </button>
@@ -199,7 +201,10 @@ if (api_is_platform_admin()) {
 
     $search_form = ' <form method="get" action="settings.php" class="form-inline">
             <div class="form-group">
-                <input class="form-control" type="text" name="search_field" value="" >
+                <input class="form-control"
+                type="text"
+                name="search_field" value=""
+                aria-label="'.get_lang('Search').'" >
                 <input type="hidden" value="search_setting" name="category">
                 <button class="btn btn-default" type="submit">
                     <em class="fa fa-search"></em> ' . get_lang('Search').'
@@ -280,7 +285,11 @@ $sessionPath = api_get_path(WEB_CODE_PATH).'session/';
 
 $search_form = ' <form method="GET" class="form-inline" action="'.$sessionPath.'session_list.php">
                     <div class="form-group">
-                        <input class="form-control" type="text" name="keyword" value="">
+                        <input class="form-control"
+                        type="text"
+                        name="keyword"
+                        value=""
+                        aria-label="'.get_lang('Search').'">
                         <button class="btn btn-default" type="submit">
                             <em class="fa fa-search"></em> ' . get_lang('Search').'
                         </button>

+ 25 - 5
main/admin/settings.lib.php

@@ -1316,7 +1316,7 @@ function generateSettingsForm($settings, $settings_by_access_list)
                             get_lang($row['comment']),
                             get_lang('MB')
                         ),
-                        array('maxlength' => '8')
+                        array('maxlength' => '8', 'aria-label' => get_lang($row['title']))
                     );
                     $form->applyFilter($row['variable'], 'html_filter');
                     $default_values[$row['variable']] = round($row['selected_value'] / 1024 / 1024, 1);
@@ -1328,7 +1328,7 @@ function generateSettingsForm($settings, $settings_by_access_list)
                             get_lang($row['title']),
                             get_lang($row['comment']),
                         ),
-                        array('maxlength' => '5')
+                        array('maxlength' => '5', 'aria-label' => get_lang($row['title']))
                     );
                     $form->applyFilter($row['variable'], 'html_filter');
                     $default_values[$row['variable']] = $row['selected_value'];
@@ -1338,6 +1338,7 @@ function generateSettingsForm($settings, $settings_by_access_list)
                     continue;
                 } else {
                     $hideme['class'] = 'col-md-4';
+                    $hideme['aria-label'] = get_lang($row['title']);
                     $form->addElement(
                         'text',
                         $row['variable'],
@@ -1358,7 +1359,13 @@ function generateSettingsForm($settings, $settings_by_access_list)
                     if (file_exists($file)) {
                         $value = file_get_contents($file);
                     }
-                    $form->addElement('textarea', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])), array('rows'=>'10'), $hideme);
+                    $form->addElement(
+                        'textarea',
+                        $row['variable'],
+                        array(get_lang($row['title']), get_lang($row['comment'])),
+                        array('rows' => '10', 'id' => $row['variable']),
+                        $hideme
+                    );
                     $default_values[$row['variable']] = $value;
                 } elseif ($row['variable'] == 'footer_extra_content') {
                     $file = api_get_home_path().'footer_extra_content.txt';
@@ -1366,10 +1373,23 @@ function generateSettingsForm($settings, $settings_by_access_list)
                     if (file_exists($file)) {
                         $value = file_get_contents($file);
                     }
-                    $form->addElement('textarea', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])), array('rows'=>'10'), $hideme);
+                    $form->addElement(
+                        'textarea',
+                        $row['variable'],
+                        array(get_lang($row['title']), get_lang($row['comment'])),
+                        array('rows' => '10', 'id' => $row['variable']),
+                        $hideme
+                    );
                     $default_values[$row['variable']] = $value;
                 } else {
-                    $form->addElement('textarea', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])), array('rows'=>'10'), $hideme);
+                    $form->addElement(
+                        'textarea',
+                        $row['variable'],
+                        array(get_lang($row['title']),
+                        get_lang($row['comment'])),
+                        array('rows' => '10', 'id' => $row['variable']),
+                        $hideme
+                    );
                     $default_values[$row['variable']] = $row['selected_value'];
                 }
                 break;

+ 4 - 1
main/admin/settings.php

@@ -80,7 +80,10 @@ $form_search = new FormValidator(
     array(),
     FormValidator::LAYOUT_INLINE
 );
-$form_search->addElement('text', 'search_field');
+$form_search->addElement('text', 'search_field', null, array(
+    'id' => 'search_field',
+    'aria-label' => get_lang('Search')
+));
 $form_search->addElement('hidden', 'category', 'search_setting');
 $form_search->addButtonSearch(get_lang('Search'), 'submit_button');
 $form_search->setDefaults(

+ 8 - 4
main/admin/subscribe_user2course.php

@@ -292,8 +292,10 @@ if (is_array($extra_field_list)) {
     <td width="40%" align="center">
      <b><?php echo get_lang('UserList'); ?></b>
      <br/><br/>
-     <?php echo get_lang('FirstLetterUser'); ?> :
-     <select name="firstLetterUser" onchange="javascript:document.formulaire.form_sent.value='2'; document.formulaire.submit();">
+        <?php echo get_lang('FirstLetterUser'); ?> :
+     <select name="firstLetterUser"
+        onchange="javascript:document.formulaire.form_sent.value='2'; document.formulaire.submit();"
+        aria-label="<?php echo get_lang('FirstLetterUser'); ?>">
       <option value="">--</option>
       <?php
         echo Display :: get_alphabet_options($first_letter_user);
@@ -304,8 +306,10 @@ if (is_array($extra_field_list)) {
     <td width="40%" align="center">
      <b><?php echo get_lang('CourseList'); ?> :</b>
      <br/><br/>
-     <?php echo get_lang('FirstLetterCourse'); ?> :
-     <select name="firstLetterCourse" onchange="javascript:document.formulaire.form_sent.value='2'; document.formulaire.submit();">
+        <?php echo get_lang('FirstLetterCourse'); ?> :
+     <select name="firstLetterCourse" 
+        onchange="javascript:document.formulaire.form_sent.value='2'; document.formulaire.submit();"
+        aria-label="<?php echo get_lang('FirstLetterCourse'); ?>">
       <option value="">--</option>
       <?php
       echo Display :: get_alphabet_options($first_letter_course);

+ 43 - 7
main/admin/user_add.php

@@ -102,33 +102,69 @@ $form = new FormValidator('user_add');
 $form->addElement('header', '', $tool_name);
 if (api_is_western_name_order()) {
     // Firstname
-    $form->addElement('text', 'firstname', get_lang('FirstName'));
+    $form->addElement(
+        'text',
+        'firstname',
+        get_lang('FirstName'),
+        array(
+            'id' => 'firstname'
+        )
+    );
     $form->applyFilter('firstname', 'html_filter');
     $form->applyFilter('firstname', 'trim');
     $form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required');
     // Lastname
-    $form->addElement('text', 'lastname', get_lang('LastName'));
+    $form->addElement(
+        'text',
+        'lastname',
+        get_lang('LastName'),
+        array(
+            'id' => 'lastname'
+        )
+    );
     $form->applyFilter('lastname', 'html_filter');
     $form->applyFilter('lastname', 'trim');
     $form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required');
 } else {
     // Lastname
-    $form->addElement('text', 'lastname', get_lang('LastName'));
+    $form->addElement(
+        'text',
+        'lastname',
+        get_lang('LastName'),
+        array(
+            'id' => 'lastname'
+        )
+    );
     $form->applyFilter('lastname', 'html_filter');
     $form->applyFilter('lastname', 'trim');
     $form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required');
     // Firstname
-    $form->addElement('text', 'firstname', get_lang('FirstName'));
+    $form->addElement(
+        'text',
+        'firstname',
+        get_lang('FirstName'),
+        array(
+            'id' => 'firstname'
+        )
+    );
     $form->applyFilter('firstname', 'html_filter');
     $form->applyFilter('firstname', 'trim');
     $form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required');
 }
 // Official code
-$form->addElement('text', 'official_code', get_lang('OfficialCode'), array('size' => '40'));
+$form->addElement(
+    'text',
+    'official_code',
+    get_lang('OfficialCode'),
+    array(
+        'size' => '40',
+        'id' => 'official_code'
+    )
+);
 $form->applyFilter('official_code', 'html_filter');
 $form->applyFilter('official_code', 'trim');
 // Email
-$form->addElement('text', 'email', get_lang('Email'), array('size' => '40', 'autocomplete' => 'off'));
+$form->addElement('text', 'email', get_lang('Email'), array('size' => '40', 'autocomplete' => 'off', 'id' => 'email'));
 $form->addRule('email', get_lang('EmailWrong'), 'email');
 if (api_get_setting('registration', 'email') == 'true') {
     $form->addRule('email', get_lang('EmailWrong'), 'required');
@@ -140,7 +176,7 @@ if (api_get_setting('login_is_email') == 'true') {
 }
 
 // Phone
-$form->addElement('text', 'phone', get_lang('PhoneNumber'), ['autocomplete' => 'off']);
+$form->addElement('text', 'phone', get_lang('PhoneNumber'), ['autocomplete' => 'off', 'id' => 'phone']);
 // Picture
 $form->addFile(
     'picture',

+ 8 - 1
main/admin/user_list.php

@@ -824,7 +824,14 @@ if (!empty($action)) {
 
 // Create a search-box
 $form = new FormValidator('search_simple', 'get', null, null, null, 'inline');
-$form->addText('keyword', get_lang('Search'), false);
+$form->addText(
+    'keyword',
+    get_lang('Search'),
+    false,
+    array(
+        'aria-label' => get_lang("SearchUsers")
+    )
+);
 $form->addButtonSearch(get_lang('Search'));
 
 $searchAdvanced = '

+ 9 - 2
main/inc/lib/extra_field.lib.php

@@ -895,7 +895,9 @@ class ExtraField extends Model
                             'text',
                             'extra_'.$field_details['variable'],
                             $field_details['display_text'],
-                            array()
+                            array(
+                                'id' => 'extra_'.$field_details['variable']
+                            )
                         );
                         $form->applyFilter('extra_'.$field_details['variable'], 'stripslashes');
                         $form->applyFilter('extra_'.$field_details['variable'], 'trim');
@@ -909,7 +911,12 @@ class ExtraField extends Model
                             $field_details['display_text'],
                             false,
                             false,
-                            array('ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130')
+                            array(
+                                'ToolbarSet' => 'Profile',
+                                'Width' => '100%',
+                                'Height' => '130',
+                                'id' => 'extra_'.$field_details['variable']
+                            )
                         );
                         $form->applyFilter('extra_'.$field_details['variable'], 'stripslashes');
                         $form->applyFilter('extra_'.$field_details['variable'], 'trim');

+ 1 - 1
main/inc/lib/sessionmanager.lib.php

@@ -7182,7 +7182,7 @@ class SessionManager
             'name',
             get_lang('SessionName'),
             true,
-            ['maxlength' => 150]
+            ['maxlength' => 150, 'aria-label' => get_lang('SessionName')]
         );
         $form->addRule('name', get_lang('SessionNameAlreadyExists'), 'callback', 'check_session_name');
 

+ 2 - 1
main/session/session_category_list.php

@@ -114,7 +114,8 @@ if (isset($_GET['search']) && $_GET['search'] == 'advanced') {
                 <div class="pull-right">
                 <form method="POST" action="session_category_list.php" class="form-inline">
                     <div class="form-group">
-                    <input class="form-control" type="text" name="keyword" value="<?php echo $keyword; ?>"/>
+                    <input class="form-control" type="text" name="keyword" value="<?php echo $keyword; ?>"
+                    aria-label="<?php echo get_lang('Search'); ?>"/>
                     <button class="btn btn-default" type="submit" name="name" value="<?php echo get_lang('Search') ?>"><em class="fa fa-search"></em> <?php echo get_lang('Search') ?></button>
                     <!-- <a href="session_list.php?search=advanced"><?php echo get_lang('AdvancedSearch'); ?></a> -->
                     </div>

+ 3 - 1
main/session/session_list.php

@@ -328,7 +328,9 @@ if (api_is_platform_admin()) {
         [],
         FormValidator::LAYOUT_INLINE
     );
-    $form->addElement('text', 'keyword');
+    $form->addElement('text', 'keyword', null, array(
+        'aria-label' => get_lang('Search')
+    ));
     $form->addButtonSearch(get_lang('Search'));
     $form->display();
     echo '</div>';