home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1998 February
/
CHIP_2_98.iso
/
software
/
pelne
/
optionp
/
ins.cab
/
nnset.inc
< prev
next >
Wrap
Text File
|
1997-10-12
|
5KB
|
162 lines
<%
quote = chr(34)
L_TEXT_TEXT = "text"
L_PASSWORD_TEXT = "password"
isAdmin = Session("IsAdmin")
function checkbox(fieldname, onclickproc, adminonly)
On Error Resume Next
dim val
if mid(fieldname,1,1) = "!" then
fieldname = mid(fieldname,2)
val = not currentobj.Get(fieldname)
else
val = currentobj.Get(fieldname)
end if
if err <> 0 then
checkbox = "<INPUT NAME='chk"+fieldname+"' TYPE='CHECKBOX'>"
alertuser "chk"+fieldname
else
if (not adminonly) or isAdmin then
if val then
output = "<INPUT NAME='chk"+fieldname+"' TYPE='CHECKBOX' CHECKED"
else
output = "<INPUT NAME='chk"+fieldname+"' TYPE='CHECKBOX' "
end if
if onclickproc <> "" then
checkbox = output + " ONCLICK = "+quote + onclickproc + quote+">"
else
checkbox = output + ">"
end if
else
if val then
checkbox = "<IMG ALIGN=middle SRC="+quote+"images/checkon.gif"+quote+">"
else
checkbox = "<IMG ALIGN=middle SRC="+quote+"images/checkoff.gif"+quote+">"
end if
end if
end if
end function
function writeoption(fieldname,value, adminonly)
On Error Resume Next
dim val
val = currentobj.Get(fieldname)
if err <> 0 then
writeoption = "<OPTION>"+value
alertuser fieldname
else
if value = val then
writeoption = "<OPTION SELECTED>"+value
else
if (isadmin or not adminonly) then
writeoption = "<OPTION>"+value
end if
end if
end if
end function
function radio(fieldname,value, onclickproc, adminonly)
On Error Resume Next
dim val
val = currentobj.Get(fieldname)
if err <> 0 then
radio = (printradio(fieldname, False,onclickproc,adminonly)) + ">"
alertuser "rdo"+fieldname
else
if (typename(val)="Boolean") then
output = printradio(fieldname, (val = value),onclickproc,adminonly)
else
if mid(value,1,1) = "!" then
output = printradio(fieldname, (val <> mid(value,2)),onclickproc,adminonly)
else
output = printradio(fieldname, (val = value),onclickproc,adminonly)
end if
end if
radio=output
end if
end function
function printradio(fieldname, checked, onclickproc,adminonly)
dim output
if checked then
chkstr = "CHECKED"
else
chkstr = ""
end if
if ((not adminonly) or isAdmin) then
output = "<INPUT NAME="+quote+"rdo"+fieldname+quote+" TYPE="+quote+"RADIO"+quote+" "+chkstr
if onclickproc <> "" then
printradio = output + " ONCLICK = "+quote + onclickproc + quote+">"
else
printradio = output + ">"
end if
else
if checked then
printradio = "<IMG SRC="+quote+"images/radioon.gif"+quote+">"
else
printradio = "<IMG SRC="+quote+"images/radiooff.gif"+quote+">"
end if
end if
end function
function text(fieldname,fieldsize,onchangeproc,onfocusproc, onblurproc,hidden,adminonly)
text = inputbox(L_TEXT_TEXT,fieldname,fieldsize,onchangeproc,onfocusproc,onblurproc,hidden,adminonly)
end function
function pword(fieldname,fieldsize,onchangeproc,onfocusproc, onblurproc,hidden,adminonly)
pword = inputbox(L_PASSWORD_TEXT,fieldname,fieldsize,onchangeproc,onfocusproc,onblurproc,hidden,adminonly)
end function
function inputbox(fieldtype,fieldname,fieldsize,onchangeproc,onfocusproc, onblurproc,hidden,adminonly)
On Error Resume Next
val = currentobj.Get(fieldname)
if err <> 0 then
textstr = "<INPUT TYPE="+quote+fieldtype+quote+" NAME="+quote+fieldname+quote+ " SIZE="+size+">"
alertuser fieldname
else
if ((not adminonly) or isAdmin) then
textstr = "<INPUT TYPE="+quote+fieldtype+quote
textstr = textstr + " NAME="+quote+fieldname+quote
if fieldsize <> "" then
textstr = textstr & " SIZE=" & fieldsize
else
end if
if onchangeproc <> "" then
textstr = textstr + " OnChange="+quote + onchangeproc + quote
end if
if onfocusproc <> "" then
textstr = textstr + " OnFocus="+quote + onfocusproc + quote
end if
if onblurproc <> "" then
textstr = textstr + " OnBlur="+quote + onblurproc + quote
end if
textstr = textstr + " VALUE="& quote & val & quote & ">"
if hidden then
textstr = textstr + " <INPUT TYPE="+quote+"hidden"+quote+" NAME="+quote+"hdn"+fieldname+quote+">"
end if
else
textstr = "<FONT FACE=HELV SIZE=1>" & val & "</FONT>"
end if
end if
inputbox = textstr
end function
sub alertuser(fieldname)
rem response.write "<SCRIPT>alert("+quote+"Could not retrieve a value for "+fieldname+"."+quote+");</SCRIPT>"
response.write "<FONT COLOR=red><B>*</B></FONT>"
end sub
%>