phpbb-extensions/boardrules

View on GitHub
adm/style/boardrules_manage.html

Summary

Maintainability
Test Coverage
{% INCLUDE 'overall_header.html' %}

{% if S_ADD_RULE or S_EDIT_RULE %}

    <script>
        var form_name = 'add_edit_rule';
        var text_name = 'rule_message';
        var load_draft = false;
        var upload = false;
        var imageTag = false;
    </script>

    <a id="maincontent"></a>

    <a href="{{ U_BACK }}" style="float: {{ S_CONTENT_FLOW_END }};">&laquo; {{ lang('BACK') }}</a>

    {% if S_ADD_RULE %}
        <h1>{{ lang('ACP_BOARDRULES_CREATE_RULE') }} :: {{ RULE_TITLE }}</h1>

        <p>{{ lang('ACP_BOARDRULES_CREATE_RULE_EXPLAIN') }}</p>
    {% else %}
        <h1>{{ lang('ACP_BOARDRULES_EDIT_RULE') }} :: {{ RULE_TITLE }}</h1>

        <p>{{ lang('ACP_BOARDRULES_EDIT_RULE_EXPLAIN') }}</p>
    {% endif %}

    {% if S_ERROR %}
    <div class="errorbox">
        <h3>{{ lang('WARNING') }}</h3>
        <p>{{ ERROR_MSG }}</p>
    </div>
    {% endif %}

    {% if S_PREVIEW %}
    <fieldset>
        <legend>{{ lang('PREVIEW') ~ lang('COLON') }} {{ RULE_TITLE_PREVIEW }}</legend>
        {{ RULE_MESSAGE_PREVIEW }}
    </fieldset>
    {% endif %}

    <form id="add_edit_rule" method="post" action="{% if S_ADD_RULE %}{{ U_ADD_ACTION }}{% else %}{{ U_EDIT_ACTION }}{% endif %}">
        <fieldset>
            <legend>{{ lang('ACP_RULE_SETTINGS') }}</legend>
            <dl>
                <dt><label for="rule_parent">{{ lang('ACP_RULE_PARENT') ~ lang('COLON') }}</label></dt>
                <dd><select id="rule_parent" name="rule_parent">
                    <option value="0">{{ lang('ACP_RULE_NO_PARENT') }}</option>
                    {% for rulemenu in loops.rulemenu %}
                        <option value="{{ rulemenu.RULE_ID }}"{% if rulemenu.S_RULE_PARENT %} selected="selected"{% endif %}{% if rulemenu.S_DISABLED %} disabled="disabled" class="disabled-option"{% endif %}>{{ rulemenu.RULE_TITLE }}</option>
                    {% endfor %}
                </select></dd>
            </dl>
            <dl>
                <dt><label for="rule_title">{{ lang('ACP_RULE_TITLE') ~ lang('COLON') }}</label><br><span>{{ lang('ACP_RULE_TITLE_EXPLAIN') }}</span></dt>
                <dd><input class="text medium" type="text" id="rule_title" name="rule_title" value="{{ RULE_TITLE }}" maxlength="200"></dd>
            </dl>
            <dl>
                <dt><label for="rule_anchor">{{ lang('ACP_RULE_ANCHOR') ~ lang('COLON') }}</label><br><span>{{ lang('ACP_RULE_ANCHOR_EXPLAIN') }}</span></dt>
                <dd><input class="text medium" type="text" id="rule_anchor" name="rule_anchor" value="{{ RULE_ANCHOR }}" maxlength="255"></dd>
            </dl>
        </fieldset>

        <fieldset>
            <legend>{{ lang('ACP_RULE_MESSAGE') }}</legend>
            {% if S_IS_CATEGORY %}
                <p>{{ lang('ACP_RULE_MESSAGE_DISABLED') }}</p>
            {% else %}
                <p>{{ lang('ACP_RULE_MESSAGE_EXPLAIN') }}</p>
                {% INCLUDE 'acp_posting_buttons.html' %}
                <dl class="responsive-columns">
                    <dt style="width: 90px;" id="color_palette_placeholder" data-orientation="v" data-color-palette="v" data-height="12" data-width="15" data-bbcode="true"></dt>
                    <dd style="margin-{{ S_CONTENT_FLOW_BEGIN }}: 90px;">
                        <label>
                            <textarea name="rule_message" rows="10" cols="60" style="width: 95%;" data-bbcode="true">{{ RULE_MESSAGE }}</textarea>
                        </label>
                    </dd>
                    <dd style="margin-{{ S_CONTENT_FLOW_BEGIN }}: 90px; margin-top: 5px;">
                        {% if S_BBCODE_ALLOWED %}
                            <label><input type="checkbox" class="radio" name="disable_bbcode"{% if S_BBCODE_DISABLE_CHECKED and (S_PREVIEW or not S_ADD_RULE) %} checked="checked"{% endif %}> {{ lang('DISABLE_BBCODE') }}</label>
                        {% endif %}
                        {% if S_SMILIES_ALLOWED %}
                            <label><input type="checkbox" class="radio" name="disable_smilies"{% if S_SMILIES_DISABLE_CHECKED and (S_PREVIEW or not S_ADD_RULE) %} checked="checked"{% endif %}> {{ lang('DISABLE_SMILIES') }}</label>
                        {% endif %}
                        {% if S_LINKS_ALLOWED %}
                            <label><input type="checkbox" class="radio" name="disable_magic_url"{% if S_MAGIC_URL_DISABLE_CHECKED and (S_PREVIEW or not S_ADD_RULE) %} checked="checked"{% endif %}> {{ lang('DISABLE_MAGIC_URL') }}</label>
                        {% endif %}
                    </dd>
                    <dd style="margin-{{ S_CONTENT_FLOW_BEGIN }}: 90px; margin-top: 10px;"><strong>{{ lang('OPTIONS') ~ lang('COLON') }} </strong>{{ BBCODE_STATUS }} :: {{ IMG_STATUS }} :: {{ FLASH_STATUS }} :: {{ URL_STATUS }} :: {{ SMILIES_STATUS }}</dd>
                </dl>
            {% endif %}
        </fieldset>

        <fieldset class="submit-buttons">
            <input class="button1" type="submit" id="submit" name="submit" value="{{ lang('SUBMIT') }}">&nbsp;
            {% if not S_IS_CATEGORY %}<input class="button2" type="submit" id="preview" name="preview" value="{{ lang('PREVIEW') }}">{% endif %}
            {{ S_FORM_TOKEN }}
        </fieldset>
    </form>

    <script>
        const textarea = document.querySelector("textarea[name='rule_message']");
        textarea.addEventListener("select", (e) => storeCaret(e.target));
        textarea.addEventListener("click", (e) => storeCaret(e.target));
        textarea.addEventListener("keyup", (e) => storeCaret(e.target));
        textarea.addEventListener("focus", () => initInsertions());
    </script>

