home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1997 May
/
Pcwk0597.iso
/
borland
/
ib
/
setups
/
intrabld
/
data.z
/
PROFILE.JCF
< prev
next >
Wrap
Text File
|
1996-12-11
|
8KB
|
289 lines
/****************************************************************************\
* *
* Profile.jcf - Custom Security Form Classes *
* *
* Updated 11/07/96 by IntraBuilder Samples Group *
* $Revision: 1.1 $ *
* *
* Copyright (c) 1996, Borland International, Inc. All rights reserved. *
* *
\****************************************************************************/
//
// smUserProfileForm
//
// You need to set three custom properties of this form:
//
// security - assign a SecurityManager object that has already logged in
// callingForm - assign a form reference. Focus is returned to this form
// changeForm - string with name of the Change Password form
//
class smUserProfileForm extends Form custom {
with (this) {
onServerLoad = class::onServerLoad;
height = 14;
left = 0;
top = 0;
width = 76;
title = "User profile";
}
with (this.nameHTML = new HTML(this)){
height = 1;
top = 5;
width = 14;
color = "black";
text = "User name";
}
with (this.userNameHTML = new HTML(this)){
height = 1;
left = 14;
top = 5;
width = 22;
color = "black";
text = "name";
}
with (this.createHTML = new HTML(this)){
height = 1;
left = 36;
top = 5;
width = 12;
color = "black";
text = "Created";
}
with (this.createdHTML = new HTML(this)){
height = 1;
left = 48;
top = 5;
width = 14;
color = "black";
text = " / / ";
}
with (this.lastLoginHTML = new HTML(this)){
height = 1;
top = 6;
width = 14;
color = "black";
text = "Last login";
}
with (this.loginHTML = new HTML(this)){
height = 1;
left = 14;
top = 6;
width = 22;
color = "black";
text = "login";
}
with (this.descriptHTML = new HTML(this)){
height = 1;
top = 7;
width = 14;
color = "black";
text = "Description";
}
with (this.descriptionHTML = new HTML(this)){
height = 1;
left = 14;
top = 7;
width = 50;
color = "black";
text = "description";
}
with (this.descriptionText = new Text(this)){
visible = false;
left = 14;
top = 7;
width = 50;
value = "";
}
with (this.passButton = new Button(this)){
onServerClick = class::passButton_onServerClick;
top = 8.5;
width = 24;
text = "Change Password...";
}
with (this.descriptButton = new Button(this)){
onServerClick = class::descriptButton_onServerClick;
left = 32;
top = 8.5;
width = 24;
text = "Edit Description...";
}
with (this.groupHTML = new HTML(this)){
height = 1;
top = 10;
width = 64;
color = "black";
text = "Groups";
}
with (this.groupSelect = new ListBox(this)){
height = 3;
top = 11;
width = 64;
}
with (this.resourceHTML = new HTML(this)){
height = 1;
top = 14;
width = 64;
color = "black";
text = "Resources";
}
with (this.resourceSelect = new ListBox(this)){
height = 3;
top = 15;
width = 64;
}
with (this.backButton = new Button(this)){
onServerClick = class::backButton_onServerClick;
top = 18;
width = 10.5;
text = "Back";
}
with (this.errorHTML = new HTML(this)){
height = 4;
left = 1;
top = 7;
width = 80;
color = "black";
text = "Error loading user profile";
pageno = 2;
}
with (this.backButton2 = new Button(this)){
onServerClick = {;this.form.pageno = 1};
left = 1;
top = 11;
width = 10.5;
text = "Back";
pageno = 2;
}
function onServerLoad()
{
try {
this.userNameHTML.text = this.security.getUserName();
this.createdHTML.text = this.security.getCreated();
this.loginHTML.text = this.security.getLogin();
this.descriptionHTML.text = this.security.getDescription();
this.descriptionText.value = this.security.getDescription();
this.gArray = new Array();
this.rArray = new Array();
var tmpVar = "";
var tmpArray = this.security.getGroups();
for (var i = 0; i<tmpArray.count(); i++) {
var tmpVar = (i==0) ? tmpArray.firstKey : tmpArray.nextKey(tmpVar);
this.gArray.add(tmpVar + " - " + tmpArray[tmpVar]);
}
var tmpArray = this.security.getResources();
for (var i = 0; i<tmpArray.count(); i++) {
var tmpVar = (i==0) ? tmpArray.firstKey : tmpArray.nextKey(tmpVar);
this.rArray.add(tmpVar + " - " + tmpArray[tmpVar]);
}
this.groupSelect.options = "array this.gArray";
this.resourceSelect.options = "array this.rArray";
// make sure the change password form is available
var file = this.changeForm.substring(0,this.changeForm.indexOf(".jfm"))
if (file.length == 0)
if (!new File().exists(this.changeForm))
this.passButton.visible = false;
else
if (!new File().exists(file+".jfm") && !new File().exists(file+".jfo"))
this.passButton.visible = false;
}
catch (Exception e) {
this.errorHTML.text = "Error loading user profile: " +
e.message + " (" + e.code + ")";
this.backButton2.visible = false;
this.pageno = 2;
}
}
function passButton_onServerClick()
{
try {
_sys.scripts.load(this.form.changeForm);
var f = eval("new " + this.form.changeFormClass + "()");
f.callingForm = this.form;
f.security = this.form.security;
f.open();
}
catch (Exception e) {
this.visible = false;
this.form.errorHTML.text = "Error loading password form: " +
e.message + " (" + e.code + ")";
this.form.pageno = 2;
}
}
function descriptButton_onServerClick()
{
if (this.text == 'Save') {
this.form.descriptionHTML.text = this.form.descriptionText.value;
this.form.descriptionText.visible = false;
this.form.descriptionHTML.visible = true;
this.text = 'Edit Description';
try {
this.form.security.changeDescription( this.form.descriptionText.value );
}
catch (Exception e) {
this.text = ' - Error - Not Saved - ';
this.onServerClick = {;var x=1}; // dummy event handler
}
}
else {
this.form.descriptionHTML.visible = false;
this.form.descriptionText.visible = true;
this.text = 'Save';
}
}
function backButton_onServerClick()
{
try {
this.form.callingForm.open();
this.form.release();
}
catch (Exception e) {
this.form.errorHTML.text = "Error closing user profile: " +
e.message + " (" + e.code + ")";
this.form.backButton2.visible = true;
this.form.pageno = 2;
}
}
}