/trunk/lang/strings_english.txt |
@@ -24,13 +24,14 @@ |
$s_plugin_Discord_config = 'Configuration'; |
$s_plugin_Discord_url_webhook = 'Default Discord Webhook URL'; |
$s_plugin_Discord_url_webhooks = 'Additional Discord Webhook URLs'; |
$s_plugin_Discord_bot_name = 'Discord Bot Name'; |
$s_plugin_Discord_bot_icon = 'Discord Bot Icon'; |
//$s_plugin_Discord_bot_name = 'Discord Bot Name'; |
//$s_plugin_Discord_bot_icon = 'Discord Bot Icon'; |
$s_plugin_Discord_skip_bulk = 'Skip notification on bulk actions'; |
$s_plugin_Discord_link_names = 'Turn user names into Discord links (may cause excess Discord notifications)'; |
$s_plugin_Discord_default_channel = 'Default Discord Channel'; |
$s_plugin_Discord_channels = 'Discord Channels'; |
$s_plugin_Discord_usernames = 'Discord Usernames'; |
//$s_plugin_Discord_default_channel = 'Default Discord Channel'; |
//$s_plugin_Discord_channels = 'Discord Channels'; |
//$s_plugin_Discord_usernames = 'Discord Usernames'; |
$s_plugin_Discord_language = 'Language'; |
$s_plugin_Discord_columns = 'Discord Columns'; |
$s_plugin_Discord_bug_created = '[%s] %s created <%s|%s>. (%s)'; |
$s_plugin_Discord_bug_updated = '[%s] %s updated <%s|%s>. (%s)'; |
/trunk/lang/strings_french.txt |
@@ -26,13 +26,14 @@ |
$s_plugin_Discord_config = 'Configuration'; |
$s_plugin_Discord_url_webhook = 'URL de webhook Discord de défaut'; |
$s_plugin_Discord_url_webhooks = 'URLs de webhook Discord additionnels'; |
$s_plugin_Discord_bot_name = 'Nom du bot Discord'; |
$s_plugin_Discord_bot_icon = 'Icône du bot Discord'; |
//$s_plugin_Discord_bot_name = 'Nom du bot Discord'; |
//$s_plugin_Discord_bot_icon = 'Icône du bot Discord'; |
$s_plugin_Discord_skip_bulk = 'Ne pas envoyer de notification pour les actions en bloc'; |
$s_plugin_Discord_link_names = 'Convertir les noms d\'utilisateurs en liens Discord (peut causer des notifications excessives dans Discord)'; |
$s_plugin_Discord_default_channel = 'Channel Discord de défault'; |
$s_plugin_Discord_channels = 'Correspondances des channels'; |
$s_plugin_Discord_usernames = 'Correspondances des noms d\'utilisateurs'; |
//$s_plugin_Discord_default_channel = 'Channel Discord de défault'; |
//$s_plugin_Discord_channels = 'Correspondances des channels'; |
//$s_plugin_Discord_usernames = 'Correspondances des noms d\'utilisateurs'; |
$s_plugin_Discord_language = 'Langue'; |
$s_plugin_Discord_columns = 'Champs de bogues'; |
$s_plugin_Discord_bug_created = '[%s] %s a crée <%s|%s>. (%s)'; |
$s_plugin_Discord_bug_updated = '[%s] %s a modifié <%s|%s>. (%s)'; |
/trunk/lang/strings_russian.txt |
@@ -25,13 +25,14 @@ |
$s_plugin_Discord_config = 'Настройка'; |
$s_plugin_Discord_url_webhook = 'Discord Webhook URL по умолчанию'; |
$s_plugin_Discord_url_webhooks = 'Доплнительные Discord Webhook URLы'; |
$s_plugin_Discord_bot_name = 'Имя Discord-бота'; |
$s_plugin_Discord_bot_icon = 'Иконка Discord-бота'; |
//$s_plugin_Discord_bot_name = 'Имя Discord-бота'; |
//$s_plugin_Discord_bot_icon = 'Иконка Discord-бота'; |
$s_plugin_Discord_skip_bulk = 'Пропускать оповещения о групповых действиях'; |
$s_plugin_Discord_link_names = 'Делать имена пользователей ссылками (это может привести к большому количеству оповещений Discord)'; |
$s_plugin_Discord_default_channel = 'Каналы Discord по умолчанию'; |
$s_plugin_Discord_channels = 'Каналы Discord'; |
$s_plugin_Discord_usernames = 'Пользователи Discord'; |
//$s_plugin_Discord_default_channel = 'Каналы Discord по умолчанию'; |
//$s_plugin_Discord_channels = 'Каналы Discord'; |
//$s_plugin_Discord_usernames = 'Пользователи Discord'; |
$s_plugin_Discord_language = 'язык'; |
$s_plugin_Discord_columns = 'Колонки Discord'; |
$s_plugin_Discord_bug_created = '[%s] %s создал <%s|%s>. (%s)'; |
$s_plugin_Discord_bug_updated = '[%s] %s изменил <%s|%s>. (%s)'; |
/trunk/pages/config.php |
@@ -1,8 +1,7 @@ |
<?php |
/** |
* Discord Integration |
* Copyright (C) Robin van Nunen (robin@vnunen.nl) for Discord modification |
* Copyright (C) Karim Ratib (karim@meedan.com) for original source |
* Copyright (C) 2014 Karim Ratib (karim.ratib@gmail.com) |
* |
* Discord Integration is free software; you can redistribute it and/or |
* modify it under the terms of the GNU General Public License 2 |
@@ -19,41 +18,160 @@ |
* or see http://www.gnu.org/licenses/. |
*/ |
|
form_security_validate('plugin_Discord_config'); |
auth_reauthenticate( ); |
access_ensure_global_level(config_get('manage_plugin_threshold')); |
/** |
* Sets plugin config option if value is different from current/default |
* |
* @param string $p_name option name |
* @param string $p_value value to set |
* |
* @return void |
*/ |
function config_set_if_needed($p_name, $p_value) |
{ |
if($p_value != plugin_config_get($p_name)) |
{ |
plugin_config_set($p_name, $p_value); |
} |
} |
|
$t_redirect_url = plugin_page('config_page', true); |
layout_page_header(null, $t_redirect_url); |
layout_page_begin(); |
html_page_top( plugin_lang_get( 'title' ) ); |
|
config_set_if_needed('url_webhook', gpc_get_string('url_webhook')); |
config_set_if_needed('skip_bulk', gpc_get_bool('skip_bulk')); |
config_set_if_needed('link_names', gpc_get_bool('link_names')); |
config_set_if_needed('language', gpc_get_string('language')); |
print_manage_menu( ); |
|
config_set_if_needed('hook_bug_report', gpc_get_bool('hook_bug_report')); |
config_set_if_needed('hook_bug_update', gpc_get_bool('hook_bug_update')); |
config_set_if_needed('hook_bug_deleted', gpc_get_bool('hook_bug_deleted')); |
config_set_if_needed('hook_bugnote_add', gpc_get_bool('hook_bugnote_add')); |
config_set_if_needed('hook_bugnote_edit', gpc_get_bool('hook_bugnote_edit')); |
config_set_if_needed('hook_bugnote_deleted', gpc_get_bool('hook_bugnote_deleted')); |
?> |
|
form_security_purge('plugin_Discord_config'); |
<br /> |
|
html_operation_successful($t_redirect_url); |
layout_page_end(); |
<form action="<?php echo plugin_page( 'config_edit' )?>" method="post"> |
<?php echo form_security_field( 'plugin_Discord_config_edit' ) ?> |
<table align="center" class="width75" cellspacing="1"> |
|
<tr> |
<td class="form-title" colspan="3"> |
<?php echo plugin_lang_get( 'title' ) . ' : ' . plugin_lang_get( 'config' )?> |
</td> |
</tr> |
|
<tr <?php echo helper_alternate_class( )?>> |
<td class="category"> |
<?php echo plugin_lang_get( 'url_webhook' )?> |
</td> |
<td colspan="2"> |
<input size="80" type="text" name="url_webhook" value="<?php echo plugin_config_get( 'url_webhook' )?>" /> |
</td> |
</tr> |
|
<tr <?php echo helper_alternate_class( )?>> |
<td class="category"> |
<?php echo plugin_lang_get( 'url_webhooks' )?> |
</td> |
<td colspan="2"> |
<p> |
Specifies the mapping between Mantis project names and Discord webhooks. |
</p> |
<p> |
Option name is <strong>plugin_Discord_url_webhooks</strong> and is an array of 'Mantis project name' => 'Discord webhook'. |
Array options must be set using the <a href="adm_config_report.php">Configuration Report</a> screen. |
The current value of this option is:<pre><?php var_export(plugin_config_get( 'url_webhooks' ))?></pre> |
</p> |
</td> |
</tr> |
|
<!-- |
<tr <?php echo helper_alternate_class( )?>> |
<td class="category"> |
<?php echo plugin_lang_get( 'bot_name' )?> |
</td> |
<td colspan="2"> |
<input type="text" name="bot_name" value="<?php echo plugin_config_get( 'bot_name' )?>" /> |
</td> |
</tr> |
|
<tr <?php echo helper_alternate_class( )?>> |
<td class="category"> |
<?php echo plugin_lang_get( 'bot_icon' )?> |
</td> |
<td colspan="2"> |
<p> |
Can be either a URL pointing to small image or an emoji of the form :emoji:</br> |
Defaults to the Mantis logo. |
</p> |
<input type="text" name="bot_icon" value="<?php echo plugin_config_get( 'bot_icon' )?>" /> |
</td> |
</tr> |
--> |
|
<tr <?php echo helper_alternate_class( )?>> |
<td class="category"> |
<?php echo plugin_lang_get( 'skip_bulk' )?> |
</td> |
<td colspan="2"> |
<input type="checkbox" name="skip_bulk" <?php if (plugin_config_get( 'skip_bulk' )) echo "checked"; ?> /> |
</td> |
</tr> |
|
<tr <?php echo helper_alternate_class( )?>> |
<td class="category"> |
<?php echo plugin_lang_get( 'link_names' )?> |
</td> |
<td colspan="2"> |
<input type="checkbox" name="link_names" <?php if (plugin_config_get( 'link_names' )) echo "checked"; ?> /> |
</td> |
</tr> |
|
<!-- |
|
<tr <?php echo helper_alternate_class( )?>> |
<td class="category"> |
<?php echo plugin_lang_get( 'default_channel' )?> |
</td> |
<td colspan="2"> |
<input type="text" name="default_channel" value="<?php echo plugin_config_get( 'default_channel' )?>" /> |
</td> |
</tr> |
|
<tr <?php echo helper_alternate_class( )?>> |
<td class="category"> |
<?php echo plugin_lang_get( 'channels' )?> |
</td> |
<td colspan="2"> |
<p> |
Specifies the mapping between Mantis project names and Discord #channels. |
</p> |
<p> |
Option name is <strong>plugin_Discord_channels</strong> and is an array of 'Mantis project name' => 'Discord channel name'. |
Array options must be set using the <a href="adm_config_report.php">Configuration Report</a> screen. |
The current value of this option is:<pre><?php var_export(plugin_config_get( 'channels' ))?></pre> |
</p> |
</td> |
</tr> |
--> |
|
<tr <?php echo helper_alternate_class( )?>> |
<td class="category"> |
<?php echo plugin_lang_get( 'columns' )?> |
</td> |
<td colspan="2"> |
<p> |
Specifies the bug fields that should be attached to the Discord notifications. |
</p> |
<p> |
Option name is <strong>plugin_Discord_columns</strong> and is an array of bug column names. |
Array options must be set using the <a href="adm_config_report.php">Configuration Report</a> screen. |
<?php |
$t_columns = columns_get_all( $t_project_id ); |
$t_all = implode( ', ', $t_columns ); |
?> |
Available column names are:<div><textarea name="all_columns" readonly="readonly" cols="80" rows="5"><?php echo $t_all ?></textarea></div> |
The current value of this option is:<pre><?php var_export(plugin_config_get( 'columns' ))?></pre> |
</p> |
</td> |
</tr> |
|
<tr <?php echo helper_alternate_class( )?>> |
<td class="category"> |
<?php echo plugin_lang_get( 'language' )?> |
</td> |
<td colspan="2"> |
<input type="text" name="language" value="<?php echo plugin_config_get( 'language' )?>" /> |
</td> |
</tr> |
|
<tr> |
<td class="center" colspan="3"> |
<input type="submit" class="button" value="<?php echo lang_get( 'change_configuration' )?>" /> |
</td> |
</tr> |
|
</table> |
</form> |
|
<?php |
html_page_bottom(); |
/trunk/pages/config_edit.php |
@@ -0,0 +1,64 @@ |
<?php |
/** |
* Discord Integration |
* Copyright (C) 2014 Karim Ratib (karim.ratib@gmail.com) |
* |
* Discord Integration is free software; you can redistribute it and/or |
* modify it under the terms of the GNU General Public License 2 |
* as published by the Free Software Foundation. |
* |
* Discord Integration is distributed in the hope that it will be useful, |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
* GNU General Public License for more details. |
* |
* You should have received a copy of the GNU General Public License |
* along with Discord Integration; if not, write to the Free Software |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
* or see http://www.gnu.org/licenses/. |
*/ |
|
form_security_validate( 'plugin_Discord_config_edit' ); |
|
auth_reauthenticate( ); |
access_ensure_global_level( config_get( 'manage_plugin_threshold' ) ); |
|
$f_url_webhook = gpc_get_string( 'url_webhook' ); |
#$f_bot_name = gpc_get_string( 'bot_name' ); |
#$f_bot_icon = gpc_get_string( 'bot_icon' ); |
$f_skip_bulk = gpc_get_bool( 'skip_bulk' ); |
$f_link_names = gpc_get_bool( 'link_names' ); |
#$f_default_channel = gpc_get_string( 'default_channel' ); |
$f_language = gpc_get_string( 'language' ); |
|
if( plugin_config_get( 'url_webhook' ) != $f_url_webhook ) { |
plugin_config_set( 'url_webhook', $f_url_webhook ); |
} |
|
#if( plugin_config_get( 'bot_name' ) != $f_bot_name ) { |
# plugin_config_set( 'bot_name', $f_bot_name ); |
#} |
|
#if( plugin_config_get( 'bot_icon' ) != $f_bot_icon ) { |
# plugin_config_set( 'bot_icon', $f_bot_icon ); |
#} |
|
if( plugin_config_get( 'skip_bulk' ) != $f_skip_bulk ) { |
plugin_config_set( 'skip_bulk', $f_skip_bulk ); |
} |
|
if( plugin_config_get( 'link_names' ) != $f_link_names ) { |
plugin_config_set( 'link_names', $f_link_names ); |
} |
|
#if( plugin_config_get( 'default_channel' ) != $f_default_channel ) { |
# plugin_config_set( 'default_channel', $f_default_channel ); |
#} |
|
if( plugin_config_get( 'language' ) != $f_language ) { |
plugin_config_set( 'language', $f_language ); |
} |
|
form_security_purge( 'plugin_Discord_config_edit' ); |
|
print_successful_redirect( plugin_page( 'config', true ) ); |