MantisBT-Discord – Rev 1

Subversion Repositories:
Rev:
<?php
/**
 * Discord Integration
 * Copyright (C) Robin van Nunen (robin@vnunen.nl) for Discord modification
 * Copyright (C) Karim Ratib (karim@meedan.com) for original source
 *
 * 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/.
 */

access_ensure_global_level( config_get( 'manage_plugin_threshold' ) );

layout_page_header( plugin_lang_get( 'title' ) );

layout_page_begin( 'manage_overview_page.php' );

print_manage_menu( 'manage_plugin_page.php' );

?>

<div class="col-md-12 col-xs-12">
<div class="space-10"></div>
<div class="form-container">
<form action="<?php echo plugin_page( 'config' ) ?>" method="post">
<fieldset>
<div class="widget-box widget-color-blue2">
<div class="widget-header widget-header-small">
    <h4 class="widget-title lighter">
        <i class="ace-icon fa fa-exchange"></i>
        <?php echo plugin_lang_get( 'title' ) ?>
    </h4>
</div>

<?php echo form_security_field( 'plugin_Discord_config' ) ?>
<div class="widget-body">
<div class="widget-main no-padding">
<div class="table-responsive">
<table class="table table-bordered table-condensed table-striped">

    <tr>
        <td class="category">
            <?php echo plugin_lang_get( 'url_webhook' ) ?>
        </td>
        <td>
            <input size="80" type="text" name="url_webhook" value="<?php echo plugin_config_get( 'url_webhook' )?>" />
        </td>
    </tr>

    <tr>
      <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>
      <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>
      <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>
        <td class="category">
            <?php echo lang_get( 'language' ) ?>
        </td>
        <td>
            <select id="language" name="language" class="input-sm">
                <?php print_language_option_list( plugin_config_get('language') ) ?>
            </select>
        </td>
    </tr>

    <tr>
        <td class="category">
            <?php echo plugin_lang_get( 'actions' ) ?>
        </td>
        <td>
            <table>
                <thead>
                <tr>
                    <th style="width: 64px; text-align: center;"><?=plugin_lang_get('enabled')?></th>
                    <th><?=plugin_lang_get('action')?></th>
                </tr>
                </thead>
                <tbody>
                <?php
                foreach(['hook_bug_report', 'hook_bug_update', 'hook_bug_deleted', 'hook_bugnote_add', 'hook_bugnote_edit', 'hook_bugnote_deleted'] as $name)
                {
                    echo '
                        <tr>
                            <td style="text-align: center;"><input type="checkbox" id="' . $name . '" name="' . $name . '" ' . (plugin_config_get($name) ? 'checked' : '') . '/></td>
                            <td><label for="' . $name . '">' . plugin_lang_get($name) . '</label></td>
                        </tr>';
                }
                ?>
                </tbody>
            </table>
        </td>
    </tr>

    <tr>
      <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 echo preg_replace('/[0-9]+ => /', '', var_export(plugin_config_get( 'columns' ), true)) ?></pre>
        </p>
      </td>
    </tr>

    <tr>
      <td class="category">
        <?php echo plugin_lang_get( 'usernames' )?>
      </td>
      <td  colspan="2">
        <p>
          Specifies the mapping between Mantis and Discord user names.
        </p>
        <p>
          Option name is <strong>plugin_Discord_usernames</strong> and is an array of 'Mantis user name' => 'Discord user 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( 'usernames' ))?></pre>
        </p>
      </td>
    </tr>

</table>
</div>
</div>
<div class="widget-toolbox padding-8 clearfix">
    <input type="submit" class="btn btn-primary btn-white btn-round" value="<?php echo plugin_lang_get( 'action_update' ) ?>" />
</div>
</div>
</div>
</fieldset>
</form>
</div>
</div>

<?php
layout_page_end();