company
home
Contents
Welcome

Download
User Guide
Developers Guide
Download & Installation
Corporate To-Do List Tutorial
Corporate Blog Tutorial
Script Packages

XML Tutorial
Scripting Reference (DTD)

Terms of use
Contact us
Corporate Blog Tutorial

Overview

A blog (short for web log) is a website that is regularly updated with comments, thoughts, and questions by its owner. It's a kind of online diary and the best ones have quite a wide readership. Sometimes a blog is written by more than one person, it becomes a group blog, and in a corporate environment such a blog can be quite a useful tool.

If a group of people are working on a common project, there are various ways they can communicate. Talking face to face or over the phone is the most common form. Emails and to a lessor extent, instant messaging are also commonly used.

The problem is, that these kinds of discussions are hugely valuable because they capture, knowledge, decisions, reasons and so forth. But the tools we use to discuss issues tend to be very poor at content capture. We tend not to minute our face to face discussions, or record our phone calls. Email is an honourable exception to this rule of thumb, email can capture a conversation. However, it subsequently faces another problem which is organizing a series of conversations so that the initial point along with the comments and responses of others can be easily accessed. Anyone who has ever had the task of going through a large set of emails from a group of people in order to find out why a particular decision was made, or find a casually mentioned telephone number will be familiar with this problem.

A group blog is an excellent tool for capturing corporate knowledge,. Holding discussions in blog form rather than via telephone or email means that conversations can be read linearly - rather than as as set of emailed quotes. They can be easily searched, and their content is held centrally - and can be accessed worldwide if the appropriate networking arrangements have been put in place.

For anyone thinking about setting up a corporate group blog, the main decision is whether or not to make it public (e.g. available over the public internet) or private, with access protected by passwords and other security arrangements. Our own experience has been that corporate blogs are best made private and only available to group members. This allows members to speak freely about their problems, complain about competitors, suppliers, etc. and generally be rather more open than they would be if they knew that every word was subject to public scrutiny.

As far as webflow is concerned, a password protected group blog is quite a simple application.......

Outline

The blog which we are creating here will simply allow multiple users to post articles onto one blog. Users can see all the posts, but are only able to change their own. The posts are displayed in date order, with only the first 10 visible.

This tutorial assumes you have worked through the corporate todo list as some basic ideas will be skipped over lightly here.

We start by defining the script id and name:-

<?xml version="1.0"?>
<!DOCTYPE ofscript SYSTEM "http://www.safedataco.com/dtd/webflow/ofscript.dtd">
<ofscript version="1.0" id="com.safedataco.Blog" name="Blog">


</ofscript>

Changes to the xml files are highlighted from now on to make it easier to identify the changes made from section to section.

Save this script as a text file with an xml extension. Something like 'blog.xml' would be a good choice.

Mappings

In the mappings section we define the variables used to store information about each blog post.

<?xml version="1.0"?>
<!DOCTYPE ofscript SYSTEM "http://www.safedataco.com/dtd/webflow/ofscript.dtd">
<ofscript version="1.0" id="com.safedataco.Blog" name="Blog">

  <mapping>
    
    <svar name="subject" />
    
    <svar name="content" />
    
    <lvar name="postingdate" converter="com.safedataco.officeflow.client.custom.converters.DateTimeConverter" />
    
    <lvar name="modifieddate" converter="com.safedataco.officeflow.client.custom.converters.DateTimeConverter" />
    
    <ivar name="posteduser" />
    
    <svar name="comment" />
    
    <lvar name="commentdate" converter="com.safedataco.officeflow.client.custom.converters.DateTimeConverter" />
    
    <ivar name="datatype" />
    
    <svar name="posteduserfullname" />
    
  </mapping>

</ofscript>

Some things to note here: We need to store the id the user who posted the item (posteduser) to identify them against the current logged in user to see if they are allowed to change the post. The fullname of the user (posteduserfullname) is for display purposes so users can see who posted each item. We define an integer called "datatype" for future versions where we may wish to associate data with each item such as comments. In this example we simply set the datatype to zero when adding new posts.

