Wrox Programmer Forums
|
Classic ASP Components Discussions specific to components in ASP 3.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Components section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 16th, 2006, 10:02 AM
Registered User
 
Join Date: Aug 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help Please

I have navigation buttons (First, Next, Previous, Last) on the top of my page to scroll through the database records. I can't get them to work. Can anyone look at the code and help me please?

[CODE]
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual InterDev 1.0">
<META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="ROBOTS" content="noindex,nofollow" >

<script language="JavaScript" src="includes/date-picker.js"></script>
<script language="JavaScript" src="includes/calendar2.js"></script>
<TITLE>SMSe Information</TITLE>
</HEAD>
<STYLE TYPE="text/javascript">
classes.Sans.all.fontFamily = "MS Sans Serif"
classes.Sans.all.fontSize = "10pt"
</STYLE>
<SCRIPT LANGUAGE="JavaScript" src="includes/md5.js"></SCRIPT>
<%
lcASPFile = Right( Request.ServerVariables( "URL" ), Len(Request.ServerVariables( "URL" )) - InStrRev( Request.ServerVariables( "URL" ), "/" ))
cVersion = "LIVE VERSION 1.0.13"
if UCase( Left( lcASPFile, 4 )) = "BETA" then
    cVersion = Replace( cVersion, "LIVE", "BETA" )
end if
lcOrigRqst = Request.QueryString()
lnEmpID = session("emp")
lcLogin = Request.QueryString("login")
lcQHash = Request.QueryString("hash")
lcSetHash = Request.QueryString("sethash")
lcNewPass = Request.QueryString("newpassword")

set rsGet = Server.CreateObject("ADODB.Recordset")
set rsGet.ActiveConnection = oConn
rsGet.CursorType = 3
%>
<SCRIPT LANGUAGE="JavaScript">
function OpenReport( pcSearch ) {
  windowName = 'SMSe Post Information' ;
  newURL = location.protocol + "//" + location.hostname + "/SMSe/smse_info.asp?wo=" + pcSearch ;
  oldURL = "http://fse.ds.state.gov/smse/smse_info.asp?wo=" + pcSearch
  newWindow= window.open( newURL );
  newWindow.focus();
}

function SwapImage( poImage, pcImageFile ) {
  poImage.src = pcImageFile ;
}

function openSearch( pcSearchText ) {
alert( pcSearchText );
  if ( pcSearchText.length > 0 )
    window.location = location.protocol + "//" + location.hostname + "/SMSe/smse_info.asp?doit=search&text=" + pcSearchText ;
  else
    alert( "The search you have requested will pull in too many records, please narrow your search by entering part of the work order number into the search box." );
}

function openWindow(contentURL,criteria,windowName,windowWi dth,windowHeight) {
    var winl = (screen.width - windowWidth) / 2;
    var wint = (screen.height - windowHeight) / 2;
    var cAddURL = "" ;

    winProps = 'height=' + windowHeight + ',width=' + windowWidth + ',top=' + wint + ',left=' + winl + ',scrollbars=Yes,resizable=Yes,menubar=Yes';
    for ( x = 0; x < criteria ; x++ ) {
        var cVal = eval( "document.ReportForm.criteria" + (x+1) + ".value" );
        if ( x == 0 )
            cAddURL = cAddURL + '?criteria' + (x+1) + '=' + cVal ;
        else
            cAddURL = cAddURL + '&criteria' + (x+1) + '=' + cVal ;
    }
    var cOpenWin = contentURL + cAddURL ;
    newWindow = window.open(cOpenWin,windowName,winProps);
    if (parseInt(navigator.appVersion) >= 4) { newWindow.window.focus(); }
}

function wwrite( wtext ) {
  document.writeln( wtext );
}

function SwapImage( poImage, pcImageFile ) {
  poImage.src = pcImageFile ;
}

function CheckLogin( oLogin, oPassword ) {
   var cEncrPs = hex_hmac_md5( this.login.value, this.password.value );
   var cLogin = this.login.value;
   window.location = location.protocol + "//" + location.hostname + location.pathname + "?login=" + cLogin + "&hash=" + cEncrPs;
 }

function DoAction( cURL ) {
    var cFind = document.StatusForm.find.value ;

    if ( cFind.length > 0 )
       window.location = location.protocol + "//" + location.hostname + location.pathname + "?" + cURL + "&find=" + cFind;
    else
       window.location = location.protocol + "//" + location.hostname + location.pathname + "?" + cURL;
}

function GetReport( cURL ) {
    var nReport = this.reportname.value ;

    window.location = location.protocol + "//" + location.hostname + location.pathname + "?" + cURL + "&find=" + nReport;
}

function GetWO( cURL ) {
    var nWO = this.workorder.value ;

    window.location = location.protocol + "//" + location.hostname + location.pathname + "?" + cURL + "&find=" + nWO;
}

function ApplyDataMod( pcInsType ) {
    document.MaintForm.doit.value = pcInsType ;
    document.MaintForm.submit();
}

function Reposition( cURL ) {
    var nFilter = this.filterid.value ;

    if ( nFilter.length > 0 && nFilter > 0 ) {
       if ( typeof cURL == "doit=search" || cURL == "doit=status" )
          window.location = location.protocol + "//" + location.hostname + location.pathname + "?filterid=" + nFilter;
       else
          window.location = location.protocol + "//" + location.hostname + location.pathname + "?" + cURL + "&filterid=" + nFilter;
       }
    else
       window.location = location.protocol + "//" + location.hostname + location.pathname + "?" + cURL;
}

function EditWORepos( cURL ) {
    var cText = this.editsearch.value ;

    if ( cText.length > 0 )
       window.location = location.protocol + "//" + location.hostname + location.pathname + "?" + cURL + "&text=" + cText;
    else {
    window.location = location.protocol + "//" + location.hostname + location.pathname + "?" + cURL;
    }
}

function VerifyLogin( cHash, cVerify ) {
   if ( cHash == cVerify )
       window.location = location.protocol + "//" + location.hostname + location.pathname + "?login=<%=lcLogin%>&sethash=" + cHash;
 }

