home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1997 May
/
Pcwk0597.iso
/
borland
/
ib
/
setups
/
intrabld
/
data.z
/
SMPADMIN.JFM
< prev
next >
Wrap
Text File
|
1996-12-11
|
9KB
|
315 lines
/****************************************************************************\
* *
* SmPAdmin.jfm -- Security Policy Administration Form *
* *
* This form is part of the security administration prebuilt business *
* solution. This is the policy adminstration form. It allows you to define *
* new groups and update existing policies. This form is called from the *
* SmAdmin form. *
* *
* Dependencies: secur21.gif *
* *
* Updated 11/13/96 by IntraBuilder Samples Group *
* $Revision: 1.9 $ *
* *
* Copyright (c) 1996, Borland International, Inc. All rights reserved. *
* *
\****************************************************************************/
#include "security.h"
// {End Header} Do not remove this comment//
// Generated on 11/13/96
//
var f = new smpadminForm();
f.open();
class smpadminForm extends SecurityForm from "SMADMIN.JCF" {
_sys.scripts.load(_sys.env.home() + "APPS\\SHARED\\CONTROLS.CC")
with (this) {
onServerLoad = class::Form_onServerLoad;
color = "fff7c4";
height = 11.5;
left = 0;
top = 0;
width = 76;
title = "Policy Administration";
}
with (this.rule1 = new Rule(this)){
top = 4;
size = 2;
right = 74;
pageno = 0;
}
with (this.rule2 = new Rule(this)){
top = 9.5;
size = 2;
right = 74;
pageno = 0;
}
with (this.actionHTML = new HTML(this)){
height = 1;
left = 12;
top = 2;
width = 30;
color = "400040";
text = "Update Existing Policy";
}
with (this.saveButton = new Button(this)){
onServerClick = class::saveButton_onServerClick;
left = 42;
top = 2;
width = 14;
text = "Save";
}
with (this.exitButton = new Button(this)){
onServerClick = class::exitButton_onServerClick;
left = 58;
top = 2;
width = 14;
text = " Exit ";
}
with (this.policyHTML = new HTML(this)){
height = 1;
top = 4.5;
width = 16;
color = "400040";
text = "Policy name";
}
with (this.policynameHTML = new HTML(this)){
height = 1;
left = 16;
top = 4.5;
width = 16;
color = "black";
text = "policyname";
}
with (this.policynameText = new Text(this)){
visible = false;
left = 16;
top = 4.5;
width = 16;
value = "policyname";
}
with (this.descriptionHTML = new HTML(this)){
height = 1;
top = 5.5;
width = 16;
color = "400040";
text = "Description";
}
with (this.descriptionText = new Text(this)){
left = 16;
top = 5.5;
width = 36;
value = "description";
}
with (this.booleanRadio = new Radio(this)){
height = 1;
top = 7;
width = 42;
text = "Value is Boolean - enter boolean value here: ";
value = true;
}
with (this.numericRadio = new Radio(this)){
height = 1;
top = 8;
width = 42;
text = "Value is Numeric - enter numeric value here: ";
value = false;
}
with (this.numericText = new Text(this)){
left = 42;
top = 8;
width = 12;
value = "0";
}
with (this.errorHTML = new HTML(this)){
height = 3;
top = 4.5;
width = 70;
color = "black";
text = "Error loading group administration form. Notify system administrator.";
pageno = 2;
}
with (this.backButton = new Button(this)){
onServerClick = {;this.form.pageno = 1};
top = 8;
width = 20;
text = "Back";
pageno = 2;
}
with (this.GeneratedHTML1 = new GeneratedHTML(this)){
height = 1;
top = 10;
width = 74;
pageno = 0;
}
with (this.booleanCheck = new CheckBox(this)){
height = 1;
left = 42;
top = 7;
width = 18;
text = "On/Yes/True";
checked = false;
}
function Form_onServerLoad()
{
try {
//
// make sure that all the custom properties are set
//
var x = this.copyEntity?1:0;
var x = this.entity.name;
var x = this.security._admin;
var x = this.callingForm.title;
//
// set the action text
//
this.createNew = true;
if (this.entity.name == null)
this.actionHTML.text = "Create New Policy";
else if (this.copyEntity)
this.actionHTML.text = ("Copy " + this.entity.name + " To New Policy");
else {
this.createNew = false;
this.actionHTML.text = "Update Existing Policy";
}
//
// set the control values on this form
//
if (this.createNew) {
this.policynameText.value = new StringEx().replicate(" ",20);
this.policynameText.visible = true;
this.policynameHTML.visible = false;
}
else {
this.policynameHTML.text = this.entity.name;
this.policynameHTML.visible = true;
this.policynameText.visible = false;
}
this.descriptionText.value = (this.entity.description == null) ?
new StringEx().replicate(" ",80) :
this.entity.description;
if (this.entity.boolean) {
this.booleanRadio.value = true;
this.booleanCheck.checked = this.entity.value;
this.numericText.value = "";
}
else {
this.numericRadio.value = true;
this.booleanCheck.checked = null;
if (this.createNew)
this.numericText.value = "";
else
this.numericText.value = ("" + this.entity.value);
}
}
catch (Exception e) {
this.errorHTML.text = "Error loading policy: " + e.message + " (" + e.code + ")";
this.pageno = 2;
}
}
function saveButton_onServerClick()
{
var form = this.form;
try {
// have an exception ready
var error = new Exception();
error.message = "";
error.code = 0;
//
// set the properties of the entity object
//
// policy name
if (form.createNew) {
var name = new StringEx(form.policynameText.value);
name.string = name.leftTrim();
name.string = name.rightTrim();
if (name.length == 0) {
error.message = "Policy name may not be blank";
throw error;
}
else
form.entity.name = name;
}
// description
form.entity.description = form.descriptionText.value;
// boolean
form.entity.boolean = form.booleanRadio.value;
// value
form.entity.value = form.entity.boolean ? form.booleanCheck.checked :
parseInt(form.numericText.value);
//
// call create/update with entity object
//
if (form.createNew)
form.security.createPolicy(form.entity);
else
form.security.updatePolicy(form.entity);
//
// Successful change, no longer in createNew mode
//
if (form.createNew) {
form.createNew = false;
form.actionHTML.text = "Update Existing Policy";
form.policynameHTML.text = form.entity.name;
form.policynameHTML.visible = true;
form.policynameText.visible = false;
}
}
catch (Exception e) {
form.errorHTML.text = "Error saving policy: " + e.message + " (" + e.code + ")";
form.pageno = 2;
}
}
function exitButton_onServerClick()
{
try {
this.form.callingForm.open();
this.form.close();
this.form.release();
}
catch (Exception e) {
this.form.errorHTML.text = "Unable to return to calling form.";
this.form.pageno = 2;
}
}
}