Backup & Menus

Next we supply a variable to identify each item in the backup system, and define the menu bar.

<?xml version="1.0"?>
<!DOCTYPE ofscript SYSTEM "http://www.safedataco.com/dtd/webflow/ofscript.dtd">
<ofscript version="1.0" id="com.safedataco.Blog" name="Blog">

  <mapping>
      
    <svar name="subject" />
    
    <svar name="content" />
        
    <lvar name="postingdate" converter="com.safedataco.officeflow.client.custom.converters.DateTimeConverter" />
    
    <lvar name="modifieddate" converter="com.safedataco.officeflow.client.custom.converters.DateTimeConverter" />
    
    <ivar name="posteduser" />
    
    <svar name="comment" />
    
    <lvar name="commentdate" converter="com.safedataco.officeflow.client.custom.converters.DateTimeConverter" />
    
    <ivar name="datatype" />
    
    <svar name="posteduserfullname" />
    
  </mapping>

  <backup fragment="{subject}" />
  
  <menus>
    
    <menu name="Blog" rwreq="true">
      <item name="New post" action="newpost" />
    </menu>
    
  </menus>
  
</ofscript>

We simply have one menu item to create a post.

New Post

<?xml version="1.0"?>
<!DOCTYPE ofscript SYSTEM "http://www.safedataco.com/dtd/webflow/ofscript.dtd">
<ofscript version="1.0" id="com.safedataco.Blog" name="Blog">
  
  <mapping>
    
    <svar name="subject" />
    
    <svar name="content" />
        
    <lvar name="postingdate" converter="com.safedataco.officeflow.client.custom.converters.DateTimeConverter" />
    
    <lvar name="modifieddate" converter="com.safedataco.officeflow.client.custom.converters.DateTimeConverter" />
    
    <ivar name="posteduser" />
    
    <svar name="comment" />
    
    <lvar name="commentdate" converter="com.safedataco.officeflow.client.custom.converters.DateTimeConverter" />
    
    <ivar name="datatype" />
    
    <svar name="posteduserfullname" />
    
  </mapping>

  <backup fragment="{subject}" />
  
  <menus>
  
    <menu name="Blog" rwreq="true">
      <item name="New post" action="newpost" />
    </menu>
  
  </menus>
  
  <actions>
    
    <action name="newpost">
      
      <clear variables="subject, content" />
      
      <form title="NEW POST">
        
        <input name="subject" label="Subject" />
        
        <textbox name="content" label="Content" />        
        
      </form>
      
      <set name="datatype" value="0" />
      
      <set name="posteduser" operation="currentuserid" />
      
      <set name="posteduserfullname" operation="currentuserfullname" />
      
      <set name="postingdate" operation="todaydatetime" />
      
      <set name="modifieddate" value="{postingdate}" />
      
      <add>
        <field name="subject" />
        <field name="content" />
        <field name="datatype" />
        <field name="posteduser" />
        <field name="posteduserfullname" />
        <field name="postingdate" />
        <field name="modifieddate" />
      </add>
      
    </action>
    
  </actions>

</ofscript>

Most of this should be familiar from the todo list tutorial. The form defines a simple single line text box for the subject of the post, and a multiline box for the actual content. The most interesting items here are the 'set' tags. The first set tag simply sets the datatype variable to the value of 0. The next set variable sets the variable to the current users id. Similarly the next sets the full name of the user. The current date and time is set to the "postingdate" variable, and finally the modifieddate variable is set to the same value as the posting date (as this is the first time the post has been modified). All these variables are saved in the 'add' section. Some of these variables (posteduser) are used by the script to determine if various script actions can function or not, whilst other variables here are used simply to display meta information about the post to the screen.

The default action

Now we can post we need to be able to see the posts listed. We define a 'default' action to list the first 25 newest items with the option of paging to the next 25 and so on.