function ValidatePost( pcFormName ) {

  var cPostID = document.forms[ pcFormName ].elements['postid'].value ;
  var cPostName = document.forms[ pcFormName ].elements['PostName'].value ;
  var cRouterIP = document.forms[ pcFormName ].elements['Router_IP'].value ;
  var cCountry = document.forms[ pcFormName ].elements['country'].value ;
  if ( cPostID == 0 || cPostID == "" )
    alert( "You must select the post." )
  else
    if ( cPostName == 0 || cPostName == "" )
        alert( "You must select a Post." )
    else
        if ( cRouterIP == 0 || cRouterIP == "" )
            alert( "You must select the Router IP." )
        else
            if ( cCountry == "undefined" || cCountry == "" )
                alert( "You must specify the Country.")
            else
                    document.forms[ pcFormName ].submit();
}
</SCRIPT>

<%
set oCmd = Server.CreateObject("ADODB.Command")
set oCmd.ActiveConnection = oConn
cMsg = ""
if Len( session( "emp" )) > 0 AND Len( lcLogin ) = 0 AND Not isEmpty( session("emp")) then
    call InterfaceForm( cMsg )
else
    if Len( lcLogin ) > 0 then
        lcSQL_UPDATE = ""
        lcUserSQL = "SELECT tblUsers.* FROM tblUsers WHERE tblUsers.Inactive = 0 and Locked = 0 and UserName = '" & lcLogin & "'"
        set rsVerify = oConn.execute( lcUserSQL )
        if not rsVerify.eof then
            lcHash = rsVerify("Hash")
            if Len( lcSetHash ) > 0 then
                lcSQL_UPDATE = "UPDATE tblUsers SET hash = '" & lcSetHash & "' WHERE UserName = '" & lcLogin & "'"
                session("emp") = rsVerify( "UserID" )
                If rsVerify( "isAdmin" ) then
                    session("isadmin") = "On"
                End if
                session("emp") = rsVerify( "UserID" )
                call InterfaceForm( cMsg )
            else
                if Len( lcHash) = 0 or lcNewPass = 1 then
                    call PasswordForm( cMsg )
                else
                    if ( lcQHash <> rsVerify( "Hash" )) or ( lcLogin <> rsVerify( "UserName" )) then
                        lnAttempts = rsVerify( "Attempts" ) + 1
                        if lnAttempts >= 3 then
                            lcSQL_UPDATE = "update tblUsers set locked = 1, attempts = " & lnAttempts & " where userid = " & rsVerify("UserID")
                            cMsg = "Login Account has been Locked!"
                            call LoginForm( cMsg )
                        else
                            lcSQL_UPDATE = "update tblUsers set attempts = " & lnAttempts & " where userid = " & rsVerify("UserID")
                            cMsg = "Invalid Authentication..."
                            call LoginForm( cMsg )
                        end if
                    else
                        ldDate = FormatDateTime( Now(), vbGeneralDate )
                        lcSQL_UPDATE = "update tblUsers set lastlogin = '" & ldDate & "', attempts = 0 where userid = " & rsVerify("UserID")
                        If rsVerify( "isAdmin" ) then
                            session("isadmin") = "On"
                        Else
                            session("isadmin") = "Off"
                        End if
                        lnEmpID = rsVerify( "UserID" )
                        session("emp") = rsVerify( "UserID" )
                        call InterfaceForm( cMsg )
                    end if
                end if
            end if
        else
            cMsg = "Invalid Authentication...Unable to Locate User Profile"
            call LoginForm( cMsg )
        end if
    else
        call LoginForm( cMsg )
    end if
    if Len( lcSQL_UPDATE ) > 0 then
        oCmd.CommandText = lcSQL_UPDATE
        oCmd.CommandType = 1
        oCmd.Execute()
    end if
    set oCmd = nothing
    lcSQL_UPDATE = ""
    if Len( lcSQL_UPDATE ) > 0 then
        oCmd.CommandText = lcSQL_UPDATE
        oCmd.CommandType = 1
        oCmd.Execute()
    end if
    set oCmd = nothing
end if

Sub MaintHeader( pcTitle, pcIDFieldName, plUpdateID, pcSQL, pcDisplayField )
%> <TBODY>
              <TR>

  <TD colspan=2 class="content-headingCell"><B>&nbsp;-
    <%=pcTitle%> - </TD>
              </TR> <%
' Using the navigation buttons at the top of the form, move to the indicated record. -Position RecordSet-
    lcShell = "doit=maint" & chr(asc("&")) & "sact=" & Request.QueryString( "sact" )
    lcCurID = Request.QueryString("curid")
    lcFindID = Request.QueryString("find")
    if Len( lcCurID ) = 0 and Len( lcFindID ) > 0 then
        lcCurID = lcFindID
    end if
    lcPosition = Request.QueryString("pos")
    lcQuery = Request.QueryString()

    rsGet.Open pcSQL
    if not rsGet.eof then
        if Len( lcCurID ) > 0 then
            llCycle = true
            lnRCnt = 1
            do
                lnValue = rsGet( pcIDFieldName )
                if lnValue = CLng(lcCurID) then
                    llCycle = false
                else
                    rsGet.MoveNext
                    lnRCnt = lnRCnt + 1
                end if
                if rsGet.Eof then
                    llCycle = false
                end if
            loop while llCycle
            if lcPosition = "first" then
                rsGet.MoveFirst
            else if lcPosition = "last" then
                rsGet.MoveLast
                else if lcPosition = "next" and lnRCnt+1 <= rsGet.RecordCount then
                    if not rsGet.EOF then
                        rsGet.MoveNext
                    end if
                    else if lcPosition = "previous" and lnRCnt-1 > 0 then
                            if not rsGet.BOF then
                                rsGet.MovePrevious
                            end if
                        end if
                    end if
                end if
            end if
            lcCurID = CStr( rsGet( pcIDFieldName ))
        end if
