[Phamm] [PATCH] phamm-0.5.15: add <img alt="ON|OFF"> for on/off attribute display

kabe at sra-tohoku.co.jp kabe at sra-tohoku.co.jp
Thu Feb 5 12:38:12 CET 2009


Pardon for patch in chunks...

When showing a boolean attribute, the TRUE.png/FALSE.png mini icon
didn't have any label for <img alt> HTML tag attribute, which made it
impossible to know the current value on a text browser. 

(N.B: elinks is usable, lynx is not, due to difference computing the URL
 from <A href="?action=..."> relative URL)

The patch will add the alt= attribute.

The alt="value" should have been escaped with htmlspecialchars() for safety,
but since other parts of the code doesn't, the patch 
follows the current convention.
-- 
kabe

--- phamm-0.5.15/lib/xhtml.php.dis4	2009-02-04 23:42:15.000000000 +0900
+++ phamm-0.5.15/lib/xhtml.php	2009-02-05 20:08:38.000000000 +0900
@@ -919,7 +919,7 @@
     $false_label = ($false == 'FALSE' ? _("NO") : _("YES"));
     $true_label = ($true == 'TRUE' ? _("YES") : _("NO"));
     
-    $tag .= '<img src="./img/'.$img.'.png" alt="" border="0" /> ';
+    $tag .= '<img src="./img/'.$img.'.png" alt="'.(($value)?$true_label:$false_label).'" border="0" /> ';
 
     if ($_SESSION["login"]["level"] >= $minAuthLevel)
     {


More information about the Phamm mailing list