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
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:
- Theme: a look/feel "wrapper" for the page.
- Component: a top level view, folder view, message view, or toolbar.
- Extension: a project which adds a new function, but which doesn't fit
into any of the other existing project types. LiveX, sysop tools.
- Folder Item: adds a new type of item inside a folder. Weblogs, shared calendars.
- User Item: adds a user-specific function. User calendar, subscriptions manager.
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.
- Demo Theme
- Demo Component (a toolbar)
- Demo Extension
- Demo Folder Item
- Demo User Item
Please register your project at http://webxedu.com/registerproject to ensure that your project name is unique.
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.
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 type | Variable prefix |
| Themes | wrap_ |
| Component: top level | inner_tl_ |
| Component: folder list | inner_fl_ |
| Component: message list | inner_ml_ |
| Component: toolbar | inner_tb_ |
| Extension | inner_ |
| Folder Item | inner_ |
| User Item | inner_ |
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
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:
| Technique | Rationale |
| 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:
| Class | Function |
| .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:
| | Situation | Example |
| 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.
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_Icons | regular icon directory |
| path.wrap_Images | regular button directory |
| path.wrap_hotImages | rollover directory (not defined by default) |
| path.wrap_clickImages | onmousedown directory (not defined by default) |
| path.wrap_sectionHeadingColor | for section-heading background colors |
| path.wrap_hostHeadingColor | host-only links or headings (see subscribe page for an example) |
| path.wrap_BgColor | body tag page bg color |
| path.wrap_TextColor | body tag text color |
| path.wrap_LinkColor | body tag link color |
| path.wrap_ALinkColor | body tag active link color |
| path.wrap_VLinkColor | body tag visited link color |
| path.wrap_HoverColor | stylesheet hover color |
| path.wrap_pathTitleColor | "pathTitle" h1 title color |
| path.wrap_h3SubtitleColor | subtitle h3 color |
| path.wrap_bannerBackground | top cell background image |
| path.wrap_bannerBgcolor | top cell background color |
| path.wrap_bannerFontColor | top cell font color |
| path.wrap_bannerLinkColor | top cell link color |
| path.wrap_bannerVLinkColor | top cell vlink color |
| path.wrap_bannerALinkColor | top cell alink color |
| path.wrap_bannerHoverColor | top cell hover color |
| path.wrap_contentBackground | content cell background image |
| path.wrap_contentBgcolor | content cell background color |
| path.wrap_navBackground | nav cell background image |
| path.wrap_navBgcolor | nav cell background color |
| path.wrap_navFontColor | nav cell text color |
| path.wrap_navLinkColor | nav cell link color |
| path.wrap_navVLinkColor | nav cell vlink color |
| path.wrap_navALinkColor | nav cell alink color |
| path.wrap_navHoverColor | nav cell hover color |
| path.wrap_specialEventsBackground | multi-purpose column background image |
| path.wrap_specialEventsBgcolor | multi-purpose column background color |
| path.wrap_multiFontColor | multi-purpose cell font color |
| path.wrap_multiLinkColor | multi-purpose cell link color |
| path.wrap_multiVLinkColor | multi-purpose cell vlink color |
| path.wrap_multiALinkColor | multi-purpose cell alink color |
| path.wrap_multiHoverColor | multi-purpose cell hover color |
| path.wrap_footerBackground | bottom cell background image |
| path.wrap_footerBgcolor | bottom cell background color |
| path.wrap_footerFontColor | bottom cell font color |
| path.wrap_footerLinkColor | bottom cell link color |
| path.wrap_footerVLinkColor | bottom cell vlink color |
| path.wrap_footerALinkColor | bottom cell alink color |
| path.wrap_footerHoverColor | bottom cell hover color |
| path.wrap_footerBgcolor | bottom cell background color |
| path.inner_fl_darkerColor | folder listing darker color |
| path.inner_fl_lighterColor | folder listing lighter color |
| path.inner_fl_lightestColor | folder listing lightest color |
| path.inner_fl_whiteColor | folder listing white equivalent |
| path.inner_fl_fontColor | font color for table headings (folder
listing) |
| path.inner_ml_darkerColor | message listing darker color |
| path.inner_ml_lighterColor | message listing lighter color |
| path.inner_ml_lightestColor | message listing lightest color |
| path.inner_ml_whiteColor | message listing white equivalent |
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.
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 ) %%
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.
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:
- Add the calls to your object definition using the method plugSetThemeHooks(). Each call requires two parameters,
the name of the WCTL macro (or WCJS command without any parameters) and a flag to tell whether it should
be ignored ( "" ), placed in the menu, 0, or selected, 1.
- Add a couple of lines to your init statement to add your project to a
palette of projects which appear at the end of the Theme Optional Item menus.
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.
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.
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 type | required? | param name set | description |
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 type | required? | param name set | description |
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 type | required? | param name set | description |
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 type | required? | param name set | description |
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 type | required? | param name set | description |
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 type | required? | param name set | description |
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 type | required? | param name set | description |
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. |
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:
- Theme: "theme"
- Extension: "Widgets"
- User Item: "userItems"
- Folder Item: "folderItems"
- Component - top level: "tl"
- Component - folderList: "fl"
- Component - messageList: "ml"
- Component - toolbar: "tb"
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.
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 have buttons of a nonstandard size, you
may want to do this so sites with old button code will get the correct button
size automatically.
- If you have proportional buttons where not every
button in a set is the same size, leave this out so you do set them all to
the same size. The site will have to update their old button code before
all their buttons will be the right sizes. You will want to note this in
your ReadMe file!
- If your Theme is likely to be used in a subfolder,
you may not want to set button sizes automatically because button sizes are
currently set sitewide.
- If the button set you choose to go with your Theme
is one of the standard button sets where all the buttons are the same size,
and which is the "standard" size, setting sizes is probably unnecessary,
because it is highly likely the site's previous size setting is already OK.
- Please note that not all the icon sets are exactly the same size and these same considerations apply to icons too.
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:
i is for icons
The NnxNn values are icon sizes in a certain order, width x height.
auction_discuss_indent_link_chat_new_node_outline_pathdiv_site_folder_topmsg_envelope_project
Buttons:
The NnxNn values are the button sizes in this order:
regularSize_smallSize
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.
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.
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:
| Option | site.stdLocalOn | site.stdLocalPerformOn | Files Loaded |
| Optimize for Localization | site.stdLocalOn == 1 | site.stdLocalPerformOn is not set | webxStd-local.tpl
webxStd_s_en_US.auto
webxextn.tpl
webxextn_s_en_US.auto |
| Optimize for Performance | site.stdLocalOn is not set | site.stdLocalPerform == 1 | webxStd-perform.tpl webxextn.tpl
webxextn_s_en_US.auto |
| Partial Localization | site.stdLocalOn == 1 | site.stdLocalPerformOn == 1 | webxStd-local.tpl webxStd_s_en_US.auto webxStd-perform.tpl webxextn.tpl
webxextn_s_en_US.auto |
| Default Settings | site.stdLocalOn is not set | site.stdLocalPerformOn is not set | webxextn.tpl
webxextn_s_en_US.auto |
The purposes of these files:
| File | |
| webxextn.tpl | Always loaded. Provides extra functionality |
| webxextn_s_en_US.auto | Always loaded. Strings for webxextn.tpl |
| webxStd-local.tpl | Localized mirror of server code. Loaded when stdLocalOn == 1 |
| webxStd_s_en_US.auto | Strings for webxStd-local.tpl. Loaded when stdLocalOn == 1 or "Enable 'std' strings" is turned on in the WCMS developer menu. |
| webxStd-perform.tpl | NONlocalized 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.
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.
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.
- wx_projName.auto file ("auto" file)
- wx_projName.tpl file ("template" file)
- wx_projName_projType.tpl file ("envelope" file)
- wx_projName_s_en_US.auto file ("strings" file)
Themes
If your Theme project is named "myTheme," you need:
Required files:
- At least one ".set" file: wx_myTheme_0.set, which goes in /webx/plugins/myTheme/
Name any subsequent ".set" files as wx_myTheme_1.set, wx_myTheme_2.set, etc.
The number of files and numeric order must match with the color definitions
in the Theme init definition.
This initial "0.set" file should match the larger life-size screenshot (not the smaller thumbnails at the right edge.)
- An Auto file: wx_myTheme.auto
This should contain the init macro
and the default strings function, plus any functions which contribute to
preferences/editPreferences or styles or on the control panel, and your "default"
strings function.
- A life-sized screenshot of the Theme in place, with any additional color
choices lined up as smaller screenshots along the right margin. If there
are any interesting or noteworthy features visible on the screenshot, you
can highlight them and annotate the screenshot. See the existing examples
(We did our annotations in Microsoft Powerpoint). For uniformity, we recommend
taking the screenshots with the gray/blue version of the "Simple" Theme in
place, but this is not required.
- A miniature thumbnail screenshot of the UNannotated larger screenshot,
without the other color choices, shrunk down to 164 pixels wide.
- A "ReadMe" HTML file. Place it in the same directory as your screenshots.
Optional files:
- Any custom images can go in: /plugins/myTheme or in the normal image locations
- A Template file: wx_myTheme.tpl
This should contain your edit macros, if your Theme is editable, along with any other special macros associated with your Theme.
- An Envelope file: wx_myTheme_thm.tpl
This should contain only reference macros pointing to macros in your Template file. See the section on Reference Macros for more information.
- A Strings file: wx_myTheme_s_en_US.auto
The full strings function for your Theme.
Component
If your component project is named "myComponent," you need:
Required files:
- An Auto file: wx_myComponent.auto
This should contain the init macro
and the default strings function, plus any functions which contribute to
preferences/editPreferences or styles or on the control panel, and your "default"
strings function.
- A Template file: wx_myComponent.tpl
This should contain your edit macros, along with any other macros associated with your Component.
- An Envelope file: wx_myComponent_compType.tpl
(Where compType ==
"tb", "tl", "ml", or "fl".) This should contain only reference macros pointing
to macros in your Template file. See the section on Reference Macros for more information.
- A Strings file: wx_myComponent_s_en_US.auto
The full strings function for your Component.
- A life-sized screenshot of the Component in place. Annotate the screenshot
with notations about important variable settings or color choices. See the
existing examples (We did our annotations in Microsoft Powerpoint). For
uniformity, we recommend taking the screenshots with the gray/blue version
of the "Simple" Theme in place, but this is not required.
- A miniature thumbnail screenshot of the UNannotated larger screenshot shrunk down to 164 pixels wide.
- A "ReadMe" HTML file. Place it in the same directory as your screenshots.
Optional files:
- Any custom images can go in: /plugins/myComponent, or in the normal image locations
Extension
If your extension project is named "myExtension," you need:
Required files:
- An Auto file: wx_myExtension.auto
This should contain the init macro
and the default strings function, plus any functions which contribute to
preferences/editPreferences or styles or on the control panel, and your "default"
strings function.
- A Template file: wx_myExtension.tpl
This should contain your edit macros, along with any other macros associated with your Extension.
- A Strings file: wx_myExtension_s_en_US.auto
The full strings function for your Extension.
- A life-sized screenshot of the Extension in place. Annotate the screenshot
with notations about important variable settings or color choices. See the
existing examples (We did our annotations in Microsoft Powerpoint). For
uniformity, we recommend taking the screenshots with the gray/blue version
of the "Simple" Theme in place, but this is not required.
- A miniature thumbnail screenshot of the UNannotated larger screenshot shrunk down to 164 pixels wide.
- A "ReadMe" HTML file. Place it in the same directory as your screenshots.
Optional files:
- An Envelope file: wx_myExtension_ext.tpl
This should contain only reference macros pointing to macros in your Template file. See the section on Reference Macros for more information.
- Any custom images can go in: /plugins/myExtension, or in the normal image locations
Folder Item
If your folder item project is named "myFolderItem," you need:
Required files:
- An Auto file: wx_myFolderItem.auto
This should contain all the macros for the project, except the main strings function.
- A Strings file: wx_myFolderItem_s_en_US.auto
The full strings function for your Folder Item.
- A life-sized screenshot of the Folder Item in place. Annotate the screenshot
with notations about important variable settings or color choices. See the
existing examples (We did our annotations in Microsoft Powerpoint). For
uniformity, we recommend taking the screenshots with the gray/blue version
of the "Simple" Theme in place, but this is not required.
- A miniature thumbnail screenshot of the UNannotated larger screenshot shrunk down to 164 pixels wide.
- A "ReadMe" HTML file. Place it in the same directory as your screenshots.
Optional files:
- Any custom images can go in: /plugins/myFolderItem, or in the normal image locations
User Item
If your user item project is named "myUserItem," you need:
Required files:
- An Auto file: wx_myUserItem.auto
This should contain all the macros for the project, except the main strings function.
- A Strings file: wx_myUserItem_s_en_US.auto
The full strings function for your User Item.
- A life-sized screenshot of the User Item in place. Annotate the screenshot
with notations about important variable settings or color choices. See the
existing examples (We did our annotations in Microsoft Powerpoint). For
uniformity, we recommend taking the screenshots with the gray/blue version
of the "Simple" Theme in place, but this is not required.
- A miniature thumbnail screenshot of the UNannotated larger screenshot shrunk down to 164 pixels wide.
- A "ReadMe" HTML file. Place it in the same directory as your screenshots.
Optional files:
- Any custom images can go in: /plugins/myUserItem, or in the normal image locations
You can proceed one of two ways to build your first project:
- 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.
- 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.
- 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.
- 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.
- Put any custom images into a folder called "myStuff" inside /plugins.
- Create the screenshots myStuffL.gif and myStuff.gif, and the
readme file readme.html. Place these in your "myStuff" folder.
- 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.
- 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.
- Open the file wx_zdemoTheme.tpl and rename it "wx_myStuff.tpl".
- 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).
- 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.)
- Edit the init function for the new theme (first one in the wx_myStuff.auto file) as follows.
- If you already have an init_myStuff() function elsewhere, feel free to rename this to init_myStuff_wcms() or something similar.
- First, find the function ShortTheme().
- 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.
- Next, find the method plugSetVersion().
- 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.
- Next, find the method plugSetWcmsFiles().
- Replace the 1st parameter "demo" with "myStuff".
- Replace the 2nd parameter "demo.gif" with "myStuff.gif.
- Replace the 3rd and 4th parameters with the width and height, respectively, of myStuff_sm.gif.
- Replace the 5th parameter "demoL.gif" with "myStuffL.gif.
- Replace the 6th and 7th parameters with the width and height, respectively, of myStuff_lg.gif.
- Replace, if necessary, the 8th parameter with the URL where users may obtain support for this project (required).
- Next, find the method plugsetTplfiles().
- The first parameter should already read "wx_myStuff.auto".
- 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.
- The next method, plugSetStringProps(), should be OK as is after your search/replace.
- Find the next method, plugSetEditables().
- 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.
- 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 "".
- The next method is plugSetInterfaceHooks(). This method is optional if you don't have any arguments for it.
- 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 "".
- 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 "".
- If your theme needs to add a link (or links) in the control
panel, create a WCJS command or function with the link and add the name of
the command/function (not quoted) as the 4th, 5th, 6th and/or 7th parameter,
depending on where you want the link(s) to appear.
4th: Services section.
5th: Customizing section.
6th: User section.
7th: Site section.
This
command/function must live in wx_myStuff.auto file. You can copy/edit the
demoExtControlPanelLink() in wx_demoExt.auto if you wish. The last two parameters
allow you to put HTML in the sysop-only section of user preferences, in the
same way as the others work.
- If your theme needs to add HTML on the user preferences page in the
sysop section
put the name of your WCJS style command or function in as the 8th and 9th parameters (edit prefs, edited prefs).
If your theme needs to add a HTML on the user preferences page in the
profile section
put the name of your WCJS style command or function in as the 10th and 11th parameters (edit prefs, edited prefs). Both of these work the same as all the others in this function.
- The last method is plugSetThemeHooks(). This method is optional if you don't have any arguments for it.
If your theme needs to place a link or call a macro in
one of the Theme cells (top, bottom, nav, multi-purpose), create a WCTL macro
(or WCJS command without any parameters) containing the link or the call. Your component can merely
place itself in the optional items menu for the indicated cell to give the
sysop an option of where to place the call or link, or it can select itself
as the default location. These parameters work in pairs. Parameters 1 and
2 should contain, respectively, the name of the macro you want to be called
in the theme top cell (in quotes), and 0 if it should merely appear in the
menu, or 1 if it should enable itself. Parameters 3 and 4 contain the same
thing for the bottom cell, parameters 5 and 6 contain the same thing for
the nav cell, and parameters 7 and 8 contain the same thing for the multi-purpose
cell. Parameters 9 and 10, and 11 and 12 are for the content cell top, and content cell bottom, respectively. Look at "macro whichLiveX" in wx_livex.tpl for an example of a macro
which can be called in the top cell, bottom cell, nav cell or multi-purpose
cell, and which is formatted differently depending on where it's called.
This macro should go in your wx_myStuff.tpl file.
- Look at the bottom of the init function. If you are using any of the
arguments for plugSetThemeHooks, you will need two lines like this for each
cell where you want your macro to appear in the menu of choices:
For the nav cell:
if ( !libraryGlobal.optionalItemsPalette.nav ) libraryGlobal.optionalItemsPalette.nav = new Object();
libraryGlobal.optionalItemsPalette.nav.myStuff = myStuffArray;
Comment out, or remove, the lines which are not needed. For an example
of an extension using four positions, see the init function in wx_livex.auto
- If you have no special Theme functions and no editable parameters, skip to step 18 and test, and if all is well, you're done.
- If you have editable parameters, open the example file "wx_zdemoTheme.tpl"
and copy the JavaScript command "editDemoTheme" and WCTL macro "editDemoThemeForm".
Open your "wx_myStuff.tpl", and paste the copied command and macro into the
top of the file.
- Select the code you just pasted in, and use search-and-replace
on the selected text to replace all instances of the string "demoTheme" with
"myStuff". This will work as-is, for now. After you're sure everything
is working you can go back later and create an edit form for your editable
parameters.
- If you have defined an envelope filename in parameter 3 of plugSetTplFiles,
create a file named wx_myStuff_thm.tpl (or whatever filename matches what
you defined). If defined in plugsetTplfiles, this file
must exist (but is not required to contain any code - a simple "this file
intentionally left empty" comment will suffice, although simply removing it from plugSetTplFiles is probably simpler). We'll deal with the contents
of this file later.
- Place the newly created folder "myStuff", containing the screenshots
and the readme file and our set files, in the /plugins directory
of your Web Crossing server.
- Copy the files you need, depending on the options you've chosen
(possibly up to four files: wx_myStuff.auto, wx_myStuff.tpl, wx_myStuff_thm.tpl,
and wx_myStuff_s_en_US.auto) to the /webxTemplates directory of your
Web Crossing server. Place any custom images where they need to go.
- If you used any method to place any of your files except Web Crossing's built in FTP or web file editor, Resynch the server to the filesystem using the link in the Control Panel near the Reset Cache link. Reset the cache in the control panel and test. Make sure the Theme
appears in the control panel > Choose a Theme page, and that you can choose
it and it imports correctly and appears as it should. If you have no special
Theme functions and no editable parameters, and all is well, you're done
and can skip the rest of these instructions.
- If everything works OK, you're ready to localize. Go to your macros,
and select out the first text string in your wx_myStuff.tpl file (or your
wx_myStuff.auto file, if there are any text strings in it). Add another
line to your strings function for the string that needs replacing. The easiest
thing to do is to copy an existing line and then edit it. If the text you
want to localize is, "Link to My Stuff", the line would look something like
this:
langStrs.myStuff.en_US.linkToMyStuff="Link to My Stuff";
You
can call your string anything you want, but naming it something obvious makes
it easier to keep track of later. Just be careful not to duplicate string
names within a function. - Then, each place where "Link to My Stuff" appears in your macro, replace it with this for WCTL:
%% "lang".jscall( "myStuff", "linkToMyStuff" ) // Link to My Stuff %%
or this, for WCJS:
lang( 'myStuff', 'linkToMyStuff' ); // Link to My Stuff
The comments are not necessary but make your code a lot easier to keep track of later.
- Do the same for each string in your project.
- Reset the cache and test both your project itself, and the control
panel "Choose a Theme" page to make sure the text appears properly there,
too. Any missing strings will be replaced by "***" and reported in the logLangErrors.log
file in your root Web Crossing directory, which is readable directly from the /server directory,
or via the Read Logs command in the WCMS developer menu.
- Next, to make sure that your Theme's special functions show up
in the folders in which the Theme is selected, but not in other locations,
you may need to create some reference macros. If you used any of the standard
macros in webxStd-local or webxextn.tpl, you will need to use reference macros.
Otherwise, you can probably try it without reference macros and see if it
works OK without. If functions or macros are showing up in folders where
they are not defined, you'll need to convert those to reference macros. The
reference macro file will go inside the folder macro controlling the
folder where the component is enabled. So you will put your "real" macro
names on the reference macros in the wx_myStuff_thm.tpl file, and change
the names on your macros in your wx_myStuff.tpl file.
- If you have these two macros in your wx_myStuff.tpl file
- myStuffDisplay and myStuff Process - change the names in wx_myStuff.tpl
to (respectively) "myStuff_myStuffDisplay" and "myStuff_myStuffProcess".
- Create three new reference macros, with the original short names, in wx_myStuff_[abbrev].tpl:
%% macro myStuffDisplay %%
%% use myStuff_myStuffDisplay %%
%% endmacro %%
%% macro myStuffProcess %%
%% use myStuff_myStuffProcess %%
%% endmacro %%
- Then, back in wx_myStuff.tpl, change all %% use ... %%
statements and form tags or link URLs which call those three macros, to the
longer names.
%% use myStuff_myStuffDisplay %%
<form action="myStuff_myStuffProcess" method="post">
- Retest once more, and make sure that your Theme works in a subfolder
when it is turned off at the top level, and doesn't appear where it's not
supposed to.
- Choose a name, something like myStuff. Filenames can get kind of long,
so keeping the base name short is a good idea. Less than 10 characters is ideal. In this example "myStuff"
is the name of the component.
- Rename your existing template file, if any, to "wx_myStuff.tpl". Note that case matters.
- Save the example file "wx_demoComp.auto" as "wx_myStuff.auto".
- Use search and replace to replace all instances of the string "demoComp" in this file with "myStuff".
- If your component is not a toolbar, find the init_myStuff function and edit all instances of "toolbar" to:
| Component Type | |
| Top Level | topLevel |
| Folder List | folderList |
| Message List | messageList |
| Toolbar | (OK as is) |
- Create the screenshots myStuff_lg.gif and myStuff_sm.gif, and the
readme file myStuff_readme.html. Place these in a folder called "myStuff".
- Open the example file wx_demoComp_s_en_US.auto and rename it "wx_myStuff_s_en_US.auto".
Do a search-and-replace for all instances of "demoComp" and replace with
"myStuff". Edit the "nameComp", "editExplanatoryText", and "descrComp" 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 Component 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.)
- Edit the init function for the new component (first one in the wx_myStuff.auto file) as follows:
- If you already have an init_myStuff() function elsewhere, feel free to rename this to init_myStuff_wcms() or something similar.
- First, find the function ShortComponent(). There is only
one parameter, the component type. Use "topLevel", "messageView", "folderView",
or "toolbar", as you did just above in step 5.
- Next, find the method plugSetVersion().
- 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.
- Next, find the method plugSetWcmsFiles().
- Replace the 1st parameter "demo" with "myStuff".
- Replace the 2nd parameter "demo.gif" with "myStuff_sm.gif.
- Replace the 3rd and 4th parameters with the width and height, respectively, of myStuff_sm.gif.
- Replace the 5th parameter "demoL.gif" with "myStuff_lg.gif.
- Replace the 6th and 7th parameters with the width and height, respectively, of myStuff_lg.gif.
- Replace the 8th parameter with the URL where users may obtain support for this project (required).
- Replace the last parameter "readme.html" with myStuff_readme.html
if you have a readme file for your project. Otherwise, replace with "".
- Next, find the method plugSetTplfiles().
- The first parameter should already read "wx_myStuff.auto".
- The 2nd parameter is the name of your template file, and should be OK as is after your search/replace.
- The default name for the 3rd parameter is OK.
- The next method, plugSetStringProps(), should be OK as is after your search/replace.
- Find the next method, plugSetEditables().
- Set the 1st parameter to 1 if you will have editable properties for your project.
- 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 "".
- The next method is plugSetInterfaceHooks(). This method is optional if you don't have any arguments for it.
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 "".
- 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 "".
- If your theme needs to add a link (or links) in the control
panel, create a WCJS command or function with the link and add the name of
the command/function (not quoted) as the 4th, 5th, 6th and/or 7th parameter,
depending on where you want the link(s) to appear.
4th: Services section.
5th: Customizing section.
6th: User section.
7th: Site section.
This
command/function must live in wx_myStuff.auto file. You can copy/edit the
demoExtControlPanelLink() in wx_demoExt.auto if you wish. The last two parameters
allow you to put HTML in the sysop-only section of user preferences, in the
same way as the others work.
- If your theme needs to add a HTML on the user preferences page in the
sysop section
put the name of your WCJS style command or function in as the 8th and 9th parameters (edit prefs, edited prefs).
If your theme needs to add a HTML on the user preferences page in the
profile section
put the name of your WCJS style command or function in as the 10th and 11th parameters (edit prefs, edited prefs). Both of these work the same as all the others in this function.
- The last method is plugSetThemeHooks(). This method is optional if you don't have any arguments for it. If your project needs to place a link or call a macro in
one of the Theme cells (top, bottom, nav, multi-purpose), create a WCTL macro
(or WCJS command without any parameters) containing the link or the call. Your component can merely
place itself in the optional items menu for the indicated cell to give the
sysop an option of where to place the call or link, or it can select itself
as the default location. These parameters work in pairs. Parameters 1 and
2 should contain, respectively, the name of the macro you want to be called
in the theme top cell (in quotes), and 0 if it should merely appear in the
menu, or 1 if it should enable itself. Parameters 3 and 4 contain the same
thing for the bottom cell, parameters 5 and 6 contain the same thing for
the nav cell, and parameters 7 and 8 contain the same thing for the multi-purpose
cell. Parameters 9 and 10, and 11 and 12 are for the content cell top, and content cell bottom, respectively. Look at "macro whichLiveX" in wx_livex.tpl for an example of a macro
which can be called in the top cell, bottom cell, nav cell or multi-purpose
cell, and which is formatted differently depending on where it's called.
This macro should go in your wx_myStuff.tpl file.
- Look at the bottom of the init function. If you are using any of the
arguments for plugSetThemeHooks, you will need two lines like this for each
cell where you want your macro to appear in the menu of choices:
For the nav cell:
if ( !libraryGlobal.optionalItemsPalette.nav ) libraryGlobal.optionalItemsPalette.nav = new Object();
libraryGlobal.optionalItemsPalette.nav.myStuff = myStuffArray;
Comment out, or remove, the lines which are not needed. For an example
of an extension using all four positions, see the init function in wx_livex.auto
- In the init_myStuff_default_strings function edit the "nameComp", "descrComp",
and "editExplanatoryText" strings as necessary to provide the actual name
of the component as you would like it to appear in the user interface, a
short description of what the component does, and additional text on operation
for the edit page. The last two can be the same, if you like.
- Open the example file "wx_demoComp.tpl" and copy the JavaScript
command "editWrapperdemoComp" and WCTL macro "editWrapperdemoCompForm". Open
your "wx_myStuff.tpl", which contains your existing code, and paste the copied
command and macro into the top of the file.
- Select the code you just pasted in, and use search-and-replace
on the selected text to replace all instances of the string "demoExt" with
"myStuff". Then in the line which sets the WCTL variable "abbrev," change
"tb" to one of the following:
| Component Type | |
| Top Level | tl |
| Folder List | fl |
| Message List | ml |
| Toolbar | (OK as is) |
This will work as-is, for a component without any editable
parameters. After you're sure everything is working you can go back later
and create an edit form if you have sysop-editable parameters. - Using the abbreviation code from the previous step, create files
named wx_myStuff_[abbrev].tpl and wx_myStuff_s_en_US.auto. For example, wx_myStuff_tb.tpl,
or wx_myStuff_fl.tpl. These files must exist but at present are not required
to contain any code - a simple "this file intentionally left empty" comment
will suffice. We'll create the contents for the strings file later, after
we're sure everything works, and deal with the other file in step 22.
- Place the newly created folder "myStuff", containing the screenshots
and the readme file, in the /plugins directory of your Web Crossing
server.
- Copy the four files wx_myStuff.auto, wx_myStuff.tpl, wx_myStuff_[abbrev].tpl,
and wx_myStuff_s_en_US.auto to the /webxTemplates directory of your Web
Crossing server. Place any custom images where they need to go.
- If you used any method to place any of your files except Web Crossing's built in FTP or web file editor, Resynch the server to the filesystem using the link in the Control Panel near the Reset Cache link. Reset the cache in the control panel and test. Make sure the component
appears in the control panel > Choose a Component page, and that you can
choose it and it appears as it should.
- If everything works OK, you're ready to localize. Go to your macros,
and select out the first text string in your wx_myStuff.tpl file (or your
wx_myStuff.auto file, if there are any text strings in it). Add another
line to your strings function in wx_myStuff_s_en_US.auto for each string that needs replacing. The easiest
thing to do is to copy an existing line and then edit it. If the text you
want to localize is, "Link to My Stuff", the line would look something like
this:
langStrs.myStuff.en_US.linkToMyStuff="Link to My Stuff";
You
can call your string anything you want, but naming it something obvious makes
it easier to keep track of later. Just be careful not to duplicate string
names within a function. - Then, each place where "Link to My Stuff" appears in your macro, replace it with this for WCTL:
%% "lang".jscall( "myStuff", "linkToMyStuff" ) // Link to My Stuff %%
or this, for WCJS:
lang( 'myStuff', 'linkToMyStuff' ); // Link to My Stuff
The comments are not necessary but make your code a lot easier to keep track of later.
- Do the same for each string in your project.
- Reset the cache and test both your project itself, and the control
panel "Choose a Theme" page to make sure the text appears properly there,
too. Any missing strings will be replaced by "***" and reported in the logLangErrors.log
file in your Web Crossing root directory, which is readable directly from the /server directory,
or via the Read Logs command in the WCMS developer menu.
- Next, to make sure that your components show up in the folders
in which they're selected, but not in other locations, you'll need to create
some reference macros. The reference macro file will go inside the
folder macro controlling the folder where the component is enabled. So you
will put your "real" macro names on the reference macros in the wx_myStuff_[abbrev].tpl
file, and change the names on your macros in your wx_myStuff.tpl file.
- If you have these three macros in your wx_myStuff.tpl file
- myStuffDisplay, myStuff Process, and folderListItem - change the names
in wx_myStuff.tpl to (respectively) "myStuff_myStuffDisplay", "myStuff_myStuffProcess"
and "myStuff_folderListItem".
- Create three new reference macros, with the original short names, in wx_myStuff_[abbrev].tpl:
%% macro myStuffDisplay %%
%% use myStuff_myStuffDisplay %%
%% endmacro %%
%% macro myStuffProcess %%
%% use myStuff_myStuffProcess %%
%% endmacro %%
%% macro folderListItem %%
%% use myStuff_folderListItem %%
%% endmacro %%
- Then, back in wx_myStuff.tpl, change all %% use ... %%
statements and form tags or link URLs which call those three macros, to the
longer names.
%% use myStuff_myStuffDisplay %%
<form action="myStuff_myStuffProcess" method="post">
- Retest once more, and make sure that your project works in a subfolder
when it is turned off at the top level, and doesn't appear where it's not
supposed to.
- Choose a name, something like myStuff. Filenames can get kind of long,
so keeping the base name short is a good idea. 10 characters or shorter is ideal. In this example "myStuff"
is the name of the extension.
- Rename the existing template file to "wx_myStuff.tpl". Note that case matters.
- Copy the example file "wx_demoExt.auto" and save it as "wx_myStuff.auto".
- Use search and replace to replace all instances of the string "demoExt" in this file with "myStuff".
- Create the screenshots myStuff_lg.gif and myStuff_sm.gif, and the
readme file myStuff_readme.html. Place these in a folder called "myStuff".
- Open the example file wx_demoExt_s_en_US.auto and rename it "wx_myStuff_s_en_US.auto".
Do a search-and-replace for all instances of "demoExt" and replace with
"myStuff". Edit the "extensionName", "editExplanatoryText", and "shortDescr" strings as necessary to
provide the actual name of the extension as you would like it to appear in the
user interface, and a short description of what the extension does. (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.)
- Edit the init function for the new extension (first one in the wx_myStuff.auto file) as follows:
- If you already have an init_myStuff() function elsewhere, feel free to rename this to init_myStuff_wcms() or something similar.
- First, find the function ShortExtension(). If you want your extension only to be turned on and off at the top level, insert a single parameter: "1". Otherwise, leave it blank - no parameters.
- Next, find the method plugSetVersion().
- 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.
- Next, find the method plugSetWcmsFiles().
- Replace the 1st parameter "demo" with "myStuff".
- Replace the 2nd parameter "demo.gif" with "myStuff_sm.gif.
- Replace the 3rd and 4th parameters with the width and height, respectively, of myStuff_sm.gif.
- Replace the 5th parameter "demoL.gif" with "myStuff_lg.gif.
- Replace the 6th and 7th parameters with the width and height, respectively, of myStuff_lg.gif.
- Replace the 8th parameter with the URL where users may obtain support for this project (required).
- Replace the last parameter "readme.html" with myStuff_readme.html
if you have a readme file for your project. Otherwise, replace with "".
- Next, find the method plugSetTplfiles().
- The first parameter should already read "wx_myStuff.auto".
- The 2nd parameter is the name of your template file, and should be OK as is after your search/replace.
- The 3rd parameter is optional if your project will run
at the top level, like a sysop control panel extension. If your project
needs to be run in a subfolder and will be on in some locations and off in
others, you need to specify an envelope file - the third parameter. If you
need this, the default name is OK. If not, remove it or use "".
- The next method, plugSetStringProps(), should be OK as is after your search/replace.
- Find the next method, plugSetEditables().
- Set the 1st parameter to 1 if you will have editable properties for your project.
- The 2nd and 3rd parameters are necessary whether or not the first parameter is set to 1, and the defaults should be OK.
- The next method is plugSetInterfaceHooks(). This method is optional if you don't have any arguments for it.
- If your extension 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 "".
- If your extension 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 "".
- If your extension needs to add a link (or links) in the control
panel, create a WCJS command or function with the link and add the name of
the command/function (not quoted) as the 4th, 5th, 6th and/or 7th parameter,
depending on where you want the link(s) to appear.
4th: Services section.
5th: Customizing section.
6th: User section.
7th: Site section.
This
command/function must live in wx_myStuff.auto file. You can copy/edit the
demoExtControlPanelLink() in wx_demoExt.auto if you wish. The last two parameters
allow you to put HTML in the sysop-only section of user preferences, in the
same way as the others work.
- If your extension needs to add a HTML on the user preferences page in the
sysop section
put the name of your WCJS style command or function in as the 8th and 9th parameters (edit prefs, edited prefs).
If your extension needs to add a HTML on the user preferences page in the
profile section
put the name of your WCJS style command or function in as the 10th and 11th parameters (edit prefs, edited prefs). Both of these work the same as all the others in this function.
- The last method is plugSetThemeHooks(). This method is optional if you don't have any arguments for it. If your project needs to place a link or call a macro in
one of the Theme cells (top, bottom, nav, multi-purpose, content top, content bottom), create a WCTL macro (or WCJS command without any parameters) containing the link or the call. Your component can merely
place itself in the optional items menu for the indicated cell to give the
sysop an option of where to place the call or link, or it can select itself
as the default location. These parameters work in pairs. Parameters 1 and
2 should contain, respectively, the name of the macro you want to be called
in the theme top cell (in quotes), and 0 if it should merely appear in the
menu, or 1 if it should enable itself. Parameters 3 and 4 contain the same
thing for the bottom cell, parameters 5 and 6 contain the same thing for
the nav cell, and parameters 7 and 8 contain the same thing for the multi-purpose
cell. Parameters 9 and 10, and 11 and 12 are for the content cell top, and content cell bottom, respectively. Look at "macro whichLiveX" in wx_livex.tpl for an example of a macro
which can be called in the top cell, bottom cell, nav cell or multi-purpose
cell, and which is formatted differently depending on where it's called.
This macro should go in your wx_myStuff.tpl file.
- Look at the bottom of the init function. If you are using any of the
arguments for plugSetThemeHooks, you will need two lines like this for each
cell where you want your macro to appear in the menu of choices:
For the nav cell:
if ( !libraryGlobal.optionalItemsPalette.nav ) libraryGlobal.optionalItemsPalette.nav = new Object();
libraryGlobal.optionalItemsPalette.nav.myStuff = myStuffArray;
Comment out, or remove, the lines which are not needed. For an example
of an extension using all four positions, see the init function in wx_livex.auto
- In the init_myStuff_default_strings function edit the "extensionName",
"shortDescr", and "editExplanatoryText" strings as necessary to provide the
actual name of the extension as you would like it to appear in the user interface,
a short description of what the extension does, and additional text on operation
for the edit page. The last two can be the same, if you like.
- Open the example file "wx_demoExt.tpl" and copy the JavaScript
command "editWrapperdemoExt" and WCTL macro "editWrapperdemoExtForm". Open
your "wx_myStuff.tpl", which contains your existing code, and paste the copied
command and macro into the top of the file.
- Select the code you just pasted in, and use search-and-replace
on the selected text to replace all instances of the string "demoExt" with
"myStuff". This will work as-is, for an extension without any editable parameters.
After you're sure everything is working, you can go back later and create
an edit form if you have sysop-editable parameters.
- Create files named wx_myStuff_ext.tpl and wx_myStuff_s_en_US.auto.
These files must exist but at present are not required to contain any code
- a simple "this file intentionally left empty" comment will suffice. We'll
create the contents for the strings file later, after we're sure everything
works, and deal with the other file in step 21.
- Place the newly created folder "myStuff", containing the screenshots
and the readme file, in the /plugins directory of your Web Crossing
server.
- Copy the four files wx_myStuff.auto, wx_myStuff.tpl, wx_myStuff_ext.tpl,
and wx_myStuff_s_en_US.auto to the /webxTemplates directory of your Web
Crossing server. Place any custom images where they need to go.
- If you used any method to place any of your files except Web Crossing's built in FTP or web file editor, Resynch the server to the filesystem using the link in the Control Panel near the Reset Cache link. Reset the cache in the control panel and test. Make sure the
extension appears in the control panel > Choose an Extension page, and
that you can choose it and it appears as it should, where it should.
- If everything works OK, you're ready to localize. In the file wx_myStuff_s_en_US.auto, do a global search/replace for all instances of "demoExt" and replace with
"myStuff" if you haven't already done so.
- Then go to your macros, and select out the first text string in
your wx_myStuff.tpl file (or your wx_myStuff.auto file, if there are any
text strings in it). Add another line to your strings function for the string
that needs replacing. The easiest thing to do is to copy an existing line
and then edit it. If the text you want to localize is, "Link to My Stuff",
the line would look something like this:
langStrs.myStuff.en_US.linkToMyStuff="Link to My Stuff";
You
can call your string anything you want, but naming it something obvious makes
it easier to keep track of later. Just be careful not to duplicate string
names within a function. - Then, each place where "Link to My Stuff" appears in your macro, replace it with this for WCTL:
%% "lang".jscall( "myStuff", "linkToMyStuff" ) // Link to My Stuff %%
or this, for WCJS:
lang( 'myStuff', 'linkToMyStuff' ); // Link to My Stuff
The comments are not necessary but make your code a lot easier to keep track of later.
- Do the same for each string in your project.
- Reset the cache and test both your project itself, and the control
panel "Choose an Extension" page to make sure the text appears properly there,
too. Any missing strings will be replaced by "***" and reported in the logLangErrors.log
file in your Web Crossing root directory, which is readable directly from the /server directory,
or via the Read Logs command in the WCMS developer menu.
- If your extension is something like a sysop utility, or something
which is always available sitewide, you won't need a
wx_myStuff_ext.tpl file. However, if your extension contains any macros
distributed in webxextn.tpl or webxStd-local.tpl, and is something which
might only be available in certain folders on your site, you'll need to create
some reference macros. If you're not sure if you need reference macros or
not, try it without and test. The reference macro file will go inside
the folder macro controlling the folder where the extension is enabled.
So you will put your "real" macro names on the reference macros in the wx_myStuff_ext.tpl
file, and change the names on your macros in your wx_myStuff.tpl file.
- If you have these three macros in your wx_myStuff.tpl file
- myStuffDisplay, myStuff Process, and folderListItem - change the names
in wx_myStuff.tpl to (respectively) "myStuff_myStuffDisplay", "myStuff_myStuffProcess"
and "myStuff_folderListItem".
- Create three new reference macros, with the original short names, in wx_myStuff_ext.tpl:
%% macro myStuffDisplay %%
%% use myStuff_myStuffDisplay %%
%% endmacro %%
%% macro myStuffProcess %%
%% use myStuff_myStuffProcess %%
%% endmacro %%
%% macro folderListItem %%
%% use myStuff_folderListItem %%
%% endmacro %%
- Then, back in wx_myStuff.tpl, change all %% use ... %%
statements and form tags or link URLs which call those three macros, to the
longer names.
%% use myStuff_myStuffDisplay %%
<form action="myStuff_myStuffProcess" method="post">
- Retest once more, and make sure that your project works in a subfolder
when it is turned off at the top level, and doesn't appear where it's not
supposed to.
- Choose a name, something like myStuff. Filenames can get kind of long,
so keeping the base name short is a good idea. Ten characters or less is best. In this example "myStuff"
is the name of the folder item.
- Rename your existing template file "wx_myStuff.auto". Note that case matters.
- Copy the function init_demoFdrItem() from the wx_demoFdrItem.auto file to the top of your wx_myStuff.auto file.
- In the text you just pasted, use a case INsensitive search and replace
to replace all instances of the string "demoFdrItem" with "myStuff".
- Create the screenshots myStuff_lg.gif and myStuff_sm.gif, and the
readme file myStuff_readme.html. Place these in a folder called "myStuff".
- Open the example file wx_demoFdrItem_s_en_US.auto and rename it
"wx_myStuff_s_en_US.auto". Do a search-and-replace for all instances of "demoFdrItem"
and replace with "myStuff". Edit the "projName", "shortDescr", and "explanatoryText"
strings as necessary to provide the actual name of the folder item as you
would like it to appear in the user interface, a short description of what
the folder item does, and additional text on operation for the edit page.
The last two can be the same, if you like. Edit the "addmyStuff" string
to return the name of your folder item as it should
appear in the "Add: " row of the text toolbar, and edit the string "addmyStuffAlt"
to return the name of your folder item as it should appear
as an alt tag on your "Add ..." toolbar button. (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.) The last two strings can be deleted unless you want to reuse them.
- Create an icon for your project, called "myStuffIcon.gif", and button sets for each set you want to support - we
can provide you with original button files if you need them. (If you don't
support all the sets we ship with, be sure to note this in the ReadMe file!). Name your
button "addmyStuff.gif". For now, place a copy of your icon in the icon directory you're using and a copy of the button in the button directory you're using. (If you wish, you can copy the icon to each of the icon directories and the button to each of the button directories. Note that the i4 directory is designed for use on a dark background, so your i4 icon should support that.)
- In order for your icon to actually be used for your project, you need to add this line of WCTL to the "add" processing for your folder item:
%% setPathIconFilename( "demoFdrItem.gif" ) %%
, replacing demoFdrItem.gif with the actual name of your icon.
-
Open the example file "wx_demoFdrItem.auto" and copy the three JavaScript functions "sayNodemoFdrItem", "sayNoPagedemoFdrItem", and "folderListBeforedemoFdrItem" into your "wx_myStuff.auto" file, and do a search/replace to replace demoFdrItem with myStuff.
- Edit the init function for the new folder item (first one in the wx_myStuff.auto file) as follows:
- If you already have an init_myStuff() function elsewhere, feel free to rename this to init_myStuff_wcms() or something similar.
- First, find call to the function ShortFolderItem().
- All the existing parameters should be OK after your search/replace.
- Next, find the method plugSetVersion().
- 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.
- Next, find the method plugSetWcmsFiles().
- Replace the 1st parameter "demo" with "myStuff".
- Replace the 2nd parameter "demo.gif" with "myStuff_sm.gif.
- Replace the 3rd and 4th parameters with the width and height, respectively, of myStuff_sm.gif.
- Replace the 5th parameter "demoL.gif" with "myStuff_lg.gif.
- Replace the 6th and 7th parameters with the width and height, respectively, of myStuff_lg.gif.
- Replace the 8th parameter with the URL where users may obtain support for this project (required).
- Replace the last parameter "readme.html" with myStuff_readme.html
if you have a readme file for your project. Otherwise, replace with "".
- Next, find the method plugSetTplfiles().
- The first parameter, and only parameter should already read "wx_myStuff.auto".
- The next method, plugSetStringProps(), should be OK as is after your search/replace.
- Find the next method, plugSetEditables().
- Set the 1st parameter to 1 if you will have editable properties for your folder item or 0 if there are no editable properties. (Note: this only refers to editable properties for the folder item feature itself, not for individual folder items you create and for which you have your own edit UI.)
- The 2nd and 3rd parameters are necessary whether or not the first parameter is set to 1, and the defaults should be OK.
- The next method is plugSetInterfaceHooks(). This method is optional if you don't have any arguments for it. If your project 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.auto, 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.auto. If your theme has no need to do this,
replace both arguments with "".
- If your project 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.auto. 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 "".
- If your project needs to add a link (or links) in the control
panel, create a WCJS command or function with the link and add the name of
the command/function (not quoted) as the 4th, 5th, 6th and/or 7th parameter,
depending on where you want the link(s) to appear.
4th: Services section.
5th: Customizing section.
6th: User section.
7th: Site section.
This
command/function must live in wx_myStuff.auto file. You can copy/edit the
demoExtControlPanelLink() in wx_demoExt.auto if you wish. The last two parameters
allow you to put HTML in the sysop-only section of user preferences, in the
same way as the others work.
- If your project needs to add a HTML on the user preferences page in the
sysop section
put the name of your WCJS style command or function in as the 8th and 9th parameters (edit prefs, edited prefs).
If your project needs to add a HTML on the user preferences page in the
profile section
put the name of your WCJS style command or function in as the 10th and 11th parameters (edit prefs, edited prefs). Both of these work the same as all the others in this function.
- The next method is plugSetThemeHooks(). This method is optional if you don't have any arguments for it. If your project needs to place a link or call a macro in
one of the Theme cells (top, bottom, nav, multi-purpose), create a WCTL macro
(or WCJS command without any parameters) containing the link or the call. Your component can merely
place itself in the optional items menu for the indicated cell to give the
sysop an option of where to place the call or link, or it can select itself
as the default location. These parameters work in pairs. Parameters 1 and
2 should contain, respectively, the name of the macro you want to be called
in the theme top cell (in quotes), and 0 if it should merely appear in the
menu, or 1 if it should enable itself. Parameters 3 and 4 contain the same
thing for the bottom cell, parameters 5 and 6 contain the same thing for
the nav cell, and parameters 7 and 8 contain the same thing for the multi-purpose
cell. Parameters 9 and 10, and 11 and 12 are for the content cell top, and content cell bottom, respectively. Look at "macro whichLiveX" in wx_livex.tpl for an example of a macro
which can be called in the top cell, bottom cell, nav cell or multi-purpose
cell, and which is formatted differently depending on where it's called.
This macro should go in your wx_myStuff.tpl file.
- Next are plugCheckButtonAccess and plugCheckPageAccess. If you have no special need to do an extra level of access checks, do nothing. If you do want to restrict access to the "add" buttons and pages, edit the functions sayNomyStuff and sayNoPagemyStuff further down the page to return 1 or 0 for the type of access checks you need to do. You'll also need to edit the string "accessInfoString" definition to describe the type of user who can add your project, for the user interface.
- Find plugFolderListBeforeText. You may ignore this unless your project needs to place some HTML or text on the page above the entire folder listing.
- Next is plugHostOnly. If set to 1, this will not appear on the "enable for this folder" pages at the folder level. It can only be turned on or off at the top level, and thus it will be a host/sysop-only function.
- Last is enableFdrItemOnInstall. UNcomment this line (as well as a few additional marked lines at the top of the init function) to have your folder item automatically turn itself on when it is installed for the first time.
- Look at the bottom of the init function. If you are using any of the
arguments for plugSetThemeHooks, you will need two lines like this for each
cell where you want your macro to appear in the menu of choices:
For the nav cell:
if ( !libraryGlobal.optionalItemsPalette.nav ) libraryGlobal.optionalItemsPalette.nav = new Object();
libraryGlobal.optionalItemsPalette.nav.myStuff = myStuffArray;
Comment out, or remove, the lines which are not needed. For an example
of an extension using all four positions, see the init function in wx_livex.auto
- Open the example file "wx_demoFdrItem.auto" and copy the JavaScript command
"editWrapperdemoFdrItem" and WCTL macro "editWrapperdemoFdrItemForm". Open
your "wx_myStuff.auto" file, which contains your existing code, and paste
the copied command and macro into the top of the file just below the init
function.
- Select the code you just pasted in, and use search-and-replace
on the selected text to replace all instances of the string "demoFdrItem"
with "myStuff". This will work as-is, for a folder item without any editable
parameters. After you're sure everything is working, you can go back later
and create an edit form if you have sysop-editable parameters.
- Place the newly created folder "myStuff", containing the screenshots and the readme file, in the webx/html/plugins directory of your Web Crossing server. If you are using the built-in FTP server, just go to the "plugins" directory and place the folder there.
- Copy the two files wx_myStuff.auto and wx_myStuff_s_en_US.auto to the webxTemplates directory of your Web Crossing server. Place any custom images where they need to go.
- If you used any method to place any of your files except Web Crossing's built in FTP or web file editor, Resynch the server to the filesystem using the link in the Control Panel near the Reset Cache link.
Reset the cache in the control panel and test. Make sure the folder
item appears in the control panel > Enable Folder Items page, and that
you can choose it and it appears as it should, where it should.
- If everything works OK, you're ready to localize. Go to your macros,
and select out the first text string in your wx_myStuff.auto file. Add another
line to your strings function for the string that needs replacing. The easiest
thing to do is to copy an existing line and then edit it. If the text you
want to localize is, "Link to My Stuff", the line would look something like
this:
langStrs.myStuff.en_US.linkToMyStuff="Link to My Stuff";
You
can call your string anything you want, but naming it something obvious makes
it easier to keep track of later. Just be careful not to duplicate string
names within a function. - Then, each place where "Link to My Stuff" appears in your macro, replace it with this for WCTL:
%% "lang".jscall( "myStuff", "linkToMyStuff" ) // Link to My Stuff %%
or this, for WCJS:
lang( 'myStuff', 'linkToMyStuff' ); // Link to My Stuff
The comments are not necessary but make your code a lot easier to keep track of later.
- Do the same for each string in your project.
- Reset the cache and test both your project itself, and the control
panel "Choose a Folder Item" page to make sure the text appears properly
there, too. Any missing strings will be replaced by "***" and reported in
the logLangErrors.log file in your Web Crossing root directory, which is readable directly
from the /server directory, or via the Read Logs command in the WCMS developer menu.
- Choose a name, something like myStuff. Filenames can get kind of long,
so keeping the base name short is a good idea. Ten characters or less is best. In this example "myStuff"
is the name of the user item.
- Rename your existing template file "wx_myStuff.auto". Note that case matters.
- Copy the function init_demoUserItem() from the wx_demoUserItem.auto file at the top of your wx_myStuff.auto file.
- In the text you just pasted, use search and replace to replace all instances of the string "demoUserItem" with "myStuff".
- Create the screenshots myStuff_lg.gif and myStuff_sm.gif, and the
readme file myStuff_readme.html. Place these in a folder called "myStuff".
- Open the example file wx_demoUserItem_s_en_US.auto and rename it
"wx_myStuff_s_en_US.auto". Do a search-and-replace for all instances of "demoUserItem"
and replace with "myStuff". Edit the "projName", "shortDescr", and "explanatoryText"
strings as necessary to provide the actual name of the user item as you would
like it to appear in the user interface, a short description of what the
user item does, and additional text on operation for the edit page. The
last two can be the same, if you like. Your user item can put a button in
the toolbar if you'd like. If you're doing this, edit the "openText" string
to return the name of your user item as it should appear in the text toolbar,
and edit the string "openButtonAlt" to return an alt tag for your toolbar
button. If you aren't using a toobar button, you can delete both of these
lines. (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.)
- Edit the init function for the new user item (first one in the wx_myStuff.auto file) as follows:
- If you already have an init_myStuff() function elsewhere, feel free to rename this to init_myStuff_wcms() or something similar.
- First, find the function ShortUserItem().
- Leave the 1st parameter alone.
- Change the 2nd parameter to a 0 if your user item should't be enabled by default, before the user makes a choice.
- Change the 3rd paramter to a 0 if your user item is not contributing a button/link to the toolbar
- If the 3rd parameter == 1, the last 4 parameters are required,
otherwise they can be set to "" or removed. The defaults are OK if you need
them there. If you include the last 3 parameters, edit them so they have
unique names, and also edit the three next lines to match, as well as the
names of these functions further down in the file. If you remove the last
three parameters or set them to "", comment out the next three lines.
- Next, find the method plugSetVersion().
- 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.
- Next, find the method plugSetWcmsFiles().
- Replace the 1st parameter "demo" with "myStuff".
- Replace the 2nd parameter "demo.gif" with "myStuff_sm.gif.
- Replace the 3rd and 4th parameters with the width and height, respectively, of myStuff_sm.gif.
- Replace the 5th parameter "demoL.gif" with "myStuff_lg.gif.
- Replace the 6th and 7th parameters with the width and height, respectively, of myStuff_lg.gif.
- Replace the 8th parameter with the URL where users may obtain support for this project (required).
- Replace the last parameter "readme.html" with myStuff_readme.html
if you have a readme file for your project. Otherwise, replace with "".
- Next, find the method plugSetTplfiles().
- The first parameter should already read "wx_myStuff.auto".
- The 2nd and 3rd parameters should be "", or missing, for user items.
- The next method, plugSetStringProps(), should be OK as is after your search/replace.
- Find the next method, plugSetEditables().
- Set the 1st parameter to 1 if you will have editable properties for your user item.
- The 2nd and 3rd parameters are necessary whether or not the first parameter is set to 1, and the defaults should be OK.
- The next method is plugSetInterfaceHooks(). This method is optional if you don't have any arguments for it. If your project 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.auto, 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.auto. If your theme has no need to do this,
replace both arguments with "".
- If your project 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.auto. 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 "".
- If your project needs to add a link (or links) in the control
panel, create a WCJS command or function with the link and add the name of
the command/function (not quoted) as the 4th, 5th, 6th and/or 7th parameter,
depending on where you want the link(s) to appear.
4th: Services section.
5th: Customizing section.
6th: User section.
7th: Site section.
This
command/function must live in wx_myStuff.auto file. You can copy/edit the
demoExtControlPanelLink() in wx_demoExt.auto if you wish. The last two parameters
allow you to put HTML in the sysop-only section of user preferences, in the
same way as the others work.
- If your project needs to add a HTML on the user preferences page in the
sysop section
put the name of your WCJS style command or function in as the 8th and 9th parameters (edit prefs, edited prefs).
If your project needs to add a HTML on the user preferences page in the
profile section
put the name of your WCJS style command or function in as the 10th and 11th parameters (edit prefs, edited prefs). Both of these work the same as all the others in this function.
- The last method is plugSetThemeHooks(). This method is optional if you don't have any arguments for it. If your project needs to place a link or call a macro in
one of the Theme cells (top, bottom, nav, multi-purpose), create a WCTL macro
(or WCJS command without any parameters) containing the link or the call. Your component can merely
place itself in the optional items menu for the indicated cell to give the
sysop an option of where to place the call or link, or it can select itself
as the default location. These parameters work in pairs. Parameters 1 and
2 should contain, respectively, the name of the macro you want to be called
in the theme top cell (in quotes), and 0 if it should merely appear in the
menu, or 1 if it should enable itself. Parameters 3 and 4 contain the same
thing for the bottom cell, parameters 5 and 6 contain the same thing for
the nav cell, and parameters 7 and 8 contain the same thing for the multi-purpose
cell. Parameters 9 and 10, and 11 and 12 are for the content cell top, and content cell bottom, respectively. Look at "macro whichLiveX" in wx_livex.tpl for an example of a macro
which can be called in the top cell, bottom cell, nav cell or multi-purpose
cell, and which is formatted differently depending on where it's called.
This macro should go in your wx_myStuff.tpl file.
- Find plugSetUserPrefsEditability. Set this to 1 if you want the user to have the option to turn your project off in their user preferences. Set it to 0 if it doesn't show as an option (i.e. is always on.)
- Next is plugCheckButtonAccess. If you have no special need to do an extra level of access checks, do nothing. If you do want to restrict access rights to buttons and pages, edit the functions sayNomyStuff and sayNoPagemyStuff further down the page to return 1 or 0 for the type of access checks you need to do.
- Next is plugToolbarLink. If you need to replace the default a tag for the user item button or link in the toolbar, edit the function toolbarLinkmyStuff below to replace the entire "<a href=.....>" tag.
- Last is plugButtonBeforeText. This method allows you to place text or code before the toolbar button or link. Edit the function buttonBeforemyStuff below, to return the material you want to appear.
- Look at the bottom of the init function. If you are using any of the
arguments for plugSetThemeHooks, you will need two lines like this for each
cell where you want your macro to appear in the menu of choices:
For the nav cell:
if ( !libraryGlobal.optionalItemsPalette.nav ) libraryGlobal.optionalItemsPalette.nav = new Object();
libraryGlobal.optionalItemsPalette.nav.myStuff = myStuffArray;
Comment out, or remove, the lines which are not needed. For an example
of an extension using all four positions, see the init function in wx_livex.auto
- Open the example file "wx_demoUserItem.auto" and copy the JavaScript
command "editWrapperdemoUserItem" and WCTL macro "editWrapperdemoUserItemForm".
Open your "wx_myStuff.auto" file, which contains your existing code, and
paste the copied command and macro into the top of the file just below the
init function.
- Select the code you just pasted in, and use search-and-replace
on the selected text to replace all instances of the string "demoUserItem"
with "myStuff". This will work as-is, for a user item without any editable
parameters. After you're sure everything is working, you can go back later
and create an edit form if you have sysop-editable parameters.
- Place the newly created folder "myStuff", containing the screenshots
and the readme file, in the webx/html/plugins directory of your Web Crossing
server. (If you're using the built-in FTP server, you can just put the folder in the plugins directory.)
- Copy the two files wx_myStuff.auto and wx_myStuff_s_en_US.auto to the /webxTemplates directory of your Web Crossing server. Place any custom images where they need to go.
- If you used any method to place any of your files except Web Crossing's built in FTP or web file editor, Resynch the server to the filesystem using the link in the Control Panel near the Reset Cache link. Reset the cache in the control panel and test. Make sure the user
item appears in the control panel > Choose a User Item page, and that
you can choose it and it appears as it should, where it should.
- If everything works OK, you're ready to localize. Go to your macros,
and select out the first text string in your wx_myStuff.auto file. Add another
line to your strings function for the string that needs replacing. The easiest
thing to do is to copy an existing line and then edit it. If the text you
want to localize is, "Link to My Stuff", the line would look something like
this:
langStrs.myStuff.en_US.linkToMyStuff="Link to My Stuff";
You
can call your string anything you want, but naming it something obvious makes
it easier to keep track of later. Just be careful not to duplicate string
names within a function. - Then, each place where "Link to My Stuff" appears in your macro, replace it with this for WCTL:
%% "lang".jscall( "myStuff", "linkToMyStuff" ) // Link to My Stuff %%
or this, for WCJS:
lang( 'myStuff', 'linkToMyStuff' ); // Link to My Stuff
The comments are not necessary but make your code a lot easier to keep track of later.
- Do the same for each string in your project.
- Reset the cache and test both your project itself, and the control
panel "Choose a User Item" page to make sure the text appears properly there,
too. Any missing strings will be replaced by "***" and reported in the logLangErrors.log
file in your Web Crossing root directory, which is readable directly from the /server directory,
or via the Read Logs command in the WCMS developer menu.
Copyright © 1996-2003 by Web Crossing, Inc., San Francisco, California.