%> <tr>
      <td align='right' colspan=2><TABLE border=0><TR><TD>
<%
        if rsGet.RecordCount > 1 then
            set rsSearch = Server.CreateObject("ADODB.Recordset")
            set rsSearch.ActiveConnection = oConn
            rsSearch.CursorType = 1
            rsSearch.Open pcSQL
            lnRecSz = rsSearch.RecordCount
%>
    <B>Search: </B><SELECT name="find" onChange="Reposition( '<%=lcShell%>&curid=' + this.value );" style="font size:11px"> <%
            nRecordBefore = 0
            do until rsSearch.eof
%> <OPTION value='<%=rsSearch( pcIDFieldName )%>' <%
                if lcCurID = CStr( rsSearch( pcIDFieldName )) then
        %> SELECTED <%
                    nRecordBefore = nPrev
                end if
                if ( pcDisplayField = "PostName" ) then
                    if ( rsSearch( "Inactive" ) = true ) then
        %> DISABLED style="font-size:11px; color:#7f7f7f"<%
                    else
        %> style="font-size:11px; color:#000000" <%
                    end if
                end if %>><%=rsSearch( pcDisplayField )%></OPTION> <%
                nPrev = rsSearch( pcIDFieldName )
                rsSearch.MoveNext
            loop %>
      </SELECT><INPUT TYPE="HIDDEN" name="prevrecid" value="<%=nRecordBefore%>">
<% rsSearch.Close
            Set rsSearch = nothing
        end if
        cAddCall = chr(asc("&")) & "curid=" & rsGet( pcIDFieldName ) & chr(asc("&")) & "pos=" %>
        <input type="button" name="Submit" value="&lt;&lt;" title="First Record" onClick="Reposition( '<%=lcShell%><%=cAddCall%>first')">
        <input type="button" name="Submit2" value="&lt;" title="Previous Record" onClick="Reposition( '<%=lcShell%><%=cAddCall%>previous')">
        <input type="button" name="Submit3" value="&gt;" title="Next Record" onClick="Reposition( '<%=lcShell%><%=cAddCall%>next')">
        <input type="button" name="Submit4" value="&gt;&gt;" title="Last Record" onClick="Reposition( '<%=lcShell%><%=cAddCall%>last')"></td></tr></table></td>
    </tr>
    <TR>
        <TD align="left"><input type="hidden" name="hiddenID" value="<%=rsGet( pcIDFieldName )%>">
    </TD></TR>
<%
    else %>
    <tr>
      <td align='right' colspan=2><TABLE border=0><TR><TD>
        <input type="button" name="Submit" value="&lt;&lt;" title="First Record" onClick="" DISABLED>
        <input type="button" name="Submit2" value="&lt;" title="Previous Record" onClick="" DISABLED>
        <input type="button" name="Submit3" value="&gt;" title="Next Record" onClick="" DISABLED>
        <input type="button" name="Submit4" value="&gt;&gt;" title="Last Record" onClick="" DISABLED></td></tr></table></td>
    </tr>
    <TR>
        <TD align="left"><input type="hidden" name="hiddenID" value="1">
    </TD></TR>
<%
    end if
End Sub

Sub MaintFooter( pcSQL, pcMatchText, pcMatchField, pcIDField, pcInsertType, plRemap )
' Delete Option Controlled through parameter pcInsertType. If field starts with "del", not "ins" the delete option will enable
if Left( pcInsertType, 3 ) = "del" then
    lcDeleteType = pcInsertType
    pcInsertType = Replace( pcInsertType, "del", "ins" )
else
    lcDeleteType = ""
end if
if plRemap = true then
    lcRemap = Replace( pcInsertType, "ins", "remap" )
%> <TR valign="center">
        <TD colspan=2></TD></TR>
    <TR valign='bottom'>
        <TD align='right'>&nbsp;&nbsp;<B>Remap to:</B>&nbsp;&nbsp;</TD>
        <TD nowrap><SELECT name='postid' style="font size:11px"> <%
        set rsMatch = oConn.execute( pcSQL )
        Do until rsMatch.eof
            if pcMatchText <> rsMatch( pcMatchField ) then %>
                <OPTION value='<%=rsMatch( pcIDField ) %>'><%=rsMatch( pcMatchField ) %></OPTION> <%
            end if
            rsMatch.movenext
        Loop
        rsMatch.close
        Set rsMatch = nothing
%> </SELECT>&nbsp;&nbsp;&nbsp;<input type='Checkbox' name='remap'>&nbsp;&nbsp;<B>Delete after Remap</B></TD></TR>
    </TD></TR>
    <TR valign="center">
        <TD colspan=2></TD></TR> <%
end if %>
    <TR valign='bottom'>
        <TD align='center' colspan=2>
            <INPUT TYPE='button' style='font size:11px' value='New' onClick="ApplyDataMod('<%=pcInsertType%>');">
            <INPUT TYPE='button' style='font size:11px' value='Save/Submit' onClick='submit();'>
<% if Len( lcDeleteType ) > 0 then %> <INPUT TYPE='button' style='font size:11px' value='Delete' onClick="ApplyDataMod('<%=lcDeleteType%>');"><%end if%>
            <INPUT TYPE='button' style='font size:11px' value='Cancel' onClick="Reposition('');">
<% if plRemap=true then %> <INPUT TYPE='button' style='font size:11px' value='Remap/Commit' onClick="ApplyDataMod('<%=lcRemap%>');"></TD></TR> <%end if%>
    </TABLE></TD><%
End Sub

