| Software Development Documentation | Development Overview | WCTL Template Language | WCTL Commands | WCJS Server-side JavaScript | WCMS Development | Chat Development | Standard Templates & URL Codes | Operator Documentation |
Visit the
Web Crossing's goal in creating the Web Crossing Customization Management Suite (WCMS) is to make it easy for non-technical Web Crossing administrators to customize their sites and add new features. From the sysop perspective, WCMS is a set of menus and forms which allow them to add new features or change the look and feel of their site at the click of a button. Besides look and feel customization, new kinds of predefined objects can be added to the site automatically, appearing in the user interface without any additional scripting.
At the developer level, WCMS is an API which allows developer projects to "plug in" to the Web Crossing user interface automatically, without scripting on the part of the end-user/sysop. Web forms are used for any configuration or setup that is necessary. As a shortcut, these macro sets will be referred to as "projects" in this document.
A project consists of a group of files and images which make use of the WCMS API to provide the sysop of a site with an additional option for a Theme, Component, Extension, Folder Item or User Item. Installing and configuring macros and files is automated in most cases.
The WCMS API allows you to easily create or adapt projects, along with the settings-edit pages necessary to provide sysop control over the variables you create. You can edit an existing Theme or WCMS project or create your own from scratch. You can create a new button set or use an existing one, and include any number of custom images. Projects' file names, file structure, macro construction, etc. must conform to the API in order to work.
Types of Projects
You can create any one of 5 different types of projects:
The list of files required for each given type of project is covered in more detail below.
To help you get started, we've created a number of working developer demo projects which you can study and use as starting points for your own development or adaptations. Look for the files (they're not encrypted) in the Documentation and Developer Support folder on the Plugins Server.
Because of the way the automatic processor works, a variable can have one of three values:
%% 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.
| 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_ |
Examples: path.wrap_leftSide, path.inner_fl_leftSide.
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.
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.). |
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. |
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> |
| 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 |
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.
<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;'>
%% set id "btn1ok" %%
%% set id "btn1ok" %%
%% set id "inp1Post_pstmymsg" %%
For WCJS, you can use the makeButton(), makeIcon() and makeSubmit() functions to simplify button creation. See the documentation for more details.
| 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 |
%% 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 ) %%
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.
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:
href="/WebX/.ee6b280/themeStylesheet/rev.26/sysRev.700/style.css"Translates to: /WebX/location/macroName/user.cssRev/site.cssRev/style.css, where location in this example is ". ee6b280", the macroName is "themeStylesheet", and either rev or sysRev are incremented when the stylesheet has changed.
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:
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.
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.
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.
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 ) %%
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. |
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 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. |
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, Â | 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, Â | 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, Â | 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 ) | 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, Â | 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. |
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:
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.
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.
<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.
Textareas, checkboxes, and radio buttons are similarly constructed. Study the existing files for examples, including examples with popup color-choosers.
Export will write a file (you can choose the name) with all the WCMS variables (everything beginning with "wrap_" or "inner_").
Importing/installing a Set file will not change image SIZES, however, unless you add two additional lines to the top of the Set file before you distribute it. Please also note that if you provide these two lines, and if a user installs your Theme in a folder, the sizes for all images on the site will change, not just the folder. Image sizes are now calculated automatically if a site is using the new button syntax, so this may not be necessary.
Some considerations:
IF you need to set image sizes, these two additional lines must go on line 3 of the Export file, immediately after the "pathBodyTag" line. These set the sizes for images and icons. You must set either both icons and button sizes, or neither.
For example: (all on one line, no spaces or linebreaks until after the final ~)
iconSet=16x14_18x14_10x16_16x14_19x16_35x15_16x14_11x11_12x20_19x14_18x14_8x16_16x16_16x14~ buttonSet=68x30_53x19~Icons:
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
<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.
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 textIn 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.
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.
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.
Required files:
Required files:
Required files:
Required files:
Required files:
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.