SupportCtrl

(let* ((replicates (me 'replicates)) (li ((sxpath '(Bag li)) replicates)) (rdf (string->symbol "http://www.w3.org/1999/02/22-rdf-syntax-ns#"))) (receive (deleteable insertable) (partition (lambda (name) (ormap (lambda (li) (equal? (attribute-string 'resource li) name)) li)) (map data (form-field 'name (current-node)))) (let ((nli (fold (lambda (name init) (if (equal? name "") init (cons (make element gi: 'li ns: rdf attributes: `((,rdf resource ,name))) init))) (empty-node-list) insertable)) (left (node-list-filter (lambda (li) (not (member (attribute-string 'resource li) deleteable))) li))) (if (and (node-list-empty? nli) (node-list-empty? left)) (error "cowardly not removing the last supporter") (make element gi: (gi replicates) ns: (ns replicates) attributes: (copy-attributes replicates) (make element gi: 'Bag ns: rdf nli left))))))

Source code:

<d:when xmlns:ac="http://www.askemos.org/2000/CoreAPI" xmlns:d="http://www.askemos.org/2005/NameSpaceDSSSL/" test="(equal? (data (form-field &quot;action&quot; (current-node))) &quot;toggle-replication-state&quot;) ">
 <ac:reply>
  <ac:continue>
   <d:copy-of select="(grove-root (current-node))"></d:copy-of>
  </ac:continue>
  <ac:replicates>
   <d:copy-of select="#CONTENT">
(let* ((replicates (me 'replicates))
       (li ((sxpath '(Bag li)) replicates))
       (rdf (string-&gt;symbol "<a href="http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot;)))">http://www.w3.org/1999/02/22-rdf-syntax-ns#")))</a>
  (receive
    (deleteable insertable)
    (partition (lambda (name)
                 (ormap (lambda (li)
                          (equal? (attribute-string 'resource li) name))
                        li))
               (map data (form-field 'name (current-node))))
    (let ((nli (fold
                 (lambda (name init)
                   (if (equal? name "") init
                       (cons (make element gi: 'li ns: rdf
                                   attributes: `((,rdf resource ,name))) init)))
                 (empty-node-list)
                 insertable))
          (left (node-list-filter
                  (lambda (li) (not (member (attribute-string 'resource li) deleteable)))
                li)))
       (if (and (node-list-empty? nli) (node-list-empty? left))
           (error "cowardly not removing the last supporter")
           (make element gi: (gi replicates) ns: (ns replicates) attributes: (copy-attributes replicates)
              (make element gi: 'Bag ns: rdf nli left))))))
      </d:copy-of>
  </ac:replicates>
  <ac:output></ac:output>
 </ac:reply>
</d:when>

Diese Seite findet man von: MetaCtrl, overview, .




Letzte Modifikation: Sat, 29 Mar 2008 16:49:54 +0100

Autor(en): jfw,

Dokument Nummer A67bb0753e1676f81983e0ecf3a15b391 geliefert an public um Fri, 22 Aug 2008 00:37:07 +0200