<?xml version="1.0"?>
<!DOCTYPE ofscript SYSTEM "http://www.safedataco.com/dtd/webflow/ofscript.dtd">
<ofscript version="1.0" id="com.safedataco.Blog" name="Blog">
  
  <mapping>
    
    <svar name="subject" />
    
    <svar name="content" />
        
    <lvar name="postingdate" converter="com.safedataco.officeflow.client.custom.converters.DateTimeConverter" />
    
    <lvar name="modifieddate" converter="com.safedataco.officeflow.client.custom.converters.DateTimeConverter" />
    
    <ivar name="posteduser" />
    
    <svar name="comment" />
    
    <lvar name="commentdate" converter="com.safedataco.officeflow.client.custom.converters.DateTimeConverter" />
    
    <ivar name="datatype" />
    
    <svar name="posteduserfullname" />
    
  </mapping>

  <backup fragment="{subject}" />
  
  <menus>
  
    <menu name="Blog" rwreq="true">
      <item name="New post" action="newpost" />
    </menu>
  
  </menus>
  
  <actions>
  
    <action name="newpost">
    
      <clear variables="subject, content" />
    
      <form title="NEW POST">
      
        <input name="subject" label="Subject" />

        <textbox name="content" label="Content" />        
                        
      </form>

      <set name="datatype" value="0" />
      
      <set name="posteduser" operation="currentuserid" />
      
      <set name="posteduserfullname" operation="currentuserfullname" />
      
      <set name="postingdate" operation="todaydatetime" />
      
      <set name="modifieddate" value="{postingdate}" />
        
      <add>
        <field name="subject" />
        <field name="content" />
        <field name="datatype" />
        <field name="posteduser" />
        <field name="posteduserfullname" />
        <field name="postingdate" />
        <field name="modifieddate" />
      </add>
                
    </action>

    <action name="default">
      
      <form okbutton="false" cancelbutton="false">
        
        <batch name="blogposts" defaultcolumnvar="postingdate" defaultsortdirection="descending" visiblerows="25" showpagebuttons="true">
          
          <column var="subject" />
          
          <column var="content" />
          
          <column var="postingdate" />
          
          <query filter="(datatype=$1)">
            <param val="0"/>
          </query>
          
          <label text="{subject}" />
          
          <separator />
          
          <label text="{content}" />
          
          <separator showline="true" />
          
        </batch>
        
      </form>
      
    </action>
    
  </actions>

</ofscript>

This form contains a batch tag. The batch tag is similar in operation to a table tag, but the contents are executed for each item returned in the query. Here we specify the data items which will be made available for each data item returned in the query set. For compatibility reasons with the table item the tags are called 'column' even though the batch tag does not have columns *( TODO: THIS MAY CHANGE!! ). We then define the query in a similar way to the table tag. This query will all select data added by the newpost action.

Any remaining tags in the batch tag will be executed for each item returned by the query. In this case we display the subject, then the content followed by a line to separate each item.

The attributes on the batch tag control the order of the posts (most recent post at the top of the page), and the amount of items to show (25). The "showpagebuttons" attribute places "Prev" and "Next" buttons at the bottom so the user can display the next 25 etc.


A Screenshot showing the blog with two posts. (Click each image to enlarge)

Showing meta information

Since we recorded the post date and the user who made the post, we wish to display this information at the bottom of each post.

In our default action, we simply retrieve the information required in addition to the subject and content and display it using labels. An align tag is used to arrange the labels horizontally.

