Skip to content

Commit b2455e9

Browse files
authored
Merge pull request #526 from dariok/development
Recent changes, erroneously made in development
2 parents 87930d5 + 26efb53 commit b2455e9

File tree

7 files changed

+54
-26
lines changed

7 files changed

+54
-26
lines changed

edoc/config.xml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,6 @@
3636

3737
<!-- standard HTTP reponse headers for HTML files -->
3838
<headers>
39-
<header name="Content-Security-Policy" value="default-src https:;
40-
connect-src 'self' https://exist.ulb.tu-darmstadt.de;
41-
frame-src 'self' http://exist2.ulb.tu-darmstadt.de:8080;
42-
img-src 'self' https: *.ulb.tu-darmstadt.de;
43-
script-src 'self' 'unsafe-hashes' 'sha256-1jAmyYXcRq6zFldLe/GCgIDJBiOONdXjTLgEFMDnDSM=' *.jquery.com *.ulb.tu-darmstadt.de;
44-
style-src 'self' 'unsafe-inline' *.ulb.tu-darmstadt.de;"/>
4539
<header name="Permissions-Policy" value="geolocation=(self), fullscreen=(self)"/>
4640
<header name="Referrer-Policy" value="no-referrer-when-downgrade"/>
4741
<header name="X-Content-Type-Options" value="nosniff"/>
@@ -54,4 +48,9 @@
5448
<origins>
5549
<origin>http://localhost:8080</origin>
5650
</origins>
51+
52+
<!-- Sources for some Blobs -->
53+
<externalSources>
54+
<source name="jquery" path="$shared/jquery-3.6.3.min.js" />
55+
</externalSources>
5756
</config>

