Version 3.1
User's Guide

Editing Counters, Groups and Globals

Previous | Next
Contents

Counters are automatically created as they are used in your HTML pages, but NetCloak also provides a way to create counters manually and to adjust their values. You can also remove counters that are no longer used, which is recommended to maximize the efficiency of the counter database. In addition, you can configure counters to automatically reset at a certain interval.

To edit counters using the NetCloak CGI, choose the Variables… command from the Configuration menu. This will display the NetCloak Lists window, and the first tab is used to edit counters.

To add a new counter, type its name into the Name field, enter a starting value into the Value field, and click the Save Changes button. To remove a counter, select it in the Counter List and click the Remove Counter button.

Clicking on a counter name in the counter list will cause the Name and Value fields to be filled in with that counter's name and current value. To change the value of a counter, click on the counter in the counter list, change the value in the Value field, and click the Save Changes button.

Figure 17: The Counters page of the NetCloak Web admin interface.

When using the plug-in version of NetCloak, you can use the NetCloak CGI to edit counters, as described above, but using the Web admin interface is preferred. To ensure that your updates take effect, quit your web server while you are editing the counters with the CGI. After your edits are complete, quit the NetCloak CGI and re-launch the server.

To edit counters using the NetCloak Web admin interface, go to the admin URL in your Web browser, then click the "Counters" link. This will display the Counters admin page, containing a table of all the currently defined counters.

To add a new counter, click the New… button at the bottom of the page. To edit the name, value, or auto-reset options of an existing counter, click the radio button next to the counter in the table, then click the Edit… button at the bottom of the page. In either case, you are then presented with the Edit Counter web admin page.

To change the name or value of the counter, change the name or value in the text fields, and click the Save Changes button.

For information on using counters within your HTML pages, see the section Commands: Counters in the Reference Guide.

Resetting Counters Automatically

Each counter you create will, by default, start with the value you assign it, and increment by one each time an INSERT_COUNT command is processed, forever. However, you can create counters that reset to a value you specify on an hourly, daily, weekly, or monthly basis.

To make a counter reset automatically, check the Automatically Reset Counter checkbox.

In the CGI, this will enable the Set To: and Every: fields below. After setting automatic reset options, be sure to click the Save Changes button to save the changes to the counter.

Set To: Enter the value that the resetting counter will reset to at the specified interval.

Every: Click the up and down arrows to specify whether the counter will reset on an hourly, daily, weekly, or monthly basis.

At: If the counter resets on a daily, weekly, or monthly basis, this field becomes enabled. Click the up and down arrows to specify the time of day the counter will reset.

On: If the counter resets on a weekly or monthly basis, this field becomes enabled. Click the up and down arrows to specify what day of the week (for weekly resets) or day of the month (for monthly resets) the counter should reset on.

Figure 18: The NetCloak Web admin Edit Counter page.

In the Web admin interface, click the radio button next to the desired reset interval (every hour, every day, every week, or every month), then select the reset date/time from the popup menus underneath that radio button. Click "Save Changes" for the changes to take effect.

Because the values of counters are important to the Webmaster, NetCloak creates a file called NetCloak Counter Resets within the NetCloak Files folder where it logs the date, the time, the counter name, the current value, and the reset value every time a counter is automatically reset.

Simplifying Maintenance With Groups

There will be times when you want to use a NetCloak command and specify a series of possible criteria. For example, you may want to hide a portion of advanced HTML from early versions of Netscape, Explorer (and maybe even Mosaic) users. Or you may want to show a portion of a page only to those users that are in your internal IP domain, which spans several ranges.

To make these commands easier to use, NetCloak includes a "groups" feature, which allows you to create a group of parameters that can then be used by name within any NetCloak command. You can create and manage groups from within the NetCloak user interface, and then simply refer to the name of the group instead of each item individually in NetCloak commands on your pages. This makes on-going maintenance easier by allowing you to change the group without having to update your HTML pages. It also makes reusing lists easy anywhere on your Web site. Just define the group once and use it anywhere.