' __________________________________________________ ______________
' INTERFACE FORMS
' __________________________________________________ ______________
Sub LoginForm( pcMsg )
%>
<table border=1 bgcolor='#9999FF' bordercolor='#0066CC'><TR><TD><img src='images/smse_banner.jpg'></TD></TR><tr><td>
<table border=0 align='center'><%
if Len( pcMsg ) > 0 then %>
<tr><td colsapn=2><%=pcMsg%></td></tr>
<% end if %>
<tr><td>Login ID:&nbsp;&nbsp;<INPUT TYPE='text' NAME=login ID=login style='font size:11px'></td></tr>
<tr><td>Password:&nbsp;&nbsp;<INPUT TYPE='password' NAME='password' style='font size:11px'></td></tr>
<tr><td align='center' valign='top'>
<IMG SRC='images/login_norm.jpg' ALT='Login' onMouseOver= "SwapImage( this, 'images/login_over.jpg' )" OnMouseOut="SwapImage( this, 'images/login_norm.jpg' )" onClick="CheckLogin( document.login, document.password )">
&nbsp;&nbsp;&nbsp;<IMG SRC='images/cancel_norm.jpg' ALT='Cancel' onMouseOver="SwapImage( this, 'images/cancel_over.jpg' )" OnMouseOut="SwapImage( this, 'images/cancel_norm.jpg' )"></td></tr>
<Table border=0><tr><td align='center' valign='top'>
<%=pcHTML%>
</CENTER></BODY>
<% End Sub

Sub PasswordForm( pcMsg )
%>
<table border=1 bgcolor='#9999FF' bordercolor='#0066CC'><TR><TD><img src='images/smse_banner.jpg'></TD></TR><tr><td>
<table border=0 align='center'><%
if Len( pcMsg ) > 0 then %>
<tr><td colsapn=2><%=pcMsg%></td></tr>
<% end if %>
<TR valign='bottom'><TD align='right'>&nbsp;&nbsp;<B>New Password (Encrypted):</B>&nbsp;&nbsp;</TD>
    <TD nowrap><input type='password' name='hash' size='32' maxlength='32' onFocus='this.select();' onChange='this.value = hex_hmac_md5( loginid.value, this.value );' style='font size:11px'></TD></TR>
<TR valign='bottom'><TD align='right'>&nbsp;&nbsp;<B>Verify Password (Encrypted):</B>&nbsp;&nbsp;</TD>
    <TD nowrap><input type='password' name='verify' size='32' maxlength='32' value='' onFocus='this.select();' onChange='this.value = hex_hmac_md5( loginid.value, this.value );' style='font size:11px'></TD></TR>
<TR valign='top'><TD></TD><TD nowrap>When entering a new password, do not leave any encrypted </TD></TR>
<TR valign='top'><TD></TD><TD nowrap>part of the newly encrypted password.</TD></TR>
<TR valign='top'><TD></TD><TD nowrap>*Note: The password encryption is one way and no decryption</TD></TR>
<TR valign='top'><TD></TD><TD nowrap> of the password is provided!*</TD></TR>
<tr><td align='center' valign='top' colspan=2><INPUT TYPE='hidden' name='loginid' value='<%=lcLogin%>'>
<INPUT TYPE='button' VALUE='Submit Change' style='font size:11px' onClick='VerifyLogin( hash.value, verify.value )'>
&nbsp;&nbsp;&nbsp;<INPUT TYPE='button' VALUE='Cancel' ALT='Cancel' style='font size:11px'></td></tr>
<Table border=0><tr><td align='center' valign='top'>
<%=pcHTML%>
</CENTER></BODY>
<% End Sub

Sub InterfaceForm( pcMsg )
%>
<table border=1 bgcolor='#9999FF' bordercolor='#0066CC'><TR><TD><img src='images/smse_banner.jpg'></TD></TR><%
if Len( pcMsg ) > 0 then %>
<tr><td><%=pcMsg%></td></tr>
<% end if %><tr><td>
<% cAction = Request.QueryString( "doit" )
lnDivisionID = Request.QueryString( "filterid" )
if session("access") = True then %>
    &nbsp;&nbsp;<B>Viewing Filter:</B>&nbsp;&nbsp;
<SELECT name='filterid' style="font size:11px" onChange="Reposition();"> <%
    strSQL = "SELECT * FROM tblWebPages ORDER BY DivisionCode;"
    set rsPri = oConn.execute( strSQL ) %>
    <OPTION value='0'>No Filter</OPTION> <%
    Do until rsPri.eof %>
    <OPTION value='<%=rsPri( "DivisionID") %>' <%
        if Cstr(lnDivisionID) = CStr( rsPri( "DivisionID" )) then
    %> SELECTED <%
        end if %>><%=rsPri("DivisionCode") %></OPTION> <%
        rsPri.movenext
    Loop
    rsPri.close
    Set rsPri = nothing
%></SELECT>
<% else %>
<INPUT TYPE='hidden' name="filterid" value=''>
<% end if %>
<INPUT TYPE='button' style='font size:11px' value='Maint. Forms' onClick="Reposition('doit=maint');">
<INPUT TYPE='button' style='font size:11px' value='SMSe Post Information' onClick="Reposition('doit=smsepost');">
<INPUT TYPE='button' style='font size:11px' value='Reports' <% if cAction = "maint" then %> DISABLED <%end if%>onClick="Reposition('doit=reports');">
</td></tr><tr><td>
<%
 if cAction = "maint" OR Left( cAction, 3 ) = "ins" OR Left( cAction, 3 ) = "upd" OR Left( cAction, 3 ) = "del" OR Left( cAction, 3 ) = "rem" then
    if session( "isadmin" ) = "On" then%>
<INPUT TYPE='button' style='font size:11px' value='Regions' onClick="Reposition('doit=maint&sact=Region');">
<INPUT TYPE='button' style='font size:11px' value='Building Types' onClick="Reposition('doit=maint&sact=BuildingType' );">
<INPUT TYPE='button' style='font size:11px' value='Post Type' onClick="Reposition('doit=maint&sact=PostType');">
<INPUT TYPE='button' style='font size:11px' value='ESO' onClick="Reposition('doit=maint&sact=ESO');">
<INPUT TYPE='button' style='font size:11px' value='ESC' onClick="Reposition('doit=maint&sact=ESC');">
<INPUT TYPE='button' style='font size:11px' value='RDSE' onClick="Reposition('doit=maint&sact=RDSE');">
<INPUT TYPE='button' style='font size:11px' value='Time Zone' onClick="Reposition('doit=maint&sact=TimeZone');">
<BR><%
    end if %>
