Subversion Repositories regexpline_backup

[/] [stable/] [2.2/] [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
<div class="block">
79
    <div class="element">
80
        <div id="regexp_container_{$class_attribute.id}">
81
            <label>{'Regular expression(s) (Perl-compatible)'|i18n( 'extension/regexpline/design/standard/class/datatype/edit' )}</label>
82
            <span class="small">{'To allow all input:'|i18n( 'extension/regexpline/design/standard/class/datatype/edit' )} /.*/</span>
83
            {foreach $content.regexp as $index => $regexp}
84
            <p id="regexp{$index}" style="border: 1px solid #eaeaea; padding: 0.5em; margin-bottom: 1em;">
85
                {if $index|gt(0)}<input type="checkbox" name="ContentClass_remove_regexpitem_{$class_attribute.id}[]" value="regexp{$index}" />{/if}
86
                <label class="small">{'Expression'|i18n( 'extension/regexpline/design/standard/class/datatype/edit' )}:</label>
87
                <input type="text" name="ContentClass_hmregexpline_regexp_{$class_attribute.id}[]" value="{$regexp|wash}" size="100" {if $hasPresets}disabled="disabled"{/if} /><br />
88
 
89
                <label class="small">{'Error message'|i18n( 'extension/regexpline/design/standard/class/datatype/edit' )}:</label>
90
                <input type="text" name="ContentClass_hmregexpline_errmsg_{$class_attribute.id}[]" value="{$content.error_messages[$index]|wash}" size="100" {if $hasPresets}disabled="disabled"{/if} />
91
            </p>
92
            {/foreach}
93
        </div>
94
        <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} />
95
        <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} />
96
    </div>
97
 
98
    {if count( $presets )|gt( 0 )}
99
    <div class="element">
100
        <label>{'Presets'|i18n( 'extension/regexpline/design/standard/class/datatype/edit' )}</label>
101
        <select name="ContentClass_hmregexpline_preset_{$class_attribute.id}[]" multiple="multiple">
102
        {foreach $presets as $identifier => $regexp}
103
        <option value="{$identifier|wash}" {if $content.preset|contains( $identifier|wash )}selected="selected"{/if}>{$identifier|wash}</option>
104
        {/foreach}
105
        </select>
106
    </div>
107
    {/if}
108
 
109
    <div class="break"></div>
110
</div>
111
 
112
<div class="block">
113
    <table class="list" cellspacing="0" style="width: 50%;">
114
    <tr>
115
        <th>{'Regexp / Preset'|i18n( 'extension/regexpline/design/standard/class/datatype/edit' )}</th>
116
        <th>{'Negate'|i18n( 'extension/regexpline/design/standard/class/datatype/edit' )}</th>
117
    </tr>
118
    {if $hasPresets}
119
        {foreach $content.preset as $preset}
120
        <tr>
121
            <td width="1%">{$preset|wash}</td>
122
            <td width="1%">
123
                <input type="checkbox" name="ContentClass_hmregexpline_negate_{$class_attribute.id}[{$preset|wash}]" {if is_set( $content.negates[$preset|wash] )}checked="checked"{/if} />
124
            </td>
125
        </tr>
126
        {/foreach}
127
    {else}
128
        {foreach $content.regexp as $index => $regexp}
129
        <tr>
130
            <td width="1%">{$regexp|wash}</td>
131
            <td width="1%">
132
                <input type="checkbox" name="ContentClass_hmregexpline_negate_{$class_attribute.id}[]" {if is_set( $content.negates[$index] )}checked="checked"{/if} />
133
            </td>
134
        </tr>
135
        {/foreach}
136
    {/if}
137
    </table>
138
</div>
139
 
140
<div class="block">
141
    <div class="block">
142
        <label>{'Object name pattern'|i18n( 'extension/regexpline/design/standard/class/datatype/edit' )}</label>
143
        {if $content.subpattern_count|gt(0)}
144
            <input type="text" name="ContentClass_hmregexpline_namepattern_{$class_attribute.id}" size="100" value="{$content.naming_pattern|wash}" />
145
            <p>
146
                {'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' )}
147
            </p>
148
        {else}
149
            <p><i>{'No subpatterns defined. Using the complete expression.'|i18n( 'extension/regexpline/design/standard/class/datatype/edit' )}</i></p>
150
        {/if}
151
    </div>
152
 
153
    <div class="block">
154
        {if $content.subpattern_count|gt(0)}
155
        <p>{'These are the available subpatterns:'|i18n( 'extension/regexpline/design/standard/class/datatype/edit' )}
156
            <ol>
157
                {foreach $content.subpatterns as $pattern}
158
                <li>{$pattern|wash}</li>
159
                {/foreach}
160
            </ol>
161
        </p>
162
        {/if}
163
    </div>
164
</div>
165
 
166
<div class="block">
167
    <label>{'Display as'|i18n( 'extension/regexpline/design/standard/class/datatype/edit' )}</label>
168
    <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' )}
169
    <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' )}
170
</div>
171
 
172
<div class="block">
173
    <label>{'Help text for users'|i18n( 'extension/regexpline/design/standard/class/datatype/edit' )}</label>
174
    <textarea name="ContentClass_hmregexpline_helptext_{$class_attribute.id}" rows="5" cols="80">{$content.help_text|wash}</textarea>
175
</div>
176
 
177
{undef $content $presets}