comparison software/eXist/webapp/mpdl/scheduler/get-jobs.xql @ 7:5589d865af7a

Erstellung XQL/XSL Applikation
author Josef Willenborg <jwillenborg@mpiwg-berlin.mpg.de>
date Tue, 08 Feb 2011 15:16:46 +0100
parents
children
comparison
equal deleted inserted replaced
6:2396a569e446 7:5589d865af7a
1 xquery version "1.0";
2
3 declare namespace request="http://exist-db.org/xquery/request";
4 declare namespace util = "http://exist-db.org/xquery/util";
5
6 let $jobId := request:get-parameter("id", "all")
7
8 let $result := mpdldoc:get-jobs($jobId)
9
10 let $resultHtml :=
11 for $operation in $result//mpdl-doc-operation
12 let $operationName := $operation/name
13 let $jobId := $operation/job-id
14 let $srcUrl := $operation/src/url
15 let $source :=
16 if ($operationName = 'delete')
17 then ()
18 else if (starts-with($srcUrl, 'file:'))
19 then
20 <bla>
21 <b>Source</b>
22 <ul>
23 <li><b>Upload file name:</b> {$operation/src/upload-file-name}</li>
24 </ul>
25 </bla>
26 else
27 <bla>
28 <b>Source</b>
29 <ul>
30 <li><b>Url:</b> {$operation/src/url}</li>
31 </ul>
32 </bla>
33 let $destUrl :=
34 if ($operationName = 'create' or $operationName = 'update')
35 then
36 <bla>
37 <li><b>Link to eSciDoc:</b> <a href="{$operation/dest/escidoc-url}">{$operation/dest/escidoc-url}</a></li>
38 <li><b>Link to eXist:</b> <a href="{$operation/dest/exist-url}">{$operation/dest/exist-url}</a></li>
39 </bla>
40 else if ($operationName = 'updateExist')
41 then
42 <bla>
43 <li><b>Link to eXist:</b> <a href="{$operation/dest/exist-url}">{$operation/dest/exist-url}</a></li>
44 </bla>
45 else ()
46 let $errorMessage := $operation/status/error-message
47 let $errorLIEntry :=
48 if ($errorMessage = 'no error')
49 then <li><b>Error:</b> {$errorMessage}</li>
50 else <li><font color="#FF0000"><b>Error:</b></font> {$errorMessage}</li>
51 let $operationHtmlTableData :=
52 <bla>
53 <tr><td>
54 <b>Refresh:</b> <a href="?id={$jobId}">operation status</a><p/>
55 <b>Operation:</b> {$operation/name}<p/>
56 <b>Job-Id:</b> {$operation/job-id}<p/>
57 <b>Job status</b>
58 <ul>
59 <li><b>Started:</b> {$operation/status/started}</li>
60 <li><b>Finished:</b> {$operation/status/finished}</li>
61 <li><b>Description:</b> {$operation/status/description}</li>
62 {$errorLIEntry}
63 </ul>
64 {$source}
65 <b>Destination</b>
66 <ul>
67 <li><b>Document base:</b> {$operation/dest/doc-base}</li>
68 <li><b>Language:</b> {$operation/dest/language}</li>
69 <li><b>Document name:</b> {$operation/dest/file-name}</li>
70 {$destUrl}
71 </ul>
72 <b>Description:</b> {$operation/description}<p/>
73 <hr/>
74 </td></tr>
75 </bla>
76 return <bla>{$operationHtmlTableData}</bla>
77
78 let $title := "Document operation status"
79 return
80 <html>
81 <head>
82 <title>{$title}</title>
83 </head>
84 <body>
85 <h1>{$title}</h1>
86 <table>
87 {$resultHtml}
88 </table>
89 See the <a href="get-jobs.xql?_source=yes">XQuery source</a> of this page, if you find a bug <a href="https://itgroup.mpiwg-berlin.mpg.de:8080/tracs/mpdl-project-software/newticket">let us know</a>
90 </body>
91 </html>