Server IP : 103.118.17.23 / Your IP : 216.73.216.169 Web Server : Microsoft-IIS/10.0 System : Windows NT RESELLERPLESK22 10.0 build 20348 (Windows Server 2016) AMD64 User : IWAM_plesk(default) ( 0) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : E:/Inetpub/vhosts/mesa.org.in/httpdocs/grievance/ |
Upload File : |
<%@ CodePage="65001" %> <% Response.Buffer = EW_RESPONSE_BUFFER %> <!--#include file="ewcfg.asp"--> <!--#include file="Grievanceinfo.asp"--> <!--#include file="aspfn.asp"--> <!--#include file="userfn.asp"--> <% Call ew_Header(False, EW_CHARSET, False) %> <% ' Define page object Dim Grievance_delete Set Grievance_delete = New cGrievance_delete Set Page = Grievance_delete ' Page init processing Call Grievance_delete.Page_Init ' Page main Call Grievance_delete.Page_Main ' Global Page Rendering event (in userfn*.asp) Page_Rendering() ' Page Render event Grievance_delete.Page_Render() %> <!--#include file="header.asp"--> <script type="text/javascript"> // Form object var CurrentPageID = EW_PAGE_ID = "delete"; var CurrentForm = fGrievancedelete = new ew_Form("fGrievancedelete", "delete"); // Form_CustomValidate event fGrievancedelete.Form_CustomValidate = function(fobj) { // DO NOT CHANGE THIS LINE! // Your custom validation code here, return false if invalid. return true; } // Use JavaScript validation or not <% If EW_CLIENT_VALIDATE Then %> fGrievancedelete.ValidateRequired = true; // Use JavaScript validation <% Else %> fGrievancedelete.ValidateRequired = false; // No JavaScript validation <% End If %> // Dynamic selection lists fGrievancedelete.Lists["x_Gender"] = {"LinkField":"","Ajax":null,"AutoFill":false,"DisplayFields":["","","",""],"ParentFields":[],"ChildFields":[],"FilterFields":[],"Options":[],"Template":""}; fGrievancedelete.Lists["x_Gender"].Options = <%= ew_ArrayToJson(Grievance.Gender.Options(False)) %>; fGrievancedelete.Lists["x_Agree"] = {"LinkField":"","Ajax":null,"AutoFill":false,"DisplayFields":["","","",""],"ParentFields":[],"ChildFields":[],"FilterFields":[],"Options":[],"Template":""}; fGrievancedelete.Lists["x_Agree"].Options = <%= ew_ArrayToJson(Grievance.Agree.Options(False)) %>; <% Set arAS = Nothing %> // Form object for search </script> <script type="text/javascript"> // Write your client script here, no need to add script tags. </script> <% Call Grievance_delete.ShowPageHeader %> <% Call Grievance_delete.ShowMessage %> <form name="fGrievancedelete" id="fGrievancedelete" class="form-inline ewForm ewDeleteForm" action="<%= ew_CurrentPage() %>" method="post"> <% If Grievance_delete.CheckToken Then %> <input type="hidden" name="<%= EW_TOKEN_NAME %>" value="<%= Grievance_delete.Token %>"> <% End If %> <input type="hidden" name="t" value="Grievance"> <input type="hidden" name="a_delete" id="a_delete" value="D"> <% For i = 0 to UBound(Grievance_delete.RecKeys) %> <input type="hidden" name="key_m" id="key_m" value="<%= ew_HtmlEncode(ew_GetKeyValue(Grievance_delete.RecKeys(i))) %>"> <% Next %> <div class="box ewBox ewGrid"> <div class="<% If ew_IsResponsiveLayout() Then %>table-responsive <% End If %>ewGridMiddlePanel"> <table class="table ewTable"> <thead> <tr class="ewTableHeader"> <% If Grievance.ID.Visible Then ' ID %> <th class="<%= Grievance.ID.HeaderCellClass() %>"><span id="elh_Grievance_ID" class="Grievance_ID"><%= Grievance.ID.FldCaption %></span></th> <% End If %> <% If Grievance.Name.Visible Then ' Name %> <th class="<%= Grievance.Name.HeaderCellClass() %>"><span id="elh_Grievance_Name" class="Grievance_Name"><%= Grievance.Name.FldCaption %></span></th> <% End If %> <% If Grievance.zEmail.Visible Then ' Email %> <th class="<%= Grievance.zEmail.HeaderCellClass() %>"><span id="elh_Grievance_zEmail" class="Grievance_zEmail"><%= Grievance.zEmail.FldCaption %></span></th> <% End If %> <% If Grievance.Password.Visible Then ' Password %> <th class="<%= Grievance.Password.HeaderCellClass() %>"><span id="elh_Grievance_Password" class="Grievance_Password"><%= Grievance.Password.FldCaption %></span></th> <% End If %> <% If Grievance.Mobile.Visible Then ' Mobile %> <th class="<%= Grievance.Mobile.HeaderCellClass() %>"><span id="elh_Grievance_Mobile" class="Grievance_Mobile"><%= Grievance.Mobile.FldCaption %></span></th> <% End If %> <% If Grievance.Gender.Visible Then ' Gender %> <th class="<%= Grievance.Gender.HeaderCellClass() %>"><span id="elh_Grievance_Gender" class="Grievance_Gender"><%= Grievance.Gender.FldCaption %></span></th> <% End If %> <% If Grievance.Department.Visible Then ' Department %> <th class="<%= Grievance.Department.HeaderCellClass() %>"><span id="elh_Grievance_Department" class="Grievance_Department"><%= Grievance.Department.FldCaption %></span></th> <% End If %> <% If Grievance.Grievance_1.Visible Then ' Grievance %> <th class="<%= Grievance.Grievance_1.HeaderCellClass() %>"><span id="elh_Grievance_Grievance_1" class="Grievance_Grievance_1"><%= Grievance.Grievance_1.FldCaption %></span></th> <% End If %> <% If Grievance.Docs.Visible Then ' Docs %> <th class="<%= Grievance.Docs.HeaderCellClass() %>"><span id="elh_Grievance_Docs" class="Grievance_Docs"><%= Grievance.Docs.FldCaption %></span></th> <% End If %> <% If Grievance.Agree.Visible Then ' Agree %> <th class="<%= Grievance.Agree.HeaderCellClass() %>"><span id="elh_Grievance_Agree" class="Grievance_Agree"><%= Grievance.Agree.FldCaption %></span></th> <% End If %> </tr> </thead> <tbody> <% Grievance_delete.RecCnt = 0 Grievance_delete.RowCnt = 0 Do While Not Grievance_delete.Recordset.EOF Grievance_delete.RecCnt = Grievance_delete.RecCnt + 1 Grievance_delete.RowCnt = Grievance_delete.RowCnt + 1 ' Set row properties Call Grievance.ResetAttrs Grievance.RowType = EW_ROWTYPE_VIEW ' view ' Get the field contents Call Grievance_delete.LoadRowValues(Grievance_delete.Recordset) ' Render row Call Grievance_delete.RenderRow %> <tr<%= Grievance.RowAttributes %>> <% If Grievance.ID.Visible Then ' ID %> <td<%= Grievance.ID.CellAttributes %>> <span id="el<%= Grievance_delete.RowCnt %>_Grievance_ID" class="form-group Grievance_ID"> <span<%= Grievance.ID.ViewAttributes %>> <%= Grievance.ID.ListViewValue %> </span> </span> </td> <% End If %> <% If Grievance.Name.Visible Then ' Name %> <td<%= Grievance.Name.CellAttributes %>> <span id="el<%= Grievance_delete.RowCnt %>_Grievance_Name" class="form-group Grievance_Name"> <span<%= Grievance.Name.ViewAttributes %>> <%= Grievance.Name.ListViewValue %> </span> </span> </td> <% End If %> <% If Grievance.zEmail.Visible Then ' Email %> <td<%= Grievance.zEmail.CellAttributes %>> <span id="el<%= Grievance_delete.RowCnt %>_Grievance_zEmail" class="form-group Grievance_zEmail"> <span<%= Grievance.zEmail.ViewAttributes %>> <%= Grievance.zEmail.ListViewValue %> </span> </span> </td> <% End If %> <% If Grievance.Password.Visible Then ' Password %> <td<%= Grievance.Password.CellAttributes %>> <span id="el<%= Grievance_delete.RowCnt %>_Grievance_Password" class="form-group Grievance_Password"> <span<%= Grievance.Password.ViewAttributes %>> <%= Grievance.Password.ListViewValue %> </span> </span> </td> <% End If %> <% If Grievance.Mobile.Visible Then ' Mobile %> <td<%= Grievance.Mobile.CellAttributes %>> <span id="el<%= Grievance_delete.RowCnt %>_Grievance_Mobile" class="form-group Grievance_Mobile"> <span<%= Grievance.Mobile.ViewAttributes %>> <%= Grievance.Mobile.ListViewValue %> </span> </span> </td> <% End If %> <% If Grievance.Gender.Visible Then ' Gender %> <td<%= Grievance.Gender.CellAttributes %>> <span id="el<%= Grievance_delete.RowCnt %>_Grievance_Gender" class="form-group Grievance_Gender"> <span<%= Grievance.Gender.ViewAttributes %>> <%= Grievance.Gender.ListViewValue %> </span> </span> </td> <% End If %> <% If Grievance.Department.Visible Then ' Department %> <td<%= Grievance.Department.CellAttributes %>> <span id="el<%= Grievance_delete.RowCnt %>_Grievance_Department" class="form-group Grievance_Department"> <span<%= Grievance.Department.ViewAttributes %>> <%= Grievance.Department.ListViewValue %> </span> </span> </td> <% End If %> <% If Grievance.Grievance_1.Visible Then ' Grievance %> <td<%= Grievance.Grievance_1.CellAttributes %>> <span id="el<%= Grievance_delete.RowCnt %>_Grievance_Grievance_1" class="form-group Grievance_Grievance_1"> <span<%= Grievance.Grievance_1.ViewAttributes %>> <%= Grievance.Grievance_1.ListViewValue %> </span> </span> </td> <% End If %> <% If Grievance.Docs.Visible Then ' Docs %> <td<%= Grievance.Docs.CellAttributes %>> <span id="el<%= Grievance_delete.RowCnt %>_Grievance_Docs" class="form-group Grievance_Docs"> <span<%= Grievance.Docs.ViewAttributes %>> <%= ew_GetFileViewTag(Grievance.Docs, Grievance.Docs.ListViewValue) %> </span> </span> </td> <% End If %> <% If Grievance.Agree.Visible Then ' Agree %> <td<%= Grievance.Agree.CellAttributes %>> <span id="el<%= Grievance_delete.RowCnt %>_Grievance_Agree" class="form-group Grievance_Agree"> <span<%= Grievance.Agree.ViewAttributes %>> <%= Grievance.Agree.ListViewValue %> </span> </span> </td> <% End If %> </tr> <% Grievance_delete.Recordset.MoveNext Loop Grievance_delete.Recordset.Close Set Grievance_delete.Recordset = Nothing %> </tbody> </table> </div> </div> <div> <button class="btn btn-primary ewButton" name="btnAction" id="btnAction" type="submit"><%= Language.Phrase("DeleteBtn") %></button> <button class="btn btn-default ewButton" name="btnCancel" id="btnCancel" type="button" data-href="<%= Grievance.ReturnUrl %>"><%= Language.Phrase("CancelBtn") %></button> </div> </form> <script type="text/javascript"> fGrievancedelete.Init(); </script> <% Call Grievance_delete.ShowPageFooter If EW_DEBUG_ENABLED Then Response.Write ew_DebugMsg() %> <script type="text/javascript"> // Write your table-specific startup script here // document.write("page loaded"); </script> <!--#include file="footer.asp"--> <% ' Clean up and drop page object Call Grievance_delete.Page_Terminate("") Set Grievance_delete = Nothing %> <% ' ' Page Class ' Class cGrievance_delete ' Page ID Public Property Get PageID PageID = "delete" End Property ' Project ID Public Property Get ProjectID ProjectID = "{8003004D-83C2-4A95-B99C-604B4C198F71}" End Property ' Table Name Public Property Get TableName TableName = "Grievance" End Property ' Page Object Name Public Property Get PageObjName PageObjName = "Grievance_delete" End Property ' Field (ID) Public Property Get ID Set ID = Grievance.ID End Property ' Field (Name) Public Property Get Name Set Name = Grievance.Name End Property ' Field (Email) Public Property Get zEmail Set zEmail = Grievance.zEmail End Property ' Field (Password) Public Property Get Password Set Password = Grievance.Password End Property ' Field (Mobile) Public Property Get Mobile Set Mobile = Grievance.Mobile End Property ' Field (Gender) Public Property Get Gender Set Gender = Grievance.Gender End Property ' Field (Department) Public Property Get Department Set Department = Grievance.Department End Property ' Field (Grievance) Public Property Get Grievance_1 Set Grievance_1 = Grievance.Grievance_1 End Property ' Field (Docs) Public Property Get Docs Set Docs = Grievance.Docs End Property ' Field (Agree) Public Property Get Agree Set Agree = Grievance.Agree End Property ' Get field object dictionary (ASP) Public Property Get Fields Set Fields = Grievance.Fields End Property ' Get field object by name (alias of Fields) (ASP) Public Function GetField(Name) Set GetField = Fields.Get(Name) End Function ' Get field object by parm (ASP) Public Function GetFieldByParm(Parm) Dim keys, key keys = Fields.Keys() For Each key In keys If Fields.Get(key).FldParm = Parm Then Set GetFieldByParm = Fields.Get(key) Exit Function End If Next Set GetFieldByParm = Nothing End Function ' Export document (ASP) Dim ExportDoc ' Page headings Dim Heading Dim Subheading ' Page heading Function PageHeading() PageHeading = "" If Heading <> "" Then PageHeading = Heading ElseIf ew_NotEmpty(Grievance) Then PageHeading = Grievance.TableCaption End If End Function ' Page subheading Function PageSubheading() If Subheading <> "" Then PageSubheading = Subheading Else PageSubheading = "" If TableName <> "" Then PageSubheading = Language.Phrase(PageID) End If End If End Function ' Page Name Public Property Get PageName PageName = ew_CurrentPage() End Property ' Page Url Public Property Get PageUrl PageUrl = ew_CurrentPage() & "?" If Grievance.UseTokenInUrl Then PageUrl = PageUrl & "t=" & Grievance.TableVar & "&" ' add page token End Property ' Message Public Property Get Message Message = Session(EW_SESSION_MESSAGE) End Property Public Property Let Message(v) Dim msg msg = Session(EW_SESSION_MESSAGE) Call ew_AddMessage(msg, v) Session(EW_SESSION_MESSAGE) = msg End Property Public Property Get FailureMessage FailureMessage = Session(EW_SESSION_FAILURE_MESSAGE) End Property Public Property Let FailureMessage(v) Dim msg msg = Session(EW_SESSION_FAILURE_MESSAGE) Call ew_AddMessage(msg, v) Session(EW_SESSION_FAILURE_MESSAGE) = msg End Property Public Property Get SuccessMessage SuccessMessage = Session(EW_SESSION_SUCCESS_MESSAGE) End Property Public Property Let SuccessMessage(v) Dim msg msg = Session(EW_SESSION_SUCCESS_MESSAGE) Call ew_AddMessage(msg, v) Session(EW_SESSION_SUCCESS_MESSAGE) = msg End Property Public Property Get WarningMessage WarningMessage = Session(EW_SESSION_WARNING_MESSAGE) End Property Public Property Let WarningMessage(v) Dim msg msg = Session(EW_SESSION_WARNING_MESSAGE) Call ew_AddMessage(msg, v) Session(EW_SESSION_WARNING_MESSAGE) = msg End Property ' Methods to clear message Public Sub ClearMessage() Session(EW_SESSION_MESSAGE) = "" End Sub Public Sub ClearFailureMessage() Session(EW_SESSION_FAILURE_MESSAGE) = "" End Sub Public Sub ClearSuccessMessage() Session(EW_SESSION_SUCCESS_MESSAGE) = "" End Sub Public Sub ClearWarningMessage() Session(EW_SESSION_WARNING_MESSAGE) = "" End Sub Public Sub ClearMessages() Session(EW_SESSION_MESSAGE) = "" Session(EW_SESSION_FAILURE_MESSAGE) = "" Session(EW_SESSION_SUCCESS_MESSAGE) = "" Session(EW_SESSION_WARNING_MESSAGE) = "" End Sub ' Show Message Public Sub ShowMessage() Dim hidden, html, sMessage hidden = False html = "" ' Message sMessage = Message Call Message_Showing(sMessage, "") If sMessage <> "" Then ' Message in Session, display If Not hidden Then sMessage = "<button type=""button"" class=""close"" data-dismiss=""alert"">×</button>" & sMessage html = html & "<div class=""alert alert-info ewInfo"">" & sMessage & "</div>" Session(EW_SESSION_MESSAGE) = "" ' Clear message in Session End If ' Warning message Dim sWarningMessage sWarningMessage = WarningMessage Call Message_Showing(sWarningMessage, "warning") If sWarningMessage <> "" Then ' Message in Session, display If Not hidden Then sWarningMessage = "<button type=""button"" class=""close"" data-dismiss=""alert"">×</button>" & sWarningMessage html = html & "<div class=""alert alert-warning ewWarning"">" & sWarningMessage & "</div>" Session(EW_SESSION_WARNING_MESSAGE) = "" ' Clear message in Session End If ' Success message Dim sSuccessMessage sSuccessMessage = SuccessMessage Call Message_Showing(sSuccessMessage, "success") If sSuccessMessage <> "" Then ' Message in Session, display If Not hidden Then sSuccessMessage = "<button type=""button"" class=""close"" data-dismiss=""alert"">×</button>" & sSuccessMessage html = html & "<div class=""alert alert-success ewSuccess"">" & sSuccessMessage & "</div>" Session(EW_SESSION_SUCCESS_MESSAGE) = "" ' Clear message in Session End If ' Failure message Dim sErrorMessage sErrorMessage = FailureMessage Call Message_Showing(sErrorMessage, "failure") If sErrorMessage <> "" Then ' Message in Session, display If Not hidden Then sErrorMessage = "<button type=""button"" class=""close"" data-dismiss=""alert"">×</button>" & sErrorMessage html = html & "<div class=""alert alert-danger ewError"">" & sErrorMessage & "</div>" Session(EW_SESSION_FAILURE_MESSAGE) = "" ' Clear message in Session End If Response.Write "<div class=""ewMessageDialog""" & ew_IIf(hidden, " style=""display: none;""", "") & ">" & html & "</div>" End Sub Dim PageHeader Dim PageFooter ' Show Page Header Public Sub ShowPageHeader() Dim sHeader sHeader = PageHeader Call Page_DataRendering(sHeader) If sHeader <> "" Then ' Header exists, display Response.Write "<p>" & sHeader & "</p>" End If End Sub ' Show Page Footer Public Sub ShowPageFooter() Dim sFooter sFooter = PageFooter Call Page_DataRendered(sFooter) If sFooter <> "" Then ' Footer exists, display Response.Write "<p>" & sFooter & "</p>" End If End Sub ' ' Validate Page request ' Public Function IsPageRequest() If Grievance.UseTokenInUrl Then IsPageRequest = False If ew_NotEmpty(ObjForm) Then IsPageRequest = (Grievance.TableVar = ObjForm.GetValue("t")) End If If Request.QueryString("t").Count > 0 Then IsPageRequest = (Grievance.TableVar = Request.QueryString("t")) End If Else IsPageRequest = True End If End Function Dim Token Dim CheckToken Dim TokenTimeout ' Valid Post Function ValidPost() If Not CheckToken Or Not ew_IsPost() Then ValidPost = True Exit Function End If If Request.Form(EW_TOKEN_NAME).Count = 0 Then ValidPost = False Exit Function End If ValidPost = ew_CheckToken(Request.Form(EW_TOKEN_NAME),TokenTimeout) End Function ' Create Token Sub CreateToken() If CheckToken And Token = "" Then Token = ew_CreateToken() gsToken = Token ' Save to global variable End If End Sub ' ' Class initialize ' Private Sub Class_Initialize() Session.LCID = 1033 ' Always use US locale id If IsEmpty(StartTimer) Then StartTimer = Timer ' Init start time ' Check Token Token = "" CheckToken = EW_CHECK_TOKEN TokenTimeout = 0 TokenTimeout = ew_SessionTimeoutTime() ' Initialize language object If IsEmpty(Language) Then Set Language = New cLanguage Call Language.LoadPhrases End If ' Initialize table object If IsEmpty(Grievance) Then Set Grievance = New cGrievance Set Table = Grievance ' Initialize URLs ' Initialize form object Set ObjForm = Nothing ' Get resize object Call ew_GetResizeObj ' Intialize page id (for backward compatibility) EW_PAGE_ID = "delete" ' Initialize table name (for backward compatibility) EW_TABLE_NAME = "Grievance" ' Debug message Call ew_LoadDebugMsg ' Open connection to the database If IsEmpty(Conn) Then Set Conn = ew_Connect(Grievance.TableDBID) End If ' User table object (Grievance) If IsEmpty(UserTable) Then Set UserTable = New cGrievance Set UserTableConn = ew_GetConn(UserTable.TableDBID) End If End Sub ' ' Page_Init ' Sub Page_Init() ' User profile Set UserProfile = New cUserProfile ' Security Set Security = New cAdvancedSecurity If Not Security.IsLoggedIn() Then Security.AutoLogin() ' Table Permission loading event If Security.IsLoggedIn() Then Call Security.TablePermission_Loading Call Security.LoadCurrentUserLevel(ProjectID & TableName) ' Table Permission loaded event If Security.IsLoggedIn() Then Call Security.TablePermission_Loaded If Not Security.CanDelete Then Call Security.SaveLastUrl If Security.CanList Then Call Page_Terminate(ew_GetUrl("Grievancelist.asp")) Else Call Page_Terminate(ew_GetUrl("login.asp")) End If End If gbOldSkipHeaderFooter = gbSkipHeaderFooter gbSkipHeaderFooter = True Call Grievance.ID.SetVisibility(Grievance) If Grievance.IsAdd() Or Grievance.IsCopy() Or Grievance.IsGridAdd() Then Grievance.ID.Visible = False End If Call Grievance.Name.SetVisibility(Grievance) Call Grievance.zEmail.SetVisibility(Grievance) Call Grievance.Password.SetVisibility(Grievance) Call Grievance.Mobile.SetVisibility(Grievance) Call Grievance.Gender.SetVisibility(Grievance) Call Grievance.Department.SetVisibility(Grievance) Call Grievance.Grievance_1.SetVisibility(Grievance) Call Grievance.Docs.SetVisibility(Grievance) Call Grievance.Agree.SetVisibility(Grievance) ' Global page loading event (in userfn*.asp) Call Page_Loading ' Page load event, used in current page Call Page_Load ' Check token If Not ValidPost() Then Response.Write Language.Phrase("InvalidPostRequest") Call Page_Terminate("") Response.End End If ' Create Token Call CreateToken End Sub ' ' Page_Terminate ' Sub Page_Terminate(url) gbSkipHeaderFooter = gbOldSkipHeaderFooter If Request.Form("customexport")&"" = "" Then ' Page unload event, used in current page Call Page_Unload ' Global page unloaded event (in userfn*.asp) Call Page_Unloaded End If ' Export If ew_NotEmpty(Grievance) Then If Grievance.Export <> "" And Request.Form("data").Count > 0 Then Dim sContent sContent = Request.Form("data") gsExportFile = Request.Form("filename") If gsExportFile = "" Then gsExportFile = Grievance.TableVar If Grievance.Export = "pdf" Then Call ExportPdf(sContent) ElseIf Grievance.Export = "email" Then Response.Write ExportEmail(sContent) ElseIf Grievance.Export = "excel" Then Call ExportExcel(sContent) ElseIf Grievance.Export = "word" Then Call ExportWord(sContent) End If End If End If Dim sRedirectUrl sRedirectUrl = url Call Page_Redirecting(sRedirectUrl) Call ew_CloseConn ' Close Connection Set Security = Nothing Set ObjForm = Nothing Set gResizeObj = Nothing ' Go to URL if specified If gsExport & "" = "" Then If sRedirectUrl <> "" Then If Response.Buffer Then Response.Clear Call ew_SaveDebugMsg Response.Redirect sRedirectUrl End If End If Set Grievance = Nothing Call ew_CleanUp End Sub ' ' Page_Terminate (End) ' Dim DbMasterFilter, DbDetailFilter Dim StartRec Dim TotalRecs Dim RecCnt Dim RecKeys Dim Recordset Dim StartRowCnt Dim RowCnt ' Page main Sub Page_Main() Dim sFilter StartRowCnt = 1 ' Set up Breadcrumb Call SetupBreadcrumb ' Load key parameters RecKeys = Grievance.GetRecordKeys() ' Load record keys sFilter = Grievance.GetKeyFilter() If sFilter = "" Then Call Page_Terminate("Grievancelist.asp") ' Prevent SQL injection, return to list End If ' Set up filter (SQL WHERE clause) and get SQL ' SQL constructor in Grievance class, Grievanceinfo.asp Grievance.CurrentFilter = sFilter ' Get action If Request.Form("a_delete").Count > 0 Then Grievance.CurrentAction = Request.Form("a_delete") ElseIf Request.QueryString("a_delete") = "1" Then Grievance.CurrentAction = "D" ' Delete record directly Else Grievance.CurrentAction = "I" ' Display record End If If Grievance.CurrentAction = "D" Then ' Delete Grievance.SendEmail = True ' Send email on delete success If DeleteRows() Then ' Delete rows If SuccessMessage = "" Then SuccessMessage = Language.Phrase("DeleteSuccess") ' Set up success message Call Page_Terminate(Grievance.ReturnUrl) ' Return to caller Else ' Delete failed Grievance.CurrentAction = "I" ' Display record End If End If If Grievance.CurrentAction = "I" Then ' Load records for display Set Recordset = LoadRecordset(-1, -1) TotalRecs = Recordset.RecordCount ' Get record count If TotalRecs <= 0 Then ' No record found, exit Recordset.Close Set Recordset = Nothing Call Page_Terminate("Grievancelist.asp") ' Return to list End If End If End Sub ' ' Load recordset ' Function LoadRecordset(offset, rowcnt) Dim sSql, rs, useSelectLimit, dbType, hasOrderBy useSelectLimit = rowcnt > 0 And offset >= 0 dbType = ew_GetConnectionType(Grievance.TableDBID) If dbType = "MSSQL" Then If ew_IsMsSql2012(Grievance.TableDBID) Then dbType = "MSSQL2012" ' ASP End If ' Load List page SQL sSql = Grievance.ListSQL If useSelectLimit Then hasOrderBy = Grievance.SqlOrderBy <> "" Or Grievance.SessionOrderBy <> "" sSql = ew_GetSelectLimitSql(sSql, rowcnt, offset, hasOrderBy, dbType) End If ' Load recordset Set rs = ew_LoadRecordsetByDbid(sSql, Grievance.TableDBID) If Not useSelectLimit Or dbType <> "MSSQL2012" And dbType <> "MYSQL" And dbType <> "POSTGRESQL" Then ' ASP If offset > 0 And Not rs.EOF Then rs.Move offset End If ' Call Recordset Selected event Call Grievance.Recordset_Selected(rs) Set LoadRecordset = rs End Function ' ' Load row based on key values ' Function LoadRow() Dim RsRow, sSql, sFilter sFilter = Grievance.KeyFilter ' Call Row Selecting event Call Grievance.Row_Selecting(sFilter) ' Load SQL based on filter Grievance.CurrentFilter = sFilter sSql = Grievance.SQL Call ew_SetDebugMsg("LoadRow: " & sSql) ' Show SQL for debugging Set RsRow = ew_LoadRowByDbid(sSql, Grievance.TableDBID) If RsRow.EOF Then LoadRow = False Else LoadRow = True RsRow.MoveFirst Call LoadRowValues(RsRow) ' Load row values End If RsRow.Close Set RsRow = Nothing End Function ' ' Load row values from recordset ' Sub LoadRowValues(RsRow) Dim sDetailFilter If Not EW_DEBUG_ENABLED Then On Error Resume Next If IsNull(RsRow) Then Set RsRow = NewRow() End If ' Call Row Selected event Call Grievance.Row_Selected(RsRow) If ew_Empty(RsRow) Then Exit Sub If RsRow.EOF Then Exit Sub Grievance.ID.DbValue = RsRow("ID") Grievance.Name.DbValue = RsRow("Name") Grievance.zEmail.DbValue = RsRow("Email") Grievance.Password.DbValue = RsRow("Password") Grievance.Mobile.DbValue = RsRow("Mobile") Grievance.Gender.DbValue = RsRow("Gender") Grievance.Department.DbValue = RsRow("Department") Grievance.Grievance_1.DbValue = RsRow("Grievance") Grievance.Docs.Upload.DbValue = RsRow("Docs") Grievance.Docs.DbValue = Grievance.Docs.Upload.DbValue Grievance.Agree.DbValue = RsRow("Agree") End Sub ' Return a row with default values Function NewRow Dim cnn, rs, sSql, sFilter ' Clear any previous errors Err.Clear Set cnn = Grievance.TableConnection sFilter = Grievance.CurrentFilter Grievance.CurrentFilter = "(0 = 1)" sSql = Grievance.SQL Grievance.CurrentFilter = sFilter Set rs = Server.CreateObject("ADODB.Recordset") rs.CursorLocation = 3 ' adUseClient Call ew_SetDebugMsg("NewRow: " & sSql) ' Show SQL for debugging rs.Open sSql, cnn, 3, 4 ' adOpenStatic, adLockBatchOptimistic ' Disconnect the Recordset Set rs.ActiveConnection = Nothing ' Add new record rs.AddNew rs("Name") = Null rs("Email") = Null rs("Password") = Null rs("Mobile") = Null rs("Gender") = Null rs("Department") = Null rs("Grievance") = Null rs("Docs") = Null rs("Agree") = Null ' Return the recordset If Err.Number = 0 Then Set NewRow = rs Else Set NewRow = Nothing End If End Function ' Load DbValue from recordset Sub LoadDbValues(Rs) If Not EW_DEBUG_ENABLED Then On Error Resume Next If ew_Empty(Rs) Then Exit Sub If Rs.EOF Then Exit Sub Grievance.ID.m_DbValue = Rs("ID") Grievance.Name.m_DbValue = Rs("Name") Grievance.zEmail.m_DbValue = Rs("Email") Grievance.Password.m_DbValue = Rs("Password") Grievance.Mobile.m_DbValue = Rs("Mobile") Grievance.Gender.m_DbValue = Rs("Gender") Grievance.Department.m_DbValue = Rs("Department") Grievance.Grievance_1.m_DbValue = Rs("Grievance") Grievance.Docs.Upload.DbValue = Rs("Docs") Grievance.Agree.m_DbValue = Rs("Agree") End Sub ' ' Render row values based on field settings ' Sub RenderRow() ' Initialize URLs ' Call Row Rendering event Call Grievance.Row_Rendering ' ' Common render codes for all row types ' ' ID ' Name ' Email ' Password ' Mobile ' Gender ' Department ' Grievance ' Docs ' Agree ' ' View Row ' If Grievance.RowType = EW_ROWTYPE_VIEW Then ' View row ' ID Grievance.ID.ViewValue = Grievance.ID.CurrentValue Grievance.ID.ViewCustomAttributes = "" ' Name Grievance.Name.ViewValue = Grievance.Name.CurrentValue Grievance.Name.ViewCustomAttributes = "" ' Email Grievance.zEmail.ViewValue = Grievance.zEmail.CurrentValue Grievance.zEmail.ViewCustomAttributes = "" ' Password Grievance.Password.ViewValue = Grievance.Password.CurrentValue Grievance.Password.ViewCustomAttributes = "" ' Mobile Grievance.Mobile.ViewValue = Grievance.Mobile.CurrentValue Grievance.Mobile.ViewCustomAttributes = "" ' Gender If Not IsNull(Grievance.Gender.CurrentValue) Then Grievance.Gender.ViewValue = Grievance.Gender.OptionCaption(Grievance.Gender.CurrentValue) Else Grievance.Gender.ViewValue = Null End If Grievance.Gender.ViewCustomAttributes = "" ' Department Grievance.Department.ViewValue = Grievance.Department.CurrentValue Grievance.Department.ViewCustomAttributes = "" ' Grievance Grievance.Grievance_1.ViewValue = Grievance.Grievance_1.CurrentValue Grievance.Grievance_1.ViewCustomAttributes = "" ' Docs Grievance.Docs.UploadPath = "../uploads/grievance" If Not ew_Empty(Grievance.Docs.Upload.DbValue) Then Grievance.Docs.ViewValue = Grievance.Docs.Upload.DbValue Grievance.Docs.ViewValue = Grievance.Docs.Upload.DbValue Else Grievance.Docs.ViewValue = "" End If Grievance.Docs.ViewCustomAttributes = "" ' Agree If Not IsNull(Grievance.Agree.CurrentValue) Then Grievance.Agree.ViewValue = Grievance.Agree.OptionCaption(Grievance.Agree.CurrentValue) Else Grievance.Agree.ViewValue = Null End If Grievance.Agree.ViewCustomAttributes = "" ' View refer script ' ID Grievance.ID.LinkCustomAttributes = "" Grievance.ID.HrefValue = "" Grievance.ID.TooltipValue = "" ' Name Grievance.Name.LinkCustomAttributes = "" Grievance.Name.HrefValue = "" Grievance.Name.TooltipValue = "" ' Email Grievance.zEmail.LinkCustomAttributes = "" Grievance.zEmail.HrefValue = "" Grievance.zEmail.TooltipValue = "" ' Password Grievance.Password.LinkCustomAttributes = "" Grievance.Password.HrefValue = "" Grievance.Password.TooltipValue = "" ' Mobile Grievance.Mobile.LinkCustomAttributes = "" Grievance.Mobile.HrefValue = "" Grievance.Mobile.TooltipValue = "" ' Gender Grievance.Gender.LinkCustomAttributes = "" Grievance.Gender.HrefValue = "" Grievance.Gender.TooltipValue = "" ' Department Grievance.Department.LinkCustomAttributes = "" Grievance.Department.HrefValue = "" Grievance.Department.TooltipValue = "" ' Grievance Grievance.Grievance_1.LinkCustomAttributes = "" Grievance.Grievance_1.HrefValue = "" Grievance.Grievance_1.TooltipValue = "" ' Docs Grievance.Docs.LinkCustomAttributes = "" Grievance.Docs.HrefValue = "" Grievance.Docs.HrefValue2 = Grievance.Docs.UploadPath & Grievance.Docs.Upload.DbValue Grievance.Docs.TooltipValue = "" ' Agree Grievance.Agree.LinkCustomAttributes = "" Grievance.Agree.HrefValue = "" Grievance.Agree.TooltipValue = "" End If ' Call Row Rendered event If Grievance.RowType <> EW_ROWTYPE_AGGREGATEINIT Then Call Grievance.Row_Rendered End If End Sub ' ' Delete records based on current filter ' Function DeleteRows() If Not EW_DEBUG_ENABLED Then On Error Resume Next Dim sKey, sThisKey, sKeyFld, arKeyFlds, sSql, RsDelete, RsOld, RsDetail, OldFiles, i, cnn DeleteRows = True sSql = Grievance.UpdateTableSQL Set cnn = Grievance.TableConnection If Not Security.CanDelete Then FailureMessage = Language.Phrase("NoDeletePermission") ' No delete permission DeleteRows = False Exit Function End If cnn.BeginTrans Set RsDelete = Server.CreateObject("ADODB.Recordset") RsDelete.CursorLocation = Grievance.TableCursorLocation Call ew_SetDebugMsg("DeleteRows: " & sSql) ' Show SQL for debugging RsDelete.Open sSql, cnn, 1, Grievance.TableRecordsetLockType If Err.Number <> 0 Then FailureMessage = Err.Description RsDelete.Close Set RsDelete = Nothing DeleteRows = False Exit Function ElseIf RsDelete.EOF Then FailureMessage = Language.Phrase("NoRecord") ' No record found RsDelete.Close Set RsDelete = Nothing DeleteRows = False Exit Function End If ' Clone old recordset object Set RsOld = ew_CloneRs(RsDelete) ' Call row deleting event If DeleteRows Then RsDelete.MoveFirst Do While Not RsDelete.EOF DeleteRows = Grievance.Row_Deleting(RsDelete) If Not DeleteRows Then Exit Do RsDelete.MoveNext Loop RsDelete.MoveFirst End If If DeleteRows Then sKey = "" RsDelete.MoveFirst Do While Not RsDelete.EOF sThisKey = "" If sThisKey <> "" Then sThisKey = sThisKey & EW_COMPOSITE_KEY_SEPARATOR sThisKey = sThisKey & RsDelete("ID") Call LoadDbValues(RsDelete) Grievance.Docs.OldUploadPath = "../uploads/grievance" Call ew_DeleteFile(Grievance.Docs.OldPhysicalUploadPath & RsDelete("Docs")) If DeleteRows Then Call ew_SetDebugMsg("Delete: " & sSql) ' Show SQL for debugging RsDelete.Delete End If If Err.Number <> 0 Or Not DeleteRows Then If Err.Description <> "" Then FailureMessage = Err.Description ' Set up error message DeleteRows = False Exit Do End If If sKey <> "" Then sKey = sKey & ", " sKey = sKey & sThisKey RsDelete.MoveNext Loop End If If Not DeleteRows Then ' Set up error message If SuccessMessage <> "" Or FailureMessage <> "" Then ' Use the message, do nothing ElseIf Grievance.CancelMessage <> "" Then FailureMessage = Grievance.CancelMessage Grievance.CancelMessage = "" Else FailureMessage = Language.Phrase("DeleteCancelled") End If End If If DeleteRows Then cnn.CommitTrans ' Commit the changes If Err.Number <> 0 Then FailureMessage = Err.Description DeleteRows = False ' Delete failed End If Else cnn.RollbackTrans ' Rollback changes End If RsDelete.Close Set RsDelete = Nothing ' Call row deleting event If DeleteRows Then RsOld.MoveFirst Do While Not RsOld.EOF Call Grievance.Row_Deleted(RsOld) RsOld.MoveNext Loop End If RsOld.Close Set RsOld = Nothing End Function ' Set up Breadcrumb Sub SetupBreadcrumb() Dim PageId, url Set Breadcrumb = New cBreadcrumb url = Mid(ew_CurrentUrl(), InStrRev(ew_CurrentUrl(), "/") + 1) Call Breadcrumb.Add("list", Grievance.TableVar, Grievance.AddMasterUrl("Grievancelist.asp"), "", Grievance.TableVar, True) PageId = "delete" Call Breadcrumb.Add("delete", PageId, url, "", "", False) End Sub ' Setup lookup filters of a field Sub SetupLookupFilters(fld, pageId) pageId = ew_IIf(ew_EmptyStr(pageId), Grievance_delete.PageID, pageId) Select Case fld.FldVar End Select End Sub ' Setup AutoSuggest filters of a field Sub SetupAutoSuggestFilters(fld, pageId) pageId = ew_IIF(ew_EmptyStr(pageId), Grievance_delete.PageID, pageId) Select Case fld.FldVar End Select End Sub ' Page Load event Sub Page_Load() 'Response.Write "Page Load" End Sub ' Page Unload event Sub Page_Unload() 'Response.Write "Page Unload" End Sub ' Page Redirecting event Sub Page_Redirecting(url) 'url = newurl End Sub ' Message Showing event ' typ = ""|"success"|"failure"|"warning" Sub Message_Showing(msg, typ) ' Example: 'If typ = "success" Then ' msg = "your success message" 'ElseIf typ = "failure" Then ' msg = "your failure message" 'ElseIf typ = "warning" Then ' msg = "your warning message" 'Else ' msg = "your message" 'End If End Sub ' Page Render event Sub Page_Render() 'Response.Write "Page Render" End Sub ' Page Data Rendering event Sub Page_DataRendering(header) ' Example: 'header = "your header" End Sub ' Page Data Rendered event Sub Page_DataRendered(footer) ' Example: 'footer = "your footer" End Sub End Class %>