{% extends "_framer.twig" %}
{% block content %}
<!-- BEGIN main_block -->
<div class="cpForm">
<form name="outputfilter" class="modify_settings" action="{{ TOOL_URI }}" method="post">
		<input type="hidden" name="id" value="{{ filter_id }}" />
        <input type="hidden" name="save_settings" value="save_settings"/>
        {{ FTAN }}
    <div style="margin: 15px 26px;float:right;">
        <input value="1" name="active" type="checkbox" id="i{{ filter_id }}" switch="bool" rel="{{ filter_id }}" {{ active_checked }} />
        <label for="i{{ filter_id }}" class="labeled" data-on-label="{{ L_('TEXT:ENABLED') }}" data-off-label="{{ L_('TEXT:DISABLED') }}">
        </label>
    </div>
    <h2>{{ L_('L:TXT_FILTER_CONF') }}</h2>           
    <div class="formRow">

        <div class="settingName"><label>{{ L_('L:TXT_FILTER_NAME') }}</label></div>
        <div class="settingValue" style="margin-top: 4px;">
            <input type="text" name="name" required value="{% if edit_filter %}{{ filter_name }}{% endif %}" {% if add_filter %} placeholder="{{ filter_name }}"{% endif %} size="40" {{ disabled_readonly }}  />


            {% if filter_config_url != '' %}
            <a href="{{ filter_config_url }}" title="{{ L_('L:TXT_CONFIG_FILTER') }}"><img src="{{ IMAGE_URL }}/config.png" alt="[{{ L_('L:TXT_CONFIG_FILTER') }}]" border="0" /></a>
            {% endif %}
            {{ tpl_filter_configurl_end }}
        </div>
    </div>

    <div class="formRow">

        <div class="settingName">
            <label>{{ L_('L:TXT_DESCRIPTION') }}</label>
            {% if helppath != '' %}
            <p>
                <a {{ helppath }} title="{{ L_('L:TXT_FILTER_HELP') }}">
                    <i class="fa fa-question-circle"></i>
                </a>
            </p>
            {% endif %}
        </div>
        <div class="settingValue" style="margin-top: 4px;">
            <textarea id="desc" name="desc" cols="65" style="width: 98%; height:auto" {{ disabled_readonly }}
              {% if add_filter %} placeholder="{{ filter_desc }}"{% endif %}
                      >{% if edit_filter %}{{ filter_desc }}{% endif %}</textarea>
        </div>
    </div>

    <div class="formHeading">{{ L_('L:TXT_FILTER_OUTPUT_SETTINGS') }}</div>
    <div class="formRow">
        <div class="settingName"><label>{{ L_('L:TXT_TYPE') }}</label></div>
        <div class="settingValue" style="margin-top: 4px;">
            <select name="type" style="width: 50%;" {tpl_filter_disabled} onchange="modules_checktree_visibility()">
                {{ filter_type_options }}
            </select><br />
            <p style="display:none;" ID="OPF_ID_SEC_DESC" class="notification"><strong>{{ L_('L:TXT_MODULE_TYPE_LAST') }}</strong></p>
            <p style="display:none;" ID="OPF_ID_PAGE_DESC" class="notification"><strong>{{ L_('L:TXT_TYPE_LAST') }}</strong></p>

        </div>
    </div>

    <div class="formRow" style="display:none;" id="OPF_ID_CHECKTREE">
        <div class="settingName">
            <img src="{{ IMAGE_URL }}/modules_go.png" alt="" /><br>
            <label>{{ L_('L:TXT_FILTER_MODULES') }}</label>
        </div>
        <div class="settingValue">
            <p class="notificatio n">{{ L_('L:TXT_MODULE_TREE') }}:</p>
            {{ module_tree }}
        </div>
    </div>

    <div class="formRow" style="display:none;" id="OPF_ID_PAGECHECKTREE">
        <div class="settingName">
            <img src="{{ IMAGE_URL }}/pages_go.png" alt="" /><br />
            <label>{{ L_('L:TXT_FILTER_PAGES') }}</label>

        </div>
        <div class="settingValue">
            <p class="notification" style="display:none;" ID="OPF_ID_PAGE_DESC_2">{{ L_('L:TXT_MODULE_TREE') }}:</p>
            <p class="notification" style="display:none;" ID="OPF_ID_SEC_DESC_2">{{ L_('L:TXT_SUB_PAGES') }}:</p>
            {{ page_tree }}
        </div>
    </div>

<!--/*    The next table will contain the filter-function/-file and all optional configuration-fields for this filter. */-->
    <div class="formHeading">{{ L_('L:TXT_FUNCTION') }}</div>
    <div class="formRow">
        <div class="settingName">
            <label>{{ L_('L:TXT_FUNC_NAME') }}</label>
        </div>
        <div class="settingValue">
            <input type="text" name="funcname" value="{{ funcname }}" size="40" style="widht:50%;" {{ disabled_readonly }} />
        </div>
    </div>