{% else %}

    <h1>{{ lang('ACP_BOARDRULES_MANAGE') }}</h1>

    {% if loops.options|length %}

        <p>{{ lang('ACP_BOARDRULES_LANGUAGE_EXPLAIN') }}</p>
        <form id="language_form" method="post" action="{{ U_ACTION }}">
            <fieldset>
                <dl>
                    <dt>
                        <label for="language">{{ lang('ACP_BOARDRULES_SELECT_LANGUAGE') ~ lang('COLON') }}</label>
                    </dt>
                    <dd>
                        <select name="language" id="language">
                            {% for options in loops.options %}
                                <option value="{{ options.LANG_ISO }}"{% if options.S_LANG_DEFAULT %} selected="selected"{% endif %}>{{ options.LANG_LOCAL_NAME }}</option>
                            {% endfor %}
                        </select>
                        <input type="submit" value="{{ lang('GO') }}" class="button2">
                        {{ S_FORM_TOKEN }}
                    </dd>
                </dl>
            </fieldset>
        </form>

    {% else %}

        <p>{{ lang('ACP_BOARDRULES_MANAGE_EXPLAIN') }}</p>
        {% if loops.breadcrumb|length %}
        <p>
            <strong>
                <a href="{{ U_MAIN }}">{{ lang('ACP_BOARDRULES') }}</a>
                {% for breadcrumb in loops.breadcrumb %}
                     -&gt; {% if not breadcrumb.S_CURRENT_LEVEL %}<a href="{{ breadcrumb.U_RULE }}">{% endif %}{{ breadcrumb.RULE_TITLE }}{% if not breadcrumb.S_CURRENT_LEVEL %}</a>{% endif %}
                {% endfor %}
            </strong>
        </p>
        {% endif %}

        {% if loops.rules|length %}
            <table class="table1 forums">
                <colgroup><col class="row1"><col class="row1"><col class="row2"></colgroup>
                <thead>
                    <tr>
                        <th colspan="2">{{ lang('ACP_BOARDRULES') }}</th>
                        <th>{{ lang('ACTION') }}</th>
                    </tr>
                </thead>
                <tbody>
                    {% for rules in loops.rules %}
                        <tr>
                            <td class="folder">
                                {% if rules.S_IS_CATEGORY %}<img src="images/icon_subfolder.gif" width="27" height="27" alt="{{ lang('ACP_BOARDRULES_CATEGORY') }}">{% else %}<img src="images/icon_folder.gif" width="27" height="27" alt="{{ lang('ACP_BOARDRULES_RULE') }}">{% endif %}
                            </td>
                            <td class="forum-desc">
                                <strong><a href="{{ rules.U_RULE }}">{{ rules.RULE_TITLE }}</a></strong>
                            </td>
                            <td class="actions">
                                <span class="up-disabled" style="display:none;">{{ ICON_MOVE_UP_DISABLED }}</span>
                                <span class="up"><a href="{{ rules.U_MOVE_UP }}" data-ajax="row_up">{{ ICON_MOVE_UP }}</a></span>
                                <span class="down-disabled" style="display:none;">{{ ICON_MOVE_DOWN_DISABLED }}</span>
                                <span class="down"><a href="{{ rules.U_MOVE_DOWN }}" data-ajax="row_down">{{ ICON_MOVE_DOWN }}</a></span>
                                <a href="{{ rules.U_EDIT }}">{{ ICON_EDIT }}</a>
                                <a href="{{ rules.U_DELETE }}" data-ajax="row_delete">{{ ICON_DELETE }}</a>
                            </td>
                        </tr>
                    {% endfor %}
                </tbody>
            </table>
        {% endif %}

        <form id="rules" method="post" action="{{ U_ACTION }}">

        <fieldset class="quick">
            {{ lang('ACP_ADD_RULE') ~ lang('COLON') }}
            <label>
                <input type="text" name="rule_title" value="" maxlength="200" placeholder="{{ lang('ACP_RULE_TITLE') }}">
            </label>
            <input type="submit" name="addrule" class="button2" value="{{ lang('SUBMIT') }}">
            <input type="hidden" name="action" value="add">
            {{ S_FORM_TOKEN }}
        </fieldset>
        </form>

    {% endif %}

{% endif %}

{% INCLUDE 'overall_footer.html' %}