<INPUT TYPE='button' style='font size:11px' value='Status' onClick="Reposition('doit=maint&sact=Status');">
<INPUT TYPE='button' style='font size:11px' value='Configs' onClick="Reposition('doit=maint&sact=ConfigType'); ">
<INPUT TYPE='button' style='font size:11px' value='Parent' onClick="Reposition('doit=maint&sact=Parent');">
<INPUT TYPE='button' style='font size:11px' value='Users' onClick="Reposition('doit=maint&sact=users');">
<INPUT TYPE='button' style='font size:11px' value='Encryption Devices' onClick="Reposition('doit=maint&sact=smsepost');">
<INPUT TYPE='button' style='font size:11px' value='Reports' onClick="Reposition('doit=maint&sact=repmaint');">
<INPUT TYPE='button' style='font size:11px' value='Report Criteria' onClick="Reposition('doit=maint&sact=criteria');">
<INPUT TYPE='button' style='font size:11px' value='Data Types' onClick="Reposition('doit=maint&sact=datatype');">
</td></tr><tr><td>
<%
end if %>
<Table border=0><tr><td align='center' valign='top'>
<%=pcHTML%>
</CENTER></BODY> <%
End Sub

' __________________________________________________ ______________
' MAINTENANCE FORMS
' __________________________________________________ ______________
Sub UserForm

cGetSQL = "SELECT * FROM tblUsers ORDER BY UserName"
%><form action="<%=lcASPFile%>" method="get" name="MaintForm">
     <input type="hidden" name="doit" value="updUser"></input>
     <input type="hidden" name="sact" value="users"></input>
    <TABLE border=0 width=755>
<%
    call MaintHeader( "User Maintenance", "UserID", true, cGetSQL, "UserName" )
    lcUName = rsGet( "UserName" )
    lcHash = rsGet( "Hash" )
    llInactive = rsGet( "Inactive" )
    llLocked = rsGet( "Locked" )
    ldLastLogin = rsGet( "LastLogin" )
    lnAttempts = rsGet( "Attempts" )
    llIsAdmin = rsGet( "IsAdmin" ) %>
    <TR valign='bottom'>
        <TD align='right'>&nbsp;&nbsp;<B>User Name:</B>&nbsp;&nbsp;</TD>
        <TD nowrap><input type='text' name='username' size='20' maxlength='20' onFocus='this.select();' value='<%=lcUName%>' style='font size:11px'></TD></TR>
    <TR valign='bottom'>
        <TD align='right'>&nbsp;&nbsp;<B>Password (Hash):</B>&nbsp;&nbsp;</TD>
        <TD nowrap><input type='text' name='hash' size='32' maxlength='32' onFocus='this.select();' value='<%=lcHash%>' style='font size:11px'></TD></TR>
    <TR valign='bottom'>
        <TD></TD>
        <TD align='left'><input type='Checkbox' name='isadmin' <%if llIsAdmin = True then %> CHECKED<%end if %>>
            &nbsp;&nbsp;<B>Is an Administrator</B></TD></TR>
    <TR valign='bottom'>
        <TD></TD>
        <TD align='left'><input type='Checkbox' name='locked' <%if llLocked = True then %> CHECKED<%end if %>>
            &nbsp;&nbsp;<B>Account is Locked</B></TD></TR>
    <TR valign='bottom'>
        <TD align='right'>&nbsp;&nbsp;<B>Login Attempts:</B>&nbsp;&nbsp;</TD>
        <TD nowrap><input type='text' name='attempts' size='10' maxlength='10' onFocus='this.select();' value='<%=lnAttempts%>' style='font size:11px'></TD></TR>
    <TR valign='bottom'>
        <TD align='right'>&nbsp;&nbsp;<B>Last Login:</B>&nbsp;&nbsp;</TD>
        <TD nowrap><input type='text' name='lastlogin' size='18' maxlength='18' onFocus='this.select();' value='<%=ldLastLogin%>' style='font size:11px'></TD></TR>
    <TR valign='bottom'>
        <TD></TD>
        <TD align='left'><input type='Checkbox' name='inactive' <%if llInactive = True then %> CHECKED<%end if %>>
            &nbsp;&nbsp;<B>Account is Deactivated</B></TD></TR>
<% call MaintFooter( cGetSQL, lcUName, "UserName", "UserID", "insUsers", false )
End Sub

set rsReps = Server.CreateObject("ADODB.Recordset")
set rsReps.ActiveConnection = oConn
rsReps.CursorType = 3

sub WriteFormLine( pcLineType, pcLabel, pcFieldName, pnSize, pnMaxLen, pcSQL, pcIDField, pcIDValue )

select case pcLineType
  case "fixed_str"
    if rsGet.eof then
        lcValue = ""
    else
        lcValue = rsGet( pcFieldName )
    end if
%> <tr>
                <td align=right><B><%=pcLabel%>:</B></td>
                <td><input type="text" name="<%=LCase(pcFieldName)%>" size=<%=pnSize%> maxlength=<%=pnSize%> value="<%=lcValue%>" style="font size:11px"></input></td>
              </tr>
<%
  case "number"
    if rsGet.eof then
        lcValue = 0
    else
        lcValue = CLng( rsGet( pcFieldName ))
    end if
%> <tr>
                <td align=right><B><%=pcLabel%>:</B></td>
                <td><input type="text" name="<%=LCase(pcFieldName)%>" size=<%=pnSize%> maxlength=<%=pnSize%> value=<%=lcValue%> style="font size:11px"></input></td>
              </tr>
<%
  case "checkbox"
    if rsGet.eof then
        llValue = False
    else
        llValue = rsGet( pcFieldName )
    end if
    lcValue = ""
    if ( llValue = 1 ) OR ( llValue = true ) then
         lcValue = " Checked "
    end if