{#
    Now display either the file-area (for installed filters)
    or the function-area (for inline-filters)
#}

{#
    Now display all optional configuration-fields for this filter.
#}
{% for field in extra_fields %}
    {% if field.type == 'text' %}
        <!-- BEGIN text_block -->
        <div class="formRow">
            <div class="settingName">
                <label>{{ field.text }}</label>
            </div>
            <div class="settingValue">
                <input type="text" name="{{ field.name }}" value="{{ field.value }}" size="40" {{ field.style }} />
            </div>
        </div>
        <!-- END text_block -->


    {% elseif field.type ==  'textarea' or field.type ==  'editarea' %}
        <!-- BEGIN textarea_block -->
        <div class="formRow">
            <div class="settingName">
                <label>{{ field.text }}</label>
            </div>
            <div class="settingValue">
                <textarea id="{{ field_id }}" name="{{ field.name }}" cols="40" rows="5" {{ field.style }}>{{ field.value }}</textarea>
            </div>
        </div>
        <!-- END textarea_block -->

    {% elseif field.type ==  'checkbox' %}
        <!-- BEGIN checkbox_block -->
        <div class="formRow">
            <div class="settingName">
               <label>{{ field.text }}</label>
            </div>
            <div class="settingValue">
                <input type="checkbox" value="{{ field.value }}" name="{{ field.name }}" {{ field.checked }} />
            </div>
        </div>
        <!-- END checkbox_block -->


    {% elseif field.type ==  'radio' %}
        <!-- BEGIN radio_block -->
        <div class="formRow">
            <div class="settingName">
               <label>{{ field.text }}</label>
            </div>
            <div class="settingValue">
                <input type="radio" value="{{ field.value }}" name="{{ field.name }}" {{ field.checked }} />
            </div>
        </div>
        <!-- END radio_block -->


    {% elseif field.type ==  'select' %}
        <!-- BEGIN select_block -->
        <div class="formRow">
            <div class="settingName">
                <label>{{ field.text }}</label>
            </div>
            <div class="settingValue">
                <select name="{{ field.name }}" size="1" style="width: 50%;">
                    {{ field.options }}
                </select>
            </div>
        </div>
        <!-- END select_block -->


    {% elseif field.type ==  'array' %}
        <!-- BEGIN array_row_block -->
        <div class="formRow">
            <div class="settingName">
               <label>{{ field.text }}</label>
            </div>
            <div class="settingValue">
                <table class="textfields" width="100%" cellpadding="2" cellspacing="0" border="0">
                {% for key, val in field.values %}
                <tr>
                    <td style="width:30%;">
                        <textarea id="{{ uniqid('k_') }}" name="{{ field.name }}[k][]" style="width:95%;" rows="1" />{{ key }}</textarea>
                    </td>
                    <td style="width:10%;" align="center"><span class="arrow">=></span></td>
                    <td style="width:60%;">
                        <textarea id="{{ uniqid('v_') }}" name="{{ field.name }}[v][]" style="width:95%;" rows="1" />{{ val }}</textarea>
                    </td>
                </tr>
                {% endfor %}
                </table>
            </div>
        </div>
        <!-- END array_row_block -->
    {% endif %}
{% endfor %}


{% if func %}    

    <div class="formRow fullValue">   
        <p class="notification">{{ L_('L:TXT_FILTER_FUNC') }}</p>
        <div class="settingValue">
            <textarea id="func" name="func"  cols="65" rows="6" style="width: 100%; height: 400px;">{{ func }}</textarea>
        </div>
    </div>

{% elseif file %}
    <div class="formRow">
        <div class="settingName">
            <label>{{ L_('L:TXT_FILTER_FILE') }}</label>
        </div>
        <div class="settingValue">
            <code style="font-size:.95em;color: grey;">{{ file_loc_readonly }}</code>
            <input type="hidden" name="file" value="{{ filter_file_loc }}" size="50" style="width: 98%;" readonly="readonly" />
        </div>
    </div>
{% endif %}

        <div class="buttonsRow">
            <button type="submit" name="submit_return" class="button ico-save">{{ L_('TEXT:SAVE') }}</button>
            <button type="submit" name="submit_exit" class="button ico-save-back">{{ L_('L:TXT_SAVE_AND_CLOSE') }}</button>
            <button class="button ico-back pos-right" type="button" data-redirect-location="{{ TOOL_URI }}&amp;last={{ filter_id }}#{{ filter_id }}">{{ L_('L:TXT_EXIT') }}</button>
        </div>

    </form>
</div>
<script type="text/javascript">var opf_use_checktrees = true;</script>
{% if func %}
{{ CodeMirror('func', 'php', {'readOnly': readOnly, 'height': '550px'}) }}
{% endif %}


{% endblock %}
