forked from kostajh/chbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
chbox.php
80 lines (72 loc) · 4.1 KB
/
chbox.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
/**
* Check box plugin
*
*
* @version 0.2.4
* @author Denis Sobolev
*/
class chbox extends rcube_plugin {
public $task = 'mail';
function init() {
$rcmail = rcmail::get_instance();
if (($rcmail->task == 'mail') && ($rcmail->action == '')) {
$this->add_hook('render_page', array($this, 'select_menu'));
$this->add_hook('render_page', array($this, 'startup_chbox'));
$this->include_script('chbox.js');
}
$this->add_hook('messages_list', array($this, 'message_list'));
}
function startup_chbox($args){
$this->add_texts('localization');
$rcmail = rcmail::get_instance();
$icon = 'plugins/chbox/' .$this->local_skin_path(). '/columncheck.png';
$chboxicon = html::img(array('src' => $icon, 'id' => 'selectmenulink', 'title' => $this->gettext('chbox'), 'alt' => $this->gettext('chbox')));
$rcmail->output->add_label('chbox.chbox');
$rcmail->output->set_env('chboxicon', $chboxicon);
$this->include_stylesheet($this->local_skin_path(). '/chbox.css');
$this->include_script($this->local_skin_path(). '/chbox.js');
return $args;
}
function message_list($args){
if (is_array($args['messages'])) {
$count = count($args['messages']);
} else {
$count = 0;
}
for ($i=0;$i<$count;$i++) {
$uid = $args['messages'][$i]->uid;
if(!empty($uid))
$tmp = $args['messages'][$i]->list_cols['chbox'];
$args['messages'][$i]->list_cols['chbox'] = '<span id="msgicnrcmrowMTExOTg" class="msgicon" title=""></span>'
. '<input type="checkbox" name="rcmselect'.$uid.'" id="rcmselect'.$uid.'" />';
}
return $args;
}
function select_menu() {
$rcmail = rcmail::get_instance();
$skin = $rcmail->config->get('skin');
if ($skin == 'classic' or $skin == 'default') {
$out .= "<div id=\"selectmenu\" class=\"popupmenu\">
<ul>
<li><a title=\"".rcmail::get_instance()->gettext('all')."\" href=\"#\" onclick=\"return rcmail.command('select-all','',this)\" class=\"active\">".rcmail::get_instance()->gettext('all')."</a></li>
<li><a title=\"".rcmail::get_instance()->gettext('currpage')."\" href=\"#\" onclick=\"return rcmail.command('select-all','page',this)\" class=\"active\">".rcmail::get_instance()->gettext('currpage')."</a></li>
<li><a title=\"".rcmail::get_instance()->gettext('unread')."\" href=\"#\" onclick=\"return rcmail.command('select-all','unread',this)\" class=\"active\">".rcmail::get_instance()->gettext('unread')."</a></li>
<li><a title=\"".rcmail::get_instance()->gettext('invert')."\" href=\"#\" onclick=\"return rcmail.command('select-all','invert',this)\" class=\"active\">".rcmail::get_instance()->gettext('invert')."</a></li>
<li><a title=\"".rcmail::get_instance()->gettext('none')."\" href=\"#\" onclick=\"return rcmail.command('select-none','',this)\" class=\"active\">".rcmail::get_instance()->gettext('none')."</a></li>
</ul>";
} else {
$out .="<div id=\"selectmenu\" class=\"popupmenu dropdown\">
<ul>
<li title=\"".rcmail::get_instance()->gettext('all')."\" onclick=\"return rcmail.command('select-all','',this)\" class=\"active\">".rcmail::get_instance()->gettext('all')."</li>
<li title=\"".rcmail::get_instance()->gettext('currpage')."\" onclick=\"return rcmail.command('select-all','page',this)\" class=\"active\">".rcmail::get_instance()->gettext('currpage')."</li>
<li title=\"".rcmail::get_instance()->gettext('unread')."\" onclick=\"return rcmail.command('select-all','unread',this)\" class=\"active\">".rcmail::get_instance()->gettext('unread')."</li>
<li title=\"".rcmail::get_instance()->gettext('invert')."\" onclick=\"return rcmail.command('select-all','invert',this)\" class=\"active\">".rcmail::get_instance()->gettext('invert')."</li>
<li title=\"".rcmail::get_instance()->gettext('none')."\" onclick=\"return rcmail.command('select-none','',this)\" class=\"active\">".rcmail::get_instance()->gettext('none')."</li>
</ul>";
}
$out .= "</div>";
$rcmail->output->add_gui_object('selectmenu', 'selectmenu');
$rcmail->output->add_footer($out);
}
}