Subversion Repositories regexpline_backup

[/] [stable/] [2.3/] [design/] [standard/] [templates/] [class/] [datatype/] [edit/] [hmregexpline.tpl] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 xrow
{def $content=$class_attribute.content
2
     $presets=ezini( 'GeneralSettings', 'RegularExpressions', 'regexpline.ini' )
3
     $hasPresets=count($content.preset)|gt(0)}
4
 
5
<script type="text/javascript">
6
7
function addLine{/literal}{$class_attribute.id}{literal}( button )
8
{
9
    if( document.getElementById && document.createElement )
10
    {
11
        var container = document.getElementById( 'regexp_container_{/literal}{$class_attribute.id}{literal}' );
12
        var par = document.createElement( 'p' );
13
        par.style.padding = '0.5em';
14
        par.style.marginBottom = '1em';
15
        par.style.border = '1px solid #eaeaea';
16
 
17
        var label = document.createElement( 'label' );
18
        label.className = 'small';
19
        var labelText = document.createTextNode( '{/literal}{'Expression'|i18n( 'extension/regexpline/design/standard/class/datatype/edit' )}{literal}:' );
20
        label.appendChild( labelText );
21
        par.appendChild( label );
22
 
23
        label = labelText = null;
24
 
25
        var input = document.createElement( 'input' );
26
        input.type = 'text';
27
        input.name = 'ContentClass_hmregexpline_regexp_{/literal}{$class_attribute.id}{literal}[]';
28
        input.size = 100;
29
        par.appendChild( input );
30
 
31
        input = null;
32
 
33
        par.appendChild( document.createElement( 'br' ) );
34
 
35
        label = document.createElement( 'label' );
36
        label.className = 'small';
37
        labelText = document.createTextNode( '{/literal}{'Error message'|i18n( 'extension/regexpline/design/standard/class/datatype/edit' )}{literal}:' );
38
        label.appendChild( labelText );
39
        par.appendChild( label );
40
 
41
        label = labelText = null;
42
 
43
        var input = document.createElement( 'input' );
44
        input.type = 'text';
45
        input.name = 'ContentClass_hmregexpline_errmsg_{/literal}{$class_attribute.id}{literal}[]';
46
        input.size = 100;
47
        par.appendChild( input );
48
 
49
        input = null;
50
 
51
        container.appendChild( par );
52
    }
53
}
54
 
55
function removeLines{/literal}{$class_attribute.id}{literal}()
56
{
57
    if( document.getElementById && document.getElementsByName )
58
    {
59
        var checkBoxes = document.getElementsByName( 'ContentClass_remove_regexpitem_{/literal}{$class_attribute.id}{literal}[]' );
60
 
61
        for( i=0; i < checkBoxes.length; i++ )
62
        {
63
            if( checkBoxes[i].checked )
64
            {
65
                element = document.getElementById( checkBoxes[i].value );
66
 
67
                if( element != null )
68
                {
69
                    element.parentNode.removeChild( element );
70
                }
71
            }
72
        }
73
    }
74
}
75
76
</script>
77
 
78
{if and( is_set( $content.class_validation_messages ),
79
                 count( $content.class_validation_messages )|gt( 0 ) )}
80
<div class="block" style="border: medium solid red; padding: 1em;">
81
        <p style="color: red; font-weight: bold;">{'The following errors occured:'|i18n( 'extension/regexpline/design/standard/class/datatype/edit' )}</p>
82
        <ul>
83
        {foreach $content.class_validation_messages as $msg}
84
                <li>{$msg|wash}</li>
85
        {/foreach}
86
        </ul>
87
</div>
88
{/if}
89
 
90
<div class="block">
91
    <div class="element">
92
        <div id="regexp_container_{$class_attribute.id}">
93
            <label>{'Regular expression(s) (Perl-compatible)'|i18n( 'extension/regexpline/design/standard/class/datatype/edit' )}</label>
94
            <span class="small">{'To allow all input:'|i18n( 'extension/regexpline/design/standard/class/datatype/edit' )} /.*/</span>
95
            {foreach $content.regexp as $index => $regexp}
96
            <p id="regexp{$index}" style="border: 1px solid #eaeaea; padding: 0.5em; margin-bottom: 1em;">
97
                {if $index|gt(0)}<input type="checkbox" name="ContentClass_remove_regexpitem_{$class_attribute.id}[]" value="regexp{$index}" />{/if}
98
                <label class="small">{'Expression'|i18n( 'extension/regexpline/design/standard/class/datatype/edit' )}:</label>
99
                <input type="text" name="ContentClass_hmregexpline_regexp_{$class_attribute.id}[]" value="{$regexp|wash}" size="100" {if $hasPresets}disabled="disabled"{/if} /><br />
100
 
101
                <label class="small">{'Error message'|i18n( 'extension/regexpline/design/standard/class/datatype/edit' )}:</label>
102
                <input type="text" name="ContentClass_hmregexpline_errmsg_{$class_attribute.id}[]" value="{$content.error_messages[$index]|wash}" size="100" {if $hasPresets}disabled="disabled"{/if} />
103
            </p>