<?xml version="1.0"?>
<!DOCTYPE ofscript SYSTEM "http://www.safedataco.com/dtd/webflow/ofscript.dtd">
<ofscript version="1.0" id="com.safedataco.Blog" name="Blog">
  
  <mapping>
    
    <svar name="subject" />
    
    <svar name="content" />
        
    <lvar name="postingdate" converter="com.safedataco.officeflow.client.custom.converters.DateTimeConverter" />
    
    <lvar name="modifieddate" converter="com.safedataco.officeflow.client.custom.converters.DateTimeConverter" />
    
    <ivar name="posteduser" />
    
    <svar name="comment" />
    
    <lvar name="commentdate" converter="com.safedataco.officeflow.client.custom.converters.DateTimeConverter" />
    
    <ivar name="datatype" />
    
    <svar name="posteduserfullname" />
    
  </mapping>

  <backup fragment="{subject}" />
  
  <menus>
  
    <menu name="Blog" rwreq="true">
      <item name="New post" action="newpost" />
    </menu>
  
  </menus>
  
  <actions>
  
    <action name="newpost">
    
      <clear variables="subject, content" />
    
      <form title="NEW POST">
      
        <input name="subject" label="Subject" />

        <textbox name="content" label="Content" />        
                        
      </form>

      <set name="datatype" value="0" />
      
      <set name="posteduser" operation="currentuserid" />
      
      <set name="posteduserfullname" operation="currentuserfullname" />
      
      <set name="postingdate" operation="todaydatetime" />
      
      <set name="modifieddate" value="{postingdate}" />
        
      <add>
        <field name="subject" />
        <field name="content" />
        <field name="datatype" />
        <field name="posteduser" />
        <field name="posteduserfullname" />
        <field name="postingdate" />
        <field name="modifieddate" />
      </add>
                
    </action>

    <action name="default">
      
      <form okbutton="false" cancelbutton="false">
        
        <batch name="blogposts" defaultcolumnvar="postingdate" defaultsortdirection="descending" visiblerows="25" showpagebuttons="true">
          
          <column var="subject" />
          
          <column var="content" />
          
          <column var="postingdate" />
                                      
          <column var="posteduserfullname" />
          
          <query filter="(datatype=$1)">
            <param val="0"/>
          </query>          
          
          <label text="{subject}" />
          
          <separator />
          
          <label text="{content}" />
                              
          <separator />
          
          <align widths="200, *">
            
            <label text="{postingdate}" rendererclass="com.safedataco.officeflow.client.custom.columnrenderers.DateTimeColumnRenderer" />
            
            <label text="Posted by: {posteduserfullname}." />
            
          </align>
                        
          <separator showline="true" />
          
        </batch>
        
      </form>

    </action>
  
  </actions>

</ofscript>


(Click each image to enlarge)

Edit and Reply buttons

For each post we need the facility to reply to posts and edit posts. Only the user who created the post can edit it. The two buttons which reply and edit will be located on the same line as the posted date and posted by.

