<%@LANGUAGE="VBSCRIPT"%> <%session("RELOAD")=true %> <% ' *** Restrict Access To Page: Grant or deny access to this page MM_authorizedUsers="ADMIN,ENTER" MM_authFailedURL="login.asp" MM_grantAccess=false If Session("MM_Username") <> "" Then If (false Or CStr(Session("MM_UserAuthorization"))="") Or _ (InStr(1,MM_authorizedUsers,Session("MM_UserAuthorization"))>=1) Then MM_grantAccess = true End If End If If Not MM_grantAccess Then MM_qsChar = "?" If (InStr(1,MM_authFailedURL,"?") >= 1) Then MM_qsChar = "&" MM_referrer = Request.ServerVariables("URL") if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString() MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer) Response.Redirect(MM_authFailedURL) End If %> <% ' *** Edit Operations: declare variables MM_editAction = CStr(Request("URL")) If (Request.QueryString <> "") Then MM_editAction = MM_editAction & "?" & Request.QueryString End If ' boolean to abort record edit MM_abortEdit = false ' query string to execute MM_editQuery = "" %> <% ' *** Insert Record: set variables If (CStr(Request("MM_insert")) <> "") Then MM_editConnection = MM_entradas_STRING MM_editTable = "CAMPOS_ACCESO" MM_editRedirectUrl = "" MM_fieldsStr = "ALIAS|value|NOMBRE|value|IDACCESS|value|VER|value|EDITAR|value" MM_columnsStr = "ALIAS|',none,''|NOMBRE|',none,''|IDACCESS|none,none,NULL|VER|none,1,0|EDITAR|none,1,0" ' create the MM_fields and MM_columns arrays MM_fields = Split(MM_fieldsStr, "|") MM_columns = Split(MM_columnsStr, "|") ' set the form values For i = LBound(MM_fields) To UBound(MM_fields) Step 2 MM_fields(i+1) = CStr(Request.Form(MM_fields(i))) Next End If %> <% ' *** Update Record: set variables If (CStr(Request("MM_update")) <> "" And CStr(Request("MM_recordId")) <> "") Then MM_editConnection = MM_entradas_STRING MM_editTable = "CAMPOS_ACCESO" MM_editColumn = "IDCAMPOS" MM_recordId = "" + Request.Form("MM_recordId") + "" MM_editRedirectUrl = "" MM_fieldsStr = "ALIAS|value|VER|value|EDITAR|value" MM_columnsStr = "ALIAS|',none,''|VER|none,1,0|EDITAR|none,1,0" ' create the MM_fields and MM_columns arrays MM_fields = Split(MM_fieldsStr, "|") MM_columns = Split(MM_columnsStr, "|") ' set the form values For i = LBound(MM_fields) To UBound(MM_fields) Step 2 MM_fields(i+1) = CStr(Request.Form(MM_fields(i))) Next End If %> <% ' *** Delete Record: declare variables if (CStr(Request("MM_delete")) <> "" And CStr(Request("MM_recordId")) <> "") Then MM_editConnection = MM_entradas_STRING MM_editTable = "CAMPOS_ACCESO" MM_editColumn = "IDCAMPOS" MM_recordId = "" + Request("MM_recordId") + "" MM_editRedirectUrl = "fields.asp?IDACCESS=" + Request("IDACCESS") End If %> <% ' *** Insert Record: construct a sql insert statement and execute it If (CStr(Request("MM_insert")) <> "") Then ' create the sql insert statement MM_tableValues = "" MM_dbValues = "" For i = LBound(MM_fields) To UBound(MM_fields) Step 2 FormVal = MM_fields(i+1) MM_typeArray = Split(MM_columns(i+1),",") Delim = MM_typeArray(0) If (Delim = "none") Then Delim = "" AltVal = MM_typeArray(1) If (AltVal = "none") Then AltVal = "" EmptyVal = MM_typeArray(2) If (EmptyVal = "none") Then EmptyVal = "" If (FormVal = "") Then FormVal = EmptyVal Else If (AltVal <> "") Then FormVal = AltVal ElseIf (Delim = "'") Then ' escape quotes FormVal = "'" & strreplace(FormVal,"'","''") & "'" Else FormVal = Delim + FormVal + Delim End If End If If (i <> LBound(MM_fields)) Then MM_tableValues = MM_tableValues & "," MM_dbValues = MM_dbValues & "," End if MM_tableValues = MM_tableValues & MM_columns(i) MM_dbValues = MM_dbValues & FormVal Next MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")" 'Evita Duplicar Campos Set rp = Server.CreateObject("ADODB.Recordset") rp.ActiveConnection = MM_editConnection rp.Source = "SELECT * FROM CAMPOS_ACCESO WHERE IDACCESS=" + request("IDACCESS") + " AND NOMBRE='" + request("NOMBRE") + "'" rp.Open() if not rp.eof then MM_abortEdit=true rp.close 'Fin Evita Duplicar Campos If (Not MM_abortEdit) Then ' execute the insert Set MM_editCmd = Server.CreateObject("ADODB.Command") MM_editCmd.ActiveConnection = MM_editConnection MM_editCmd.CommandText = MM_editQuery MM_editCmd.Execute MM_editCmd.ActiveConnection.Close If (MM_editRedirectUrl <> "") Then Response.Redirect(MM_editRedirectUrl) End If End If End If %> <% ' *** Update Record: construct a sql update statement and execute it If (CStr(Request("MM_update")) <> "" And CStr(Request("MM_recordId")) <> "") Then ' create the sql update statement MM_editQuery = "update " & MM_editTable & " set " For i = LBound(MM_fields) To UBound(MM_fields) Step 2 FormVal = MM_fields(i+1) MM_typeArray = Split(MM_columns(i+1),",") Delim = MM_typeArray(0) If (Delim = "none") Then Delim = "" AltVal = MM_typeArray(1) If (AltVal = "none") Then AltVal = "" EmptyVal = MM_typeArray(2) If (EmptyVal = "none") Then EmptyVal = "" If (FormVal = "") Then FormVal = EmptyVal Else If (AltVal <> "") Then FormVal = AltVal ElseIf (Delim = "'") Then ' escape quotes FormVal = "'" & strreplace(FormVal,"'","''") & "'" Else FormVal = Delim + FormVal + Delim End If End If If (i <> LBound(MM_fields)) Then MM_editQuery = MM_editQuery & "," End If MM_editQuery = MM_editQuery & MM_columns(i) & " = " & FormVal Next MM_editQuery = MM_editQuery & " where " & MM_editColumn & " = " & MM_recordId If (Not MM_abortEdit) Then ' execute the update Set MM_editCmd = Server.CreateObject("ADODB.Command") MM_editCmd.ActiveConnection = MM_editConnection MM_editCmd.CommandText = MM_editQuery MM_editCmd.Execute MM_editCmd.ActiveConnection.Close If (MM_editRedirectUrl <> "") Then Response.Redirect(MM_editRedirectUrl) End If End If End If %> <% ' *** Delete Record: construct a sql delete statement and execute it If (CStr(Request("MM_delete")) <> "" And CStr(Request("MM_recordId")) <> "") Then ' create the sql delete statement MM_editQuery = "delete from " & MM_editTable & " where " & MM_editColumn & " = " & MM_recordId If (Not MM_abortEdit) Then ' execute the delete Set MM_editCmd = Server.CreateObject("ADODB.Command") MM_editCmd.ActiveConnection = MM_editConnection MM_editCmd.CommandText = MM_editQuery MM_editCmd.Execute MM_editCmd.ActiveConnection.Close If (MM_editRedirectUrl <> "") Then Response.Redirect(MM_editRedirectUrl) End If End If End If %> <% set fl = Server.CreateObject("ADODB.Recordset") fl.ActiveConnection = MM_entradas_STRING fl.Source = "SELECT * FROM ENTRADAS WHERE ID=0" fl.CursorType = 0 fl.CursorLocation = 2 fl.LockType = 3 fl.Open() fl_numRows = 0 %> <% Dim nivs__VICS nivs__VICS = "1" if (request("IDACCESS") <> "") then nivs__VICS = request("IDACCESS") %> <% set nivs = Server.CreateObject("ADODB.Recordset") nivs.ActiveConnection = MM_entradas_STRING nivs.Source = "SELECT * FROM CAMPOS_ACCESO WHERE IDACCESS=" + strreplace(nivs__VICS, "'", "''") + "" nivs.CursorType = 0 nivs.CursorLocation = 2 nivs.LockType = 3 nivs.Open() nivs_numRows = 0 %> <% Dim Repeat1__numRows Repeat1__numRows = -1 Dim Repeat1__index Repeat1__index = 0 nivs_numRows = nivs_numRows + Repeat1__numRows %> www.promad.com.mx
<% if request("IDACCESS")<>"" then ' Adv Conditional Region %>
Selector de Campos:
Aqui usted podrá seleccionar los campos a los que tiene acceso el usuario, El campo Obligatorio para todas los perfiles es el de ID, se recomienda que ID solo sea un campo de Tipo VER, debido a que forma parte de un consecutivo interno whe mantiene en orden los datos.

