home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 February / CHIP_2_98.iso / software / pelne / optionp / iis4_03.cab / iiset.inc < prev    next >
Text File  |  1997-10-20  |  9KB  |  247 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,"chk" & 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='" & fieldname & "' TYPE='CHECKBOX'>"
  38.         alertuser fieldname    
  39.     else
  40.         if (not adminonly) or isAdmin then
  41.             if val then
  42.                 output="<INPUT NAME='" & fieldname & "' TYPE='CHECKBOX' CHECKED"
  43.             else
  44.                 output="<INPUT NAME='" & fieldname & "' TYPE='CHECKBOX' "
  45.             end if
  46.             
  47.             output = output & " OnClick=" & quote & "top.title.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 Session("Browser") = "IE4" then
  58.                 if val then
  59.                     checkboxVal="<INPUT NAME='" & fieldname & "' TYPE='CHECKBOX' CHECKED DISABLED>"
  60.                 else
  61.                     checkboxVal="<INPUT NAME='" & fieldname & "' TYPE='CHECKBOX' CHECKED DISABLED>"
  62.                 end if                
  63.             else
  64.                 
  65.                 if val then
  66.                     checkboxVal="<IMG ALIGN=middle SRC=" & quote & "images/checkon.gif" & quote & ">"
  67.                 else
  68.                     checkboxVal="<IMG ALIGN=middle SRC=" & quote & "images/checkoff.gif" & quote & ">"
  69.                 end if
  70.             end if
  71.         end if 
  72.     end if
  73. end function
  74.  
  75.  
  76. function printoption(selected, text, adminonly)
  77.     'On Error Resume Next 
  78.     if selected then
  79.         printoption="<OPTION SELECTED>" & text
  80.     else
  81.         if (isadmin or not adminonly) then            
  82.             printoption="<OPTION>" & text
  83.         end if
  84.     end if
  85.  
  86. end function
  87.  
  88.  
  89.  
  90. function getoption(fieldname,value, adminonly)
  91.     'On Error Resume Next 
  92.     Dim val
  93.     val=currentobj.Get(fieldname)
  94.     if err <> 0 then
  95.         val = False
  96.         alertuser fieldname            
  97.     end if
  98.     getoption = printoption((value=val),value,adminonly)
  99. end function
  100.  
  101.  
  102. function radio(fieldname,value, onclickproc, adminonly)
  103.     On Error Resume Next 
  104.     Dim val
  105.     val=currentobj.Get(fieldname)
  106.     if err <> 0 then
  107.         radio=(printradio(fieldname, False,onclickproc,adminonly)) 
  108.         alertuser "rdo" & fieldname    
  109.     else
  110.             if (typename(val)="Boolean") then
  111.                     output=printradio(fieldname, (val=value),onclickproc,adminonly)        
  112.             else
  113.                 if mid(value,1,1)="!" then
  114.                     output=printradio(fieldname, (val <> mid(value,2)),onclickproc,adminonly)        
  115.                 else
  116.                     output=printradio(fieldname, (val=value),onclickproc,adminonly)
  117.                 end if
  118.             end if 
  119.         radio=output
  120.     end if
  121. end function
  122.  
  123. function printradio(fieldname, checked, onclickproc,adminonly)
  124.     Dim output, chkstr
  125.     
  126.     if checked then
  127.         chkstr="CHECKED"
  128.     else
  129.         chkstr=""
  130.     end if 
  131.     
  132.     if ((not adminonly) or isAdmin) then
  133.         output="<INPUT NAME=" & quote & "rdo" & fieldname & quote & " TYPE=" & quote & "RADIO" & quote & " " & chkstr
  134.         output=output & " OnClick=" & quote & "top.title.Global.updated=true;"
  135.         if onclickproc <> "" then
  136.             printradio=output & onclickproc & quote & ">"
  137.         else
  138.             printradio=output & quote & ">"
  139.         end if
  140.     else
  141.         if checked then
  142.             printradio="<IMG SRC=" & quote & "images/radioon.gif" & quote & ">"
  143.         else
  144.             printradio="<IMG SRC=" & quote & "images/radiooff.gif" & quote & ">"
  145.         end if
  146.     end if 
  147.  
  148. end function
  149.  
  150. function text(fieldname,fieldsize,onchangeproc,onfocusproc, onblurproc,hidden,adminonly)
  151.     On Error Resume Next 
  152.     Dim val
  153.     val=currentobj.Get(fieldname)
  154.     text=inputbox(err,"text",fieldname,val,fieldsize,onchangeproc,onfocusproc,onblurproc,hidden,adminonly,false)
  155. end function
  156.  
  157. function pword(fieldname,fieldsize,onchangeproc,onfocusproc, onblurproc,hidden,adminonly)
  158.     On Error Resume Next 
  159.     Dim val
  160.     val=currentobj.Get(fieldname)
  161.     if ((not adminonly) or isAdmin) then
  162.         pword=inputbox(err,"password",fieldname,val,fieldsize,onchangeproc,onfocusproc,onblurproc,hidden,adminonly,false)
  163.     else
  164.         pword=disabletextstart & "*******" & disabletextend
  165.     end if
  166.     
  167. end function
  168.  
  169. function inputbox(err,fieldtype,fieldname,val,fieldsize,onchangeproc,onfocusproc,onblurproc,hidden,adminonly,readonly)
  170.     inputbox = writeinputbox(err,fieldtype,fieldname,val,fieldsize,"",onchangeproc,onfocusproc,onblurproc,hidden,adminonly,readonly) 
  171. end function
  172.  
  173. function inputboxfixed(err,fieldtype,fieldname,val,fieldsize,maxfieldsize,onchangeproc,onfocusproc,onblurproc,hidden,adminonly,readonly)
  174.     inputboxfixed = writeinputbox(err,fieldtype,fieldname,val,fieldsize,maxfieldsize,onchangeproc,onfocusproc,onblurproc,hidden,adminonly,readonly) 
  175. end function
  176.  
  177. function writeinputbox(err,fieldtype,fieldname,val,fieldsize,maxfieldsize,onchangeproc,onfocusproc,onblurproc,hidden,adminonly,readonly)
  178.     On Error Resume Next 
  179.     Dim textstr
  180.     if err <> 0 then
  181.         textstr="<INPUT TYPE=" & quote & fieldtype & quote & " NAME=" & quote & fieldname & quote & " SIZE=" & fieldsize & ">"
  182.         alertuser fieldname    
  183.     else
  184.         if ((not adminonly) or isAdmin) then
  185.             textstr="<INPUT TYPE=" & quote & fieldtype & quote
  186.             textstr=textstr & " NAME=" & quote & fieldname & quote
  187.             if fieldsize <> "" then
  188.                 textstr=textstr & " SIZE=" & fieldsize
  189.             else
  190.             end if 
  191.             if maxfieldsize <> "" then
  192.                 textstr=textstr & " MAXLENGTH=" & maxfieldsize
  193.             else
  194.             end if             
  195.             textstr=textstr & " VALUE=" &  quote & val & quote
  196.             textstr=textstr & " OnChange=" & quote & "top.title.Global.updated=true;"
  197.             if onchangeproc <> "" then
  198.                 textstr=textstr & onchangeproc & quote
  199.             else
  200.                 textstr=textstr & quote
  201.             end if
  202.             if onfocusproc <> "" then
  203.                 textstr=textstr & " OnFocus=" & quote & onfocusproc & quote
  204.             end if
  205.             if onblurproc <> "" then
  206.                 textstr=textstr & " OnBlur=" & quote & onblurproc & quote
  207.             end if            
  208.             if readonly then
  209.                 textstr=textstr & " READONLY"
  210.             end if            
  211.             textstr=textstr & ">"
  212.             
  213.             if hidden then
  214.                 textstr=textstr & " <INPUT TYPE=" & quote & "hidden" & quote & " NAME=" & quote & "hdn" & fieldname & quote & " VALUE=" &  quote & val & quote & ">"
  215.             end if            
  216.         else    
  217.         
  218.             if Session("Browser") = "IE4" then
  219.                     textstr="<INPUT TYPE=" & quote & fieldtype & quote & " NAME=" & quote & fieldname & quote & " SIZE=" & fieldsize & " VALUE='" & val & "' DISABLED>"
  220.             else
  221.                 if val = "" then
  222.                     val  = " "
  223.                 else
  224.                     if len(val) > 50 then
  225.                         val = Left(val,50) & "..."
  226.                     end if
  227.                 end if
  228.                 if fieldsize < 15 then
  229.                     textstr=disableintstart & "<FONT FACE=HELV SIZE=1>" & val  & "</FONT>" & disabletextend            
  230.                 else
  231.                     textstr=disabletextstart & "<FONT FACE=HELV SIZE=1>" & val  & "</FONT>" & disabletextend
  232.                 end if
  233.             end if
  234.         end if            
  235.     end if
  236.     writeinputbox=textstr
  237.     
  238. end function
  239.  
  240.  
  241. Sub alertuser(fieldname)
  242.     'Response.Write "<SCRIPT>alert(" & quote & "Could not retrieve a value for " & fieldname & ". (" & err & ":" & err.description & ")" & quote & ");</SCRIPT>"
  243.     Response.Write "<FONT COLOR=red><B>*</B></FONT>"
  244. End Sub
  245.  
  246.  %>
  247.