From: Mike G. v. a. <we...@ma...> - 2009-07-13 00:06:38
|
Log Message: ----------- Added id's to links in the left margin Modified Files: -------------- webwork2/lib/WeBWorK: ContentGenerator.pm Revision Data ------------- Index: ContentGenerator.pm =================================================================== RCS file: /webwork/cvs/system/webwork2/lib/WeBWorK/ContentGenerator.pm,v retrieving revision 1.196 retrieving revision 1.197 diff -Llib/WeBWorK/ContentGenerator.pm -Llib/WeBWorK/ContentGenerator.pm -u -r1.196 -r1.197 --- lib/WeBWorK/ContentGenerator.pm +++ lib/WeBWorK/ContentGenerator.pm @@ -590,7 +590,10 @@ my $new_urlpath = $self->r->urlpath->newFromModule($module, %$urlpath_args); my $new_systemlink = $self->systemLink($new_urlpath, %$systemlink_args); - defined $text or $text = $new_urlpath->name; + defined $text or $text = $new_urlpath->name; #too clever + + my $id = $text; + $id =~ s/\W/\_/g; #$text = sp2nbsp($text); # ugly hack to prevent text from wrapping # try to set $active automatically by comparing @@ -615,9 +618,9 @@ my $new_anchor; if ($active) { # add <strong> for old browsers - $new_anchor = CGI::strong(CGI::a({href=>$new_systemlink, class=>"active", %target}, $text)); + $new_anchor = CGI::strong(CGI::a({href=>$new_systemlink, id=>$id, class=>"active", %target}, $text)); } else { - $new_anchor = CGI::a({href=>$new_systemlink, %target}, $text); + $new_anchor = CGI::a({href=>$new_systemlink, id=>$id, %target}, "$text"); } return $new_anchor; @@ -1289,9 +1292,11 @@ while (@siblings) { my $name = shift @siblings; my $url = shift @siblings; + my $id = $name; + $id =~ s/\W/\_/g; push @result, $url - ? CGI::a({-href=>"$url?$auth"}, $name) - : $name; + ? CGI::span( {id=>$id}, CGI::a({-href=>"$url?$auth"}, $name) ) + : CGI::span( {id=>$id},$name ); } return join($sep, @result) . "\n"; |