Add missing `license` element in `package.xsd`
[GitHub/WoltLab/WCF.git] / wcfsetup / install / files / acp / templates / __devtoolsProjectInstructionsFormField.tpl
1 <dl id="{@$field->getPrefixedId()}Container"{*
2 *}{if !$field->getClasses()|empty} class="{implode from=$field->getClasses() item='class' glue=' '}{$class}{/implode}"{/if}{*
3 *}{foreach from=$field->getAttributes() key='attributeName' item='attributeValue'} {$attributeName}="{$attributeValue}"{/foreach}{*
4 *}{if !$field->checkDependencies()} style="display: none;"{/if}{*
5 *}>
6 <dt>{if $field->getLabel() !== null}<label for="{@$field->getPrefixedId()}">{@$field->getLabel()}</label>{/if}</dt>
7 <dd>
8 <div class="row rowColGap formGrid">
9 <dl class="col-xs-12 col-md-10">
10 <dt></dt>
11 <dd>
12 <select id="{@$field->getPrefixedId()}_instructionsType">
13 <option value="" selected disabled>{lang}wcf.acp.devtools.project.instructions.type{/lang}</option>
14 <option value="install">{lang}wcf.acp.devtools.project.instructions.type.install{/lang}</option>
15 <option value="update">{lang}wcf.acp.devtools.project.instructions.type.update{/lang}</option>
16 </select>
17 </dd>
18 </dl>
19
20 <dl class="col-xs-12 col-md-5" style="display: none;">
21 <dt></dt>
22 <dd>
23 <input type="text" id="{@$field->getPrefixedId()}_fromVersion" class="long" placeholder="{lang}wcf.acp.devtools.project.instructions.update.fromVersion{/lang}">
24 <small>{lang}wcf.acp.devtools.project.instructions.update.fromVersion.description{/lang}</small>
25 </dd>
26 </dl>
27
28 <dl class="col-xs-12 col-md-2 text-right">
29 <dt></dt>
30 <dd>
31 <a href="#" class="button small" id="{@$field->getPrefixedId()}_addButton">{lang}wcf.global.button.add{/lang}</a>
32 </dd>
33 </dl>
34 </div>
35
36 <ul id="{@$field->getPrefixedId()}_instructionsList"></ul>
37
38 {capture assign='instructionsTemplate'}
39 <header class="sectionHeader">
40 <h2 class="sectionTitle">
41 {literal}{if $type === 'update'}{/literal}
42 <span class="icon icon16 fa-pencil pointer jsTooltip" id="{@$field->getPrefixedId()}_instructions{literal}{$instructionsId}{/literal}_editButton" title="{lang}wcf.global.button.edit{/lang}"></span>
43 <span class="icon icon16 fa-times pointer jsTooltip" id="{@$field->getPrefixedId()}_instructions{literal}{$instructionsId}{/literal}_deleteButton" title="{lang}wcf.global.button.delete{/lang}"></span>
44 {literal}{/if}{/literal}
45 {literal}<span class="jsInstructionsTitle">{$sectionTitle}</span>{/literal}
46 </h2>
47 <p class="sectionDescription">{lang}wcf.acp.devtools.project.instructions.instructions.description{/lang}</p>
48 </header>
49
50 <div id="{@$field->getPrefixedId()}_instructions{literal}{$instructionsId}{/literal}_instructionListContainer">
51 <ol class="sortableList nativeList" id="{@$field->getPrefixedId()}_instructions{literal}{$instructionsId}{/literal}_instructionList"></ol>
52 </div>
53
54 <div class="row rowColGap formGrid">
55 <dl class="col-xs-12 col-md-3">
56 <dt></dt>
57 <dd>
58 <select id="{@$field->getPrefixedId()}_instructions{literal}{$instructionsId}{/literal}_pip">
59 <option value="" selected disabled>{lang}wcf.acp.devtools.project.instruction.packageInstallationPlugin{/lang}</option>
60 {foreach from=$packageInstallationPlugins item=packageInstallationPlugin}
61 <option value="{@$packageInstallationPlugin->pluginName}">{@$packageInstallationPlugin->pluginName}</option>
62 {/foreach}
63 </select>
64 </dd>
65 </dl>
66
67 <dl class="col-xs-12 col-md-9">
68 <dt></dt>
69 <dd>
70 <input type="text" id="{@$field->getPrefixedId()}_instructions{literal}{$instructionsId}{/literal}_value" class="long" placeholder="{lang}wcf.acp.devtools.project.instruction.value{/lang}">
71 <small id="{@$field->getPrefixedId()}_instructions{literal}{$instructionsId}{/literal}_valueDescription">{lang}wcf.acp.devtools.project.instruction.value.description{/lang}</small>
72 </dd>
73 </dl>
74
75 <dl class="col-xs-12 col-md-2" style="display: none;">
76 <dt></dt>
77 <dd>
78 <select id="{@$field->getPrefixedId()}_instructions{literal}{$instructionsId}{/literal}_application">
79 <option value="" selected disabled>{lang}wcf.acp.devtools.project.instruction.application{/lang}</option>
80 {foreach from=$apps item=app}
81 <option value="{@$app->getAbbreviation()}">{@$app->getAbbreviation()}</option>
82 {/foreach}
83 </select>
84 </dd>
85 </dl>
86
87 <dl class="col-xs-12 col-md-10">
88 <dt></dt>
89 <dd>
90 <label><input type="checkbox" id="{@$field->getPrefixedId()}_instructions{literal}{$instructionsId}{/literal}_runStandalone" value="1"> {lang}wcf.acp.devtools.project.instruction.runStandalone{/lang}</label>
91 <small>{lang}wcf.acp.devtools.project.instruction.runStandalone.description{/lang}</small>
92 </dd>
93 </dl>
94
95 <dl class="col-xs-12 col-md-2 text-right">
96 <dt></dt>
97 <dd>
98 <a href="#" class="button small" id="{@$field->getPrefixedId()}_instructions{literal}{$instructionsId}{/literal}_addButton">{lang}wcf.global.button.add{/lang}</a>
99 </dd>
100 </dl>
101 </div>
102 {/capture}
103
104 {capture assign='instructionsEditDialogContent'}
105 <div class="section">
106 <dl>
107 <dt>{lang}wcf.acp.devtools.project.instructions.update.fromVersion{/lang}</dt>
108 <dd>
109 <input type="text" name="fromVersion" class="long" value="{literal}{$fromVersion}{/literal}" autofocus />
110 <small>{lang}wcf.acp.devtools.project.instructions.update.fromVersion.description{/lang}</small>
111 </dd>
112 </dl>
113 </div>
114
115 <div class="formSubmit">
116 <button data-type="submit" class="buttonPrimary">{lang}wcf.global.button.submit{/lang}</button>
117 </div>
118 {/capture}
119
120 {capture assign='instructionEditDialogContent'}
121 <div class="section">
122 <dl>
123 <dt>{lang}wcf.acp.devtools.project.instruction.packageInstallationPlugin{/lang}</dt>
124 <dd>
125 <select name="pip">
126 <option value="" selected>{lang}wcf.global.noSelection{/lang}</option>
127 {foreach from=$packageInstallationPlugins item=packageInstallationPlugin}
128 <option value="{@$packageInstallationPlugin->pluginName}">{@$packageInstallationPlugin->pluginName}</option>
129 {/foreach}
130 </select>
131 </dd>
132 </dl>
133
134 <dl>
135 <dt>{lang}wcf.acp.devtools.project.instruction.value{/lang}</dt>
136 <dd>
137 <input type="text" name="value" class="long" value="{literal}{$value}{/literal}">
138 <small class="jsInstructionValueDescription">{lang}wcf.acp.devtools.project.instruction.value.description{/lang}</small>
139 </dd>
140 </dl>
141
142 <dl style="display: none;">
143 <dt>{lang}wcf.acp.devtools.project.instruction.application{/lang}</dt>
144 <dd>
145 <select name="application">
146 <option value="" selected>{lang}wcf.global.noSelection{/lang}</option>
147 {foreach from=$apps item=app}
148 <option value="{@$app->getAbbreviation()}">{@$app->getAbbreviation()}</option>
149 {/foreach}
150 </select>
151 </dd>
152 </dl>
153
154 <dl>
155 <dt></dt>
156 <dd>
157 <label><input type="checkbox" name="runStandalone" value="1"{literal}{if $runStandalone} checked{/if}{/literal}> {lang}wcf.acp.devtools.project.instruction.runStandalone{/lang}</label>
158 <small>{lang}wcf.acp.devtools.project.instruction.runStandalone.description{/lang}</small>
159 </dd>
160 </dl>
161 </div>
162
163 <div class="formSubmit">
164 <button data-type="submit" class="buttonPrimary">{lang}wcf.global.button.submit{/lang}</button>
165 </div>
166 {/capture}
167
168 {include file='__formFieldDescription'}
169 {include file='__formFieldDependencies'}
170 {include file='__formFieldDataHandler'}
171 </dd>
172 </dl>
173
174
175 <script data-relocate="true">
176 require([
177 'Language',
178 'WoltLabSuite/Core/Acp/Form/Builder/Field/Devtools/Project/Instructions',
179 'WoltLabSuite/Core/Template'
180 ], function(
181 Language,
182 InstructionsFormField,
183 Template
184 ) {
185 Language.addObject({
186 'wcf.acp.devtools.project.instruction.delete.confirmMessages': '{lang}wcf.acp.devtools.project.instruction.delete.confirmMessages{/lang}',
187 'wcf.acp.devtools.project.instruction.edit': '{lang}wcf.acp.devtools.project.instruction.edit{/lang}',
188 'wcf.acp.devtools.project.instruction.instruction': '{capture assign=__languageItem}{lang __literal=true}wcf.acp.devtools.project.instruction.instruction{/lang}{/capture}{@$__languageItem|encodeJS}',
189 'wcf.acp.devtools.project.instruction.value.description': '{lang}wcf.acp.devtools.project.instruction.value.description{/lang}',
190 'wcf.acp.devtools.project.instruction.value.description.defaultFilename': '{lang __literal=true}wcf.acp.devtools.project.instruction.value.description.defaultFilename{/lang}',
191 'wcf.acp.devtools.project.instructions.delete.confirmMessages': '{lang}wcf.acp.devtools.project.instructions.delete.confirmMessages{/lang}',
192 'wcf.acp.devtools.project.instructions.edit': '{lang}wcf.acp.devtools.project.instructions.edit{/lang}',
193 'wcf.acp.devtools.project.instructions.instructions.description': '{lang}wcf.acp.devtools.project.instructions.instructions.description{/lang}',
194 'wcf.acp.devtools.project.instructions.type.install.title': '{lang}wcf.acp.devtools.project.instructions.type.install.title{/lang}',
195 'wcf.acp.devtools.project.instructions.type.update.error.duplicate': '{lang}wcf.acp.devtools.project.instructions.type.update.error.duplicate{/lang}',
196 'wcf.acp.devtools.project.instructions.type.update.title': '{lang __literal=true}wcf.acp.devtools.project.instructions.type.update.title{/lang}',
197 'wcf.global.form.error.noValidSelection': '{lang}wcf.global.form.error.noValidSelection{/lang}'
198 });
199
200 var instructionsTemplate = new Template('{@$instructionsTemplate|encodeJS}');
201 var instructionsEditDialogTemplate = new Template('{@$instructionsEditDialogContent|encodeJS}');
202 var instructionEditDialogTemplate = new Template('{@$instructionEditDialogContent|encodeJS}');
203
204 new InstructionsFormField(
205 '{@$field->getPrefixedId()}',
206 instructionsTemplate,
207 instructionsEditDialogTemplate,
208 instructionEditDialogTemplate,
209 {
210 {implode from=$packageInstallationPlugins item=packageInstallationPlugin}
211 '{$packageInstallationPlugin->pluginName}': '{$packageInstallationPlugin->getDefaultFilename()}'
212 {/implode}
213 },
214 [
215 {implode from=$field->getValue() key=instructionsKey item=instructions}
216 {
217 errors: [
218 {assign var='__instructionsHasError' value=false}
219 {foreach from=$field->getValidationErrors() item=validationError}
220 {if $validationError->getInformation()[instructions]|isset && $validationError->getInformation()[instructions] === $instructionsKey && !$validationError->getInformation()[instruction]|isset}
221 {if $__instructionsHasError},{/if}
222 '{@$validationError->getMessage()|encodeJS}'
223
224 {assign var='__instructionsHasError' value=true}
225 {/if}
226 {/foreach}
227 ],
228 {if $instructions[type] === 'update'}
229 fromVersion: '{$instructions[fromVersion]}',
230 {/if}
231 instructions: [
232 {if !$instructions[instructions]|empty}
233 {implode from=$instructions[instructions] key=instructionKey item=instruction}
234 {
235 application: '{if $instruction[application]|isset}{$instruction[application]}{/if}',
236 errors: [
237 {assign var='__instructionHasError' value=false}
238 {foreach from=$field->getValidationErrors() item=validationError}
239 {if $validationError->getInformation()[instructions]|isset && $validationError->getInformation()[instructions] === $instructionsKey && $validationError->getInformation()[instruction]|isset && $validationError->getInformation()[instruction] === $instructionKey}
240 {if $__instructionHasError},{/if}
241 '{@$validationError->getMessage()|encodeJS}'
242
243 {assign var='__instructionHasError' value=true}
244 {/if}
245 {/foreach}
246 ],
247 pip: '{$instruction[pip]}',
248 runStandalone: {$instruction[runStandalone]|intval},
249 value: '{$instruction[value]|encodeJS}'
250 }
251 {/implode}
252 {/if}
253 ],
254 type: '{@$instructions[type]}'
255 }
256 {/implode}
257 ]
258 );
259 });
260 </script>