http package (only partially working)
This commit is contained in:
23
packages/http/examples/pwp/context.pwp
Normal file
23
packages/http/examples/pwp/context.pwp
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html xmlns:pwp="http://www.cs.otago.ac.nz/staffpriv/ok/pwp.pl">
|
||||
|
||||
<head>
|
||||
<title>Context variables for PWP scripts</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>This PWP demo lists the context-parameters that are passed into
|
||||
the script.
|
||||
</p>
|
||||
<ul>
|
||||
<li pwp:ask="member(Name=Value, CONTEXT)">
|
||||
<span class=name pwp:use="Name"/>
|
||||
=
|
||||
<span class=value pwp:use="writeq(Value)"/>
|
||||
</li>
|
||||
</ul>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
25
packages/http/examples/pwp/index.pwp
Normal file
25
packages/http/examples/pwp/index.pwp
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html xmlns:pwp="http://www.cs.otago.ac.nz/staffpriv/ok/pwp.pl">
|
||||
|
||||
<head>
|
||||
<title>Index for PWP demos</title>
|
||||
</head>
|
||||
<body pwp:ask="atom_concat(SCRIPT_DIRECTORY, /, Prefix),
|
||||
atom_concat(Prefix, '*.pwp', Pattern),
|
||||
expand_file_name(Pattern, Paths),
|
||||
maplist(atom_concat(Prefix), Files, Paths)">
|
||||
|
||||
<h1>PWP scripts in this directory</h1>
|
||||
|
||||
<ul>
|
||||
<li pwp:ask="member(F, Files), F \== 'index.pwp'">
|
||||
<a pwp:use="F" pwp:att="$" href="$(F)$"/>
|
||||
<a pwp:att="$" href="$(F)$?view=source">source</a>
|
||||
</li>
|
||||
</ul>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
12
packages/http/examples/pwp/pwp1.pwp
Normal file
12
packages/http/examples/pwp/pwp1.pwp
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<html
|
||||
xmlns:pwp="http://www.cs.otago.ac.nz/staffpriv/ok/pwp.pl"
|
||||
pwp:ask = "ensure_loaded(pwp(pwpdb)), once(msg(Greeting))">
|
||||
<head>
|
||||
<title pwp:use="Greeting"/>
|
||||
</head>
|
||||
<body>
|
||||
<p><span pwp:use="Greeting" pwp:tag='-'/></p>
|
||||
</body>
|
||||
</html>
|
10
packages/http/examples/pwp/pwp2.pwp
Normal file
10
packages/http/examples/pwp/pwp2.pwp
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<html
|
||||
xmlns:pwp="http://www.cs.otago.ac.nz/staffpriv/ok/pwp.pl">
|
||||
<head><title>Example 2</title></head>
|
||||
<body pwp:ask="Hello = 'Hello world', A = 20, B = 22">
|
||||
<h1 pwp:use="Hello"/>
|
||||
<p>The answer is <span pwp:tag='-' pwp:use="C" pwp:ask="C is A+B"/>.</p>
|
||||
</body>
|
||||
</html>
|
25
packages/http/examples/pwp/pwp3.pwp
Normal file
25
packages/http/examples/pwp/pwp3.pwp
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<html
|
||||
xmlns:pwp="http://www.cs.otago.ac.nz/staffpriv/ok/pwp.pl"
|
||||
pwp:ask='ensure_loaded(pwp(pwpdb))'>
|
||||
<head>
|
||||
<title>Phone list for Full-Time staff.</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Phone list for Full-Time staff.</h1>
|
||||
<table
|
||||
pwp:ask = "setof(FullName-Phone,
|
||||
N^O^E^(
|
||||
status(N, full_time),
|
||||
staff(N, FullName, O, Phone, E)
|
||||
),
|
||||
Staff_List)">
|
||||
<tr><th>Name</th><th>Phone</th></tr>
|
||||
<tr pwp:ask="member(FullName-Phone, Staff_List)">
|
||||
<td pwp:use="FullName"/>
|
||||
<td pwp:use="Phone"/>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
23
packages/http/examples/pwp/pwp4.pwp
Normal file
23
packages/http/examples/pwp/pwp4.pwp
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<html
|
||||
xmlns:pwp="http://www.cs.otago.ac.nz/staffpriv/ok/pwp.pl"
|
||||
pwp:ask='ensure_loaded(pwp(pwpdb))'>
|
||||
<head>
|
||||
<title>Phone list for Full-Time staff.</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Phone list for Full-Time staff.</h1>
|
||||
<table
|
||||
pwp:ask = "setof(FullName-E_Mail,
|
||||
N^O^P^staff(N, FullName, O, P, E_Mail),
|
||||
Staff_List)">
|
||||
<tr><th>Name</th><th>Address</th></tr>
|
||||
<tr pwp:ask="member(FullName-E_Mail, Staff_List)">
|
||||
<td pwp:use="FullName"/>
|
||||
<td><a pwp:use="E_Mail"
|
||||
pwp:att='$' href="mailto:$(E_Mail)$"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
11
packages/http/examples/pwp/pwp5.pwp
Normal file
11
packages/http/examples/pwp/pwp5.pwp
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<html
|
||||
xmlns:pwp="http://www.cs.otago.ac.nz/staffpriv/ok/pwp.pl">
|
||||
<head><title>$SHELL</title></head>
|
||||
<body>
|
||||
<p pwp:ask="getenv('SHELL', Shell)"
|
||||
>The default shell is <span pwp:tag="-" pwp:use="Shell"/>.</p>
|
||||
<p pwp:ask="\+getenv('SHELL',_)">There is no default shell.</p>
|
||||
</body>
|
||||
</html>
|
3
packages/http/examples/pwp/pwp6.pwp
Normal file
3
packages/http/examples/pwp/pwp6.pwp
Normal file
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<a>b</a>
|
3
packages/http/examples/pwp/pwp7.pwp
Normal file
3
packages/http/examples/pwp/pwp7.pwp
Normal file
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<a><b pwp:use='27' pwp:tag='-'/></a>
|
3
packages/http/examples/pwp/pwp8.pwp
Normal file
3
packages/http/examples/pwp/pwp8.pwp
Normal file
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<a pwp:ask="B=20,C=22"><b pwp:use="B"/><c pwp:use="C"/></a>
|
12
packages/http/examples/pwp/pwpdb.pl
Normal file
12
packages/http/examples/pwp/pwpdb.pl
Normal file
@@ -0,0 +1,12 @@
|
||||
% This is a tiny data base for testing PWP.
|
||||
|
||||
msg('Hello, World!').
|
||||
|
||||
status(tom, full_time).
|
||||
status(dick, part_time).
|
||||
status(harry, full_time).
|
||||
|
||||
staff(tom, 'Tom Cat', 1-21, 'x1234', 'tom@jerry.example.org').
|
||||
staff(dick, 'Dick Tater', 2-50, 'x9999', 'boss@hq.example.org').
|
||||
staff(harry, 'Harry Ett', 3-14, 'x7654', 'h.ett@kit.example.org').
|
||||
|
Reference in New Issue
Block a user