Editing groups is done on the Groups page of the NetCloak Web admin interface or the Groups tab of the NetCloak Lists window.

Editing Groups with the CGI

To edit groups from the CGI, select the Variables… command of the Configuration menu and click the Groups tab.

The example above has several groups already created, including one called SuperUsers. To see the items in any group, simply click on it and the Items list will change to a list of the items in the selected group.

Removing a single item or an entire group is as simple as selecting the item or group and clicking the appropriate Remove button.

To create a new group, enter the name of the group into the text entry field underneath the groups list, then click the Add Group button. The currently selected group or item has no effect when adding a group.

To add items to a group, first click on the name of the group in the groups list to select it. Then enter the name of the item to add to the group in the text field beneath the items list and click the Add Item button.

Once you have created your groups, click the OK button and they will be saved to the NetCloak.groups file. Note that you can also edit this file manually with a text editor. Each line in the NetCloak.groups file represents one group.

Editing Groups with a Web Browser

You can also edit groups using the Groups page of the NetCloak Web admin interface. Enter the URL of the NetCloak Web admin page into your Web browser, then click the Groups link at the top of the page.

Figure 19: The NetCloak Web admin Groups page.

To remove a group and all of its items, click the radio button in the Select column next to the group's name, then click the Remove button.

To create a group, click the New… button. To edit an existing group, click the radio button next to the group's name, then click the Edit… button. In either case, you are presented with the Edit Group page.

To change the group name, type the new name into the Group Name field, then click Save Changes.

To add a new item to the group, enter the new item into the New value field, then click the Add Item button.

Figure 20: The NetCloak Web admin Edit Group page.

To remove an item from the group, click the radio button in the Select column next to the item to be removed, then click the Remove button.

To edit an item, click the radio button next to the item, enter the new value for the item in the New value field, then click the Edit Item button.

Using Groups in NetCloak Commands

To use a group in any NetCloak command, refer to it by name within the command, preceded by an exclamation point ("!"). The exclamation point tells NetCloak to look for and use a group rather than try to use the group name as a parameter.

Let's look at the SupportsTables example shown in the sample dialog above. Here is the HTML syntax for showing a table to certain browsers, without using groups:

<HIDE><SHOW_CLIENT Mozilla MSIE Mosaic>
<TABLE>
<TR><TD>…

By creating the SupportsTables group, we simplify this to:

<HIDE><SHOW_CLIENT !SupportsTables>
<TABLE>
<TR><TD>…

Not only does this simplify the HTML, but when a new browser comes out that supports tables, you simply add the browser to the group. No changes are needed to the HTML pages at all.

Figure 21: The Variables page of the NetCloak Web Admin.

Accessing Global Variables

Variables, as we have discussed, are available in three types: Global, Local, and User. Local and User variables last only as long as a page is being served or a user is visiting your site. Because they are relatively temporary, these variables can not be directly edited. Global variables, by contrast, are permanent, and can be set directly using the Web admin interface or the Variables window in the NetCloak CGI.

To edit global variables using the Web admin interface, go to the NetCloak Web admin URL in your Web browser, then click the Global Variables link.

To set global variables with the CGI, select the Variables… command from the Configuration menu, and click the Variables tab.

Creating, modifying, and deleting global variables is easy. To create a variable, simply enter its name and value, and click the Save Changes button. To modify an existing variable, click on it in the Variables list, edit the value, and click Save Changes. To delete a variable, simply select it in the list and click Remove Variable.

Figure 22: The NetCloak Web admin Global Variables page.

To delete a global variable, click the radio button next to the variable's name, then click the Remove button.

To create a new global variable, click the New… button. To edit an existing global variable, click the radio button next to the variable's name, then click the Edit… button. Either way, you are shown the Edit Global Variable page.

Type changes to the variables name and/or value into the text fields, then click the Save Changes button for the change to take effect.

