hotkey help: fix actions bound to multiple sequences not displayed correctly

This commit is contained in:
Andrew Dolgov 2013-02-27 22:58:43 +04:00
parent c22580b55f
commit c2e4e8fe91
1 changed files with 16 additions and 19 deletions

View File

@ -23,16 +23,10 @@ class Backend extends Handler {
$imap = get_hotkeys_map($this->link); $imap = get_hotkeys_map($this->link);
$omap = array(); $omap = array();
// :(
$tinycharmap = array(
"(9)" => "{TAB}",
"(191)" => "?");
foreach ($imap[1] as $sequence => $action) { foreach ($imap[1] as $sequence => $action) {
if (!isset($omap[$action])) { if (!isset($omap[$action])) $omap[$action] = array();
$omap[$action] = isset($tinycharmap[$sequence]) ? $tinycharmap[$sequence] :
$sequence; array_push($omap[$action], $sequence);
}
} }
print "<ul class='helpKbList' id='helpKbList'>"; print "<ul class='helpKbList' id='helpKbList'>";
@ -44,19 +38,22 @@ class Backend extends Handler {
print "<li><h3>" . $section . "</h3></li>"; print "<li><h3>" . $section . "</h3></li>";
foreach ($hotkeys as $action => $description) { foreach ($hotkeys as $action => $description) {
if (strpos($omap[$action], "|") !== FALSE) {
$omap[$action] = substr($omap[$action], foreach ($omap[$action] as $sequence) {
strpos($omap[$action], "|")+1, if (strpos($sequence, "|") !== FALSE) {
strlen($omap[$action])); $sequence = substr($sequence,
strpos($sequence, "|")+1,
strlen($sequence));
} }
print "<li>"; print "<li>";
print "<span class='hksequence'>" . $omap[$action] . "</span>"; print "<span class='hksequence'>$sequence</span>";
print $description; print $description;
print "</li>"; print "</li>";
}
} }
}
}
print "</ul>"; print "</ul>";