Price list demonstration

Features

The demonstration

Item Price
186 processor $14
286 processor $21
386 processor $27

View as merchant.

The demonstration has been reset.

Item Price
186 processor $14
286 processor $21
386 processor $27

View as merchant.


last reset: May 28 @0:03 UTC

W2ML sources

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

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

<!-- The tabular price list. Only merchant may edit, add, or delete lines. -->
<table border="1" cellspacing="0" w2:ac="end" w2:user="merchant" w2:login="">

 <!-- The template is hidden in an undisplayed tbody. It is only used
 when the merchant adds a line, so we only process it for him. -->
 <tbody style="display:none" w2:ac="x" w2:user="merchant">

  <!-- The price line template. It is possible to add a next sibling
  line of a previously added line. Lines can also be deleted. -->
  <tr w2:template="priceline" w2:new="line" w2:from="priceline"
      w2:to="nextSibling" w2:del="delline">
   <!-- Editable item name. -->
   <td><span w2:ed="text">item</span></td>
   <!-- Editable item price. -->
   <td align="right"><span w2:ed="text">$</span></td>
   <!-- Cell with buttons, processed only for the merchant. -->
   <td w2:ac="x" w2:user="merchant">
    <!-- Button to add a next sibling line. -->
    <button w2:ed="new" w2:to="line">Add line</button>
    <!-- Button to delete this line. -->
    <button w2:ed="del" w2:to="delline">Delete line</button>
   </td>
  </tr>

 </tbody>

 <!-- Table head, lines are added after this line (next sibling). -->
 <tr w2:new="line0" w2:from="priceline" w2:to="nextSibling">
  <th>Item</th>
  <th align="right">Price</th>
  <!-- Cell with a button to create the first line, only for merchant. -->
  <th w2:ac="x" w2:user="merchant">
   <button w2:ed="new" w2:to="line0">Add line</button>
  </th>
 </tr>
 
 <!-- Price line templates are instantiated here. -->
 
</table>

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

→ See user element in the W2ML specification.
→ See login attribute in the W2ML specification.
→ See ac attribute in the W2ML specification.
→ See template attribute in the W2ML specification.