Subversion Repositories dbi_notifications

[/] [design/] [standard/] [templates/] [workflow/] [eventtype/] [edit/] [event_dbiaddnotificationrule.tpl] - Blame information for rev 1

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1 Bedlore
{let $classes=fetch('class', 'list')}
2
 
3
<script type="text/javascript">
4
<!--
5
    var optionArray;
6
    var valueArray;
7
 
8
    optionArray = new Array( );
9
    valueArray = new Array( );
10
 
11
    {foreach $classes as $class}
12
        optionArray['{$class.identifier}'] = new Array( );
13
        valueArray['{$class.identifier}'] = new Array( );
14
        {let $attributes = fetch( 'class', 'attribute_list', hash( 'class_id', $class.id ) )}
15
        {foreach $attributes as $attribute}
16
            optionArray['{$class.identifier}'].push( "{$attribute.name|addslashes}" );
17
            valueArray['{$class.identifier}'].push( "{$attribute.id}" );
18
        {/foreach}
19
        {/let}
20
    {/foreach}
21
 
22
    {literal}
23
function syncSelectBoxes( fromid, toid, optionArray, valueArray )
24
{
25
    var i;
26
    var from;
27
    var to;
28
    var fromlen;
29
    var selected;
30
    var selectedValue;
31
    var optionlen;
32
    var chosenOptions;
33
    var chosenValues;
34
    var tolen;
35
 
36
    from = document.getElementById( fromid );
37
    to = document.getElementById( toid );
38
 
39
    if ( from != null && to != null )
40
    {
41
        removeAllOptions( toid );
42
        if ( from.selectedIndex > -1 )
43
        {
44
            selected = from.options[from.selectedIndex];
45
 
46
            selectedValue = selected.value;
47
 
48
            chosenOptions = optionArray[selectedValue];
49
            chosenValues = valueArray[selectedValue];
50
 
51
            optionlen = chosenOptions.length;
52
 
53
            for ( i = 0; i < optionlen; i++ )
54
            {
55
                tolen = to.length;
56
                to.options[tolen] = new Option( chosenOptions[i], chosenValues[i], false, false );
57
            }
58
        }
59
    }
60
}
61
 
62
function removeAllOptions( selectid )
63
{
64
    var i;
65
    var select;
66
 
67
    select = document.getElementById( selectid );
68
 
69
    if ( select != null )
70
    {
71
        for ( i = ( select.length - 1 ); i >= 0; i-- )
72
        {
73
            select.options[i] = null;
74
        }
75
    }
76
}
77
 
78
    {/literal}
79
-->
80
</script>
81
 
82
<div class="block">
83
<fieldset>
84
<legend>{'Selection attributes with notification types'|i18n( 'design/admin/workflow/eventtype/edit' )}</legend>
85
 
86
<select id="ClassSelection_{$event.id}" onchange="javascript:syncSelectBoxes( 'ClassSelection_{$event.id}', 'AttributeSelection_{$event.id}', optionArray, valueArray );">
87
    {foreach $classes as $class}
88
        <option value="{$class.identifier}">{$class.name|wash}</option>
89
    {/foreach}
90
</select>
91
 
92
<select name="AttributeSelection_{$event.id}" id="AttributeSelection_{$event.id}">
93
    <option value="">&nbsp;</option>
94
</select>
95
 
96
<input type="submit" class="button" name="CustomActionButton[{$event.id}_AddAttribute]" value="{'Add attribute'|i18n( 'design/admin/workflow/eventtype/edit' )}" />
97
 
98
<script type="text/javascript">
99
<!--
100
    javascript:syncSelectBoxes( 'ClassSelection_{$event.id}', 'AttributeSelection_{$event.id}', optionArray, valueArray );
101
-->
102
</script>
103
 
104
{if $event.selected_attributes|count|gt(0)}
105
<table class="list" cellspacing="0">
106
<thead>
107
<tr>
108
<th class="tight">&nbsp;</th>
109
<th>{'Attributes'|i18n( 'design/admin/workflow/eventtype/edit' )}</th>
110
</tr>
111
</thead>
112
<tbody>
113
{foreach $event.selected_attributes as $attributeID}
114
{def $attribute=fetch( 'content', 'class_attribute', hash( 'attribute_id', $attributeID ) )}
115
{if $attribute}
116
{def $class=fetch( 'content', 'class', hash( 'class_id', $attribute.contentclass_id ) )}
117
<tr>
118
<td><input type="checkbox" name="DeleteAttributeIDArray_{$event.id}[]" value="{$attributeID}" /></td>
119
<td>{$class.name|wash} / {$attribute.name|wash}</td>
120
</tr>
121
{undef $class}
122
{/if}
123
{undef $attribute}
124
125
</tbody>
126
</table>
127
<input type="submit" class="button" name="CustomActionButton[{$event.id}_RemoveAttributes]" value="{'Remove selected'|i18n( 'design/admin/workflow/eventtype/edit' )}" />
128
{/if}
129
</fieldset>
130
</div>