MetaCtrl

;; Low level API operation here. (This is a comment. BTW?.) ;; We send a "set this protection" request to the object. (let ((target (owner me find (parsed-locator (data (form-field "what" (current-node))))))) ;; The above way we can get the object id, if we can read along the path. ;; Once we have the id, we can send a direct message, even if we can't ;; write along the given path. This implements the most usual situation, ;; where the path goes through a public channel. ((me 'get 'sender) to: target type: 'write 'location '() 'body/parsed-xml (make element gi: 'form ns: 'mind attributes: '() (node-list (make element gi: 'action ns: 'mind attributes: '() (literal "protect")) (make element gi: 'challenge ns: 'mind attributes: '() (literal (oid->string (me 'get 'id))))))) (oid->string target)) (let ((desired (map (lambda (n) (string->right (data n))) (form-field 'c (current-node)))) (to (make element gi: 'to (literal (oid->string (me 'get 'id))))) (from (make element gi: 'from (literal (oid->string (me 'get 'id)))))) (node-list (document-element (grove-root (current-node))) ; body unchanged (map (lambda (right) (make element gi: 'grant ns: 'mind to (right->node-list right))) desired) (map (lambda (right) (make element gi: 'revoke ns: 'mind from (right->node-list right))) (filter (lambda (c) (not (member c desired))) (me 'capabilities))))) (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:

<!--

We have a 'metaview', which gives a "somehow" representation of the
meta data of a place, naturally those include some web forms.  Here we
have the corresponding controllers.

The implementation is not very much state of the art, instead you'll
see a lot of heritage from early days, where features where missing.

Both, 'metaview' and 'metactrl' are - for now - exported as functions
available at the Scheme level with the intention to improve these
parts over time and allow at application level to dispatch to a
"standard debug level interface" as soon as it finds
"(is-meta-form? msg)" to be true.

BEWARE: don't depend on those requests or dispatch them in any other
way.  Forms and controllers of the debug level may change at any time
without prior notice.

-->
<xsl:stylesheet xmlns:dsssl="http://www.askemos.org/2000/NameSpaceDSSSL" xmlns:mind="http://www.askemos.org/2000/CoreAPI" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xml:space="default">
 <xsl:template match="request">
  <xsl:choose>@LinkDCtrl@LinkCtrl@CreateDocCtrl<!--
 Maybe we should remove the grant and revoke controls and always use
 gcai instead.
 --><dsssl:when test="
              (equal? &quot;grant&quot; (data (form-field &apos;action (current-node))))
    ">@GrantCtrl</dsssl:when>@RevokeCtrl<dsssl:when test="
              (equal? &quot;take&quot; (data (form-field &apos;action (current-node))))
    ">@TakeoverCtrl</dsssl:when>@ChangeCtrl@ProtectCtrl@SecretCtrl@AdjustRightsCtrl@SupportCtrl@OtherwiseError</xsl:choose>
 </xsl:template>
</xsl:stylesheet>

Diese Seite findet man von: overview, .




Letzte Modifikation: Sat, 29 Mar 2008 16:51:38 +0100

Autor(en): jfw,

Dokument Nummer A67bb0753e1676f81983e0ecf3a15b391 geliefert an public um Mon, 08 Sep 2008 20:49:36 +0200