home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1997 May
/
Pcwk0597.iso
/
borland
/
ib
/
setups
/
intrabld
/
data.z
/
SERVER.JFM
< prev
next >
Wrap
Text File
|
1996-11-13
|
13KB
|
464 lines
/****************************************************************************\
* *
* Server.jfm -- Server Configuration Sample Form *
* *
* Server.jfm is a stand-alone sample file. But it is more than just a sample.*
* You can actually use this form to configure the system registry settings *
* for the IntraBuilder server. The form demonstrates the use of external *
* functions, in this case Windows 32 API functions. The Form_onServerLoad *
* method creates a Registry object, which is used in that method as well as *
* the saveButton_onServerClick method to read and write registry values. *
* *
* Dependencies: Registry.js (contains the Registry class definition) *
* *
* Updated 11/13/96 by IntraBuilder Samples Group *
* $Revision: 1.14 $ *
* *
* Copyright (c) 1996, Borland International, Inc. All rights reserved. *
* *
\****************************************************************************/
#include "WINREG.H"
//
// Define the registry key for the IntraBuilder settings
//
#define SERVER_REG_KEY "SOFTWARE\\Borland\\IntraBuilder\\1.0"
// {End Header} Do not remove this comment//
// Generated on 11/13/96
//
var f = new serverForm();
f.open();
class serverForm extends Form {
with (this) {
onServerLoad = class::form_onServerLoad;
height = 15;
left = 0;
top = 0;
width = 78;
title = "IntraBuilder Server Configuration";
}
with (this.rule1 = new Rule(this)){
top = 2;
size = 2;
right = 74;
pageno = 0;
}
with (this.rule2 = new Rule(this)){
top = 13.5;
size = 2;
right = 74;
pageno = 0;
}
with (this.rule3 = new Rule(this)){
top = 7;
size = 2;
right = 74;
pageno = 2;
}
with (this.Title = new HTML(this)){
height = 2;
width = 74;
color = "black";
alignHorizontal = 1;
text = "<H1>IntraBuilder Server Configuration</H1>";
}
with (this.pathHTML = new HTML(this)){
height = 1.1667;
top = 3;
width = 34;
color = "black";
text = "Path to IntraBuilder Server Agent";
}
with (this.pathText = new Text(this)){
left = 34;
top = 3;
width = 40;
value = "";
}
with (this.instancesHTML = new HTML(this)){
height = 1.1667;
top = 4.4167;
width = 34;
color = "black";
text = "Number of IntraBuilder Server Agents";
}
with (this.instancesText = new Text(this)){
left = 34;
top = 4.4167;
width = 10;
template = "999";
value = "";
}
with (this.sessionsHTML = new HTML(this)){
height = 1.1667;
top = 6;
width = 34;
color = "black";
text = "Maximum Number of Sessions";
}
with (this.sessionsText = new Text(this)){
left = 34;
top = 6;
width = 10;
template = "999";
value = "";
}
with (this.timeoutHTML = new HTML(this)){
height = 1.1667;
top = 7.5;
width = 34;
color = "black";
text = "Session Timeout";
}
with (this.timeoutText = new Text(this)){
left = 34;
top = 7.4167;
width = 10;
template = "9999999";
value = "";
}
with (this.IntraBuilderHTML = new HTML(this)){
height = 1;
top = 14;
width = 74;
color = "black";
text = {||"<ADDRESS>Generated by IntraBuilder on " + new Date() + "</ADDRESS>"};
pageno = 0;
}
with (this.saveButton = new Button(this)){
onServerClick = class::saveButton_onServerClick;
top = 9;
width = 10.5;
text = "Save";
}
with (this.resetButton = new Reset(this)){
onClick = class::resetButton_onClick;
left = 18;
top = 9;
width = 9;
text = "Reset";
}
with (this.noteHTML = new HTML(this)){
height = 1;
top = 12;
width = 74;
color = "red";
text = "(Note: changes do not take effect until you restart the IntraBuilder Server)";
pageno = 0;
}
with (this.remoteAgentsButton = new Button(this)){
onServerClick = {;this.form.pageno = 2};
left = 48;
top = 4.4167;
width = 24;
text = "Define Remote Agents...";
}
with (this.html1 = new HTML(this)){
height = 2;
width = 74;
color = "black";
alignHorizontal = 1;
text = "<H1>Remote Agent Configuration</H1>";
pageno = 2;
}
with (this.remoteAgentsListBox = new ListBox(this)){
height = 3;
left = 24;
top = 3;
width = 32;
pageno = 2;
}
with (this.agentIDHTML = new HTML(this)){
height = 1;
top = 8;
width = 18;
visible = false;
color = "black";
alignVertical = 1;
alignHorizontal = 2;
text = "Agent ID: ";
pageno = 2;
}
with (this.agentIDText = new Text(this)){
visible = false;
left = 20;
top = 8;
width = 4;
value = "";
pageno = 2;
}
with (this.userNameHTML = new HTML(this)){
height = 1;
top = 9;
width = 18;
visible = false;
color = "black";
alignVertical = 1;
alignHorizontal = 2;
text = "User Name: ";
pageno = 2;
}
with (this.userNameText = new Text(this)){
visible = false;
left = 20;
top = 9;
width = 16;
value = "";
pageno = 2;
}
with (this.machineNameHTML = new HTML(this)){
height = 1;
top = 10;
width = 18;
visible = false;
color = "black";
alignVertical = 1;
alignHorizontal = 2;
text = "Machine Name: ";
pageno = 2;
}
with (this.machineNameText = new Text(this)){
visible = false;
left = 20;
top = 10;
width = 16;
value = "";
pageno = 2;
}
with (this.deleteButton = new Button(this)){
onServerClick = class::deleteButton_onServerClick;
left = 12;
top = 4.5;
width = 10.5;
text = "Delete";
pageno = 2;
}
with (this.updateButton = new Button(this)){
onServerClick = class::updateButton_onServerClick;
left = 12;
top = 3;
width = 10.5;
text = "Update";
pageno = 2;
}
with (this.addButton = new Button(this)){
onServerClick = class::addButton_onServerClick;
top = 3;
width = 10.5;
text = "Add";
pageno = 2;
}
with (this.backButton = new Button(this)){
onServerClick = {;this.form.pageno = 1};
top = 4.5;
width = 10.5;
text = "Back";
pageno = 2;
}
with (this.saveAgentButton = new Button(this)){
onServerClick = class::saveAgentButton_onServerClick;
visible = false;
left = 42;
top = 8;
width = 14;
text = "Save Agent";
pageno = 2;
}
with (this.abandonAgentButton = new Button(this)){
onServerClick = class::abandonAgentButton_onServerClick;
visible = false;
left = 42;
top = 9.5;
width = 14;
text = "Abandon";
pageno = 2;
}
function form_onServerLoad()
{
// load the registry class library
_sys.scripts.load("registry.js");
// load the registry values
form.registry = new Registry(HKEY_LOCAL_MACHINE, SERVER_REG_KEY + "\\Server" );
form.remoteAgents = new Array();
form.maxAgentID = -1;
if (form.registry.error == 0) {
form.pathText.value = form.resetPath = form.registry.queryValue("IntraPath");
form.instancesText.value = form.resetInstances = form.registry.queryValue("Agents");
form.sessionsText.value = form.resetSessions = form.registry.queryValue("MaxSessions");
form.timeoutText.value = form.resetTimeout = form.registry.queryValue("Timeout");
// load remote agent information
form.readRemoteAgents(form);
}
else {
form.pathText.value = "Error reading system registry";
form.instancesText.value = "Error";
form.sessionsText.value = "Error";
form.timeoutText.value = "Error";
form.saveButton.visible = false;
// disable remote agent button
this.remoteAgentsButton.visible = false;
}
}
function readRemoteAgents(oForm)
{
oForm.remoteAgents = new Array();
oForm.maxAgentID = -1;
var nAgentId = -1;
var aValues = oForm.registry.enumValue();
aValues.sort();
for (var i = 0; i < aValues.length; i++)
if (aValues[i].substring(0,6).toUpperCase() == 'REMOTE') {
nAgentID = aValues[i].substring(6,aValues[i].length)
oForm.remoteAgents.add(nAgentID + ", " +
oForm.registry.queryValue(aValues[i]));
if (parseInt(nAgentID) > oForm.maxAgentID)
oForm.maxAgentID = parseInt(nAgentID);
}
oForm.remoteAgentsListBox.options = "array form.remoteAgents";
if (oForm.remoteAgents.length == 0) {
oForm.updateButton.visible = false;
oForm.deleteButton.visible = false;
}
else {
oForm.updateButton.visible = true;
oForm.deleteButton.visible = true;
}
}
function saveButton_onServerClick()
{
this.form.registry.setValue("IntraPath",form.pathText.value);
this.form.registry.setValue("Agents",form.instancesText.value);
this.form.registry.setValue("MaxSessions",form.sessionsText.value);
this.form.registry.setValue("Timeout",form.timeoutText.value);
}
function resetButton_onClick()
{
//Note: this only executes when run in the IntraBuilder IDE
this.form.pathText.value = this.form.resetPath;
this.form.instancesText.value = this.form.resetInstances;
this.form.sessionsText.value = this.form.resetSessions;
this.form.timeoutText.value = this.form.resetTimeout;
}
function showAgentControls(oForm, bShowThem)
{
oForm.agentIDHTML.visible = bShowThem;
oForm.agentIDText.visible = bShowThem;
oForm.userNameHTML.visible = bShowThem;
oForm.userNameText.visible = bShowThem;
oForm.machineNameHTML.visible = bShowThem;
oForm.machineNameText.visible = bShowThem;
oForm.saveAgentButton.visible = bShowThem;
oForm.abandonAgentButton.visible = bShowThem;
}
function addButton_onServerClick()
{
this.form.agentIDText.value = "" + (this.form.maxAgentID + 1);
this.form.userNameText.value = "";
this.form.machineNameText.value = "";
this.form.showAgentControls(this.form, true);
}
function updateButton_onServerClick()
{
var agent = this.form.remoteAgentsListBox.value;
if (agent.length > 0) {
this.form.agentIDText.value = agent.substring(0,agent.indexOf(","));
this.form.userNameText.value = agent.substring(agent.indexOf(",") + 2, agent.indexOf("@"));
this.form.machineNameText.value = agent.substring(agent.indexOf("@") + 1, agent.length);
this.form.showAgentControls(this.form, true);
}
}
function deleteButton_onServerClick()
{
var agent = this.form.remoteAgentsListBox.value;
if (agent.length > 0) {
this.form.registry.deleteValue("Remote" + agent.substring(0,agent.indexOf(",")));
this.form.readRemoteAgents(this.form);
}
}
function saveAgentButton_onServerClick()
{
this.form.registry.setValue("Remote" + this.form.agentIDText.value,
this.form.userNameText.value + "@" + this.form.machineNameText.value);
this.form.showAgentControls(this.form, false);
this.form.readRemoteAgents(this.form);
}
function abandonAgentButton_onServerClick()
{
this.form.showAgentControls(this.form, false);
}
}