MantisBT-Discord – Diff between revs 1 and 2
?pathlinks?
Rev 1 | Rev 2 | |||
---|---|---|---|---|
Line 1... | Line 1... | |||
1 | <?php |
1 | <?php |
|
2 | /** |
2 | /** |
|
3 | * Discord Integration |
3 | * Discord Integration |
|
4 | * Copyright (C) Robin van Nunen (robin@vnunen.nl) for Discord modification |
- | ||
5 | * Copyright (C) Karim Ratib (karim@meedan.com) for original source |
4 | * Copyright (C) 2014 Karim Ratib (karim.ratib@gmail.com) |
|
6 | * |
5 | * |
|
7 | * Discord Integration is free software; you can redistribute it and/or |
6 | * Discord Integration is free software; you can redistribute it and/or |
|
8 | * modify it under the terms of the GNU General Public License 2 |
7 | * modify it under the terms of the GNU General Public License 2 |
|
9 | * as published by the Free Software Foundation. |
8 | * as published by the Free Software Foundation. |
|
10 | * |
9 | * |
|
Line 17... | Line 16... | |||
17 | * along with Discord Integration; if not, write to the Free Software |
16 | * along with Discord Integration; if not, write to the Free Software |
|
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
|
19 | * or see http://www.gnu.org/licenses/. |
18 | * or see http://www.gnu.org/licenses/. |
|
20 | */ |
19 | */ |
|
Line 21... | Line 20... | |||
21 | |
20 | |
|
22 | form_security_validate('plugin_Discord_config'); |
21 | auth_reauthenticate( ); |
|
23 | access_ensure_global_level(config_get('manage_plugin_threshold')); |
- | ||
24 | /** |
- | ||
25 | * Sets plugin config option if value is different from current/default |
- | ||
26 | * |
- | ||
27 | * @param string $p_name option name |
- | ||
28 | * @param string $p_value value to set |
- | ||
29 | * |
- | ||
30 | * @return void |
- | ||
31 | */ |
- | ||
32 | function config_set_if_needed($p_name, $p_value) |
- | ||
33 | { |
- | ||
34 | if($p_value != plugin_config_get($p_name)) |
- | ||
35 | { |
- | ||
36 | plugin_config_set($p_name, $p_value); |
- | ||
37 | } |
- | ||
38 | } |
22 | access_ensure_global_level( config_get( 'manage_plugin_threshold' ) ); |
|
39 | |
23 | |
|
40 | $t_redirect_url = plugin_page('config_page', true); |
- | ||
41 | layout_page_header(null, $t_redirect_url); |
- | ||
42 | layout_page_begin(); |
- | ||
43 | |
- | ||
44 | config_set_if_needed('url_webhook', gpc_get_string('url_webhook')); |
- | ||
45 | config_set_if_needed('skip_bulk', gpc_get_bool('skip_bulk')); |
- | ||
46 | config_set_if_needed('link_names', gpc_get_bool('link_names')); |
- | ||
47 | config_set_if_needed('language', gpc_get_string('language')); |
- | ||
48 | |
- | ||
49 | config_set_if_needed('hook_bug_report', gpc_get_bool('hook_bug_report')); |
- | ||
50 | config_set_if_needed('hook_bug_update', gpc_get_bool('hook_bug_update')); |
- | ||
51 | config_set_if_needed('hook_bug_deleted', gpc_get_bool('hook_bug_deleted')); |
- | ||
52 | config_set_if_needed('hook_bugnote_add', gpc_get_bool('hook_bugnote_add')); |
- | ||
53 | config_set_if_needed('hook_bugnote_edit', gpc_get_bool('hook_bugnote_edit')); |
- | ||
Line 54... | Line 24... | |||
54 | config_set_if_needed('hook_bugnote_deleted', gpc_get_bool('hook_bugnote_deleted')); |
24 | html_page_top( plugin_lang_get( 'title' ) ); |
|
Line -... | Line 25... | |||
- | 25 | |
||
- | 26 | print_manage_menu( ); |
||
- | 27 | |
||
- | 28 | ?> |
||
- | 29 | |
||
- | 30 | <br /> |
||
- | 31 | |
||
- | 32 | <form action="<?php echo plugin_page( 'config_edit' )?>" method="post"> |
||
- | 33 | <?php echo form_security_field( 'plugin_Discord_config_edit' ) ?> |
||
- | 34 | <table align="center" class="width75" cellspacing="1"> |
||
- | 35 | |
||
- | 36 | <tr> |
||
- | 37 | <td class="form-title" colspan="3"> |
||
- | 38 | <?php echo plugin_lang_get( 'title' ) . ' : ' . plugin_lang_get( 'config' )?> |
||
- | 39 | </td> |
||
- | 40 | </tr> |
||
- | 41 | |
||
- | 42 | <tr <?php echo helper_alternate_class( )?>> |
||
- | 43 | <td class="category"> |
||
- | 44 | <?php echo plugin_lang_get( 'url_webhook' )?> |
||
- | 45 | </td> |
||
- | 46 | <td colspan="2"> |
||
- | 47 | <input size="80" type="text" name="url_webhook" value="<?php echo plugin_config_get( 'url_webhook' )?>" /> |
||
- | 48 | </td> |
||
- | 49 | </tr> |
||
- | 50 | |
||
- | 51 | <tr <?php echo helper_alternate_class( )?>> |
||
- | 52 | <td class="category"> |
||
- | 53 | <?php echo plugin_lang_get( 'url_webhooks' )?> |
||
- | 54 | </td> |
||
- | 55 | <td colspan="2"> |
||
- | 56 | <p> |
||
- | 57 | Specifies the mapping between Mantis project names and Discord webhooks. |
||
- | 58 | </p> |
||
- | 59 | <p> |
||
- | 60 | 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 | The current value of this option is:<pre><?php var_export(plugin_config_get( 'url_webhooks' ))?></pre> |
||
- | 63 | </p> |
||
- | 64 | </td> |
||
- | 65 | </tr> |
||
- | 66 | |
||
- | 67 | <!-- |
||
- | 68 | <tr <?php echo helper_alternate_class( )?>> |
||
- | 69 | <td class="category"> |
||
- | 70 | <?php echo plugin_lang_get( 'bot_name' )?> |
||
- | 71 | </td> |
||
- | 72 | <td colspan="2"> |
||
- | 73 | <input type="text" name="bot_name" value="<?php echo plugin_config_get( 'bot_name' )?>" /> |
||
- | 74 | </td> |
||
- | 75 | </tr> |
||
- | 76 | |
||
- | 77 | <tr <?php echo helper_alternate_class( )?>> |
||
- | 78 | <td class="category"> |
||
- | 79 | <?php echo plugin_lang_get( 'bot_icon' )?> |
||
- | 80 | </td> |
||
- | 81 | <td colspan="2"> |
||
- | 82 | <p> |
||
- | 83 | Can be either a URL pointing to small image or an emoji of the form :emoji:</br> |
||
- | 84 | Defaults to the Mantis logo. |
||
- | 85 | </p> |
||
- | 86 | <input type="text" name="bot_icon" value="<?php echo plugin_config_get( 'bot_icon' )?>" /> |
||
- | 87 | </td> |
||
- | 88 | </tr> |
||
- | 89 | --> |
||
- | 90 | |
||
- | 91 | <tr <?php echo helper_alternate_class( )?>> |
||
- | 92 | <td class="category"> |
||
- | 93 | <?php echo plugin_lang_get( 'skip_bulk' )?> |
||
- | 94 | </td> |
||
- | 95 | <td colspan="2"> |
||
- | 96 | <input type="checkbox" name="skip_bulk" <?php if (plugin_config_get( 'skip_bulk' )) echo "checked"; ?> /> |
||
- | 97 | </td> |
||
- | 98 | </tr> |
||
- | 99 | |
||
- | 100 | <tr <?php echo helper_alternate_class( )?>> |
||
- | 101 | <td class="category"> |
||
- | 102 | <?php echo plugin_lang_get( 'link_names' )?> |
||
- | 103 | </td> |
||
- | 104 | <td colspan="2"> |
||
- | 105 | <input type="checkbox" name="link_names" <?php if (plugin_config_get( 'link_names' )) echo "checked"; ?> /> |
||
- | 106 | </td> |
||
- | 107 | </tr> |
||
- | 108 | |
||
- | 109 | <!-- |
||
- | 110 | |
||
- | 111 | <tr <?php echo helper_alternate_class( )?>> |
||
- | 112 | <td class="category"> |
||
- | 113 | <?php echo plugin_lang_get( 'default_channel' )?> |
||
- | 114 | </td> |
||
- | 115 | <td colspan="2"> |
||
- | 116 | <input type="text" name="default_channel" value="<?php echo plugin_config_get( 'default_channel' )?>" /> |
||
- | 117 | </td> |
||
- | 118 | </tr> |
||
- | 119 | |
||
- | 120 | <tr <?php echo helper_alternate_class( )?>> |
||
- | 121 | <td class="category"> |
||
- | 122 | <?php echo plugin_lang_get( 'channels' )?> |
||
- | 123 | </td> |
||
- | 124 | <td colspan="2"> |
||
- | 125 | <p> |
||
- | 126 | Specifies the mapping between Mantis project names and Discord #channels. |
||
- | 127 | </p> |
||
- | 128 | <p> |
||
- | 129 | 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. |
||
- | 131 | The current value of this option is:<pre><?php var_export(plugin_config_get( 'channels' ))?></pre> |
||
- | 132 | </p> |
||
- | 133 | </td> |
||
- | 134 | </tr> |
||
- | 135 | --> |
||
- | 136 | |
||
- | 137 | <tr <?php echo helper_alternate_class( )?>> |
||
- | 138 | <td class="category"> |
||
- | 139 | <?php echo plugin_lang_get( 'columns' )?> |
||
- | 140 | </td> |
||
- | 141 | <td colspan="2"> |
||
- | 142 | <p> |
||
- | 143 | Specifies the bug fields that should be attached to the Discord notifications. |
||
- | 144 | </p> |
||
- | 145 | <p> |
||
55 | |
146 | 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. |
||
- | 148 | <?php |
||
- | 149 | $t_columns = columns_get_all( $t_project_id ); |
||
- | 150 | $t_all = implode( ', ', $t_columns ); |
||
- | 151 | ?> |
||
- | 152 | Available column names are:<div><textarea name="all_columns" readonly="readonly" cols="80" rows="5"><?php echo $t_all ?></textarea></div> |
||
- | 153 | The current value of this option is:<pre><?php var_export(plugin_config_get( 'columns' ))?></pre> |
||
- | 154 | </p> |
||
- | 155 | </td> |
||
- | 156 | </tr> |
||
- | 157 | |
||
- | 158 | <tr <?php echo helper_alternate_class( )?>> |
||
- | 159 | <td class="category"> |
||
- | 160 | <?php echo plugin_lang_get( 'language' )?> |
||
- | 161 | </td> |
||
- | 162 | <td colspan="2"> |
||
- | 163 | <input type="text" name="language" value="<?php echo plugin_config_get( 'language' )?>" /> |
||
- | 164 | </td> |
||
- | 165 | </tr> |
||
- | 166 | |
||
- | 167 | <tr> |
||
- | 168 | <td class="center" colspan="3"> |
||
- | 169 | <input type="submit" class="button" value="<?php echo lang_get( 'change_configuration' )?>" /> |
||
- | 170 | </td> |
||
- | 171 | </tr> |
||
- | 172 | |
||
- | 173 | </table> |
||
56 | form_security_purge('plugin_Discord_config'); |
174 | </form> |