manageConditional.smarty
5.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<h2>{i18n}Manage conditional fieldset{/i18n}</h2>
<p class="descriptiveText">{i18n}Conditional fieldsets allow you to restrict the options
a user has for values in some fields based on the values in other fields. There
are two kinds of conditional fieldsets: <strong>Simple</strong> and <strong>Complex</strong>
. Simple fieldsets should be sufficient for most things: they allow you to say that
the values of one field are restricted to a certain subset of values if another field
has a specific value. For example, you could say that if the field "Street" is "Jeffrey",
then the field "Residents" must be one of "Jones","Smith" or "Friedman".{/i18n}</p>
<p class="descriptiveText">{i18n}Complex fieldsets allow you to give far more detailed structure to
your information: The value of "Residents" can depend not only on "Street", but on
how the user was allowed to select the specific street (given another field).{/i18n}</p>
{* don't show warnings until the basics are done. *}
{if ($oMasterField && empty($free_fields))}
{if $sIncomplete}
<div class="ktInfoMessage">
<span>{i18n}This conditional fieldset is marked such that it
cannot be used. The system automatically checks whether the fieldset is useable,
and if not it will prevent it being used in a "conditional" fashion. Please correct
the issues identified below.{/i18n}</span>
</div>
{/if}
{if $sIncomplete}
<div class="ktErrorMessage">
<span>{i18n}This error prevents this fieldset from being set
to complete{/i18n}: {$sIncomplete}</span>
</div>
{/if}
{/if}
<h2>{i18n}View Overview{/i18n}</h2>
<form action="{$smarty.server.PHP_SELF}" method="POST">
<input type="hidden" name="action" value="viewOverview" />
<input type="hidden" name="fieldset_id" value="{$oFieldset->getId()}" />
<input type="submit" name="submit" value="{i18n}View Overview{/i18n}" />
</form>
<h2>{i18n}Conditional type{/i18n}</h2>
{if $oFieldset->getIsComplex()}
<p>{i18n}The fieldset is currently designated as <strong>Complex</strong>{/i18n}</p>
{if ($oMasterField && empty($free_fields))}<p><a
class="ktActionLink ktEdit"
href="{$rootUrl}/plugins/ktcore/admin/manageConditionals.php?action=editComplexFieldset&fieldset_id={$oFieldset->getId()}">{i18n}Manage
complex conditional{/i18n}</a></p>{/if}
<form action="{$smarty.server.PHP_SELF}" method="POST">
<input type="hidden" name="action" value="changeToSimple" />
<input type="hidden" name="fFieldsetId" value="{$oFieldset->getId()}" />
<input type="submit" name="submit" value="{i18n}Change to simple{/i18n}" />
</form>
{else}
<p>{i18n}The fieldset is currently designated as <strong>Simple</strong>{/i18n}</p>
{if ($oMasterField && empty($free_fields))}<p><a
class="ktActionLink ktEdit"
href="{$rootUrl}/plugins/ktcore/admin/manageConditionals.php?action=editFieldset&fieldset_id={$oFieldset->getId()}">{i18n}Manage simple conditional{/i18n}</a>
</p>
{/if}
<form action="{$smarty.server.PHP_SELF}" method="POST">
<input type="hidden" name="action" value="changeToComplex" />
<input type="hidden" name="fFieldsetId" value="{$oFieldset->getId()}" />
<input type="submit" name="submit" value="{i18n}Change to complex{/i18n}" />
</form>
{/if}
<p>{i18n}Changing the conditional type set will remove all existing field
ordering!{/i18n}</p>
{if !$oMasterField}
<h2>{i18n}Master field{/i18n}</h2>
{i18n}No master field is set, please select the master field{/i18n}:
<form action="{$smarty.server.PHP_SELF}" method="POST">
<input type="hidden" name="action" value="setMasterField" />
<input type="hidden" name="fFieldsetId" value="{$oFieldset->getId()}" />
{entity_select entities=$oFieldset->getFields() name="fFieldId"}
<input type="submit" name="submit" value="{i18n}Set master field{/i18n}" />
</form>
{else}
<form action="{$smarty.server.PHP_SELF}" method="POST">
<fieldset>
<legend>{i18n}Master field{/i18n}</legend>
<input type="hidden" name="action" value="setMasterField" />
<input type="hidden" name="fFieldsetId" value="{$oFieldset->getId()}" />
<p class="descriptiveText">{i18n}In order to have a chain of conditions, one initial field
must be shown to the user. This is called the <strong>master field</strong>.{/i18n}</p>
<div class="form">
<p class="descriptiveText important">{i18n}Changing the master field set will remove all existing field
ordering!{/i18n}</p>
{entity_select entities=$oFieldset->getFields() name="fFieldId" selected=$oMasterField->getId()}
</div>
<div class="form_actions">
<input type="submit" name="submit" value="{i18n}Change master field{/i18n}" />
</div>
</fieldset>
</form>
<h2>{i18n}Field ordering{/i18n}</h2>
{if $aFieldOrders}
<h3>{i18n}Existing ordering{/i18n}</h2>
<ul>
{foreach from=$aFieldOrders item=aRow}
{php}
$this->assign("oParentField", DocumentField::get($this->_tpl_vars['aRow']['parent_field_id']));
$this->assign("oChildField", DocumentField::get($this->_tpl_vars['aRow']['child_field_id']));
{/php}
<li>
{$oParentField->getName()}
<span class="descriptiveText">{i18n}controls the values available in{/i18n}</span>
{$oChildField->getName()}
</li>
{/foreach}
</ul>
{/if}
{ if $free_fields }
<form action="{$smarty.server.PHP_SELF}" method="POST">
<fieldset>
<input type="hidden" name="fFieldsetId" value="{$oFieldset->getId()}" />
<input type="hidden" name="action" value="orderFields" />
<legend>{i18n}Order Fields{/i18n}</legend>
<div class="field">
<p class="descriptiveText">{i18n}The value of the field{/i18n}</p>
{entity_select entities=$parent_fields name="fParentFieldId"}
</div>
<div class="field">
<p class="descriptiveText">{i18n}controls the values of the following fields{/i18n}</p>
{entity_select entities=$free_fields name="fFreeFieldIds[]" multiple="yes"}
</div>
<div class="form_actions">
<input type="submit" name="submit" value="{i18n}Order{/i18n}" />
</div>
</fieldset>
</form>
{/if}
{/if}
<h2>{i18n}Rename Behaviours{/i18n}</h2>
<form action="{$smarty.server.PHP_SELF}" method="POST">
<input type="hidden" name="action" value="renameBehaviours" />
<input type="hidden" name="fieldset_id" value="{$oFieldset->getId()}" />
<input type="submit" name="submit" value="{i18n}Rename Behaviours{/i18n}" />
</form>