%> <tr>
                <td align=right>&nbsp;</td>
                <td><input type="checkbox" name="<%=LCase(pcFieldName)%>" <%=lcValue%> style="font size:11px">&nbsp;<B><%=pcLabel%></B>&nbsp;</td>
              </tr>
<%
  case "date"
  case "calendar"
  case "memo"
    if rsGet.eof then
        lcValue = ""
    else
        lcValue = rsGet( pcFieldName )
    end if
%> <tr>
                <td align=right valign='top'><B><%=pcLabel%>:</B></td>
                <td><textarea name="<%=LCase(pcFieldName)%>" cols=<%=pnSize%> rows=<%=pnMaxLen%> style='font size:11px; FONT-FAMILY: arial;'><%=lcValue%></textarea></td>
              </tr>
<%
  case "fixed_strmax"
    if rsGet.eof then
        lcValue = ""
    else
        lcValue = rsGet( pcFieldName )
    end if
%> <tr>
                <td align=right><B><%=pcLabel%>:</B></td>
                <td><input type="text" name="<%=LCase(pcFieldName)%>" size=<%=pnSize%> maxlength=<%=pnMaxLen%> value="<%=lcValue%>" style="font size:11px"></input></td>
              </tr>
<%
  case "select_num"
' lnValue = CLng( rsGet( pcIDField ))
    if rsGet.eof then
        pnLookup = 0
    else
        pnLookup = pcIDValue
    end if
' pcIDValue = lnValue
%> <tr>
                <td align=right><B><%=pcLabel%>:</B></td>
                <td><select name="<%=LCase(pcIDField)%>" style="font size:11px">
        <OPTION value='0' style="color:red">Please make a selection</OPTION>
<% Set oRs = oConn.execute(pcSQL)
                      Do while (Not oRs.eof)
%> <option <% if ors( pcIDField ) = pnLookup then response.write "selected" end if %> value='<%=ors( pcIDField )%>'><%=oRs( pcFieldName ) %></option>
<% oRs.MoveNext
             Loop
%> </select>
    </TD>
              </TR>
<%
  case "select_oTA"
' lnValue = CLng( rsGet( pcIDField ))
    if rsGet.eof then
        pnLookup = 0
    else
        pnLookup = pcIDValue
    end if
' pcIDValue = lnValue
%> <tr>
                <td align=right><B><%=pcLabel%>:</B></td>
                <td><select name="<%=LCase(pcIDField)%>" style="font size:11px">
                      <option value='0'>Select Contact, if appropriate</option>
<% Set oRs = oTAConn.execute(pcSQL)
                      Do while (Not oRs.eof)
%> <option <% if ors( pcIDField ) = pnLookup then response.write "selected" end if %> value='<%=ors( pcIDField )%>'><%=oRs( pcFieldName ) %></option>
<% oRs.MoveNext
             Loop
%> </select>
    </TD>
              </TR>
<%
end select
end sub

sub WriteFormFooter( pcTable )
    lcShell = Request.QueryString
%> <tr>
                <td colspan=2 align=center valign=top>
        <INPUT type="button" style='font size:11px' value="New" onClick="ApplyDataMod('<%=pcInsertType%>');"></input>&nbsp;&nbsp;
        <INPUT type="button" style='font size:11px' value="Save" onClick="submit();"></input>&nbsp;&nbsp;
        <INPUT type="button" style='font size:11px' value="Delete" onClick="buttonSubmit( this.value );" DISABLED></input>&nbsp;&nbsp;
        <INPUT type="button" style='font size:11px' value="Cancel" onClick="Reposition('');"></input>
                </td>
              </tr>
              <TR>
                <TD colspan=2 vAlign=top align=left>&nbsp;&nbsp;&nbsp;</TD>
              </TR></form>
            </table>
<%
end sub

Sub BuildingTypeForm
%> <form action="<%=lcASPFile%>" method="get" name="MaintForm">
     <input type="hidden" name="doit" value="upd<%=subAction%>"></input>
     <input type="hidden" name="sact" value="<%=subAction%>"></input>
    <TABLE border=0 width=755>
<%
call MaintHeader( "Building Security Type Maintenance", "BldgSecurityTypeID", 1, "SELECT * FROM BldgSecurityType ORDER BY BldgSecurityTypeDesc;", "BldgSecurityTypeDesc" )
call WriteFormLine( "fixed_str", "Building Security Type", "BldgSecurityTypeDesc", 50, 0, "", "", "" )
if rsGet.eof then
    lcDesc = ""
else
    lcDesc = rsGet( "BldgSecurityTypeDesc" )
end if
call MaintFooter( cSQL, lcDesc, "BldgSecurityTypeDesc", "BldgSecurityTypeID", "insBuildingType", false )
End Sub

Sub RegionForm
%> <form action="<%=lcASPFile%>" method="get" name="MaintForm">
     <input type="hidden" name="doit" value="upd<%=subAction%>"></input>
     <input type="hidden" name="sact" value="<%=subAction%>"></input>
    <TABLE border=0 width=755>
<%
call MaintHeader( "Region Maintenance", "RegionID", 1, "SELECT * FROM RegionType ORDER BY RegionDesc;", "RegionDesc" )
call WriteFormLine( "fixed_str", "Region Type", "RegionDesc", 50, 0, "", "", "" )
if rsGet.eof then
    lcDesc = ""
else
    lcDesc = rsGet( "RegionDesc" )
end if
call MaintFooter( cSQL, lcDesc, "RegionDesc", "RegionID", "insRegion", false )
End Sub

Sub PostTypeForm
%> <form action="<%=lcASPFile%>" method="get" name="MaintForm">
     <input type="hidden" name="doit" value="upd<%=subAction%>"></input>
     <input type="hidden" name="sact" value="<%=subAction%>"></input>
    <TABLE border=0 width=755>
<%
call MaintHeader( "Post Type Maintenance", "PostTypeID", 1, "SELECT * FROM PostType ORDER BY PostTypeDesc;", "PostTypeDesc" )
call WriteFormLine( "fixed_str", "Post Type", "PostTypeDesc", 50, 0, "", "", "" )
if rsGet.eof then
    lcDesc = ""
