MantisBT-Discord – Diff between revs 2 and 3
?pathlinks?
Rev 2 | Rev 3 | |||
---|---|---|---|---|
1 | <?php |
1 | <?php |
|
- | 2 | |
||
2 | /** |
3 | /** |
|
3 | * Discord Integration |
4 | * Discord Integration |
|
4 | * Copyright (C) 2014 Karim Ratib (karim.ratib@gmail.com) |
5 | * Copyright (C) 2014 Karim Ratib (karim.ratib@gmail.com) |
|
5 | * |
6 | * |
|
6 | * Discord Integration is free software; you can redistribute it and/or |
7 | * Discord Integration is free software; you can redistribute it and/or |
|
7 | * modify it under the terms of the GNU General Public License 2 |
8 | * modify it under the terms of the GNU General Public License 2 |
|
8 | * as published by the Free Software Foundation. |
9 | * as published by the Free Software Foundation. |
|
9 | * |
10 | * |
|
10 | * Discord Integration is distributed in the hope that it will be useful, |
11 | * Discord Integration is distributed in the hope that it will be useful, |
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | * GNU General Public License for more details. |
14 | * GNU General Public License for more details. |
|
14 | * |
15 | * |
|
15 | * You should have received a copy of the GNU General Public License |
16 | * You should have received a copy of the GNU General Public License |
|
16 | * along with Discord Integration; if not, write to the Free Software |
17 | * along with Discord Integration; if not, write to the Free Software |
|
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
|
18 | * or see http://www.gnu.org/licenses/. |
19 | * or see http://www.gnu.org/licenses/. |
|
19 | */ |
20 | */ |
|
20 | |
21 | |
|
21 | auth_reauthenticate( ); |
22 | auth_reauthenticate(); |
|
22 | access_ensure_global_level( config_get( 'manage_plugin_threshold' ) ); |
23 | access_ensure_global_level(config_get('manage_plugin_threshold')); |
|
23 | |
24 | |
|
24 | html_page_top( plugin_lang_get( 'title' ) ); |
25 | html_page_top(plugin_lang_get('title')); |
|
25 | |
26 | |
|
26 | print_manage_menu( ); |
27 | print_manage_menu(); |
|
27 | |
28 | |
|
28 | ?> |
29 | ?> |
|
29 | |
30 | |
|
30 | <br /> |
31 | <br /> |
|
31 | |
32 | |
|
32 | <form action="<?php echo plugin_page( 'config_edit' )?>" method="post"> |
33 | <form action="<?php echo plugin_page('config_edit') ?>" method="post"> |
|
33 | <?php echo form_security_field( 'plugin_Discord_config_edit' ) ?> |
34 | <?php echo form_security_field('plugin_Discord_config_edit') ?> |
|
34 | <table align="center" class="width75" cellspacing="1"> |
35 | <table class="width75" cellspacing="1"> |
|
35 | |
36 | |
|
36 | <tr> |
37 | <tr> |
|
37 | <td class="form-title" colspan="3"> |
38 | <td class="form-title" colspan="3"> |
|
38 | <?php echo plugin_lang_get( 'title' ) . ' : ' . plugin_lang_get( 'config' )?> |
39 | <?php echo plugin_lang_get('title') . ' : ' . plugin_lang_get('config') ?> |
|
39 | </td> |
40 | </td> |
|
40 | </tr> |
41 | </tr> |
|
41 | |
42 | |
|
42 | <tr <?php echo helper_alternate_class( )?>> |
43 | <tr <?php echo helper_alternate_class() ?>> |
|
43 | <td class="category"> |
44 | <td class="category"> |
|
44 | <?php echo plugin_lang_get( 'url_webhook' )?> |
45 | <?php echo plugin_lang_get('url_webhook') ?> |
|
45 | </td> |
46 | </td> |
|
46 | <td colspan="2"> |
47 | <td colspan="2"> |
|
47 | <input size="80" type="text" name="url_webhook" value="<?php echo plugin_config_get( 'url_webhook' )?>" /> |
48 | <input size="80" type="text" name="url_webhook" value="<?php echo plugin_config_get('url_webhook') ?>" /> |
|
48 | </td> |
49 | </td> |
|
49 | </tr> |
50 | </tr> |
|
50 | |
51 | |
|
51 | <tr <?php echo helper_alternate_class( )?>> |
52 | <tr <?php echo helper_alternate_class() ?>> |
|
52 | <td class="category"> |
53 | <td class="category"> |
|
53 | <?php echo plugin_lang_get( 'url_webhooks' )?> |
54 | <?php echo plugin_lang_get('url_webhooks') ?> |
|
54 | </td> |
55 | </td> |
|
55 | <td colspan="2"> |
56 | <td colspan="2"> |
|
56 | <p> |
57 | <p> |
|
57 | Specifies the mapping between Mantis project names and Discord webhooks. |
58 | Specifies the mapping between Mantis project names and Discord webhooks. |
|
58 | </p> |
59 | </p> |
|
59 | <p> |
60 | <p> |
|
60 | Option name is <strong>plugin_Discord_url_webhooks</strong> and is an array of 'Mantis project name' => 'Discord webhook'. |
61 | Option name is <strong>plugin_Discord_url_webhooks</strong> and is an array of 'Mantis project name' => 'Discord webhook'. |
|
61 | Array options must be set using the <a href="adm_config_report.php">Configuration Report</a> screen. |
62 | Array options must be set using the <a href="adm_config_report.php">Configuration Report</a> screen. |
|
- | 63 | The current value of this option is: |
||
62 | The current value of this option is:<pre><?php var_export(plugin_config_get( 'url_webhooks' ))?></pre> |
64 | <pre><?php var_export(plugin_config_get('url_webhooks')) ?></pre> |
|
63 | </p> |
65 | </p> |
|
64 | </td> |
66 | </td> |
|
65 | </tr> |
67 | </tr> |
|
66 | |
68 | |
|
67 | <!-- |
69 | <!-- |
|
68 | <tr <?php echo helper_alternate_class( )?>> |
70 | <tr <?php echo helper_alternate_class() ?>> |
|
69 | <td class="category"> |
71 | <td class="category"> |
|
70 | <?php echo plugin_lang_get( 'bot_name' )?> |
72 | <?php echo plugin_lang_get('bot_name') ?> |
|
71 | </td> |
73 | </td> |
|
72 | <td colspan="2"> |
74 | <td colspan="2"> |
|
73 | <input type="text" name="bot_name" value="<?php echo plugin_config_get( 'bot_name' )?>" /> |
75 | <input type="text" name="bot_name" value="<?php echo plugin_config_get('bot_name') ?>" /> |
|
74 | </td> |
76 | </td> |
|
75 | </tr> |
77 | </tr> |
|
76 | |
78 | |
|
77 | <tr <?php echo helper_alternate_class( )?>> |
79 | <tr <?php echo helper_alternate_class() ?>> |
|
78 | <td class="category"> |
80 | <td class="category"> |
|
79 | <?php echo plugin_lang_get( 'bot_icon' )?> |
81 | <?php echo plugin_lang_get('bot_icon') ?> |
|
80 | </td> |
82 | </td> |
|
81 | <td colspan="2"> |
83 | <td colspan="2"> |
|
82 | <p> |
84 | <p> |
|
83 | Can be either a URL pointing to small image or an emoji of the form :emoji:</br> |
85 | Can be either a URL pointing to small image or an emoji of the form :emoji:</br> |
|
84 | Defaults to the Mantis logo. |
86 | Defaults to the Mantis logo. |
|
85 | </p> |
87 | </p> |
|
86 | <input type="text" name="bot_icon" value="<?php echo plugin_config_get( 'bot_icon' )?>" /> |
88 | <input type="text" name="bot_icon" value="<?php echo plugin_config_get('bot_icon') ?>" /> |
|
87 | </td> |
89 | </td> |
|
88 | </tr> |
90 | </tr> |
|
89 | --> |
91 | --> |
|
90 | |
92 | |
|
91 | <tr <?php echo helper_alternate_class( )?>> |
93 | <tr <?php echo helper_alternate_class() ?>> |
|
92 | <td class="category"> |
94 | <td class="category"> |
|
93 | <?php echo plugin_lang_get( 'skip_bulk' )?> |
95 | <?php echo plugin_lang_get('skip_bulk') ?> |
|
94 | </td> |
96 | </td> |
|
95 | <td colspan="2"> |
97 | <td colspan="2"> |
|
96 | <input type="checkbox" name="skip_bulk" <?php if (plugin_config_get( 'skip_bulk' )) echo "checked"; ?> /> |
98 | <input type="checkbox" name="skip_bulk" <?php if (plugin_config_get('skip_bulk')) echo "checked"; ?> /> |
|
97 | </td> |
99 | </td> |
|
98 | </tr> |
100 | </tr> |
|
99 | |
101 | |
|
100 | <tr <?php echo helper_alternate_class( )?>> |
102 | <tr <?php echo helper_alternate_class() ?>> |
|
101 | <td class="category"> |
103 | <td class="category"> |
|
102 | <?php echo plugin_lang_get( 'link_names' )?> |
104 | <?php echo plugin_lang_get('link_names') ?> |
|
103 | </td> |
105 | </td> |
|
104 | <td colspan="2"> |
106 | <td colspan="2"> |
|
105 | <input type="checkbox" name="link_names" <?php if (plugin_config_get( 'link_names' )) echo "checked"; ?> /> |
107 | <input type="checkbox" name="link_names" <?php if (plugin_config_get('link_names')) echo "checked"; ?> /> |
|
106 | </td> |
108 | </td> |
|
107 | </tr> |
109 | </tr> |
|
108 | |
110 | |
|
109 | <!-- |
111 | <!-- |
|
110 | |
112 | |
|
111 | <tr <?php echo helper_alternate_class( )?>> |
113 | <tr <?php echo helper_alternate_class() ?>> |
|
112 | <td class="category"> |
114 | <td class="category"> |
|
113 | <?php echo plugin_lang_get( 'default_channel' )?> |
115 | <?php echo plugin_lang_get('default_channel') ?> |
|
114 | </td> |
116 | </td> |
|
115 | <td colspan="2"> |
117 | <td colspan="2"> |
|
116 | <input type="text" name="default_channel" value="<?php echo plugin_config_get( 'default_channel' )?>" /> |
118 | <input type="text" name="default_channel" value="<?php echo plugin_config_get('default_channel') ?>" /> |
|
117 | </td> |
119 | </td> |
|
118 | </tr> |
120 | </tr> |
|
119 | |
121 | |
|
120 | <tr <?php echo helper_alternate_class( )?>> |
122 | <tr <?php echo helper_alternate_class() ?>> |
|
121 | <td class="category"> |
123 | <td class="category"> |
|
122 | <?php echo plugin_lang_get( 'channels' )?> |
124 | <?php echo plugin_lang_get('channels') ?> |
|
123 | </td> |
125 | </td> |
|
124 | <td colspan="2"> |
126 | <td colspan="2"> |
|
125 | <p> |
127 | <p> |
|
126 | Specifies the mapping between Mantis project names and Discord #channels. |
128 | Specifies the mapping between Mantis project names and Discord #channels. |
|
127 | </p> |
129 | </p> |
|
128 | <p> |
130 | <p> |
|
129 | Option name is <strong>plugin_Discord_channels</strong> and is an array of 'Mantis project name' => 'Discord channel name'. |
131 | Option name is <strong>plugin_Discord_channels</strong> and is an array of 'Mantis project name' => 'Discord channel name'. |
|
130 | Array options must be set using the <a href="adm_config_report.php">Configuration Report</a> screen. |
132 | Array options must be set using the <a href="adm_config_report.php">Configuration Report</a> screen. |
|
131 | The current value of this option is:<pre><?php var_export(plugin_config_get( 'channels' ))?></pre> |
133 | The current value of this option is:<pre><?php var_export(plugin_config_get('channels')) ?></pre> |
|
132 | </p> |
134 | </p> |
|
133 | </td> |
135 | </td> |
|
134 | </tr> |
136 | </tr> |
|
135 | --> |
137 | --> |
|
136 | |
138 | |
|
137 | <tr <?php echo helper_alternate_class( )?>> |
139 | <tr <?php echo helper_alternate_class() ?>> |
|
138 | <td class="category"> |
140 | <td class="category"> |
|
139 | <?php echo plugin_lang_get( 'columns' )?> |
141 | <?php echo plugin_lang_get('columns') ?> |
|
140 | </td> |
142 | </td> |
|
141 | <td colspan="2"> |
143 | <td colspan="2"> |
|
142 | <p> |
144 | <p> |
|
143 | Specifies the bug fields that should be attached to the Discord notifications. |
145 | Specifies the bug fields that should be attached to the Discord notifications. |
|
144 | </p> |
146 | </p> |
|
145 | <p> |
147 | <p> |
|
146 | Option name is <strong>plugin_Discord_columns</strong> and is an array of bug column names. |
148 | Option name is <strong>plugin_Discord_columns</strong> and is an array of bug column names. |
|
147 | Array options must be set using the <a href="adm_config_report.php">Configuration Report</a> screen. |
149 | Array options must be set using the <a href="adm_config_report.php">Configuration Report</a> screen. |
|
148 | <?php |
150 | <?php |
|
149 | $t_columns = columns_get_all( $t_project_id ); |
151 | $t_columns = columns_get_all($t_project_id); |
|
150 | $t_all = implode( ', ', $t_columns ); |
152 | $t_all = implode(', ', $t_columns); |
|
151 | ?> |
153 | ?> |
|
152 | Available column names are:<div><textarea name="all_columns" readonly="readonly" cols="80" rows="5"><?php echo $t_all ?></textarea></div> |
154 | Available column names are:<div><textarea name="all_columns" readonly="readonly" cols="80" rows="5"><?php echo $t_all ?></textarea></div> |
|
- | 155 | The current value of this option is: |
||
153 | The current value of this option is:<pre><?php var_export(plugin_config_get( 'columns' ))?></pre> |
156 | <pre><?php var_export(plugin_config_get('columns')) ?></pre> |
|
154 | </p> |
157 | </p> |
|
155 | </td> |
158 | </td> |
|
156 | </tr> |
159 | </tr> |
|
157 | |
160 | |
|
158 | <tr <?php echo helper_alternate_class( )?>> |
161 | <tr <?php echo helper_alternate_class() ?>> |
|
159 | <td class="category"> |
162 | <td class="category"> |
|
160 | <?php echo plugin_lang_get( 'language' )?> |
163 | <?php echo plugin_lang_get('language') ?> |
|
161 | </td> |
164 | </td> |
|
162 | <td colspan="2"> |
165 | <td colspan="2"> |
|
163 | <input type="text" name="language" value="<?php echo plugin_config_get( 'language' )?>" /> |
166 | <input type="text" name="language" value="<?php echo plugin_config_get('language') ?>" /> |
|
164 | </td> |
167 | </td> |
|
165 | </tr> |
168 | </tr> |
|
166 | |
169 | |
|
167 | <tr> |
170 | <tr> |
|
168 | <td class="center" colspan="3"> |
171 | <td class="center" colspan="3"> |
|
169 | <input type="submit" class="button" value="<?php echo lang_get( 'change_configuration' )?>" /> |
172 | <input type="submit" class="button" value="<?php echo lang_get('change_configuration') ?>" /> |
|
170 | </td> |
173 | </td> |
|
171 | </tr> |
174 | </tr> |
|
172 | |
175 | |
|
173 | </table> |
176 | </table> |
|
174 | </form> |
177 | </form> |
|
175 | |
178 | |
|
176 | <?php |
179 | <?php |
|
177 | html_page_bottom(); |
180 | html_page_bottom(); |
|
178 | |
181 | |