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_edit Set Grievance_edit = New cGrievance_edit Set Page = Grievance_edit ' Page init processing Call Grievance_edit.Page_Init ' Page main Call Grievance_edit.Page_Main ' Global Page Rendering event (in userfn*.asp) Page_Rendering() ' Page Render event Grievance_edit.Page_Render() %> <!--#include file="header.asp"--> <script type="text/javascript"> // Form object var CurrentPageID = EW_PAGE_ID = "edit"; var CurrentForm = fGrievanceedit = new ew_Form("fGrievanceedit", "edit"); // Validate form fGrievanceedit.Validate = function() { if (!this.ValidateRequired) return true; // Ignore validation var $ = jQuery, fobj = this.GetForm(), $fobj = $(fobj); if ($fobj.find("#a_confirm").val() == "F") return true; var elm, felm, uelm, addcnt = 0; var $k = $fobj.find("#" + this.FormKeyCountName); // Get key_count var rowcnt = ($k[0]) ? parseInt($k.val(), 10) : 1; var startcnt = (rowcnt == 0) ? 0 : 1; // Check rowcnt == 0 => Inline-Add var gridinsert = $fobj.find("#a_list").val() == "gridinsert"; for (var i = startcnt; i <= rowcnt; i++) { var infix = ($k[0]) ? String(i) : ""; $fobj.data("rowindex", infix); elm = this.GetElements("x" + infix + "_Name"); if (elm && !ew_IsHidden(elm) && !ew_HasValue(elm)) return this.OnError(elm, "<%= ew_JsEncode2(Replace(Grievance.Name.ReqErrMsg, "%s", Grievance.Name.FldCaption)) %>"); elm = this.GetElements("x" + infix + "_zEmail"); if (elm && !ew_IsHidden(elm) && !ew_HasValue(elm)) return this.OnError(elm, "<%= ew_JsEncode2(Replace(Grievance.zEmail.ReqErrMsg, "%s", Grievance.zEmail.FldCaption)) %>"); elm = this.GetElements("x" + infix + "_zEmail"); if (elm && !ew_CheckEmail(elm.value)) return this.OnError(elm, "<%= ew_JsEncode2(Grievance.zEmail.FldErrMsg) %>"); elm = this.GetElements("x" + infix + "_Password"); if (elm && !ew_IsHidden(elm) && !ew_HasValue(elm)) return this.OnError(elm, "<%= ew_JsEncode2(Replace(Grievance.Password.ReqErrMsg, "%s", Grievance.Password.FldCaption)) %>"); elm = this.GetElements("x" + infix + "_Mobile"); if (elm && !ew_IsHidden(elm) && !ew_HasValue(elm)) return this.OnError(elm, "<%= ew_JsEncode2(Replace(Grievance.Mobile.ReqErrMsg, "%s", Grievance.Mobile.FldCaption)) %>"); elm = this.GetElements("x" + infix + "_Mobile"); if (elm && !ew_CheckInteger(elm.value)) return this.OnError(elm, "<%= ew_JsEncode2(Grievance.Mobile.FldErrMsg) %>"); elm = this.GetElements("x" + infix + "_Gender"); if (elm && !ew_IsHidden(elm) && !ew_HasValue(elm)) return this.OnError(elm, "<%= ew_JsEncode2(Replace(Grievance.Gender.ReqErrMsg, "%s", Grievance.Gender.FldCaption)) %>"); elm = this.GetElements("x" + infix + "_Department"); if (elm && !ew_IsHidden(elm) && !ew_HasValue(elm)) return this.OnError(elm, "<%= ew_JsEncode2(Replace(Grievance.Department.ReqErrMsg, "%s", Grievance.Department.FldCaption)) %>"); elm = this.GetElements("x" + infix + "_Grievance_1"); if (elm && !ew_IsHidden(elm) && !ew_HasValue(elm)) return this.OnError(elm, "<%= ew_JsEncode2(Replace(Grievance.Grievance_1.ReqErrMsg, "%s", Grievance.Grievance_1.FldCaption)) %>"); elm = this.GetElements("x" + infix + "_Agree"); if (elm && !ew_IsHidden(elm) && !ew_HasValue(elm)) return this.OnError(elm, "<%= ew_JsEncode2(Replace(Grievance.Agree.ReqErrMsg, "%s", Grievance.Agree.FldCaption)) %>"); // Fire Form_CustomValidate event if (!this.Form_CustomValidate(fobj)) return false; } // Process detail forms var dfs = $fobj.find("input[name='detailpage']").get(); for (var i = 0; i < dfs.length; i++) { var df = dfs[i], val = df.value; if (val && ewForms[val]) if (!ewForms[val].Validate()) return false; } return true; } // Form_CustomValidate event fGrievanceedit.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 %> fGrievanceedit.ValidateRequired = true; // Use JavaScript validation <% Else %> fGrievanceedit.ValidateRequired = false; // No JavaScript validation <% End If %> // Dynamic selection lists fGrievanceedit.Lists["x_Gender"] = {"LinkField":"","Ajax":null,"AutoFill":false,"DisplayFields":["","","",""],"ParentFields":[],"ChildFields":[],"FilterFields":[],"Options":[],"Template":""}; fGrievanceedit.Lists["x_Gender"].Options = <%= ew_ArrayToJson(Grievance.Gender.Options(False)) %>; fGrievanceedit.Lists["x_Agree"] = {"LinkField":"","Ajax":null,"AutoFill":false,"DisplayFields":["","","",""],"ParentFields":[],"ChildFields":[],"FilterFields":[],"Options":[],"Template":""}; fGrievanceedit.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_edit.ShowPageHeader %> <% Call Grievance_edit.ShowMessage %> <form name="fGrievanceedit" id="fGrievanceedit" class="<%= Grievance_edit.FormClassName %>" action="<%= ew_CurrentPage %>" method="post"> <% If Grievance_edit.CheckToken Then %> <input type="hidden" name="<%= EW_TOKEN_NAME %>" value="<%= Grievance_edit.Token %>"> <% End If %> <input type="hidden" name="a_table" id="a_table" value="Grievance"> <input type="hidden" name="a_edit" id="a_edit" value="U"> <input type="hidden" name="modal" value="<%= ew_IIf(Grievance_edit.IsModal, "1", "0") %>"> <!-- Fields to prevent google autofill --> <input class="hidden" type="text" name="<%= ew_Encrypt(ew_Random()) %>"> <input class="hidden" type="password" name="<%= ew_Encrypt(ew_Random()) %>"> <div class="ewEditDiv"><!-- page* --> <% If Grievance.ID.Visible Then ' ID %> <div id="r_ID" class="form-group"> <label id="elh_Grievance_ID" class="<%= Grievance.LeftColumnClass %>"><%= Grievance.ID.FldCaption %></label> <div class="<%= Grievance.RightColumnClass %>"><div<%= Grievance.ID.CellAttributes %>> <span id="el_Grievance_ID"> <span<%= Grievance.ID.ViewAttributes %>> <p class="form-control-static"><%= Grievance.ID.EditValue %></p> </span> </span> <input type="hidden" data-table="Grievance" data-field="x_ID" name="x_ID" id="x_ID" value="<%= ew_HtmlEncode(Grievance.ID.CurrentValue&"") %>"> <%= Grievance.ID.CustomMsg %></div></div> </div> <% End If %> <% If Grievance.Name.Visible Then ' Name %> <div id="r_Name" class="form-group"> <label id="elh_Grievance_Name" for="x_Name" class="<%= Grievance.LeftColumnClass %>"><%= Grievance.Name.FldCaption %><%= Language.Phrase("FieldRequiredIndicator") %></label> <div class="<%= Grievance.RightColumnClass %>"><div<%= Grievance.Name.CellAttributes %>> <span id="el_Grievance_Name"> <input type="text" data-table="Grievance" data-field="x_Name" name="x_Name" id="x_Name" size="30" maxlength="255" placeholder="<%= Grievance.Name.PlaceHolder %>" value="<%= Grievance.Name.EditValue %>"<%= Grievance.Name.EditAttributes %>> </span> <%= Grievance.Name.CustomMsg %></div></div> </div> <% End If %> <% If Grievance.zEmail.Visible Then ' Email %> <div id="r_zEmail" class="form-group"> <label id="elh_Grievance_zEmail" for="x_zEmail" class="<%= Grievance.LeftColumnClass %>"><%= Grievance.zEmail.FldCaption %><%= Language.Phrase("FieldRequiredIndicator") %></label> <div class="<%= Grievance.RightColumnClass %>"><div<%= Grievance.zEmail.CellAttributes %>> <span id="el_Grievance_zEmail"> <input type="text" data-table="Grievance" data-field="x_zEmail" name="x_zEmail" id="x_zEmail" size="30" maxlength="50" placeholder="<%= Grievance.zEmail.PlaceHolder %>" value="<%= Grievance.zEmail.EditValue %>"<%= Grievance.zEmail.EditAttributes %>> </span> <%= Grievance.zEmail.CustomMsg %></div></div> </div> <% End If %> <% If Grievance.Password.Visible Then ' Password %> <div id="r_Password" class="form-group"> <label id="elh_Grievance_Password" for="x_Password" class="<%= Grievance.LeftColumnClass %>"><%= Grievance.Password.FldCaption %><%= Language.Phrase("FieldRequiredIndicator") %></label> <div class="<%= Grievance.RightColumnClass %>"><div<%= Grievance.Password.CellAttributes %>> <span id="el_Grievance_Password"> <input type="text" data-table="Grievance" data-field="x_Password" name="x_Password" id="x_Password" size="30" maxlength="50" placeholder="<%= Grievance.Password.PlaceHolder %>" value="<%= Grievance.Password.EditValue %>"<%= Grievance.Password.EditAttributes %>> </span> <%= Grievance.Password.CustomMsg %></div></div> </div> <% End If %> <% If Grievance.Mobile.Visible Then ' Mobile %> <div id="r_Mobile" class="form-group"> <label id="elh_Grievance_Mobile" for="x_Mobile" class="<%= Grievance.LeftColumnClass %>"><%= Grievance.Mobile.FldCaption %><%= Language.Phrase("FieldRequiredIndicator") %></label> <div class="<%= Grievance.RightColumnClass %>"><div<%= Grievance.Mobile.CellAttributes %>> <span id="el_Grievance_Mobile"> <input type="text" data-table="Grievance" data-field="x_Mobile" name="x_Mobile" id="x_Mobile" size="30" placeholder="<%= Grievance.Mobile.PlaceHolder %>" value="<%= Grievance.Mobile.EditValue %>"<%= Grievance.Mobile.EditAttributes %>> </span> <%= Grievance.Mobile.CustomMsg %></div></div> </div> <% End If %> <% If Grievance.Gender.Visible Then ' Gender %> <div id="r_Gender" class="form-group"> <label id="elh_Grievance_Gender" class="<%= Grievance.LeftColumnClass %>"><%= Grievance.Gender.FldCaption %><%= Language.Phrase("FieldRequiredIndicator") %></label> <div class="<%= Grievance.RightColumnClass %>"><div<%= Grievance.Gender.CellAttributes %>> <span id="el_Grievance_Gender"> <div id="tp_x_Gender" class="ewTemplate"><input type="radio" data-table="Grievance" data-field="x_Gender" data-value-separator="<%= Grievance.Gender.DisplayValueSeparatorAttribute %>" name="x_Gender" id="x_Gender" value="{value}"<%= Grievance.Gender.EditAttributes %>></div> <div id="dsl_x_Gender" data-repeatcolumn="5" class="ewItemList" style="display: none;"><div> <%= Grievance.Gender.RadioButtonListHtml(False, "x_Gender", -1, Grievance) %> </div></div> </span> <%= Grievance.Gender.CustomMsg %></div></div> </div> <% End If %> <% If Grievance.Department.Visible Then ' Department %> <div id="r_Department" class="form-group"> <label id="elh_Grievance_Department" for="x_Department" class="<%= Grievance.LeftColumnClass %>"><%= Grievance.Department.FldCaption %><%= Language.Phrase("FieldRequiredIndicator") %></label> <div class="<%= Grievance.RightColumnClass %>"><div<%= Grievance.Department.CellAttributes %>> <span id="el_Grievance_Department"> <input type="text" data-table="Grievance" data-field="x_Department" name="x_Department" id="x_Department" size="30" maxlength="50" placeholder="<%= Grievance.Department.PlaceHolder %>" value="<%= Grievance.Department.EditValue %>"<%= Grievance.Department.EditAttributes %>> </span> <%= Grievance.Department.CustomMsg %></div></div> </div> <% End If %> <% If Grievance.Grievance_1.Visible Then ' Grievance %> <div id="r_Grievance_1" class="form-group"> <label id="elh_Grievance_Grievance_1" for="x_Grievance_1" class="<%= Grievance.LeftColumnClass %>"><%= Grievance.Grievance_1.FldCaption %><%= Language.Phrase("FieldRequiredIndicator") %></label> <div class="<%= Grievance.RightColumnClass %>"><div<%= Grievance.Grievance_1.CellAttributes %>> <span id="el_Grievance_Grievance_1"> <textarea data-table="Grievance" data-field="x_Grievance_1" name="x_Grievance_1" id="x_Grievance_1" cols="35" rows="4" placeholder="<%= Grievance.Grievance_1.PlaceHolder %>"<%= Grievance.Grievance_1.EditAttributes %>><%= Grievance.Grievance_1.EditValue %></textarea> </span> <%= Grievance.Grievance_1.CustomMsg %></div></div> </div> <% End If %> <% If Grievance.Docs.Visible Then ' Docs %> <div id="r_Docs" class="form-group"> <label id="elh_Grievance_Docs" class="<%= Grievance.LeftColumnClass %>"><%= Grievance.Docs.FldCaption %></label> <div class="<%= Grievance.RightColumnClass %>"><div<%= Grievance.Docs.CellAttributes %>> <div id="el_Grievance_Docs"> <div id="fd_x_Docs"> <span title="<%= ew_IIf(Grievance.Docs.FldTitle <> "", Grievance.Docs.FldTitle, Language.Phrase("ChooseFile")) %>" class="btn btn-default btn-sm fileinput-button ewTooltip<% If Grievance.Docs.ReadOnly Or Grievance.Docs.Disabled Then Response.Write " hide" %>" data-trigger="hover"> <span><%= Language.Phrase("ChooseFileBtn") %></span> <input type="file" title=" " data-table="Grievance" data-field="x_Docs" name="x_Docs" id="x_Docs"<%= Grievance.Docs.EditAttributes %>> </span> <input type="hidden" name="fn_x_Docs" id= "fn_x_Docs" value="<%= Grievance.Docs.Upload.FileName %>"> <% If Request.Form("fa_x_Docs") & "" = "0" Then %> <input type="hidden" name="fa_x_Docs" id= "fa_x_Docs" value="0"> <% Else %> <input type="hidden" name="fa_x_Docs" id= "fa_x_Docs" value="1"> <% End If %> <input type="hidden" name="fs_x_Docs" id= "fs_x_Docs" value="50"> <input type="hidden" name="fx_x_Docs" id= "fx_x_Docs" value="<%= Grievance.Docs.UploadAllowedFileExt %>"> <input type="hidden" name="fm_x_Docs" id= "fm_x_Docs" value="<%= Grievance.Docs.UploadMaxFileSize %>"> </div> <table id="ft_x_Docs" class="table table-condensed pull-left ewUploadTable"><tbody class="files"></tbody></table> </div> <%= Grievance.Docs.CustomMsg %></div></div> </div> <% End If %> <% If Grievance.Agree.Visible Then ' Agree %> <div id="r_Agree" class="form-group"> <label id="elh_Grievance_Agree" class="<%= Grievance.LeftColumnClass %>"><%= Grievance.Agree.FldCaption %><%= Language.Phrase("FieldRequiredIndicator") %></label> <div class="<%= Grievance.RightColumnClass %>"><div<%= Grievance.Agree.CellAttributes %>> <span id="el_Grievance_Agree"> <div id="tp_x_Agree" class="ewTemplate"><input type="radio" data-table="Grievance" data-field="x_Agree" data-value-separator="<%= Grievance.Agree.DisplayValueSeparatorAttribute %>" name="x_Agree" id="x_Agree" value="{value}"<%= Grievance.Agree.EditAttributes %>></div> <div id="dsl_x_Agree" data-repeatcolumn="5" class="ewItemList" style="display: none;"><div> <%= Grievance.Agree.RadioButtonListHtml(False, "x_Agree", -1, Grievance) %> </div></div> </span> <%= Grievance.Agree.CustomMsg %></div></div> </div> <% End If %> </div><!-- /page* --> <% If Not Grievance_edit.IsModal Then %> <div class="form-group"><!-- buttons .form-group --> <div class="<%= Grievance.OffsetColumnClass %>"><!-- buttons offset --> <button class="btn btn-primary ewButton" name="btnAction" id="btnAction" type="submit"><%= Language.Phrase("SaveBtn") %></button> <button class="btn btn-default ewButton" name="btnCancel" id="btnCancel" type="button" data-href="<%= Grievance.ReturnUrl %>"><%= Language.Phrase("CancelBtn") %></button> </div><!-- /buttons offset --> </div><!-- /buttons .form-group --> <% End If %> </form> <script type="text/javascript"> fGrievanceedit.Init(); </script> <% Call Grievance_edit.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_edit.Page_Terminate("") Set Grievance_edit = Nothing %> <% ' ' Page Class ' Class cGrievance_edit ' Page ID Public Property Get PageID PageID = "edit" 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_edit" 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 = "edit" ' 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() ' Is modal IsModal = (Request.QueryString("modal") = "1" Or Request.Form("modal") = "1") ' 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.CanEdit 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 ' Create form object Set ObjForm = New cFormObj Grievance.CurrentAction = ew_IIf(Request.QueryString("a").Count > 0, Request.QueryString("a") & "", ObjForm.GetValue("a_list") & "") ' Set up current action 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 ' Process auto fill Dim results If Request.Form("ajax") = "autofill" Then results = Grievance.GetAutoFill(Request.Form("name"), Request.Form("q")) If results <> "" Then ' Clean output buffer If Response.Buffer Then Response.Clear Response.Write results Call Page_Terminate("") Response.End End If 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 ' Handle modal response If IsModal Then ' Show as modal Dim row, pageName Set row = Dictionary() Call row.Add("url", sRedirectURL) Call row.Add("modal", "1") pageName = ew_GetPageName(sRedirectURL) If pageName <> Grievance.ListUrl Then ' Not List page Call row.Add("caption", Grievance.GetModalCaption(pageName)) If pageName = "Grievanceview.asp" Then Call row.Add("view", "1") End If Else 'List page should not be shown as modal => error Call row.Add("error", FailureMessage) Call ClearFailureMessage End If Call ResponseJson Response.Write "[" & row.ToJson() & "]" Set row = Nothing Response.End Else Call ew_SaveDebugMsg Response.Redirect sRedirectUrl End If End If End If Set Grievance = Nothing Call ew_CleanUp End Sub ' ' Page_Terminate (End) ' Dim DbMasterFilter, DbDetailFilter Dim FormClassName Dim IsModal Dim IsMobileOrModal Dim DisplayRecs Dim StartRec, StopRec, TotalRecs, RecRange Dim AutoHidePager Dim RecCnt Dim Recordset ' ' Page main ' Sub Page_Main() Dim sReturnUrl sReturnUrl = "" ' Check modal If IsModal Then gbSkipHeaderFooter = True IsMobileOrModal = False IsMobileOrModal = ew_IsMobile() Or IsModal FormClassName = "ewForm ewEditForm form-horizontal" Dim loaded, postBack sReturnUrl = "" loaded = False postBack = False ' Set up current action and primary key If ObjForm.GetValue("a_edit")&"" <> "" Then Grievance.CurrentAction = ObjForm.GetValue("a_edit")&"" ' Get action code If Grievance.CurrentAction <> "I" Then ' Not reload record, handle as postback postBack = True End If ' Load key from Form If ObjForm.HasValue("x_ID") Then Grievance.ID.FormValue = ObjForm.GetValue("x_ID") End If Else Grievance.CurrentAction = "I" ' Default action is display ' Load key from QueryString Dim loadByQuery loadByQuery = False If Request.QueryString("ID").Count > 0 Then Grievance.ID.QueryStringValue = Request.QueryString("ID") loadByQuery = True Else Grievance.ID.CurrentValue = Null End If End If ' Load current record loaded = LoadRow() ' Process form if post back If postBack Then Call LoadFormValues ' Get form values End If ' Validate form if post back If postBack Then If Not ValidateForm() Then Grievance.CurrentAction = "" ' Form error, reset action FailureMessage = gsFormError Grievance.EventCancelled = True ' Event cancelled LoadRow() ' Restore row Call RestoreFormValues ' Restore form values if validate failed End If End If ' Perform current action Select Case Grievance.CurrentAction Case "I" ' Get a record to display If Not loaded Then ' Load Record based on key If FailureMessage = "" Then FailureMessage = Language.Phrase("NoRecord") ' No record found Call Page_Terminate("Grievancelist.asp") ' No matching record, return to list End If Case "U" ' Update sReturnUrl = Grievance.ReturnUrl If ew_GetPageName(sReturnUrl) = "Grievancelist.asp" Then sReturnUrl = Grievance.AddMasterUrl(sReturnUrl) ' List page, return to List page with correct master key if necessary End If Grievance.SendEmail = True ' Send email on update success If EditRow() Then ' Update Record based on key If SuccessMessage = "" Then SuccessMessage = Language.Phrase("UpdateSuccess") ' Update success End If Call Page_Terminate(sReturnUrl) ' Return to caller ElseIf FailureMessage = Language.Phrase("NoRecord") Then Call Page_Terminate(sReturnUrl) ' Return to caller Else Grievance.EventCancelled = True ' Event cancelled LoadRow() ' Restore row Call RestoreFormValues ' Restore form values if update failed End If End Select ' Render the record Grievance.RowType = EW_ROWTYPE_EDIT ' Render as edit ' Set up Breadcrumb Call SetupBreadcrumb ' Render row Call Grievance.ResetAttrs Call RenderRow End Sub Dim Pager ' ' Set up Starting Record parameters based on Pager Navigation ' Sub SetupStartRec() Dim PageNo ' Exit if DisplayRecs = 0 If DisplayRecs = 0 Then Exit Sub If IsPageRequest Then ' Validate request ' Check for a START parameter If Request.QueryString(EW_TABLE_START_REC).Count > 0 Then StartRec = Request.QueryString(EW_TABLE_START_REC) Grievance.StartRecordNumber = StartRec ElseIf Request.QueryString(EW_TABLE_PAGE_NO).Count > 0 Then PageNo = Request.QueryString(EW_TABLE_PAGE_NO) If IsNumeric(PageNo) Then StartRec = (PageNo-1)*DisplayRecs+1 If StartRec <= 0 Then StartRec = 1 ElseIf StartRec >= ((TotalRecs-1)\DisplayRecs)*DisplayRecs+1 Then StartRec = ((TotalRecs-1)\DisplayRecs)*DisplayRecs+1 End If Grievance.StartRecordNumber = StartRec End If End If End If StartRec = Grievance.StartRecordNumber ' Check if correct start record counter If Not IsNumeric(StartRec) Or StartRec = "" Then ' Avoid invalid start record counter StartRec = 1 ' Reset start record counter Grievance.StartRecordNumber = StartRec ElseIf CLng(StartRec) > CLng(TotalRecs) Then ' Avoid starting record > total records StartRec = ((TotalRecs-1)\DisplayRecs)*DisplayRecs+1 ' Point to last page first record Grievance.StartRecordNumber = StartRec ElseIf (StartRec-1) Mod DisplayRecs <> 0 Then StartRec = ((StartRec-1)\DisplayRecs)*DisplayRecs+1 ' Point to page boundary Grievance.StartRecordNumber = StartRec End If End Sub ' ' Get upload files ' Sub GetUploadFiles() ' Get upload data Grievance.Docs.Upload.Index = ObjForm.Index Grievance.Docs.Upload.UploadFile() Grievance.Docs.CurrentValue = Grievance.Docs.Upload.FileName End Sub ' ' Load form values ' Sub LoadFormValues() ' Load values from form Call GetUploadFiles ' Get upload files If Not Grievance.ID.FldIsDetailKey Then Grievance.ID.FormValue = ObjForm.GetValue("x_ID") If Not Grievance.Name.FldIsDetailKey Then Grievance.Name.FormValue = ObjForm.GetValue("x_Name") If Not Grievance.zEmail.FldIsDetailKey Then Grievance.zEmail.FormValue = ObjForm.GetValue("x_zEmail") If Not Grievance.Password.FldIsDetailKey Then Grievance.Password.FormValue = ObjForm.GetValue("x_Password") If Not Grievance.Mobile.FldIsDetailKey Then Grievance.Mobile.FormValue = ObjForm.GetValue("x_Mobile") If Not Grievance.Gender.FldIsDetailKey Then Grievance.Gender.FormValue = ObjForm.GetValue("x_Gender") If Not Grievance.Department.FldIsDetailKey Then Grievance.Department.FormValue = ObjForm.GetValue("x_Department") If Not Grievance.Grievance_1.FldIsDetailKey Then Grievance.Grievance_1.FormValue = ObjForm.GetValue("x_Grievance_1") If Not Grievance.Agree.FldIsDetailKey Then Grievance.Agree.FormValue = ObjForm.GetValue("x_Agree") End Sub ' ' Restore form values ' Sub RestoreFormValues() Grievance.ID.CurrentValue = Grievance.ID.FormValue Grievance.Name.CurrentValue = Grievance.Name.FormValue Grievance.zEmail.CurrentValue = Grievance.zEmail.FormValue Grievance.Password.CurrentValue = Grievance.Password.FormValue Grievance.Mobile.CurrentValue = Grievance.Mobile.FormValue Grievance.Gender.CurrentValue = Grievance.Gender.FormValue Grievance.Department.CurrentValue = Grievance.Department.FormValue Grievance.Grievance_1.CurrentValue = Grievance.Grievance_1.FormValue Grievance.Agree.CurrentValue = Grievance.Agree.FormValue End Sub ' ' 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 ' Load old record Function LoadOldRecord() ' Load key values from Session Dim bValidKey bValidKey = True If Grievance.GetKey("ID")&"" <> "" Then Grievance.ID.CurrentValue = Grievance.GetKey("ID") ' ID Else bValidKey = False End If ' Load old record OldRecordset = Null If bValidKey Then Grievance.CurrentFilter = Grievance.KeyFilter Dim sSql sSql = Grievance.SQL Set OldRecordset = ew_LoadRecordsetByDbid(sSql, Grievance.TableDBID) End If Call LoadRowValues(OldRecordset) ' Load row values LoadOldRecord = bValidKey End Function ' ' 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 = "" ' ' Edit Row ' ElseIf Grievance.RowType = EW_ROWTYPE_EDIT Then ' Edit row ' ID Call Grievance.ID.EditAttrs.UpdateAttribute("class", "form-control") Grievance.ID.EditCustomAttributes = "" Grievance.ID.EditValue = Grievance.ID.CurrentValue Grievance.ID.ViewCustomAttributes = "" ' Name Call Grievance.Name.EditAttrs.UpdateAttribute("class", "form-control") Grievance.Name.EditCustomAttributes = "" Grievance.Name.EditValue = ew_HtmlEncode(Grievance.Name.CurrentValue) Grievance.Name.PlaceHolder = ew_HtmlEncode(ew_RemoveHtml(Grievance.Name.FldCaption)) ' Email Call Grievance.zEmail.EditAttrs.UpdateAttribute("class", "form-control") Grievance.zEmail.EditCustomAttributes = "" Grievance.zEmail.EditValue = ew_HtmlEncode(Grievance.zEmail.CurrentValue) Grievance.zEmail.PlaceHolder = ew_HtmlEncode(ew_RemoveHtml(Grievance.zEmail.FldCaption)) ' Password Call Grievance.Password.EditAttrs.UpdateAttribute("class", "form-control") Grievance.Password.EditCustomAttributes = "" Grievance.Password.EditValue = ew_HtmlEncode(Grievance.Password.CurrentValue) Grievance.Password.PlaceHolder = ew_HtmlEncode(ew_RemoveHtml(Grievance.Password.FldCaption)) ' Mobile Call Grievance.Mobile.EditAttrs.UpdateAttribute("class", "form-control") Grievance.Mobile.EditCustomAttributes = "" Grievance.Mobile.EditValue = ew_HtmlEncode(Grievance.Mobile.CurrentValue) Grievance.Mobile.PlaceHolder = ew_HtmlEncode(ew_RemoveHtml(Grievance.Mobile.FldCaption)) ' Gender Grievance.Gender.EditCustomAttributes = "" Grievance.Gender.EditValue = Grievance.Gender.Options(False) ' Department Call Grievance.Department.EditAttrs.UpdateAttribute("class", "form-control") Grievance.Department.EditCustomAttributes = "" Grievance.Department.EditValue = ew_HtmlEncode(Grievance.Department.CurrentValue) Grievance.Department.PlaceHolder = ew_HtmlEncode(ew_RemoveHtml(Grievance.Department.FldCaption)) ' Grievance Call Grievance.Grievance_1.EditAttrs.UpdateAttribute("class", "form-control") Grievance.Grievance_1.EditCustomAttributes = "" Grievance.Grievance_1.EditValue = ew_HtmlEncode(Grievance.Grievance_1.CurrentValue) Grievance.Grievance_1.PlaceHolder = ew_HtmlEncode(ew_RemoveHtml(Grievance.Grievance_1.FldCaption)) ' Docs Call Grievance.Docs.EditAttrs.UpdateAttribute("class", "form-control") Grievance.Docs.EditCustomAttributes = "" Grievance.Docs.UploadPath = "../uploads/grievance" If Not ew_Empty(Grievance.Docs.Upload.DbValue) Then Grievance.Docs.EditValue = Grievance.Docs.Upload.DbValue Grievance.Docs.EditValue = Grievance.Docs.Upload.DbValue Else Grievance.Docs.EditValue = "" End If If Grievance.CurrentAction = "I" And Not Grievance.EventCancelled Then Call ew_RenderUploadField(Grievance.Docs, -1) ' Agree Grievance.Agree.EditCustomAttributes = "" Grievance.Agree.EditValue = Grievance.Agree.Options(False) ' Edit refer script ' ID Grievance.ID.LinkCustomAttributes = "" Grievance.ID.HrefValue = "" ' Name Grievance.Name.LinkCustomAttributes = "" Grievance.Name.HrefValue = "" ' Email Grievance.zEmail.LinkCustomAttributes = "" Grievance.zEmail.HrefValue = "" ' Password Grievance.Password.LinkCustomAttributes = "" Grievance.Password.HrefValue = "" ' Mobile Grievance.Mobile.LinkCustomAttributes = "" Grievance.Mobile.HrefValue = "" ' Gender Grievance.Gender.LinkCustomAttributes = "" Grievance.Gender.HrefValue = "" ' Department Grievance.Department.LinkCustomAttributes = "" Grievance.Department.HrefValue = "" ' Grievance Grievance.Grievance_1.LinkCustomAttributes = "" Grievance.Grievance_1.HrefValue = "" ' Docs Grievance.Docs.LinkCustomAttributes = "" Grievance.Docs.HrefValue = "" Grievance.Docs.HrefValue2 = Grievance.Docs.UploadPath & Grievance.Docs.Upload.DbValue ' Agree Grievance.Agree.LinkCustomAttributes = "" Grievance.Agree.HrefValue = "" End If If Grievance.RowType = EW_ROWTYPE_ADD Or Grievance.RowType = EW_ROWTYPE_EDIT Or Grievance.RowType = EW_ROWTYPE_SEARCH Then ' Add/Edit/Search row Call Grievance.SetupFieldTitles End If ' Call Row Rendered event If Grievance.RowType <> EW_ROWTYPE_AGGREGATEINIT Then Call Grievance.Row_Rendered End If End Sub ' ' Validate form ' Function ValidateForm() ' Initialize gsFormError = "" ' Check if validation required If Not EW_SERVER_VALIDATE Then ValidateForm = (gsFormError = "") Exit Function End If If Not Grievance.Name.FldIsDetailKey And Not IsNull(Grievance.Name.FormValue) And Grievance.Name.FormValue&"" = "" Then Call ew_AddMessage(gsFormError, Replace(Grievance.Name.ReqErrMsg, "%s", Grievance.Name.FldCaption)) End If If Not Grievance.zEmail.FldIsDetailKey And Not IsNull(Grievance.zEmail.FormValue) And Grievance.zEmail.FormValue&"" = "" Then Call ew_AddMessage(gsFormError, Replace(Grievance.zEmail.ReqErrMsg, "%s", Grievance.zEmail.FldCaption)) End If If Not ew_CheckEmail(Grievance.zEmail.FormValue) Then Call ew_AddMessage(gsFormError, Grievance.zEmail.FldErrMsg) End If If Not Grievance.Password.FldIsDetailKey And Not IsNull(Grievance.Password.FormValue) And Grievance.Password.FormValue&"" = "" Then Call ew_AddMessage(gsFormError, Replace(Grievance.Password.ReqErrMsg, "%s", Grievance.Password.FldCaption)) End If If Not Grievance.Mobile.FldIsDetailKey And Not IsNull(Grievance.Mobile.FormValue) And Grievance.Mobile.FormValue&"" = "" Then Call ew_AddMessage(gsFormError, Replace(Grievance.Mobile.ReqErrMsg, "%s", Grievance.Mobile.FldCaption)) End If If Not ew_CheckInteger(Grievance.Mobile.FormValue) Then Call ew_AddMessage(gsFormError, Grievance.Mobile.FldErrMsg) End If If Grievance.Gender.FormValue&"" = "" Then Call ew_AddMessage(gsFormError, Replace(Grievance.Gender.ReqErrMsg, "%s", Grievance.Gender.FldCaption)) End If If Not Grievance.Department.FldIsDetailKey And Not IsNull(Grievance.Department.FormValue) And Grievance.Department.FormValue&"" = "" Then Call ew_AddMessage(gsFormError, Replace(Grievance.Department.ReqErrMsg, "%s", Grievance.Department.FldCaption)) End If If Not Grievance.Grievance_1.FldIsDetailKey And Not IsNull(Grievance.Grievance_1.FormValue) And Grievance.Grievance_1.FormValue&"" = "" Then Call ew_AddMessage(gsFormError, Replace(Grievance.Grievance_1.ReqErrMsg, "%s", Grievance.Grievance_1.FldCaption)) End If If Grievance.Agree.FormValue&"" = "" Then Call ew_AddMessage(gsFormError, Replace(Grievance.Agree.ReqErrMsg, "%s", Grievance.Agree.FldCaption)) End If ' Return validate result ValidateForm = (gsFormError = "") ' Call Form Custom Validate event Dim sFormCustomError sFormCustomError = "" ValidateForm = ValidateForm And Form_CustomValidate(sFormCustomError) If sFormCustomError <> "" Then Call ew_AddMessage(gsFormError, sFormCustomError) End If End Function ' ' Update record based on key values ' Function EditRow() If Not EW_DEBUG_ENABLED Then On Error Resume Next Dim cnn, Rs, sSql, sFilter Dim RsChk, sSqlChk, sFilterChk Dim bUpdateRow Dim RsOld, RsNew Dim sIdxErrMsg ' Clear any previous errors Err.Clear sFilter = Grievance.KeyFilter Set cnn = Grievance.TableConnection Grievance.CurrentFilter = sFilter sSql = Grievance.UpdateTableSQL Set Rs = Server.CreateObject("ADODB.Recordset") Rs.CursorLocation = Grievance.TableCursorLocation Call ew_SetDebugMsg("EditRow: " & sSql) ' Show SQL for debugging Rs.Open sSql, cnn, 1, Grievance.TableRecordsetLockType If Err.Number <> 0 Then Message = Err.Description Rs.Close Set Rs = Nothing EditRow = False Exit Function End If ' Clone old recordset object Set RsOld = ew_CloneRs(Rs) Call LoadDbValues(RsOld) Grievance.Docs.OldUploadPath = "../uploads/grievance" Grievance.Docs.UploadPath = Grievance.Docs.OldUploadPath If Rs.EOF Then FailureMessage = Language.Phrase("NoRecord") ' Set no record message EditRow = False ' Update Failed Else ' Field Name Call Grievance.Name.SetDbValue(Rs, Grievance.Name.CurrentValue, Null, Grievance.Name.ReadOnly) ' Field Email Call Grievance.zEmail.SetDbValue(Rs, Grievance.zEmail.CurrentValue, Null, Grievance.zEmail.ReadOnly) ' Field Password If Not EW_CASE_SENSITIVE_PASSWORD And Not IsNull(Grievance.Password.CurrentValue) Then Grievance.Password.CurrentValue = LCase(Grievance.Password.CurrentValue) If EW_ENCRYPTED_PASSWORD And Not IsNull(Grievance.Password.CurrentValue) And (Grievance.Password.CurrentValue <> Rs("Password")) Then Grievance.Password.CurrentValue = ew_EncryptPassword(Grievance.Password.CurrentValue) Call Grievance.Password.SetDbValue(Rs, Grievance.Password.CurrentValue, Null, Grievance.Password.ReadOnly) ' Field Mobile Call Grievance.Mobile.SetDbValue(Rs, Grievance.Mobile.CurrentValue, Null, Grievance.Mobile.ReadOnly) ' Field Gender Call Grievance.Gender.SetDbValue(Rs, Grievance.Gender.CurrentValue, Null, Grievance.Gender.ReadOnly) ' Field Department Call Grievance.Department.SetDbValue(Rs, Grievance.Department.CurrentValue, Null, Grievance.Department.ReadOnly) ' Field Grievance Call Grievance.Grievance_1.SetDbValue(Rs, Grievance.Grievance_1.CurrentValue, Null, Grievance.Grievance_1.ReadOnly) ' Field Docs If Grievance.Docs.Visible And Not Grievance.Docs.ReadOnly And Not Grievance.Docs.Upload.KeepFile Then Grievance.Docs.Upload.DbValue = Rs("Docs") ' Get original value If Grievance.Docs.Upload.FileName & "" = "" Then Rs("Docs") = Null Else Rs("Docs") = Grievance.Docs.Upload.FileName End If End If ' Field Agree Call Grievance.Agree.SetDbValue(Rs, Grievance.Agree.CurrentValue, Null, Grievance.Agree.ReadOnly) ' Check recordset update error If Err.Number <> 0 Then FailureMessage = Err.Description Rs.Close Set Rs = Nothing EditRow = False Exit Function End If If Grievance.Docs.Visible And Not Grievance.Docs.Upload.KeepFile Then Grievance.Docs.UploadPath = "../uploads/grievance" TmpOldFiles = ew_IIf(ew_Empty(Grievance.Docs.Upload.DbValue), Array(), Array(Grievance.Docs.Upload.DbValue)) If Not ew_Empty(Grievance.Docs.Upload.FileName) Then TmpNewFiles = Array(Grievance.Docs.Upload.FileName) TmpNewFileCount = UBound(TmpNewFiles) + 1 For i = 0 to TmpNewFileCount - 1 TmpFldVar = ew_IIf(Grievance.Docs.Upload.Index < 0, Grievance.Docs.FldVar, Mid(Grievance.Docs.FldVar, 1, 1) & Grievance.Docs.Upload.Index & Mid(Grievance.Docs.FldVar, 2)) If TmpNewFiles(i) <> "" Then If ew_FileExists(ew_UploadTempPath(TmpFldVar, Grievance.Docs.TblVar), TmpNewFiles(i)) Then TmpFile = TmpNewFiles(i) OldFileFound = False TmpOldFileCount = UBound(TmpOldFiles) + 1 For j = 0 to TmpOldFileCount - 1 If TmpOldFiles(j) = TmpFile Then ' Old file found, no need to delete anymore TmpOldFiles = ew_ArrayDiff(TmpOldFiles, Array(TmpFile)) ' ASP OldFileFound = True Exit For End If Next If Not OldFileFound Then TmpFile1 = ew_UploadFileNameEx(Grievance.Docs.PhysicalUploadPath, TmpFile) ' Get new file name If TmpFile1 <> TmpFile Then Do While ew_FileExists(ew_UploadTempPath(TmpFldVar, Grievance.Docs.TblVar), TmpFile1) Or ew_FileExists(Grievance.Docs.PhysicalUploadPath, TmpFile1) ' Make sure no file name clash TmpFile1 = ew_UniqueFilename(Grievance.Docs.PhysicalUploadPath, TmpFile1, True) ' Use indexed name Loop Call ew_RenameFile(ew_UploadTempPath(TmpFldVar, Grievance.Docs.TblVar) & TmpFile, ew_UploadTempPath(TmpFldVar, Grievance.Docs.TblVar) & TmpFile1) ' Rename temp file TmpNewFiles(i) = TmpFile1 ' Update new file name End If End If End If End If Next If ew_Empty(TmpOldFiles) Then Grievance.Docs.Upload.DbValue = "" Else Grievance.Docs.Upload.DbValue = Join(TmpOldFiles, EW_MULTIPLE_UPLOAD_SEPARATOR) End If Grievance.Docs.Upload.FileName = Join(TmpNewFiles, EW_MULTIPLE_UPLOAD_SEPARATOR) Call Grievance.Docs.SetDbValue(Rs, Grievance.Docs.Upload.FileName, Null, Grievance.Docs.ReadOnly) End If End If ' Call Row Updating event bUpdateRow = Grievance.Row_Updating(RsOld, Rs) If bUpdateRow Then ' Clone new recordset object Set RsNew = ew_CloneRs(Rs) EditRow = True If EditRow Then Call ew_SetDebugMsg("Update: " & ew_HtmlEncode(ew_RecordToJson(Rs))) ' Show data for debugging Rs.Update End If If Err.Number <> 0 Or Not EditRow Then If Err.Description <> "" Then FailureMessage = Err.Description EditRow = False Else EditRow = True End If If EditRow Then If Grievance.Docs.Visible And Not Grievance.Docs.Upload.KeepFile Then TmpOldFiles = ew_IIf(ew_Empty(Grievance.Docs.Upload.DbValue), Array(), Array(Grievance.Docs.Upload.DbValue)) If Not ew_Empty(Grievance.Docs.Upload.FileName) Then TmpNewFiles = Array(Grievance.Docs.Upload.FileName) TmpNewFiles2 = Array(Rs("Docs")) TmpNewFileCount = UBound(TmpNewFiles) + 1 For i = 0 to TmpNewFileCount - 1 TmpFldVar = ew_IIf(Grievance.Docs.Upload.Index < 0, Grievance.Docs.FldVar, Mid(Grievance.Docs.FldVar, 1, 1) & Grievance.Docs.Upload.Index & Mid(Grievance.Docs.FldVar, 2)) If TmpNewFiles(i) <> "" Then If ew_FileExists(ew_UploadTempPath(TmpFldVar, Grievance.Docs.TblVar), TmpNewFiles(i)) Then TmpFile = ew_UploadTempPath(TmpFldVar, Grievance.Docs.TblVar) & TmpNewFiles(i) Grievance.Docs.Upload.Value = ew_LoadBinaryFile(TmpFile) If UBound(TmpNewFiles2) >= i Then If TmpNewFiles2(i) <> "" Then ' Use correct file name TmpNewFiles(i) = TmpNewFiles2(i) End If End If TmpFile = TmpNewFiles(i) If Not Grievance.Docs.Upload.SaveToFile(TmpFile, True) Then FailureMessage = Language.Phrase("UploadErrMsg7") End If End If End If Next Else TmpNewFiles = Array() End If TmpOldFileCount = UBound(TmpOldFiles) + 1 For i = 0 to TmpOldFileCount - 1 If TmpOldFiles(i) <> "" And Not ew_InArray(TmpOldFiles(i), TmpNewFiles) Then Call ew_DeleteFile(Grievance.Docs.OldPhysicalUploadPath & TmpOldFiles(i)) End If Next End If End If Else Rs.CancelUpdate ' 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("UpdateCancelled") End If EditRow = False End If End If ' Call Row_Updated event If EditRow Then Call Grievance.Row_Updated(RsOld, RsNew) End If Rs.Close Set Rs = Nothing ' Docs Call ew_CleanUploadTempPath(Grievance.Docs, Grievance.Docs.Upload.Index) If ew_NotEmpty(RsOld) Then RsOld.Close Set RsOld = Nothing End If If ew_NotEmpty(RsNew) Then RsNew.Close Set RsNew = Nothing End If 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 = "edit" Call Breadcrumb.Add("edit", PageId, url, "", "", False) End Sub ' Setup lookup filters of a field Sub SetupLookupFilters(fld, pageId) pageId = ew_IIf(ew_EmptyStr(pageId), Grievance_edit.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_edit.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 ' Form Custom Validate event Function Form_CustomValidate(CustomError) 'Return error message in CustomError Form_CustomValidate = True End Function End Class %>