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/panel/ |
Upload File : |
<%@ CodePage="65001" %> <% Response.Buffer = EW_RESPONSE_BUFFER %> <!--#include file="ewcfg.asp"--> <!--#include file="Home_Linksinfo.asp"--> <!--#include file="aspfn.asp"--> <!--#include file="userfn.asp"--> <% Call ew_Header(False, EW_CHARSET, False) %> <% ' Define page object Dim Home_Links_edit Set Home_Links_edit = New cHome_Links_edit Set Page = Home_Links_edit ' Page init processing Call Home_Links_edit.Page_Init ' Page main Call Home_Links_edit.Page_Main ' Global Page Rendering event (in userfn*.asp) Page_Rendering() ' Page Render event Home_Links_edit.Page_Render() %> <!--#include file="header.asp"--> <script type="text/javascript"> // Form object var CurrentPageID = EW_PAGE_ID = "edit"; var CurrentForm = fHome_Linksedit = new ew_Form("fHome_Linksedit", "edit"); // Validate form fHome_Linksedit.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 + "_Course_Title"); if (elm && !ew_IsHidden(elm) && !ew_HasValue(elm)) return this.OnError(elm, "<%= ew_JsEncode2(Replace(Home_Links.Course_Title.ReqErrMsg, "%s", Home_Links.Course_Title.FldCaption)) %>"); elm = this.GetElements("x" + infix + "_Enable"); if (elm && !ew_IsHidden(elm) && !ew_HasValue(elm)) return this.OnError(elm, "<%= ew_JsEncode2(Replace(Home_Links.Enable.ReqErrMsg, "%s", Home_Links.Enable.FldCaption)) %>"); elm = this.GetElements("x" + infix + "_Sequence"); if (elm && !ew_CheckInteger(elm.value)) return this.OnError(elm, "<%= ew_JsEncode2(Home_Links.Sequence.FldErrMsg) %>"); // 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 fHome_Linksedit.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 %> fHome_Linksedit.ValidateRequired = true; // Use JavaScript validation <% Else %> fHome_Linksedit.ValidateRequired = false; // No JavaScript validation <% End If %> // Dynamic selection lists fHome_Linksedit.Lists["x_Enable"] = {"LinkField":"","Ajax":null,"AutoFill":false,"DisplayFields":["","","",""],"ParentFields":[],"ChildFields":[],"FilterFields":[],"Options":[],"Template":""}; fHome_Linksedit.Lists["x_Enable"].Options = <%= ew_ArrayToJson(Home_Links.Enable.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 Home_Links_edit.ShowPageHeader %> <% Call Home_Links_edit.ShowMessage %> <form name="fHome_Linksedit" id="fHome_Linksedit" class="<%= Home_Links_edit.FormClassName %>" action="<%= ew_CurrentPage %>" method="post"> <% If Home_Links_edit.CheckToken Then %> <input type="hidden" name="<%= EW_TOKEN_NAME %>" value="<%= Home_Links_edit.Token %>"> <% End If %> <input type="hidden" name="a_table" id="a_table" value="Home_Links"> <input type="hidden" name="a_edit" id="a_edit" value="U"> <input type="hidden" name="modal" value="<%= ew_IIf(Home_Links_edit.IsModal, "1", "0") %>"> <div class="ewEditDiv"><!-- page* --> <% If Home_Links.ID.Visible Then ' ID %> <div id="r_ID" class="form-group"> <label id="elh_Home_Links_ID" class="<%= Home_Links.LeftColumnClass %>"><%= Home_Links.ID.FldCaption %></label> <div class="<%= Home_Links.RightColumnClass %>"><div<%= Home_Links.ID.CellAttributes %>> <span id="el_Home_Links_ID"> <span<%= Home_Links.ID.ViewAttributes %>> <p class="form-control-static"><%= Home_Links.ID.EditValue %></p> </span> </span> <input type="hidden" data-table="Home_Links" data-field="x_ID" name="x_ID" id="x_ID" value="<%= ew_HtmlEncode(Home_Links.ID.CurrentValue&"") %>"> <%= Home_Links.ID.CustomMsg %></div></div> </div> <% End If %> <% If Home_Links.Photo.Visible Then ' Photo %> <div id="r_Photo" class="form-group"> <label id="elh_Home_Links_Photo" class="<%= Home_Links.LeftColumnClass %>"><%= Home_Links.Photo.FldCaption %></label> <div class="<%= Home_Links.RightColumnClass %>"><div<%= Home_Links.Photo.CellAttributes %>> <div id="el_Home_Links_Photo"> <div id="fd_x_Photo"> <span title="<%= ew_IIf(Home_Links.Photo.FldTitle <> "", Home_Links.Photo.FldTitle, Language.Phrase("ChooseFile")) %>" class="btn btn-default btn-sm fileinput-button ewTooltip<% If Home_Links.Photo.ReadOnly Or Home_Links.Photo.Disabled Then Response.Write " hide" %>" data-trigger="hover"> <span><%= Language.Phrase("ChooseFileBtn") %></span> <input type="file" title=" " data-table="Home_Links" data-field="x_Photo" name="x_Photo" id="x_Photo"<%= Home_Links.Photo.EditAttributes %>> </span> <input type="hidden" name="fn_x_Photo" id= "fn_x_Photo" value="<%= Home_Links.Photo.Upload.FileName %>"> <% If Request.Form("fa_x_Photo") & "" = "0" Then %> <input type="hidden" name="fa_x_Photo" id= "fa_x_Photo" value="0"> <% Else %> <input type="hidden" name="fa_x_Photo" id= "fa_x_Photo" value="1"> <% End If %> <input type="hidden" name="fs_x_Photo" id= "fs_x_Photo" value="255"> <input type="hidden" name="fx_x_Photo" id= "fx_x_Photo" value="<%= Home_Links.Photo.UploadAllowedFileExt %>"> <input type="hidden" name="fm_x_Photo" id= "fm_x_Photo" value="<%= Home_Links.Photo.UploadMaxFileSize %>"> </div> <table id="ft_x_Photo" class="table table-condensed pull-left ewUploadTable"><tbody class="files"></tbody></table> </div> <%= Home_Links.Photo.CustomMsg %></div></div> </div> <% End If %> <% If Home_Links.Course_Title.Visible Then ' Course_Title %> <div id="r_Course_Title" class="form-group"> <label id="elh_Home_Links_Course_Title" for="x_Course_Title" class="<%= Home_Links.LeftColumnClass %>"><%= Home_Links.Course_Title.FldCaption %><%= Language.Phrase("FieldRequiredIndicator") %></label> <div class="<%= Home_Links.RightColumnClass %>"><div<%= Home_Links.Course_Title.CellAttributes %>> <span id="el_Home_Links_Course_Title"> <input type="text" data-table="Home_Links" data-field="x_Course_Title" name="x_Course_Title" id="x_Course_Title" size="30" maxlength="255" placeholder="<%= Home_Links.Course_Title.PlaceHolder %>" value="<%= Home_Links.Course_Title.EditValue %>"<%= Home_Links.Course_Title.EditAttributes %>> </span> <%= Home_Links.Course_Title.CustomMsg %></div></div> </div> <% End If %> <% If Home_Links.URL.Visible Then ' URL %> <div id="r_URL" class="form-group"> <label id="elh_Home_Links_URL" for="x_URL" class="<%= Home_Links.LeftColumnClass %>"><%= Home_Links.URL.FldCaption %></label> <div class="<%= Home_Links.RightColumnClass %>"><div<%= Home_Links.URL.CellAttributes %>> <span id="el_Home_Links_URL"> <input type="text" data-table="Home_Links" data-field="x_URL" name="x_URL" id="x_URL" size="30" maxlength="255" placeholder="<%= Home_Links.URL.PlaceHolder %>" value="<%= Home_Links.URL.EditValue %>"<%= Home_Links.URL.EditAttributes %>> </span> <%= Home_Links.URL.CustomMsg %></div></div> </div> <% End If %> <% If Home_Links.Enable.Visible Then ' Enable %> <div id="r_Enable" class="form-group"> <label id="elh_Home_Links_Enable" class="<%= Home_Links.LeftColumnClass %>"><%= Home_Links.Enable.FldCaption %><%= Language.Phrase("FieldRequiredIndicator") %></label> <div class="<%= Home_Links.RightColumnClass %>"><div<%= Home_Links.Enable.CellAttributes %>> <span id="el_Home_Links_Enable"> <div id="tp_x_Enable" class="ewTemplate"><input type="radio" data-table="Home_Links" data-field="x_Enable" data-value-separator="<%= Home_Links.Enable.DisplayValueSeparatorAttribute %>" name="x_Enable" id="x_Enable" value="{value}"<%= Home_Links.Enable.EditAttributes %>></div> <div id="dsl_x_Enable" data-repeatcolumn="5" class="ewItemList" style="display: none;"><div> <%= Home_Links.Enable.RadioButtonListHtml(False, "x_Enable", -1, Home_Links) %> </div></div> </span> <%= Home_Links.Enable.CustomMsg %></div></div> </div> <% End If %> <% If Home_Links.Sequence.Visible Then ' Sequence %> <div id="r_Sequence" class="form-group"> <label id="elh_Home_Links_Sequence" for="x_Sequence" class="<%= Home_Links.LeftColumnClass %>"><%= Home_Links.Sequence.FldCaption %></label> <div class="<%= Home_Links.RightColumnClass %>"><div<%= Home_Links.Sequence.CellAttributes %>> <span id="el_Home_Links_Sequence"> <input type="text" data-table="Home_Links" data-field="x_Sequence" name="x_Sequence" id="x_Sequence" size="30" placeholder="<%= Home_Links.Sequence.PlaceHolder %>" value="<%= Home_Links.Sequence.EditValue %>"<%= Home_Links.Sequence.EditAttributes %>> </span> <%= Home_Links.Sequence.CustomMsg %></div></div> </div> <% End If %> </div><!-- /page* --> <% If Not Home_Links_edit.IsModal Then %> <div class="form-group"><!-- buttons .form-group --> <div class="<%= Home_Links.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="<%= Home_Links.ReturnUrl %>"><%= Language.Phrase("CancelBtn") %></button> </div><!-- /buttons offset --> </div><!-- /buttons .form-group --> <% End If %> </form> <script type="text/javascript"> fHome_Linksedit.Init(); </script> <% Call Home_Links_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 Home_Links_edit.Page_Terminate("") Set Home_Links_edit = Nothing %> <% ' ' Page Class ' Class cHome_Links_edit ' Page ID Public Property Get PageID PageID = "edit" End Property ' Project ID Public Property Get ProjectID ProjectID = "panel" End Property ' Table Name Public Property Get TableName TableName = "Home_Links" End Property ' Page Object Name Public Property Get PageObjName PageObjName = "Home_Links_edit" End Property ' Field (ID) Public Property Get ID Set ID = Home_Links.ID End Property ' Field (Photo) Public Property Get Photo Set Photo = Home_Links.Photo End Property ' Field (Course_Title) Public Property Get Course_Title Set Course_Title = Home_Links.Course_Title End Property ' Field (URL) Public Property Get URL Set URL = Home_Links.URL End Property ' Field (Enable) Public Property Get Enable Set Enable = Home_Links.Enable End Property ' Field (Sequence) Public Property Get Sequence Set Sequence = Home_Links.Sequence End Property ' Field (Date) Public Property Get zDate Set zDate = Home_Links.zDate End Property ' Field (IP) Public Property Get IP Set IP = Home_Links.IP End Property ' Get field object dictionary (ASP) Public Property Get Fields Set Fields = Home_Links.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(Home_Links) Then PageHeading = Home_Links.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 Home_Links.UseTokenInUrl Then PageUrl = PageUrl & "t=" & Home_Links.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 Home_Links.UseTokenInUrl Then IsPageRequest = False If ew_NotEmpty(ObjForm) Then IsPageRequest = (Home_Links.TableVar = ObjForm.GetValue("t")) End If If Request.QueryString("t").Count > 0 Then IsPageRequest = (Home_Links.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(Home_Links) Then Set Home_Links = New cHome_Links Set Table = Home_Links ' 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 = "Home_Links" ' Debug message Call ew_LoadDebugMsg ' Open connection to the database If IsEmpty(Conn) Then Set Conn = ew_Connect(Home_Links.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() Call Security.LoadCurrentUserLevel(ProjectID & TableName) If Not Security.CanEdit Then Call Security.SaveLastUrl If Security.CanList Then Call Page_Terminate(ew_GetUrl("Home_Linkslist.asp")) Else Call Page_Terminate(ew_GetUrl("login.asp")) End If End If ' Create form object Set ObjForm = New cFormObj Home_Links.CurrentAction = ew_IIf(Request.QueryString("a").Count > 0, Request.QueryString("a") & "", ObjForm.GetValue("a_list") & "") ' Set up current action Call Home_Links.ID.SetVisibility(Home_Links) If Home_Links.IsAdd() Or Home_Links.IsCopy() Or Home_Links.IsGridAdd() Then Home_Links.ID.Visible = False End If Call Home_Links.Photo.SetVisibility(Home_Links) Call Home_Links.Course_Title.SetVisibility(Home_Links) Call Home_Links.URL.SetVisibility(Home_Links) Call Home_Links.Enable.SetVisibility(Home_Links) Call Home_Links.Sequence.SetVisibility(Home_Links) Call Home_Links.zDate.SetVisibility(Home_Links) Call Home_Links.IP.SetVisibility(Home_Links) ' 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 = Home_Links.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) 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(Home_Links) Then If Home_Links.Export <> "" And Request.Form("data").Count > 0 Then Dim sContent sContent = Request.Form("data") gsExportFile = Request.Form("filename") If gsExportFile = "" Then gsExportFile = Home_Links.TableVar If Home_Links.Export = "pdf" Then Call ExportPdf(sContent) ElseIf Home_Links.Export = "email" Then Response.Write ExportEmail(sContent) ElseIf Home_Links.Export = "excel" Then Call ExportExcel(sContent) ElseIf Home_Links.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 <> Home_Links.ListUrl Then ' Not List page Call row.Add("caption", Home_Links.GetModalCaption(pageName)) If pageName = "Home_Linksview.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 Home_Links = 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 Home_Links.CurrentAction = ObjForm.GetValue("a_edit")&"" ' Get action code If Home_Links.CurrentAction <> "I" Then ' Not reload record, handle as postback postBack = True End If ' Load key from Form If ObjForm.HasValue("x_ID") Then Home_Links.ID.FormValue = ObjForm.GetValue("x_ID") End If Else Home_Links.CurrentAction = "I" ' Default action is display ' Load key from QueryString Dim loadByQuery loadByQuery = False If Request.QueryString("ID").Count > 0 Then Home_Links.ID.QueryStringValue = Request.QueryString("ID") loadByQuery = True Else Home_Links.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 Home_Links.CurrentAction = "" ' Form error, reset action FailureMessage = gsFormError Home_Links.EventCancelled = True ' Event cancelled LoadRow() ' Restore row Call RestoreFormValues ' Restore form values if validate failed End If End If ' Perform current action Select Case Home_Links.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("Home_Linkslist.asp") ' No matching record, return to list End If Case "U" ' Update sReturnUrl = Home_Links.ReturnUrl If ew_GetPageName(sReturnUrl) = "Home_Linkslist.asp" Then sReturnUrl = Home_Links.AddMasterUrl(sReturnUrl) ' List page, return to List page with correct master key if necessary End If Home_Links.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 Home_Links.EventCancelled = True ' Event cancelled LoadRow() ' Restore row Call RestoreFormValues ' Restore form values if update failed End If End Select ' Render the record Home_Links.RowType = EW_ROWTYPE_EDIT ' Render as edit ' Set up Breadcrumb Call SetupBreadcrumb ' Render row Call Home_Links.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) Home_Links.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 Home_Links.StartRecordNumber = StartRec End If End If End If StartRec = Home_Links.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 Home_Links.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 Home_Links.StartRecordNumber = StartRec ElseIf (StartRec-1) Mod DisplayRecs <> 0 Then StartRec = ((StartRec-1)\DisplayRecs)*DisplayRecs+1 ' Point to page boundary Home_Links.StartRecordNumber = StartRec End If End Sub ' ' Get upload files ' Sub GetUploadFiles() ' Get upload data Home_Links.Photo.Upload.Index = ObjForm.Index Home_Links.Photo.Upload.UploadFile() Home_Links.Photo.CurrentValue = Home_Links.Photo.Upload.FileName End Sub ' ' Load form values ' Sub LoadFormValues() ' Load values from form Call GetUploadFiles ' Get upload files If Not Home_Links.ID.FldIsDetailKey Then Home_Links.ID.FormValue = ObjForm.GetValue("x_ID") If Not Home_Links.Course_Title.FldIsDetailKey Then Home_Links.Course_Title.FormValue = ObjForm.GetValue("x_Course_Title") If Not Home_Links.URL.FldIsDetailKey Then Home_Links.URL.FormValue = ObjForm.GetValue("x_URL") If Not Home_Links.Enable.FldIsDetailKey Then Home_Links.Enable.FormValue = ObjForm.GetValue("x_Enable") If Not Home_Links.Sequence.FldIsDetailKey Then Home_Links.Sequence.FormValue = ObjForm.GetValue("x_Sequence") If Not Home_Links.zDate.FldIsDetailKey Then Home_Links.zDate.FormValue = ObjForm.GetValue("x_zDate") If Not Home_Links.IP.FldIsDetailKey Then Home_Links.IP.FormValue = ObjForm.GetValue("x_IP") End Sub ' ' Restore form values ' Sub RestoreFormValues() Home_Links.ID.CurrentValue = Home_Links.ID.FormValue Home_Links.Course_Title.CurrentValue = Home_Links.Course_Title.FormValue Home_Links.URL.CurrentValue = Home_Links.URL.FormValue Home_Links.Enable.CurrentValue = Home_Links.Enable.FormValue Home_Links.Sequence.CurrentValue = Home_Links.Sequence.FormValue Home_Links.zDate.CurrentValue = Home_Links.zDate.FormValue Home_Links.IP.CurrentValue = Home_Links.IP.FormValue End Sub ' ' Load row based on key values ' Function LoadRow() Dim RsRow, sSql, sFilter sFilter = Home_Links.KeyFilter ' Call Row Selecting event Call Home_Links.Row_Selecting(sFilter) ' Load SQL based on filter Home_Links.CurrentFilter = sFilter sSql = Home_Links.SQL Call ew_SetDebugMsg("LoadRow: " & sSql) ' Show SQL for debugging Set RsRow = ew_LoadRowByDbid(sSql, Home_Links.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 Home_Links.Row_Selected(RsRow) If ew_Empty(RsRow) Then Exit Sub If RsRow.EOF Then Exit Sub Home_Links.ID.DbValue = RsRow("ID") Home_Links.Photo.Upload.DbValue = RsRow("Photo") Home_Links.Photo.DbValue = Home_Links.Photo.Upload.DbValue Home_Links.Course_Title.DbValue = RsRow("Course_Title") Home_Links.URL.DbValue = RsRow("URL") Home_Links.Enable.DbValue = RsRow("Enable") Home_Links.Sequence.DbValue = RsRow("Sequence") Home_Links.zDate.DbValue = RsRow("Date") Home_Links.IP.DbValue = RsRow("IP") End Sub ' Return a row with default values Function NewRow Dim cnn, rs, sSql, sFilter ' Clear any previous errors Err.Clear Set cnn = Home_Links.TableConnection sFilter = Home_Links.CurrentFilter Home_Links.CurrentFilter = "(0 = 1)" sSql = Home_Links.SQL Home_Links.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("Photo") = Null rs("Course_Title") = Null rs("URL") = Null rs("Enable") = Null rs("Sequence") = Null rs("Date") = Null rs("IP") = 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 Home_Links.ID.m_DbValue = Rs("ID") Home_Links.Photo.Upload.DbValue = Rs("Photo") Home_Links.Course_Title.m_DbValue = Rs("Course_Title") Home_Links.URL.m_DbValue = Rs("URL") Home_Links.Enable.m_DbValue = Rs("Enable") Home_Links.Sequence.m_DbValue = Rs("Sequence") Home_Links.zDate.m_DbValue = Rs("Date") Home_Links.IP.m_DbValue = Rs("IP") End Sub ' Load old record Function LoadOldRecord() ' Load key values from Session Dim bValidKey bValidKey = True If Home_Links.GetKey("ID")&"" <> "" Then Home_Links.ID.CurrentValue = Home_Links.GetKey("ID") ' ID Else bValidKey = False End If ' Load old record OldRecordset = Null If bValidKey Then Home_Links.CurrentFilter = Home_Links.KeyFilter Dim sSql sSql = Home_Links.SQL Set OldRecordset = ew_LoadRecordsetByDbid(sSql, Home_Links.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 Home_Links.Row_Rendering ' ' Common render codes for all row types ' ' ID ' Photo ' Course_Title ' URL ' Enable ' Sequence ' Date ' IP ' ' View Row ' If Home_Links.RowType = EW_ROWTYPE_VIEW Then ' View row ' ID Home_Links.ID.ViewValue = Home_Links.ID.CurrentValue Home_Links.ID.ViewCustomAttributes = "" ' Photo Home_Links.Photo.UploadPath = "../uploads/homelinks" If Not ew_Empty(Home_Links.Photo.Upload.DbValue) Then Home_Links.Photo.ViewValue = Home_Links.Photo.Upload.DbValue Home_Links.Photo.ViewValue = Home_Links.Photo.Upload.DbValue Else Home_Links.Photo.ViewValue = "" End If Home_Links.Photo.ViewCustomAttributes = "" ' Course_Title Home_Links.Course_Title.ViewValue = Home_Links.Course_Title.CurrentValue Home_Links.Course_Title.ViewCustomAttributes = "" ' URL Home_Links.URL.ViewValue = Home_Links.URL.CurrentValue Home_Links.URL.ViewCustomAttributes = "" ' Enable If Not IsNull(Home_Links.Enable.CurrentValue) Then Home_Links.Enable.ViewValue = Home_Links.Enable.OptionCaption(Home_Links.Enable.CurrentValue) Else Home_Links.Enable.ViewValue = Null End If Home_Links.Enable.ViewCustomAttributes = "" ' Sequence Home_Links.Sequence.ViewValue = Home_Links.Sequence.CurrentValue Home_Links.Sequence.ViewCustomAttributes = "" ' Date Home_Links.zDate.ViewValue = Home_Links.zDate.CurrentValue Home_Links.zDate.ViewCustomAttributes = "" ' IP Home_Links.IP.ViewValue = Home_Links.IP.CurrentValue Home_Links.IP.ViewCustomAttributes = "" ' View refer script ' ID Home_Links.ID.LinkCustomAttributes = "" Home_Links.ID.HrefValue = "" Home_Links.ID.TooltipValue = "" ' Photo Home_Links.Photo.LinkCustomAttributes = "" Home_Links.Photo.HrefValue = "" Home_Links.Photo.HrefValue2 = Home_Links.Photo.UploadPath & Home_Links.Photo.Upload.DbValue Home_Links.Photo.TooltipValue = "" ' Course_Title Home_Links.Course_Title.LinkCustomAttributes = "" Home_Links.Course_Title.HrefValue = "" Home_Links.Course_Title.TooltipValue = "" ' URL Home_Links.URL.LinkCustomAttributes = "" Home_Links.URL.HrefValue = "" Home_Links.URL.TooltipValue = "" ' Enable Home_Links.Enable.LinkCustomAttributes = "" Home_Links.Enable.HrefValue = "" Home_Links.Enable.TooltipValue = "" ' Sequence Home_Links.Sequence.LinkCustomAttributes = "" Home_Links.Sequence.HrefValue = "" Home_Links.Sequence.TooltipValue = "" ' Date Home_Links.zDate.LinkCustomAttributes = "" Home_Links.zDate.HrefValue = "" Home_Links.zDate.TooltipValue = "" ' IP Home_Links.IP.LinkCustomAttributes = "" Home_Links.IP.HrefValue = "" Home_Links.IP.TooltipValue = "" ' ' Edit Row ' ElseIf Home_Links.RowType = EW_ROWTYPE_EDIT Then ' Edit row ' ID Call Home_Links.ID.EditAttrs.UpdateAttribute("class", "form-control") Home_Links.ID.EditCustomAttributes = "" Home_Links.ID.EditValue = Home_Links.ID.CurrentValue Home_Links.ID.ViewCustomAttributes = "" ' Photo Call Home_Links.Photo.EditAttrs.UpdateAttribute("class", "form-control") Home_Links.Photo.EditCustomAttributes = "" Home_Links.Photo.UploadPath = "../uploads/homelinks" If Not ew_Empty(Home_Links.Photo.Upload.DbValue) Then Home_Links.Photo.EditValue = Home_Links.Photo.Upload.DbValue Home_Links.Photo.EditValue = Home_Links.Photo.Upload.DbValue Else Home_Links.Photo.EditValue = "" End If If Home_Links.CurrentAction = "I" And Not Home_Links.EventCancelled Then Call ew_RenderUploadField(Home_Links.Photo, -1) ' Course_Title Call Home_Links.Course_Title.EditAttrs.UpdateAttribute("class", "form-control") Home_Links.Course_Title.EditCustomAttributes = "" Home_Links.Course_Title.EditValue = ew_HtmlEncode(Home_Links.Course_Title.CurrentValue) Home_Links.Course_Title.PlaceHolder = ew_HtmlEncode(ew_RemoveHtml(Home_Links.Course_Title.FldCaption)) ' URL Call Home_Links.URL.EditAttrs.UpdateAttribute("class", "form-control") Home_Links.URL.EditCustomAttributes = "" Home_Links.URL.EditValue = ew_HtmlEncode(Home_Links.URL.CurrentValue) Home_Links.URL.PlaceHolder = ew_HtmlEncode(ew_RemoveHtml(Home_Links.URL.FldCaption)) ' Enable Home_Links.Enable.EditCustomAttributes = "" Home_Links.Enable.EditValue = Home_Links.Enable.Options(False) ' Sequence Call Home_Links.Sequence.EditAttrs.UpdateAttribute("class", "form-control") Home_Links.Sequence.EditCustomAttributes = "" Home_Links.Sequence.EditValue = ew_HtmlEncode(Home_Links.Sequence.CurrentValue) Home_Links.Sequence.PlaceHolder = ew_HtmlEncode(ew_RemoveHtml(Home_Links.Sequence.FldCaption)) ' Date ' IP ' Edit refer script ' ID Home_Links.ID.LinkCustomAttributes = "" Home_Links.ID.HrefValue = "" ' Photo Home_Links.Photo.LinkCustomAttributes = "" Home_Links.Photo.HrefValue = "" Home_Links.Photo.HrefValue2 = Home_Links.Photo.UploadPath & Home_Links.Photo.Upload.DbValue ' Course_Title Home_Links.Course_Title.LinkCustomAttributes = "" Home_Links.Course_Title.HrefValue = "" ' URL Home_Links.URL.LinkCustomAttributes = "" Home_Links.URL.HrefValue = "" ' Enable Home_Links.Enable.LinkCustomAttributes = "" Home_Links.Enable.HrefValue = "" ' Sequence Home_Links.Sequence.LinkCustomAttributes = "" Home_Links.Sequence.HrefValue = "" ' Date Home_Links.zDate.LinkCustomAttributes = "" Home_Links.zDate.HrefValue = "" ' IP Home_Links.IP.LinkCustomAttributes = "" Home_Links.IP.HrefValue = "" End If If Home_Links.RowType = EW_ROWTYPE_ADD Or Home_Links.RowType = EW_ROWTYPE_EDIT Or Home_Links.RowType = EW_ROWTYPE_SEARCH Then ' Add/Edit/Search row Call Home_Links.SetupFieldTitles End If ' Call Row Rendered event If Home_Links.RowType <> EW_ROWTYPE_AGGREGATEINIT Then Call Home_Links.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 Home_Links.Course_Title.FldIsDetailKey And Not IsNull(Home_Links.Course_Title.FormValue) And Home_Links.Course_Title.FormValue&"" = "" Then Call ew_AddMessage(gsFormError, Replace(Home_Links.Course_Title.ReqErrMsg, "%s", Home_Links.Course_Title.FldCaption)) End If If Home_Links.Enable.FormValue&"" = "" Then Call ew_AddMessage(gsFormError, Replace(Home_Links.Enable.ReqErrMsg, "%s", Home_Links.Enable.FldCaption)) End If If Not ew_CheckInteger(Home_Links.Sequence.FormValue) Then Call ew_AddMessage(gsFormError, Home_Links.Sequence.FldErrMsg) 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 = Home_Links.KeyFilter Set cnn = Home_Links.TableConnection Home_Links.CurrentFilter = sFilter sSql = Home_Links.UpdateTableSQL Set Rs = Server.CreateObject("ADODB.Recordset") Rs.CursorLocation = Home_Links.TableCursorLocation Call ew_SetDebugMsg("EditRow: " & sSql) ' Show SQL for debugging Rs.Open sSql, cnn, 1, Home_Links.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) Home_Links.Photo.OldUploadPath = "../uploads/homelinks" Home_Links.Photo.UploadPath = Home_Links.Photo.OldUploadPath If Rs.EOF Then FailureMessage = Language.Phrase("NoRecord") ' Set no record message EditRow = False ' Update Failed Else ' Field Photo If Home_Links.Photo.Visible And Not Home_Links.Photo.ReadOnly And Not Home_Links.Photo.Upload.KeepFile Then Home_Links.Photo.Upload.DbValue = Rs("Photo") ' Get original value If Home_Links.Photo.Upload.FileName & "" = "" Then Rs("Photo") = Null Else Rs("Photo") = Home_Links.Photo.Upload.FileName End If End If ' Field Course_Title Call Home_Links.Course_Title.SetDbValue(Rs, Home_Links.Course_Title.CurrentValue, Null, Home_Links.Course_Title.ReadOnly) ' Field URL Call Home_Links.URL.SetDbValue(Rs, Home_Links.URL.CurrentValue, Null, Home_Links.URL.ReadOnly) ' Field Enable Call Home_Links.Enable.SetDbValue(Rs, Home_Links.Enable.CurrentValue, Null, Home_Links.Enable.ReadOnly) ' Field Sequence Call Home_Links.Sequence.SetDbValue(Rs, Home_Links.Sequence.CurrentValue, Null, Home_Links.Sequence.ReadOnly) ' Field Date Call Home_Links.zDate.SetDbValue(Rs, ew_CurrentDate, Null, False) ' Field IP Call Home_Links.IP.SetDbValue(Rs, ew_CurrentUserIP, Null, False) ' Check recordset update error If Err.Number <> 0 Then FailureMessage = Err.Description Rs.Close Set Rs = Nothing EditRow = False Exit Function End If If Home_Links.Photo.Visible And Not Home_Links.Photo.Upload.KeepFile Then Home_Links.Photo.UploadPath = "../uploads/homelinks" TmpOldFiles = ew_IIf(ew_Empty(Home_Links.Photo.Upload.DbValue), Array(), Array(Home_Links.Photo.Upload.DbValue)) If Not ew_Empty(Home_Links.Photo.Upload.FileName) Then TmpNewFiles = Array(Home_Links.Photo.Upload.FileName) TmpNewFileCount = UBound(TmpNewFiles) + 1 For i = 0 to TmpNewFileCount - 1 TmpFldVar = ew_IIf(Home_Links.Photo.Upload.Index < 0, Home_Links.Photo.FldVar, Mid(Home_Links.Photo.FldVar, 1, 1) & Home_Links.Photo.Upload.Index & Mid(Home_Links.Photo.FldVar, 2)) If TmpNewFiles(i) <> "" Then If ew_FileExists(ew_UploadTempPath(TmpFldVar, Home_Links.Photo.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(Home_Links.Photo.PhysicalUploadPath, TmpFile) ' Get new file name If TmpFile1 <> TmpFile Then Do While ew_FileExists(ew_UploadTempPath(TmpFldVar, Home_Links.Photo.TblVar), TmpFile1) Or ew_FileExists(Home_Links.Photo.PhysicalUploadPath, TmpFile1) ' Make sure no file name clash TmpFile1 = ew_UniqueFilename(Home_Links.Photo.PhysicalUploadPath, TmpFile1, True) ' Use indexed name Loop Call ew_RenameFile(ew_UploadTempPath(TmpFldVar, Home_Links.Photo.TblVar) & TmpFile, ew_UploadTempPath(TmpFldVar, Home_Links.Photo.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 Home_Links.Photo.Upload.DbValue = "" Else Home_Links.Photo.Upload.DbValue = Join(TmpOldFiles, EW_MULTIPLE_UPLOAD_SEPARATOR) End If Home_Links.Photo.Upload.FileName = Join(TmpNewFiles, EW_MULTIPLE_UPLOAD_SEPARATOR) Call Home_Links.Photo.SetDbValue(Rs, Home_Links.Photo.Upload.FileName, Null, Home_Links.Photo.ReadOnly) End If End If ' Call Row Updating event bUpdateRow = Home_Links.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 Home_Links.Photo.Visible And Not Home_Links.Photo.Upload.KeepFile Then TmpOldFiles = ew_IIf(ew_Empty(Home_Links.Photo.Upload.DbValue), Array(), Array(Home_Links.Photo.Upload.DbValue)) If Not ew_Empty(Home_Links.Photo.Upload.FileName) Then TmpNewFiles = Array(Home_Links.Photo.Upload.FileName) TmpNewFiles2 = Array(Rs("Photo")) TmpNewFileCount = UBound(TmpNewFiles) + 1 For i = 0 to TmpNewFileCount - 1 TmpFldVar = ew_IIf(Home_Links.Photo.Upload.Index < 0, Home_Links.Photo.FldVar, Mid(Home_Links.Photo.FldVar, 1, 1) & Home_Links.Photo.Upload.Index & Mid(Home_Links.Photo.FldVar, 2)) If TmpNewFiles(i) <> "" Then If ew_FileExists(ew_UploadTempPath(TmpFldVar, Home_Links.Photo.TblVar), TmpNewFiles(i)) Then TmpFile = ew_UploadTempPath(TmpFldVar, Home_Links.Photo.TblVar) & TmpNewFiles(i) Home_Links.Photo.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 Home_Links.Photo.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(Home_Links.Photo.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 Home_Links.CancelMessage <> "" Then FailureMessage = Home_Links.CancelMessage Home_Links.CancelMessage = "" Else FailureMessage = Language.Phrase("UpdateCancelled") End If EditRow = False End If End If ' Call Row_Updated event If EditRow Then Call Home_Links.Row_Updated(RsOld, RsNew) End If Rs.Close Set Rs = Nothing ' Photo Call ew_CleanUploadTempPath(Home_Links.Photo, Home_Links.Photo.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", Home_Links.TableVar, Home_Links.AddMasterUrl("Home_Linkslist.asp"), "", Home_Links.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), Home_Links_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), Home_Links_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 %>