
29/03/2003, 05:09
|
| | Fecha de Ingreso: noviembre-2002
Mensajes: 253
Antigüedad: 22 años, 5 meses Puntos: 2 | |
<%@ Language=VBScript%>
<!--#include file ="media/IIS_Gen_3.0_ConnectionPool.js"-->
<!--#include file ="media/IIS_Gen_3.0_Recordset.js"-->
<!--#include file ="media/MkOptnFmRecordset.js"-->
<!--#include file ="media/IIS_ServerHTMLEncode.js"-->
<%
REM Connection Cache
Set ConnectionCache = CreateConnectionCache()
REM server-side recordset
Set emp_cons = CreateRS("emp_cons", "mercafil", "admin", "", "select * from emp_const", "empresa", true, 2, 3, 3, "")
Call emp_cons_BeforeOpen()
Call emp_cons.Open()
Call emp_cons.ProcessAction()
Call emp_cons.SetMessages("","")
Call emp_cons_Server()
REM server-side recordset
Set tipo_cons = CreateRS("tipo_cons", "mercafil", "admin", "", "select * from tipo_cons", "", true, 2, 3, 3, "")
Call tipo_cons.Open()
Call tipo_cons.ProcessAction()
Call tipo_cons.SetMessages("","")
%>
<%
Sub emp_cons_Server()
if CStr(Request("FormButton1")) <> "" then
Response.Redirect(URLEscapeSpaces("listconst.asp") & "?emp_cons_Action=" & Server.URLEncode(emp_cons.FilterString) & "&emp_cons_Position=PAR:" & Server.URLEncode(emp_cons.GetParams()))
end if
End Sub
Sub emp_cons_BeforeOpen()
if CStr(Request("FormButton1")) <> "" then
AddToFilter emp_cons, "List1", "tipo", "=", "AND", "ListBox", " "
end if
VBeval("emp_cons.Open = DSNLessRecordsetOpen")
fn = "emp_cons.filename = """ & "construline.mdb" & """"
VBeval(fn)
End Sub
Sub List1_Server(html)
html_string = ""
location = Instr(1, html, "<Option")
if location <> 0 then
html_string = Left(html, location) & "<Option Value=" & ""
selected = "0"
if selected = "1" then
html_string = html_string & " SELECTED "
end if
html_string = html_string & "> " & "" & Mid(html, location)
else
html_string = html
end if
Response.Write(html_string)
End Sub
%>
<SCRIPT LANGUAGE=JavaScript RUNAT=Server>
// Support Script (724)
function AddToFilter(objRecordset, strElementName, strFieldName, strOperator, strConnector, strElementType, strClauseSeparator)
{
var strValue
var doc
var strFilter
var strBeginWildCard = ""
var strEndWildCard = ""
var strBeginClause = ""
var strEndClause = ""
var strLocalOperator = strOperator
var strTableName = ""
var strColumnName = ""
var strTheFieldName
// Analyze the field name for table names and spaces
dotPos = strFieldName.indexOf(".")
if (dotPos > 0)
{
strTableName = strFieldName.substring(0,dotPos)
strColumnName = strFieldName.substring(dotPos + 1, strFieldName.length)
if (strTableName.indexOf(" ") >= 0 && strTableName.charAt(strTableName.length - 1) != "]")
{
strTableName = "[" + strTableName + "]"
}
strTableName += "."
}
else
{
strColumnName = strFieldName
}
if (strColumnName.indexOf(" ") >= 0 && strColumnName.charAt(strColumnName.length - 1) != "]")
{
strColumnName = "[" + strColumnName + "]"
}
strTheFieldName = strTableName + strColumnName
if (strClauseSeparator == "(")
{
strBeginClause = "("
}
else if (strClauseSeparator == ")")
{
strEndClause = ")"
}
if (strConnector == " ")
{
strFilter = ""
}
else
{
if (objRecordset.FilterString)
{
strFilter = objRecordset.FilterString
}
else
{
strFilter = ""
}
strFilter = StripFilterWrap(strFilter)
}
if (strElementType == "EditBox" || strElementType == "ListBox")
{
strValue = String(Request(strElementName))
}
else if (strElementType == "Value")
{
strValue = strElementName
}
else
{
if (String(Request(strElementName)) == "undefined")
{
strValue = "false"
}
else
{
strValue = "true"
}
}
strValue = FilterSupportEscapeQuotes(strValue)
if (strOperator == "Begins with")
{
strEndWildCard = "*"
strLocalOperator = "LIKE"
}
if (strOperator == "Includes")
{
strBeginWildCard = "*"
strEndWildCard = "*"
strLocalOperator = "LIKE"
}
if (strOperator == "Not equal to")
{
strLocalOperator = "<>"
}
if (strValue != "")
{
if (strFilter == "")
{
// We don't want to start off with "AND" or "OR"
strConnector = ""
}
strFilter += " " + strConnector + " " + strBeginClause + strTheFieldName + " " + strLocalOperator + " '" + strBeginWildCard + strValue + strEndWildCard + "'" + strEndClause
}
strFilter = AddFilterWrap(strFilter)
objRecordset.FilterString = strFilter
//Response.Write("<br>Filter = " + strFilter)
}
// This function takes a string
// such as XXXXXX and returns Filter("XXXXXX")
//
function AddFilterWrap(strIn)
{
var strOut
strOut = "Filter(\"" + strIn + "\")"
return strOut
}
// This function takes a string
// such as Filter("XXXXXX") and returns XXXXXX
//
function StripFilterWrap(s)
{
var strIn = String(s)
var strOut = ""
if (strIn == "")
{
return ""
}
if (strIn.indexOf("Filter(") == 0)
{
// There is already a filter, let's strip it
strOut = strIn.substring(8, strIn.length - 2)
}
else
{
strOut = strIn
}
return strOut
}
// This function takes a string. If strIn is
// Hello "there" how's it going?
// then this function will return
// Hello \"there\" how''s it going?
//
function FilterSupportEscapeQuotes(strIn)
{
var i
var theChar
var strOut = ""
var inString = String(strIn)
for (i = 0; i < inString.length; i++)
{
theChar = inString.charAt(i)
if (theChar == "'")
strOut += "'"
if (theChar == '"')
strOut += "\\"
strOut += theChar
}
return strOut
}
// This function creates a filter based on values submitted
// by a list box. Multiple values that are comma-delimited
// are accepted. NOTE: All commas are considered delimiters.
//
function CreateMultiListFilter(strElementName, strFieldName, strOperator)
{
var strValue
var thisVal
var doc
var strFilter
var strBeginWildCard = ""
var strEndWildCard = ""
var strLocalOperator = strOperator
var strTableName = ""
var strColumnName = ""
var strTheFieldName
var dotPos
var i
} |