<?xml version="1.0"?>
<!DOCTYPE ofscript SYSTEM "http://www.safedataco.com/dtd/webflow/ofscript.dtd">
<ofscript version="1.0" id="com.safedataco.Blog" name="Blog">
  
  <mapping>
    
    <svar name="subject" />
    
    <svar name="content" />
        
    <lvar name="postingdate" converter="com.safedataco.officeflow.client.custom.converters.DateTimeConverter" />
    
    <lvar name="modifieddate" converter="com.safedataco.officeflow.client.custom.converters.DateTimeConverter" />
    
    <ivar name="posteduser" />
    
    <svar name="comment" />
    
    <lvar name="commentdate" converter="com.safedataco.officeflow.client.custom.converters.DateTimeConverter" />
    
    <ivar name="datatype" />
    
    <svar name="posteduserfullname" />
    
  </mapping>

  <backup fragment="{subject}" />
  
  <menus>
  
    <menu name="Blog" rwreq="true">
      <item name="New post" action="newpost" />
    </menu>
  
  </menus>
  
  <actions>
  
    <action name="newpost">
    
      <clear variables="subject, content" />
    
      <form title="NEW POST">
      
        <input name="subject" label="Subject" />

        <textbox name="content" label="Content" />        
                        
      </form>

      <set name="datatype" value="0" />
      
      <set name="posteduser" operation="currentuserid" />
      
      <set name="posteduserfullname" operation="currentuserfullname" />
      
      <set name="postingdate" operation="todaydatetime" />
      
      <set name="modifieddate" value="{postingdate}" />
        
      <add>
        <field name="subject" />
        <field name="content" />
        <field name="datatype" />
        <field name="posteduser" />
        <field name="posteduserfullname" />
        <field name="postingdate" />
        <field name="modifieddate" />
      </add>
                
    </action>

    <action name="default">
      
      <form okbutton="false" cancelbutton="false">
        
        <set name="currentuser" operation="currentuserid" />
        
        <batch name="blogposts" defaultcolumnvar="postingdate" defaultsortdirection="descending" visiblerows="25" showpagebuttons="true">
          
          <column var="subject" />
          
          <column var="content" />
          
          <column var="postingdate" />
                                      
          <column var="posteduser" />
          
          <column var="posteduserfullname" />
          
          <query filter="(datatype=$1)">
            <param val="0"/>
          </query>          
          
          <label text="{subject}" />
          
          <separator />
          
          <label text="{content}" />
                              
          <separator />
          
          <align alignments="left, left, right, right" widths="200, *, 40, 40">
          
            <label text="{postingdate}" rendererclass="com.safedataco.officeflow.client.custom.columnrenderers.DateTimeColumnRenderer" />

            <label text="Posted by: {posteduserfullname}." />
            
            <button text="Edit" condition="{posteduser}=={currentuser}" action="editpost?postpk={blogposts}" />
            
            <button text="Reply" action="replypost?postpk={blogposts}" />
            
          </align>
                        
          <separator showline="true" />
          
        </batch>
        
      </form>

    </action>
  
  </actions>

</ofscript>


(Click each image to enlarge)

Firstly we assign the current logged in user to a variable and ensure we retrieve the user id for each post. We compare these two variables to see if the current user is allowed to edit the post. This can be seen in the 'condition' attribute of the button tag for "Edit". The align tag has two extra attributes added to specify the alignment of each child tag and the width in pixels for that item. Here we say that we wish to display the two buttons to the right of the screen each in a 40 pixel wide block. The posted date and posted user are free to use the remaining space as they wish.

Finally, the actions on both of the buttons are slighly special in that they pass the current item's id to the given action. As batch tag specified 'blogposts' as it's name when each item is 'executed' the batch tag sets the item's id to the 'blogposts' variable. We need this id in the editpost and replypost actions to identify the post which we are editing or replying to.

When the action is executed by clicking the button, the Webflow will set the variables specified after the ? to the given values, ie for the edit button which has the following action:-

editpost?postpk={blogposts}

The {blogposts} variable will contain the current items id from the batch tag, so the action when executed will be resolved to something like:-

editpost?postpk=1002326

Will cause a variable called 'postpk' to be set to the value of 1002326 (in this example).

Edit Post

To edit a post we simply define an action to respond to the Edit button's action.

