[LON-CAPA-cvs] cvs: loncom /interface lonhtmlcommon.pm

droeschl droeschl@source.lon-capa.org
Wed, 26 Nov 2008 23:20:56 -0000


droeschl		Wed Nov 26 23:20:56 2008 EDT

  Modified files:              
    /loncom/interface	lonhtmlcommon.pm 
  Log:
  Changes related to LON-CAPA redesign project.
  generate_menu supports alt tags for icons.
  
  
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.185 loncom/interface/lonhtmlcommon.pm:1.186
--- loncom/interface/lonhtmlcommon.pm:1.185	Wed Nov 26 17:11:55 2008
+++ loncom/interface/lonhtmlcommon.pm	Wed Nov 26 23:20:56 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common html routines
 #
-# $Id: lonhtmlcommon.pm,v 1.185 2008/11/26 17:11:55 schafran Exp $
+# $Id: lonhtmlcommon.pm,v 1.186 2008/11/26 23:20:56 droeschl Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2021,6 +2021,7 @@
 #			permission  =>	'Contains permissions as returned from lonnet::allowed(),
 #					 must evaluate to true in order to activate the link',
 #			icon        =>  'icon filename',
+#			alttext	    =>	'alt text for the icon',
 #			help	    =>	'Name of the corresponding helpfile',
 #			linktitle   =>	'Description of the link (used for title tag)'
 #		    },
@@ -2038,8 +2039,6 @@
 # Don't rely on its current functionality as it might be 
 # changed or removed.
 # TODO:
-# add icon field
-# add alt tag for icon
 # check for empty values
 # --------------------------
 
@@ -2054,12 +2053,17 @@
 	    $menu_html .= '<li class="">'.
 			    qq{<a href="$item->{'url'}" title="$item->{'linktitle'}">};
             if($item->{'icon'}){
-                $menu_html .= qq{<img class = "" src="/res/adm/pages/$item->{'icon'}" alt=""/>} 
+                $menu_html .= qq{<img class = "" src="/res/adm/pages/$item->{'icon'}" alt="};
+		if($item->{'alttext'}){
+		    $menu_html .= qq{$item->{'alttext'}"/>};
+		} else { #use linktext as alt text for the icon
+		    $menu_html .= qq{$item->{'linktext'}"/>};
+                } 
             }
             $menu_html .= &mt($item->{'linktext'}).'</a>';
-#	    if (exists($item->{'help'})) {
-#		$menu_html .= &Apache::loncommon::help_open_topic($item->{'help'});
-#	    }
+	    if (exists($item->{'help'})) {
+		$menu_html .= &Apache::loncommon::help_open_topic($item->{'help'});
+	    }
 	    $menu_html .= '</li>';
 	}
 	$menu_html .= '</div>';