else
    lcDesc = rsGet( "PostTypeDesc" )
end if
call MaintFooter( cSQL, lcDesc, "PostTypeDesc", "PostTypeID", "insPostType", false )
End Sub

Sub ESCForm
%> <form action="<%=lcASPFile%>" method="get" name="MaintForm">
     <input type="hidden" name="doit" value="upd<%=subAction%>"></input>
     <input type="hidden" name="sact" value="<%=subAction%>"></input>
    <TABLE border=0 width=755>
<%
call MaintHeader( "ESC Maintenance", "ESCID", 1, "SELECT * FROM ESC ORDER BY ESCDesc;", "ESCDesc" )
call WriteFormLine( "fixed_str", "ESC", "ESCDesc", 50, 0, "", "", "" )
if rsGet.eof then
    lcDesc = ""
else
    lcDesc = rsGet( "ESCDesc" )
end if
call MaintFooter( cSQL, lcDesc, "ESCDesc", "ESCID", "insESC", false )
End Sub

Sub ESOForm
%> <form action="<%=lcASPFile%>" method="get" name="MaintForm">
     <input type="hidden" name="doit" value="upd<%=subAction%>"></input>
     <input type="hidden" name="sact" value="<%=subAction%>"></input>
    <TABLE border=0 width=755>
<%
call MaintHeader( "ESO Maintenance", "ESOID", 1, "SELECT * FROM ESO ORDER BY ESODesc;", "ESODesc" )
call WriteFormLine( "fixed_str", "ESO", "ESODesc", 50, 0, "", "", "" )
if rsGet.eof then
    lcDesc = ""
else
    lcDesc = rsGet( "ESODesc" )
end if
call MaintFooter( cSQL, lcDesc, "ESODesc", "ESOID", "insESO", false )
End Sub

Sub RDSEForm
%> <form action="<%=lcASPFile%>" method="get" name="MaintForm">
     <input type="hidden" name="doit" value="upd<%=subAction%>"></input>
     <input type="hidden" name="sact" value="<%=subAction%>"></input>
    <TABLE border=0 width=755>
<%
call MaintHeader( "RDSE Maintenance", "RDSEID", 1, "SELECT * FROM RDSE ORDER BY RDSEDesc;", "RDSEDesc" )
call WriteFormLine( "fixed_str", "RDSE", "RDSEDesc", 50, 0, "", "", "" )
if rsGet.eof then
    lcDesc = ""
else
    lcDesc = rsGet( "RDSEDesc" )
end if
call MaintFooter( cSQL, lcDesc, "RDSEDesc", "RDSEID", "insRDSE", false )
End Sub


Sub ConfigTypeForm
%> <form action="<%=lcASPFile%>" method="get" name="MaintForm">
     <input type="hidden" name="doit" value="upd<%=subAction%>"></input>
     <input type="hidden" name="sact" value="<%=subAction%>"></input>
    <TABLE border=0 width=755>
<%
call MaintHeader( "Configuration Type Maintenance", "ConfigTypeID", 1, "SELECT * FROM ConfigType ORDER BY ConfigTypeDesc;", "ConfigTypeDesc" )
call WriteFormLine( "fixed_str", "Configuration Type", "ConfigTypeDesc", 50, 0, "", "", "" )
if rsGet.eof then
    lcDesc = ""
else
    lcDesc = rsGet( "ConfigTypeDesc" )
end if
call MaintFooter( cSQL, lcDesc, "ConfigTypeDesc", "ConfigTypeID", "insConfigType", false )
End Sub

Sub ParentForm
%> <form action="<%=lcASPFile%>" method="get" name="MaintForm">
     <input type="hidden" name="doit" value="upd<%=subAction%>"></input>
     <input type="hidden" name="sact" value="<%=subAction%>"></input>
    <TABLE border=0 width=755>
<%
call MaintHeader( "Parent Post Maintenance", "ParentID", 1, "SELECT * FROM [Parent Post] ORDER BY ParentDesc;", "ParentDesc" )
call WriteFormLine( "fixed_str", "Parent Post", "ParentDesc", 50, 0, "", "", "" )
if rsGet.eof then
    lcDesc = ""
else
    lcDesc = rsGet( "ParentDesc" )
