CreateUser

New Entry Point Form

New Entry Point

Administrator Secret
Entry Name
Secret
Secret (for verification)
Either give an existing OID?, or data and action.
OID?
Data
Action
 

change name

(let ((s (data (form-field 'secret1 (current-node)))) (oid (data (form-field 'oid (current-node))))) (if (not (equal? s (data (form-field 'secret2 (current-node))))) (error "secret and 2nd secret are not the same, try again.")) (node-list ;; Stay unchanged. (document-element (grove-root (current-node))) (make element gi: 'EntryPoint? attributes: `((host ,(data (form-field 'host (current-node)))) (name ,(data (form-field 'name (current-node)))) (secret ,(data (form-field 'admin-secret (current-node))))) (if (equal? "" oid) (xsl-variable "new") (make element gi: 'id attributes: `((secret ,(data (form-field 'secret1 (current-node))))) (literal (string->oid oid))))) (make element gi: 'output (literal (data (form-field 'name (current-node)))))))

Source code:

<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">
 <xsl:template match="*[@type=&quot;read&quot;]">
  <html xmlns="http://www.w3.org/1999/xhtml">
   <head>
    <title>New Entry Point Form</title>
    <meta content="text/html" http-equiv="Content-Type"></meta>
   </head>
   <body bgcolor="white">
    <h1>New Entry Point</h1>
    <form method="post">
     <xsl:attribute name="action">
      <dsssl:copy-of select="(write-locator (msg &apos;location-format) (list (oid-&gt;string (me &apos;get &apos;id))))"></dsssl:copy-of>
     </xsl:attribute>
     <table bgcolor="silver" border="1">
      <tbody>
       <tr>
        <td>Administrator Secret</td>
        <td>
         <input name="admin-secret" size="20" type="password"></input>
         <dsssl:input name="host" type="hidden" dsssl:value="(literal (public-oid))"></dsssl:input>
        </td>
       </tr>
       <tr>
        <td>Entry Name</td>
        <td>
         <input name="name" size="20" type="text"></input>
        </td>
       </tr>
       <tr>
        <td>Secret</td>
        <td>
         <input name="secret1" size="20" type="password"></input>
        </td>
       </tr>
       <tr>
        <td>Secret (for verification)</td>
        <td>
         <input name="secret2" size="20" type="password"></input>
        </td>
       </tr>
       <tr>
        <td colspan="2"><em>Either</em> give an existing OID,
or data and action.</td>
       </tr>
       <tr>
        <td>OID</td>
        <td>
         <input name="oid" size="34" type="text" value=""></input>
        </td>
       </tr>
       <tr>
        <td>Data</td>
        <td>
         <input name="data" size="20" type="text" value="public/xslt-user"></input>
        </td>
       </tr>
       <tr>
        <td>Action</td>
        <td>
         <input name="action" size="20" type="text" value="xslt-method"></input>
        </td>
       </tr>
       <tr>
        <td>&amp;nbsp;</td>
        <td>
         <input type="submit" value="Submit"></input>
        </td>
       </tr>
      </tbody>
     </table>
    </form>
    <p>
     <a href="/LOGOUT">change name</a>
    </p>
   </body>
  </html>
 </xsl:template>
 <xsl:template match="*[@type=&quot;write&quot;]">
  <mind:reply>
   <xsl:variable name="new">
<!--
  Instead messily creating a completly new object, we probably should
  use the to-be-implemented metamorph action of a place, which is going
  to result in a new unlinked place anyway.

  A metamorph BTW will copy (share) everything but the Action.  (The
  links will consequently have to be copied, rest shared.)  A new
  action as defined by the metamorph request will be assigned to the
  new place.
  -->
    <mind:new>
     <xsl:attribute name="secret">
      <dsssl:copy-of select="(md5-digest (data (form-field &apos;secret1 (current-node))))"></dsssl:copy-of>
     </xsl:attribute>
     <xsl:attribute name="action">
      <dsssl:copy-of select="(data (form-field &apos;action (current-node)))"></dsssl:copy-of>
     </xsl:attribute>
     <dsssl:copy-of select="(fetch (parsed-locator (data (form-field &apos;data (current-node)))))"></dsssl:copy-of>
    </mind:new>
   </xsl:variable>
   <dsssl:copy-of select="#CONTENT">

(let ((s (data (form-field 'secret1 (current-node))))
      (oid (data (form-field 'oid (current-node)))))
  (if (not (equal? s (data (form-field 'secret2 (current-node)))))
      (error "secret and 2nd secret are not the same, try again."))
  (node-list
   ;; Stay unchanged.
   (document-element (grove-root (current-node)))
   (make element gi: 'EntryPoint
     attributes: `((host ,(data (form-field 'host (current-node))))
                   (name ,(data (form-field 'name (current-node))))
                   (secret ,(data (form-field 'admin-secret (current-node)))))
     (if (equal? "" oid) (xsl-variable "new")
       (make element
        gi: 'id
        attributes: `((secret ,(data (form-field 'secret1 (current-node)))))
        (literal (string-&gt;oid oid)))))
   (make element gi: 'output (literal (data (form-field 'name (current-node)))))))

</dsssl:copy-of>
  </mind:reply>
 </xsl:template>
</xsl:stylesheet>

Diese Seite findet man von: overview, .




Letzte Modifikation: Mon, 21 May 2007 11:35:52 +0200

Autor(en): jfw,

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