<?xml version="1.0"?>
<!DOCTYPE ofscript SYSTEM "http://www.safedataco.com/dtd/webflow/ofscript.dtd">
<ofscript version="1.0" id="com.safedataco.Blog" name="Blog">
  
  <mapping>
    
    <svar name="subject" />
    
    <svar name="content" />
        
    <lvar name="postingdate" converter="com.safedataco.officeflow.client.custom.converters.DateTimeConverter" />
    
    <lvar name="modifieddate" converter="com.safedataco.officeflow.client.custom.converters.DateTimeConverter" />
    
    <ivar name="posteduser" />
    
    <svar name="comment" />
    
    <lvar name="commentdate" converter="com.safedataco.officeflow.client.custom.converters.DateTimeConverter" />
    
    <ivar name="datatype" />
    
    <svar name="posteduserfullname" />
    
  </mapping>

  <backup fragment="{subject}" />
  
  <menus>
  
    <menu name="Blog" rwreq="true">
      <item name="New post" action="newpost" />
    </menu>
  
  </menus>
  
  <actions>
  
    <action name="newpost">
    
      <clear variables="subject, content" />
    
      <form title="NEW POST">
      
        <input name="subject" label="Subject" />

        <textbox name="content" label="Content" />        
                        
      </form>

      <set name="datatype" value="0" />
      
      <set name="posteduser" operation="currentuserid" />
      
      <set name="posteduserfullname" operation="currentuserfullname" />
      
      <set name="postingdate" operation="todaydatetime" />
      
      <set name="modifieddate" value="{postingdate}" />
        
      <add>
        <field name="subject" />
        <field name="content" />
        <field name="datatype" />
        <field name="posteduser" />
        <field name="posteduserfullname" />
        <field name="postingdate" />
        <field name="modifieddate" />
      </add>
                
    </action>

    <action name="default">
      
      <form okbutton="false" cancelbutton="false">
        
        <set name="currentuser" operation="currentuserid" />
        
        <batch name="blogposts" defaultcolumnvar="postingdate" defaultsortdirection="descending" visiblerows="25" showpagebuttons="true">
          
          <column var="subject" />
          
          <column var="content" />
          
          <column var="postingdate" />
                                      
          <column var="posteduser" />
          
          <column var="posteduserfullname" />
          
          <query filter="(datatype=$1)">
            <param val="0"/>
          </query>          
          
          <label text="{subject}" />
          
          <separator />
          
          <label text="{content}" />
                              
          <separator />
          
          <align alignments="left, left, right, right" widths="200, *, 40, 40">
          
            <label text="{postingdate}" rendererclass="com.safedataco.officeflow.client.custom.columnrenderers.DateTimeColumnRenderer" />

            <label text="Posted by: {posteduserfullname}." />
            
            <button text="Edit" condition="{posteduser}=={currentuser}" action="editpost?postpk={blogposts}" />
            
            <button text="Reply" action="replypost?postpk={blogposts}" />
            
          </align>
                        
          <separator showline="true" />
          
        </batch>
        
      </form>

    </action>
    
    <action name="editpost">
      
      <retrieve pk="{postpk}">
        <field name="subject" />
        <field name="content" />
      </retrieve>
      
      <form title="EDIT POST">
        
        <input name="subject" label="Subject" />
        
        <textbox name="content" label="Content" />        
        
      </form>
      
      <set name="modifieddate" operation="todaydatetime" />
      
      <change pk="{postpk}">
        <field name="subject" />
        <field name="content" />
        <field name="modifieddate" />
      </change>
      
    </action>
    
  </actions>

</ofscript>

Note, in the retrieve and change tags the postpk variable comes automatically from the buttons we defined in the last section.

This action simply retrieves the data from the database, creates a form allowing the user to change the details, updates the modified date and saves the data back to the database.

Reply to Post

To reply to a post we simply define an action to respond to the Reply button's action in the same way as Edit. When reply to a post we want to pick up the original subject and prefix 'Re:' in front of the subject.