end if
call MaintFooter( cSQL, lcDesc, "ParentDesc",
 
Old August 16th, 2006, 10:10 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Right. And now you expect us to wade through 1616 lines of code trying to figure out what exactly you mean with "can't get them to work."??? I don't think anyone is going to do that.

How about you trim the code to the relevant parts and describe your problem in much more detail....

Take a look here for some ideas about proper questions: http://www.catb.org/~esr/faqs/smart-questions.html

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old August 16th, 2006, 10:20 AM
Registered User
 
Join Date: Aug 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok I think this section should cover it please take a look.
[CODE]
Sub MaintHeader( pcTitle, pcIDFieldName, plUpdateID, pcSQL, pcDisplayField )
%> <TBODY>
              <TR>

  <TD colspan=2 class="content-headingCell"><B>&nbsp;-
    <%=pcTitle%> - </TD>
              </TR> <%
' Using the navigation buttons at the top of the form, move to the indicated record. -Position RecordSet-
    lcShell = "doit=maint" & chr(asc("&")) & "sact=" & Request.QueryString( "sact" )
    lcCurID = Request.QueryString("curid")
    lcFindID = Request.QueryString("find")
    if Len( lcCurID ) = 0 and Len( lcFindID ) > 0 then
        lcCurID = lcFindID
    end if
    lcPosition = Request.QueryString("pos")
    lcQuery = Request.QueryString()

    rsGet.Open pcSQL
    if not rsGet.eof then
        if Len( lcCurID ) > 0 then
            llCycle = true
            lnRCnt = 1
            do
                lnValue = rsGet( pcIDFieldName )
                if lnValue = CLng(lcCurID) then
                    llCycle = false
                else
                    rsGet.MoveNext
                    lnRCnt = lnRCnt + 1
                end if
                if rsGet.Eof then
                    llCycle = false
                end if
            loop while llCycle
            if lcPosition = "first" then
                rsGet.MoveFirst
            else if lcPosition = "last" then
                rsGet.MoveLast
                else if lcPosition = "next" and lnRCnt+1 <= rsGet.RecordCount then
                    if not rsGet.EOF then
                        rsGet.MoveNext
                    end if
                    else if lcPosition = "previous" and lnRCnt-1 > 0 then
                            if not rsGet.BOF then
                                rsGet.MovePrevious
                            end if
                        end if
                    end if
                end if
            end if
            lcCurID = CStr( rsGet( pcIDFieldName ))
        end if
%> <tr>
      <td align='right' colspan=2><TABLE border=0><TR><TD>
<%
        if rsGet.RecordCount > 1 then
            set rsSearch = Server.CreateObject("ADODB.Recordset")
            set rsSearch.ActiveConnection = oConn
            rsSearch.CursorType = 1
            rsSearch.Open pcSQL
            lnRecSz = rsSearch.RecordCount
%>
    <B>Search: </B><SELECT name="find" onChange="Reposition( '<%=lcShell%>&curid=' + this.value );" style="font size:11px"> <%
            nRecordBefore = 0
            do until rsSearch.eof
%> <OPTION value='<%=rsSearch( pcIDFieldName )%>' <%
                if lcCurID = CStr( rsSearch( pcIDFieldName )) then
        %> SELECTED <%
                    nRecordBefore = nPrev
                end if
                if ( pcDisplayField = "PostName" ) then
                    if ( rsSearch( "Inactive" ) = true ) then
        %> DISABLED style="font-size:11px; color:#7f7f7f"<%
                    else
        %> style="font-size:11px; color:#000000" <%
                    end if
                end if %>><%=rsSearch( pcDisplayField )%></OPTION> <%
                nPrev = rsSearch( pcIDFieldName )
                rsSearch.MoveNext
            loop %>
      </SELECT><INPUT TYPE="HIDDEN" name="prevrecid" value="<%=nRecordBefore%>">
<% rsSearch.Close
            Set rsSearch = nothing
        end if
        cAddCall = chr(asc("&")) & "curid=" & rsGet( pcIDFieldName ) & chr(asc("&")) & "pos=" %>
        <input type="button" name="Submit" value="&lt;&lt;" title="First Record" onClick="Reposition( '<%=lcShell%><%=cAddCall%>first')">
        <input type="button" name="Submit2" value="&lt;" title="Previous Record" onClick="Reposition( '<%=lcShell%><%=cAddCall%>previous')">
        <input type="button" name="Submit3" value="&gt;" title="Next Record" onClick="Reposition( '<%=lcShell%><%=cAddCall%>next')">
        <input type="button" name="Submit4" value="&gt;&gt;" title="Last Record" onClick="Reposition( '<%=lcShell%><%=cAddCall%>last')"></td></tr></table></td>
    </tr>
    <TR>
        <TD align="left"><input type="hidden" name="hiddenID" value="<%=rsGet( pcIDFieldName )%>">
    </TD></TR>
<%
    else %>
    <tr>
      <td align='right' colspan=2><TABLE border=0><TR><TD>
        <input type="button" name="Submit" value="&lt;&lt;" title="First Record" onClick="" DISABLED>
        <input type="button" name="Submit2" value="&lt;" title="Previous Record" onClick="" DISABLED>
        <input type="button" name="Submit3" value="&gt;" title="Next Record" onClick="" DISABLED>
        <input type="button" name="Submit4" value="&gt;&gt;" title="Last Record" onClick="" DISABLED></td></tr></table></td>
    </tr>
    <TR>
        <TD align="left"><input type="hidden" name="hiddenID" value="1">
    </TD></TR>
<%
    end if
End Sub

 
Old August 16th, 2006, 10:23 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Did you bother to read this: http://www.catb.org/~esr/faqs/smart-questions.html

If you keep posting the same question, I am sure you'll keep getting the same answer: http://www.catb.org/~esr/faqs/smart-questions.html

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old August 18th, 2006, 06:59 AM
Registered User
 
Join Date: Aug 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

So can you please help me with the code??


Quote:
quote:Originally posted by Imar
 Did you bother to read this: http://www.catb.org/~esr/faqs/smart-questions.html

If you keep posting the same question, I am sure you'll keep getting the same answer: http://www.catb.org/~esr/faqs/smart-questions.html

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old August 18th, 2006, 07:03 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Perhaps, if we knew what the problem was.

You have only dumped loads of code, but never described the problem. That makes it hard to suggest a solution, don't you think?
Quote:
quote:Did you bother to read this: http://www.catb.org/~esr/faqs/smart-questions.html
And did you?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
 
Old August 18th, 2006, 07:08 AM
Registered User
 
Join Date: Aug 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The problem is that I can't get the navigation buttons to work to find the First, Next, Previous, Last records in the databae table.

When and of the buttons a clicked the code just sends the user back to the main form.


Quote:
quote:Originally posted by Imar
 Perhaps, if we knew what the problem was.

You have only dumped loads of code, but never described the problem. That makes it hard to suggest a solution, don't you think?
Quote:
quote:Did you bother to read this: http://www.catb.org/~esr/faqs/smart-questions.html
And did you?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
 
Old August 18th, 2006, 07:17 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I give up. If you want help, you have to help us help you.

We can't look into you head; we don't know what your code does; we don't know what "I can't get the navigation buttons to work" means; we don't know whether you get an error or not; we don't know what your intentions are and we don't know what the code is supposed to do. You can't expect us to find out the problem ourselves and then suggest a fix. The first part is your task.

The page I linked to describes how to ask proper questions, so all of the questions above are answered. Apparently, you find it troublesome to read that page, follow its suggestions, read my replies and follow my suggestions, so it looks like you don't want help.

I really tried, but this is fruitless.....

Maybe someone else can help.

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.









Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.