104
            {/foreach}
105
        </div>
106
        <input type="button" name="ContentClass_add_regexp" value="{'Add regular expression'|i18n( 'extension/regexpline/design/standard/class/datatype/edit' )}" onclick="javascript:addLine{$class_attribute.id}(this);" {if $hasPresets}disabled="disabled"{/if} />
107
        <input type="button" name="ContentClass_remove_regexp" value="{'Remove regular expression(s)'|i18n( 'extension/regexpline/design/standard/class/datatype/edit' )}" onclick="javascript:removeLines{$class_attribute.id}();" {if $hasPresets}disabled="disabled"{/if} />
108
    </div>
109
 
110
    {if count( $presets )|gt( 0 )}
111
    <div class="element">
112
        <label>{'Presets'|i18n( 'extension/regexpline/design/standard/class/datatype/edit' )}</label>
113
        <select name="ContentClass_hmregexpline_preset_{$class_attribute.id}[]" multiple="multiple">
114
        {foreach $presets as $identifier => $regexp}
115
        <option value="{$identifier|wash}" {if $content.preset|contains( $identifier|wash )}selected="selected"{/if}>{$identifier|wash}</option>
116
        {/foreach}
117
        </select>
118
    </div>
119
    {/if}
120
 
121
    <div class="break"></div>
122
</div>
123
 
124
<div class="block">
125
    <table class="list" cellspacing="0" style="width: 50%;">
126
    <tr>
127
        <th>{'Regexp / Preset'|i18n( 'extension/regexpline/design/standard/class/datatype/edit' )}</th>
128
        <th>{'Negate'|i18n( 'extension/regexpline/design/standard/class/datatype/edit' )}</th>
129
    </tr>
130
    {if $hasPresets}
131
        {foreach $content.preset as $preset}
132
        <tr>
133
            <td width="1%">{$preset|wash}</td>
134
            <td width="1%">
135
                <input type="checkbox" name="ContentClass_hmregexpline_negate_{$class_attribute.id}[{$preset|wash}]" {if is_set( $content.negates[$preset|wash] )}checked="checked"{/if} />
136
            </td>
137
        </tr>
138
        {/foreach}
139
    {else}
140
        {foreach $content.regexp as $index => $regexp}
141
        <tr>
142
            <td width="1%">{$regexp|wash}</td>
143
            <td width="1%">
144
                <input type="checkbox" name="ContentClass_hmregexpline_negate_{$class_attribute.id}[]" {if is_set( $content.negates[$index] )}checked="checked"{/if} />
145
            </td>
146
        </tr>
147
        {/foreach}
148
    {/if}
149
    </table>
150
</div>
151
 
152
<div class="block">
153
    <div class="block">
154
        <label>{'Object name pattern'|i18n( 'extension/regexpline/design/standard/class/datatype/edit' )}</label>
155
        {if $content.subpattern_count|gt(0)}
156
            <input type="text" name="ContentClass_hmregexpline_namepattern_{$class_attribute.id}" size="100" value="{$content.naming_pattern|wash}" />
157
            <p>
158
                {'This field allows you to structure the object naming pattern for this attribute. To use a subpattern of your regular expression, place its number (visible in the list below) in a tag-like notation, e.g. &lt;1&gt; to use the first subpattern.'|i18n( 'extension/regexpline/design/standard/class/datatype/edit' )}
159
            </p>
160
        {else}
161
            <p><i>{'No subpatterns defined. Using the complete expression.'|i18n( 'extension/regexpline/design/standard/class/datatype/edit' )}</i></p>
162
        {/if}
163
    </div>
164
 
165
    <div class="block">
166
        {if $content.subpattern_count|gt(0)}
167
        <p>{'These are the available subpatterns:'|i18n( 'extension/regexpline/design/standard/class/datatype/edit' )}
168
            <ol>
169
                {foreach $content.subpatterns as $pattern}
170
                <li>{$pattern|wash}</li>
171
                {/foreach}
172
            </ol>
173
        </p>
174
        {/if}
175
    </div>
176
</div>
177
 
178
<div class="block">
179
    <label>{'Display as'|i18n( 'extension/regexpline/design/standard/class/datatype/edit' )}</label>
180
    <input type="radio" name="ContentClass_hmregexpline_display_{$class_attribute.id}" value="line" {if $content.display_type|eq("line")}checked="checked"{/if} /> {'Single text line'|i18n( 'extension/regexpline/design/standard/class/datatype/edit' )}
181
    <input type="radio" name="ContentClass_hmregexpline_display_{$class_attribute.id}" value="area" {if $content.display_type|eq("area")}checked="checked"{/if} /> {'Text area (Text block)'|i18n( 'extension/regexpline/design/standard/class/datatype/edit' )}
182
</div>
183
 
184
<div class="block">
185
    <label>{'Help text for users'|i18n( 'extension/regexpline/design/standard/class/datatype/edit' )}</label>
186
    <textarea name="ContentClass_hmregexpline_helptext_{$class_attribute.id}" rows="5" cols="80">{$content.help_text|wash}</textarea>
187
</div>
188
 
189
{undef $content $presets}