15e6162e |
1 | <?php |
2 | |
3 | /** |
4 | * setup.php |
5 | * |
598294a7 |
6 | * This is a standard SquirrelMail 1.2 API for plugins. |
15e6162e |
7 | * |
4b4abf93 |
8 | * @copyright © 1999-2005 The SquirrelMail Project Team |
9 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License |
2a880038 |
10 | * @version $Id$ |
ea5f4b8e |
11 | * @package plugins |
12 | * @subpackage bug_report |
15e6162e |
13 | */ |
14 | |
ea5f4b8e |
15 | /** |
16 | * Initialize the bug report plugin |
17 | * @return void |
2a880038 |
18 | * @access private |
ea5f4b8e |
19 | */ |
d79e01f5 |
20 | function squirrelmail_plugin_init_bug_report() { |
21 | global $squirrelmail_plugin_hooks; |
22 | |
23 | $squirrelmail_plugin_hooks['menuline']['bug_report'] = 'bug_report_button'; |
d79e01f5 |
24 | $squirrelmail_plugin_hooks['loading_prefs']['bug_report'] = 'bug_report_load'; |
e1df9174 |
25 | $squirrelmail_plugin_hooks['optpage_loadhook_display']['bug_report'] = 'bug_report_block'; |
15e6162e |
26 | } |
27 | |
28 | |
2a880038 |
29 | /** |
30 | * Show the button in the main bar |
31 | * @access private |
32 | */ |
d79e01f5 |
33 | function bug_report_button() { |
ce68b76b |
34 | global $bug_report_visible; |
d79e01f5 |
35 | |
36 | if (! $bug_report_visible) { |
37 | return; |
38 | } |
39 | |
2a880038 |
40 | displayInternalLink('plugins/bug_report/bug_report.php', _("Bug"), ''); |
d79e01f5 |
41 | echo " \n"; |
15e6162e |
42 | } |
43 | |
2a880038 |
44 | /** |
45 | * Loads bug report options |
46 | * @access private |
47 | */ |
d79e01f5 |
48 | function bug_report_load() { |
49 | global $username, $data_dir; |
50 | global $bug_report_visible; |
15e6162e |
51 | |
e1df9174 |
52 | $bug_report_visible = (bool) getPref($data_dir, $username, 'bug_report_visible',false); |
15e6162e |
53 | } |
54 | |
2a880038 |
55 | /** |
e1df9174 |
56 | * Register bug report option block |
57 | * @since 1.5.1 |
2a880038 |
58 | * @access private |
59 | */ |
e1df9174 |
60 | function bug_report_block() { |
61 | global $optpage_data; |
62 | $optpage_data['grps']['bug_report'] = _("Bug Reports"); |
63 | $optionValues = array(); |
64 | // FIXME: option needs refresh in SMOPT_REFRESH_RIGHT |
65 | // (menulink is processed before options are saved/loaded) |
66 | $optionValues[] = array( |
67 | 'name' => 'bug_report_visible', |
68 | 'caption' => _("Show button in toolbar"), |
69 | 'type' => SMOPT_TYPE_BOOLEAN, |
70 | 'refresh' => SMOPT_REFRESH_ALL, |
71 | 'initial_value' => false |
72 | ); |
73 | $optpage_data['vals']['bug_report'] = $optionValues; |
15e6162e |
74 | } |
75 | |
f8a1ed5a |
76 | ?> |