Global variables changed in the CGI or the Web admin pages will be immediately reflected when used in commands on your site. This is an excellent way to simplify site maintenance.

For example, assume each of your pages used a macro for the page header. You could put something like this in the macro:

<HIDE><SHOW_GLOBAL MaintMode "On">
<REDIRECT "http://mysite.com/MaintMode.html">
<SHOW>

Figure 23: The NetCloak Web admin Edit Global Variable page.

"MaintMode.html" could be a page that tells visitors that the site is currently being revised and that they should check back later. Now, any time you need to make major revisions to the site, you can just edit the Global variable so that it's value is "On". When you are done making changes, change the value to "Off" and the site will be accessible again.

Using AppleScript to Access Global Variables

NetCloak includes the ability to set and get global variable values using AppleScript or any application capable of sending AppleEvents.

The Get Global Event

To get the value of a global variable in the NetCloak CGI using AppleScript, use the following script syntax, replacing "varName" with the name of the global variable you want to get:

tell application "NetCloak.acgi"
set varValue to get global "varName"
end tell

This script sets the value of the script variable "varValue" to the value of the global variable. An example script using this syntax, named Get Global via NetCloak.acgi, is in the Sample Scripts folder installed with NetCloak.

Because the NetCloak Plug-In cannot publish its AppleScript dictionary when it is running inside the web server, you must use the raw AppleEvent codes in a script designed to communicate with the NetCloak Plug-In. For example, the equivalent script to talk to the NetCloak Plug-In would look like this:

tell application "WebSTAR 2.1.1"
set varValue to «event NClkGetG» "varName"
end tell

Note two differences: you must "tell" the web server, not the plug-in, what to do; and you must use the raw event code "«event NClkGetG»". To enter the special '«' character, type "option-\" (hold down the option key and press the backslash key), and type "option-shift-\" to enter the '»' character. This is necessary because the plug-in actually becomes part of the web server when it is running, but it cannot modify the web server's AppleScript dictionary. See the Get Global via WebSTAR script in the Sample Scripts folder.

To send the Get Global event to NetCloak using some other application that requires you to enter the AppleEvent codes for the event class, event ID and event parameters, you will need to know the following information. Consult the application's documentation for specific instructions on how to use this information.

Event Class:   'GetG'

Parameters:
The direct parameter '----' of the event is type 'char' and contains the name of the global variable.

Reply:
The direct parameter '----' of the reply event is type 'char' and contains the variable's value.

The Set Global Event

To set the value of a global variable in the NetCloak CGI using AppleScript, use the following script syntax, replacing "varName" and "varValue" with the name of the global variable and the value you want to set it to:

tell application "NetCloak.acgi"
set global "varName" to "varValue"
end tell

An example script using this syntax, named Set Global via NetCloak.acgi, is in the Sample Scripts folder.

Because the NetCloak Plug-In cannot publish its AppleScript dictionary when it is running inside the web server, you must use the raw AppleEvent codes in a script designed to communicate with the NetCloak Plug-In via the web server. For example, the equivalent script to talk to the NetCloak Plug-In would look like this:

tell application "WebSTAR 2.1.1"
«event NClkSetG» "varName" Â
given «class value»:"varValue"
end tell

Note two differences: you must "tell" the web server, not the plug-in, what to do; and you must use the raw event codes. See the "Set Global via WebSTAR" script in the Sample Scripts folder.

To send the Set Global event to NetCloak using some other application that requires you to enter the AppleEvent codes for the event suite, event class and event parameters, you will need to know the following information. Consult the application's documentation for specific instructions on how to use this information.

Event Class:   'SetG'

Parameters:
The direct parameter '----' of the event is type 'char' and contains the name of the global variable.

A 'valu' parameter is also required; it is type 'char' and contains the new value for the global variable.

Reply:
There is no reply to the Set Global event.


Copyright © 1996-2000 Maxum Development Corporation

http://www.maxum.com/
Previous | Next
Contents