From: x2003bruneau Date: Sat, 19 Aug 2006 16:58:44 +0000 (+0000) Subject: Add shortkey browsing X-Git-Tag: 1.8~160 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=6e0f0e15f04945b641436588c1aaae985ad45dcd;p=banana.git Add shortkey browsing u => next unread p => new post r => reply c => cancel a => previous post z => next post q => previous thread s => next thread Do not hesitate to change the shortkeys if you have better :p git-svn-id: svn+ssh://murphy/home/svn/banana/trunk@138 9869982d-c50d-0410-be91-f2a2ec7c7c7b --- diff --git a/Changelog b/Changelog index c5c117f..dade110 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,7 @@ +Sat, 19 Aug 2006 Florent Bruneau + + * Add shortkey browsing + Sat, 05 Aug 2006 Florent Bruneau * Allow browsing through unread messages diff --git a/banana/misc.inc.php b/banana/misc.inc.php index fe76cd9..48c8081 100644 --- a/banana/misc.inc.php +++ b/banana/misc.inc.php @@ -83,12 +83,15 @@ function makeLink($params) /** Format a link to be use in a link * @ref makeLink */ -function makeHREF($params, $text = null, $popup = null, $class = null) +function makeHREF($params, $text = null, $popup = null, $class = null, $accesskey = null) { $link = makeLink($params); if (is_null($text)) { $text = $link; } + if (!is_null($accesskey)) { + $popup .= ' (raccourci : ' . $accesskey . ')'; + } if (!is_null($popup)) { $popup = ' title="' . $popup . '"'; } @@ -99,7 +102,13 @@ function makeHREF($params, $text = null, $popup = null, $class = null) if (isset($params['action']) && $params['action'] == 'view') { $target = ' target="_blank"'; } - return '' . $text . ''; + if (!is_null($accesskey)) { + $accesskey = ' accesskey="' . $accesskey . '"'; + } + + return '' . $text . ''; } /** Format tree images links @@ -133,12 +142,13 @@ function makeImg($img, $alt, $height = null, $width = null) /** Make a link using an image */ -function makeImgLink($params, $img, $alt, $height = null, $width = null, $class = null) +function makeImgLink($params, $img, $alt, $height = null, $width = null, $class = null, $accesskey = null) { return makeHREF($params, makeImg($img, ' [' . $alt . ']', $height, $width), $alt, - $class); + $class, + $accesskey); } /******************************************************************************** diff --git a/banana/post.inc.php b/banana/post.inc.php index 3ee59cf..3db1818 100644 --- a/banana/post.inc.php +++ b/banana/post.inc.php @@ -360,18 +360,20 @@ class BananaPost { global $banana; $ret = '
'; - $actions = Array('nextUnread' => Array('next_unread', _b_('Message non-lu suivant')), - 'prevPost' => Array('prev', _b_('Article précédent')), - 'nextPost' => Array('next', _b_('Article suivant')), - 'prevThread' => Array('prev_thread', _b_('Discussion précédente')), - 'nextThread' => Array('next_thread', _b_('Discussion suivante'))); + $actions = Array('nextUnread' => Array('next_unread', _b_('Message non-lu suivant'), 'u'), + 'prevPost' => Array('prev', _b_('Article précédent'), 'a'), + 'nextPost' => Array('next', _b_('Article suivant'), 'z'), + 'prevThread' => Array('prev_thread', _b_('Discussion précédente'), 'q'), + 'nextThread' => Array('next_thread', _b_('Discussion suivante'), 's')); foreach ($actions as $method=>$params) { $id = $banana->spool->$method($this->id); if (!is_null($id)) { $ret .= makeImgLink(Array('group' => $banana->state['group'], 'artid' => $id), $params[0] . '.gif', - $params[1]); + $params[1], + null, null, null, + $params[2]); } } return $ret . '
'; @@ -416,19 +418,19 @@ class BananaPost . makeImgLink(Array('group' => $banana->state['group'], 'action' => 'new'), 'post.gif', - _b_('Nouveau message')) . ' ' + _b_('Nouveau message'), null, null, null, 'p') . ' ' . makeImgLink(Array('group' => $banana->state['group'], 'artid' => $this->id, 'action' => 'new'), 'reply.gif', - _b_('Répondre')); + _b_('Répondre'), null, null, null, 'r'); if ($this->checkCancel()) { $res .= ' ' . makeImgLink(Array('group' => $banana->state['group'], 'artid' => $this->id, 'action' => 'cancel'), 'cancel.gif', - _b_('Annuler')); + _b_('Annuler'), null, null, null, 'c'); } $res .= '' . formatDisplayHeader('subject', $this->headers['subject']) diff --git a/banana/spool.inc.php b/banana/spool.inc.php index 9b634a0..de4e598 100644 --- a/banana/spool.inc.php +++ b/banana/spool.inc.php @@ -397,13 +397,6 @@ class BananaSpool { $res = ''; - $new = '
' - . makeImgLink(Array('group' => $this->group, - 'action' => 'new'), - 'post.gif', - _b_('Nouveau message')); - $new .= '
'; - if (is_null($_ref)) { $next = $this->nextUnread(); if (!is_null($next)) { @@ -411,14 +404,14 @@ class BananaSpool . makeImgLink(Array('group' => $this->group, 'artid' => $next), 'next_unread.gif', - _b_('Message non-lu suivant')) + _b_('Message non-lu suivant'), null, null, null, 'u') . ''; } $new = '
' . makeImgLink(Array('group' => $this->group, 'action' => 'new'), 'post.gif', - _b_('Nouveau message')) + _b_('Nouveau message'), null, null, null, 'p') . '
'; $res .= '';
' . $next . _b_('Date') . '