<xsl:stylesheet xmlns:d="http://www.askemos.org/2000/NameSpaceDSSSL" xmlns:editor="urn:editor" xmlns:mind="http://www.askemos.org/2005/CoreAPI#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<timer>
<rss>
<channel>
<title>Askemos Timer Event</title>
<link>
<a href="http://www.askemos.org">http://www.askemos.org</a>
</link>
<copyright>Copyright © 2006-present, pitcom GmbH.</copyright>
<generator>Askemos - EPost - RSS Timer</generator>
<managingEditor>rahe@askemos.org</managingEditor>
<webMaster>chsh@askemos.org</webMaster>
<description>card_Mustermann_Tue, 28 Feb 2006 14:05:40</description>
<language>de_DE</language>
<pubDate>Tue, 28 Feb 2006 14:05:49 +0100</pubDate>
<ttl>432000</ttl>
<cloud domain="https://askemos1.tzv.de" path="A97bc55ec077ccd291efdaeb15547d180" port="443">
<unlink>Tue, 28 Feb 2006 14:05:49 +0100</unlink>
</cloud>
</channel>
</rss>
<rss>
<channel>
<title>Askemos Timer Event</title>
<link>
<a href="http://www.askemos.org">http://www.askemos.org</a>
</link>
<copyright>Copyright © 2006-present, pitcom GmbH.</copyright>
<generator>Askemos - EPost - RSS Timer</generator>
<managingEditor>rahe@askemos.org</managingEditor>
<webMaster>chsh@askemos.org</webMaster>
<description>card_Mustermann_Tue, 28 Feb 2006 14:25:15</description>
<language>de_DE</language>
<pubDate>Tue, 28 Feb 2006 14:25:23 +0100</pubDate>
<ttl>432000</ttl>
<cloud domain="https://askemos1.tzv.de" path="A97bc55ec077ccd291efdaeb15547d180" port="443">
<unlink>Tue, 28 Feb 2006 14:25:23 +0100</unlink>
</cloud>
</channel>
</rss>
</timer>
<!-- +++++++++++ lesen +++++++++++++ -->
<xsl:template match="request [ @type="read" ]">
<xsl:choose>
<d:when test="(pair? (msg 'destination))">
<mind:forward></mind:forward>
</d:when>
<d:when test="(and (is-meta-form? msg) (service-level))">
<d:copy-of select="(message-body (metaview me msg))"></d:copy-of>
</d:when>
<d:when test="(not (null? (form-field 'register (current-node))))">
<html>
<d:copy-of select="#CONTENT">
(let ((date (date->string (msg 'dc-date) "~a, ~d ~b ~Y ~H:~M:~S ~z")))
(sxml `((head (title "RSS Timer"))
(body (center (h4 "RSS Timer") (hr)
(d:form (@ (method "POST") (d:action ,(oid->string (me 'get 'id)))) (table
(tr (td (@ (align "right")) "Link:") (td " ") (td (input (@ (type "text") (name "link") (size ,(number->string (string-length date)))))))
(tr (td (@ (align "right")) "Beschreibung:") (td " ") (td (input (@ (type "text") (name "description") (size ,(number->string (string-length date)))))))
(tr (td (@ (align "right")) "Datum:") (td " ") (td (input (@ (type "text") (name "pubDate") (value ,date) (size ,(number->string (string-length date))) (readonly)))))
(tr (td (@ (align "right")) "TTL:") (td " ") (td (input (@ (type "text") (name "ttl") (value "1") (size ,(number->string (string-length date)))))))
(tr (td (@ (align "right")) "Notification:") (td " ") (td (input (@ (type "text") (name "notify") (size ,(number->string (string-length date))))))))
(br) (input (@ (type "submit") (name "register") (value "anlegen")))))))))
</d:copy-of>
</html>
</d:when>
<d:when test="(not (null? (form-field 'channel (current-node))))">
<xsl:choose>
<d:when test="(not (null? (form-field 'rss (current-node))))">
<mind:output media-type="text/rss+xml" method="xml">
<d:copy-of select="#CONTENT">
(let*
((pubDate (data (form-field 'channel (current-node))))
(channel (node-list-filter (lambda (channel) (equal? (data ((sxpath '(pubDate)) channel)) (pem-decode pubDate)))
((sxpath `(timer rss channel)) (document-element (grove-root (current-node)))))))
(make element gi: 'rss channel))
</d:copy-of>
</mind:output>
</d:when>
<xsl:otherwise>
<html>
<d:copy-of select="#CONTENT">
(let*
((pubDate (data (form-field 'channel (current-node))))
(channel (node-list-filter (lambda (channel) (equal? (data ((sxpath '(pubDate)) channel)) (pem-decode pubDate)))
((sxpath `(timer rss channel)) (document-element (grove-root (current-node)))))))
(sxml `((head (title ,(data ((sxpath '(title)) channel))))
(body (center (h4 ,(data ((sxpath '(title)) channel))) (hr)
(table
(tr (td (@ (align "right")) "Link:") (td " ") (td (a (@ (href ,(data ((sxpath '(link)) channel)))) ,(data ((sxpath '(link)) channel)))))
(tr (td (@ (align "right")) "Description:") (td " ") (td ,(data ((sxpath '(description)) channel))))
(tr (td (@ (align "right")) "pubDate:") (td " ") (td ,(data ((sxpath '(pubDate)) channel))))
(tr (td (@ (align "right")) "TTL:") (td " ") (td ,(data ((sxpath '(ttl)) channel)) " Sekunde(n)"))
(tr (td (@ (align "right")) "Cloud:") (td " ") (td ,(attribute-string "path" ((sxpath '(cloud)) channel))))
(tr (td (@ (align "right")) "managingEditor:") (td " ") (td (a (@ (href ,(string-append "mailto:" (data ((sxpath '(managingEditor)) channel))))) ,(data ((sxpath '(managingEditor)) channel)))))
(tr (td (@ (align "right")) "webMaster:") (td " ") (td (a (@ (href ,(string-append "mailto:" (data ((sxpath '(webMaster)) channel))))) ,(data ((sxpath '(webMaster)) channel)))))))))))
</d:copy-of>
</html>
</xsl:otherwise>
</xsl:choose>
</d:when>
<d:when test="(service-level (public-oid) (my-oid))">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Askemos anonymous access control</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"></meta>
</head>
<body bgcolor="white">
<d:copy-of select="#CONTENT">
(let*
((channel ((sxpath '(timer rss channel)) (document-element (grove-root (current-node))))))
(node-list-map (lambda (channel) (sxml `((center (a (@ (href ,(string-append (oid->string (me 'get 'id)) "?channel=" (pem-encode (data ((sxpath '(pubDate)) channel)))))) (h6 ,(data ((sxpath '(title)) channel))))
(font (@ (size "-2") (color "blue")) (br) ,(date->string (time-utc->date (add-duration (date->time-utc (string->date (data ((sxpath '(pubDate)) channel)) "~a, ~d ~b ~Y ~H:~M:~S ~z")) (make-time 'time-duration 0 (string->number (data ((sxpath '(ttl)) channel))))) (date-zone-offset (string->date (data ((sxpath '(pubDate)) channel)) "~a, ~d ~b ~Y ~H:~M:~S ~z"))) "~a, ~d ~b ~Y ~H:~M:~S ~z")) (hr))))) channel))
</d:copy-of>
</body>
</html>
</d:when>
<xsl:otherwise>
<mind:html>Somehow I can't see anything. Dunno why.</mind:html>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- +++++++++++++ schreiben +++++++++++++++ -->
<xsl:template match="request[@type="write"]">
<xsl:choose>
<d:when test="(and (is-meta-form? msg) (service-level))">
<d:copy-of select="(message-body (metactrl me msg))"></d:copy-of>
</d:when>
<d:when test="(and (not (null? (form-field 'register (current-node)))) (not (equal? (data (form-field 'link (current-node))) "")))">
<mind:reply>
<mind:become>
<d:copy-of select="#CONTENT">
(let ((root (document-element (grove-root (current-node))))
(link (data (form-field 'link (current-node))))
(description (data (form-field 'description (current-node))))
(pubDate (data (form-field 'pubDate (current-node))))
(ttl (data (form-field 'ttl (current-node))))
(notify (children (form-field 'notify (current-node)))))
(make element gi: (gi root) ns: (ns root) attributes: (copy-attributes root)
(node-list-map
(lambda (node)
(cond
((equal? (gi node) 'timer) (make element gi: (gi node) ns: (ns node) attributes: (copy-attributes node)
(node-list
(children node)
(make element gi: 'rss (make element gi: 'channel
(node-list (sxml `((title "Askemos Timer Event")
(link "<a href="http://www.askemos.org")">http://www.askemos.org")</a> (copyright "Copyright © 2006-present, pitcom GmbH.")
(generator "Askemos - EPost - RSS Timer") (managingEditor "rahe@askemos.org") (webMaster "chsh@askemos.org")
(description ,description) (language "de_DE") (pubDate ,pubDate) (ttl ,ttl)))
(make element gi: 'cloud attributes: `((domain "<a href="https://askemos1.tzv.de")">https://askemos1.tzv.de")</a> (port "443") (path ,link)) notify)))))))
(else node))) (children root))))
</d:copy-of>
</mind:become>
<mind:output>
<xsl:attribute name="location">
<d:copy-of select="(string-append "https://askemos1.tzv.de/" (oid->string (me 'get 'id)))"></d:copy-of>
</xsl:attribute>
</mind:output>
</mind:reply>
</d:when>
<d:when test="(or (eq? (msg 'caller) 'A47c99de81171431933fee2c7d110dc19) #t)">
<!--
Channel deren Timer noch nicht abgelaufen sind.
-->
<xsl:variable name="channels">
<d:copy-of select="#CONTENT">
(node-list-filter (lambda (channel) (time<? (date->time-utc (msg 'dc-date)) (add-duration (date->time-utc (string->date (data ((sxpath '(pubDate)) channel)) "~a, ~d ~b ~Y ~H:~M:~S ~z")) (make-time 'time-duration 0 (string->number (data ((sxpath '(ttl)) channel))))))) ((sxpath '(timer rss channel)) (grove-root (current-node))))
</d:copy-of>
</xsl:variable>
<!--
Channel deren Timer abgelaufen sind.
-->
<xsl:variable name="trigger">
<d:copy-of select="#CONTENT">
(node-list-filter (lambda (channel) (time>=? (date->time-utc (msg 'dc-date)) (add-duration (date->time-utc (string->date (data ((sxpath '(pubDate)) channel)) "~a, ~d ~b ~Y ~H:~M:~S ~z")) (make-time 'time-duration 0 (string->number (data ((sxpath '(ttl)) channel))))))) ((sxpath '(timer rss channel)) (grove-root (current-node))))
</d:copy-of>
</xsl:variable>
<mind:reply>
<mind:become>
<d:copy-of select="#CONTENT">
(let* ((root (document-element (grove-root (current-node))))
(channels (xsl-variable "channels")))
(make element gi: (gi root) ns: (ns root) attributes: (copy-attributes root)
(node-list-map (lambda (node) (if (equal? (gi node) 'timer) (make element gi: (gi node) ns: (ns node) attributes: (copy-attributes node) (node-list-map (lambda (node) (make element gi: 'rss node)) channels)) node)) (children root))))
</d:copy-of>
</mind:become>
<!--
Notification an die Cloud (Timer abgelaufen)
-->
<d:copy-of select="#CONTENT">
(node-list-map (lambda (channel)
(make element gi: 'send attributes: `((type "write"))
(node-list (make element gi: 'to (attribute-string "path" ((sxpath '(cloud)) channel)))
(make element gi: 'body (children ((sxpath '(cloud)) channel)))))) (xsl-variable "trigger"))
</d:copy-of>
<mind:output>
<xsl:attribute name="location">
<d:copy-of select="(string-append "https://askemos1.tzv.de/" (oid->string (me 'get 'id)))"></d:copy-of>
</xsl:attribute>
</mind:output>
</mind:reply>
</d:when>
<xsl:otherwise>
<d:copy-of select="(error "request not understood")"></d:copy-of>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
Diese Seite findet man von: overview, .
Letzte Modifikation:
Autor(en): jfw,
Dokument Nummer A67bb0753e1676f81983e0ecf3a15b391
geliefert an public
um Thu, 20 Nov 2008 18:11:01 +0100