Software Development Documentation Development Overview WCTL Template Language WCTL Commands WCJS Server-side JavaScript WCMS Development Chat Development Standard Templates & URL Codes Operator Documentation

Visit the

  • Developer Center,
  • WebX Harbor, and the
  • Web Crossing Conference
    to find a wealth of WebX info and a community of WebX experts on the Web!
  • Web Crossing Customization Management Suite (WCMS) Developer Documentation

    Table of Contents

    API for Developers (WCMS Projects) Creating Your First Project - Step by Step

    » API for Developers (WCMS Projects)

    This document will assume you are familiar with the terms and procedures outlined in the Sysop Documentation for WCMS, so please read it first if you haven't done so yet.

    Web Crossing's goal in creating the Web Crossing Customization Management Suite (WCMS) is to make it easy for non-technical Web Crossing administrators to customize their sites and add new features. From the sysop perspective, WCMS is a set of menus and forms which allow them to add new features or change the look and feel of their site at the click of a button. Besides look and feel customization, new kinds of predefined objects can be added to the site automatically, appearing in the user interface without any additional scripting.

    At the developer level, WCMS is an API which allows developer projects to "plug in" to the Web Crossing user interface automatically, without scripting on the part of the end-user/sysop. Web forms are used for any configuration or setup that is necessary. As a shortcut, these macro sets will be referred to as "projects" in this document.

    A project consists of a group of files and images which make use of the WCMS API to provide the sysop of a site with an additional option for a Theme, Component, Extension, Folder Item or User Item. Installing and configuring macros and files is automated in most cases.

    The WCMS API allows you to easily create or adapt projects, along with the settings-edit pages necessary to provide sysop control over the variables you create. You can edit an existing Theme or WCMS project or create your own from scratch. You can create a new button set or use an existing one, and include any number of custom images. Projects' file names, file structure, macro construction, etc. must conform to the API in order to work.

    Types of Projects
    You can create any one of 5 different types of projects:

    The list of files required for each given type of project is covered in more detail below.

    To help you get started, we've created a number of working developer demo projects which you can study and use as starting points for your own development or adaptations. Look for the files (they're not encrypted) in the Documentation and Developer Support folder on the Plugins Server.

    » Project Names

    Please register your project at http://webxedu.com/registerproject to ensure that your project name is unique.

    » WCMS Inheritance and path$xxxxx variables

    WCTL path variables are set as path.xxxxx in various locations, and are accessed using path$xxxxx. path$xxxxx returns path.xxxxx if it exists, and if not, it returns path.xxxxx for the closest parent location. Referencing path$xxxxx also sets pathHierLocation to the location from which the variable is inherited. Thus, parameters can be inherited by child locations, and the parent from which the inheritance is taking place can be identified. In Javascript, location.nodeHier( parameter ) works similarly to return inherited properties which return string values (but doesn't work for objects).

    A set of automated form processors in webxWcms-admin.tpl set whatever variables are fed to the forms from the various edit macros for Themes or projects, allowing you to easily develop editable variables for use in your macros without worrying about processing macros.

    The processor will set a path.xxxxx for any variable which comes to it in a form field. So by simply setting up your Edit page correctly, the built-in form processor will write an Edit Confirm page automatically, and the path variables will be set.

    Because of the way the automatic processor works, a variable can have one of three values:

    Thus, your display macros need to be able to deal with any of these three options. For example:
    
    %% set myValue path$inner_fl_myValue %%
    %% if myValue && myValue != "none" %%
    	%% myValue %%
    %% endif %%
    

    Note that a significant performance advantage is obtained by first setting the local variable "myValue" to the path$inner_fl_myValue variable. Subsequently the value of "myValue" is checked and displayed. This avoids the cost of looking up the hierarchical value of the path$inner_fl_myValue variable multiple times.

    » Naming Conventions, FileNames, and Variables

    Besides filenames, there are two types of variables that are important within the WCMS API with regard to naming conventions: sysop-settable path variables, and language string variables.

    Path variables

    Project typeVariable prefix
    Themeswrap_
    Component: top levelinner_tl_
    Component: folder listinner_fl_
    Component: message listinner_ml_
    Component: toolbarinner_tb_
    Extensioninner_
    Folder Iteminner_
    User Iteminner_

    A path variable which does not begin with either "wrap_" or "inner_" will not be exported when you create a Theme configuration ".set" file and thus is not importable or installable unless you specifically set it in an init function.

    Examples: path.wrap_leftSide, path.inner_fl_leftSide.

    For the most part, variables already exist within the Theme Manager system, so you if you're developing a new Theme, you won't need to create any new variables unless you have special Theme elements that require them.

    Language String Variables

    Localization within Web Crossing takes place by string substitutions from a global JavaScript object holding all the strings for a given project. Your project's language object name (the object holding the strings for your particular project) should be the same as your project. More specific information is below in the Localization section.

    The names of your language strings are less critical. You should name them something which makes the associated text easy to identify by looking at the string name, but the exact syntax and any naming conventions are up to you.

    Since localizability can be turned on and off, you shouldn't count on any strings from other projects (such as webxStd-Local.tpl) on being available. However, webxextn.tpl is always localizable, and always loaded, so those strings are always available for you to use if you want to avoid re-defining common terms such as "Cancel," "OK," etc.

    For more information on filename conventions, see Files Needed for A Project, below.

    » HTML and CSS

    HTML

    Web Crossing 5.0 has stylesheet-based HTML. Since our goal is to support as broad a browser base as possible for our customers, we have taken some steps to ensure that the user interface works acceptably-well for older browsers back through 4.0, and that options are available for sites supporting users with browsers older than that.

    We strongly encourage you to follow the WCMS conventions for HTML and CSS.

    Specifically, we have done the following:
    TechniqueRationale
    Surrounded all text inside table cells with <p> tags or span class="text" Older browsers, specifically Netscape 4, do not always deal with inheritance properly. This ensures that text inside table cells will be properly styled
    Close all tags with optional close tags, such as <p> and </p> and <li> and </li>, <a name="x"> and </a>, etc. Required by CSS
    All text should be inside a container of some kind, probably <p> tags. You can also apply a style to a <div> and use that.Work around Netscape 4 inheritance bugs.
    <p> tags shouldn't be used as line breaks, but as containers for text.Required by CSS
    Text following form fields Netscape 4 has a habit of dropping styles in text which appears after a form field. Thus, best practice is to surround this text with a specific
    <span class="text">text</span>
    tag (or div, or p, etc.) to ensure that styles are applied to this text properly.
    Quoted Attributes Reqired by XHTML. In most cases (but not all) we have quoted HTML attributes in template code, but the server code has not been updated yet this way.
    Lowercase HTML Required by XHTML. In most cases (but not all) we have lowercased all HTML in template code, but the server code may not have been updated yet.
    Font tags As much as is practical, get rid of font tags and use stylesheet indications for font face, color, and size. There are predefined classes for sizes 1 through 6 (size1, size2, etc.) which roughly approximate the old font size=NN values. (OK for span, div, p, etc.).

    CSS

    We have provided some basic CSS classes which are available for you to use, and you can create your own classes for your projects and include them in a custom stylesheet. The default Web Crossing (no themes) stylesheet macro is in webxextn.tpl (defaultStylesheet). The default stylesheet for Themes is also in webxextn.tpl (themeStylesheet). If no stylesheet variable is present, the contents of the file "default.css" in the /system directory are imported, saved, and used. We calculate the initial font size measurement using a site default with a user preference to change the site default in the user preferences area. Once a base font size is determined, everything else is calculated from that using ems or percentages. You can also install the Quick Set Fonts extension to allow registered users and guests to set their preference directly from your sidebars.

    Available classes are:
    ClassFunction
    .text Mirrors the body text size in case you need to invoke it specifically where it may not be inherited as it should be
    .size1 through .size6 These roughly correspond to the old <font size=N> tags
    .treeTitle For message titles
    .alert Bold red for warnings, errors, important status messages
    .red Red text, but not bold.
    .pathTitle Folder and discussion titles, as well as other titles appearing in the title position at the top of the page
    H3.subtitle For H3s used in a "subtitle" role
    .mlMsg Surrounds the message itself
    .fl Surrounds the folder listing
    .backpath Surrounds the backpath
    .preparedFor Surrounds the optional "prepared for..." statement at the top of the page.

    All textareas and text input tags have a sysop-definable monospaced font applied to them to attempt to get the fields to appear the same size in Internet Explorer and older Netscapes.

    There are some basic Web Crossing CSS conventions you should employ for consistency:
     SituationExample
    Page Titles For all "title" type headings at the top of the page, whether or not it truly Is the "pathTitle." Note that these are no longer indented with <ul>'s, but can be indented with stylesheet control if desired. <h1 class="pathTitle">Title of Page</h1>
    Subtitles For all H3's used as subtitles <h3 class="subtitle">Subsection</h3>
    Backpath For %% backpath %% and %% backpaththis %% <p class="backpath">%% backpath %%</p>
    Alert For warning or important alerts (also can use for span, div, p, H3, etc.) <span class="alert">Alert Text</span>
    Red For red text, not necessarily a warning (example: "subscribe by email" text in addMessage) (also can use for span, div, p, H3, etc.) <p class="treeTitle">Title</p>
    pathTreeTitle All pathTreeTitles (or places where pathTitle is used where the tree title should have been, were there one) (also can use for span, div, p, H3, etc.) <p class="treeTitle">Title</p>
    Same-page Anchors Anchors needs to be closed, but without text inside them, and with a class of "none." <a name="xxxx" class="none"></a>
    Message text Surround all cases where messages are displayed with class "mlMsg." This includes search results, moderation preview/edit pages, messageListItem, discussionTree, message center page, etc. <div class="mlMsg">... </div>

    For more information on replacing the stylesheet or adding to it see the Stylesheet section just below.

    » Colors

    We recommend that you reuse the predefined theme site and colors whenever possible so your project can drop into any theme and match. Most of these are defined for all themes.

    Color variables are set as path.varName and called as path$varName. These are the predefined variables you can use (the exact colors these represent will vary by Theme, but the names give you an idea). The indicator after the variable name represents its default use. You can use any of these you want elsewhere.

    path.wrap_Iconsregular icon directory
    path.wrap_Images regular button directory
    path.wrap_hotImagesrollover directory (not defined by default)
    path.wrap_clickImagesonmousedown directory (not defined by default)
    path.wrap_sectionHeadingColorfor section-heading background colors
    path.wrap_hostHeadingColorhost-only links or headings (see subscribe page for an example)
    path.wrap_BgColorbody tag page bg color
    path.wrap_TextColorbody tag text color
    path.wrap_LinkColorbody tag link color
    path.wrap_ALinkColorbody tag active link color
    path.wrap_VLinkColorbody tag visited link color
    path.wrap_HoverColorstylesheet hover color
    path.wrap_pathTitleColor"pathTitle" h1 title color
    path.wrap_h3SubtitleColorsubtitle h3 color
    path.wrap_bannerBackgroundtop cell background image
    path.wrap_bannerBgcolortop cell background color
    path.wrap_bannerFontColortop cell font color
    path.wrap_bannerLinkColortop cell link color
    path.wrap_bannerVLinkColortop cell vlink color
    path.wrap_bannerALinkColortop cell alink color
    path.wrap_bannerHoverColortop cell hover color
    path.wrap_contentBackgroundcontent cell background image
    path.wrap_contentBgcolorcontent cell background color
    path.wrap_navBackgroundnav cell background image
    path.wrap_navBgcolornav cell background color
    path.wrap_navFontColornav cell text color
    path.wrap_navLinkColornav cell link color
    path.wrap_navVLinkColornav cell vlink color
    path.wrap_navALinkColornav cell alink color
    path.wrap_navHoverColornav cell hover color
    path.wrap_specialEventsBackgroundmulti-purpose column background image
    path.wrap_specialEventsBgcolormulti-purpose column background color
    path.wrap_multiFontColormulti-purpose cell font color
    path.wrap_multiLinkColormulti-purpose cell link color
    path.wrap_multiVLinkColormulti-purpose cell vlink color
    path.wrap_multiALinkColormulti-purpose cell alink color
    path.wrap_multiHoverColormulti-purpose cell hover color
    path.wrap_footerBackgroundbottom cell background image
    path.wrap_footerBgcolorbottom cell background color
    path.wrap_footerFontColorbottom cell font color
    path.wrap_footerLinkColorbottom cell link color
    path.wrap_footerVLinkColorbottom cell vlink color
    path.wrap_footerALinkColorbottom cell alink color
    path.wrap_footerHoverColorbottom cell hover color
    path.wrap_footerBgcolorbottom cell background color
    path.inner_fl_darkerColorfolder listing darker color
    path.inner_fl_lighterColorfolder listing lighter color
    path.inner_fl_lightestColorfolder listing lightest color
    path.inner_fl_whiteColorfolder listing white equivalent
    path.inner_fl_fontColorfont color for table headings (folder listing)
    path.inner_ml_darkerColormessage listing darker color
    path.inner_ml_lighterColormessage listing lighter color
    path.inner_ml_lightestColormessage listing lightest color
    path.inner_ml_whiteColormessage listing white equivalent

    » Buttons and Rollovers

    Version 5.0 includes some new WCTL directives for returning entire image tags for buttons, icons and submit buttons. The advantage of using these new directives is that the server automatically retrieves and caches the image size directly from the image file. This means individual buttons can now be different sizes. See the WCTL documentation for "siteImagesImg" and other similar directives more information.

    Here's an example of a typical localized button call in 5.0:

    %% set id "cancel" %%%% use getAttr %%%% "cancel.gif".siteImagesImg( user.language, Â
    "lang( 'extn', 'btncancel' )".jsEval, "align=""middle"" border=""0"" hspace=""0""" & attr ) %%
    
    Macro getAttr is in webxextn.tpl. GetAttr uses the id variable and returns "attr," which contains rollover code, along with a small client-size Javascript function to create the rollovers.

    If a path$wrap_hotImages directory (e.g. "/Images/b29" is defined, those buttons will be used for onmouseover events. If, in addition, a path$wrap_clickImages is defined, those buttons will be used for onmousedown events.

    Without rollover and click directories defined, the HTML returned by the Cancel button call above is:

    <img src="/Images/b26/cancel.gif" width=68 height=30 alt="Cancel" border="0" hspace="0" name="cancel">
    
    With both rollover and click directories defined, the HTML is:
    <script language="javascript"><!--
    if ( document.images ) {
    cancel_hot = new Image;
    cancel_cold = new Image;
    cancel_click = new Image;
    cancel_click.src = "/Images/b20/cancel.gif";
    cancel_hot.src = "/Images/b27/cancel.gif";
    cancel_cold.src = "/Images/b26/cancel.gif";
    } else {
    cancel_click = "";
    cancel_hot = "";
    cancel_cold = "";
    document.cancel ="";
    }//-->
    </script>
    <img src="/Images/b26/cancel.gif" width=68 height=30 alt="Cancel" border="0" Â
    hspace="0" name="cancel" onmouseover='this.src=cancel_hot.src;' Â
    onmouseout='this.src=cancel_cold.src;' onmousedown='this.src=cancel_click.src;'>
    

    The "id" variable is used for the "name" attribute of the image tag, and is typically the filename of the button minus the extension, with a couple of exceptions:

    For WCJS, you can use the makeButton(), makeIcon() and makeSubmit() functions to simplify button creation. See the documentation for more details.

    » Date Formatting

    There are three predefined, sysop-settable date formats available for your projects. There is no GUI at present to set these, but they are found in the function init_colors() in webxextn.tpl, which can be overridden by copying it into webx.tpl and making changes.

    The defaults are:
    path$wrap_defaultLongDateFormat"Mmm D1, Y4 H2:I2 a"Jan 1, 2004 08:02 am
    path$wrap_defaultShortDateFormat"M1/D1/Y4 Y4 H2:I2 a"1/1/2004 08:02 am
    path$wrap_defaultMiniDateFormat"D2 Mmm Y4"01 Jan 2004

    A real-life coding example:

    
    %% set longDate path$wrap_defaultLongDateFormat %%
    %% if longDate && longDate != "none" %%
    	%% set date_format longDate %%
    %% else %%
    	%% set date_format "Mmm D1, Y4 H2:I2 a" %%
    %% endif %%
    %% pathModifiedDate( date_format ) %%
    

    » Accessibility Issues

    We strive to be US Government Section 508 Priority 1 compliant. Some simplified practical guidelines can be found on the W3C site.

    The two main Priority 1 tasks in Web Crossing are:

    All graphical elements, buttons, and submit input tags need alt tags., and all scripts and applets providing necessary functionality need an alternative accessible link or function.

    We also support some of the Priority 2 recommendations, in particular the <label> tag, which allows the form element to be associated with its text label in disability access browsers.

    The form field itself needs a unique ID, which is referenced in the label tag:

    <label for="username">User Name</label> <input type="text" name="username" value="" id="username">
    
    The ID field can be the same as the name, except in the case of radio buttons which all share the same name field. In that case what we've done in most cases is to append the value to the end of the name to make a unique label ID:
    <input type="radio" id="name_value1" value="value1" name="name">
    <label for="name_value1">Yes</label><br>
    <input type="radio" id="name_value2" value="value2" name="name">
    <label for="name_value2">No</label><br>
    <input type="radio" id="name_value3" value="value3" name="name">
    <label for="name_value3">Maybe</label><br>
    
    There are other Section 508 recommendations with regard to form layout, etc. which we would strongly recommend you take into consideration when building your forms.

    » Available Hooks outside WCMS

    Please also see the section on defining an init and creating your project object.

    Stylesheets and Projects

    The stylesheet macro is used to put a stylesheet link URL in the current page, and is called in the Theme document head field if Themes are on (and the stylesheet has not been disabled), or by superHeaderDefault, a macro which runs automatically from the head of the document if Themes are off. The stylesheet URL uses the themeStylesheet or defaultStylesheet macros to actually serve the style sheet for a page as a separate dynamically-created page. By serving dynamic stylesheets, we can easily customize the look of the site for different users or locations.

    In order to allow the browser to cache the various stylesheets that we serve, the stylesheet URLs are "standard" URLs without a user certificate, but including a stylesheet revision number to force stylesheet reloads if/when needed.

    A stylesheet usually is provided with a theme, but sometimes components or extensions need support for custom classes. So we've provided some stylesheet hooks for other projects to drop their styles into the stylesheet.

    This is how it works:

    Usually only a Theme would replace the stylesheet, but any of your projects can either replace the default or themeStylesheets or you can add your own custom style definitions at the bottom of either of them. If you have a need to replace macro stylesheet as well, that is also possible (although inadvisable unless you know exactly what you're doing and why.)

    To replace the stylesheet that is run when Themes are turned on, just replace the stylesheet in the Theme settings > Global settings > default stylesheet textarea. The value of this field is held in path$wrap_stylesheet.

    Here's an example of the theme stylesheet as it appears in the browser, after variable substitutions, and not including any additional classes provided by plugins:

    /* basic WebX CSS */
    a.none {background:transparent} /* for anchor links only */
    a:link {font-weight: bold; text-decoration:none;}
    a:visited{font-weight: bold; text-decoration:none; }
    a:active {font-weight: bold; text-decoration:underline; }
    a:hover {font-weight: bold; text-decoration:underline; }
    small {font-size:.9em}
    big {font-size: 1.1em}
    address, b, big, blink, blockquote, body, center, cite, dir, Â
    dl, div, em, h1, h2, h3, h4, h5, h6, i, legend, listing, menu, Â
    object, ol, p, s, server, small, span, strike, strong, sub, sup, Â
    table, td, th, u, ul, li, var, xmp { font-family: Arial;}
    body,p,ul,li,td {font-size:12px; }
    .2 {font-size:10px; }
    .text {font-size:12px;font-family:Arial;}
    code, kbd, pre, samp, tt,form,input,textarea {font-family: Courier, Â
    "Courier New", Monaco, monospace;font-size:12px; }
    h1 { font-size: 26px; }
    h2 { font-size: 21px; }
    h3 { font-size: 18px; }
    h4 { font-size: 15px; }
    .size1 { font-size:9px; }
    .size2 { font-size:10px; }
    .size3 { font-size:12px; }
    .size4 { font-size:17px; }
    .size5 { font-size:20px; }
    .size6 { font-size:24px; }
    .text { font-size:12px; }
    h3.subtitle{ font-style:italic; color:#666666; }
    .treeTitle { font-weight: bold; }
    .pathTitle { font-size:28px; color: #444444; } 
    .backpath {font-size:12px; font-weight:bold; }
    .mlMsg { font-size:12px; }
    div.mlMsg blockquote { font-style:italic; } 
    .nonbold { font-size: .9em; }
    .red { color: red; }
    .alert { color: red; font-weight: bold; }
    .preparedFor { background: white; }
    
    To add to the stylesheet rather than replace it, create a style Javascript command or function containing your project name (so it has a unique name) and add it to your project object definition. It will then be added to the bottom of the existing stylesheet along with any other projects' additional style definitions. In this case, all you need to do is concatenate your definitions onto the existing WCTL variable "body" which is building the stylesheet body. Probably the simplest solution is to call a WCTL macro from your JS style macro. The WCTL macro will retrieve the stylesheet variable and display it if it exists and if not, set it to your designated string.

    For real-life examples of how to do this, see macro demoFdrItemStyleJS in wx_demoFdrItem.auto.

    %% command myProjectStylesJS() { 
    	wctlEval( 'use myProjectStyles' );
    } %%
    
    %% macro myProjectStyles %%
    	%% set myStyles path$inner_myProject_stylesheet %%
    	%% if myStyles && myStyles != "none" %%
    		%% set body body & myStyles.fromSgml.evalTemplate & crlf & crlf   %%
    	%% else %%
    		%% set f "/* My Project Styles */" & crlf &
    		".myProject{ color: %" & "% color %" & "%; font-family: Courier; font-size: 18px; }" %%
    		%% set body body & f.evalTemplate & crlf & crlf  %%
    		%% set curLoc location %%
    		%% set x path$inner_myProject_stylesheet %%
    		%% setPath( pathHierLocation ) // find the location where the stylesheet is defined %%
    		%% set path.inner_myProject_stylesheet f %%
    		%% setPath( curLoc ) %%
    	%% endif %%
    %% endmacro %%
    

    Preferences

    If your project needs access to the user preferences page, you can create a Javascript command or function which will be plugged into the editPreferences/editedPreferences macros. You can use the editPreferences page to display your form (keeping in mind that it needs to fit into an existing two-column table structure) and the editedPreferences page to process your form fields and display the results (again, keeping in mind that it has to fit into an existing two-column table).

    Create your preferences form and processor and name them whatever you want - but do use the name of your proejct in the preferences command/function name to ensure the function name is unique. Then and add the name of your function to the proper location in the object definition in your init file. Example:

    For editPreferences:

    %% function demoFIEditPrefs() {
    	var text='';
    	text += '<tr><td colspan="2"><p><b>Your Demo Folder Item Color Preference</b></p></td></tr>';
    	text += '<tr><td colspan="2"><p><input type="radio" value="red" name="demoFIColor"';
    	if ( user.demoFIColor == "red" ) text += " selected";
    	text += '> Red<br><input type="radio" value="blue" name="demoFIColor"';
    	if ( user.demoFIColor == "blue" ) text += " selected";
    	text += '> Blue</p></td></tr>';
    	return text;
    } %%
    
    For editedPreferences:
    %% function demoFIEditedPrefs() {
    	var retval='';
    	if ( form.demoFIColor ) user.demoFIColor = form.demoFIColor;
    	retval += '<tr><td><p><b>Your Demo Folder Item Color Preferences</b></p></td><td><p>';
    	if ( user.demoFIColor == "red" ) retval += "Red";
    	else retval += "Blue";
    	reval += '</p></td></tr>';
    	return retval;
    } %%
    
    The values set here are used in the demo folder item when the user clicks the "Add Demo Folder Item" button.

    Control Panel Links

    If your project needs to provide one or more control panel links, you can do that in a similar way. Create your link, and add the name of your link function to the proper location in the object definition in your init file. As an example of this, see this example function demoExtControlPanelLink from the wx_demoExt.auto.

    %% command demoExtControlPanelLink() {
    	return '<br><br><a href="' + makeUrl( 'demoExtControlPanel' ) + '">Demo Extension Link</a>';
    } %%
    

    Theme Cells: top cell, nav cell, multi-purpose cell, bottom cell, content cell pre and post

    You can have your project add links to, or call macros for, the various Theme cells. The Weblog sidebar macro and LiveX are examples of this. Your project can actually enable the functionality to appear in the desired cell, or it can merely place itself as an option in the menus for the area, for the sysop to select if the default positioning isn't what they want .

    It takes two steps to do this:

    This allows the project to place itself somewhere by default, but allows the sysop to choose a final location if the default location isn't best for their site. For example, LiveX enables itself by default in the top Theme cell, but can alternatively be turned off in the top cell and placed instead in the nav or multi-purpose cells, or even in the bottom cell.

    For an example of a macro which merely places a link on the page, see macro demoUserItemLink in wx_demoUserItem.auto, and for an example of a macro which places an entire block of HTML in the right or nav columns, see macro sidebar in wx_blog.auto. If you are placing a link to a user item or a folder item, you need to have your macro check to see if it should return anything or not, based on the location, the user, and the enabled status of the project. You can use the JS functions checkUIStatus( projectName ) and checkFIStatus( projectName ) to check to see if the user should have access to the function. checkUIStatus returns true or false for WCJS, and also sets the WCTL variable "toShow" to "yes" if true. checkFIStatus does this as well, and in addition sets the WCTL variable "toShow" to "guest" if the user is unknown.

    » Filter Issues

    Up until 5.0, it was difficult to get filters from different projects to co-exist. If your project needs to run a processing filter, you need to either make sure it's enclosed within a folder envelope macro, or use one of the new filter techniques available in 5.0 for running multiple filters per action. See the build notes for details. This is especially useful when creating new instances of folder items with the addFolder macro. You can call a special folderAddFilterPost macro, via a hidden form field in the addFolder macro, to set various folder properties as the folder is created. See the blog, brainstorm, and rate auction projects for examples.

    If you have a filter enclosed in a folder macro, you probably will want to also make the filter from the parent level available (in case it's something like reporting, which need to always run.) You can do this by adding a line like this at the end of a section your filter which doesn't interrupt processing:

    %% useParent messageAddFilterPost %%
    If your special filter needs to always run, or doesn't live inside a folder envelope, (again, reporting is an example), you can register it using the new 5.0 WCTL commands:

    %%  "authenticateFilter".filterRegister("authenticateFilter_myFilter" ) %%

    This would run the extra authenticate filter "macro authenticateFilter_myFilter" after the normal one.

    » Initing Your Project

    Each project needs an init function which inits the project object and makes it available to the WCMS API. The init consists of an object definition function followed by several methods which set various required parameters, and finally, some code to add your project's functions to the Theme cells, if necessary.

    Here's an example init for a user item, annotated: (the  indicates that there should be no hard line break in this location, but it is broken for display purposes here). More details about the various methods and arguments are below in the table.

     1 %% function init_demoUserItem() {
     2         if ( !libraryGlobal.userItemPalette ) libraryGlobal.userItemPalette = new Object();
     3         var ui = libraryGlobal.userItemPalette;
     4
     5         // replace demoUserItem 3 x with your project name in the next 2 lines
     6       if ( topLevelFolder.userItemPaletteBkp && topLevelFolder.userItemPaletteBkp.demoUserItem Â
     7         && topLevelFolder.userItemPaletteBkp.demoUserItem.plugIsEnabled ) {
     8            var isEnabled = topLevelFolder.userItemPaletteBkp.demoUserItem.plugIsEnabled;
     9         } else var isEnabled = 0;
    10
    11      // your project name
    12      if ( !ui.demoUserItem ) {
    13
    14         /* use isEnabled (variable set just above), default enabled?, toolbar enabled?, 
    15            url to open userItem, string for text toolbar, string for button alt tag,
    16            open button filename
    17            all required (replace this with the right constructor for your project type!) */
    18          ui.demoUserItem = new ShortUserItem( isEnabled, 1, 1, "demoUserItemPage", Â
    19            "openButtonAlt", "demoUserItem.gif" );
    20                    
    21         /* version, date
    22            both required */
    23         ui.demoUserItem.plugSetVersion( "1.0", "11/14/02" );
    24
    25         /* directory in WCMS, small screenshot filename, W in pixels, H in pixels,
    26             large screenshot filename, W, H, full support URL, ReadMe file name
    27            all required */
    28         ui.demoUserItem.plugSetWcmsFiles( "demo", "demo.gif", 164, 109, "demoL.gif",Â
    29            600, 400, "http://support.webcrossing.com", "readme.html" );
    30
    31         /* auto file name, (template file name), (envelope file name)
    32            auto file name required (for some other projects, need all three arguments) */
    33         ui.demoUserItem.plugSetTplFiles( "wx_demoUserItem.auto" );
    34
    35         /* strings object name, strings file name, string for "Friendly" name for UI,
    36            string for short description for "choose" page
    37            all are required */
    38         ui.demoUserItem.plugSetStringProps( "demoUserItem", "wx_demoUserItem_s_en_US.auto", Â
    39            "projName", "shortDescr" );
    40
    41         /* 1 if extension has editable parameters and 0 if not, name of edit WCTL macro,
    42            string name for explanatory text on edit page
    43            all required */
    44         ui.demoUserItem.plugSetEditables( 0, "editDemoUserItem", "explanText" );
    45
    46         /* JS macro for prefs page, JS macro for edited prefs, JS macro to add to stylesheet,
    47            JS macro to add to Control Panel Services, JS macro to add to Control Panel Customizing,
    48            JS macro to add to Control Panel User, JS macro to add to Control Panel Site
    49            all optional but if present must be in .auto file */
    50         ui.demoUserItem.plugSetInterfaceHooks( demoUserItemEditPrefs, demoUserItemEditedPrefs,Â
    51             demoUserItemStyleJS, "", "", "", "" );
    52
    53         /* WCTL macro to be inserted in theme top cell, 1 if enabled by default
    54            and 0 if merely in menu, WCTL macro for bottom theme cell, enabled or not,
    55            WCTL macro for nav theme cell, enabled or not, WCTL macro for multi-purpose theme cell,
    56            enabled or not, , WCTL macro for content theme cell pre, enabled or not, WCTL macro
    57            for content theme cell post, enabled or not
    58            all optional */
    59         ui.demoUserItem.plugSetThemeHooks( "", "", "", "", "demoUserItemLink", 1, "", "", Â
    60            "", "" );
    61
    62         /* Flag to determine if the user can turn this off or not in their personal preferences;
    63            1 if it should be shown as an option in prefs, 0 if not */
    64         ui.demoUserItem.plugSetUserPrefsEditability( 1 );
    65			
    66         /* This provides an avenue for an extra level of access checks if
    67		you need to check user group membership, etc. for access to buttons and user
    68		item "add" screens.
    69		Return 0 to prevent access to the button; return 1 to enable it. */
    70         ui.demoUserItem.plugCheckButtonAccess = sayNodemoUserItem;
    71
    72         /* If present, this replaces the entire <a href tag in the toolbar link.
    73		return the complete <a href tag */
    74         ui.demoUserItem.plugToolbarLink = toolbarLinkdemoUserItem;
    75
    76         /* If present, this provides extra text or code which is placed
    77		in the toolbar before the button
    78		return the code you want placed in the toolbar */
    79         ui.demoUserItem.plugButtonBeforeText = buttonBeforedemoUserItem;
    80	}
    81         /* for macros in other areas of the Theme wrapper
    82         var demoUserItemArray;
    83         demoUserItemArray = [ "demoUserItem", "userItem", "" ];
    84
    85         /* need one of these to correspond with each of the cells defined in plugSetThemeHooks, above
    86         comment out the pairs of lines you don't need */
    87	   //if ( !libraryGlobal.optionalItemsPalette.banner ) Â
    89            libraryGlobal.optionalItemsPalette.banner = new Object();
    90	   //libraryGlobal.optionalItemsPalette.banner.demoUserItem = demoUserItemArray;
    91	   //if ( !libraryGlobal.optionalItemsPalette.footer ) Â
    92            libraryGlobal.optionalItemsPalette.footer = new Object();
    93	   //libraryGlobal.optionalItemsPalette.footer.demoUserItem = demoUserItemArray;
    94	   if ( !libraryGlobal.optionalItemsPalette.nav ) Â
    95            libraryGlobal.optionalItemsPalette.nav = new Object();
    96	   libraryGlobal.optionalItemsPalette.nav.demoUserItem = demoUserItemArray;
    97	   //if ( !libraryGlobal.optionalItemsPalette.right ) Â
    98            libraryGlobal.optionalItemsPalette.right = new Object();
    99	   //libraryGlobal.optionalItemsPalette.right.demoUserItem = demoUserItemArray;
    100	   //if ( !libraryGlobal.optionalItemsPalette.contentpre )  Â
    101            libraryGlobal.optionalItemsPalette.contentpre = new Object();
    102	   //libraryGlobal.optionalItemsPalette.contentpre.demoUserItem = demoUserItemArray;
    103	   //if ( !libraryGlobal.optionalItemsPalette.contentpost  Â
    104            libraryGlobal.optionalItemsPalette.contentpost = new Object();
    105	   //libraryGlobal.optionalItemsPalette.contentpost.demoUserItem = demoUserItemArray;
    106
    107 } %%
    
    Line 1: The naming convention here is "init_" plus name-of-project.
    Lines 2 & 3: First, we init the userItemPalette, in case this is the first user item inited.
    Lines 6-9: Copy the "is enabled" property from the backup copy stored in the database so it can be maintained between cache resets and server restarts. (Necessary for folder items and user items only.)
    Lines 18-19: Init the demoUserItem object. See below for documentation on the object definition parameters needed.
    Line 23: Version and date for project.
    Lines 28-29:Init the directory name in /plugins, and the files that live there.
    Line 33: The auto file is required for all projects. The other two files are optional for some projects.
    Lines 38-39: Init the language string object and file, and the strings needed for display on the "Choose a..." page. For more details, see the Localization section.
    Line 44: Set whether your project has any editable properties, and set edit macro name and string file names (all required whether or not your project has any editable parameters).
    Line 50-51: This method is optional if your project doesn't need to add HTML to any of the stylesheet, the user preferences page, or the control panel.
    Line 59-60: This method is optional if your project doesn't need to add any HTML to any of the theme cells.
    Line 64: Determines whether the user can turn off this user item in their personal preferences or not.
    Line 70: Optional extra level of access checks for display of the buttons and the "add" screens.
    Line 74: Optionally replace the entire toolbar button link if necessary.
    Line 79: Optional extra code which is inserted before the toolbar button.
    Line 82-83: Set up a temporary array so we can add items to the Theme popup Optional Items menus. Everything from here to the end if optional if you don't need to use plugSetThemeHooks. For components there is a third parameter, the component type (topLevel, messageList, folderList, or toolbar).
    Lines 94-96: Init the optionalItemsPalette.nav if necessary. Then add the temporary array as an object.
    Lines 87-105: Repeat for any other Theme cell menus the project needs to appear in. (Whether or not it's enabled in that location). The simplest thing is just to comment out the lines you don't need.

    For a Theme, when the .set file is imported, if the navigation column is turned on, and the Login/Logout settings are turned on, the default "You have guest access..." (preparedFor) text is turned off. If you need to re-enable it for some reason, you can use:

    %% userGuests.setUserShowPrepared( 1 ) %%
    

    WCMS Constructor/Method Documentation

    These tables show the required and optional fields, and the form in which they need to be, to init a project. These values are also retrievable by using one of the following, as appropriate.

    libraryGlobal.themePalette.projectName.parameterOrMethod
    libraryGlobal.componentPalette.topLevel.projectName.parameterOrMethod
    libraryGlobal.componentPalette.folderList.projectName.parameterOrMethod
    libraryGlobal.componentPalette.messageList.projectName.parameterOrMethod
    libraryGlobal.componentPalette.toolbar.projectName.parameterOrMethod
    libraryGlobal.extensionPalette.projectName.parameterOrMethod
    libraryGlobal.folderItemPalette.projectName.parameterOrMethod
    libraryGlobal.userItemPalette.projectName.parameterOrMethod

    At minimum, you need to define your object using the constructor for your project type, and then use all the required methods in the Init Methods section.

    Constructors: Themes | Components | Extensions | Folder Items | User Items
    Init Methods: Version | WCMS Files | Template Files | Language Strings | Editability | User Interface Hooks | Theme Hooks
    Other methods for all projects
    Other useful functions for all projects

    At minimum, you need to define your object using the constructor for your project type, and then use all the required methods in the following section.

    THEME CONSTRUCTOR -- new ShortTheme ( 1, 2 ) Required for Themes.

      

    (plugType)

    Automatically added - do NOT include in your object definition

    1

    required

    plugThemeColors

    An array of Theme color options for the UI. (e.g. [ "demoThemeColor1", "demoThemeColor2" ]

    2

    required

    plugThemeColorFiles

    An array of Theme color files, corresponding to the themeColors just above. These filename conventions are not required, but are strongly recommended to avoid conflicts with other projects. (e.g. [ "wx_demoTheme_0.set", "wx_demoTheme_1.set" ] )



    COMPONENT CONSTRUCTOR -- new ShortComponent ( 1 ) Required for Components.

      

    (plugType)

    Automatically added - do NOT include in your object definition

    1

    required

    plugComponentType

    Should be "toolbar", "messageList", "folderList", or "topLevel".



    EXTENSION CONSTRUCTOR -- new ShortExtension ( 1 ) Required for extensions.

      

    (plugType)

    Automatically added - do NOT include in your object definition

    1

    optional

    plugTopLevelEnableOnly

    Set to 1 if the extension can only be turned on and off at the top level. Leave blank otherwise.



    FOLDER ITEM CONSTRUCTOR -- new ShortFolderItem ( 1, 2, 3, 4, 5, 6, 7, 8 ) Required for Folder Items.

      

    (plugType)

    Automatically added - do NOT include in your object definition

    1

    required

    plugIsEnabled

    Always use isEnabled (no quotes). This will be retrieved at startup/reset from a backup stored variable.

    2

    required

    plugAddMacro

    Name, in quotes, of the WCTL macro or WCJS command returning the Add Folder Item screen. (e.g. "adddemoFdrItem")

    3

    required

    plugIcon

    Filename of the icon to display in folder listings (e.g. "demoIcon.gif")

    4

    required

    plugAddTextString

    Lang() string to produce a text string for the text toolbar's row of "Add:" links. This differs from the addButtonString in that addButtonString includes the word "Add" in the returned text from lang(). (e.g. "addText")

    5

    required

    plugAddButtonString

    Lang() string to produce an alt text string for toolbar buttons. This differs from the addTextString in that addTextString does not include the word "Add" in the returned text from lang(). (e.g. "addTextAlt")

    6

    required

    plugAddButtonFileName

    Filename of the "add xxx" button to display in button toolbars. A copy of this button should be created for all button directories or instructions given to the sysop to use a non-button toolbar.

    7

    optional

    plugAccessInfo

    The text string which returns information about which users are allowed to add the item if it is enabled at the folder level (as opposed to enabling at the site level for hosts/sysop)

    8

    optional

    plugFolderListItem

    Not used at present - use "".



    USER ITEM CONSTRUCTOR -- new ShortUserItem ( 1, 2, 3, 4, 5, 6, 7 ) Required for User Items.

      

    (plugType)

    Automatically added - do NOT include in your object definition

    1

    required

    plugIsEnabled

    Always use isEnabled (no quotes). This will be retrieved at startup/reset from a backup stored variable.

    2

    required

    plugDefaultEnabled

    1 if the UserItem defaults to being enabled for all users, (once it is enabled for the site) 0 if the user has to explicitly turn on the UserItem for their own use to enable it.

    3

    required

    plugToolbarEnabled

    1 if the user item contributes a button to the toolbar, 0 if not

    4

    optional

    plugOpenUrl

    WCTL macro or JS command name, in quotes, which should run when the toolbar button or link is clicked. Required if plugToolbarEnabled is 1. (e.g. "openUserItem")

    Note that the following three parameters allow you use a different user item toolbar button/link for different states - e.g. user has email or not, etc.

    5

    optional

    plugGetUserItemOpenText( user, location )

    Function name to return the proper lang() string to display text toolbar or select menu string for this user item. Required if plugToolbarEnabled is 1. (e.g. getDemoUserItemOpenString (no quotes)). This function MUST be defined as a method in the user item init, and the function must exist in the auto file. See the wx_demoUserItem.auto file for an example.

    6

    optional

    plugGetUserItemButtonAlt( user, location )

    Function name to return the lang() string to display the right user item toolbar button alt string for this user item. Required if plugToolbarEnabled is 1. (e.g. getDemoUserItemButtonAlt (no quotes)). This function MUST be defined as a method in the user item init, and the function must exist in the auto file. See the wx_demoUserItem.auto file for an example.

    7

    optional

    plugGetUserItemButtonFilename( user, location )

    Function name to return the right user item toolbar button this user item. Required if plugToolbarEnabled is 1. (e.g. getUserItemButtonFilename (no quotes)). This function MUST be defined as a method in the user item init, and the function must exist in the auto file. See the wx_demoUserItem.auto file for an example.

    WCMS Init Methods

    The following methods are also used to init your project:

    VERSION -- projObject.plugSetVersion ( 1, 2 ) Method is required.

    #proj typerequired?param name setdescription

    1

    all

    required

    plugVersion

    Version number. (e.g. "1.1")

    2

    all

    required

    plugDate

    Version date. (e.g. "9/17/02" This date is not used internally so you can format it however you wish.)



    WCMS FILES -- projObject.plugSetWcmsFiles ( 1, 2, 3, 4, 5, 6, 7, 8, 9 ) Method is required.

    #proj typerequired?param name setdescription

    1

    all

    required

    plugFileName

    Name of directory in /plugins holding image, readme, etc. files (e.g. "demo")

    2

    all

    required

    plugSmallScreenShotLoc

    Filename of small screenshot. File must be inside /plugins directory in fileName, above. (e.g. "screenshot.gif")

    3

    all

    required

    plugSmallScreenShotWidth

    Width, in pixels, of small screenshot (should be 164 if at all possible)

    4

    all

    required

    plugSmallScreenShotHeight

    Height, in pixels, of small screenshot

    5

    all

    required

    plugBigScreenShotLoc

    Filename of life-sized screenshot. File must be inside /plugins directory in fileName, above. (e.g. "screenshotL.gif")

    6

    all

    required

    plugBigScreenShotWidth

    Width, in pixels, of large screenshot

    7

    all

    required

    plugBigScreenShotHeight

    Height, in pixels, of large screenshot

    8

    all

    required

    plugSupportInfo

    URL for support for this project (e.g. "http://support.webcrossing.com")

    9

    all

    required

    plugReadMe

    Filename of read-me HTML file. File must be inside /plugins directory in fileName, above. (e.g. "readMe.html")



    TEMPLATE FILES -- projObject.plugSetTplFiles ( 1, 2, 3 ) Method is required.

    #proj typerequired?param name setdescription

    1

    all

    required

    plugAutoFile

    Name of the ".auto" file associated with this Theme. This naming convention is not required, but is strongly recommended to avoid conflicts with other projects. (e.g. "wx_demoTheme.auto")

    2

    not used for folder items or user items

    depends

    plugTemplateFile

    Name of template file holding any Project macros. This file should contain the bulk of the macro load. This naming convention is not required, but is strongly recommended to avoid conflicts with other projects.(e.g. "wx_demoProj.tpl" )

    Required for components and extensions. Required for themes only if you have special features above and beyond the usual theme settings, which need to show up only in the locations where the theme is enabled.

    3

    not used for folder items or user items

    depends

    plugEnvelopeFile

    Name of the file which goes inside a folder macro if this Theme is used other than at the top level. This file should be as light in K as possible, only referencing the macros in the tplFile. This naming convention is not required, but is strongly recommended to avoid conflicts with other projects.(e.g. "wx_demoProj_type.tpl")

    Required for components. Required for themes and extensions only if you have extension settings or special theme features above and beyond the usual theme settings, which need to show up only in the locations where the project is enabled.



    LANGUAGE STRINGS -- projObject.plugSetStringProps ( 1, 2, 3, 4 ) Method is required.

    #proj typerequired?param name setdescription

    1

    all

    required

    plugStringsObj

    Name of the strings object holding language strings associated with this project. (e.g. "demoTheme")

    2

    all

    required

    plugStringsFile

    Name of strings file associated with this project. This naming convention is not required, but is strongly recommended to avoid conflicts with other projects. (e.g. "wx_demoProj_s_en_US.auto")

    3

    all

    required

    plugDisplayNameString

    Lang() string to display name of Theme for UI (e.g. "projName")

    4

    all

    required

    plugShortDescriptionString

    Lang() string to display short description for the "Choose a ..." page. (e.g. "shortDescr")



    EDITABILITY -- projObject.plugSetEditables ( 1, 2, 3 ) Method is required.

    #proj typerequired?param name setdescription

    1

    all

    required

    plugIsEditable

    1 if this project has any editable paramters, 0 if not. (For Themes, if it has any special editable properties above and beyond the usual Theme settings.)

    2

    all

    required for all but Themes

    plugEditHtml

    Name of the WCJS command holding the initial edit macro to set up the edit variables. This command name should be in quotes. (e.g. "editDemoTheme") This is required for non-theme projects even if you have no editable parameters. Required for Themes if plugIsEditable == 1.

    3

    all

    required for all but Themes

    plugEditExplanatoryTextString

    Lang() string which provides a short paragraph of explanatory text for the edit page. (e.g. "explanText") This is required for non-theme projects even if you have no editable parameters. Required for Themes if plugIsEditable == 1.



    USER INTERFACE HOOKS -- projObject.plugSetInterfaceHooks ( 1, 2, 3, 4, 5, 6, 7, 8, 9 ) Method is optional.

    #proj typerequired?param name setdescription

    1

    all

    optional

    plugEditPrefs

    Name of the WCJS function or command which returns a portion of HTML to go on the user preferences page, in the "misc" section. This command or function must be in the .auto file, and it must not be quoted. (e.g. demoEditPrefs)

    2

    all

    optional

    plugEditedPrefs

    Name of the WCJS function or command which returns a portion of HTML (and does processing of the HTML from editPrefs) to go on the user edited preferences page, in the "misc" section. This command or function must be in the .auto file, and it must not be quoted. (e.g. demoEditedPrefs)

    3

    all

    optional

    plugStyles

    Name of the WCJS function or command which returns a portion CSS code to be included at the end of the stylesheet. This command or function must be in the .auto file, and it must not be quoted. (e.g. demoStyles)

    4

    all

    optional

    plugControlPanelServices

    Name of the WCJS function or command which returns a portion HTML (usually a link) to be included in the control panel "services" section. This command or function must be in the .auto file, and it must not be quoted. (e.g. demoControlPanelLink)

    5

    all

    optional

    plugControlPanelCustomizing

    Name of the WCJS function or command which returns a portion HTML (usually a link) to be included in the control panel "customizing" section. This command or function must be in the .auto file, and it must not be quoted. (e.g. demoControlPanelLink)

    6

    all

    optional

    plugControlPanelUser

    Name of the WCJS function or command which returns a portion HTML (usually a link) to be included in the control panel "user" section. This command or function must be in the .auto file, and it must not be quoted. (e.g. demoControlPanelLink)

    7

    all

    optional

    plugControlPanelSite

    Name of the WCJS function or command which returns a portion HTML (usually a link) to be included in the control panel "site" section. This command or function must be in the .auto file, and it must not be quoted. (e.g. demoControlPanelLink)

    8

    all

    optional

    plugEditSysopPrefs

    Name of the WCJS function or command which returns a portion of HTML to go on the user preferences page, in the sysop-only section. This command or function must be in the .auto file, and it must not be quoted. (e.g. demoEditSysopPrefs)

    9

    all

    optional

    plugEditedSysopPrefs

    Name of the WCJS function or command which returns a portion of HTML (and does processing of the HTML from editPrefs) to go on the user edited preferences page, in the sysop-only section. This command or function must be in the .auto file, and it must not be quoted. (e.g. demoEditedSysopPrefs)



    THEME HOOKS -- projObject.plugSetThemeHooks ( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ) Method is optional.

    #proj typerequired?param name setdescription

    1

    all

    optional

    plugBannerHtml

    Name of a WCTL macro or WCJS command-without-parameters (in quotes), which is run when a project adds something to the Theme top cell. (e.g. "demoThemeBanner")

    2

    all

    optional

    plugBannerHtmlIsEnabled

    1 if the bannerHTML is automatically selected, 0 if it appears in the menu only, "" if it is ignored.

    3

    all

    optional

    plugFooterHtml

    Name of a WCTL macro or WCJS command-without-parameters (in quotes), which is run when a project adds something to the Theme bottom cell. (e.g. "demoThemeFooter")

    4

    all

    optional

    plugFooterHtmlIsEnabled

    1 if the footerHTML is automatically selected, 0 if it appears in the menu only, "" if it is ignored.

    5

    all

    optional

    plugNavHtml

    Name of a WCTL macro or WCJS command-without-parameters (in quotes), which is run when a project adds something to the Theme nav. (e.g. "demoThemeNav")

    6

    all

    optional

    plugNavHtmlIsEnabled

    1 if the navHTML is automatically selected, 0 if it appears in the menu only, "" if it is ignored.

    7

    all

    optional

    plugRightHtml

    Name of a WCTL macro or WCJS command-without-parameters (in quotes), which is run when a project adds something to the Theme multi-purpose (right) column. (e.g. "demoThemeFooter")

    8

    all

    optional

    plugRightHtmlIsEnabled

    1 if the rightHTML is automatically enabled, 0 if it appears in the menu only, "" if it is ignored.

    9

    all

    optional

    contentPreHtml

    Name of a WCTL macro or WCJS command-without-parameters (in quotes), which is run when a project adds something above the content cell of the Theme. (e.g. "demoThemeContentPre")

    10

    all

    optional

    contentPreHtmlIsEnabled

    1 if the contentPreHtml is automatically selected, 0 if it appears in the menu only, "" if it is ignored.

    11

    all

    optional

    contentPostHtml

    Name of a WCTL macro or WCJS command-without-parameters (in quotes), which is run when a project adds something below the content cell of the Theme. (e.g. "demoThemeContentPost")

    12

    all

    optional

    contentPostHtmlIsEnabled

    1 if the contentPostHtml is automatically selected, 0 if it appears in the menu only, "" if it is ignored.



    Other WCMS Project Methods

    Other useful methods and parameters:

    plugDisplayName()

    all

    Returns the display name of the project in the user's preferred language.

    plugShortDescription()

    all

    Returns a short description of the project in the user's preferred language.

    plugEditExplanatoryText()

    all

    Returns a paragraph of explanatory text for the edit project page, in the user's preferred language.

    plugAddText()

    Folder items only

    Returns the text string "Add Xxxx" in the user's chosen language.

    plugAddMenu()

    Folder items only

    Returns the text string for an "Add Xxxx" menu item, in the user's chosen language.

    plugAddButton()

    Folder items only

    Returns the "Add Xxxx" button in the user's chosen language.

    plugCheckButtonAccess( user, location )

    Folder items only

    Returns 1 if the user has access to see the toolbar button/link or run the macro/function; 0 if not. You can redefine this method to do special user checks for group membership, etc. Note that you can lock out even sysop from a function using this. See the demoFdrItem for an example. If not present, the default is to allow unknown users and unmoderated registered users to see the button.

    plugCheckPageAccess( user, location )

    Folder items only

    Returns 1 if the user has access to actually use the "add" form, or should be asked to log in. You can redefine this method to do special user checks for group membership, etc. Note that you can lock out even sysop from a function using this. See the demoFdrItem for an example. This allows you to show the button to guests (in case they're registered users who are not logged in yet) and ask them to log in when they attempt to use the page. After login they are directed immediately back to the add form. If not present, the default is to allow registered, unmoderated users to add.

    plugOpenText()

    User items only

    Returns the text string for text toolbars or select menus in the user's chosen language.

    plugOpenButton()

    User items only

    Returns the toolbar button for the User Item in the user's chosen language.

    plugToolbarLink()

    User items only

    Replaces the entire <a href... tag surrounding the user item button or link in the toolbar.

    plugButtonBeforeText()

    User items only

    Returns some text or HTML which is placed in the toolbar before the button.

    plugHostOnly

    Folder items only

    Set this to 1 if the item should is only for hosts/sysops to use and should never be available for regular participants to add. The default, if this parameter is not present, is 0.

    plugFolderListBeforeText()

    Folder items only

    If present, this returns HTML or text which is inserted before the entire folder listing. You can use this to put any javascript, etc. on the page which is needed to open your folder item link.

    plugNeverShowPrefs

    User items onlys

    Return 0 to suppress selection of the user item on the user's personal preferences page. If not present, defaults to showing the item.

    plugToolbarLink()

    User items only

    If present, replaces the entire <a href=""...> tag for the toolbar button.

    plugButtonBeforeText()

    User items only

    If present, text or (more probably) script is inserted before the toolbar button.

    Other Useful Functions and Variables

    You may also use these other built-in functions and variables:

    themeIsEnabledHier( projectName, loc )

    Themes only

    Returns 1 if the current theme is argument 1, otherwise returns 0. ProjectName is required. Loc defaults to current location if not specified.

    componentIsEnabledHier( componentType, Â
    projectName, loc )

    Components only

    Returns 1 if the component is enabled at the current level or a parent level, otherwise returns 0. ProjectName and componentType are required. Loc defaults to current location if not specified.

    extensionIsEnabledHier ( projectName, loc )

    Extensions only

    Returns 1 if the extension is enabled at the current level or a parent level, otherwise returns 0. ProjectName is required. Loc defaults to current location if not specified.

    folderItemIsEnabledHier( projectName, Â
    loc, hier )

    Folder items only

    Returns 1 if the folder item is enabled at the current level or a parent level, otherwise returns 0. ProjectName is required. Loc defaults to current location if not specified. Hier should be either "site" or "local". If hier is missing, defaults to local. This does NOT take plugCheckButtonAccess or the current's user's ability/inability to add folders into consideration.

    userItemIsEnabledHier( projectName, Â
    loc, hier, user )

    User items only

    Returns 1 if the user item is enabled at the current level or a parent level, otherwiser returns 0. ProjectName is required. Loc defaults to current location if not specified. Hier should be either "site" or "local". If hier is missing, defaults to local. If a user is specified, also takes into consideration the user's preferences for the user item along with local and site settings, otherwise returns only the result when site and local settings are taken into consideration. If a user is specified, it returns -1 if the user is a guest (and therefore can't add folder items).

    checkUIStatus( projectName )

    User items only

    Returns 1, and sets the string value "yes" for the WCTL variable "toShow" if the macro or command should return its contents in this location for this user, otherwise returns an empty string for toShow. For example, use this to determine if links to the user item should appear in the nav or multi-purpose columns.

    checkFIStatus( projectName )

    Folder items only

    Returns 1 and sets the string value "yes" for the WCTL variable "toShow" if the macro or command should return its contents in this location for this user, otherwise returns an empty string for toShow. For example, use this to determine if an addFolderItem form can be presented or processed. This takes into consideration plugCheckButtonAccess.

    folderItemToolbarLoop( type )

    Folder items only

    If "type" is not provided, returns a set of toolbar buttons for the folder items enabled in this location. If type == "text" returns links for a text toolbar. If type == "menu" returns a set of option items for a select menu. This takes into consideration plugCheckButtonAccess.

    userItemToolbarLoop( type )

    User items only

    Same as folderItemToolbarLoop, only for user items.

    plugHtmlLoop( parameterName )

    All projects

    Returns the HTML provided by the currently enabled projects for this location and user, for the stylesheet or editPreferences, and editedPreferences.

    whichCell

    All projects

    whichCell is a WCTL variable available in Theme cells to identify which cell a macro is being inserted into. Returns "banner", "footer", "right", or "nav" (string values). An example of using whichCell is in whichLiveX, in wx_livex.tpl

    findAllDates

    All projects

    Returns an HTML table with a summary of all the available WCMS plugins on the server, with their versions and build dates.

    findPluginVersionDates( type, tables )

    All projects

    Returns an HTML table with a summary of all the available WCMS plugins of the type indicated on the server, with their versions and build dates. Type must be "themePalette", "componentPalette", "extensionPalette", "folderItemPalette", or "userItemPalette". If the tables parameter is 1, it places the results in a table. If the tables parameter is 0, it does not supply or <table> </table> tags but starts with a <tr>. The parameters can be either formal parameters, or form fields named "type" and "tables".

    enableFdrItemOnInstall( objectName )
    enableUserItemOnInstall( objectName )

    Folder items and user items

    To enable a folder item or user item when it is installed, include these lines early in your init (see the wx_demoFdrItem.auto file for positioning):

    var toEnableOnInstall;
    if ( !topLevelFolder.folderItemPaletteBkp Â
       || !topLevelFolder.folderItemPaletteBkp.demoFdrItem )
        toEnableOnInstall = 1;
    else toEnableOnInstall = 0;
    
    And then this line toward the end of the init (use the correct function name for the object are enabling):
    if ( toEnableOnInstall && toEnableOnInstall == 1 ) Â
    	enableFdrItemOnInstall( 'demoFdrItem' );
    

    findWidgetLoc( locationID, Â
    extensionObjName )

    Extensions only

    LocationID is the unique ID of a location. Returns the stored unique ID of the location where the extension is enabled. Also sets the WCTL variable "loc" to the same ID.

    pageCreditHeaders

    All projects

    A WCTL macro which returns the Web Crossing header comments for the top of an HTML page.

    makeButton( filename )

    All projects

    Filename is MINUS the extension (i.e. ".gif"). Action is the command code for the link URL. If there are no parameters it defaults to an OK button with an action of 14 at the current WCTL location.

    makeSubmit( filename, action )

    All projects

    Filename is MINUS the extension (i.e. ".gif"). Assumes the "name" field is the same as the filename, thus can't be used in situations where there is more than one submit button for the same filename on the same page, and in situations where the "name" field differs from the filename. If there are no parameters it defaults to an OK button where the "name" field is "ok".

    makeIcon( filename )

    All projects

    Filename is MINUS the extension (i.e. ".gif"). If there are no parameters it defaults to a discussion icon linked to the WCTL pathUrl.

    » Creating an Edit Page

    For any project except Themes, it is required that you provide the name of an edit macro; however, it is not required that you make anything editable. You can either write your own edit macro and processor, or you can use the built-in processor.

    Since Themes are already editable via the Edit Theme Settings page, you only need supply an edit macro for Themes if you have special parameters to edit that are not included on the default Edit Theme Settings pages.

    If you use our processor, the edit page itself must be set up correctly for everything to work. Moreover, the portion of the page you provide drops into an existing table provided by the Admin macros. Thus, the form fields and table structure are critical.

    If you want to use your own edit macro and processor
    To write your own edit macro and processor, simply provide the name of it in the object definition. Simply define your edit macro to show your custom form rather as in the examples above. Remember that you are responsible for checking security on the processor macros you write. An example:

    %% command editBlog() {
    	return wctlEval( 'use someOtherMacro' );
    	// (or place the form directly in this command)
    } %%
    

    If your project has no editable parameters, or if you are using the built-in processor
    Editing a project actually requires two macros:

    Command 1: editTheme[projectName or component type] (this naming convention is not required, but is suggested to prevent conflicts in naming). This must be a Javascript command.
    e.g. editdemoUserItem, editsimple, etc.
    Macro 2: [Command 1 Name]Form (You can name Command 1 whatever you want, but Macro 2 must be named the same as Command 1, with the addition of the word "Form" at the end)
    e.g. editdemoUserItemForm, editsimpleForm, etc. This must be a WCTL macro.

    Command 1 has a prescribed format:

     1 %% command editDemoUserItem() {
     2    var obj=libraryGlobal.userItemPalette.demoUserItem;
     3    session.wrap_edit="demoUserItem";
     4    setWctlVar( "which", "demoUserItem" );
     5    setWctlVar( "formUrl", obj.plugEditHtml );
     6    setWctlVar( "abbrev", "userItems" );
     7    setWctlVar( "isEditable", obj.plugIsEditable + "" );
     8    setWctlVar( "objType", obj.plugType );
     9    var txt = obj.plugEditExplanatoryText();
    10    setWctlVar( "explanatoryText", txt );
    11    return wctlEval( "use editWrapperHelpSet" );
    12 } %%
    
    Line 2: Edit this line for the correct palette and project name. For components, be sure to include the component type:
    libraryGlobal.componentPalette.toolbar.demoToolbar;
    Line 3: Edit this line to set session.wrap_edit to the name of the project.
    Line 4: Edit this line to set the WCTL variable "which" to the name of the project.
    Line 5: Do not edit this line.
    Line 6: Edit this line to set the WCTL variable "abbrev" to one of the following: Line 7-11: Do not edit these lines.

    Tip: The simplest way to accomplish this is to retrieve an existing macro from one of the demo projects (the one which matches the object type of your project) and do a global search/replace for the demo project name, replacing with your project name. If your project is a component, you also need to edit the "abbrev" line manually - otherwise, you're done.


    Macro 2:

    No editable parameters
    If you have no editable parameters, your macro edit[ x ]Form macro only needs one line, for example:
    <p>This top level view has no editable parameters. Â
    However, you can choose another top level view using the link just above.</p>
    

    Help references
    The first thing required in Macro 2, if you have editable parameters, and you need to provide user help footnotes, are help string references. On the edit pages, following the form fields or labels, you can have anchor links leading to help footnotes on the page. These footnotes are inserted and available if they are included in the help string, which is a space-delimited list of help footnote numbers. For example, if you need help string 1 and 4, you would use this as the first line in your macro. If you don't need any help footnotes, you can omit the line altogether.

    %% set helpString "1 4" %%
    
    You can find a list of the help strings in webxWcms_s_en_US.auto. At this time it's not possible to add new help strings, although you can certainly format your form to put information elsewhere on the page.

    The second line required in Macro 2 is this:

    %% set url "myMacro2Name" %%
    Edit this to the same name as macro 2.

    Form fields
    If you do have editable parameters, you will need to fit your form fields into an existing three-column table.

    Tip: The simplest thing is to copy and paste the table row(s) for an existing form field type of the kind you want to use, and copy/paste change the variable and string names.

    Here is a sample text field form and its associated one table row: Again, Â means the line has been broken here for clarity, but should not be broken in your code.

     1<tr>
     2  <td valign="top"><p>
     3    <label for="inner_fl_tableCellspacing">%% "lang( 'sortableFL', 'fl_tableCellspacing' )".jsEval Â
     4       // Folder List Table Cellspacing %%</label>
     5 </p></td>%% nop %%
     6 <td><p>
     7   <input type="hidden" name="inner_fl_tableCellspacing_conf" Â
     8      value="%% "lang( 'sortableFL', 'fl_tableCellspacing' )".jsEval %%">
     9   <input name="inner_fl_tableCellspacing" type="text" size="%% clipCols( 5 ) %%" Â
    10     maxlength="4" %% if inh %%value="%% path$inner_fl_tableCellspacing %%" Â
    12      %% use inheritCheck %%%% else %%value="%% path.inner_fl_tableCellspacing %%"%% endif %% Â
    13       id="inner_fl_tableCellspacing"> <a href="#help12">*12</a>
    14  </p></td>
    15  <td valign="top" align="right" width="150"><p>
    16  	%% use inheritance %% 
    17  </p></td>
    18</tr>%%nop%%
    
    Line 3-4: This is the lang() call for the field label. The "label" tag is required for Section 508 (US disability) access compliance, but not for the WCMS system per se. It's up to you if you want to include it. For more on localization and lang() calls, see the Localization section.
    Line 7-8: This is a hidden field which provides the text for the "confirm" page which shows up after the form is submitted, summarizing what was set. If this field is missing, the form will use the variable name instead. Note that the name of this form field is the same as the actual form value you're setting, with "_conf" appended.
    Line 9-13: This displays the actual text form field. "Inh" is a WCTL variable set earlier on the page which indicates if the value is inherited or not. "InheritCheck" turns the form field style red if it is inherited. "Inheritance" displays the "local" or "inherited" text in the right-hand table cell in folder-level forms. This is blank at the top level. Note that the "id" tag matches up with the "for" attribute in the label tag above. Line 13 is the link to help footnote #12.

    Textareas, checkboxes, and radio buttons are similarly constructed. Study the existing files for examples, including examples with popup color-choosers.

    » Creating Set Files for Themes

    For the most part, all you need to do to create a Set file for a Theme is to export the settings from a location which is set up the way you want it.

    Export will write a file (you can choose the name) with all the WCMS variables (everything beginning with "wrap_" or "inner_").

    Importing/installing a Set file will not change image SIZES, however, unless you add two additional lines to the top of the Set file before you distribute it. Please also note that if you provide these two lines, and if a user installs your Theme in a folder, the sizes for all images on the site will change, not just the folder. Image sizes are now calculated automatically if a site is using the new button syntax, so this may not be necessary.

    Some considerations:

    IF you need to set image sizes, these two additional lines must go on line 3 of the Export file, immediately after the "pathBodyTag" line. These set the sizes for images and icons. You must set either both icons and button sizes, or neither.

    For example: (all on one line, no spaces or linebreaks until after the final ~)

    iconSet=16x14_18x14_10x16_16x14_19x16_35x15_16x14_11x11_12x20_19x14_18x14_8x16_16x16_16x14~
    buttonSet=68x30_53x19~
    
    Icons: Buttons: The sizes here in these examples are the sizes of the i2 and b2 icon/button sets, so if your chosen buttons are the same size, you can just copy these lines.

    » Adding Buttons or Other Custom Images

    Your project can have any number of custom images, including new button or icon directories. You can place any custom, nonbutton, nonicon images in your project's plugin directory itself: /html/plugins/plugFileName/newCustom.jpg and you can them reference them this way:
    <img src="/plugins/myProject/newCustom.jpg">

    Or, you can place them in any of the standard image locations.

    If you want to add an entire button set, the Plugin Server will place them in the usual /Images location for buttons. If your project is a Theme, you can have your Set file define the button set to be used with your Theme. Otherwise, you'll have to either tell your users in the ReadMe file to manually set their button directories, or set it automatically somehow when the project is enabled.

    » Localization Manager

    All plugins should be localized (a string file is required). The native server code is not localized for performance reasons. In the Localization Manager popup menu is a page which allows the site to choose whether localization or performance is the priority. Depending on the choice made, a variable is set which determines which files to load.

    The options on that page are:

    Optionsite.stdLocalOnsite.stdLocalPerformOnFiles Loaded
    Optimize for Localizationsite.stdLocalOn == 1site.stdLocalPerformOn is not setwebxStd-local.tpl
    webxStd_s_en_US.auto
    webxextn.tpl
    webxextn_s_en_US.auto
    Optimize for Performancesite.stdLocalOn is not setsite.stdLocalPerform == 1webxStd-perform.tpl
    webxextn.tpl
    webxextn_s_en_US.auto
    Partial Localizationsite.stdLocalOn == 1site.stdLocalPerformOn == 1webxStd-local.tpl
    webxStd_s_en_US.auto
    webxStd-perform.tpl
    webxextn.tpl
    webxextn_s_en_US.auto
    Default Settingssite.stdLocalOn is not setsite.stdLocalPerformOn is not setwebxextn.tpl
    webxextn_s_en_US.auto

    The purposes of these files:
    File 
    webxextn.tplAlways loaded. Provides extra functionality
    webxextn_s_en_US.autoAlways loaded. Strings for webxextn.tpl
    webxStd-local.tplLocalized mirror of server code. Loaded when stdLocalOn == 1
    webxStd_s_en_US.autoStrings for webxStd-local.tpl. Loaded when stdLocalOn == 1 or "Enable 'std' strings" is turned on in the WCMS developer menu.
    webxStd-perform.tplNONlocalized copy of selected performance-critical macros. Loaded when stdLocalPerformOn == 1

    Localization takes place through WCJS calls to a lang() function, from which the correct language and string is retrieved. The lang() function can be found in webxLocal-lang.tpl. The user can choose a language at registration or in user preferences.

    Language strings are initialized in the init_localizer() function, found in webxLocal-init.tpl. webxLocal-init.tpl can be overwritten upon upgrade, so any manual changes to that file should be made in an override file named webxLocal-init_o.tpl. Here's an example of a site supporting English and Japanese. English is the default, since it appears first in the list, so any guest, or any registered user coming to the site without a specific "user.language" property, would see English.

    %% function init_localizer() {
    if (!libraryGlobal.langStrs) libraryGlobal.langStrs = new Object();
    // set the known languages for the current site here
    langStrs.languages = [ "en_US", "jp_JP" ];
    langStrs.languageNames = [ "English", "Japanese" ];
    } %%
    
    Any additional language codes and language names would be added in the langStrs.languages and langStrs.languageNames arrays. Information on language codes and how to construct them can be found via the Localization Manager popup menu in the control panel, in the Add/Edit/Delete Language option. You can add a language there, delete a language, and set a default language to be shown to users who have not yet made a selection in their preferences. Or you can edit the init_localizer() function directly.

    In WCJS, you would call a string like this:

    lang( 'projectName', 'stringVariableName' ); // This is replacement text
    In WCTL, you need to use .jsEval syntax:
    %% "lang( 'projectName', 'stringVariableName' )".jsEval // This is replacement text %%
    The commented literal text is not required, but makes it easier to read your code after it's localized.

    The strings for any given project are in a strings function in a separate strings file named, for example, "wx_propTB_s_en_US.auto". In this example, "en_US" is the code for US English, and "propTB" is the project name.

    %%function init_propTB_s_en_US() {
    
    if (!libraryGlobal.langStrs) langStrs = new Object();
    if (!langStrs.propTB) langStrs.propTB = new Object();
    if (!langStrs.propTB.en_US) langStrs.propTB.en_US = new Object();
    langStrs.propTB.en_US.nameToolbar="Toolbar with Custom Button Colors";
    langStrs.propTB.en_US.descrToolbar="Set your own exact button, rollover,  Â
    and onclick colors.  Color settings extend to nontoolbar buttons as well.  Â
    Large or small buttons.";
    langStrs.propTB.en_US.editExplanatoryText="Choose button color and rollovers.";
    langStrs.propTB.en_US.propToolbar="Toolbar with Proportional Buttons";
    langStrs.propTB.en_US.textColor="Text Color";
    langStrs.propTB.en_US.whiteText="White Text";
    langStrs.propTB.en_US.blackText="Black Text";
    langStrs.propTB.en_US.tb_buttonBG="Button Color";
    langStrs.propTB.en_US.tb_rollover="Button Rollover Color";
    langStrs.propTB.en_US.tb_onClick="Button OnClick Color";
    
    } %%
    
    These strings should not be edited. If you need to change any of the string definitions, or add strings, you need to create a strings override function in a separate file called "wx_propTB_s_en_US_o.auto", holding just the changed strings.
    %%function init_propTB_s_en_US_o() {
    
    if (!libraryGlobal.langStrs) langStrs = new Object();
    if (!langStrs.propTB) langStrs.propTB = new Object();
    if (!langStrs.propTB.en_US) langStrs.propTB.en_US = new Object();
    langStrs.propTB.en_US.propToolbar="Toolbar with Custom Buttons";
    
    } %%
    
    Each English project has its own strings file and optional override file. Each non-English project has an override file for each other supported language. The reason for this is so that we can ship (non-override) files at some point without interfering with people's own translations.
    1  %% function init_propTB_s_jp_JP_o() {
    2  if (!libraryGlobal.langStrs) libraryGlobal.langStrs = new Object();
    3  if (!libraryGlobal.langStrs.propTB) libraryGlobal.langStrs.propTB = new Object();
    4  if (!libraryGlobal.langStrs.propTB.jp_JP) libraryGlobal.langStrs.propTB.jp_JP = new Object();
    5 langStrs.propTB.jp_JP.propToolbar="Toolbar with Proportional Buttons";
    6 langStrs.propTB.jp_JP.textColor="Text Color";
    7 langStrs.propTB.jp_JP.whiteText="White Text";
    8 langStrs.propTB.jp_JP.blackText="Black Text";
    9 langStrs.propTB.jp_JP.tb_buttonBG="Button Color";
    10 langStrs.propTB.jp_JP.tb_rollover="Button Rollover Color";
    11 langStrs.propTB.jp_JP.tb_onClick="Button OnClick Color ";
    } %%
    
    This function adds an object to hold the Japanese strings (line 3), and defines the Japanese strings (seen here in English).

    You can build this manually, or, use one of the Edit Strings pages in the Localization Manager. You can either translate using web forms or use a spreadsheet system.

    If you use the Add/Edit/Delete Language page, it will edit the init_localizer() function to add the new language. You can then use the Edit Strings page to translate. If no strings file exists for the project and language, it will be created. If a strings file exists, an override file will be created. If an override file exists, the old file will be renamed before the new one is written.

    Debugging Language Issues
    In the WCMS developer menu is an option to enable language debugging. Doing so will place HTML comments into the source identifying which file and which string a particular bit of text was called from. We don't recommend leaving this on for production servers, as it can cause display errors and cosmetic problems due to comments inside form buttons, etc.

    » Creating Reference Macros

    Reference macros prevent individual subfolders from each loading a copy of the macros for a given projects over and over. The "meat" of the macros are loaded only once (see "template files" just below), but the much shorter reference macros can be loaded numerous times in subfolders without significant effects on performance or memory requirements.

    A reference macro simply references another main macro and points to it. Rename the "real" macro with the project name prepended.

    Reference macros are only required when you are editing a macro provided by the system (not a custom macro) which is not inside a folder envelope, or when you need to specifically prevent a custom macro from running outside its envelope.

    An example, from LiveX:

    In wx_livex_ext.tpl (which is loaded in each folder where LiveX is chosen from the menu of options):

    %% macro send_message_process %%
    	%% use livex_send_message_process %%	
    %% endmacro %%
    
    In wx_livex.tpl (which is loaded only once):
    %% macro livex_send_message_process %%
    
    %% set curLoc location %%
    %% set loc location %%
    <HTML><HEAD>
    
    ... approx 80 lines of code ...
    
    %% endmacro %%
    
    When you need to call other project-related macros from the macros in wx_livex.tpl, use the entire long name:
    %% use livex_receive_message %%
    For more examples, see the existing project files and the demo project files.

    » Files Needed for A Project

    You need a unique name for your Theme, Component, or Extension. Register it as a project at the Developer and Education site. Each type of project has different required files.

    There is no absolutely required naming convention for any of the project files, since you can specify filenames in your project object definition, but we strongly suggest you follow our convention to avoid problems and issues with other developers' work. The filenames below are examples of our suggested convention.

    Your files will generally be divided into three sets, one set which will go into the webxTemplates directory, one set which goes into the /webx/html/plugins directory, and images which go inside the various image directories. Inside /plugins, create a new directory with your project plugFileName, and put anything other than your templates and string files in there.

    You will need a large and small screenshot for each project, and a readMe HTML file. Themes need at least one ".set" file. Beyond that, there are 4 basic template files for each project, not all of which are required for each type of project.


    Themes
    If your Theme project is named "myTheme," you need:

    Required files:

    Optional files:
    Component
    If your component project is named "myComponent," you need:

    Required files:

    Optional files:
    Extension
    If your extension project is named "myExtension," you need:

    Required files:

    Optional files:
    Folder Item
    If your folder item project is named "myFolderItem," you need:

    Required files:

    Optional files:
    User Item
    If your user item project is named "myUserItem," you need:

    Required files:

    Optional files:

    » Creating Your First Project - Step by Step

    You can proceed one of two ways to build your first project:

    1. Create your project as you normally would, with macros in webx.tpl or a file included from there. Don't worry initially about WCMS-specific issues or localization, just get your project working as you want it to.

      Once you have a new working project, or an old project you want to adapt into a WCMS project, follow these easy steps to add the code to integrate it into the WCMS system. Once you've done this once or twice, it will all start to make a lot more sense to you and the next one(s) you do will go faster.

    2. Or, you can start with one of the demo objects and edit it as you need to and build your project from there, that way.

    Either way, reading these instructions before you start (perhaps adapting a small existing practice project first?) will show you the roadmap for where you're going before you start.

    At the Developer Center are some simplified instructions for a "Quick Start" in creating your project.

    Essentially it involves starting with a demo project of the same type as yours, renaming the files, and then doing a lot of search/replace to replace the project name everywhere it appears. Once you've done that, it's just a matter of turning the right options on and off in the init. Unless you're doing something unusual, most of the defaults are fine.

    » Creating a Theme

    1. Choose a name, something like myStuff. Filenames can get kind of long, so keeping the base name short is a good idea. Less than about 10 characters is ideal. In this example "myStuff" is the name of the theme.
    2. When you create your Theme settings, be sure to turn on the tabular or sortable folder item and the tabular message view components and set matching colors for those as well so the colors will export. You can use any of the background images in /plugins/bgs, or create your own custom images.
    3. Put any custom images into a folder called "myStuff" inside /plugins.
    4. Create the screenshots myStuffL.gif and myStuff.gif, and the readme file readme.html. Place these in your "myStuff" folder.
    5. When you have your theme settings the way you want, use the Export function on the Theme Settings page to export a Theme set file.
    6. Name your set file: wx_myStuff_0.set. If you have other color variations on the same theme, name the other files wx_myStuff_1.set, wx_myStuff_2.set, etc. for as many variations as you have.
    7. Open the file wx_zdemoTheme.tpl and rename it "wx_myStuff.tpl".
    8. Use search and replace to replace all instances of the string "zdemoTheme" with "myStuff". Also replace all instances of the string "demoTheme" with "myStuff". (The Demo Theme object name is sometimes is prefixed with the "z" to make it alphabetize to the end of the selection list).
    9. Open the example file wx_demoTheme_s_en_US.auto and rename it "wx_myStuff_s_en_US.auto". Do a search-and-replace for all instances of "demoTheme" and replace with "myStuff". Edit the "themeName", "explanText", and "shortDescr" strings as necessary to provide the actual name of the theme as you would like it to appear in the user interface, and a short description of what the theme does. The other strings go specifically with the Demo Theme and can be deleted unless you want to reuse them. (If you already have a strings file for your project you'll have to combine all the strings into one file, and make sure that file is the one named in plugSetWcmsFiles() below.)
    10. Edit the init function for the new theme (first one in the wx_myStuff.auto file) as follows.
      1. If you already have an init_myStuff() function elsewhere, feel free to rename this to init_myStuff_wcms() or something similar.
      2. First, find the function ShortTheme().
      3. These two parameters are each arrays holding the list of set files you created in step 6. Parameter 1 is an array of the names of the color options for the user interface, and the second is an array of the actual names of the file.
      4. Next, find the method plugSetVersion().
      5. Replace the two parameters with the version number of the plugin and date of the current release, respectively. The date can be in whatever format you wish.
      6. Next, find the method plugSetWcmsFiles().
      7. Replace the 1st parameter "demo" with "myStuff".
      8. Replace the 2nd parameter "demo.gif" with "myStuff.gif.
      9. Replace the 3rd and 4th parameters with the width and height, respectively, of myStuff_sm.gif.
      10. Replace the 5th parameter "demoL.gif" with "myStuffL.gif.
      11. Replace the 6th and 7th parameters with the width and height, respectively, of myStuff_lg.gif.
      12. Replace, if necessary, the 8th parameter with the URL where users may obtain support for this project (required).
      13. Next, find the method plugsetTplfiles().
      14. The first parameter should already read "wx_myStuff.auto".
      15. The 2nd and 3rd parameters can be replaced with "" unless you have special functions above and beyond the theme settings, which need to be included with your project. The defaults are OK if you do have special functions.
      16. The next method, plugSetStringProps(), should be OK as is after your search/replace.
      17. Find the next method, plugSetEditables().
      18. Set the 1st parameter to 1 if you will have a special edit form for your theme, or 0 if the theme has no editable parameters.
      19. The 2nd and 3rd parameters are necessary only if the first parameter is set to 1. If so, the defaults are OK. If not, replace them with "".
      20. The next method is plugSetInterfaceHooks(). This method is optional if you don't have any arguments for it.
      21. If your theme needs to place HTML on the user preferences page in the misc section, put the names of your WCJS preferences functions or commands (one for edit prefs, one for edited prefs) in as the 1st and 2nd parameters, without quotes around the names. Place these functions/commands in the wx_myStuff.auto file. These functions/commands should only call another macro or function inside wx_myStuff.tpl, similar to the way the stylesheet functions/macros work in the next step. You can use demoFIEditPrefs() and demoFIEditedPrefs() functions from wx_demoFdrItem.auto file as examples of the function for wx_myStuff.tpl. If your theme has no need to do this, replace both arguments with "".
      22. If your theme needs to add a custom class to the stylesheet, put the name of your WCJS style command or function in as the 3rd parameter. You can copy/edit the command demoUIStyleJS and the macro demoUIStyle from wx_demoFdrItem.auto file if you wish. Place demoUIStyleJS in wx_myStuff.auto and demoUIStyle in wx_myStuff.tpl.tpl. Edit the names of them to myStuffStyleJS and myStuffStyle and include your own stylesheet code. myStuffStyle needs to set/return the WCTL variable "body". If not, replace with "".
      23. If your theme needs to add a link (or links) in the control panel, create a WCJS command or function w