Improvements in VWcms

Sunday, 22 November 2009 23:26

This Endless Software Solutions website, is maintained using the web content management system, VWcms (pronounced vee-dub).  VWcms is a software packaged developed and maintained by Mark Daniel, the author of the WASD web server software.  The software is of an excellent standard and Mark's support has always been great.

Recently I was putting together an upcoming blog entry that makes rather extensive use of the $$IF$$ substiution control directive.  VWcms seemed to have a problem with executing the code snippet below correctly.  According to the manual this snippet should test for the pressence of the CGI variable TEST and succeed if it was not present, which it didn't seem to be doing.  So, out of interest as to how VWcms works I decided to have a go at investigating and fixing it myself.

$$IF$!cgi=WWW_FORM_TEST$$
    <some_html/>
$$ELSE$$
    <other_html/>
$$ENDIF$$

After some fiddling around I discovered that the value for the CGI variable TEST would default to an empty string.  So, even when the variable was not present in the URL it would always appear as if it had, just without a value.  I corrected this and it is now possible to test for the presence of a CGI variable as decribed by the documentation.

While fiddling around in this code I decided that it might be a good idea to add support for some other operators to the "cgi=" parameter.  In the official release it is only possible to specify "=" which actually performs a substring match rather than a test for equality.  For example, the following piece of code will match when INDEX is both "1" and "11".

$$IF$cgi=WWW_FORM_INDEX=11$$
    <matched/>
$$ENDIF$$

I have altered this behaviour for my patch.  Although I have not noticed any erratic results there may be something lurking in the depths and your mileage may vary.  However, it is now possible to compare the CGI variable value with a static string using the following operators:

Operator Description Syntax
= Equality $$IF$cgi=WWW_FORM_INDEX=10$$
== Symonym for "=" $$IF$cgi=WWW_FORM_INDEX==10$$
<> Inequality $$IF$cgi=WWW_FORM_INDEX<>10$$
< Less than $$IF$cgi=WWW_FORM_INDEX<9$$
> Greater than $$IF$cgi=WWW_FORM_INDEX>11$$
<= Less than or equal to $$IF$cgi=WWW_FORM_INDEX<=9$$
>= Greater than or equal to $$IF$cgi=WWW_FORM_INDEX>=11$$
<=> Substring match.  This is the original functionality of the "=" operator. It locates the specified substring in the CGI variable's value. $$IF$cgi=WWW_FORM_INDEX<=>11$$

*All comparisons are case insensitive.

Lastly, on Mark's suggestion I also applied a call to CgiLibHtmlDeEntify() to the code that matches the login= and rss= tests also.  This call ensures that all "entified" text (i.e. &lt; and others) is converted to regular text.

Patch

I have constructed a patch based on the V0.94 release of VWcms.

  • VWcms software patch DIF

This patch was created using the DCL command DIFFERENCES/SLP.  Use the following command to apply it:

$ EDIT/SUM HT_ROOT:[SRC.VWCMS]TEMPLATE.C/UPDATE=ddcu:[dir]TEMPLATE.DIF

[PRINT]  [PRINT]