From 59478e06c25303a790a0840ab2ac30662c4ef781 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Tue, 5 Aug 2014 16:46:22 +0200 Subject: c'est la merde.. --- plugins/keyboard_shortcuts/keyboard_shortcuts.php | 130 ++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 plugins/keyboard_shortcuts/keyboard_shortcuts.php (limited to 'plugins/keyboard_shortcuts/keyboard_shortcuts.php') diff --git a/plugins/keyboard_shortcuts/keyboard_shortcuts.php b/plugins/keyboard_shortcuts/keyboard_shortcuts.php new file mode 100644 index 000000000..3599c7b2f --- /dev/null +++ b/plugins/keyboard_shortcuts/keyboard_shortcuts.php @@ -0,0 +1,130 @@ + + * @licence GNU GPL + * + **/ + /** * + **/ + +/** + * Shortcuts, list view: + * ?: Show shortcut help + * a: Select all visible messages + * A: Mark all as read (as Google Reader) + * c: Compose new message + * d: Delete message + * f: Forward message + * j: Go to previous page of messages (as Gmail) + * k: Go to next page of messages (as Gmail) + * p: Print message + * r: Reply to message + * R: Reply to all of message + * s: Jump to quicksearch + * u: Check for new mail (update) + * + * Shortcuts, threads view: + * E: Expand all + * C: Collapse all + * U: Expand Unread + * + * Shortcuts, mail view: + * d: Delete message + * f: Forward message + * j: Go to previous message (as Gmail) + * k: Go to next message (as Gmail) + * p: Print message + * r: Reply to message + * R: Reply to all of message + */ + +class keyboard_shortcuts extends rcube_plugin +{ + public $task = 'mail'; + + function init() + { + // only init in authenticated state and if newuserdialog is finished + // do not init on compose (css incompatibility with compose_addressbook plugin + $rcmail = rcmail::get_instance(); + $this->require_plugin('jqueryui'); + + if($_SESSION['username'] && empty($_SESSION['plugin.newuserdialog']) && $rcmail->action != 'compose'){ + $this->include_stylesheet('keyboard_shortcuts.css'); + $this->include_script('keyboard_shortcuts.js'); + $this->add_hook('template_container', array($this, 'html_output')); + $this->add_texts('localization', true); + } + } + + function html_output($p) { + if ($p['name'] == "listcontrols") { + $rcmail = rcmail::get_instance(); + $skin = $rcmail->config->get('skin'); + + if(!file_exists('plugins/keyboard_shortcuts/skins/' . $skin . '/images/keyboard.png')){ + $skin = "default"; + } + + $this->load_config(); + $keyboard_shortcuts = $rcmail->config->get('keyboard_shortcuts_extras', array()); + + $c = ""; + $c .= '' . $this->gettext("title") . ": ".$this->gettext("keyboard_shortcuts")." ".$this->gettext("show")."\n"; + $c .= "
"; + $c .= "

".$this->gettext("mailboxview")."

"; + $c .= "
?
".$this->gettext('help')."
"; + $c .= "
a
".$this->gettext('selectallvisiblemessages')."
"; + $c .= "
A
".$this->gettext('markallvisiblemessagesasread')."
"; + $c .= "
c
".$this->gettext('compose')."
"; + $c .= "
d
".$this->gettext('deletemessage')."
"; + $c .= "
f
".$this->gettext('forwardmessage')."
"; + $c .= "
j
".$this->gettext('previouspage')."
"; + $c .= "
k
".$this->gettext('nextpage')."
"; + $c .= "
p
".$this->gettext('printmessage')."
"; + $c .= "
r
".$this->gettext('replytomessage')."
"; + $c .= "
R
".$this->gettext('replytoallmessage')."
"; + $c .= "
s
".$this->gettext('quicksearch')."
"; + $c .= "
u
".$this->gettext('checkmail')."
"; + $c .= "

"; + $c .= "
"; + + if(!is_object($rcmail->imap)){ + $rcmail->imap_connect(); + } + $threading_supported = $rcmail->imap->get_capability('thread=references') + || $rcmail->imap->get_capability('thread=orderedsubject') + || $rcmail->imap->get_capability('thread=refs'); + + if ($threading_supported) { + $c .= "

".$this->gettext("threads")."

"; + $c .= "
E
".$this->gettext('expand-all')."
"; + $c .= "
C
".$this->gettext('collapse-all')."
"; + $c .= "
U
".$this->gettext('expand-unread')."
"; + $c .= "

"; + $c .= "
"; + } + $c .= "

".$this->gettext("messagesdisplaying")."

"; + $c .= "
d
".$this->gettext('deletemessage')."
"; + $c .= "
c
".$this->gettext('compose')."
"; + $c .= "
f
".$this->gettext('forwardmessage')."
"; + $c .= "
j
".$this->gettext('previousmessage')."
"; + $c .= "
k
".$this->gettext('nextmessage')."
"; + $c .= "
p
".$this->gettext('printmessage')."
"; + $c .= "
r
".$this->gettext('replytomessage')."
"; + $c .= "
R
".$this->gettext('replytoallmessage')."
"; + $c .= "

"; + $c .= "
"; + + $rcmail->output->set_env('ks_functions', array('63' => 'ks_help')); + + $p['content'] = $c . $p['content']; + } + return $p; + } +} -- cgit v1.2.3