edoc/modules/app.xqm

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ declare function wdb:getHead ( $node as node(), $model as map(*) ) as element(he
353353
<meta name="path" content="{$model('fileLoc')}"/>
354354
<meta name="rest" content="{$wdb:restURL}" />
355355
<title>{ $model("title") } – { normalize-space($wdb:configFile//config:short) }</title>
356+
356357
{
357358
if ( wdb:findProjectFunction($model, "wdbPF:overrideCssJs", 1) ) then
358359
(wdb:getProjectFunction($model, "wdbPF:overrideCssJs", 1))($model)
@@ -369,7 +370,7 @@ declare function wdb:getHead ( $node as node(), $model as map(*) ) as element(he
369370
then <link rel="stylesheet" type="text/css" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.min.css" />
370371
else (),
371372
wdb:getProjectFiles($node, $model, 'css'),
372-
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>,
373+
wdb:getBlob($node, $model, 'jquery'),
373374
if ( $model?annotation = true() )
374375
then <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script>
375376
else (),
@@ -936,4 +937,8 @@ declare function wdb:getContentTypeFromExt ( $extension as xs:string, $namespace
936937
return
937938
'application/octet-stream'
938939
};
940+
941+
declare function wdb:getBlob ( $node as node(), $model as map(*), $name as xs:string ) {
942+
<script src="{$wdb:configFile//config:source[@name = $name]/@path}"></script>
943+
};
939944
(: END HELPERS FOR REST AND HTTP REQUESTS :)

edoc/modules/error.xqm

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ declare function wdbErr:error ($data as map (*)) {
4141
<title>ERROR</title>
4242
<link rel="stylesheet" type="text/css" href="$shared/css/wdb.css" />
4343
<link rel="stylesheet" type="text/css" href="$shared/css/function.css" />
44-
<script src="https://code.jquery.com/jquery-3.5.1.min.js" />
4544
<script src="resources/scripts/function.js"/>
4645
</head>,
4746
<body>

edoc/modules/function.xqm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ declare function wdbfp:getHead ( $node as node(), $model as map(*), $templateFil
181181
then <link rel="stylesheet" type="text/css" href="{$wdb:edocBaseURL}/data/resources/{$templateFile}.css" />
182182
else (),
183183
wdbfp:get('css', $model?pathToEd, $model),
184-
<script src="https://code.jquery.com/jquery-3.5.1.min.js" />,
184+
wdb:getBlob($node, $model, 'jquery'),
185185
<script src="./$shared/scripts/js.cookie.js"/>,
186186
<script src="./$shared/scripts/legal.js"/>,
187187
<script src="./$shared/scripts/function.js"/>,

edoc/rest/rest-coll.xql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ xquery version "3.1";
22

33
module namespace wdbRc = "https://github.com/dariok/wdbplus/RestCollections";
44

5-
import module namespace json = "http://www.json.org";
65
import module namespace wdb = "https://github.com/dariok/wdbplus/wdb" at "/db/apps/edoc/modules/app.xqm";
76
import module namespace wdbErr = "https://github.com/dariok/wdbplus/errors" at "/db/apps/edoc/modules/error.xqm";
87
import module namespace wdbfp = "https://github.com/dariok/wdbplus/functionpages" at "/db/apps/edoc/modules/function.xqm";
@@ -522,7 +521,7 @@ declare function wdbRc:getGeneral ($id, $mt, $content) {
522521
</rest:response>,
523522
if ($content[1] = 200)
524523
then if ($mt = "application/json")
525-
then json:xml-to-json($content[2])
524+
then xml-to-json($content[2])
526525
else $content[2]
527526
else $content[2]
528527
)

edoc/schema/config.rng

Lines changed: 40 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,40 @@
99
<element name="short">
1010
<data type="NCName"/>
1111
</element>
12-
<element name="logo">
13-
<data type="anyURI"/>
14-
</element>
12+
<optional>
13+
<element name="logo">
14+
<data type="anyURI"/>
15+
</element>
16+
</optional>
1517
</element>
1618
<element name="role">
1719
<element name="type">
1820
<data type="NCName"/>
1921
</element>
20-
<element name="peer">
21-
<data type="anyURI"/>
22-
</element>
22+
<oneOrMore>
23+
<element name="peer">
24+
<optional>
25+
<attribute name="xml:id">
26+
<data type="ID" />
27+
</attribute>
28+
<attribute name="type">
29+
<data type="token" />
30+
</attribute>
31+
</optional>
32+
<data type="anyURI"/>
33+
</element>
34+
</oneOrMore>
2335
</element>
24-
<element name="params">
25-
<element name="param">
26-
<attribute name="name">
27-
<data type="NCName"/>
28-
</attribute>
29-
<data type="anyURI"/>
36+
<optional>
37+
<element name="params">
38+
<element name="param">
39+
<attribute name="name">
40+
<data type="NCName"/>
41+
</attribute>
42+
<data type="anyURI"/>
43+
</element>
3044
</element>
31-
</element>
45+
</optional>
3246
<element name="server">
3347
<data type="anyURI"/>
3448
</element>
@@ -53,14 +67,26 @@
5367
</element>
5468
</optional>
5569
<optional>
56-
<element name="origins" >
70+
<element name="origins">
5771
<oneOrMore>
5872
<element name="origin">
5973
<text />
6074
</element>
6175
</oneOrMore>
6276
</element>
6377
</optional>
78+
<element name="externalSources">
79+
<oneOrMore>
80+
<element name="source">
81+
<attribute name="name">
82+
<text />
83+
</attribute>
84+
<attribute name="path">
85+
<data type="anyURI" />
86+
</attribute>
87+
</element>
88+
</oneOrMore>
89+
</element>
6490
</element>
6591
</start>
6692
</grammar>

edoc/templates/admin.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<link rel="stylesheet" type="text/css" href="../resources/css/function.css" />
1212
<link rel="stylesheet" type="text/css" href="../resources/css/admin.css" />
1313
<link data-template="wdbAdmin:css" />
14-
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
14+
<script data-template="wdb:getBlob" data-template-name="jquery"></script>
1515
<script src="../resources/scripts/js.cookie.js"></script>
1616
<script src="../resources/scripts/function.js"></script>
1717
<script src="../resources/scripts/admin.js"></script>

0 commit comments

Comments
 (0)