forked from github/kensanata.oddmuse
Add access keys for articles and comments, if enabled.
If $CommentsPrefix is set, the wiki knows about article pages and comment pages. The link in GetFooterLinks now uses 'a' and 'c' as access keys. The access key is passed to GetPageLink and to ScriptLink.
This commit is contained in:
12
wiki.pl
12
wiki.pl
@@ -1162,11 +1162,12 @@ sub GetPageOrEditLink { # use GetPageLink and GetEditLink if you know the result
|
||||
}
|
||||
|
||||
sub GetPageLink { # use if you want to force a link to local pages, whether it exists or not
|
||||
my ($id, $name, $class) = @_;
|
||||
my ($id, $name, $class, $accesskey) = @_;
|
||||
$id = FreeToNormal($id);
|
||||
$name = $id unless $name;
|
||||
$class .= ' ' if $class;
|
||||
return ScriptLink(UrlEncode($id), NormalToFree($name), $class . 'local');
|
||||
return ScriptLink(UrlEncode($id), NormalToFree($name), $class . 'local',
|
||||
undef, undef, $accesskey);
|
||||
}
|
||||
|
||||
sub GetEditLink { # shortcut
|
||||
@@ -1996,8 +1997,7 @@ sub DoHistory {
|
||||
}
|
||||
@html = (GetFormStart(undef, 'get', 'history'),
|
||||
$q->p($q->submit({-name=>T('Compare')}),
|
||||
# don't use $q->hidden here, the sticky action
|
||||
# value will be used instead
|
||||
# don't use $q->hidden here!
|
||||
$q->input({-type=>'hidden',-name=>'action',-value=>'browse'}),
|
||||
$q->input({-type=>'hidden', -name=>'diff', -value=>'1'}),
|
||||
$q->input({-type=>'hidden', -name=>'id', -value=>$id})),
|
||||
@@ -2399,9 +2399,9 @@ sub GetFooterLinks {
|
||||
if ($id and $rev ne 'history' and $rev ne 'edit') {
|
||||
if ($CommentsPrefix) {
|
||||
if ($id =~ /^$CommentsPrefix(.*)/o) {
|
||||
push(@elements, GetPageLink($1, undef, 'original'));
|
||||
push(@elements, GetPageLink($1, undef, 'original', T('a')));
|
||||
} else {
|
||||
push(@elements, GetPageLink($CommentsPrefix . $id, undef, 'comment'));
|
||||
push(@elements, GetPageLink($CommentsPrefix . $id, undef, 'comment', T('c')));
|
||||
}
|
||||
}
|
||||
if (UserCanEdit($id, 0)) {
|
||||
|
||||
Reference in New Issue
Block a user