home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 9 / IOPROG_9.ISO / contrib / iis4 / iis4_03.cab / iiset.inc < prev    next >
Encoding:
Text File  |  1997-08-15  |  7.6 KB  |  219 lines

  1. <% 
  2.  
  3. dim quote,isAdmin,disabletextstart,disableintstart,disabletextend
  4.  
  5. quote=chr(34)
  6.  
  7. if Session("FONTSIZE") = "LARGE" then
  8.     disabletextstart= "<TABLE BORDER=1  BORDERCOLORLIGHT=" & quote & "#000000" & quote & " BORDERCOLORMEDIUM=" & quote & "#000000" & quote & " BORDERCOLORDARK=" & quote & "Gray" & quote & "><TR><TD BGCOLOR=" & quote & "#C0C0C0" & quote & " BORDERCOLOR=" & quote & "#C0C0C0" & quote & " BORDERCOLORLIGHT=" & quote & "#C0C0C0" & quote & " BORDERCOLORMEDIUM=" & quote & "#C0C0C0" & quote & " BORDERCOLORDARK=" & quote & "#C0C0C0" & quote & "WIDTH=300>"
  9.     disableintstart= "<TABLE BORDER=1  BORDERCOLORLIGHT=" & quote & "#000000" & quote & " BORDERCOLORMEDIUM=" & quote & "#000000" & quote & " BORDERCOLORDARK=" & quote & "Gray" & quote & "><TR><TD BGCOLOR=" & quote & "#C0C0C0" & quote & " BORDERCOLOR=" & quote & "#C0C0C0" & quote & " BORDERCOLORLIGHT=" & quote & "#C0C0C0" & quote & " BORDERCOLORMEDIUM=" & quote & "#C0C0C0" & quote & " BORDERCOLORDARK=" & quote & "#C0C0C0" & quote & "WIDTH=75>"
  10. else
  11.     disabletextstart= "<TABLE BORDER=1  BORDERCOLORLIGHT=" & quote & "#000000" & quote & " BORDERCOLORMEDIUM=" & quote & "#000000" & quote & " BORDERCOLORDARK=" & quote & "Gray" & quote & "><TR><TD BGCOLOR=" & quote & "#C0C0C0" & quote & " BORDERCOLOR=" & quote & "#C0C0C0" & quote & " BORDERCOLORLIGHT=" & quote & "#C0C0C0" & quote & " BORDERCOLORMEDIUM=" & quote & "#C0C0C0" & quote & " BORDERCOLORDARK=" & quote & "#C0C0C0" & quote & "WIDTH=275>"
  12.     disableintstart= "<TABLE BORDER=1  BORDERCOLORLIGHT=" & quote & "#000000" & quote & " BORDERCOLORMEDIUM=" & quote & "#000000" & quote & " BORDERCOLORDARK=" & quote & "Gray" & quote & "><TR><TD BGCOLOR=" & quote & "#C0C0C0" & quote & " BORDERCOLOR=" & quote & "#C0C0C0" & quote & " BORDERCOLORLIGHT=" & quote & "#C0C0C0" & quote & " BORDERCOLORMEDIUM=" & quote & "#C0C0C0" & quote & " BORDERCOLORDARK=" & quote & "#C0C0C0" & quote & "WIDTH=50>"
  13. end if
  14. disabletextend="</TD></TR></TABLE>"
  15.  
  16. isAdmin=Session("isAdmin")
  17.  
  18. function checkbox(fieldname, onclickproc, adminonly)
  19.     On Error Resume Next 
  20.     Dim val
  21.  
  22.     if mid(fieldname,1,1)="!" then
  23.         fieldname=mid(fieldname,2) 
  24.         val=not currentobj.Get(fieldname)
  25.     else
  26.         val=currentobj.Get(fieldname)
  27.     end if
  28.     
  29.     checkbox = checkboxVal(err,val,fieldname,onclickproc,adminonly)
  30.  
  31. end function
  32.  
  33. function checkboxVal(err, val, fieldname, onclickproc, adminonly)
  34.     On Error Resume Next 
  35.     Dim output
  36.     if err <> 0 then
  37.         checkbox="<INPUT NAME='chk" & fieldname & "' TYPE='CHECKBOX'>"
  38.         alertuser "chk" & fieldname    
  39.     else
  40.         if (not adminonly) or isAdmin then
  41.             if val then
  42.                 output="<INPUT NAME='chk" & fieldname & "' TYPE='CHECKBOX' CHECKED"
  43.             else
  44.                 output="<INPUT NAME='chk" & fieldname & "' TYPE='CHECKBOX' "
  45.             end if
  46.             
  47.             output = output & " OnClick=" & quote & "top.head.Global.updated=true;"
  48.  
  49.             if onclickproc <> "" then                
  50.                 checkboxVal=output & onclickproc & quote & ">"
  51.             else
  52.                 checkboxVal=output & quote & ">"
  53.             end if
  54.             
  55.         
  56.         else
  57.             if val then
  58.                 checkbox="<IMG ALIGN=middle SRC=" & quote & "images/checkon.gif" & quote & ">"
  59.             else
  60.                 checkbox="<IMG ALIGN=middle SRC=" & quote & "images/checkoff.gif" & quote & ">"
  61.             end if
  62.         end if 
  63.     end if
  64. end function
  65.  
  66.  
  67. function printoption(selected, text, adminonly)
  68.     'On Error Resume Next 
  69.     if selected then
  70.         printoption="<OPTION SELECTED>" & text
  71.     else
  72.         if (isadmin or not adminonly) then            
  73.             printoption="<OPTION>" & text
  74.         end if
  75.     end if
  76.  
  77. end function
  78.  
  79.  
  80.  
  81. function getoption(fieldname,value, adminonly)
  82.     'On Error Resume Next 
  83.     Dim val
  84.     val=currentobj.Get(fieldname)
  85.     if err <> 0 then
  86.         val = False
  87.         alertuser fieldname            
  88.     end if
  89.     getoption = printoption((value=val),value,adminonly)
  90. end function
  91.  
  92.  
  93. function radio(fieldname,value, onclickproc, adminonly)
  94.     On Error Resume Next 
  95.     Dim val
  96.     val=currentobj.Get(fieldname)
  97.     if err <> 0 then
  98.         radio=(printradio(fieldname, False,onclickproc,adminonly)) 
  99.         alertuser "rdo" & fieldname    
  100.     else
  101.             if (typename(val)="Boolean") then
  102.                     output=printradio(fieldname, (val=value),onclickproc,adminonly)        
  103.             else
  104.                 if mid(value,1,1)="!" then
  105.                     output=printradio(fieldname, (val <> mid(value,2)),onclickproc,adminonly)        
  106.                 else
  107.                     output=printradio(fieldname, (val=value),onclickproc,adminonly)
  108.                 end if
  109.             end if 
  110.         radio=output
  111.     end if
  112. end function
  113.  
  114. function printradio(fieldname, checked, onclickproc,adminonly)
  115.     Dim output, chkstr
  116.     
  117.     if checked then
  118.         chkstr="CHECKED"
  119.     else
  120.         chkstr=""
  121.     end if 
  122.     
  123.     if ((not adminonly) or isAdmin) then
  124.         output="<INPUT NAME=" & quote & "rdo" & fieldname & quote & " TYPE=" & quote & "RADIO" & quote & " " & chkstr
  125.         output=output & " OnClick=" & quote & "top.head.Global.updated=true;"
  126.         if onclickproc <> "" then
  127.             printradio=output & onclickproc & quote & ">"
  128.         else
  129.             printradio=output & quote & ">"
  130.         end if
  131.     else
  132.         if checked then
  133.             printradio="<IMG SRC=" & quote & "images/radioon.gif" & quote & ">"
  134.         else
  135.             printradio="<IMG SRC=" & quote & "images/radiooff.gif" & quote & ">"
  136.         end if
  137.     end if 
  138.  
  139. end function
  140.  
  141. function text(fieldname,fieldsize,onchangeproc,onfocusproc, onblurproc,hidden,adminonly)
  142.     On Error Resume Next 
  143.     Dim val
  144.     val=currentobj.Get(fieldname)
  145.     text=inputbox(err,"text",fieldname,val,fieldsize,onchangeproc,onfocusproc,onblurproc,hidden,adminonly)
  146. end function
  147.  
  148. function pword(fieldname,fieldsize,onchangeproc,onfocusproc, onblurproc,hidden,adminonly)
  149.     On Error Resume Next 
  150.     Dim val
  151.     val=currentobj.Get(fieldname)
  152.     if ((not adminonly) or isAdmin) then
  153.         pword=inputbox(err,"password",fieldname,val,fieldsize,onchangeproc,onfocusproc,onblurproc,hidden,adminonly)
  154.     else
  155.         pword=disabletextstart & "*******" & disabletextend
  156.     end if
  157.     
  158. end function
  159.  
  160.  
  161. function inputbox(err,fieldtype,fieldname,val,fieldsize,onchangeproc,onfocusproc, onblurproc,hidden,adminonly)
  162.     On Error Resume Next 
  163.     Dim textstr
  164.     if err <> 0 then
  165.         textstr="<INPUT TYPE=" & quote & fieldtype & quote & " NAME=" & quote & fieldname & quote & " SIZE=" & fieldsize & ">"
  166.         alertuser fieldname    
  167.     else
  168.         if ((not adminonly) or isAdmin) then
  169.             textstr="<INPUT TYPE=" & quote & fieldtype & quote
  170.             textstr=textstr & " NAME=" & quote & fieldname & quote
  171.             if fieldsize <> "" then
  172.                 textstr=textstr & " SIZE=" & fieldsize
  173.             else
  174.             end if 
  175.             textstr=textstr & " VALUE=" &  quote & val & quote
  176.             textstr=textstr & " OnChange=" & quote & "top.head.Global.updated=true;"
  177.             if onchangeproc <> "" then
  178.                 textstr=textstr & onchangeproc & quote
  179.             else
  180.                 textstr=textstr & quote
  181.             end if
  182.             if onfocusproc <> "" then
  183.                 textstr=textstr & " OnFocus=" & quote & onfocusproc & quote
  184.             end if
  185.             if onblurproc <> "" then
  186.                 textstr=textstr & " OnBlur=" & quote & onblurproc & quote
  187.             end if            
  188.             textstr=textstr & ">"
  189.             
  190.             if hidden then
  191.                 textstr=textstr & " <INPUT TYPE=" & quote & "hidden" & quote & " NAME=" & quote & "hdn" & fieldname & quote & " VALUE=" &  quote & val & quote & ">"
  192.             end if            
  193.         else    
  194.             if val = "" then
  195.                 val  = " "
  196.             else
  197.                 if len(val) > 50 then
  198.                     val = Left(val,50) & "..."
  199.                 end if
  200.             end if
  201.             if fieldsize < 15 then
  202.                 textstr=disableintstart & "<FONT FACE=HELV SIZE=1>" & val  & "</FONT>" & disabletextend            
  203.             else
  204.                 textstr=disabletextstart & "<FONT FACE=HELV SIZE=1>" & val  & "</FONT>" & disabletextend
  205.             end if
  206.         end if            
  207.     end if
  208.     inputbox=textstr
  209.     
  210. end function
  211.  
  212.  
  213. Sub alertuser(fieldname)
  214.     'Response.Write "<SCRIPT>alert(" & quote & "Could not retrieve a value for " & fieldname & ". (" & err & ":" & err.description & ")" & quote & ");</SCRIPT>"
  215.     Response.Write "<FONT COLOR=red><B>*</B></FONT>"
  216. End Sub
  217.  
  218.  %>
  219.