WYSIWYG Forum demonstration

Features

Demonstration

Subject
by Anonymous Coward (38.103.63.16) on Wednesday July 23, @07:58PM
Reply here...
Frist post!
by Marc Mongenet on Thursday June 14, @06:20AM
This is the first post!

[ Reply to This ]

First reply
by Marc (again) on Thursday June 14, @06:20AM
This the 1st reply to the 1st post.

[ Reply to This ]

No subject
by Demonstrator on Thursday July 10, @03:49AM
Uninteresting reply.

[ Reply to This ]

View as moderator.

W2ML sources

This forum is implemented with a W2ML template that is instatiated when a new message is created:

<!-- ©2007 Marc Mongenet. You are free to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of this W2ML example. -->

<!-- User 'moderator', without password for demonstration.
This element is only processed by the w2:login attribute. -->
<w2:user ac="x" user="none"><w2:name>moderator</w2:name></w2:user>

<!-- Only the moderator may delete messages. -->
<w2:g login="" ac="d" user="moderator">

<!-- The template is hidden in an undisplayed div. -->
<div style="display:none">
 <!-- Message template, deletable after instantiation. -->
 <div w2:template="msg" w2:del="delmsg">
  <div style="border:1px solid black; margin-bottom:1em">
   <!-- Message head -->
   <div style="background:#066; color:#FFF; padding:0.5ex">
    <!-- Message subject, text-only editable once -->
    <strong w2:once="w2:ed=&quot;text&quot;">Subject</strong>
    <!-- Delete button for moderator -->
    <button w2:ac="x" w2:user="moderator" w2:ed="del" w2:to="delmsg">Delete</button>
    <!-- Message author, text-only editable once. -->
    <br/>by <span w2:once="w2:ed=&quot;text&quot;">Anonymous Coward</span>
    <!-- Save visitor IP. -->
    <w2:g next="ac='x' user='moderator'">(<w2:res><w2:v internal="user ip"/></w2:res>)</w2:g> on
    <!-- Save message submission date in UTC. -->
    <w2:res tfiller="0" tz="utc">
     <w2:day fmt="name"/> <w2:month fmt="name"/> <w2:day/>,
     @<w2:hour fmt="12" twidth="2"/>:<w2:minute twidth="2"/><w2:ampm/>
    </w2:res>
   </div>
   <!-- Message body, wysiwyg editable once -->
   <div w2:once="w2:ed=&quot;wysiwyg&quot;" style="padding:0.5ex">
    Reply here...<br/>
   </div>
   <!-- The reply link appears after the message is saved. -->
   <w2:next>
    <p style="padding:0.5ex; margin:0">
     [ <a href="#" w2:ed="new" w2:to="replies">Reply to This</a> ]
    </p>
   </w2:next>
  </div>
  <!-- Replies are going in this div, last reply is last child. -->
  <div style="padding-left:2em" w2:new="replies" w2:from="msg" w2:to="lastChild">
  </div>
 </div>
</div>

<!-- Button to post a new message above itself. -->
<button w2:ed="new" w2:from="msg" w2:to="previousSibling">Post message</button>

<!-- Link to switch between visitor and moderator login. -->
<p>View as
<a w2:ac="-x" w2:user="moderator" href="?w2mlusr=moderator">moderator</a
><a w2:ac="x" w2:user="moderator" href="?w2mllog=out">visitor</a>.
</p>

</w2:g>