# You must use a tab-size of 4 spaces to edit this file.
---
zenario_document_rule:
    title: 'Creating a new auto-set rule'
    key: 
        id: ''
    hide_tab_bar: true
    tabs:
        details:
            edit_mode:
                enabled: true
            fields:
                use:
                    label: 'Check:'
                    type: radios
                    value: filename_without_extension
                    values:
                        filename_without_extension:
                            label: 'Filename without extension'
                        filename_and_extension:
                            label: 'Filename and extension'
                        extension:
                            label: 'Extension'
                pattern:
                    label: 'For this pattern:'
                    type: text
                    note_below: >
                        e.g.: &ldquo;<code>@.*(20\d\d).*@</code>&rdquo;
                action:
                    full_width: true
                    type: radios
                    values:
                        set_field:
                            label: 'If it matches, set this field:'
                        move_to_folder:
                            label: 'If it matches, move document to this folder:'
                    format_onchange: true
                folder_id:
                    full_width: true
                    type: select
                    empty_value: '-- Select  a folder --'
                field_id:
                    full_width: true
                    type: select
                    empty_value: '-- Select  a field --'
                    format_onchange: true
                replacement_is_regexp:
                    full_width: true
                    type: radios
                    values:
                        0:
                            label: 'To this value:'
                        1:
                            label: 'To this replacement pattern:'
                    format_onchange: true
                field_value:
                    full_width: true
                    type: select
                replacement:
                    full_width: true
                    type: text
                    note_below: >
                        e.g.: &ldquo;<code>$1</code>&rdquo;
                
                apply_second_pass:
                    label: 'Apply a second pass:'
                    type: checkbox
                    format_onchange: true
                second_pattern:
                    label: 'Look for this pattern:'
                    type: text
                    note_below: >
                        e.g.: &ldquo;<code>@([_-]+)@</code>&rdquo;
                second_replacement:
                    label: 'Replace with:'
                    type: text
                    note_below: >
                        e.g.: &ldquo;<code> </code>&rdquo;
                
                stop_processing_rules:
                    label: ''
                    type: checkbox
                    value: 1
                
                preg_match_help:
                    full_width: true
                    snippet:
                        html: >
                            <p>
                                The <a href="http://php.net/manual/en/function.preg-match.php" target="_blank">
                                <code>preg_match()</code></a> function will be used to decide whether this rule is
                                applied, where the pattern you enter will be used as the <code>$pattern</code> and
                                the file's name and/or extension used as the <code>$subject</code>. For example:
                            </p>
                            <table class="zenario_ab_infotable"><tr>
                                <th>Check</th>
                                <th>Pattern</th>
                                <th>Description</th>
                            </tr><tr>
                                <td>Filename</td>
                                <td><code>@^CAT_@</code></td>
                                <td>Name starts with "CAT_"</td>
                            </tr><tr>
                                <td>Filename</td>
                                <td><code>@ENG$@</code></td>
                                <td>Name ends with "ENG"</td>
                            </tr><tr>
                                <td>Filename</td>
                                <td><code>@_1980_@</code></td>
                                <td>Name contains "_1980"</td>
                            </tr></table>
                
                preg_replace_help:
                    full_width: true
                    snippet:
                        html: >
                            <p>
                                The <a href="http://php.net/manual/en/function.preg-replace.php" target="_blank">
                                <code>preg_replace()</code></a> function will be used to decide whether this rule is
                                applied, where the pattern you enter will be used as the <code>$pattern</code>, 
                                the replacement you enter will be used as the <code>$replacement</code> and
                                the file's name and/or extension used as the <code>$subject</code>. For example:
                            </p>
                            <table class="zenario_ab_infotable"><tr>
                                <th>Check</th>
                                <th>Pattern</th>
                                <th>Replacement</th>
                                <th>Description</th>
                            </tr><tr>
                                <td>Filename</td>
                                <td><code>@.*_(\d\d\d\d)[-_/]([01]\d).*@</code></td>
                                <td><code>$1</code></td>
                                <td>Attempt to extract the year from a filename</td>
                            </tr><tr>
                                <td>Filename</td>
                                <td><code>@.*_(\d\d\d\d)[-_/]([01]?\d).*@</code></td>
                                <td><code>$2</code></td>
                                <td>Attempt to extract the month from a filename</td>
                            </tr><tr>
                                <td>Extension</td>
                                <td><code>@(gif|jpg|jpeg|png)@i</code></td>
                                <td><code>true</code></td>
                                <td>File is an image</td>
                            </tr></table>
                            <p>
                                (The <code>.*</code> at the start and the end of some examples is necessary
                                to stop the entire filename being placed into the field.)
                            </p>
            
            notices:
                desc:
                    show: true
                    type: warning
                    message: >
                        This is an advanced feature and requires knowledge of regular expressions.
                        
                        You can define a regular expression against which to match the filename of a document.
                        If a match is found, the rule will set a field to a given value, or move the document to a given folder.
                checkboxes:
                    type: warning
                    message: >
                        You have selected a checkboxes-type field.
                        You may only set one checkbox per rule, to check multiple checkboxes
                        you will need multiple rules.
                checkbox:
                    type: warning
                    message: >
                        You have selected a checkbox-type field.
                        The <code>engToBoolean()</code> function will be used on the resulting answer.
                date:
                    type: warning
                    message: >
                        You have selected a date-type field.
                        The <code>strtotime()</code> function will be used on the resulting answer.
                lov:
                    type: warning
                    message: >
                        You have selected a field that uses a list of values.
                        Each possible choice has both a visible value,
                        and an ID that is stored in the database.
                        Make sure you refer to the visible value.