Fix: New: Differentiate text and img for better accessibility.

This commit is contained in:
Laurent Destailleur 2014-07-29 20:21:01 +02:00
parent 6226d39cda
commit b57371bfa1
4 changed files with 34 additions and 27 deletions

View File

@ -28,6 +28,7 @@ For users:
- New: First changes for accessibility. - New: First changes for accessibility.
- New: Home page of project area shows list of draft project (like other main page). - New: Home page of project area shows list of draft project (like other main page).
- New: Can search on project ref or string from project main page (like other main page). - New: Can search on project ref or string from project main page (like other main page).
- New: Differentiate text and img for better accessibility.
- Fix: [ bug #1487 ] PAYMENT_DELETE trigger does not intercept trigger action - Fix: [ bug #1487 ] PAYMENT_DELETE trigger does not intercept trigger action
- Fix: [ bug #1470, #1472, #1473] User trigger problem - Fix: [ bug #1470, #1472, #1473] User trigger problem
- Fix: [ bug #1489, #1491 ] Intervention trigger problem - Fix: [ bug #1489, #1491 ] Intervention trigger problem

View File

@ -162,7 +162,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
if (! empty($head['sublink'])) print '<a href="'.$head['sublink'].'"'.(empty($head['target'])?' target="_blank"':'').'>'; if (! empty($head['sublink'])) print '<a href="'.$head['sublink'].'"'.(empty($head['target'])?' target="_blank"':'').'>';
if (! empty($head['subpicto'])) print img_picto($head['subtext'], $head['subpicto'], 'class="'.(empty($head['subclass'])?'':$head['subclass']).'" id="idsubimg'.$this->boxcode.'"'); if (! empty($head['subpicto'])) print img_picto($head['subtext'], $head['subpicto'], 'class="'.(empty($head['subclass'])?'':$head['subclass']).'" id="idsubimg'.$this->boxcode.'"');
if (! empty($head['sublink'])) '</a>'; if (! empty($head['sublink'])) '</a>';
if ($conf->use_javascript_ajax) if (! empty($conf->use_javascript_ajax))
{ {
print '</td><td class="nocellnopadd boxclose nowrap">'; print '</td><td class="nocellnopadd boxclose nowrap">';
// The image must have the class 'boxhandle' beause it's value used in DOM draggable objects to define the area used to catch the full object // The image must have the class 'boxhandle' beause it's value used in DOM draggable objects to define the area used to catch the full object
@ -225,7 +225,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
if (! empty($contents[$i][$j]['logo'])) if (! empty($contents[$i][$j]['logo']))
{ {
$logo=preg_replace("/^object_/i","",$contents[$i][$j]['logo']); $logo=preg_replace("/^object_/i","",$contents[$i][$j]['logo']);
print img_object($langs->trans("Show"),$logo); print img_object(':'.$langs->trans("Show"),$logo);
} }
$maxlength=$MAXLENGTHBOX; $maxlength=$MAXLENGTHBOX;

View File

@ -1785,7 +1785,7 @@ function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8',$nodo
/** /**
* Show picto whatever it's its name (generic function) * Show picto whatever it's its name (generic function)
* *
* @param string $alt Text on alt and title of image (alt only if param notitle is set to 1) * @param string $alt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
* @param string $picto Name of image file to show ('filenew', ...) * @param string $picto Name of image file to show ('filenew', ...)
* If no extension provided, we use '.png'. Image must be stored into theme/xxx/img directory. * If no extension provided, we use '.png'. Image must be stored into theme/xxx/img directory.
* Example: picto.png if picto.png is stored into htdocs/theme/mytheme/img * Example: picto.png if picto.png is stored into htdocs/theme/mytheme/img
@ -1842,13 +1842,19 @@ function img_picto($alt, $picto, $options = '', $pictoisfullpath = false, $srcon
} }
if ($srconly) return $fullpathpicto; if ($srconly) return $fullpathpicto;
else return '<img src="'.$fullpathpicto.'" border="0" alt="'.dol_escape_htmltag($alt).'"'.($notitle?'':' title="'.dol_escape_htmltag($alt).'"').($options?' '.$options:'').'>'; else
{
$tmparray=explode(':',$alt);
$alt=$tmparray[0];
$title=empty($tmparray[1])?$alt:$tmparray[1];
return '<img src="'.$fullpathpicto.'" border="0" alt="'.dol_escape_htmltag($alt).'"'.($notitle?'':' title="'.dol_escape_htmltag($title).'"').($options?' '.$options:'').'>'; // Alt is used for accessibility, title for popup
}
} }
/** /**
* Show a picto called object_picto (generic function) * Show a picto called object_picto (generic function)
* *
* @param string $alt Text of alt on image * @param string $alt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
* @param string $picto Name of image to show object_picto (example: user, group, action, bill, contract, propal, product, ...) * @param string $picto Name of image to show object_picto (example: user, group, action, bill, contract, propal, product, ...)
* For external modules use imagename@mymodule to search into directory "img" of module. * For external modules use imagename@mymodule to search into directory "img" of module.
* @param string $options Add more attribute on img tag (ie: class="datecallink") * @param string $options Add more attribute on img tag (ie: class="datecallink")
@ -1864,7 +1870,7 @@ function img_object($alt, $picto, $options = '', $pictoisfullpath = false)
/** /**
* Show picto (generic function) * Show picto (generic function)
* *
* @param string $alt Text on alt and title of image * @param string $alt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
* @param string $picto Name of image file to show (If no extension provided, we use '.png'). Image must be stored into htdocs/theme/common directory. * @param string $picto Name of image file to show (If no extension provided, we use '.png'). Image must be stored into htdocs/theme/common directory.
* @param string $options Add more attribute on img tag * @param string $options Add more attribute on img tag
* @param int $pictoisfullpath If 1, image path is a full path * @param int $pictoisfullpath If 1, image path is a full path
@ -1896,7 +1902,7 @@ function img_picto_common($alt, $picto, $options = '', $pictoisfullpath = 0)
/** /**
* Show logo action * Show logo action
* *
* @param string $alt Text for image alt and title ('default', ...) * @param string $alt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
* @param int $numaction Action to show * @param int $numaction Action to show
* @return string Return an img tag * @return string Return an img tag
*/ */
@ -1919,7 +1925,7 @@ function img_action($alt, $numaction)
/** /**
* Show pdf logo * Show pdf logo
* *
* @param string $alt Texte sur le alt de l'image * @param string $alt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
* @param int $size Taille de l'icone : 3 = 16x16px , 2 = 14x14px * @param int $size Taille de l'icone : 3 = 16x16px , 2 = 14x14px
* @return string Retourne tag img * @return string Retourne tag img
*/ */
@ -1935,7 +1941,7 @@ function img_pdf($alt = 'default', $size = 3)
/** /**
* Show logo + * Show logo +
* *
* @param string $alt Texte sur le alt de l'image * @param string $alt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
* @return string Return tag img * @return string Return tag img
*/ */
function img_edit_add($alt = 'default') function img_edit_add($alt = 'default')
@ -1949,7 +1955,7 @@ function img_edit_add($alt = 'default')
/** /**
* Show logo - * Show logo -
* *
* @param string $alt Texte sur le alt de l'image * @param string $alt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
* @return string Retourne tag img * @return string Retourne tag img
*/ */
function img_edit_remove($alt = 'default') function img_edit_remove($alt = 'default')
@ -1964,7 +1970,7 @@ function img_edit_remove($alt = 'default')
/** /**
* Show logo editer/modifier fiche * Show logo editer/modifier fiche
* *
* @param string $alt Texte sur le alt de l'image * @param string $alt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
* @param float $float Si il faut y mettre le style "float: right" * @param float $float Si il faut y mettre le style "float: right"
* @param string $other Add more attributes on img * @param string $other Add more attributes on img
* @return string Retourne tag img * @return string Retourne tag img
@ -1981,7 +1987,7 @@ function img_edit($alt = 'default', $float = 0, $other = '')
/** /**
* Show logo view card * Show logo view card
* *
* @param string $alt Texte sur le alt de l'image * @param string $alt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
* @param float $float Si il faut y mettre le style "float: right" * @param float $float Si il faut y mettre le style "float: right"
* @param string $other Add more attributes on img * @param string $other Add more attributes on img
* @return string Retourne tag img * @return string Retourne tag img
@ -2000,7 +2006,7 @@ function img_view($alt = 'default', $float = 0, $other = '')
/** /**
* Show delete logo * Show delete logo
* *
* @param string $alt Text on alt image * @param string $alt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
* @param string $other Add more attributes on img * @param string $other Add more attributes on img
* @return string Retourne tag img * @return string Retourne tag img
*/ */
@ -2016,7 +2022,7 @@ function img_delete($alt = 'default', $other = '')
/** /**
* Show printer logo * Show printer logo
* *
* @param string $alt Text on alt image * @param string $alt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
* @param string $other Add more attributes on img * @param string $other Add more attributes on img
* @return string Retourne tag img * @return string Retourne tag img
*/ */
@ -2050,7 +2056,7 @@ function img_help($usehelpcursor = 1, $usealttitle = 1)
/** /**
* Show info logo * Show info logo
* *
* @param string $alt Text to show on alt image * @param string $alt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
* @return string Return img tag * @return string Return img tag
*/ */
function img_info($alt = 'default') function img_info($alt = 'default')
@ -2065,7 +2071,7 @@ function img_info($alt = 'default')
/** /**
* Show warning logo * Show warning logo
* *
* @param string $alt Text to show on alt image * @param string $alt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
* @param int $float If we must add style "float: right" * @param int $float If we must add style "float: right"
* @return string Return img tag * @return string Return img tag
*/ */
@ -2081,7 +2087,7 @@ function img_warning($alt = 'default', $float = 0)
/** /**
* Show error logo * Show error logo
* *
* @param string $alt Text to show on alt image * @param string $alt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
* @return string Return img tag * @return string Return img tag
*/ */
function img_error($alt = 'default') function img_error($alt = 'default')
@ -2096,7 +2102,7 @@ function img_error($alt = 'default')
/** /**
* Show next logo * Show next logo
* *
* @param string $alt Text to show on alt image * @param string $alt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
* @return string Return img tag * @return string Return img tag
*/ */
function img_next($alt = 'default') function img_next($alt = 'default')
@ -2111,7 +2117,7 @@ function img_next($alt = 'default')
/** /**
* Show previous logo * Show previous logo
* *
* @param string $alt Text to show on alt image * @param string $alt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
* @return string Return img tag * @return string Return img tag
*/ */
function img_previous($alt = 'default') function img_previous($alt = 'default')
@ -2126,7 +2132,7 @@ function img_previous($alt = 'default')
/** /**
* Show down arrow logo * Show down arrow logo
* *
* @param string $alt Text to show on alt image * @param string $alt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
* @param int $selected Selected * @param int $selected Selected
* @return string Return img tag * @return string Return img tag
*/ */
@ -2142,7 +2148,7 @@ function img_down($alt = 'default', $selected = 0)
/** /**
* Show top arrow logo * Show top arrow logo
* *
* @param string $alt Text to show on alt image * @param string $alt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
* @param int $selected Selected * @param int $selected Selected
* @return string Return img tag * @return string Return img tag
*/ */
@ -2158,7 +2164,7 @@ function img_up($alt = 'default', $selected = 0)
/** /**
* Show left arrow logo * Show left arrow logo
* *
* @param string $alt Text to show on alt image * @param string $alt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
* @param int $selected Selected * @param int $selected Selected
* @param string $options Add more attribute on img tag (For example 'style="float: right"') * @param string $options Add more attribute on img tag (For example 'style="float: right"')
* @return string Return img tag * @return string Return img tag
@ -2175,7 +2181,7 @@ function img_left($alt = 'default', $selected = 0, $options='')
/** /**
* Show right arrow logo * Show right arrow logo
* *
* @param string $alt Text to show on alt image * @param string $alt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
* @param int $selected Selected * @param int $selected Selected
* @param string $options Add more attribute on img tag (For example 'style="float: right"') * @param string $options Add more attribute on img tag (For example 'style="float: right"')
* @return string Return img tag * @return string Return img tag
@ -2193,7 +2199,7 @@ function img_right($alt = 'default', $selected = 0, $options='')
* Show tick logo if allowed * Show tick logo if allowed
* *
* @param string $allow Allow * @param string $allow Allow
* @param string $alt Text to show on alt image * @param string $alt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
* @return string Return img tag * @return string Return img tag
*/ */
function img_allow($allow, $alt = 'default') function img_allow($allow, $alt = 'default')
@ -2212,7 +2218,7 @@ function img_allow($allow, $alt = 'default')
* Show MIME img of a file * Show MIME img of a file
* *
* @param string $file Filename * @param string $file Filename
* @param string $alt Alternate text to show on img mous hover * @param string $alt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
* @return string Return img tag * @return string Return img tag
*/ */
function img_mime($file, $alt = '') function img_mime($file, $alt = '')
@ -2232,7 +2238,7 @@ function img_mime($file, $alt = '')
* Show phone logo. * Show phone logo.
* Use img_picto instead. * Use img_picto instead.
* *
* @param string $alt Text to show on alt image * @param string $alt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
* @param int $option Option * @param int $option Option
* @return string Return img tag * @return string Return img tag
* @deprecated * @deprecated

View File

@ -256,7 +256,7 @@ if (empty($user->societe_id))
$text=$langs->trans($titres[$key]); $text=$langs->trans($titres[$key]);
print '<div class="boxstats">'; print '<div class="boxstats">';
print '<a href="'.$links[$key].'" class="nobold nounderline">'; print '<a href="'.$links[$key].'" class="nobold nounderline">';
print img_object($text,$icons[$key]).' '.$text.'<br>'; print img_object("",$icons[$key]).' '.$text.'<br>';
print '</a>'; print '</a>';
print '<a href="'.$links[$key].'">'; print '<a href="'.$links[$key].'">';
print $board->nb[$val]; print $board->nb[$val];