a)Para agregar un Nuevo campo al Perfil, seleccione la columna que desea y escriba el Nombre que desea se muestre en el Perfil (*Nota- Puede usar diferentes nombre en diferentes Perfiles). Después Seleccione el tipo de acceso que desea proveer (Consulta o Edición [Ver,Editar]) Y Finalmente Presione en "Permitir". El sistema Automaticamente le Sugiere el Siguiente Campo para su facilidad de Captura.

b) Para cambiar los campos de un Perfil actual corrija en el renglon Correspondiente los datos y Presione el Botón de "Actualizar"

c) Si desea eliminar por completo el acceso a un campo utilice el Boton de "x" en el renglón Correspondiente.

** NOTA -Después de una modificación En esta pantalla se le pedirá que ingrese de nuevo su contraseña.
Campo: Nombre a Mostrar   Agregar Columnas
"> Ver Editar
 
<%cmp=0 %> <% While ((Repeat1__numRows <> 0) AND (NOT nivs.EOF)) %> <%cmp=cmp+1 %> "> <% Repeat1__index=Repeat1__index+1 Repeat1__numRows=Repeat1__numRows-1 nivs.MoveNext() Wend %>
Campo
Acceso
<%=(nivs.Fields.Item("NOMBRE").Value)%> " size="20" maxlength="50" class="arialsmall"> type="checkbox" name="VER" value="1"> Ver type="checkbox" name="EDITAR" value="1"> Editar "> &IDACCESS=<%=request("IDACCESS") %>');return document.MM_returnValue">
 
Total de Campos: <%=cnt %>
Campos con Acceso: <%=cmp %>
<% end if ' request("IDACCESS")<>"" %>

  
 
 
<% fl.Close() %> <% nivs.Close() %>