<?xml version="1.0"?>
<!DOCTYPE ofscript SYSTEM "http://www.safedataco.com/dtd/webflow/ofscript.dtd">
<ofscript version="1.0" id="com.safedataco.Blog" name="Blog">
  
  <mapping>
    
    <svar name="subject" />
    
    <svar name="content" />
        
    <lvar name="postingdate" converter="com.safedataco.officeflow.client.custom.converters.DateTimeConverter" />
    
    <lvar name="modifieddate" converter="com.safedataco.officeflow.client.custom.converters.DateTimeConverter" />
    
    <ivar name="posteduser" />
    
    <svar name="comment" />
    
    <lvar name="commentdate" converter="com.safedataco.officeflow.client.custom.converters.DateTimeConverter" />
    
    <ivar name="datatype" />
    
    <svar name="posteduserfullname" />
    
  </mapping>

  <backup fragment="{subject}" />
  
  <menus>
  
    <menu name="Blog" rwreq="true">
      <item name="New post" action="newpost" />
    </menu>
  
  </menus>
  
  <actions>
  
    <action name="newpost">
    
      <clear variables="subject, content" />
    
      <form title="NEW POST">
      
        <input name="subject" label="Subject" />

        <textbox name="content" label="Content" />        
                        
      </form>

      <set name="datatype" value="0" />
      
      <set name="posteduser" operation="currentuserid" />
      
      <set name="posteduserfullname" operation="currentuserfullname" />
      
      <set name="postingdate" operation="todaydatetime" />
      
      <set name="modifieddate" value="{postingdate}" />
        
      <add>
        <field name="subject" />
        <field name="content" />
        <field name="datatype" />
        <field name="posteduser" />
        <field name="posteduserfullname" />
        <field name="postingdate" />
        <field name="modifieddate" />
      </add>
                
    </action>

    <action name="default">
      
      <form okbutton="false" cancelbutton="false">
        
        <set name="currentuser" operation="currentuserid" />
        
        <batch name="blogposts" defaultcolumnvar="postingdate" defaultsortdirection="descending" visiblerows="25" showpagebuttons="true">
          
          <column var="subject" />
          
          <column var="content" />
          
          <column var="postingdate" />
                                      
          <column var="posteduser" />
          
          <column var="posteduserfullname" />
          
          <query filter="(datatype=$1)">
            <param val="0"/>
          </query>          
          
          <label text="{subject}" />
          
          <separator />
          
          <label text="{content}" />
                              
          <separator />
          
          <align alignments="left, left, right, right" widths="200, *, 40, 40">
          
            <label text="{postingdate}" rendererclass="com.safedataco.officeflow.client.custom.columnrenderers.DateTimeColumnRenderer" />

            <label text="Posted by: {posteduserfullname}." />
            
            <button text="Edit" condition="{posteduser}=={currentuser}" action="editpost?postpk={blogposts}" />
            
            <button text="Reply" action="replypost?postpk={blogposts}" />
            
          </align>
                        
          <separator showline="true" />
          
        </batch>
        
      </form>

    </action>
    
    <action name="editpost">
    
      <retrieve pk="{postpk}">
        <field name="subject" />
        <field name="content" />
      </retrieve>
    
      <form title="EDIT POST">
      
        <input name="subject" label="Subject" />

        <textbox name="content" label="Content" />        
                        
      </form>
      
      <set name="modifieddate" operation="todaydatetime" />
      
      <change pk="{postpk}">
        <field name="subject" />
        <field name="content" />
        <field name="modifieddate" />
      </change>
                
    </action>
    
    <action name="replypost">
      
      <retrieve pk="{postpk}">
        <field name="subject" />
      </retrieve>    
      
      <clear variables="content" />
      
      <set name="subject" value="Re: {subject}" />
      
      <form title="REPLY TO POST">
      
        <input name="subject" label="Subject" />
        
        <textbox name="content" label="Content" />        
      
      </form>
      
      <set name="datatype" value="0" />
      
      <set name="posteduser" operation="currentuserid" />
      
      <set name="postingdate" operation="todaydatetime" />
      
      <set name="modifieddate" value="{postingdate}" />
      
      <add>
        <field name="subject" />
        <field name="content" />
        <field name="datatype" />
        <field name="posteduser" />
        <field name="postingdate" />
        <field name="modifieddate" />
      </add>
      
    </action>
  
  </actions>

</ofscript>

This replypost action is similar to the add post action apart from the subject is retrieved from the original post.

Conclusion

This completes the Blog script. This script defines the basic actions required to post new items and change them. It can be further enhanced to provide comments against each post instead of the reply function. This would have the effect of grouping replies together.

Now if you wish you can try installing this script into Webflow. If you have not done this before, read the "Installing scripts" section in the Installation guide.

Download

You can download the complete script here.

© Copyright 2006 SafeDataCo.com