1 | <accessor debug="false" trace="false" deadlock="true"> |
---|
2 | <name>/isocat/manage/import</name> |
---|
3 | <descr>Import a DCIF document into the registry</descr> |
---|
4 | <param mandatory="true"> |
---|
5 | <name>action</name> |
---|
6 | <descr>what should we do?</descr> |
---|
7 | <type canonical="true">string</type> |
---|
8 | <source> |
---|
9 | <param/> |
---|
10 | <nvp/> |
---|
11 | <default> |
---|
12 | <string>refresh</string> |
---|
13 | </default> |
---|
14 | </source> |
---|
15 | </param> |
---|
16 | <param> |
---|
17 | <name>id</name> |
---|
18 | <descr>import id</descr> |
---|
19 | <type canonical="true">string</type> |
---|
20 | <source> |
---|
21 | <nvp/> |
---|
22 | <default> |
---|
23 | <string/> |
---|
24 | </default> |
---|
25 | </source> |
---|
26 | </param> |
---|
27 | <param> |
---|
28 | <name>dcif</name> |
---|
29 | <descr>DCIF document to import</descr> |
---|
30 | <source> |
---|
31 | <param/> |
---|
32 | <default> |
---|
33 | <null/> |
---|
34 | </default> |
---|
35 | </source> |
---|
36 | </param> |
---|
37 | <param> |
---|
38 | <name>owner</name> |
---|
39 | <descr>user id</descr> |
---|
40 | <type canonical="true">string</type> |
---|
41 | <source> |
---|
42 | <nvp/> |
---|
43 | <default> |
---|
44 | <string/> |
---|
45 | </default> |
---|
46 | </source> |
---|
47 | </param> |
---|
48 | <param> |
---|
49 | <name>external</name> |
---|
50 | <descr>external DCs</descr> |
---|
51 | <type canonical="true">string</type> |
---|
52 | <source> |
---|
53 | <nvp/> |
---|
54 | <default> |
---|
55 | <string>false</string> |
---|
56 | </default> |
---|
57 | </source> |
---|
58 | </param> |
---|
59 | <param> |
---|
60 | <name>validation-mode</name> |
---|
61 | <descr>validation mode</descr> |
---|
62 | <type canonical="true">string</type> |
---|
63 | <source> |
---|
64 | <nvp/> |
---|
65 | <default> |
---|
66 | <string>strict</string> |
---|
67 | </default> |
---|
68 | </source> |
---|
69 | </param> |
---|
70 | <param> |
---|
71 | <name>shared</name> |
---|
72 | <descr>also update shared DCs</descr> |
---|
73 | <type canonical="true">string</type> |
---|
74 | <source> |
---|
75 | <nvp/> |
---|
76 | <default> |
---|
77 | <string>false</string> |
---|
78 | </default> |
---|
79 | </source> |
---|
80 | </param> |
---|
81 | <params/> |
---|
82 | <idoc> |
---|
83 | <accessor-debug> |
---|
84 | <instr> |
---|
85 | <type>log</type> |
---|
86 | <operand>var:params</operand> |
---|
87 | </instr> |
---|
88 | </accessor-debug> |
---|
89 | <if> |
---|
90 | <cond> |
---|
91 | <instr> |
---|
92 | <type>sloot.xpath2eval</type> |
---|
93 | <operand>var:action</operand> |
---|
94 | <operator> |
---|
95 | <xpath>(normalize-space(.)='') or (normalize-space(.)='init')</xpath> |
---|
96 | </operator> |
---|
97 | <target>this:cond</target> |
---|
98 | </instr> |
---|
99 | </cond> |
---|
100 | <then> |
---|
101 | <!-- create an import id --> |
---|
102 | <instr> |
---|
103 | <type>xslt2</type> |
---|
104 | <operand> |
---|
105 | <null/> |
---|
106 | </operand> |
---|
107 | <operator> |
---|
108 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> |
---|
109 | <xsl:template match="/"> |
---|
110 | <string> |
---|
111 | <xsl:value-of select="format-dateTime(current-dateTime(),'[Y][M01][D01][H01][m01][s01][f01]')"/> |
---|
112 | </string> |
---|
113 | </xsl:template> |
---|
114 | </xsl:stylesheet> |
---|
115 | </operator> |
---|
116 | <target>var:id</target> |
---|
117 | </instr> |
---|
118 | <accessor-debug> |
---|
119 | <instr> |
---|
120 | <type>sloot.log</type> |
---|
121 | <operand>var:id</operand> |
---|
122 | </instr> |
---|
123 | </accessor-debug> |
---|
124 | <!-- create a DCIF import directory --> |
---|
125 | <instr> |
---|
126 | <type>xslt2</type> |
---|
127 | <operand>var:id</operand> |
---|
128 | <operator> |
---|
129 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> |
---|
130 | <xsl:template match="/"> |
---|
131 | <uri> |
---|
132 | <xsl:text>ffcpl:/import/</xsl:text> |
---|
133 | <xsl:value-of select="."/> |
---|
134 | <xsl:text>/</xsl:text> |
---|
135 | </uri> |
---|
136 | </xsl:template> |
---|
137 | </xsl:stylesheet> |
---|
138 | </operator> |
---|
139 | <target>var:dir</target> |
---|
140 | </instr> |
---|
141 | <accessor-debug> |
---|
142 | <instr> |
---|
143 | <type>sloot.log</type> |
---|
144 | <operand>var:dir</operand> |
---|
145 | </instr> |
---|
146 | </accessor-debug> |
---|
147 | <!-- put the DCIF document in the import directory --> |
---|
148 | <instr> |
---|
149 | <type>resolveURI</type> |
---|
150 | <operand> |
---|
151 | <uri>dcif.xml</uri> |
---|
152 | </operand> |
---|
153 | <operator>var:dir</operator> |
---|
154 | <target>var:loc</target> |
---|
155 | </instr> |
---|
156 | <instr> |
---|
157 | <type>copy</type> |
---|
158 | <operand>var:dcif</operand> |
---|
159 | <target>curi:var:loc</target> |
---|
160 | </instr> |
---|
161 | <!-- lookup the owner id --> |
---|
162 | <instr> |
---|
163 | <type>ISOcat.access.data.user.id</type> |
---|
164 | <user>var:owner</user> |
---|
165 | <target>var:owner</target> |
---|
166 | </instr> |
---|
167 | <instr> |
---|
168 | <type>sloot.xquery</type> |
---|
169 | <operator> |
---|
170 | <sql> |
---|
171 | SELECT |
---|
172 | view_owner.id, |
---|
173 | name, |
---|
174 | login, |
---|
175 | CASE |
---|
176 | WHEN (login IS NULL) |
---|
177 | THEN 'TDG' |
---|
178 | ELSE 'user' |
---|
179 | END AS type |
---|
180 | FROM |
---|
181 | view_owner |
---|
182 | LEFT JOIN |
---|
183 | core_user |
---|
184 | ON |
---|
185 | view_owner.id = core_user.id |
---|
186 | WHERE |
---|
187 | view_owner.id = {string($owner)} |
---|
188 | ; |
---|
189 | </sql> |
---|
190 | </operator> |
---|
191 | <owner>var:owner</owner> |
---|
192 | <target>var:sql</target> |
---|
193 | </instr> |
---|
194 | <instr> |
---|
195 | <type>ISOcat.access.data.query</type> |
---|
196 | <query>var:sql</query> |
---|
197 | <target>var:owner</target> |
---|
198 | </instr> |
---|
199 | <!-- create an initial status document --> |
---|
200 | <instr> |
---|
201 | <type>sloot.xquery</type> |
---|
202 | <operator> |
---|
203 | <xquery> |
---|
204 | declare variable $id as node() external; |
---|
205 | declare variable $params as node() external; |
---|
206 | declare variable $owner as node() external; |
---|
207 | <import id="{string($id)}"> |
---|
208 | <config> |
---|
209 | {$params} |
---|
210 | </config> |
---|
211 | <owner> |
---|
212 | {$owner} |
---|
213 | </owner> |
---|
214 | <valid/> |
---|
215 | <check/> |
---|
216 | <result/> |
---|
217 | </import> |
---|
218 | </xquery> |
---|
219 | </operator> |
---|
220 | <params>var:params</params> |
---|
221 | <owner>var:owner</owner> |
---|
222 | <id>var:id</id> |
---|
223 | <target>var:status</target> |
---|
224 | </instr> |
---|
225 | <instr> |
---|
226 | <type>resolveURI</type> |
---|
227 | <operand> |
---|
228 | <uri>status.xml</uri> |
---|
229 | </operand> |
---|
230 | <operator>var:dir</operator> |
---|
231 | <target>var:loc</target> |
---|
232 | </instr> |
---|
233 | <instr> |
---|
234 | <type>copy</type> |
---|
235 | <operand>var:status</operand> |
---|
236 | <target>curi:var:loc</target> |
---|
237 | </instr> |
---|
238 | </then> |
---|
239 | <else> |
---|
240 | <!-- determine the import directory --> |
---|
241 | <instr> |
---|
242 | <type>xslt2</type> |
---|
243 | <operand>var:id</operand> |
---|
244 | <operator> |
---|
245 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> |
---|
246 | <xsl:template match="/"> |
---|
247 | <uri> |
---|
248 | <xsl:text>ffcpl:/import/</xsl:text> |
---|
249 | <xsl:value-of select="."/> |
---|
250 | <xsl:text>/</xsl:text> |
---|
251 | </uri> |
---|
252 | </xsl:template> |
---|
253 | </xsl:stylesheet> |
---|
254 | </operator> |
---|
255 | <target>var:dir</target> |
---|
256 | </instr> |
---|
257 | <!-- load the status --> |
---|
258 | <instr> |
---|
259 | <type>resolveURI</type> |
---|
260 | <operand> |
---|
261 | <uri>status.xml</uri> |
---|
262 | </operand> |
---|
263 | <operator>var:dir</operator> |
---|
264 | <target>var:loc</target> |
---|
265 | </instr> |
---|
266 | <instr> |
---|
267 | <type>copy</type> |
---|
268 | <operand>curi:var:loc</operand> |
---|
269 | <target>var:status</target> |
---|
270 | </instr> |
---|
271 | </else> |
---|
272 | </if> |
---|
273 | <!-- execute the requested action --> |
---|
274 | <choose> |
---|
275 | <cond> |
---|
276 | <instr> |
---|
277 | <type>sloot.xpath2eval</type> |
---|
278 | <operand>var:action</operand> |
---|
279 | <operator> |
---|
280 | <xpath>.='validate'</xpath> |
---|
281 | </operator> |
---|
282 | <target>this:cond</target> |
---|
283 | </instr> |
---|
284 | </cond> |
---|
285 | <then> |
---|
286 | <!-- validate the DCIF --> |
---|
287 | <instr> |
---|
288 | <type>resolveURI</type> |
---|
289 | <operand> |
---|
290 | <uri>dcif.xml</uri> |
---|
291 | </operand> |
---|
292 | <operator>var:dir</operator> |
---|
293 | <target>var:loc</target> |
---|
294 | </instr> |
---|
295 | <if> |
---|
296 | <cond> |
---|
297 | <instr> |
---|
298 | <type>sloot.xpath2eval</type> |
---|
299 | <operand>var:validation-mode</operand> |
---|
300 | <operator> |
---|
301 | <xpath>.='lax'</xpath> |
---|
302 | </operator> |
---|
303 | <target>this:cond</target> |
---|
304 | </instr> |
---|
305 | </cond> |
---|
306 | <then> |
---|
307 | <instr> |
---|
308 | <type>validateRNG</type> |
---|
309 | <operand>curi:var:loc</operand> |
---|
310 | <operator>active:ISOcat.access.data.dcif.schema.lax</operator> |
---|
311 | <target>var:valid</target> |
---|
312 | </instr> |
---|
313 | </then> |
---|
314 | <else> |
---|
315 | <instr> |
---|
316 | <type>validateRNG</type> |
---|
317 | <operand>curi:var:loc</operand> |
---|
318 | <operator>active:ISOcat.access.data.dcif.schema</operator> |
---|
319 | <target>var:valid</target> |
---|
320 | </instr> |
---|
321 | </else> |
---|
322 | </if> |
---|
323 | <!-- dump the validation result --> |
---|
324 | <instr> |
---|
325 | <type>resolveURI</type> |
---|
326 | <operand> |
---|
327 | <uri>validation.xml</uri> |
---|
328 | </operand> |
---|
329 | <operator>var:dir</operator> |
---|
330 | <target>var:loc</target> |
---|
331 | </instr> |
---|
332 | <instr> |
---|
333 | <type>copy</type> |
---|
334 | <operand>var:valid</operand> |
---|
335 | <target>curi:var:loc</target> |
---|
336 | </instr> |
---|
337 | <!-- update the validation status --> |
---|
338 | <instr> |
---|
339 | <type>xslt2</type> |
---|
340 | <operand>var:status</operand> |
---|
341 | <operator> |
---|
342 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> |
---|
343 | <xsl:param name="valid"/> |
---|
344 | <xsl:param name="validation-mode"/> |
---|
345 | <xsl:template match="@*|node()"> |
---|
346 | <xsl:copy> |
---|
347 | <xsl:apply-templates select="@*|node()"/> |
---|
348 | </xsl:copy> |
---|
349 | </xsl:template> |
---|
350 | <xsl:template match="valid"> |
---|
351 | <xsl:copy> |
---|
352 | <xsl:choose> |
---|
353 | <xsl:when test="$validation-mode='lax'"> |
---|
354 | <xsl:attribute name="mode" select="'lax'"/> |
---|
355 | </xsl:when> |
---|
356 | <xsl:otherwise> |
---|
357 | <xsl:attribute name="mode" select="'strict'"/> |
---|
358 | </xsl:otherwise> |
---|
359 | </xsl:choose> |
---|
360 | <xsl:copy-of select="$valid"/> |
---|
361 | </xsl:copy> |
---|
362 | </xsl:template> |
---|
363 | </xsl:stylesheet> |
---|
364 | </operator> |
---|
365 | <valid>var:valid</valid> |
---|
366 | <validation-mode>var:validation-mode</validation-mode> |
---|
367 | <target>var:status</target> |
---|
368 | </instr> |
---|
369 | <instr> |
---|
370 | <type>resolveURI</type> |
---|
371 | <operand> |
---|
372 | <uri>status.xml</uri> |
---|
373 | </operand> |
---|
374 | <operator>var:dir</operator> |
---|
375 | <target>var:loc</target> |
---|
376 | </instr> |
---|
377 | <instr> |
---|
378 | <type>copy</type> |
---|
379 | <operand>var:status</operand> |
---|
380 | <target>curi:var:loc</target> |
---|
381 | </instr> |
---|
382 | </then> |
---|
383 | <cond> |
---|
384 | <instr> |
---|
385 | <type>sloot.xpath2eval</type> |
---|
386 | <operand>var:action</operand> |
---|
387 | <operator> |
---|
388 | <xpath>.=('check','forced check')</xpath> |
---|
389 | </operator> |
---|
390 | <target>this:cond</target> |
---|
391 | </instr> |
---|
392 | </cond> |
---|
393 | <then> |
---|
394 | <!-- check the DCIF --> |
---|
395 | <instr> |
---|
396 | <type>resolveURI</type> |
---|
397 | <operand> |
---|
398 | <uri>dcif.xml</uri> |
---|
399 | </operand> |
---|
400 | <operator>var:dir</operator> |
---|
401 | <target>var:loc</target> |
---|
402 | </instr> |
---|
403 | <!-- lookup the PID's and collect them in a DCS --> |
---|
404 | <instr> |
---|
405 | <type>xslt2</type> |
---|
406 | <operand>curi:var:loc</operand> |
---|
407 | <operator> |
---|
408 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" |
---|
409 | xmlns:dcif="http://www.isocat.org/ns/dcif" |
---|
410 | exclude-result-prefixes="dcif" |
---|
411 | > |
---|
412 | <xsl:param name="status"/> |
---|
413 | <xsl:param name="shared"/> |
---|
414 | <xsl:template match="text()"/> |
---|
415 | <xsl:template match="/dcif:dataCategorySelection"> |
---|
416 | <script> |
---|
417 | <batch> |
---|
418 | <sql>CREATE TEMPORARY TABLE DCIFimport (pid character varying,tpe character varying,action character varying) ON COMMIT DROP;</sql> |
---|
419 | <xsl:apply-templates/> |
---|
420 | </batch> |
---|
421 | <sql> |
---|
422 | SELECT |
---|
423 | CASE |
---|
424 | WHEN id IS NULL |
---|
425 | THEN nextval('core_data_category_id_seq'::regclass) |
---|
426 | ELSE id |
---|
427 | END AS id, |
---|
428 | DCIFimport.pid, |
---|
429 | DCIFimport.tpe, |
---|
430 | CASE |
---|
431 | WHEN action IS NOT NULL |
---|
432 | THEN action |
---|
433 | WHEN id IS NULL |
---|
434 | THEN 'create' |
---|
435 | --WHEN view_data_category.private |
---|
436 | --THEN 'update' |
---|
437 | --ELSE 'revision' |
---|
438 | WHEN owner_id = <xsl:value-of select="$status//owner//id"/> |
---|
439 | THEN 'update' |
---|
440 | WHEN rights::text LIKE '%u%' |
---|
441 | THEN 'update' |
---|
442 | ELSE 'select' |
---|
443 | END AS action |
---|
444 | FROM |
---|
445 | DCIFimport |
---|
446 | LEFT JOIN |
---|
447 | view_data_category |
---|
448 | ON |
---|
449 | view_data_category.pid = DCIFimport.pid |
---|
450 | LEFT JOIN |
---|
451 | view_dc_access |
---|
452 | ON |
---|
453 | view_dc_access.dc = view_data_category.id |
---|
454 | AND |
---|
455 | view_dc_access.account = <xsl:value-of select="$status//owner//id"/> |
---|
456 | AND |
---|
457 | view_dc_access."type" = '<xsl:value-of select="if ($shared='true') then ('user') else ('owner')"/>' |
---|
458 | ORDER BY tpe DESC |
---|
459 | ; |
---|
460 | </sql> |
---|
461 | </script> |
---|
462 | </xsl:template> |
---|
463 | <xsl:template match="dcif:dataCategory[exists(*)]"> |
---|
464 | <sql> |
---|
465 | <xsl:text>INSERT INTO DCIFimport (pid,tpe) VALUES ('</xsl:text> |
---|
466 | <xsl:value-of select="replace(@pid,'''','''''')"/> |
---|
467 | <xsl:text>','</xsl:text> |
---|
468 | <xsl:value-of select="@type"/> |
---|
469 | <xsl:text>');</xsl:text> |
---|
470 | </sql> |
---|
471 | </xsl:template> |
---|
472 | <xsl:template match="dcif:dataCategory[empty(*)]"> |
---|
473 | <sql> |
---|
474 | <xsl:text>INSERT INTO DCIFimport (pid,tpe,action) VALUES ('</xsl:text> |
---|
475 | <xsl:value-of select="replace(@pid,'''','''''')"/> |
---|
476 | <xsl:text>','</xsl:text> |
---|
477 | <xsl:value-of select="@type"/> |
---|
478 | <xsl:text>','select');</xsl:text> |
---|
479 | </sql> |
---|
480 | </xsl:template> |
---|
481 | </xsl:stylesheet> |
---|
482 | </operator> |
---|
483 | <status>var:status</status> |
---|
484 | <shared>var:shared</shared> |
---|
485 | <target>var:sql</target> |
---|
486 | </instr> |
---|
487 | <accessor-debug> |
---|
488 | <instr> |
---|
489 | <type>copy</type> |
---|
490 | <operand>var:sql</operand> |
---|
491 | <target>ffcpl:/trace/DCIFimport.sql.xml</target> |
---|
492 | </instr> |
---|
493 | </accessor-debug> |
---|
494 | <instr> |
---|
495 | <type>ISOcat.access.data.query</type> |
---|
496 | <query>var:sql</query> |
---|
497 | <target>var:check</target> |
---|
498 | </instr> |
---|
499 | <!-- annotate the dcif with the ids --> |
---|
500 | <instr> |
---|
501 | <type>xslt2</type> |
---|
502 | <operand>curi:var:loc</operand> |
---|
503 | <operator> |
---|
504 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" |
---|
505 | xmlns:dcif="http://www.isocat.org/ns/dcif" |
---|
506 | xmlns:isocat="http://www.isocat.org/" |
---|
507 | > |
---|
508 | <xsl:param name="check"/> |
---|
509 | <xsl:template match="@*|node()"> |
---|
510 | <xsl:copy> |
---|
511 | <xsl:apply-templates select="@*|node()"/> |
---|
512 | </xsl:copy> |
---|
513 | </xsl:template> |
---|
514 | <xsl:template match="dcif:*[exists(self::dcif:isA|self::dcif:value)][exists(@pid)]" priority="1"> |
---|
515 | <xsl:copy> |
---|
516 | <xsl:apply-templates select="@*"/> |
---|
517 | <xsl:variable name="row" select="$check//row[pid=current()/@pid]"/> |
---|
518 | <xsl:choose> |
---|
519 | <xsl:when test="exists($row)"> |
---|
520 | <xsl:attribute name="isocat:id" select="$row/id"/> |
---|
521 | </xsl:when> |
---|
522 | <xsl:otherwise> |
---|
523 | <xsl:variable name="uri" select="concat('active:ISOcat.access.data.dc.pid2id+pid@data:text/plain,',encode-for-uri(current()/@pid))"/> |
---|
524 | <!--<xsl:message>NK URI[<xsl:value-of select="$uri"/>]</xsl:message>--> |
---|
525 | <xsl:variable name="id" select="doc($uri)"/> |
---|
526 | <xsl:choose> |
---|
527 | <xsl:when test="normalize-space($id)!=''"> |
---|
528 | <xsl:attribute name="isocat:id" select="normalize-space($id)"/> |
---|
529 | </xsl:when> |
---|
530 | <xsl:otherwise> |
---|
531 | <xsl:message>ERR: unresolvable PID[<xsl:value-of select="current()/@pid"/>]!</xsl:message> |
---|
532 | </xsl:otherwise> |
---|
533 | </xsl:choose> |
---|
534 | </xsl:otherwise> |
---|
535 | </xsl:choose> |
---|
536 | <xsl:apply-templates select="node()"/> |
---|
537 | </xsl:copy> |
---|
538 | </xsl:template> |
---|
539 | </xsl:stylesheet> |
---|
540 | </operator> |
---|
541 | <check>var:check</check> |
---|
542 | <target>curi:var:loc</target> |
---|
543 | </instr> |
---|
544 | <!-- add the is-a info to the check result --> |
---|
545 | <instr> |
---|
546 | <type>xslt2</type> |
---|
547 | <operand>var:check</operand> |
---|
548 | <operator> |
---|
549 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" |
---|
550 | xmlns:dcif="http://www.isocat.org/ns/dcif" |
---|
551 | xmlns:isocat="http://www.isocat.org/" |
---|
552 | exclude-result-prefixes="dcif isocat" |
---|
553 | > |
---|
554 | <xsl:param name="dcif"/> |
---|
555 | <xsl:template match="@*|node()"> |
---|
556 | <xsl:copy> |
---|
557 | <xsl:apply-templates select="@*|node()"/> |
---|
558 | </xsl:copy> |
---|
559 | </xsl:template> |
---|
560 | <xsl:template match="row[tpe='simple']" priority="1"> |
---|
561 | <xsl:copy> |
---|
562 | <xsl:apply-templates select="@*"/> |
---|
563 | <xsl:variable name="dc" select="$dcif//dcif:dataCategory[@pid=current()/pid]"/> |
---|
564 | <xsl:if test="exists($dc/dcif:isA/@isocat:id)"> |
---|
565 | <isa> |
---|
566 | <xsl:value-of select="$dc/dcif:isA/@isocat:id"/> |
---|
567 | </isa> |
---|
568 | </xsl:if> |
---|
569 | <xsl:apply-templates select="node()"/> |
---|
570 | </xsl:copy> |
---|
571 | </xsl:template> |
---|
572 | </xsl:stylesheet> |
---|
573 | </operator> |
---|
574 | <dcif>curi:var:loc</dcif> |
---|
575 | <target>var:check</target> |
---|
576 | </instr> |
---|
577 | <!-- sort the check result --> |
---|
578 | <instr> |
---|
579 | <type>xslt2</type> |
---|
580 | <operand>var:check</operand> |
---|
581 | <operator> |
---|
582 | <xsl:stylesheet |
---|
583 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" |
---|
584 | xmlns:isocat="http://www.isocat.org/" |
---|
585 | > |
---|
586 | <xsl:variable name="rows" select="//row"/> |
---|
587 | <xsl:template match="@*|node()"> |
---|
588 | <xsl:copy> |
---|
589 | <xsl:apply-templates select="@*|node()"/> |
---|
590 | </xsl:copy> |
---|
591 | </xsl:template> |
---|
592 | <xsl:function name="isocat:path"> |
---|
593 | <xsl:param name="row"/> |
---|
594 | <xsl:choose> |
---|
595 | <xsl:when test="exists($row/isa)"> |
---|
596 | <xsl:variable name="isa" select="$rows[id=$row/isa]"/> |
---|
597 | <xsl:sequence select="concat(isocat:path($isa),'/',$row/id)"/> |
---|
598 | </xsl:when> |
---|
599 | <xsl:otherwise> |
---|
600 | <xsl:sequence select="concat('/',$row/id)"/> |
---|
601 | </xsl:otherwise> |
---|
602 | </xsl:choose> |
---|
603 | </xsl:function> |
---|
604 | <xsl:template match="results" priority="1"> |
---|
605 | <xsl:copy> |
---|
606 | <xsl:apply-templates select="row[tpe='simple']"> |
---|
607 | <xsl:sort select="isocat:path(.)"/> |
---|
608 | </xsl:apply-templates> |
---|
609 | <xsl:apply-templates select="row[tpe!='simple']"/> |
---|
610 | </xsl:copy> |
---|
611 | </xsl:template> |
---|
612 | </xsl:stylesheet> |
---|
613 | </operator> |
---|
614 | <target>var:check</target> |
---|
615 | </instr> |
---|
616 | <!-- dump the check result --> |
---|
617 | <instr> |
---|
618 | <type>resolveURI</type> |
---|
619 | <operand> |
---|
620 | <uri>check.xml</uri> |
---|
621 | </operand> |
---|
622 | <operator>var:dir</operator> |
---|
623 | <target>var:loc</target> |
---|
624 | </instr> |
---|
625 | <instr> |
---|
626 | <type>copy</type> |
---|
627 | <operand>var:check</operand> |
---|
628 | <target>curi:var:loc</target> |
---|
629 | </instr> |
---|
630 | <!-- update the check status --> |
---|
631 | <instr> |
---|
632 | <type>xslt2</type> |
---|
633 | <operand>var:status</operand> |
---|
634 | <operator> |
---|
635 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> |
---|
636 | <xsl:param name="action"/> |
---|
637 | <xsl:param name="check"/> |
---|
638 | <xsl:param name="shared"/> |
---|
639 | <xsl:template match="@*|node()"> |
---|
640 | <xsl:copy> |
---|
641 | <xsl:apply-templates select="@*|node()"/> |
---|
642 | </xsl:copy> |
---|
643 | </xsl:template> |
---|
644 | <xsl:template match="check"> |
---|
645 | <xsl:copy> |
---|
646 | <xsl:choose> |
---|
647 | <xsl:when test="$action='forced check'"> |
---|
648 | <xsl:attribute name="forced" select="'true'"/> |
---|
649 | </xsl:when> |
---|
650 | <xsl:otherwise> |
---|
651 | <xsl:attribute name="forced" select="'false'"/> |
---|
652 | </xsl:otherwise> |
---|
653 | </xsl:choose> |
---|
654 | <xsl:attribute name="shared" select="$shared"/> |
---|
655 | <xsl:copy-of select="$check"/> |
---|
656 | </xsl:copy> |
---|
657 | </xsl:template> |
---|
658 | </xsl:stylesheet> |
---|
659 | </operator> |
---|
660 | <action>var:action</action> |
---|
661 | <check>var:check</check> |
---|
662 | <shared>var:shared</shared> |
---|
663 | <target>var:status</target> |
---|
664 | </instr> |
---|
665 | <instr> |
---|
666 | <type>resolveURI</type> |
---|
667 | <operand> |
---|
668 | <uri>status.xml</uri> |
---|
669 | </operand> |
---|
670 | <operator>var:dir</operator> |
---|
671 | <target>var:loc</target> |
---|
672 | </instr> |
---|
673 | <instr> |
---|
674 | <type>copy</type> |
---|
675 | <operand>var:status</operand> |
---|
676 | <target>curi:var:loc</target> |
---|
677 | </instr> |
---|
678 | </then> |
---|
679 | <cond> |
---|
680 | <instr> |
---|
681 | <type>sloot.xpath2eval</type> |
---|
682 | <operand>var:action</operand> |
---|
683 | <operator> |
---|
684 | <xpath>.='disable' or .='disable-all' or .='enable-all'</xpath> |
---|
685 | </operator> |
---|
686 | <target>this:cond</target> |
---|
687 | </instr> |
---|
688 | </cond> |
---|
689 | <then> |
---|
690 | <!-- en/disable import actions --> |
---|
691 | <instr> |
---|
692 | <type>xslt2</type> |
---|
693 | <operand>var:status</operand> |
---|
694 | <operator> |
---|
695 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> |
---|
696 | <xsl:param name="action"/> |
---|
697 | <xsl:param name="actions"/> |
---|
698 | <xsl:template match="@*|node()"> |
---|
699 | <xsl:copy> |
---|
700 | <xsl:apply-templates select="@*|node()"/> |
---|
701 | </xsl:copy> |
---|
702 | </xsl:template> |
---|
703 | <xsl:template match="enabled"/> |
---|
704 | <xsl:template match="check//row"> |
---|
705 | <xsl:copy> |
---|
706 | <xsl:apply-templates select="@*|node()"/> |
---|
707 | <xsl:variable name="row" select="count(preceding::row) + 1"/> |
---|
708 | <xsl:choose> |
---|
709 | <xsl:when test="$action='enable-all'"> |
---|
710 | <enabled>true</enabled> |
---|
711 | </xsl:when> |
---|
712 | <xsl:when test="$action='disable-all'"> |
---|
713 | <enabled>false</enabled> |
---|
714 | </xsl:when> |
---|
715 | <xsl:when test="exists($actions//*[name()=concat('enabled-row-',$row)])"> |
---|
716 | <enabled>true</enabled> |
---|
717 | </xsl:when> |
---|
718 | <xsl:otherwise> |
---|
719 | <enabled>false</enabled> |
---|
720 | </xsl:otherwise> |
---|
721 | </xsl:choose> |
---|
722 | </xsl:copy> |
---|
723 | </xsl:template> |
---|
724 | </xsl:stylesheet> |
---|
725 | </operator> |
---|
726 | <action>var:action</action> |
---|
727 | <actions>var:params</actions> |
---|
728 | <target>var:status</target> |
---|
729 | </instr> |
---|
730 | <instr> |
---|
731 | <type>resolveURI</type> |
---|
732 | <operand> |
---|
733 | <uri>status.xml</uri> |
---|
734 | </operand> |
---|
735 | <operator>var:dir</operator> |
---|
736 | <target>var:loc</target> |
---|
737 | </instr> |
---|
738 | <instr> |
---|
739 | <type>copy</type> |
---|
740 | <operand>var:status</operand> |
---|
741 | <target>curi:var:loc</target> |
---|
742 | </instr> |
---|
743 | </then> |
---|
744 | <cond> |
---|
745 | <instr> |
---|
746 | <type>sloot.xpath2eval</type> |
---|
747 | <operand>var:action</operand> |
---|
748 | <operator> |
---|
749 | <xpath>.='backup'</xpath> |
---|
750 | </operator> |
---|
751 | <target>this:cond</target> |
---|
752 | </instr> |
---|
753 | </cond> |
---|
754 | <then> |
---|
755 | <!-- backup existing DCs to DCIF --> |
---|
756 | <instr> |
---|
757 | <type>xslt2</type> |
---|
758 | <operand>var:status</operand> |
---|
759 | <operator> |
---|
760 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" |
---|
761 | xmlns:dcif="http://www.isocat.org/ns/dcif" |
---|
762 | exclude-result-prefixes="dcif" |
---|
763 | > |
---|
764 | <xsl:template match="text()"/> |
---|
765 | <xsl:template match="/import"> |
---|
766 | <dcs type="dcs" key="import-{@id}"> |
---|
767 | <xsl:apply-templates select="check//row"/> |
---|
768 | </dcs> |
---|
769 | </xsl:template> |
---|
770 | <xsl:template match="row[normalize-space(id)!=''][action='update' or action='revision'][empty(enabled) or enabled='true']"> |
---|
771 | <dc ref="{id}"/> |
---|
772 | </xsl:template> |
---|
773 | </xsl:stylesheet> |
---|
774 | </operator> |
---|
775 | <target>var:dcs</target> |
---|
776 | </instr> |
---|
777 | <accessor-debug> |
---|
778 | <instr> |
---|
779 | <type>log</type> |
---|
780 | <operand>var:dcs</operand> |
---|
781 | </instr> |
---|
782 | </accessor-debug> |
---|
783 | <instr> |
---|
784 | <type>ISOcat.access.data.dcs.to.dcif</type> |
---|
785 | <dcs>var:dcs</dcs> |
---|
786 | <target>var:backup</target> |
---|
787 | </instr> |
---|
788 | <!-- put the backup DCIF document in the import directory --> |
---|
789 | <instr> |
---|
790 | <type>resolveURI</type> |
---|
791 | <operand> |
---|
792 | <uri>backup.xml</uri> |
---|
793 | </operand> |
---|
794 | <operator>var:dir</operator> |
---|
795 | <target>var:loc</target> |
---|
796 | </instr> |
---|
797 | <instr> |
---|
798 | <type>copy</type> |
---|
799 | <operand>var:backup</operand> |
---|
800 | <target>curi:var:loc</target> |
---|
801 | </instr> |
---|
802 | </then> |
---|
803 | <cond> |
---|
804 | <instr> |
---|
805 | <type>sloot.xpath2eval</type> |
---|
806 | <operand>var:action</operand> |
---|
807 | <operator> |
---|
808 | <xpath>.='import'</xpath> |
---|
809 | </operator> |
---|
810 | <target>this:cond</target> |
---|
811 | </instr> |
---|
812 | </cond> |
---|
813 | <then> |
---|
814 | <!-- the actual import --> |
---|
815 | <instr> |
---|
816 | <type>resolveURI</type> |
---|
817 | <operand> |
---|
818 | <uri>dcif.xml</uri> |
---|
819 | </operand> |
---|
820 | <operator>var:dir</operator> |
---|
821 | <target>var:loc</target> |
---|
822 | </instr> |
---|
823 | <instr> |
---|
824 | <type>copy</type> |
---|
825 | <operand>curi:var:loc</operand> |
---|
826 | <target>var:dcif</target> |
---|
827 | </instr> |
---|
828 | <!-- loop over the enabled rows: --> |
---|
829 | <while> |
---|
830 | <cond> |
---|
831 | <instr> |
---|
832 | <type>sloot.xpath2eval</type> |
---|
833 | <operand>var:status</operand> |
---|
834 | <operator> |
---|
835 | <xpath>exists(//check//row[empty(enabled) or enabled='true'][empty(imported) or imported='false'][action!='select'])</xpath> |
---|
836 | </operator> |
---|
837 | <target>this:cond</target> |
---|
838 | </instr> |
---|
839 | </cond> |
---|
840 | <seq> |
---|
841 | <!-- spin of a batch import --> |
---|
842 | <accessor-trace name="batch"> |
---|
843 | <instr> |
---|
844 | <type>ISOcat.manage.system.import.batch</type> |
---|
845 | <id>var:id</id> |
---|
846 | <target>var:void</target> |
---|
847 | </instr> |
---|
848 | </accessor-trace> |
---|
849 | <!-- reload the status document --> |
---|
850 | <instr> |
---|
851 | <type>resolveURI</type> |
---|
852 | <operand> |
---|
853 | <uri>status.xml</uri> |
---|
854 | </operand> |
---|
855 | <operator>var:dir</operator> |
---|
856 | <target>var:loc</target> |
---|
857 | </instr> |
---|
858 | <instr> |
---|
859 | <type>copy</type> |
---|
860 | <operand>curi:var:loc</operand> |
---|
861 | <target>var:status</target> |
---|
862 | </instr> |
---|
863 | </seq> |
---|
864 | </while> |
---|
865 | <!-- need a DPML statement here, otherwise DPML bails out and NK gets a void response --> |
---|
866 | <instr> |
---|
867 | <type>sloot.log</type> |
---|
868 | <operand> |
---|
869 | <msg>INF: finished import loop</msg> |
---|
870 | </operand> |
---|
871 | </instr> |
---|
872 | </then> |
---|
873 | <cond> |
---|
874 | <instr> |
---|
875 | <type>sloot.xpath2eval</type> |
---|
876 | <operand>var:action</operand> |
---|
877 | <operator> |
---|
878 | <xpath>.='dcs'</xpath> |
---|
879 | </operator> |
---|
880 | <target>this:cond</target> |
---|
881 | </instr> |
---|
882 | </cond> |
---|
883 | <then> |
---|
884 | <!-- create a DCS with the result of the import --> |
---|
885 | <instr> |
---|
886 | <type>sloot.xquery</type> |
---|
887 | <operator> |
---|
888 | <xquery> |
---|
889 | declare variable $status as node() external; |
---|
890 | |
---|
891 | <dcs owner="{string($status//owner//login)}" name="{$status/import/@id} DCIF import"> |
---|
892 | { |
---|
893 | for $row in $status//check//row[imported='true' or (action='select' and (empty(enabled) or enabled='true'))] |
---|
894 | return |
---|
895 | <dc ref="{string($row/id)}" type="{string($row/tpe)}"/> |
---|
896 | } |
---|
897 | </dcs> |
---|
898 | </xquery> |
---|
899 | </operator> |
---|
900 | <status>var:status</status> |
---|
901 | <target>var:dcs</target> |
---|
902 | </instr> |
---|
903 | <!--<accessor-debug>--> |
---|
904 | <instr> |
---|
905 | <type>log</type> |
---|
906 | <operand>var:dcs</operand> |
---|
907 | </instr> |
---|
908 | <!--</accessor-debug>--> |
---|
909 | <instr> |
---|
910 | <type>ISOcat.access.data.dcs.new</type> |
---|
911 | <dcs>var:dcs</dcs> |
---|
912 | <target>var:dcs</target> |
---|
913 | </instr> |
---|
914 | <!-- update status --> |
---|
915 | <instr> |
---|
916 | <type>xslt2</type> |
---|
917 | <operand>var:status</operand> |
---|
918 | <operator> |
---|
919 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> |
---|
920 | <xsl:param name="actions"/> |
---|
921 | <xsl:template match="@*|node()"> |
---|
922 | <xsl:copy> |
---|
923 | <xsl:apply-templates select="@*|node()"/> |
---|
924 | </xsl:copy> |
---|
925 | </xsl:template> |
---|
926 | <xsl:template match="/import"> |
---|
927 | <xsl:copy> |
---|
928 | <xsl:apply-templates select="@*"/> |
---|
929 | <xsl:attribute name="dcs" select="concat(@id,' DCIF import')"/> |
---|
930 | <xsl:apply-templates select="node()"/> |
---|
931 | </xsl:copy> |
---|
932 | </xsl:template> |
---|
933 | </xsl:stylesheet> |
---|
934 | </operator> |
---|
935 | <actions>var:params</actions> |
---|
936 | <target>var:status</target> |
---|
937 | </instr> |
---|
938 | <instr> |
---|
939 | <type>resolveURI</type> |
---|
940 | <operand> |
---|
941 | <uri>status.xml</uri> |
---|
942 | </operand> |
---|
943 | <operator>var:dir</operator> |
---|
944 | <target>var:loc</target> |
---|
945 | </instr> |
---|
946 | <instr> |
---|
947 | <type>copy</type> |
---|
948 | <operand>var:status</operand> |
---|
949 | <target>curi:var:loc</target> |
---|
950 | </instr> |
---|
951 | </then> |
---|
952 | </choose> |
---|
953 | <!-- create an output document based on the curent status --> |
---|
954 | <instr> |
---|
955 | <type>xslt2</type> |
---|
956 | <operand>var:status</operand> |
---|
957 | <operator> |
---|
958 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> |
---|
959 | <xsl:template match="/import"> |
---|
960 | <xsl:variable name="owned" select="exists(owner//id)"/> |
---|
961 | <xsl:variable name="valid" select="valid/b/(text())[1]='t'"/> |
---|
962 | <xsl:variable name="checked" select="exists(check/*)"/> |
---|
963 | <xsl:variable name="import" select="exists(check//row[enabled!='false' and imported!='true'])"/> |
---|
964 | <xsl:variable name="imported" select="exists(check//row[imported='true'])"/> |
---|
965 | <html> |
---|
966 | <head> |
---|
967 | <title>ISOcat DCIF import</title> |
---|
968 | </head> |
---|
969 | <body> |
---|
970 | <form action="/isocat/manage/import" method="post"> |
---|
971 | <input type="hidden" name="id" value="{@id}"/> |
---|
972 | <table> |
---|
973 | <tr> |
---|
974 | <th colspan="3" align="left"> |
---|
975 | <xsl:text>DCIF import: </xsl:text> |
---|
976 | <a href="import?action=refresh&id={@id}"> |
---|
977 | <xsl:value-of select="@id"/> |
---|
978 | </a> |
---|
979 | </th> |
---|
980 | </tr> |
---|
981 | <tr> |
---|
982 | <td colspan="3"> |
---|
983 | <hr/> |
---|
984 | </td> |
---|
985 | </tr> |
---|
986 | <tr> |
---|
987 | <td valign="top">Owner: </td> |
---|
988 | <td valign="top"> |
---|
989 | <xsl:choose> |
---|
990 | <xsl:when test="$owned"> |
---|
991 | <xsl:value-of select="owner//type"/> |
---|
992 | <xsl:text>: </xsl:text> |
---|
993 | <xsl:value-of select="owner//name"/> |
---|
994 | <xsl:if test="exists(owner//login)"> |
---|
995 | <xsl:text> (</xsl:text> |
---|
996 | <xsl:value-of select="owner//login"/> |
---|
997 | <xsl:text>)</xsl:text> |
---|
998 | </xsl:if> |
---|
999 | <xsl:text> [</xsl:text> |
---|
1000 | <xsl:value-of select="owner//id"/> |
---|
1001 | <xsl:text>]</xsl:text> |
---|
1002 | </xsl:when> |
---|
1003 | <xsl:otherwise> |
---|
1004 | <b>unknown</b> |
---|
1005 | </xsl:otherwise> |
---|
1006 | </xsl:choose> |
---|
1007 | </td> |
---|
1008 | <td/> |
---|
1009 | </tr> |
---|
1010 | <tr> |
---|
1011 | <td valign="top">Document: </td> |
---|
1012 | <td valign="top"> |
---|
1013 | <xsl:value-of select="config/nvp/dcif"/> |
---|
1014 | </td> |
---|
1015 | <td/> |
---|
1016 | </tr> |
---|
1017 | <tr> |
---|
1018 | <td valign="top">External: </td> |
---|
1019 | <td valign="top"> |
---|
1020 | <xsl:choose> |
---|
1021 | <xsl:when test="config/nvp/external='true'"> |
---|
1022 | <xsl:text>external PIDs are kept</xsl:text> |
---|
1023 | </xsl:when> |
---|
1024 | <xsl:otherwise> |
---|
1025 | <xsl:text>external PIDs are replaced by ISOcat PIDs</xsl:text> |
---|
1026 | </xsl:otherwise> |
---|
1027 | </xsl:choose> |
---|
1028 | </td> |
---|
1029 | <td/> |
---|
1030 | </tr> |
---|
1031 | <tr> |
---|
1032 | <td valign="top">Validate </td> |
---|
1033 | <td valign="top"> |
---|
1034 | <xsl:choose> |
---|
1035 | <xsl:when test="$valid"> |
---|
1036 | <xsl:text>valid (</xsl:text> |
---|
1037 | <xsl:value-of select="valid/@mode"/> |
---|
1038 | <xsl:text>)</xsl:text> |
---|
1039 | </xsl:when> |
---|
1040 | <xsl:when test="valid/b/(text())[1]='f'"> |
---|
1041 | <b> |
---|
1042 | <xsl:text>invalid (</xsl:text> |
---|
1043 | <xsl:value-of select="valid/@mode"/> |
---|
1044 | <xsl:text>)</xsl:text> |
---|
1045 | </b> |
---|
1046 | <!-- show warnings/errors --> |
---|
1047 | <div> |
---|
1048 | <xsl:if test="exists(valid/b/warnings/warning)"> |
---|
1049 | Warnings: |
---|
1050 | <ol> |
---|
1051 | <xsl:for-each select="valid/b/warnings/warning"> |
---|
1052 | <li> |
---|
1053 | <xsl:value-of select="."/> |
---|
1054 | <br/> |
---|
1055 | <xsl:text>(</xsl:text> |
---|
1056 | <xsl:value-of select="@xpath"/> |
---|
1057 | <xsl:text>)</xsl:text> |
---|
1058 | </li> |
---|
1059 | </xsl:for-each> |
---|
1060 | </ol> |
---|
1061 | </xsl:if> |
---|
1062 | <xsl:if test="exists(valid/b/errors/error)"> |
---|
1063 | Errors: |
---|
1064 | <ol> |
---|
1065 | <xsl:for-each select="valid/b/errors/error"> |
---|
1066 | <li> |
---|
1067 | <xsl:value-of select="."/> |
---|
1068 | <br/> |
---|
1069 | <xsl:text>(</xsl:text> |
---|
1070 | <xsl:value-of select="@xpath"/> |
---|
1071 | <xsl:text>)</xsl:text> |
---|
1072 | </li> |
---|
1073 | </xsl:for-each> |
---|
1074 | </ol> |
---|
1075 | </xsl:if> |
---|
1076 | </div> |
---|
1077 | </xsl:when> |
---|
1078 | <xsl:otherwise> |
---|
1079 | <xsl:text>unknown</xsl:text> |
---|
1080 | </xsl:otherwise> |
---|
1081 | </xsl:choose> |
---|
1082 | </td> |
---|
1083 | <td valign="top"> |
---|
1084 | <button type="submit" name="action" value="validate"> |
---|
1085 | <xsl:if test="not($owned)"> |
---|
1086 | <xsl:attribute name="disabled" select="'disabled'"/> |
---|
1087 | </xsl:if> |
---|
1088 | <xsl:text>validate DCIF</xsl:text> |
---|
1089 | </button> |
---|
1090 | <input type="checkbox" name="validation-mode" value="lax"> |
---|
1091 | <xsl:if test="not($owned)"> |
---|
1092 | <xsl:attribute name="disabled" select="'disabled'"/> |
---|
1093 | </xsl:if> |
---|
1094 | <xsl:if test="valid/@mode='lax'"> |
---|
1095 | <xsl:attribute name="checked" select="'checked'"/> |
---|
1096 | </xsl:if> |
---|
1097 | </input> |
---|
1098 | <xsl:text> </xsl:text> |
---|
1099 | <span>lax</span> |
---|
1100 | </td> |
---|
1101 | </tr> |
---|
1102 | <tr> |
---|
1103 | <td valign="top"> |
---|
1104 | <xsl:text>Check</xsl:text> |
---|
1105 | <xsl:if test="check/@forced='true'"> |
---|
1106 | <xsl:text> (forced)</xsl:text> |
---|
1107 | </xsl:if> |
---|
1108 | </td> |
---|
1109 | <td> |
---|
1110 | <xsl:choose> |
---|
1111 | <xsl:when test="$checked"> |
---|
1112 | <xsl:text>Actions:</xsl:text> |
---|
1113 | <ul> |
---|
1114 | <xsl:for-each-group select="check//row" group-by="action"> |
---|
1115 | <li> |
---|
1116 | <xsl:value-of select="count(current-group())"/> |
---|
1117 | <xsl:text> </xsl:text> |
---|
1118 | <xsl:value-of select="current-grouping-key()"/> |
---|
1119 | <xsl:text> actions</xsl:text> |
---|
1120 | </li> |
---|
1121 | </xsl:for-each-group> |
---|
1122 | </ul> |
---|
1123 | </xsl:when> |
---|
1124 | <xsl:otherwise> |
---|
1125 | <xsl:text>unchecked</xsl:text> |
---|
1126 | </xsl:otherwise> |
---|
1127 | </xsl:choose> |
---|
1128 | </td> |
---|
1129 | <td valign="top"> |
---|
1130 | <button type="submit" name="action"> |
---|
1131 | <xsl:choose> |
---|
1132 | <xsl:when test="not($owned) or normalize-space(valid)=''"> |
---|
1133 | <xsl:attribute name="value" select="'check'"/> |
---|
1134 | <xsl:attribute name="disabled" select="'disabled'"/> |
---|
1135 | <xsl:text>check actions</xsl:text> |
---|
1136 | </xsl:when> |
---|
1137 | <xsl:when test="valid/b/(text())[1]='f'"> |
---|
1138 | <xsl:attribute name="value" select="'forced check'"/> |
---|
1139 | <xsl:text>check actions (forced)</xsl:text> |
---|
1140 | </xsl:when> |
---|
1141 | <xsl:otherwise> |
---|
1142 | <xsl:attribute name="value" select="'check'"/> |
---|
1143 | <xsl:text>check actions</xsl:text> |
---|
1144 | </xsl:otherwise> |
---|
1145 | </xsl:choose> |
---|
1146 | </button> |
---|
1147 | <input type="checkbox" name="shared" value="true"> |
---|
1148 | <xsl:if test="not($owned) or normalize-space(valid)=''"> |
---|
1149 | <xsl:attribute name="disabled" select="'disabled'"/> |
---|
1150 | </xsl:if> |
---|
1151 | <xsl:if test="check/@shared='true'"> |
---|
1152 | <xsl:attribute name="checked" select="'checked'"/> |
---|
1153 | </xsl:if> |
---|
1154 | </input> |
---|
1155 | <xsl:text> </xsl:text> |
---|
1156 | <span>update shared DCs</span> |
---|
1157 | </td> |
---|
1158 | </tr> |
---|
1159 | <tr> |
---|
1160 | <td valign="top">Disable</td> |
---|
1161 | <td> |
---|
1162 | <xsl:choose> |
---|
1163 | <xsl:when test="$checked"> |
---|
1164 | <table border="1" rules="cols" frame="box"> |
---|
1165 | <tr style="border-bottom:1px solid black;"> |
---|
1166 | <th>id</th> |
---|
1167 | <th>DC PID</th> |
---|
1168 | <th>type</th> |
---|
1169 | <th>is-a</th> |
---|
1170 | <th>action</th> |
---|
1171 | <th>enabled</th> |
---|
1172 | </tr> |
---|
1173 | <xsl:for-each select="check//row"> |
---|
1174 | <tr> |
---|
1175 | <td align="left"> |
---|
1176 | <xsl:value-of select="id"/> |
---|
1177 | </td> |
---|
1178 | <td align="left"> |
---|
1179 | <a href="{pid}" target="other"> |
---|
1180 | <xsl:value-of select="pid"/> |
---|
1181 | </a> |
---|
1182 | </td> |
---|
1183 | <td align="left"> |
---|
1184 | <xsl:value-of select="tpe"/> |
---|
1185 | </td> |
---|
1186 | <td align="left"> |
---|
1187 | <xsl:value-of select="isa"/> |
---|
1188 | </td> |
---|
1189 | <td align="center"> |
---|
1190 | <xsl:value-of select="action"/> |
---|
1191 | </td> |
---|
1192 | <td align="center"> |
---|
1193 | <input type="checkbox" name="enabled-row-{count(preceding::row) + 1}" value="{count(preceding::row) + 1}"> |
---|
1194 | <xsl:choose> |
---|
1195 | <xsl:when test="enabled='true'"> |
---|
1196 | <xsl:attribute name="checked" select="'checked'"/> |
---|
1197 | </xsl:when> |
---|
1198 | <xsl:when test="empty(enabled)"> |
---|
1199 | <xsl:attribute name="checked" select="'checked'"/> |
---|
1200 | </xsl:when> |
---|
1201 | </xsl:choose> |
---|
1202 | <xsl:if test="imported='true'"> |
---|
1203 | <xsl:attribute name="disabled" select="'disabled'"/> |
---|
1204 | </xsl:if> |
---|
1205 | </input> |
---|
1206 | </td> |
---|
1207 | </tr> |
---|
1208 | </xsl:for-each> |
---|
1209 | </table> |
---|
1210 | </xsl:when> |
---|
1211 | <xsl:otherwise> |
---|
1212 | <xsl:text>unchecked</xsl:text> |
---|
1213 | </xsl:otherwise> |
---|
1214 | </xsl:choose> |
---|
1215 | </td> |
---|
1216 | <td valign="top"> |
---|
1217 | <button type="submit" name="action" value="disable"> |
---|
1218 | <xsl:if test="not($checked)"> |
---|
1219 | <xsl:attribute name="disabled" select="'disabled'"/> |
---|
1220 | </xsl:if> |
---|
1221 | <xsl:text>en/disable actions</xsl:text> |
---|
1222 | </button> |
---|
1223 | <br/> |
---|
1224 | <button type="submit" name="action" value="disable-all"> |
---|
1225 | <xsl:if test="not($checked)"> |
---|
1226 | <xsl:attribute name="disabled" select="'disabled'"/> |
---|
1227 | </xsl:if> |
---|
1228 | <xsl:text>disable all actions</xsl:text> |
---|
1229 | </button> |
---|
1230 | <br/> |
---|
1231 | <button type="submit" name="action" value="enable-all"> |
---|
1232 | <xsl:if test="not($checked)"> |
---|
1233 | <xsl:attribute name="disabled" select="'disabled'"/> |
---|
1234 | </xsl:if> |
---|
1235 | <xsl:text>enable all actions</xsl:text> |
---|
1236 | </button> |
---|
1237 | </td> |
---|
1238 | </tr> |
---|
1239 | <tr> |
---|
1240 | <td valign="top">Backup </td> |
---|
1241 | <td valign="top"> |
---|
1242 | <xsl:if test="$checked"> |
---|
1243 | <xsl:value-of select="count(check//row[action='update' or action='revision'][empty(enabled) or enabled='true'])"/> |
---|
1244 | <xsl:text> enabled and existing DCs</xsl:text> |
---|
1245 | </xsl:if> |
---|
1246 | </td> |
---|
1247 | <td valign="top"> |
---|
1248 | <button type="submit" name="action" value="backup"> |
---|
1249 | <xsl:if test="empty(check//row[action='update' or action='revision'])"> |
---|
1250 | <xsl:attribute name="disabled" select="'disabled'"/> |
---|
1251 | </xsl:if> |
---|
1252 | <xsl:text>backup DCs to DCIF</xsl:text> |
---|
1253 | </button> |
---|
1254 | </td> |
---|
1255 | </tr> |
---|
1256 | <tr> |
---|
1257 | <td valign="top">Import </td> |
---|
1258 | <td valign="top"> |
---|
1259 | <xsl:value-of select="count(check//row[empty(enabled) or enabled='true'])"/> |
---|
1260 | <xsl:text> enabled import actions</xsl:text> |
---|
1261 | </td> |
---|
1262 | <td valign="top"> |
---|
1263 | <button type="submit" name="action" value="import"> |
---|
1264 | <xsl:if test="not($checked) and not($import)"> |
---|
1265 | <xsl:attribute name="disabled" select="'disabled'"/> |
---|
1266 | </xsl:if> |
---|
1267 | <xsl:text>import</xsl:text> |
---|
1268 | </button> |
---|
1269 | </td> |
---|
1270 | </tr> |
---|
1271 | <tr> |
---|
1272 | <td valign="top">DCS </td> |
---|
1273 | <td valign="top"> |
---|
1274 | <xsl:choose> |
---|
1275 | <xsl:when test="normalize-space(@dcs)!=''"> |
---|
1276 | <xsl:value-of select="@dcs"/> |
---|
1277 | </xsl:when> |
---|
1278 | <xsl:otherwise> |
---|
1279 | <i>none</i> |
---|
1280 | </xsl:otherwise> |
---|
1281 | </xsl:choose> |
---|
1282 | </td> |
---|
1283 | <td valign="top"> |
---|
1284 | <button type="submit" name="action" value="dcs"> |
---|
1285 | <xsl:if test="not($imported)"> |
---|
1286 | <xsl:attribute name="disabled" select="'disabled'"/> |
---|
1287 | </xsl:if> |
---|
1288 | <xsl:text>create</xsl:text> |
---|
1289 | </button> |
---|
1290 | </td> |
---|
1291 | </tr> |
---|
1292 | </table> |
---|
1293 | </form> |
---|
1294 | </body> |
---|
1295 | </html> |
---|
1296 | </xsl:template> |
---|
1297 | </xsl:stylesheet> |
---|
1298 | </operator> |
---|
1299 | <target>this:response</target> |
---|
1300 | </instr> |
---|
1301 | </idoc> |
---|
1302 | <exception> |
---|
1303 | <debug/> |
---|
1304 | <trace>ffcpl:/trace/import.exception.xml</trace> |
---|
1305 | <throw/> |
---|
1306 | </exception> |
---|
1307 | <response> |
---|
1308 | <mime>text/html</mime> |
---|
1309 | </response> |
---|
1310 | </accessor> |
---|