Imports System.Diagnostics Imports System.Web Imports System.Text Imports System.Xml Imports System.IO Imports System.IO.Path Imports System.Drawing Imports System.Windows.Forms Imports Microsoft.VisualBasic.ControlChars Imports rdServer.rdInternational Imports System.Net Imports System.Collections.Generic Imports System.Globalization Imports System.Threading Imports System.Text.RegularExpressions Imports System.Security 'Imports mshtml Imports System.Web.SessionState Imports rdMetadata Public Class rdSession Public Shared SESSION_VAR_SESSION_GUID As String = "rdSessionGUID" #If JAVA Then Public Shared Sub ApplicationStart() Dim st As New rdState Dim sSettingsDefinitionFile As String = st.sGetDefinition("_Settings", , False) Dim xSettings As New XmlDocument() xSettings.LoadXml(sSettingsDefinitionFile) Dim rdCopy As New rdServer.rdJavaSessionCopying rdCopy.SetupJavaSessionCopying(xSettings) 'Copy the InfoGo plugins over if present. Dim sSupPath As String = st.sGetPhysicalPath & System.IO.Path.DirectorySeparatorChar & "_SupportFiles" & System.IO.Path.DirectorySeparatorChar Dim sWebPath As String = st.sGetPhysicalPath & System.IO.Path.DirectorySeparatorChar & "WEB-INF" & System.IO.Path.DirectorySeparatorChar & "lib" & System.IO.Path.DirectorySeparatorChar If File.Exists(sSupPath & "InfoGoReportManagementPlugin.jar") Then File.Copy(sSupPath & "InfoGoReportManagementPlugin.jar", sWebPath & "InfoGoReportManagementPlugin.jar", True) End If End Sub #End If Public Shared Sub SessionStart() 'Check licensing. Dim st As New rdState Dim sSettingsDefinitionFile As String = st.sGetDefinition("_Settings", , False) 'License10 Dim xSettings As New XmlDocument() xSettings.LoadXml(sSettingsDefinitionFile) Try '12664 HttpContext.Current.Application("rdConstant-rdLicensing") = "Version10" Dim sn As XmlElement = xSettings.SelectSingleNode("/Setting/General") If sn IsNot Nothing Then Dim sAlternateLocation As String = sn.GetAttribute("LicenseFileLocation").Trim If sAlternateLocation <> "" Then HttpContext.Current.Session.Add("rdLicenseFolder", st.sReplaceTokens(sAlternateLocation)) End If End If '#If JAVA Then ' Dim rdCopy As New rdServer.rdJavaSessionCopying ' rdCopy.SetupJavaSessionCopying(xSettings) '#End If ' Issue 11197 - Add note for widgets. ' If this is a request for a widget, we must let the call continue. If we throw the license exception ' now, then the user will only see a "loading ..." page and never get the error. rdWidget will handle the ' license checks and errors. If (Not HttpContext.Current.Server.MapPath(".").Contains("rdWidget")) Then lgxLicense10.CheckLicense(xSettings.DocumentElement.OuterXml) Else '15082 HttpContext.Current.Session("rdProduct") = "rdWidget" End If Catch ex As LicenseException HttpContext.Current.Response.Clear() 'HttpContext.Current.Response.Write(lgxLicense10.ReturnErrorPage(ex.Message)) 'HttpContext.Current.Response.End() HttpContext.Current.Session.Abandon() Dim slash As String = rdState.GetSlash Dim sDirName As String = HttpContext.Current.Request.PhysicalApplicationPath() & "rdDownload" & slash Dim sShortName As String = "LicError" & Guid.NewGuid.ToString() & ".html" Dim sFileName As String = sDirName & sShortName Dim objReader As System.IO.StreamWriter objReader = New System.IO.StreamWriter(sFileName) objReader.Write(lgxLicense10.ReturnErrorPage(ex.Message)) objReader.Close() Dim sUrl As String = HttpContext.Current.Request.ApplicationPath & slash & "rdDownload" & slash & sShortName HttpContext.Current.Response.Redirect(sUrl, True) HttpContext.Current.Response.End() End Try rdSession.SetSessionGUID() End Sub Private Shared Sub SetSessionGUID() HttpContext.Current.Session(rdSession.SESSION_VAR_SESSION_GUID) = Guid.NewGuid() End Sub Public Shared Function GetSessionGUID() As String Dim oSess As Object = HttpContext.Current.Session(rdSession.SESSION_VAR_SESSION_GUID) If IsNothing(oSess) Then 'If rdEndSession is run then you will need a new GUID. HttpContext.Current.Session(rdSession.SESSION_VAR_SESSION_GUID) = Guid.NewGuid() GetSessionGUID = HttpContext.Current.Session(rdSession.SESSION_VAR_SESSION_GUID).ToString Else GetSessionGUID = oSess.ToString End If End Function End Class 'New data definition class Public Class DataBuilder Dim http As HttpContext = HttpContext.Current Dim st As New rdState() Dim dbug As New rdDebug() Dim xmlDef As XmlDocument Public pb As PageBuilder = New PageBuilder() Friend sHtmlOutput As String = "" Friend srHtmlOutputReader As StreamReader Friend msRequestedPage As String = "" Friend isAjaxRequest As Boolean = False Friend needLocalization As Boolean = False Friend rdHS As rdServerHtmlStreamer 'Putting this object here keeps it alive longer so that it's Finalize event isn't fired, thus closing useful streams. Dim _db9 As rdDb9 = Nothing Dim util As New rdUtility() Friend xmlSettings As XmlDocument Dim sSettings As String Dim sbResponse As New StringBuilder() Friend sbHead As New StringBuilder() Dim sbBody As New StringBuilder() Public Sub BuildDataHtml(Optional ByVal DataDefinitionID As String = "") 'Defintion File dbug.AddDebugMessage("Determine Definition") msRequestedPage = DataDefinitionID If msRequestedPage.Length = 0 Then msRequestedPage = st.sGetRequestVar("rdData") If msRequestedPage.Length = 0 Then _ Throw New Exception("The Data Definition must be specified with parameter ""rdData"".") msRequestedPage = msRequestedPage.Replace(".lgx", "") rdEventLogging.LogEvent("BuildData", "Data", rdEventLogging.EventSequence.Starting, "rdData=" & msRequestedPage) dbug.AddDebugMessage(, "Requested Definition", msRequestedPage) dbug.AddDebugMessage(, "Read Definition") 'Get the definition file for the current page. Dim bFromProcess As Boolean = False xmlDef = New XmlDocument() : xmlDef.LoadXml(st.sGetDefinition(msRequestedPage, "Data", , , , , , bFromProcess)) 'Can the user run the report? Call rdSecurityUtil.subCheckDefinitionSecurityRights(xmlDef, st) 'Get DefaultRequestParams, LocalData, SessionParams. Call st.subGetReportStartupParams(xmlDef.DocumentElement, _db9, xmlSettings) 'Do some preprocessing on the defintion file. Call rdState.subRemoveRemarks(xmlDef) Call rdSecurity.subRemoveSecuredElements(xmlDef) Call rdUtility.ApplyDefinitionModifierFiles(st, dbug, xmlDef, xmlDef.DocumentElement) Dim sDataID As String = st.sGetRequestVar("rdDataID") Dim sResultsetFirstRow As String = st.sGetRequestVar("rdResultsetFirstRow") Dim sResultsetRowCount As String = st.sGetRequestVar("rdResultsetRowCount") Dim sResultsetGuid As String = st.sGetRequestVar("rdResultsetGuid") Dim eleJsonData As XmlElement = Nothing If String.IsNullOrEmpty(sDataID) Then Dim nlJsonData As XmlNodeList = xmlDef.DocumentElement.SelectNodes("JsonData") If nlJsonData.Count = 0 Then _ Throw New Exception("Data definitions require a JsonData element.") If nlJsonData.Count > 1 Then _ Throw New Exception("Parameter rdDataID is required when there are multiple JsonData elements.") eleJsonData = nlJsonData(0) Else eleJsonData = xmlDef.DocumentElement.SelectSingleNode("JsonData[@ID='" & sDataID & "']") If IsNothing(eleJsonData) Then _ Throw New Exception("A JsonData element with ID """ & sDataID & """ was not found.") End If 'Data layer info Dim xmlDataLayersInfo As New XmlDocument() xmlDataLayersInfo.LoadXml("") Dim streamData As Stream = Nothing Dim sCacheFileGuid As String = "" Dim bUseCachedDataLayers As Boolean = False 'Read cache? If Not String.IsNullOrEmpty(sResultsetGuid) Then dbug.AddDebugMessage(, "Retrieve Data from cache") Dim sCacheFile As String = st.DataCacheLocation() & "\" & sResultsetGuid & ".xml" bUseCachedDataLayers = st.bGetCachedDataSet9WithoutSession(st, streamData, xmlDataLayersInfo, sCacheFile, xmlSettings) End If If Not bUseCachedDataLayers Then Dim rdData As rdDb9 = New rdServer.rdDb9(Nothing, dbug) streamData = rdData.xmlGetData(eleJsonData, ".//DataLayer") xmlDataLayersInfo = rdData.rdDataLayersInfoXml End If If Not String.IsNullOrEmpty(sResultsetFirstRow) AndAlso Not bUseCachedDataLayers Then dbug.AddDebugMessage(, "Retrieve Data (not from cache)") st.sCacheDataset9(streamData, xmlDataLayersInfo, xmlSettings, "", sCacheFileGuid) End If Dim db9 As New rdDb9(xmlSettings, Nothing) 'First paged request? If so, cache the data If Not String.IsNullOrEmpty(sResultsetFirstRow) AndAlso String.IsNullOrEmpty(sResultsetGuid) AndAlso Not bUseCachedDataLayers Then dbug.AddDebugMessage(, "Cache data with rdResultsetGuid parameter.") streamData = db9.xmlGetData(eleJsonData, "DataLayer") st.sCacheDataset9(streamData, db9.rdDataLayersInfoXml, xmlSettings, sCacheFileGuid) End If 'Remove non requested rows if this is a paging request If Not String.IsNullOrEmpty(sResultsetFirstRow) AndAlso Not String.IsNullOrEmpty(sResultsetFirstRow) AndAlso Not IsNothing(streamData) Then Dim iFirstRow As Integer Integer.TryParse(sResultsetFirstRow, iFirstRow) Dim iRows As Integer Integer.TryParse(sResultsetRowCount, iRows) Dim iLastRow As Integer = iFirstRow + (iRows - 1) Dim paging As New rdDataPaging9 streamData = paging.RemoveOffPageRowsWithoutSession(dbug, streamData, iFirstRow, iLastRow, xmlSettings) End If rdEventLogging.LogEvent("BuildData", "Data", rdEventLogging.EventSequence.Ending, "DataID=" & msRequestedPage) dbug.AddDebugMessage(, "Build JSON") If Not IsNothing(streamData) Then sbResponse.AppendLine(rdJSON.sProcess_IncludeJSON(eleJsonData, st, dbug, sbResponse, True, streamData)) Else sbResponse.AppendLine(rdJSON.sProcess_IncludeJSON(eleJsonData, st, dbug, sbResponse, True)) End If Try streamData.Close() streamData = Nothing Catch : End Try dbug.AddDebugMessage(, "Set response headers") If Not String.IsNullOrEmpty(sCacheFileGuid) Then http.Response.AddHeader("ResultsetGuid", sCacheFileGuid) If Not String.IsNullOrEmpty(sResultsetFirstRow) Then http.Response.AddHeader("FirstRow", sResultsetFirstRow) If Not String.IsNullOrEmpty(sResultsetRowCount) Then http.Response.AddHeader("RowCount", sResultsetRowCount) 'Make sure to set the right content type of the response If Not String.IsNullOrEmpty(st.sGetRequestVar("lgxPreview")) Then http.Response.ContentType = "text/html" If dbug.DebuggingEnabled Then _ sbResponse.Append("
") ElseIf Not String.IsNullOrEmpty(eleJsonData.GetAttribute("JsonVarName")) Then http.Response.ContentType = "application/javascript" Else http.Response.ContentType = "application/json" End If dbug.AddDebugMessage(, "Finish") http.Response.Output.Write(sbResponse.ToString()) http.Response.End() End Sub Public Sub BuildResponse() Call dbug.NewTransaction() dbug.AddDebugMessage("Data Definition", "Start") dbug.AddDebugMessage("Requested URL", , http.Request.Url.ToString) If Not String.IsNullOrEmpty(dbug.DebugUrl) Then _ http.Response.AddHeader("DebuggerTraceUrl", dbug.DebugUrl) Try lgxLicense10.CheckLicense() 'Get settings and make sure constants are set Dim xmlSettings As New XmlDocument() Dim sSettings As String = st.sGetDefinition("_Settings") If sSettings = http.Application("_Settings-rdDef-string") Then xmlSettings.LoadXml(sSettings) Else xmlSettings.LoadXml(st.sGetDefinition("_Settings")) Call st.subSetConstants(xmlSettings) End If rdInternational.SetCulture(rdInternational.CultureType.CULTURE_INVARIANT) Dim sec As rdSecurity = http.Session("rdSecurity") If Not IsNothing(sec) Then 'Security object already exists. It's the same or a different user If sec.SecurityIsEnabled Then Dim eleSecurity As XmlElement = xmlSettings.DocumentElement.SelectSingleNode("Security") '12223 12499 Dim restartSession As Boolean = False Dim AuthenticationSource As String = eleSecurity.GetAttribute("AuthenticationSource") Boolean.TryParse(eleSecurity.GetAttribute("RestartSession"), restartSession) Dim sToken As String = HttpContext.Current.Request.QueryString("rdSecureKey") If AuthenticationSource = "SecureKey" _ AndAlso restartSession _ And Not String.IsNullOrEmpty(sToken) _ And IsNothing(http.Items("SecureKeyAuthenticated")) _ Then If IsNothing(http.Items("rdDebugError")) Then '16688: Don't restart the security if we're re-running a report for the debugger, and we're on the first report request. sec = Nothing End If Else 'Has the authenticated user changed? Dim sRequestUserName As String = st.sReplaceTokens("@Request.UserName~") If sRequestUserName.Length <> 0 _ AndAlso sec.UserName <> sRequestUserName Then 'New user. Clear the security object. sec = Nothing Else 'Same user. If sec.CheckSecurityEveryRequest Then 'This is the default path! Clear the security object so it is retested. sec = Nothing End If End If End If End If End If If IsNothing(sec) Then 'Test security. sec = New rdSecurity(xmlSettings) http.Session("rdSecurity") = sec 'This may be needed/retreived from the session object later. End If Dim msRequestedPage As String = st.sGetRequestVar("rdData") Call BuildDataHtml(msRequestedPage) ''''''''''''''''''Error Handling'''''''''''''' Catch ex As ThreadAbortException 'Normal end. Catch ex As Exception If st.sGetRequestVar("lgxPreview").Length = 0 Then Call dbug.subReportGeneralError(ex, True) http.Response.StatusCode = HttpStatusCode.BadRequest http.Response.Write(ex.Message) http.Response.End() Else 'Build the page again, this time with debugging turned on. If Not dbug.DebuggingEnabled Then http.Items("rdDebugError") = True If http.Request("rdDebugSession") = "False" Then '24168 Throw ex Else Call BuildResponse() 'Rerun the stuff that created the error. This time, debuggin is turned on. End If Else Call dbug.subReportGeneralError(ex, True) If (http.Items("rdDebuggerFile") IsNot Nothing) Then http.Response.Write(rdUtility.ReadFile(http.Items("rdDebuggerFile"))) '15695 Else http.Response.Write(http.Items("rdDebuggerFile")) End If End If End If End Try End Sub End Class Public Class ResponseBuilder Public isAjaxRequest As Boolean = False Public isExportRequest As Boolean = False 'Public sWidgetResponse As String Public xmlWidgetResponse As XmlDocument Dim http As HttpContext = HttpContext.Current Dim st As New rdState() Dim dbug As New rdDebug() Public Sub BuildResponse() 'http.Response.AppendToLog("Dave was here") 'HttpContext.Current.Session("rdLic") = True #If JAVA Then ' 9354 If the session is not properly initialized then try once again with the Tomcat servletReponse. If http.Request.RawUrl.ToLower.IndexOf("rdtemplate/rdwidget/rdwidget.aspx") = -1 Then '12375 Dim servletRequest As javax.servlet.http.HttpServletRequest = vmw.j2ee.J2EEUtils.getHttpServletRequest() Dim servletSession As javax.servlet.http.HttpSession = servletRequest.getSession If IsNothing(http.Session("rdProduct")) And servletSession.getAttribute("rdJavaRedirect") <> "true" Then rdServer.rdSession.SessionStart() '13929 The Session_Start event did not fire. Run it directly. If IsNothing(http.Session("rdProduct")) And servletSession.getAttribute("rdJavaRedirect") <> "true" Then http.Session.Abandon() Dim servletResponse As javax.servlet.http.HttpServletResponse = vmw.j2ee.J2EEUtils.getHttpServletResponse servletSession.setAttribute("rdJavaRedirect", "true") servletResponse.sendRedirect(http.Request.RawUrl) http.Response.End() End If If servletSession.getAttribute("rdJavaRedirect") = "true" Then servletSession.removeAttribute("rdJavaRedirect") End If End If End If #End If 'License10 'If HttpContext.Current.Application("rdConstant-rdLicensing") = "Version10" Then Try HttpContext.Current.Application("rdConstant-rdLicensing") = "Version10" If HttpContext.Current.Server.MapPath(".").Contains("rdWidget") Then ' Issue 11197 - Add note for widgets. ' Widgets are the only thing that should pass through here, this allows note to show. If IsNothing(http.Session("rdProduct")) Then http.Session.Add("rdProduct", "RepDevEnt") Else lgxLicense10.CheckLicense() End If 'lgxLicense10.CheckLicense() Catch ex As LicenseException http.Response.Clear() http.Response.Write(lgxLicense10.ReturnErrorPage(ex.Message)) http.Response.End() End Try If IsNothing(http.Session("rdProduct")) Then Dim sMsg As String sMsg = "There is a problem with the ASP.NET Session object. Some possible reasons are:" sMsg &= "
  • Sessions are disabled for this web." sMsg &= "
  • The session has been somehow destoyed." sMsg &= "
  • There is a problem with Global.asax. Make sure that Global.asax is properly installed in the web folder, and that versions of Global.asax.resx and Global.asax.vb are NOT installed." sMsg &= "
  • If you have a custom Global.asax, the Session_Start event should include:
    " sMsg &= " Dim rdServer As rdServer.rdSession
    " sMsg &= " Call rdServer.SessionStart()" http.Response.Write(sMsg) http.Response.End() End If Call dbug.NewTransaction() dbug.AddDebugMessage("Response Builder", "Start") dbug.AddDebugMessage("Requested URL", , http.Request.Url.ToString) Try #If JAVA Then '9843 and 10434 Dim props As java.util.Properties = java.lang.System.getProperties() Dim rt As java.lang.Runtime = java.lang.Runtime.getRuntime() dbug.AddDebugMessage("Java Settings") Dim sVersion As String = java.lang.System.getProperty("java.version") Dim dVersion As Double = Double.Parse(sVersion.Substring(0, 3), CultureInfo.InvariantCulture) '11354 dbug.AddDebugMessage(, "Java Version", sVersion) 'This should be 1.6. Older versions will have scripting errors. dbug.AddDebugMessage(, "Java VM name", java.lang.System.getProperty("java.vm.name")) 'This should be a SERVER VM not CLIENT. SERVER is much faster. dbug.AddDebugMessage(, "java.awt.headless", java.lang.System.getProperty("java.awt.headless")) 'This is a required setting. http://java.sun.com/developer/technicalArticles/J2SE/Desktop/headless/ dbug.AddDebugMessage(, "java.home", java.lang.System.getProperty("java.home")) 'This should be a JRE under a JDK. The SERVER VM is shipped with the JDK. dbug.AddDebugMessage(, "Free VM Memory", FormatNumber(rt.freeMemory, 0, TriState.False)) 'This is how much memory is free within the currently allocated memory. dbug.AddDebugMessage(, "Total VM Memory", FormatNumber(rt.totalMemory, 0, TriState.False)) 'This is not the same as MAX. It's how memory is currently allocated. Watch this. dbug.AddDebugMessage(, "Max VM Memory", FormatNumber(rt.maxMemory, 0, TriState.False)) 'This should be at least 1GB. Dim iter As java.util.Iterator = java.lang.management.ManagementFactory.getMemoryPoolMXBeans().iterator() While (iter.hasNext()) '11376 Dim item As java.lang.management.MemoryPoolMXBean = CType(iter.next(), java.lang.management.MemoryPoolMXBean) Dim sMemory As String = item.getName().Trim Select Case sMemory '21448 Case "PS Perm Gen" Dim lPermGen As Long = item.getUsage().getMax If lPermGen > 0 Then '13559 Dim sPermGen As String = FormatNumber(lPermGen, 0, TriState.False) If lPermGen < 134217728 Then dbug.AddDebugMessage(, "Maximum PermGen Memory", "**** PermGen memory is " & sPermGen & ". This is below the 128MB safe minimum. Please set the following java option -XX:MaxPermSize=128m. Complete Logi Java setup information is available on DevNet. ****") 'This is how much memory is free within the currently allocated memory. Else dbug.AddDebugMessage(, "Maximum PermGen Memory", sPermGen) 'This is how much memory is free within the currently allocated memory. End If End If Case "Code Cache" Dim lUsed As Long = item.getUsage().getUsed If lUsed > 0 Then dbug.AddDebugMessage(, "Code Cache Memory", FormatNumber(lUsed, 0, TriState.False)) End If Case "Metaspace" Dim lUsed As Long = item.getUsage().getUsed item.getUsage.getCommitted() item.getUsage() If lUsed > 0 Then dbug.AddDebugMessage(, "Metaspace Memory", FormatNumber(lUsed, 0, TriState.False)) End If Case "PS Eden Space" Dim lUsed As Long = item.getUsage().getUsed If lUsed > 0 Then dbug.AddDebugMessage(, "Eden Space Memory", FormatNumber(lUsed, 0, TriState.False)) End If Case "PS Survivor Space" Dim lUsed As Long = item.getUsage().getUsed If lUsed > 0 Then dbug.AddDebugMessage(, "Survivor Space Memory", FormatNumber(lUsed, 0, TriState.False)) End If Case "PS Old Gen" Dim lUsed As Long = item.getUsage().getUsed If lUsed > 0 Then dbug.AddDebugMessage(, "Old Generation Memory", FormatNumber(lUsed, 0, TriState.False)) End If End Select End While rt = Nothing props = Nothing If dVersion < 1.6 Then '10975 Throw New Exception("JDK 1.6 or later is required. Version " & sVersion & " was found.") End If #End If 'Get the settings. #5315 Dim xmlSettings As New XmlDocument() Dim sSettings As String = st.sGetDefinition("_Settings") If sSettings = http.Application("_Settings-rdDef-string") Then xmlSettings.LoadXml(sSettings) Else 'The settings.lgx file changed. ' Need to remove all cached definition files. dbug.AddDebugMessage(, "Settings changed, removing cached Definitions.", http.Request.Url.ToString) http.Application.Set("_Settings-rdDef-string", sSettings) http.Application.Remove("rdConstantsLoaded") http.Session.Remove("rdDebugSession") Dim sAppKey As String For Each sAppKey In http.Application.AllKeys If sAppKey.EndsWith("rdDef") Or sAppKey.StartsWith("rdConstant") Then If sAppKey <> "rdConstant-rdNativePdf" Then http.Application.Remove(sAppKey) End If End If Next xmlSettings.LoadXml(st.sGetDefinition("_Settings")) Call st.subSetConstants(xmlSettings) End If Dim intelReporting As rdIntelligenceReporting = rdIntelligenceReporting.GetIntelligenceReporting() 'Show the wait page If st.sGetRequestVar("rdShowWait") = "True" Then subShowWait(xmlSettings) End If rdInternational.SetCulture(rdInternational.CultureType.CULTURE_INVARIANT) '#6536 - New UserCulture Attribute for Globalization If Not IsNothing(http.Application("rdConstant-UserCulture")) Then http.Session("rdUserCulture") = st.sReplaceTokens(http.Application("rdConstant-UserCulture")) End If Dim atrXFrameOptions As XmlAttribute = xmlSettings.SelectSingleNode("/Setting/General/@IFrameEmbeddingHostRestrictions") '24166 If Not IsNothing(atrXFrameOptions) AndAlso Not String.IsNullOrEmpty(atrXFrameOptions.Value.Trim) AndAlso st.sGetRequestVar("rdembedded") = "true" Then '24656 Dim sXFrameOptions As String = "" Select Case atrXFrameOptions.Value.ToUpper Case "SAMEORIGIN" sXFrameOptions = "SAMEORIGIN" Case "DENY" sXFrameOptions = "DENY" Case Else Dim sAllowedFrom As String = atrXFrameOptions.Value If sAllowedFrom.IndexOf(",") <> -1 Then Dim aAllowedFrom() As String = sAllowedFrom.Split(",") If st.sGetRequestVar("forOrigin").Length <> 0 Then Dim sForOrigin As String = st.sGetRequestVar("forOrigin") sXFrameOptions = "DENY" For i As Integer = 0 To aAllowedFrom.Length - 1 If aAllowedFrom(i) = sForOrigin Then sXFrameOptions = "ALLOW FROM " & aAllowedFrom(i) End If Next Else sXFrameOptions = "DENY" End If Else sXFrameOptions = "ALLOW-FROM " & atrXFrameOptions.Value End If End Select http.Response.AddHeader("X-Frame-Options", sXFrameOptions) End If 'Initialize security. Dim sLogoffRedirect As String = st.sGetRequestVar("rdLogoffRedirect") If sLogoffRedirect.Length <> 0 Then http.Session.Abandon() http.Response.Redirect(sLogoffRedirect) End If Dim bNewUserSession As Boolean = False Dim sec As rdSecurity = http.Session("rdSecurity") If IsNothing(sec) Then bNewUserSession = True End If If Not IsNothing(sec) Then 'Security object already exists. It's the same or a different user If sec.SecurityIsEnabled Then Dim eleSecurity As XmlElement = xmlSettings.DocumentElement.SelectSingleNode("Security") '12223 12499 Dim restartSession As Boolean = False Dim AuthenticationSource As String = eleSecurity.GetAttribute("AuthenticationSource") Boolean.TryParse(eleSecurity.GetAttribute("RestartSession"), restartSession) Dim sToken As String = HttpContext.Current.Request.QueryString("rdSecureKey") If AuthenticationSource = "SecureKey" _ AndAlso restartSession _ And Not String.IsNullOrEmpty(sToken) _ And IsNothing(http.Items("SecureKeyAuthenticated")) _ Then If IsNothing(http.Items("rdDebugError")) Then '16688: Don't restart the security if we're re-running a report for the debugger, and we're on the first report request. bNewUserSession = True sec = Nothing http.Session.Remove("rdSecurity") End If Else 'Has the authenticated user changed? Dim sRequestUserName As String = st.sReplaceTokens("@Request.UserName~") If sRequestUserName.Length <> 0 _ AndAlso sec.UserName <> sRequestUserName Then 'New user. Clear the security object. bNewUserSession = True sec = Nothing http.Session.Remove("rdSecurity") Else 'Same user. If sec.CheckSecurityEveryRequest Then 'This is the default path! Clear the security object so it is retested. sec = Nothing http.Session.Remove("rdSecurity") End If End If End If End If End If If IsNothing(sec) Then 'Test security. rdEventLogging.LogEvent("SessionStart", "", rdEventLogging.EventSequence.Starting) sec = New rdSecurity(xmlSettings) http.Session("rdSecurity") = sec End If 'AppDev and LogiXML 4.5 support. 'If an AppDev PassportID ever comes in, save it as a session variable. If st.sGetRequestVar("lgx_PassportID").Length > 0 Then http.Session("lgx_PassportID") = st.sGetRequestVar("lgx_PassportID") End If dbug.AddDebugMessage("Application Security", "Enabled", sec.SecurityIsEnabled) If sec.SecurityIsEnabled Then dbug.AddDebugMessage(, "Authenticated User", sec.UserName) dbug.AddDebugMessage(, "User Roles", sec.UserRolesString) dbug.AddDebugMessage(, "User Rights", sec.UserRightsString) End If If Not IsNothing(http.Session("rdErrorLogLocation")) Then '25503, RD17366 Dim eleGeneral As XmlElement = xmlSettings.SelectSingleNode("//Setting/General") http.Session("rdErrorLogLocation") = st.sGetAttribute(eleGeneral, "ErrorLogLocation") End If If bNewUserSession Then Dim nlStartupProcesses As XmlNodeList = xmlSettings.DocumentElement.SelectNodes("StartupProcess") For i As Integer = 0 To nlStartupProcesses.Count - 1 dbug.AddDebugMessage("Run StartupProcess") Dim ap As New rdServer.ActionProcessor() If i = nlStartupProcesses.Count - 1 Then 'Last StartupProcess. ap.DisableResponse = False Else ap.DisableResponse = True End If ap.ProcessAction(nlStartupProcesses(i)) Next '25624 - Re establish UserCulture Attribute for Globalization If Not IsNothing(http.Application("rdConstant-UserCulture")) Then http.Session("rdUserCulture") = st.sReplaceTokens(http.Application("rdConstant-UserCulture")) End If End If If st.sGetRequestVar("rdGetWidgetSample") = "True" Then _ Call WidgetBuilder.RespondWithWidgetSample() 'If Array.IndexOf("Excel,NativeExcel,Word,NativeWord,GoogleSpreadsheet,CSV,PDF,HtmlEmail,HtmlExport".Split(","), st.sGetRequestVar("rdReportFormat")) <> -1 Then _ If Array.IndexOf("Excel,NativeExcel,Word,NativeWord,GoogleSpreadsheet,CSV,PDF,HtmlEmail,HtmlExport,DataLayerXml".Split(","), st.sGetRequestVar("rdReportFormat")) <> -1 Then _ isExportRequest = True Dim pb As New PageBuilder(dbug, xmlSettings) pb.isAjaxRequest = Me.isAjaxRequest pb.st = st If st.sGetRequestVar("rdTemplate").Length <> 0 Then Dim rdTemplate As New rdServer.rdTemplate() Call rdTemplate.sBuildTemplateReport(xmlSettings) 'This contains Redirects, so we may not come back. Else pb.BuildHtml() 'License10 'Issue 10615 - No naggler is request is for schema only. ' If (HttpContext.Current.Application("rdConstant-rdLicensing") = "Version10") AndAlso _ '(st.sGetRequestVar("rdReportFormat") <> "DataLayerSchema") AndAlso _ '(lgxLicense10.GetError().Length > 0) Then If (st.sGetRequestVar("rdReportFormat") <> "DataLayerSchema") AndAlso _ (lgxLicense10.GetError().Length > 0) Then Dim oStream As System.IO.Stream = pb.srHtmlOutputReader.BaseStream If oStream.GetType.Name = "MemoryStream" Then oStream.Position = 0 Dim sr As New StreamReader(oStream, System.Text.Encoding.UTF8) Dim sPage As String = sr.ReadToEnd() Dim nStart As Integer = sPage.IndexOf("", nStart) If (nEnd < 0) Then Throw New Exception("Invalid output producted.") sPage = sPage.Insert(nEnd + 1, lgxLicense10.GetError()) Dim ms As New MemoryStream() Dim sw As New StreamWriter(ms, System.Text.Encoding.UTF8) sw.Write(sPage) sw.Flush() ms.Position = 0 pb.srHtmlOutputReader = New StreamReader(ms, System.Text.Encoding.UTF8) Else If oStream.CanRead Then oStream.Close() Dim sFileName As String = CType(oStream, FileStream).Name Dim sNewName As String = sFileName.Substring(0, sFileName.LastIndexOf(System.IO.Path.DirectorySeparatorChar) + 1) & Guid.NewGuid.ToString() & ".txt" Dim fsIn As New FileStream(sFileName, FileMode.Open, FileAccess.Read) Dim sr As New StreamReader(fsIn, System.Text.Encoding.UTF8) Dim fsOut As New FileStream(sNewName, FileMode.Create, FileAccess.Write) Dim sw As New StreamWriter(fsOut, System.Text.Encoding.UTF8) Try Dim bMessageAdded As Boolean = False Dim nBuffer As Integer = 131072 Dim aBuffer(nBuffer) As Char While (Not sr.EndOfStream) sr.Read(aBuffer, 0, aBuffer.Length) If (Not bMessageAdded) Then Dim sText As New String(aBuffer) Dim nStart As Integer = sText.IndexOf(" 0) Then Dim nEnd As Integer = sText.IndexOf(">", nStart) sText = sText.Insert(nEnd + 1, lgxLicense10.GetError()) End If sw.Write(sText) Else sw.Write(aBuffer) End If End While Finally sw.Close() sr.Close() End Try pb.srHtmlOutputReader = New StreamReader(sNewName, System.Text.Encoding.UTF8) End If 'Issue 16783 - Removed code for logi banner at the bottom of pages. End If '#If JAVA Then '8787 srHtmlOutputReader is being discarded. ' Dim rt As java.lang.Runtime = java.lang.Runtime.getRuntime() ' rt.gc() '#End If If st.sGetRequestVar("rdReportFormat") = "DataLayerSchema" Or st.sGetRequestVar("rdReportFormat") = "PdfFormFields" Then 'Issue 11275, 13548 'Getting schema for Studio http.Response.Write(pb.sHtmlOutput) Else 'Typical execution path. 'Version9 streams. #If Not java Then 'This can cause memory streams to be garbage collected. dbug.AddDebugMessage("Report", "Paging Method", pb.sGetPagingMethod()) #End If If isExportRequest Then Call subBuildExport9(pb.srHtmlOutputReader.BaseStream) 'This contains Redirects, so we may not come back. ElseIf isAjaxRequest Then 'Ajax stuff should be small, so we can convert to a string. pb.srHtmlOutputReader.BaseStream.Position = 0 Dim sHtmlOutput As String = pb.srHtmlOutputReader.ReadToEnd() Dim a As New rdAjax() a.PostProcessAjaxRefresh(sHtmlOutput, st) If sHtmlOutput.Length <> 0 Then 'Test the sHtml to ensure it's valid XML. '18808 - Removing html validation for AJAX 19991 19450 Try Dim xmlHtml As New XmlDocument 'Replace any & < > inside script tags to prevent xml validation errors ' & = _rdamp_ , < = _rdlt_ , > = _rdgt_ If sHtmlOutput.Contains("")) Then Dim iScriptStart As Integer = sHtmlOutput.IndexOf("= 0 Dim iScriptStartLength As Integer = sHtmlOutput.IndexOf(">", iScriptStart) - iScriptStart + 1 iScriptStart += iScriptStartLength iScriptEnd = sHtmlOutput.IndexOf("", iScriptStart) sModifiedHtmlOutput &= sHtmlOutput.Substring(0, iScriptStart) sModifiedJavascript = sHtmlOutput.Substring(iScriptStart, (iScriptEnd - iScriptStart)) sModifiedJavascript = sModifiedJavascript.Replace("&", "_rdamp_") sModifiedJavascript = sModifiedJavascript.Replace("<", "_rdlt_") sModifiedJavascript = sModifiedJavascript.Replace("<=", "_rdlt_=") sModifiedJavascript = sModifiedJavascript.Replace(">", " _rdgt_") sModifiedHtmlOutput &= sModifiedJavascript sHtmlOutput = sHtmlOutput.Substring(iScriptEnd) iScriptStart = sHtmlOutput.IndexOf("" ' But with .End, errors in embedded sub-reports cause a blank page to be returned. ' Seems to be working OK now... Else Call dbug.subReportGeneralError(ex) '13776 Me.xmlWidgetResponse = New XmlDocument() If (ex.GetType.Name = "LicenseException") Then ' Issue 11197 - Add note for widgets. xmlWidgetResponse.LoadXml("" & lgxLicense10.ReturnErrorPage(ex.Message) & "") Else ''Widget request. ' Debug pages are already written to file, use that instead...13776 Dim sErrorMsg As String = "There was an error creating the widget. The error was:
    " & ex.Message & "
    " If http.Session("rdDebuggerStyle") <> "NoDetail" _ AndAlso http.Session("rdDebuggerStyle") <> "Redirect" Then sErrorMsg &= "View details." End If Me.xmlWidgetResponse.LoadXml("" & sErrorMsg & "") End If ' Create a new transaction, since its an error we don't need to add additional debug info to existing debug file.13776 dbug.NewTransaction(True) Dim wr As New WidgetBuilder(dbug) Call wr.BuildResponse(Me.xmlWidgetResponse) End If End If End Try '#If JAVA Then '17134 ' If Not IsNothing(System.Web.HttpContext.Current.Session.Item("rdProcedureRedirect")) Then ' System.Web.HttpContext.Current.Session.Remove("rdProcedureRedirect") '8375 ' End If ' '10137 ' 'Dim runt As java.lang.Runtime = java.lang.Runtime.getRuntime() ' 'runt.gc() '#End If End Sub Private Sub subCleanup() 'Remove any expired session variables. rdState.CleanupExpiredSessionVars() 'Request a Cleanup. Dim rdCleanup As New rdServer.rdCleanup(dbug) rdCleanup.subAsyncCleanup() End Sub Private Sub subWriteSuperElementSaveFile() '23267 Defect - InfoGo: error in bookmark corrupts bookmark file. 'This routine writes save files after error handling so that if there is an error, the bad save file is not saved. 'It works for the AG only because the AG does full page loads with each update. 'Other super elements, like ReportAuthor and Dashboard use Ajax which does the saving to the save file, and then the super-element is reloaded from that. 'So code cannot know when there's an error until after the save. Might find a solution to that later, but the AG is generally at greater risk of errors. If IsNothing(HttpContext.Current.Items("rdWriteSaveFileName")) Then _ Exit Sub Try rdUtility.WriteFile(http.Items("rdWriteSaveFileName"), http.Items("rdWriteSaveFileContent")) Catch : End Try End Sub Private Sub subBuildExport9(ByRef streamHtml As Stream) 'NOTE: The stream may be changed in this call. Dim util As New rdUtility() Dim st As New rdState() Dim sUrl As String = "" Dim sFilename As String = "" Dim slash As String = rdState.GetSlash() Dim sGoogUrl As String = "" ' Loading the report defintion. Dim xmlExportReport As New XmlDocument() xmlExportReport.LoadXml(st.sGetDefinition(st.sGetRequestVar("rdReport"))) Dim nlExportFileNames As XmlNodeList = xmlExportReport.SelectNodes("//Action") Dim rdHS As rdServerHtmlStreamer rdHS = New rdServerHtmlStreamer(streamHtml, st.DataCacheLocation) If streamHtml.GetType.Name = "MemoryStream" Then 'Keep using the same kind of stream. rdHS.MemoryStreamLimit = 2048 Else rdHS.MemoryStreamLimit = 0 End If '#18142 If xmlExportReport.SelectSingleNode("//WaitPage") IsNot Nothing Or st.sGetRequestVar("rdHasWaitPanel") = "True" Then '19212 Dim cFileDownload As HttpCookie = New HttpCookie("rdFileDownloadComplete", "true") '24977 cFileDownload.HttpOnly = False HttpContext.Current.Response.SetCookie(cFileDownload) End If 'Write out the file with an extension to the download folder. Select Case http.Request("rdReportFormat") Case "Excel", "GoogleSpreadsheet" sFilename = GetEncodedQueryString("rdExportFilename") '19351 Call rdState.MakeTempDownloadFilename("xls", sUrl, sFilename) Case "Word" sFilename = GetEncodedQueryString("rdExportFilename") Call rdState.MakeTempDownloadFilename("doc", sUrl, sFilename) Case "NativeExcel" sFilename = GetEncodedQueryString("rdExportFilename") 'Call rdState.MakeTempExportDownloadFilename("xls", sUrl, sFilename) ' Is it excel 2007 format? If st.sGetRequestVar("rdExportExtension").Length <> 0 Then Call rdState.MakeTempExportDownloadFilename(st.sGetRequestVar("rdExportExtension").Replace(".", ""), sUrl, sFilename) ElseIf st.sGetRequestVar("rdExcelOutputFormat") = "Excel2007" Then Call rdState.MakeTempExportDownloadFilename("xlsx", sUrl, sFilename) Else Call rdState.MakeTempExportDownloadFilename("xls", sUrl, sFilename) End If Case "NativeWord" sFilename = GetEncodedQueryString("rdExportFilename") Call rdState.MakeTempExportDownloadFilename("doc", sUrl, sFilename) Case "CSV" sFilename = GetEncodedQueryString("rdExportFilename") 'Call rdState.MakeTempDownloadFilename("csv", sUrl, sFilename) Call rdState.MakeTempExportDownloadFilename("csv", sUrl, sFilename) Case "XML", "DataLayerXml" Dim sFileExtension As String = st.sGetRequestVar("rdFileExtension") If sFileExtension.Length = 0 Then sFileExtension = "xml" 'Call rdState.MakeTempDownloadFilename(sFileExtension, sUrl, sFilename) Call rdState.MakeTempExportDownloadFilename(sFileExtension, sUrl, sFilename) '18368 Case Else ' includes PDF Call rdState.MakeTempDownloadFilename("htm", sUrl, sFilename) End Select 'Select Case http.Request("rdReportFormat") ' Case "Excel", "Word", "GoogleSpreadsheet" ' 'If http.Request.Browser.Browser <> "IE" Then ' 'These exports can't include the style sheet or the user will see an error. Issue 2521. ' 'rdHS.Replace("", "") 'End If If http.Request("rdReportFormat") = "Excel" _ OrElse http.Request("rdReportFormat") = "Word" Then util.CopySupportDirectories(rdState.sGetPhysicalPath, rdState.sGetPhysicalPath() & slash & "rdDownload") End If If http.Request("rdEmbeddedSubReport") = "True" Then 'The stream gets written to the Response object by the calling function. Exit Sub ElseIf http.Request("rdReportFormat") = "CSV" Then dbug.AddDebugMessage("Exporting to CSV", "Start") 'Get the definition file's encoding. Dim sEncoding As String = st.sGetRequestVar("rdExportEncoding") If sEncoding.Length = 0 Then sEncoding = HttpContext.Current.Application("rdConstant-rdDefaultCsvEncoding") 'If sEncoding.Length = 0 Then sEncoding = "ISO-8859-1" 'If IsNothing(sEncoding) OrElse sEncoding.Length = 0 Then sEncoding = "unicode" 'This is the new default. #7015 If IsNothing(sEncoding) OrElse sEncoding.Length = 0 Then sEncoding = "utf-8" 'This is the new default. #7553 Unicode doesn't open properly in Excel. 'Make the CSV. Dim csv As New rdCsv() csv.StringColumns = st.sGetRequestVar("rdCsvStringColumns") If st.sGetRequestVar("rdCsvFieldDelimiter").Length <> 0 Then csv.FieldDelimiter = st.sGetRequestVar("rdCsvFieldDelimiter") If csv.FieldDelimiter.StartsWith("=") Then Dim evl As New rdScriptEvaluator() csv.FieldDelimiter = evl.sEvaluateFormula(csv.FieldDelimiter) End If End If If st.sGetRequestVar("rdCsvRowDelimiter").Length <> 0 Then csv.RowDelimiter = st.sGetRequestVar("rdCsvRowDelimiter") If csv.RowDelimiter.StartsWith("=") Then Dim evl As New rdScriptEvaluator() csv.RowDelimiter = evl.sEvaluateFormula(csv.RowDelimiter) End If End If ' #8074. For CSV export replace " " back with " "... Dim sExcelReplacementFixups(0, 1) As String sExcelReplacementFixups(0, 0) = " " : sExcelReplacementFixups(0, 1) = " " Call rdHS.ReplaceStringPairs(sExcelReplacementFixups, sEncoding) Call csv.HtmlToFile9(rdHS.InputStream, sFilename, st.sGetRequestVar("rdExportTableID"), sEncoding) csv = Nothing rdHS = Nothing #If JAVA Then Dim r As java.lang.Runtime = java.lang.Runtime.getRuntime() r.gc() #Else GC.Collect() #End If dbug.AddDebugMessage(, "Finish") ElseIf http.Request("rdReportFormat") = "NativeExcel" Then dbug.AddDebugMessage("Exporting to NativeExcel", "Start") 'Get the definition file's encoding. Dim sEncoding As String = st.sGetRequestVar("rdExportEncoding") If sEncoding.Length = 0 Then sEncoding = "ISO-8859-1" '15506 - remove version7 code path, defaulting to excel version8 always. Dim sGridlines As String = rdNativeExcelUtil.GetGridLinesType(st) ' Getting the report definition dynamically, if changed by a plugin call. # 9117 Dim sModifiedReportDef As String = st.sGetDefinition(st.sGetRequestVar("rdReport")) Dim sNewRepDef As String = HttpContext.Current.Session("rdDataLayerPluginModifiedDefinition") Dim sNewRepDefID As String = HttpContext.Current.Session("rdDataLayerPMDefinition") '20558 If Not IsNothing(sNewRepDef) AndAlso Not IsNothing(sNewRepDefID) Then If sNewRepDef.Length <> 0 AndAlso st.sGetRequestVar("rdReport") = sNewRepDefID Then sModifiedReportDef = sNewRepDef End If End If Dim sExcelReplacementFixups(11, 1) As String sExcelReplacementFixups(0, 0) = "" : sExcelReplacementFixups(0, 1) = "" '#7247 Was backwards: "" sExcelReplacementFixups(1, 0) = "" : sExcelReplacementFixups(1, 1) = "" sExcelReplacementFixups(2, 0) = "" : sExcelReplacementFixups(2, 1) = "" sExcelReplacementFixups(3, 0) = "
    " : sExcelReplacementFixups(3, 1) = "

    " sExcelReplacementFixups(4, 0) = "" : sExcelReplacementFixups(4, 1) = " " sExcelReplacementFixups(5, 0) = "" : sExcelReplacementFixups(5, 1) = " " sExcelReplacementFixups(6, 0) = " 0 Then Dim eleModifiedAGNode As XmlElement = Nothing : Dim ModifiedAGNodeDoc As New XmlDocument Dim eleOldAg As XmlElement #If JAVA Then '10365 Dim iRow As Integer = 0 Do While iRow < nlModAGList.Count eleOldAg = nlModAGList.ItemOf(iRow) iRow = iRow + 1 Dim sAGId As String = eleOldAg.GetAttribute("ID") If Not IsNothing(HttpContext.Current.Session("rdAgDefFile-" & sAGId)) Then ModifiedAGNodeDoc.Load(HttpContext.Current.Session("rdAgDefFile-" & sAGId)) eleModifiedAGNode = ModifiedAGNodeDoc.DocumentElement eleOldAg.ParentNode.AppendChild(ModifiedAGDef.ImportNode(eleModifiedAGNode, True)) eleOldAg.ParentNode.RemoveChild(eleOldAg) nlModAGList = ModifiedAGDef.SelectNodes("//AnalysisGrid") End If Loop #Else For Each eleOldAg In nlModAGList Dim sAGId As String = eleOldAg.GetAttribute("ID") If Not IsNothing(HttpContext.Current.Session("rdAgDefFile-" & sAGId)) Then ModifiedAGNodeDoc.Load(HttpContext.Current.Session("rdAgDefFile-" & sAGId)) eleModifiedAGNode = ModifiedAGNodeDoc.DocumentElement eleOldAg.ParentNode.AppendChild(ModifiedAGDef.ImportNode(eleModifiedAGNode, True)) eleOldAg.ParentNode.RemoveChild(eleOldAg) End If Next #End If sModifiedReportDef = ModifiedAGDef.OuterXml.ToString End If Dim nlSharedElements As XmlNodeList = ModifiedAGDef.SelectNodes("//SharedElement") '17797 If nlSharedElements.Count <> 0 Then Dim eleSharedElement As XmlElement = Nothing Do While nlSharedElements.Count > 0 '17797 eleSharedElement = nlSharedElements.ItemOf(0) eleSharedElement.ParentNode.RemoveChild(eleSharedElement) nlSharedElements = ModifiedAGDef.SelectNodes("//SharedElement") Loop 'For Each eleSharedElement In nlSharedElements ' eleSharedElement.ParentNode.RemoveChild(eleSharedElement) 'Next sModifiedReportDef = ModifiedAGDef.OuterXml.ToString End If Dim rdXl As New rdExcel.rdExcel8() 'Call rdXl.subHtmlToExcel(rdHS.InputStream, sFilename, st.sGetRequestVar("rdExportTableID"), st.sGetDefinition(st.sGetRequestVar("rdReport")), st.sGetRequestVar("rdShowGridlines")) 'dbug.AddDebugMessage(, "Export Html", "View Export Html", "file:" & CType(rdHS.InputStream, FileStream).Name) dbug.AddDebugMessage(, "Export Html", "View Export Html", StreamMoreInfo(rdHS.InputStream)) Call rdXl.subHtmlToExcel(rdHS.InputStream, sFilename, st.sGetRequestVar("rdExportTableID"), sModifiedReportDef, sGridlines, st.sGetRequestVar("rdExcelOutputFormat"), st.sGetRequestVar("rdExcelPaperSize")) rdXl = Nothing rdHS = Nothing '9360 streamHtml.Close() '9360 dbug.AddDebugMessage(, "Finish") ElseIf http.Request("rdReportFormat") = "GoogleSpreadsheet" Then dbug.AddDebugMessage("Exporting to Google Spreadsheet", "Start") Dim eleSpSheet As XmlElement = Nothing Dim nlSpSheet As XmlNodeList = Nothing For Each eleSpSheet In nlExportFileNames If st.sGetAttribute(eleSpSheet, "Type") = "GoogleSpreadsheet" Then nlSpSheet = eleSpSheet.ChildNodes End If Next eleSpSheet = Nothing Dim sConnectionID As String = "" Dim sSpreadsheetname As String = "" Dim bConvertToGoogleFormat As Boolean = True For Each eleSpSheet In nlSpSheet If eleSpSheet.Name = "Target" Then sSpreadsheetname = st.sGetAttribute(eleSpSheet, "Spreadsheetname") sConnectionID = st.sGetAttribute(eleSpSheet, "ConnectionID") If st.sGetAttribute(eleSpSheet, "ConvertToGoogleFormat").Equals("False") Then bConvertToGoogleFormat = False End If End If Next 'Get the definition file's encoding. Dim sEncoding As String = st.sGetRequestVar("rdExportEncoding") If sEncoding.Length = 0 Then sEncoding = "ISO-8859-1" Dim sExcelReplacementFixups(5, 1) As String 'sExcelReplacementFixups(0, 0) = "" : sExcelReplacementFixups(0, 1) = "" 'Was backwards: "" sExcelReplacementFixups(0, 0) = "" : sExcelReplacementFixups(0, 1) = "" '17894 - XHTML invalid when showmodes/condition used to remove content for Word Export - Replaced "" with "" to fix sExcelReplacementFixups(1, 0) = "" : sExcelReplacementFixups(1, 1) = "" sExcelReplacementFixups(2, 0) = "" : sExcelReplacementFixups(2, 1) = "" sExcelReplacementFixups(3, 0) = "
    " : sExcelReplacementFixups(3, 1) = "

    " sExcelReplacementFixups(4, 0) = "" : sExcelReplacementFixups(4, 1) = " " sExcelReplacementFixups(5, 0) = "" : sExcelReplacementFixups(5, 1) = " " Call rdHS.ReplaceStrings(sExcelReplacementFixups) Dim rdXl As New rdExcel.rdExcel8() Call rdXl.subHtmlToExcel(rdHS.InputStream, sFilename, st.sGetRequestVar("rdExportTableID"), st.sGetDefinition(st.sGetRequestVar("rdReport")), st.sGetRequestVar("rdShowGridlines"), st.sGetRequestVar("rdExcelOutputFormat"), st.sGetRequestVar("rdExcelPaperSize")) rdXl = Nothing Dim sSettings As String = st.sGetDefinition("_Settings") Dim xmlSettings As XmlDocument = New XmlDocument xmlSettings.LoadXml(sSettings) Dim eleConn As XmlElement = xmlSettings.SelectSingleNode("Setting/Connections/Connection[@ID='" & sConnectionID & "']") If IsNothing(eleConn) Then _ Throw New Exception("The specified connection could not be found: " & sConnectionID) If eleConn.GetAttribute("Type") <> "GoogleDocs" Then _ Throw New Exception("The specified connection must be a GoogleDocs connection.") Dim rdGoog As New rdConnector.rdGoogle() sGoogUrl = rdGoog.UploadSpreadsheet(eleConn, sFilename, sSpreadsheetname, bConvertToGoogleFormat) ElseIf http.Request("rdReportFormat") = "NativeWord" Then '#If JAVA Then 'CBS Word not supported - waiting for licensing. 5190 -- 6703 license now installed. ' Throw New Exception("Native Word is not currently supported in the Java version") '#End If dbug.AddDebugMessage("Exporting to NativeWord", "Start") '10/30/13 CC - Uses a 2D array to replace parts of the xml file. First part of the array is what to replace, second part is the part its replaced with. 18921 Dim sExcelReplacementFixups(8, 1) As String 'sExcelReplacementFixups(0, 0) = "" : sExcelReplacementFixups(0, 1) = "" 'Was backwards: "" sExcelReplacementFixups(0, 0) = "" : sExcelReplacementFixups(0, 1) = "" '17894 - XHTML invalid when showmodes/condition used to remove content for Word Export - Replaced "" with "" to fix sExcelReplacementFixups(1, 0) = "" : sExcelReplacementFixups(1, 1) = "" sExcelReplacementFixups(2, 0) = "" : sExcelReplacementFixups(2, 1) = "" sExcelReplacementFixups(3, 0) = "
    " : sExcelReplacementFixups(3, 1) = "

    " sExcelReplacementFixups(4, 0) = "" : sExcelReplacementFixups(4, 1) = " " sExcelReplacementFixups(5, 0) = "" : sExcelReplacementFixups(5, 1) = " " sExcelReplacementFixups(6, 0) = " " : sExcelReplacementFixups(6, 1) = String.Empty '20727 sExcelReplacementFixups(7, 0) = "£" : sExcelReplacementFixups(7, 1) = Chr(163).ToString() sExcelReplacementFixups(8, 0) = "¥" : sExcelReplacementFixups(8, 1) = Chr(165).ToString() '22239 - Word Exports don't encode < and > characters. Don't need to replace the &... It messes with the encoding for <, > and other special characters. 'sExcelReplacementFixups(9, 0) = "&" : sExcelReplacementFixups(9, 1) = "&" Call rdHS.ReplaceStrings(sExcelReplacementFixups) Call subEditAgColumnHeadersForWordExport(rdHS) sFilename = sFilename.Replace(".htm", ".doc") sUrl = sUrl.Replace(".htm", ".doc") Dim wrd As New rdNativeWord.rdNativeWord() Call subFillExportProperties(wrd) Dim sStreamingFilename As String = rdState.GetNewDataCacheFilename("txt") dbug.AddDebugMessage(, "Export Html", "View Export Html", StreamMoreInfo(rdHS.InputStream)) wrd.subHtmlToWord(rdHS.InputStream, sFilename, sStreamingFilename) dbug.AddDebugMessage(, "Finish") ElseIf http.Request("rdReportFormat") = "PDF" Then Select Case rdPdfUtil.GetPdfType(st) #If JAVA Then '7283 Case "JavaPdf" Dim sPdfFilename As String = "" Dim sPdfUrl As String = "" Dim xmlExpReport As New XmlDocument() xmlExpReport.LoadXml(st.sGetDefinition(st.sGetRequestVar("rdReport"))) sPdfFilename = st.sGetRequestVar("rdExportFilename") Call rdState.MakeTempExportDownloadFilename("pdf", sPdfUrl, sPdfFilename) If st.sGetRequestVar("rdDebugPdf") <> "True" Then Dim pdf As New rdJavaPdf.rdJavaPdf 'Issue #5078 - tokens in printable paging element... Dim sExpPageWidth As String = Nothing : Dim sExpPageHeight As String = Nothing Dim eleExportPaging As XmlElement = xmlExpReport.SelectSingleNode("//*/PrintablePaging") If st.sGetRequestVar("rdExportReportAuthorView") = "True" Then ReportAuthorPdfPageHeightWidth(eleExportPaging, xmlExpReport) '23255 End If If Not IsNothing(eleExportPaging) Then ' if printable paging element is present then... Call subGetPdfPageHeightWidth(eleExportPaging, sExpPageHeight, sExpPageWidth) End If '#19311 #10069 - Is the showTableHeaderMIR attribute set to true ? Dim sKeepTabHeadMIR As String = st.sGetRequestVar("rdKeepTabheadMIR") dbug.AddDebugMessage(, "Export Html", "View Export Html", StreamMoreInfo(rdHS.InputStream)) '13743 Call pdf.BuildPdf(rdHS.InputStream, sPdfFilename, xmlExpReport, st.sGetRequestVar("rdExportTableID"), sExpPageWidth, sExpPageHeight, sKeepTabHeadMIR) dbug.AddDebugMessage(, "PDF Generated", sPdfFilename) sFilename = sPdfFilename sUrl = sPdfUrl pdf = Nothing rdHS = Nothing streamHtml.Close() End If Dim rt As java.lang.Runtime = java.lang.Runtime.getRuntime() '9523 rt.gc() #Else 'Case "Version7" ' 'This is the old PDF conversion. Doesn't work very well and is not recommended. ' sFilename = sFilename.Replace(".htm", ".pdf") ' sUrl = sUrl.Replace(".htm", ".pdf") ' Dim pdf As New rdNativePdf.rdNativePdf() ' Call subFillExportProperties(pdf) ' 'Fix4rdDb9Never. ' Dim sHtml As String = rdHS.SubString(0, rdHS.InputStream.Length) ' pdf.subHtmlToPdf(sHtml, sFilename) Case "Version8" Dim sPdfFilename As String = "" Dim sPdfUrl As String = "" Dim xmlExpReport As New XmlDocument() xmlExpReport.LoadXml(st.sGetDefinition(st.sGetRequestVar("rdReport"))) 'Dim nlExpFileNames As XmlNodeList = xmlExpReport.SelectNodes("//Action") 'sPdfFilename = getExpFileName("PDF", nlExpFileNames) sPdfFilename = st.sGetRequestVar("rdExportFilename") Call rdState.MakeTempExportDownloadFilename("pdf", sPdfUrl, sPdfFilename) 'Make a local file system url to the exported html file that easyPDF can understand. 'Dim sLocalPdfGenerationUrl As String = "file:///" & rdState.sGetPhysicalPath.Replace("\", "/") & "/" & sUrl 'You can add rdDebugPdf=True to the PDF Action's LinkParams to have the page returned back to the browser 'without submitting to PDF generation. Can help with debugging. If st.sGetRequestVar("rdDebugPdf") <> "True" Then 'This function starts an IE session, runs a request on the exported HTML, and sends the results to the 'WebSuperGoo library for the PDF creation. 'Dim pdf As New rdPdf8.rdPdf8 'Call subFillExportProperties(pdf) 'Dim sExcelReplacementFixups(0, 1) As String 'sExcelReplacementFixups(0, 0) = "^fixme!" : sExcelReplacementFixups(0, 1) = "" 'Call rdHS.ReplaceStrings(sExcelReplacementFixups) 'Issue #5078 - tokens in printable paging element... Dim sExpPageWidth As String = Nothing : Dim sExpPageHeight As String = Nothing Dim eleExportPaging As XmlElement = xmlExpReport.DocumentElement.SelectSingleNode("//*/PrintablePaging") '22404 'Info Go specific code, Set the export page dimensions and Orientation. If st.sGetRequestVar("rdExportReportAuthorView") = "True" Then ReportAuthorPdfPageHeightWidth(eleExportPaging, xmlExpReport) '23255 End If If Not IsNothing(eleExportPaging) Then ' if printable paging element is present then... Call subGetPdfPageHeightWidth(eleExportPaging, sExpPageHeight, sExpPageWidth) ' 11923 End If ' #10069 - Is the showTableHeaderMIR attribute set to true ? Dim sKeepTabHeadMIR As String = st.sGetRequestVar("rdKeepTabheadMIR") dbug.AddDebugMessage(, "Export Html", "View Export Html", StreamMoreInfo(rdHS.InputStream)) ' 18739 - PDF dll gets locked. Use a separate AppDomain to make sure all locks are removed after pdf render. Dim serverDomain As AppDomain = AppDomain.CreateDomain("TempDomain", New System.Security.Policy.Evidence(AppDomain.CurrentDomain.Evidence)) Try 'Run PDF Dim pdf As rdPdf8.rdPdf8 = CType(serverDomain.CreateInstanceFrom(GetType(rdPdf8.rdPdf8).Assembly.Location, GetType(rdPdf8.rdPdf8).FullName).Unwrap(), rdPdf8.rdPdf8) pdf.BuildPdf(rdHS.InputStream, sPdfFilename, xmlExpReport, st.sGetRequestVar("rdExportTableID"), sExpPageWidth, sExpPageHeight, sKeepTabHeadMIR) dbug.AddDebugMessage(, "PDF Generated", sPdfFilename) sFilename = sPdfFilename sUrl = sPdfUrl Catch ex As Exception Throw New Exception("Error Exporting to PDF.", ex) '19305 Finally If serverDomain IsNot Nothing Then AppDomain.Unload(serverDomain) End Try 'Call pdf.BuildPdf(rdHS.InputStream, sPdfFilename, xmlExpReport, st.sGetRequestVar("rdExportTableID"), sExpPageWidth, sExpPageHeight, sKeepTabHeadMIR) 'dbug.AddDebugMessage(, "PDF Generated", sPdfFilename) 'sFilename = sPdfFilename 'sUrl = sPdfUrl 'pdf = Nothing ' Test to see if this resolves the ABCPdf lock issue. End If #End If End Select End If Select Case http.Request("rdReportFormat") Case "HtmlEmail" rdUtility.WriteFile(sFilename, rdHS.InputStream, st.sGetRequestVar("rdExportEncoding")) http.Response.Write(rdUtility.ReadFile(sFilename)) 'This extra step of getting the report into a string allows the Process to work. 'Because Server.Execute() get's garbage encoding characters from .TransmitFile(). Case "HtmlExport" 'Make an XML document listing the files that were exported. 'If st.sGetRequestVar("rdRequestFromProcess") = "True" Then This is always from a process rdUtility.WriteFile(sFilename, rdHS.InputStream, st.sGetRequestVar("rdExportEncoding")) 'util.CopySupportDirectories(rdState.sGetPhysicalPath, rdState.sGetPhysicalPath() & slash & "rdDownload") Dim sExportFiles As String = "" sExportFiles &= "" 'This is the main HTML file. Dim colExportFiles As Collection = HttpContext.Current.Items("rdExportFiles") '"rdExportFiles" was set in rdServerHtmlFixup.vb If Not IsNothing(colExportFiles) Then For Each sFilename In colExportFiles 'These are chart files. sExportFiles &= "" Next End If sExportFiles &= "" http.Response.Write(sExportFiles) 'End If Case "PDF", "CSV", "NativeExcel", "NativeWord" If st.sGetRequestVar("rdRequestFromProcess") = "True" Then Dim sExportFiles As String = "" sExportFiles &= "" 'This is export file. sExportFiles &= "" http.Response.Write(sExportFiles) Else #If JAVA Then sUrl = sUrl.Replace("\", "/") '12948 sUrl = CheckUtf8Chars(sUrl, True) '19351 #End If http.Response.Redirect(sUrl) 'Redirect to export file. End If Case "GoogleSpreadsheet" http.Response.Redirect(sGoogUrl) Case Else rdUtility.WriteFile(sFilename, rdHS.InputStream) If Not st.sGetRequestVar("rdGetResponseFilename") = "True" Then '14418 http.Response.Redirect(sUrl) 'Redirect to export file. End If End Select End Sub Private Sub ReportAuthorPdfPageHeightWidth(ByRef eleExportPaging As XmlElement, ByRef xmlExpReport As XmlDocument) '23255 If IsNothing(eleExportPaging) Then eleExportPaging = xmlExpReport.DocumentElement.AppendChild(xmlExpReport.CreateElement("PrintablePaging")) End If #If JAVA Then Dim sAutoFit As String = st.sGetRequestVar("PdfPageJavaAutoFit") If Not String.IsNullOrEmpty(sAutoFit) Then eleExportPaging.SetAttribute("PdfAutoFit", sAutoFit) End If #End If 'Dim sPanelId As String = st.sGetRequestVar("rdExportPanelId") Dim sPdfSize As String = st.sGetRequestVar("PdfPageSize") If String.IsNullOrEmpty(sPdfSize) Then sPdfSize = "8.5X11" End If Dim sPdfOrientation As String = st.sGetRequestVar("PdfPageOrientation") Dim aSizes() As String = sPdfSize.Split("X") If sPdfOrientation = "Landscape" Then eleExportPaging.SetAttribute("PageWidth", CDbl(aSizes(1)) - 1) eleExportPaging.SetAttribute("PageHeight", CDbl(aSizes(0)) - 1.5) Else eleExportPaging.SetAttribute("PageWidth", CDbl(aSizes(0)) - 1) eleExportPaging.SetAttribute("PageHeight", CDbl(aSizes(1)) - 1.5) End If End Sub Private Sub subGetPdfPageHeightWidth(ByRef eleExportPaging As XmlElement, ByRef sExpPageHeight As String, ByRef sExpPageWidth As String) '5078 sExpPageWidth = eleExportPaging.GetAttribute("PageWidth") sExpPageHeight = eleExportPaging.GetAttribute("PageHeight") ' replace sExpPageWidth = sExpPageWidth.Replace("@Request.", "@RequestXmlEncoded.") 'Ensure valid XHTML. Helps with formulas. Issue 1628. sExpPageWidth = sExpPageWidth.Replace("@Local.", "@LocalHtmlEncoded.") sExpPageHeight = sExpPageHeight.Replace("@Request.", "@RequestXmlEncoded.") 'Ensure valid XHTML. Helps with formulas. Issue 1628. sExpPageHeight = sExpPageHeight.Replace("@Local.", "@LocalHtmlEncoded.") If Not IsNumeric(sExpPageWidth) Then sExpPageWidth = st.sReplaceTokens(sExpPageWidth) End If If Not IsNumeric(sExpPageHeight) Then sExpPageHeight = st.sReplaceTokens(sExpPageHeight) End If End Sub Private Sub subFillExportProperties(ByVal exp As Object) Dim xmlExpReport As New XmlDocument() xmlExpReport.LoadXml(st.sGetDefinition(st.sGetRequestVar("rdReport"))) Dim eleExpPaging As XmlElement = xmlExpReport.DocumentElement.SelectSingleNode("//*/PrintablePaging") Dim nExpPageWidth As String = 7.5 Dim nExpPageHeight As String = 9.5 Dim nExpMarginLeft As Single = 0.5 Dim nExpMarginRight As Single = 0.5 Dim nExpMarginTop As Single = 0.75 Dim nExpMarginBottom As Single = 0.75 Dim nTimeoutSecs As Integer If Not IsNothing(eleExpPaging) Then If eleExpPaging.GetAttribute("MarginLeft").Length > 0 Then _ nExpMarginLeft = eleExpPaging.GetAttribute("MarginLeft").Replace(",", ".") 'The Replace() helps with international numbers, in case the developer enters commas for decimal points. But generally, definitions should always have points for decimal position. If eleExpPaging.GetAttribute("MarginBottom").Length > 0 Then _ nExpMarginBottom = eleExpPaging.GetAttribute("MarginBottom").Replace(",", ".") If eleExpPaging.GetAttribute("MarginTop").Length > 0 Then _ nExpMarginTop = eleExpPaging.GetAttribute("MarginTop").Replace(",", ".") If eleExpPaging.GetAttribute("MarginRight").Length > 0 Then _ nExpMarginRight = eleExpPaging.GetAttribute("MarginRight").Replace(",", ".") ' supporting tokens for page height and width...17977 If eleExpPaging.GetAttribute("PageWidth").Length > 0 Then nExpPageWidth = eleExpPaging.GetAttribute("PageWidth") ' replace nExpPageWidth = nExpPageWidth.Replace("@Request.", "@RequestXmlEncoded.") 'Ensure valid XHTML. Helps with formulas. Issue 1628. nExpPageWidth = nExpPageWidth.Replace("@Local.", "@LocalHtmlEncoded.") If Not IsNumeric(nExpPageWidth) Then nExpPageWidth = st.sReplaceTokens(nExpPageWidth) End If End If If eleExpPaging.GetAttribute("PageHeight").Length > 0 Then nExpPageHeight = eleExpPaging.GetAttribute("PageHeight") nExpPageHeight = nExpPageHeight.Replace("@Request.", "@RequestXmlEncoded.") 'Ensure valid XHTML. Helps with formulas. Issue 1628. nExpPageHeight = nExpPageHeight.Replace("@Local.", "@LocalHtmlEncoded.") If Not IsNumeric(nExpPageHeight) Then nExpPageHeight = st.sReplaceTokens(nExpPageHeight) End If End If End If nExpPageWidth += nExpMarginLeft + nExpMarginRight nExpPageHeight += nExpMarginTop + nExpMarginBottom If st.sGetRequestVar("rdPdfTimeout").Length <> 0 Then _ exp.TimeoutSeconds = st.sGetRequestVar("rdPdfTimeout") exp.PageWidth = nExpPageWidth exp.PageHeight = nExpPageHeight If TypeOf exp Is rdNativeWord.rdNativeWord Then ' Set the page margins exp.MarginLeft = nExpMarginLeft exp.MarginRight = nExpMarginRight exp.MarginTop = nExpMarginTop exp.MarginBottom = nExpMarginBottom ' Add the debug information dbug.AddDebugMessage("Native Export Generation", "Timeout seconds", nTimeoutSecs) dbug.AddDebugMessage(, "Page Width", nExpPageWidth) dbug.AddDebugMessage(, "Page Height", nExpPageHeight) End If End Sub Private Sub subEditAgColumnHeadersForWordExport(ByRef rdHS As rdServerHtmlStreamer) Dim iPos0 As Integer = rdHS.IndexOf("") If iPos0 <> -1 Then Try Dim iPos1 As Integer = rdHS.IndexOf("
  • " sReturn = sSetClass(eleDef, sReturn) sReturn = sSetPositioning(eleDef, sReturn) sReturn = sSetAction(eleDef, sReturn) Return sReturn End Function Private Function sProcess_Button(ByRef eleDef As XmlElement, ByVal sElementID As String) As String Dim sReturn As String = Nothing ' sReturn = " "ExtraColumnHeader" Or Not IsNothing(eleDef.Attributes("ProcessExtraColumnHeader")) Then Dim sTagName As String = "SPAN" If st.sGetAttribute(eleDef, "HtmlDiv") = "True" Then sTagName = "DIV" 'This is used by the DataTree and OlapGrid. End If If bPreEvaluatedConditionIsFalse(eleDef) Then 'Condition=False. Remove this element, don't process any children. eleDef.InnerXml = "" Return "" End If sReturn = "<" & sTagName & " " & sGetTooltipTitle(eleDef) & ">" 'sReturn = "<" & sTagName & " >" sReturn = sSetID(eleDef, sReturn) sReturn = sSetClass(eleDef, sReturn) sReturn = sSetStyle(eleDef, sReturn) 'Style attribute is normally not supported. This is added for nowrap in CellBar elements. sReturn = sSetPositioning(eleDef, sReturn) sReturn = sSetVisibility(eleDef, sReturn) sReturn = sSetHtmlStyle(eleDef, sReturn) sReturn = sReturn & sProcessDefinitionElementChildren(eleDef) sReturn = sReturn & "" sReturn = sSetEventHandler(eleDef, sReturn) '#13993. sReturn = sSetAction(eleDef, sReturn) '#17389 sReturn = sSetConditionalElement(eleDef, sReturn) sReturn = sSetQuicktip(eleDef, sReturn) '16382 If Not IsNothing(eleDef.SelectSingleNode("Resizer")) Then sReturn = sSetResizer(eleDef, eleDef.GetAttribute("ID"), 0, 0, sReturn) End If If eleDef.Name = "DragDivision" Then sReturn = sProcess_DragDivision(eleDef, sReturn) ElseIf eleDef.Name = "DropDivision" Then sReturn = sProcess_DropDivision(eleDef, sReturn) End If End If Return sReturn End Function Private Function sProcess_DragDivision(ByRef eleDragDiv As XmlElement, ByVal sHtmlElement As String) As String lgxLicense10.LicenseCheck(eleDragDiv) mbAddAjaxSupport = True Dim nPosCloseTag As Integer = sHtmlElement.IndexOf(">") sHtmlElement = sHtmlElement.Insert(nPosCloseTag, " rdDraggable=""True""") Dim sHoverClass As String = eleDragDiv.GetAttribute("HoverClass") If sHoverClass.Length <> 0 Then sHtmlElement = sHtmlElement.Insert(nPosCloseTag, " rdHoverClass=""" & sHoverClass & """") End If 'Create an empty SPAN that stores the LinkParams in attributes. Dim sHiddenLinkParams As String = "" For Each eleLinkParam As XmlElement In eleDragDiv.SelectNodes("LinkParams") For Each atrLinkParam As XmlAttribute In eleLinkParam.Attributes 'This is the same code found in sSetAction. sHiddenLinkParams &= "&" & XmlConvert.EncodeLocalName(atrLinkParam.Name) & "=" & util.SimpleDoubleUrlEncode(atrLinkParam.Value).Replace("'", "\'") Next Next sHiddenLinkParams = "" Return sHtmlElement & sHiddenLinkParams End Function Private Function sProcess_DropDivision(ByRef eleDropDiv As XmlElement, ByVal sHtmlElement As String) As String 'Dim sDropDivID As String = st.sGetAttribute(eleDropDiv, "ID") 'If sDropDivID.Length = 0 Then ' Throw New Exception("DropDivision elements must have an ID.") 'End If Dim eleDropAction As XmlElement = eleDropDiv.SelectSingleNode("Action") If IsNothing(eleDropAction) Then _ Throw New Exception("DropDivision elements must have one Action element.") Dim sDroppableIDs As String = eleDropDiv.GetAttribute("DroppableIDs").Replace(" ", "") If sDroppableIDs.Length = 0 Then _ sDroppableIDs = "rdAll" sHtmlElement = sHtmlElement.Insert(sHtmlElement.IndexOf(">"), " rdDroppableIDs=""" & sDroppableIDs & """") 'Create a hidden element and put the child Acion on that. We'll call it after the drop! Dim eleHiddenLabel As XmlElement = eleDropDiv.OwnerDocument.CreateElement("Label") 'eleHiddenLabel.SetAttribute("ID", "rdHiddenDropAction_" & sDropDivID) eleHiddenLabel.AppendChild(eleDropDiv.RemoveChild(eleDropAction)) 'Move the action under the Label. Dim sHiddenLabel As String = sProcessDefinitionElement(eleHiddenLabel) 'Dim sHidden As String = "" 'sHidden = ssetaaction(sHidden, Return sHtmlElement & sHiddenLabel End Function Private Function sProcess_HtmlTag(ByRef eleDef As XmlElement) As String Dim sReturn As String = Nothing If bPreEvaluatedConditionIsFalse(eleDef) Then 'Condition=False. Remove this element, don't process any children. eleDef.InnerXml = "" Return "" End If Dim sTagName As String = eleDef.GetAttribute("HtmlTagName") Dim sAttributes As String = "" For Each atr As XmlAttribute In eleDef.SelectNodes("HtmlAttributeParams/@*") Dim sAtrValue As String = sTokenToXsl(atr.Value, xslValueType.Attribute, True) sAttributes &= atr.Name & "=""" & sAtrValue & """ " Next sReturn = "<" & sTagName & " " & sAttributes & ">" sReturn = sSetID(eleDef, sReturn) sReturn = sSetClass(eleDef, sReturn) If eleDef.HasAttribute("HtmlTagText") Then sReturn &= sTokenToXsl(eleDef.GetAttribute("HtmlTagText"), xslValueType.Element, True) End If sReturn = sReturn & sProcessDefinitionElementChildren(eleDef) sReturn = sReturn & "" sReturn = sSetAction(eleDef, sReturn) sReturn = sSetConditionalElement(eleDef, sReturn) Return sReturn End Function Private Sub ReplaceDataTokensToChart(ByRef eleDef As XmlElement) 'Convert all the Data Tokens to @Chart tokens. If eleDef.OuterXml.Contains("@Data") _ AndAlso Not bUnderDataRepeater(eleDef) Then 'For legacy gauge definitions that have @Data tokens which are NOT under a data table and instead have a DataLayer under the gauge, 'convert ALL @Data tokens into @Chart tokens so they will be resolved when the gauge is executed later. If IsNothing(eleDef.SelectSingleNode("ancestor::SummaryRow")) Then '16141 - don't change @data tokens if gauge is under a summary row. For Each atrDef As XmlAttribute In eleDef.SelectNodes(".//@*") If atrDef.Value.Contains("@Data.") Then atrDef.Value = atrDef.Value.Replace("@Data.", "@Chart.") End If Next End If End If End Sub Private Function sProcess_Chart_or_Gauge(ByRef eleDef As XmlElement, ByVal sElementID As String) As String Dim sReturn As String = Nothing Dim eleParent As XmlElement = eleDef.ParentNode ''Commented by DP because the super-elements no longer convert static charts to HighCharts. '' if chart canvas is preferred, and this chart is inside valid super-element, redirect If eleParent IsNot Nothing Then 'Olap Grid and Dimension Grid still uses static Charts, we added new attribute rdTranslateToChartCanvas If st.sGetAttribute(eleDef, "rdTranslateToChartCanvas") = "True" OrElse (Not IsNothing(HttpContext.Current.Session("rdShowChartAsChartCanvas")) AndAlso HttpContext.Current.Session("rdShowChartAsChartCanvas").ToUpper() = "TRUE" AndAlso String.IsNullOrEmpty(st.sGetAttribute(eleDef, "D3Angle")) AndAlso String.IsNullOrEmpty(st.sGetAttribute(eleDef, "D3"))) Then Dim canvasChart As XmlElement = rdUtility.GetCanvasChart(eleDef) If canvasChart IsNot Nothing Then 'all charts here are under super element. Setting this ensures that they will be processed ' correctly when resizer triggers re-draw of individual chart. canvasChart.SetAttribute("rdUnderSuperElement", "True") Dim wallpaperImage As String = st.sGetAttribute(eleDef, "WallpaperImage") If Not String.IsNullOrEmpty(wallpaperImage) Then If wallpaperImage.IndexOf("/") = -1 Then '#9694 _Images folder will be depricated when using Tokenized caption names. If Not wallpaperImage.Contains("@") Then wallpaperImage = rdSupportFile.getRelativeWebPath(wallpaperImage, rdState.sGetPhysicalPath(), rdSupportFile.SupportFileType.Image) Else 'Just use _SupportFiles wallpaperImage = "_SupportFiles/" & wallpaperImage End If Else 'We must remove the users last ../ if it exists bc thier current pwd is not in _images or _supportfiles If wallpaperImage.Contains("../") Then wallpaperImage = wallpaperImage.Remove(wallpaperImage.IndexOf("../"), 3) End If End If canvasChart.SetAttribute("PlotBackgroundImage", wallpaperImage) End If eleDef.ParentNode.ReplaceChild(canvasChart, eleDef) eleDef = canvasChart Return sProcess_ChartCanvas(eleDef, sElementID) End If End If End If Dim aSupportedSvgGaugeTypes As String() = New String() {"BalloonBar", "BulletBar", "Arc", "Angular"} If eleDef.Name = "Gauge" AndAlso Array.IndexOf(aSupportedSvgGaugeTypes, eleDef.GetAttribute("Type")) <> -1 _ AndAlso st.sGetAttribute(eleDef, "GaugeRenderMode") <> "Image" Then If (st.sGetAttribute(eleDef, "RemoveWidthAttribute") = "True") Then eleDef.RemoveAttribute("ChartWidth") End If Dim translator As GaugeToChartCanvasTranslator = New GaugeToChartCanvasTranslator() Dim eleChartCanvas As XmlElement = translator.Translate(eleDef) Dim bIsActiveSqlDLayer As Boolean = False Dim nlDlGauages As XmlNodeList = eleChartCanvas.SelectNodes(".//DataLayer") For Each eleDlGauge As XmlElement In nlDlGauages If eleDlGauge.GetAttribute("Type") = "ActiveSQL" Then bIsActiveSqlDLayer = True Exit For End If Next If Not bIsActiveSqlDLayer Then 'INFOGO-425 (keep data tokens in gauges for activesql dlayers) ReplaceDataTokensToChart(eleChartCanvas) End If Return "" ElseIf st.sGetAttribute(eleDef, "Type") = "Arc" Then Throw New Exception("Arc gauges can use only ChartCanvas as GaugeRenderMode") End If ' 'Save the definition for the chart into the URL. 'If eleDef.Name = "Gauge" Then 16583 ' lgxLicense10.LicenseCheck(eleDef) ' 'If http.Session("rdProduct").IndexOf("Ent") = -1 Then ' ' Throw New Exception("The element """ & eleDef.Name & """ requires a Logi Info Server license.") ' 'End If 'End If If eleDef.OwnerDocument.DocumentElement.Name = "MobileReport" Then '18483 - Remove HoverHightlight Elements from MobileReports Dim eleMobileHoverHighlight As XmlElement = eleDef.SelectSingleNode("HoverHighlight") If Not IsNothing(eleMobileHoverHighlight) Then eleDef.RemoveChild(eleMobileHoverHighlight) End If End If Dim isZoomChart As Boolean = eleDef.SelectNodes("ZoomChart").Count > 0 If (isZoomChart) Then Return sProcess_ZoomChart(eleDef) End If 'In case there is a DataLayer.Linked in the chart definition... eleDef.SetAttribute("Report", HttpContext.Current.Items("rdRequestedPage")) 'Are there any script files in the definition? Add them under the chart to be accessed in the new request.17028 Call subAddFormulaScriptFilesUnderChart(eleDef) '14873 Dim eleGroupDrillthrough As XmlElement = eleDef.SelectSingleNode("GroupDrillthrough") If Not IsNothing(eleGroupDrillthrough) Then subProcess_GroupDrillthrough(eleGroupDrillthrough) End If '17881 Dim bIsLegendFilter As Boolean = False If Not IsNothing(eleDef.SelectSingleNode("Legend")) AndAlso st.sGetAttribute(eleDef.SelectSingleNode("Legend"), "LegendFilter") = "True" Then bIsLegendFilter = True '23824 'subAddIncludedScript("rdAjax/rdAjax2.js") If st.sGetAttribute(eleDef, "ID").Length = 0 Then Throw New Exception("Charts with enabled Legend Filter must have an ID.") End If End If Dim sDrillDownID As String = "" Dim sDrillDown As String = Nothing Dim sDrilldownUseMap As String = "" Dim eleAction As XmlElement = eleDef.SelectSingleNode("Action") '14674 was ("Action") ' Is this under a Inputchart element, if yes include the id. Dim sInputChartID As String = "" : Dim bIsUnderInputChart As Boolean = False If Not IsNothing(eleParent) Then If eleParent.Name = "InputChart" Then If eleParent.GetAttribute("ID") = "" Then Throw New Exception("The InputChart element requires an ID.") End If sInputChartID = " data-inputParams=""" & st.sGetAttribute(eleParent, "ID") & """" 'Prevent 3D style, which doesn't highlight well. 18515 If eleDef.GetAttribute("Type") = "Pie" Then _ eleDef.RemoveAttribute("D3") 'Set drilldown. bIsUnderInputChart = True 'Make sure Chart has ID, otherwise things like Resize break during Refresh element If String.IsNullOrEmpty(eleDef.GetAttribute("ID")) Then sElementID = ChartBuilder.generateAndSetChartID(eleDef) End If ' For InputChart.List add parameters to the chart definition which will be added to the imagemap eventually ' This is for the client side code to pick up at run time. If eleParent.GetAttribute("Type") = "List" Then Dim aParentattrs As String() = {"SelectedColor", "SelectedTransparency", "UnselectedColor", "UnselectedTransparency"} For iattr As Integer = 0 To aParentattrs.Length - 1 If String.IsNullOrEmpty(st.sGetAttribute(eleParent, aParentattrs(iattr))) Then eleDef.SetAttribute("InputChartList-" & aParentattrs(iattr), "") ElseIf aParentattrs(iattr) = "SelectedTransparency" Or aParentattrs(iattr) = "UnselectedTransparency" Then eleDef.SetAttribute("InputChartList-" & aParentattrs(iattr), Math.Abs(CInt(st.sGetAttribute(eleParent, aParentattrs(iattr), "10")) - 15) / 15) Else eleDef.SetAttribute("InputChartList-" & aParentattrs(iattr), st.sGetAttribute(eleParent, aParentattrs(iattr))) End If Next eleDef.SetAttribute("InputChartListID", st.sGetAttribute(eleParent, "ID")) eleDef.SetAttribute("IsInputChartList", "True") End If ' Add class trigger for InputChart sInputChartID &= " class=""LogiInputChart""" End If End If '14674 'Chart.Heatmap -> action,tooltip,alttext may be everywhere (chart definition or group columns) 'Heatmap specific Dim bSomethingInHeatmap As Boolean = False If eleDef.Name = "Chart" AndAlso st.sGetAttribute(eleDef, "Type") = "Heatmap" Then eleAction = eleDef.SelectSingleNode(".//Action") For Each grColumn As XmlElement In eleDef.SelectNodes("HeatmapGroupColumn") If st.sGetAttribute(grColumn, "Tooltip").IndexOf("@Chart.") <> 1 OrElse _ st.sGetAttribute(grColumn, "AltText").IndexOf("@Chart.") <> 1 Then bSomethingInHeatmap = True Exit For End If Next If Not IsNothing(eleDef.SelectSingleNode("//Quicktip")) Then bSomethingInHeatmap = True End If End If ' gauges tooltip? 17292 Dim bSomethingInGauge As Boolean = False If eleDef.Name = "Gauge" AndAlso eleDef.GetAttribute("Tooltip").Length > 0 Then bSomethingInGauge = True End If If Not IsNothing(eleAction) _ OrElse eleDef.GetAttribute("Tooltip").IndexOf("@Chart.") <> -1 _ OrElse eleDef.GetAttribute("AltText").IndexOf("@Chart.") <> -1 _ OrElse Not IsNothing(eleDef.SelectSingleNode("Quicktip | ExtraXYLayer/Quicktip | ExtraXYDataColumn/Quicktip | HoverHighlight")) _ OrElse bIsUnderInputChart = True _ OrElse bSomethingInGauge = True _ OrElse bSomethingInHeatmap = True _ OrElse bIsLegendFilter = True Then sDrillDownID = "rdDrillDown_" & Guid.NewGuid.ToString If bUnderDataRepeater(eleDef) Then _ sDrillDownID &= "-rdDrilldownSequenceNr" 'See ProcessDrilldownSequenceNrs() for details. sDrillDown = "rdDrillDownID=" & sDrillDownID & "&" sDrillDown &= "rdRequestedPage=" & msRequestedPage & "&" sDrilldownUseMap = " USEMAP=""#" & sDrillDownID & """ " '11448.Fix for usemap for widgets. 'sDrilldownUseMap = " USEMAP=""#"" " 'Call subAddIncludedScript("rdActionSubmit2.js") 'Call subAddIncludedScript("rdActionProcess.js") 'Call subAddIncludedScript("rdScroll.js") If Not IsNothing(eleAction) Then _ If eleAction.GetAttribute("Type") = "RefreshElement" Then _ mbAddAjaxSupport = True End If Dim quicktipElement As XmlElement = eleDef.SelectSingleNode("Quicktip | HeatmapGroupColumn/Quicktip | ExtraXYLayer/Quicktip | ExtraXYDataColumn/Quicktip") '16533 If (quicktipElement IsNot Nothing) Then ' I tried dynamically loading CSS via YUI Loader but it would add CSS link to bottom of ' This in turn caused the default CSS to override our Theme CSS, so revert to old server driven loading. subAddIncludedCss("rdYui/rdQuicktip.css") ' Pull any customized options from element and generate JS call subAddYUIInitializer("'quicktip'", rdQuicktip.generateQuicktipJsInitialization(quicktipElement)) '16439 - remove old tooltip, when Quicktip is presented eleDef.SetAttribute("Tooltip", "") End If If Not IsNothing(eleAction) Then _ Call subAddAdditionalScriptFiles(eleAction) ' forecast charts set the linestyledatacolumn. ' If either the linestyle or the linecolor datacolumns are set, the imagemap returned is funky, and breaks the hoverhighlight code, ' so for now we remove the hoverhighlight element if either of these columns is being set by user. - 18071,18083 If Not IsNothing(eleDef.SelectSingleNode("HoverHighlight")) AndAlso eleDef.GetAttribute("XYChartType") = "Line" Then If st.sGetAttribute(eleDef, "LineStyleDataColumn").Length <> 0 Or st.sGetAttribute(eleDef, "LineColorDataColumn").Length <> 0 Then eleDef.RemoveChild(eleDef.SelectSingleNode("HoverHighlight")) eleDef.SetAttribute("HoverHighlightElementRemoved", "True") End If End If Dim enableHoverHighlight As Boolean = False If Not IsNothing(eleDef.SelectSingleNode("HoverHighlight")) Then enableHoverHighlight = True 'Prevent 3D style, which doesn't highlight well. 18515 If eleDef.GetAttribute("Type") = "Pie" Then _ eleDef.RemoveAttribute("D3") If eleDef.GetAttribute("Type") = "XY" Then ' No spline charts If eleDef.GetAttribute("XYChartType") = "Spline" Then enableHoverHighlight = False 'Throw New Exception("Hover Highlight doesn't support Spline charts.") eleDef.RemoveChild(eleDef.SelectSingleNode("HoverHighlight")) If IsNothing(eleDef.SelectSingleNode("ancestor::DimensionGrid | ancestor::OlapGrid")) Then ' For normal charts, throw warning in the chart debug page.18133 eleDef.SetAttribute("HoverHighlightEleRemovedForSpline", "True") Else ' For DG/OG throw the warning here. dbug.AddDebugMessage("** WARNING **", "The HoverHighlight element was removed because it doesn't support Spline charts.") End If End If ' No horizontal orientation for Line or Area charts If (eleDef.GetAttribute("XYChartType") = "Line" Or eleDef.GetAttribute("XYChartType") = "Area") AndAlso _ eleDef.GetAttribute("ChartOrientation") = "Horizontal" Then Throw New Exception("Hover Highlight doesn't support Horizontal Orientation with Line and Area charts") End If End If 'If (isPieChartEligibleForHighlightorSelection(eleDef)) Then ' Throw New Exception("Hover Highlight doesn't support 3D Doughnuts with 3D Angles set to anything but 0.") 'End If If enableHoverHighlight Then eleDef.SetAttribute("Class", eleDef.GetAttribute("Class") & " chartfx-highlight") End If End If 'Every @Data token in the chart definition needs to be replaced by an @Request, 'and they need to be passed into the chart as request vars. 'But don't replace @Data for attributes under a chart's CalculatatedColumn and ConditionFilter element(s), if any. Dim nlCalcColAttrs As XmlNodeList = eleDef.SelectNodes("*//CalculatedColumn/@* | *//ExtraCrosstabCalculatedColumn/@* | *//ConditionFilter/@* | *//SqlCalculatedColumn/@* | *//SqlConditionFilter/@*") '18819. Dim atrCalcCol As XmlAttribute For Each atrCalcCol In nlCalcColAttrs atrCalcCol.Value = atrCalcCol.Value.Replace("@Data.", "@CalcCol.") Next Call subReplaceLocalDataTokens(eleDef) 'This is for legacy pre-10.2.2xx If eleDef.Name = "Gauge" Then ReplaceDataTokensToChart(eleDef) End If ' sTooltip was commented out for gauge token changes. Have uncommented it out and ... ' moved it above sChartDef to support formulas in gauge tooltips too. ' For guages if there is a forumla that needs to get calculated post xsl, we set it here and not in the image map. ' this will resolve tickets 17380 (charts) and 17371 (gauges) Dim sTooltip As String = sGetImageTextAttributes(eleDef) If eleDef.Name = "Gauge" AndAlso sTooltip.IndexOf("rdFormulaTitle") <> -1 Then eleDef.SetAttribute("Tooltip", "") End If Dim sChartData As String = "" Dim sChartDef As String = eleDef.OuterXml Dim tzr As New Tokenizer(sChartDef) Dim tkn As Tokenizer.Token Dim htTokenNames As New Hashtable() For Each tkn In tzr.Tokens Select Case tkn.Type Case "Data" If Not htTokenNames.Contains(tkn.Name) Then 'Fixes #2416: Data tokens are repeating when used in Charts under Data elements htTokenNames.Add(tkn.Name, Nothing) sChartData &= "&ChartData" & tkn.Name & "=" & sTokenToXsl(tkn.Text.Replace("@Data.", "@DataHrefLink."), xslValueType.Attribute) '16125 End If End Select Next 'Issue 16675 - Lookup element uses @Data tokens and these must remain unchanged. If sChartDef.Contains(" "True") _ Then ' 12601,13085. Commented for #15587 And IsNothing(eleDef.SelectSingleNode("Resizer"))) _ 'Set a fixed height and width. sSize = " Height=""" & sTokenToXsl(eleDef.GetAttribute("ChartHeight"), xslValueType.Attribute, True) & """ Width=""" & sTokenToXsl(eleDef.GetAttribute("ChartWidth"), xslValueType.Attribute, True) & """ " End If End If 'sReturn = "" Dim sOnLoad As String = " onload=""javascript:if(typeof(rdChartLoad)!= 'undefined') rdChartLoad(this)"" onerror=""javascript:if(typeof(rdChartError) != 'undefined') rdChartError(this)"" " If eleDef.GetAttribute("Type") = "ColorSpectrum" Then sOnLoad = "" '#12030. If Not IsNothing(eleDef.SelectSingleNode("Resizer")) AndAlso _ http.Request("rdEmbeddedSubReport") <> "True" Then 'sOnLoad = sOnLoad.Replace("(this)", "(this);rdInitResizer(this)") sChartUrl &= "&rdResizer=True" End If If Not IsNothing(HttpContext.Current.Items("rdIsWidgetRequest")) Then _ sOnLoad = "" ' Input chart? set a request variable... If bIsUnderInputChart Then sChartUrl &= "&rdInputChart=True" End If ' Add the debug File link to the Chart Url, and pass it as a request variable...'14865 Dim sChartDebugFilename As String = "" Dim sChartDebuggerUrl As String = "" If dbug.DebuggingEnabled Then If eleDef.GetAttribute("Type") <> "ColorSpectrum" Then Dim sDebugGuid As String = Guid.NewGuid.ToString.Replace("-", "") Call rdState.MakeTempDownloadFilename("htm", sChartDebuggerUrl, sChartDebugFilename, sDebugGuid) sChartDebuggerUrl = sChartDebuggerUrl.Replace(".htm", "-rdDebug.htm") 'sChartUrl &= "&rdDebugGuid=" & sDebugGuid & "_Row@Function.RowNumber~" sChartUrl &= "&rdDebugGuid=" & sDebugGuid If bUnderDataRepeater(eleDef) Then '16114 position()... adds the row number so that charts inside tables work by making every row's GUID unique. sChartUrl &= "{position() + $nPageRowCnt * ($nPageNr - 1)}" sChartDebuggerUrl = sChartDebuggerUrl.Replace("-rdDebug.htm", "@Function.RowNumber~-rdDebug.htm") If Not IsNothing(eleDef.SelectSingleNode("ancestor::CrosstabTable")) Then '16114 Under a Crosstab. Add "rdCrosstabColumn so each column's GUID will be unique too. '"rdCrosstabColumn" will get cause the crosstab code to put the column number in. sChartUrl &= "-rdCrosstabColumn" sChartDebuggerUrl = sChartDebuggerUrl.Replace("-rdDebug.htm", "-rdCrosstabColumn-rdDebug.htm") End If End If End If End If Dim sChartStyle As String = "style=""border: 0px;" If eleDef.GetAttribute("ShowWaitIcon") <> "False" Then '17361 - For Charts, new ShowWaitIcon Attribute sChartStyle &= "background-image:url(rdTemplate/rdWait.gif);background-repeat:no-repeat;background-position: center;""" Else sChartStyle &= """" End If Dim sRdIdeRdx As String = eleDef.GetAttribute("rdIdeIdx") ' Dim sChartStyle As String = "style=""border: 0px;background-image:url(rdTemplate/rdWait.gif);background-repeat:no-repeat;background-position: center center;""" '13966,13948 'sReturn = "" 'sReturn = "" 'sReturn = "" '13966,13948 sReturn = "" '13966,13948 'sReturn = "" '13966,13948 ' For chart/gauge images under GoogleMap markers...to resolve data tokens # 10361 If CType(eleDef.ParentNode, XmlElement).GetAttribute("ID").StartsWith("rdMarker-") Then sReturn = sTokenToXsl(sReturn, xslValueType.Attribute) End If sReturn = sSetID(eleDef, sReturn) ' sReturn = sSetEventHandler(eleDef, sReturn) This sort of works, but it's not sensitive to individual chart elements. sReturn = sSetClass(eleDef, sReturn) sReturn = sSetPositioning(eleDef, sReturn) 'If eleDef.Name = "Gauge" Then '17317 - actions for gauges moved to rdChart.vb ' sReturn = sSetAction(eleDef, sReturn) 'End If sReturn = sSetResizer(eleDef, sElementID, Val(st.sGetAttribute(eleDef, "ChartWidth")), Val(st.sGetAttribute(eleDef, "ChartHeight")), sReturn) sReturn = "" & sReturn & "" 'This span is used for chart debugging in rdChartLoad(). '23824 'subAddIncludedScript("rdChart.js") 'Add a debug link for this chart? addDebuggerLinkToChart(eleDef, sChartDebuggerUrl) 'Rip out the the child DataLayer for this element so that it's not processed by GetXML for this page. (Gets processed by rdChart.vb) eleDef.RemoveAll() 'But we need to keep the ID in case there's a RefreshElement for this. This prevents throwing an error. #3273 eleDef.SetAttribute("ID", sElementID) Return sReturn End Function Private Sub addDebuggerLinkToChart(ByRef eleDef As XmlElement, ByVal sChartDebuggerUrl As String) If dbug.DebuggingEnabled Then If Array.IndexOf("Excel,NativeExcel,Word,NativeWord,PDF".Split(","), st.sGetRequestVar("rdReportFormat")) = -1 Then '13729, 18670 If eleDef.GetAttribute("Type") <> "ColorSpectrum" Then Dim eleDebug As XmlElement Dim eleAction As XmlElement Dim eleTarget As XmlElement eleDebug = xmlDef.CreateElement("Image") eleDebug.SetAttribute("ID", "rdDebugChart") eleDebug.SetAttribute("Caption", "rdTemplate/rdDebug.png") eleDebug.SetAttribute("Tooltip", "Show the Chart's Debugger Trace Report") eleDebug.SetAttribute("AltText", "Chart Debug") eleDebug.SetAttribute("Style", "border-style:none;") eleAction = eleDebug.AppendChild(xmlDef.CreateElement("Action")) eleAction.SetAttribute("Type", "Link") eleTarget = eleAction.AppendChild(xmlDef.CreateElement("Target")) eleTarget.SetAttribute("Type", "Link") eleTarget.SetAttribute("Link", sChartDebuggerUrl) Dim eleHoverHandler As XmlElement = eleDebug.AppendChild(xmlDef.CreateElement("EventHandler")) eleHoverHandler.SetAttribute("DhtmlEvent", "onmouseover") Dim sHoverUrl As String = "rdTemplate/rdDebugHover.png" If Not IsNothing(HttpContext.Current.Items("rdIsWidgetRequest")) Then _ sHoverUrl = HttpContext.Current.Request("rdServerUrl") & "/" & sHoverUrl eleAction = eleHoverHandler.AppendChild(xmlDef.CreateElement("Action")) eleAction.SetAttribute("Type", "Javascript") eleAction.SetAttribute("Javascript", "this.setAttribute('src','" & sHoverUrl & "')") sHoverUrl = "rdTemplate/rdDebug.png" If Not IsNothing(HttpContext.Current.Items("rdIsWidgetRequest")) Then _ sHoverUrl = HttpContext.Current.Request("rdServerUrl") & "/" & sHoverUrl eleHoverHandler = eleDebug.AppendChild(xmlDef.CreateElement("EventHandler")) eleHoverHandler.SetAttribute("DhtmlEvent", "onmouseout") eleAction = eleHoverHandler.AppendChild(xmlDef.CreateElement("Action")) eleAction.SetAttribute("Type", "Javascript") eleAction.SetAttribute("Javascript", "this.setAttribute('src','" & sHoverUrl & "')") 'If (TypeOf (eleDef.ParentNode) Is XmlDocument) Then Dim eleParentNode As XmlElement = eleDef.ParentNode If eleParentNode.Name = "InputChart" Then eleParentNode.ParentNode.InsertAfter(eleDebug, eleParentNode) eleParentNode.ParentNode.InsertBefore(xmlDef.CreateElement("LineBreak"), eleDebug) eleParentNode.ParentNode.InsertAfter(xmlDef.CreateElement("LineBreak"), eleDebug) Else eleDef.ParentNode.InsertAfter(eleDebug, eleDef) eleDef.ParentNode.InsertBefore(xmlDef.CreateElement("LineBreak"), eleDebug) eleDef.ParentNode.InsertAfter(xmlDef.CreateElement("LineBreak"), eleDebug) End If 'End If End If End If End If End Sub Private Function sProcess_Sparkline(ByRef eleDef As XmlElement, ByVal sElementID As String) As String dbug.AddDebugMessage("Sparkline", "Generate Definition") Dim sparkline As New rdSparkline Dim eleSparklineDef As XmlElement = sparkline.GenerateSparklineDefinition(eleDef) dbug.AddDebugMessage(, "Generated Sparkline", "View Definition", eleSparklineDef) eleDef.ParentNode.InsertAfter(eleSparklineDef, eleDef) Return "" End Function Private Function sProcess_InputChart(ByRef eleDef As XmlElement) As String Dim sReturn As String = Nothing Dim sInputChartType As String = eleDef.GetAttribute("Type") Dim sInputSelectName As String = "" ' build the string containing min and max values. Dim sValues As String = "" Dim eleHiddenInput As XmlElement '** Check basic requirements. Dim eleChart As XmlElement = eleDef.SelectSingleNode("Chart") If IsNothing(eleChart) Then Throw New Exception("No chart definition found under the InputChart element.") End If '** 'Line and Scatter Charts. Must have Linear Scales. Logarithmic Scale not supported for now. If sInputChartType = "DataRange" Then If eleChart.GetAttribute("Type") = "XY" Then If eleChart.GetAttribute("XYChartType") <> "Line" And eleChart.GetAttribute("XYChartType") <> "Spline" Then Throw New Exception("InputChart.DataRange supports only Line, Spline or Scatter charts.") End If Dim eleLabelScale As XmlElement = eleChart.SelectSingleNode("LabelScale") If IsNothing(eleLabelScale) Then Throw New Exception("InputChart.DataRange must have a chart with a LabelScale element with ScalingMode set to a linear scale.") Else If eleLabelScale.GetAttribute("ScalingMode") <> "LinearNumeric" And eleLabelScale.GetAttribute("ScalingMode") <> "LinearTime" Then Throw New Exception("InputChart.DataRange must have a chart with a LabelScale element with ScalingMode set to a linear scale.") End If End If 'Orientation. If eleChart.GetAttribute("ChartOrientation") = "Horizontal" Then Throw New Exception("The ChartOrientation must be ""Vertical"" for InputChart elements.") End If 'Secondary Data Axis. Dim eleSecondaryAxis As XmlElement = eleChart.SelectSingleNode("SecondaryAxis") If Not IsNothing(eleSecondaryAxis) Then Throw New Exception("The datarange filter will not work with charts having a secondary data axis.") End If End If ' Add hidden elements for x and y values. Dim aAxisIDs() As String = New String() {"MinXaxisID", "MaxXaxisID", "MinYaxisID", "MaxYaxisID"} Dim sAxisValue As String = "" If eleDef.GetAttribute(aAxisIDs(0)).Length = 0 AndAlso eleDef.GetAttribute(aAxisIDs(1)).Length = 0 AndAlso _ eleDef.GetAttribute(aAxisIDs(2)).Length = 0 AndAlso eleDef.GetAttribute(aAxisIDs(3)).Length = 0 Then Throw New Exception("InputChart requires Min and Max XAxisIDs and/or Min and Max YAxisIDs") End If If eleDef.GetAttribute(aAxisIDs(0)).Length = 0 And eleDef.GetAttribute(aAxisIDs(1)).Length <> 0 _ OrElse eleDef.GetAttribute(aAxisIDs(0)).Length <> 0 And eleDef.GetAttribute(aAxisIDs(1)).Length = 0 Then Throw New Exception("InputChart requires both Min and Max XAxisIDs") End If If eleDef.GetAttribute(aAxisIDs(2)).Length = 0 And eleDef.GetAttribute(aAxisIDs(3)).Length <> 0 _ OrElse eleDef.GetAttribute(aAxisIDs(2)).Length <> 0 And eleDef.GetAttribute(aAxisIDs(3)).Length = 0 Then Throw New Exception("InputChart requires both Min and Max YAxisIDs") End If For iAxisId As Integer = 0 To aAxisIDs.Length - 1 ' Add Input IDs to the main div tag sAxisValue = st.sGetAttribute(eleDef, aAxisIDs(iAxisId)) If sAxisValue.Length <> 0 Then sValues &= " data-" & aAxisIDs(iAxisId) & "=""" & sAxisValue & """" ' Add Hidden Input Elements for each of the axis IDs specified which allows the user to get or ' set the data @Request. eleHiddenInput = eleDef.AppendChild(eleDef.OwnerDocument.CreateElement("InputHidden")) eleHiddenInput.SetAttribute("ID", sAxisValue) eleHiddenInput.SetAttribute("DefaultValue", "@Request." & sAxisValue & "~") End If Next sInputSelectName = "rdISL-" & st.sGetAttribute(eleDef, "ID") Else '***** InputChart.List for bar and pie charts now. Dim bIsBarOrPie As Boolean = True If eleChart.GetAttribute("Type") <> "XY" And eleChart.GetAttribute("Type") <> "Pie" Then bIsBarOrPie = False End If If eleChart.GetAttribute("Type") = "XY" AndAlso eleChart.GetAttribute("XYChartType") <> "Bar" Then bIsBarOrPie = False End If If Not bIsBarOrPie Then Throw New Exception("InputChart.List supports only bar charts and pie charts.") End If ' Hidden inputs don't fire onchange events. Makese sense if you think about it as hidden inputs ' can only be changed programmatically. I need onChange to be available for InputChangeFlagEvent, ' so create normal input with display set to none. eleHiddenInput = eleDef.AppendChild(eleDef.OwnerDocument.CreateElement("InputText")) eleHiddenInput.SetAttribute("Style", "display: none;") eleHiddenInput.SetAttribute("ID", eleDef.GetAttribute("ID")) eleHiddenInput.SetAttribute("DefaultValue", st.sGetAttribute(eleDef, "DefaultValue")) Dim eleValidation As XmlElement = eleDef.SelectSingleNode("Validation") If Not IsNothing(eleValidation) Then _ eleHiddenInput.AppendChild(eleValidation.ParentNode.RemoveChild(eleValidation)) 'Add class to trigger javascript eleChart.SetAttribute("Class", eleChart.GetAttribute("Class") & " chartfx-selection") ' Add the Input Chart Value Column to the chart definiton for processing later on. Dim sInputChartValueColumn As String = st.sGetAttribute(eleDef, "InputChartValueColumn", eleChart.GetAttribute("ChartLabelColumn")) eleChart.SetAttribute("InputChartValueColumn", sInputChartValueColumn) 'If (isPieChartEligibleForHighlightorSelection(eleChart)) Then ' Throw New Exception("InputChart.List doesn't support 3D Doughnuts with 3D Angles set to anything but 0.") 'End If ' Input Chart List creates a hidden input dynamically, this input gets passed around to the normal input functions instead of the original element. eleHiddenInput.SetAttribute("ChangeFlagElementID", eleDef.GetAttribute("ChangeFlagElementID")) subSetupInputChangeFlagEvent(eleHiddenInput) subAddInputElementCookieCreation(eleHiddenInput) subProcessInputValidationElements(eleHiddenInput) sReturn = sProcessDefinitionElementChildren(eleDef) End If ' ONlY for InputChart.DataRange... If sInputChartType = "DataRange" Then ' Remove the chart element for now, so as not to include it in the main
    14 Then dRegionOpacity = 0.0 Else dRegionOpacity = 1 - (CDbl(st.sGetAttribute(eleDef, "RegionTransparency")) / 15) dRegionOpacity = Math.Round(dRegionOpacity, 2) End If End If Dim sChartType As String = st.sGetAttribute(eleChart, "XYChartType") '17267 If sChartType = "" AndAlso st.sGetAttribute(eleChart, "Type") = "Scatter" Then sChartType = st.sGetAttribute(eleChart, "Type") End If 'Dim sInputSelectName As String = "rdISL-" & st.sGetAttribute(eleDef, "ID") Dim sSubmitAction As String = "" : Dim sClearAction As String = "" Dim eleSubmitAction As XmlElement = eleDef.SelectSingleNode("AreaDrawn") Dim eleClearAction As XmlElement = eleDef.SelectSingleNode("AreaCleared") If Not IsNothing(eleSubmitAction) Then sSubmitAction = sSetAction(eleSubmitAction, sSubmitAction) Dim nPosHrefTag As Integer = sSubmitAction.IndexOf("href") If nPosHrefTag <> -1 Then ' get the href part sSubmitAction = sSubmitAction.Substring(nPosHrefTag + 6, sSubmitAction.IndexOf("""", nPosHrefTag + 6) - (nPosHrefTag + 6)) End If End If If Not IsNothing(eleClearAction) Then sClearAction = sSetAction(eleClearAction, sClearAction) Dim nPosHrefTag As Integer = sClearAction.IndexOf("href") If nPosHrefTag <> -1 Then ' get the href part sClearAction = sClearAction.Substring(nPosHrefTag + 6, sClearAction.IndexOf("""", nPosHrefTag + 6) - (nPosHrefTag + 6)) End If End If sValues &= " data-chartType=""" & sChartType & """" sValues &= " data-chart3d=""" & schart3d & """" sValues &= " data-chartOrientation=""" & sChartOrientation & """" sValues &= " data-overlayBgcolor=""" & sRegionColor & """" sValues &= " data-overlayBorderColor=""" & sRegionBorderColor & """" sValues &= " data-overlayOpacity=""" & dRegionOpacity & """" sValues &= " data-inputSelectname=""" & sInputSelectName & """" If Not IsNothing(eleSubmitAction) Then sValues &= " data-submitAction=""" & sSubmitAction & """" End If If Not IsNothing(eleClearAction) Then sValues &= " data-clearAction=""" & sClearAction & """" End If Dim disableSelectionClear As String = st.sGetAttribute(eleDef, "DisableSelectionClear", "") If disableSelectionClear.ToLower() = "true" Then sValues += " data-disableSelectionClear=""True""" End If Dim fullSelectionOnRender As String = st.sGetAttribute(eleDef, "FullSelectionOnRender", "") If fullSelectionOnRender.ToLower() = "true" Then sValues += " data-fullSelectionOnRender=""True""" End If eleDef.RemoveChild(eleDef.SelectSingleNode("Chart")) End If ' Set to display:none. eleDef.SetAttribute("ShowModes", "None") sReturn = "
    " sReturn = sSetID(eleDef, sReturn) sReturn = sSetVisibility(eleDef, sReturn) sReturn = sReturn & sProcessDefinitionElementChildren(eleDef) Dim nPosCloseTag As Integer = sReturn.IndexOf(">") If nPosCloseTag <> -1 Then ' Insert the min and max attributes... sReturn = sReturn.Substring(0, nPosCloseTag) & sValues & sReturn.Substring(nPosCloseTag) End If sReturn &= "
    " ' Add the chart definition back. and append the chart output html. eleDef.AppendChild(eleChart) sReturn &= sProcess_Chart_or_Gauge(eleChart, eleChart.GetAttribute("ID")) End If Return sReturn End Function Private Sub subConvert_OldHeatmapApplet(eleOldHeatmap As XmlElement) Dim eleNewHeatmap As XmlElement = rdOldHeatmapConverter.ConvertOldHeatmap(eleOldHeatmap) dbug.AddDebugMessage(, "Converted to ", "Heatmap Definition", eleNewHeatmap) eleOldHeatmap.ParentNode.InsertAfter(eleNewHeatmap, eleOldHeatmap) End Sub 'Private Function isPieChartEligibleForHighlightorSelection( ByRef elementDefinition as XmlElement ) as Boolean ' ' Doughnuts can be 3D, but no 3D angle ' ' This check happens before rdChart automatically sets empty D3Angle values to 0 or 45, depending on whether 3D is 0 or > 0 ' Dim chartIneligible as Boolean = false ' If ( elementDefinition.GetAttribute("Type") = "Pie" AndAlso elementDefinition.GetAttribute("PieChartType") = "Doughnut" ) AndAlso elementDefinition.GetAttribute("D3").Trim() <> "" Then ' Dim threeD as Integer ' Dim threeDAngle as Integer ' Dim threeDAngleBlank as Boolean = true ' if IsNumeric(elementDefinition.GetAttribute("D3Angle")) ' threeDAngle = Integer.Parse( elementDefinition.GetAttribute("D3Angle") ) ' threeDAngleBlank = False ' elseif elementDefinition.GetAttribute("D3Angle").Trim() = "" ' threeDAngleBlank = True ' end if ' if IsNumeric(elementDefinition.GetAttribute("D3")) ' threeD = Integer.Parse( elementDefinition.GetAttribute("D3") ) ' end If ' ' 3D is 0 ' if threeD = 0 ' ' 3D Angle is not blank and greater than 0, which is not allowed ' if not threeDAngleBlank AndAlso threeDAngle > 0 then ' chartIneligible = True ' end If ' ' 3D is set ' elseif threeD > 0 ' ' 3D angle is blank or greater than 0m which is not allowed ' if threeDAngleBlank or threeDAngle > 0 then ' chartIneligible = True ' end If ' end if ' End if ' return chartIneligible 'End Function Friend Function sSetResizer(ByRef eleDef As XmlElement, ByVal sParentID As String, ByVal sParentWidth As Integer, ByVal sParentHeight As Integer, ByVal sHtml As String) As String Dim eleResizer As XmlElement = eleDef.SelectSingleNode("Resizer") If IsNothing(eleResizer) Then _ Return sHtml 'lgxLicense10.LicenseCheck(eleResizer) 'Issue 11195 'Removed: 19672. 'If http.Session("rdProduct").IndexOf("Ent") = -1 Then _ ' Throw New Exception("The element """ & eleResizer.Name & """ requires a Logi Info Server license.") If sParentID.Length = 0 Then Throw New Exception("Elements with Resizer elements must have an ID.") Return sHtml End If If http.Request("rdEmbeddedSubReport") = "True" Then dbug.AddDebugMessage(, "** WARNING **", "Resizer elements do not work in embedded reports.") eleDef.RemoveChild(eleResizer) Return sHtml End If Dim sResizerId As String = "rdResizer_" & sParentID eleResizer.SetAttribute("ID", sResizerId) ' setting default minimum values for the resizer height and width - #9022 If eleResizer.GetAttribute("MinWidth").Length = 0 Then _ eleResizer.SetAttribute("MinWidth", "100") If eleResizer.GetAttribute("MinHeight").Length = 0 Then _ eleResizer.SetAttribute("MinHeight", "100") Dim sAttrSpan As String = " 0 Then _ sAttrSpan &= "rdMinWidth=""" & eleResizer.GetAttribute("MinWidth") & """ " If eleResizer.GetAttribute("MinHeight").Length <> 0 Then _ sAttrSpan &= "rdMinHeight=""" & eleResizer.GetAttribute("MinHeight") & """ " If eleResizer.GetAttribute("MinWidth").Length <> 0 Then _ sAttrSpan &= "rdMaxWidth=""" & eleResizer.GetAttribute("MaxWidth") & """ " If eleResizer.GetAttribute("MinHeight").Length <> 0 Then _ sAttrSpan &= "rdMaxHeight=""" & eleResizer.GetAttribute("MaxHeight") & """ " 'resize width or height only Dim heightOnly As Boolean = st.sGetAttribute(eleResizer, "HeightOnly") = "True" Dim widthOnly As Boolean = st.sGetAttribute(eleResizer, "WidthOnly") = "True" If heightOnly Then sAttrSpan &= "rdHeightOnly=""True"" " End If If widthOnly Then sAttrSpan &= "rdWidthOnly=""True"" " End If sAttrSpan &= ">" 'Don't do "/>". This type of end tag doesn't work for HTML! 10974 Dim sReturn As String = "" sReturn = sSetID(eleResizer, sReturn) sReturn = sSetPositioning(eleDef, sReturn) sReturn = sSetVisibility(eleDef, sReturn) sReturn = sReturn & sHtml sReturn = sSetConditionalElement(eleDef, sReturn) sReturn &= sAttrSpan '23824 'subAddIncludedScript("rdResizer.js") 'subAddIncludedScript("rdAjax/rdAjax2.js") If eleDef.Name = "AnimatedChart" Then 'Call subAddIncludedScript("rdAnimatedChart/rdAnimatedChartResizer.js") Dim eleHiddenAnimatedChartReportID As XmlElement = eleDef.AppendChild(eleDef.OwnerDocument.CreateElement("InputHidden")) eleHiddenAnimatedChartReportID.SetAttribute("ID", st.sGetAttribute(eleDef, "ID") & "-Hidden") eleHiddenAnimatedChartReportID.SetAttribute("DefaultValue", msRequestedPage) sReturn &= sProcessDefinitionElement(eleHiddenAnimatedChartReportID) ElseIf eleDef.Name = "AnimatedMap" Then 'Call subAddIncludedScript("rdFusionMap/rdAnimatedMapResizer.js") Dim eleHiddenAnimatedMapReportID As XmlElement = eleDef.AppendChild(eleDef.OwnerDocument.CreateElement("InputHidden")) eleHiddenAnimatedMapReportID.SetAttribute("ID", st.sGetAttribute(eleDef, "ID") & "-Hidden") eleHiddenAnimatedMapReportID.SetAttribute("DefaultValue", msRequestedPage) sReturn &= sProcessDefinitionElement(eleHiddenAnimatedMapReportID) ElseIf eleDef.Name = "InteractiveDataView" Then 'Call subAddIncludedScript("rdAppletResizer.js") Dim sBGColor As String Try sBGColor = System.Drawing.Color.FromName(st.sGetAttribute(eleDef, "BackgroundColor", "White")).ToArgb().ToString("x").Remove(0, 2) Catch sBGColor = "000000" End Try Call subAddJavaEventFunction("domready", "rdInitAppletResizer('" & eleDef.GetAttribute("ID") & "', '" & sBGColor & "')") Dim eleHiddenAppletReportID As XmlElement = eleDef.AppendChild(eleDef.OwnerDocument.CreateElement("InputHidden")) eleHiddenAppletReportID.SetAttribute("ID", st.sGetAttribute(eleDef, "ID") & "-Hidden") eleHiddenAppletReportID.SetAttribute("DefaultValue", msRequestedPage) sReturn &= sProcessDefinitionElement(eleHiddenAppletReportID) ElseIf eleDef.Name = "GoogleMap" Then 'Call subAddIncludedScript("rdGoogleMapsResizer.js") 'Call subAddJavaEventFunction("rdBodyLoad", "rdInitGoogleMapsResizer('" & eleDef.GetAttribute("ID") & "')") Dim eleHiddenGoogleMapReportID As XmlElement = eleDef.AppendChild(eleDef.OwnerDocument.CreateElement("InputHidden")) eleHiddenGoogleMapReportID.SetAttribute("ID", st.sGetAttribute(eleDef, "ID") & "-Hidden") eleHiddenGoogleMapReportID.SetAttribute("DefaultValue", msRequestedPage) sReturn &= sProcessDefinitionElement(eleHiddenGoogleMapReportID) End If Return sReturn End Function Private Function sProcess_TrellisChart(ByRef eleDef As XmlElement, ByVal sElementID As String) As String Dim sReturn As String Dim trellis As New rdTrellisChart trellis.db9 = _db9 trellis.st = st trellis.dbug = dbug Dim eleTrellisChartDefinition As XmlElement = trellis.BuildTrellisChartDefinition(eleDef, sElementID) sReturn = sProcessDefinitionElement(eleTrellisChartDefinition) plugin.CallPlugins_GeneratedElement(eleTrellisChartDefinition, eleDef) '14254 - Call Plugins from more places - ElementPluginCall 'Remove all the chart elements. They will have DataLayers that we don't want to run with the normal DataLayer process later. Dim eleChart As XmlElement = eleTrellisChartDefinition.SelectSingleNode(".//Chart") Do While Not IsNothing(eleChart) eleChart.ParentNode.RemoveChild(eleChart) eleChart = eleTrellisChartDefinition.SelectSingleNode(".//Chart") Loop Return sReturn End Function Private Function sProcess_ChartGrid(ByRef eleDef As XmlElement) As String Dim sReturn As String = Nothing lgxLicense10.LicenseCheck(eleDef) If eleDef.OwnerDocument.SelectNodes("//ChartGrid").Count > 1 Then _ Throw New Exception("There is only one ChartGrid element allowed for a single report definition.") '23824 Call subAddIncludedScript("rdChartGrid/rdCgScript.js") 'Call subAddJavaEventFunction("rdBodyLoad", "rdCgShowTabsState()") 'msJavaEventFunctionBodyPressEnter = "onKeyDown=""rdTrapKeyDown(event) onKeyUp=""rdTrapKeyUp(event)""" 'If Not IsNothing(eleDef.SelectSingleNode("XolapCube")) Then _ ' CacheXolapCubeDataLayer(eleDef) 'The XolapCube's DataLayer needs to be cached. Dim cg As New rdServer.rdChartGrid(xmlSettings) Dim eleCg As XmlElement = cg.BuildChartGrid(eleDef) If dbug.DebuggingEnabled Then _ dbug.AddDebugMessage("ChartGrid", "Generated", "View Definition", eleCg) plugin.CallPlugins_GeneratedElement(eleCg, eleDef) '14254 - Call Plugins from more places - ElementPluginCall 'CacheXolapCubeDataLayer(eleDef) HttpContext.Current.Session("rdCgDef-" & eleDef.GetAttribute("ID")) = eleDef.OuterXml 'Position the CGs css so that it goes before the developer's css. 'This makes the developer's css take precedence. 'sbHead.Insert(sbHead.ToString.IndexOf("") + 8, "") subAddIncludedCss("rdChartGrid/rdCgStyle.css") sReturn = sReturn & sProcessDefinitionElementChildren(eleCg) 'sReturn = sSetClass(eleDef, sReturn) Return sReturn End Function Private Function sProcess_ColorSpectrumLegend(ByRef eleDef As XmlElement, ByVal sElementID As String) As String Dim sOrientation As String = eleDef.GetAttribute("Orientation") Dim od As XmlDocument = eleDef.OwnerDocument Dim eleRows As XmlElement = Nothing Dim eleCol1 As XmlElement = Nothing Dim eleCol2 As XmlElement = Nothing Dim eleCol3 As XmlElement = Nothing Dim eleSpectrum As XmlElement = Nothing If sOrientation.ToUpper = "VERTICAL" Then eleRows = od.CreateElement("Rows") Dim eleRow1 As XmlElement = eleRows.AppendChild(od.CreateElement("Row")) Dim eleColSpectrum As XmlElement = eleRow1.AppendChild(od.CreateElement("Column")) eleColSpectrum.SetAttribute("RowSpan", 3) eleCol3 = eleRow1.AppendChild(od.CreateElement("Column")) eleCol3.SetAttribute("Style", "vertical-align:top") Dim eleRow2 As XmlElement = eleRows.AppendChild(od.CreateElement("Row")) eleCol2 = eleRow2.AppendChild(od.CreateElement("Column")) eleCol2.SetAttribute("Style", "vertical-align:center") 'Too bad there's no good way to make this text vertical. Dim eleRow3 As XmlElement = eleRows.AppendChild(od.CreateElement("Row")) eleCol1 = eleRow3.AppendChild(od.CreateElement("Column")) eleCol1.SetAttribute("Style", "vertical-align:bottom") eleSpectrum = eleColSpectrum.AppendChild(od.CreateElement("Gauge")) Else 'Horizontal. eleRows = od.CreateElement("Rows") Dim eleRow1 As XmlElement = eleRows.AppendChild(od.CreateElement("Row")) Dim eleColSpectrum As XmlElement = eleRow1.AppendChild(od.CreateElement("Column")) eleColSpectrum.SetAttribute("ColSpan", 3) Dim eleRow2 As XmlElement = eleRows.AppendChild(od.CreateElement("Row")) eleCol1 = eleRow2.AppendChild(od.CreateElement("Column")) eleCol1.SetAttribute("Style", "text-align:left") eleCol2 = eleRow2.AppendChild(od.CreateElement("Column")) eleCol2.SetAttribute("Style", "text-align:center") eleCol3 = eleRow2.AppendChild(od.CreateElement("Column")) eleCol3.SetAttribute("Style", "text-align:right") eleSpectrum = eleColSpectrum.AppendChild(od.CreateElement("Gauge")) End If Dim eleLabel1 As XmlElement = eleCol1.AppendChild(od.CreateElement("Label")) Dim eleLabel2 As XmlElement = eleCol2.AppendChild(od.CreateElement("Label")) Dim eleLabel3 As XmlElement = eleCol3.AppendChild(od.CreateElement("Label")) eleLabel1.SetAttribute("ID", "rdLegendMinRange_" & sElementID) eleLabel1.SetAttribute("Caption", eleDef.GetAttribute("MinRange")) eleLabel1.SetAttribute("Format", eleDef.GetAttribute("Format")) eleLabel1.SetAttribute("Class", eleDef.GetAttribute("Class")) eleLabel2.SetAttribute("ID", "rdLegendCaption_" & sElementID) eleLabel2.SetAttribute("Caption", eleDef.GetAttribute("Caption")) eleLabel2.SetAttribute("Class", eleDef.GetAttribute("Class")) eleLabel3.SetAttribute("ID", "rdSLegendMaxRange_" & sElementID) eleLabel3.SetAttribute("Caption", eleDef.GetAttribute("MaxRange")) eleLabel3.SetAttribute("Format", eleDef.GetAttribute("Format")) eleLabel3.SetAttribute("Class", eleDef.GetAttribute("Class")) eleSpectrum.SetAttribute("ID", "rdLegendSpectrum_" & sElementID) eleSpectrum.SetAttribute("Type", "ColorSpectrum") eleSpectrum.SetAttribute("LowValueColor", eleDef.GetAttribute("LowValueColor")) eleSpectrum.SetAttribute("MediumValueColor", eleDef.GetAttribute("MediumValueColor")) eleSpectrum.SetAttribute("HighValueColor", eleDef.GetAttribute("HighValueColor")) eleSpectrum.SetAttribute("BorderColor", eleDef.GetAttribute("BorderColor")) eleSpectrum.SetAttribute("Orientation", sOrientation) eleSpectrum.SetAttribute("Height", eleDef.GetAttribute("Height")) eleSpectrum.SetAttribute("Width", eleDef.GetAttribute("Width")) eleSpectrum.SetAttribute("ChartHeight", eleDef.GetAttribute("Height")) eleSpectrum.SetAttribute("ChartWidth", eleDef.GetAttribute("Width")) If eleSpectrum.GetAttribute("LowValueColor").Length = 0 Then eleSpectrum.SetAttribute("LowValueColor", "red") If eleSpectrum.GetAttribute("HighValueColor").Length = 0 Then eleSpectrum.SetAttribute("HighValueColor", "green") Return sProcessDefinitionElement(eleRows) End Function Private Function sProcess_DefinitionModifierFile(ByRef eleDef As XmlElement) As String '11906 If Not mbDontCacheXsl Then 'Might need to prevent Xsl caching if the DMF has a token. Dim sFilename As String = eleDef.GetAttribute("DefinitionModifierFile") If st.sReplaceTokens(sFilename) <> sFilename Then mbDontCacheXsl = True End If End If Return "" End Function 'Private Function sProcess_DefaultRequestParams(ByRef eleDef As XmlElement) As String ' 'Don't change how this works. It will may break some customer's Plugins. ' Dim sReturn As String = Nothing ' http.Application("rdCheckDefaultRequest") = "True" ' Dim sKeyNamePrefix As String = "rdDefaultRequest_" & msRequestedPage & "_" ' If eleDef.GetAttribute("RemoveDeleted") = "True" Then 'This is only used by Ad Hoc. ' 'Ad Hoc may have removed some DefaultRequestParams. ' Dim sKeyName As String ' For Each sKeyName In http.Application.AllKeys() ' If sKeyName.StartsWith(sKeyNamePrefix) Then ' If IsNothing(eleDef.Attributes(sKeyName.Replace(sKeyNamePrefix, ""))) Then ' http.Application.Remove(sKeyName) ' End If ' End If ' Next ' End If ' Dim atr As XmlAttribute ' For Each atr In eleDef.Attributes ' If atr.Value = "@Request." & atr.Name & "~" Then _ ' Throw New Exception("DefaultRequestParameters cannot reference themselves. See " & atr.Name & ".") ' http.Application(sKeyNamePrefix & atr.Name) = atr.Value ' Next ' Return sReturn 'End Function Private Function sProcess_Dashboard2(ByRef eleDef As XmlElement) As String needLocalization = True dbug.AddDebugMessage("Dashboard", "Generate Definition") Dim dashboard As New rdServer.rdDashboard(Me, st, dbug) Return dashboard.sProcess_Dashboard2(eleDef, xmlSettings.DocumentElement) End Function Private Function sProcess_GoogleMap(ByRef eleDef As XmlElement, ByVal sElementID As String) As String lgxLicense10.LicenseCheck(eleDef) If st.sGetRequestVar("rdGoogleMapResizerRefresh") = "True" Then ' If it is a Resizer Refresh, Do not process, Just get the current element's With and Height values and store them in Session. If Not String.IsNullOrEmpty(st.sGetRequestVar("rdGoogleMapCurrentWidth")) Then HttpContext.Current.Session(st.sGetRequestVar("rdGoogleMapId") + "-" + "rdGoogleMapCurrentWidth") = st.sGetRequestVar("rdGoogleMapCurrentWidth") If Not String.IsNullOrEmpty(st.sGetRequestVar("rdGoogleMapCurrentHeight")) Then HttpContext.Current.Session(st.sGetRequestVar("rdGoogleMapId") + "-" + "rdGoogleMapCurrentHeight") = st.sGetRequestVar("rdGoogleMapCurrentHeight") Return String.Empty End If Dim sID As String = eleDef.GetAttribute("ID") If sID.Length = 0 Then Throw New Exception("GoogleMap elements must have an ID value.") If eleDef.GetAttribute("Height").Length = 0 Or eleDef.GetAttribute("Height").Length = 0 Then _ Throw New Exception("GoogleMap elements must have Width and Height attributes.") Dim sMapScriptUrl As String = eleDef.GetAttribute("GoogleMapsApiUrl") Dim sConnID As String = eleDef.GetAttribute("ConnectionID") Dim gmap As New rdGoogleMap(dbug) If String.IsNullOrEmpty(sMapScriptUrl) Then sMapScriptUrl = gmap.GetUrl(sConnID, xmlSettings, rdGoogleMap.GoogleMapApi.JavascriptMap) eleDef.SetAttribute("GoogleMapsApiUrl", sMapScriptUrl) End If 'Call gmap.SignUrl(sMapScriptUrl) IncludeChartCanvasRequiredScripts() 'load libraries for marker labels and clustering 'If eleDef.SelectNodes("GoogleMapMarkers/MapMarkerLabel").Count > 0 Then _ ' Call subAddIncludedScript("rdGoogleMap/markerwithlabel_packed.js") ' ''Call subAddIncludedScript("http://google-maps-utility-library-v3.googlecode.com/svn/tags/markerwithlabel/1.1.5/src/markerwithlabel_packed.js") 'If eleDef.SelectNodes("GoogleMapMarkers/MapMarkerClustering").Count > 0 Then _ ' Call subAddIncludedScript("rdGoogleMap/markerclusterer.js") ''Call subAddIncludedScript("http://google-maps-utility-library-v3.googlecode.com/svn/tags/markerclustererplus/2.0.4/src/markerclusterer_packed.js") Dim sJavascriptInclude As String = gmap.GetUrl(sConnID, xmlSettings, rdGoogleMap.GoogleMapApi.JavascriptInclude) If Not String.IsNullOrEmpty(sJavascriptInclude) Then subAddIncludedScript(sJavascriptInclude) ' Dim sLoadScript As String = "rdGmapLoad(""" & sID & """);" 'Else End If '23824 'subAddIncludedScript("rdAjax/rdAjax2.js") 'Call subAddJavaEventFunction("rdBodyLoad", sLoadScript) '10590 Dim sMapMarkersXsl As String = Nothing Call subBuildGoogleMapMarkersXsl(eleDef, sID, sMapMarkersXsl) Dim sXsl As String = "" & eleDef.OuterXml & "" Dim sMapDef As String = eleDef.OuterXml Dim tzr As New Tokenizer(sMapDef) Dim tkn As Tokenizer.Token For Each tkn In tzr.Tokens Select Case tkn.Type Case "Data" sXsl = sXsl.Replace("@Data." & tkn.Name & "~", sTokenToXsl("@DataMap." & tkn.Name & "~", xslValueType.Attribute, True)) End Select Next ' Added this to provide the Resizer functionality to the Google Maps. If (Not String.IsNullOrEmpty(eleDef.GetAttribute("Width")) And Not String.IsNullOrEmpty(eleDef.GetAttribute("Height"))) _ AndAlso eleDef.SelectNodes("Resizer").Count > 0 Then _ sXsl = sSetResizer(eleDef, sElementID, Val(st.sGetAttribute(eleDef, "Width")), Val(st.sGetAttribute(eleDef, "Height")), sXsl) Call subAddGoogleMapLegend(eleDef, sXsl) 'This call may change sXsl. Dim ret As String = sXsl & sMapMarkersXsl If http.Request("rdReportFormat") = "PDF" Then ret = rdBrowserBornElementRenderer.WrapHtmlToBrowserBornTag(ret, BrowserBornRenderType.Image) End If Return ret End Function Private Sub subBuildGoogleMapMarkersXsl(ByRef eledef As XmlElement, ByRef sId As String, ByRef sMapMarkersXsl As String) 'This function returns the XSL for map markers for Google maps. Dim nlMapMarkers As XmlNodeList = Nothing Select Case eledef.Name Case "GoogleMap" nlMapMarkers = eledef.SelectNodes("GoogleMapMarkers | GoogleMapPolygons | GoogleMapPolylines | MapMarkerLabel") 'Case "ArcWebServicesMap" ' nlMapMarkers = eledef.SelectNodes("AwsMapMarkers") End Select If nlMapMarkers.Count <> 0 Then Dim sMarkerImageXsl As String = Nothing Dim sMarkerTextXsl As String = Nothing Dim sMarkerInfoXsl As String = Nothing Dim sMarkerActionXsl As String = Nothing For Each eleMapMarker As XmlElement In nlMapMarkers Dim sMarkersID As String = eleMapMarker.GetAttribute("ID") If sMarkersID.Length = 0 Then _ Throw New Exception(eleMapMarker.Name & " elements must have an ID.") 'Action.MapMarkerInfo. Dim eleMapMarkerAction As XmlElement = eleMapMarker.SelectSingleNode("Action[@Type='MapMarkerInfo']") If Not IsNothing(eleMapMarkerAction) Then Dim eleMapMarkerInfo As XmlElement = eleMapMarkerAction.SelectSingleNode("MapMarkerInfo") If IsNothing(eleMapMarkerInfo) Then _ Throw New Exception("Action.MapMarkerInfo element must have a child element.") 'This is for information bubbles. 'Move the elements from the MarkerInfo element under a hidden SPAN, then get the XSL for that Span. Dim eleHiddenSpan As XmlElement = eleMapMarkerInfo.OwnerDocument.CreateElement("Span") eleHiddenSpan.SetAttribute("ID", "rdShow-" & sId) eleHiddenSpan.SetAttribute("ShowModes", "None") Dim nlMarkerChildren As XmlNodeList = eleMapMarkerInfo.SelectNodes("*") Do While 0 < nlMarkerChildren.Count Dim eleMarkerChild As XmlElement = nlMarkerChildren.ItemOf(0) eleHiddenSpan.AppendChild(eleMarkerChild.ParentNode.RemoveChild(eleMarkerChild)) nlMarkerChildren = eleMapMarkerInfo.SelectNodes("*") Loop eleMapMarkerInfo.AppendChild(eleHiddenSpan) 'Add a dummy Action.ShowElement so that IFrames are still added. Dim eleAction As XmlElement = eleHiddenSpan.AppendChild(eleHiddenSpan.OwnerDocument.CreateElement("Action")) eleAction.SetAttribute("Type", "ShowElement") eleAction.SetAttribute("ElementID", "rdShow-" & sId) '23824 'Call subAddIncludedScript("rdActionShowElement.js") 'Get the XSL sMarkerInfoXsl = sProcessDefinitionElementChildren(eleHiddenSpan) '21675 eleHiddenSpan.ParentNode.RemoveChild(eleHiddenSpan) Else ''Any other kinds of Actions? 'Dim eleAction As XmlElement = eleMapMarker.SelectSingleNode("Action") 'If Not IsNothing(eleAction) Then ' 'Make a hidden label to hold the Action. ' Dim eleLabel As XmlElement = eleMapMarker.AppendChild(eleMapMarker.OwnerDocument.CreateElement("Label")) ' eleLabel.SetAttribute("ID", "rdMarkerActionSpan_" & sMarkersID) ' eleLabel.AppendChild(eleAction.CloneNode(True)) ' sMarkerActionXsl = sProcessDefinitionElement(eleLabel) 'End If 'Any other kinds of Actions? Dim eleAction As XmlElement = eleMapMarker.SelectSingleNode("Action") If Not IsNothing(eleAction) Then 'Make a hidden label to hold the Action. Dim eleLabel As XmlElement = eleMapMarker.AppendChild(eleMapMarker.OwnerDocument.CreateElement("Button")) eleLabel.SetAttribute("Caption", "xxxx") eleLabel.SetAttribute("ID", "rdMarkerActionSpan_" & sMarkersID) eleLabel.AppendChild(eleAction.CloneNode(True)) sMarkerActionXsl = sProcessDefinitionElement(eleLabel) End If End If 'Marker images. If eleMapMarker.Name = "GoogleMapMarkers" Then Dim eleMapMarkerImage As XmlElement = eleMapMarker.SelectSingleNode("MapMarkerImage") If Not IsNothing(eleMapMarkerImage) Then Dim eleMapMarkerImageChild As XmlElement = eleMapMarkerImage.SelectSingleNode("*") If IsNothing(eleMapMarkerImageChild) Then _ Throw New Exception("MapMarkerImage elements must have a child element that is an Image, Chart or Gauge.") Dim sWidth As String = eleMapMarkerImageChild.GetAttribute("Width") Dim sHeight As String = eleMapMarkerImageChild.GetAttribute("Height") If sWidth.Length = 0 Or sHeight.Length = 0 Then 'A chart? sWidth = eleMapMarkerImageChild.GetAttribute("ChartWidth") sHeight = eleMapMarkerImageChild.GetAttribute("ChartHeight") If sWidth.Length = 0 Or sHeight.Length = 0 Then _ Throw New Exception("MapMarkerImage elements must have a child element with Width and Height.") End If If Not IsNothing(eleMapMarkerImageChild.SelectSingleNode("Action")) Then _ Throw New Exception("Action elements can not be used under MapMarkerImages. Instead, put the Action under MapMarkers.") eleMapMarkerImageChild.SetAttribute("ID", "rdMapMarkerImage_" + sId + "_" + sMarkersID) 'Move the child image element from the MapMarkerImage element under a hidden Span, then get the XSL for that Span. Dim eleHiddenSpan As XmlElement = eleMapMarkerImage.OwnerDocument.CreateElement("Span") eleHiddenSpan.SetAttribute("ID", "rdMarker-" & sMarkersID) eleHiddenSpan.SetAttribute("ShowModes", "None") eleHiddenSpan.AppendChild(eleMapMarkerImageChild.ParentNode.RemoveChild(eleMapMarkerImageChild)) eleMapMarkerImage.AppendChild(eleHiddenSpan) 'Get the XSL sMarkerImageXsl = sProcessDefinitionElementChildren(eleHiddenSpan) End If End If If eleMapMarker.Name = "GoogleMapPolygons" Then 'Update the DataLayer with a new column that will contain encoded polygon points. Dim eleDataLayer As XmlElement = eleMapMarker.SelectSingleNode("DataLayer") If IsNothing(eleDataLayer) Then _ Throw New Exception("GoogleMapPolygon elements require a child DataLayer.") Dim eleEncodeCoordinates As XmlElement = eleDataLayer.AppendChild(eledef.OwnerDocument.CreateElement("GoogleEncodeCoordinates")) eleEncodeCoordinates.SetAttribute("ID", "rdPolygonEncoded") eleEncodeCoordinates.SetAttribute("Coordinates", "rdCoordinates") 'rdCoordinates comes out of the transformation from the .gpx file. eleEncodeCoordinates.SetAttribute("IsPolygon", "True") 'rdCoordinates comes out of the transformation from the .gpx file. eleEncodeCoordinates.SetAttribute("PointReduction", st.sGetAttribute(eleMapMarker, "PointReduction", 4)) End If If eleMapMarker.Name = "GoogleMapPolylines" Then 'Update the DataLayer with a new column that will contain encoded polygon points. Dim eleDataLayer As XmlElement = eleMapMarker.SelectSingleNode("DataLayer") If IsNothing(eleDataLayer) Then _ Throw New Exception("GoogleMapPolylines elements require a child DataLayer.") Dim eleEncodeCoordinates As XmlElement = eleDataLayer.AppendChild(eledef.OwnerDocument.CreateElement("GoogleEncodeCoordinates")) eleEncodeCoordinates.SetAttribute("ID", "rdLineEncoded") eleEncodeCoordinates.SetAttribute("Coordinates", "rdCoordinates") 'rdCoordinates comes out of the transformation from the .gpx file. eleEncodeCoordinates.SetAttribute("IsLine", "True") 'rdCoordinates comes out of the transformation from the .gpx file. End If ''Marker Text - ArcWebServices only. 'Dim eleMapMarkerText As XmlElement = eleMapMarker.SelectSingleNode("MapMarkerText") 'If Not IsNothing(eleMapMarkerText) Then ' Dim eleMapMarkerLabel As XmlElement = eleMapMarker.AppendChild(eleMapMarkerText.OwnerDocument.CreateElement("Label")) ' eleMapMarkerLabel.SetAttribute("ID", "rdMapMarkerText-" & sMarkersID) ' 'Get the XSL ' sMarkerTextXsl = sProcessDefinitionElement(eleMapMarkerLabel) 'End If Dim slash As String = rdState.GetSlash() Dim sXsl As String = rdUtility.ReadFile(rdState.sGetPhysicalPath() & slash & "rdTemplate" & slash & "rdGoogleMap" & slash & "rdMarkersInfo.xsl") sMapMarkersXsl &= rdUtility.ReadFile(rdState.sGetPhysicalPath() & slash & "rdTemplate" & slash & "rdGoogleMap" & slash & "rdMarkersInfo.xsl") sXsl = sXsl.Replace("rdDataID", sMarkersID) sXsl = sXsl.Replace("bActionMapMarkerInfo", IIf(IsNothing(sMarkerInfoXsl), "false", "true")) sXsl = sXsl.Replace("rdMarkerImage", sMarkerImageXsl) sXsl = sXsl.Replace("rdMarkerText", sMarkerTextXsl) sXsl = sXsl.Replace("rdMarkerInfo", sMarkerInfoXsl) sXsl = sXsl.Replace("rdMarkerAction", sMarkerActionXsl) sMapMarkersXsl &= sXsl Next End If End Sub Private Sub subAddGoogleMapLegend(ByVal eleGoogleMap As XmlElement, ByRef sXsl As String) Dim eleLegendDef As XmlElement = eleGoogleMap.SelectSingleNode(".//PolygonColorSpectrumLegend") If IsNothing(eleLegendDef) Then Exit Sub End If Dim eleSpectrumColumn As XmlElement = eleLegendDef.SelectSingleNode("ancestor::GoogleMapPolygons//ColorSpectrumColumn") If IsNothing(eleSpectrumColumn) Then _ Throw New Exception("PolygonColorSpectrumLegend elements must have a ColorSpectrumColumn element under its parent's DataLayer.") 'Create a legend and wrap it up togeter with the map in a table. Dim od As XmlDocument = eleGoogleMap.OwnerDocument Dim eleRows As XmlElement = od.CreateElement("Rows") eleRows.SetAttribute("ID", eleLegendDef.GetAttribute("ID")) Dim eleRow1 As XmlElement Dim eleRow2 As XmlElement Dim eleColMap As XmlElement Dim eleColLegend As XmlElement Dim sWidth As String Dim sHeight As String Dim sOrientation As String If eleLegendDef.GetAttribute("Location") = "Right" Then 'Right side sOrientation = "Vertical" eleRow1 = eleRows.AppendChild(od.CreateElement("Row")) eleColMap = eleRow1.AppendChild(od.CreateElement("Column")) eleColLegend = eleRow1.AppendChild(od.CreateElement("Column")) sWidth = 10 sHeight = eleGoogleMap.GetAttribute("Height") Else 'Bottom side. sOrientation = "Horizontal" eleRow1 = eleRows.AppendChild(od.CreateElement("Row")) eleColMap = eleRow1.AppendChild(od.CreateElement("Column")) eleRow2 = eleRows.AppendChild(od.CreateElement("Row")) eleColLegend = eleRow2.AppendChild(od.CreateElement("Column")) sWidth = eleGoogleMap.GetAttribute("Width") sHeight = 10 End If Dim eleMapSpan As XmlElement = eleColMap.AppendChild(od.CreateElement("Label")) eleMapSpan.SetAttribute("Caption", "rdMapGoesHere") Dim eleLegend As XmlElement = eleColLegend.AppendChild(od.CreateElement("ColorSpectrumLegend")) eleLegend.SetAttribute("Class", eleLegendDef.GetAttribute("Class")) eleLegend.SetAttribute("Caption", eleLegendDef.GetAttribute("Caption")) eleLegend.SetAttribute("Format", eleLegendDef.GetAttribute("Format")) eleLegend.SetAttribute("Width", sWidth) eleLegend.SetAttribute("Height", sHeight) eleLegend.SetAttribute("Orientation", sOrientation) eleLegend.SetAttribute("BorderColor", "Gray") eleLegend.SetAttribute("LowValueColor", eleSpectrumColumn.GetAttribute("LowValueColor")) eleLegend.SetAttribute("MediumValueColor", eleSpectrumColumn.GetAttribute("MediumValueColor")) eleLegend.SetAttribute("HighValueColor", eleSpectrumColumn.GetAttribute("HighValueColor")) eleLegend.SetAttribute("MinRange", eleLegendDef.GetAttribute("MinRange")) eleLegend.SetAttribute("MaxRange", eleLegendDef.GetAttribute("MaxRange")) 'Set default values for min and max range if they are not set so that they automatically come from the data. If eleLegend.GetAttribute("MinRange").Length = 0 Then _ eleLegend.SetAttribute("MinRange", "@Data." & eleSpectrumColumn.GetAttribute("ID") & "_MinRange~") If eleLegend.GetAttribute("MaxRange").Length = 0 Then _ eleLegend.SetAttribute("MaxRange", "@Data." & eleSpectrumColumn.GetAttribute("ID") & "_MaxRange~") Dim sTableXsl As String = sProcessDefinitionElement(eleRows) sXsl = sTableXsl.Replace("rdMapGoesHere", sXsl) End Sub Private Sub subAddAnimatedMapLegend(ByVal eleAnimatedMap As XmlElement, ByRef sXsl As String) Dim eleLegendDef As XmlElement = eleAnimatedMap.SelectSingleNode(".//AnimatedMapColorSpectrumLegend") If IsNothing(eleLegendDef) Then Exit Sub End If Dim eleSpectrumColumn As XmlElement = eleAnimatedMap.SelectSingleNode(".//ColorSpectrumColumn") '13523 If IsNothing(eleSpectrumColumn) Then _ Throw New Exception("AnimatedMapColorSpectrumLegend elements must have a ColorSpectrumColumn element under its parent's DataLayer.") 'Create a legend and wrap it up togeter with the map in a table. Dim od As XmlDocument = eleAnimatedMap.OwnerDocument Dim eleRows As XmlElement = od.CreateElement("Rows") eleRows.SetAttribute("ID", eleLegendDef.GetAttribute("ID")) Dim eleRow1 As XmlElement Dim eleRow2 As XmlElement Dim eleColMap As XmlElement Dim eleColLegend As XmlElement Dim sWidth As String Dim sHeight As String Dim sOrientation As String If eleLegendDef.GetAttribute("Location") = "Right" Then 'Right side sOrientation = "Vertical" eleRow1 = eleRows.AppendChild(od.CreateElement("Row")) eleColMap = eleRow1.AppendChild(od.CreateElement("Column")) eleColLegend = eleRow1.AppendChild(od.CreateElement("Column")) sWidth = 10 sHeight = eleAnimatedMap.GetAttribute("Height") Else 'Bottom side. sOrientation = "Horizontal" eleRow1 = eleRows.AppendChild(od.CreateElement("Row")) eleColMap = eleRow1.AppendChild(od.CreateElement("Column")) eleRow2 = eleRows.AppendChild(od.CreateElement("Row")) eleColLegend = eleRow2.AppendChild(od.CreateElement("Column")) sWidth = eleAnimatedMap.GetAttribute("Width") sHeight = 10 End If Dim eleMapSpan As XmlElement = eleColMap.AppendChild(od.CreateElement("Label")) eleMapSpan.SetAttribute("Caption", "rdMapGoesHere") Dim eleLegend As XmlElement = eleColLegend.AppendChild(od.CreateElement("ColorSpectrumLegend")) eleLegend.SetAttribute("Class", eleLegendDef.GetAttribute("Class")) eleLegend.SetAttribute("Caption", eleLegendDef.GetAttribute("Caption")) eleLegend.SetAttribute("Format", eleLegendDef.GetAttribute("Format")) eleLegend.SetAttribute("Width", sWidth) eleLegend.SetAttribute("Height", sHeight) eleLegend.SetAttribute("Orientation", sOrientation) eleLegend.SetAttribute("BorderColor", "Gray") eleLegend.SetAttribute("LowValueColor", eleSpectrumColumn.GetAttribute("LowValueColor")) eleLegend.SetAttribute("MediumValueColor", eleSpectrumColumn.GetAttribute("MediumValueColor")) eleLegend.SetAttribute("HighValueColor", eleSpectrumColumn.GetAttribute("HighValueColor")) eleLegend.SetAttribute("MinRange", eleLegendDef.GetAttribute("MinRange")) eleLegend.SetAttribute("MaxRange", eleLegendDef.GetAttribute("MaxRange")) 'Set default values for min and max range if they are not set so that they automatically come from the data. If eleLegend.GetAttribute("MinRange").Length = 0 Then _ eleLegend.SetAttribute("MinRange", "@Data." & eleSpectrumColumn.GetAttribute("ID") & "_MinRange~") If eleLegend.GetAttribute("MaxRange").Length = 0 Then _ eleLegend.SetAttribute("MaxRange", "@Data." & eleSpectrumColumn.GetAttribute("ID") & "_MaxRange~") Dim sTableXsl As String = sProcessDefinitionElement(eleRows) sXsl = sTableXsl.Replace("rdMapGoesHere", sXsl) End Sub Private Function sProcess_HR(ByRef eleDef As XmlElement) As String Dim sReturn As String = Nothing sReturn = "
    0 Then sReturn = sReturn & "size=""" & eleDef.GetAttribute("Size") & """" End If sReturn = sReturn & ">" sReturn = sSetClass(eleDef, sReturn) sReturn = sSetPositioning(eleDef, sReturn) Return sReturn End Function Private Function sProcess_Image(ByRef eleDef As XmlElement) As String Dim sReturn As String = Nothing 'Staples.com Dim sCaption As String = eleDef.GetAttribute("Caption") If sCaption.Length = 0 AndAlso st.sGetAttribute(eleDef, "PreventOnEmptyException") <> "True" Then _ Throw New Exception("An Image must have a Caption attribute that sets the image filename.") 'We decided not to implement this "ImageData" token. It would automatically create the FileColumn element under the DataLayer. 'If sCaption.StartsWith("@ImageData.") AndAlso sCaption.EndsWith("~") Then ' Dim sDataColumn As String = sCaption.Substring("@ImageData.".Length, sCaption.Length - "@ImageData.".Length - 1) ' 'Add a FileColumn element to the bottom of the DataLayer. ' Dim eleDataLayer As XmlElement = eleDef.SelectSingleNode("ancestor::*/DataLayer") ' If Not IsNothing(eleDataLayer) Then ' 'Add something like this to the DataLayer: ' ' ' Dim eleFileColumn As XmlElement = eleDataLayer.AppendChild(eleDef.OwnerDocument.CreateElement("FileColumn")) ' eleFileColumn.SetAttribute("ID", "rdImageData_" & sDataColumn) ' eleFileColumn.SetAttribute("SavedFilenameColumnID", "rdImageData_" & sDataColumn) ' eleFileColumn.SetAttribute("DataColumn", sDataColumn) ' eleFileColumn.SetAttribute("Filename", "@Function.AppPhysicalPath~\rdDownload\@Function.GUID~.gif") ' 'Update the Image's caption attribute to use the generated filenames. ' sCaption = "rdDownload/@Data.rdImageData_" & sDataColumn & "~" ' End If 'End If ' Resolve ReportAuthorUploadFolder Dim bAddFixupToken As Boolean = False sCaption = ReportAuthor.ResolveReportAuthorFolderInCaption(sCaption, st, dbug, bAddFixupToken) Dim sFormula As String = "" If sCaption.StartsWith("=") Then 'The caption is a formula. The value is calculated post-XSL transformation. sCaption = rdUtility.HtmlEncode4(sCaption, True) sFormula = "rdFormula=""" & sTokenToXsl(sCaption.Substring(1), xslValueType.Attribute, True, True) & """ " sCaption = "rdFormulaValue" Else If sCaption.IndexOf("/") = -1 Then '#9694 _Images folder will be depricated when using Tokenized caption names. If Not sCaption.Contains("@") Then sCaption = rdSupportFile.getRelativeWebPath(sCaption, rdState.sGetPhysicalPath(), rdSupportFile.SupportFileType.Image) Else 'Just use _SupportFiles sCaption = "_SupportFiles/" & sCaption End If 'THIS FIX DOES NOT WORK!!! sCaption = rdSupportFile.getRelativeWebPath(st.sReplaceTokens(sCaption), rdState.sGetPhysicalPath(), rdSupportFile.SupportFileType.Image) '9694 Else 'We must remove the users last ../ if it exists bc thier current pwd is not in _images or _supportfiles If sCaption.Contains("../") Then sCaption = sCaption.Remove(sCaption.IndexOf("../"), 3) End If End If 'If sCaption.IndexOf("@") = -1 Then ' If File.Exists(rdState.sGetphysicalpath() & "\_Images\" & sCaption) Then ' sCaption = "_Images/" & sCaption ' End If 'End If End If ' PDF? add the full relative web path... #7475 If st.sGetRequestVar("rdReportFormat") = "PDF" And sCaption.IndexOf("/") <> -1 Then If sCaption.IndexOf("_SupportFiles") = -1 And sCaption.IndexOf("_Images") = -1 Then '13221 If Not sCaption.Contains("//") Then Dim sFullRelativeWebPath As String = HttpContext.Current.Request.Url.AbsoluteUri If sFullRelativeWebPath.IndexOf(".aspx") <> -1 Then sFullRelativeWebPath = sFullRelativeWebPath.Substring(0, sFullRelativeWebPath.IndexOf(".aspx")) '12373 'Remove the file part. sFullRelativeWebPath = sFullRelativeWebPath.Substring(0, sFullRelativeWebPath.LastIndexOf("/")) End If sCaption = sFullRelativeWebPath & "/" & sCaption End If End If End If 'Image height and width. Dim sImageStyle As String = "" If eleDef.GetAttribute("Width").Length > 0 Then sImageStyle &= " width=""" & eleDef.GetAttribute("Width") & """" ' & "px""" End If If eleDef.GetAttribute("Height").Length > 0 Then sImageStyle &= " height=""" & eleDef.GetAttribute("Height") & """" ' & "px""" End If If bAddFixupToken Then sReturn = sFormula & "rdFixupSrc=""" & sCaption & """" & sImageStyle Else sReturn = sFormula & "src=""" & sCaption & """" & sImageStyle End If 'sReturn = sReturn & " border=""0""" sReturn = sTokenToXsl(sReturn, xslValueType.Attribute) sReturn = sReturn & sGetImageTextAttributes(eleDef) sReturn = "" sReturn &= sSetTooltipPanel(eleDef) '#13993. 'sReturn = sSetAlign(eleDef, sReturn) sReturn = sSetHtmlStyle(eleDef, sReturn) sReturn = sSetID(eleDef, sReturn) sReturn = sSetClass(eleDef, sReturn) sReturn = sSetStyle(eleDef, sReturn) sReturn = sSetEventHandler(eleDef, sReturn) sReturn = sSetPositioning(eleDef, sReturn) sReturn = sSetAction(eleDef, sReturn) sReturn = sSetConditionalElement(eleDef, sReturn) 'This is not in the Rules - it's used by the DataTree. sReturn = sSetQuicktip(eleDef, sReturn) '16382 Return sReturn End Function Private Sub subProcess_ElementTemplate(ByRef eleDef As XmlElement) 'Remove any DataLayers or anything else that would try to get processed later. Do While eleDef.ChildNodes.Count <> 0 eleDef.RemoveChild(eleDef.ChildNodes(0)) Loop End Sub Private Function sProcess_ToggleImage(ByRef eleDef As XmlElement, ByVal sElementID As String) As String Dim sReturn As String = Nothing If sElementID.Length = 0 Then _ Throw New Exception("ToggleImage elements must have an ID value.") Dim sTrueImage As String = st.sGetAttribute(eleDef, "TrueImage", "rdTemplate/rdMinus.gif") Dim sFalseImage As String = st.sGetAttribute(eleDef, "FalseImage", "rdTemplate/rdPlus.gif") Dim sTargetElementID As String = st.sGetAttribute(eleDef, "ElementID") Try '#14303. If Not sTargetElementID.LastIndexOf("_") = -1 Then Dim sInstanceID As String = sTargetElementID.Substring(sTargetElementID.LastIndexOf("_")) If Not String.IsNullOrEmpty(sInstanceID) Then sElementID = sElementID + sInstanceID End If End If Catch End Try If sTargetElementID.Length = 0 Then _ Throw New Exception("ToggleImage elements must have an ElementID value.") Dim sValue As String = eleDef.GetAttribute("Value") If sValue.Length <> 0 _ AndAlso sValue <> "True" _ AndAlso sValue <> "False" Then _ Throw New Exception("ToggleImage elements must have a Value of blank, True, or False.") 'Add Logi Reporting elements that will make this work. Dim eleToggle As XmlElement = eleDef.OwnerDocument.CreateElement("Division") eleDef.AppendChild(eleToggle) eleToggle.SetAttribute("ID", "rdDiv" & sElementID) 'eleToggle.SetAttribute("SecurityRightID", eleDef.GetAttribute("SecurityRightID")) Dim s As String s = eleDef.GetAttribute("Condition") : If s.Length <> 0 Then eleToggle.SetAttribute("Condition", eleDef.GetAttribute("Condition")) 'Condition is not in the Rules, but is used by the DataTree element. Dim eleDiv As XmlElement Dim eleImage As XmlElement Dim eleAction As XmlElement 'On Division. eleDiv = eleDef.OwnerDocument.CreateElement("Division") eleToggle.AppendChild(eleDiv) eleDiv.SetAttribute("ID", "rdOnDiv" & sElementID) If sValue <> "True" Then 'The default value is False. eleDiv.SetAttribute("ShowModes", "None") End If 'On Image. eleImage = eleDef.OwnerDocument.CreateElement("Image") eleDiv.AppendChild(eleImage) 'eleImage.SetAttribute("ID", "rdOnImage" & eleDef.GetAttribute("ID")) eleImage.SetAttribute("Caption", sTrueImage) s = eleDef.GetAttribute("Class") : If s.Length <> 0 Then eleImage.SetAttribute("Class", s) 'eleImage.SetAttribute("SecurityRightID", eleDef.GetAttribute("Class")) s = eleDef.GetAttribute("AltText") : If s.Length <> 0 Then eleImage.SetAttribute("AltText", s) Else eleImage.SetAttribute("AltText", "Expand") s = eleDef.GetAttribute("Tooltip") : If s.Length <> 0 Then eleImage.SetAttribute("Tooltip", s) s = eleDef.GetAttribute("Height") : If s.Length <> 0 Then eleImage.SetAttribute("Height", s) s = eleDef.GetAttribute("Width") : If s.Length <> 0 Then eleImage.SetAttribute("Width", s) 'On Action eleAction = eleDef.OwnerDocument.CreateElement("Action") eleImage.AppendChild(eleAction) eleAction.SetAttribute("ID", "rdAct2" & sElementID) '16985 eleAction.SetAttribute("Type", "ShowElement") eleAction.SetAttribute("ElementID", sTargetElementID & ",rdOnDiv" & sElementID & ",rdOffDiv" & sElementID) eleAction.SetAttribute("Display", "Toggle") eleAction.SetAttribute("OriginalElement", "ToggleImage") 'Off Image and Action eleDiv = eleDiv.CloneNode(True) eleAction.SetAttribute("ID", "rdAct" & sElementID) eleToggle.AppendChild(eleDiv) eleDiv.SetAttribute("ID", "rdOffDiv" & sElementID) If sValue <> "True" Then 'The default value is False. eleDiv.RemoveAttribute("ShowModes") Else eleDiv.SetAttribute("ShowModes", "None") End If eleImage = eleDiv.SelectSingleNode("Image") eleImage.SetAttribute("Caption", sFalseImage) eleImage.SetAttribute("AltText", "Collapse") sReturn = sProcessDefinitionElementChildren(eleDef) Return sReturn End Function Private Function sProcess_Label(ByRef eleDef As XmlElement) As String Dim sReturn As String = Nothing 'If bExportCsv() Or bExportNativeExcel() Or (bExportExcel() And eleDef.GetAttribute("Class").Length = 0) Then 'If bExportNativeExcel() Or (bExportExcel() And eleDef.GetAttribute("Class").Length = 0) Then 'Removed CSV so that it will use the Label's Format attribute. '15506 - remove version7. 'If bExportNativeExcel() _ ' AndAlso rdNativeExcelUtil.GetExcelType(st) = "Version7" Then 'Removed original Excel for same reason. Issue 1853. ' 'Streamlined ' Dim sCaption As String = eleDef.GetAttribute("Caption") ' If sCaption.StartsWith("=") Then ' 'The caption is a formula. The value is calculated post-XSL transformation. ' If sCaption.Length > 1 Then ' 'sCaption =rdUtility.HtmlEncode4(sCaption) Removed to handle quotes in @Data values. ' Dim sErrorResult As String = eleDef.GetAttribute("ErrorResult") ' If sErrorResult.Length <> 0 Then _ ' sCaption &= ":rdErrorResult=" & sErrorResult 'Append the error result to the forumula. ' Dim sFormula As String = "rdFormula=""" & sTokenToXsl(sCaption.Substring(1), xslValueType.Attribute, True, True) & """ " ' sCaption = "rdFormulaValue" ' sReturn = "" & sTokenToXsl(sCaption, xslValueType.Element, True) & "" ' End If ' Else ' sCaption = sCaption.Replace("@Request.", "@RequestXmlEncoded.") 'Ensure valid XHTML for these exports. ' sCaption = sCaption.Replace("@Local.", "@LocalHtmlEncoded.") ' sCaption = sCaption.Replace("@Session.", "@SessionHtmlEncoded.") '#8612 ' sReturn = sTokenToXsl(sCaption, xslValueType.Element, True) ' End If 'Else 'Normal Label processing. Dim sCaption As String = eleDef.GetAttribute("Caption") sCaption = sCaption.Replace("@Request.", "@RequestXmlEncoded.") 'Ensure valid XHTML. Helps with formulas. Issue 1628. sCaption = sCaption.Replace("@Local.", "@LocalHtmlEncoded.") sCaption = sCaption.Replace("@Session.", "@SessionHtmlEncoded.") '#8612 Dim sBindId As String = eleDef.GetAttribute("For") If Not String.IsNullOrEmpty(sBindId) Then sBindId = sBindId.Replace("@Request.", "@RequestXmlEncoded.") 'Ensure valid XHTML. Helps with formulas. Issue 1628. sBindId = sBindId.Replace("@Local.", "@LocalHtmlEncoded.") sBindId = sBindId.Replace("@Session.", "@SessionHtmlEncoded.") '#8612 End If Dim sHTMLTag As String = st.sGetAttribute(eleDef, "HtmlTag") Dim sFormat As String = eleDef.GetAttribute("Format") If sFormat.Length > 0 Then Select Case eleDef.GetAttribute("Format") Case "Preserve Line Feeds" sCaption = sCaption.Replace(vbCr, "").Replace(vbLf, "_rdBR_") Case "Expanded Spaces" sCaption = sCaption.Replace(" ", "_rdNBSP_") 'sCaption = sCaption.Replace(" ", " ") End Select If sFormat.Contains("@") _ AndAlso sFormat <> st.sReplaceTokens(sFormat) Then 'There are tokens. 10941 sFormat = "rdFormatLabel=""" & sTokenToXsl(sFormat, xslValueType.Attribute, True, True) & """ " '10941 Else 'Normal non-tokenized formats. sFormat = "rdFormatLabel=""" & rdUtility.HtmlEncode4(sFormat) & """ " End If End If Dim sFormula As String = "" If sCaption.StartsWith("=") Then 'The caption is a formula. The value is calculated post-XSL transformation. 'sCaption =rdUtility.HtmlEncode4(sCaption) Removed to handle quotes in @Data values. If HttpContext.Current.Application("rdScriptingLanguage") = "JavaScript" Then _ sCaption = sCaption.Replace("@RequestXmlEncoded.", "@RequestJScriptXml.") '16594 Dim sErrorResult As String = eleDef.GetAttribute("ErrorResult") If sErrorResult.Length <> 0 Then _ sCaption &= ":rdErrorResult=" & sErrorResult 'Append the error result to the forumula. sFormula = "rdFormula=""" & sTokenToXsl(sCaption.Substring(1), xslValueType.Attribute, True, True) & """ " sCaption = "rdFormulaValue" End If Dim sTooltip As String = "" If Not bExportCsv() Then 'If eleDef.GetAttribute("Tooltip").Length <> 0 Then ' sTooltip = sReturn & " TITLE=""" & sTokenToXsl(eleDef.GetAttribute("Tooltip"), xslValueType.Attribute, True) & """" 'End If sTooltip = sGetTooltipTitle(eleDef) End If Dim sInlineStyle As String = "" If Not bExportCsv() Then If eleDef.GetAttribute("InlineStyle").Length <> 0 Then sInlineStyle = sReturn & " STYLE=""" & sTokenToXsl(eleDef.GetAttribute("InlineStyle"), xslValueType.Attribute, True) & """" End If End If Dim sXsl As String = sTokenToXsl(sCaption, xslValueType.Element, True) If Not String.IsNullOrEmpty(sBindId) Then Dim sBindXsl As String = sTokenToXsl(sBindId, xslValueType.Attribute, True) sReturn = "" '22617 Else If String.IsNullOrEmpty(sHTMLTag) Then sReturn = "" & sXsl & "" Else sReturn = "<" & sHTMLTag & " " & sFormat & sFormula & sTooltip & sInlineStyle & ">" & sXsl & "" '22715 End If End If sReturn &= sSetTooltipPanel(eleDef) '#13993. If Not bExportCsv() And Not bExportExcel() Then 'For these exports, we don't need this, and this makes the resultant HTML much smaller. sReturn = sSetHtmlStyle(eleDef, sReturn) sReturn = sSetID(eleDef, sReturn) sReturn = sSetEventHandler(eleDef, sReturn) sReturn = sSetClass(eleDef, sReturn) sReturn = sSetQuicktip(eleDef, sReturn) '16382 If st.sGetRequestVar("rdReportFormat") <> "PDF" Then '13763 sReturn = sSetAction(eleDef, sReturn) End If sReturn = sSetPositioning(eleDef, sReturn) 'The position is applied to the link, instead of the span. This makes the "hand" cursor work. 'sReturn = sSetConditionalClass(eleDef, sReturn) End If If bExportExcel() Then sReturn = sSetClass(eleDef, sReturn) End If If sFormat = "rdFormatLabel=""HtmlNoWrap"" " Then sReturn = "" & sTokenToXsl(sCaption, xslValueType.Element, True) & "" End If 'This change causes too many problems in Javascript. Breaks backward compatibility. 16991 ''The span may be unnecessary. 'If http.Application("rdConstant-rdMinimizeSpans") <> "False" Then ' If sReturn.Contains("") Then ' 'Remove the empty span. ' sReturn = sReturn.Replace("", "") ' sReturn = sReturn.Replace("", "") ' ''17130 Commented because there is more work to do when removing these SPANs. There are other elements that depend on them. (Numbered InteractivePaging is one.) ' ''ElseIf sReturn.Contains("") Then ' '' 'Swap to a new custom element. ' '' sReturn = sReturn.Replace("", "") ' '' 'sReturn = sReturn.Replace("", "") ' '' sReturn = sReturn.Substring(0, sReturn.Length - 7) & "" ' End If 'End If Return sReturn End Function Private Function sProcess_LineBreak(ByRef eleDef As XmlElement) As String Dim sReturn As String = Nothing Dim iLines As Integer = 1 'Default value. Try If eleDef.HasAttribute("LineCount") Then iLines = eleDef.GetAttribute("LineCount") End If Catch : End Try Dim i As Integer For i = 1 To iLines sReturn = sReturn & "

    " Next Return sReturn End Function Private Function sProcess_PrinterPageBreak(ByRef eleDef As XmlElement) As String Dim sReturn As String = Nothing If http.Request("rdReportFormat") = "PDF" Then '19290 ' 19519 - on upgrade to v9 of abcpdf, adding the rdNBsp causes extra space on the page after the break, so use page-break-after to avoid that extra space. sReturn = sReturn & "

    rdNbsp

    " Else sReturn = sReturn & "

    " End If sReturn = sSetID(eleDef, sReturn) Return sReturn End Function Private Function sProcess_ExcelSheetBreak(ByRef eleDef As XmlElement) As String Dim sReturn As String = Nothing lgxLicense10.LicenseCheck(eleDef) 'If http.Session("rdProduct").IndexOf("Ent") = -1 Then _ ' Throw New Exception("The element """ & eleDef.Name & """ requires a Logi Info Server license.") 'sReturn = sReturn & "" sReturn = sSetID(eleDef, sReturn) Return sReturn End Function Private Function sProcess_PopupPanel(ByRef eleDef As XmlElement, ByVal sElementID As String) As String If sElementID.Length = 0 Then _ Throw New Exception("PopupPanels must have an ID value.") Dim xmlTemplate As XmlDocument = rdUtility.GetSuperElementTemplate("rdPopup/rdPopupPanelTemplate.lgx") Dim sTemplate As String = xmlTemplate.OuterXml sTemplate = sTemplate.Replace("rdPopupPanelID", sElementID) xmlTemplate.LoadXml(sTemplate) Dim eleTemplate As XmlElement = xmlTemplate.DocumentElement Dim s As String Dim h As String 's = eleDef.GetAttribute("ShowModes") 'If s.Length <> 0 Then _ ' xmlTemplate.DocumentElement.SetAttribute("ShowModes", s) s = eleDef.GetAttribute("Width") If s.Length <> 0 Then xmlTemplate.DocumentElement.SetAttribute("Width", "100") xmlTemplate.DocumentElement.SetAttribute("WidthScale", "%") End If h = eleDef.GetAttribute("Height") ' # 11508. If h.Length <> 0 Then xmlTemplate.DocumentElement.SetAttribute("Height", "100") xmlTemplate.DocumentElement.SetAttribute("HeightScale", "%") End If 'Class Dim sClass As String = eleDef.GetAttribute("Class") If sClass.Length <> 0 Then eleTemplate.SetAttribute("Class", eleTemplate.GetAttribute("Class") & " " & sClass) End If Dim sRdIdeIdx As String = eleDef.GetAttribute("rdIdeIdx") If Not String.IsNullOrEmpty(sRdIdeIdx) Then eleTemplate.SetAttribute("rdIdeIdx", sRdIdeIdx) End If 'Title bar / caption. Dim sCaption As String = eleDef.GetAttribute("Caption") If eleDef.GetAttribute("ID").Contains("rdTsActionBookmark") Then sCaption = " " 'sCaption = "Save a Thinkspace" End If If sCaption.Length <> 0 Then Dim eleCaptionLabel As XmlElement = xmlTemplate.SelectSingleNode("//Label[@ID='rdPopupPanelCaption']") eleCaptionLabel.SetAttribute("Caption", sCaption) Dim sCaptionClass As String = eleDef.GetAttribute("CaptionClass") If Not String.IsNullOrEmpty(sCaptionClass) Then eleCaptionLabel.SetAttribute("Class", sCaptionClass) End If 'Close "X" button. If eleDef.GetAttribute("HideCloseX") = "True" Then Dim eleCloseX As XmlElement = xmlTemplate.SelectSingleNode("//Label[@ID='rdPopupPanelX']") If Not IsNothing(eleCloseX) Then eleCloseX.ParentNode.RemoveChild(eleCloseX) End If Else 'Change the "X" to something else? Dim sCloseButtonCaption As String = eleDef.GetAttribute("CloseButtonCaption") If sCloseButtonCaption.Length <> 0 Then Dim eleCloseX As XmlElement = xmlTemplate.SelectSingleNode("//Label[@ID='rdPopupPanelX']") eleCloseX.SetAttribute("Caption", sCloseButtonCaption) End If 'Change the "X" caption's class? Dim sCloseButtonClass As String = eleDef.GetAttribute("CloseButtonClass") If sCloseButtonClass.Length <> 0 Then Dim eleCloseX As XmlElement = xmlTemplate.SelectSingleNode("//Label[@ID='rdPopupPanelX']") eleCloseX.SetAttribute("Class", sCloseButtonClass) End If 'Change the Action? This element, CloseAction, is unpublished. It's used by the OlapGrid/DimensionGrid. Dim eleCloseAction As XmlElement = eleDef.SelectSingleNode("CloseAction") If Not IsNothing(eleCloseAction) Then Dim eleCurrAction As XmlElement = xmlTemplate.SelectSingleNode("//Action[@ID='actionHidePanel']") If Not IsNothing(eleCurrAction) Then Dim eleNewAction As XmlElement = eleCloseAction.SelectSingleNode("Action") If Not IsNothing(eleNewAction) Then eleCurrAction.ParentNode.AppendChild(xmlTemplate.ImportNode(eleNewAction, True)) eleCurrAction.ParentNode.RemoveChild(eleCurrAction) End If End If End If End If Else 'Remove the whole title bar. Dim eleTitleBar As XmlElement = xmlTemplate.SelectSingleNode("//Row[@ID='rdPopupPanelTitle_" & sElementID & "']") If Not IsNothing(eleTitleBar) Then eleTitleBar.ParentNode.RemoveChild(eleTitleBar) End If End If 'ShowOnPageLoad - automatically show the popup panel when the page loads. Dim bShowOnPageLoad As Boolean = IIf(String.IsNullOrEmpty(st.sReplaceTokens(eleDef.GetAttribute("ShowOnPageLoad"))), False, st.sReplaceTokens(eleDef.GetAttribute("ShowOnPageLoad"))) If bShowOnPageLoad Then '#12957. subAddJavaEventFunction("rdBodyLoad", "ShowElement(this.id,'" & eleDef.GetAttribute("ID") & "','')") '#15472. End If 'Dim elePageLoadScript As XmlElement = xmlTemplate.SelectSingleNode("//IncludeHtml[@ID='rdShowOnPageLoad']") 'If Not IsNothing(elePageLoadScript) Then ' Dim sShowOnPageLoad As String = eleDef.GetAttribute("ShowOnPageLoad") ' If sShowOnPageLoad.Length = 0 Then ' 'Remove ShowOnPageLoad ' elePageLoadScript.ParentNode.RemoveChild(elePageLoadScript) ' Else ' 'Update ShowOnPageLoad if() with the value - especially in case it's a token like @Request.ShowMyPopup~. ' Dim sScript As String = elePageLoadScript.GetAttribute("Html") ' sScript = sScript.Replace("rdShowOnPageLoadValue", sShowOnPageLoad) ' elePageLoadScript.SetAttribute("Html", sScript) ' End If 'End If 'Copy panel content to the template. Dim eleContentDiv As XmlElement = xmlTemplate.SelectSingleNode("//Division[@ID='PopupPanelContent']") Dim nlContentElements As XmlNodeList = eleDef.SelectNodes("*") Do Until nlContentElements.Count = 0 Dim eleContentElement As XmlElement = nlContentElements(0) eleContentDiv.AppendChild(xmlTemplate.ImportNode(eleContentElement, True)) eleContentElement.ParentNode.RemoveChild(eleContentElement) '#10423 nlContentElements = eleDef.SelectNodes("*") Loop 'Script and CSS files: ''In order for the user to over-ride classes defined in this style sheet, ''the report's StyleSheet element must be after the Body element (really after this PopupPanel element). ''Fixes 3734. 'Dim od As XmlDocument = eleDef.OwnerDocument 'Dim eleStyleSheet As XmlElement = od.DocumentElement.AppendChild(od.CreateElement("StyleSheet")) 'eleStyleSheet.SetAttribute("StyleSheet", "rdTemplate/rdPopup/rdPopupPanel.css") 'Call sProcess_StyleSheet(eleStyleSheet) 'od.DocumentElement.RemoveChild(eleStyleSheet) 'sbHead.Insert(sbHead.ToString.IndexOf("") + 8, "") subAddIncludedCss("rdPopup/rdPopupPanel.css") '23824 'subAddIncludedScript("rdPopup/rdPopupPanel.js") 'subAddIncludedScript("rdActionShowElement.js") '11538 Dim sLocation As String = " rdLocation=""" & st.sGetAttribute(eleDef, "PopupPanelLocation", "Mouse").Replace(" ", "") & """" 'No tokens allowed for this. Dim sDraggable As String = "" If eleDef.GetAttribute("Draggable") = "True" Then 'No tokens allowed for this. If eleDef.GetAttribute("Caption").Length = 0 Then _ Throw New Exception("PopupPanel elements require a Caption attribute when Draggable=""True"".") sDraggable = " rdDraggable=""True""" End If 'Copy the template back into the main definition, get the XSL. Dim elePanel As XmlElement = eleDef.AppendChild(eleDef.OwnerDocument.ImportNode(xmlTemplate.DocumentElement, True)) ' Pass Condition on to child Rows Dim sCondition As String = eleDef.GetAttribute("Condition") If Not String.IsNullOrEmpty(sCondition) Then ' Apply condition to each Row Dim eleRows As XmlNodeList = elePanel.SelectNodes(".//Row") Dim sRowCondition As String For Each eleRow As XmlElement In eleRows sRowCondition = eleRow.GetAttribute("Condition") If String.IsNullOrEmpty(sRowCondition) Then sRowCondition = sCondition Else sRowCondition = String.Format("({0}) && ({1})", sCondition, sRowCondition) End If eleRow.SetAttribute("Condition", sRowCondition) Next End If Dim sPopupTable As String = sProcessDefinitionElement(elePanel) Dim sStyle As String = "display:none;" If eleDef.GetAttribute("Width").Length > 0 Then sStyle &= "width:" & eleDef.GetAttribute("Width") & st.sGetAttribute(eleDef, "WidthScale", "px") & ";" End If If eleDef.GetAttribute("Height").Length > 0 Then sStyle &= "height:" & eleDef.GetAttribute("Height") & st.sGetAttribute(eleDef, "HeightScale", "px") & ";" End If Dim sModal As String = "" Dim sModalShadeDiv As String = "" If eleDef.GetAttribute("PopupModal") = "True" Then 'No tokens allowed for this. sModal = " rdModal=""True""" Static bBeenHere As Boolean = False If Not bBeenHere Then sModalShadeDiv = "
    " '19705 End If End If Dim sReturn As String 'If eleDef.GetAttribute("FloatingPanel") = "True" Then ' Dim sFloatDirection As String = IIf(IsNothing(eleDef.GetAttribute("FloatDirection")), "Both", eleDef.GetAttribute("FloatDirection")) ' sReturn = "
    " 'Else Dim sNoElementShowHistory As String = String.Empty If eleDef.GetAttribute("rdNoElementShowHistory") = "True" Then '#14008. sNoElementShowHistory = " rdNoElementShowHistory=""True""" End If sReturn = "
    " 'End If sReturn = sSetID(eleDef, sReturn) sReturn = sSetClass(eleDef, sReturn) sReturn &= sPopupTable sReturn &= "
    " If eleDef.GetAttribute("rdDefinitionElement") = "TooltipPanel" Then '#14064. sReturn = sSetConditionalElement(eleDef, sReturn) End If If sModalShadeDiv.Length <> 0 Then _ sReturn = sModalShadeDiv & sReturn '#6327 There may be DataLayers or other elements that should be removed their original location. It's now all been processed from inside the template. eleDef.RemoveAll() eleDef.AppendChild(eleDef.OwnerDocument.ImportNode(elePanel, True)) ' Dont add if this is export to PDF... #10068 or excel #13336, HtmlEmail #23796, googlespreadsheet RD20220 If Array.IndexOf("PDF,NativeExcel,HtmlEmail,GoogleSpreadsheet".Split(","), st.sGetRequestVar("rdReportFormat")) <> -1 Then sReturn = "" End If Return sAddRdIdeIdx(eleDef, sReturn) End Function Private Function sProcess_TooltipPanel(ByRef eleDef As XmlElement, ByVal sElementID As String) As String If sElementID.Length = 0 Then _ Throw New Exception("TooltipPanels must have an ID value.") Dim eleTooltipParent As XmlElement = eleDef.ParentNode If String.IsNullOrEmpty(eleTooltipParent.GetAttribute("ID")) Then _ Throw New Exception("The parent element of a Tooltip Panel must have an ID value.") '#14048. Dim eleTooltipPanel As XmlElement = eleDef.OwnerDocument.CreateElement("PopupPanel") eleTooltipPanel.SetAttribute("rdDefinitionElement", "TooltipPanel") eleTooltipPanel.SetAttribute("rdNoElementShowHistory", "True") '#14008. eleTooltipPanel.SetAttribute("ID", sElementID) For Each atrTooltipAttributes As XmlAttribute In eleDef.Attributes eleTooltipPanel.SetAttribute(atrTooltipAttributes.Name, atrTooltipAttributes.Value) Next For Each eleTooltipChildNodes As XmlElement In eleDef.ChildNodes eleTooltipPanel.AppendChild(eleTooltipPanel.OwnerDocument.ImportNode(eleTooltipChildNodes.Clone, True)) Next eleDef.ParentNode.InsertAfter(eleTooltipPanel, eleDef) Dim eleOnMouseOverEventHandler As XmlElement = eleDef.OwnerDocument.CreateElement("EventHandler") eleOnMouseOverEventHandler.SetAttribute("DhtmlEvent", "onmouseover") Dim eleOnMouseOverAction As XmlElement = eleDef.OwnerDocument.CreateElement("Action") eleOnMouseOverAction.SetAttribute("Type", "ShowElement") eleOnMouseOverAction.SetAttribute("ElementID", sElementID) eleOnMouseOverAction.SetAttribute("ID", "Show" & sElementID) eleOnMouseOverAction.SetAttribute("Display", "Show") eleOnMouseOverEventHandler.AppendChild(eleOnMouseOverAction) Dim eleOnMouseOutEventHandler As XmlElement = eleDef.OwnerDocument.CreateElement("EventHandler") eleOnMouseOutEventHandler.SetAttribute("DhtmlEvent", "onmouseout") eleTooltipPanel.ParentNode.AppendChild(eleOnMouseOverEventHandler) Dim eleOnMouseOutAction As XmlElement = eleDef.OwnerDocument.CreateElement("Action") eleOnMouseOutAction.SetAttribute("Type", "ShowElement") eleOnMouseOutAction.SetAttribute("ElementID", sElementID) eleOnMouseOutAction.SetAttribute("ID", "Hide" & sElementID) eleOnMouseOutAction.SetAttribute("Display", "Hide") eleOnMouseOutEventHandler.AppendChild(eleOnMouseOutAction) eleTooltipPanel.ParentNode.AppendChild(eleOnMouseOutEventHandler) eleDef.RemoveAll() Return "" End Function Private Function sProcess_Rectangle(ByRef eleDef As XmlElement) As String Dim sReturn As String = Nothing sReturn = "
    " sReturn = sSetID(eleDef, sReturn) sReturn = sSetClass(eleDef, sReturn) sReturn = sSetPositioning(eleDef, sReturn) 'sReturn = sSetVisibility(eleDef, sReturn) sReturn = sReturn & sProcessDefinitionElementChildren(eleDef) sReturn = sReturn & "
    " Return sReturn End Function Private Function sProcess_Line(ByRef eleDef As XmlElement) As String Dim sReturn As String = Nothing sReturn = "" sReturn = sSetID(eleDef, sReturn) sReturn = sSetClass(eleDef, sReturn) sReturn = sSetPositioning(eleDef, sReturn) 'sReturn = sSetVisibility(eleDef, sReturn) sReturn = sReturn & "" Return sReturn End Function Private Function sProcess_SpaceForBorders(ByRef eleDef As XmlElement) As String 'Undocumented element that can insert a space when a data column is missing or has no value. 'It's initial purpose is for the AnalysisGrid. Dim sReturn As String = Nothing Dim sDataColumn As String = eleDef.GetAttribute("DataColumn") If sDataColumn.Length = 0 Then _ Throw New Exception("SpaceForBorders elements require a DataColumn attribute.") sReturn = "" & util.XSLCompliant(" ") & "" '8140 - Added XmlConvert.EncodeLocalName() Return sReturn End Function Private Function sProcess_Spaces(ByRef eleDef As XmlElement) As String Dim sReturn As String = Nothing Dim sSpaces As String = eleDef.GetAttribute("Size") If sSpaces.Length = 0 Then sSpaces = "1" If IsNumeric(sSpaces) Then Dim iSpaces As Integer = CInt(sSpaces) sReturn = "" Dim i As Integer For i = 1 To iSpaces sReturn = sReturn & util.XSLCompliant(" ") Next sReturn = sReturn & "" Else 'sSpaces may be a token. Change to a Label with a formula. Dim eleLabel As XmlElement = eleDef.OwnerDocument.CreateElement("Label") eleLabel.SetAttribute("Caption", "=IIF(IsNumeric(""" & sSpaces & """), String(0" & sSpaces & ","" ""),"""")") sReturn = sProcessDefinitionElement(eleLabel) End If sReturn = sSetPositioning(eleDef, sReturn) Return sReturn End Function Private Function sProcess_DataCalendar(ByRef eleDef As XmlElement, ByVal sElementID As String) As String Dim sReturn As String = Nothing mbDontCacheXsl = True '#17103. Dim od As XmlDocument = eleDef.OwnerDocument If eleDef.GetAttribute("ID").Length = 0 Then Throw New Exception("DataCalendars must have an ID value.") End If ' To handle the multiple instances of the DataCalendar in the dashboard If Not String.IsNullOrEmpty(eleDef.GetAttribute("DashBoardGUID")) And Not eleDef.GetAttribute("ID").Contains(eleDef.GetAttribute("DashBoardGUID")) Then eleDef.SetAttribute(("ID"), eleDef.GetAttribute("ID") & "_" & eleDef.GetAttribute("DashBoardGUID")) End If Dim sDatePickerID As String = eleDef.GetAttribute("ID") 'Get a date that will be shown in the calendar. Dim sMonth As String = String.Empty Dim sYear As String = String.Empty Dim sDay As String = String.Empty Dim sCalendarDate As String = String.Empty Dim sDateFormat As String = eleDef.GetAttribute("DateFormat") ' Maurice 17Aug12 #17452 - Check for query string parameter with new selected date. If String.IsNullOrEmpty(st.sGetRequestVar("rdDataCalendarDate")) Then sCalendarDate = st.sGetAttribute(eleDef, "DataCalendarDate") Else sCalendarDate = st.sGetRequestVar("rdDataCalendarDate") End If ' 19484 be mindful of browser vs OS culture If Not String.IsNullOrEmpty(sCalendarDate) Then Dim dCalendarDate As Date = Nothing If Not String.IsNullOrEmpty(sDateFormat) Then Try dCalendarDate = Date.ParseExact(sCalendarDate, sDateFormat, System.Globalization.CultureInfo.InvariantCulture) sMonth = dCalendarDate.Month sYear = dCalendarDate.Year sDay = dCalendarDate.Day Catch ex As Exception dCalendarDate = Nothing End Try End If If dCalendarDate = Nothing Then Try rdInternational.SetCulture(CultureType.CULTURE_BROWSER) 'Add Culture Settings. sMonth = CDate(sCalendarDate).Month sYear = CDate(sCalendarDate).Year sDay = CDate(sCalendarDate).Day Catch ex As Exception sCalendarDate = String.Empty Finally rdInternational.SetCulture(CultureType.CULTURE_INVARIANT) 'Add Culture Settings. End Try End If End If If Not eleDef.GetAttribute("UserInputDate").Length = 0 Then Try If eleDef.GetAttribute("UserInputDate").Length >= 3 Then sCalendarDate = CDate(eleDef.GetAttribute("UserInputDate")) Else sCalendarDate = String.Empty End If Catch ex As Exception sCalendarDate = String.Empty End Try End If If sCalendarDate.Length = 0 Then sCalendarDate = Today End If If eleDef.GetAttribute("UserInputDate").Length = 0 Then If HttpContext.Current.Request("IpMonthInputSelectList_" & sDatePickerID) <> Nothing Then sMonth = HttpContext.Current.Request("IpMonthInputSelectList_" & sDatePickerID).ToString.Split(",")(0) '#10931 sYear = HttpContext.Current.Request("IpYearInputSelectList_" & sDatePickerID).ToString.Split(",")(0) sDay = "01" End If Else End If If String.IsNullOrEmpty(sYear) Then sYear = CDate(sCalendarDate).Year End If If String.IsNullOrEmpty(sMonth) Then sMonth = CDate(sCalendarDate).Month End If If String.IsNullOrEmpty(sDay) Then sDay = "01" End If If sMonth.Length <> 0 Then If sYear.Length <> 0 Then sCalendarDate = CDate(sMonth & "/" & sDay & "/" & sYear).ToString("MM/dd/yyyy") Else '25884 sCalendarDate = CDate(sMonth & "/" & sDay & "/" & DateTime.Now.Year).ToString("MM/dd/yyyy") End If Else If sYear.Length <> 0 Then sCalendarDate = CDate(DateTime.Now.Month & "/" & sDay & "/" & sYear).ToString("MM/dd/yyyy") End If End If Dim dtCalendarDate As DateTime = DateTime.Now If sCalendarDate.Contains(".") Then sCalendarDate = sCalendarDate.Replace(".", "/") 'Issue with German Language as the date contains ".", the following block defaults the date to the current day. End If If sCalendarDate.Length <> 0 Then If Not rdUtility.isFormattableDateValue(st.sReplaceTokens(sCalendarDate), dtCalendarDate) Then dtCalendarDate = DateTime.Now End If End If Dim dicJulianHolder As Dictionary(Of String, String) = New Dictionary(Of String, String) 'Container for holding the JulianDay numbers. Dim sCurrentElement As String = eleDef.GetAttribute("CurrentElement") 'Variable to hold the name of the Code calling Parent Element. Dim sCalendarElementsCheck As String = IIf(String.IsNullOrEmpty(sCurrentElement), "", sCurrentElement) ' variable used to check if this Code call is from Calendar elements. Dim sCalendarHeightVariable1 As String = String.Empty ' Variables used for adjusting the calendar Height, Used below in the Calendar height manipulation block. Dim sCalendarHeightVariable2 As String = String.Empty Dim sCalendarHeightVariable3 As String = String.Empty Dim sCalendarCount As String = String.Empty Dim sTimePeriod As String = String.Empty If String.IsNullOrEmpty(sCalendarElementsCheck) Then sTimePeriod = st.sGetAttribute(eleDef, "TimePeriod", "Month") Else sTimePeriod = st.sGetAttribute(eleDef, "NumberOfMonths", "Month") End If If sTimePeriod = "2Months" Then sCalendarCount = "2" If sTimePeriod = "3Months" Then sCalendarCount = "3" If String.IsNullOrEmpty(sCalendarCount) Then sCalendarCount = "1" End If Dim aWeekdayFilter() As String = st.sGetAttribute(eleDef, "WeekdayFilter", "0,1,2,3,4,5,6").Replace(" ", "").Split(",") Dim nFirstDayOfWeek As Integer = http.Application("rdConstant-FirstDayOfWeek") Dim bCalendarPaging As Boolean = False Dim bRerunDlForPaging As Boolean = False Dim bCalendarIsBeingPaged As Boolean = False Dim eleCalendarPaging As XmlElement = eleDef.SelectSingleNode("DataCalendarPaging") If IsNothing(eleCalendarPaging) And (sCurrentElement = "InputDate" Or sCurrentElement = "DatePicker") Then eleCalendarPaging = od.CreateElement("DataCalendarPaging") eleCalendarPaging.SetAttribute("RerunDataLayer", "False") eleCalendarPaging.SetAttribute("AjaxPaging", "True") eleCalendarPaging.SetAttribute("DropdownYearAndMonth", IIf(String.IsNullOrEmpty(eleDef.GetAttribute("DropdownYearAndMonth")), "False", eleDef.GetAttribute("DropdownYearAndMonth"))) End If If Not IsNothing(eleCalendarPaging) Then bCalendarPaging = True bRerunDlForPaging = CBool(st.sGetAttribute(eleCalendarPaging, "RerunDataLayer", "False")) ' Note: Check for this request variable below before running in to the code block as "rdDataCalendarDate" variable gets passed through every time (since rdRequestForwarding is True), once the Calendar paging (<, > controls) is used. ' Added link params for the dropdowns to pass "rdCalendarDropdownPaging" variable through. If this resolves to true, skip the code below. ' If the code blow is not skipped, and when dropdown paging is used, the calendar will not page, it will stay with the last date passed through the "rdDataCalendarDate" variable by the Calendar paging (<, > controls). If Not st.sGetRequestVar("rdCalendarDropdownPaging") = "True" Then If rdUtility.isFormattableDateValue(st.sGetRequestVar("rdDataCalendarDate"), dtCalendarDate) Then 'This may replace the date with a new date from calendar paging. bCalendarIsBeingPaged = True sMonth = dtCalendarDate.Month sYear = dtCalendarDate.Year sDay = dtCalendarDate.Day End If Else bCalendarIsBeingPaged = True End If End If Dim eleDataLayer As XmlElement = Nothing Dim xmlData As XmlDocument = Nothing Dim sDataCacheKey As String = String.Empty If String.IsNullOrEmpty(sCalendarElementsCheck) Then Dim sDataColumn As String = st.sGetAttribute(eleDef, "DataColumn") If sDataColumn.Length = 0 Then _ Throw New Exception("DataColumn attribute is required for " & eleDef.Name & " elements.") 'Issue 11210 - remove rdDb from build. eleDataLayer = _db9.GetDataLayer(eleDef) 'Add a column for the date. We use it below Dim eleCalcDay As XmlElement = eleDataLayer.AppendChild(od.CreateElement("CalculatedColumn")) eleCalcDay.SetAttribute("ID", "rdDataCalendarDate") eleCalcDay.SetAttribute("Formula", "Left(""@Data." & sDataColumn & "~"",10)") 'Get the data. Dim streamData As System.IO.Stream = Nothing sDataCacheKey = st.sGetRequestVar("rdCalDataCache") If bCalendarIsBeingPaged And Not bRerunDlForPaging Then Dim xmlDataLayersInfo As XmlDocument = Nothing If st.bGetCachedDataSet9(streamData, xmlDataLayersInfo, sDataCacheKey, xmlSettings) Then xmlData = New XmlDocument xmlData.Load(streamData) End If End If If IsNothing(xmlData) Then 'Run the DataLayer. Dim db9 As New rdDb9(xmlSettings, dbug) streamData = db9.xmlGetData(eleDef, "DataLayer") xmlData = New XmlDocument xmlData.Load(streamData) 'For paging, cache the DataLayer. If bCalendarPaging _ And Not bRerunDlForPaging Then _ sDataCacheKey = st.sCacheDataset9(streamData, db9.rdDataLayersInfoXml, xmlSettings) End If End If 'This DataLayer is no longer wanted, or it will get rerun. If Not IsNothing(eleDataLayer) Then eleDef.RemoveChild(eleDataLayer) Dim bCalendarHasDataRows As Boolean Dim eleDayTableTemplate As XmlElement = Nothing Dim eleCalendarDayAction As XmlElement = Nothing Dim eleCalendarDay As XmlElement = Nothing 'Create the DataTable template that will be copied for each day. If String.IsNullOrEmpty(sCalendarElementsCheck) Then bCalendarHasDataRows = False eleDayTableTemplate = od.CreateElement("DataTable") eleDayTableTemplate.SetAttribute("ID", "DayTable") 'This ID gets changed below with each current day. eleDayTableTemplate.SetAttribute("Class", "rdDataCalendarRows") eleCalendarDay = eleDef.SelectSingleNode("DataCalendarDay") If IsNothing(eleCalendarDay) Then _ Throw New Exception("The DataCalendarDay element is required for DataCalendar elements.") eleCalendarDayAction = eleCalendarDay.SelectSingleNode("Action") Dim eleDataTableColumn As XmlElement = eleDayTableTemplate.AppendChild(od.CreateElement("DataTableColumn")) For Each atr As XmlAttribute In eleCalendarDay.Attributes eleDataTableColumn.SetAttribute(atr.Name, atr.Value) Next For Each eleDayContent As XmlElement In eleCalendarDay.SelectNodes("DataCalendarRows/*") eleDataTableColumn.AppendChild(eleDayContent.CloneNode(True)) bCalendarHasDataRows = True Next 'Add the DataLayer for each day. Dim eleDayDataLayer As XmlElement = eleDayTableTemplate.AppendChild(od.CreateElement("DataLayer")) eleDayDataLayer.SetAttribute("ID", "DataLayer") 'This ID gets changed below with each current day. eleDayDataLayer.SetAttribute("Type", "Static") Else bCalendarHasDataRows = True eleDayTableTemplate = od.CreateElement("Rows") eleDayTableTemplate.SetAttribute("ID", "DayTable") 'This ID gets changed below with each current day. eleDayTableTemplate.SetAttribute("Class", "rdDataCalendarRows") eleCalendarDay = od.CreateElement("Row") eleDayTableTemplate.AppendChild(od.CreateElement("Column")) End If 'Make the main Calendar table. Dim eleCalendarHolder As XmlElement = od.CreateElement("Rows") eleCalendarHolder.SetAttribute("ID", sDatePickerID) eleCalendarHolder.SetAttribute("Class", st.sGetAttribute(eleDef, "Class")) ' # 10785. eleCalendarHolder.SetAttribute("CellSpacing", "0") Dim eleRowUnderCalendarHolder As XmlElement = eleCalendarHolder.AppendChild(od.CreateElement("Row")) Dim eleCalendarHolderColumn1 As XmlElement Dim eleCalendarHolderColumn2 As XmlElement Dim eleCalendarHolderColumn3 As XmlElement Dim nCalendarNumber As Integer Dim eleMainRows As XmlElement ' This loop handles the creation of multiple months in the calendar For nCalendarNumber = 1 To CInt(sCalendarCount) If nCalendarNumber > 1 Then dtCalendarDate = dtCalendarDate.AddMonths(1) End If If nCalendarNumber = 1 Then eleCalendarHolderColumn1 = eleRowUnderCalendarHolder.AppendChild(od.CreateElement("Column")) eleMainRows = eleCalendarHolderColumn1.AppendChild(od.CreateElement("Rows")) ElseIf nCalendarNumber = 2 Then eleCalendarHolderColumn2 = eleRowUnderCalendarHolder.AppendChild(od.CreateElement("Column")) eleMainRows = eleCalendarHolderColumn2.AppendChild(od.CreateElement("Rows")) ElseIf nCalendarNumber = 3 Then eleCalendarHolderColumn3 = eleRowUnderCalendarHolder.AppendChild(od.CreateElement("Column")) eleMainRows = eleCalendarHolderColumn3.AppendChild(od.CreateElement("Rows")) End If eleMainRows.SetAttribute("Class", "rdDataCalendar") eleMainRows.SetAttribute("CellSpacing", IIf(String.IsNullOrEmpty(eleDef.GetAttribute("CellSpacing")), "1", eleDef.GetAttribute("CellSpacing"))) If Not IsNothing(eleDef.Attributes("TableBorder")) Then _ eleMainRows.SetAttribute("TableBorder", eleDef.GetAttribute("TableBorder")) If Not IsNothing(eleDef.Attributes("Layout")) Then _ eleMainRows.SetAttribute("Layout", eleDef.GetAttribute("Layout")) If eleDef.Name = "DataCalendar" AndAlso String.IsNullOrEmpty(eleDef.GetAttribute("Layout")) Then eleMainRows.SetAttribute("Layout", "Fixed") ' # 11633. End If If Not IsNothing(eleDef.Attributes("Width")) Then _ eleMainRows.SetAttribute("Width", eleDef.GetAttribute("Width")) If Not IsNothing(eleDef.Attributes("WidthScale")) Then _ eleMainRows.SetAttribute("WidthScale", eleDef.GetAttribute("WidthScale")) 'Calendar Caption. Dim sDefaultCaptionFormat As String = IIf(sTimePeriod = "Week", "d", "yyyy MMMM") 'Different format for Monthly or Weekly calendar. Dim sCalendarCaptionFormat As String = st.sGetAttribute(eleDef, "CalendarCaptionFormat", sDefaultCaptionFormat) Dim eleCaptionRow As XmlElement Dim eleCaptionCell As XmlElement If sCalendarCaptionFormat.ToLower <> "none" Then eleCaptionRow = eleMainRows.AppendChild(od.CreateElement("Row")) eleCaptionCell = eleCaptionRow.AppendChild(od.CreateElement("Column")) eleCaptionCell.SetAttribute("ColSpan", aWeekdayFilter.Length) eleCaptionCell.SetAttribute("Class", "rdDataCalendarCaption") eleCaptionCell.SetAttribute("ID", "Cal-" & nCalendarNumber & "-CaptionCell") rdInternational.SetCulture(CultureType.CULTURE_BROWSER) 'Add Culture Settings. Dim sMonthFormat As String = IIf(String.IsNullOrEmpty(ParseCalendarCaptionFormat(sCalendarCaptionFormat).Split(",")(0)), "MMMM", ParseCalendarCaptionFormat(sCalendarCaptionFormat).Split(",")(0)) Dim sYearFormat As String = IIf(String.IsNullOrEmpty(ParseCalendarCaptionFormat(sCalendarCaptionFormat).Split(",")(1)), "yyyy", ParseCalendarCaptionFormat(sCalendarCaptionFormat).Split(",")(1)) Dim sDropdownAlignment As String = IIf(String.IsNullOrEmpty(ParseCalendarCaptionFormat(sCalendarCaptionFormat).Split(",")(2)), "RegularAlignment", ParseCalendarCaptionFormat(sCalendarCaptionFormat).Split(",")(2)) 'Add the dropdown list for year and month in to the Calendar Header. Dim nDropdownYears As Integer = IIf(String.IsNullOrEmpty(eleDef.GetAttribute("NumberOfDropdownYears")), 20, st.sGetAttribute(eleDef, "NumberOfDropdownYears")) '#12125. Dim YearsList As IList(Of String) = New List(Of String) Dim YearsFormattedList As Dictionary(Of String, String) = New Dictionary(Of String, String) Dim sCurrentYr As String = DateTime.Now.ToString(sYearFormat) If sYear <> sCurrentYr Then sCurrentYr = sYear End If Dim y As Integer For y = sCurrentYr - Math.Floor(nDropdownYears / 2) To sCurrentYr + Math.Floor(nDropdownYears / 2) If sYearFormat.Length = 2 Then YearsList.Add(y.ToString.Substring(2)) YearsFormattedList.Add(y.ToString.Substring(2), y) Else YearsList.Add(y) YearsFormattedList.Add(y, y) End If Next Dim aMonthsValueList As String() = New String() {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"} Dim nDateTimeMonth As Integer = DateTime.Now.Month Dim q As Integer = 12 - nDateTimeMonth Dim dtDateTimeNowForMonthDropdown As DateTime = Date.Now.AddMonths(q + 1) Dim MonthsList As IList(Of String) = New List(Of String) MonthsList.Add(dtDateTimeNowForMonthDropdown.ToString(sMonthFormat)) Dim m As Integer For m = 1 To 11 dtDateTimeNowForMonthDropdown = dtDateTimeNowForMonthDropdown.AddMonths(1) MonthsList.Add(dtDateTimeNowForMonthDropdown.ToString(sMonthFormat)) Next rdInternational.SetCulture(CultureType.CULTURE_INVARIANT) 'Revert the Culture Settings. Dim eleCalendarYearDropdown As XmlElement = od.CreateElement("InputSelectList") eleCalendarYearDropdown.SetAttribute("ID", "IpYearInputSelectList_" & sDatePickerID) eleCalendarYearDropdown.SetAttribute("OptionCaptionColumn", "Year") eleCalendarYearDropdown.SetAttribute("OptionValueColumn", "YearValue") eleCalendarYearDropdown.SetAttribute("DefaultValue", YearsFormattedList(IIf(sYearFormat.Length = 2, sYear.Substring(2), sYear))) eleCalendarYearDropdown.SetAttribute("Class", "rdDataCalendarDropdown") Dim eleYearStaticDataLayer As XmlElement = eleCalendarYearDropdown.AppendChild(od.CreateElement("DataLayer")) eleYearStaticDataLayer.SetAttribute("Type", "Static") eleYearStaticDataLayer.SetAttribute("ID", "dlYearStaticInputSelectList_" & sDatePickerID) Dim z As Integer For z = 0 To YearsList.Count - 1 Dim eleStaticDataRow As XmlElement = eleYearStaticDataLayer.AppendChild(od.CreateElement("StaticDataRow")) eleStaticDataRow.SetAttribute("Year", YearsList(z)) eleStaticDataRow.SetAttribute("YearValue", YearsFormattedList(YearsList(z))) Next Dim eleYearEventHandler As XmlElement = eleCalendarYearDropdown.AppendChild(od.CreateElement("EventHandler")) eleYearEventHandler.SetAttribute("DhtmlEvent", "onchange") Dim eleYearEventRefreshElement As XmlElement = eleYearEventHandler.AppendChild(od.CreateElement("Action")) eleYearEventRefreshElement.SetAttribute("ID", "actYearrefresh_" & sDatePickerID) eleYearEventRefreshElement.SetAttribute("Type", "CalendarRefreshElement") eleYearEventRefreshElement.SetAttribute("ElementID", eleDef.GetAttribute("InputDateEleID") & "," & sDatePickerID) Dim eleYearEventRefreshElementLinkParams As XmlElement = eleYearEventRefreshElement.AppendChild(od.CreateElement("LinkParams")) eleYearEventRefreshElementLinkParams.SetAttribute("rdCalendarDropdownPaging", "True") '#12422. Dim eleCalendarMonthDropdown As XmlElement = od.CreateElement("InputSelectList") eleCalendarMonthDropdown.SetAttribute("ID", "IpMonthInputSelectList_" & sDatePickerID) eleCalendarMonthDropdown.SetAttribute("OptionCaptionColumn", "Month") eleCalendarMonthDropdown.SetAttribute("OptionValueColumn", "Value") eleCalendarMonthDropdown.SetAttribute("DefaultValue", sMonth) eleCalendarMonthDropdown.SetAttribute("Class", "rdDataCalendarDropdown") Dim eleMonthStaticDataLayer As XmlElement = eleCalendarMonthDropdown.AppendChild(od.CreateElement("DataLayer")) eleMonthStaticDataLayer.SetAttribute("Type", "Static") eleMonthStaticDataLayer.SetAttribute("ID", "dlMonthStaticInputSelectList_" & sDatePickerID) Dim i As Integer For i = 0 To UBound(aMonthsValueList) Dim eleStaticDataRow As XmlElement = eleMonthStaticDataLayer.AppendChild(od.CreateElement("StaticDataRow")) eleStaticDataRow.SetAttribute("Month", MonthsList(i)) eleStaticDataRow.SetAttribute("Value", aMonthsValueList(i)) Next Dim eleMonthEventHandler As XmlElement = eleCalendarMonthDropdown.AppendChild(od.CreateElement("EventHandler")) eleMonthEventHandler.SetAttribute("DhtmlEvent", "onchange") Dim eleMonthEventRefreshElement As XmlElement = eleMonthEventHandler.AppendChild(od.CreateElement("Action")) eleMonthEventRefreshElement.SetAttribute("ID", "actMonthrefresh_" & sDatePickerID) eleMonthEventRefreshElement.SetAttribute("Type", "CalendarRefreshElement") eleMonthEventRefreshElement.SetAttribute("ElementID", eleDef.GetAttribute("InputDateEleID") & "," & sDatePickerID) Dim eleMonthEventRefreshElementLinkParams As XmlElement = eleMonthEventRefreshElement.AppendChild(od.CreateElement("LinkParams")) eleMonthEventRefreshElementLinkParams.SetAttribute("rdCalendarDropdownPaging", "True") '#12422. If sDropdownAlignment.Contains("Month") Then ' # 11100 eleCaptionCell.AppendChild(eleCalendarMonthDropdown) eleCaptionCell.AppendChild(eleCalendarYearDropdown) Else eleCaptionCell.AppendChild(eleCalendarYearDropdown) eleCaptionCell.AppendChild(eleCalendarMonthDropdown) End If 'Paging If bCalendarPaging Then Call subInsertDataCalendarPagingControl(eleCalendarPaging, IIf(sDropdownAlignment.Contains("Month"), eleCalendarMonthDropdown, eleCalendarYearDropdown), "<", eleDef.GetAttribute("InputDateEleID") & "," & sDatePickerID, dtCalendarDate, sTimePeriod, aWeekdayFilter.Length, sDataCacheKey) Call subInsertDataCalendarPagingControl(eleCalendarPaging, IIf(sDropdownAlignment.Contains("Month"), eleCalendarYearDropdown, eleCalendarMonthDropdown), ">", eleDef.GetAttribute("InputDateEleID") & "," & sDatePickerID, dtCalendarDate, sTimePeriod, aWeekdayFilter.Length, sDataCacheKey) End If rdInternational.SetCulture(CultureType.CULTURE_BROWSER) 'Add Culture Settings. Dim eleCalendarCaptionLabel As XmlElement = od.CreateElement("Label") eleCalendarCaptionLabel.SetAttribute("Caption", dtCalendarDate.ToString(sCalendarCaptionFormat)) 'dtCalendarDate.Year & " " & dtCalendarDate.ToString("MMMM")) If IsNothing(eleCalendarPaging) And eleDef.Name = "DataCalendar" Then ' #11099 eleCaptionCell.RemoveAll() eleCaptionCell.AppendChild(eleCalendarCaptionLabel) eleCaptionCell.SetAttribute("ColSpan", aWeekdayFilter.Length) eleCaptionCell.SetAttribute("Class", "rdDataCalendarCaption") End If ' XML manipulation to place the dropdowns properly If Not IsNothing(eleCalendarPaging) Then If Not CBool(IIf(eleCalendarPaging.GetAttribute("DropdownYearAndMonth") = Nothing, True, eleCalendarPaging.GetAttribute("DropdownYearAndMonth"))) Or Not nCalendarNumber = 1 Then 'Dim CaptionCellNode As XmlNode = CType(eleCaptionRow, XmlNode) eleCaptionCell.AppendChild(eleCalendarCaptionLabel) If nCalendarNumber = 1 Then eleCaptionCell.InsertAfter(eleCalendarCaptionLabel, eleCaptionCell.ChildNodes.ItemOf(1)) eleCaptionCell.RemoveChild(eleCaptionCell.ChildNodes.ItemOf(3)) eleCaptionCell.RemoveChild(eleCaptionCell.ChildNodes.ItemOf(3)) End If If nCalendarNumber > 1 Then eleCaptionCell.RemoveAll() eleCaptionCell.SetAttribute("ColSpan", aWeekdayFilter.Length) eleCaptionCell.SetAttribute("Class", "rdDataCalendarCaption") eleCaptionCell.SetAttribute("ID", "Cal-" & nCalendarNumber & "-CaptionCell") eleCaptionCell.AppendChild(eleCalendarCaptionLabel) End If End If End If End If 'Weekday Captions. Dim dtCurr As DateTime Dim eleFirstWeekday As XmlElement = Nothing Dim sWeekdayCaptionFormat As String = st.sGetAttribute(eleDef, "WeekdayCaptionFormat", "dddd") If Not String.IsNullOrEmpty(sCalendarElementsCheck) Then sWeekdayCaptionFormat = st.sGetAttribute(eleDef, "WeekdayCaptionFormat", "dd") If sWeekdayCaptionFormat.ToLower <> "none" Then Dim eleWeekdayCaptionRow As XmlElement = eleMainRows.AppendChild(od.CreateElement("Row")) eleWeekdayCaptionRow.SetAttribute("ID", "rdWeekdayCaptionRow_" & sElementID) eleWeekdayCaptionRow.SetAttribute("Class", "rdDataCalendarWeekdayCaption") dtCurr = dtCalendarDate.AddDays(dtCalendarDate.DayOfWeek * -1 + nFirstDayOfWeek) Do While True If Array.IndexOf(aWeekdayFilter, CStr(dtCurr.DayOfWeek)) <> -1 Then Dim eleWeekdayCaptionCell As XmlElement = eleWeekdayCaptionRow.AppendChild(od.CreateElement("Column")) Dim eleWeekdayCaptionLabel As XmlElement = eleWeekdayCaptionCell.AppendChild(od.CreateElement("Label")) If sWeekdayCaptionFormat.ToString().ToLower().Trim() = "dd" Then 'Had to change the write label caption method to support internationalization as the previous does not work with culture settings 'eleWeekdayCaptionLabel.SetAttribute("Caption", CultureInfo.CurrentCulture.DateTimeFormat.DayNames(CInt(dtCurr.DayOfWeek)).Substring(0, 3)) 'eleWeekdayCaptionLabel.SetAttribute("Caption", CultureInfo.CurrentCulture.DateTimeFormat.AbbreviatedDayNames(CInt(dtCurr.DayOfWeek))) eleWeekdayCaptionLabel.SetAttribute("Caption", dtCurr.ToString("dddd").Substring(0, 1)) ElseIf sWeekdayCaptionFormat.ToString().ToLower().Trim() = "ddd" Or sWeekdayCaptionFormat.ToString().ToLower().Trim() = "dddd" Then eleWeekdayCaptionLabel.SetAttribute("Caption", dtCurr.ToString(sWeekdayCaptionFormat.ToString().ToLower().Trim())) 'eleWeekdayCaptionLabel.SetAttribute("Caption", CultureInfo.CurrentCulture.DateTimeFormat.DayNames(CInt(dtCurr.DayOfWeek))) Else Throw New Exception("Enter a Proper format for Weekday Caption Format") End If If IsNothing(eleFirstWeekday) Then eleFirstWeekday = eleWeekdayCaptionLabel End If dtCurr = dtCurr.AddDays(1) If dtCurr.DayOfWeek = nFirstDayOfWeek Then _ Exit Do Loop End If Select Case sTimePeriod Case "Week" dtCurr = New DateTime(dtCalendarDate.Year, dtCalendarDate.Month, dtCalendarDate.Day) Case Else '"Month" dtCurr = New DateTime(dtCalendarDate.Year, dtCalendarDate.Month, 1) 'Go to the first day of the month. End Select 'Back up to the first day of the week. Dim nBackupDays As Integer = dtCurr.DayOfWeek * -1 + nFirstDayOfWeek If nBackupDays > 0 Then nBackupDays -= 7 '#8871 dtCurr = dtCurr.AddDays(nBackupDays) Dim eleWeekRow As XmlElement = Nothing Do While True 'Add a new week? If dtCurr.DayOfWeek = nFirstDayOfWeek Then eleWeekRow = eleMainRows.AppendChild(od.CreateElement("Row")) End If If Array.IndexOf(aWeekdayFilter, CStr(dtCurr.DayOfWeek)) <> -1 Then 'Add a new day. Dim eleDayColumn As XmlElement = eleWeekRow.AppendChild(od.CreateElement("Column")) 'Today? eleDayColumn.SetAttribute("Class", "rdDataCalendarDay") If dtCalendarDate.Date.CompareTo(dtCurr.Date) = 0 Then eleDayColumn.SetAttribute("Class", eleDayColumn.GetAttribute("Class") & " rdDataCalendarDate") 'This is the date specified by the calendar element. End If If Today.Date.CompareTo(dtCurr.Date) = 0 Then _ eleDayColumn.SetAttribute("Class", eleDayColumn.GetAttribute("Class") & " rdDataCalendarToday") 'This is the current day today. ' Note: Call to st.sGetAttribute returns the thread to Invariant Culture. 'Added the CSS class to indicate the user selected day If Not st.sGetAttribute(eleDef, "DataCalendarDate").Length = 0 Then Try If CDate(st.sGetAttribute(eleDef, "DataCalendarDate")).Date.CompareTo(dtCurr.Date) = 0 Then eleDayColumn.SetAttribute("Class", eleDayColumn.GetAttribute("Class") & " rdDataCalendarDayLabelHighlight") 'This is the selected day/user provided date. End If Catch ex As Exception End Try ElseIf Not eleDef.GetAttribute("UserInputDate").Length = 0 Then rdInternational.SetCulture(CultureType.CULTURE_INVARIANT) 'Revert Culture Settings. Try If CDate(eleDef.GetAttribute("UserInputDate")).Date.CompareTo(dtCurr.Date) = 0 Then eleDayColumn.SetAttribute("Class", eleDayColumn.GetAttribute("Class") & " rdDataCalendarDayLabelHighlight") 'This is the selected day/user provided date. End If Catch ex As Exception End Try rdInternational.SetCulture(CultureType.CULTURE_BROWSER) 'Add Culture Settings. End If Try ' # 11206 If Not st.sGetAttribute(eleDef, "EndDateDefaultValue").Length = 0 And Not st.sGetAttribute(eleDef, "DataCalendarDate").Length = 0 Then _ If CDate(st.sGetAttribute(eleDef, "EndDateDefaultValue")).Date.CompareTo(dtCurr.Date) >= 0 And CDate(st.sGetAttribute(eleDef, "DataCalendarDate")).Date.CompareTo(dtCurr.Date) <= 0 Then _ eleDayColumn.SetAttribute("Class", eleDayColumn.GetAttribute("Class") & " rdDataCalendarDayLabelHighlight") 'Highlight the DateRange provided.. Catch ex As Exception End Try ' Note: Need to set Culture to that of the browser at this point as the st.sGetAttribute calls happen to/may return the Thread to Invariant culture, # 11503. rdInternational.SetCulture(CultureType.CULTURE_BROWSER) 'Add Culture Settings. If dtCurr.Month = dtCalendarDate.Month OrElse sTimePeriod = "Week" Then 'Special handling for ConditionalClasses in a CalendarDay element. If Not IsNothing(eleCalendarDay) Then For Each eleCondClass As XmlElement In eleCalendarDay.SelectNodes("ConditionalClass") 'Dim eleTodaysData As XmlElement = xmlData.SelectSingleNode("//*[@rdCalendarDay='" & dtCurr.Day & "']") 'Get just the first row for this day. Dim eleTodaysData As XmlElement = xmlData.SelectSingleNode("//*[@rdDataCalendarDate='" & String.Format("{0:yyyy-MM-dd}", dtCurr) & "']") 'Get just the first row for this day. If Not IsNothing(eleTodaysData) Then Dim evl As New rdScriptEvaluator() Dim sCondition As String = st.sReplaceTokens(eleCondClass.GetAttribute("Condition"), , eleTodaysData, evl.ScriptingLanguage) If CBool(evl.Eval(sCondition, "False")) Then eleDayColumn.SetAttribute("Class", eleCondClass.GetAttribute("Class")) End If End If Next End If 'Day number. Dim sDayCaptionFormat As String = st.sGetAttribute(eleDef, "DayCaptionFormat", "%d") rdInternational.SetCulture(CultureType.CULTURE_INVARIANT) 'Revert Culture Settings. ' Note: Set the culture to Invariant for the DataCalendar Day label as the date formatting is done in XSL and it cannot handle culture settings, #12393. If sDayCaptionFormat.ToLower <> "none" Then Dim eleDayLabel As XmlElement = eleDayColumn.AppendChild(od.CreateElement("Label")) eleDayLabel.SetAttribute("Caption", dtCurr.ToString()) eleDayLabel.SetAttribute("Format", sDayCaptionFormat) eleDayLabel.SetAttribute("ID", "lblDayNo_" & dtCurr.Day) eleDayLabel.SetAttribute("Class", "rdDataCalendarDayCaption") If Not IsNothing(eleCalendarDayAction) Then 'Dim eleTodaysData As XmlElement = xmlData.SelectSingleNode("//*[@rdCalendarDay='" & dtCurr.Day & "']") 'Get just the first row for this day. Dim eleTodaysData As XmlElement = xmlData.SelectSingleNode("//*[@rdDataCalendarDate='" & String.Format("{0:yyyy-MM-dd}", dtCurr) & "']") 'Get just the first row for this day. If Not IsNothing(eleTodaysData) Then Dim eleLabelAction As XmlElement = eleDayLabel.AppendChild(eleCalendarDayAction.CloneNode(True)) st.ReplaceTokensInElement(eleLabelAction, , eleTodaysData) End If End If End If ' Set the culture back to that of the browser after the day label value is set. rdInternational.SetCulture(CultureType.CULTURE_BROWSER) 'Add Culture Settings. 'Data Table goes here. If bCalendarHasDataRows Then Dim eleDayTable As XmlElement = eleDayColumn.AppendChild(eleDayTableTemplate.CloneNode(True)) If eleDef.Name = "DatePicker" Then eleDayTable.SetAttribute("Class", "rdHidden") ElseIf eleDef.Name = "DataCalendar" Then '23824 'Call subAddIncludedScript("rdCalendar/rdDatePicker.js") 'DatePicker Javascript file Call subAddJavaEventFunction("rdBodyLoad", "rdOnLoadUserProvidedDataCalendarDateColoring(""" & eleDef.GetAttribute("ID") & """)") ' # 11641. End If 'Dim Date2Julian As Integer = Math.Floor((1461 * (dtCurr.Year + 4800 + (dtCurr.Month - 14) / 12)) / 4 + (367 * (dtCurr.Month - 2 - 12 * ((dtCurr.Month - 14) / 12))) / 12 - (3 * ((dtCurr.Year + 4900 + (dtCurr.Month - 14) / 12) / 100)) / 4 + dtCurr.Day - 32075) Dim nDate2Julian As Double = (1461 * (dtCurr.Year + 4800 + (dtCurr.Month - 14) / 12)) / 4 + (367 * (dtCurr.Month - 2 - 12 * ((dtCurr.Month - 14) / 12))) / 12 - (3 * ((dtCurr.Year + 4900 + (dtCurr.Month - 14) / 12) / 100)) / 4 + dtCurr.Day - 32075 ' Made the Date2Julian a Double as the integer rounds to the same value for Dec 31 and jan 1st of the next year thereby causing issues. 'Update the IDs for the DataTable and all the elements below to make them unique for the current day. If nCalendarNumber = 1 Then For Each atrID As XmlAttribute In eleDayTable.SelectNodes("..//@ID | ..//@ElementID") If atrID.Name = "ElementID" Then If IsNothing(eleDayTable.SelectSingleNode(".//*[@ID='" & atrID.Value & "']")) Then Continue For End If End If atrID.Value = sDatePickerID & "_" & "rdCalDay_" & dtCurr.Day & "_" & atrID.Value Next dicJulianHolder.Add(sDatePickerID & "_" & "rdCalDay_" & dtCurr.Day & "_DayTable", nDate2Julian) ElseIf nCalendarNumber = 2 Then For Each atrID As XmlAttribute In eleDayTable.SelectNodes("..//@ID | ..//@ElementID") If atrID.Name = "ElementID" Then If IsNothing(eleDayTable.SelectSingleNode(".//*[@ID='" & atrID.Value & "']")) Then Continue For End If End If atrID.Value = sDatePickerID & "_" & "Cal2_rdCalDay_" & dtCurr.Day & "_" & atrID.Value Next dicJulianHolder.Add(sDatePickerID & "_" & "Cal2_rdCalDay_" & dtCurr.Day & "_DayTable", nDate2Julian) Else For Each atrID As XmlAttribute In eleDayTable.SelectNodes("..//@ID | ..//@ElementID") If atrID.Name = "ElementID" Then If IsNothing(eleDayTable.SelectSingleNode(".//*[@ID='" & atrID.Value & "']")) Then Continue For End If End If atrID.Value = sDatePickerID & "_" & "Cal3_rdCalDay_" & dtCurr.Day & "_" & atrID.Value Next dicJulianHolder.Add(sDatePickerID & "_" & "Cal3_rdCalDay_" & dtCurr.Day & "_DayTable", nDate2Julian) End If 'Add the the static DataLayer rows for the current day. Dim eleDl As XmlElement = eleDayTable.SelectSingleNode("DataLayer") If Not IsNothing(eleDl) Then For Each eleRow As XmlElement In xmlData.SelectNodes("//*[@rdDataCalendarDate='" & String.Format("{0:yyyy-MM-dd}", dtCurr) & "']") Dim eleStaticDataRow As XmlElement = eleDl.AppendChild(od.CreateElement("StaticDataRow")) For Each atr As XmlAttribute In eleRow.Attributes eleStaticDataRow.SetAttribute(atr.Name, atr.Value) Next Next End If If Not String.IsNullOrEmpty(sCalendarElementsCheck) Then If nCalendarNumber = 1 Then eleDayColumn.SetAttribute("ID", sDatePickerID & "_" & "rdCalDay-Holder_" & dtCurr.Day & "_DayTable") If nCalendarNumber = 2 Then eleDayColumn.SetAttribute("ID", sDatePickerID & "_" & "Cal2_rdCalDay-Holder_" & dtCurr.Day & "_DayTable") If nCalendarNumber = 3 Then eleDayColumn.SetAttribute("ID", sDatePickerID & "_" & "Cal3_rdCalDay-Holder_" & dtCurr.Day & "_DayTable") Dim eleLabelLink As XmlElement = eleDayColumn.AppendChild(od.CreateElement("Label")) eleLabelLink.SetAttribute("Caption", dtCurr.Day) eleLabelLink.SetAttribute("Class", "rdDataCalendarDayLabel") eleLabelLink.SetAttribute("ID", "lbl_Day_" & dtCurr.Day) Dim eleDayAction As XmlElement = eleLabelLink.AppendChild(od.CreateElement("Action")) eleDayAction.SetAttribute("Type", "Link") eleDayAction.SetAttribute("ID", "actInsertDates") eleDayAction.SetAttribute("Class", "rdDataCalendarDayLabel") '#12136. Dim eleDayTarget As XmlElement = eleDayAction.AppendChild(od.CreateElement("Target")) eleDayTarget.SetAttribute("Type", "Link") eleDayTarget.SetAttribute("ID", "tgtInsertDates") Dim sClientDisplayDate As String = String.Empty If Not String.IsNullOrEmpty(sDateFormat) Then If Not sDateFormat = "rdShortDate" Then sClientDisplayDate = dtCurr.Date.ToString(sDateFormat) '.Replace(",", "") Else sClientDisplayDate = dtCurr.Date.ToShortDateString() End If Else sClientDisplayDate = dtCurr.Date.ToShortDateString() End If If CBool(eleDef.GetAttribute("ShowDateRange")) Then eleDayTarget.SetAttribute("Link", "javascript:rdInsertDates(""" & eleDef.GetAttribute("StartDateElementID") & """,""" & eleDef.GetAttribute("EndDateElementID") & """,""" & Regex.Replace(dtCurr.Date.ToString("MM/dd/yyyy"), "[,.-]", "/") & """,""" & dtCurr.Day & """,""" & sClientDisplayDate & """,""" & nCalendarNumber & """,""" & sDatePickerID & """)") Else eleDayTarget.SetAttribute("Link", "javascript:rdInsertSingleDate(""" & eleDef.GetAttribute("StartDateElementID") & """,""" & eleDef.GetAttribute("PopUpID") & """,""" & Regex.Replace(dtCurr.Date.ToString("MM/dd/yyyy"), "[,.-]", "/") & """,""" & dtCurr.Day & """,""" & sClientDisplayDate & """,""" & nCalendarNumber & """,""" & sDatePickerID & """)") End If End If Else 'No data rows. This calandar just shows the days, no content. eleDayColumn.AppendChild(od.CreateElement("Spaces")) End If Else 'This day is outside the current month. eleDayColumn.SetAttribute("Class", "rdDataCalendarDayOutsideMonth") eleDayColumn.AppendChild(od.CreateElement("Spaces")) End If End If 'WeekdayFilter dtCurr = dtCurr.AddDays(1) 'Done? Select Case sTimePeriod Case "Week" If dtCurr.DayOfWeek = nFirstDayOfWeek Then _ Exit Do Case Else '"Month" If dtCurr.Month <> dtCalendarDate.Month _ AndAlso dtCurr.DayOfWeek = nFirstDayOfWeek Then _ Exit Do End Select Loop rdInternational.SetCulture(CultureType.CULTURE_INVARIANT) 'Revert the Culture Settings. 'XML Manipulation to make the calendars of equal Height, Add an extra empty Row if any of the month does have only 6 rows If CInt(sCalendarCount) > 1 Then If nCalendarNumber = 1 Then sCalendarHeightVariable1 = eleCalendarHolderColumn1.ChildNodes.ItemOf(0).ChildNodes.Count If CInt(sCalendarHeightVariable1) < 7 Then subInsertExtraRow_DataCalendar(eleCalendarHolderColumn1.ChildNodes.ItemOf(0), od, "") End If End If If nCalendarNumber = 2 Then sCalendarHeightVariable2 = eleCalendarHolderColumn2.ChildNodes.ItemOf(0).ChildNodes.Count If CInt(sCalendarHeightVariable2) < 7 Then subInsertExtraRow_DataCalendar(eleCalendarHolderColumn2.ChildNodes.ItemOf(0), od, "") End If End If If nCalendarNumber = 3 Then sCalendarHeightVariable3 = eleCalendarHolderColumn3.ChildNodes.ItemOf(0).ChildNodes.Count If CInt(sCalendarHeightVariable3) < 7 Then subInsertExtraRow_DataCalendar(eleCalendarHolderColumn3.ChildNodes.ItemOf(0), od, "") End If End If End If Next 'XML Manipulation to make the calendars of equal Height, Add an extra empty Row to the rest of the displayed months if any of the month does have 8 rows Dim sSample As String = sCalendarHeightVariable1 & "," & sCalendarHeightVariable2 & "," & sCalendarHeightVariable3 If (sSample.Contains("8")) And CInt(sCalendarCount) > 1 Then Dim RowsList As String() = sSample.Split(",") Dim L As Integer For L = 0 To UBound(RowsList) Dim eleRowNode As XmlNode If L = 0 Then If Not String.IsNullOrEmpty(RowsList(L).ToString.Trim()) Then eleRowNode = eleCalendarHolderColumn1.ChildNodes.ItemOf(0) subInsertExtraRow_DataCalendar(eleRowNode, od, RowsList(L)) End If End If If L = 1 Then If Not String.IsNullOrEmpty(RowsList(L).ToString.Trim()) Then eleRowNode = eleCalendarHolderColumn2.ChildNodes.ItemOf(0) subInsertExtraRow_DataCalendar(eleRowNode, od, RowsList(L)) End If End If If L = 2 Then If Not String.IsNullOrEmpty(RowsList(L).ToString.Trim()) Then eleRowNode = eleCalendarHolderColumn3.ChildNodes.ItemOf(0) subInsertExtraRow_DataCalendar(eleRowNode, od, RowsList(L)) End If End If Next End If Dim eleDefOriginal As XmlElement = eleDef.CloneNode(True) '14254 - let's keep original definition eleDef.RemoveAll() eleDef.AppendChild(eleCalendarHolder) 'Put the new DataLayers in with the report definition so they are run later. If dbug.DebuggingEnabled Then _ dbug.AddDebugMessage("DataCalendar", "Generated", "View Definition", eleMainRows) plugin.CallPlugins_GeneratedElement(eleMainRows, eleDefOriginal) '14254 - Call Plugins from more places - ElementPluginCall If Not IsNothing(eleDefOriginal.ParentNode) Then eleDefOriginal.ParentNode.RemoveChild(eleDefOriginal) '14254 clenup End If If sCurrentElement = "InputDate" Then xmlDef.SelectSingleNode("//InputDate").AppendChild(eleCalendarHolder) End If sReturn = sProcessDefinitionElement(eleCalendarHolder) ' Adds a variable used in the Ajax2.js file If Not String.IsNullOrEmpty(sCalendarElementsCheck) Then sReturn = sReturn.Insert(sReturn.IndexOf("TABLE") + 5, " rdElementIdentifier=""Calendar"" ") End If ' Adding the julian date to the HTML for the javascript coloring 'If Not CBool(sElementUnderADataTable) Then Dim s As Integer Dim p As Integer Dim sKey As String For p = 1 To 3 For s = 1 To 31 If p = 1 Then sKey = sDatePickerID & "_" & "rdCalDay_" & s & "_DayTable" If p = 2 Then sKey = sDatePickerID & "_" & "Cal2_rdCalDay_" & s & "_DayTable" If p = 3 Then sKey = sDatePickerID & "_" & "Cal3_rdCalDay_" & s & "_DayTable" If dicJulianHolder.ContainsKey(sKey) Then sReturn = sReturn.Insert(sReturn.IndexOf("id=" & ControlChars.Quote & sKey & ControlChars.Quote), " JulianDate=""" & dicJulianHolder(sKey).Replace(",", ".") & """" & " ") 'to handle the OnLoad Coloring for the PopupCalendar/DatePicker. End If Next Next 'sbHead.Insert(sbHead.ToString.IndexOf("") + 8, "") subAddIncludedCss("rdCalendar/rdDataCalendarStyle.css") Return sReturn End Function Private Function ParseCalendarCaptionFormat(ByVal Format As String) As String ' Helper function to align the Calendar Month/Year paging Dropdowns and split the Calendar Caption Format. Dim sMonthFormat As String = String.Empty Dim sYearFormat As String = String.Empty Dim sDropdownAlignment As String = String.Empty Dim sSeperator As Char() = {".", "/", "-", " "} Dim sFormat As String() = Format.Split(sSeperator) Dim i As Integer For i = 0 To UBound(sFormat) If sFormat(i).ToLower.Contains("m") Then sDropdownAlignment = "MonthDropdownFirst" Exit For ElseIf sFormat(i).ToLower.Contains("y") Then sDropdownAlignment = "YearDropdownFirst" Exit For End If Next For i = 0 To UBound(sFormat) If sFormat(i).ToLower.Contains("m") Then sMonthFormat = sFormat(i).ToString If sMonthFormat.Length < 2 Then sMonthFormat = "MMMM" End If ElseIf sFormat(i).ToLower.Contains("y") Then sYearFormat = sFormat(i).ToString End If Next Return sMonthFormat & "," & sYearFormat & "," & sDropdownAlignment End Function Private Sub subInsertExtraRow_DataCalendar(ByVal ColumnNode As XmlNode, ByVal XDoc As XmlDocument, ByVal Variable As String) If String.IsNullOrEmpty(Variable) Then Dim eleExtraRow As XmlElement = ColumnNode.InsertAfter(XDoc.CreateElement("Row"), ColumnNode.LastChild) Dim q As Integer For q = 1 To 7 Dim eleExtraRowColumn As XmlElement = eleExtraRow.AppendChild(XDoc.CreateElement("Column")) eleExtraRowColumn.SetAttribute("Class", "rdDataCalendarDayOutsideMonth") eleExtraRowColumn.AppendChild(XDoc.CreateElement("Spaces")) Next ElseIf CInt(Variable) < 8 Then Dim eleExtraRow As XmlElement = ColumnNode.InsertAfter(XDoc.CreateElement("Row"), ColumnNode.LastChild) Dim q As Integer For q = 1 To 7 Dim eleExtraRowColumn As XmlElement = eleExtraRow.AppendChild(XDoc.CreateElement("Column")) eleExtraRowColumn.SetAttribute("Class", "rdDataCalendarDayOutsideMonth") eleExtraRowColumn.AppendChild(XDoc.CreateElement("Spaces")) Next End If End Sub Private Function sProcess_InputDateCalendar(ByRef eleDef As XmlElement, ByVal sElementID As String) As String Return "" End Function Private Function sProcess_DatePicker(ByRef eleDef As XmlElement, ByVal sElementID As String) As String ' 16583 If String.IsNullOrEmpty(eleDef.GetAttribute("SkipLicenseCheck")) And Not eleDef.GetAttribute("ID").Contains("DpForInputDate") Then ' lgxLicense10.LicenseCheck(eleDef) 'End If Dim sReturn As String = Nothing If eleDef.GetAttribute("ID").Length = 0 Then Throw New Exception("Date Picker element must have an ID.") End If If Not String.IsNullOrEmpty(eleDef.GetAttribute("DashBoardGUID")) And Not eleDef.GetAttribute("ID").Contains(eleDef.GetAttribute("DashBoardGUID")) Then eleDef.SetAttribute("ID", eleDef.GetAttribute("ID") & "_" & eleDef.GetAttribute("DashBoardGUID")) eleDef.SetAttribute("EndDateRangeID", eleDef.GetAttribute("EndDateRangeID") & "_" & eleDef.GetAttribute("DashBoardGUID")) ' To handle multiple instances in the dashboard. End If Dim sInputDateReformat As String = eleDef.GetAttribute("InputDateReformat") If sInputDateReformat.Length = 0 Then sInputDateReformat = IIf(IsNothing(http.Application("rdConstant-DefaultDateReformat")), "", http.Application("rdConstant-DefaultDateReformat")) If eleDef.GetAttribute("StartDateElementID").Length = 0 Then Dim eleDatePickerHiddenOne As XmlElement = xmlDef.CreateElement("InputHidden") If Not String.IsNullOrEmpty(eleDef.GetAttribute("DefaultValue")) Then eleDatePickerHiddenOne.SetAttribute("DefaultValue", eleDef.GetAttribute("DefaultValue")) eleDef.SetAttribute("DataCalendarDate", eleDef.GetAttribute("DefaultValue")) Else eleDatePickerHiddenOne.SetAttribute("DefaultValue", "") 'Today.ToString("MM/dd/yyyy")) End If eleDatePickerHiddenOne.SetAttribute("ID", eleDef.GetAttribute("ID")) ' Need to revisit this issue. eleDef.SetAttribute("StartDateElementID", eleDef.GetAttribute("ID")) 'eleDef.AppendChild(eleDatePickerHiddenOne) sReturn = sProcessDefinitionElement(eleDatePickerHiddenOne) End If If eleDef.GetAttribute("ShowDateRange").Length = 0 Then eleDef.SetAttribute("ShowDateRange", "False") ElseIf CBool(eleDef.GetAttribute("ShowDateRange")) Then If eleDef.GetAttribute("EndDateElementID").Length = 0 Then Dim eleDatePickerHiddenTwo As XmlElement = xmlDef.CreateElement("InputHidden") If Not String.IsNullOrEmpty(eleDef.GetAttribute("EndDateDefaultValue")) Then eleDatePickerHiddenTwo.SetAttribute("DefaultValue", eleDef.GetAttribute("EndDateDefaultValue")) Else eleDatePickerHiddenTwo.SetAttribute("DefaultValue", "") ' Today.ToString("MM/dd/yyyy")) End If If eleDef.GetAttribute("EndDateRangeID").Length = 0 Then Throw New Exception("EndDate must have an ID value.") eleDatePickerHiddenTwo.SetAttribute("ID", eleDef.GetAttribute("EndDateRangeID")) eleDef.SetAttribute("EndDateElementID", eleDef.GetAttribute("EndDateRangeID")) 'eleDef.AppendChild(eleDatePickerHiddenTwo) sReturn &= sProcessDefinitionElement(eleDatePickerHiddenTwo) Dim eleEndDateReformat As XmlElement = xmlDef.CreateElement("InputHidden") eleEndDateReformat.SetAttribute("ID", "rdReformatDate" & eleDef.GetAttribute("EndDateRangeID")) eleEndDateReformat.SetAttribute("DefaultValue", sInputDateReformat) eleDef.AppendChild(eleEndDateReformat) sReturn &= sProcessDefinitionElement(eleEndDateReformat) End If End If If Not IsNothing(sInputDateReformat) Then Dim eleReformat As XmlElement = xmlDef.CreateElement("InputHidden") eleReformat.SetAttribute("ID", "rdReformatDate" & eleDef.GetAttribute("ID")) eleReformat.SetAttribute("DefaultValue", sInputDateReformat) eleDef.AppendChild(eleReformat) sReturn &= sProcessDefinitionElement(eleReformat) End If If eleDef.GetAttribute("DropdownYearAndMonth").Length = 0 Then eleDef.SetAttribute("DropdownYearAndMonth", "True") eleDef.SetAttribute("DayCaptionFormat", "None") eleDef.SetAttribute("DateFormat", eleDef.GetAttribute("DateFormat").Trim()) 'Date Format from the InputDate Element. If Not String.IsNullOrEmpty(eleDef.GetAttribute("CurrentElement")) Then eleDef.SetAttribute("CurrentElement", eleDef.GetAttribute("CurrentElement")) Else eleDef.SetAttribute("CurrentElement", "DatePicker") End If 'If Not String.IsNullOrEmpty(eleDef.GetAttribute("AjaxRefresh")) Then '23824 'Call subAddIncludedScript("rdCalendar/rdDatePicker.js") 'DatePicker Javascript file If Not eleDef.GetAttribute("ID").Contains("DpForInputDate") Then ' To handle the code call from Inputdate element versus the straight DatePicker element. 'If Not String.IsNullOrEmpty(eleDef.GetAttribute("RowIdentifierValue")) Then 'eleDef.SetAttribute("ID", eleDef.GetAttribute("ID") & "_rdDatePickerElement" & eleDef.GetAttribute("RowIdentifierValue")) 'Else eleDef.SetAttribute("ID", eleDef.GetAttribute("ID") & "_rdDatePickerElement") 'End If Call subAddJavaEventFunction("rdBodyLoad", "rdOnLoadJavascriptAddition(""" & eleDef.GetAttribute("ID") & """)") sElementID = eleDef.GetAttribute("ID") Else 'If Not String.IsNullOrEmpty(eleDef.GetAttribute("RowIdentifierValue")) Then 'eleDef.SetAttribute("ID", eleDef.GetAttribute("ID") & eleDef.GetAttribute("RowIdentifierValue")) 'Call subAddJavaEventFunction("rdBodyLoad", "rdOnLoadJavascriptAddition(""" & eleDef.GetAttribute("ID").Substring(0, CInt(eleDef.GetAttribute("ID").LastIndexOf(eleDef.GetAttribute("RowIdentifierValue")))) & """); ") 'Else Call subAddJavaEventFunction("rdBodyLoad", "rdOnLoadJavascriptAddition(""" & eleDef.GetAttribute("ID") & """); ") 'End If End If Call subProcessInputValidationElements(eleDef) sReturn &= sProcess_DataCalendar(eleDef, sElementID) ' Do not include Date picker html for excel and word exports #10767, #10768 If st.sGetRequestVar("rdReportFormat") = "NativeExcel" Or st.sGetRequestVar("rdReportFormat") = "NativeWord" Then sReturn = "" End If Return sReturn End Function Private Function sProcess_InputDate(ByRef eleDef As XmlElement, ByVal sElementID As String) As String Dim sReturn As String = Nothing If sElementID.Length = 0 Then _ Throw New Exception("InputDate elements must have an ID value.") If sElementID.IndexOf("-") <> -1 Then _ Throw New Exception("The ID of an InputDate element must not contain a dash character.") If Not String.IsNullOrEmpty(eleDef.GetAttribute("DashBoardGUID")) And Not eleDef.GetAttribute("ID").Contains(eleDef.GetAttribute("DashBoardGUID")) Then eleDef.SetAttribute(("ID"), eleDef.GetAttribute("ID") & "_" & eleDef.GetAttribute("DashBoardGUID")) eleDef.SetAttribute("EndDateRangeID", eleDef.GetAttribute("EndDateRangeID") & "_" & eleDef.GetAttribute("DashBoardGUID")) ' Added to handle the multiple instances in the Dashboards. End If Dim bElementUnderDataTable As Boolean = False Dim bAjaxrefresh As Boolean = IIf(String.IsNullOrEmpty(eleDef.GetAttribute("AjaxRefresh")), False, True) If bUnderDataRepeater(eleDef) Then bElementUnderDataTable = True 'If sChangeFlagElementID.Length <> 0 Then '# 11046 ' bElementUnderDataTable = True 'End If End If Dim sInputDate As String = st.sGetRequestVar("rdInputDateValue") 'User Input date, retreived by Ajax onblur 'Build an InputText element, by renaming the current element to InputText and re-running this function. Dim eleInputText As XmlElement = xmlDef.CreateElement("InputText") eleInputText.SetAttribute("rdInputDate", "True") 'eleDef.SetAttribute("InputSize", "10") Dim atr As XmlAttribute For Each atr In eleDef.Attributes eleInputText.SetAttribute(atr.Name, atr.Value) Next If Not String.IsNullOrEmpty(sInputDate) Then eleInputText.SetAttribute("DefaultValue", sInputDate) End If 'eleInputText.SetAttribute("DefaultValue", "@Request.SelectedDate~") Dim sDateFormat As String = st.sGetAttribute(eleInputText, "Format") If sDateFormat.Length = 0 Then sDateFormat = http.Application("rdConstant-DefaultDateFormat") 'If IsNothing(sDateFormat) Then sDateFormat = "M/d/yyyy" 'Default value. If IsNothing(sDateFormat) Then sDateFormat = rdInternational.GetSpecificBrowserDateFormat("Short Date") 'rdInternational.SetCulture(CultureType.CULTURE_BROWSER) 'Add Culture settings. 'If IsNothing(sDateFormat) Then sDateFormat = rdInternational.GetSpecificBrowserDateFormat("Short Date") 'To handle internationalization 'rdInternational.SetCulture(CultureType.CULTURE_INVARIANT) 'Add Culture settings. If sDateFormat = "Short Date" Then '18659 sDateFormat = rdInternational.GetSpecificBrowserDateFormat("Short Date") End If eleInputText.SetAttribute("Format", sDateFormat) For Each eleEventHandler As XmlElement In eleDef.SelectNodes("EventHandler") '#8940 eleInputText.AppendChild(eleEventHandler.CloneNode(True)) Next eleDef.ParentNode.AppendChild(eleInputText) sReturn = sProcessDefinitionElement(eleInputText) eleInputText.ParentNode.RemoveChild(eleInputText) 'Adding an input Hidden field to handle the internationalization issues with dates, field holds the date in culture invariant format Dim eleHiddenDateHolder As XmlElement = xmlDef.CreateElement("InputHidden") eleHiddenDateHolder.SetAttribute("ID", eleDef.GetAttribute("ID") & "_Hidden") If String.IsNullOrEmpty(sInputDate) Then eleHiddenDateHolder.SetAttribute("DefaultValue", eleDef.GetAttribute("DefaultValue")) End If eleDef.AppendChild(eleHiddenDateHolder) Dim sHiddenInputDate As String = sProcessDefinitionElement(eleHiddenDateHolder) sReturn = sReturn.Insert(sReturn.LastIndexOf("") + 8, sHiddenInputDate) Dim sInputDateReformat As String = st.sGetAttribute(eleInputText, "InputDateReformat") If sInputDateReformat.Length = 0 Then sInputDateReformat = IIf(IsNothing(http.Application("rdConstant-DefaultDateReformat")), Nothing, http.Application("rdConstant-DefaultDateReformat")) If Not (eleDef.GetAttribute("ShowDateRange").Length = 0) Then If CBool(eleDef.GetAttribute("ShowDateRange")) Then Dim eleNewLine As XmlElement = xmlDef.CreateElement("Spaces") 'eleDef.ParentNode.AppendChild(eleNewLine) Dim eleSecondDateCaption As XmlElement = xmlDef.CreateElement("Label") eleSecondDateCaption.SetAttribute("ID", "EndDateRangeCaption") eleSecondDateCaption.SetAttribute("Caption", eleDef.GetAttribute("EndDateRangeCaption")) eleSecondDateCaption.SetAttribute("Class", eleDef.GetAttribute("CaptionClass")) Dim eleEndDateInputText As XmlElement = xmlDef.CreateElement("InputText") eleEndDateInputText.SetAttribute("ID", eleDef.GetAttribute("EndDateRangeID")) If String.IsNullOrEmpty(eleDef.GetAttribute("EndDateRangeID")) Then Throw New Exception("EndDate must have an ID value.") End If eleEndDateInputText.SetAttribute("Class", eleDef.GetAttribute("Class")) eleEndDateInputText.SetAttribute("InputSize", eleDef.GetAttribute("InputSize")) eleEndDateInputText.SetAttribute("Tooltip", eleDef.GetAttribute("Tooltip")) eleEndDateInputText.SetAttribute("SaveInCookie", eleDef.GetAttribute("SaveInCookie")) eleEndDateInputText.SetAttribute("DefaultValue", eleDef.GetAttribute("EndDateDefaultValue")) eleEndDateInputText.SetAttribute("ChangeFlagElementID", eleDef.GetAttribute("ChangeFlagElementID")) eleEndDateInputText.SetAttribute("Format", sDateFormat) eleEndDateInputText.SetAttribute("SecurityRightID", eleDef.GetAttribute("SecurityRightID")) For Each eleEventHandler As XmlElement In eleDef.SelectNodes("EventHandler") eleEndDateInputText.AppendChild(eleEventHandler.CloneNode(True)) Next Dim eleSpace As XmlElement = xmlDef.CreateElement("Spaces") Dim sNewLine As String = sProcessDefinitionElement(eleNewLine) Dim sSecondDateCaption As String = sProcessDefinitionElement(eleSecondDateCaption) Dim sEndDateInputText As String If CBool(bElementUnderDataTable) Then eleDef.ParentNode.AppendChild(eleEndDateInputText) sEndDateInputText = sProcessDefinitionElement(eleEndDateInputText) eleEndDateInputText.ParentNode.RemoveChild(eleEndDateInputText) Else sEndDateInputText = sProcessDefinitionElement(eleEndDateInputText) End If Dim sSpaces As String = sProcessDefinitionElement(eleSpace) Dim sHiddenEndDateInputReformat As String = String.Empty If Not String.IsNullOrEmpty(sInputDateReformat) Then Dim eleEndDateReformat As XmlElement = xmlDef.CreateElement("InputHidden") eleEndDateReformat.SetAttribute("ID", "rdReformatDate" & eleDef.GetAttribute("EndDateRangeID")) eleEndDateReformat.SetAttribute("DefaultValue", sInputDateReformat) eleDef.AppendChild(eleEndDateReformat) sHiddenEndDateInputReformat = sProcessDefinitionElement(eleEndDateReformat) End If 'eleEndDateInputText.ParentNode.RemoveChild(eleEndDateInputText) sReturn = sReturn.Insert(sReturn.LastIndexOf("") + 8, sNewLine & " " & sHiddenEndDateInputReformat & " " & sSecondDateCaption & " " & sEndDateInputText & " " & sSpaces) End If Else eleDef.SetAttribute("ShowDateRange", "False") End If 'If sInputDateReformat.Length = 0 Then sInputDateReformat = http.Application("rdConstant-DefaultDateReformat") If Not IsNothing(sInputDateReformat) Then Dim eleReformat As XmlElement = xmlDef.CreateElement("InputHidden") eleReformat.SetAttribute("ID", "rdReformatDate" & eleDef.GetAttribute("ID")) eleReformat.SetAttribute("DefaultValue", sInputDateReformat) eleDef.AppendChild(eleReformat) Dim sHiddenInputReformat As String = sProcessDefinitionElement(eleReformat) If sDateFormat.Length <> 0 Then Dim eleFormat As XmlElement = xmlDef.CreateElement("InputHidden") eleFormat.SetAttribute("ID", "rdDateFormat" & eleDef.GetAttribute("ID")) eleFormat.SetAttribute("DefaultValue", sDateFormat) eleDef.AppendChild(eleFormat) sHiddenInputReformat &= sProcessDefinitionElement(eleFormat) End If sReturn = sReturn.Insert(sReturn.LastIndexOf("") + 8, sHiddenInputReformat) Else 'Set the output format the old way. If there is a date validation, use the server's culture. If Not IsNothing(eleDef.SelectSingleNode("Validation[@Type='Date']")) Then Dim eleDeLocalize As XmlElement = xmlDef.CreateElement("InputHidden") eleDeLocalize.SetAttribute("ID", "rdDeLocalize" & eleDef.GetAttribute("ID")) eleDeLocalize.SetAttribute("DefaultValue", "Date") eleDef.AppendChild(eleDeLocalize) Dim sHiddenInputDeLocalize As String = sProcessDefinitionElement(eleDeLocalize) sReturn = sReturn.Insert(sReturn.LastIndexOf("") + 8, sHiddenInputDeLocalize) End If End If Call subProcessInputValidationElements(eleDef) 'Add the calendar link? If eleDef.GetAttribute("CalendarLink").Length <> 0 Or eleDef.GetAttribute("CalendarLinkType") = "Image" Then If Not bExportReport() Then 'Add the image, or text, that links to the calendar. Dim eleCaption As XmlElement If eleDef.GetAttribute("CalendarLinkType") = "Image" Then eleCaption = xmlDef.CreateElement("Image") eleCaption.SetAttribute("Class", "rdDataCalendarImage") If eleDef.GetAttribute("CalendarLink").Length = 0 Then eleDef.SetAttribute("CalendarLink", "rdTemplate/rdCalendar/rdDatePicker.gif") End If Else eleCaption = xmlDef.CreateElement("Label") End If eleCaption.SetAttribute("ID", sElementID & "_rdCalendarLink") eleCaption.SetAttribute("Caption", eleDef.GetAttribute("CalendarLink")) If eleDef.GetAttribute("CalendarLinkClass").Length <> 0 Then eleCaption.SetAttribute("Class", eleDef.GetAttribute("CalendarLinkClass")) End If eleCaption.RemoveAttribute("lgxKey") eleCaption.RemoveAttribute("Format") eleCaption.RemoveAttribute("AbsoluteLeft") eleCaption.RemoveAttribute("AbsoluteTop") 'eleCaption.RemoveAttribute("AbsoluteWidth") eleCaption.RemoveAttribute("Width") eleCaption.RemoveAttribute("WidthScale") Dim eleAction As XmlElement = eleCaption.AppendChild(xmlDef.CreateElement("Action")) eleAction.SetAttribute("ID", "actDatePickerForInputDate_" & eleDef.GetAttribute("ID")) eleAction.SetAttribute("Type", "ShowElement") eleAction.SetAttribute("ElementID", "PPDatePickerForInputDate_" & eleDef.GetAttribute("ID")) Dim eleEventHandler As XmlElement = eleCaption.AppendChild(xmlDef.CreateElement("EventHandler")) eleEventHandler.SetAttribute("DhtmlEvent", "onclick") Dim eleActionLink As XmlElement = eleEventHandler.AppendChild(xmlDef.CreateElement("Action")) eleActionLink.SetAttribute("Type", "Link") Dim eleTargetLink As XmlElement = eleActionLink.AppendChild(xmlDef.CreateElement("Target")) eleTargetLink.SetAttribute("Type", "Link") If CBool(bElementUnderDataTable) Then eleTargetLink.SetAttribute("Link", "javascript:rdGetRowIdentifier(" & "'" & "@Function.RowNumber~" & "'" & ")") Else eleTargetLink.SetAttribute("Link", "javascript:rdGetRowIdentifier(" & "'" & "" & "'" & ")") End If Dim eleChildInputDateCalendar As XmlElement '# 11014 Dim i As Integer = 0 While i < eleDef.ChildNodes.Count If eleDef.ChildNodes.ItemOf(i).LocalName = "InputDateCalendar" Then eleChildInputDateCalendar = eleDef.ChildNodes.ItemOf(i) Exit While End If i += 1 End While Dim eleCalendarPopUp As XmlElement = xmlDef.CreateElement("PopupPanel") eleCalendarPopUp.SetAttribute("ID", "PPDatePickerForInputDate_" & eleDef.GetAttribute("ID")) If IsNothing(eleChildInputDateCalendar) Then eleCalendarPopUp.SetAttribute("Caption", "Calendar") Else eleCalendarPopUp.SetAttribute("Caption", IIf(String.IsNullOrEmpty(eleChildInputDateCalendar.GetAttribute("CalendarCaption")), "Calendar", eleChildInputDateCalendar.GetAttribute("CalendarCaption"))) End If eleCalendarPopUp.SetAttribute("Class", "rdDataCalendarPopUp") eleCalendarPopUp.SetAttribute("HideCloseX", "False") eleCalendarPopUp.SetAttribute("PopupModal", "False") If HttpContext.Current.Items("isMobileDef") = True Then eleCalendarPopUp.SetAttribute("PopupModal", "True") '#13374. End If eleCalendarPopUp.SetAttribute("Draggable", "True") Dim sCalendarPopUp As String = String.Empty Dim sCalendarLinkCaption As String = String.Empty If Not CBool(bElementUnderDataTable) And bAjaxrefresh Then Dim eleDatePicker As XmlElement = eleCalendarPopUp.AppendChild(xmlDef.CreateElement("DatePicker")) eleDatePicker.SetAttribute("ID", "DpForInputDate_" & eleDef.GetAttribute("ID") & "_rdInputDateElement") '***Added to handle the Ajax refresh issue*** 'If Not String.IsNullOrEmpty(eleDef.GetAttribute("DashBoardGUID")) Then 'Added to handle the dashboard issue. 'eleDatePicker.SetAttribute("InputDateEleID", eleDef.GetAttribute("ID") & "_" & eleDef.GetAttribute("DashBoardGUID") & "_rdInputDateElement") 'Else eleDatePicker.SetAttribute("InputDateEleID", eleDef.GetAttribute("ID") & "_rdInputDateElement") 'End If eleDatePicker.SetAttribute("InputDateEleID", eleDef.GetAttribute("ID") & "_rdInputDateElement") eleDatePicker.SetAttribute("PopUpID", eleCalendarPopUp.GetAttribute("ID")) 'eleDatePicker.SetAttribute("ElementUnderDataTable", bElementUnderDataTable.ToString()) 'If String.IsNullOrEmpty(sInputDate) Then eleDatePicker.SetAttribute("SetDateToToday", "True") 'Dim sDataTableRowIdentifierValue As String = st.sGetRequestVar("rdRowIdentifierValue") 'DataTable Row number, retreived by Ajax request 'If Not String.IsNullOrEmpty(sDatatableModifier) And Not String.IsNullOrEmpty(sDataTableRowIdentifierValue) Then ' HttpContext.Current.Session("rdCalendarRowIdentifier") = sDataTableRowIdentifierValue 'End If 'eleDatePicker.SetAttribute("RowIdentifierValue", sDataTableRowIdentifierValue) If Not eleDef.GetAttribute("CalendarCaptionFormat").Length = 0 Then eleDatePicker.SetAttribute("CalendarCaptionFormat", eleDef.GetAttribute("CalendarCaptionFormat")) ElseIf Not eleChildInputDateCalendar Is Nothing Then If Not eleChildInputDateCalendar.GetAttribute("CalendarCaptionFormat").Length = 0 Then eleDatePicker.SetAttribute("CalendarCaptionFormat", eleChildInputDateCalendar.GetAttribute("CalendarCaptionFormat")) End If End If If Not eleDef.GetAttribute("CellSpacing").Length = 0 Then eleDatePicker.SetAttribute("CellSpacing", eleDef.GetAttribute("CellSpacing")) ElseIf Not eleChildInputDateCalendar Is Nothing Then If Not eleChildInputDateCalendar.GetAttribute("CellSpacing").Length = 0 Then eleDatePicker.SetAttribute("CellSpacing", eleChildInputDateCalendar.GetAttribute("CellSpacing")) End If End If eleDatePicker.SetAttribute("DayCaptionFormat", "None") If Not eleDef.GetAttribute("DropdownYearAndMonth").Length = 0 Then eleDatePicker.SetAttribute("DropdownYearAndMonth", eleDef.GetAttribute("DropdownYearAndMonth")) ElseIf Not eleChildInputDateCalendar Is Nothing Then If Not eleChildInputDateCalendar.GetAttribute("DropdownYearAndMonth").Length = 0 Then eleDatePicker.SetAttribute("DropdownYearAndMonth", eleChildInputDateCalendar.GetAttribute("DropdownYearAndMonth")) End If End If If Not eleDef.GetAttribute("DefaultValue").Length = 0 Then eleDatePicker.SetAttribute("DataCalendarDate", eleDef.GetAttribute("DefaultValue")) ElseIf Not eleChildInputDateCalendar Is Nothing Then If Not eleChildInputDateCalendar.GetAttribute("DefaultValue").Length = 0 Then eleDatePicker.SetAttribute("DataCalendarDate", eleChildInputDateCalendar.GetAttribute("DefaultValue")) End If End If If Not eleDef.GetAttribute("SecurityRightID").Length = 0 Then eleDatePicker.SetAttribute("SecurityRightID", eleDef.GetAttribute("SecurityRightID")) ElseIf Not eleChildInputDateCalendar Is Nothing Then If Not eleChildInputDateCalendar.GetAttribute("SecurityRightID").Length = 0 Then eleDatePicker.SetAttribute("SecurityRightID", eleChildInputDateCalendar.GetAttribute("SecurityRightID")) End If End If If Not eleDef.GetAttribute("ShowDateRange").Length = 0 Then eleDatePicker.SetAttribute("ShowDateRange", eleDef.GetAttribute("ShowDateRange")) ElseIf Not eleChildInputDateCalendar Is Nothing Then If Not eleChildInputDateCalendar.GetAttribute("ShowDateRange").Length = 0 Then eleDatePicker.SetAttribute("ShowDateRange", eleChildInputDateCalendar.GetAttribute("ShowDateRange")) End If End If If Not eleDef.GetAttribute("NumberOfMonths").Length = 0 Then eleDatePicker.SetAttribute("NumberOfMonths", eleDef.GetAttribute("NumberOfMonths")) ElseIf Not eleChildInputDateCalendar Is Nothing Then If Not eleChildInputDateCalendar.GetAttribute("NumberOfMonths").Length = 0 Then eleDatePicker.SetAttribute("NumberOfMonths", eleChildInputDateCalendar.GetAttribute("NumberOfMonths")) End If End If If Not eleDef.GetAttribute("TableBorder").Length = 0 Then eleDatePicker.SetAttribute("TableBorder", eleDef.GetAttribute("TableBorder")) ElseIf Not eleChildInputDateCalendar Is Nothing Then If Not eleChildInputDateCalendar.GetAttribute("TableBorder").Length = 0 Then eleDatePicker.SetAttribute("TableBorder", eleChildInputDateCalendar.GetAttribute("TableBorder")) End If End If If Not eleDef.GetAttribute("WeekdayCaptionFormat").Length = 0 Then eleDatePicker.SetAttribute("WeekdayCaptionFormat", eleDef.GetAttribute("WeekdayCaptionFormat")) ElseIf Not eleChildInputDateCalendar Is Nothing Then If Not eleChildInputDateCalendar.GetAttribute("WeekdayCaptionFormat").Length = 0 Then eleDatePicker.SetAttribute("WeekdayCaptionFormat", eleChildInputDateCalendar.GetAttribute("WeekdayCaptionFormat")) End If End If If Not eleDef.GetAttribute("Width").Length = 0 Then eleDatePicker.SetAttribute("Width", eleDef.GetAttribute("Width")) ElseIf Not eleChildInputDateCalendar Is Nothing Then If Not eleChildInputDateCalendar.GetAttribute("Width").Length = 0 Then eleDatePicker.SetAttribute("Width", eleChildInputDateCalendar.GetAttribute("Width")) End If End If If Not eleDef.GetAttribute("WidthScale").Length = 0 Then eleDatePicker.SetAttribute("WidthScale", eleDef.GetAttribute("WidthScale")) ElseIf Not eleChildInputDateCalendar Is Nothing Then If Not eleChildInputDateCalendar.GetAttribute("WidthScale").Length = 0 Then eleDatePicker.SetAttribute("WidthScale", eleChildInputDateCalendar.GetAttribute("WidthScale")) End If End If If Not eleDef.GetAttribute("StartDateElementID").Length = 0 Then eleDatePicker.SetAttribute("StartDateElementID", eleDef.GetAttribute("StartDateElementID")) Else eleDatePicker.SetAttribute("StartDateElementID", eleDef.GetAttribute("ID")) End If If CBool(eleDef.GetAttribute("ShowDateRange")) Then eleDatePicker.SetAttribute("EndDateElementID", eleDef.GetAttribute("EndDateRangeID")) End If If Not eleDef.GetAttribute("EndDateDefaultValue").Length = 0 Then eleDatePicker.SetAttribute("EndDateDefaultValue", eleDef.GetAttribute("EndDateDefaultValue")) End If If Not eleDef.GetAttribute("NumberOfDropdownYears").Length = 0 Then eleDatePicker.SetAttribute("NumberOfDropdownYears", eleDef.GetAttribute("NumberOfDropdownYears")) End If If Not sInputDate.Length = 0 Then 'rdInternational.SetCulture(CultureType.CULTURE_BROWSER) 'Adding culture settings. 'sInputDate = CDate(sInputDate).ToString("MM/dd/yyyy") 'rdInternational.SetCulture(CultureType.CULTURE_INVARIANT) 'Adding culture settings. eleDatePicker.SetAttribute("UserInputDate", sInputDate.Trim()) End If If Not String.IsNullOrEmpty(sDateFormat) Then sDateFormat = ConvertFormatNameToFormatString(sDateFormat) End If eleDatePicker.SetAttribute("DateFormat", sDateFormat) 'Date Format from the InputDate Element. eleDatePicker.SetAttribute("CurrentElement", "InputDate") 'variable to identify the code calling element. eleDatePicker.SetAttribute("AjaxRefresh", eleDef.GetAttribute("AjaxRefresh")) 'variable to identify Ajax Refresh. eleDatePicker.SetAttribute("SkipLicenseCheck", "True") 'To handle the license check for the InputDate in free version of Info. eleDef.SetAttribute("ID", eleDef.GetAttribute("ID") & "_rdInputDateElement") '***Added to handle the Ajax refresh issue*** sCalendarPopUp = sProcessDefinitionElement(eleCalendarPopUp) sCalendarLinkCaption = sProcessDefinitionElement(eleCaption) 'If sDatatableModifier.Length = sElementID.Length Then sCalendarLinkCaption = sCalendarLinkCaption.Insert(sCalendarLinkCaption.IndexOf("id=" & ControlChars.Quote & eleAction.GetAttribute("ID") & ControlChars.Quote) - 2, ";rdInputDateAjaxRequest(" & "'" & eleDef.GetAttribute("ID") & "'" & " , " & "'" & eleDatePicker.GetAttribute("ID") & "'" & " , " & "'" & eleDef.GetAttribute("ID").Substring(0, eleDef.GetAttribute("ID").IndexOf("_rdInputDateElement")) & "');" & "") 'Else 'sCalendarLinkCaption = sCalendarLinkCaption.Insert(sCalendarLinkCaption.IndexOf("id=" & ControlChars.Quote & eleAction.GetAttribute("ID") & ControlChars.Quote) - 2, ";rdGetRowIdentifier(" & "'" & st.sReplaceTokens("@Function.RowNumber~") & "'" & ");rdInputDateAjaxRequest(" & "'" & eleDef.GetAttribute("ID") & "'" & " , " & "'" & eleDatePicker.GetAttribute("ID") & "'" & " , " & "'" & eleDef.GetAttribute("ID").Substring(0, eleDef.GetAttribute("ID").IndexOf("_rdInputDateElement")) & "');" & "") 'End If Else ' Block of code gets processed when the InputDate Element is under a DataTable or an Analysis Grid. Dim eleDatePicker As XmlElement = eleCalendarPopUp.AppendChild(xmlDef.CreateElement("Rows")) 'Add a Dummy Table in the PopUp. eleDatePicker.SetAttribute("ID", "DpForInputDate_" & eleDef.GetAttribute("ID") & "_rdInputDateElement") '23824 'Call subAddIncludedScript("rdCalendar/rdDatePicker.js") 'DatePicker Javascript file 'sbHead.Insert(sbHead.ToString.IndexOf("") + 8, "") ' Add the Calendar Style Sheet. subAddIncludedCss("rdCalendar/rdDataCalendarStyle.css") mbAddAjaxSupport = True ' This needs to be set to true to add the Ajax2.js to be added during the processing. ' Add the Popup and caption to the element definition so that the Id gets appended with the Row number, #14844. 'eleDef.ParentNode.AppendChild(eleCalendarPopUp) 'eleDef.ParentNode.AppendChild(eleCaption) sCalendarPopUp = sProcessDefinitionElement(eleCalendarPopUp) sCalendarLinkCaption = sProcessDefinitionElement(eleCaption) 'Now remove the element from the definition as the element is processed. 'eleDef.ParentNode.RemoveChild(eleCalendarPopUp) 'eleDef.ParentNode.RemoveChild(eleCaption) sCalendarLinkCaption = sCalendarLinkCaption.Insert(sCalendarLinkCaption.IndexOf("onClick=") + 9, ";rdInputDateAjaxRequest(" & "'" & eleDef.GetAttribute("ID") & "'" & " , " & "'" & eleDatePicker.GetAttribute("ID") & "'" & " , " & "'" & eleDef.GetAttribute("ID") & "'" & " , " & "'" & msRequestedPage & "');" & "") 'Added the ReportID to the javascript method to fix the Ajax request issue, Issue being - Calendar does not get rendered unless the report is the default report. End If If eleDef.ParentNode.Name = "InputGrid" Then sReturn = sReturn.Insert(sReturn.LastIndexOf(""), sCalendarLinkCaption & sCalendarPopUp) Else sReturn = sReturn.Insert(sReturn.LastIndexOf(""), sCalendarLinkCaption & sCalendarPopUp) End If End If End If Return sReturn End Function Private Sub subInsertDataCalendarPagingControl( _ ByVal elePaging As XmlElement, _ ByVal eleSibling As XmlElement, _ ByVal sCaption As String, _ ByVal sElementID As String, _ ByVal dtCalendarDate As DateTime, _ ByVal sTimePeriod As String, _ ByVal nDaysPerWeek As Integer, _ ByVal sDataCacheKey As String) Dim od As XmlDocument = eleSibling.OwnerDocument Dim elePagingLabel As XmlElement = Nothing Dim eleSpaces As XmlElement = Nothing If sCaption = "<" Then elePagingLabel = eleSibling.ParentNode.InsertBefore(od.CreateElement("Label"), eleSibling) elePagingLabel.SetAttribute("Class", "rdDataCalendarPagingLabel") eleSpaces = eleSibling.ParentNode.InsertBefore(od.CreateElement("Spaces"), eleSibling) Else elePagingLabel = eleSibling.ParentNode.InsertAfter(od.CreateElement("Label"), eleSibling) elePagingLabel.SetAttribute("Class", "rdDataCalendarPagingLabel") eleSpaces = eleSibling.ParentNode.InsertAfter(od.CreateElement("Spaces"), eleSibling) End If elePagingLabel.SetAttribute("Caption", sCaption) eleSpaces.SetAttribute("Size", "2") Dim eleAction As XmlElement = elePagingLabel.AppendChild(od.CreateElement("Action")) Dim eleLinkParams As XmlElement = eleAction.AppendChild(od.CreateElement("LinkParams")) If Not IsNothing(HttpContext.Current.Items("rdIsWidgetRequest")) Then 'Widget paging eleAction.SetAttribute("Type", "Widget") Dim eleTarget As XmlElement = eleAction.AppendChild(od.CreateElement("Target")) eleTarget.SetAttribute("Type", "Widget") ElseIf st.sGetAttribute(elePaging, "AjaxPaging") = "True" Then 'Ajax paging eleAction.SetAttribute("Type", "CalendarRefreshElement") eleAction.SetAttribute("ElementID", sElementID) Else 'Standard paging. eleAction.SetAttribute("Type", "Report") Dim eleTarget As XmlElement = eleAction.AppendChild(od.CreateElement("Target")) eleTarget.SetAttribute("Type", "Report") 'This could be implemented later: 'If elePaging.GetAttribute("KeepScrollPosition") = "True" Then ' Call subAddIncludedScript("rdScroll.js") ' Call subAddJavaEventFunction("rdBodyLoad", _ ' "rdSetScroll()") ' sColSortUrl &= "&rdSubmitScroll" 'End If End If Dim nDirection As Integer = IIf(sCaption = "<", -1, 1) Dim dtNewDate As DateTime = Nothing Select Case sTimePeriod Case "Week" dtNewDate = dtCalendarDate.AddDays(nDaysPerWeek * nDirection) Case Else '"Month" dtNewDate = dtCalendarDate.AddMonths(1 * nDirection) End Select eleLinkParams.SetAttribute("rdDataCalendarDate", dtNewDate.ToString("yyyy-MM-dd")) eleLinkParams.SetAttribute("rdRequestForwarding", "Form") '#8086 If sDataCacheKey.Length <> 0 Then 'RerunDataLayer="False" eleLinkParams.SetAttribute("rdCalDataCache", sDataCacheKey) Else eleLinkParams.SetAttribute("rdDataCalendarMonth", dtNewDate.Month) eleLinkParams.SetAttribute("rdDataCalendarYear", dtNewDate.Year) eleLinkParams.SetAttribute("rdDataCalendarDay", dtNewDate.Day) End If End Sub Private Function sProcess_InputTime(ByRef eleDef As XmlElement, ByVal sElementID As String) As String Dim sReturn As String = Nothing If sElementID.Length = 0 Then Throw New Exception("Input Time elements need an ID value.") '23824 'Call subAddIncludedScript("rdClock/rdTimePicker.js") If Not String.IsNullOrEmpty(eleDef.GetAttribute("DashBoardGUID")) And Not sElementID.Contains(eleDef.GetAttribute("DashBoardGUID")) Then eleDef.SetAttribute(("ID"), sElementID & "_" & eleDef.GetAttribute("DashBoardGUID")) ' Added to handle the multiple instances in the Dashboards. End If Dim bElementUnderDataTable As Boolean = False Dim bAjaxrefresh As Boolean = IIf(String.IsNullOrEmpty(eleDef.GetAttribute("AjaxRefresh")), False, True) If bUnderDataRepeater(eleDef) Then bElementUnderDataTable = True End If Dim sInputTime As String = st.sGetRequestVar("rdInputTime") Dim eleInputTimePicker As XmlElement = eleDef.SelectSingleNode("InputTimeClock") Dim sTimePickerPopup As String = String.Empty : Dim sTimePickerLinkCaption As String = String.Empty Dim sShowSeconds As String = "False" : Dim sShowMinutes As String = "True" Dim sHoursHeader As String = String.Empty : Dim sMinutesHeader As String = String.Empty : Dim sSecondsHeader As String = String.Empty Dim sTimePickerHours As String = String.Empty If Not IsNothing(eleInputTimePicker) Then sShowMinutes = eleInputTimePicker.GetAttribute("ShowMinutes") sShowSeconds = IIf(String.IsNullOrEmpty(eleInputTimePicker.GetAttribute("ShowSeconds")), "False", eleInputTimePicker.GetAttribute("ShowSeconds")) sHoursHeader = eleInputTimePicker.GetAttribute("HoursHeader") sMinutesHeader = eleInputTimePicker.GetAttribute("MinutesHeader") sSecondsHeader = eleInputTimePicker.GetAttribute("SecondsHeader") sTimePickerHours = eleInputTimePicker.GetAttribute("ClockHours") End If 'Build an InputText element, by renaming the current element to InputText and re-running this function. Dim eleInputText As XmlElement = xmlDef.CreateElement("InputText") eleInputText.SetAttribute("rdInputTime", "True") Dim atr As XmlAttribute For Each atr In eleDef.Attributes eleInputText.SetAttribute(atr.Name, atr.Value) Next If Not String.IsNullOrEmpty(sInputTime) Then eleInputText.SetAttribute("DefaultValue", sInputTime) End If Dim sTimeFormat As String = st.sGetAttribute(eleInputText, "Format") If sTimeFormat.Length = 0 Then sTimeFormat = IIf(IsNothing(http.Application("rdConstant-DefaultTimeFormat")), "", http.Application("rdConstant-DefaultTimeFormat")) ' From the Settings file. If sTimeFormat.Length = 0 Then If sTimePickerHours = "24Hours" AndAlso String.IsNullOrEmpty(sTimeFormat) Then '#14221. sTimeFormat = "HH:mm" If CBool(sShowSeconds) Then sTimeFormat = "HH:mm:ss" End If End If Select Case sTimeFormat.ToLower.Replace(" ", "") Case "shorttime" sTimeFormat = "t" Case "longtime", "" sTimeFormat = "T" End Select eleDef.SetAttribute("Format", sTimeFormat) For Each eleEventHandler As XmlElement In eleDef.SelectNodes("EventHandler") '#8940 eleInputText.AppendChild(eleEventHandler.CloneNode(True)) Next eleDef.ParentNode.AppendChild(eleInputText) sReturn = sProcessDefinitionElement(eleInputText) eleInputText.ParentNode.RemoveChild(eleInputText) 'Adding an input Hidden field to handle the internationalization. Dim eleHiddenDateHolder As XmlElement = xmlDef.CreateElement("InputHidden") eleHiddenDateHolder.SetAttribute("ID", eleDef.GetAttribute("ID") & "_Hidden") rdInternational.SetCulture(CultureType.CULTURE_BROWSER) If String.IsNullOrEmpty(sInputTime) Then eleHiddenDateHolder.SetAttribute("DefaultValue", Now.ToString(sTimeFormat)) End If eleDef.AppendChild(eleHiddenDateHolder) Dim sHiddenInputDate As String = sProcessDefinitionElement(eleHiddenDateHolder) rdInternational.SetCulture(CultureType.CULTURE_INVARIANT) sReturn = sReturn.Insert(sReturn.LastIndexOf("") + 8, sHiddenInputDate) Dim sInputTimeReformat As String = st.sGetAttribute(eleInputText, "InputTimeReformat") If sInputTimeReformat.Length = 0 Then sInputTimeReformat = IIf(IsNothing(http.Application("rdConstant-DefaultTimeReformat")), Nothing, http.Application("rdConstant-DefaultTimeReformat")) If Not IsNothing(sInputTimeReformat) Then Dim eleTimeReformat As XmlElement = xmlDef.CreateElement("InputHidden") eleTimeReformat.SetAttribute("ID", "rdReformatTime" & sElementID) eleTimeReformat.SetAttribute("DefaultValue", sInputTimeReformat) eleDef.AppendChild(eleTimeReformat) Dim sHiddenInputTimeReformat As String = sProcessDefinitionElement(eleTimeReformat) If sTimeFormat.Length <> 0 Then Dim eleFormat As XmlElement = xmlDef.CreateElement("InputHidden") eleFormat.SetAttribute("ID", "rdFormatTime" & sElementID) eleFormat.SetAttribute("DefaultValue", sTimeFormat) eleDef.AppendChild(eleFormat) sHiddenInputTimeReformat &= sProcessDefinitionElement(eleFormat) End If sReturn = sReturn.Insert(sReturn.LastIndexOf("") + 8, sHiddenInputTimeReformat) Else If Not IsNothing(eleDef.SelectSingleNode("Validation[@Type='Time']")) Then Dim eleInputTimeDeLocalize As XmlElement = xmlDef.CreateElement("InputHidden") eleInputTimeDeLocalize.SetAttribute("ID", "rdDeLocalize" & sElementID) eleInputTimeDeLocalize.SetAttribute("DefaultValue", "Time") eleDef.AppendChild(eleInputTimeDeLocalize) Dim sHiddenInputTimeDeLocalize As String = sProcessDefinitionElement(eleInputTimeDeLocalize) sReturn = sReturn.Insert(sReturn.LastIndexOf("") + 8, sHiddenInputTimeDeLocalize) End If End If Call subProcessInputValidationElements(eleDef) 'Add the calendar link? If eleDef.GetAttribute("ClockLink").Length <> 0 Or eleDef.GetAttribute("ClockLinkType") = "Image" Then If Not bExportReport() Then 'Add the image, or text, that links to the calendar. Dim eleCaption As XmlElement If eleDef.GetAttribute("ClockLinkType") = "Image" Then eleCaption = xmlDef.CreateElement("Image") eleCaption.SetAttribute("Class", "rdTimePickerImage") If eleDef.GetAttribute("ClockLink").Length = 0 Then eleDef.SetAttribute("ClockLink", "rdTemplate/rdClock/rdTimePicker.png") End If Else eleCaption = xmlDef.CreateElement("Label") End If eleCaption.SetAttribute("ID", sElementID & "_rdInputTimeLink") eleCaption.SetAttribute("Caption", eleDef.GetAttribute("ClockLink")) If eleDef.GetAttribute("ClockLinkClass").Length <> 0 Then eleCaption.SetAttribute("Class", eleDef.GetAttribute("ClockLinkClass")) End If eleCaption.RemoveAttribute("lgxKey") eleCaption.RemoveAttribute("Format") eleCaption.RemoveAttribute("AbsoluteLeft") eleCaption.RemoveAttribute("AbsoluteTop") eleCaption.RemoveAttribute("Width") eleCaption.RemoveAttribute("WidthScale") Dim eleAction As XmlElement = eleCaption.AppendChild(xmlDef.CreateElement("Action")) eleAction.SetAttribute("ID", "actTimePickerForInputTime_" & sElementID) eleAction.SetAttribute("Type", "ShowElement") eleAction.SetAttribute("ElementID", "PPTimePickerForInputTime_" & sElementID) Dim eleEventHandler As XmlElement = eleCaption.AppendChild(xmlDef.CreateElement("EventHandler")) eleEventHandler.SetAttribute("DhtmlEvent", "onclick") Dim eleActionLink As XmlElement = eleEventHandler.AppendChild(xmlDef.CreateElement("Action")) eleActionLink.SetAttribute("Type", "Link") Dim eleTargetLink As XmlElement = eleActionLink.AppendChild(xmlDef.CreateElement("Target")) eleTargetLink.SetAttribute("Type", "Link") 'Maurice 10Aug12 #17523 "InputTime Element gives a Javascript error if the ID has a _" 'Need to save the InputTime element ID without any dashboard GUID, and pass it as a 'parameter to rdInputTimeAjaxRequest. Dim linkAction As String = String.Empty Dim timeRowIdParam As String = String.Empty Dim dbGuid As String = String.Empty Dim rawElemId As String = Me.subFixUpDashboardManipulatedElementID(sElementID, dbGuid) If CBool(bElementUnderDataTable) Then timeRowIdParam = "@Function.RowNumber~" End If linkAction = String.Format("javascript:rdGetInputTimeRowIdentifier('{0}');rdInputTimeAjaxRequest('{1}','{2}','TableForInputTime_{3}_rdInputTimeElement','{4}')", timeRowIdParam, sElementID, rawElemId, sElementID, msRequestedPage) eleTargetLink.SetAttribute("Link", linkAction) If Not CBool(bElementUnderDataTable) And bAjaxrefresh Then Dim xmlTpTemplate As XmlDocument = rdUtility.GetSuperElementTemplate("rdClock/rdTimePickerTemplate.lgx") 'Is there a template modifier? Call rdUtility.ApplyTemplateModifier(st, dbug, eleDef, xmlTpTemplate.DocumentElement) 'Is there a theme or DefinitionModifierFile? Run them too. Call rdUtility.ApplyDefinitionModifierFiles(st, dbug, eleDef.OwnerDocument, xmlTpTemplate.DocumentElement) subMakeTimePickerCellIDsUnique(xmlTpTemplate.DocumentElement, sElementID) Dim eleTimePickerPopup As XmlElement = xmlTpTemplate.SelectSingleNode("//PopupPanel") Dim sTimePickerTableType As String = PickTimePickerTable(sTimePickerHours) Dim eleTableForInputTime As XmlElement = eleTimePickerPopup.SelectSingleNode(".//Rows[@ID='" & sTimePickerTableType & "']") ' Maurice 06Aug12 #17401 - When time picker is in a dashboard it needs the dashboard GUID in its ' ID. If Not String.IsNullOrEmpty(eleDef.GetAttribute("DashBoardGUID")) And Not sElementID.Contains(eleDef.GetAttribute("DashBoardGUID")) Then eleTableForInputTime.SetAttribute("ID", "TableForInputTime_" & sElementID & "_" & eleDef.GetAttribute("DashBoardGUID") & "_rdInputTimeElement") Else eleTableForInputTime.SetAttribute("ID", "TableForInputTime_" & sElementID & "_rdInputTimeElement") End If subSetTimePickerTableHeader(eleTableForInputTime, sHoursHeader, "Hours", "True") subSetTimePickerTableHeader(eleTableForInputTime, sMinutesHeader, "Minutes", sShowMinutes) subSetTimePickerTableHeader(eleTableForInputTime, sSecondsHeader, "Seconds", sShowSeconds) Dim eleHoursTableForDynamicDataAddition As XmlElement = eleTableForInputTime.SelectSingleNode("*//Rows[@ID='" & sElementID & "_rdTimePicker_HoursTable']") subCreateTimePickerHoursTable(eleHoursTableForDynamicDataAddition, sTimeFormat) If Not String.IsNullOrEmpty(sInputTime) Then _ subHighlightTimePickerCells(eleTableForInputTime, sInputTime, sElementID) sTimePickerPopup = sProcessDefinitionElement(eleTimePickerPopup) sTimePickerLinkCaption = sProcessDefinitionElement(eleCaption) Else Dim eleTimePickerDummy As XmlElement = xmlDef.CreateElement("PopupPanel") eleTimePickerDummy.SetAttribute("ID", "PPTimePickerForInputTime_" & sElementID) If IsNothing(eleInputTimePicker) Then eleTimePickerDummy.SetAttribute("Caption", "Time Picker") Else eleTimePickerDummy.SetAttribute("Caption", IIf(String.IsNullOrEmpty(eleInputTimePicker.GetAttribute("ClockCaption")), _ "Time Picker", eleInputTimePicker.GetAttribute("ClockCaption"))) End If eleTimePickerDummy.SetAttribute("Class", "rdTimePickerPopup") eleTimePickerDummy.SetAttribute("HideCloseX", "False") eleTimePickerDummy.SetAttribute("PopupModal", "False") If HttpContext.Current.Items("isMobileDef") = True Then eleTimePickerDummy.SetAttribute("PopupModal", "True") End If eleTimePickerDummy.SetAttribute("Draggable", "True") Dim eleDatePicker As XmlElement = eleTimePickerDummy.AppendChild(eleTimePickerDummy.OwnerDocument.CreateElement("Rows")) eleDatePicker.SetAttribute("ID", "TableForInputTime_" & sElementID & "_rdInputTimeElement") '23824 'Call subAddIncludedScript("rdClock/rdTimePicker.js") 'sbHead.Insert(sbHead.ToString.IndexOf("") + 8, "") subAddIncludedCss("rdClock/rdTimePickerStyle.css") mbAddAjaxSupport = True sTimePickerPopup = sProcessDefinitionElement(eleTimePickerDummy) sTimePickerLinkCaption = sProcessDefinitionElement(eleCaption) End If If eleDef.ParentNode.Name = "InputGrid" Then sReturn = sReturn.Insert(sReturn.LastIndexOf(""), sTimePickerLinkCaption & sTimePickerPopup) Else sReturn = sReturn.Insert(sReturn.LastIndexOf(""), sTimePickerLinkCaption & sTimePickerPopup) End If End If End If Return sReturn End Function Private Sub subSetTimePickerTableHeader(ByVal eleTimePickerTable As XmlElement, ByVal sTableHeader As String, ByVal sTableType As String, ByVal sShowTableBool As String) Dim eleTable As XmlElement = eleTimePickerTable.SelectSingleNode("*//Column[@ID='col" & sTableType & "']") If Not IsNothing(eleTable) Then If sShowTableBool.ToLower = "false" Then eleTable.ParentNode.RemoveChild(eleTable) ElseIf Not String.IsNullOrEmpty(sTableHeader) Then Dim eleHeaderCaptionLabel As XmlElement = eleTable.SelectSingleNode("*//Label[@ID='lbl" & sTableType & "Caption']") If Not IsNothing(eleHeaderCaptionLabel) Then eleHeaderCaptionLabel.SetAttribute("Caption", sTableHeader) End If End If End Sub Private Sub subHighlightTimePickerCells(ByVal eleTimePickerTable As XmlElement, ByVal sInputTime As String, ByVal sElementID As String) rdInternational.SetCulture(CultureType.CULTURE_BROWSER) Dim dtInputTime As DateTime = Today Try dtInputTime = CDate(Date.Parse(sInputTime)) Catch Exit Sub End Try Dim sHours As String = dtInputTime.Hour If sHours.Length < 2 Then sHours = "0" + sHours Dim sMinutes As String = dtInputTime.Minute If sMinutes.Length < 2 Then sMinutes = "0" + sMinutes Dim sSeconds As String = dtInputTime.Second If sSeconds.Length < 2 Then sSeconds = "0" + sSeconds Dim eleHoursCell As XmlElement = eleTimePickerTable.SelectSingleNode("*//Column[@ID='" & sElementID & "_rdTimePicker_HourCell_" & sHours & "']") If Not IsNothing(eleHoursCell) Then eleHoursCell.SetAttribute("Class", "rdTimePickerLabelHighlight") Dim eleMinutesCell As XmlElement = eleTimePickerTable.SelectSingleNode("*//Column[@ID='" & sElementID & "_rdTimePicker_MinutesCell_" & sMinutes & "']") If Not IsNothing(eleMinutesCell) Then eleMinutesCell.SetAttribute("Class", "rdTimePickerLabelHighlight") Dim eleSecondsCell As XmlElement = eleTimePickerTable.SelectSingleNode("*//Column[@ID='" & sElementID & "_rdTimePicker_SecondsCell_" & sSeconds & "']") If Not IsNothing(eleSecondsCell) Then eleSecondsCell.SetAttribute("Class", "rdTimePickerLabelHighlight") rdInternational.SetCulture(CultureType.CULTURE_INVARIANT) End Sub Private Sub subCreateTimePickerHoursTable(ByVal eleHoursTable As XmlElement, ByVal sTimeFormat As String) rdInternational.SetCulture(CultureType.CULTURE_BROWSER) Dim nPreviousHour As Integer = 0 Dim nHourRows As XmlNodeList = eleHoursTable.SelectNodes("Row") For Each eleHourRow As XmlElement In nHourRows Dim nHourColumns As XmlNodeList = eleHourRow.SelectNodes("Column") For Each eleHourColumn As XmlElement In nHourColumns Dim eleHourInputHidden As XmlElement = eleHourColumn.SelectSingleNode("InputHidden") eleHourInputHidden.SetAttribute("DefaultValue", Today.AddHours(IIf(nPreviousHour = 0, 0, nPreviousHour)).ToString(sTimeFormat)) nPreviousHour += 1 Next Next rdInternational.SetCulture(CultureType.CULTURE_INVARIANT) End Sub Private Function PickTimePickerTable(ByVal sTimePickerHours As String) As String Dim sTimePickerTable As String = Nothing Select Case sTimePickerHours Case "12Hours" sTimePickerTable = "12HourTable" Case "24Hours" sTimePickerTable = "24HourTable" Case "BrowserLocale", "" rdInternational.SetCulture(CultureType.CULTURE_BROWSER) Dim sTimeNow As String = Today.AddHours(13).ToString("T") Dim aSplitTime As Array = sTimeNow.Split(":") If CInt(aSplitTime(0)) > 12 Then sTimePickerTable = "24HourTable" Else sTimePickerTable = "12HourTable" End If End Select Return sTimePickerTable End Function Private Sub subMakeTimePickerCellIDsUnique(ByVal eleTimePickerTable As XmlElement, ByVal sElementID As String) Dim atr As XmlAttribute Dim nlAttrs As XmlNodeList = eleTimePickerTable.SelectNodes(".//@*[contains(., 'rdTimePicker_')]") For Each atr In nlAttrs atr.Value = atr.Value.Replace("rdTimePicker_", sElementID & "_rdTimePicker_") Next MakeTimePickerCellActionLinks(eleTimePickerTable, sElementID) End Sub Private Sub MakeTimePickerCellActionLinks(ByVal eleTimePickerTable As XmlElement, ByVal sElementID As String) Dim atr As XmlAttribute Dim nlAttrs As XmlNodeList = eleTimePickerTable.SelectNodes(".//@*[contains(., 'rdClockPick')]") For Each atr In nlAttrs If atr.Value.Contains("(this)") Then Dim eleTimePickerCell As XmlElement = atr.OwnerElement.ParentNode atr.Value = atr.Value.Replace("(this)", "('" & eleTimePickerCell.GetAttribute("ID") & "')") End If Next End Sub Private Function sProcess_DataTable(ByRef eleDef As XmlElement, ByVal sElementID As String) As String Dim sReturn As String = Nothing 'Dim sTableResizeScript As String = "" 'There has to be an ID. If eleDef.GetAttribute("ID").Length = 0 Then _ Throw New Exception("DataTables must have an ID value.") '23644, set the definition of this table for the wizard. If HttpContext.Current.Session("rdForWizard") IsNot Nothing AndAlso eleDef.GetAttribute("ID") = "dtAnalysisGrid" Then Dim eleDefClone As XmlElement = eleDef.CloneNode(True) Dim eleWizardDataLayer As XmlElement = eleDefClone.SelectSingleNode("DataLayer") Call rdAnalysisFilter.ReplaceAnalysisFilterInsert(eleWizardDataLayer) HttpContext.Current.Session("rdForWizard") = eleDefClone.OuterXml End If 'clear column ids from previous tables _dataColumnNames.Clear() For Each dtColumn As XmlElement In eleDef.SelectNodes("DataTableColumn") If String.IsNullOrEmpty(st.sGetAttribute(dtColumn, "ID")) Then dtColumn.SetAttribute("ID", GetUniqueIdForDataTableColumn("DataTableColumn")) End If Next 'There should be a DataLayer Dim eleDataLayer As XmlElement = Nothing 'Issue 11210 - remove rdDb from build. eleDataLayer = _db9.GetDataLayer(eleDef) 'There cannot be any sub-DataTables. If eleDef.SelectNodes(".//DataTable").Count > 0 Then _ Throw New Exception("There cannot be any subordinate DataTables under a DataTable.") 'Remember sorting? Dim sRememberSort As String = "" If eleDef.GetAttribute("RememberSort") = "True" Then _ sRememberSort = "&rdRememberSort=True" ''Printable Paging? 'Dim elePrintablePaging As XmlElement = eleDef.SelectSingleNode("PrintablePaging") 'If Not IsNothing(elePrintablePaging) Then ' 'There can only be a single PrintablePaging element. ' If xmlDef.DocumentElement.SelectNodes("//*/PrintablePaging").Count > 1 Then ' Throw New Exception("There can only be one PrintablePaging element in the definition.") ' End If 'End If ''DataLayer.ActiveSQL? - Convert to DataLayer.ActiveSql. 'If eleDataLayer.GetAttribute("Type") = "ActiveSQL" Then ' 'Create DL.R from DL.ActiveSQL ' eleDataLayer.SetAttribute("Type", "ActiveSql") ' dbug.AddDebugMessage(, "Converted DataLayer.ActiveSQL to private DataLayer.Relational.") 'End If 'DataLayer.ActiveSql? Dim bActiveSqlDataLayer As Boolean = False If eleDataLayer.GetAttribute("Type") = "ActiveSQL" Then bActiveSqlDataLayer = True mbDontCacheXsl = True End If 'Shared AG datatable ? enable sort arrows on the dt.RD20424 Dim bSharedAGDatatableSortArrows As Boolean = False If (Not String.IsNullOrEmpty(st.sGetRequestVar("rdBookmarkUserName")) _ AndAlso st.sGetRequestVar("rdBookmarkUserName") <> st.sReplaceTokens("@Function.UserName~")) _ AndAlso eleDef.GetAttribute("ParentAGSortArrows") = "True" Then bSharedAGDatatableSortArrows = True End If Dim eleAutoColumns As XmlElement = eleDef.SelectSingleNode("AutoColumns") If Not IsNothing(eleAutoColumns) Then 'This may add additional DataTableColumns Call Process_AutoColumns(eleDef, eleAutoColumns, eleDataLayer, sElementID) End If 'If HttpContext.Current.Session("rdBookmarkOrganizerDataTableID") = sElementID Then ' Dim eleDragColumn As XmlElement = HttpContext.Current.Session("rdBookmarkOrganizerDataTableDragColumn") ' eleDef.PrependChild(eleDef.OwnerDocument.ImportNode(eleDragColumn, True)) 'End If 'Remove DataTableColumns with Conditions that do not include @Data tokens. 11089 Dim sConditionSearch As String = ".//DataTableColumn[@Condition and not(@Condition[contains(., '@Data.')])]" Dim eleColumnWithCondition As XmlElement = eleDef.SelectSingleNode(sConditionSearch) 'This finds DataTableColumns in SubDataTables too. Dim evl As rdScriptEvaluator = Nothing Do Until IsNothing(eleColumnWithCondition) Dim sCondition As String = IIf(String.IsNullOrEmpty(st.sReplaceTokens(eleColumnWithCondition.GetAttribute("Condition"))), "True", st.sReplaceTokens(eleColumnWithCondition.GetAttribute("Condition"))) '# 11089 If sCondition <> eleColumnWithCondition.GetAttribute("Condition") Then 'There were token replacements, we can't cache this definition. mbDontCacheXsl = True End If If IsNothing(evl) Then _ evl = New rdScriptEvaluator() 'Only instantiate this once. If CBool(evl.Eval(sCondition)) Then 'Keep this column, remove the condition. eleColumnWithCondition.RemoveAttribute("Condition") Else 'Remove the column. eleColumnWithCondition.ParentNode.RemoveChild(eleColumnWithCondition) End If 'Look for another column eleColumnWithCondition = eleDef.SelectSingleNode(sConditionSearch) Loop Dim sHiddenDataTableInputFlag As String = "" If Not IsNothing(eleDef.SelectSingleNode("*//*[starts-with(local-name(), 'Input')]")) Then 'This hidden element can be used as a flag in Procedure.RunDataTableRows when there are multiple tables with intput elements. Dim eleHidden As XmlElement = xmlDef.CreateElement("InputHidden") eleHidden.SetAttribute("ID", "rdDataTableInput_" & sElementID) sHiddenDataTableInputFlag = sProcessDefinitionElement(eleHidden) End If 'Handle draggable columns. Dim bTableHeaderPresent As Boolean Dim eleCol As XmlElement Dim sScopeColAttr As String = " scope=""col""" Dim sColumnSeqAttr As String = "" Dim sDragTableNewCell As String = "" Dim sDragTableEnd As String = "" Dim sDraggableColumnsID As String = Nothing Dim sResizableColumnsID As String = Nothing Dim sResizeTableNewCell As String = "" Dim sDragResizeTableStart As String = "" Dim sDragResizeTableEnd As String = "" If eleDef.GetAttribute("DraggableColumns") = "True" Then bTableHeaderPresent = True '15744 sDraggableColumnsID = " rdDraggableColumnsID=""" & rdUtility.UrlEncode4(msRequestedPage & "_" & sElementID) & """" mbAddAjaxSupport = True If Not IsNothing(eleDef.SelectSingleNode("HeaderRow[@HeaderPosition='Top']")) Then Throw New Exception("The HeaderRow HeaderPosition cannot be ""Top"" with DraggableColumns=""True"".") End If If Not IsNothing(eleDef.SelectSingleNode(".//CrosstabComparison")) Then sDraggableColumnsID &= " rdDraggableCtComp=""True""" If Not String.IsNullOrEmpty(eleDef.GetAttribute("AnalysisGridID")) Then sDraggableColumnsID &= " rdAnalysisGridID=""" & eleDef.GetAttribute("AnalysisGridID") & """" '#14164. End If End If If eleDef.GetAttribute("ResizableColumns") = "True" Then bTableHeaderPresent = True '15744 sResizableColumnsID = " rdResizableColumnsID=""" & rdUtility.UrlEncode4(msRequestedPage & "_" & sElementID) & """" mbAddAjaxSupport = True If Not IsNothing(eleDef.SelectSingleNode("HeaderRow[@HeaderPosition='Top']")) Then Throw New Exception("The HeaderRow HeaderPosition cannot be ""Top"" with ResizableColumns=""True"".") End If End If ' Add PDF tag holder... #10069 Dim sColPDFTag As String = "" If st.sGetRequestVar("rdReportFormat") = "PDF" Then '12842 sColPDFTag = " abcpdf-tag="""" " End If 'Build the header. 'Dim eleAGDataLayer As XmlElement = eleDef.SelectSingleNode("//*[@ID='dtAnalysisGrid']/DataLayer") Dim sTblHeader As String = "" Dim sTblCols As String = "" 'COLS allow setting of styles for entire columns at once. Dim sCellColorSliderScript As String = "" Dim sColumnWidths As String = st.sGetRequestVar("rdColumnWidths") Dim rdColumnWidths As Dictionary(Of String, String) If String.IsNullOrEmpty(sColumnWidths) Then rdColumnWidths = Nothing Else rdColumnWidths = New Dictionary(Of String, String) Dim oColumnWidths As rdNewtonsoft.Json.Linq.JObject = rdNewtonsoft.Json.Linq.JContainer.Parse(sColumnWidths) Dim jprop As rdNewtonsoft.Json.Linq.JProperty = oColumnWidths.First While Not IsNothing(jprop) rdColumnWidths.Add(jprop.Name, jprop.Value) jprop = jprop.Next() End While End If For Each eleCol In eleDef.SelectNodes("DataTableColumn") setResponsiveVisibility(eleCol) If Not bExportReport() Or bElementInitiallyVisible(eleCol) Then 'Added for Issue # 1455. Don't create invisible columns for exported reports. '23824 'Call subAddIncludedScript("rdActionShowElement.js") Call subAddJavaEventFunction("rdBodyLoad", "rdColumnDisplayVisibility()") Dim sColStyle As String = "" Dim sID As String = eleCol.GetAttribute("ID") Dim sIDEnc As String = rdUtility.GetAttributeEncoded(eleCol, "ID") If eleCol.GetAttribute("Width").Length > 0 Then 'sColStyle = "style=""width: " & eleCol.GetAttribute("Width") & eleCol.GetAttribute("WidthScale") & """" sColStyle = "style=""width: " & eleCol.GetAttribute("Width") & st.sGetAttribute(eleCol, "WidthScale", "px") & """" #If Not JAVA Then ' A JAVA fix is still needed for REPDEV-13549 ElseIf rdColumnWidths IsNot Nothing Then Dim sHeaderID As String = sID & "-TH" Dim sWidth As String = Nothing If rdColumnWidths.TryGetValue(sHeaderID, sWidth) _ AndAlso Not String.IsNullOrEmpty(sWidth) Then sColStyle = "style=""width: " & sWidth & """ conditionalProcessed=""true""" End If #End If End If 'Dim sColTooltip As String = "" 'If eleCol.GetAttribute("Tooltip").Length > 0 Then ' sColTooltip &= " TITLE=""" & sTokenToXsl(eleCol.GetAttribute("Tooltip"), xslValueType.Attribute, True) & """" 'End If Dim sColTooltip As String = sGetTooltipTitle(eleCol) Dim sDragHandle As String = "" Dim sResizeHandle As String = "" Dim sColHeader As String = "" If sDraggableColumnsID IsNot Nothing Then If Not bExportReport() Then '16893 sDragHandle = "" End If End If If sResizableColumnsID IsNot Nothing Then If Not bExportReport() Then '16893 sResizeHandle = "" End If End If If eleCol.GetAttribute("HeaderType") = "Image" Then Dim eleHeaderImage As XmlElement = eleCol.AppendChild(xmlDef.CreateElement("Image")) eleHeaderImage.SetAttribute("ID", sID & "-HeaderImage") eleHeaderImage.SetAttribute("Caption", eleCol.GetAttribute("Header")) sColHeader &= sProcessDefinitionElement(eleHeaderImage) eleCol.RemoveChild(eleHeaderImage) Else Dim sHeader As String = eleCol.GetAttribute("Header") sHeader = sHeader.Replace("@Request.", "@RequestXmlEncoded.") 'Ensure valid XHTML. Helps with formulas. Issue 1628 and 8852. sHeader = sHeader.Replace("@Local.", "@LocalHtmlEncoded.") sHeader = sHeader.Replace("@Session.", "@SessionHtmlEncoded.") '#8612 If sHeader.StartsWith("=") Then 'The header is a formula. The value is calculated post-XSL transformation. If sHeader.Length > 1 Then Dim sFormula As String = "rdFormula=""" & sTokenToXsl(sHeader.Substring(1), xslValueType.Attribute, True, True) & """ " sHeader = "rdFormulaValue" sColHeader = "" & sTokenToXsl(sHeader, xslValueType.Element, True) & "" Else sColHeader = sTokenToXsl(sHeader, xslValueType.Element, True) End If Else sColHeader = sTokenToXsl(sHeader, xslValueType.Element, True) End If Dim sFormat As String = eleCol.GetAttribute("Format") If sFormat.Length > 0 Then sColHeader = "" & sColHeader & "" End If End If If sColHeader.Length > 0 Then bTableHeaderPresent = True 'Setup column sorting. 'If http.Request("rdReportFormat") <> "Excel" And http.Request("rdReportFormat") <> "Word" And http.Request("rdReportFormat") <> "PDF" And http.Request("rdReportFormat") <> "HtmlExport" And sGetPagingMethod() <> "Printable" Then If sGetPagingMethod() <> "Printable" Then Dim sColSortUrl As String Dim eleSort As XmlElement = eleCol.SelectSingleNode("DataColumnSort") If Not IsNothing(eleSort) Then Dim sDataColumn As String = eleSort.GetAttribute("DataColumn").Trim If sDataColumn.Length = 0 Then _ Throw New Exception("DataColumnSort elements must have a DataColumn value.") Dim sSortRowLimit As String = eleSort.GetAttribute("SortRowLimit") Dim sSortRowLimitMsg As String = eleSort.GetAttribute("SortRowLimitMsg") If sSortRowLimit.Length <> 0 And sSortRowLimitMsg.Length = 0 Then sSortRowLimitMsg = "There are too many rows to sort." Else sSortRowLimitMsg = sSortRowLimitMsg.Replace("'", "\'") 'Escape any quotes in the user-defined message. End If Dim sSortArrowKeyUrl As String = "" Dim sSortArrowHtml As String = "" If eleDef.GetAttribute("SortArrows") = "True" OrElse bSharedAGDatatableSortArrows Then Dim sSortOrderKey As String = "rdSortArrowKey-" & msRequestedPage.Replace(".", "-") & "-" & sElementID & "-" & eleSort.GetAttribute("DataColumn") 'Use dash seperators that don't break Logi tokens. ' Appended the column name to make the key more unique, #12792. sSortArrowKeyUrl &= "&rdSortArrowTable=" & sSortOrderKey Dim eleArrowDiv As XmlElement Dim eleArrowLabel As XmlElement eleArrowDiv = eleDef.OwnerDocument.CreateElement("Division") eleArrowDiv.SetAttribute("Condition", """@Session." & sSortOrderKey & "~""=""asc""") eleArrowLabel = eleArrowDiv.AppendChild(eleDef.OwnerDocument.CreateElement("Label")) eleArrowLabel.SetAttribute("Caption", "") eleArrowLabel.SetAttribute("Format", "HTML") sSortArrowHtml &= sProcessDefinitionElement(eleArrowDiv) eleArrowDiv = eleDef.OwnerDocument.CreateElement("Division") eleArrowDiv.SetAttribute("Condition", """@Session." & sSortOrderKey & "~""=""desc""") eleArrowLabel = eleArrowDiv.AppendChild(eleDef.OwnerDocument.CreateElement("Label")) eleArrowLabel.SetAttribute("Caption", "") eleArrowLabel.SetAttribute("Format", "HTML") sSortArrowHtml &= sProcessDefinitionElement(eleArrowDiv) End If sColSortUrl = _ "javascript:SubmitSort('rdPage.aspx?" _ & "rdRequestForwarding=Form" _ & "&rdReport=" & msRequestedPage _ & "&rdPaging=@Request.rdPaging~" _ & "&rdShowModes=@Request.rdShowModes~" _ & "&rdDataCache=rdInsertDataCacheKeyHere" _ & "&rdSort=" & sElementID & "~" & rdUtility.UrlEncode4(eleSort.GetAttribute("DataColumn")) & "~" & eleSort.GetAttribute("DataType").Replace(" ", "") & "~" & eleSort.GetAttribute("FirstSortSequence") & "~" & eleSort.GetAttribute("ReverseSortSequence") _ & "&" & sElementID & "-PageNr=0" _ & sRememberSort _ & rdUtility.UrlEncode4(sSortArrowKeyUrl) If eleDef.GetAttribute("AjaxPaging") <> "True" _ OrElse Not IsNothing(HttpContext.Current.Items("rdIsWidgetRequest")) Then 'Widgets are Ajax by nature. #5799 'Keep the scroll position? If eleDef.GetAttribute("KeepScrollPosition") = "True" Then Call subAddIncludedScript("rdScroll.js") Call subAddJavaEventFunction("rdBodyLoad", _ "rdSetScroll()") sColSortUrl &= "&rdSubmitScroll" End If 'Finish the SubmitSort function call. sColSortUrl &= "','@Session." & sElementID & "_RowCnt~','" & sSortRowLimit & "','" & sSortRowLimitMsg & "')" Else 'Ajax paging/sorting. 20543 sColSortUrl = sColSortUrl.Replace("SubmitSort('rdPage.aspx?", "rdAjaxRequest('") 'This doesn't support max sort rows. sColSortUrl &= "&rdDataTablePaging=True" sColSortUrl &= "&rdAjaxCommand=RefreshElement&rdRefreshElementID=" & sElementID & "')" mbAddAjaxSupport = True End If sColHeader = "" & sColHeader & "" & sSortArrowHtml 'Call subAddIncludedScript("rdActionSubmit2.js") End If End If 'Is there a custom column header? Dim eleCustomHdr As XmlElement = eleCol.SelectSingleNode("ExtraColumnHeader") If Not IsNothing(eleCustomHdr) Then bTableHeaderPresent = True eleCustomHdr.PrependChild(eleCustomHdr.OwnerDocument.CreateElement("Spaces")) 'sColHeader &= sProcessDefinitionElementChildren(eleCustomHdr) eleCustomHdr.SetAttribute("ProcessExtraColumnHeader", "T") sColHeader &= sProcessDefinitionElement(eleCustomHdr) eleCustomHdr.RemoveAttribute("ProcessExtraColumnHeader") End If If eleCol.GetAttribute("rdCrosstab") = "True" Then _ sColStyle &= " rdCrosstab=""True"" " 'Is there a CellColorSlider element? Dim eleCellColorSlider As XmlElement = eleCol.SelectSingleNode("CellColorSlider") If Not IsNothing(eleCellColorSlider) Then sCellColorSliderScript &= sProcess_CellColorSlider(eleCellColorSlider, eleDef, eleCol, sColHeader) 'This may modify sColHeader. End If 'Is there a CellBar element? Dim nlCellBars As XmlNodeList = eleCol.SelectNodes("CellBar") 'Dim eleCellBar As XmlElement = eleCol.SelectSingleNode("CellBar") Dim eleCellBar As XmlElement For Each eleCellBar In nlCellBars Call subProcess_CellBar(eleCellBar, eleDef, eleCol) 'This may modify sColHeader. Next '19180 19184 Need to ignore these table headers for export If Not bExportReport() AndAlso (eleDef.GetAttribute("ResizableColumns") = "True" Or eleDef.GetAttribute("DraggableColumns") = "True") Then sDragResizeTableStart = "
    " sDragResizeTableEnd = "
    " End If If eleDef.GetAttribute("DraggableColumns") = "True" Then sColumnSeqAttr = " rdColumnSeq=""""" ' ** Exclude this part for exports here, combines fixes for both 15377 and 16363. ' ** revert back 15377 which disabled draggable columns for exports, include them now but make sure they don't break. 16363 fix. If Not bExportReport() Then sDragTableNewCell = "" sDragTableEnd = "" End If End If If eleDef.GetAttribute("ResizableColumns") = "True" Then If Not eleDef.GetAttribute("Class").Contains(" rdResizableColumns") Then eleDef.SetAttribute("Class", eleDef.GetAttribute("Class") & " rdResizableColumns") End If subAddIncludedCss("rdResize/rdResizableColumns.css") sColumnSeqAttr = " rdColumnSeq=""""" ' ** Exclude this part for exports here, combines fixes for both 15377 and 16363. ' ** revert back 15377 which disabled draggable columns for exports, include them now but make sure they don't break. 16363 fix. If Not bExportReport() Then sResizeTableNewCell = "" End If End If Dim eleClassElement As XmlElement = eleDef 'This is the element containing the class attribute. Dim sColumnHeaderClassAttribute As String = "Class" If eleDef.HasAttribute("ColumnHeaderClass") Then sColumnHeaderClassAttribute = "ColumnHeaderClass" End If If eleCol.HasAttribute("ColumnHeaderClass") Then sColumnHeaderClassAttribute = "ColumnHeaderClass" 'eleCol.SetAttribute("ColumnHeaderClass", eleDef.GetAttribute("ColumnHeaderClass") & " " & eleCol.GetAttribute("ColumnHeaderClass")) eleClassElement = eleCol 'Get the class from the column. End If sColHeader = sSetClass(eleClassElement, "" & sDragResizeTableStart & sDragHandle & sDragTableNewCell & sColHeader & sResizeTableNewCell & sResizeHandle & sDragResizeTableEnd & "", sColumnHeaderClassAttribute) 'End If 'sColHeader = sSetClass(eleDef, "" & sColHeader & "", sColumnHeaderClass) sColHeader = sSetConditionalElement(eleCol, sColHeader) ' #3446 Dim suffix As String = "-TH" sColHeader = sSetID(eleCol, sColHeader, suffix) 'sColHeader = sSetAlign(eleCol, sColHeader) ' ''Commented for Issue # 1455 ' ''If Array.IndexOf("Excel,NativeExcel,Word,CSV".Split(","), st.sGetRequestVar("rdReportFormat")) <> -1 Then ' '' 'Excel and Word don't know how to work with the COL element. COL allows a column to be completely ' '' 'hidden. So we need to set visibility for the TH and the column data too. ' '' sColHeader = sSetVisibility(eleCol, sColHeader) ' ''End If ' ''sTblHeader = sTblHeader & sColHeader ' ''If Not bExportCsv() And Not bExportNativeExcel() Then 'This col element gives trouble to the CSV and NativeExcel routines. ' '' Dim sTblCol As String = "" ' '' sTblCol = sSetID(eleCol, sTblCol) ' '' sTblCol = sSetVisibility(eleCol, sTblCol) ' '' sTblCols &= sTblCol & "" ' ''End If If eleCol.GetAttribute("Header") = "None" Then sColHeader = "" ElseIf Not String.IsNullOrEmpty(sColHeader) Then sColHeader = GetColHeaderWithUniqueId(sColHeader) Dim idIndex As Integer = sColHeader.IndexOf("id=") + 4 Dim length As Integer = sColHeader.IndexOf(">") - idIndex - 1 If length > 0 Then '23656 Dim id As String = sColHeader.Substring(idIndex, length) eleCol.SetAttribute("rdColumnId", id) End If sColHeader = sAddRdIdeIdx(eleCol, sColHeader) sTblHeader &= sColHeader End If Dim sTblCol As String = "" sTblCol = sSetID(eleCol, sTblCol) sTblCol = sSetVisibility(eleCol, sTblCol) sTblCol &= "" sTblCol = sSetConditionalElement(eleCol, sTblCol) ' #3446 sTblCol = sSetStyle(eleDef, sTblCol) 'Originally put here to set cell background colors for crosstab comparisons. sTblCols &= sTblCol End If Next If eleDef.GetAttribute("rdFromOlapGrid") = "True" Then 'Prevent an empty header row. A better way to do this might be to look at the contents of the column headers and do this if they are all blank. '10891 sTblHeader = "" End If Dim sRenderHeaders As String = st.sGetAttribute(eleDef, "AccessibleHeaders", "False") If sRenderHeaders = "False" Then sRenderHeaders = st.sGetAttribute(eleDef.OwnerDocument.SelectSingleNode(".//AnalysisGrid"), "AccessibleHeaders", "False") End If Dim sRdFromOlapGrid As String = st.sGetAttribute(eleDef, "rdFromOlapGrid", "False") Dim sTblTopHeaderRows As String = "" Dim sTblBottomHeaderRows As String = "" Dim eleHeaderRow As XmlElement For Each eleHeaderRow In eleDef.SelectNodes("HeaderRow") bTableHeaderPresent = True 'Set the class for the header row. For Each eleHeaderCell As XmlElement In eleHeaderRow.SelectNodes("Column") Dim id As String = eleHeaderCell.GetAttribute("ID") If String.IsNullOrEmpty(id) OrElse (id = "col0") Then eleHeaderCell.SetAttribute("ID", GetUniqueFormattedId("")) End If Next If eleHeaderRow.GetAttribute("Class").Length = 0 Then If eleDef.GetAttribute("ColumnHeaderClass").Length <> 0 Then eleHeaderRow.SetAttribute("Class", eleDef.GetAttribute("ColumnHeaderClass")) ElseIf eleDef.GetAttribute("Class").Length <> 0 Then eleHeaderRow.SetAttribute("Class", eleDef.GetAttribute("Class")) End If End If 'Create the header row. If eleHeaderRow.GetAttribute("HeaderPosition") = "Top" Then sTblTopHeaderRows &= sGetSummaryRow(eleDef, eleHeaderRow) Else sTblBottomHeaderRows &= sGetSummaryRow(eleDef, eleHeaderRow) End If If sRenderHeaders = "True" Then Dim eleHeaderCell As XmlElement Dim eleHeaders As XmlNodeList = eleDef.SelectNodes("DataTableColumn") Dim nCurrentIndex As Integer = 0 For Each eleHeaderCell In eleHeaderRow.SelectNodes("Column") Dim nColSpan As Integer If Not Integer.TryParse(eleHeaderCell.GetAttribute("ColSpan"), nColSpan) Then nColSpan = 1 End If If nCurrentIndex < eleHeaders.Count Then For i As Integer = nCurrentIndex To nCurrentIndex + nColSpan - 1 If i = eleHeaders.Count Then Exit For End If CType(eleHeaders.ItemOf(i), XmlElement).SetAttribute("rdSubHeaderIDs", CType(eleHeaders.ItemOf(i), XmlElement).GetAttribute("rdSubHeaderIDs") & " " & eleHeaderCell.GetAttribute("ID")) Next nCurrentIndex += nColSpan End If Next End If Next sTblTopHeaderRows = sTblTopHeaderRows.Replace("", "") sTblBottomHeaderRows = sTblBottomHeaderRows.Replace("", "") ' If sRdFromOlapGrid = "True" Then 'sTblTopHeaderRows = sTblTopHeaderRows.Replace(" 0 Then _ sTblHeader = "" & sTblHeader & "" sTblHeader = sTblTopHeaderRows & sTblHeader & sTblBottomHeaderRows & CrLf If sGetPagingMethod() <> "Printable" _ Or (http.Request("rdReportFormat") = "PDF" AndAlso rdPdfUtil.GetPdfType(st) = "Version7") _ Or (http.Request("rdReportFormat") = "NativeWord") Then 'When sent to the printer, the table will have a table header on each page. 'But when printable, this kind of thing is done in the JScript. sTblHeader = "" & sTblHeader & "" End If Else sTblHeader = "" End If 'Make an HTML table record, leaving the @Data tokens in. 'Dim sListRecord As String = eleDef.GetAttribute("Display") 'sListRecord = " " Dim sListRecord As String = "" 'This had a space after the >. Fixed for issue 1068. Dim slash As String = rdState.GetSlash() If eleDef.GetAttribute("AltRowClass").Length > 0 Then sListRecord &= rdUtility.ReadFile(rdState.sGetPhysicalPath() & slash & "rdTemplate" & slash & "rdAlternatingRow.xsl").Replace("rdAltRowClass", eleDef.GetAttribute("AltRowClass")) End If Dim sInlineHeadersId As String = "" Dim eleGHR As XmlElement 'GHR = GroupHeaderRow For Each eleGHR In eleDef.SelectNodes("GroupHeaderRow") If eleGHR.SelectNodes(".//Column").Count = 0 Then Dim sGroupColumn As String = eleGHR.GetAttribute("GroupColumn") Dim eleGC As XmlElement = eleGHR.SelectSingleNode("//DataTableColumn[@ID='" & "col" & sGroupColumn & "']") If eleGC IsNot Nothing And Not bExportReport() And sRenderHeaders = "True" Then sInlineHeadersId &= String.Format("{0}{1}", eleGC.GetAttribute("ID"), "_Row{rdXslExtension:GetSessionVar('nGroupRowNr')}") End If ElseIf eleGHR.SelectNodes(".//Column").Count > 1 Then Dim sGroupColumn As String = eleGHR.GetAttribute("GroupColumn") 'Dim eleGC As XmlElement = eleGHR.SelectSingleNode("//Column[@DataColumn='" & sGroupColumn & "']") Dim eleGC As XmlElement = Nothing If sGroupColumn <> "" Then eleGC = eleGHR.SelectSingleNode("//Column[@DataColumn='" & sGroupColumn & "']") End If If eleGC IsNot Nothing And Not bExportReport() And sRenderHeaders = "True" Then sInlineHeadersId &= String.Format("{0}{1}", eleGC.GetAttribute("ID"), "_Row{rdXslExtension:GetSessionVar('nGroupRowNr')}") End If Else Dim eleGC As XmlElement = eleGHR.SelectSingleNode(".//Column") If (IsNothing(eleGC)) Then Continue For End If Dim groupId As String = eleGHR.GetAttribute("GroupFilterID") Dim groupFilter As XmlElement = eleDef.SelectSingleNode("//GroupFilter [@ID=""" & groupId & """]") If IsNothing(groupFilter) Then groupFilter = eleDef.SelectSingleNode("//SqlGroup [@ID=""" & groupId & """]") Dim groupColumn As String = groupFilter.GetAttribute("GroupColumn").Replace(",", "-").Replace(" ", "") sInlineHeadersId &= String.Format("{{rdXslExtension:GetGroupHeaderAttribute('{0}', '{1}')}} ", eleGC.GetAttribute("ID"), groupColumn) buildClearVarString(String.Format("", groupColumn)) End If Next Dim nColumns As Integer = 0 For Each eleCol In eleDef.SelectNodes("DataTableColumn") Dim sHeadersAttr As String = "" If Not bExportReport() Or bElementInitiallyVisible(eleCol) Then 'Added for Issue # 1455. Don't create invisible columns for exported reports. ' This prevents ShowElement from working. If bElementInitiallyVisible(eleCol) Then Dim sColStyle As String = "" If Not bTableHeaderPresent Then 'Need to set the column width for each row when it wasn't set in a table header row. ' ''If Not bExportCsv() And Not bExportNativeExcel() Then If eleCol.GetAttribute("Width").Length > 0 Then 'sColStyle = "style=""width: " & eleCol.GetAttribute("Width") & eleCol.GetAttribute("WidthScale") & """" sColStyle = "width: " & eleCol.GetAttribute("Width") & st.sGetAttribute(eleCol, "WidthScale", "px") End If ' ''End If End If If eleCol.GetAttribute("BackgroundColor").Length > 0 Then sColStyle &= " background-color:" & eleCol.GetAttribute("BackgroundColor") & ";" End If If eleCol.GetAttribute("TextColor").Length > 0 Then sColStyle &= " color:" & eleCol.GetAttribute("TextColor") & ";" End If If sColStyle.Length <> 0 Then sColStyle = "style=""" & sTokenToXsl(sColStyle, xslValueType.Attribute) & """ " '13869 End If Dim sCrosstabAttr As String = "" If eleCol.GetAttribute("rdCrosstab") = "True" Then _ sCrosstabAttr = " rdCrosstab=""True"" " Dim idAttributeValue As String = rdUtility.GetAttributeEncoded(eleCol, "rdColumnId") If (idAttributeValue.EndsWith("-TH")) Then idAttributeValue = idAttributeValue.Remove(idAttributeValue.Length - 3) End If Dim sListFieldID As String = "id='" & idAttributeValue & "-TD' " If eleDef.GetAttribute("DontOutputElementIDs") = "True" _ AndAlso eleDef.Name <> "CrosstabTable" Then sListFieldID = "" 'Don't output the ID. '#9301 End If Dim sOpenTD As String = "" 'This had a space after the >. Fixed for issue 1068. 'This saves a lot of memory for large reports by reducing the HTML size. Dim bSetClass As Boolean = True Dim bSetID As Boolean = True If bExportCsv() Then bSetClass = False If Not Array.IndexOf(st.sGetRequestVar("rdCsvStringColumns").Split(","), eleCol.GetAttribute("ID")) <> -1 Then bSetID = False End If '15506 - remove version7. 'ElseIf bExportExcel() AndAlso rdNativeExcelUtil.GetExcelType(st) = "Version7" Then ' bSetClass = False ' bSetID = False End If If bSetID Then sListField = sSetID(eleCol, sListField) End If Dim elementId As String = rdUtility.GetAttributeEncoded(eleCol, "ID") If Not String.IsNullOrEmpty(elementId) AndAlso Not eleCol.GetAttribute("rdCrosstab") = "True" Then Dim index As Integer = sListField.IndexOf("id='") Dim quoteIndex As Integer = sListField.IndexOf("'", index) + 1 Dim secondQuoteIndex As Integer = sListField.IndexOf("'", quoteIndex) sListField = sListField.Remove(quoteIndex, secondQuoteIndex - quoteIndex) sListField = sListField.Insert(quoteIndex, elementId & "_Row{position()}") If eleCol.GetAttribute("ScopeRowHeader") = "True" _ And Not bExportReport() And sRenderHeaders = "True" Then 'sInlineHeadersId &= String.Format("{0}{1} {2} {3}", elementId, "_Row{position()}", eleCol.GetAttribute("rdColumnId"), eleCol.GetAttribute("rdSubHeaderIDs")) sInlineHeadersId &= String.Format("{0}{1} {2}", elementId, "_Row{position()}", eleCol.GetAttribute("rdSubHeaderIDs")) sInlineHeadersId = sInlineHeadersId.Trim() End If End If If bSetClass Then sListField = sSetClass(eleCol, sListField) End If 'sListField = sSetBackgroundImage(eleCol, sListField) 'Get the XSL for all the child elements. Dim sCellXsl As String = sProcessDefinitionElementChildren(eleCol) If bExportNativeExcel() Then '#4763 If sCellXsl.Length = 0 Then sCellXsl = "" End If End If Call HideDuplicateColumnValues(eleCol, sElementID, sCellXsl) sListField &= sCellXsl sListField &= sCloseTD & CrLf If Array.IndexOf("Excel,NativeExcel,Word,CSV,HtmlEmail".Split(","), st.sGetRequestVar("rdReportFormat")) <> -1 Then 'Excel and Word don't know how to work with the COL element. COL allows a column to be completely 'hidden. So we need to set visibility for the TH and the column data too. sListField = sSetVisibility(eleCol, sListField) End If sListField = sSetConditionalElement(eleCol, sListField) ' #3446 '10831 - Actions and EventHandlers for Columns. Call subConvertActionToEventHandler(eleCol) sListField = sSetEventHandler(eleCol, sListField) sListField = sAddRdIdeIdx(eleCol, sListField) If eleCol.GetAttribute("rdRemark") <> "True" Then 'This is only used by the AnalysisGrid to hide the DataTableColumn definition. sListRecord = sListRecord & sListField nColumns += 1 End If End If Next ''TableRowsConditionalClass (experimental) 'Dim nlRowsConditionalClasses As XmlNodeList = eleDef.SelectNodes("TableRowsConditionalClass") 'If nlRowsConditionalClasses.Count <> 0 Then ' 'Create a new ConditionalClass element under a temporary dummy element, then call sSetClass on the TR tag. ' Dim eleTemp As XmlElement = eleDef.AppendChild(eleDef.OwnerDocument.CreateElement("TempHolder")) ' For Each eleRowsConditionalClass As XmlElement In nlRowsConditionalClasses ' Dim eleConditionalClass As XmlElement = eleTemp.AppendChild(eleDef.OwnerDocument.CreateElement("ConditionalClass")) ' eleConditionalClass.SetAttribute("Condition", eleRowsConditionalClass.GetAttribute("Condition")) ' eleConditionalClass.SetAttribute("Class", eleRowsConditionalClass.GetAttribute("Class")) ' Next ' sListRecord = sSetClass(eleTemp, sListRecord, "RowsClass") ' eleDef.RemoveChild(eleTemp) 'End If 'RowClass '10987 sListRecord = sSetClass(eleDef, sListRecord, "RowClass") 'sListRecord &= "" & CrLf 'This adds a CR at the end of each row. It's needed when we do ReadLine in the HtmlFixup. sListRecord &= "" & XSL_LINEFEED & CrLf 'MoreInfoRow: Are there any More Info Rows? sListRecord &= sGetMoreInfoRows(eleDef, nColumns) 'GroupHeaderRow: GetGroupHeaderRows(eleDef, sListRecord) 'sListRecord may be changed. 'GroupSummarRow: sListRecord &= sGetGroupSummaryRows(eleDef, sColumnSeqAttr) 'If sGetPagingMethod() = "Printable" Then If Not IsNothing(melePrintablePaging) Then sListRecord &= "" 'This is used for pagebreaking on the client side to determine where the end of each row is located. 'Else ' dbug.AddDebugMessage(, "** WARNING ** rdReportFormat=Printable, but there is no PrintablePaging element.") End If 'End If 'Get the Xsl template for a data table. Dim sXsl As String sXsl = rdUtility.ReadFile(rdState.sGetPhysicalPath() & slash & "rdTemplate" & slash & "rdDataTable.xsl") sXsl = sXsl.Replace("", sTblBottomHeaderRows) If eleDef.GetAttribute("ID").Contains("dtAnalysisGrid") Then '#15049. 'Issue 16020 - Look for KeepGroupedRows with a parent that is not an EmptyDataLayer - or else we lose data.'RD20519 (look just under the non empty dl, not child one's) If Not IsNothing(eleDef.SelectSingleNode("./DataLayer[@Type!='EmptyDataLayer']/GroupFilter[@KeepGroupedRows='False']")) Then sListRecord = sListRecord.Substring(0, sListRecord.LastIndexOf("")) End If End If sXsl = sXsl.Replace("", sListRecord) sXsl = sXsl.Replace("rdDataID", sElementID) sXsl = sXsl.Replace("rdDataTableID", sElementID) If Not bExportReport() Then sXsl = sXsl.Replace("", "") '10478 End If 'If sTableResizeScript.Length <> 0 Then ' sTableResizeScript = " onresize=""alert('1');" & sTableResizeScript & """ " 'End If Dim sTableBorder As String = "" If eleDef.GetAttribute("TableBorder").Length <> 0 Then sTableBorder = " border=""" & eleDef.GetAttribute("TableBorder") & """ " End If Dim sTblStyle As String = "" ''This may need to come back. ''Dim elePrintablePaging As XmlElement If sGetPagingMethod() = "Printable" _ AndAlso http.Request("rdReportFormat") = "PDF" AndAlso rdPdfUtil.GetPdfType(st) = "PdfPack" Then 'Old-style BCL PDF. '' elePrintablePaging = eleDef.SelectSingleNode("PrintablePaging") '' Dim nPrintablePageWidth As Single = CSng("0" + elePrintablePaging.GetAttribute("PageWidth")) '' If nPrintablePageWidth = 0 Then nPrintablePageWidth = 6.5 '' sTblStyle = "width: " & CInt(nPrintablePageWidth * 87) & "px;" '87 is an IE constant. Else If eleDef.GetAttribute("Width").Length > 0 Then 'sTblStyle = "width: " & eleDef.GetAttribute("Width") & eleDef.GetAttribute("WidthScale") & ";" sTblStyle = "width: " & eleDef.GetAttribute("Width") & st.sGetAttribute(eleDef, "WidthScale", "px") & ";" End If If eleDef.GetAttribute("Height").Length > 0 Then sTblStyle &= "height: " & eleDef.GetAttribute("Height") & st.sGetAttribute(eleDef, "HeightScale", "px") & ";" End If End If If eleDef.GetAttribute("Layout") = "Fixed" Then sTblStyle &= "table-layout:fixed;" End If sTblStyle = "style=""" & sTblStyle & """" Dim sTableSummaryAttr = eleDef.GetAttribute("AccessibleSummary") If Not sTableSummaryAttr = "" Then sTableSummaryAttr = " summary=""" & sTableSummaryAttr & """ " End If 'sReturn = sSetClass(eleDef, "") sReturn = sSetClass(eleDef, "
    ") sReturn = sSetPositioning(eleDef, sReturn) sReturn = sSetID(eleDef, sReturn) sReturn = sSetCellSpacing(eleDef, sReturn) 'sReturn = sSetBackgroundImage(eleDef, sReturn) 'Set the table's caption. sReturn &= sBuildTableCaption(eleDef) sReturn &= sTblCols 'sReturn &= sTblHeader 'sXsl = sXsl.Replace("", sTblHeader & vbCrLf & "") This caused extra headers for MIRs with SubDataTables sXsl = sXsl.Insert(sXsl.IndexOf("", "").Replace("", "") '10478 End If sReturn &= sXsl 'sReturn = sReturn.Insert(sReturn.IndexOf("") + 11, sTblBottomHeaderRows) sReturn &= sTblSummaryRow sReturn &= sCellColorSliderScript sReturn &= "
    " Call subHideWhenZeroRows(eleDef, sReturn) 'This may modify eleDef and sReturn. 'Does the table need Interactive paging? 'If IsNothing(http.Request("rdPaging")) Or http.Request("rdPaging") = "Interactive" Then If sGetPagingMethod() <> "Printable" And Not bExportReport() Then Dim elePaging As XmlElement = eleDef.SelectSingleNode("InteractivePaging[not(@Remove='True')]") If Not IsNothing(elePaging) Then If bActiveSqlDataLayer Then 'By default, for DataTables with ActiveSQL, and interactive paging, don't get the row count. This is faster. If Not eleDataLayer.HasAttribute("SkipRowCount") Then _ eleDataLayer.SetAttribute("SkipRowCount", "True") 'Make a new ResultsetGuid? Dim bFreshResultsetGUID As Boolean = False Dim sGuidSessionVar As String = "rdResultsetGuid:" & msRequestedPage & ":" & sElementID 'This variable will keep this table's ResultsetGuid. It's the report name + table ID. Dim sGuid As String = http.Session(sGuidSessionVar) If IsNothing(sGuid) Then 'Guid not set for this table yet. bFreshResultsetGUID = True ElseIf st.sGetRequestVar("rdDataCache").Length = 0 Then 'The entire page is getting new data. bFreshResultsetGUID = True End If If bFreshResultsetGUID Then sGuid = Guid.NewGuid.ToString.Replace("-", "") http.Session(sGuidSessionVar) = sGuid eleDataLayer.SetAttribute("FirstRow", "1") 'TODO Remove me eleDataLayer.SetAttribute("RowCount", elePaging.GetAttribute("PageRowCount")) End If eleDataLayer.SetAttribute("rdResultsetGuid", sGuid) End If '#7214 elePaging.AppendChild(xmlDef.CreateElement("LineBreak")) 'Create a Division element. It creates a SPAN so that all controls can be styled together. Dim eleDiv As XmlElement = elePaging.AppendChild(xmlDef.CreateElement("Division")) eleDiv.SetAttribute("HtmlDiv", "True") 'Create new elements to represent the paging controls. Call subAddInteractivePagingControl(eleDef, eleDataLayer, elePaging, eleDiv, "FirstPageCaption", "1") Call subAddInteractivePagingControl(eleDef, eleDataLayer, elePaging, eleDiv, "PreviousPageCaption", "@Session." & sElementID & "-PrevPageNr~") If elePaging.GetAttribute("ShowPageNumber") = "True" Then Call subAddInteractivePagingControl(eleDef, eleDataLayer, elePaging, eleDiv, "PageOfPages", "") ElseIf elePaging.GetAttribute("ShowPageNumber") = "Numbered" Then Call subAddInteractivePagingControl(eleDef, eleDataLayer, elePaging, eleDiv, "Numbered", "") End If Call subAddInteractivePagingControl(eleDef, eleDataLayer, elePaging, eleDiv, "NextPageCaption", "@Session." & sElementID & "-NextPageNr~") Call subAddInteractivePagingControl(eleDef, eleDataLayer, elePaging, eleDiv, "LastPageCaption", "@Session." & sElementID & "-LastPageNr~") Dim sPaging As String = sProcessDefinitionElementChildren(elePaging) 'If elePaging.GetAttribute("NoWrap") = "False" Then 'This attribute is not published. Dim sTdNoWrap As String = sSetClass(elePaging, "") sPaging = "" & sTdNoWrap & sPaging & "
    " '#7218 sPaging = sSetID(elePaging, sPaging) '#7215 sPaging = sSetClass(elePaging, sPaging) '#7290 'End If sPaging = "" & sPaging & "" 'Wrap it up so it can be removed sPaging = "" & sPaging & "" 'This SPAN is used to wrap the entire control for WYSIWYG. sPaging = sSetPositioning(elePaging, sPaging) Call subHideWhenOnePage(elePaging, sPaging) sPaging = sAddRdIdeIdx(elePaging, sPaging) If "Top,Both".IndexOf(elePaging.GetAttribute("Location")) > -1 Then 'sReturn = sPaging.Replace("rdNewPageNr=True", "rdNewPageNr=True1") & "

    " & CrLf & sReturn sReturn = sPaging.Replace("rdNewPageNr=True", "rdNewPageNr=True1") & CrLf & sReturn End If If "Bottom,Both".IndexOf(elePaging.GetAttribute("Location")) > -1 Then 'For the bottom/second paging control, replace the text box's ID to a different value so it can be found with getElementById(). sPaging = sPaging.Replace("id=""" & sElementID & "-PageNr""", "id=""" & sElementID & "-PageNr2""") sPaging = sPaging.Replace("document.getElementById('" & sElementID & "-PageNr').value", "document.getElementById('" & sElementID & "-PageNr2').value") sReturn = sReturn & CrLf & sPaging.Replace("rdNewPageNr=True", "rdNewPageNr=True2") End If Else 'Append-style Paging elePaging = eleDef.SelectSingleNode("AppendPaging") If Not IsNothing(elePaging) Then Dim eleDiv As XmlElement = elePaging.AppendChild(xmlDef.CreateElement("Division")) eleDiv.SetAttribute("HtmlDiv", "True") elePaging.SetAttribute("HideShowPrevNextCaptions", "True") Call subAddInteractivePagingControl(eleDef, eleDataLayer, elePaging, eleDiv, "NextPageCaption", "@Session." & sElementID & "-NextPageNr~") Dim sPaging As String = sProcessDefinitionElementChildren(elePaging) sPaging = sSetID(elePaging, sPaging) sPaging = "" & sPaging & "" 'Wrap it up so it can be removed sReturn = sReturn & CrLf & sPaging End If End If End If If Not bExportReport() AndAlso sGetPagingMethod() = "Printable" Then 'Setup dynamic printable paging by IE. sbHead.Append("") If Not IsNothing(melePrintablePaging) Then Dim sShowPrintDialog As String = "" If http.Request("rdReportFormat") <> "PDF" Then 'Showing the dialog breaks PDF generation. sShowPrintDialog = melePrintablePaging.GetAttribute("ShowPrintDialog") End If Call subAddIncludedScript("rdPrintablePageBreaks.js") If IsNothing(eleDef.PreviousSibling) Then '#7332. Call subAddJavaEventFunction("rdBodyLoad", _ "DoPrintablePageBreaks('" & eleDef.GetAttribute("ID") & "','" & melePrintablePaging.GetAttribute("PageHeight").Replace(",", ".") & "','" & sShowPrintDialog & "'); ") Else If Not eleDef.PreviousSibling.Name = "DataTable" Then _ Call subAddJavaEventFunction("rdBodyLoad", _ "DoPrintablePageBreaks('" & eleDef.GetAttribute("ID") & "','" & melePrintablePaging.GetAttribute("PageHeight").Replace(",", ".") & "','" & sShowPrintDialog & "'); ") End If End If End If If sHiddenDataTableInputFlag.Length <> 0 Then sReturn = sHiddenDataTableInputFlag & sReturn End If If http.Request("rdReportFormat") = "PDF" _ AndAlso rdPdfUtil.GetPdfType(st) = "Version8" Then 'The DIV below that we use for Ajax doesn't work for PDF. So we add this dummy IMG. sReturn &= "" End If 'This is used for Ajax paging and sorting so that all the table elements can be replaced at once. If eleDef.GetAttribute("ID") = "dtAnalysisGrid" Then sReturn = String.Format("
    {1}
    ", sElementID, sReturn) Else sReturn = String.Format("
    {1}
    ", sElementID, sReturn) End If 'Replace values in the XSL template. sReturn = sReturn.Replace("rdElementID", sElementID) Return sReturn End Function Private Function GetColHeaderWithUniqueId(ByVal sColHeader As String) As String Const SKIP_ID As Integer = 4 Const QUOTE As Integer = 1 Dim startIndex As Integer = sColHeader.IndexOf("id=") + SKIP_ID Dim endIndex As Integer = sColHeader.IndexOf(">") Dim length As Integer = endIndex - startIndex - QUOTE If length < 0 Then '23656 Return sColHeader End If Dim id As String = sColHeader.Substring(startIndex, length) id = GetUniqueFormattedId(id) sColHeader = sColHeader.Remove(startIndex, length) Return sColHeader.Insert(startIndex, id) End Function Private Function GetUniqueFormattedId(ByVal id As String) As String Const TH As String = "-TH" Dim isTh As Boolean = id.EndsWith(TH) If (isTh) Then Const TH_LENGTH As Integer = 3 id = id.Remove(id.Length - TH_LENGTH) End If id = GetUniqueIdForDataTableColumn(id) If (isTh) Then id &= TH End If Return id End Function Private Function sProcess_XolapTable(ByRef eleDef As XmlElement) As String Dim sReturn As String = "" '#If Not java Then If eleDef.GetAttribute("ID").Length = 0 Then _ Throw New Exception("XolapTables must have an ID value.") Dim eleDataLayer As XmlElement = eleDef.SelectSingleNode("XolapCube") If IsNothing(eleDataLayer) Then Return "" 'happens with filters End If Dim rdXolap As New rdOlap.rdOlapTable rdXolap.isXolap = True Dim XmlOutput As New XmlDocument '#If JAVA Then ' Dim xcs As New rdOlap.XolapCellSet ' 'do we need to get the data layer, or is it cached? ' Dim bolGotCache As Boolean = rdXolap.bXolapCellsetCacheExists(eleDef, xcs, Nothing, XmlOutput, xmlSettings) '#Else Dim bUseBinary As Boolean = (rdState.GetApplicationConstant("rdConstant-XolapCube").Equals("Binary")) Dim xcs As New LogiCubeEngine.Cube.XolapCellSet() Dim bolGotCache As Boolean = False If (Not bUseBinary) AndAlso IsNothing(eleDef.SelectSingleNode("ancestor::Dashboard2")) Then bolGotCache = rdXolap.bXolapCellsetCacheExists(eleDef, xcs, Nothing, XmlOutput, xmlSettings) '#End If Dim strmXolapDataLayer As System.IO.Stream = Nothing Dim db9 As New rdDb9(xmlSettings, dbug) Dim strXPathDL As String = "DataLayer" If Not bolGotCache Then Dim eleXmlfileDatalayer As XmlElement = eleDataLayer.SelectSingleNode("DataLayer[@ID='rdCachedData']") Dim sFilename As String = "" If (eleXmlfileDatalayer IsNot Nothing) Then '21831 sFilename = eleXmlfileDatalayer.GetAttribute("XMLFile") If (Not String.IsNullOrEmpty(sFilename)) AndAlso File.Exists(sFilename) Then strmXolapDataLayer = New FileStream(sFilename, FileMode.Open, FileAccess.Read) strmXolapDataLayer.Position = 0 bolGotCache = True Else eleXmlfileDatalayer.ParentNode.RemoveChild(eleXmlfileDatalayer) Dim nlDataLayers As XmlNodeList = eleDef.SelectNodes("//*[not(self::LocalData or self::DataLayer)]/DataLayer") For Each eleSubDataLayer As XmlElement In nlDataLayers If eleSubDataLayer.GetAttribute("Type").Equals("EmptyDataLayer") Then eleSubDataLayer.SetAttribute("Type", eleSubDataLayer.GetAttribute("OriginalType")) Exit For End If Next End If End If If (Not bolGotCache) Then strmXolapDataLayer = db9.xmlGetData(eleDataLayer, strXPathDL) strmXolapDataLayer.Position = 0 If (Not String.IsNullOrEmpty(sFilename)) AndAlso (Not File.Exists(sFilename)) Then '21831 rdUtility.WriteFile(sFilename, strmXolapDataLayer) strmXolapDataLayer.Position = 0 End If End If 'Dim sFilename As String = eleXmlfileDatalayer.GetAttribute("XMLFile") 'If IsNothing(eleXmlfileDatalayer) OrElse Not File.Exists(sFilename) Then ' If Not File.Exists(sFilename) Then '21831 ' eleXmlfileDatalayer.ParentNode.RemoveChild(eleXmlfileDatalayer) ' Dim nlDataLayers As XmlNodeList = eleDef.SelectNodes("//*[not(self::LocalData or self::DataLayer)]/DataLayer") ' For Each eleSubDataLayer As XmlElement In nlDataLayers ' If eleSubDataLayer.GetAttribute("Type").Equals("EmptyDataLayer") Then ' eleSubDataLayer.SetAttribute("Type", eleSubDataLayer.GetAttribute("OriginalType")) ' Exit For ' End If ' Next ' End If ' strmXolapDataLayer = db9.xmlGetData(eleDataLayer, strXPathDL) ' strmXolapDataLayer.Position = 0 ' If Not File.Exists(sFilename) Then '21831 ' rdUtility.WriteFile(sFilename, strmXolapDataLayer) ' strmXolapDataLayer.Position = 0 ' End If 'Else ' strmXolapDataLayer = New FileStream(sFilename, FileMode.Open, FileAccess.Read) ' strmXolapDataLayer.Position = 0 'End If End If If (bUseBinary) Then dbug.AddDivider("Start OLAP Binary Data Cube") dbug.AddDebugMessage("Binary OLAP", "Start Cube Processing") dbug.AddDebugMessage("", "Cube Definition", "View Definition", eleDef) Dim dtStart As DateTime = Now Dim oCube As New LogiCubeEngine.InfoCube() sReturn = oCube.GetXolapData(eleDef, xcs, strmXolapDataLayer, XmlOutput, xmlSettings) Dim iCount As Integer = oCube.RowCount Dim sMessage As String = String.Format("{0:#,##0} records in {1:#,##0.00} seconds. ({2:#,##0} rows per minute)", oCube.RowCount, (Now - dtStart).TotalSeconds, iCount / (Now - dtStart).TotalMinutes) dbug.AddDebugMessage("", "Data Records Processed", sMessage) dbug.AddDebugMessage("", "Binary Cube Complete") Else dbug.AddDivider("Start OLAP XML Cube") sReturn = rdXolap.subXolapGetData(eleDef, xcs, strmXolapDataLayer, XmlOutput, xmlSettings) dbug.AddDebugMessage("", "XML Cube Complete") End If dbug.AddDivider("Cube Data Processing Completed") Dim eleDataTable As XmlElement = Nothing Try 'sort top axis '#If JAVA Then ' xcs.Axes(0).Positions.Sort(New rdOlap.XolapCellSet.XolapPositionComparer) '#Else xcs.Axes(0).Positions.Sort(New LogiCubeEngine.Cube.XolapCellSet.XolapPositionComparer()) '#End If eleDataTable = rdXolap.OlapTableToDataTable(eleDef, xmlSettings, XmlOutput, xcs) Catch ex As Exception Throw New Exception("Error processing a XolapTable.", ex) End Try If Not IsNothing(eleDataTable) Then eleDataTable.SetAttribute("FromOlapTable", "True") dbug.AddDebugMessage("XolapTable", "Generated", "View Definition", eleDataTable) HttpContext.Current.Session(msRequestedPage & "_rdOgTable_" & eleDef.GetAttribute("ID")) = eleDataTable.OuterXml If eleDef.GetAttribute("AddedToDashboard") = "True" Then subModifyOlapComponentsForDashboard(eleDataTable) End If plugin.CallPlugins_GeneratedElement(eleDataTable, eleDef) '14254 - Call Plugins from more places - ElementPluginCall eleDef.ParentNode.InsertAfter(eleDataTable, eleDef) 'For the Filter PopupPanel, add a LinkParam to all actions so that the popup isn't closed when the user clicks something. Dim eleFilterPopup As XmlElement = eleDef.SelectSingleNode("//Division[@ID='divFilterTable']") If Not IsNothing(eleFilterPopup) Then 'We're building the Filter's table. For Each eleLinkParams As XmlElement In eleFilterPopup.SelectNodes(".//LinkParams") eleLinkParams.SetAttribute("rdShowFilterPopup", "True") 'Keep the Popup alive as the page is updated. Next End If End If 'prevent re-running of data layer Dim eleInternalDataLayer As XmlElement = eleDataLayer.SelectSingleNode("DataLayer") If Not eleInternalDataLayer Is Nothing Then eleInternalDataLayer.SetAttribute("Type", "EmptyDataLayer") End If '#End If Return sReturn End Function Private Function sBuildTableCaption(ByVal eleDef As XmlElement) As String 'This function as added to resolve #4654: Error with Special Characters in Table Captions If eleDef.GetAttribute("Caption").Length <> 0 Then 'old way: sReturn &= sSetClass(eleDef, "" & eleDef.GetAttribute("Caption") & "", "CaptionClass") Dim eleCaptionAsLabel As XmlElement = eleDef.OwnerDocument.CreateElement("Label") eleCaptionAsLabel.SetAttribute("ID", eleDef.GetAttribute("ID") & "_Caption") eleCaptionAsLabel.SetAttribute("Class", eleDef.GetAttribute("CaptionClass")) eleCaptionAsLabel.SetAttribute("Caption", eleDef.GetAttribute("Caption")) Dim sCaption As String = sProcessDefinitionElement(eleCaptionAsLabel) sCaption = sCaption.Replace("", "") Return sCaption Else Return "" End If End Function Private Sub Process_AutoColumns(ByRef eleDataTable As XmlElement, ByRef eleAutoCols As XmlElement, ByRef eleDataLayer As XmlElement, ByVal sElementID As String) 'Automatically add DataTable columns for each column returned in the DataLayer that wasn't already 'referenced in the DataTableColumn. lgxLicense10.LicenseCheck(eleAutoCols) Dim sColClass As String = eleAutoCols.GetAttribute("Class") If st.sGetRequestVar("rdDataCache").Length <> 0 _ AndAlso st.sGetRequestVar("rdDataCache") <> "None" _ AndAlso Not IsNothing(HttpContext.Current.Session("rdCacheAutoColumnsDef-" & sElementID)) Then 'Replace the current DataTable with the cached DataTable '#If JAVA Then 'Incident 6637 and 6790 All this is necessary because XmlDocumentFragment can't be cast to XmlElement in Java. 10130. Put in support for other datalayers. ' Dim fragCachedDataTable As XmlDocumentFragment = eleDataTable.OwnerDocument.CreateDocumentFragment() ' Dim sXml As String = HttpContext.Current.Session("rdCacheAutoColumnsDef-" & sElementID) ' fragCachedDataTable.InnerXml = sXml ' eleDataTable.ParentNode.InsertAfter(fragCachedDataTable, eleDataTable) ' Dim pNode As XmlNode = eleDataTable.ParentNode ' pNode.RemoveChild(eleDataTable) ' Dim nlChildren As XmlNodeList = pNode.SelectNodes("*") ' Dim iCnt As Integer = 0 ' For iCnt = 0 To nlChildren.Count - 1 ' Dim tEle As XmlElement = nlChildren.Item(iCnt) ' If sXml = tEle.OuterXml Then ' eleDataTable = tEle ' Exit For ' End If ' Next '#Else ' Dim fragCachedDataTable As XmlDocumentFragment = eleDataTable.OwnerDocument.CreateDocumentFragment() ' fragCachedDataTable.InnerXml = HttpContext.Current.Session("rdCacheAutoColumnsDef-" & sElementID) ' Dim eleCachedDataTable As XmlElement = eleDataTable.ParentNode.InsertAfter(fragCachedDataTable, eleDataTable) ' eleDataTable.ParentNode.RemoveChild(eleDataTable) ' eleDataTable = eleCachedDataTable 'Return the updated DataTable. '#End If 'Copy the autocolumns from the cached definition. Dim xmlCachedDataTable As New XmlDocument xmlCachedDataTable.LoadXml(HttpContext.Current.Session("rdCacheAutoColumnsDef-" & sElementID)) For Each eleAutoColumn As XmlElement In xmlCachedDataTable.DocumentElement.SelectNodes("//DataTableColumn[@rdAutoColumn]") eleDataTable.AppendChild(eleDataTable.OwnerDocument.ImportNode(eleAutoColumn, True)) Next Else 'Run the DataLayer and get it into an XML file. This prevents going back to the Data Source when DataLayers are normally run. Dim sDataFilename As String = Nothing Dim eleActiveSqlDatalayer As XmlElement = eleDataTable.SelectSingleNode("DataLayer[@Type='ActiveSQL']") Dim eleActiveSqlDataLayerSaved As XmlElement = Nothing If Not IsNothing(eleActiveSqlDatalayer) Then 'Save the DL.ActiveSql so it can be put back the way it is now in code below. eleActiveSqlDataLayerSaved = eleActiveSqlDatalayer.CloneNode(True) 'Just get one row, so this runs fast. eleActiveSqlDatalayer.SetAttribute("FirstRow", 1) eleActiveSqlDatalayer.SetAttribute("RowCount", 1) End If 'Issue 11210 - remove rdDb from build. Dim db9 As New rdDb9(xmlSettings, dbug) Dim streamData As Stream = Nothing streamData = db9.xmlGetData(eleDataTable, "DataLayer") sDataFilename = db9.StreamToFile(streamData) 'xmlDataLayersInfo = New XmlDocument : xmlDataLayersInfo.LoadXml(db9.rdDataLayersInfoXml.ToString) db9 = Nothing streamData.Close() : streamData.Dispose() 'Convert the DataLayer into type = XMLFile. If IsNothing(eleActiveSqlDatalayer) Then eleDataLayer.SetAttribute("OriginalType", eleDataLayer.GetAttribute("Type")) If (rdState.GetApplicationConstant("rdConstant-rdDataEngine") <> "Version10.0") Then eleDataLayer.SetAttribute("Type", "AutoColumns") Else eleDataLayer.SetAttribute("Type", "XMLFile") End If eleDataLayer.SetAttribute("XMLFile", sDataFilename) 'Remove all the child elements that would re-modify XML DL. #4129 Dim nlChildren As XmlNodeList = eleDataLayer.SelectNodes("*") #If JAVA Then '6637 Do While 0 < nlChildren.Count Dim eleChild As XmlElement = nlChildren.ItemOf(0) eleDataLayer.RemoveChild(eleChild) nlChildren = eleDataLayer.SelectNodes("*") Loop #Else For Each eleChild As XmlElement In nlChildren eleDataLayer.RemoveChild(eleChild) Next #End If dbug.AddDebugMessage(, "AutoColumns", "DataLayer cached and converted to XMLFile.") End If 'Make a clone of the DataTable without the DataLayer stuff. 'This helps to determine if a column is referenced in the table. Dim eleTableClone As XmlElement = eleDataTable.CloneNode(True) Dim nlDlClones As XmlNodeList = eleTableClone.SelectNodes("DataLayer") #If JAVA Then '6637 and 6790 Do While 0 < nlDlClones.Count eleTableClone.RemoveChild(nlDlClones(nlDlClones.Count - 1)) nlDlClones = eleTableClone.SelectNodes("DataLayer") Loop #Else For i As Integer = nlDlClones.Count - 1 To 0 Step -1 eleTableClone.RemoveChild(nlDlClones(i)) Next #End If Dim aColumnNames As New Dictionary(Of String, Boolean) 'Dim htUsedCols As New Hashtable Dim nlTableAttrs As XmlNodeList = eleTableClone.SelectNodes("//@*") For Each atr As XmlAttribute In nlTableAttrs 'Look for @Data tokens. Dim tzr As New Tokenizer(atr.Value) For Each tkn As Tokenizer.Token In tzr.Tokens If tkn.Type = "Data" Then If Not aColumnNames.ContainsKey(tkn.Name) Then aColumnNames.Add(tkn.Name, True) End If End If Next 'Look for specific column name references. If atr.Name.EndsWith("Column") Then If Not aColumnNames.ContainsKey(atr.Value) Then aColumnNames.Add(atr.Value, True) End If End If Next 'Make DataTableColumns for each column in the first data row. Dim rdr As New XmlTextReader(sDataFilename) Do While rdr.Read() If rdr.NodeType = XmlNodeType.Element _ AndAlso rdr.Name = sElementID Then 'We're in the first row. 'Add a DataTableColumn for each attribute. If rdr.HasAttributes Then While rdr.MoveToNextAttribute() If Array.IndexOf(HIDDEN_COLUMNS, rdr.Name) < 0 _ AndAlso Not aColumnNames.ContainsKey(rdr.Name) Then Dim eleCol As XmlElement = eleDataTable.AppendChild(xmlDef.CreateElement("DataTableColumn")) eleCol.SetAttribute("rdAutoColumn", "True") eleCol.SetAttribute("ID", "rdAutoCol" & rdr.Name) eleCol.SetAttribute("Header", XmlConvert.DecodeName(rdr.Name).Replace("[", "").Replace("]", "")) 'Remove brackets that come from OLAP field names. If sColClass.Length <> 0 Then eleCol.SetAttribute("Class", sColClass) Dim eleLabel As XmlElement = eleCol.AppendChild(xmlDef.CreateElement("Label")) eleLabel.SetAttribute("ID", "rdAutoLabel" & rdr.Name) eleLabel.SetAttribute("Caption", "@Data." & XmlConvert.DecodeName(rdr.Name) & "~") 'Basic formatting. If rdUtility.isFormattableDateValue(rdr.Value) Then eleLabel.SetAttribute("Format", "General Date") End If aColumnNames.Add(rdr.Name, True) End If End While End If 'Exit Do <-- Removed: Since the staging data is XML, auto columns must scan the entire file to get a complete list of columns. Yes it is a performance hit. End If Loop rdr.Close() If Not IsNothing(eleActiveSqlDatalayer) Then 'Restore the original DL.R. eleDataTable.InsertAfter(eleActiveSqlDataLayerSaved, eleActiveSqlDatalayer) eleDataTable.RemoveChild(eleActiveSqlDatalayer) eleDataLayer = eleActiveSqlDataLayerSaved End If eleDataTable.SetAttribute("rdHasAutoColumns", "True") 'Run definition modifiers on the auto columns generated rdUtility.ApplyDefinitionModifierFiles(st, dbug, xmlDef, eleDataTable) 'Save the DataTable's definition in case there's paging or sorting. HttpContext.Current.Session("rdCacheAutoColumnsDef-" & sElementID) = eleDataTable.OuterXml End If End Sub Private Function sProcess_InputSlider(ByRef eleDef As XmlElement, ByVal sElementID As String) As String If bExportPdf() OrElse bExportNativeWord() Then _ Return "" 'InputSlider doesn't work with these exports. If sElementID.Length = 0 Then _ Throw New Exception("InputSliders must have an ID value.") Dim slash As String = rdState.GetSlash() Dim sSliderHtml As String = rdUtility.ReadFile(rdState.sGetPhysicalPath & slash & "rdTemplate" & slash & "rdInputSlider" & slash & "rdInputSliderTemplate.htm") If bUnderDataRepeater(eleDef) Then sSliderHtml = sSliderHtml.Replace("", "") Else sSliderHtml = sSliderHtml.Replace("", "") End If sSliderHtml = sSliderHtml.Replace("SLIDERID", sElementID) Dim sSlider2ID As String = eleDef.GetAttribute("SecondSliderID") If sSlider2ID.Length <> 0 Then _ sSliderHtml = sSliderHtml.Replace("SLIDER2ID", sSlider2ID) Dim sSliderOrientation As String = eleDef.GetAttribute("SliderOrientation") If sSliderOrientation <> "Vertical" Then sSliderOrientation = "Horizontal" 'Horizontal is the default. Dim sSliderLength As String = eleDef.GetAttribute("SliderLength") If sSliderLength.Length = 0 Then sSliderLength = "200" Dim sMinValue As String = eleDef.GetAttribute("MinValue") If sMinValue.Length = 0 Then sMinValue = "0" Dim sMaxValue As String = eleDef.GetAttribute("MaxValue") If sMaxValue.Length = 0 Then sMaxValue = "100" Dim ThumbSeparationValue As String = eleDef.GetAttribute("ThumbSeparationValue") If ThumbSeparationValue.Length = 0 Then ThumbSeparationValue = "0" Dim sTickCount As String = eleDef.GetAttribute("TickCount") If sTickCount.Length = 0 Then sTickCount = "0" Dim sDecimalPoints As String = eleDef.GetAttribute("DecimalPoints") If sDecimalPoints.Length = 0 Then sDecimalPoints = "0" Dim sBackgroundImage As String = eleDef.GetAttribute("BackgroundImage") Dim sBackgroundImageUrl As String = "" If sBackgroundImage = "" Then 'If the background image is not selected, then this image is produced by default Call rdState.MakeTempDownloadFilename("png", sBackgroundImageUrl, sBackgroundImage) Dim image As New SliderImage ''Feed in values from above to create image image.GenerateImage(sSliderLength, 30, sTickCount, sBackgroundImage, sSliderOrientation) mbDontCacheXsl = True '18500 - InputSlider's background image May Get Deleted by Cleanup Else sBackgroundImageUrl = rdSupportFile.getRelativeWebPath(st.sReplaceTokens(sBackgroundImage), rdState.sGetPhysicalPath(), rdSupportFile.SupportFileType.Image) End If Dim sThumbImage As String = eleDef.GetAttribute("ThumbImage") If sSliderOrientation = "Horizontal" Then If sThumbImage.Length = 0 Then sThumbImage = "rdTemplate/rdInputSlider/rdThumbArrowUp.gif" Else If sThumbImage.Length = 0 Then sThumbImage = "rdTemplate/rdInputSlider/rdThumbArrowRight.gif" End If Dim eleBackground As XmlElement = eleDef.OwnerDocument.CreateElement("Division") eleDef.AppendChild(eleBackground) 'Put it under this element so that it will get the right ID (like "..._Row1") if it's under a DataTable eleBackground.SetAttribute("ID", "rdBackground_" & sElementID) eleBackground.SetAttribute("Class", "yui3-slider-rail") 'eleBackground.SetAttribute("Caption", sBackgroundImage) eleBackground.SetAttribute("Tooltip", eleDef.GetAttribute("Tooltip")) Dim eleThumbSpan As XmlElement = eleDef.OwnerDocument.CreateElement("Division") eleBackground.AppendChild(eleThumbSpan) eleThumbSpan.SetAttribute("ID", "rdThumb_" & sElementID) eleThumbSpan.SetAttribute("Class", "yui3-slider-thumb") Dim eleThumb As XmlElement = eleDef.OwnerDocument.CreateElement("Image") eleThumbSpan.AppendChild(eleThumb) 'Put it under this element so that it will get the right ID (like "..._Row1") if it's under a DataTable eleThumb.SetAttribute("Caption", sThumbImage) If Len(sSlider2ID) > 0 Then Dim eleThumbSpan2 As XmlElement = eleDef.OwnerDocument.CreateElement("Division") eleThumbSpan2.SetAttribute("ID", "rdThumb_" & sSlider2ID) eleThumbSpan2.SetAttribute("Class", "yui3-slider-thumb") Dim eleThumb2 As XmlElement = eleDef.OwnerDocument.CreateElement("Image") eleThumbSpan2.AppendChild(eleThumb2) 'Put it under this element so that it will get the right ID (like "..._Row1") if it's under a DataTable eleThumb2.SetAttribute("Caption", sThumbImage) eleBackground.AppendChild(eleThumbSpan2) End If Dim sBgImageXsl As String = sProcessDefinitionElement(eleBackground) Dim sThumbImageXsl As String = sProcessDefinitionElement(eleThumb).Insert(5, "onload=""this.style.display='none';"" ") Dim sThumb2ImageXsl As String = "" sSliderHtml = sSliderHtml.Replace("SLIDER_BG_IMG", sBgImageXsl) sSliderHtml = sSliderHtml.Replace("SLIDER_THUMB_IMG", sThumbImageXsl) sSliderHtml = sSliderHtml.Replace("SLIDER2_THUMB_IMG", sThumb2ImageXsl) 'Create a hidden InputText with the Slider's ID. This is the element that returns the value when the form is submitted. Dim eleHidden As XmlElement = eleDef.OwnerDocument.CreateElement("InputText") eleDef.AppendChild(eleHidden) 'Put it under this element so that it will get the right ID (like "..._Row1") if it's under a DataTable eleHidden.SetAttribute("ID", sElementID) 'eleHidden.SetAttribute("ShowModes", "None") If eleDef.HasAttribute("DefaultValue") Then _ eleHidden.SetAttribute("DefaultValue", eleDef.GetAttribute("DefaultValue")) If eleDef.HasAttribute("SaveInLocalStorage") Then _ eleHidden.SetAttribute("SaveInLocalStorage", eleDef.GetAttribute("SaveInLocalStorage")) 'There may be EventHandler elements. Dim sEventHtml As String = "" For Each eleEvent As XmlElement In eleDef.SelectNodes("EventHandler") Dim sHtml As String Dim sEvent As String = eleEvent.GetAttribute("DhtmlEvent") 'Add a new element to handle the slideEnd event with an onchange event. Dim eleSlideEnd As XmlElement = eleDef.OwnerDocument.CreateElement("InputText") eleDef.AppendChild(eleSlideEnd) 'Put it under this element so that it will get the right ID (like "..._Row1") if it's under a DataTable eleSlideEnd.SetAttribute("ID", sElementID & "_" & sEvent) eleEvent = eleSlideEnd.AppendChild(eleEvent.CloneNode(True)) eleEvent.SetAttribute("DhtmlEvent", "onchange") sHtml = sProcessDefinitionElement(eleSlideEnd) sHtml = sHtml.Insert(sHtml.IndexOf("" Return sReturn End Function Private Function sProcess_DataMultiColumnList(ByRef eleDef As XmlElement, ByVal sElementID As String) As String Dim sReturn As String = Nothing Dim eleSubDataLayer As XmlElement = eleDef.SelectSingleNode("SubDataLayer") 'There has to be an ID. Dim sTableID As String = eleDef.GetAttribute("ID") If sTableID.Length = 0 Then _ Throw New Exception("MultiColumnLists must have an ID value.") If eleDef.Name = "SubDataMultiColumnList" Then 'SubDataGroupID is only used for DataLayer.Shape. Otherwise it's ignored. 'Save the table's ID for later use when building the XML data. Dim sGroupID As String = eleDef.GetAttribute("SubDataGroupID") If sGroupID.Length <> 0 Then Dim eleSubDataGroup As XmlElement = eleDef.SelectSingleNode("//SubDataGroup[@ID=""" & sGroupID & """]") If Not IsNothing(eleSubDataGroup) Then 'There is a SubDataGroup. Set it's ID value to the table ID so that the DataLayer's element IDs match the table's. eleSubDataGroup.SetAttribute("ID", sTableID) Else 'There's no SubDataGroup. It's a "hard-coded" shape command. Change the ID of the SubDataTable to match the DataLayer's sub data ID. sTableID = sGroupID eleDef.SetAttribute("ID", sGroupID) End If End If End If Dim sListRecord As String = sProcessDefinitionElementChildren(eleDef) & XSL_LINEFEED Dim slash As String = rdState.GetSlash() 'Get the Xsl template for a list. Dim sXslFilename As String = rdState.sGetPhysicalPath() & slash & "rdTemplate" & slash If eleDef.GetAttribute("MultiListDirection") = "Across" Then sXslFilename &= "rdMultiColListAcross.xsl" Else sXslFilename &= "rdMultiColListDown.xsl" End If If eleDef.Name = "SubDataMultiColumnList" Then _ sXslFilename = sXslFilename.Replace("rdMulti", "rdSubMulti") Dim sXsl As String = rdUtility.ReadFile(sXslFilename) sXsl = sXsl.Replace("rdListRecord", sListRecord) 'sXsl = sXsl.Replace("rdDataID", sElementID) If IsNothing(eleSubDataLayer) _ And eleDef.Name = "SubDataMultiColumnList" Then sXsl = sXsl.Replace("rdDataID", "*") 'Used for GroupFilters with Hierarhical=True. Else sXsl = sXsl.Replace("rdDataID", sTableID) 'For SubDataLayers, this ties the table directly to the data layer. End If ''sXsl = sXsl.Replace("rdDataTableID", sTableID) ' eleDef.GetAttribute("ID")) 'Divide the list up into columns. 'Get the number of lines per column. Dim sColumns As String = eleDef.GetAttribute("MultiListColumns") sXsl = sXsl.Replace("rdColumns", sColumns) Dim sTableStyle As String = "" If eleDef.GetAttribute("Width").Length > 0 Then 'sTableStyle = "width:" & eleDef.GetAttribute("Width") & eleDef.GetAttribute("WidthScale") & ";" sTableStyle = "width:" & eleDef.GetAttribute("Width") & st.sGetAttribute(eleDef, "WidthScale", "px") & ";" End If If eleDef.GetAttribute("Layout") = "Fixed" Then sTableStyle &= "table-layout:fixed;" End If If Len(sTableStyle) <> 0 Then sTableStyle = "style=""" & sTableStyle & """" End If Dim sTableBorder As String = "" If eleDef.GetAttribute("TableBorder").Length <> 0 Then sTableBorder = " border=""" & eleDef.GetAttribute("TableBorder") & """ " End If sReturn = "" sReturn = sSetID(eleDef, sReturn) sReturn = sSetCellSpacing(eleDef, sReturn) sReturn = sSetClass(eleDef, sReturn) sReturn = sSetPositioning(eleDef, sReturn) 'If eleDef.GetAttribute("Caption").Length <> 0 Then ' sReturn &= sSetClass(eleDef, "") 'End If sReturn &= sBuildTableCaption(eleDef) sReturn &= "" & sXsl & "
    " & eleDef.GetAttribute("Caption") & "
    " Return sReturn End Function Private Function sProcess_DataList(ByRef eleDef As XmlElement, ByVal sElementID As String) As String Dim sReturn As String = Nothing If sElementID.Length = 0 Then Throw New Exception("DataList must have an ID value.") Dim eleData As XmlElement = _db9.GetDataLayer(eleDef) Dim sListItem As String = sProcessDefinitionElementChildren(eleDef) & XSL_LINEFEED Dim slash As String = rdState.GetSlash() 'Get the Xsl template for a list. Dim sXslFilename As String = rdState.sGetPhysicalPath() & slash & "rdTemplate" & slash sXslFilename &= "rdDataList.xsl" Dim sXsl As String = rdUtility.ReadFile(sXslFilename) sXsl = sXsl.Replace("rdListItem", sListItem) sXsl = sXsl.Replace("rdDataListID", sElementID) Dim bOrderedList As Boolean = IIf(String.IsNullOrEmpty(eleDef.GetAttribute("Ordered")), "False", st.sGetAttribute(eleDef, "Ordered", "False")) If bOrderedList Then sReturn &= "
      " & sXsl & "
    " Else sReturn &= "
      " & sXsl & "
    " End If sReturn = sSetID(eleDef, sReturn) sReturn = sSetClass(eleDef, sReturn) sReturn = sSetPositioning(eleDef, sReturn) Return sReturn End Function Private Function sProcess_DataMenu(ByRef eleDef As XmlElement, ByVal sElementID As String) As String If sElementID.Length = 0 Then Throw New Exception("DataMenu must have an ID value.") Dim eleData As XmlElement = _db9.GetDataLayer(eleDef) dbug.AddDebugMessage("DataMenu", "Generate Definition") Dim sSubMenuIDColumn As String = eleDef.GetAttribute("SubMenuIDColumn") Dim tknSubMenuIDColumn As String = IIf(String.IsNullOrEmpty(sSubMenuIDColumn), String.Empty, "@Data." & sSubMenuIDColumn & "~") 'If String.IsNullOrEmpty(sSubMenuIDDataColumn) Then Throw New Exception("DataMenu must have an SubMenuIDDataColumn value.") Dim sCaptionColumn As String = eleDef.GetAttribute("CaptionColumn") If String.IsNullOrEmpty(sCaptionColumn) Then Throw New Exception("DataMenu must have a CaptionColumn value.") Dim tknCaptionColumn As String = "@Data." & sCaptionColumn & "~" Dim sActionIDColumn As String = eleDef.GetAttribute("ActionIDColumn") Dim tknActionIDColumn As String = IIf(String.IsNullOrEmpty(sActionIDColumn), String.Empty, "@Data." & sActionIDColumn & "~") Dim sImageColumn As String = eleDef.GetAttribute("ImageColumn") Dim tknImageColumn As String = IIf(String.IsNullOrEmpty(sImageColumn), String.Empty, "@Data." & sImageColumn & "~") Dim sTargetSubMenuIDColumn As String = eleDef.GetAttribute("TargetSubMenuIDColumn") Dim tknTargetSubMenuIDColumn As String = IIf(String.IsNullOrEmpty(sTargetSubMenuIDColumn), String.Empty, "@Data." & sTargetSubMenuIDColumn & "~") Dim bHideDataMenuArrows As Boolean = False If eleDef.GetAttribute("HideDataMenuArrows") = "True" Then _ bHideDataMenuArrows = True Dim eleDefDataLayer As XmlElement = eleDef.SelectSingleNode("DataLayer") Dim nlDefActionList As XmlNodeList = eleDef.SelectNodes("Action") If nlDefActionList.Count = 0 And Not sActionIDColumn.Length = 0 Then Throw New Exception("DataMenus must have an action element when the ActionIDColumn value has been set.") End If Dim xmlDataMenuTemplate As XmlDocument = rdUtility.GetSuperElementTemplate("rdPopup/rdDataMenuTemplate.lgx") 'Is there a template modifier? Call rdUtility.ApplyTemplateModifier(st, dbug, eleDef, xmlDataMenuTemplate.DocumentElement) 'Is there a theme or DefinitionModifierFile? Run them too. Call rdUtility.ApplyDefinitionModifierFiles(st, dbug, eleDef.OwnerDocument, xmlDataMenuTemplate.DocumentElement) Dim eleMenuTable As XmlElement = xmlDataMenuTemplate.SelectSingleNode("*//DataTable") eleMenuTable.SetAttribute("ID", sElementID) If Not String.IsNullOrEmpty(eleDef.GetAttribute("Class")) Then _ eleMenuTable.SetAttribute("Class", eleMenuTable.GetAttribute("Class") + " " + eleDef.GetAttribute("Class")) Dim eleMenuDataLayer As XmlElement = eleDefDataLayer.CloneNode(True) 'Add the condition filter Dim eleMenuConditionFilter As XmlElement = xmlDataMenuTemplate.CreateElement("ConditionFilter") Dim sMenuConditionalFilter As String = """@Request.rdMenuID~"" = """ & tknSubMenuIDColumn & """" eleMenuConditionFilter.SetAttribute("Condition", sMenuConditionalFilter) eleMenuConditionFilter.SetAttribute("ID", "rdFilterCurrentMenuItems") eleMenuDataLayer.AppendChild(eleMenuDataLayer.OwnerDocument.ImportNode(eleMenuConditionFilter, True)) ' Add the calculated column. 'If Not String.IsNullOrEmpty(sImageColumn) Then '#13513. Dim eleMenuCalculatedColumn As XmlElement = xmlDataMenuTemplate.CreateElement("CalculatedColumn") Dim sMenuCalculatedColumnFormula As String = "IIF(""" & tknImageColumn & """="""", ""/../../rdTemplate/rd1x1Trans.gif"", """ & tknImageColumn & """)" eleMenuCalculatedColumn.SetAttribute("Formula", sMenuCalculatedColumnFormula) eleMenuCalculatedColumn.SetAttribute("ID", "rdMenuImage") eleMenuDataLayer.AppendChild(eleMenuDataLayer.OwnerDocument.ImportNode(eleMenuCalculatedColumn, True)) 'End If ' Add the Datalayer to the Menu datatable. eleMenuTable.PrependChild(xmlDataMenuTemplate.ImportNode(eleMenuDataLayer, True)) Dim eleDataTable As XmlElement = xmlDataMenuTemplate.SelectSingleNode("*//DataTableColumn[@ID='rdDataMenuTable']") Dim eleRows As XmlElement = eleDataTable.SelectSingleNode("Rows") Dim nlMenuCaptionColumnRowsRowList As XmlNodeList = eleRows.SelectNodes("Row") ' This row element holds the template for the subMenu. Dim eleSubMenuRow As XmlElement = nlMenuCaptionColumnRowsRowList(0) Dim eleActionRow As XmlElement = nlMenuCaptionColumnRowsRowList(1) '13516 ' Set the Row element condition value. Dim sSubMenuRowCondition As String = """" & tknActionIDColumn & """ = """"" eleSubMenuRow.SetAttribute("Condition", sSubMenuRowCondition) ' Modify the Linkparams and the caption label values. Dim eleSubMenuRowLinkParams As XmlElement = eleSubMenuRow.SelectSingleNode("*//LinkParams") eleSubMenuRowLinkParams.SetAttribute("rdMenuID", tknTargetSubMenuIDColumn) Dim eleMenusubMenuRowCaptionLabel As XmlElement = eleSubMenuRow.SelectSingleNode("*//Label[@ID='lblCaption']") eleMenusubMenuRowCaptionLabel.SetAttribute("Caption", tknCaptionColumn) 'Remove the Arrows? If bHideDataMenuArrows Then Dim eleArrows As XmlElement eleArrows = eleDataTable.SelectSingleNode(".//Column[@ID='rdDataMenuArrow']") If Not IsNothing(eleArrows) Then _ eleArrows.ParentNode.RemoveChild(eleArrows) eleArrows = eleDataTable.SelectSingleNode(".//Column[@ID='rdDataMenuArrow']") 'There are two of these with @ID='rdDataMenuArrow'. If Not IsNothing(eleArrows) Then _ eleArrows.ParentNode.RemoveChild(eleArrows) End If ' Get to the other Row element as it is used for any action elements added to the DataMenu. For Each eleRow As XmlElement In nlMenuCaptionColumnRowsRowList If Not eleRow.Equals(eleSubMenuRow) Then _ eleRows.RemoveChild(eleRow) Next ' Add one Action template for each action added on to the DataMenu element. For Each eleActionItem As XmlElement In nlDefActionList ' Set the Row element condition value. Dim eleMenuActionRowClone As XmlElement = eleActionRow.CloneNode(True) Dim sMenuActionRowCondition As String = """" & tknActionIDColumn & """ = """ & eleActionItem.GetAttribute("ID") & """" eleMenuActionRowClone.SetAttribute("Condition", sMenuActionRowCondition) ' Modify the caption label value. Dim eleMenuActionRowcaptionLabel As XmlElement = eleMenuActionRowClone.SelectSingleNode("*//Label[@ID='lblCaption']") eleMenuActionRowcaptionLabel.SetAttribute("Caption", tknCaptionColumn) ' Replace the template Action element with the users Action element. Dim eleMenuActionRowActionElement As XmlElement = eleMenuActionRowClone.SelectSingleNode("*//Action") eleMenuActionRowActionElement.ParentNode.AppendChild(eleMenuActionRowActionElement.OwnerDocument.ImportNode(eleActionItem, True)) eleMenuActionRowActionElement.ParentNode.RemoveChild(eleMenuActionRowActionElement) eleSubMenuRow.ParentNode.AppendChild(eleMenuActionRowClone) Next If dbug.DebuggingEnabled Then _ dbug.AddDebugMessage("DataMenu", "Generated", "View Definition", eleMenuTable) plugin.CallPlugins_GeneratedElement(eleMenuTable, eleDef) '14254 - Call Plugins from more places - ElementPluginCall eleDef.ParentNode.InsertAfter(eleDef.OwnerDocument.ImportNode(eleMenuTable, True), eleDef) eleDef.RemoveAll() Return Nothing End Function Private Function sProcess_DataMenuTree(ByRef eleDef As XmlElement, ByVal sElementID As String) As String dbug.AddDebugMessage("DataMenuTree", "Generate Definition") If sElementID.Length = 0 Then Throw New Exception("DataMenuTree must have an ID value.") Dim eleData As XmlElement = _db9.GetDataLayer(eleDef) Dim sSubMenuIDColumn As String = eleDef.GetAttribute("SubMenuIDColumn") Dim tknSubMenuIDColumn As String = IIf(String.IsNullOrEmpty(sSubMenuIDColumn), String.Empty, "@Data." & sSubMenuIDColumn & "~") 'If String.IsNullOrEmpty(sSubMenuIDDataColumn) Then Throw New Exception("DataMenuTree must have an SubMenuIDDataColumn value.") Dim sCaptionColumn As String = eleDef.GetAttribute("CaptionColumn") If String.IsNullOrEmpty(sCaptionColumn) Then Throw New Exception("DataMenuTree must have a CaptionColumn value.") Dim sActionIDColumn As String = eleDef.GetAttribute("ActionIDColumn") Dim tknActionIDColumn As String = IIf(String.IsNullOrEmpty(sActionIDColumn), String.Empty, "@Data." & sActionIDColumn & "~") Dim sImageColumn As String = eleDef.GetAttribute("ImageColumn") Dim tknImageColumn As String = IIf(String.IsNullOrEmpty(sImageColumn), String.Empty, "@Data." & sImageColumn & "~") Dim sClassColumn As String = eleDef.GetAttribute("ClassColumn") Dim tknRowClass As String = IIf(String.IsNullOrEmpty(sClassColumn), String.Empty, "@Data." & sClassColumn & "~") Dim sTargetSubMenuIDColumn As String = eleDef.GetAttribute("TargetSubMenuIDColumn") Dim tknTargetSubMenuIDColumn As String = IIf(String.IsNullOrEmpty(sTargetSubMenuIDColumn), String.Empty, "@Data." & sTargetSubMenuIDColumn & "~") Dim sDefaultDepth As String = eleDef.GetAttribute("DefaultExpansionDepth") If sDefaultDepth.Length = 0 Then _ sDefaultDepth = "0" Dim bRememberView As Boolean = True If eleDef.GetAttribute("RememberView") = "False" Then _ bRememberView = False Dim nLevelIndent As Integer = Val(st.sGetAttribute(eleDef, "LevelIndent")) If nLevelIndent = 0 Then nLevelIndent = 8 'Default Dim eleDefDataLayer As XmlElement = eleDef.SelectSingleNode("DataLayer") Dim nlDefActionList As XmlNodeList = eleDef.SelectNodes("Action") If nlDefActionList.Count = 0 And Not sActionIDColumn.Length = 0 Then Throw New Exception("DataMenuTrees must have an action element when the ActionIDColumn value has been set.") End If Dim xmlDataMenuTreeTemplate As XmlDocument = rdUtility.GetSuperElementTemplate("rdPopup/rdDataMenuTreeTemplate.lgx") 'Is there a template modifier? Call rdUtility.ApplyTemplateModifier(st, dbug, eleDef, xmlDataMenuTreeTemplate.DocumentElement) 'Is there a theme or DefinitionModifierFile? Run them too. 'Call rdUtility.ApplyDefinitionModifierFiles(st, dbug, eleDef.OwnerDocument, xmlDataMenuTreeTemplate.DocumentElement) ' This was setting the cell color. Dim eleMenuDiv As XmlElement = xmlDataMenuTreeTemplate.SelectSingleNode("*//Division") Dim eleMenuTable As XmlElement = eleMenuDiv.SelectSingleNode("DataTable") eleMenuTable.SetAttribute("ID", sElementID) Dim sRdIdeIdx As String = eleDef.GetAttribute("rdIdeIdx") If Not String.IsNullOrEmpty(sRdIdeIdx) Then eleMenuTable.SetAttribute("rdIdeIdx", sRdIdeIdx) End If If Not String.IsNullOrEmpty(eleDef.GetAttribute("Class")) Then _ eleMenuTable.SetAttribute("Class", eleMenuTable.GetAttribute("Class") + " " + eleDef.GetAttribute("Class")) Dim eleMenuDataLayer As XmlElement = eleDefDataLayer.CloneNode(True) 'Add the BranchDepthColumn element to the DataLayer. It figures out the level of each item. Dim eleDepthColumn As XmlElement = eleMenuDataLayer.AppendChild(eleMenuDataLayer.OwnerDocument.CreateElement("BranchDepthColumn")) eleDepthColumn.SetAttribute("ID", "rdDepth") eleDepthColumn.SetAttribute("ParentDataColumn", sTargetSubMenuIDColumn) eleDepthColumn.SetAttribute("ChildDataColumn", sSubMenuIDColumn) eleDepthColumn.SetAttribute("FilterNonParents", "False") 'Add the rdIndent calculated column to the DataLayer Dim eleIndentColumn As XmlElement = eleMenuDataLayer.AppendChild(eleMenuDataLayer.OwnerDocument.CreateElement("CalculatedColumn")) eleIndentColumn.SetAttribute("ID", "rdIndent") eleIndentColumn.SetAttribute("Formula", "@Data.rdDepth~ * " & nLevelIndent) 'Add a calculated column for the developer-defined menu item icons. If tknImageColumn.Length <> 0 Then Dim eleMenuImageColumn As XmlElement = xmlDataMenuTreeTemplate.CreateElement("CalculatedColumn") Dim sMenuImageColumnFormula As String = "IIF(""" & tknImageColumn & """="""", ""/../../rdTemplate/rd1x1Trans.gif"", """ & tknImageColumn & """)" eleMenuImageColumn.SetAttribute("Formula", sMenuImageColumnFormula) eleMenuImageColumn.SetAttribute("ID", "rdMenuImage") eleMenuDataLayer.AppendChild(eleMenuDataLayer.OwnerDocument.ImportNode(eleMenuImageColumn, True)) Else 'There are no menu item icons, remove the Image element. Dim eleMenuImage As XmlElement = eleMenuDiv.SelectSingleNode(".//Image[@ID='rdDmtImage']") If Not IsNothing(eleMenuImage) Then _ eleMenuImage.ParentNode.RemoveChild(eleMenuImage) End If If tknRowClass.Length <> 0 Then _ eleMenuTable.SetAttribute("RowClass", tknRowClass) 'Add a calculated column expand/collapse status. Dim eleStatusColumn As XmlElement = xmlDataMenuTreeTemplate.CreateElement("CalculatedColumn") 'Dim sStatusColumnFormula As String = "IIF(Len(""" & tknTargetSubMenuIDColumn & """)>0,""+"", """")" Dim sStatusColumnFormula As String = "IIF(Len(""" & tknTargetSubMenuIDColumn & """)>0, IIF(@Data.rdDepth~<" & sDefaultDepth & ",""-"",""+""), """")" eleStatusColumn.SetAttribute("Formula", sStatusColumnFormula) eleStatusColumn.SetAttribute("ID", "rdExpandoStatus_" & sElementID) eleMenuDataLayer.AppendChild(eleMenuDataLayer.OwnerDocument.ImportNode(eleStatusColumn, True)) If Not bRememberView Then 'Remove the hidden label that keeps the expansion status IDs for the browsers localStorage. Dim eleExpandoItemID As XmlElement = eleMenuTable.SelectSingleNode(".//Label[@ID='rdExpandoItemID_rdDataMenuTreeID']") If Not IsNothing(eleExpandoItemID) Then _ eleExpandoItemID.ParentNode.RemoveChild(eleExpandoItemID) End If ' Add the Datalayer to the Menu datatable. eleMenuTable.PrependChild(xmlDataMenuTreeTemplate.ImportNode(eleMenuDataLayer, True)) 'Add the template's DataTableColumn Dim eleDataTableCol As XmlElement = xmlDataMenuTreeTemplate.SelectSingleNode("*//DataTableColumn[@ID='rdMenuColumn_rdDataMenuTreeID']") ' Add one Action template for each action added on to the DataMenuTree element. Dim eleDivWithAction As XmlElement = eleDataTableCol.SelectSingleNode(".//Division[@ID='rdDmtAction']") Dim eleDivParent As XmlElement = eleDivWithAction.ParentNode eleDivParent.RemoveChild(eleDivWithAction) 'eleDivWithAction is the template Division that gets the Action. For Each eleActionItem As XmlElement In nlDefActionList Dim sActionID As String = eleActionItem.GetAttribute("ID") If sActionID.Length = 0 Then _ Throw New Exception("Action elements under DataMenuTrees require an ID.") Dim eleDiv As XmlElement = eleDivParent.AppendChild(eleDivWithAction.CloneNode(True)) eleDiv.SetAttribute("Condition", """" & tknActionIDColumn & """=""" & sActionID & """") Dim eleLabel As XmlElement = eleDiv.SelectSingleNode("Label[@ID='rdDmtCaption']") eleLabel.AppendChild(xmlDataMenuTreeTemplate.ImportNode(eleActionItem, True)) Next Dim eleWork As XmlElement = eleMenuTable.OwnerDocument.CreateElement("Work") For Each eleDataMenuColumn As XmlElement In eleDef.SelectNodes("DataMenuColumn") 'Copy the element, just changing the name from DataMenuColumn to simply DataTableColumn. Dim sDataMenuColumn As String = eleDataMenuColumn.OuterXml.Replace("DataMenuColumn", "DataTableColumn") eleWork.InnerXml = sDataMenuColumn eleDataMenuColumn = eleMenuTable.AppendChild(eleWork.FirstChild) If Not eleDataMenuColumn.HasAttribute("Class") Then _ eleDataMenuColumn.SetAttribute("Class", eleDataTableCol.GetAttribute("Class")) Next '23824 'Call subAddIncludedScript("rdAjax/rdAjax2.js") 'Call subAddIncludedScript("rdCookie.js") 'Call subAddIncludedScript("rdPopup/rdDataMenuTree.js") 'Please the css so that it goes before the developer's css. This makes the developer's css take precedence. 'sbHead.Insert(sbHead.ToString.IndexOf("") + 8, "") subAddIncludedCss("rdPopup/rdDataMenuTree.css") 'Call subAddJavaEventFunction("rdBodyLoad", "rdDataMenuTreeInit(""" & sElementID & """)") Call rdUtility.ReplaceAttributeValues(eleMenuDiv, "rdDataMenuTreeID", sElementID, True) Call rdUtility.ReplaceAttributeValues(eleMenuTable, "@Data.ActionIDColumn~", tknActionIDColumn, True) Call rdUtility.ReplaceAttributeValues(eleMenuTable, "@Data.SubMenuIDColumn~", tknSubMenuIDColumn, True) If dbug.DebuggingEnabled Then _ dbug.AddDebugMessage("DataMenuTree", "Generated", "View Definition", eleMenuDiv) plugin.CallPlugins_GeneratedElement(eleMenuDiv, eleDef) '14254 - Call Plugins from more places - ElementPluginCall eleDef.ParentNode.InsertAfter(eleDef.OwnerDocument.ImportNode(eleMenuDiv, True), eleDef) eleDef.RemoveAll() Return Nothing End Function Private Function sProcess_MenuTree(ByRef eleDef As XmlElement, ByVal sElementID As String) As String dbug.AddDebugMessage("MenuTree", "Generate Definition") If sElementID.Length = 0 Then Throw New Exception("MenuTree must have an ID value.") If bUnderDataRepeater(eleDef) Then _ Throw New Exception(eleDef.Name & " elements cannot go under a DataTable or other element with a DataLayer.") 'Remove all menu items which are Condition=False Dim eleWithCondition As XmlElement = eleDef.SelectSingleNode(".//*[@Condition]") Do Until IsNothing(eleWithCondition) mbDontCacheXsl = True Static evl As New rdScriptEvaluator() Dim sCond As String = st.sGetAttribute(eleWithCondition, "Condition") If Not CBool(evl.Eval(sCond)) Then 'Remove the element. eleWithCondition.ParentNode.RemoveChild(eleWithCondition) Else 'Just remove the condition. eleWithCondition.RemoveAttribute("Condition") End If eleWithCondition = eleDef.SelectSingleNode(".//*[@Condition]") Loop 'Remove branches which do not have a leaf. Dim eleBranchWithLeaves As XmlElement = eleDef.SelectSingleNode(".//MenuBranch[not(.//MenuLeaf)]") Do Until IsNothing(eleBranchWithLeaves) 'Remove the element. eleBranchWithLeaves.ParentNode.RemoveChild(eleBranchWithLeaves) eleBranchWithLeaves = eleDef.SelectSingleNode(".//MenuBranch[not(.//MenuLeaf)]") Loop 'Popup menu? If st.sGetAttribute(eleDef, "MenuMode").Contains("Popup") Then sProcess_MenuTreePopup(eleDef, sElementID) Return Nothing End If Dim nLevelIndent As Integer = Val(st.sGetAttribute(eleDef, "LevelIndent")) If nLevelIndent = 0 Then nLevelIndent = 8 'Default Dim xmlMenuTreeTemplate As XmlDocument = rdUtility.GetSuperElementTemplate("rdPopup/rdMenuTreeTemplate.lgx") 'Is there a template modifier? Dim elePopupTemplate As XmlElement = xmlMenuTreeTemplate.SelectSingleNode(".//Division[@ID='rdMenuPopupTreeID']") If Not IsNothing(elePopupTemplate) Then elePopupTemplate.ParentNode.RemoveChild(elePopupTemplate) End If Call rdUtility.ApplyTemplateModifier(st, dbug, eleDef, xmlMenuTreeTemplate.DocumentElement) Dim eleMenuDiv As XmlElement = xmlMenuTreeTemplate.SelectSingleNode(".//Division") eleMenuDiv = eleDef.ParentNode.InsertAfter(eleDef.OwnerDocument.ImportNode(eleMenuDiv, True), eleDef) If st.sGetAttribute(eleDef, "DisableRememberExpansion") = "True" Then Dim eleUseLocalStorage As XmlElement = eleMenuDiv.SelectSingleNode(".//InputHidden[@ID='rdDisableRememberExpansion_rdDataMenuTreeID']") eleUseLocalStorage.SetAttribute("DefaultValue", "True") End If Dim eleMenuRow As XmlElement = eleMenuDiv.SelectSingleNode(".//Row[@ID='rdMenuRow_rdDataMenuTreeID']") If eleDef.HasAttribute("Class") Then _ eleMenuRow.SetAttribute("Class", eleMenuDiv.GetAttribute("Class") + " " + eleDef.GetAttribute("Class")) For Each eleConditionalClass As XmlElement In eleDef.SelectNodes("ConditionalClass") eleMenuRow.AppendChild(eleConditionalClass.CloneNode(False)) Next If eleDef.HasAttribute("BranchCollapsedImage") Then Dim eleBranchCollapsedImage As XmlElement = eleMenuDiv.SelectSingleNode(".//Image[@ID='rdBranchCollapsedImage_rdDataMenuTreeID']") eleBranchCollapsedImage.SetAttribute("Caption", eleDef.GetAttribute("BranchCollapsedImage")) End If If eleDef.HasAttribute("BranchExpandedImage") Then Dim eleBranchCollapsedImage As XmlElement = eleMenuDiv.SelectSingleNode(".//Image[@ID='rdBranchExpandedImage_rdDataMenuTreeID']") eleBranchCollapsedImage.SetAttribute("Caption", eleDef.GetAttribute("BranchExpandedImage")) End If Dim eleMenuItemRows As XmlElement = eleMenuRow.ParentNode eleMenuRow.ParentNode.RemoveChild(eleMenuRow) 'This element gets cloned/duplicated below. Dim eleCurrParent As XmlElement = eleMenuDiv Dim nl As XmlNodeList = eleDef.SelectNodes(".//MenuBranch | .//MenuLeaf") Dim nRow As Integer = 0 For Each eleMenuItemDef As XmlElement In eleDef.SelectNodes(".//MenuBranch | .//MenuLeaf") Dim eleParentMenuItemDef As XmlElement = eleMenuItemDef.ParentNode Dim eleNewRow As XmlElement = eleMenuItemRows.AppendChild(eleMenuRow.CloneNode(True)) nRow += 1 eleNewRow.SetAttribute("ID", "rdMenuRow_rdDataMenuTreeID_Row" & nRow) If eleMenuItemDef.HasAttribute("Condition") Then eleNewRow.SetAttribute("Condition", eleMenuItemDef.GetAttribute("Condition")) Else If eleParentMenuItemDef.HasAttribute("Condition") Then eleNewRow.SetAttribute("Condition", eleParentMenuItemDef.GetAttribute("Condition")) End If End If Dim eleMenuColumn As XmlElement = eleNewRow.SelectSingleNode(".//Column[@ID='rdMenuColumn_rdDataMenuTreeID']") eleMenuColumn.SetAttribute("ID", "rdMenuColumn_rdDataMenuTreeID_Row" & nRow) Dim eleImage As XmlElement = eleNewRow.SelectSingleNode(".//Image[@ID='rdExpando_rdDataMenuTreeID']") eleImage.SetAttribute("ID", "rdExpando_rdDataMenuTreeID_Row" & nRow) Dim eleLabel As XmlElement = eleNewRow.SelectSingleNode(".//Label[@ID='rdDmtCaption']") Dim sCaption As String = eleMenuItemDef.GetAttribute("Caption") If String.IsNullOrEmpty(sCaption) Then Throw New Exception(eleMenuItemDef.Name & " must have a Caption attribute.") eleLabel.SetAttribute("Caption", sCaption) If eleMenuItemDef.HasAttribute("Class") Then _ eleLabel.SetAttribute("Class", eleMenuItemDef.GetAttribute("Class")) If eleMenuItemDef.HasAttribute("Tooltip") Then _ eleLabel.SetAttribute("Tooltip", eleMenuItemDef.GetAttribute("Tooltip")) For Each eleConditionalClass As XmlElement In eleMenuItemDef.SelectNodes("ConditionalClass") eleLabel.AppendChild(eleConditionalClass.CloneNode(False)) Next Dim nDepth As Integer If eleParentMenuItemDef.HasAttribute("rdDepth") Then nDepth = Val(eleParentMenuItemDef.GetAttribute("rdDepth")) + 1 Else nDepth = 0 End If eleMenuItemDef.SetAttribute("rdDepth", nDepth) Dim eleIndent As XmlElement = eleNewRow.SelectSingleNode(".//Column[@ID='rdIndent_rdDataMenuTreeID']") eleIndent.SetAttribute("ID", "rdIndent_rdDataMenuTreeID_Row" & nRow) eleIndent.SetAttribute("Width", nDepth * nLevelIndent) Dim eleExpandoStatus As XmlElement = eleNewRow.SelectSingleNode(".//Label[@ID='rdExpandoStatus_rdDataMenuTreeID']") eleExpandoStatus.SetAttribute("ID", "rdExpandoStatus_rdDataMenuTreeID_Row" & nRow) Dim eleExpandoItemID As XmlElement = eleNewRow.SelectSingleNode(".//Label[@ID='rdExpandoItemID_rdDataMenuTreeID']") eleExpandoItemID.SetAttribute("ID", "rdExpandoItemID_rdDataMenuTreeID_Row" & nRow) eleExpandoItemID.SetAttribute("Caption", "Data.SubMenuIDColumn~:" & sCaption) Dim eleExpandoTarget As XmlElement = eleNewRow.SelectSingleNode(".//Target[@ID='tgt_rdDataMenuTreeID']") eleExpandoTarget.SetAttribute("Link", eleExpandoTarget.GetAttribute("Link").Replace("@Function.RowNumber~", nRow)) Select Case eleMenuItemDef.Name Case "MenuBranch" If st.sGetAttribute(eleMenuItemDef, "Expanded") = "True" Then eleExpandoStatus.SetAttribute("Caption", "-") Else eleExpandoStatus.SetAttribute("Caption", "+") End If Case "MenuLeaf" eleExpandoStatus.SetAttribute("Caption", "") Dim eleAction As XmlElement = eleMenuItemDef.SelectSingleNode("Action") If Not IsNothing(eleAction) Then 'Allow the entire row to be clickable. eleNewRow.AppendChild(eleAction.CloneNode(True)) 'Allow the underline to work. Dim eleNullAction As XmlElement = eleDef.OwnerDocument.CreateElement("Action") eleNullAction.SetAttribute("Type", "Javascript") eleNullAction.SetAttribute("Javascript", "return false;") eleLabel.AppendChild(eleNullAction) End If End Select Next Call rdUtility.ReplaceAttributeValues(eleMenuDiv, "rdMenuTreeID", sElementID, True) Call rdUtility.ReplaceAttributeValues(eleMenuDiv, "rdDataMenuTreeID", sElementID, True) 'DataMenuTree also because this shares script code with DataMenuTree. If dbug.DebuggingEnabled Then _ dbug.AddDebugMessage("DataMenuTree", "Generated", "View Definition", eleMenuDiv) eleDef.RemoveAll() Return Nothing End Function Private Function sProcess_MenuTreePopup(ByRef eleDef As XmlElement, sElementId As String) As Integer Dim xmlMenuTreeTemplate As XmlDocument = rdUtility.GetSuperElementTemplate("rdPopup/rdMenuTreeTemplate.lgx") Dim eleOldMenuTemplate As XmlElement = xmlMenuTreeTemplate.SelectSingleNode(".//Division[@ID='rdMenuTreeID']") If Not IsNothing(eleOldMenuTemplate) Then eleOldMenuTemplate.ParentNode.RemoveChild(eleOldMenuTemplate) End If 'Is there a template modifier? Call rdUtility.ApplyTemplateModifier(st, dbug, eleDef, xmlMenuTreeTemplate.DocumentElement) Dim eleMenuDiv As XmlElement = xmlMenuTreeTemplate.SelectSingleNode(".//Division") eleMenuDiv = eleDef.ParentNode.InsertAfter(eleDef.OwnerDocument.ImportNode(eleMenuDiv, True), eleDef) Dim eleMenuRow As XmlElement = eleMenuDiv.SelectSingleNode(".//Row[@ID='rdMenuRow_rdDataMenuTreeID']") If eleDef.HasAttribute("Class") Then _ eleMenuRow.SetAttribute("Class", eleMenuDiv.GetAttribute("Class") & " " & eleDef.GetAttribute("Class")) For Each eleConditionalClass As XmlElement In eleDef.SelectNodes("ConditionalClass") eleMenuRow.AppendChild(eleConditionalClass.CloneNode(False)) Next Dim eleMenuColumn As XmlElement = eleMenuRow.SelectSingleNode(".//Column") Dim bVerticalPopup As Boolean = st.sGetAttribute(eleDef, "MenuMode") = "VerticalPopup" If bVerticalPopup Then eleMenuColumn = eleMenuColumn.ParentNode CType(eleMenuColumn.SelectSingleNode(".//Action[@Type='Popup']"), XmlElement).SetAttribute("PopupLocation", "right") eleMenuRow = eleMenuRow.ParentNode End If Dim sHorizontalSpacing As String = st.sGetAttribute(eleDef, "HorizontalMenuSpacing", "5") Dim nHorizontalSpacing As Integer = 0 Integer.TryParse(sHorizontalSpacing, nHorizontalSpacing) Dim eleSpacing As XmlElement = Nothing If nHorizontalSpacing <> 0 AndAlso Not bVerticalPopup Then eleSpacing = eleMenuRow.OwnerDocument.CreateElement("Spaces") eleSpacing.SetAttribute("Size", nHorizontalSpacing) End If Dim eleMenuItemRows As XmlElement = eleMenuRow.ParentNode eleMenuColumn.ParentNode.RemoveChild(eleMenuColumn) 'This element gets cloned/duplicated below. Dim eleCurrParent As XmlElement = eleMenuDiv Dim nl As XmlNodeList = eleDef.SelectNodes("./MenuBranch") Dim nMenuBranchesCount As Integer = nl.Count For i As Integer = 0 To nMenuBranchesCount - 1 Dim eleMenuItem As XmlElement = nl.ItemOf(i) Dim eleCurrentItem As XmlElement = eleMenuColumn.CloneNode(True) Dim sCaption As String = st.sGetAttribute(eleMenuItem, "Caption") If String.IsNullOrEmpty(sCaption) Then Throw New Exception(eleMenuItem.Name & " must have a Caption attribute.") End If Dim eleBranchTemplate As XmlElement = eleCurrentItem.SelectSingleNode(".//Label[@ID='rdMenuColumn_rdMenuBranchCaption']") eleBranchTemplate.SetAttribute("Caption", sCaption) If eleMenuItem.HasAttribute("Class") Then _ eleBranchTemplate.SetAttribute("Class", eleMenuItem.GetAttribute("Class")) eleMenuRow.AppendChild(eleCurrentItem) PopulateMenuBranchChildren(eleMenuItem, eleCurrentItem, eleMenuColumn) If Not IsNothing(eleSpacing) AndAlso i <> nMenuBranchesCount - 1 Then eleCurrentItem.AppendChild(eleSpacing.CloneNode(True)) End If Next Call rdUtility.ReplaceAttributeValues(eleMenuDiv, "rdMenuPopupTreeID", sElementId, True) Call rdUtility.ReplaceAttributeValues(eleMenuDiv, "rdDataMenuTreeID", sElementId, True) eleDef.RemoveAll() If dbug.DebuggingEnabled Then _ dbug.AddDebugMessage("DataMenuTree", "Generated", "View Definition", eleMenuDiv) Return Nothing End Function Private Sub PopulateMenuBranchChildren(menuItem As XmlElement, eleCurrentItem As XmlElement, eleTemplate As XmlElement) Dim elePopupOption As XmlElement = eleCurrentItem.SelectSingleNode(".//PopupOption") Dim eleBranchLeafList As XmlNodeList = menuItem.SelectNodes("./MenuLeaf|./MenuBranch") For Each eleLeaf As XmlElement In eleBranchLeafList Dim eleCurrentPopupOption As XmlElement = elePopupOption.CloneNode(True) Dim sLeafCaption As String = st.sGetAttribute(eleLeaf, "Caption") If String.IsNullOrEmpty(sLeafCaption) Then _ Throw New Exception(eleLeaf.Name & " must have a Caption attribute.") eleCurrentPopupOption.SetAttribute("Caption", sLeafCaption) If eleLeaf.HasAttribute("Class") Then _ eleCurrentPopupOption.SetAttribute("Class", eleLeaf.GetAttribute("Class")) elePopupOption.ParentNode.AppendChild(eleCurrentPopupOption) If eleLeaf.Name = "MenuLeaf" Then For Each childNode As XmlElement In eleLeaf.ChildNodes eleCurrentPopupOption.AppendChild(childNode.CloneNode(True)) Next Dim elePopupAction As XmlElement = eleCurrentPopupOption.SelectSingleNode("Action") If IsNothing(elePopupAction) Then ' Need to add a dummy action since an action is needed under the PopupOption element. Dim eleDummyAction As XmlElement = eleCurrentPopupOption.PrependChild(eleCurrentPopupOption.OwnerDocument.CreateElement("Action")) eleDummyAction.SetAttribute("Type", "Link") Dim eleDummyTarget As XmlElement = eleDummyAction.AppendChild(eleCurrentPopupOption.OwnerDocument.CreateElement("Target")) eleDummyTarget.SetAttribute("Type", "Link") eleDummyTarget.SetAttribute("Link", "Javascript:void(0);") End If ElseIf eleLeaf.Name = "MenuBranch" Then If eleLeaf.ChildNodes.Count > 0 Then Dim eleAction As XmlElement = eleTemplate.SelectSingleNode(".//Action[@Type='Popup']").CloneNode(True) eleCurrentPopupOption.AppendChild(eleAction) PopulateMenuBranchChildren(eleLeaf, eleAction, eleTemplate) End If End If Next If eleBranchLeafList.Count = 0 Then Dim eleAction As XmlElement = eleCurrentItem.SelectSingleNode(".//Action[@Type='Popup']") eleAction.ParentNode.RemoveChild(eleAction) End If elePopupOption.ParentNode.RemoveChild(elePopupOption) End Sub Private Function sProcess_ReportCenterMenu(ByRef eleDef As XmlElement, ByVal sElementID As String) As String lgxLicense10.LicenseCheck(eleDef) ''This is a special bypass. To display the schedule and email options, we create a new report and redirect the browser there. Select Case st.sGetRequestVar("rdRcCommand") Case "Schedule" Call subRedirectToReportCenterSchedule(eleDef) End Select If sElementID.Length = 0 Then Throw New Exception("ReportCenter must have an ID value.") Dim sCollectionName As String = rdBookmark.GetCollectionNameFromAttr(st, eleDef) If String.IsNullOrEmpty(sCollectionName) Then _ Throw New Exception("ReportCenterMenu must have a BookmarkCollection attribute, or BookmarkCollectionDefault attribute in the Settings/General element.") 'Get the template. Dim xmlTemplate As XmlDocument = rdUtility.GetSuperElementTemplate("rdReportCenter/rdRcMenuTemplate.lgx") 'Is there a template modifier? Call rdUtility.ApplyTemplateModifier(st, dbug, eleDef, xmlTemplate.DocumentElement) 'Is there a theme? Call rdUtility.ApplyDefinitionModifierFiles(st, dbug, eleDef.OwnerDocument, xmlTemplate.DocumentElement) Dim eleRcContainer As XmlElement = xmlTemplate.DocumentElement eleRcContainer = eleDef.ParentNode.InsertAfter(eleDef.OwnerDocument.ImportNode(eleRcContainer, True), eleDef) Dim eleDataMenuTree As XmlElement = eleRcContainer.SelectSingleNode(".//DataMenuTree") Dim sClass As String = eleDef.GetAttribute("Class") If sClass.Length <> 0 Then eleDataMenuTree.SetAttribute("Class", eleDataMenuTree.GetAttribute("Class") & " " & sClass) 'Append the developer's class. End If Dim sRdIdeIdx As String = eleDef.GetAttribute("rdIdeIdx") If Not String.IsNullOrEmpty(sRdIdeIdx) Then eleDataMenuTree.SetAttribute("rdIdeIdx", sRdIdeIdx) End If eleDataMenuTree.SetAttribute("DefaultExpansionDepth", eleDef.GetAttribute("DefaultExpansionDepth")) Call rdUtility.ReplaceAttributeValues(eleRcContainer, "rdBookmarkCollection", sCollectionName, True) Call rdUtility.ReplaceAttributeValues(eleRcContainer, "rdReportCenterID", sElementID, True) Call rdUtility.ReplaceAttributeValues(eleRcContainer, "rdRcReportID", msRequestedPage, True) 'Is there a custom DataLayer under the ReportCenter. By default, we include a DataLayer.DefinitionList, but the developer can replace it. Dim eleCustomDataLayer As XmlElement = eleDef.SelectSingleNode("DataLayer") If Not IsNothing(eleCustomDataLayer) Then Dim eleStockDataLayer As XmlElement = eleDataMenuTree.SelectSingleNode("DataLayer") 'Copy the other DataLayer's attributes into the template's element. If eleCustomDataLayer.HasAttribute("DefinitionListFolder") Then eleStockDataLayer.SetAttribute("DefinitionListFolder", eleCustomDataLayer.GetAttribute("DefinitionListFolder")) End If 'And now the child elements. Dim eleStockReportCenterFilter As XmlElement = eleStockDataLayer.SelectSingleNode("ReportCenterFilter") For Each eleChild As XmlElement In eleCustomDataLayer.SelectNodes("*") eleStockDataLayer.InsertBefore(eleChild.CloneNode(True), eleStockReportCenterFilter) Next 'Let the ReportCenterFilter know that there is a custom datalayer eleStockReportCenterFilter.SetAttribute("CustomDataLayerExists", "True") eleDef.RemoveChild(eleCustomDataLayer) 'Dim eleStockDataLayer As XmlElement = eleDataMenuTree.SelectSingleNode("DataLayer") 'Dim eleCopiedDataLayer As XmlElement = eleDataMenuTree.InsertAfter(eleCustomDataLayer.CloneNode(True), eleStockDataLayer) 'eleCopiedDataLayer.AppendChild(eleStockReportCenterFilter.ParentNode.RemoveChild(eleStockReportCenterFilter)) 'eleCustomDataLayer.ParentNode.RemoveChild(eleCustomDataLayer) 'eleStockDataLayer.ParentNode.RemoveChild(eleStockDataLayer) End If 'Move all root level FolderOrder and DefinitionOrder Elements under the ReportCenterFilter Dim nlstItemOrder As XmlNodeList = eleDef.SelectNodes("FolderOrder | DefinitionOrder") Dim iCount As Integer = 0 If nlstItemOrder IsNot Nothing Then iCount = nlstItemOrder.Count If iCount > 0 Then #If JAVA Then '19283 While nlstItemOrder.Count > 0 Dim eleItemOrder As XmlElement = nlstItemOrder.Item(0) eleDataMenuTree.SelectSingleNode(".//ReportCenterFilter").AppendChild(eleItemOrder) nlstItemOrder = eleDef.SelectNodes("FolderOrder | DefinitionOrder") End While #Else For Each eleItemOrder As XmlElement In nlstItemOrder eleDataMenuTree.SelectSingleNode(".//ReportCenterFilter").AppendChild(eleItemOrder) Next #End If End If End If 'Only run sorting when Folder/Definition orders have been specified or there is no custom datalayer present If iCount > 0 Or eleCustomDataLayer Is Nothing Then 'Sort by sort key attribute Dim eleMainDataLayer As XmlElement = eleDataMenuTree.SelectSingleNode("DataLayer") 'Put the custom sort after the default sort Dim eleReportCenterSort As XmlElement = eleDef.OwnerDocument.CreateElement("SortFilter") eleReportCenterSort.SetAttribute("SortColumn", "rdSortKey") eleReportCenterSort.SetAttribute("SortSequence", "Ascending") eleMainDataLayer.InsertAfter(eleReportCenterSort, eleMainDataLayer.SelectSingleNode("ReportCenterFilter")) End If Dim sSchedulerConnID As String = eleDef.GetAttribute("SchedulerConnectionID") If Not String.IsNullOrEmpty(sSchedulerConnID) Then mbDontCacheXsl = True 'We set a session variable here, which needs to be done for every user, thus disqualifying use of the XSL cache. HttpContext.Current.Session("rdRcScheduleConnID") = sSchedulerConnID 'This is used later - too hard to pass directly. Dim eleReportCenterFilter As XmlElement = eleDataMenuTree.SelectSingleNode(".//ReportCenterFilter") eleReportCenterFilter.SetAttribute("AllowScheduling", "True") End If Call subAddIncludedCss("rdReportCenter/rdRcStyle.css") mbAddAjaxSupport = True If dbug.DebuggingEnabled Then _ dbug.AddDebugMessage("ReportCenterMenu", "Generated", "View Definition", eleRcContainer) plugin.CallPlugins_GeneratedElement(eleRcContainer, eleRcContainer) '14254 - Call Plugins from more places - ElementPluginCall Return Nothing End Function Friend Sub subRedirectToReportCenterSchedule(ByVal eleRcDef As XmlElement) Dim xmlScheduleTemplate As XmlDocument = rdUtility.GetSuperElementTemplate("rdReportCenter/rdRcScheduleTemplate.lgx") 'Is there a template modifier? Call rdUtility.ApplyTemplateModifier(st, dbug, eleRcDef, xmlScheduleTemplate.DocumentElement) ''Title caption. 'Dim sTitle As String = st.sGetAttribute(eleDrillthroughDef, "Caption") 'If sTitle.Length = 0 Then ' 'Remove the title. ' Dim eleTitle As XmlElement = xmlScheduleTemplate.SelectSingleNode("//Row[@ID='rowOgDrillthroughTitle']") ' If Not IsNothing(eleTitle) Then _ ' eleTitle.ParentNode.RemoveChild(eleTitle) 'Else ' 'Set the title caption. ' Dim eleTitle As XmlElement = xmlScheduleTemplate.SelectSingleNode("//Label[@ID='lblOgDrillthroughTitle']") ' eleTitle.SetAttribute("Caption", sTitle) 'End If Dim eleHiddenReportCenterID As XmlElement = xmlScheduleTemplate.SelectSingleNode("//InputHidden[@ID='rdReportCenterID']") If st.sGetRequestVar("rdReportCenterID").Length = 0 Then 'This may be set by InfoGO. eleHiddenReportCenterID.SetAttribute("DefaultValue", eleRcDef.GetAttribute("ID")) Else eleHiddenReportCenterID.SetAttribute("DefaultValue", st.sGetRequestVar("rdReportCenterID")) End If Dim eleHiddenRcReportID As XmlElement = xmlScheduleTemplate.SelectSingleNode("//InputHidden[@ID='rdRcReportID']") eleHiddenRcReportID.SetAttribute("DefaultValue", st.sGetRequestVar("rdRcReportID")) Dim eleHiddenPopupID As XmlElement = xmlScheduleTemplate.SelectSingleNode("//InputHidden[@ID='rdPopupID']") 'This is used to quickly hid the popup when the user clicks a button. eleHiddenPopupID.SetAttribute("DefaultValue", st.sGetRequestVar("rdPopupID")) 'Get the schedule information setup, if there is a schedule. Dim sSchedulerTaskID As String = st.sGetRequestVar("rdSchedulerTaskID") Dim eleSchedulerDataLayer As XmlElement = xmlScheduleTemplate.SelectSingleNode("//DataLayer[@Type='Scheduler']") If sSchedulerTaskID.Length = 0 Then sSchedulerTaskID = -1 'The causes the LocalData query to the scheduler to return no tasks. If left empty it would return all tasks. 'Remove the Schedule DataLayer element. eleSchedulerDataLayer.ParentNode.RemoveChild(eleSchedulerDataLayer) Else eleSchedulerDataLayer.SetAttribute("ConnectionID", eleRcDef.GetAttribute("SchedulerConnectionID")) eleSchedulerDataLayer.SetAttribute("SchedulerTaskID", sSchedulerTaskID) End If 'Control the allowed export formats presented to the user. Dim sFormats As String = st.sGetRequestVar("rdAllowedExportFormats") If sFormats.Length <> 0 Then Dim aFormats() As String = sFormats.Replace(" ", "").Split(",") For Each eleFormatRow As XmlElement In xmlScheduleTemplate.SelectNodes("//DataLayer[@ID='dlExportFormat']/StaticDataRow") If Array.IndexOf(aFormats, eleFormatRow.GetAttribute("Format")) = -1 Then eleFormatRow.SetAttribute("RemoveMe", "True") 'Flag the rows to be removed. End If Next 'Remove the rows/formats we don't want. Dim eleRemove As XmlElement = xmlScheduleTemplate.SelectSingleNode("//DataLayer[@ID='dlExportFormat']/StaticDataRow[@RemoveMe]") While Not IsNothing(eleRemove) eleRemove.ParentNode.RemoveChild(eleRemove) eleRemove = xmlScheduleTemplate.SelectSingleNode("//DataLayer[@ID='dlExportFormat']/StaticDataRow[@RemoveMe]") End While If xmlScheduleTemplate.SelectNodes("//DataLayer[@ID='dlExportFormat']/StaticDataRow").Count < 2 Then 'There's only one choice. Hide the control from the user. Dim eleUiRow As XmlElement = xmlScheduleTemplate.SelectSingleNode("//Row[@ID='rowExportFormat']") eleUiRow.SetAttribute("Class", "rdHidden") End If End If 'Save some values that may be passed when saving a schedule. Dim eleHiddenSchedulerReport As XmlElement = xmlScheduleTemplate.SelectSingleNode("//InputHidden[@ID='rdSchedulerReportID']") eleHiddenSchedulerReport.SetAttribute("DefaultValue", st.sGetRequestVar("rdSchedulerReportID")) Dim eleHiddenBookmarkID As XmlElement = xmlScheduleTemplate.SelectSingleNode("//InputHidden[@ID='rdBookmarkID']") eleHiddenBookmarkID.SetAttribute("DefaultValue", st.sGetRequestVar("rdBookmarkID")) Dim eleHiddenBookmarkCollection As XmlElement = xmlScheduleTemplate.SelectSingleNode("//InputHidden[@ID='rdBookmarkCollection']") eleHiddenBookmarkCollection.SetAttribute("DefaultValue", st.sGetRequestVar("rdBookmarkCollection")) Dim eleHiddenBookmarkUserName As XmlElement = xmlScheduleTemplate.SelectSingleNode("//InputHidden[@ID='rdBookmarkUserName']") eleHiddenBookmarkUserName.SetAttribute("DefaultValue", st.sGetRequestVar("rdBookmarkUserName")) Dim eleHiddenExportTableID As XmlElement = xmlScheduleTemplate.SelectSingleNode("//InputHidden[@ID='rdExportTableID']") eleHiddenExportTableID.SetAttribute("DefaultValue", st.sGetRequestVar("rdExportTableID")) Dim eleHiddenCustomColumn1 As XmlElement = xmlScheduleTemplate.SelectSingleNode("//InputHidden[@ID='rdCustomColumn1']") eleHiddenCustomColumn1.SetAttribute("DefaultValue", st.sGetRequestVar("rdCustomColumn1")) Dim eleHiddenCustomColumn2 As XmlElement = xmlScheduleTemplate.SelectSingleNode("//InputHidden[@ID='rdCustomColumn2']") eleHiddenCustomColumn2.SetAttribute("DefaultValue", st.sGetRequestVar("rdCustomColumn2")) If st.sGetAttribute(eleRcDef, "SchedulerSessionVariables") <> "" Then Dim eleHiddenSchSessVars As XmlElement = xmlScheduleTemplate.SelectSingleNode("//InputHidden[@ID='rdSchedulerSessionVariables']") eleHiddenSchSessVars.SetAttribute("DefaultValue", st.sGetAttribute(eleRcDef, "SchedulerSessionVariables")) End If 'Copy style sheet(s) from the OG definition. For Each eleStyleDef As XmlElement In eleRcDef.SelectNodes("//StyleSheet") xmlScheduleTemplate.DocumentElement.AppendChild(xmlScheduleTemplate.ImportNode(eleStyleDef, True)) Next 'Save the report definition and redirect to it. Dim sDefFilename As String = "" Dim sDefUrl As String = "" Call rdState.MakeTempDownloadFilename("lgx", sDefUrl, sDefFilename) xmlScheduleTemplate.Save(sDefFilename) #If JAVA Then '13008 Just a relative path does not work. Dim sUri As String = HttpContext.Current.Request.Url.AbsoluteUri & "?rdReport=../../" & sDefUrl Dim iLoc As Integer = sUri.IndexOf("?") If iLoc > -1 Then sDefUrl = sUri.Substring(0, iLoc) & "?rdReport=../../" & sDefUrl Else sDefUrl = "rdPage.aspx?rdReport=../../" & sDefUrl End If #Else sDefUrl = "rdPage.aspx?rdReport=../../" & sDefUrl #End If HttpContext.Current.Response.Redirect(sDefUrl) End Sub Private Function sProcess_ListItem(ByRef eleDef As XmlElement, ByVal sElementID As String) As String Dim sReturn As String = Nothing sReturn = sProcessDefinitionElementChildren(eleDef) & XSL_LINEFEED sReturn = "
  • " & sReturn & "
  • " sReturn = sSetID(eleDef, sReturn) sReturn = sSetClass(eleDef, sReturn) sReturn = sSetEventHandler(eleDef, sReturn) sReturn = sSetPositioning(eleDef, sReturn) Return sReturn End Function Private Function sProcess_TextCloud(ByRef eleDef As XmlElement, ByVal sElementID As String) As String 'lgxLicense10.LicenseCheck(eleDef) 16583 'If http.Session("rdProduct").IndexOf("Ent") = -1 Then _ ' Throw New Exception("The element """ & eleDef.Name & """ requires a Logi Info Server license.") Dim sReturn As String = Nothing 'There has to be an ID. Dim sTableID As String = eleDef.GetAttribute("ID") If sTableID.Length = 0 Then _ Throw New Exception("TextClouds must have an ID value.") Dim eleDataLayer As XmlElement = Nothing 'Issue 11210 - remove rdDb from build. eleDataLayer = _db9.GetDataLayer(eleDef) Dim sCloudLabelColumn As String = eleDef.GetAttribute("CloudLabelColumn") If sCloudLabelColumn.Length = 0 Then _ Throw New Exception("TextClouds must have a CloudLabelColumn attribute.") Dim sCloudSizeColumn As String = eleDef.GetAttribute("CloudSizeColumn") Dim sMinFontSize As String = eleDef.GetAttribute("MinFontSize") Dim sMaxFontSize As String = eleDef.GetAttribute("MaxFontSize") If sMinFontSize.Length = 0 Then sMinFontSize = 8 If sMaxFontSize.Length = 0 Then sMaxFontSize = 20 'Add a new calc column to the DataLayer. Dim eleCalc As XmlElement 'Keep text terms from wrapping apart when there are spaces. eleCalc = eleDataLayer.AppendChild(eleDataLayer.OwnerDocument.CreateElement("CalculatedColumn")) eleCalc.SetAttribute("ID", "rdTextCloudCaption") 'eleCalc.SetAttribute("Formula", "Replace(Trim(""@Data." & sCloudLabelColumn & "~""),"" "",""nbsp;"")") eleCalc.SetAttribute("Formula", "Replace(Trim(""@Data." & sCloudLabelColumn & "~""),"" "",""rdNbsp"")") 'Get the PercentOfSpread eleCalc = eleDataLayer.AppendChild(eleDataLayer.OwnerDocument.CreateElement("PercentOfSpreadColumn")) eleCalc.SetAttribute("ID", "rdTextCloudSize") eleCalc.SetAttribute("DataColumn", sCloudSizeColumn) 'Turn PercentOfSpread into the font size. eleCalc = eleDataLayer.AppendChild(eleDataLayer.OwnerDocument.CreateElement("CalculatedColumn")) eleCalc.SetAttribute("ID", "rdTextCloudSize") eleCalc.SetAttribute("Formula", "FormatNumber(@Data.rdTextCloudSize~ * (" & sMaxFontSize & " - " & sMinFontSize & ") + " & sMinFontSize & ", 0)") Dim eleLabel As XmlElement = eleDef.AppendChild(eleDef.OwnerDocument.CreateElement("Label")) eleLabel.SetAttribute("Caption", "@Data.rdTextCloudCaption~") 'If IsNothing(HttpContext.Current.Items("rdIsWidgetRequest")) Then ' 'Widgets don't need this. ' eleLabel.SetAttribute("Format", "HTML") 'End If eleLabel.SetAttribute("InlineStyle", "font-size:@Data.rdTextCloudSize~px;") Dim eleAction As XmlElement = eleDef.SelectSingleNode("Action") If Not IsNothing(eleAction) Then eleLabel.AppendChild(eleAction.CloneNode(True)) End If Dim sTooltip As String = eleDef.GetAttribute("Tooltip") If sTooltip.Length <> 0 Then eleLabel.SetAttribute("Tooltip", sTooltip) End If Dim sClass As String = eleDef.GetAttribute("Class") If sClass.Length <> 0 Then eleLabel.SetAttribute("Class", sClass) End If 'Move ConditionalClass elements from the main element to the Label. Do While True Dim eleCondClass As XmlElement = eleDef.SelectSingleNode("ConditionalClass") If IsNothing(eleCondClass) Then _ Exit Do eleLabel.AppendChild(eleDef.RemoveChild(eleCondClass)) Loop Dim sLabelXsl As String = sProcessDefinitionElementChildren(eleDef) & XSL_LINEFEED Dim slash As String = rdState.GetSlash() 'Get the Xsl template for a list. Dim sXslFilename As String = rdState.sGetPhysicalPath() & slash & "rdTemplate" & slash & "rdTextCloud.xsl" Dim sXsl As String = rdUtility.ReadFile(sXslFilename) sXsl = sXsl.Replace("rdDataID", sTableID) sXsl = sXsl.Replace("rdTextCloudLabelXsl", sLabelXsl) sReturn = "" sReturn = sSetID(eleDef, sReturn) sReturn = sSetClass(eleDef, sReturn) sReturn = sSetPositioning(eleDef, sReturn) sReturn &= sXsl & "" Return sReturn End Function Private Function sProcess_Tabs(ByRef eleDef As XmlElement, ByVal sElementID As String) As String lgxLicense10.LicenseCheck(eleDef) Dim sReturn As String = Nothing 'There has to be an ID. If sElementID.Length = 0 Then _ Throw New Exception("Tabs elements must have an ID value.") Dim sOrientation As String = st.sGetAttribute(eleDef, "TabLocation").ToLower If sOrientation.Length = 0 Then _ sOrientation = "top" Dim sTabbingStyle As String = st.sGetAttribute(eleDef, "TabbingStyle", "Static") Dim sNewActiveTab As String = st.sGetRequestVar(sElementID) Dim sActiveTabId As String = st.sGetAttribute(eleDef, "DefaultTab") Dim sTabbingStyleIdentifier As String = String.Empty If sTabbingStyle = "Ajax" Then 'mbDontCache = True mbAddAjaxSupport = True sTabbingStyleIdentifier = " sTabbingStyle = ""Ajax"" " '#17282. If sNewActiveTab.Length <> 0 Then _ sActiveTabId = sNewActiveTab ElseIf sTabbingStyle = "RefreshPage" Then 'mbDontCacheXsl = True 12061 If sNewActiveTab.Length <> 0 Then _ sActiveTabId = sNewActiveTab End If 'Special initialization for Ajax-style. If sTabbingStyle = "Ajax" Then Dim sDefXml As String = eleDef.OuterXml 'Input calendars. If sDefXml.Contains(" 0 Then _ sWidth = "width:" & sWidth & st.sGetAttribute(eleDef, "WidthScale", "px") & ";" Dim sHeight As String = st.sGetAttribute(eleDef, "Height") If sHeight.Length <> 0 Then _ sHeight = "height:" & sHeight & st.sGetAttribute(eleDef, "HeightScale", "px") & ";" Dim sStyle As String = "" Dim bNoMinWidth As Boolean = st.sGetAttribute(eleDef, "NoMinWidth", False) 'Undocumented escape valve. 'The main SPAN for the Tabs element. If sWidth.Length <> 0 Then _ sStyle = " STYLE=""" & sWidth & ";""" 'Only set the width here. Set height below. 11744 'sReturn &= "
    " sReturn &= "" sReturn &= "
    " sReturn &= "
    " Dim sWrapStyle As String = "" If sOrientation = "top" OrElse sOrientation = "bottom" Then If Not HttpContext.Current.Items("isMobileDef") Then _ sWrapStyle = " STYLE=""white-space:nowrap; width:0%""" 'nowrap added for 11856. End If 'Javascript will show the tabs when they are initialized sReturn &= "
      " 'Dim nTabCnt As Integer = 0 Dim nlTabPanels As XmlNodeList = eleDef.SelectNodes("TabPanel") If nlTabPanels.Count = 0 Then _ Throw New Exception("Tabs elements must have at least one TabPanel element.") 'Add the tabs. Dim bIsMobileDashboardNewTab As Boolean = False 'dp ' Variable will be used below for some special processing of a Mobile Dashboard's 'Add a New Tab'. For Each eleTabPanel As XmlElement In nlTabPanels If Not String.IsNullOrEmpty(eleTabPanel.GetAttribute("rdIsMobileDashboardNewTab")) Then bIsMobileDashboardNewTab = True 'Check to see if this is a Mobile Dashboard New Tab. Dim sTabXsl As String = "" Dim sTabPanelID As String = eleTabPanel.GetAttribute("ID") If sTabPanelID.Length = 0 Then _ Throw New Exception("TabPanel elements must have an ID value.") Dim sTabPanelCaption As String = eleTabPanel.GetAttribute("Caption") If sTabPanelCaption.Length = 0 Then _ Throw New Exception("TabPanel elements must have a Caption value.") If sActiveTabId.Length = 0 Then _ sActiveTabId = sTabPanelID Dim sSelected As String If sActiveTabId = sTabPanelID Then sSelected = "CLASS=""selected""" Else sSelected = "" End If sTabXsl &= sSetID(eleTabPanel, "
    • ") '
      Dim eleLabel As XmlElement = Nothing If eleTabPanel.GetAttribute("CaptionType") = "Image" Then eleLabel = eleDef.OwnerDocument.CreateElement("Image") Else eleLabel = eleDef.OwnerDocument.CreateElement("Label") End If eleLabel.SetAttribute("ID", "rdCaption_" & sTabPanelID) eleLabel.SetAttribute("Caption", IIf(sTabPanelCaption = "Add a New Tab", "", sTabPanelCaption)) eleLabel.SetAttribute("Tooltip", eleTabPanel.GetAttribute("Tooltip")) eleLabel.SetAttribute("Class", eleTabPanel.GetAttribute("Class")) Dim sLabel As String = sProcessDefinitionElement(eleLabel) '' Test for linking outside the current tab... But this doesn't work so we don't support the feature. 'If IsNothing(eleTabPanel.SelectSingleNode("Action")) Then 'There's no action. Show the tab with DHTML. sTabXsl &= "" & sLabel & "" 'Else ' 'There's an action. ' sReturn &= sSetAction(eleTabPanel, "" & sTabCaption & "") 'End If sTabXsl &= "
    • " sTabXsl = sSetVisibility(eleTabPanel, sTabXsl) If Not bNoMinWidth Then 'Undocumented escape valve. '#11744 'Add a hidden image that will be used to set a minimum width. 'It prevents the tab panel width from being less width of all the tabs. 'The width gets set dynamically in rdActionShowElement.js. Dim eleMinWidthImage As XmlElement = eleTabPanel.AppendChild(eleDef.OwnerDocument.CreateElement("Image")) eleMinWidthImage.SetAttribute("ID", "rdTabMinWidth_" & sTabPanelID) eleMinWidthImage.SetAttribute("Caption", "rdTemplate/rdBlank.gif") eleMinWidthImage.SetAttribute("Height", "0") End If sReturn &= sTabXsl Next sReturn &= "
    " eleDef.SetAttribute("rdDefaultTabId", sActiveTabId) ''Set the the DIV for the content. sStyle = " STYLE=""""" If sHeight.Length <> 0 Then _ sStyle = sStyle.Insert(sStyle.IndexOf("""") + 1, sHeight) 'Only set the height here. Set width above. 11744 If sWidth.Length <> 0 OrElse sHeight.Length <> 0 Then ' Commented out to address #13296. 'If HttpContext.Current.Request.Browser.Browser = "IE" Then '#12917. ' sStyle = sStyle.Insert(sStyle.IndexOf("""") + 1, "overflow:visible;") 'Else sStyle = sStyle.Insert(sStyle.IndexOf("""") + 1, "overflow:auto;") 'End If End If sReturn &= "
    " 'Add the contents for each tab. sReturn &= sProcessDefinitionElementChildren(eleDef) sReturn &= "
    " sReturn &= "
    " sReturn &= "
    " 'Create a hidden element that will keep track of the active tab. 'Access the value in a called page with @Request.x~, where x is the ID of the tabs element. sReturn &= "" sReturn &= "" 'Initialize the tabs subAddIncludedCss("rdYui/rdTabs.css") subAddYUIInitializer("'tabs'", "LogiXML.Tabs.push(new Y.LogiXML.Tabs({ id: '" & sElementID & "', reportid: '" & msRequestedPage & "', orientation: '" & sOrientation & "', isMobile: " & bIsMobileDashboardNewTab.ToString().ToLowerInvariant() & " }));") sReturn = sSetID(eleDef, sReturn) sReturn = sSetClass(eleDef, sReturn) sReturn = sSetPositioning(eleDef, sReturn) Static bBeenHere As Boolean If Not bBeenHere Then bBeenHere = True 'Set styles. 'All Tabs elements on the same page must have the same style. 'These don't support tokens. Dim sBorderColor As String = st.sGetAttribute(eleDef, "BorderColor") If sBorderColor.Length = 0 _ Then sBorderColor = "#000000" Dim sActiveTabBackgroundColor As String = st.sGetAttribute(eleDef, "ActiveTabBackgroundColor") If sActiveTabBackgroundColor.Length = 0 _ Then sActiveTabBackgroundColor = "#FFFFFF" Dim sInactiveTabBackgroundColor As String = st.sGetAttribute(eleDef, "InactiveTabBackgroundColor") If sInactiveTabBackgroundColor.Length = 0 _ Then sInactiveTabBackgroundColor = "#CCCCCC" 'Create the STYLE element. sbHead.Append("") End If If sTabbingStyle = "Ajax" Then _ Call subIncludeAllStandardScript() 'Panels may be shown via AJAX RefreshElement, so all possible script should be included. Return sReturn End Function Private Function sProcess_TabPanel(ByRef eleTabPanel As XmlElement, ByVal sElementID As String) As String Dim sTabbingStyle As String = "" Dim sCurrentTabId As String = Nothing If eleTabPanel.ParentNode.Name = "Tabs" Then 'For the initial processing of the Tabs element. Dim eleTabs As XmlElement = eleTabPanel.ParentNode sTabbingStyle = st.sGetAttribute(eleTabs, "TabbingStyle", "Static") sCurrentTabId = eleTabs.GetAttribute("rdDefaultTabId") ElseIf st.sGetRequestVar("rdRefreshTabPanel") = "True" Then 'For processing a single TabPanel from a RefreshElement when this is an Ajax request. sTabbingStyle = "Ajax" sCurrentTabId = st.sGetRequestVar("rdCurrTabId") Else sTabbingStyle = "Static" End If Dim sReturn As String = Nothing If sTabbingStyle = "Static" _ OrElse sCurrentTabId = eleTabPanel.GetAttribute("ID") Then '18680 don't hide RefreshPage content '18904 don't hide default tab, otherwise it will refresh hidden Dim sHide As String = "" If sTabbingStyle <> "RefreshPage" And sCurrentTabId <> sElementID Then sHide = "STYLE=""display:none;""" sReturn &= "
    " sReturn &= sProcessDefinitionElementChildren(eleTabPanel) Else 'Remove this element from the definition so that any child DataLayer elements wont' get run later in this process. sReturn &= "
    " eleTabPanel.RemoveAll() If sTabbingStyle = "RefreshPage" AndAlso st.sGetRequestVar("rdReportFormat").Length = 0 Then '24697 sReturn &= "SubmitForm('rdPage.aspx?rdReport=" & msRequestedPage & "&rdRequestForwarding=Form',window.name)" 'Call subAddIncludedScript("rdActionSubmit2.js") '11870 End If End If sReturn &= "
    " Return sReturn End Function Public Sub IncludeChartCanvasRequiredScripts() 'Call subAddIncludedScript("rdAjax/rdAjax2.js") 'subAddIncludedScript(rdUtility.IncludeCombinedScripts("chartcanvas")) 'Call subAddIncludedCss("rdYui/rdQuicktip.css") ''highcharts requires localization 'Me.needLocalization = True ''YUI Javascript initialization Call subAddYUIInitializerOnce("'chartCanvas'", "Y.LogiXML.ChartCanvas.createElements();") End Sub Private Function sProcess_ChartCanvas(ByRef eleDef As XmlElement, ByVal sElementID As String) As String '23579, set the definition of this chart for the wizard. If HttpContext.Current.Session("rdForWizard") IsNot Nothing Then Dim eleSeries As XmlElement = eleDef.SelectSingleNode(".//Series") If Not IsNothing(eleSeries) AndAlso eleSeries.GetAttribute("Type").IndexOf("Gauge") = -1 Then HttpContext.Current.Session("rdForWizard") = eleDef.OuterXml End If End If '23078 chart ids must be not empty and unique for exports If (st.sGetRequestVar("rdReportFormat").ToLower() = "pdf") Then Dim uniqueId As String = rdUtility.GetUniqueId(chartCanvasIds, sElementID, "chartcanvas") If uniqueId <> sElementID Then sElementID = uniqueId eleDef.SetAttribute("ID", sElementID) End If End If 'Drillin? Dim eleChartDrillTo As XmlElement = eleDef.SelectSingleNode(".//ChartDrillTo") If Not IsNothing(eleChartDrillTo) Then CreateChartCanvasActionPopup(eleDef, eleChartDrillTo) ElseIf Not (http.Application("rdConstant-ChartCanvasAutoDrillTo") = "False") Then CreateChartCanvasAutoDrillTo(eleDef) End If 'GroupDrillthrough? For Each eleGroupDrillthrough As XmlElement In eleDef.SelectNodes(".//GroupDrillthrough") subProcess_GroupDrillthrough(eleGroupDrillthrough) Next If (st.sGetAttribute(eleDef, "RemoveWidthAttribute") = "True") Then eleDef.RemoveAttribute("ChartWidth") End If 'Create auto popup menu CreatePopupMenusForChartCanvas(eleDef) Dim sReturn As String = String.Empty Call IncludeChartCanvasRequiredScripts() Call subAddFormulaScriptFilesUnderChart(eleDef) If Not isAjaxRequest Then Call SetRefreshSeriesTimer(eleDef) End If 'highcharts requires localization Me.needLocalization = True Me.subReplaceLocalDataTokens(eleDef) Dim isUnderDataRepeater As Boolean = bUnderDataRepeater(eleDef) If isUnderDataRepeater Then eleDef.SetAttribute("RepeatedElement", "True") '19203 End If Dim eleAncestor As XmlElement = eleDef.SelectSingleNode("ancestor::*[DataLayer]") Dim dataLayers As XmlNodeList = eleDef.SelectNodes(".//DataLayer") For Each dataLayer As XmlElement In dataLayers dataLayer.SetAttribute("OriginalType", dataLayer.GetAttribute("Type")) dataLayer.SetAttribute("Type", "EmptyDataLayer") 'Don't process this overall, do it later for individual AnimCharts. If Not IsNothing(eleAncestor) Then 'Chart is under datatable, user must use @Chart token in datalayer for distinguish between source (parent datatable or chart's datalayer) Dim dataLayerWithChildren As XmlNodeList = dataLayer.SelectNodes(". | .//*") For Each dlChild As XmlElement In dataLayerWithChildren For Each att As XmlAttribute In dlChild.Attributes If Not String.IsNullOrEmpty(att.Value) AndAlso att.Value.Contains("@Chart.") Then att.Value = att.Value.Replace("@Chart.", "@rdChartData.") End If Next Next End If Next 'debugger Dim sChartDebuggerUrl As String = "" Dim sChartDebuggerUrlForLink As String = "" Dim sChartDebugFilename As String = "" Dim sDebugGuid As String = "" If dbug.DebuggingEnabled Then If String.IsNullOrEmpty(st.sGetRequestVar("rdAjaxCommand")) OrElse st.sGetRequestVar("rdAjaxCommand") = "RefreshElement" Then sDebugGuid = Guid.NewGuid.ToString.Replace("-", "") Call rdState.MakeTempDownloadFilename("htm", sChartDebuggerUrl, sChartDebugFilename, sDebugGuid) sChartDebuggerUrl = sChartDebuggerUrl.Replace(".htm", "-rdDebug.htm") sChartDebuggerUrlForLink = sChartDebuggerUrl If isUnderDataRepeater Then sDebugGuid &= "{position() + $nPageRowCnt * ($nPageNr - 1)}" sChartDebuggerUrl = sChartDebuggerUrl.Replace("-rdDebug.htm", "{position() + $nPageRowCnt * ($nPageNr - 1)}-rdDebug.htm") sChartDebuggerUrlForLink = sChartDebuggerUrlForLink.Replace("-rdDebug.htm", "@Function.RowNumber~-rdDebug.htm") If Not IsNothing(eleDef.SelectSingleNode("ancestor::CrosstabTable")) Then sDebugGuid &= "-rdCrosstabColumn" sChartDebuggerUrl = sChartDebuggerUrl.Replace("-rdDebug.htm", "-rdCrosstabColumn-rdDebug.htm") sChartDebuggerUrlForLink = sChartDebuggerUrlForLink.Replace("-rdDebug.htm", "-rdCrosstabColumn-rdDebug.htm") End If End If Else sChartDebuggerUrl = dbug.DebugUrl sChartDebuggerUrlForLink = dbug.DebugUrl sDebugGuid = dbug.DebugGuid End If End If For Each elePopup As XmlElement In eleDef.SelectNodes(".//Action[@Type='Popup']") Dim sPopupId As String = elePopup.GetAttribute("ID") sPopupId = sPopupId + (nPopupCnt + 1).ToString() elePopup.SetAttribute("rdPopupID", sPopupId) Dim span As String = String.Format("", sElementID, sPopupId) Dim nlChildActions As XmlNodeList = elePopup.SelectNodes(".//Action") Dim lstChildActions As List(Of XmlElement) = New List(Of XmlElement) For Each eleChildAction As XmlElement In nlChildActions lstChildActions.Add(eleChildAction) Next For i As Integer = 0 To lstChildActions.Count - 1 Dim eleChildAction As XmlElement = lstChildActions(i) If eleChildAction.GetAttribute("Type") = "Popup" Then Continue For End If rdUtility.RenameElement(eleChildAction, "rdOriginalAction") Dim eleFakeAction As XmlElement = eleChildAction.ParentNode.AppendChild(eleChildAction.OwnerDocument.CreateElement("Action")) eleFakeAction.SetAttribute("ID", "actStub") eleFakeAction.SetAttribute("Type", "Javascript") Dim sChartIdForPopup As String = sElementID If isUnderDataRepeater Then sChartIdForPopup = String.Format("{0}_Row@Function.RowNumber~", sElementID) End If eleFakeAction.SetAttribute("Javascript", String.Format("rdGetChartCanvasObject('{0}').execPopupMnuAction({1});", sChartIdForPopup, i)) Next Dim sAction As String = sSetAction(elePopup.ParentNode, span) sReturn += sAction Next Dim sChartDef As String = eleDef.OuterXml '19126 Convert Single Quote encoding to SingleQuoteXmlEncoded because Chart loads the XML document before any sql statements are executed, where the single quotes are generally used sChartDef = sChartDef.Replace("@Request.", "@RequestXmlEncoded.").Replace("@Local.", "@LocalXmlEncoded.").Replace("@Session.", "@SessionXmlEncoded.").Replace("@SingleQuote.", "@SingleQuoteXmlEncoded.") '16212 sChartDef = sChartDef.Replace("{", "{{").Replace("}", "}}") '13649 sReturn = sChartDef + sReturn If isUnderDataRepeater AndAlso Not bUnderGoogleMapMarkers(eleDef) Then Dim sNewID As String = sElementID + "_Row" + "{position() + $nPageRowCnt * ($nPageNr - 1)}" eleDef.SetAttribute("ID", sNewID) sReturn = sReturn.Replace(String.Format("ID=""{0}""", sElementID), String.Format("ID=""{0}""", sNewID)) End If 'sReturn = "" & sChartDef & "" Dim tzr As New Tokenizer(sChartDef) Dim tkn As Tokenizer.Token For Each tkn In tzr.Tokens Select Case tkn.Type Case "Data" 'look for any ancestor that contains datalayer underneath If Not IsNothing(eleAncestor) AndAlso eleAncestor.Name <> "AnalysisChart" Then 'replace @DataTokens to parent element's datalayer values sReturn = sReturn.Replace("@Data." & tkn.Name & "~", sTokenToXsl("@Data." & tkn.Name & "~", xslValueType.Attribute, True)) Else sReturn = sReturn.Replace("@Data." & tkn.Name & "~", "@rdChartData." & tkn.Name & "~") End If End Select Next Dim eleResizer As XmlElement = eleDef.SelectSingleNode(".//Resizer") If Not IsNothing(eleResizer) Then Dim nWidth As Integer = Val(st.sGetAttribute(eleDef, "ChartWidth")) Dim nHeight As Integer = Val(st.sGetAttribute(eleDef, "ChartHeight")) Dim bHeightOnly As Boolean = st.sGetAttribute(eleResizer, "HeightOnly") = "True" Dim bWidthOnly As Boolean = st.sGetAttribute(eleResizer, "WidthOnly") = "True" If (bHeightOnly) Then If nHeight > 0 Then sReturn = sSetResizer(eleDef, sElementID, 0, nHeight, sReturn) Else Throw New Exception("When the Resizer is set, then the chart's Height attribute must be supplied and greater than 0.") End If ElseIf bWidthOnly Then If nWidth > 0 Then sReturn = sSetResizer(eleDef, sElementID, nWidth, 0, sReturn) Else Throw New Exception("When the Resizer is set, then the chart's Width attribute must be supplied and greater than 0.") End If ElseIf nWidth > 0 AndAlso nHeight > 0 Then sReturn = sSetResizer(eleDef, sElementID, nWidth, nHeight, sReturn) Else Throw New Exception("When the Resizer is set, then the chart's Width and Height attributes must be supplied and greater than 0.") End If End If addDebuggerLinkToChart(eleDef, sChartDebuggerUrlForLink) 'input chart and validation. must be created here Dim lstInputSelection As XmlNodeList = eleDef.SelectNodes(".//InputSelection") If lstInputSelection.Count > 0 Then CreateInputSelectionValueElement(eleDef, lstInputSelection) End If Dim DashOrRA As XmlElement = eleDef.SelectSingleNode("ancestor::Dashboard2 | ancestor::Division[@ID='ReportAuthor']") sReturn = String.Format("{4}", _ msRequestedPage, sChartDebuggerUrl, sChartDebugFilename, sDebugGuid, sReturn, Not IsNothing(DashOrRA)) Return sReturn End Function Private Sub CreatePopupMenusForChartCanvas(ByVal eleDef As XmlElement) Dim sChartID As String = eleDef.GetAttribute("ID") For Each eleSeries As XmlElement In eleDef.SelectNodes("Series") Dim sSeriesID As String = eleSeries.GetAttribute("ID") Dim nlActions As XmlNodeList = eleSeries.SelectNodes("Action|InputSelection[@Type='Point' and not(@SelectionType='Area' or @SelectionType='AreaXAxis' or @SelectionType='AreaYAxis') ]/InputSelectionEvent[@SelectionEvent='Change' or @SelectionEvent='' or not(@SelectionEvent)]/Action") If nlActions.Count > 1 AndAlso IsNothing(eleSeries.SelectSingleNode("Action[@Type='Popup']")) Then Dim lstActions As List(Of XmlElement) = New List(Of XmlElement) For Each eleAction As XmlElement In nlActions lstActions.Add(eleAction) Next Dim elePopupMenu As XmlElement = eleSeries.AppendChild(eleSeries.OwnerDocument.CreateElement("Action")) elePopupMenu.SetAttribute("Type", "Popup") elePopupMenu.SetAttribute("ID", String.Format("ppAction_{0}_{1}", sChartID, sSeriesID)) Dim i As Integer = 0 For Each eleAction As XmlElement In lstActions i += 1 Dim sParentNodeName As String = eleAction.ParentNode.Name 'crate stub event for input selection If sParentNodeName = "InputSelectionEvent" Then CType(eleAction.ParentNode.ParentNode, XmlElement).SetAttribute("rdDeffered", "True") eleAction.SetAttribute("rdDeffered", "True") Dim sStubAction As XmlElement = eleAction.ParentNode.AppendChild(eleAction.OwnerDocument.CreateElement("Action")) sStubAction.SetAttribute("ID", "noAction") sStubAction.SetAttribute("Type", "Javascript") sStubAction.SetAttribute("Javascript", "return false;") End If Dim elePopupOption As XmlElement = elePopupMenu.AppendChild(elePopupMenu.OwnerDocument.CreateElement("PopupOption")) elePopupOption.SetAttribute("ID", String.Format("ppOption_{0}_{1}_{2}", sChartID, sSeriesID, i)) Dim sCaption As String = eleAction.GetAttribute("PopupMenuCaption") If String.IsNullOrEmpty(sCaption) Then sCaption = eleAction.GetAttribute("Type") End If elePopupOption.SetAttribute("Caption", sCaption) elePopupOption.AppendChild(eleAction) Next End If Next End Sub Private Sub CreateInputSelectionValueElement(ByRef eleDef As XmlElement, ByVal lstInputSelection As XmlNodeList) For Each eleSelection As XmlElement In lstInputSelection Dim attrNames As String() If st.sGetAttribute(eleSelection, "Type") = "Point" Then attrNames = New String() {"ID"} Else attrNames = New String() {"MaxXaxisID", "MinXaxisID", "MaxYaxisID", "MinYaxisID"} End If For Each attrName As String In attrNames Dim inputId As String = st.sGetAttribute(eleSelection, attrName) If String.IsNullOrEmpty(inputId) Then Continue For End If Dim inputElement As XmlElement = eleSelection.OwnerDocument.DocumentElement.SelectSingleNode( _ String.Format(".//InputHidden[@ID='{0}']|.//InputText[@ID='{0}']|//InputCheckboxList[@ID='{0}']|//InputSelectList[@ID='{0}']|//InputRadioButtons[@ID='{0}']", inputId)) If IsNothing(inputElement) Then inputElement = eleDef.OwnerDocument.CreateElement("InputHidden") inputElement.SetAttribute("ID", inputId) inputElement = eleDef.ParentNode.AppendChild(inputElement) End If Dim eleValidation As XmlElement = eleSelection.SelectSingleNode("Validation[@Type='Required']") If Not IsNothing(eleValidation) Then Dim inputValidation As XmlElement = inputElement.SelectSingleNode("Validation[@Type='Required']") If IsNothing(inputValidation) Then eleValidation = eleValidation.ParentNode.RemoveChild(eleValidation) eleValidation = inputElement.AppendChild(eleValidation) 'in case of existed inputElement it may be proccessed or not yet, we don't know 'let's force to create validation script and remove validation element out of the input subProcessInputValidationElements(inputElement) inputElement.RemoveChild(eleValidation) End If End If Next Next End Sub Private Sub CreateChartCanvasAutoDrillTo(ByRef eleDef As XmlElement) 'Dim eleDataLayer As XmlElement = eleDef.SelectSingleNode(".//DataLayer[@Type='ActiveSQL']") 'If IsNothing(eleDataLayer) Then If st.sGetAttribute(eleDef, "AutoDrillTo") <> "True" Then 'TODO: Finalize how this should be enabled. Return End If Dim eleDataLayer As XmlElement = eleDef.SelectSingleNode(".//DataLayer[@Type='ActiveSQL']") If IsNothing(eleDataLayer) Then _ Throw New Exception("AutoDrillTo requires an ActiveSQL DataLayer.") Dim eleSeries As XmlElement = eleDef.SelectSingleNode(".//Series") Dim aSupportedSeries As String() = New String() {"Bar", "Pie", "Line", "Spline"} If Array.IndexOf(aSupportedSeries, eleSeries.GetAttribute("Type")) = -1 Then Return End If 'chart was created by AG with QueryBuilder? If eleDataLayer.GetAttribute("QueryBuilderTableID").Length = 0 Then Return End If Dim nlSqlColumns As XmlNodeList = eleDataLayer.SelectNodes(".//SqlColumn") If nlSqlColumns.Count = 0 Then Return End If Dim eleChartDrillTo As XmlElement = eleSeries.AppendChild(eleSeries.OwnerDocument.CreateElement("ChartDrillTo")) For Each eleSqlColumn As XmlElement In nlSqlColumns Dim eleDrillToColumn As XmlElement = eleChartDrillTo.AppendChild(eleChartDrillTo.OwnerDocument.CreateElement("DrillToColumn")) eleDrillToColumn.SetAttribute("ColumnName", eleSqlColumn.GetAttribute("DataColumn")) eleDrillToColumn.SetAttribute("DataColumn", eleSqlColumn.GetAttribute("ID")) eleDrillToColumn.SetAttribute("DataType", eleSqlColumn.GetAttribute("DataType")) eleDrillToColumn.SetAttribute("Header", eleSqlColumn.GetAttribute("Caption")) eleDrillToColumn.SetAttribute("TableName", CType(eleSqlColumn.ParentNode, XmlElement).GetAttribute("Source")) eleDrillToColumn.SetAttribute("ID", eleSqlColumn.GetAttribute("ID")) Next CreateChartCanvasActionPopup(eleDef, eleChartDrillTo) End Sub Private Sub CreateChartCanvasActionPopup(ByRef eleChart As XmlElement, ByRef eleChartDrillTo As XmlElement) Dim sChartID As String = eleChart.GetAttribute("ID") Dim xmlTemplate As XmlDocument = rdUtility.GetSuperElementTemplate(String.Format("rdChartCanvas{0}rdDrilledToChart.lgx", rdState.GetSlash()), True) 'Is there a template modifier? 'Call rdUtility.ApplyTemplateModifier(st, dbug, eleChart, xmlTemplate.DocumentElement) 'Is there a theme or DefinitionModifierFile? Run them too. Call rdUtility.ApplyDefinitionModifierFiles(st, dbug, eleChart.OwnerDocument, xmlTemplate.DocumentElement) Dim eleTemplate As XmlElement = xmlTemplate.DocumentElement 'set ids Call rdUtility.ReplaceAttributeValues(eleTemplate, "rdElementID", sChartID, True) Dim elePopupForImport As XmlElement = eleTemplate.SelectSingleNode(String.Format(".//PopupPanel[@ID='rd_pp_chartactions_{0}']", sChartID)) Dim elePopup As XmlElement = eleChart.ParentNode.InsertAfter(eleChart.OwnerDocument.ImportNode(elePopupForImport, True), eleChart) Dim eleDrillColumnsDataLayer As XmlElement = elePopup.SelectSingleNode(String.Format(".//DataLayer[@ID='dlDrillToColumns_{0}']", sChartID)) Dim eleDatalayerWithDateGroups As XmlElement = eleTemplate.SelectSingleNode(".//DataLayer[@ID='dlGroupByDateOperators']") Dim lstUsedTables As List(Of String) = New List(Of String) For Each eleDrillToColumn As XmlElement In eleChartDrillTo.SelectNodes("DrillToColumn") Dim tableIdx As Integer = lstUsedTables.IndexOf(eleDrillToColumn.GetAttribute("TableName")) If tableIdx = -1 Then lstUsedTables.Add(eleDrillToColumn.GetAttribute("TableName")) tableIdx = lstUsedTables.Count - 1 End If Dim eleStaticDataRow As XmlElement = eleDrillColumnsDataLayer.AppendChild(eleDrillColumnsDataLayer.OwnerDocument.CreateElement("StaticDataRow")) For Each attr As XmlAttribute In eleDrillToColumn.Attributes eleStaticDataRow.SetAttribute(attr.Name, attr.Value) Next If String.IsNullOrEmpty(eleStaticDataRow.GetAttribute("TableFriendlyName")) Then eleStaticDataRow.SetAttribute("TableFriendlyName", eleStaticDataRow.GetAttribute("TableName")) End If Dim sFriendlyColumnName As String = eleDrillToColumn.GetAttribute("Header") If Not String.IsNullOrEmpty(sFriendlyColumnName) Then eleStaticDataRow.SetAttribute("ColumnName", sFriendlyColumnName) End If eleStaticDataRow.SetAttribute("TableSequence", tableIdx + 1) If eleDrillToColumn.GetAttribute("DataType") = "DateTime" OrElse _ eleDrillToColumn.GetAttribute("DataType") = "Date" Then For Each eleDateGrouping As XmlElement In eleDatalayerWithDateGroups.ChildNodes eleStaticDataRow = eleDrillColumnsDataLayer.AppendChild(eleDrillColumnsDataLayer.OwnerDocument.CreateElement("StaticDataRow")) For Each attr As XmlAttribute In eleDrillToColumn.Attributes eleStaticDataRow.SetAttribute(attr.Name, attr.Value) Next If String.IsNullOrEmpty(eleStaticDataRow.GetAttribute("TableFriendlyName")) Then eleStaticDataRow.SetAttribute("TableFriendlyName", eleStaticDataRow.GetAttribute("TableName")) End If eleStaticDataRow.SetAttribute("TableSequence", tableIdx + 1) eleStaticDataRow.SetAttribute("DataColumn", String.Format("{0}!timeperiod!{1}", eleStaticDataRow.GetAttribute("DataColumn"), eleDateGrouping.GetAttribute("GroupByDateOperatorValue"))) eleStaticDataRow.SetAttribute("ColumnName", String.Format("{0}", eleDateGrouping.GetAttribute("GroupByDateLabel"))) eleStaticDataRow.SetAttribute("Format", eleDateGrouping.GetAttribute("Format")) Next End If Next Dim eleAction As XmlElement = eleChartDrillTo.ParentNode.InsertBefore(eleChartDrillTo.OwnerDocument.CreateElement("Action"), eleChartDrillTo) eleAction.SetAttribute("Type", "Javascript") eleAction.SetAttribute("ID", String.Format("actShowDrillTo_{0}", sChartID)) eleAction.SetAttribute("Javascript", "e.point.series.chart.chartCanvas.pointClick(e.point)") eleAction.SetAttribute("PopupMenuCaption", "Drill To") End Sub Private Function sProcess_AnimatedChart(ByRef eleDef As XmlElement, ByVal sElementID As String) As String 'lgxLicense10.LicenseCheck(eleDef) 16583 '23824 'Call subAddIncludedScript("rdAjax/rdAjax2.js") If Not IsNothing(eleDef.SelectSingleNode("/*//Action")) Then 'Allow actions to work. '23824 'Call subAddIncludedScript("rdActionSubmit2.js") 'Call subAddIncludedScript("rdActionProcess.js") Call subAddIncludedScript("rdScroll.js") 'Call subAddIncludedScript("rdActionShowElement.js") End If Call subAddIncludedScript("rdAnimatedChart/FusionCharts.js") Call subAddIncludedScript("rdAnimatedChart/jquery.min.js") ' New javascript include files for Fusion charts - 19034 Call subAddIncludedScript("rdAnimatedChart/FusionCharts.HC.js") Call subAddIncludedScript("rdAnimatedChart/FusionCharts.HC.Charts.js") Call subAddIncludedScript("rdAnimatedChart/FusionCharts.HC.Widgets.js") '19142 Animated Chart Type is Required. 20582 If eleDef.Name = "AnimatedChart" AndAlso eleDef.GetAttribute("Type") = "XY" AndAlso _ String.IsNullOrEmpty(eleDef.GetAttribute("XYChartType")) Then _ Throw New Exception("Animated Chart Type must be selected") ' For Refresh and Show element...11714 Dim eleAction As XmlElement = eleDef.SelectSingleNode("Action") If Not IsNothing(eleAction) Then If eleAction.GetAttribute("Type") = "RefreshElement" Or eleAction.GetAttribute("Type") = "ShowElement" Then _ mbAddAjaxSupport = True '13631 Call subAddAdditionalScriptFiles(eleAction) End If ' For real time update Dim eleUpdate As XmlElement = eleDef.SelectSingleNode("RealTimeUpdate") If Not IsNothing(eleUpdate) Then mbAddAjaxSupport = True ' Id is required for realtimeupdate... If eleDef.GetAttribute("ID").Length = 0 Then _ Throw New Exception("Animated Charts with the Real Time Update element must have an ID.") ' is the refreshInterval set? 19839 Dim sInterval As String = eleUpdate.GetAttribute("RefreshInterval") If sInterval.Length = 0 Then _ Throw New Exception("RefreshInterval cannot be blank for the Real Time Update element.") ' Do this only on the first iteration. If st.sGetRequestVar("rdAnimatedChartRealTimeRefresh") = "" Then ' Create a Refresh Element Timer element to refresh this chart (just to get the update data-text file) Dim eleRefreshElementTimer As XmlElement = eleDef.OwnerDocument.DocumentElement.AppendChild(eleDef.OwnerDocument.CreateElement("RefreshElementTimer")) eleRefreshElementTimer.SetAttribute("ElementID", eleDef.GetAttribute("ID")) eleRefreshElementTimer.SetAttribute("animatedChartRealTimeData", "True") eleRefreshElementTimer.SetAttribute("RefreshInterval", eleUpdate.GetAttribute("RefreshInterval")) eleRefreshElementTimer.SetAttribute("ID", "RefreshTimerForAnimatedCharts" & eleDef.GetAttribute("ID")) ' Also pass the request variable to just build the text data file... Dim eleRefreshLinkparams As XmlElement = eleRefreshElementTimer.AppendChild(eleRefreshElementTimer.OwnerDocument.CreateElement("LinkParams")) eleRefreshLinkparams.SetAttribute("rdAnimatedChartRealTimeRefresh", "True") eleRefreshLinkparams.SetAttribute("rdAnimDBInstanceId", eleDef.GetAttribute("rdDBInstanceId")) '19771 End If End If 'Automatically set an ID if there isn't one already. A missing ID causes problems. But we can't make it required 'because that would break backward compatibilty. If eleDef.GetAttribute("ID").Length = 0 _ OrElse http.Request("rdEmbeddedSubReport") = "True" Then eleDef.SetAttribute("ID", "rdAnimatedChartAutoID_" & Guid.NewGuid().ToString) '#8666 'You can't have two animated charts on the same page with the same ID. End If If bUnderDataRepeater(eleDef) Then eleDef.SetAttribute("RepeatedElement", "True") '19203 End If ' Set datalayer to type which won't do anything...'17122 Dim eleDataLayer As XmlElement = eleDef.SelectSingleNode("DataLayer") If Not IsNothing(eleDataLayer) Then eleDataLayer.SetAttribute("OriginalType", eleDataLayer.GetAttribute("Type")) eleDataLayer.SetAttribute("Type", "EmptyDataLayer") 'Don't process this overall, do it later for individual AnimCharts. End If '# 10006. Dim eleAnimFormat As XmlElement = eleDef.SelectSingleNode("FormatData") If Not IsNothing(eleAnimFormat) Then Dim sFormatString As String = eleAnimFormat.GetAttribute("ChartLabelFormat") If sFormatString.Length <> 0 Then sFormatString = sFormatString.Replace("{Value}", "rdAnimChartDelimiter") sFormatString = sFormatString.Replace("{value}", "rdAnimChartDelimiter") eleAnimFormat.SetAttribute("ChartLabelFormat", sFormatString) End If End If 'Add the Definition to the output. It'll get processed later, like a chart. 'Return "" & eleDef.OuterXml & "" Dim sChartDef As String = eleDef.OuterXml '19126 Convert Single Quote encoding to SingleQuoteXmlEncoded because Chart loads the XML document before any sql statements are executed, where the single quotes are generally used sChartDef = sChartDef.Replace("@Request.", "@RequestXmlEncoded.").Replace("@Local.", "@LocalXmlEncoded.").Replace("@Session.", "@SessionXmlEncoded.").Replace("@SingleQuote.", "@SingleQuoteXmlEncoded.") '16212 sChartDef = sChartDef.Replace("{", "{{").Replace("}", "}}") '13649 Dim sXsl As String = "" & sChartDef & "" Dim bIsDataTokenInDef As Boolean = False Dim tzr As New Tokenizer(sChartDef) Dim tkn As Tokenizer.Token For Each tkn In tzr.Tokens Select Case tkn.Type Case "Data" 'sXsl = sXsl.Replace("@Data." & tkn.Name & "~", sTokenToXsl("@Data." & tkn.Name & "~", xslValueType.Attribute, True)) '17122 Dim bParentData As Boolean = False '18259,18169,17646 - Anim charts under Rows element which does not have a DL. Dim eleAncestor As XmlElement = eleDef.SelectSingleNode("ancestor::DataTable | ancestor::DataMultiColumnList | ancestor::Rows") If Not IsNothing(eleAncestor) Then Dim eleCurrentParent As XmlElement = eleDef.ParentNode bParentData = True If eleAncestor.Name = "Rows" AndAlso eleCurrentParent.Name <> "DataTableColumn" Then '18715(edit - look for DT as the immediate parent) bParentData = False End If End If If bParentData Then sXsl = sXsl.Replace("@Data." & tkn.Name & "~", sTokenToXsl("@Data." & tkn.Name & "~", xslValueType.Attribute, True)) Else sXsl = sXsl.Replace("@Data." & tkn.Name & "~", "@rdAnimData." & tkn.Name & "~") End If bIsDataTokenInDef = True End Select Next If bIsDataTokenInDef Then HttpContext.Current.Items("rdAnimatedChartOrigDef-" & eleDef.GetAttribute("ID")) = eleDef.OuterXml '13555 '19683 End If ' Added this to provide the Resizer functionality to the Animated Charts. If Not String.IsNullOrEmpty(eleDef.GetAttribute("ChartWidth")) And Not String.IsNullOrEmpty(eleDef.GetAttribute("ChartHeight")) Then _ sXsl = sSetResizer(eleDef, sElementID, Val(st.sGetAttribute(eleDef, "ChartWidth")), Val(st.sGetAttribute(eleDef, "ChartHeight")), sXsl) '11910 If st.sGetRequestVar("rdReportFormat") = "NativeWord" Or st.sGetRequestVar("rdReportFormat") = "NativeExcel" Then '2773,6428 sXsl = "" End If Return sXsl End Function Private Function sProcess_AnimatedMap(ByRef eleDef As XmlElement, ByVal sElementID As String) As String ' Setting the color 'Dim sPerSpreadCol As String = sProcess_FusionMapColor(eleDef) 'remove resizer if export request If http.Request("rdReportFormat") = "PDF" Then Dim eleResizer As XmlElement = eleDef.SelectSingleNode("Resizer") If Not IsNothing(eleResizer) Then eleResizer.ParentNode.RemoveChild(eleResizer) End If End If lgxLicense10.LicenseCheck(eleDef) 'If http.Session("rdProduct").IndexOf("Ent") = -1 Then _ ' Throw New Exception("The element """ & eleDef.Name & """ requires a Logi Info Server license.") '23824 'Call subAddIncludedScript("rdAjax/rdAjax2.js") If Not IsNothing(eleDef.SelectSingleNode("/*//Action")) Then 'Allow actions to work. '23824 'Call subAddIncludedScript("rdActionSubmit2.js") 'Call subAddIncludedScript("rdActionProcess.js") Call subAddIncludedScript("rdScroll.js") 'Call subAddIncludedScript("rdActionShowElement.js") End If Call subAddIncludedScript("rdFusionMap/FusionMaps.js") Call subAddIncludedScript("rdFusionMap/jquery.min.js") Call subAddIncludedScript("rdFusionMap/FusionCharts.js") Call subAddIncludedScript("rdFusionMap/FusionCharts.HC.js") Call subAddIncludedScript("rdFusionMap/FusionCharts.HC.Maps.js") ' For Refresh and Show element...11714 Dim eleAction As XmlElement = eleDef.SelectSingleNode("Action") If Not IsNothing(eleAction) Then If eleAction.GetAttribute("Type") = "RefreshElement" Or eleAction.GetAttribute("Type") = "ShowElement" Then _ mbAddAjaxSupport = True '13631 Call subAddAdditionalScriptFiles(eleAction) End If 'Automatically set an ID if there isn't one already. A missing ID causes problems. But we can't make it required 'because that would break backward compatibilty. Static nPrevID As Integer = 0 If eleDef.GetAttribute("ID").Length = 0 Then eleDef.SetAttribute("ID", "rdAnimatedMapAutoID_" & nPrevID) nPrevID += 1 End If Dim sXsl As String = Nothing 'Add the Definition to the output. It'll get processed later, like a chart. 'Return "" & eleDef.OuterXml & "" Dim sChartDef As String = eleDef.OuterXml sChartDef = sChartDef.Replace("{", "{{").Replace("}", "}}") '13649 sXsl &= "" & sChartDef & "" Dim tzr As New Tokenizer(sChartDef) Dim tkn As Tokenizer.Token For Each tkn In tzr.Tokens Select Case tkn.Type Case "Data" sXsl = sXsl.Replace("@Data." & tkn.Name & "~", sTokenToXsl("@Data." & tkn.Name & "~", xslValueType.Attribute, True)) End Select Next ' Added this to provide the Resizer functionality to the Animated Maps. Dim eleWidth As String = eleDef.GetAttribute("Width") If (String.IsNullOrEmpty(eleWidth)) Then eleWidth = "0" End If If Not String.IsNullOrEmpty(eleDef.GetAttribute("Height")) Then _ sXsl = sSetResizer(eleDef, sElementID, Val(eleWidth), Val(st.sGetAttribute(eleDef, "Height")), sXsl) Call subAddAnimatedMapLegend(eleDef, sXsl) 'This call may change sXsl. 11713 If st.sGetRequestVar("rdReportFormat") = "NativeWord" Or st.sGetRequestVar("rdReportFormat") = "NativeExcel" Then '6428 sXsl = "" End If If http.Request("rdReportFormat") = "PDF" Then 'wrap for export sXsl = rdBrowserBornElementRenderer.WrapHtmlToBrowserBornTag(sXsl, BrowserBornRenderType.Image) End If Return sXsl End Function Private Function sProcess_IncludeHtmlFile(ByRef eleDef As XmlElement) As String Dim slash As String = rdState.GetSlash() Dim sReturn As String = Nothing Dim sIncludeFile As String = eleDef.GetAttribute("IncludedHtmlFile") Dim tzr As New Tokenizer(sIncludeFile) If tzr.Tokens.Length = 0 Then 'The value doesn't have any tokens. Throw the included HTML into the transformation. If Not File.Exists(sIncludeFile) Then sIncludeFile = rdSupportFile.getLocalPath(sIncludeFile, rdState.sGetPhysicalPath(), rdSupportFile.SupportFileType.IncHTML, slash, sIncludeFile) '5261 modified to change case If Not File.Exists(sIncludeFile) Then sIncludeFile = sIncludeFile.Replace(slash & "_IncHtmls" & slash, slash) '5261 modified If Not File.Exists(sIncludeFile) Then Throw New Exception("Included definition file was not found. " & sIncludeFile) End If End If End If sReturn = util.XSLCompliant(rdUtility.ReadFile(sIncludeFile)) Else 'The value is tokenized, and needs to be processed after transformation. sReturn = "" End If If eleDef.ParentNode.Name = "Report" OrElse eleDef.ParentNode.Name = "MobileReport" Then 'This goes into the header, not the body. sbHead.Append(sReturn) sReturn = "" Else Dim sPositionedDiv As String = sSetPositioning(eleDef, "
    ") If sPositionedDiv.Length <> 5 Then '17132 sReturn = sPositionedDiv & sReturn & "
    " End If End If Return sReturn End Function Private Function sProcess_IncludeHtml(ByRef eleDef As XmlElement) As String 'Insert a new Label element with Format="HTML". Dim eleLabel As XmlElement = eleDef.ParentNode.InsertAfter(eleDef.OwnerDocument.CreateElement("Label"), eleDef) eleLabel.SetAttribute("Caption", eleDef.GetAttribute("Html")) eleLabel.SetAttribute("Format", "HTML") If eleDef.GetAttribute("NoWrap") = "True" Then '17130, don't output a wrapping SPAN tag, like the Label element will. eleLabel.SetAttribute("Format", "HtmlNoWrap") Else If eleDef.GetAttribute("ID").Length <> 0 Then _ eleLabel.SetAttribute("ID", eleDef.GetAttribute("ID")) End If Return Nothing End Function Private Function sProcess_IncludeFrame(ByRef eleDef As XmlElement) As String Dim sReturn As String = Nothing 'Don't included embedded reports that are hidden. '(This routine could almost be used for any control. But IncludeFrame is special because of the extra ' overhead of running embedded subreports.) Dim elePopup As XmlElement = CType(eleDef.SelectSingleNode("ancestor::PopupPanel"), XmlElement) If st.sGetRequestVar("rdKeepShowElements") <> "True" Then If Not bElementInitiallyVisible(eleDef, True) Then 'It's invisible, but could it be made visible with an Action.ShowElement on one of its ancestors? 'First get the list of parent IDs, building an XPath query along the way. '#13392 Dim bShowElementFound As Boolean = False Dim colParentIDs As New Collection Dim eleParent As XmlElement = eleDef Do While Not eleParent.Name = eleDef.OwnerDocument.DocumentElement.Name Dim sParentId As String = eleParent.GetAttribute("ID") If sParentId.Length <> 0 Then If Not colParentIDs.Contains(sParentId) Then '13747 colParentIDs.Add(Nothing, sParentId) End If End If eleParent = eleParent.ParentNode 'Get the next parent. Loop If colParentIDs.Count <> 0 Then 'Does the IncludeFrame or a parent element have an ID attribute? For Each eleShowElements As XmlElement In xmlDef.SelectNodes("//*/Action[@Type='ShowElement'] | //*/ToggleImage") Dim aElementIDs() As String = eleShowElements.GetAttribute("ElementID").Replace(" ", "").Replace(":Show", "").Replace(":Hide", "").Split(",") ' Added replacements above for :Show and :Hide for 16359 For Each sElementID As String In aElementIDs If colParentIDs.Contains(sElementID) Then bShowElementFound = True Exit For End If Next Next If Not bShowElementFound AndAlso _ elePopup IsNot Nothing Then bShowElementFound = True End If End If If Not bShowElementFound Then _ Return "" End If End If '21360 'default iframe width is 300 px (CSS spec). 'we should set it to 100% when iframe is under dashboard panel If Not IsNothing(eleDef.SelectSingleNode("ancestor::Division[@rdDashboardContent='True']")) Then Dim sFrameWidth As String = st.sGetAttribute(eleDef, "Width") If String.IsNullOrEmpty(sFrameWidth) Then eleDef.SetAttribute("Width", "100") eleDef.SetAttribute("WidthScale", "%") End If End If Dim sIFrameID As String = eleDef.GetAttribute("ID") If sIFrameID.Length = 0 Then _ Throw New Exception("IncludeFrames (Sub Reports) must have an ID value.") Dim eleTarget As XmlElement = eleDef.SelectSingleNode("Target") If IsNothing(eleTarget) Then _ Throw New Exception("An IncludeFrame must have a Target element.") Dim sMode As String = eleDef.GetAttribute("SubReportMode") Dim tkn As New Tokenizer(sMode) 'Is SubReportMode a token? If tkn.Tokens.Length <> 0 Then mbDontCacheXsl = True 'Can't cache the XSL for this definition. sMode = st.sReplaceTokens(sMode) End If If bExportReport() Or sGetPagingMethod() = "Printable" Then sMode = "Embedded" End If If sMode.Length = 0 Then sMode = "IncludeFrame" End If Dim sUrl As String = "" Select Case eleTarget.GetAttribute("Type") Case "IncludeFrameLink" sUrl = sGetTarget(eleTarget, TargetType.TargetType_URL) Case "IncludeFrameReport" sUrl = "rdPage.aspx?rdReport=" & sGetTarget(eleTarget, TargetType.TargetType_URL) sUrl = sUrl.Replace("@Request.", "@RequestHrefLink.") End Select If sUrl.Contains("rdPage.aspx?") Then '12607 sUrl &= "&rdSubReport=True" End If Dim sAttributes As String = "" ' Deprecating the HTML FrameBorder attribute, throws off IframeResize caclucations. 'If eleDef.GetAttribute("FrameBorder") = "False" Then 'Only set when No, because the default is "1". sAttributes = sAttributes & " FrameBorder=""0"" " 'End If 'Replacing HTML Frame border with CSS border. If eleDef.GetAttribute("FrameBorder") = "True" OrElse String.IsNullOrEmpty(eleDef.GetAttribute("FrameBorder")) Then sAttributes = sAttributes & " Style=""border: 1px solid #696969;"" " End If Dim bAddIFrameResize As Boolean = False If eleDef.GetAttribute("Width").Length > 0 Then ' rdIFrameFixedWidth, and rdIFrameFixedHeight attributes are looked up in the rdIframeResize.js file. sAttributes = sAttributes & " Width=""" & eleDef.GetAttribute("Width") & st.sGetAttribute(eleDef, "WidthScale", "px") & """ rdIFrameFixedWidth=""True""" Else 'Make the frame resize itself according to the content. 'onreadystatechange helps this work for Safari. sAttributes = sAttributes & " Width=""1""" bAddIFrameResize = True End If If eleDef.GetAttribute("Height").Length > 0 Then sAttributes = sAttributes & " Height=""" & eleDef.GetAttribute("Height") & st.sGetAttribute(eleDef, "HeightScale", "px") & """ rdIFrameFixedHeight=""True""" Else 'Make the frame resize itself according to the content. 'onreadystatechange helps this work for Safari. bAddIFrameResize = True sAttributes = sAttributes & " Height=""1""" sUrl &= "&rdResizeFrame=True" End If ' REPDEV-19882 Duplicate IDs are bad for IFrames in popups ' Because when the code executes to post to that iframe, we could be loading one iframe, while showing another ' We need to keep the iframe tied to this popup Dim sSuffix As String ' Check for other IFrames with this same ID in this same report ' If found, add the popup ID as the suffix so we don't get duplicate IDs in the DOM If elePopup IsNot Nothing _ AndAlso eleDef.SelectNodes(String.Format("//{0}[@ID='{1}']", eleDef.Name, sIFrameID)).Count > 1 Then sSuffix = elePopup.GetAttribute("ID") Else sSuffix = "" End If If eleDef.GetAttribute("Title").Length > 0 Then sAttributes &= " title=""" & eleDef.GetAttribute("Title") & """" Else 'always set a title (508 compliance) RD20407 sAttributes &= " title=""" & sIFrameID & sSuffix & """" End If Dim eleWaitPage As XmlElement = eleDef.SelectSingleNode(".//WaitPage") Dim sWaitKey As String If eleWaitPage IsNot Nothing _ AndAlso sMode <> "Embedded" Then sWaitKey = Guid.NewGuid().ToString.Replace("-", "") sAttributes &= " data-waitkey=""" & sWaitKey & """" _ & " data-waitmessage=""" & sEscapeAndTokenize(eleWaitPage.GetAttribute("Caption"), """") & """" _ & " data-waitclass=""" & sEscapeAndTokenize(eleWaitPage.GetAttribute("Class"), """") & """" _ & " data-waitcaptionclass=""" & sEscapeAndTokenize(eleWaitPage.GetAttribute("CaptionClass"), """") & """" End If sAttributes &= " onload=""" If eleWaitPage IsNot Nothing _ AndAlso sMode <> "Embedded" Then Dim sWaitID As String = "#rdWait_" & eleDef.GetAttribute("ID") & "_" If bUnderDataRepeater(eleDef) Then sWaitID &= sEscapeAndTokenize("Row@Function.RowNumber~_") sWaitID &= sWaitKey End If If bAddIFrameResize Then 'rdIFrameAdditionalScrollWidthAdded attribute is picked up and used by the rdIframeResize javascript #12112. sAttributes &= " iframeResize(this)" End If sAttributes &= """" If bAddIFrameResize Then sAttributes &= " rdIFrameAdditionalScrollWidthAdded="""" rdIFrameAdditionalScrollHeightAdded=""""" If sGetPagingMethod() = "Printable" Then sAttributes &= " Scrolling=""False""" Else Select Case eleDef.GetAttribute("Scrolling") Case "True" sAttributes = sAttributes & " Scrolling=""yes""" Case "False" sAttributes = sAttributes & " Scrolling=""no""" End Select End If If sMode = "IncludeFrameAsync" Then sUrl = sUrl.Replace("rdPage.aspx?", "rdPageAsync.aspx?") End If If sMode = "Embedded" Then Dim sRdIdeIdx As String = eleDef.GetAttribute("rdIdeIdx") If Not String.IsNullOrEmpty(sRdIdeIdx) Then sUrl &= String.Format("&SubReportRdIdeIdx={0}", sRdIdeIdx) End If 'Note: All sub reports under an embedded subreport must also be embedded. sReturn &= "" sReturn = "
    " & sReturn & "
    " 'This is done for WYSIWYG editing, so the item is selectable and positionable. Otherwise the IFRAME handles it. ElseIf bElementInitiallyVisible(eleDef.ParentNode, True) Then ' ''Need to set the SRC to blank, and save the URL in a hidden field. ' ''This routine must work with all browsers, and with SSL too. ' ''Need to include the src attribute or the user gets a security warning in IE5. See http://support.microsoft.com/kb/261188 ' ''But rdBlank.htm is flashed. It's annoying, so we only do this for SSL connections. ' ''If it's not an SSL connection, the src="rdTemplate/rdBlank.htm" will be removed. ''sReturn = sReturn & "" '#16050 Removed rdBlank.htm. See http://support.microsoft.com/kb/261188 sReturn &= "" Else ' Not initially visible, so make an RDIFRAME so it won't load until we make it visible sReturn &= "" End If sReturn = sSetClass(eleDef, sReturn) sReturn = sSetPositioning(eleDef, sReturn) sReturn = sSetID(eleDef, sReturn, sSuffix, True) '19895 sReturn = sSetConditionalElement(eleDef, sReturn) '23824 Call subAddIncludedScript("rdIframeIOS.js") Call subAddJavaEventFunction("rdBodyLoad", "setIframeIOSScrolling()") 'REPDEV-20607 'Call subAddJavaEventFunction("rdBodyLoad", "iframeResizeAllFrames()") If sMode = "Embedded" Then 'Include every possible JScript. These may be used by the embedded sub report. 'Because the JScript for the embedded report must be in this report. Call subIncludeAllStandardScript() If eleTarget.GetAttribute("Type") = "IncludeFrameReport" Then 'Add a duummy PopupPanel element in case the SubReport has a popup. Otherwise the subreport's popup won't work. 10937 'It might be better to inspect the SubReort for a PopupPanel, but that will take even longer. ' Dont add if this is export to PDF... #11008. If st.sGetRequestVar("rdReportFormat") <> "PDF" And st.sGetRequestVar("rdReportFormat") <> "HtmlEmail" Then ' Do not include this Popup when the report is being emailed using the Procedure.SendHtmlReport #12130. Dim eleDummyPopup As XmlElement = eleDef.ParentNode.AppendChild(eleDef.OwnerDocument.CreateElement("PopupPanel")) eleDummyPopup.SetAttribute("ID", "rdPopupPanelLoader") eleDummyPopup.SetAttribute("Draggable", "True") eleDummyPopup.SetAttribute("Caption", "StandIn") End If End If End If If bExportReport() Or sGetPagingMethod() = "Printable" Then 'Add the chart JScript, just in case the sub-report contains a chart. '23824 'subAddIncludedScript("rdChart.js") End If Return sReturn End Function Private Function sProcess_InteractiveDataView(ByRef eleDef As XmlElement, ByVal sElementID As String) As String Dim sReturn As String = Nothing lgxLicense10.LicenseCheck(eleDef) 'If http.Session("rdProduct").IndexOf("Ent") = -1 Then _ ' Throw New Exception("The element """ & eleDef.Name & """ requires a Logi Info Server license.") If st.sGetRequestVar("rdAppletResizerRefresh") = "True" Then ' If it is a Resizer Refresh, Do not process, Just get the current element's With and Height values and store them in Session. If Not String.IsNullOrEmpty(st.sGetRequestVar("rdAppletCurrentWidth")) Then HttpContext.Current.Session(st.sGetRequestVar("rdAppletId") + "-" + "rdAppletCurrentWidth") = st.sGetRequestVar("rdAppletCurrentWidth") If Not String.IsNullOrEmpty(st.sGetRequestVar("rdAppletCurrentHeight")) Then HttpContext.Current.Session(st.sGetRequestVar("rdAppletId") + "-" + "rdAppletCurrentHeight") = st.sGetRequestVar("rdAppletCurrentHeight") Return String.Empty End If Dim eleDataLayer As XmlElement = eleDef.SelectSingleNode("DataLayer") If IsNothing(eleDataLayer) Then _ Throw New Exception("InteractiveDataView is missing a DataLayer element.") 'Dim sDataLayerID As String = eleDataLayer.GetAttribute("ID") 'If Len(sDataLayerID) = 0 Then _ ' Throw New Exception("InteractiveDataView is missing a DataLayer element with an ID attrtibute.") 'If IsNothing(eleDataLayer.SelectSingleNode("CrosstabFilter")) Then _ ' Throw New Exception("InteractiveDataView is missing a DataLayer element with a CrosstabFilter element.") If IsNothing(eleDataLayer.SelectSingleNode("CrosstabFilter")) AndAlso eleDataLayer.GetAttribute("Type") <> "Linked" Then _ dbug.AddDebugMessage("** WARNING **", , "This Crosstab's table does not have a DataLayer with a CrosstabFilter.") If Not IsNothing(eleDataLayer.SelectSingleNode("CrosstabFilter/CrosstabRowSummaryColumn")) Then _ Throw New Exception("InteractiveDataView can not have a CrosstabRowSummaryColumn in its CrosstabFilter.") If Not IsNothing(eleDataLayer.SelectSingleNode("CrosstabFilter/ExtraCrosstabLabelColumn")) Then _ Throw New Exception("InteractiveDataView can not have an ExtraCrosstabLabelColumn in its CrosstabFilter.") Dim sIdvVersion As String = st.sGetAttribute(eleDef, "IdvVersion") If sIdvVersion <> "2" Then 'sReturn = rdutility.readfile(rdState.sGetphysicalpath() & "\rdTemplate\rdIDV\idvApplet.txt") Dim xmlHtml As New XmlDocument() Dim slash As String = rdState.GetSlash() xmlHtml.Load(rdState.sGetPhysicalPath() & slash & "rdTemplate" & slash & "rdIDV" & slash & "idvApplet.txt") 'Remove the numerous comment nodes. Dim nlComments As XmlNodeList = xmlHtml.SelectNodes("//comment()") Dim eleComment As XmlComment #If JAVA Then Do While 0 < nlComments.Count eleComment = nlComments.ItemOf(0) If IsNothing(eleComment) Then Exit Do End If eleComment.ParentNode.RemoveChild(eleComment) nlComments = xmlHtml.SelectNodes("//comment()") Loop #Else For Each eleComment In nlComments eleComment.ParentNode.RemoveChild(eleComment) Next #End If 'Set attributes. xmlHtml.DocumentElement.SetAttribute("IdvVersion", sIdvVersion) xmlHtml.DocumentElement.SetAttribute("IdvID", sElementID) xmlHtml.DocumentElement.SetAttribute("rdTitle", st.sGetAttribute(eleDef, "IdvTitle")) xmlHtml.DocumentElement.SetAttribute("rdTitleX", st.sGetAttribute(eleDef, "IdvTitleX")) xmlHtml.DocumentElement.SetAttribute("rdTitleY", st.sGetAttribute(eleDef, "IdvTitleY")) xmlHtml.DocumentElement.SetAttribute("rdFormat", st.sGetAttribute(eleDef, "IdvValueFormat")) xmlHtml.DocumentElement.SetAttribute("rd3D", st.sGetAttribute(eleDef, "Idv3D")) Dim eleIdvApplet As XmlElement = xmlHtml.SelectSingleNode("//rdIDV/applet") eleIdvApplet.SetAttribute("id", sElementID) Dim nWidth As Integer Dim nHeight As Integer If Not String.IsNullOrEmpty(HttpContext.Current.Session(st.sGetAttribute(eleDef, "ID") + "-" + "rdAppletCurrentWidth")) Then nWidth = Val(HttpContext.Current.Session(st.sGetAttribute(eleDef, "ID") + "-" + "rdAppletCurrentWidth")) Else nWidth = Val(st.sGetAttribute(eleDef, "Width")) End If If Not String.IsNullOrEmpty(HttpContext.Current.Session(st.sGetAttribute(eleDef, "ID") + "-" + "rdAppletCurrentHeight")) Then nHeight = Val(HttpContext.Current.Session(st.sGetAttribute(eleDef, "ID") + "-" + "rdAppletCurrentHeight")) Else nHeight = Val(st.sGetAttribute(eleDef, "Height")) End If If nWidth >= 200 And nWidth <= 2000 Then _ eleIdvApplet.SetAttribute("width", nWidth) If nHeight >= 200 And nHeight <= 2000 Then _ eleIdvApplet.SetAttribute("height", nHeight) If eleDef.GetAttribute("BackgroundColor").Length <> 0 Then 'Dim sColor As Integer = CStr(Drawing.Color.FromName(st.sGetAttribute(eleDef, "BackgroundColor")).ToArgb) Dim sColor As Integer = GetColorFromString(st.sGetAttribute(eleDef, "BackgroundColor")) '13373. If sColor = "0" Then sColor = eleDef.GetAttribute("BackgroundColor") 'The color name is unknown Else sColor = CInt(sColor) + -&HFF000000 'Take out the transparency part. End If eleIdvApplet.SelectSingleNode("param[@name='controls.bgColor']").Attributes("value").Value = sColor eleIdvApplet.SelectSingleNode("param[@name='menu.bgColor']").Attributes("value").Value = sColor eleIdvApplet.SelectSingleNode("param[@name='chart.bgColor']").Attributes("value").Value = sColor eleIdvApplet.SelectSingleNode("param[@name='tree.bgColor']").Attributes("value").Value = sColor End If 'Chart Type Dim sChartType As String = "" Select Case eleDef.GetAttribute("IdvChartType") Case "Line" sChartType = "Line" Case "ClusteredBar" sChartType = "Clustered Bar" Case "StackedBar" sChartType = "Stacked Bar" Case "StackedArea" sChartType = "Stacked Area" Case "Pie" sChartType = "Pie" End Select If Not IsNothing(sChartType) Then eleIdvApplet.SelectSingleNode("param[@name='chart.showChartType']").Attributes("value").Value = sChartType End If 'Font Dim eleFont As XmlElement = eleDef.SelectSingleNode("FontIdv") If Not IsNothing(eleFont) Then If eleFont.GetAttribute("FontFilename").Length <> 0 Then Dim sFontName As String = eleFont.GetAttribute("FontIdv") eleIdvApplet.SelectSingleNode("param[@name='applet.font']").Attributes("value").Value = sFontName eleIdvApplet.SelectSingleNode("param[@name='menu.font']").Attributes("value").Value = sFontName eleIdvApplet.SelectSingleNode("param[@name='chart.font']").Attributes("value").Value = sFontName eleIdvApplet.SelectSingleNode("param[@name='tree.font']").Attributes("value").Value = sFontName eleIdvApplet.SelectSingleNode("param[@name='tree.labelFont']").Attributes("value").Value = sFontName eleIdvApplet.SelectSingleNode("param[@name='grid.dataFont']").Attributes("value").Value = sFontName eleIdvApplet.SelectSingleNode("param[@name='reports.font']").Attributes("value").Value = sFontName End If If eleFont.GetAttribute("FontSize").Length <> 0 Then Dim sFontSize As String = eleFont.GetAttribute("FontSize") eleIdvApplet.SelectSingleNode("param[@name='applet.fontSize']").Attributes("value").Value = sFontSize eleIdvApplet.SelectSingleNode("param[@name='menu.fontSize']").Attributes("value").Value = sFontSize eleIdvApplet.SelectSingleNode("param[@name='chart.fontSize']").Attributes("value").Value = sFontSize eleIdvApplet.SelectSingleNode("param[@name='chart.axisFontSize']").Attributes("value").Value = sFontSize eleIdvApplet.SelectSingleNode("param[@name='chart.legendFontSize']").Attributes("value").Value = sFontSize eleIdvApplet.SelectSingleNode("param[@name='chart.titleFontSize']").Attributes("value").Value = sFontSize eleIdvApplet.SelectSingleNode("param[@name='tree.fontSize']").Attributes("value").Value = sFontSize eleIdvApplet.SelectSingleNode("param[@name='tree.labelFontSize']").Attributes("value").Value = sFontSize eleIdvApplet.SelectSingleNode("param[@name='grid.dataFontSize']").Attributes("value").Value = sFontSize eleIdvApplet.SelectSingleNode("param[@name='grid.titleFontSize']").Attributes("value").Value = sFontSize 'eleIdvApplet.SelectSingleNode("param[@name='reports.fontSize']").Attributes("value").Value = sFontSize End If If eleFont.GetAttribute("FontColor").Length <> 0 Then Dim sColor As Integer = CStr(Drawing.Color.FromName(eleFont.GetAttribute("FontColor")).ToArgb) If sColor = "0" Then sColor = eleDef.GetAttribute("BackgroundColor") 'The color name is unknown Else sColor = CInt(sColor) + -&HFF000000 'Take out the transparency part. End If eleIdvApplet.SelectSingleNode("param[@name='applet.fontColor']").Attributes("value").Value = sColor eleIdvApplet.SelectSingleNode("param[@name='menu.fontColor']").Attributes("value").Value = sColor eleIdvApplet.SelectSingleNode("param[@name='chart.fgColor']").Attributes("value").Value = sColor 'eleIdvApplet.SelectSingleNode("param[@name='tree.fontColor']").Attributes("value").Value = sColor eleIdvApplet.SelectSingleNode("param[@name='tree.labelFontColor']").Attributes("value").Value = sColor eleIdvApplet.SelectSingleNode("param[@name='grid.dataFontColor']").Attributes("value").Value = sColor eleIdvApplet.SelectSingleNode("param[@name='grid.headerFontColor']").Attributes("value").Value = sColor End If End If 'sReturn = xmlHtml.OuterXml Dim sXsl As String = Nothing sXsl &= "" & xmlHtml.OuterXml & "" Dim sChartDef As String = eleDef.OuterXml Dim tkzr As New Tokenizer(sChartDef) Dim tokn As Tokenizer.Token For Each tokn In tkzr.Tokens Select Case tokn.Type Case "Data" sXsl = sXsl.Replace("@Data." & tokn.Name & "~", sTokenToXsl("@Data." & tokn.Name & "~", xslValueType.Attribute, True)) End Select Next ' Added this to provide the Resizer functionality to the IDV. If Not String.IsNullOrEmpty(eleDef.GetAttribute("Width")) And Not String.IsNullOrEmpty(eleDef.GetAttribute("Height")) Then Return sSetResizer(eleDef, sElementID, Val(st.sGetAttribute(eleDef, "Width")), Val(st.sGetAttribute(eleDef, "Height")), sXsl) Else Return sSetResizer(eleDef, sElementID, 750, 600, sXsl) ' Set to default values, refer to rdTemplate/rdIDV/idvApplet.txt. End If Else 'IDV Version 2 'sReturn = rdutility.readfile(rdState.sGetphysicalpath() & "\rdTemplate\rdIDV\idvApplet.txt") Dim xmlHtml As New XmlDocument() Dim slash As String = rdState.GetSlash() xmlHtml.Load(rdState.sGetPhysicalPath() & slash & "rdTemplate" & slash & "rdIDV" & slash & "idvAppletV2.xml") xmlHtml.DocumentElement.SetAttribute("IdvVersion", "2") Dim sConfigUrl As String = "" Dim sConfigFilename As String = "" Call rdState.MakeTempDownloadFilename("xml", sConfigUrl, sConfigFilename) sConfigUrl = sConfigUrl.Replace(".xml", "-IdvCfg.xml") sConfigFilename = sConfigFilename.Replace(".xml", "-IdvCfg.xml") Dim eleAppletConfig As XmlElement = xmlHtml.SelectSingleNode("rdIDV/applet/param[@name='config.file']") eleAppletConfig.SetAttribute("value", sConfigUrl) FileCopy(rdState.sGetPhysicalPath() & slash & "rdTemplate" & slash & "rdIdv" & slash & "idvConfigV2.xml", sConfigFilename) Dim xmlConfig As New XmlDocument() : xmlConfig.Load(sConfigFilename) 'Set attributes. xmlHtml.DocumentElement.SetAttribute("ID", sElementID) xmlHtml.DocumentElement.SetAttribute("rdTitle", st.sGetAttribute(eleDef, "IdvTitle")) xmlHtml.DocumentElement.SetAttribute("rdTitleX", st.sGetAttribute(eleDef, "IdvTitleX")) xmlHtml.DocumentElement.SetAttribute("rdTitleY", st.sGetAttribute(eleDef, "IdvTitleY")) xmlHtml.DocumentElement.SetAttribute("rdFormat", st.sGetAttribute(eleDef, "IdvValueFormat")) Dim eleIdvApplet As XmlElement = xmlHtml.SelectSingleNode("//rdIDV/applet") Dim nWidth As Integer = Val(st.sGetAttribute(eleDef, "Width")) If nWidth >= 200 And nWidth <= 2000 Then _ eleIdvApplet.SetAttribute("width", nWidth) Dim nHeight As Integer = Val(st.sGetAttribute(eleDef, "Height")) If nHeight >= 200 And nHeight <= 2000 Then _ eleIdvApplet.SetAttribute("height", nHeight) If eleDef.GetAttribute("BackgroundColor").Length <> 0 Then Dim sColor As Integer = CStr(Drawing.Color.FromName(st.sGetAttribute(eleDef, "BackgroundColor")).ToArgb) If sColor = "0" Then sColor = eleDef.GetAttribute("BackgroundColor") 'The color name is unknown Else sColor = CInt(sColor) + -&HFF000000 'Take out the transparency part. End If xmlConfig.SelectSingleNode("//param-name[.='background']").NextSibling.InnerText = sColor End If 'Chart Type Dim sChartType As String = Nothing Select Case eleDef.GetAttribute("IdvChartType") Case "Line" sChartType = "Line" Case "ClusteredBar" sChartType = "Clustered Bar" Case "StackedBar" sChartType = "Stacked Bar" Case "StackedArea" sChartType = "Stacked Area" Case "Pie" sChartType = "Pie" End Select If Not IsNothing(sChartType) Then xmlConfig.SelectSingleNode("//param-name[.='chartType']").NextSibling.InnerText = sChartType End If xmlConfig.Save(sConfigFilename) sReturn = xmlHtml.OuterXml End If sReturn = sSetPositioning(eleDef, sReturn) 'This can't be absolutely positioned, but adding the LgxKey allows an error message to be displayed to the user. sReturn = util.XSLCompliant(sReturn) Return sReturn End Function Private Function sProcess_HeadersAndFooters(ByRef eleDef As XmlElement) As String Dim sReturn As String = Nothing sReturn = sProcessDefinitionElementChildren(eleDef) If eleDef.GetAttribute("ID").Length = 0 Then '8131 If eleDef.Name = "PageHeader" Or eleDef.Name = "PageFooter" Then Dim sHFId As String = "rdPageHF-" & Guid.NewGuid.ToString eleDef.SetAttribute("ID", sHFId) End If End If sReturn = "" & sReturn & "" If eleDef.GetAttribute("ID").Length <> 0 Then 'This makes Action.RefreshElement work with ReportHeader and ReportFooter. sReturn = sSetID(eleDef, "") & sReturn & "" End If 'sReturn = sSetID(eleDef, sReturn) sReturn = sSetClass(eleDef, sReturn) sReturn = sSetPositioning(eleDef, sReturn) sReturn = sSetVisibility(eleDef, sReturn) 'If eleDef.Name = "ReportHeader" Then sReturn = sReturn.Insert(sReturn.IndexOf("
    ") sReturn &= "" Return sReturn End Function Private Function sProcess_StyleSheet(ByRef eleDef As XmlElement) As String Dim sReturn As String = Nothing ' 'If Not mbSyleSheetWasSet Then If bElementInitiallyVisible(eleDef) Then Dim sTemp As String = eleDef.GetAttribute("StyleSheet") 'If sTemp.Length = 0 Then _ ' Throw New Exception("A StyleSheet must have a StyleSheet attribute.") If sTemp.Length <> 0 Then Static htAddedStylesheets As New Dictionary(Of String, Boolean) 'Don't add the same CSS multiple times. If Not htAddedStylesheets.ContainsKey(sTemp) Then htAddedStylesheets.Add(sTemp, False) Dim sStyleSheetLink As String = " 0 Then _ sTemp = sTemp & "?lgxPreview=" & sLgxPreview 'When in Studio's Preview mode, this parameter can be used to prevent caching of the Stylesheet. If sTemp.IndexOf("/") = -1 Then sStyleSheetLink += "href=""" & rdSupportFile.getRelativeWebPath(st.sReplaceTokens(sTemp), rdState.sGetPhysicalPath(), rdSupportFile.SupportFileType.StyleSheet) & """ />" Else sStyleSheetLink += "href=""" & sTemp & """ />" End If If eleDef.GetAttribute("InsertFirst") = "True" Then Dim nInsertPos As Integer = sbHead.ToString.IndexOf(" -1 Then sbHead.Insert(nInsertPos, sStyleSheetLink) Else sbHead.Append(sStyleSheetLink) End If Else sbHead.Append(sStyleSheetLink) End If 'If Not sTemp.Contains("assets/menu.css") Then 'We still need to look for the global style sheet if the yui popup menu css is getting added now. ' mbSyleSheetWasSet = True 'End If End If End If End If 'End If Return sReturn End Function Private Function sProcess_Row(ByRef eleDef As XmlElement) As String Dim sReturn As String = Nothing If bPreEvaluatedConditionIsFalse(eleDef) Then 'Condition=False. Remove this element, don't process any children. eleDef.InnerXml = "" Return "" End If sReturn = "" sReturn = sSetVisibility(eleDef, sReturn) 'Call subConvertActionToEventHandler(eleDef) '10831 - Actions and EventHandlers for Columns. 'sReturn = sSetEventHandler(eleDef, sReturn) sReturn = sSetClass(eleDef, sReturn) Call subConvertActionToEventHandler(eleDef) '10831 - Actions and EventHandlers for Columns. sReturn = sSetID(eleDef, sReturn) sReturn = sReturn.Insert(sReturn.Length - 5, sProcessDefinitionElementChildren(eleDef)) & CrLf 'Insert the children just before the ending "" 'sReturn = sSetAction(eleDef, sReturn) 'Doesn't work because around fails in WebKit and Mozilla. sReturn = sSetEventHandler(eleDef, sReturn) 'Not documented, used by the mobile menu element. sReturn = sSetConditionalElement(eleDef, sReturn) Return sReturn End Function Private Function sProcess_Rows(ByRef eleDef As XmlElement) As String Dim sReturn As String = Nothing If eleDef.GetAttribute("ID").Length = 0 Then 'Generate an ID value. This will help Native PDF more quickly calculate column widths if this element is repeated within a DataTable. mnNextID += 1 eleDef.SetAttribute("ID", "rdRows-" & mnNextID) End If Dim sTableStyle As String = "" If eleDef.GetAttribute("Width").Length > 0 Then 'sTableStyle = "width:" & eleDef.GetAttribute("Width") & eleDef.GetAttribute("WidthScale") & ";" sTableStyle = "width:" & eleDef.GetAttribute("Width") & st.sGetAttribute(eleDef, "WidthScale", "px") & ";" End If If eleDef.GetAttribute("Height").Length > 0 Then 'sTableStyle &= "height:" & eleDef.GetAttribute("Height") & eleDef.GetAttribute("HeightScale") & ";" sTableStyle &= "height:" & eleDef.GetAttribute("Height") & st.sGetAttribute(eleDef, "HeightScale", "px") & ";" End If If eleDef.GetAttribute("Layout") = "Fixed" Then sTableStyle &= "table-layout:fixed;" End If If Len(sTableStyle) <> 0 Then sTableStyle = "style=""" & sTableStyle & """" End If Dim sTableBorder As String = "" If eleDef.GetAttribute("TableBorder").Length <> 0 Then sTableBorder = " border=""" & eleDef.GetAttribute("TableBorder") & """ " End If sReturn = "" sReturn = sSetCellSpacing(eleDef, sReturn) 'sReturn = sSetBackgroundImage(eleDef, sReturn) sReturn = sSetVisibility(eleDef, sReturn) sReturn = sSetClass(eleDef, sReturn) sReturn = sSetPositioning(eleDef, sReturn) sReturn = sSetID(eleDef, sReturn) 'If eleDef.GetAttribute("Caption").Length <> 0 Then ' sReturn = sReturn & "" 'End If sReturn &= sBuildTableCaption(eleDef) sReturn = sReturn & sProcessDefinitionElementChildren(eleDef) sReturn = sReturn & "
    " & eleDef.GetAttribute("Caption") & "
    " Return sReturn End Function Private Function sProcess_Column(ByRef eleDef As XmlElement) As String Dim sReturn As String = Nothing If bPreEvaluatedConditionIsFalse(eleDef) Then 'Condition=False. Remove this element, don't process any children. eleDef.InnerXml = "" Return "" End If 'If bElementInitiallyVisible(eleDef) Then Dim dataGroup As String = st.sGetAttribute(eleDef, "DragGroup") If Not String.IsNullOrEmpty(dataGroup) Then dataGroup = String.Format(" data-group=""{0}""", dataGroup) End If Dim sColStyle As String = "" If eleDef.GetAttribute("Width").Length > 0 Then _ 'sColStyle = "style=""width: " & eleDef.GetAttribute("Width") & eleDef.GetAttribute("WidthScale") & """ " sColStyle = "width: " & eleDef.GetAttribute("Width") & st.sGetAttribute(eleDef, "WidthScale", "px") & ";" End If If eleDef.GetAttribute("BackgroundColor").Length > 0 Then sColStyle &= " background-color:" & eleDef.GetAttribute("BackgroundColor") & ";" End If If eleDef.GetAttribute("TextColor").Length > 0 Then sColStyle &= " color:" & eleDef.GetAttribute("TextColor") & ";" End If If sColStyle.Length <> 0 Then sColStyle = "style=""" & sTokenToXsl(sColStyle, xslValueType.Attribute) & """ " '13869 End If 'If eleDef.GetAttribute("text-align").Length > 0 Then _ ' sColStyle = "style=""text-align: " & eleDef.GetAttribute("text-align") & """ " 'This is used by the ColorSpectrumLegend 'If eleDef.GetAttribute("vertical-align").Length > 0 Then _ ' sColStyle = "style=""vertical-align: " & eleDef.GetAttribute("vertical-align") & """ " 'This is used by the ColorSpectrumLegend sReturn = " 0 Then _ sReturn = sReturn & "COLSPAN=""" & eleDef.GetAttribute("ColSpan") & """ " If eleDef.GetAttribute("RowSpan").Length > 0 Then _ sReturn = sReturn & "ROWSPAN=""" & eleDef.GetAttribute("RowSpan") & """ " If eleDef.Name = "CrosstabTableHeaderColumn" _ OrElse eleDef.Name = "CrosstabTableSummaryColumn" Then _ sReturn = sReturn & "rdCrosstab=""True"" " sReturn &= sGetTooltipTitle(eleDef) 'For DraggableColumns, allow Column elements to move with the DataTableColumn. Dim eleDraggableColumnParentTable As XmlElement = eleDef.SelectSingleNode("ancestor::DataTable[@DraggableColumns='True']") If Not IsNothing(eleDraggableColumnParentTable) Then If IsNothing(eleDef.SelectSingleNode("ancestor::SubDataTable")) AndAlso _ "HeaderRow,SummaryRow,GroupHeaderRow,GroupSummaryRow,".Contains("," & eleDef.ParentNode.Name & ",") Then sReturn &= " rdColumnSeq=""""" End If End If 'For ResizableColumns, allow Column elements to move with the DataTableColumn. Dim eleResizableColumnParentTable As XmlElement = eleDef.SelectSingleNode("ancestor::DataTable[@ResizableColumns='True']") If Not IsNothing(eleResizableColumnParentTable) Then If IsNothing(eleDef.SelectSingleNode("ancestor::SubDataTable")) AndAlso _ "HeaderRow,SummaryRow,GroupHeaderRow,GroupSummaryRow,".Contains("," & eleDef.ParentNode.Name & ",") Then sReturn &= " rdResizeSeq=""""" End If End If sReturn = sReturn & ">" sReturn = sSetVisibility(eleDef, sReturn) 'sReturn = sSetAlign(eleDef, sReturn) Call subConvertActionToEventHandler(eleDef) '10831 - Actions and EventHandlers for Columns. sReturn = sSetClass(eleDef, sReturn) sReturn = sSetStyle(eleDef, sReturn) 'Originally put here especially for ColorSpectrumLegends. sReturn = sSetID(eleDef, sReturn) If sReturn.Substring(sReturn.Length - 5).Contains("DIV") Then ' # 10869. sReturn = sReturn.Insert(sReturn.Length - 6, sProcessDefinitionElementChildren(eleDef)) & CrLf 'Insert the children just before the ending "
    " Else sReturn = sReturn.Insert(sReturn.Length - 5, sProcessDefinitionElementChildren(eleDef)) & CrLf 'Insert the children just before the ending "" End If 'sReturn = sReturn & "" & CrLf sReturn = sSetEventHandler(eleDef, sReturn) sReturn = sSetConditionalElement(eleDef, sReturn) 'End If Return sReturn End Function Private Function sProcess_InputGrid(ByRef eleDef As XmlElement) As String Dim sReturn As String = Nothing Dim sTableStyle As String = "" If eleDef.GetAttribute("GridWidth").Length > 0 Then 'sTableStyle = "width:" & eleDef.GetAttribute("GridWidth") & eleDef.GetAttribute("WidthScale") & ";" sTableStyle = "width:" & eleDef.GetAttribute("GridWidth") & st.sGetAttribute(eleDef, "WidthScale", "px") & ";" End If If eleDef.GetAttribute("Layout") = "Fixed" Then sTableStyle &= "table-layout:fixed;" End If If Len(sTableStyle) <> 0 Then sTableStyle = "style=""" & sTableStyle & """" End If 'Table sReturn = "" sReturn = sSetCellSpacing(eleDef, sReturn) 'sReturn = sSetBackgroundImage(eleDef, sReturn) sReturn = sSetVisibility(eleDef, sReturn) sReturn = sSetID(eleDef, sReturn) sReturn = sSetClass(eleDef, sReturn) 'Table header 'Dim sHeader As String = "" 'Used to set column widths 'Dim sCaptionStyle As String = "" 'Dim sInputStyle As String = "" 'If eleDef.GetAttribute("CaptionWidth").Length > 0 Then _ ' sCaptionStyle = " style=""width:" & eleDef.GetAttribute("CaptionWidth") & eleDef.GetAttribute("WidthScale") & ";""" 'If eleDef.GetAttribute("InputWidth").Length > 0 Then _ ' sInputStyle = " style=""width:" & eleDef.GetAttribute("InputWidth") & eleDef.GetAttribute("WidthScale") & ";""" 'If sCaptionStyle.Length + sInputStyle.Length <> 0 Then _ ' sReturn &= "" sReturn &= sProcessDefinitionElementChildren(eleDef) sReturn &= "
    " sReturn = sSetPositioning(eleDef, sReturn) Return sReturn End Function Private Function sProcess_InputHidden(ByRef eleDef As XmlElement) As String Dim sReturn As String = Nothing sReturn &= " 0 Then If sDefaultValue.StartsWith("=") Then 'The value is a formula. The value is calculated post-XSL transformation. sDefaultValue = rdUtility.HtmlEncode4(sDefaultValue, True) sFormula = " rdFormula=""" & sTokenToXsl(sDefaultValue.Substring(1), xslValueType.Attribute, True, True) & """" sDefaultValue = "rdFormulaValue" End If sDefaultValue = sDefaultValue.Replace("@Request.", "@RequestHtmlEncoded.") sReturn &= sFormula & " VALUE=""" & sTokenToXsl(sDefaultValue, xslValueType.Attribute, True) & """" End If sReturn &= ">" sReturn = sSetID(eleDef, sReturn, , SET_NAME_TOO) Return sReturn End Function Private Function sProcess_InputText(ByRef eleDef As XmlElement) As String Dim sReturn As String = Nothing Dim sCaption As String = sAddInputElementCaption(eleDef) Dim sType As String = String.Empty Select Case eleDef.Name Case "InputPassword" sType = "PASSWORD" Case "InputNumber" sType = "NUMBER" Case "InputEmail" sType = "EMAIL" Case "InputTelephone" sType = "TEL" Case Else sType = "TEXT" End Select sReturn &= " 0 Then _ sReturn &= " rdFormatValue=""" & rdUtility.HtmlEncode4(sFormat) & """" If eleDef.GetAttribute("AjaxDontSubmit") = "True" Then _ sReturn &= " rdAjaxDontSubmit=""True""" Dim sFormula As String = "" Dim sDefaultValue As String = eleDef.GetAttribute("DefaultValue") If sDefaultValue.Length <> 0 Then If sDefaultValue.StartsWith("=") Then 'The value is a formula. The value is calculated post-XSL transformation. sDefaultValue = rdUtility.HtmlEncode4(sDefaultValue, True) sFormula = " rdFormula=""" & sTokenToXsl(sDefaultValue.Substring(1), xslValueType.Attribute, True, True) & """" sDefaultValue = "rdFormulaValue" End If sDefaultValue = sDefaultValue.Replace("@Request.", "@RequestHtmlEncoded.") sReturn &= sFormula & " VALUE=""" & sTokenToXsl(sDefaultValue, xslValueType.Attribute, True, True) & """" '10658 for { and } End If Dim sStyle As String = eleDef.GetAttribute("Style") If eleDef.GetAttribute("InputSize").Length <> 0 Then If eleDef.GetAttribute("InputSize") = "0" Then sStyle &= " displaynone " Else sReturn &= " SIZE=""" & eleDef.GetAttribute("InputSize") & """" End If End If If eleDef.Name = "InputComboList" Then sStyle &= "padding-right: 17px;" 'Use the default size of the down arrow, this prevents text from appearing behind the arrow.RD19313 End If If Not String.IsNullOrEmpty(sStyle) Then sReturn &= " Style=""" & sStyle & """" End If If eleDef.GetAttribute("InputMaxLength").Length <> 0 Then _ sReturn &= " MAXLENGTH=""" & eleDef.GetAttribute("InputMaxLength") & """" sReturn &= sGetTooltipTitle(eleDef) If Not IsNothing(eleDef.SelectSingleNode("//Action[@EnterKeyDefault=""True""]")) Then 'There's another default action for the enter key. Disable the enter from this textbox. #9040. sReturn &= " onkeypress=""return !(event && event.keyCode == 13);""" 'Changed window.event to event. #10404 End If '14780 MultipleAddresses="True" If sType = "EMAIL" AndAlso st.sGetAttribute(eleDef, "MultipleAddresses", "False") = "True" Then sReturn &= " multiple=""true""" End If If Not String.IsNullOrEmpty(eleDef.GetAttribute("Placeholder")) Then sReturn &= " Placeholder=""" & eleDef.GetAttribute("Placeholder") & """" End If ' REPDEV-20365 If st.sGetAttribute(eleDef, "DisableAutoFill").Equals("True") Then ' autocomplete="off" should work, but browsers blatently ignore it ' in order for browsers to obey the autocomplete attribute ' we must specify a meaningful value that explains why we want it ' to not be automatically filled in when blank ' autocomplete="rd-off" does not work, maybe the browser see that it contains the word off? ' autocomplete="new-field" does not work, maybe the value has to be unique? ' autocomplete="new-idOfTheInputElement" seems to work in IE, Chrome, Firefox, and Edge, so we're going with that Dim sID As String = st.sGetAttribute(eleDef, "ID") sReturn &= " autocomplete=""new-" & sID & """" End If Dim eleAutoComplete As XmlElement ' Autocomplete and ComboList specific... Dim sComboListButtonXsl As String = Nothing If eleDef.Name = "InputComboList" Then Dim eleComboListDataLayer As XmlElement = eleDef.SelectSingleNode("DataLayer") Dim sColumn As String = eleDef.GetAttribute("ComboListColumn") If String.IsNullOrEmpty(sColumn) Then _ Throw New Exception("InputComboList requires the ComboListColumn attribute.") If IsNothing(eleComboListDataLayer) Then _ Throw New Exception("InputComboList requires a child DataLayer element.") 'Move the DataLayer into a new AutoComplete. eleAutoComplete = eleDef.AppendChild(eleDef.OwnerDocument.CreateElement("AutoComplete")) eleAutoComplete.SetAttribute("ColumnName", sColumn) If eleDef.HasAttribute("MultiSelect") Then eleAutoComplete.SetAttribute("MultiSelect", eleDef.GetAttribute("MultiSelect")) End If eleAutoComplete.AppendChild(eleDef.RemoveChild(eleComboListDataLayer)) Else eleAutoComplete = eleDef.SelectSingleNode("AutoComplete") End If If Not IsNothing(eleAutoComplete) Then 'AutoComplete and InputComboList go here. mbDontCacheXsl = True 'Can't XSL-cache when the data values are getting built below. '23824 'Call subAddIncludedScript("rdYui/auto-complete.js") Call subAddYUIInitializerOnce("'rdAutoComplete'", "Y.LogiXML.rdAutoComplete.createElements();") eleDef.SetAttribute("Class", " rdAutoCompleteElement " & eleDef.GetAttribute("Class")) If eleAutoComplete.GetAttribute("ID") = "" Then eleAutoComplete.SetAttribute("ID", "AuComp-" & Guid.NewGuid.ToString) If IsNothing(eleAutoComplete.SelectSingleNode("DataLayer")) Then '24028 Throw New Exception("AutoComplete requires a child DataLayer.") End If Dim xmlData As XmlDocument = _db9.xmlGetDataDocument(eleDef, ".//DataLayer") Dim sDataValues As String = "" If Not IsNothing(xmlData) Then sDataValues = getAutoCompleteData(xmlData, eleAutoComplete) End If Dim sMultiSelect As String = "False" If eleAutoComplete.GetAttribute("MultiSelect") = "True" Then sMultiSelect = "True" If eleDef.Name = "InputComboList" Then 'Add a button for the ComboList. 'In javascript, the down arrow gets moved into the , then made visible, and then a click action gets assigned. Dim sMarginOffset As String = st.sGetAttribute(eleDef, "DropdownArrowOffset", -17) sComboListButtonXsl = "" 'Remove the X that appears in IE text-boxes. It gets in the way of the down-arrow. sComboListButtonXsl &= "" End If sReturn &= String.Format(" data-values=""{0}"" data-multiSelect=""{1}"" data-delimiter=""{2}"" ", sDataValues, sMultiSelect, st.InputValueDelimiter) ' height specified? If eleDef.HasAttribute("Height") Then Dim sScrollStyle As String = "" sbHead.Append(sScrollStyle) End If End If sReturn &= ">" sReturn = sSetID(eleDef, sReturn, , SET_NAME_TOO) Call subSetupInputChangeFlagEvent(eleDef) sReturn = sSetEventHandler(eleDef, sReturn) sReturn = sSetClass(eleDef, sReturn) sReturn = sSetAction(eleDef, sReturn) If Not IsNothing(sComboListButtonXsl) Then _ sReturn = "" & sReturn & sComboListButtonXsl & "" sReturn = sMakeInputGridRow(eleDef, sCaption, sReturn) 'Adding this block of code here for required attributes "ID" in Textbox element to work. Not sure why it wasn't here to begin with, but adding this 'and leaving it here commented out in case it should be readded later. 'Validation ' If eleDef.GetAttribute("ID").Length = 0 Then ' Throw New Exception("Textbox ID must be defined") ' End If If Not IsNothing(eleDef.SelectSingleNode("Validation[@Type='Numeric']")) Then 'Setup handling for localization for numbers. 'sReturn &= "" Dim eleDeLocalize As XmlElement = xmlDef.CreateElement("InputHidden") eleDeLocalize.SetAttribute("ID", "rdDeLocalize" & eleDef.GetAttribute("ID")) eleDeLocalize.SetAttribute("DefaultValue", "Number") eleDef.AppendChild(eleDeLocalize) Dim sHiddenInputDeLocalize As String = sProcessDefinitionElement(eleDeLocalize) sReturn &= sHiddenInputDeLocalize End If Call subProcessInputValidationElements(eleDef) Call subAddInputElementCookieCreation(eleDef) Return sReturn End Function Private Function sProcess_InputTextArea(ByRef eleDef As XmlElement) As String Dim sReturn As String = Nothing Dim sCaption As String = sAddInputElementCaption(eleDef) sReturn &= "" sReturn = sSetID(eleDef, sReturn, , SET_NAME_TOO) 'sReturn = sSetID(eleDef, sReturn, , SET_NAME_TOO) Call subSetupInputChangeFlagEvent(eleDef) sReturn = sSetEventHandler(eleDef, sReturn) sReturn = sSetClass(eleDef, sReturn) sReturn = sMakeInputGridRow(eleDef, sCaption, sReturn) Call subProcessInputValidationElements(eleDef) Call subAddInputElementCookieCreation(eleDef) Return sReturn End Function Private Function sProcess_InputCheckbox(ByRef eleDef As XmlElement) As String Dim sReturn As String = Nothing sReturn &= " 0 Then _ sReturn &= " rdCheckboxDefaultValue=""" & sTokenToXsl(eleDef.GetAttribute("DefaultValue"), xslValueType.Attribute, True) & """" sReturn &= " VALUE=""" & sTokenToXsl(eleDef.GetAttribute("CheckedValue"), xslValueType.Attribute, True) & """ " If Not eleDef.HasAttribute("UncheckedValue") _ AndAlso http.Application("rdConstant-rdUncheckedBoxesReturnNothing") = "True" Then eleDef.SetAttribute("UncheckedValue", "rdNotSent") End If sReturn &= " rdUncheckedValue=""" & sTokenToXsl(eleDef.GetAttribute("UncheckedValue"), xslValueType.Attribute, True) & """ " If eleDef.GetAttribute("AjaxDontSubmit") = "True" Then _ sReturn &= " rdAjaxDontSubmit=""True""" 'If eleDef.GetAttribute("Tooltip").Length <> 0 Then _ ' sReturn &= " TITLE=""" & sTokenToXsl(eleDef.GetAttribute("Tooltip"), xslValueType.Attribute, True) & """ " Dim sIdPostfix As String = "" Dim sCurId As String = st.sGetAttribute(eleDef, "ID") If (checkboxNames.ContainsKey(sCurId)) Then checkboxNames(sCurId) += 1 Else checkboxNames.Add(sCurId, 0) End If If (checkboxNames(sCurId) > 0) Then sIdPostfix = checkboxNames(sCurId).ToString() End If Dim sCaption As String = sAddInputElementCaption(eleDef, sIdPostfix) sReturn &= sGetTooltipTitle(eleDef) sReturn &= ">" sReturn = sSetID(eleDef, sReturn, , SET_NAME_TOO, sIdPostfix) Call subSetupInputChangeFlagEvent(eleDef) sReturn = sSetEventHandler(eleDef, sReturn) sReturn = sSetClass(eleDef, sReturn) 'This comes close to making something that will pass a value when the checkbox is not checked. 'But there would need to be a way (in Javascript?) to rename this element to the original element name and remove the 'original element too. #5458 'Dim sUncheckedValue As String = eleDef.GetAttribute("UncheckedValue") 'If sUncheckedValue.Length <> 0 Then ' Dim sUncheckedInput As String ' sUncheckedInput = " 0 Then _ ' sReturn &= " TITLE=""" & sTokenToXsl(eleDef.GetAttribute("Tooltip"), xslValueType.Attribute, True) & """" sReturn &= sGetTooltipTitle(eleDef) If eleDef.GetAttribute("InputSize").Length <> 0 Then _ sReturn &= " SIZE=""" & eleDef.GetAttribute("InputSize") & """" Dim accept As String = eleDef.GetAttribute("accept") If Not String.IsNullOrEmpty(accept) Then sReturn &= " accept='" & accept & "' " End If sReturn &= ">" sReturn = sSetID(eleDef, sReturn, , SET_NAME_TOO) Call subSetupInputChangeFlagEvent(eleDef) sReturn = sSetEventHandler(eleDef, sReturn) sReturn = sSetClass(eleDef, sReturn) sReturn = sSetAction(eleDef, sReturn) sReturn = sMakeInputGridRow(eleDef, sCaption, sReturn) Call subProcessInputValidationElements(eleDef) Return sReturn End Function Private Function sProcess_InputRadioButtons(ByRef eleDef As XmlElement, ByVal sElementID As String) As String Dim sReturn As String = Nothing 'Issue 11210 - remove rdDb from build. Dim eleData As XmlElement = _db9.GetDataLayer(eleDef) If eleDef.GetAttribute("ID").Length = 0 Then _ Throw New Exception("InputRadioButtons elements must have an ID value.") If eleDef.GetAttribute("OptionValueColumn").Length = 0 Then _ Throw New Exception("InputRadioButtons elements must have an OptionValueColumn attribute.") If eleDef.GetAttribute("OptionCaptionColumn").Length = 0 Then _ Throw New Exception("InputRadioButtons elements must have an OptionCaptionColumn attribute.") If bUnderDataRepeater(eleDef) Then _ Throw New Exception("InputRadioButtons elements cannot go under a DataTable.") Dim bLayoutVertical As Boolean = False If eleDef.GetAttribute("RadioButtonDirection") = "Down" Then _ bLayoutVertical = True Dim sCaption As String = sAddInputElementCaption(eleDef) If sCaption.Length <> 0 And bLayoutVertical Then _ sCaption &= "
    " sReturn &= " 0 Then _ sReturn &= " rdRadioButtonValue=""" & sTokenToXsl(eleDef.GetAttribute("DefaultValue"), xslValueType.Attribute, True) & """" sReturn &= ">" 'Build the Options HTML record. It's repeated with the DataLayer. Dim sListRecord As String = " 0 Then sListRecord &= "TITLE=""" & sTokenToXsl("@Data." & eleDef.GetAttribute("OptionTooltipColumn") & "~", xslValueType.Attribute, True) & """ " ElseIf eleDef.GetAttribute("Tooltip").Length <> 0 Then 'sListRecord &= "TITLE=""" & sTokenToXsl(eleDef.GetAttribute("Tooltip"), xslValueType.Attribute, True) & """ " sListRecord &= sGetTooltipTitle(eleDef) End If If eleDef.GetAttribute("AjaxDontSubmit") = "True" Then _ sReturn &= " rdAjaxDontSubmit=""True""" sListRecord &= ">" 'sListRecord &= sTokenToXsl("@Data." & eleDef.GetAttribute("OptionCaptionColumn") & "~", xslValueType.Element, True) Dim eleCaption As XmlElement If eleDef.GetAttribute("CaptionType") = "Image" Then 'The caption is an image. --CaptionType-- is an unsupported attribute. eleCaption = eleDef.OwnerDocument.CreateElement("Image") Else eleCaption = eleDef.OwnerDocument.CreateElement("Label") End If eleCaption.SetAttribute("Caption", "@Data." & eleDef.GetAttribute("OptionCaptionColumn") & "~") If eleDef.HasAttribute("OptionTooltipColumn") Then _ eleCaption.SetAttribute("Tooltip", "@Data." & eleDef.GetAttribute("OptionTooltipColumn") & "~") If eleDef.HasAttribute("Class") Then _ eleCaption.SetAttribute("Class", eleDef.GetAttribute("Class")) eleCaption.SetAttribute("For", sElementID & "_{position()}") sListRecord &= sProcessDefinitionElement(eleCaption) sListRecord &= " " sListRecord = sSetClass(eleDef, sListRecord) Call subSetupInputChangeFlagEvent(eleDef) sListRecord = sSetEventHandler(eleDef, sListRecord) If bLayoutVertical Then _ sListRecord &= "
    " Dim slash As String = rdState.GetSlash() 'Get the Xsl template for a data table. Dim sXsl As String = rdUtility.ReadFile(rdState.sGetPhysicalPath() & slash & "rdTemplate" & slash & "rdDataInputSelect.xsl") sXsl = sXsl.Replace("", sListRecord) sXsl = sXsl.Replace("rdInputOptions", "rdInputRadioOptions") sXsl = sXsl.Replace("rdElementID", "rdRadioButtonGroup" & sElementID) sReturn &= sXsl sReturn &= "
    " eleDef.SetAttribute("ID", "rdRadioButtonGroup" & sElementID) sReturn = sSetID(eleDef, sReturn, , SET_NAME_TOO) sReturn = sReturn.Replace("NAME=""rdRadioButtonGroup", "name=""") 'Setting the name attribute is for 13388. If Not IsNothing(eleDef.SelectSingleNode("ConditionalClass")) _ OrElse http.Application("rdConstant-rdMinimizeSpans") = "False" Then sReturn = "" & sReturn & "" 'Keep the space in so that ConditionalClass works. sReturn = sSetClass(eleDef, sReturn) End If sReturn = sMakeInputGridRow(eleDef, sCaption, sReturn) Call subProcessInputValidationElements(eleDef) Call subAddInputElementCookieCreation(eleDef) Return sReturn End Function Private Function sProcess_InputSelectList(ByRef eleDef As XmlElement, ByVal sElementID As String) As String Dim sReturn As String = Nothing 'Issue 11210 - remove rdDb from build. Dim eleData As XmlElement = _db9.GetDataLayer(eleDef) If eleDef.GetAttribute("ID").Length = 0 Then _ Throw New Exception("InputSelectList elements must have an ID value.") If eleDef.GetAttribute("OptionValueColumn").Length = 0 Then _ Throw New Exception("InputSelectList elements must have an OptionValueColumn attribute.") If eleDef.GetAttribute("OptionCaptionColumn").Length = 0 Then _ Throw New Exception("InputSelectList elements must have an OptionCaptionColumn attribute.") '14142 - InputSelectList: Easy Default values for Multiple Selections Dim sDefaultValue As String = st.sGetAttribute(eleDef, "DefaultValue") 'This may contain token values from a previous request. If so, that gets priority over this DataLayer. If sDefaultValue.Length = 0 Then SetDefaultInputSelectValues(eleDef) End If Dim sCaption As String = sAddInputElementCaption(eleDef) sReturn &= " 0 Then _ sReturn &= " rdSelectValue=""" & sTokenToXsl(eleDef.GetAttribute("DefaultValue").Replace("@Request.", "@RequestXmlEncoded.").Replace("@Local.", "@LocalHtmlEncoded.").Replace("@Session.", "@SessionHtmlEncoded."), xslValueType.Attribute, True) & """" If eleDef.GetAttribute("InputRows").Length <> 0 Then _ sReturn &= " SIZE=""" & sTokenToXsl(eleDef.GetAttribute("InputRows"), xslValueType.Attribute, True) & """" 'sReturn &= " SIZE=""" & eleDef.GetAttribute("InputRows") & """" If eleDef.GetAttribute("MultiSelect") = "True" Then _ sReturn &= " MULTIPLE=""true"" rdInputValueDelimiter= """ & st.InputValueDelimiter & """" ' Added the Delimiter value, picked up by the javascript, #12217. 'Tooltips don't work with SELECTs IE6, so it's not included in the Rules. 'If eleDef.GetAttribute("Tooltip").Length <> 0 Then _ ' sReturn &= " TITLE=""" & sTokenToXsl(eleDef.GetAttribute("Tooltip"), xslValueType.Attribute, True) & """" sReturn &= sGetTooltipTitle(eleDef) Dim sListCaptionsElementId As String = st.sGetAttribute(eleDef, "ListCaptionsElementID") If Not String.IsNullOrEmpty(sListCaptionsElementId) Then Dim inputElement As XmlElement = eleDef.OwnerDocument.DocumentElement.SelectSingleNode(String.Format(".//InputHidden[@ID='{0}']|.//InputText[@ID='{0}']", sListCaptionsElementId)) If IsNothing(inputElement) Then Throw New Exception(String.Format("The referenced element for ListCaptionsElementID attribute is not found, element ID={0}.", sListCaptionsElementId)) End If End If sReturn &= " data-list-captions-element-id=""" & sListCaptionsElementId & """" ''Prototype to return the selected item caption in a hidden form variable. ''sReturn &= " onchange=""" & "alert(this.options[selectedIndex].text);test" & ".value=this.options[selectedIndex].text""" If eleDef.GetAttribute("AjaxDontSubmit") = "True" Then _ sReturn &= " rdAjaxDontSubmit=""True""" sReturn &= ">" & XSL_LINEFEED 'If HttpContext.Current.Session("rdAdHocProduct") = "True" Then ' 'Hack for #4912 so that old Ad Hoc reports don't break. ' If Not IsNothing(eleDef.OwnerDocument.SelectSingleNode("//Note/@Note[contains(., 'AdHocReportBuilder')]")) Then ' If eleDef.GetAttribute("IncludeBlankValue").Length = 0 Then ' 'Look for the DefaultValue in the InputSelectList and get the value from DefaultRequestParams. ' Dim sDefaultValue As String = eleDef.GetAttribute("DefaultValue") ' If sDefaultValue.StartsWith("@Request.") Then ' sDefaultValue = sDefaultValue.Replace("@Request.", "").Replace("~", "") ' Dim atrDefReqParam As XmlAttribute = eleDef.OwnerDocument.SelectSingleNode("//DefaultRequestParams/@" & sDefaultValue) ' If Not IsNothing(atrDefReqParam) Then ' eleDef.SetAttribute("IncludeBlankValue", atrDefReqParam.Value) ' End If ' End If ' End If ' End If 'End If If eleDef.GetAttribute("IncludeBlank") = "True" Then sReturn &= "" 'Added IncludeBlankValue for #4951 and #4912 End If 'Build the Options HTML record. It's repeated with the DataLayer. Dim sListRecord As String = "" & XSL_LINEFEED 'Get the Xsl template for a data table. Dim slash As String = rdState.GetSlash() 'Get the Xsl template for a data table. Dim eleGroupFilter As XmlElement = eleDef.SelectSingleNode("DataLayer/GroupFilter[@Hierarchical='True']") Dim sXsl As String = "" If Not String.IsNullOrEmpty(eleDef.GetAttribute("GroupCaptionColumn")) AndAlso Not IsNothing(eleGroupFilter) Then 'This is for grouped dropdown select lists Dim sGroupClassColumn As String = sTokenToXsl("@Data." & eleDef.GetAttribute("GroupClassColumn") & "~", xslValueType.Attribute, True) Dim sGroupCaptionColumn As String = sTokenToXsl("@Data." & eleDef.GetAttribute("GroupCaptionColumn") & "~", xslValueType.Attribute, True) sXsl = rdUtility.ReadFile(rdState.sGetPhysicalPath() & slash & "rdTemplate" & slash & "rdGroupedDataInputSelect.xsl") Dim sOptGroup As String = "" sXsl = sXsl.Replace("", sOptGroup) sXsl = sXsl.Replace("", "") Else 'Standard dropdown select lists sXsl = rdUtility.ReadFile(rdState.sGetPhysicalPath() & slash & "rdTemplate" & slash & "rdDataInputSelect.xsl") End If sXsl = sXsl.Replace("", sListRecord) sXsl = sXsl.Replace("rdInputOptions", "rdInputSelectOptions") sXsl = sXsl.Replace("rdElementID", sElementID) sReturn &= sXsl sReturn &= "" sReturn = sSetID(eleDef, sReturn, , SET_NAME_TOO) Call subSetupInputChangeFlagEvent(eleDef) sReturn = sSetEventHandler(eleDef, sReturn) sReturn = sSetClass(eleDef, sReturn) sReturn = sSetAction(eleDef, sReturn) sReturn = sMakeInputGridRow(eleDef, sCaption, sReturn) Call subProcessInputValidationElements(eleDef) Call subAddInputElementCookieCreation(eleDef) 'init plugin Dim initScript As String = "var selectList = Y.one(""#" & eleDef.GetAttribute("ID") & """); if (selectList) {selectList.plug(Y.LogiXML.rdInputSelectList);}" subAddYUIInitializer("'rd-inputSelectList-plugin'", initScript) Return sReturn End Function Private Function sProcess_BookmarkOrganizer(ByRef eleDef As XmlElement) As String If dbug.DebuggingEnabled Then _ dbug.AddDebugMessage("BookmarkOrganizer", "Generate Definition") Dim oBookmarkOrganizer As New rdServer.rdBookmarkOrganizer(Me, st, dbug) Dim eleBookmarkOrganizer As XmlElement = oBookmarkOrganizer.sProcess_BookmarkOrganizer(eleDef) If dbug.DebuggingEnabled Then _ dbug.AddDebugMessage("BookmarkOrganizer", "Generated BookmarkOrganizer", "View Definition", eleBookmarkOrganizer) Dim sId As String = oBookmarkOrganizer._sElementId Dim eleTable As XmlElement = oBookmarkOrganizer.eleBookmarkOrganizerDiv eleTable.SetAttribute("ID", sId) Dim eleHiddenExpandedState As XmlElement = xmlDef.CreateElement("InputHidden") eleHiddenExpandedState.SetAttribute("DefaultValue", "@Request." & oBookmarkOrganizer._sElementId & "_rdExpandedCollapsedHistory~") eleHiddenExpandedState.SetAttribute("ID", oBookmarkOrganizer._sElementId & "_rdExpandedCollapsedHistory") Dim sHiddenExpandedState As String = sProcessDefinitionElement(eleHiddenExpandedState) 'init plugin Dim initScript As String = "var BookmarkOrganizer = Y.one(""#" & sId & """); if (BookmarkOrganizer) {LogiXML.BookmarkOrganizer = BookmarkOrganizer.plug(Y.LogiXML.rdBookmarkOrganizer);}" '23824 'Call subAddIncludedScript("rdAjax/rdAjax2.js") 'Call subAddIncludedScript("rdBookmark.js") 'Call subAddIncludedScript("rdActionShowElement.js") 'Call subAddIncludedScript("rdBookmarkOrganizer/rdBookmarkOrganizer.js") Call subAddYUIInitializer("'rd-BookmarkOrganizer-plugin'", initScript) Call subAddIncludedCss("rdBookmarkOrganizer/rdBookmarkOrganizer.css") Return sHiddenExpandedState & sProcessDefinitionElement(eleTable) End Function Private Function sProcess_ActionShowBookmarkSharing(ByRef eleAction As XmlElement, ByRef eleDef As XmlElement) As XmlElement If dbug.DebuggingEnabled Then _ dbug.AddDebugMessage("Action.BookmarkSharing", "Generate Definition") '23824 'Call subAddIncludedScript("rdAjax/rdAjax2.js") 'Call subAddIncludedScript("rdBookmark.js") 'Call subAddIncludedScript("rdActionShowElement.js") mbAddAjaxSupport = True Dim xmlBookmarkSharingActionTemplate As XmlDocument = rdUtility.GetSuperElementTemplate("rdBookmarkOrganizer/rdActionShareBookmarkTemplate.lgx") Call subAddIncludedCss("rdBookmarkOrganizer/rdBookmarkOrganizer.css") 'Is there a template modifier? Call rdUtility.ApplyTemplateModifier(st, dbug, eleAction, xmlBookmarkSharingActionTemplate.DocumentElement) Dim sPopupGuid As Guid = Guid.NewGuid() Dim elePopup As XmlElement = xmlBookmarkSharingActionTemplate.SelectSingleNode(".//PopupPanel") elePopup.SetAttribute("ID", sPopupGuid.ToString) If String.IsNullOrEmpty(eleAction.GetAttribute("PopupCaption")) Then _ Throw New Exception("Action.ShowBookmarkSharing requires the Popup Caption attribute.") Dim sBookmarkCollection As String = HttpContext.Current.Application("rdBookmarkCollectionDefault") If String.IsNullOrEmpty(sBookmarkCollection) Then Throw New Exception("Action.ShowBookmarkSharing must have BookmarkCollectionDefault set in Settings/General element.") elePopup.SetAttribute("Caption", eleAction.GetAttribute("PopupCaption")) Dim eleClosePopupAction As XmlElement = xmlBookmarkSharingActionTemplate.SelectSingleNode(".//Action[@ID='actClosePopup']") eleClosePopupAction.SetAttribute("FeedbackHideElementID", sPopupGuid.ToString) Dim sRefresh As String = "" If Not String.IsNullOrEmpty(HttpContext.Current.Session("rdBookmarkOrganizerID")) Then sRefresh = HttpContext.Current.Session("rdBookmarkOrganizerID") If Not String.IsNullOrEmpty(HttpContext.Current.Session("rdBookmarkOrganizerDataTableID")) Then sRefresh &= "," & HttpContext.Current.Session("rdBookmarkOrganizerDataTableID") End If End If eleClosePopupAction.SetAttribute("ElementID", sRefresh) Dim eleLinkParams As XmlElement = elePopup.SelectSingleNode(".//LinkParams") eleLinkParams.SetAttribute("rdBookmarkCollection", rdBookmark.GetCollectionNameFromAttr(st, eleAction)) eleLinkParams.SetAttribute("rdFolderID", eleAction.GetAttribute("FolderID")) eleLinkParams.SetAttribute("rdBookmarkID", eleAction.GetAttribute("BookmarkID")) eleLinkParams.SetAttribute("rdPopupID", sPopupGuid.ToString) 'Replace the showBookmarkSharing action with the show element from the template Dim eleActionReplace As XmlElement = xmlBookmarkSharingActionTemplate.SelectSingleNode(".//Action") eleActionReplace.SetAttribute("ElementID", sPopupGuid.ToString) eleDef.ReplaceChild(eleDef.OwnerDocument.ImportNode(eleActionReplace, True), eleAction) 'Get the sharing template and build it to match the action, then put it in rdDownload with a guid as the filename and update the report attribute of the target element Dim xmlBookmarkSharingTemplate As XmlDocument = rdUtility.GetSuperElementTemplate("rdBookmarkOrganizer/rdBookmarkShareTemplate.lgx") 'Is there a template modifier? Dim bModifierFound As Boolean = False Call rdUtility.ApplyTemplateModifier(st, dbug, eleAction, xmlBookmarkSharingTemplate.DocumentElement, bModifierFound) '23457 Dim eleReport As XmlElement = eleDef.OwnerDocument.DocumentElement Dim eleTheme As XmlElement = eleReport.SelectSingleNode("StyleSheet[@Theme]") If Not IsNothing(eleTheme) Then Dim eleSharingReport As XmlElement = xmlBookmarkSharingTemplate.SelectSingleNode("//Report") eleSharingReport.InsertBefore(xmlBookmarkSharingTemplate.ImportNode(eleTheme.CloneNode(True), True), eleSharingReport.FirstChild) End If If bModifierFound Then HttpContext.Current.Session.Add("rdBookmarkOrganizerSharing", "True") End If If bModifierFound OrElse String.IsNullOrEmpty(HttpContext.Current.Session("rdBookmarkOrganizerSharing")) Then Dim eleCannotShareWithSelf As XmlElement = xmlBookmarkSharingTemplate.SelectSingleNode("//InputHidden[@ID='rdCannotShareWithSelf']") Dim eleAlreadySharedWith As XmlElement = xmlBookmarkSharingTemplate.SelectSingleNode("//InputHidden[@ID='rdAlreadySharedWith']") Dim eleUserDoesNotExist As XmlElement = xmlBookmarkSharingTemplate.SelectSingleNode("//InputHidden[@ID='rdUserDoesNotExist']") Dim sUserDoesNotExist As String = eleUserDoesNotExist.GetAttribute("DefaultValue").Replace("{UserName}", "{0}") Dim sAlreadySharedWith As String = eleAlreadySharedWith.GetAttribute("DefaultValue").Replace("{UserName}", "{0}") HttpContext.Current.Session.Add("rdAlreadySharedWith", sAlreadySharedWith) HttpContext.Current.Session.Add("rdUserDoesNotExist", sUserDoesNotExist) HttpContext.Current.Session.Add("rdCannotShareWithSelf", eleCannotShareWithSelf.GetAttribute("DefaultValue")) End If Dim eleSharingList As XmlElement = eleAction.SelectSingleNode("SharingList") Dim eleDataLayer As XmlElement = Nothing If Not IsNothing(eleSharingList) Then eleDataLayer = eleSharingList.SelectSingleNode("DataLayer") If Not IsNothing(eleSharingList) AndAlso IsNothing(eleDataLayer) Then Throw New Exception("SharingList element requires a DataLayer.") If Not IsNothing(eleSharingList) AndAlso Not IsNothing(eleDataLayer) Then Dim eleNoSharingListRow As XmlElement = xmlBookmarkSharingTemplate.SelectSingleNode("//Row[@ID='rowNonSharingList']") eleNoSharingListRow.ParentNode.RemoveChild(eleNoSharingListRow) Dim eleTemplateDataTable As XmlElement = xmlBookmarkSharingTemplate.SelectSingleNode(".//DataTable[DataLayer[@ID='DummyDataLayer']]") Dim nlDataTableColumns As XmlNodeList = eleSharingList.SelectNodes("DataTableColumn") For Each eleDataTableColumn As XmlElement In nlDataTableColumns eleTemplateDataTable.AppendChild(eleTemplateDataTable.OwnerDocument.ImportNode(eleDataTableColumn, True)) Next eleLinkParams.SetAttribute("rdSharingCollectionColumn", eleSharingList.GetAttribute("SharingCollectionColumn")) eleLinkParams.SetAttribute("rdGroupIdentifierColumn", eleSharingList.GetAttribute("GroupIdentifierColumn")) Dim eleDataLayerReplace As XmlElement = xmlBookmarkSharingTemplate.SelectSingleNode(".//DataLayer[@ID='DummyDataLayer']") Dim nlCompareFilters As XmlNodeList = eleDataLayerReplace.SelectNodes("CompareFilter") Dim sGroupIdentifierColumn As String = eleSharingList.GetAttribute("GroupIdentifierColumn") Dim sSharingCollectionColumn As String = eleSharingList.GetAttribute("SharingCollectionColumn") If String.IsNullOrEmpty(sSharingCollectionColumn) Then Throw New Exception("The SharingList element's SharingCollectionColumn attribute must be set.") End If If Not IsNothing(nlCompareFilters) Then For Each eleCompFilter As XmlElement In nlCompareFilters eleCompFilter.SetAttribute("DataColumn", eleCompFilter.GetAttribute("DataColumn").Replace("rdSharingCollectionColumn", sSharingCollectionColumn)) eleDataLayer.AppendChild(eleDataLayer.OwnerDocument.ImportNode(eleCompFilter, True)) Next End If eleDataLayerReplace.ParentNode.ReplaceChild(eleDataLayerReplace.OwnerDocument.ImportNode(eleDataLayer, True), eleDataLayerReplace) ' Set the right label value for the shared collection to be read from... Dim eleActionShare As XmlElement = xmlBookmarkSharingTemplate.SelectSingleNode(".//Action[@ID='actShare']") eleActionShare.SetAttribute("SharedWith", eleActionShare.GetAttribute("SharedWith").Replace("rdSharingCollectionColumn", sSharingCollectionColumn)) eleActionShare.SetAttribute("FromInput", "False") If Not String.IsNullOrEmpty(sGroupIdentifierColumn) Then Dim eleUserCondition As XmlElement = xmlBookmarkSharingTemplate.SelectSingleNode(".//DataTable[@ID='dtUserList']/DataLayer/CompareFilter[@ID='compareSharePeople']") If Not IsNothing(eleUserCondition) Then _ eleUserCondition.SetAttribute("DataColumn", sGroupIdentifierColumn) Dim eleGroupCondition As XmlElement = xmlBookmarkSharingTemplate.SelectSingleNode(".//DataTable[@ID='dtUserList']/DataLayer/CompareFilter[@ID='compareShareGroups']") If Not IsNothing(eleGroupCondition) Then _ eleGroupCondition.SetAttribute("DataColumn", sGroupIdentifierColumn) Dim eleUserConditionalClass As XmlElement = xmlBookmarkSharingTemplate.SelectSingleNode(".//DataTableColumn[@ID='colAddUser']/Label/ConditionalClass[@ID='iconAddUser']") If Not IsNothing(eleUserConditionalClass) Then _ eleUserConditionalClass.SetAttribute("Condition", eleUserConditionalClass.GetAttribute("Condition").Replace("rdGroupIdentifierColumn", sGroupIdentifierColumn)) Dim eleGroupConditionalClass As XmlElement = xmlBookmarkSharingTemplate.SelectSingleNode(".//DataTableColumn[@ID='colAddUser']/Label/ConditionalClass[@ID='iconAddGroup']") If Not IsNothing(eleGroupConditionalClass) Then _ eleGroupConditionalClass.SetAttribute("Condition", eleGroupConditionalClass.GetAttribute("Condition").Replace("rdGroupIdentifierColumn", sGroupIdentifierColumn)) Else Dim eleShareTypeFilter As XmlElement = xmlBookmarkSharingTemplate.SelectSingleNode(".//InputSelectList[@ID='lstShareType']") If Not IsNothing(eleShareTypeFilter) Then eleShareTypeFilter.ParentNode.RemoveChild(eleShareTypeFilter) End If End If Else Dim eleSharingListRow As XmlElement = xmlBookmarkSharingTemplate.SelectSingleNode("//Row[@ID='rowSharingList']") eleSharingListRow.ParentNode.RemoveChild(eleSharingListRow) End If Dim eleActionParent As XmlElement = eleDef.ParentNode Dim sReportConfigFilename As String = "" Dim sReportConfigUrl As String = "" Call rdState.MakeTempDownloadFilename("lgx", sReportConfigUrl, sReportConfigFilename) xmlBookmarkSharingTemplate.Save(sReportConfigFilename) Dim eleTarget As XmlElement = elePopup.SelectSingleNode(".//Target") eleTarget.SetAttribute("Report", "../../" & sReportConfigUrl.Replace(".lgx", "")) ' Pass Condition on to Popup Dim sCondition As String = eleDef.GetAttribute("Condition").Trim() If Not String.IsNullOrEmpty(sCondition) Then Dim sPopupCondition As String = elePopup.GetAttribute("Condition").Trim() If Not String.IsNullOrEmpty(sPopupCondition) Then sPopupCondition = String.Format("({0}) && ({1})", sCondition, sPopupCondition) Else sPopupCondition = sCondition End If elePopup.SetAttribute("Condition", sPopupCondition) End If eleActionParent.AppendChild(eleDef.OwnerDocument.ImportNode(elePopup, True)) Return eleDef End Function Private Function sProcess_InputCheckboxList(ByRef eleDef As XmlElement, ByVal sId As String) As String 'Required attributes If sId.Length = 0 Then _ Throw New Exception("InputCheckboxList elements must have an ID value.") Dim eleDataLayer As XmlElement = eleDef.SelectSingleNode("DataLayer") If IsNothing(eleDataLayer) Then Throw New Exception("The InputCheckboxList element must have a DataLayer element.") End If Dim eleCheckboxListBranch As XmlElement = eleDef.SelectSingleNode(".//CheckboxListBranch") Dim sValueColumn As String = eleDef.GetAttribute("OptionValueColumn") If sValueColumn.Length = 0 Then _ Throw New Exception("InputCheckboxList elements must have an OptionValueColumn attribute.") Dim sCaptionColumn As String = eleDef.GetAttribute("OptionCaptionColumn") If sCaptionColumn.Length = 0 Then _ Throw New Exception("InputCheckboxList elements must have an OptionCaptionColumn attribute.") 'Optional attributes Dim sCaption As String = st.sGetAttribute(eleDef, "Caption", "") Dim sChangeElementID As String = st.sGetAttribute(eleDef, "ChangeFlagElementID", "") Dim sUserClass As String = st.sGetAttribute(eleDef, "Class", "") Dim sDefaultValue As String = st.sGetAttribute(eleDef, "DefaultValue", "") Dim sMultiSelect As String = st.sGetAttribute(eleDef, "MultiSelect", "True") Dim sDropdown As String = st.sGetAttribute(eleDef, "CheckboxListDropdown", "False").Trim() Dim isDropdown As Boolean = False If Not String.IsNullOrEmpty(sDropdown) AndAlso sDropdown = "True" Then isDropdown = True End If Dim sColumns As String = st.sGetAttribute(eleDef, "ColumnCount", "1") Dim nColumns As Integer = 1 If Not Integer.TryParse(sColumns, nColumns) OrElse nColumns <= 0 Then nColumns = 1 End If If nColumns > 100 Then nColumns = 100 End If '20260 If Not IsNothing(eleCheckboxListBranch) Then nColumns = 1 End If Dim sWidth As String = st.sGetAttribute(eleDef, "Width", "") Dim sWidthScale As String = st.sGetAttribute(eleDef, "WidthScale", "px") Dim sHeight As String = st.sGetAttribute(eleDef, "Height", "") Dim sHeightScale As String = st.sGetAttribute(eleDef, "HeightScale", "px") Dim sTooltip As String = st.sGetAttribute(eleDef, "Tooltip", "") Dim sTooltipColumn As String = st.sGetAttribute(eleDef, "OptionTooltipColumn", "") Dim sCheckAllCaption As String = st.sGetAttribute(eleDef, "CheckAllCaption", "Check all") 'Show by default? Dim sDropdownNoneSelectedCaption As String = st.sGetAttribute(eleDef, "DropdownNoneSelectedCaption", "Select options") Dim sDropdownSelectedCaption As String = st.sGetAttribute(eleDef, "DropdownSelectedCaption", "# selected") Dim sDropdownButtonClass As String = st.sGetAttribute(eleDef, "DropdownButtonClass", "") Dim isMultiColumn As String = IIf(nColumns > 1, "True", "False") Dim sListCaptionsElementId As String = st.sGetAttribute(eleDef, "ListCaptionsElementID") 'Any validation? '... If Not String.IsNullOrEmpty(sListCaptionsElementId) AndAlso Not (isAjaxRequest) Then '26362 Dim inputElement As XmlElement = eleDef.OwnerDocument.DocumentElement.SelectSingleNode(String.Format(".//InputHidden[@ID='{0}']|.//InputText[@ID='{0}']", sListCaptionsElementId)) If IsNothing(inputElement) Then Throw New Exception(String.Format("The referenced element for ListCaptionsElementID attribute is not found, element ID={0}.", sListCaptionsElementId)) End If End If If sDefaultValue.Length = 0 Then SetDefaultInputSelectValues(eleDef) End If sCaption = sAddInputElementCaption(eleDef) 'Style widht Dim sStyleWidth As String = "" Dim nWidth As Integer Integer.TryParse(sWidth, nWidth) If (nWidth > 0) Then sStyleWidth &= "width:" & nWidth.ToString() & sWidthScale & ";" End If 'Style height Dim sStyleHeight As String = "" Dim sStyleDropdownHeight As String = "" Dim nHeight As Integer Integer.TryParse(sHeight, nHeight) If (nHeight > 0) Then sStyleHeight &= "height:" & nHeight.ToString() & sHeightScale & ";" sStyleDropdownHeight = "max-height:" & nHeight.ToString() & sHeightScale & ";" Else sStyleDropdownHeight = "max-height:350px;" End If 'CSS class Dim sCssClass As String = "rd-checkboxlist " If isDropdown Then sCssClass &= "rd-checkboxlist-popup " End If If sUserClass.Length > 0 Then sCssClass &= sUserClass End If 'Actions Dim sActions As String = "" Call subSetupInputChangeFlagEvent(eleDef) Dim sFakeElement As String = "" sFakeElement = sSetEventHandler(eleDef, sFakeElement) sFakeElement = sSetAction(eleDef, sFakeElement) If sFakeElement.Length > "".Length Then Dim xDoc As XmlDocument = New XmlDocument() xDoc.LoadXml(sFakeElement) For Each attr As XmlAttribute In xDoc.DocumentElement.Attributes sActions &= "data-action-" & attr.Name & "=""" & rdUtility.HtmlEncode4(attr.Value) & """ " Next End If 'Add a hidden element to save the page number if the page is refreshed for some other reason besides paging. #8295. Dim eleHiddenExpandedState As XmlElement = xmlDef.CreateElement("InputHidden") eleHiddenExpandedState.SetAttribute("DefaultValue", "@Request." & sId & "_rdExpandedCollapsedHistory~") eleHiddenExpandedState.SetAttribute("ID", sId & "_rdExpandedCollapsedHistory") Dim sHiddenExpandedState As String = sProcessDefinitionElement(eleHiddenExpandedState) 'Save the value/selected value to a hidden input. Dim elechkListHiddenOne As XmlElement = xmlDef.CreateElement("InputHidden") If Not String.IsNullOrEmpty(eleDef.GetAttribute("DefaultValue")) Then elechkListHiddenOne.SetAttribute("DefaultValue", eleDef.GetAttribute("DefaultValue")) End If elechkListHiddenOne.SetAttribute("ID", "rdICL-" & eleDef.GetAttribute("ID")) Dim sChkListHidden As String = sProcessDefinitionElement(elechkListHiddenOne) Dim chkList As StringBuilder = New StringBuilder() chkList.Append(sChkListHidden) chkList.Append(sHiddenExpandedState) chkList.Append("") chkList.Append("
    0 Then _ chkList.Append(" data-rd-checked=""" & sTokenToXsl(eleDef.GetAttribute("DefaultValue").Replace("@Request.", "@RequestXmlEncoded.").Replace("@Local.", "@LocalHtmlEncoded.").Replace("@Session.", "@SessionHtmlEncoded."), xslValueType.Attribute, True) & """ ") chkList.Append("data-dropdown=""" & IIf(isDropdown = True, "true", "false") & """ ") chkList.Append("data-noneselected-caption=""" & sDropdownNoneSelectedCaption & """ ") chkList.Append("data-selected-caption=""" & sDropdownSelectedCaption & """ ") chkList.Append("data-columns=""" & nColumns.ToString() & """ ") If (sChangeElementID.Trim().Length > 0) Then chkList.Append("data-changeelementid=""" & sChangeElementID & """ ") End If chkList.Append("rdInputValueDelimiter=""" & st.InputValueDelimiter & """ ") chkList.Append("rdPopupPanel=""True""") If Not isDropdown AndAlso sTooltip.Length > 0 Then chkList.Append(String.Format("title=""{0}"" ", sTooltip)) End If chkList.Append(" data-list-captions-element-id=""" & sListCaptionsElementId & """ ") chkList.Append(">") chkList.Append("
      ") If sCheckAllCaption.Length > 0 AndAlso sCheckAllCaption.ToLower() <> "none" AndAlso sMultiSelect <> "False" Then '20269 chkList.Append(String.Format("
    • ", sCheckAllCaption)) End If 'xls start 'Hierarchical checkbox list 20035 If Not IsNothing(eleCheckboxListBranch) Then Dim nlGroupFilterList As XmlNodeList = eleDataLayer.SelectNodes(".//GroupFilter") Dim nlCheckboxBranchList As XmlNodeList = eleDef.SelectNodes(".//CheckboxListBranch") '20168 If nlCheckboxBranchList.Count <> nlGroupFilterList.Count Then _ Throw New Exception("You must have an equal number of CheckboxListBranches and DataLayer Group Filters.") Dim nLevel As Integer = 1 Dim sToggleImage As String = "" Dim sIndentString As String = "{*amp;*}#160;{*amp;*}#160;{*amp;*}#160;{*amp;*}#160;{*amp;*}#160;{*amp;*}#160;{*amp;*}#160;{*amp;*}#160;" Dim sPositionXSL As String = "" For Each eleGroup As XmlElement In eleDataLayer.SelectNodes(".//GroupFilter") Dim sGroupCaptionColumn As String = eleCheckboxListBranch.GetAttribute("OptionCaptionColumn") '20171 'Group Start chkList.AppendLine("") '20235 If nLevel = 1 Then chkList.AppendLine(" ") Else chkList.AppendLine(" ") End If chkList.Append("") chkList.Append("
    • ") chkList.Append(String.Format("
    • ") nLevel += 1 eleCheckboxListBranch = eleCheckboxListBranch.SelectSingleNode("CheckboxListBranch") Next chkList.AppendLine("") 'chkList.AppendLine(" ") chkList.AppendLine(" ") chkList.Append("
    • ") chkList.Append(String.Format("
    • ") chkList.AppendLine("
      ") 'xls end For Each eleGroup As XmlElement In eleDataLayer.SelectNodes(".//GroupFilter") 'Group End chkList.AppendLine("
      ") Next Else 'non hierarchical 'xls start chkList.AppendLine("") chkList.AppendLine(" ") chkList.Append("
    • ") chkList.Append(String.Format("
    • ", sTokenToXsl("@Data." & sCaptionColumn & "~", xslValueType.Element, True))) chkList.AppendLine("
      ") 'xls end End If chkList.Append("
    ") chkList.Append("
    ") Dim sReturn As String = chkList.ToString() sReturn = sSetClass(eleDef, sReturn) Call subProcessInputValidationElements(eleDef) Call subAddInputElementCookieCreation(eleDef) If isDropdown Then Dim sDropDownCss As String = "rd-checkboxlist-dropdown " If sDropdownButtonClass.Length > 0 Then sDropDownCss += sDropdownButtonClass End If Dim sDropDownStyle As String = "" If sStyleWidth.Length > 0 Then sDropDownStyle = String.Format("style=""{0}""", sStyleWidth) End If Dim dropDown As StringBuilder = New StringBuilder() dropDown.Append(String.Format("") dropDown.Append(sReturn) sReturn = dropDown.ToString() End If 'CSS? subAddIncludedCss("rdInputCheckboxList/rdInputCheckboxList.css") 'init plugin Dim initScript As String = "var chkList = Y.one(""#" & sId & """); if (chkList) {chkList.plug(Y.LogiXML.rdInputCheckList);}" subAddYUIInitializer("'rd-inputCheckList-plugin'", initScript) sReturn = sMakeInputGridRow(eleDef, sCaption, sReturn) Return sReturn End Function Private Function sProcess_InputColorPicker(ByRef eleDef As XmlElement) As String Call subAddYUIInitializerOnce("'rdInputColorPicker'", "Y.LogiXML.rdInputColorPicker.createElements();") Dim eleDirectAction As XmlElement = eleDef.SelectSingleNode("Action") If Not IsNothing(eleDirectAction) Then Dim eleEventHandler As XmlElement = eleDef.OwnerDocument.CreateElement("EventHandler") eleEventHandler.AppendChild(eleDirectAction) eleDef.AppendChild(eleEventHandler) eleEventHandler.SetAttribute("DhtmlEvent", "onchange") End If Dim id As String = st.sGetAttribute(eleDef, "ID") If id = "" Then Throw New Exception("InputColorPicker must have an ID") End If '26424 Dim uniqueId As String = rdUtility.GetUniqueId(colorPickerIds, id, "colorpicker") If uniqueId <> id Then id = uniqueId eleDef.SetAttribute("ID", id) End If Dim sDefaultColor As String = st.sGetAttribute(eleDef, "DefaultValue") 'st.sGetRequestVar(id) sDefaultColor = st.sReplaceTokens(sDefaultColor) Dim colorInRequest As String = st.sGetRequestVar(id) If String.IsNullOrEmpty(sDefaultColor) Then sDefaultColor = colorInRequest End If sDefaultColor = rdHighCharts.GetRGBAColor(sDefaultColor) Dim nCapacity As Integer = st.sGetAttribute(eleDef, "RowCapacity", "10") 'read definition from template Dim templateDoc As XmlDocument = rdUtility.GetSuperElementTemplate(String.Format("rdInputColorPicker{0}rdInputColorPickerTemplate.lgx", rdState.GetSlash()), True) templateDoc.InnerXml = templateDoc.InnerXml.Replace("rdElementID", id) Dim eleColorPickerWrapperInTemplate As XmlElement = templateDoc.SelectSingleNode(String.Format("//Division[@ID='ColorPickerWraper_{0}']", id)) 'import templete into current report document Dim eleColorPickerWrapper As XmlElement = eleDef.OwnerDocument.ImportNode(eleColorPickerWrapperInTemplate, True) Dim eleColorTextBox As XmlElement = eleColorPickerWrapper.SelectSingleNode(".//InputText") eleColorTextBox.SetAttribute("SaveInCookie", st.sGetAttribute(eleDef, "SaveInCookie")) eleColorTextBox.SetAttribute("SaveInLocalStorage", st.sGetAttribute(eleDef, "SaveInLocalStorage")) Dim eleColorPickerPopup As XmlElement = eleColorPickerWrapper.SelectSingleNode(String.Format("//PopupPanel[@ID='ppColors_{0}']", id)) Dim sPopupCaption As String = st.sGetAttribute(eleDef, "ColorPickerCaption", "Color Picker") If Not String.IsNullOrEmpty(sPopupCaption) Then eleColorPickerPopup.SetAttribute("Draggable", "True") End If eleColorPickerPopup.SetAttribute("CaptionClass", st.sGetAttribute(eleDef, "CaptionClass", "rdPopupPanelTitleCaption")) eleColorPickerPopup.SetAttribute("Caption", sPopupCaption) Dim eleColorIndicator As XmlElement = eleColorPickerWrapper.SelectSingleNode(String.Format("//Rectangle[@ID='rectColorIndicator_{0}']", id)) eleColorPickerWrapperInTemplate.SetAttribute("Caption", st.sGetAttribute(eleDef, "Caption")) Dim sCaption As String = sAddInputElementCaption(eleColorPickerWrapperInTemplate) eleColorIndicator.SetAttribute("BackgroundColor", sDefaultColor) eleColorTextBox.SetAttribute("DefaultValue", sDefaultColor) eleColorTextBox.SetAttribute("InputSize", st.sGetAttribute(eleDef, "InputSize", "0")) eleColorTextBox.SetAttribute("Placeholder", st.sGetAttribute(eleDef, "Placeholder")) eleColorTextBox.SetAttribute("CaptionClass", st.sGetAttribute(eleDef, "CaptionClass")) eleColorTextBox.SetAttribute("ChangeFlagElementID", st.sGetAttribute(eleDef, "ChangeFlagElementID")) Dim bAllowTransparency As Boolean = st.sGetAttribute(eleDef, "AllowTransparency", "False") subAddInputElementCookieCreation(eleColorTextBox) Dim eleImgButton As XmlElement = eleColorPickerWrapper.SelectSingleNode(String.Format("//Image[@ID='colorPicker_{0}']", id)) If eleDef.HasAttribute("Tooltip") Then _ eleImgButton.SetAttribute("Tooltip", eleDef.GetAttribute("Tooltip")) If eleDef.HasAttribute("AltText") Then _ eleImgButton.SetAttribute("AltText", eleDef.GetAttribute("AltText")) eleDef.AppendChild(eleColorPickerWrapper) Dim sOnchangeEventHandlerText As String = "" Dim nlEventHandlers As XmlNodeList = eleDef.SelectNodes("EventHandler") If nlEventHandlers.Count > 0 Then Dim rxAction As Regex = New Regex("(?<=javascript:)([^""]+)") For Each eleEventHandler As XmlElement In nlEventHandlers Dim eleWrapper As XmlElement = eleDef.OwnerDocument.CreateElement("Division") eleWrapper.AppendChild(eleEventHandler) Dim sEventHtml As String = sSetEventHandler(eleWrapper, "") Dim sEvent As String = rxAction.Match(sEventHtml).Value If Not String.IsNullOrEmpty(sEvent) Then sEvent = st.sReplaceTokens(HttpContext.Current.Server.HtmlDecode(sEvent)) If st.sGetAttribute(eleEventHandler, "DhtmlEvent").ToLower() = "onchange" Then sOnchangeEventHandlerText = sOnchangeEventHandlerText + ";" + rdUtility.HtmlEncode4(sEvent) ElseIf st.sGetAttribute(eleEventHandler, "DhtmlEvent").ToLower() = "onclick" Then Dim eleImageAction As XmlElement = eleImgButton.SelectSingleNode("EventHandler/Action") If Not IsNothing(eleImageAction) Then eleImageAction.SetAttribute("Javascript", eleImageAction.GetAttribute("Javascript") + ";" + sOnchangeEventHandlerText) Else eleImgButton.AppendChild(eleEventHandler) End If End If End If Next End If Dim sReturn As String = sProcessDefinitionElement(eleColorPickerWrapper) Dim imgOpenTag As Integer = sReturn.LastIndexOf("") sReturn = sReturn.Insert(imgCloseTag + 6, "
    ") sReturn = sReturn.Insert(imgOpenTag, " ") Else imgCloseTag = sReturn.LastIndexOf("") sReturn = sReturn.Remove(imgOpenTag, imgCloseTag - imgOpenTag + 6) End If Dim sWrapper As String = String.Format("
    ", id, st.sGetAttribute(eleDef, "Colors"), nCapacity, bAllowTransparency, sOnchangeEventHandlerText) sWrapper = sSetClass(eleDef, sWrapper) sWrapper = sWrapper.Replace(">", " style='display: inline-block;'>") sReturn = String.Format("{0}{1}
    ", sWrapper, sReturn) sReturn = sMakeInputGridRow(eleDef, sCaption, sReturn) Return sReturn End Function Private Function sProcess_ZoomChart(ByRef eleDef As XmlElement) As String Dim zoomChart As rdZoomChart = New rdZoomChart(st, dbug, Me) eleDef = zoomChart.Build(eleDef) Dim sReturn As String = sProcessDefinitionElement(eleDef) Return sReturn End Function Private Function sProcess_Thinkspace(ByRef eleDef As XmlElement, sID As String) As String Dim discovery As New Discovery(Me, xmlSettings, st, dbug) Call discovery.Process_Discovery(eleDef) sbHead.Append(discovery.scriptMain) Return discovery.htmlMain End Function Private Function sProcess_NgpVisualization(ByRef eleDef As XmlElement, sID As String) As String Dim ngpViz As New NgpVisualization(Me, xmlSettings, st, dbug) Call ngpViz.Process_NgpVisualization(eleDef) sbHead.Append(ngpViz.scriptMain) Return ngpViz.htmlMain End Function Private Sub addRdIdeIDSpan(ByRef sReturn As String, ByRef sElementRdIdeID As String) If Not String.IsNullOrEmpty(sElementRdIdeID) _ AndAlso Not String.IsNullOrEmpty(sReturn) Then sReturn = String.Format(" {1} ", sElementRdIdeID, sReturn) End If End Sub Private Sub SetDefaultInputSelectValues(ByRef eleDef As XmlElement) Dim eleDefaultValues As XmlElement = eleDef.SelectSingleNode("DefaultValues") If Not IsNothing(eleDefaultValues) Then Dim sColumnName As String = st.sReplaceTokens(st.sGetAttribute(eleDefaultValues, "DataColumn")) If sColumnName.Length = 0 Then _ Throw New Exception("The DefaultValues element must have a DataColumn attribute.") Dim eleDlDefaultValues As XmlElement = eleDefaultValues.SelectSingleNode("DataLayer") If IsNothing(eleDlDefaultValues) Then _ Throw New Exception("The DefaultValues element must have a DataLayer element.") 'Don't cache this DataLayer in the XSL, otherwise different users will get the same data. mbDontCacheXsl = True 'Add AggregateColumn to DataLayer (concat values) Dim eleConcatAggregate As XmlElement = eleDlDefaultValues.AppendChild(eleDlDefaultValues.OwnerDocument.CreateElement("AggregateColumn")) eleConcatAggregate.SetAttribute("ID", "rdSelectedValues_" & eleDef.GetAttribute("ID")) eleConcatAggregate.SetAttribute("AggregateColumn", sColumnName) eleConcatAggregate.SetAttribute("AggregateFunction", "Concat") eleConcatAggregate.SetAttribute("ConcatSeparator", st.InputValueDelimiter) 'Run datalayer Dim xData As XmlDocument = _db9.xmlGetDataDocument(eleDlDefaultValues, ".") '16336 'Setup default value Dim xDefaultParams As XmlElement = eleDef.OwnerDocument.CreateElement("DefaultRequestParams") xDefaultParams.SetAttribute(eleDef.GetAttribute("ID"), st.sGetAttribute(xData.DocumentElement, "rdSelectedValues_" & eleDef.GetAttribute("ID"))) st.subGetDefaultRequestParams(xDefaultParams) eleDef.SetAttribute("DefaultValue", "@Request." + eleDef.GetAttribute("ID") + "~") 'Remove DefaultValues element from InpetSelectList eleDef.RemoveChild(eleDefaultValues) End If End Sub Private Function sProcess_EmailReport(ByVal eleEmailReport As XmlElement, ByRef eleChildAction As XmlElement, ByVal sHtmlElement As String) As String 'Get the template. Dim xmlTemplate As XmlDocument = rdUtility.GetSuperElementTemplate("rdEmail/rdEmailReportTemplate.lgx") 'Is there a template modifier? Call rdUtility.ApplyTemplateModifier(st, dbug, eleEmailReport, xmlTemplate.DocumentElement) 'Is there a theme? Call rdUtility.ApplyDefinitionModifierFiles(st, dbug, eleChildAction.OwnerDocument, xmlTemplate.DocumentElement) 'Remove the Action element, it will replaced by a ShowElement, then re-added below. Dim bUnderDataTable As Boolean = bUnderDataRepeater(eleEmailReport) 'This is needed below. Dim eleParent As XmlElement = eleEmailReport.ParentNode eleParent.RemoveChild(eleEmailReport) 'Add a ShowElement to show the popup panel. Dim eleShowElement As XmlElement = eleChildAction.OwnerDocument.ImportNode(xmlTemplate.DocumentElement.SelectSingleNode("Action"), True) eleParent.AppendChild(eleShowElement) 'Add the popup panel. Dim elePopup As XmlElement = eleChildAction.OwnerDocument.ImportNode(xmlTemplate.DocumentElement.SelectSingleNode("PopupPanel"), True) Dim elePopupParent As XmlElement = eleParent.ParentNode If elePopupParent.Name = "Column" Then 'Go to the parent of the Rows element. For why, see 12505. elePopupParent = elePopupParent.ParentNode.ParentNode.ParentNode ElseIf eleParent.Name = "PopupOption" Then 'Go up one more level so the popup panel is processed. elePopupParent = elePopupParent.ParentNode.ParentNode ElseIf eleParent.Name = "EventHandler" Then 'Go up one more level so the popup panel is processed. elePopupParent = elePopupParent.ParentNode End If elePopupParent.AppendChild(elePopup) ''''Copy the original Action element to the popup panel's "Send" button. '''Dim eleSend As XmlElement = elePopup.SelectSingleNode("*//Label[@ID='lblSend_rdActionID']") '''eleSend.AppendChild(eleChildAction.CloneNode(True)) Dim ele As XmlElement 'ID Dim sId As String = eleEmailReport.GetAttribute("ID") If sId.Length = 0 Then _ Throw New Exception("EmailReport elements must have an ID value.") eleShowElement.SetAttribute("ElementID", "rdPopupEmail_" & sId) 'Caption Dim sPopupCaption As String = eleEmailReport.GetAttribute("Caption") If sPopupCaption.Length <> 0 Then _ elePopup.SetAttribute("Caption", sPopupCaption) 'From If eleEmailReport.GetAttribute("FromEmailAddress").Length <> 0 Then ele = elePopup.SelectSingleNode(".//InputEmail[@ID='rdFrom_rdActionID']") If Not IsNothing(ele) Then _ ele.SetAttribute("DefaultValue", eleEmailReport.GetAttribute("FromEmailAddress")) End If 'To If eleEmailReport.GetAttribute("ToEmailAddress").Length <> 0 Then ele = elePopup.SelectSingleNode(".//InputEmail[@ID='rdTo_rdActionID']") If Not IsNothing(ele) Then _ ele.SetAttribute("DefaultValue", eleEmailReport.GetAttribute("ToEmailAddress")) End If 'Cc If eleEmailReport.GetAttribute("CcEmailAddress").Length <> 0 Then ele = elePopup.SelectSingleNode(".//InputEmail[@ID='rdCc_rdActionID']") If Not IsNothing(ele) Then _ ele.SetAttribute("DefaultValue", eleEmailReport.GetAttribute("CcEmailAddress")) End If 'Bcc If eleEmailReport.GetAttribute("BccEmailAddress").Length <> 0 Then ele = elePopup.SelectSingleNode(".//InputEmail[@ID='rdBcc_rdActionID']") If Not IsNothing(ele) Then _ ele.SetAttribute("DefaultValue", eleEmailReport.GetAttribute("BccEmailAddress")) End If 'Subject If eleEmailReport.GetAttribute("EmailSubject").Length <> 0 Then ele = elePopup.SelectSingleNode(".//InputText[@ID='rdSubject_rdActionID']") If Not IsNothing(ele) Then _ ele.SetAttribute("DefaultValue", eleEmailReport.GetAttribute("EmailSubject")) End If 'Body If eleEmailReport.GetAttribute("EmailBody").Length <> 0 Then ele = elePopup.SelectSingleNode(".//InputTextArea[@ID='rdBody_rdActionID']") If Not IsNothing(ele) Then _ ele.SetAttribute("DefaultValue", eleEmailReport.GetAttribute("EmailBody")) End If 'ConnectionID. Dim sConnectionID As String = st.sGetAttribute(eleEmailReport, "ConnectionID") Dim xmlSettings As XmlDocument = New XmlDocument() xmlSettings.LoadXml(st.sGetDefinition("_Settings")) Dim eleMailConn As XmlElement If sConnectionID.Length <> 0 Then eleMailConn = xmlSettings.SelectSingleNode("//Setting/Connections/Connection[@ID=""" & sConnectionID & """]") Else 'Grab the first connection. eleMailConn = xmlSettings.SelectSingleNode("//Setting/Connections/Connection[@Type='Smtp']") End If If IsNothing(eleMailConn) Then Err.Raise(vbObjectError, , "The SMTP (mail) connection element not found in the Settings' Connections.") End If http.Session("rdEmailReportConnId") = sConnectionID Dim eleTarget As XmlElement = eleChildAction.SelectSingleNode("Target") If IsNothing(eleTarget) Then _ Throw New Exception("Action element is missing a child Target element.") Dim eleLinkParams As XmlElement = elePopup.AppendChild(elePopup.OwnerDocument.CreateElement("Division")) eleLinkParams.SetAttribute("ID", "rdLinkParams_rdActionID") eleLinkParams.SetAttribute("ShowModes", "None") Dim nlLinkParams As XmlNodeList = eleChildAction.SelectNodes("LinkParams/@*") If nlLinkParams.Count <> 0 Then For Each atrLinkParam As XmlAttribute In nlLinkParams ele = eleLinkParams.AppendChild(elePopup.OwnerDocument.CreateElement("Label")) ele.SetAttribute("ID", atrLinkParam.Name) ele.SetAttribute("Caption", atrLinkParam.Value) Next End If Dim s As String ''Report Definition. s = eleTarget.GetAttribute("Report") If eleTarget.GetAttribute("Type") = "Template" Then _ s = eleTarget.GetAttribute("TemplateDefinition") If s = "" Or s = "CurrentReport" Then s = msRequestedPage ele = eleLinkParams.AppendChild(elePopup.OwnerDocument.CreateElement("Label")) ele.SetAttribute("ID", "rdReportID") ele.SetAttribute("Caption", s) 'Report Export Format. s = eleTarget.GetAttribute("Type") ele = eleLinkParams.AppendChild(elePopup.OwnerDocument.CreateElement("Label")) ele.SetAttribute("ID", "rdFormat") ele.SetAttribute("Caption", s) 'ExportFilename s = eleTarget.GetAttribute("ExportFilename") If s.Length = 0 Then '18436 If eleTarget.GetAttribute("Type") = "Template" Then 'Require the filename Throw New Exception("Action.EmailReport for Templates requires a Target element with an ExportFilename. Example: ExportFilename=""@Function.GUID~.xls"".") End If Try s = HttpContext.Current.Session.SessionID & "-" 'Sometimes, on the first request, the SessionID is not set. Seems to be a .NET bug. Catch : End Try If s.Length > 0 Then s = "rdDL" & s & System.Guid.NewGuid().ToString("N") & "." Else 'We can let the inability of getting session id to break filename creation. s = "@Function.FUID~." End If Select Case eleTarget.GetAttribute("Type") Case "NativeExcel" s &= IIf(eleTarget.GetAttribute("ExcelOutputFormat") = "Excel2007", "xlsx", "xls") Case "NativeWord" s &= "doc" Case Else 'PDF, CSV. s &= eleTarget.GetAttribute("Type").ToLower End Select 'Select Case eleTarget.GetAttribute("Type") ' Case "NativeExcel" ' s &= "@Function.FUID~." & IIf(eleTarget.GetAttribute("ExcelOutputFormat") = "Excel2007", "xlsx", "xls") ' Case "NativeWord" ' s &= "@Function.FUID~." & "doc" ' Case "Template" ' If s.Length = 0 Then ' 'Require the filename ' Throw New Exception("Action.EmailReport for Templates requires a Target element with an ExportFilename. Example: ExportFilename=""@Function.GUID~.xls"".") ' End If ' Case Else 'PDF, CSV. ' s &= "@Function.FUID~." & eleTarget.GetAttribute("Type").ToLower 'End Select End If ele = eleLinkParams.AppendChild(elePopup.OwnerDocument.CreateElement("Label")) ele.SetAttribute("ID", "rdExportFilename") ele.SetAttribute("Caption", s) 'ExportDataTableID s = eleTarget.GetAttribute("ExportDataTableID") If s.Length <> 0 Then ele = eleLinkParams.AppendChild(elePopup.OwnerDocument.CreateElement("Label")) ele.SetAttribute("ID", "rdExportTableID") ele.SetAttribute("Caption", s) End If 'ReportShowModes s = eleTarget.GetAttribute("ReportShowModes") If s.Length <> 0 Then ele = eleLinkParams.AppendChild(elePopup.OwnerDocument.CreateElement("Label")) ele.SetAttribute("ID", "rdShowModes") ele.SetAttribute("Caption", s) End If If eleTarget.GetAttribute("Type") = "NativeExcel" Then 'ExcelOutputFormat s = eleTarget.GetAttribute("ExcelOutputFormat") If s.Length <> 0 Then ele = eleLinkParams.AppendChild(elePopup.OwnerDocument.CreateElement("Label")) ele.SetAttribute("ID", "rdExcelFormat") ele.SetAttribute("Caption", s) End If 'ExcelPaperSize s = eleTarget.GetAttribute("ExcelPaperSize") If s.Length <> 0 Then ele = eleLinkParams.AppendChild(elePopup.OwnerDocument.CreateElement("Label")) ele.SetAttribute("ID", "rdExcelPaperSize") ele.SetAttribute("Caption", s) End If 'ExcelGridLines s = eleTarget.GetAttribute("ShowGridlines") If s.Length <> 0 Then ele = eleLinkParams.AppendChild(elePopup.OwnerDocument.CreateElement("Label")) ele.SetAttribute("ID", "rdExcelGridlines") ele.SetAttribute("Caption", s) End If End If If eleTarget.GetAttribute("Type") = "CSV" Then 'CsvFieldDelimiter s = eleTarget.GetAttribute("CsvFieldDelimiter") If s.Length <> 0 Then ele = eleLinkParams.AppendChild(elePopup.OwnerDocument.CreateElement("Label")) ele.SetAttribute("ID", "rdCsvFieldDelimiter") ele.SetAttribute("Caption", s) End If 'CsvRowDelimiter s = eleTarget.GetAttribute("CsvRowDelimiter") If s.Length <> 0 Then ele = eleLinkParams.AppendChild(elePopup.OwnerDocument.CreateElement("Label")) ele.SetAttribute("ID", "rdCsvRowDelimiter") ele.SetAttribute("Caption", s) End If 'CsvStringColumns s = eleTarget.GetAttribute("CsvStringColumns") If s.Length <> 0 Then ele = eleLinkParams.AppendChild(elePopup.OwnerDocument.CreateElement("Label")) ele.SetAttribute("ID", "rdCsvStringColumns") ele.SetAttribute("Caption", s) End If End If If Not bUnderDataTable Then Dim eleSendNowAction As XmlElement = elePopup.SelectSingleNode(".//Action[@ID='rdActionSendEmail']") If Not IsNothing(eleSendNowAction) Then 'There is no RowNumber, remove it from the script for this Action.JavaScript element. eleSendNowAction.SetAttribute("Javascript", eleSendNowAction.GetAttribute("Javascript").Replace("@Function.RowNumber~", "")) End If End If If eleTarget.GetAttribute("Type") = "Report" Then 'The email message will contain the report, so don't allow adding message text. ele = elePopup.SelectSingleNode(".//Row[@ID='rowMessage']") If Not IsNothing(ele) Then _ ele.ParentNode.RemoveChild(ele) End If Call rdUtility.ReplaceAttributeValues(elePopup, "rdActionID", sId, True) '23824 'Call subAddIncludedScript("rdEmail/rdEmailReport.js") mbAddAjaxSupport = True If dbug.DebuggingEnabled Then _ dbug.AddDebugMessage("EmailReport", "Generated", "View Definition", elePopup) plugin.CallPlugins_GeneratedElement(eleParent, eleParent) '14254 - Call Plugins from more places - ElementPluginCall Return sSetAction(eleParent, sHtmlElement) End Function Sub subSetupInputChangeFlagEvent(ByVal eleDef As XmlElement) Dim sChangeFlagID As String = eleDef.GetAttribute("ChangeFlagElementID") If sChangeFlagID.Length <> 0 Then Dim sRowNr As String = "" If bUnderDataRepeater(eleDef) Then sRowNr = "_Row@Function.RowNumber~" End If Dim eleEventHandler As XmlElement = eleDef.OwnerDocument.CreateElement("EventHandler") eleEventHandler.SetAttribute("DhtmlEvent", "onchange") eleDef.AppendChild(eleEventHandler) Dim eleAction As XmlElement = eleDef.OwnerDocument.CreateElement("Action") eleAction.SetAttribute("Type", "Link") eleEventHandler.AppendChild(eleAction) Dim eleTarget As XmlElement = eleDef.OwnerDocument.CreateElement("Target") eleTarget.SetAttribute("Type", "Link") eleTarget.SetAttribute("Link", "javascript:rdChangeFlag('" & sChangeFlagID & sRowNr & "','" & sChangeFlagID & sRowNr & "')") eleAction.AppendChild(eleTarget) '23824 'Call subAddIncludedScript("rdInputValidation.js") End If End Sub Private Sub HideDuplicateColumnValues(ByVal eleCol As XmlElement, ByVal sTableID As String, ByRef sCellXsl As String) 'Hide duplicate values? Dim eleHideDups As XmlElement = eleCol.SelectSingleNode("HideDuplicates") If Not IsNothing(eleHideDups) Then Dim sDupId As String = eleHideDups.GetAttribute("DataColumn").Replace(",", "-").Replace(" ", "") If sDupId.Length = 0 Then _ Throw New Exception("DataColumn attribute is required for HideDuplicates elements.") sCellXsl = "" & sCellXsl & "" End If End Sub Private Sub subHideWhenZeroRows(ByVal eleDef As XmlElement, ByRef sHtmlElement As String) If eleDef.GetAttribute("HideWhenZeroRows") = "True" Then Dim sHideAttr As String = "rdHideTableRowCount-" & eleDef.GetAttribute("ID") 'Add a condition element, setup the condition, and add a summary column to get the row count. eleDef.SetAttribute("Condition", "@Data." & sHideAttr & "~.0 > 0 OR Len(""@Data." & sHideAttr & "~"") = 0") Dim eleCountSummary As XmlElement = eleDef.OwnerDocument.CreateElement("DataColumnSummary") eleDef.AppendChild(eleCountSummary) eleCountSummary.SetAttribute("ID", sHideAttr) eleCountSummary.SetAttribute("Function", "Count") eleCountSummary.SetAttribute("DataColumn", "rdAnyCol") sHtmlElement = sSetConditionalElement(eleDef, sHtmlElement) End If End Sub Private Sub subHideWhenOnePage(ByVal elePaging As XmlElement, ByRef sHtmlElement As String) If elePaging.GetAttribute("HideWhenOnePage") = "True" Then Dim sID As String = Nothing 'elePaging.GetAttribute("ID") 20394 'If sID.Length = 0 Then 'Get the ID of the DataTable. This is the standard path. Fix for 3815. Dim eleParent As XmlElement = elePaging.ParentNode sID = eleParent.GetAttribute("ID") 'End If Dim sHideAttr As String = sID & "-RowCnt" 'Issue 18201 - Datalayer.ActiveSQL - hide paging when there is only one page Dim sPageRowCnt As Integer = st.sGetAttribute(elePaging, "PageRowCount", 9999) 'Add a condition element, setup the condition, and add a summary column to get the row count. elePaging.SetAttribute("Condition", "@Session." & sHideAttr & "~.0 > " & sPageRowCnt & " OR Len(""@Session." & sHideAttr & "~"") = 0") 'Issue 18201 - Datalayer.ActiveSQL - hide paging when there is only one page Dim eleCountSummary As XmlElement = elePaging.OwnerDocument.CreateElement("DataColumnSummary") elePaging.AppendChild(eleCountSummary) eleCountSummary.SetAttribute("ID", sHideAttr) eleCountSummary.SetAttribute("Function", "Count") sHtmlElement = sSetConditionalElement(elePaging, sHtmlElement) End If 'Note that this process does not work with DataLayer.ActiveSql because DataColumnSummary is not supported. End Sub Private Sub subProcessInputValidationElements(ByVal eleDef As XmlElement) Dim nlValidation As XmlNodeList = eleDef.SelectNodes("Validation") If nlValidation.Count = 0 Then Exit Sub Dim eleValidation As XmlElement For Each eleValidation In nlValidation Dim sElementID As String = eleDef.GetAttribute("ID") If sElementID.Contains("_rdDatePicker") Then sElementID = sElementID.Substring(0, sElementID.IndexOf("_rdDatePicker")) eleDef.SetAttribute("Format", "M/d/yyyy") '# 10953 End If Dim sEndDateElementID As String = eleDef.GetAttribute("EndDateRangeID") Dim sErrorMsg As String = eleValidation.GetAttribute("ErrorMsg").Replace(vbCr, "\n").Replace(vbLf, "") '10207 Dim sErrorClass As String = eleValidation.GetAttribute("Class") Select Case eleValidation.GetAttribute("Type") Case "Date" Dim sDateFormat As String = eleDef.GetAttribute("Format") Dim sRangeStart As String = eleValidation.GetAttribute("RangeStart") Try ' # 10953 rdInternational.SetCulture(CultureType.CULTURE_BROWSER) 'Add the Culture Settings. sRangeStart = IIf(String.IsNullOrEmpty(ConvertFormatNameToFormatString(sDateFormat)), CDate(sRangeStart).ToShortDateString, CDate(sRangeStart).ToString(ConvertFormatNameToFormatString(sDateFormat))) Catch ex As Exception sRangeStart = eleValidation.GetAttribute("RangeStart") End Try Dim sRangeEnd As String = eleValidation.GetAttribute("RangeEnd") Try sRangeEnd = IIf(String.IsNullOrEmpty(ConvertFormatNameToFormatString(sDateFormat)), CDate(sRangeEnd).ToShortDateString, CDate(sRangeEnd).ToString(ConvertFormatNameToFormatString(sDateFormat))) Catch ex As Exception sRangeEnd = eleValidation.GetAttribute("RangeEnd") End Try If sDateFormat.Length = 0 Then sDateFormat = http.Application("rdConstant-DefaultDateFormat") If IsNothing(sDateFormat) Then sDateFormat = "Short Date" 'Default date format. If sDateFormat = "Short Date" Then sDateFormat = "rdShortDate" If "General Date,Medium Date, Long Date,".IndexOf(sDateFormat) <> -1 Then _ Throw New Exception("For Date Validation, the Format attribute must be a specific date format (like ""MM/dd/yyyy"") or ""Short Date"".") If sErrorMsg.Length = 0 Then sErrorMsg = sElementID & " must be a valid date." msJScriptValidationStatements &= "sErrorMsg = rdValidateDate('" & sElementID & "','" & sDateFormat & "','" & sRangeStart & "','" & sRangeEnd & "','" & util.XSLCompliant(sErrorMsg.Replace("'", "\'")) & "','" & sErrorClass & "'); if (sErrorMsg) return sErrorMsg; " If Not String.IsNullOrEmpty(sEndDateElementID) Then msJScriptValidationStatements &= "sErrorMsg = rdValidateDate('" & sEndDateElementID & "','" & sDateFormat & "','" & sRangeStart & "','" & sRangeEnd & "','" & util.XSLCompliant(sErrorMsg.Replace("'", "\'")) & "','" & sErrorClass & "'); if (sErrorMsg) return sErrorMsg; " End If rdInternational.SetCulture(CultureType.CULTURE_INVARIANT) 'Revert the Culture Settings. '23824 'Call subAddIncludedScript("rdCalendar/CalendarPopup.js") 'This is needed to get the isDate function, called by rdValidateDate. Case "Numeric" If sErrorMsg.Length = 0 Then sErrorMsg = sElementID & " must be numeric." Dim sLocaleDecimalChar As String = "." If eleDef.GetAttribute("Format").Length <> 0 Then sLocaleDecimalChar = rdInternational.BrowserDecimalCharacter End If msJScriptValidationStatements &= "sErrorMsg = rdValidateNumeric('" & sElementID & "','" & sLocaleDecimalChar & "','" & util.XSLCompliant(sErrorMsg.Replace("'", "\'")) & "','" & sErrorClass & "'); if (sErrorMsg) return sErrorMsg; " Case "Required" If sErrorMsg.Length = 0 Then sErrorMsg = sElementID & " is required." 'sErrorMsg = sErrorMsg.Replace("""", """) 'sErrorMsg = sErrorMsg.Replace("&", "&") msJScriptValidationStatements &= "sErrorMsg = rdValidateRequired('" & sElementID & "','" & util.XSLCompliant(sErrorMsg.Replace("'", "\'")) & "','" & sErrorClass & "'); if (sErrorMsg) return sErrorMsg; " If Not String.IsNullOrEmpty(sEndDateElementID) Then msJScriptValidationStatements &= "sErrorMsg = rdValidateRequired('" & sEndDateElementID & "','" & util.XSLCompliant(sErrorMsg.Replace("'", "\'")) & "','" & sErrorClass & "'); if (sErrorMsg) return sErrorMsg; " End If Case "Length" Dim sMinLength As String = eleValidation.GetAttribute("MinLength") If sMinLength.Length = 0 Or Not IsNumeric(sMinLength) Then sMinLength = "0" 'This is the max length for TextAreas. Dim sMaxLength As String = eleValidation.GetAttribute("MaxLength") If sMaxLength.Length = 0 Or Not IsNumeric(sMaxLength) Then sMaxLength = "30000" 'This is the max length for TextAreas. If sErrorMsg.Length = 0 Then sErrorMsg = sElementID & " is the wrong length." msJScriptValidationStatements &= "sErrorMsg = rdValidateLength('" & sElementID & "','" & sMinLength & "','" & sMaxLength & "','" & util.XSLCompliant(sErrorMsg.Replace("'", "\'")) & "','" & sErrorClass & "'); if (sErrorMsg) return sErrorMsg; " Case "Javascript" Dim sFunction As String = st.sGetAttribute(eleValidation, "JavascriptFunction") If sErrorMsg.Length = 0 Then sErrorMsg = sElementID & " is not valid." msJScriptValidationStatements &= "sErrorMsg = rdValidateJavascript('" & sElementID & "', '" & util.XSLCompliant(sFunction.Replace("'", "\'")) & "', '" & util.XSLCompliant(sErrorMsg.Replace("'", "\'")) & "','" & sErrorClass & "'); if (sErrorMsg) return sErrorMsg; " Case "Email" If sErrorMsg.Length = 0 Then sErrorMsg = sElementID & " is not a valid Email Address." msJScriptValidationStatements &= "sErrorMsg = rdValidateEmailAddress('" & sElementID & "','" & util.XSLCompliant(sErrorMsg.Replace("'", "\'")) & "','" & sErrorClass & "'); if (sErrorMsg) return sErrorMsg; " Case "Telephone" Dim sAllowedCharacters As String = eleValidation.GetAttribute("AllowedCharacters") If sErrorMsg.Length = 0 Then sErrorMsg = sElementID & " is not a valid Telephone number." msJScriptValidationStatements &= "sErrorMsg = rdValidateTelePhoneNumber('" & sElementID & "','" & sAllowedCharacters & "','" & util.XSLCompliant(sErrorMsg.Replace("'", "\'")) & "','" & sErrorClass & "'); if (sErrorMsg) return sErrorMsg; " Case "Time" rdInternational.SetCulture(CultureType.CULTURE_BROWSER) Dim sTimeFormat As String = eleDef.GetAttribute("Format") Dim sStartTime As String = eleValidation.GetAttribute("RangeStartTime") Try '#14390. If Not String.IsNullOrEmpty(sStartTime) Then sStartTime = Format(CDate(sStartTime), sTimeFormat) Catch : End Try Dim sEndTime As String = eleValidation.GetAttribute("RangeEndTime") Try If Not String.IsNullOrEmpty(sEndTime) Then sEndTime = Format(CDate(sEndTime), sTimeFormat) Catch : End Try If sErrorMsg.Length = 0 Then sErrorMsg = sElementID & " is not a valid Time." msJScriptValidationStatements &= "sErrorMsg = rdValidateTimeString('" & sElementID & "','" & sStartTime & "','" & sEndTime & "','" & util.XSLCompliant(sErrorMsg.Replace("'", "\'")) & "','" & sErrorClass & "'); if (sErrorMsg) return sErrorMsg; " rdInternational.SetCulture(CultureType.CULTURE_INVARIANT) End Select '23824 'Call subAddIncludedScript("rdInputValidation.js") Next End Sub Private Function sAddInputElementCaption(ByVal eleDef As XmlElement, Optional ByVal postFix As String = "") As String If eleDef.GetAttribute("Caption").Length <> 0 Then Dim eleLabel As XmlElement eleLabel = xmlDef.CreateElement("Label") eleLabel.SetAttribute("For", String.Format("{0}{1}", eleDef.GetAttribute("ID"), postFix)) eleLabel.SetAttribute("Caption", eleDef.GetAttribute("Caption")) If eleDef.GetAttribute("CaptionClass").Length <> 0 Then eleLabel.SetAttribute("Class", eleDef.GetAttribute("CaptionClass")) ElseIf eleDef.GetAttribute("Class").Length <> 0 Then eleLabel.SetAttribute("Class", eleDef.GetAttribute("Class")) End If eleLabel.SetAttribute("ID", String.Format("{0}{1}-Caption", eleDef.GetAttribute("ID"), postFix)) Dim eleConditionalClass As XmlElement If eleDef.ParentNode.Name = "InputGrid" Then For Each eleConditionalClass In eleDef.ParentNode.SelectNodes("ConditionalClass") eleLabel.AppendChild(eleConditionalClass.CloneNode(True)) Next End If For Each eleConditionalClass In eleDef.SelectNodes("ConditionalClass") eleLabel.AppendChild(eleConditionalClass.CloneNode(True)) Next Dim sReturn As String = sProcess_Label(eleLabel) Return sReturn Else Return "" End If End Function Private Sub subAddInputElementCookieCreation(ByVal eleDef As XmlElement) If bExportReport() Then Exit Sub If eleDef.GetAttribute("SaveInCookie") = "True" Then If bUnderDataRepeater(eleDef) Then Throw New Exception("""SaveInCookie"" cannot be used under a Data Table.") ElseIf Not IsNothing(HttpContext.Current.Items("rdIsWidgetRequest")) Then Throw New Exception("""SaveInCookie"" cannot be used with Widgets.") End If Dim sSettings As String = st.sGetDefinition("_Settings") xmlSettings = New XmlDocument() xmlSettings.LoadXml(sSettings) rdState.subRemoveRemarks(xmlSettings) Dim sGeneralSettingsCookiePath As String = String.Empty Dim sGeneralSettingsCookieExpiration As String = String.Empty If Not IsNothing(xmlSettings.SelectSingleNode("//General").Attributes("CookiePath")) Then '#11968. sGeneralSettingsCookiePath = xmlSettings.SelectSingleNode("//General").Attributes("CookiePath").Value() End If If Not IsNothing(xmlSettings.SelectSingleNode("//General").Attributes("CookieExpiration")) Then sGeneralSettingsCookieExpiration = xmlSettings.SelectSingleNode("//General").Attributes("CookieExpiration").Value() End If msJScriptInputCookieStatements &= "rdSaveInputCookie(" & "'" & eleDef.GetAttribute("ID") & "'" & "," & "'" & sGeneralSettingsCookieExpiration & "'" & "," & "'" & sGeneralSettingsCookiePath & "'" & ");" '23824 'Call subAddIncludedScript("rdAjax/rdAjax2.js") 'Call subAddIncludedScript("rdCookie.js") End If 'SaveInLocalStorage is originally added for Action.EmailReport so users don't have to re-enter the From email address every time. If eleDef.GetAttribute("SaveInLocalStorage") = "True" Then 'This currently doesn't work under DataTables, but don't throw an error. 'If bUnderDataTableColumn(eleDef) Then ' Throw New Exception("""SaveInLocalStorage"" cannot be used under a Data Table.") 'ElseIf Not IsNothing(HttpContext.Current.Items("rdIsWidgetRequest")) Then If Not IsNothing(HttpContext.Current.Items("rdIsWidgetRequest")) Then _ Throw New Exception("""SaveInLocalStorage"" cannot be used with Widgets.") msJScriptInputLocalStorageStatements &= "rdSaveInputToLocalStorage(" & "'" & eleDef.GetAttribute("ID") & "');" '23824 'Call subAddIncludedScript("rdAjax/rdAjax2.js") 'Call subAddIncludedScript("rdCookie.js") Call subAddJavaEventFunction("rdBodyLoad", "rdGetInputFromLocalStorage(""" & eleDef.GetAttribute("ID") & """)") End If End Sub Private Function sMakeInputGridRow(ByVal eleDef As XmlElement, ByVal sCaption As String, ByVal sInput As String) As String Dim eleInputGrid As XmlElement = eleDef.ParentNode Dim sRow As String = "" If Not IsNothing(eleInputGrid) AndAlso eleInputGrid.Name = "InputGrid" Then Dim sCaptionStyle As String = "" If eleInputGrid.GetAttribute("CaptionWidth").Length > 0 Then 'sCaptionStyle = " style=""width:" & eleInputGrid.GetAttribute("CaptionWidth") & eleInputGrid.GetAttribute("WidthScale") & ";""" sCaptionStyle = " style=""width:" & eleInputGrid.GetAttribute("CaptionWidth") & st.sGetAttribute(eleInputGrid, "WidthScale", "px") & ";""" End If sRow &= sSetClass(eleInputGrid, "") sRow &= sSetClass(eleInputGrid, "") sRow &= sCaption & "" sRow &= sSetClass(eleInputGrid, "") sRow &= sInput & "" Else sRow &= "" & sCaption & sInput & "" 'This SPAN is used to wrap the entire control for WYSIWYG. sRow = sSetPositioning(eleDef, sRow) End If Return sRow End Function Friend Shared Function GetLastPageMagicNumber(nPageRowCount As Integer) As Integer Return (Integer.MaxValue - 10000) / nPageRowCount End Function Private Sub subAddInteractivePagingControl(ByVal eleDef As XmlElement, ByVal eleData As XmlElement, ByVal elePaging As XmlElement, ByVal elePagingDiv As XmlElement, ByVal sCaptionAttribute As String, ByVal sPageTarget As String) 'This code actually adds to the page's definition by adding new label, action, and target elements. Dim eleLabel As XmlElement Dim eleSpace As XmlElement Dim sCaption As String = elePaging.GetAttribute(sCaptionAttribute) Dim sClass As String = elePaging.GetAttribute("Class") If sClass.Length = 0 Then If HttpContext.Current.Application("rdConstant-DontSetPagingClass") <> "True" Then sClass = eleDef.GetAttribute("Class") End If End If Dim eleAction As XmlElement Dim eleLinkParams As XmlElement Dim sElementId As String = eleDef.GetAttribute("ID") If sCaptionAttribute = "PageOfPages" Then 'The page number info comes from request and session vars when the data is built. ' "Page" eleLabel = xmlDef.CreateElement("Label") eleLabel.SetAttribute("Caption", st.sGetAttribute(elePaging, "PageNrCaption", "Page ")) ''eleLabel.SetAttribute("Class", elePaging.GetAttribute("Class")) If HttpContext.Current.Application("rdConstant-DontSetPagingClass") <> "True" Then _ eleLabel.SetAttribute("Class", sClass) eleLabel.SetAttribute("ID", sElementId & "-" & sCaptionAttribute) eleLabel.SetAttribute("For", sElementId & "-PageNr") elePagingDiv.AppendChild(eleLabel) ' "PageNr" 'sPageNrCaption = sPageNrCaption & "@Session." & eleData.GetAttribute("ID") & "-PageNr~" Dim eleText As XmlElement = xmlDef.CreateElement("InputText") eleText.SetAttribute("DefaultValue", "@Session." & sElementId & "-PageNr~") eleText.SetAttribute("InputSize", "7") eleText.SetAttribute("InputMaxLength", "7") ''eleText.SetAttribute("Class", elePaging.GetAttribute("Class")) If HttpContext.Current.Application("rdConstant-DontSetPagingClass") <> "True" Then eleText.SetAttribute("Class", st.sGetAttribute(elePaging, "CurrentPageClass", sClass)) End If eleText.SetAttribute("ID", sElementId & "-PageNr") eleAction = xmlDef.CreateElement("Action") eleAction.SetAttribute("Type", "Report") Dim eleTarget As XmlElement = xmlDef.CreateElement("Target") eleTarget.SetAttribute("Type", "Report") eleTarget.SetAttribute("Report", msRequestedPage) eleTarget.SetAttribute("FrameID", "_self") eleTarget.SetAttribute("RequestForwarding", "True") If eleDef.GetAttribute("KeepScrollPosition") = "True" Then _ eleTarget.SetAttribute("KeepScrollPosition", "True") eleLinkParams = xmlDef.CreateElement("LinkParams") 'eleLinkParams.SetAttribute("rdDefinition", msRequestedPage) eleLinkParams.SetAttribute("rdDataCache", "rdInsertDataCacheKeyHere") eleLinkParams.SetAttribute("rdShowModes", "@RequestJScript.rdShowModes~") ' "@Request.rdShowModes~") 'Issue 2422 eleLinkParams.SetAttribute("rdSort", "@RequestJScript.rdSort~") ' "@Request.rdSort~") eleLinkParams.SetAttribute("rdNewPageNr", "True") eleText.AppendChild(eleAction) eleAction.AppendChild(eleTarget) eleAction.AppendChild(eleLinkParams) elePagingDiv.AppendChild(eleText) If Not IsNothing(http.Request.UserAgent) AndAlso http.Request.UserAgent.Contains("Firefox") Then 'Add a Dummy hidden InputText to prevent Mozilla from submitting the page when the above InputText is by itself. '11515 Dim eleHiddenDiv As XmlElement = xmlDef.CreateElement("Division") eleHiddenDiv.SetAttribute("ShowModes", "None") Dim eleHiddenText As XmlElement = xmlDef.CreateElement("InputText") eleHiddenText.SetAttribute("ID", "rdFix4Firefox") eleHiddenDiv.AppendChild(eleHiddenText) elePagingDiv.AppendChild(eleHiddenDiv) End If Dim elePageCount As XmlElement = xmlDef.CreateElement("Division") elePageCount.SetAttribute("Condition", "@Session.rdRowCountKnown_" & sElementId & "~") elePagingDiv.AppendChild(elePageCount) ' " of " eleLabel = xmlDef.CreateElement("Label") eleLabel.SetAttribute("Caption", st.sGetAttribute(elePaging, "PageOfCaption", " of ")) eleLabel.SetAttribute("ID", sElementId & "-of") elePageCount.AppendChild(eleLabel) If HttpContext.Current.Application("rdConstant-DontSetPagingClass") <> "True" Then _ eleLabel.SetAttribute("Class", sClass) 'Page Count. eleLabel = xmlDef.CreateElement("Label") eleLabel.SetAttribute("Caption", "@Session." & sElementId & "-LastPageNr~") ''eleLabel.SetAttribute("Class", elePaging.GetAttribute("Class")) If HttpContext.Current.Application("rdConstant-DontSetPagingClass") <> "True" Then _ eleLabel.SetAttribute("Class", sClass) eleLabel.SetAttribute("ID", sElementId & "-" & "PageOfPages") elePageCount.AppendChild(eleLabel) eleSpace = xmlDef.CreateElement("Spaces") eleSpace.SetAttribute("Size", "2") elePagingDiv.AppendChild(eleSpace) ElseIf sCaptionAttribute = "Numbered" Then 'These elements will be made complete in rdServerHtmlFixup.vb. Dim eleDiv As XmlElement = xmlDef.CreateElement("Label") eleDiv.SetAttribute("Caption", "") eleDiv.SetAttribute("Format", "HTML") elePagingDiv.AppendChild(eleDiv) 'Prototype for the current page number. eleLabel = xmlDef.CreateElement("Label") eleLabel.SetAttribute("Caption", "@Session." & sElementId & "-PageNr~") 'If HttpContext.Current.Application("rdConstant-DontSetPagingClass") <> "True" Then _ eleLabel.SetAttribute("Class", elePaging.GetAttribute("CurrentPageClass")) eleLabel.SetAttribute("ID", sElementId & "-rdNumberedCurrPageNr") elePagingDiv.AppendChild(eleLabel) 'Build a prototype for the page number links. eleLabel = xmlDef.CreateElement("Label") eleLabel.SetAttribute("ID", sElementId & "-NumberedPageNr") eleLabel.SetAttribute("Caption", "rdTargetPageNr") 'If HttpContext.Current.Application("rdConstant-DontSetPagingClass") <> "True" Then _ 'eleLabel.SetAttribute("Class", sClass) 'Dim sPrevNextClass As String = elePaging.GetAttribute("PrevNextClass") 'If sPrevNextClass.Length <> 0 Then _ ' eleLabel.SetAttribute("Class", sPrevNextClass) eleAction = xmlDef.CreateElement("Action") eleAction.SetAttribute("Type", "Report") Dim eleTarget As XmlElement = xmlDef.CreateElement("Target") eleTarget.SetAttribute("Type", "Report") eleTarget.SetAttribute("Report", msRequestedPage) eleTarget.SetAttribute("FrameID", "_self") eleTarget.SetAttribute("RequestForwarding", "True") If eleDef.GetAttribute("KeepScrollPosition") = "True" Then _ eleTarget.SetAttribute("KeepScrollPosition", "True") eleLinkParams = xmlDef.CreateElement("LinkParams") eleLinkParams.SetAttribute(sElementId & "-PageNr", "rdTargetPageNr") eleLinkParams.SetAttribute("rdDataCache", "rdInsertDataCacheKeyHere") eleLinkParams.SetAttribute("rdShowModes", "@RequestJScript.rdShowModes~") ' "@Request.rdShowModes~") 'Issue 2422 eleLinkParams.SetAttribute("rdSort", "@RequestJScript.rdSort~") ' "@Request.rdSort~") eleLinkParams.SetAttribute("rdNewPageNr", "True") eleLabel.AppendChild(eleAction) eleAction.AppendChild(eleTarget) eleAction.AppendChild(eleLinkParams) elePagingDiv.AppendChild(eleLabel) eleDiv = xmlDef.CreateElement("Label") eleDiv.SetAttribute("Caption", "") eleDiv.SetAttribute("Format", "HTML") elePagingDiv.AppendChild(eleDiv) 'Add a hidden element to save the page number if the page is refreshed for some other reason besides paging. #8295. Dim eleHiddenPageNr As XmlElement = xmlDef.CreateElement("InputHidden") eleHiddenPageNr.SetAttribute("DefaultValue", "@Session." & sElementId & "-PageNr~") eleHiddenPageNr.SetAttribute("ID", sElementId & "-PageNr") elePagingDiv.AppendChild(eleHiddenPageNr) Else Dim eleDiv As XmlElement = xmlDef.CreateElement("Division") If st.sGetAttribute(elePaging, "HideShowPrevNextCaptions") = "True" Then If sCaptionAttribute = "FirstPageCaption" OrElse sCaptionAttribute = "PreviousPageCaption" Then eleDiv.SetAttribute("Condition", "@Session." & sElementId & "-NotFirstPage~") ElseIf sCaptionAttribute = "LastPageCaption" OrElse sCaptionAttribute = "NextPageCaption" Then eleDiv.SetAttribute("Condition", "@Session." & sElementId & "-NotLastPage~") End If End If If sCaptionAttribute = "LastPageCaption" AndAlso eleData.GetAttribute("SkipRowCount") = "True" Then Dim nPageRowCount As Integer = Val(elePaging.GetAttribute("PageRowCount")) sPageTarget = GetLastPageMagicNumber(nPageRowCount).ToString() 'Force ActiveSQL to get the actual page count by asking for the greatest possible value. 'Removed: This code will hide the last page link for large ActiveSQL results. 'Dim sCondition As String = eleDiv.GetAttribute("Condition") 'If sCondition.Length <> 0 Then _ ' sCondition &= " and " 'sCondition &= "@Session.rdRowCountKnown_" & sElementId & "~" 'eleDiv.SetAttribute("Condition", sCondition) End If If elePaging.GetAttribute("CaptionType") = "Image" Then eleLabel = xmlDef.CreateElement("Image") 'eleLabel.SetAttribute("AltText", sCaption) 'Issue 2176 If sCaption.Length = 0 Then Select Case sCaptionAttribute Case "FirstPageCaption" sCaption = "rdTemplate/rdPageFirst.gif" Case "PreviousPageCaption" sCaption = "rdTemplate/rdPagePrev.gif" Case "NextPageCaption" sCaption = "rdTemplate/rdPageNext.gif" Case "LastPageCaption" sCaption = "rdTemplate/rdPageLast.gif" End Select End If If sCaptionAttribute = "FirstPageCaption" Then eleLabel.SetAttribute("AltText", st.sGetAttribute(elePaging, "FirstPageAltText", "First page")) ElseIf sCaptionAttribute = "PreviousPageCaption" Then eleLabel.SetAttribute("AltText", st.sGetAttribute(elePaging, "PreviousPageAltText", "Previous page")) ElseIf sCaptionAttribute = "NextPageCaption" Then eleLabel.SetAttribute("AltText", st.sGetAttribute(elePaging, "NextPageAltText", "Next page")) ElseIf sCaptionAttribute = "LastPageCaption" Then eleLabel.SetAttribute("AltText", st.sGetAttribute(elePaging, "LastPageAltText", "Last page")) End If Else eleLabel = xmlDef.CreateElement("Label") If sCaption.Length = 0 Then Select Case sCaptionAttribute Case "FirstPageCaption" sCaption = "<<" Case "PreviousPageCaption" sCaption = "<" Case "NextPageCaption" sCaption = ">" Case "LastPageCaption" sCaption = ">>" End Select End If End If eleLabel.SetAttribute("Caption", sCaption) eleLabel.SetAttribute("ID", sElementId & "-" & sCaptionAttribute) ''eleLabel.SetAttribute("Class", elePaging.GetAttribute("Class")) If HttpContext.Current.Application("rdConstant-DontSetPagingClass") <> "True" Then _ eleLabel.SetAttribute("Class", sClass) Dim sPrevNextClass As String = elePaging.GetAttribute("PrevNextClass") If sPrevNextClass.Length <> 0 Then _ eleLabel.SetAttribute("Class", sPrevNextClass) eleAction = xmlDef.CreateElement("Action") eleAction.SetAttribute("Type", "Report") Dim eleTarget As XmlElement = xmlDef.CreateElement("Target") eleTarget.SetAttribute("Type", "Report") eleTarget.SetAttribute("Report", msRequestedPage) eleTarget.SetAttribute("FrameID", "_self") eleTarget.SetAttribute("RequestForwarding", "True") If eleDef.GetAttribute("KeepScrollPosition") = "True" Then _ eleTarget.SetAttribute("KeepScrollPosition", "True") eleLinkParams = xmlDef.CreateElement("LinkParams") eleLinkParams.SetAttribute(sElementId & "-PageNr", sPageTarget) 'eleLinkParams.SetAttribute("rdDefinition", msRequestedPage) eleLinkParams.SetAttribute("rdDataCache", "rdInsertDataCacheKeyHere") If eleData.HasAttribute("rdResultsetGuid") Then eleLinkParams.SetAttribute("rdResultsetGuid", eleData.GetAttribute("rdResultsetGuid")) End If eleLinkParams.SetAttribute("rdShowModes", "@Request.rdShowModes~") eleLinkParams.SetAttribute("rdSort", "@Request.rdSort~") eleLinkParams.SetAttribute("rdNewPageNr", "True") eleSpace = xmlDef.CreateElement("Spaces") eleSpace.SetAttribute("Size", "2") If sCaptionAttribute = "LastPageCaption" Then eleSpace.SetAttribute("Size", "0") End If eleLabel.AppendChild(eleAction) eleAction.AppendChild(eleTarget) eleAction.AppendChild(eleLinkParams) eleDiv.AppendChild(eleLabel) eleDiv.AppendChild(eleSpace) elePagingDiv.AppendChild(eleDiv) 'eleLabel.SetAttribute("Caption", sCaption) 'eleLabel.SetAttribute("Class", elePaging.GetAttribute("Class")) 'eleLabel.SetAttribute("ID", eleData.GetAttribute("ID") & "-" & sCaptionAttribute) 'Dim eleAction As XmlElement = xmlDef.CreateElement("Action") 'eleAction.SetAttribute("Type", "Click") 'Dim eleTarget As XmlElement = xmlDef.CreateElement("Target") 'eleTarget.SetAttribute("Type", "Report") 'eleTarget.SetAttribute("Report", msRequestedPage) 'Dim eleLinkParams As XmlElement = xmlDef.CreateElement("LinkParams") 'eleLinkParams.SetAttribute(eleData.GetAttribute("ID") & "-PageNr", sPageTarget) ''eleLinkParams.SetAttribute("rdDefinition", msRequestedPage) 'eleLinkParams.SetAttribute("rdDataCache", "True") 'eleLabel.AppendChild(eleAction) 'eleAction.AppendChild(eleTarget) 'eleTarget.AppendChild(eleLinkParams) 'elePaging.AppendChild(eleLabel) End If If elePaging.Name = "AppendPaging" _ OrElse eleDef.GetAttribute("AjaxPaging") = "True" Then If IsNothing(HttpContext.Current.Items("rdIsWidgetRequest")) Then 'Widgets are Ajax by nature. #5799 eleAction.SetAttribute("rdAjaxCommand", "RefreshElement") eleAction.SetAttribute("rdDataTablePaging", "True") eleAction.SetAttribute("rdRefreshElementID", sElementId) eleLinkParams.SetAttribute("rdAjaxCommand", "RefreshElement") eleLinkParams.SetAttribute("rdDataTablePaging", "True") eleLinkParams.SetAttribute("rdRefreshElementID", sElementId) If eleDef.GetAttribute("AjaxPaging") = "True" AndAlso sCaptionAttribute = "LastPageCaption" Then Dim elePagedResultsLoadingIconColumn As XmlElement = xmlDef.CreateElement("Column") elePagingDiv.ParentNode.AppendChild(elePagedResultsLoadingIconColumn) Dim elePagedResultsLoadingIconDiv As XmlElement = xmlDef.CreateElement("Division") elePagedResultsLoadingIconDiv.SetAttribute("HtmlDiv", "True") elePagedResultsLoadingIconDiv.SetAttribute("ShowModes", "None") elePagedResultsLoadingIconDiv.SetAttribute("ID", "divPagingWait_" & eleDef.GetAttribute("ID")) elePagedResultsLoadingIconColumn.AppendChild(elePagedResultsLoadingIconDiv) Dim elePagedResultsLoadingIcon As XmlElement = xmlDef.CreateElement("Image") elePagedResultsLoadingIcon.SetAttribute("Caption", "rdTemplate/rdPagingWait.gif") elePagedResultsLoadingIconDiv.AppendChild(elePagedResultsLoadingIcon) eleLinkParams.SetAttribute("rdPagingWait", "True") End If End If End If End Sub Private Function sGetMoreInfoRows(ByVal eleDef As XmlElement, ByVal nColumns As Integer) As String Dim sMIRs As String = "" Dim eleMIR As XmlElement 'MIR = MoreInfoRow Dim sMIR As String For Each eleMIR In eleDef.SelectNodes("MoreInfoRow") Dim bColumnMode As Boolean = False If Not IsNothing(eleMIR.SelectSingleNode("MoreInfoRowColumn")) Then bColumnMode = True If Not IsNothing(eleMIR.SelectSingleNode("*[not(self::MoreInfoRowColumn)] ")) Then Throw New Exception("When MoreInfoRowColumn elements are under a MoreInfoRow, no other elements are allowed.") End If End If sMIR = "" 'eleMIR.SetAttribute("Visible", "False") sMIR = sSetVisibility(eleMIR, sMIR) sMIR = sSetID(eleMIR, sMIR) 'sMIR = sSetAlign(eleMIR, sMIR) If bColumnMode Then Dim eleMirChild As XmlElement = eleMIR.FirstChild Do Until IsNothing(eleMirChild) 'This is a MoreInfoRowColumn element. If eleMIR.HasAttribute("Class") _ AndAlso Not eleMirChild.HasAttribute("Class") Then eleMirChild.SetAttribute("Class", eleMIR.GetAttribute("Class")) End If sMIR &= sProcessDefinitionElement(eleMirChild) eleMirChild = eleMirChild.NextSibling Loop Else 'Figure out the column span. Dim nFirstCol As Integer = 1 Try nFirstCol = eleMIR.GetAttribute("ColumnSpanFirst") Catch : End Try Dim nLastCol As Integer = nColumns Try nLastCol = eleMIR.GetAttribute("ColumnSpanLast") Catch : End Try Dim i As Integer For i = nFirstCol To 2 Step -1 sMIR &= "" Next 'Build the MIR column. Dim nColSpan As Integer = nLastCol - nFirstCol + 1 nColSpan = Math.Max(1, nColSpan) 'Prevent COLSPAN < 1 If eleMIR.GetAttribute("ColumnSpanLast").Contains("@") Then 'There's a token. sMIR &= sSetClass(eleMIR, "") '10319 Else 'No token, use nLastCol calculated above. sMIR &= sSetClass(eleMIR, "") End If sMIR &= sProcessDefinitionElementChildren(eleMIR) sMIR &= "" End If sMIR &= "" sMIR = sSetConditionalElement(eleMIR, sMIR) sMIRs &= sMIR Next Return sMIRs End Function Private Sub GetGroupHeaderRows(ByVal eleTableDef As XmlElement, ByRef sDataRow As String) Dim sGHRs As String = "" 'Dim sEndGroupMarkers As String = "" Dim eleGHR As XmlElement 'GHR = GroupHeaderRow Dim sGHR As String For Each eleGHR In eleTableDef.SelectNodes("GroupHeaderRow") 'There must be a corresponding GroupFilter in the DataLayer. Dim sGroupFilterID As String = eleGHR.GetAttribute("GroupFilterID") If sGroupFilterID.Length = 0 Then _ Throw New Exception("The GroupFilterID attribute is required for GroupHeaderRow elements.") Dim eleGroupFilter As XmlElement = eleTableDef.SelectSingleNode("*//GroupFilter[@ID='" & sGroupFilterID & "'] | *//SqlGroup[@ID='" & sGroupFilterID & "']") If IsNothing(eleGroupFilter) Then If eleTableDef.GetAttribute("rdHasAutoColumns") = "True" Then Throw New Exception("GroupHeaderRow elements are not allowed with AutoColumns.") Else Throw New Exception("GroupHeaderRow elements require a corresponding GroupFilter element under the table's DataLayer.") End If End If 'Update Header element with the group columns. They'll be used later to determine where the Header rows go. Dim sGroupColumn As String = st.sGetAttribute(eleGroupFilter, "GroupColumn") If sGroupColumn <> eleGroupFilter.GetAttribute("GroupColumn") Then 'The user has specified a variable for the GroupColumn. We must prevent caching of this definition. mbDontCacheXsl = True End If sGroupColumn = sGroupColumn.Replace(", ", ",").Replace(" ,", ",") eleGHR.SetAttribute("GroupColumn", rdUtility.EncodeDataColumnName(sGroupColumn.Trim()).Replace("_x002C_", ",")) '25002,25344 sGHR = sGetHeaderRow(eleTableDef, eleGHR) ''Collapsible rows. Make something like this: 'Dim sHdrTbody As String = "" 'sHdrTbody &= "" ''sHdrTbody &= " " ''sHdrTbody &= " " '"rdDataID" gets replaced by the DataTableID later. ''sHdrTbody &= " " ''sHdrTbody &= "" 'sGHR = sHdrTbody & sGHR & "" 'Dim sStartGroupMarker As String = "" 'If Not bExportReport() Then ' Issue # 7140 - extra row added to excel export *Jaideep. ' sStartGroupMarker &= "" ' sStartGroupMarker &= " " ' sStartGroupMarker &= " " '"rdDataID" gets replaced by the DataTableID later. ' sStartGroupMarker &= " " ' sStartGroupMarker &= "" 'End If 'sGHR &= sStartGroupMarker 'Build the XSL that controls when the GroupHeaderRow will appear. Dim sGroupAttr As String = eleGHR.GetAttribute("GroupColumn").Replace(",", "-") If sGroupAttr.Length = 0 Then _ Throw New Exception("The DataColumn attribute is required for GroupHeaderRow elements.") Dim sFullGroupAttr As String = "rdGroupStartRow-" & sGroupAttr sGHR = String.Format("{1}", sFullGroupAttr, sGHR, sGroupAttr) 'sEndGroupMarkers &= "" 'sEndGroupMarkers &= " " 'sEndGroupMarkers &= " " 'sEndGroupMarkers &= "" 'If eleGHR.GetAttribute("PrinterPageBreak") = "True" Then ' Dim nInsertPos As Integer = Math.Min(sGHR.IndexOf("

    " ' sPageBreak = "" & sPageBreak & "" ' sGHR = sGHR.Insert(nInsertPos, sPageBreak) 'End If sGHRs += sGHR Next sDataRow = sGHRs & sDataRow ' & sEndGroupMarkers End Sub Private Function sGetHeaderRow(ByVal eleTableDef As XmlElement, ByVal eleHeaderRow As XmlElement) As String Dim sTblHeaderRow As String = "" If Not IsNothing(eleHeaderRow) Then Dim bAutomaticDefinition As Boolean = False If IsNothing(eleHeaderRow.SelectSingleNode("Column")) Then 'Automatically generate a definition for the SummaryRow. bAutomaticDefinition = True End If 'Dim eleCollapsible As XmlElement = eleHeaderRow.SelectSingleNode("CollapsibleGroup") '6806 'Dim eleCollapsibleLink As XmlElement = Nothing Dim sTagName As String = "TD" If bAutomaticDefinition Then Dim sRowClass As String = st.sGetAttribute(eleHeaderRow, "Class") Dim bBeenHere As Boolean Dim eleCol As XmlElement For Each eleCol In eleTableDef.SelectNodes("DataTableColumn") Dim sTblHeaderCol As String Dim sColClass As String = eleCol.GetAttribute("Class") eleCol.SetAttribute("Class", sColClass & " " & sRowClass) If eleCol.GetAttribute("rdCrosstab") = "True" Then sTagName = "TH" sTblHeaderCol = sSetClass(eleCol, String.Format("<{0} scope=""row"" rdHeaderColParentID=""{1}"" rdCrosstab=""True"">", sTagName, eleCol.GetAttribute("ID"))) Else sTblHeaderCol = sSetClass(eleCol, String.Format("<{0} scope=""row"">", sTagName)) End If eleCol.SetAttribute("Class", sColClass) sTblHeaderCol = sSetID(eleCol, sTblHeaderCol) If Not bBeenHere Then bBeenHere = True ''If there's collapsible groups, put the icon in the first column. 'If Not IsNothing(eleCollapsible) Then ' eleCollapsibleLink = GetCollapsibleGroupLink(eleCollapsible) ' eleCol.AppendChild(eleCollapsibleLink) 'Allows bUnderDataTableColumn() to work. ' sTblHeaderCol &= sProcessDefinitionElement(eleCollapsibleLink) ' eleCol.RemoveChild(eleCollapsibleLink) 'End If 'Set the caption in the first column. Dim eleLabel As XmlElement = xmlDef.CreateElement("Label") eleLabel.SetAttribute("ID", "HeaderCaption") eleLabel.SetAttribute("Caption", eleHeaderRow.GetAttribute("Caption")) sTblHeaderCol &= sProcessDefinitionElement(eleLabel) End If 'Add a summary for this column? Dim eleColSummary As XmlElement = eleCol.SelectSingleNode("DataColumnSummary") If Not IsNothing(eleColSummary) Then 'Add a Label element to show the summary value. Dim eleLabel As XmlElement = xmlDef.CreateElement("Label") eleLabel.SetAttribute("ID", "Summary" & eleCol.GetAttribute("ID")) eleLabel.SetAttribute("Caption", "@Data." & eleColSummary.GetAttribute("ID") & "~") Try 'Try to get a format from a label inside the data table column. eleLabel.SetAttribute("Format", eleCol.SelectSingleNode(".//Label[@Format]").Attributes("Format").Value) Catch : End Try If eleHeaderRow.Name = "GroupHeaderRow" Then 'Change the output Label's data column. Dim sDataColumnId As String = "rdGroupSummaryColumn_" & eleColSummary.GetAttribute("ID") eleLabel.SetAttribute("Caption", "@Data." & sDataColumnId & "~") End If sTblHeaderCol &= sProcessDefinitionElement(eleLabel) End If sTblHeaderCol &= String.Format("", sTagName) sTblHeaderCol = sSetConditionalElement(eleCol, sTblHeaderCol) ' #3980 sTblHeaderRow &= sTblHeaderCol Next Else 'No automatic definition. The user has defined Column elements for this row. 'If Not IsNothing(eleCollapsible) Then ' 'Add the collapsible link (ToggleImage element) at the beginning of the first Column element after this element. ' Dim eleLinkCol As XmlElement = eleCollapsible.NextSibling ' While Not IsNothing(eleLinkCol) ' If eleLinkCol.Name = "Column" Then _ ' Exit While ' eleLinkCol = eleLinkCol.NextSibling ' End While ' If IsNothing(eleLinkCol) Then _ ' eleLinkCol = eleHeaderRow.SelectSingleNode("Column") 'Get the first Column. ' If Not IsNothing(eleLinkCol) Then ' eleCollapsibleLink = GetCollapsibleGroupLink(eleCollapsible) ' eleLinkCol.PrependChild(eleCollapsibleLink) ' End If 'End If sTblHeaderRow = sProcessDefinitionElementChildren(eleHeaderRow) sTblHeaderRow = sTblHeaderRow.Replace(" 0 Then ' eleTableDef.SetAttribute("rdCollapseCnt", nCollapsedCnt) ' If nCollapsedCnt > 1 Then ' sCollapsedAttributes = " STYLE=""display:none"" rdCollapseCnt=""" & nCollapsedCnt & """" ' End If 'End If Dim sPrintablePageBreak As String = "" Dim sHtmlPageBreak As String = "" If eleHeaderRow.GetAttribute("PrinterPageBreak") = "True" Then If st.sGetRequestVar("rdPaging") = "Printable" And Not bExportReport() Then 'This is used in rdPrintablePaging.js. sPrintablePageBreak = "rdPageBreak=""Before""" Else 'Normal page breaks defined in HTML. sHtmlPageBreak = "" sHtmlPageBreak = "" & sHtmlPageBreak & "" End If End If 'sTblHeaderRow = "" & sTblHeaderRow & "" sTblHeaderRow = "" & sTblHeaderRow & "" sTblHeaderRow = sSetID(eleHeaderRow, sTblHeaderRow) sTblHeaderRow = sSetClass(eleHeaderRow, sTblHeaderRow) sTblHeaderRow = sSetVisibility(eleHeaderRow, sTblHeaderRow) sTblHeaderRow = sHtmlPageBreak & sTblHeaderRow 'Prepend blank rows? If Not (eleHeaderRow.GetAttribute("PrinterPageBreak") = "True" And st.sGetRequestVar("rdPaging") = "Printable") Then Dim nBlankRows As Integer = CInt(Val(eleHeaderRow.GetAttribute("PrependBlankRows"))) If nBlankRows <> 0 Then Dim sLineBreak As String = "" If Not bExportNativeExcel() And Not bExportNativeWord() Then sLineBreak = "

    " End If Dim nColSpan As Integer Try nColSpan = eleTableDef.SelectNodes("DataTableColumn").Count Finally : End Try Dim i As Integer Dim sBlankRows As String = "" For i = 1 To nBlankRows sBlankRows = sBlankRows & "" & sLineBreak & "" Next If sBlankRows.Length <> 0 Then sTblHeaderRow = "" & sBlankRows & "" & sTblHeaderRow End If End If End If Return sTblHeaderRow End If Return "" End Function Private Function sGetGroupSummaryRows(ByVal eleTableDef As XmlElement, Optional ByVal sColumnSeqAttr As String = "") As String Dim sGSRs As String = "" Dim eleGSR As XmlElement 'GSR = GroupSummaryRow Dim sGSR As String For Each eleGSR In eleTableDef.SelectNodes("GroupSummaryRow") 'There must be a corresponding GroupFilter in the DataLayer. Dim sGroupFilterID As String = eleGSR.GetAttribute("GroupFilterID") If sGroupFilterID.Length = 0 Then _ Throw New Exception("The GroupFilterID attribute is required for GroupSummaryRow elements.") Dim eleGroupFilter As XmlElement = eleTableDef.SelectSingleNode("*//GroupFilter[@ID='" & sGroupFilterID & "'] | *//SqlGroup[@ID='" & sGroupFilterID & "']") If IsNothing(eleGroupFilter) Then If eleTableDef.GetAttribute("rdHasAutoColumns") = "True" Then Throw New Exception("GroupSummaryRow elements are not allowed with AutoColumns.") Else Throw New Exception("GroupSummaryRow elements require a corresponding GroupFilter element under the table's DataLayer.") End If End If 'Update summary element with the group columns. They'll be used later to determine where the summary rows go. Dim sGroupColumn As String = st.sGetAttribute(eleGroupFilter, "GroupColumn") If sGroupColumn <> eleGroupFilter.GetAttribute("GroupColumn") Then 'The user has specified a variable for the GroupColumn. We must prevent caching of this definition. mbDontCacheXsl = True End If eleGSR.SetAttribute("GroupColumn", sGroupColumn.Replace(" ", "")) sGSR = sGetSummaryRow(eleTableDef, eleGSR, eleGroupFilter, sColumnSeqAttr) 'Build the XSL that controls when the GroupSummaryRow will appear. Dim sGroupAttr As String = eleGSR.GetAttribute("GroupColumn").Replace(",", "-") If sGroupAttr.Length = 0 Then _ Throw New Exception("The DataColumn attribute is required for GroupSummaryRow elements.") sGroupAttr = "rdGroupEndRow-" & sGroupAttr sGSR = "" & sGSR & "" sGSRs += sGSR Next Return sGSRs End Function Private Function sGetSummaryRow(ByVal eleTableDef As XmlElement, ByVal eleSummaryRow As XmlElement, Optional ByVal eleGroupFilter As XmlElement = Nothing, Optional ByVal sColumnSeqAttr As String = "") As String 'sSummaryRowType may be "SummaryRow", "HeaderRow", "GroupSummaryRow", or "GroupHeaderRow" Dim sTblSummaryRow As String = "" If IsNothing(eleSummaryRow) Then _ Return sTblSummaryRow 'Automatically generate a definition for the SummaryRow. If IsNothing(eleSummaryRow.SelectSingleNode("Column")) Then Dim sRowClass As String = st.sGetAttribute(eleSummaryRow, "Class") Dim bBeenHere As Boolean Dim eleCol As XmlElement For Each eleCol In eleTableDef.SelectNodes("DataTableColumn") Dim sTblSummaryCol As String Dim sColClass As String = eleCol.GetAttribute("Class") eleCol.SetAttribute("Class", sColClass & " " & sRowClass) If eleCol.GetAttribute("rdCrosstab") = "True" Then sTblSummaryCol = String.Format("", eleCol.GetAttribute("ID")) Else sTblSummaryCol = "" End If sTblSummaryCol = sSetClass(eleCol, sTblSummaryCol) eleCol.SetAttribute("Class", sColClass) sTblSummaryCol = sTblSummaryCol.Insert(3, sColumnSeqAttr) sTblSummaryCol = sAddRdIdeIdx(eleCol, sTblSummaryCol) If Not bBeenHere Then bBeenHere = True 'Set the caption in the first column. Dim eleLabel As XmlElement = xmlDef.CreateElement("Label") eleLabel.SetAttribute("ID", "SummaryCaption") eleLabel.SetAttribute("Caption", eleSummaryRow.GetAttribute("Caption")) sTblSummaryCol &= sProcessDefinitionElement(eleLabel) End If 'Add a summary for this column? Dim eleColSummary As XmlElement = eleCol.SelectSingleNode("DataColumnSummary") If Not IsNothing(eleColSummary) Then If eleColSummary.GetAttribute("ID").Length = 0 Then _ Throw New Exception("DataColumnSummary must have an ID attribute value.") 'Add a Label element to show the summary value. Dim eleLabel As XmlElement = xmlDef.CreateElement("Label") eleLabel.SetAttribute("ID", "Summary" & eleCol.GetAttribute("ID")) eleLabel.SetAttribute("Caption", "@Data." & eleColSummary.GetAttribute("ID") & "~") Try 'Try to get a format from a label inside the data table column. Select Case eleColSummary.GetAttribute("Function").ToUpper Case "SUM", "MIN", "MAX", "MODE" 'Issue 10331 - Correct summary averages eleLabel.SetAttribute("Format", eleCol.SelectSingleNode(".//Label[@Format]").Attributes("Format").Value) Case "AVERAGE", "STDEV", "MEDIAN", "AVERAGEOFALLROWS" eleLabel.SetAttribute("Format", "mps3") End Select Catch : End Try If eleSummaryRow.Name = "GroupSummaryRow" Then 'Change the output Label's data column. Dim sDataColumnId As String = "rdGroupSummaryColumn_" & eleColSummary.GetAttribute("ID") eleLabel.SetAttribute("Caption", "@Data." & sDataColumnId & "~") End If ' For excel output.16918. Set the id to the parent column id (to support excelcolumnformat) If st.sGetRequestVar("rdReportFormat") = "NativeExcel" Then 'sTblSummaryCol = sTblSummaryCol.Insert(sTblSummaryCol.Length - 1, " id=""" & eleCol.GetAttribute("ID") & """") sTblSummaryCol = sTblSummaryCol.Insert(3, " id=""" & eleCol.GetAttribute("ID") & """") '18439 End If sTblSummaryCol &= sProcessDefinitionElement(eleLabel) ElseIf st.sGetRequestVar("rdReportFormat") = "NativeExcel" Then '21553 - Need a placeholder for proper alignment of data column summary elements sTblSummaryCol &= "" End If sTblSummaryCol &= "" sTblSummaryCol = sSetConditionalElement(eleCol, sTblSummaryCol) ' #3980 sTblSummaryRow &= sTblSummaryCol Next Else 'No automatic definition. The user has defined Column elements for this row. sTblSummaryRow = sProcessDefinitionElementChildren(eleSummaryRow) End If Dim sPrintablePageBreak As String = "" Dim sHtmlPageBreak As String = "" If eleSummaryRow.GetAttribute("PrinterPageBreak") = "True" Then If st.sGetRequestVar("rdPaging") = "Printable" And Not bExportReport() Then 'This is used in rdPrintablePaging.js. sPrintablePageBreak = "rdPageBreak=""After""" Else 'Normal page breaks defined in HTML. 'sHtmlPageBreak = "" 'sHtmlPageBreak = "" & sHtmlPageBreak & "" ' Issue 5938,5601 - pagebreak in group summary rows... ' This works only with a PDF export. If http.Request("rdReportFormat") = "PDF" Then '19540. #If JAVA Then sHtmlPageBreak = "

    " '20033 #Else sHtmlPageBreak = "

    rdNbsp

    " #End If End If End If End If sTblSummaryRow = "" & sTblSummaryRow & "" sTblSummaryRow = sSetID(eleSummaryRow, sTblSummaryRow) sTblSummaryRow = sSetClass(eleSummaryRow, sTblSummaryRow) sTblSummaryRow = sSetVisibility(eleSummaryRow, sTblSummaryRow) sTblSummaryRow = sAddRdIdeIdx(eleSummaryRow, sTblSummaryRow) sTblSummaryRow &= sHtmlPageBreak 'Append blank rows? ''If Not (eleSummaryRow.GetAttribute("PrinterPageBreak") = "True" And sGetPagingMethod() = "Printable") Then '' Dim nBlankRows As Integer = CInt(Val(eleSummaryRow.GetAttribute("AppendBlankRows"))) '' If nBlankRows <> 0 Then '' Dim nColSpan As Integer '' Try '' nColSpan = eleTableDef.SelectNodes("DataTableColumn").Count '' Finally : End Try '' Dim i As Integer '' For i = 1 To nBlankRows '' sTblSummaryRow &= "" & sLineBreak & "" '' Next '' End If ''End If If Not (eleSummaryRow.GetAttribute("PrinterPageBreak") = "True" And st.sGetRequestVar("rdPaging") = "Printable") Then Dim nBlankRows As Integer = CInt(Val(eleSummaryRow.GetAttribute("AppendBlankRows"))) If nBlankRows <> 0 Then Dim sLineBreak As String = "" If Not bExportNativeExcel() And Not bExportNativeWord() Then sLineBreak = "

    " End If Dim nColSpan As Integer Try nColSpan = eleTableDef.SelectNodes("DataTableColumn").Count Finally : End Try Dim i As Integer Dim sBlankRows As String = "" For i = 1 To nBlankRows sBlankRows = sBlankRows & "" & sLineBreak & "" Next If sBlankRows.Length <> 0 Then 'sTblSummaryRow &= "" & sBlankRows & "" sTblSummaryRow &= sBlankRows 'Fix 2800 End If End If End If If sGetPagingMethod() = "Interactive" Then If Not IsNothing(eleSummaryRow.SelectSingleNode("ancestor::*[InteractivePaging]")) Then 'Is there interactive paging? If eleSummaryRow.GetAttribute("FirstPageOnly") = "True" Then Dim eleDataLayer As XmlElement = eleTableDef.SelectSingleNode("//*[@Type=""Turbo""]") If Not IsNothing(eleDataLayer) Then sTblSummaryRow = "" & sTblSummaryRow & "" Else sTblSummaryRow = "" & sTblSummaryRow & "" End If ElseIf eleSummaryRow.GetAttribute("LastPageOnly") = "True" Then sTblSummaryRow = "" & sTblSummaryRow & "" End If End If End If If eleSummaryRow.Name = "HeaderRow" AndAlso st.sGetRequestVar("rdReportFormat") = "PDF" Then '12358.Repeatable Header Row.PDF Exports. If eleSummaryRow.GetAttribute("FirstPageOnly") <> "True" Then sTblSummaryRow = sTblSummaryRow.Replace(" 0 Then Dim tkn As Tokenizer.Token Dim nTokenNr As Integer = -1 Dim saTokens(tzr.Tokens.Length) As String '#10386 For Each tkn In tzr.Tokens Dim sXsl As String = "" nTokenNr += 1 'If Not tkn.Type.StartsWith("Replace") Then Select Case tkn.Type Case "Data", "Summary" Dim sTokenName As String = XmlConvert.EncodeLocalName(tkn.Name) 'Dim sTokenName As String = tkn.Name.Replace(" ", "_x0020_") Select Case typValue Case xslValueType.Element If tkn.SubType = "Parent" Then 'For DataRows. 'sXsl = "" ElseIf tkn.SubType.Length <> 0 Then 'For DataRows. 'sXsl = "" sXsl = "" Else 'For inside of data repeaters, like tables. 'If sFormat.Length = 0 Then '#5375 sXsl = "" sXsl = "" 'Else ' sXsl = "" 'End If End If Case xslValueType.Attribute If tkn.SubType.Length <> 0 Then 'For DataRows. '(Is this still used?) sXsl = "{/*/*/" & tkn.SubType & "/@" & sTokenName & "}" Else 'For inside of data repeaters, like tables. sXsl = "{@" & sTokenName & "}" End If End Select If tkn.Encodings.Length > 0 Then sXsl = sXsl.Replace("@" & sTokenName, "rdXslExtension:EncodeResolvedDataToken(@" & sTokenName & ",'" & String.Join("!", tkn.Encodings) & "')") End If sInput = sInput.Replace(tkn.Text, "rdToken" & nTokenNr) saTokens(nTokenNr) = sXsl Case "DataJScriptLink" Dim sTokenName As String = XmlConvert.EncodeLocalName(tkn.Name) 'Dim sTokenName As String = tkn.Name.Replace(" ", "_x0020_") Select Case typValue Case xslValueType.Element 'Probably not used for DataJScriptLink. If tkn.SubType.Length <> 0 Then 'For DataRows. '#5375 sXsl = "" sXsl = "" Else 'For inside of data repeaters, like tables. 'If sFormat.Length = 0 Then '#5375 sXsl = "" sXsl = "" 'Else ' sXsl = "" 'End If End If Case xslValueType.Attribute If tkn.SubType.Length <> 0 Then 'For DataRows. '(Is this still used?) 'Probably not used for DataJScriptLink. sXsl = "{/*/*/" & tkn.SubType & "/@" & sTokenName & "}" Else 'For inside of data repeaters, like tables. sXsl = "{rdXslExtension:JScriptUrlEncode(@" & sTokenName & ")}" End If End Select sInput = sInput.Replace(tkn.Text, "rdToken" & nTokenNr) saTokens(nTokenNr) = sXsl Case "DataJScript", "DataJScriptXml" Dim sTokenName As String = XmlConvert.EncodeLocalName(tkn.Name) 'Dim sTokenName As String = tkn.Name.Replace(" ", "_x0020_") Select Case typValue Case xslValueType.Element 'Probably not used for DataJScriptLink. If tkn.SubType.Length <> 0 Then 'For DataRows. '#5375 sXsl = "" sXsl = "" Else 'For inside of data repeaters, like tables. 'If sFormat.Length = 0 Then '#5375 sXsl = "" sXsl = "" 'Else ' sXsl = "" 'End If End If Case xslValueType.Attribute If tkn.SubType.Length <> 0 Then 'For DataRows. '(Is this still used?) 'Probably not used for DataJScriptLink. sXsl = "{/*/*/" & tkn.SubType & "/@" & sTokenName & "}" Else 'For inside of data repeaters, like tables. sXsl = "{rdXslExtension:JScriptXmlEncode(@" & sTokenName & ")}" End If End Select sInput = sInput.Replace(tkn.Text, "rdToken" & nTokenNr) saTokens(nTokenNr) = sXsl Case "DataJScriptParam" Dim sTokenName As String = XmlConvert.EncodeLocalName(tkn.Name) ''Dim sTokenName As String = tkn.Name.Replace(" ", "_x0020_") 'Select Case typValue ' Case xslValueType.Element ' 'Probably not used for DataJScriptLink. ' If tkn.SubType.Length <> 0 Then ' 'For DataRows. ' '#5375 sXsl = "" ' sXsl = "" ' Else ' 'For inside of data repeaters, like tables. ' 'If sFormat.Length = 0 Then ' '#5375 sXsl = "" ' sXsl = "" ' 'Else ' ' sXsl = "" ' 'End If ' End If ' Case xslValueType.Attribute ' If tkn.SubType.Length <> 0 Then ' 'For DataRows. ' '(Is this still used?) ' 'Probably not used for DataJScriptLink. ' sXsl = "{/*/*/" & tkn.SubType & "/@" & sTokenName & "}" ' Else 'For inside of data repeaters, like tables. sXsl = "{rdXslExtension:JScriptEncode(@" & sTokenName & ")}" 'This is for Confirm/alert messages. ' End If sInput = sInput.Replace(tkn.Text, "rdToken" & nTokenNr) saTokens(nTokenNr) = sXsl Case "DataHrefLink" Dim sTokenName As String = XmlConvert.EncodeLocalName(tkn.Name) 'Dim sTokenName As String = tkn.Name.Replace(" ", "_x0020_") Select Case typValue Case xslValueType.Element 'Probably not used for DataHrefLink. If tkn.SubType.Length <> 0 Then 'For DataRows. '#5375 sXsl = "" sXsl = "" Else 'For inside of data repeaters, like tables. 'If sFormat.Length = 0 Then '#5375 sXsl = "" sXsl = "" 'Else ' sXsl = "" 'End If End If Case xslValueType.Attribute If tkn.SubType.Length <> 0 Then 'For DataRows. '(Is this still used?) 'Probably not used for DataHrefLink. sXsl = "{/*/*/" & tkn.SubType & "/@" & sTokenName & "}" Else 'For inside of data repeaters, like tables. sXsl = "{rdXslExtension:HrefUrlEncode(@" & sTokenName & ")}" End If End Select sInput = sInput.Replace(tkn.Text, "rdToken" & nTokenNr) saTokens(nTokenNr) = sXsl Case "Function", "Functions" If tkn.Name = "RowNumber" Then Select Case typValue Case xslValueType.Element '#5375 sXsl = "" sXsl = "" Case xslValueType.Attribute sXsl = "{position() + $nPageRowCnt * ($nPageNr - 1)}" End Select sInput = sInput.Replace(tkn.Text, "rdToken" & nTokenNr) saTokens(nTokenNr) = sXsl End If End Select 'End If Next 'The tokens in sInput have been replaced by rdToken1, rdToken2,... 'HTML-encode the whole input string, then replace the tokens with the generated xsl. If bHtmlEncode Then sInput = rdUtility.HtmlEncode4(sInput) End If Dim i As Integer For i = nTokenNr To 0 Step -1 sInput = sInput.Replace("rdToken" & i, saTokens(i)) Next 'This handles the special case when tokens are seperated only by a single space. (Doesn't handle mulitple spaces.) sInput = sInput.Replace("/> "ActiveSQL" Then Dim aSort As String() = sSort.Split("~") Dim sDataColumn As String = aSort(1) Dim sDataType As String = aSort(2) Dim sSortOrder As String = aSort(3) Dim eleSortFilter As XmlElement = eleDef.OwnerDocument.CreateElement("SortFilter") eleSortFilter.SetAttribute("ID", "rdPanelDataTableSort") eleSortFilter.SetAttribute("SortColumn", sDataColumn) eleSortFilter.SetAttribute("DataType", sDataType) eleSortFilter.SetAttribute("SortSequence", sSortOrder) eleDataLayer.AppendChild(eleSortFilter) End If End If End If If eleDef.GetAttribute("DraggableColumns") = "True" Then Dim sDraggableColumnsOrder As String = HttpContext.Current.Session("rdDraggedColumns_" & sRequestedPage & "_" & eleDef.GetAttribute("ID")) If Not IsNothing(sDraggableColumnsOrder) Then 'Columns have been dragged. For Each sDrag As String In sDraggableColumnsOrder.Split(",") If sDrag.Length <> 0 Then Dim sFromColId As String = sDrag.Split(":")(0) Dim sToColId As String = sDrag.Split(":")(1) Dim nDirection As Integer = sDrag.Split(":")(2) 'Move column definitions under the main DataTable element. Dim eleFromColumn As XmlElement = eleDef.SelectSingleNode("DataTableColumn[@ID='" & sFromColId & "']") Dim eleToColumn As XmlElement = eleDef.SelectSingleNode("DataTableColumn[@ID='" & sToColId & "']") If nDirection > 0 Then eleDef.InsertAfter(eleDef.RemoveChild(eleFromColumn), eleToColumn) Else eleDef.InsertBefore(eleDef.RemoveChild(eleFromColumn), eleToColumn) End If End If Next End If End If If eleDef.GetAttribute("ResizableColumns") = "True" Then Dim sResizeableColumnsOrder As String = HttpContext.Current.Session("rdResizedColumns_" & sRequestedPage & "_" & eleDef.GetAttribute("ID")) If Not IsNothing(sResizeableColumnsOrder) Then 'Put all columns into a hashtable for lookup Dim colHashTable As Hashtable = New Hashtable() For Each sResizeIn As String In sResizeableColumnsOrder.Split(",") If sResizeIn.Length > 0 Then Dim columnID As String = sResizeIn.Split(":")(0) Dim width As Integer = sResizeIn.Split(":")(1) If Not colHashTable.ContainsKey(columnID) Then colHashTable.Add(columnID, width) End If End If Next 'Loop through the parent nodes that have column elements. These are COLS and THs and TDS. For Each eleSeq0 As XmlElement In eleDef.SelectNodes("DataTableColumn") If colHashTable.ContainsKey(eleSeq0.GetAttribute("ID")) Then eleSeq0.SetAttribute("Width", colHashTable(eleSeq0.GetAttribute("ID"))) eleSeq0.SetAttribute("WidthScale", "px") End If Next End If End If End Sub Private Shared Sub subRemoveSpecificElementsFromPanel(eleDef As XmlElement) Dim st As New rdState Dim aElements As String() = {"ZoomChart"} For Each sElement As String In aElements Dim eleElementToExclude As XmlElement = eleDef.SelectSingleNode(".//" & sElement) If Not IsNothing(eleElementToExclude) Then subRemoveBookmark(st.sGetRequestVar("rdBookmarkCollection"), st.sGetRequestVar("rdBookmarkID")) Throw New Exception(eleElementToExclude.Name & " is not supported in a Dashboard.") End If Next Dim aRemoveAtrs As String() = {"AnalysisGridID", "rdAcOriginalID"} For Each sRemoveAtr As String In aRemoveAtrs eleDef.RemoveAttribute(sRemoveAtr) Next End Sub Private Shared Sub subModifyOlapComponentsForDashboard(eleDef As XmlElement) Dim nlOlapComponentItems As XmlNodeList = eleDef.SelectNodes(".//Image | .//EventHandler | .//Action[@Type='Report']") Dim i As Integer = 0 Do While i < nlOlapComponentItems.Count '19638 Dim eleOlapTableImage As XmlElement = nlOlapComponentItems.ItemOf(i) i = i + 1 If Not IsNothing(eleOlapTableImage) Then eleOlapTableImage.ParentNode.RemoveChild(eleOlapTableImage) nlOlapComponentItems = eleDef.SelectNodes(".//Image | .//EventHandler | .//Action[@Type='Report']") i = i - 1 End If Loop End Sub Private Shared Sub subRemoveBookmark(sBookmarkCollection As String, sBookmarkId As String) Dim st As New rdState Dim xmlBookmarks As XmlDocument = Nothing Dim sFile As String = Nothing Call rdBookmark.subGetBookmarkCollection(st, sBookmarkCollection, Nothing, xmlBookmarks, sFile) Dim eleBookmark As XmlElement = xmlBookmarks.SelectSingleNode("//Bookmark[@BookmarkID='" & st.sGetRequestVar("rdBookmarkID") & "']") If Not IsNothing(eleBookmark) Then Dim sExtraFile As String = eleBookmark.GetAttribute("ExtraFile") If sExtraFile.Length <> 0 Then Try System.IO.File.Delete(rdBookmark.GetBookmarkLocation(st) & sExtraFile) Catch : End Try End If 'Remove the bookmark element. eleBookmark.ParentNode.RemoveChild(eleBookmark) Call rdBookmark.subSaveBookmarkCollection(xmlBookmarks, sFile) End If End Sub Private Function subModifySuperElementComponentsBeforeAddToDashboard(eleDef As XmlElement, eleDefDoc As XmlDocument) As XmlElement Call subReplaceLinkDLWithOriginalDL(eleDef, eleDefDoc) Dim isXolap As Boolean = True Dim eleNewDef As XmlElement = eleDef '21019 Dim isHeatMap As Boolean = False '24233 If eleDef.Name = "DataTable" AndAlso eleDef.GetAttribute("ID") = "dtAnalysisGrid" Then Dim nlDtColumns As XmlNodeList = eleDef.SelectNodes(".//DataTableColumn") For Each eleColumn As XmlElement In nlDtColumns Dim eleExtraColumnHeader As XmlElement = eleColumn.SelectSingleNode(".//ExtraColumnHeader") If Not IsNothing(eleExtraColumnHeader) Then Dim eleExtraColumnHeaderLabel As XmlElement = eleExtraColumnHeader.SelectSingleNode("Label") If Not IsNothing(eleExtraColumnHeaderLabel) Then eleColumn.SetAttribute("Header", eleExtraColumnHeaderLabel.GetAttribute("Caption")) End If End If Next Dim eleExtraHeader As XmlElement = eleDef.SelectSingleNode(".//ExtraColumnHeader[@ID='ExtraColumnHeader']") While Not IsNothing(eleExtraHeader) eleExtraHeader.ParentNode.RemoveChild(eleExtraHeader) eleExtraHeader = eleDef.SelectSingleNode(".//ExtraColumnHeader[@ID='ExtraColumnHeader']") End While End If If eleDef.Name = "DataTable" _ OrElse eleDef.Name = "CrosstabTable" Then Dim eleRemoveInteractivePaging As XmlElement = eleDef.SelectSingleNode("InteractivePaging[@Remove='True']") Do While Not IsNothing(eleRemoveInteractivePaging) eleDef.RemoveChild(eleRemoveInteractivePaging) eleRemoveInteractivePaging = eleDef.SelectSingleNode("InteractivePaging[@Remove='True']") Loop End If If eleDef.Name = "AnalysisChart" AndAlso eleDef.GetAttribute("AnalysisChartTypes") = "Heatmap" Then Dim ac As New rdAnalysisChart(Me, xmlSettings) Dim eleAg As XmlElement = ac.BuildAnalysisChart(eleDef) eleNewDef = eleAg.SelectSingleNode(".//ChartCanvas") isHeatMap = True End If Dim eleAnalysisFilterInsert As XmlElement = eleDef.SelectSingleNode(".//AnalysisFilterInsert") If Not IsNothing(eleAnalysisFilterInsert) Then 'Replace the insert with a CompareFilter. Dim eleDataLayerFiltered As XmlElement = eleAnalysisFilterInsert.SelectSingleNode("ancestor::DataLayer") Call rdAnalysisFilter.ReplaceAnalysisFilterInsert(eleDataLayerFiltered) End If ' If eleDef.Name = "Chart" Then ' Dim sOldValue As String = eleDef.GetAttribute("ID") ' Dim sNewValue As String = eleDef.GetAttribute("ID") & "_" & st.sGetRequestVar("rdUniqueIdentifier") '#19537, #21091 Making the Icon id and the Chart Id unique. ' Dim atr As XmlAttribute ' Dim nlAttrs As XmlNodeList = eleDef.SelectNodes(".//@*[contains(., '" & sOldValue & "')]") ' For Each atr In nlAttrs ' atr.Value = atr.Value.Replace(sOldValue, sNewValue) ' Next ' eleNewDef = rdChartToCanvas.GetCanvasChart(eleDef) ' Dim sThumbnailPath As String = rdAnalysisGrid10.subMakeChartThumbnail(st.sGetRequestVar("rdSaveFile"), eleNewDef) '#If JAVA Then ' sThumbnailPath = sThumbnailPath.Replace("\", "/") '22086 '#End If ' eleDef.SetAttribute("rdThumbnailPath", sThumbnailPath) ' eleNewDef.SetAttribute("rdThumbnailPath", sThumbnailPath) ' 'End If If eleDef.Name = "ChartCanvas" OrElse eleDef.Name = "Gauge" Then Dim sThumbnailPath As String = rdAnalysisGrid10.subMakeChartThumbnail(findSaveFilePath(eleDef, st), eleDef, st) #If JAVA Then sThumbnailPath = sThumbnailPath.Replace("\", "/") '22086 #End If eleDef.SetAttribute("rdThumbnailPath", sThumbnailPath) eleNewDef.SetAttribute("rdThumbnailPath", sThumbnailPath) End If Dim eleDataLayer As XmlElement = eleNewDef.SelectSingleNode("//DataLayer[@ID='dlOlapChart'] | //DataLayer[@ID='acCached']") 'xolap / olap chart or heatmap If Not IsNothing(eleDataLayer) Then Dim grpFilter As XmlElement = eleDataLayer.SelectSingleNode("GroupFilter") eleDataLayer.ParentNode.RemoveChild(eleDataLayer) Dim xmlOg As XmlDocument = LoadSuperElementDefFromSession("Og") For Each datalayer As XmlElement In xmlOg.SelectNodes("//DataLayer") Dim type As String = st.sGetAttribute(datalayer, "OriginalType") If Not String.IsNullOrEmpty(type) Then datalayer.SetAttribute("Type", type) End If Next Dim xolapCube As XmlElement = xmlOg.SelectSingleNode("//XolapCube") 'Xolap Chart or Heatmap Dim olapQuerryDL As XmlElement = xmlOg.SelectSingleNode("//OlapTable[@ID='otOlapGrid']//DataLayer [@Type='OlapMdx']") Dim olapQuerry As XmlElement If Not IsNothing(olapQuerryDL) Then olapQuerry = olapQuerryDL.SelectSingleNode("MdxQuery") 'olap Chart or Heatmap isXolap = IsNothing(olapQuerry) End If If Not IsNothing(xolapCube) OrElse Not IsNothing(olapQuerry) Then 'we can form Xolap / olap ChartCanvas here, and it will not be modified before adding to panel If isXolap Then xolapCube.RemoveChild(xolapCube.SelectSingleNode("DataLayer[@ ID='rdCachedData']")) End If Dim templateSeries As XmlElement = eleNewDef.SelectSingleNode(".//Series") 'series works as container for chart type and look & feel attributes Dim sTemplateColorAttr As String = "" Dim eleSeries As XmlElement = eleNewDef.SelectSingleNode(".//Series") While Not IsNothing(eleSeries) '25098 Dim sColorAttr As String = eleSeries.GetAttribute("Color") sTemplateColorAttr += IIf(String.IsNullOrEmpty(sTemplateColorAttr), sColorAttr, "," + sColorAttr) eleSeries.ParentNode.RemoveChild(eleSeries) eleSeries = eleNewDef.SelectSingleNode(".//Series") End While templateSeries.SetAttribute("Color", sTemplateColorAttr) Dim xolapQuerry As XmlElement If isXolap Then xolapCube = eleNewDef.OwnerDocument.ImportNode(xolapCube, True) xolapQuerry = eleNewDef.OwnerDocument.ImportNode(xmlOg.SelectSingleNode("//OlapTable//DataLayer[@Type='XolapQuery'] | //XolapTable[@ID='otOlapGrid']//DataLayer[@Type='XolapQuery']"), True) Else olapQuerryDL = eleNewDef.OwnerDocument.ImportNode(olapQuerryDL, True) olapQuerry = olapQuerryDL.SelectSingleNode("MdxQuery") 'after import this elements have different owner document End If If isHeatMap Then Dim aggrColor As XmlElement = eleDataLayer.SelectSingleNode(String.Format(".//GroupAggregateColumn[@ID='{0}']", st.sGetAttribute(templateSeries, "HeatmapColorDataColumn"))) templateSeries.SetAttribute("HeatmapColorDataColumn", st.sGetAttribute(aggrColor, "AggregateColumn")) Dim aggrSize As XmlElement = eleDataLayer.SelectSingleNode(String.Format(".//GroupAggregateColumn[@ID='{0}']", st.sGetAttribute(templateSeries, "HeatmapSizeDataColumn"))) templateSeries.SetAttribute("HeatmapSizeDataColumn", st.sGetAttribute(aggrSize, "AggregateColumn")) Dim labelColumn As String = st.sGetAttribute(templateSeries, "HeatmapLabelDataColumn") If labelColumn.Contains("formatted") Then 'we have formatted labels labelColumn = labelColumn.Replace("_formatted", "") templateSeries.SetAttribute("HeatmapLabelDataColumn", labelColumn) Dim labelStyle As XmlElement = eleNewDef.OwnerDocument.CreateElement("HeatmapLabelStyle") Dim formatLabel As XmlElement = eleDataLayer.SelectSingleNode(String.Format(".//FormattedColumn[@ID='{0}']", labelColumn)) labelStyle.SetAttribute("Format", st.sGetAttribute(formatLabel, "Format")) templateSeries.AppendChild(labelStyle) End If If isXolap Then xolapQuerry.AppendChild(grpFilter) Else olapQuerry.AppendChild(grpFilter) End If Else ' We need to remove auto-generated elements Dim eleQuicktip As XmlElement = templateSeries.SelectSingleNode("Quicktip") If eleQuicktip IsNot Nothing Then templateSeries.RemoveChild(eleQuicktip) End If If templateSeries.ParentNode IsNot Nothing Then '23755 Dim eleChartCanvasLegend As XmlElement = templateSeries.ParentNode.SelectSingleNode("ChartCanvasLegend") If eleChartCanvasLegend IsNot Nothing Then templateSeries.ParentNode.RemoveChild(eleChartCanvasLegend) End If End If templateSeries.RemoveAttribute("LegendLabel") End If Dim actionDrilldown As XmlElement = templateSeries.SelectSingleNode("Action[@Type='Report']") If Not IsNothing(actionDrilldown) Then actionDrilldown.ParentNode.RemoveChild(actionDrilldown) End If Dim olapChart As XmlDocument = New XmlDocument() olapChart.LoadXml(HttpContext.Current.Session(msRequestedPage & "_rdOgOlapChart_" & st.sGetRequestVar("rdPanelContentElementID"))) Dim positionLeft As String = st.sGetAttribute(olapChart.SelectSingleNode("OlapChart|OlapHeatmap"), "PositionLeft") Dim positionTop As String = st.sGetAttribute(olapChart.SelectSingleNode("OlapChart|OlapHeatmap"), "PositionTop") Dim positionsLeft As String() = positionLeft.Split("*") Dim positionsTop As String() = positionTop.Split("*") If (Not String.IsNullOrEmpty(positionLeft)) Then If positionsLeft.Length = 0 Then positionsLeft = New String() {positionLeft} End If End If Dim axisQuerryDimensions As XmlNodeList If (isXolap) Then axisQuerryDimensions = xolapQuerry.SelectNodes("XolapQueryAxisDimension [@Axis='Left']") Else axisQuerryDimensions = olapQuerry.SelectNodes("MdxAxisDimension [@Axis='Left']") End If If Not String.IsNullOrEmpty(positionLeft) Then 'If Not isHeatMap AndAlso isXolap Then ' positionsLeft(positionsLeft.Length - 1) = "" 'End If For Each leftAxisQuerry As XmlElement In axisQuerryDimensions For Each topMember As String In positionsLeft If topMember.Contains(st.sGetAttribute(leftAxisQuerry, "DimensionName")) Then If Not String.IsNullOrEmpty(topMember) Then leftAxisQuerry.SetAttribute("TopMember", topMember) Dim lastDrilldown As XmlElement = leftAxisQuerry.LastChild If Not IsNothing(lastDrilldown) Then lastDrilldown = lastDrilldown.CloneNode(True) leftAxisQuerry.InnerXml = "" 'for some reasons for olapCharts and heatmaps drilldowns with positionLeft works wrong leftAxisQuerry.AppendChild(lastDrilldown) 'we need only last drilldown 'End If End If End If Exit For End If Next Next ElseIf Not String.IsNullOrEmpty(positionTop) Then 'If (positionsTop.Length > 1) Then ' positionsTop(positionsTop.Length - 1) = "" ' If Not isHeatMap AndAlso isXolap Then ' positionsTop(positionsTop.Length - 2) = "" ' End If 'End If If isXolap Then axisQuerryDimensions = xolapQuerry.SelectNodes("XolapQueryAxisDimension [@Axis='Top']") Else axisQuerryDimensions = olapQuerry.SelectNodes("MdxAxisDimension [@Axis='Top']") End If For Each topAxisQuerry As XmlElement In axisQuerryDimensions For Each topMember As String In positionsTop If topMember.Contains(st.sGetAttribute(topAxisQuerry, "DimensionName")) Then If Not String.IsNullOrEmpty(topMember) Then topAxisQuerry.SetAttribute("TopMember", topMember) End If Exit For End If Next Next End If If isXolap Then eleNewDef.AppendChild(xolapQuerry) eleNewDef.AppendChild(xolapCube) Else eleNewDef.AppendChild(olapQuerryDL) End If For Each attr As XmlAttribute In templateSeries.SelectNodes("@ChartYDataColumn | @ChartXDataColumn | @HeatmapLabelDataColumn | @HeatmapSizeDataColumn | @HeatmapColorDataColumn") If Not String.IsNullOrEmpty(attr.Value) Then templateSeries.SetAttribute(attr.Name, XmlConvert.DecodeName(attr.Value)) End If Next eleNewDef.AppendChild(templateSeries) eleDef = eleNewDef End If End If subResolveTokensForAddToDashboard(eleDef) Return eleDef End Function Private Sub subResolveTokensForAddToDashboard(eleDef As XmlElement) Dim atrsTokens As XmlNodeList = eleDef.SelectNodes(".//@*[contains(., 'Request.')] | .//@*[contains(., 'Local.')]") Dim aTokenList As String() = {"Request", "Local"} For Each atrToken As XmlAttribute In atrsTokens atrToken.Value = st.sReplaceTokens(atrToken.Value, , , , , aTokenList, , , ) Next End Sub Shared Sub subBuildTokenListForCustomDashboardPanelsElementAttrs(eleDef As XmlElement) Dim eleCustomDashboardPanels As XmlElement = eleDef.SelectSingleNode(".//CustomDashboardPanels") If IsNothing(eleCustomDashboardPanels) Then Exit Sub Dim aTokenTypes As String() = {"Request", "Session"} For Each sTokenType As String In aTokenTypes Dim sTokenList As String = String.Empty Dim atrsTokens As XmlNodeList = eleDef.SelectNodes(".//@*[contains(., '" & sTokenType & ".')]") For Each atrToken As XmlAttribute In atrsTokens Dim tzr As New Tokenizer(atrToken.Value) Dim tok As Tokenizer.Token For Each tok In tzr.Tokens If tok.Text.Contains(sTokenType) Then If sTokenList.Contains(tok.Name & ",") Then Continue For sTokenList &= tok.Name & "," End If Next Next eleCustomDashboardPanels.SetAttribute("AddPanel" & sTokenType & "IDs", sTokenList) Next End Sub Private Function subGetDeepestElement(eleDef As XmlElement) As XmlElement Dim ele As XmlElement = eleDef.SelectSingleNode(eleDef.Name) If IsNothing(ele) Then Return eleDef Else subGetDeepestElement(ele) Return ele End If End Function Private Sub subReplaceLinkDLWithOriginalDL(eleDef As XmlElement, eleDefDoc As XmlDocument) If Not IsNothing(eleDef.SelectSingleNode(".//DataLayer[@Type='ActiveSQL']")) Then Dim eleActiveSQLDL As XmlElement = eleDef.SelectSingleNode(".//DataLayer[@Type='ActiveSQL']") eleActiveSQLDL.RemoveAttribute("rdResultsetGuid") '#19462. Dim eleEmptyDataLayer As XmlElement = eleDef.SelectSingleNode(".//DataLayer[@Type='EmptyDataLayer']") If Not IsNothing(eleEmptyDataLayer) Then eleEmptyDataLayer.ParentNode.RemoveChild(eleEmptyDataLayer) '#19584. End If Exit Sub 'We don't need to do anything for ActiveSQL. ElseIf Not IsNothing(eleDef.SelectSingleNode(".//DataLayer[@ID='rdCachedData']")) Then Dim eleCachedOlapDL As XmlElement = eleDef.SelectSingleNode(".//DataLayer[@ID='rdCachedData']") eleCachedOlapDL.ParentNode.RemoveChild(eleCachedOlapDL) Dim eleEmptyOlapDL As XmlElement = eleDef.SelectSingleNode(".//DataLayer[@Type='EmptyDataLayer']") eleEmptyOlapDL.SetAttribute("Type", eleEmptyOlapDL.GetAttribute("OriginalType")) End If Dim eleOriginalDataLayer As XmlElement = Nothing If eleDef.GetAttribute("rdAcIsAnalysisChart") = "True" _ OrElse eleDef.GetAttribute("rdAxIsAnalysisCrosstab") = "True" Then Dim eleAg As XmlElement = eleDefDoc.SelectSingleNode("//AnalysisGrid") If Not IsNothing(eleAg) Then 'AC or AX in an AG. Use the AG's DataLayer. eleOriginalDataLayer = eleAg.SelectSingleNode(".//DataTable//DataLayer[@TokenResolvedDataLayer='True']") End If End If If IsNothing(eleOriginalDataLayer) Then eleOriginalDataLayer = eleDefDoc.SelectSingleNode(".//DataLayer[@TokenResolvedDataLayer='True']") End If If Not IsNothing(eleOriginalDataLayer) Then Dim originalGroupFilters As XmlNodeList = eleOriginalDataLayer.SelectNodes("GroupFilter") For Each groupFilter As XmlElement In originalGroupFilters '22392 - Need to remove all existing sqlgroup and groupfilter elements if trying to export a chart. If Not IsNothing(groupFilter) And (eleDef.Name = "ChartCanvas" OrElse eleDef.Name = "Chart" OrElse eleDef.Name = "CrosstabTable") Then eleOriginalDataLayer.RemoveChild(groupFilter) End If Next If Not IsNothing(eleOriginalDataLayer.ParentNode) Then 'Remove the Token unresolved DL. eleOriginalDataLayer.ParentNode.ParentNode.RemoveChild(eleOriginalDataLayer.ParentNode) End If eleOriginalDataLayer.SetAttribute("Type", eleOriginalDataLayer.GetAttribute("OriginalType")) Dim bAnalysisChartOrCrosstab As Boolean = False Dim eleCachedDataLayer As XmlElement = eleDefDoc.SelectSingleNode(".//DataLayer[@ID='agCached']") 'There could be formulae..etc under this DL. This is the DL under the DataTable. If IsNothing(eleCachedDataLayer) Then eleCachedDataLayer = eleDefDoc.SelectSingleNode(".//DataLayer[@ID='acCached'] | .//DataLayer[@ID='axCached']") If Not IsNothing(eleCachedDataLayer) Then bAnalysisChartOrCrosstab = True End If End If If Not bAnalysisChartOrCrosstab Then If Not IsNothing(eleCachedDataLayer) Then 'Now move all the elements under the agCached DL to the Original Token resolved DL. For Each eleCachedDLChild As XmlElement In eleCachedDataLayer.ChildNodes 'Nest the user added Group filter under the group filter in the report def if any. If eleCachedDLChild.Name = "GroupFilter" AndAlso Not IsNothing(eleCachedDLChild.Attributes("ID")) AndAlso eleCachedDLChild.Attributes("ID").Value.StartsWith("rdAgGroup") Then Dim eleOriginalDLGroupFilter As XmlElement = eleOriginalDataLayer.SelectSingleNode("GroupFilter") If IsNothing(eleOriginalDLGroupFilter) Then If eleDef.Name = "DataTable" Then eleOriginalDataLayer.AppendChild(eleCachedDLChild.CloneNode(True)) End If Else If eleDef.Name = "DataTable" Then eleOriginalDataLayer.AppendChild(eleCachedDLChild.CloneNode(True)) Else eleOriginalDLGroupFilter = subGetDeepestElement(eleOriginalDLGroupFilter) 'Commented out beacuse the AG' DataTable DatalayerLink dresult set does not include the GroupFilter under the table. eleOriginalDLGroupFilter.AppendChild(eleCachedDLChild.CloneNode(True)) End If End If Else eleOriginalDataLayer.AppendChild(eleCachedDLChild.CloneNode(True)) End If Next End If End If If eleDef.Name = "DataTable" Then eleCachedDataLayer.ParentNode.ReplaceChild(eleOriginalDataLayer, eleCachedDataLayer) 'Replace the agCached Dl with the Original Token resolved DL. Else Dim eleDlUnderDef As XmlElement = eleDef.SelectSingleNode(".//DataLayer") 'The def is a Chart or a Crosstab Table. For Each eleDlUnderDefChild As XmlElement In eleDlUnderDef.ChildNodes If eleDlUnderDefChild.Name = "GroupFilter" Then 'Nest the user added Group filter under the group filter in the report def if any. Dim eleOriginalDLGroupFilter As XmlElement = eleOriginalDataLayer.SelectSingleNode("GroupFilter") If IsNothing(eleOriginalDLGroupFilter) Then eleOriginalDataLayer.AppendChild(eleDlUnderDefChild.CloneNode(True)) Else If (eleOriginalDLGroupFilter.ChildNodes.Count = 0) Then Dim filter As XmlNode = eleOriginalDLGroupFilter eleOriginalDLGroupFilter = eleOriginalDLGroupFilter.ParentNode eleOriginalDLGroupFilter.RemoveChild(filter) Else eleOriginalDLGroupFilter = subGetDeepestElement(eleOriginalDLGroupFilter) End If eleOriginalDLGroupFilter.AppendChild(eleDlUnderDefChild.CloneNode(True)) End If Else eleOriginalDataLayer.AppendChild(eleDlUnderDefChild.CloneNode(True)) End If Next eleDlUnderDef.ParentNode.ReplaceChild(eleOriginalDataLayer, eleDlUnderDef) End If Dim nlDLLink As XmlNodeList = eleDef.SelectNodes(".//DataLayerLink | .//DataLayer[@Type='Linked']") 'Remove the DataLayerLink elements if any. Dim iRow As Integer = 0 Do While iRow < nlDLLink.Count '19638 Dim eleDLLink As XmlElement = nlDLLink.ItemOf(iRow) iRow = iRow + 1 If Not IsNothing(eleDLLink) Then eleDLLink.ParentNode.RemoveChild(eleDLLink) nlDLLink = eleDef.SelectNodes(".//DataLayerLink | .//DataLayer[@Type='Linked']") 'Remove the DataLayerLink elements if any. iRow = iRow - 1 End If Loop 'Make the DataLayer look better. eleOriginalDataLayer.RemoveAttribute("ID") eleOriginalDataLayer.RemoveAttribute("FullResultsetRowCount") eleOriginalDataLayer.RemoveAttribute("OriginalType") eleOriginalDataLayer.RemoveAttribute("TokenResolvedDataLayer") Dim eleEmptyChildDl As XmlElement = eleOriginalDataLayer.SelectSingleNode("DataLayer") If Not IsNothing(eleEmptyChildDl) AndAlso st.sGetAttribute(eleOriginalDataLayer, "Type") <> "Cached" Then 'Should always be something. eleOriginalDataLayer.RemoveChild(eleEmptyChildDl) End If End If End Sub Friend Sub subModifyElementDefForGallery(ByRef elePanelContent As XmlElement, sRequestedPage As String) If Not IsNothing(elePanelContent) Then If elePanelContent.Name = "DataTable" Then subModifyDataTablesBeforeAddToDashboard(elePanelContent, sRequestedPage) elePanelContent.SetAttribute("ID", elePanelContent.GetAttribute("ID") & "_" & Now.Ticks) Else Dim eleDataTables As XmlNodeList = elePanelContent.SelectNodes(".//DataTable") For Each eleDef As XmlElement In eleDataTables subModifyDataTablesBeforeAddToDashboard(eleDef, sRequestedPage) Next End If subRemoveSpecificElementsFromPanel(elePanelContent) If elePanelContent.GetAttribute("FromOlapTable") = "True" OrElse elePanelContent.GetAttribute("OlapGrid") = "True" Then subModifyOlapComponentsForDashboard(elePanelContent) Exit Sub End If End If End Sub Private Function LoadSuperElementDefFromSession(sSuperElement As String) As XmlDocument Dim sElementId As String = st.sGetRequestVar("rd" & sSuperElement & "Id") Dim xmlDefFromSession As New XmlDocument() If sSuperElement = "Ag" Then Dim sCachedDefFilename As String = HttpContext.Current.Session("rdAgDefFile-" & sElementId) If File.Exists(sCachedDefFilename) Then xmlDefFromSession.Load(sCachedDefFilename) End If Else Dim sSessionDef As String = HttpContext.Current.Session("rd" & sSuperElement & "Def-" & sElementId) If Not String.IsNullOrEmpty(sSessionDef) Then xmlDefFromSession.LoadXml(sSessionDef) End If End If Return xmlDefFromSession End Function Private Function LoadAcDefFromSession() As XmlDocument Dim sElementId As String = st.sGetRequestVar("rdPanelContentElementID").Replace("rdAcChart_", "") Dim sSessionDef As String = HttpContext.Current.Session("rdAcDef-" & sElementId) Dim xmlDefFromSession As New XmlDocument() If Not String.IsNullOrEmpty(sSessionDef) Then xmlDefFromSession.LoadXml(sSessionDef) End If Return xmlDefFromSession End Function Private Function LoadOgDgDefintionFromSession() As XmlDocument Dim xmlDefFromSession As New XmlDocument() Dim sSessionDef As String = String.Empty If Not String.IsNullOrEmpty(st.sGetRequestVar("rdOgDataTable")) Then Dim xmlDoc As New XmlDocument() Dim xmlOg As XmlDocument = LoadSuperElementDefFromSession("Og") If Not IsNothing(xmlOg.DocumentElement) Then Dim eleOgTable As XmlElement = xmlOg.DocumentElement.SelectSingleNode(".//*[@ID='" & st.sGetRequestVar("rdPanelContentElementID") & "']") eleOgTable.SetAttribute("AddedToDashboard", "True") xmlDoc.LoadXml(eleOgTable.OuterXml) End If Return xmlDoc ElseIf Not String.IsNullOrEmpty(st.sGetRequestVar("rdOgChart")) Then sSessionDef = HttpContext.Current.Session(msRequestedPage & "_rdOgChart_" & st.sGetRequestVar("rdPanelContentElementID")) ElseIf Not String.IsNullOrEmpty(st.sGetRequestVar("rdOgHeatmap")) Then sSessionDef = HttpContext.Current.Session(msRequestedPage & "_rdOgHeatmap_" & st.sGetRequestVar("rdPanelContentElementID")) End If If Not String.IsNullOrEmpty(sSessionDef) Then xmlDefFromSession.LoadXml(sSessionDef) End If Return xmlDefFromSession End Function Friend Function GetSuperElementBuiltDef(ByRef elePanelContent As XmlElement, ByRef elePanelParams As XmlElement, ByRef eleCustomDashboardPanels As XmlElement) As Boolean If st.sGetRequestVar("rdAgAddToDashboard") = "True" Then Dim xmlAgSession As XmlDocument = LoadSuperElementDefFromSession("Ag") If Not IsNothing(xmlAgSession.DocumentElement) Then Dim sPanelContentElementID As String = st.sGetRequestVar("rdPanelContentElementID") elePanelContent = xmlAgSession.DocumentElement.SelectSingleNode(".//DataTable[@ID='" & sPanelContentElementID & "'] | .//AnalysisChart[@ID='" & sPanelContentElementID & "'] | .//AnalysisCrosstab[@ID='" & sPanelContentElementID & "']") If IsNothing(elePanelContent) Then _ Throw New Exception("Cannot find panel with ID=" & sPanelContentElementID) 'This should never happen. 'AnalysisChart If elePanelContent.Name = "AnalysisChart" Then 'Adding a chart from the AG. Get it from the AC. Dim eleAcDef As New XmlDocument eleAcDef.LoadXml(HttpContext.Current.Session("rdAcDef-" & sPanelContentElementID)) Dim eleAcChart As XmlElement = eleAcDef.SelectSingleNode("//ChartCanvas") If IsNothing(eleAcChart) Then 'It's a gauge instead of a chart. eleAcChart = eleAcDef.SelectSingleNode("//Gauge") End If 'Replace the AC with the ChartCanvas, and return that in elePanelContent. Dim eleAcParent As XmlElement = elePanelContent.ParentNode eleAcParent.ReplaceChild(elePanelContent.OwnerDocument.ImportNode(eleAcChart, True), elePanelContent) elePanelContent = eleAcParent.SelectSingleNode(eleAcChart.Name) End If 'AnalysisCrosstab If elePanelContent.Name = "AnalysisCrosstab" Then 'Adding a CrosstabTable from the AG. Get it from the AX. Dim eleAxDef As New XmlDocument eleAxDef.LoadXml(HttpContext.Current.Session("rdAxDef-" & sPanelContentElementID)) Dim eleCrosstabTable As XmlElement = eleAxDef.SelectSingleNode("//CrosstabTable") 'Replace the AX with the ChartCanvas, and return that in elePanelContent. Dim eleAxParent As XmlElement = elePanelContent.ParentNode eleAxParent.ReplaceChild(elePanelContent.OwnerDocument.ImportNode(eleCrosstabTable, True), elePanelContent) elePanelContent = eleAxParent.SelectSingleNode(eleCrosstabTable.Name) End If 'INFOGO SECURITY If Not String.IsNullOrEmpty(xmlAgSession.DocumentElement.GetAttribute("SecurityRightID")) Then elePanelContent.SetAttribute("SecurityRightID", xmlAgSession.DocumentElement.GetAttribute("SecurityRightID")) End If elePanelContent = subModifySuperElementComponentsBeforeAddToDashboard(elePanelContent, xmlAgSession) Else Return False End If ElseIf st.sGetRequestVar("rdAcAddToDashboard") = "True" Then Dim xmlAcSession As XmlDocument = LoadAcDefFromSession() If Not IsNothing(xmlAcSession.DocumentElement) Then elePanelContent = xmlAcSession.DocumentElement.SelectSingleNode(".//*[@ID='" & st.sGetRequestVar("rdPanelContentElementID") & "']") elePanelParams = xmlAcSession.DocumentElement.SelectSingleNode(".//*[@ID='" & st.sGetRequestVar("rdPanelParamsElementID") & "']") If Not IsNothing(eleCustomDashboardPanels) Then elePanelContent.AppendChild(elePanelContent.OwnerDocument.ImportNode(eleCustomDashboardPanels, True)) End If elePanelContent = subModifySuperElementComponentsBeforeAddToDashboard(elePanelContent, xmlAcSession) Else Return False End If ElseIf st.sGetRequestVar("rdOgAddToDashboard") = "True" Then Dim xmlOgSession As XmlDocument = LoadOgDgDefintionFromSession() If Not IsNothing(xmlOgSession.DocumentElement) Then elePanelContent = xmlOgSession.DocumentElement If Not IsNothing(eleCustomDashboardPanels) Then elePanelContent.AppendChild(elePanelContent.OwnerDocument.ImportNode(eleCustomDashboardPanels, True)) End If elePanelContent = subModifySuperElementComponentsBeforeAddToDashboard(elePanelContent, xmlOgSession) Else Return False End If ElseIf st.sGetRequestVar("rdDashboardEditVizType") = "AnalysisChart" Then 'For charts edited from Dashboard. Dim sPanelContentElementID As String = st.sGetRequestVar("rdPanelContentElementID") Dim xmlAcDef As New XmlDocument xmlAcDef.LoadXml(HttpContext.Current.Session("rdAcDef-" & sPanelContentElementID)) Dim eleAcChart As XmlElement = xmlAcDef.SelectSingleNode("//ChartCanvas") If IsNothing(eleAcChart) Then 'It's a gauge instead of a chart. eleAcChart = xmlAcDef.SelectSingleNode("//Gauge") End If elePanelContent = subModifySuperElementComponentsBeforeAddToDashboard(eleAcChart, xmlAcDef) ElseIf st.sGetRequestVar("rdDashboardEditVizType") = "AxTable" Then 'For crosstabs edited from Dashboard. Dim sPanelContentElementID As String = st.sGetRequestVar("rdPanelContentElementID") Dim xmlAxDef As New XmlDocument xmlAxDef.LoadXml(HttpContext.Current.Session("rdAxDef-" & sPanelContentElementID)) Dim eleAxTable As XmlElement = xmlAxDef.SelectSingleNode("//CrosstabTable") elePanelContent = subModifySuperElementComponentsBeforeAddToDashboard(eleAxTable, xmlAxDef) ElseIf st.sGetRequestVar("rdDashboardEditVizType") = "AgTable" Then 'For AG-generated tables edited from Dashboard. Dim sPanelContentElementID As String = st.sGetRequestVar("rdPanelContentElementID") Dim sSaveFilename As String = HttpContext.Current.Session("rdAgDefFile-" & sPanelContentElementID) Dim xmlAgDef As New XmlDocument xmlAgDef.Load(sSaveFilename) '''''''''HttpContext.Current.Session.Remove("rdAgDefFile-" & sPanelContentElementID) Dim eleAgTable As XmlElement = xmlAgDef.SelectSingleNode("//DataTable[@ID='dtAnalysisGrid']") elePanelContent = subModifySuperElementComponentsBeforeAddToDashboard(eleAgTable, xmlAgDef) End If Return True End Function Private Sub subAddPanelToDashboardGallery(ByVal xmlDef As XmlElement) Dim sElementID As String = st.sGetRequestVar("rdElementID") Dim sElementIDModifier As String = IIf(String.IsNullOrEmpty(sElementID), "", sElementID) Dim sSaveFile As String = findSaveFilePath(xmlDef, st) If String.IsNullOrEmpty(sSaveFile) Then Throw New Exception("DashboardSaveFile is required.") End If Dim sPanelContentHeight As String = st.sGetRequestVar("rdPanelContentHeight") Dim sPanelContentElementId As String = st.sGetRequestVar("rdPanelContentElementID") Dim sPanelParamsElementId As String = st.sGetRequestVar("rdPanelParamsElementID") Dim sPanelSkipElementIds As String = st.sGetRequestVar("rdPanelSkipElementIDs") Dim sPanelTitle As String = st.sGetRequestVar("rdPanelTitle" & sElementIDModifier) Dim sPanelDescription As String = st.sGetRequestVar("rdPanelDescription" & sElementIDModifier) Dim sPanelRequestIds As String = st.sGetRequestVar("rdPanelRequestIDs") Dim sPanelSessionIds As String = st.sGetRequestVar("rdPanelSessionIDs") Dim sPanelLocalDataIds As String = st.sGetRequestVar("rdPanelLocalDataIDs") Dim sPanelLocalDataLayerIds As String = st.sGetRequestVar("rdAddPanelLocalDataLayerIDs") Dim sPanelImage As String = st.sGetRequestVar("rdPanelImage") Dim sUniqueIdentifier As String = Guid.NewGuid.ToString.Replace("-", "") Dim sInstanceID As String = Guid.NewGuid.ToString.Replace("-", "") Dim bAddToDashboardFromSuperElement As Boolean = False If st.sGetRequestVar("rdAgAddToDashboard") = "True" _ OrElse st.sGetRequestVar("rdAcAddToDashboard") = "True" _ OrElse st.sGetRequestVar("rdAxAddToDashboard") = "True" _ OrElse st.sGetRequestVar("rdOgAddToDashboard") = "True" _ Then bAddToDashboardFromSuperElement = True End If Dim elePanelParams As XmlElement = xmlDef.SelectSingleNode(".//*[@ID='" & sPanelParamsElementId & "']") Dim elePanelContent As XmlElement = xmlDef.SelectSingleNode(".//*[@ID='" & sPanelContentElementId & "']") Dim sSecurityRightID As String = HttpContext.Current.Session("rdAgSecurityRightID") 'ElseIf Not IsNothing(elePanelContent) AndAlso elePanelContent.Name = "NgpVisualization" Then ' elePanelContent.SetAttribute("NgpVisualizaionConfig", st.sGetRequestVar("rdNgpDataVizConfig")) ' elePanelContent.SetAttribute("NgpDataview", st.sGetRequestVar("rdNgpDataViewName")) 'End If If sPanelContentElementId = "NGPviz" Then Dim eleWrapper As XmlElement = xmlDef.OwnerDocument.CreateElement("NgpVisualization") eleWrapper.SetAttribute("NgpVisualizaionConfig", st.sGetRequestVar("rdNgpDataVizConfig")) eleWrapper.SetAttribute("NgpDataview", st.sGetRequestVar("rdNgpDataViewName")) eleWrapper.SetAttribute("ID", "NGPviz_" + Guid.NewGuid().ToString()) Dim eleThinkspace As XmlElement = xmlDef.SelectSingleNode("//Thinkspace") eleThinkspace.SetAttribute("ThinkspaceConfig", st.sGetRequestVar("rdThinkspaceConfig")) Dim eleAQB As XmlElement = xmlDef.SelectSingleNode("//ActiveQueryBuilder") If Not IsNothing(eleAQB) Then eleThinkspace.AppendChild(eleAQB) End If Dim sSavedQB As String = HttpContext.Current.Session("rdThinkSpaceSavedQB") If Not String.IsNullOrEmpty(sSavedQB) Then eleAQB.InnerXml = sSavedQB End If eleWrapper.AppendChild(eleThinkspace) Dim sLogiApplicationServiceID As String = eleThinkspace.GetAttribute("LogiApplicationServiceID") eleWrapper.SetAttribute("LogiApplicationServiceID", sLogiApplicationServiceID) eleWrapper.SetAttribute("LogiTheme", st.sGetRequestVar("rdNgpDataLogiTheme")) eleWrapper.SetAttribute("DataViewId", st.sGetRequestVar("rdDataViewId")) Dim xml As New XmlDocument() Dim eleThinkspaceDataLayer As XmlElement = eleThinkspace.SelectSingleNode(".//DataLayer") 'RD19830 - get dlayer under the thinkspace element. If IsNothing(eleThinkspaceDataLayer) Then 'SSRM Metadata builder If Not IsNothing(HttpContext.Current.Session(rdBookmark.GetSuperElementDef(eleThinkspace))) Then 'XML is in session xml.LoadXml(HttpContext.Current.Session(rdBookmark.GetSuperElementDef(eleThinkspace))) ElseIf Not IsNothing(HttpContext.Current.Session(rdBookmark.GetSuperElementDefFromFile(eleThinkspace))) Then 'XML is in file xml.Load(HttpContext.Current.Session(rdBookmark.GetSuperElementDefFromFile(eleThinkspace))) End If 'does it have query builder? Dim eleActiveSqlDataLayer As XmlElement = xml.DocumentElement.SelectSingleNode(".//SavedQueryBuilder/DataLayer[@MetadataID and @QueryBuilderTableID]") If Not IsNothing(eleActiveSqlDataLayer) Then eleActiveSqlDataLayer.SetAttribute("Type", "ActiveSQL") eleThinkspaceDataLayer = eleActiveSqlDataLayer Dim eleEmptyDataLayer As XmlElement = eleActiveSqlDataLayer.SelectSingleNode("DataLayer[@Type='EmptyDataLayer']") If Not IsNothing(eleEmptyDataLayer) Then eleEmptyDataLayer.ParentNode.RemoveChild(eleEmptyDataLayer) End If Else eleThinkspaceDataLayer = xml.SelectSingleNode("//DataLayer") End If If Not IsNothing(eleThinkspaceDataLayer) Then eleWrapper.AppendChild(xmlDef.OwnerDocument.ImportNode(eleThinkspaceDataLayer, True)) End If Else eleWrapper.AppendChild(eleThinkspaceDataLayer) End If Dim eleResizer As XmlElement = xmlDef.OwnerDocument.CreateElement("Resizer") eleWrapper.AppendChild(eleResizer) elePanelContent = eleWrapper 'INFOGO SECURITY If Not String.IsNullOrEmpty(sSecurityRightID) Then elePanelContent.SetAttribute("SecurityRightID", sSecurityRightID) End If End If Dim eleCustomDashboardPanels As XmlElement = xmlDef.SelectSingleNode("//CustomDashboardPanels") If Not GetSuperElementBuiltDef(elePanelContent, elePanelParams, eleCustomDashboardPanels) Then If Not String.IsNullOrEmpty(st.sGetRequestVar("rdBookmarkCollection")) Then subRemoveBookmark(st.sGetRequestVar("rdBookmarkCollection"), st.sGetRequestVar("rdBookmarkID")) End If Exit Sub End If If IsNothing(elePanelContent) Then If Not String.IsNullOrEmpty(st.sGetRequestVar("rdBookmarkCollection")) Then subRemoveBookmark(st.sGetRequestVar("rdBookmarkCollection"), st.sGetRequestVar("rdBookmarkID")) End If Throw New Exception("The AddPanelContentElementID is not valid.") Exit Sub End If 'INFOGO SECURITY 'If Not String.IsNullOrEmpty(xmlDef.GetAttribute("SecurityRightID")) Then ' elePanelContent.SetAttribute("SecurityRightID", xmlDef.GetAttribute("SecurityRightID")) 'End If Call subModifyElementDefForGallery(elePanelContent, msRequestedPage) Dim eleDLLinked As XmlElement = elePanelContent.SelectSingleNode(".//DataLayer[@Type='Linked']") If Not IsNothing(eleDLLinked) Then '#19614. If Not eleDLLinked.ParentNode.Name = "ExtraXYLayer" Then '#20268. Throw New Exception("The DataLayer.Linked cannot be used with Action.AddDashboardPanel") End If End If 'Remove the skip elements. If Not IsNothing(elePanelParams) Then If Not String.IsNullOrEmpty(sPanelSkipElementIds) Then Dim aSkipElements As String() = sPanelSkipElementIds.Split(",") For i As Integer = 0 To aSkipElements.Length - 1 Dim sSkipElementId As String = aSkipElements(i).Trim() Dim eleSkipElement As XmlElement = elePanelParams.SelectSingleNode(".//*[@ID='" & sSkipElementId & "']") If Not IsNothing(eleSkipElement) Then eleSkipElement.ParentNode.RemoveChild(eleSkipElement) End If Next End If End If Dim docDashboardSaveFile As XmlDocument = New XmlDocument() If Not File.Exists(sSaveFile) Then Call subCreateDashboardSaveFile(sSaveFile) End If docDashboardSaveFile.Load(sSaveFile) ' Get the root element of the Dashboard Save file. Dim eleSavedDashboardElement As XmlElement = docDashboardSaveFile.SelectSingleNode("rdSavedDashboard") If IsNothing(eleSavedDashboardElement) Then Throw New Exception() Dim eleDashboardTabs As XmlElement = eleSavedDashboardElement.SelectSingleNode("//*/Tabs[@ID='rdDashboardTabs']") Dim eleCustomPanelDefinition As XmlElement = eleSavedDashboardElement.SelectSingleNode("ExtraPanelDefinition") Dim eleMobileDashboardDefinition As XmlElement = eleSavedDashboardElement.SelectSingleNode("rdSavedMobileDashboard") If IsNothing(eleCustomPanelDefinition) Then ' Create the ExtraPanelDefinition if it doesn't exist. eleCustomPanelDefinition = docDashboardSaveFile.CreateElement("ExtraPanelDefinition") eleSavedDashboardElement.AppendChild(docDashboardSaveFile.ImportNode(eleCustomPanelDefinition, True)) eleCustomPanelDefinition = eleSavedDashboardElement.SelectSingleNode("ExtraPanelDefinition") End If ' Create the Panel element Dim eleCustomPanel As XmlElement = docDashboardSaveFile.CreateElement("Panel") eleCustomPanel.SetAttribute("Caption", sPanelTitle) eleCustomPanel.SetAttribute("PanelDescription", sPanelDescription) eleCustomPanel.SetAttribute("SaveTime", rdUtility.ConvertToISODateFormat(Now)) 'Not adding to Dboard from a superelement, in this case check for the panel security id set by the action. RD19504 If Not bAddToDashboardFromSuperElement Then sSecurityRightID = st.sGetRequestVar("rdPanelSecurityRightID") End If If Not String.IsNullOrEmpty(sSecurityRightID) Then eleCustomPanel.SetAttribute("SecurityRightID", sSecurityRightID) End If Dim sCustomPanelID As String = If(sPanelContentElementId = "NGPviz", String.Format("rdCustomDashboardPanel_NGPviz_{0}", sUniqueIdentifier), "rdCustomDashboardPanel_" & sUniqueIdentifier) eleCustomPanel.SetAttribute("ID", sCustomPanelID) eleCustomPanel.SetAttribute("rdUniqueIdentifier", sUniqueIdentifier) eleCustomPanelDefinition.AppendChild(eleCustomPanel) 'Remove the chart caption. This is for adding an AC chart, which will have a panel title. If elePanelContent.Name = ("ChartCanvas") _ AndAlso elePanelContent.GetAttribute("rdUnderSuperElement") = "True" _ AndAlso elePanelContent.GetAttribute("ID").Contains("AnalysisChart") Then elePanelContent.RemoveAttribute("ChartCaption") End If If sPanelContentElementId = "NGPviz" Then Dim isTableNgpViz As Boolean = st.sGetRequestVar("rdNgpDataVizConfig").Contains("""type"":""table""") Dim isCrosstabTableNgpViz As Boolean = st.sGetRequestVar("rdNgpDataVizConfig").Contains("""type"":""crosstabTable""") Dim placeHolderImg As String = "rdThumbnailPath" If isTableNgpViz Then placeHolderImg = "table_rdNGPvisualPlaceHolder.png" ElseIf isCrosstabTableNgpViz Then placeHolderImg = "crosstabTable_rdNGPvisualPlaceHolder.png" Else Dim ngpViz As New NgpVisualization(Me, xmlSettings, st, dbug) placeHolderImg = ngpViz.CreateThumbnail(elePanelContent, sSaveFile) End If If Not String.IsNullOrEmpty(elePanelContent.GetAttribute("rdThumbnailPath")) Then eleCustomPanel.SetAttribute("Image", elePanelContent.GetAttribute("rdThumbnailPath")) Else eleCustomPanel.SetAttribute("Image", String.Format("../rdTemplate/rdDiscovery/{0}", placeHolderImg)) End If 'NGP-5238 SSM only- Filtering using 'In List' returns an empty list for Discovery visualizations Dim eleNgpVizDataLayer As XmlElement = elePanelContent.SelectSingleNode("DataLayer") If Not IsNothing(eleNgpVizDataLayer) AndAlso eleNgpVizDataLayer.HasAttribute("rdResultsetGuid") Then eleNgpVizDataLayer.RemoveAttribute("rdResultsetGuid") End If End If ' Create the PanelParams element. Dim eleCustomPanelParams As XmlElement = Nothing If Not IsNothing(elePanelParams) Then eleCustomPanelParams = docDashboardSaveFile.CreateElement("PanelParameters") eleCustomPanelParams.SetAttribute("AllowCaptionRename", "True") eleCustomPanelParams.SetAttribute("RefreshForCancel", "True") eleCustomPanel.AppendChild(eleCustomPanelParams) eleCustomPanelParams.AppendChild(eleCustomPanelParams.OwnerDocument.ImportNode(elePanelParams, True)) ' Add the elements to be exported here. End If ' Create the PanelContent element. Dim eleCustomPanelContent As XmlElement = docDashboardSaveFile.CreateElement("PanelContent") eleCustomPanelContent.SetAttribute("Height", sPanelContentHeight) eleCustomPanel.AppendChild(eleCustomPanelContent) eleCustomPanelContent.AppendChild(eleCustomPanelContent.OwnerDocument.ImportNode(elePanelContent, True)) ' Add the elements to be exported here. 'We have to be sure, that table id will be unique Dim eleMainContentElement As XmlElement = eleCustomPanelContent.SelectSingleNode("./XolapTable | ./OlapTable | ./CrosstabTable") If Not IsNothing(eleMainContentElement) Then eleMainContentElement.SetAttribute("ID", String.Format("{0}_{1}", st.sGetAttribute(eleMainContentElement, "ID"), Guid.NewGuid.ToString)) End If ' Add the Panel to the List of Dashboard Panels. Dim elePanelDefined As XmlElement Dim eleFirstTab As XmlElement Dim sFirstTabID As String ' Check to see if the Tabs exist. If IsNothing(eleDashboardTabs) Then elePanelDefined = docDashboardSaveFile.SelectSingleNode("//*/Panel[@ID='" & sCustomPanelID & "']") sFirstTabID = String.Empty Else Dim sActiveTabID As String = eleDashboardTabs.GetAttribute("ActiveTabID") If String.IsNullOrEmpty(sActiveTabID) Then eleFirstTab = eleDashboardTabs.SelectSingleNode("Tab") Else eleFirstTab = eleDashboardTabs.SelectSingleNode("//*/Tab[@ID='" & sActiveTabID & "']") End If sFirstTabID = eleFirstTab.GetAttribute("ID") elePanelDefined = docDashboardSaveFile.SelectSingleNode("//*/Panel[@TabID='" & sFirstTabID & "' and @ID='" & sCustomPanelID & "']") End If If IsNothing(elePanelDefined) Then ' Add the panel to the first tab in the Save file. elePanelDefined = docDashboardSaveFile.CreateElement("Panel") elePanelDefined.SetAttribute("ID", sCustomPanelID) elePanelDefined.SetAttribute("InstanceID", sInstanceID) If Not String.IsNullOrEmpty(sFirstTabID) Then _ elePanelDefined.SetAttribute("TabID", sFirstTabID) elePanelDefined.SetAttribute("DashboardColumn", "0") ' to the first dashboard column. eleSavedDashboardElement.PrependChild(elePanelDefined) If Not IsNothing(eleMobileDashboardDefinition) Then eleMobileDashboardDefinition.PrependChild(elePanelDefined.CloneNode(True)) End If End If eleCustomPanel.SetAttribute("rdCustomDashboardPanel", "True") ' Attribute gets looked up in the Dashboard code. 'Set the default request params. If Not bAddToDashboardFromSuperElement Then 'This block should only run for anAction.AddDashboardPanel element. If Not String.IsNullOrEmpty(sPanelRequestIds) Then Dim eleDefaultRequestParams As XmlElement = docDashboardSaveFile.CreateElement("DefaultRequestParams") eleDefaultRequestParams.SetAttribute("ID", "CustomDashboardDefaultRequestParams") Dim aPanelRequestIds As String() = sPanelRequestIds.Split(",") For i As Integer = 0 To aPanelRequestIds.Length - 1 Dim sPanelRequestId As String = aPanelRequestIds(i).Trim() eleDefaultRequestParams.SetAttribute(sPanelRequestId, st.sReplaceTokens("@Request." & sPanelRequestId & "~")) Next eleCustomPanel.PrependChild(eleDefaultRequestParams) End If 'Set the Session variables. If Not String.IsNullOrEmpty(sPanelSessionIds) Then Dim eleCustomDasboardSessionVariables As XmlElement = docDashboardSaveFile.SelectSingleNode(".//ExtraPanelDefinition/SetSessionVariables") If IsNothing(eleCustomDasboardSessionVariables) Then eleCustomDasboardSessionVariables = docDashboardSaveFile.CreateElement("SetSessionVariables") eleCustomDasboardSessionVariables.SetAttribute("ID", "CustomDashoardSessionVariables") Dim eleCustomDasboardSessionParams As XmlElement = eleCustomDasboardSessionVariables.OwnerDocument.CreateElement("SessionParams") Dim aPanelSessionIds As String() = sPanelSessionIds.Split(",") For i As Integer = 0 To aPanelSessionIds.Length - 1 Dim sPanelSessionId As String = aPanelSessionIds(i).Trim() eleCustomDasboardSessionParams.SetAttribute(sPanelSessionId, st.sReplaceTokens("@Session." & sPanelSessionId & "~")) Next eleCustomDasboardSessionVariables.AppendChild(eleCustomDasboardSessionParams) End If eleCustomPanel.PrependChild(eleCustomDasboardSessionVariables) End If 'Set the Local Data. If Not String.IsNullOrEmpty(sPanelLocalDataIds) Then Dim aPanelLocalDataIds As String() = sPanelLocalDataIds.Split(",") Dim eleDefLocalDataLayer As XmlElement = docDashboardSaveFile.CreateElement("LocalData") eleDefLocalDataLayer.SetAttribute("ID", "dlLocal") Dim eleDatalayerStatic As XmlElement = docDashboardSaveFile.CreateElement("DataLayer") eleDatalayerStatic.SetAttribute("Type", "Static") Dim eleStaticDataRow As XmlElement = docDashboardSaveFile.CreateElement("StaticDataRow") eleDatalayerStatic.AppendChild(eleStaticDataRow) eleDefLocalDataLayer.AppendChild(eleDatalayerStatic) For i As Integer = 0 To aPanelLocalDataIds.Length - 1 Dim sPanelLocalDataId As String = aPanelLocalDataIds(i).Trim() Dim sLocalDataTokenValue As String = st.sReplaceTokens(String.Format("@Local.{0}~", sPanelLocalDataId)) If Not String.IsNullOrEmpty(sLocalDataTokenValue) Then eleStaticDataRow.SetAttribute(sPanelLocalDataId, sLocalDataTokenValue) End If Next eleCustomPanel.PrependChild(eleDefLocalDataLayer) End If 'Copy the Local Data. If Not String.IsNullOrEmpty(sPanelLocalDataLayerIds) Then Dim aPanelLocalDataLayerIds As String() = sPanelLocalDataLayerIds.Split(",") For i As Integer = 0 To aPanelLocalDataLayerIds.Length - 1 Dim sReportLocalDataId As String = aPanelLocalDataLayerIds(i).Trim() Dim eleLocalDataToCopy As XmlElement = xmlDef.SelectSingleNode(String.Format("//LocalData[@ID='{0}']", sReportLocalDataId)) If Not IsNothing(eleLocalDataToCopy) Then Dim eleClonnedLocalData As XmlElement = eleCustomPanel.OwnerDocument.ImportNode(eleLocalDataToCopy, True) eleCustomPanel.PrependChild(eleClonnedLocalData) End If Next End If End If eleCustomPanel.SetAttribute("MultipleInstances", IIf(st.sGetRequestVar("rdMultipleInstances").ToLower = "true", "True", "False")) If Not String.IsNullOrEmpty(elePanelContent.GetAttribute("rdThumbnailPath")) Then eleCustomPanel.SetAttribute("Image", elePanelContent.GetAttribute("rdThumbnailPath")) ElseIf sPanelImage.Length <> 0 Then '25009 eleCustomPanel.SetAttribute("Image", sPanelImage) End If 'Do not add the link to the Bookmark if no value is provided for BookmarkCollection attribute. If Not String.IsNullOrEmpty(st.sGetRequestVar("rdBookmarkCollection")) AndAlso Not String.IsNullOrEmpty(st.sGetRequestVar("rdBookmarkID")) Then eleCustomPanel.SetAttribute("BookmarksCollection", st.sGetRequestVar("rdBookmarkCollection")) eleCustomPanel.SetAttribute("BookmarkId", st.sGetRequestVar("rdBookmarkID")) 'Create the Link back to original report. Dim eleExportWrapper As XmlElement = eleCustomPanelContent.OwnerDocument.CreateElement("Division") eleExportWrapper.SetAttribute("ShowModes", "rdBrowser") eleExportWrapper.SetAttribute("Class", "rdBookmarkLinkbackContainer") Dim eleNewLine As XmlElement = eleCustomPanelContent.OwnerDocument.CreateElement("LineBreak") eleNewLine.SetAttribute("LineCount", 2) eleExportWrapper.AppendChild(eleNewLine) Dim eleBookmarkLinkback As XmlElement = eleCustomPanelContent.OwnerDocument.CreateElement("Label") eleBookmarkLinkback.SetAttribute("Caption", st.sGetRequestVar("rdBookmarkLinkbackCaption")) Dim eleBookmarkLinkbackAction As XmlElement = eleCustomPanelContent.OwnerDocument.CreateElement("Action") eleBookmarkLinkbackAction.SetAttribute("ID", "actRunBookmark") eleBookmarkLinkbackAction.SetAttribute("Type", "RunBookmark") eleBookmarkLinkbackAction.SetAttribute("Report", st.sGetRequestVar("rdBookmarkReport")) eleBookmarkLinkbackAction.SetAttribute("BookmarkID", st.sGetRequestVar("rdBookmarkID")) eleBookmarkLinkbackAction.SetAttribute("BookmarkCollection", st.sGetRequestVar("rdBookmarkCollection")) eleExportWrapper.AppendChild(eleBookmarkLinkback) eleBookmarkLinkback.AppendChild(eleBookmarkLinkbackAction) Dim eleBookmarkLinkbackTarget As XmlElement = eleCustomPanelContent.OwnerDocument.CreateElement("Target") eleBookmarkLinkbackTarget.SetAttribute("Type", "RunBookmark") eleBookmarkLinkbackTarget.SetAttribute("FrameID", st.sGetRequestVar("rdBookmarkFrameID")) eleBookmarkLinkbackAction.AppendChild(eleBookmarkLinkbackTarget) eleCustomPanelContent.AppendChild(eleExportWrapper) End If eleCustomPanel.SetAttribute("rdMakeIdsUnique", "True") 'This runs the Dashboard code that makes the panels and its children along with tokens unique. Dim bExit As Boolean = False 'RD19968, a user can have this open to save while another one tries - retry in that case. Dim bRetryCount As Integer = 0 While bExit = False Try docDashboardSaveFile.Save(sSaveFile) bExit = True Catch ex As Exception If bRetryCount > 4 Then Exit While ' Ok tried 5 times, this is some other issue not multiple users accessing the same file.abort retry. End If bExit = False bRetryCount += 1 End Try End While End Sub Private Shared Function findSaveFilePath(ByVal xmlDef As XmlElement, ByVal st As rdState) As String Dim eleDashboardSaveFile As XmlElement = xmlDef.SelectSingleNode("//CustomDashboardPanels[@DashboardSaveFile]") Dim sSaveFilePath As String = String.Empty If eleDashboardSaveFile Is Nothing Then Dim nlDboardSaveFiles As XmlNodeList = xmlDef.SelectNodes("//Action[@Type='AddDashboardPanel' and @DashboardSaveFile]") 'RD20381 If nlDboardSaveFiles.Count = 1 Then eleDashboardSaveFile = nlDboardSaveFiles(0) ElseIf nlDboardSaveFiles.Count > 1 Then eleDashboardSaveFile = xmlDef.SelectSingleNode("//Action[@Type='AddDashboardPanel' and @DashboardSaveFile and @ID='" & st.sGetRequestVar("rdElementId").Substring(1) & "']") If eleDashboardSaveFile Is Nothing Then Throw New Exception("An ID for every AddDashboardPanel action is required.") End If End If If eleDashboardSaveFile Is Nothing Then Return "" End If End If Return st.sGetAttribute(eleDashboardSaveFile, "DashboardSaveFile") End Function Private Sub subCreateDashboardSaveFile(ByVal sDashboardSavedFilePath As String) ' Subroutine creates the save file if it does not exist at the path provided. Dim xmlSavedDashboardFile As New XmlDocument() xmlSavedDashboardFile.LoadXml("") Dim eleSavedDashboardTabs As XmlElement = xmlSavedDashboardFile.DocumentElement.AppendChild(xmlSavedDashboardFile.CreateElement("Tabs")) eleSavedDashboardTabs.SetAttribute("ID", "rdDashboardTabs") Dim sFirstTabId As String = Guid.NewGuid.ToString.Replace("-", "") eleSavedDashboardTabs.SetAttribute("ActiveTabID", sFirstTabId) eleSavedDashboardTabs.SetAttribute("DashboardColumnCount", "3") Dim eleSavedDashboardTab As XmlElement = eleSavedDashboardTabs.AppendChild(xmlSavedDashboardFile.CreateElement("Tab")) eleSavedDashboardTab.SetAttribute("ID", sFirstTabId) eleSavedDashboardTab.SetAttribute("Caption", "New Tab") Call rdUtility.EnsureDirectoryExists(sDashboardSavedFilePath) Dim bExit As Boolean = False Dim bRetryCount As Integer = 0 While bExit = False Try xmlSavedDashboardFile.Save(sDashboardSavedFilePath) bExit = True Catch ex As Exception If bRetryCount > 4 Then Exit While ' Ok tried 5 times, this is some other issue not multiple users accessing the same file.abort retry. End If bExit = False bRetryCount += 1 End Try End While End Sub Private nPopupCnt As Integer = 0 Friend Function sSetAction(ByVal eleDef As XmlElement, ByVal sHtmlElement As String) As String sSetAction = sHtmlElement Dim sAction As String = "" 'Dim sAddPopupJScripts As String = "" Dim sAddPopupActions As String = "" Dim eleAction As XmlElement = Nothing Dim nlChildActions As XmlNodeList = eleDef.SelectNodes("Action") If nlChildActions.Count > 1 AndAlso IsNothing(eleDef.SelectSingleNode("Action[@Type='Popup']")) AndAlso IsNothing(eleDef.SelectSingleNode("ancestor::ChartCanvas")) _ AndAlso Not (eleDef.Name = "PopupOption") Then ' eleAction = CreatePopupMenusForMultipleActions(eleDef, nlChildActions) ElseIf nlChildActions.Count > 0 Then eleAction = nlChildActions.Item(0) End If If IsNothing(eleAction) Then Exit Function If http.Request("rdWysiwygEdit") = "True" Then 'Normally shouldn't check for request variables here but it's OK for this. If eleAction.ParentNode.Name = "Button" Then Exit Function End If End If If Not IsNothing(HttpContext.Current.Items("rdIsWidgetRequest")) Then 'Widget request. If eleAction.GetAttribute("Type") = "Report" Then Dim eleTarget As XmlElement = eleAction.SelectSingleNode("Target") If Not IsNothing(eleTarget) Then If eleTarget.GetAttribute("FrameID").Length = 0 Then eleTarget.SetAttribute("FrameID", "Top") End If End If End If End If Dim sCallback As String = st.sGetAttribute(eleAction, "PostRefreshJavascript", "null") If sCallback <> "null" Then sCallback = String.Format("function(){{{0}}}", sCallback) End If 'Check for wait page Dim eleWait As XmlElement = eleAction.SelectSingleNode(".//WaitPage") Dim sShowWait As String = "null" If eleWait IsNot Nothing Then 'Configure wait panel sShowWait = "['" & sEscapeAndTokenize(eleWait.GetAttribute("Caption"), "'") & "','" & sEscapeAndTokenize(eleWait.GetAttribute("Class"), "'") & "','" & sEscapeAndTokenize(eleWait.GetAttribute("CaptionClass"), "'") & "']" End If If eleDef.Name = "InputText" Then 'Currently we're only doing Actions on input fields for "InputText" for use of the paging control. 'If eleAction.GetAttribute("Type") = "Click" Then Dim eleTarget As XmlElement = eleAction.SelectSingleNode("Target") 'If IsNothing(eleTarget) Then _ ' Throw New Exception("Action elements must have a single Target element.") Select Case eleAction.GetAttribute("Type") Case "Report" 'Call subAddIncludedScript("rdActionSubmit2.js") Dim sFrameId As String = eleTarget.GetAttribute("FrameID") If sFrameId.Length <> 0 Then Select Case sFrameId Case "NewWindow" sFrameId = "_blank" '#18142 sShowWait = "null" Case "Parent" sFrameId = "_parent" Case "Top" sFrameId = "_top" Case "Self" sFrameId = "_self" End Select End If Dim sAjaxCommand As String = eleAction.GetAttribute("rdAjaxCommand") Dim sDataTablePaging As String = eleAction.GetAttribute("rdDataTablePaging") '20543 Dim sSubmitFunction As String = "SubmitForm('rdPage.aspx?rdReport=" & sGetTarget(eleTarget, TargetType.TargetType_JScript) & "'" If sDataTablePaging <> "True" AndAlso sAjaxCommand <> "UpdateTreeBranchRows" Then _ sSubmitFunction &= ",'" & sFrameId & "', 'false', null, null, " & sShowWait sSubmitFunction &= ")" sAction = " onChange=""javascript:" & sSubmitFunction & """" If IsNothing(eleDef.SelectSingleNode("//Action[@EnterKeyDefault=""True""]")) Then '#9203 sAction &= " onkeypress=""javascript:if(window.event!=null){{if(window.event.keyCode == 13){{ " & sSubmitFunction & ";return false;}}}}""" 'the "return false;" prevents the entire form from begin submitted if the user clicks "Enter". Also see 11515. ' {Brackets are doubled-up to prevent XSLT errors.} End If sAction = sAction.Replace("@Request.", "@RequestJScriptLink.") If sDataTablePaging = "True" Then Dim sTableID As String = eleAction.GetAttribute("rdRefreshElementID") sAction = sAction.Replace("SubmitForm('rdPage.aspx?", "rdAjaxRequestWithFormVars('" & sTableID & "-PageNr=' + document.getElementById('" & sTableID & "-PageNr').value + '&") mbAddAjaxSupport = True ElseIf sAjaxCommand = "UpdateTreeBranchRows" Then sAction = sAction.Replace("SubmitForm('rdPage.aspx?", "rdAjaxRequest('") mbAddAjaxSupport = True End If End Select sSetAction = sHtmlElement.Insert(sHtmlElement.IndexOf(">"), sAction) 'End If ElseIf eleDef.Name = "InputSelectList" Then 'This is an undocumented feature, added to support the AnalysisGrid. Select Case eleAction.GetAttribute("Type") Case "Link" Dim eleTarget As XmlElement = eleAction.SelectSingleNode("Target") If IsNothing(eleTarget) Then _ Throw New Exception("Action elements must have a single Target element.") Dim sTarget As String = sGetTarget(eleTarget, TargetType.TargetType_JScript) 'Stuff was take out here that would support different window frames and Javascript confirmation. Dim sFrameID As String = "" Dim sValidate As String = "false" Dim sFeatures As String = "" Dim sConfirm As String = "" Dim sSubmitFunction As String = "NavigateLink2('" & sTarget.Replace("'", "\'") & "','" & sFrameID & "','" & sValidate & "','" & sFeatures & "','" & sConfirm & "')" 'Call subAddIncludedScript("rdActionSubmit2.js") sAction = " onChange=""javascript:" & sSubmitFunction & """" sAction = sAction.Replace("@Request.", "@RequestJScriptLink.") End Select sSetAction = sHtmlElement.Insert(sHtmlElement.IndexOf(">"), sAction) 'End If Else 'All other control types. Handled with an
    tag. 'eleTarget = eleAction.SelectSingleNode("Target") 'MIGHT NEED TO CHANGE THIS to loop through a collection of targets. 'If IsNothing(eleTarget) Then _ ' Throw New Exception( "Action elements must have a single Target element.") Dim sValidate As String = "false" If eleAction.GetAttribute("Validate") = "True" Then _ sValidate = "true" Dim sConfirm As String = sEscapeAndTokenizeJs(eleAction.GetAttribute("ConfirmMessage"), "'") If eleAction.GetAttribute("Type") = "Exit" Then 'Convert the Action.Exit into an Action.Link. 'The user will be directed to rdPage, which will abandon the session, 'then redirect the user to the Link. eleAction.SetAttribute("Type", "Link") Dim eleTarget As XmlElement = eleAction.SelectSingleNode("Target") If IsNothing(eleTarget) Then _ Throw New Exception("Action.Exit elements must have a single Target element.") eleTarget.SetAttribute("Link", "rdPage.aspx?rdLogoffRedirect=" & eleTarget.GetAttribute("Link")) End If If eleAction.GetAttribute("Type") = "AddDashboardPanel" Then Dim sActionID As String = eleAction.GetAttribute("ID") Static aPrevActionIDs As New ArrayList() If aPrevActionIDs.Contains(sActionID) Then '19542-DashBoard/Panel elements must have Unique ID error when trying to add charts. Dim sUniqueIdentifier As String = "_" & Guid.NewGuid.ToString.Replace("-", "") If sActionID.Contains("_") Then Dim sTicks As String = sActionID.Substring(sActionID.LastIndexOf("_")) If sTicks.Length >= 18 Then sUniqueIdentifier = "" End If End If eleAction.SetAttribute("ID", eleAction.GetAttribute("ID") & sUniqueIdentifier) Else aPrevActionIDs.Add(sActionID) End If Dim xmlAddtoDashboardTemplate As XmlDocument = rdUtility.GetSuperElementTemplate("rdAddToDashboardTemplate.lgx") Dim eleAddToDashboardShowElementAction As XmlElement = xmlAddtoDashboardTemplate.SelectSingleNode(".//Action") Dim elePopupPanel As XmlElement = xmlAddtoDashboardTemplate.SelectSingleNode(".//PopupPanel") Dim eleAddToDashboardButton As XmlElement = xmlAddtoDashboardTemplate.SelectSingleNode(".//Label[@ID='lblAddToDashboard']") Dim eleAddToDashboardPanelTitle As XmlElement = xmlAddtoDashboardTemplate.SelectSingleNode(".//InputText[@ID='rdPanelTitle']") Dim eleAddToDashboardPanelDescription As XmlElement = xmlAddtoDashboardTemplate.SelectSingleNode(".//InputTextArea[@ID='rdPanelDescription']") Dim eleAddToDashboardSubmitAction As XmlElement = xmlAddtoDashboardTemplate.SelectSingleNode(".//Action[@Type='RefreshElement']") Dim eleAddToDashboardHidePoupAction As XmlElement = xmlAddtoDashboardTemplate.SelectSingleNode(".//Action[@ID='actHidePopup']") Dim eleAddToDashboardBookmarkAction As XmlElement = xmlAddtoDashboardTemplate.SelectSingleNode(".//Action[@ID='actAddBookmark']") Dim eleAddToDashboardBookmarkEvent As XmlElement = xmlAddtoDashboardTemplate.SelectSingleNode(".//EventHandler[@ID='evtBookmark']") Dim eleBookmarkLinkBack As XmlElement = eleAction.SelectSingleNode(".//BookmarkLinkback") Dim eleLinkParams As XmlElement = xmlAddtoDashboardTemplate.SelectSingleNode(".//LinkParams") eleAddToDashboardShowElementAction.SetAttribute("ID", eleAction.GetAttribute("ID")) 'Make the Id's of the PopupPanel and its children by appending the AddToDashboard Action Id. Dim sElementUniqueIdentifier As String = "_" & eleAction.GetAttribute("ID") eleAddToDashboardShowElementAction.SetAttribute("ElementID", eleAddToDashboardShowElementAction.GetAttribute("ElementID") & sElementUniqueIdentifier) elePopupPanel.SetAttribute("ID", elePopupPanel.GetAttribute("ID") + sElementUniqueIdentifier) eleAddToDashboardPanelTitle.SetAttribute("ID", eleAddToDashboardPanelTitle.GetAttribute("ID") + sElementUniqueIdentifier) eleAddToDashboardPanelDescription.SetAttribute("ID", eleAddToDashboardPanelDescription.GetAttribute("ID") + sElementUniqueIdentifier) eleAddToDashboardSubmitAction.SetAttribute("ID", eleAddToDashboardSubmitAction.GetAttribute("ID") + sElementUniqueIdentifier) eleAddToDashboardSubmitAction.SetAttribute("ElementID", eleAddToDashboardSubmitAction.GetAttribute("ElementID") & sElementUniqueIdentifier) 'eleAddToDashboardHidePoupAction.SetAttribute("ElementID", eleAddToDashboardHidePoupAction.GetAttribute("ElementID") & sElementUniqueIdentifier) eleAddToDashboardBookmarkAction.SetAttribute("ID", eleAddToDashboardBookmarkAction.GetAttribute("ID") + sElementUniqueIdentifier) eleLinkParams.SetAttribute("rdElementID", sElementUniqueIdentifier) If String.IsNullOrEmpty(st.sGetAttribute(eleAction, "AddPanelContentElementID")) Then Throw New Exception("AddPanelContentElementID is required.") End If eleLinkParams.SetAttribute("rdPanelContentElementID", st.sGetAttribute(eleAction, "AddPanelContentElementID")) eleLinkParams.SetAttribute("rdPanelContentHeight", st.sGetAttribute(eleAction, "AddPanelContentHeight")) eleLinkParams.SetAttribute("rdPanelParamsElementID", st.sGetAttribute(eleAction, "AddPanelParamsElementID")) eleLinkParams.SetAttribute("rdPanelSkipElementIDs", st.sGetAttribute(eleAction, "AddPanelSkipElementIDs")) eleLinkParams.SetAttribute("rdPanelTitle", st.sGetAttribute(eleAction, "AddPanelTitle")) eleLinkParams.SetAttribute("rdPanelDescription", st.sGetAttribute(eleAction, "AddPanelDescription")) eleLinkParams.SetAttribute("rdPanelRequestIDs", st.sGetAttribute(eleAction, "AddPanelRequestIDs")) eleLinkParams.SetAttribute("rdPanelSessionIDs", st.sGetAttribute(eleAction, "AddPanelSessionIDs")) eleLinkParams.SetAttribute("rdPanelLocalDataIDs", st.sGetAttribute(eleAction, "AddPanelLocalDataIDs")) eleLinkParams.SetAttribute("rdAddPanelLocalDataLayerIDs", st.sGetAttribute(eleAction, "AddPanelLocalDataLayerIDs")) eleLinkParams.SetAttribute("rdPanelImage", st.sGetAttribute(eleAction, "Image")) eleLinkParams.SetAttribute("rdMultipleInstances", st.sGetAttribute(eleAction, "MultipleInstances")) eleLinkParams.SetAttribute("rdPanelSecurityRightID", st.sGetAttribute(eleAction, "AddPanelSecurityRightID")) If Not IsNothing(eleDef.SelectSingleNode("ancestor::AnalysisGrid")) OrElse st.sGetAttribute(eleAction, "AgAddToDashboard") = "True" Then '26066 - conflicts with query builder plugin and discovery element If Not eleAction.GetAttribute("AddPanelContentElementID") = "NGPviz" Then eleLinkParams.SetAttribute("rdAgAddToDashboard", "True") End If ElseIf Not IsNothing(eleDef.SelectSingleNode("ancestor::AnalysisChart")) OrElse st.sGetAttribute(eleAction, "AcAddToDashboard") = "True" Then eleLinkParams.SetAttribute("rdAcAddToDashboard", "True") ElseIf Not IsNothing(eleDef.SelectSingleNode("ancestor::AnalysisCrosstab")) OrElse st.sGetAttribute(eleAction, "AxAddToDashboard") = "True" Then eleLinkParams.SetAttribute("rdAxAddToDashboard", "True") ElseIf Not IsNothing(eleDef.SelectSingleNode("ancestor::OlapGrid")) OrElse st.sGetAttribute(eleAction, "OgAddToDashboard") = "True" Then eleLinkParams.SetAttribute("rdOgAddToDashboard", "True") If Not String.IsNullOrEmpty(st.sGetAttribute(eleAction, "OgDataTable")) Then eleLinkParams.SetAttribute("rdOgDataTable", "True") ElseIf Not String.IsNullOrEmpty(st.sGetAttribute(eleAction, "OgChart")) Then If Not IsNothing(eleAction.OwnerDocument.DocumentElement.SelectSingleNode(".//OlapChart/ChartCanvas")) Then eleLinkParams.SetAttribute("rdPanelContentElementID", CType(eleAction.OwnerDocument.DocumentElement.SelectSingleNode(".//OlapChart/ChartCanvas"), XmlElement).GetAttribute("ID")) End If eleLinkParams.SetAttribute("rdOgChart", "True") ElseIf Not String.IsNullOrEmpty(st.sGetAttribute(eleAction, "OgHeatmap")) Then eleLinkParams.SetAttribute("rdOgHeatmap", "True") End If elePopupPanel.SetAttribute("rdNoElementShowHistory", "True") End If eleLinkParams.SetAttribute("rdUniqueIdentifier", Guid.NewGuid.ToString.Replace("-", "")) eleLinkParams.SetAttribute("rdPopupCaption", st.sGetAttribute(eleAction, "AddPanelPopupCaption", "Add Panel")) eleLinkParams.SetAttribute("rdAddButtonCaption", st.sGetAttribute(eleAction, "AddPanelButtonCaption", "Add Panel")) eleLinkParams.SetAttribute("rdSecurityRightID", st.sGetAttribute(eleAction, "SecurityRightID")) If Not String.IsNullOrEmpty(st.sGetAttribute(eleAction, "AddPanelSkipLocalData")) Then eleLinkParams.SetAttribute("rdSkipLocalData", st.sGetAttribute(eleAction, "AddPanelSkipLocalData")) End If 'RD20052 - We should probably be removing the 'addbookmark' event from this action when it is run from any element under the AG definition. Dim bRemoveAddDbBookmarkEvent As Boolean = False If eleAction.GetAttribute("AddPanelContentElementID") = "dtAnalysisGrid" OrElse eleAction.GetAttribute("AddPanelContentElementID").StartsWith("AnalChart_") _ OrElse eleAction.GetAttribute("AddPanelContentElementID").StartsWith("AnalCrosstab_") Then bRemoveAddDbBookmarkEvent = True End If ' If Not eleAction.GetAttribute("AddPanelContentElementID") = "NGPviz" Then If IsNothing(eleBookmarkLinkBack) Then eleAddToDashboardBookmarkEvent.ParentNode.RemoveChild(eleAddToDashboardBookmarkEvent) ElseIf eleAction.GetAttribute("AddPanelContentElementID") = "NGPviz" Then eleAddToDashboardBookmarkEvent.ParentNode.RemoveChild(eleAddToDashboardBookmarkEvent) ElseIf String.IsNullOrEmpty(rdBookmark.GetCollectionNameFromAttr(st, eleBookmarkLinkBack)) Then eleAddToDashboardBookmarkEvent.ParentNode.RemoveChild(eleAddToDashboardBookmarkEvent) ElseIf bRemoveAddDbBookmarkEvent Then eleAddToDashboardBookmarkEvent.ParentNode.RemoveChild(eleAddToDashboardBookmarkEvent) Else '23824 'Call subAddIncludedScript("rdAjax/rdAjax2.js") 'Call subAddIncludedScript("rdBookmark.js") Dim sAddToDashboardBookmark As String = eleAddToDashboardBookmarkAction.GetAttribute("Javascript") sAddToDashboardBookmark = sAddToDashboardBookmark.Replace("actAddBookmark", eleAddToDashboardBookmarkAction.GetAttribute("ID")) sAddToDashboardBookmark = sAddToDashboardBookmark.Replace("sReport", msRequestedPage) sAddToDashboardBookmark = sAddToDashboardBookmark.Replace("sBookmarkReqIds", st.sGetAttribute(eleAction, "AddPanelRequestIDs")) sAddToDashboardBookmark = sAddToDashboardBookmark.Replace("sBookmarkSessionIds", st.sGetAttribute(eleAction, "AddPanelSessionIDs")) sAddToDashboardBookmark = sAddToDashboardBookmark.Replace("sCollection", rdBookmark.GetCollectionNameFromAttr(st, eleBookmarkLinkBack)) sAddToDashboardBookmark = sAddToDashboardBookmark.Replace("sName", st.sGetAttribute(eleBookmarkLinkBack, "BookmarkName")) sAddToDashboardBookmark = sAddToDashboardBookmark.Replace("sDescription", st.sGetAttribute(eleBookmarkLinkBack, "BookmarkDescription")) Dim sBookmarkId As String = Guid.NewGuid.ToString sAddToDashboardBookmark = sAddToDashboardBookmark.Replace("sBookmarkId", sBookmarkId) eleAddToDashboardBookmarkAction.SetAttribute("Javascript", sAddToDashboardBookmark) eleLinkParams.SetAttribute("rdBookmarkLinkbackCaption", st.sGetAttribute(eleBookmarkLinkBack, "Caption")) eleLinkParams.SetAttribute("rdBookmarkCollection", rdBookmark.GetCollectionNameFromAttr(st, eleBookmarkLinkBack)) eleLinkParams.SetAttribute("rdBookmarkID", sBookmarkId) eleLinkParams.SetAttribute("rdBookmarkReport", msRequestedPage) eleLinkParams.SetAttribute("rdBookmarkFrameID", st.sGetAttribute(eleBookmarkLinkBack, "FrameID")) End If 'End If elePopupPanel.SetAttribute("Caption", st.sGetAttribute(eleAction, "AddPanelPopupCaption", "Add Panel")) eleAddToDashboardPanelTitle.SetAttribute("DefaultValue", st.sGetAttribute(eleAction, "AddPanelTitle")) eleAddToDashboardPanelDescription.SetAttribute("DefaultValue", st.sGetAttribute(eleAction, "AddPanelDescription")) eleAddToDashboardButton.SetAttribute("Caption", st.sGetAttribute(eleAction, "AddPanelButtonCaption", "Add Panel")) eleAction = eleAddToDashboardShowElementAction.CloneNode(True) eleAddToDashboardShowElementAction.ParentNode.RemoveChild(eleAddToDashboardShowElementAction) eleDef.OwnerDocument.DocumentElement.AppendChild(eleDef.OwnerDocument.ImportNode(elePopupPanel, True)) 'Adding elePopupPanel to the highest level helps prevent popup positioning or style problems caused by being under other elements (says Ben, sounds good.) End If Select Case eleAction.GetAttribute("Type") Case "Link" Dim eleTarget As XmlElement = eleAction.SelectSingleNode("Target") 'Dim sTarget As String = sGetTarget(eleTarget, TargetType.TargetType_URL) Dim sTarget As String = sGetTarget(eleTarget, TargetType.TargetType_JScript) 'sAction = " href="" " & sTarget & """" ' Dim sFrameId As String = eleTarget.GetAttribute("FrameID") If eleTarget.GetAttribute("LinkModal") = "True" Then _ sFrameId = "_modal" 'This value is used later. If sFrameId.Length <> 0 Then If sFrameId.Length <> 0 Then Select Case sFrameId Case "NewWindow" sFrameId = "_blank" '#18142 sShowWait = "null" Case "Parent" sFrameId = "_parent" Case "Top" sFrameId = "_top" Case "Self" sFrameId = "_self" End Select End If If sFrameId.Contains("@") Then _ sFrameId = sTokenToXsl(sFrameId, xslValueType.Attribute) 'This helps tokens be used for the FrameID. Not documented, this is being do for the ReportCenter. End If Dim sFeatures As String = "" Dim sWindowTop As String = eleTarget.GetAttribute("WindowTop") Dim sWindowLeft As String = eleTarget.GetAttribute("WindowLeft") Dim sWindowWidth As String = eleTarget.GetAttribute("WindowWidth") Dim sWindowHeight As String = eleTarget.GetAttribute("WindowHeight") Dim sWindowResize As String = eleTarget.GetAttribute("WindowResizable") Dim sWindowScroll As String = eleTarget.GetAttribute("WindowScrollable") If sWindowTop.Length <> 0 Then sFeatures += "dialogTop:" & sWindowTop & "px;" If sWindowLeft.Length <> 0 Then sFeatures += "dialogLeft:" & sWindowLeft & "px;" If sWindowWidth.Length <> 0 Then sFeatures += "dialogWidth:" & sWindowWidth & "px;" If sWindowHeight.Length <> 0 Then sFeatures += "dialogHeight:" & sWindowHeight & "px;" If sWindowResize.Length <> 0 Then sFeatures += "resizable:" & IIf(sWindowResize = "True", "yes", "no") & ";" If sWindowScroll.Length <> 0 Then sFeatures += "scroll:" & IIf(sWindowScroll = "True", "yes", "no") & ";" '12225 If sFrameId <> "_modal" Then sFeatures = sFeatures.Replace("dialog", "").Replace(":", "=").Replace(";", ",").Replace("scroll", "scrollbars").ToLower 'sAction = " href=""javascript:NavigateLink2('" & sTarget.Replace("'", "\'") & "','" & sFrameID & "','" & sValidate & "','" & sFeatures & "','" & sConfirm & "')""" If eleAction.GetAttribute("CrawlerFriendly") = "True" Then If eleAction.ParentNode.Name = "Chart" Then _ Throw New Exception("Cannot use CrawlerFriendly=True for Actions under Charts.") 'Include the href without any JScript just for the crawler/spider, but the onclick is what runs the link. sAction = " href=""" & st.sRemoveTokens(sTarget) & """" sAction &= " onclick=""NavigateCrawlerFriendly('" & sTarget.Replace("'", "\'") & "','" & sFrameId & "','" & sValidate & "','" & sFeatures & "','" & sConfirm & "'); return false;""" ElseIf eleAction.GetAttribute("PostInputElements") = "True" Then If sFeatures.Length <> 0 Then _ Throw New Exception("Cannot use Modal and Window positioning attributes with PostInputElements=""True"".") sAction = " href=""javascript:SubmitForm('" & sTarget.Replace("'", "\'") & "','" & sFrameId & "','" & sValidate & "','" & sConfirm & "',HrefOrClick," & sShowWait & ")""" '#6549 Else sAction = " href=""javascript:NavigateLink2('" & sTarget.Replace("'", "\'") & "','" & sFrameId & "','" & sValidate & "','" & sFeatures & "','" & sConfirm & "'," & sShowWait & ",HrefOrClick)""" End If 'Call subAddIncludedScript("rdActionSubmit2.js") Try ' This code is only used in the case of 'Add Bookmarks' where a an action element is added as a child for the current action element. Dim eleChildAction As XmlElement = eleAction.SelectSingleNode("Action") If Not IsNothing(eleChildAction) Then eleDef.AppendChild(eleAction.RemoveChild(eleChildAction)) eleDef.RemoveChild(eleAction) Dim sScript As String = Me.sGetTarget(eleTarget, TargetType.TargetType_JScript).Replace("javascript:", "") Dim sChildAction As String = Me.sSetAction(eleDef, sHtmlElement) If sChildAction.Contains("javascript:") Then 'Should be this or "onclick". sChildAction = sChildAction.Insert(sChildAction.IndexOf("javascript:") + "javascript:".Length, sScript & ";") ElseIf sChildAction.Contains("onClick=""") Then sChildAction = sChildAction.Insert(sChildAction.IndexOf("onClick=""") + "onClick=""".Length, sScript & ";") End If Return sChildAction End If Catch End Try Case "Report", "Export", "PDF", "CSV", "NativeExcel", "NativeWord", "XML", "Template", "Widget", "GoogleSpreadsheet" Dim eleTarget As XmlElement = eleAction.SelectSingleNode("Target") Dim sTarget As String = sGetTarget(eleTarget, TargetType.TargetType_JScript) Dim sFrameId As String = eleTarget.GetAttribute("FrameID") If http.Request("lgxPreview") <> "" Then '24484 http.Session("rdIsInLgxStudioPreviewMode") = "True" End If If Array.IndexOf("NativeExcel,CSV".Split(","), eleAction.GetAttribute("Type")) <> -1 AndAlso http.Session("rdIsInLgxStudioPreviewMode") <> "" Then If sFrameId = "NewWindow" Then sFrameId = "Self" End If If sFrameId.Length <> 0 Then Select Case sFrameId Case "NewWindow" sFrameId = "_blank" '#18142 sShowWait = "null" Case "Parent" sFrameId = "_parent" Case "Top" sFrameId = "_top" Case "Self" sFrameId = "_self" End Select If sFrameId.Contains("@") Then _ sFrameId = sTokenToXsl(sFrameId, xslValueType.Attribute) 'This helps tokens be used for the FrameID. Not documented, this is being do for the ReportCenter. End If If eleAction.GetAttribute("CrawlerFriendly") = "True" Then If eleAction.ParentNode.Name = "Chart" Then _ Throw New Exception("Cannot use CrawlerFriendly=True for Actions under Charts.") 'Include the href without any JScript just for the crawler/spider, but the onclick is what runs the link. sAction = " href=""rdPage.aspx?rdReport=" & sTarget & """" sAction &= " onclick=""SubmitFormCrawlerFriendly('rdPage.aspx?rdReport=" & sTarget.Replace("'", "\'") & "','" & sFrameId & "','" & sValidate & "','" & sConfirm & "'); return false;""" ElseIf eleAction.GetAttribute("rdAjaxCommand").Length <> 0 Then 'sAction &= " href=""javascript:rdAjaxRequest('rdAjaxCommand=" & eleAction.GetAttribute("rdAjaxCommand") & "&rdReport=" & sTarget.Replace("'", "\'") & "')""" sAction &= " href=""javascript:rdAjaxRequest('rdReport=" & sTarget.Replace("'", "\'") & "','" & sValidate & "','" & sConfirm & "', null, " & sCallback & ", " & sShowWait & ")""" mbAddAjaxSupport = True Else sAction &= " href=""javascript:SubmitForm('rdPage.aspx?rdReport=" & sTarget.Replace("'", "\'") & "','" & sFrameId & "','" & sValidate & "','" & sConfirm & "',HrefOrClick," & sShowWait & ")""" End If If eleAction.GetAttribute("Type") = "Template" Then _ sAction = sAction.Replace("rdReport=", "rdTemplate=") sAction = sAction.Replace("@Request.", "@RequestJScriptLink.") 'Call subAddIncludedScript("rdActionSubmit2.js") Case "AppDev" 'Go to an AppDev page. 'Enhanced to pass parameters as normal-style URL parameters. Dim eleTarget As XmlElement = eleAction.SelectSingleNode("Target") Dim sLgxTarget As String = eleTarget.GetAttribute("Type").Replace("AppDev", "").Replace("Frameset", "Frame") 'Turn this AppDev Action into a normal Link Action, then remove this link and process the new one. Dim eleLinkAction As XmlElement = xmlDef.CreateElement("Action") eleLinkAction.SetAttribute("Type", "Link") eleLinkAction.SetAttribute("ID", eleAction.GetAttribute("ID")) eleLinkAction.SetAttribute("Validate", eleAction.GetAttribute("Validate")) Dim eleLinkTarget As XmlElement = xmlDef.CreateElement("Target") eleLinkTarget.SetAttribute("Type", "Link") eleLinkTarget.SetAttribute("ID", eleTarget.GetAttribute("ID")) eleLinkTarget.SetAttribute("FrameID", eleTarget.GetAttribute("FrameID")) Dim sLinkUrl As String = eleTarget.GetAttribute("AppDevPath") If sLinkUrl.EndsWith("/") Then sLinkUrl = sLinkUrl.Substring(0, sLinkUrl.Length - 1) 'Take off a trailing /. sLinkUrl += "/lgx_Engine/lgx_" & sLgxTarget & ".aspx" eleLinkTarget.SetAttribute("Link", sLinkUrl) Dim eleLinkLPs As XmlElement = xmlDef.CreateElement("LinkParams") eleLinkLPs.SetAttribute("Action", eleTarget.GetAttribute("StandardFunction")) ' eleLinkLPs.SetAttribute("lgx_PassportID", "@Session.lgx_PassportID~") PassportIDs are passed in the session. 'eleLinkLPs.SetAttribute("lgx_WindowID", sLgxTarget) eleLinkLPs.SetAttribute("lgx_WindowID", eleAction.GetAttribute("FrameID")) Dim eleLinkParam As XmlElement For Each eleLinkParam In eleAction.SelectNodes("LinkParams") Dim atrLinkParam As XmlAttribute For Each atrLinkParam In eleLinkParam.Attributes eleLinkLPs.SetAttribute(atrLinkParam.Name, atrLinkParam.Value) Next Next If eleTarget.GetAttribute("DefinitionFile").Length <> 0 Then eleLinkLPs.SetAttribute("lgx_" & sLgxTarget & "ID", eleTarget.GetAttribute("DefinitionFile")) End If 'Put the new elements together. eleLinkAction.AppendChild(eleLinkTarget) eleLinkAction.AppendChild(eleLinkLPs) eleAction.ParentNode.AppendChild(eleLinkAction) eleLinkAction.ParentNode.RemoveChild(eleAction) 'eleAction.ParentNode.ReplaceChild(eleLinkAction, eleAction) 'Recall this function, this time with an Action.Link element. sSetAction = sSetAction(eleLinkAction.ParentNode, sHtmlElement) 'sSetAction = sSetAction.Replace("@RequestJScriptLink.", "@RequestJScriptAppDevLink.") Exit Function Case "ShowElement" 'This element could be changed so that several Taget.ShowElements could be called at once. If Not eleAction.HasAttribute("ElementID") Then _ Throw New Exception("ElementID is required for Action.ShowElement.") Dim sElementID As String = sGetAndValidateElementIDs(eleAction) Dim sEffect As String = eleAction.GetAttribute("ShowElementEffect") If sEffect = "FadeIn" Then '#11740. Dim aElements As String() = sElementID.Split(",") Dim sEleId As String For Each sEleId In aElements Dim eleContainer As XmlElement = eleDef.OwnerDocument.SelectSingleNode("//Division[@ID='" & sEleId.Trim & "']") If Not IsNothing(eleContainer) Then If eleContainer.Name = "Division" Then Dim sHTMLDivAttr As String = eleContainer.GetAttribute("HtmlDiv") If String.IsNullOrEmpty(sHTMLDivAttr) _ OrElse Not CBool(sHTMLDivAttr) Then Throw New Exception("Division elements must have the attribute ""Output HTML Div Tag"" set to ""True"" with ""ShowElementEffect"" = ""FadeIn"".") End If End If End If Next End If '23824 'Call subAddIncludedScript("rdActionShowElement.js") Call subAddJavaEventFunction("rdBodyLoad", "rdShowElementsFromHistory()") 'Dim sShowID As String = sSetID(eleDef, "") sAction = " href=""javascript:void 0"" onClick=""ShowElement(this.id,'" & sElementID & "','" & eleAction.GetAttribute("Display") & "','" & sEffect & "')""" 'sAction = " href=""javascript:void 0"" onClick=""alert(this.id)""" 'sAction = sAction.Replace("href=""javascript:", "href=""javascript:void 0"" onClick=""") Case "Process" 'Check a couple critical items. Dim sDefFile As String = st.sGetAttribute(eleAction, "Process") If sDefFile.Length = 0 Then _ Throw New Exception("The Process Definition File attribute is required for Action.Process elements.") Dim sTaskId As String = st.sGetAttribute(eleAction, "TaskID") If sTaskId.Length = 0 Then _ Throw New Exception("The TaskID attribute is required for Action.Process elements.") 'Package up all the Actions. Dim sProcessAction As String = "" Dim eleActionParent As XmlElement = eleAction.ParentNode Dim nlActions As XmlNodeList = eleActionParent.GetElementsByTagName("Action") Dim eleOneAction As XmlElement For Each eleOneAction In nlActions sProcessAction &= eleOneAction.OuterXml 'Issue Next sProcessAction = "" & sProcessAction & "" sProcessAction = rdUtility.HtmlEncode4(sProcessAction) Dim sFrameId As String = eleAction.GetAttribute("FrameID") If sFrameId.Length <> 0 Then Select Case sFrameId Case "NewWindow" sFrameId = "_blank" '#18142 sShowWait = "null" Case "Parent" sFrameId = "_parent" Case "Top" sFrameId = "_top" Case "Self" sFrameId = "_self" End Select End If 'Set up token resolution for the Actions. 'sProcessAction = sProcessAction.Replace("@Data.", "@DataJScriptLink.") 'Data token values need to be UrlEncoded. 'The above line was commented because rdActionProcess.js encodes these values. No need for encoding with @DataJScriptLink. sProcessAction = sProcessAction.Replace("@Data.", "@DataJScriptXml.") 'Data token values need to be UrlEncoded. sProcessAction = sProcessAction.Replace("@Local.", "@LocalJScriptXml.") 'Data token values need to be UrlEncoded. sProcessAction = sTokenToXsl(sProcessAction, xslValueType.Attribute) 'Setup a JScript function that submits the request. sAction = " href=""javascript:RunProcess('" & sProcessAction.Replace("'", "\'") & "','" & sValidate & "','" & sConfirm & "','" & sFrameId & "'," & sShowWait & ")""" sAction = sAction.Replace("@Request.", "@RequestJScriptProcessLink.") '23824 'Call subAddIncludedScript("rdActionProcess.js") 'These are here just in case KeepScrollPosition is used when this report is called by a Process' Response.Report element. Call subAddIncludedScript("rdScroll.js") Call subAddJavaEventFunction("rdBodyLoad", _ "rdSetScroll()") Case "Popup" http.Items("rdAddPopupMenuScript") = True 'New version 8.1 Dim sPopupId As String = eleAction.GetAttribute("ID") If sPopupId.Length = 0 Then _ Throw New Exception("Action.Popup elements must have an ID value.") 'Make the ID unique. nPopupCnt += 1 'The random ID is causing problems for dashboard popup menus If Not eleAction.GetAttribute("rdMobileDashboard") = "True" Then sPopupId &= nPopupCnt.ToString End If eleAction.SetAttribute("ID", sPopupId) Dim sPopupLocation As String = eleAction.GetAttribute("PopupLocation") sAddPopupActions = "
    " sAddPopupActions = sSetID(eleAction, sAddPopupActions, "_rdPopup") 'sAddPopupActions = sSetClass(eleAction, sAddPopupActions) sAddPopupActions &= "
    " ' class bd is used by the yui menu script. sAddPopupActions &= sSetClass(eleAction, "
    " 'Add a yui style sheet to the end. Static bBeenHere As Boolean = False If Not bBeenHere Then bBeenHere = True 'Please the popup css so that it goes before the developer's css. 'This makes the developer's css take precedence. subAddIncludedCss("rdPopup/rdPopupMenu.css") End If 'Set trigger class and data- needed for the popup menu Dim sDhtmlEvent As String = "" '18602 If eleDef.HasAttribute("DhtmlEvent") Then sDhtmlEvent = "data-dhtmlevent=""" & eleDef.GetAttribute("DhtmlEvent").Substring(2).ToLowerInvariant() & """" End If sAction = " href=""javascript:void 0"" class=""rdPopupMenuActivate"" " & sDhtmlEvent & " data-popuplocation=""" & sPopupLocation & """ " Case "RefreshElement", "CalendarRefreshElement" If Not eleAction.HasAttribute("ElementID") Then _ Throw New Exception("ElementID is required for Action.RefreshElement.") Dim sElementIDs As String = sGetAndValidateElementIDs(eleAction) '19103 - fix for animated charts. sEditAnimatedChartRefreshIds(sElementIDs, eleAction) ''21402 - Replaces sElmentIDs with flag to validate after everything else is processed. 'If Not IsNothing(sElementIDs) Then ' If sElementIDs.Contains(",") AndAlso IsNothing(eleDef.OwnerDocument.DocumentElement.SelectSingleNode(".//ReportAuthor")) Then ' sElementIDs = "PROCESSACTIONAFTER%" + sElementIDs + "%ENDOFELEMENTID" ' End If 'End If Dim sLinkParams As String = "" Dim eleLinkParams As XmlElement Dim atrLinkParams As XmlAttribute Dim nlLinkParams As XmlNodeList = eleAction.SelectNodes("LinkParams") #If JAVA Then '7815 Do While 0 < nlLinkParams.Count eleLinkParams = nlLinkParams.ItemOf(0) For Each atrLinkParams In eleLinkParams.Attributes sLinkParams &= "&" & atrLinkParams.Name & "=" & util.SimpleDoubleUrlEncode(atrLinkParams.Value).Replace("'", "\'") Next eleAction.RemoveChild(eleLinkParams) nlLinkParams = eleAction.SelectNodes("LinkParams") Loop #Else For Each eleLinkParams In nlLinkParams For Each atrLinkParams In eleLinkParams.Attributes sLinkParams &= "&" & atrLinkParams.Name & "=" & util.SimpleDoubleUrlEncode(atrLinkParams.Value).Replace("'", "\'") Next eleAction.RemoveChild(eleLinkParams) Next #End If 'Add an rdReport parameter so that we run this report. If sLinkParams.IndexOf("&rdReport=") = -1 Then _ sLinkParams &= "&rdReport=" & util.SimpleDoubleUrlEncode(msRequestedPage) 'ShowModes. Dim sShowModes As String = eleAction.GetAttribute("ReportShowModes") If sShowModes.Length <> 0 Then _ sLinkParams &= "&rdShowModes=" & util.SimpleDoubleUrlEncode(sShowModes) 'AjaxFeedback Dim sFeedbackShowElementID As String = eleAction.GetAttribute("FeedbackShowElementID") If sFeedbackShowElementID.Length <> 0 Then _ sLinkParams &= "&rdFeedbackShowElementID=" & sFeedbackShowElementID Dim sFeedbackHideElementID As String = eleAction.GetAttribute("FeedbackHideElementID") If sFeedbackHideElementID.Length <> 0 Then _ sLinkParams &= "&rdFeedbackHideElementID=" & sFeedbackHideElementID 'RequestForwarding If eleAction.GetAttribute("RequestForwarding") = "True" Then _ sLinkParams &= "&rdRequestForwarding=Form" sLinkParams = sLinkParams.Replace("@Data.", "@DataJScriptLink.") '10487 sLinkParams = sLinkParams.Replace("@Local.", "@LocalJScriptLink.") sLinkParams = sLinkParams.Replace("@Request.", "@RequestJScriptLink.") sLinkParams = sLinkParams.Replace("@Cookie.", "@CookieJScriptLink.") Dim eleTarget As XmlElement '20747 If Not IsNothing(eleAction.SelectSingleNode("Target")) AndAlso Not String.IsNullOrEmpty(st.sGetRequestVar("rdLegendFilter")) Then eleTarget = eleAction.SelectSingleNode("Target") Else eleTarget = eleAction.OwnerDocument.CreateElement("Target") eleAction.AppendChild(eleTarget) eleTarget.SetAttribute("Type", "Link") If IsNothing(eleDef.SelectSingleNode("ancestor::*/@rdInputDate")) Then 'If Not IsNothing(eleDef.ParentNode) AndAlso Not IsNothing(eleDef.ParentNode.Attributes("rdInputDate")) Then If eleAction.GetAttribute("Type") = "CalendarRefreshElement" Then eleTarget.SetAttribute("Link", "javascript:rdAjaxRequestWithFormVars('rdAjaxCommand=CalendarRefreshElement&rdCalendarRefreshElementID=" & sElementIDs & sLinkParams & "','" & sValidate & "','" & sConfirm & "',HrefOrClick,null," & sCallback & ")") Else eleTarget.SetAttribute("Link", "javascript:rdAjaxRequestWithFormVars('rdAjaxCommand=RefreshElement&rdRefreshElementID=" & sElementIDs.Replace("@"c, "$"c) & sLinkParams & "','" & sValidate & "','" & sConfirm & "',HrefOrClick,null," & sCallback & "," & sShowWait & ",true)") End If Else If eleAction.GetAttribute("Type") = "CalendarRefreshElement" Then 'This prevents a Mozilla error when the calendar link is used to fire the onchange EventHandler. eleTarget.SetAttribute("Link", "javascript:setTimeout('rdAjaxRequestWithFormVars(""rdAjaxCommand=CalendarRefreshElement&rdCalendarRefreshElementID=" & sElementIDs & sLinkParams & """, """ & sValidate & """, """ & sConfirm & """,null,null," & sCallback & ") ',0)") Else 'This prevents a Mozilla error when the calendar link is used to fire the onchange EventHandler. eleTarget.SetAttribute("Link", "javascript:setTimeout(""rdAjaxRequestWithFormVars('rdAjaxCommand=RefreshElement&rdRefreshElementID=" & sElementIDs & sLinkParams & "','" & sValidate & "','" & sConfirm & "',HrefOrClick,null," & sCallback & "," & sShowWait & ",true)"",0)") End If End If End If Dim sTarget As String = sGetTarget(eleTarget, TargetType.TargetType_JScript) sAction = " href=""" & sTarget & """" mbAddAjaxSupport = True '23824 'Call subAddIncludedScript("rdActionShowElement.js") '22606 Case "RunBookmark" 'Convert this into an Action.Report. 'This is an undocumented attribute: Dim sReport As String = eleAction.GetAttribute("Report") If sReport.Length = 0 Then _ sReport = "@Data.rdReport~" 'This is the default. eleAction.SetAttribute("Type", "Link") Dim sBookmarkID As String = eleAction.GetAttribute("BookmarkID") Dim sSharedBookmarkID As String = eleAction.GetAttribute("SharedBookmarkID") If sBookmarkID.Length = 0 Then If bUnderDataRepeater(eleDef) Then sBookmarkID = "@Data.BookmarkID~" sSharedBookmarkID = "@Data.SharedBookmarkID~" Else Throw New Exception("The Action.RunBookmark BookmarkID attribute cannot be blank.") End If End If Dim sBookmarkUserName As String = eleAction.GetAttribute("BookmarkUserName") '25150 25393 Dim sBookmarkCollection As String = rdBookmark.GetCollectionNameFromAttr(st, eleAction, st.sGetAttribute(eleAction, "BookmarkUserName")) Dim sBookmarkLookupDefaultDescription As String = eleAction.GetAttribute("BookmarkLookupDescription") If sBookmarkLookupDefaultDescription = "True" Then sBookmarkLookupDefaultDescription = "&rdBookmarkLookupDescription=True" Else sBookmarkLookupDefaultDescription = "" End If Dim eleTargetLink As XmlElement = eleAction.AppendChild(eleAction.OwnerDocument.CreateElement("Target")) eleTargetLink.SetAttribute("Type", "Link") eleTargetLink.SetAttribute("Link", "rdPage.aspx?rdLoadBookmark=True&rdReport=" & sReport & "&rdBookmarkCollection=" & sBookmarkCollection & "&rdBookmarkUserName=" & sBookmarkUserName & "&rdBookmarkID=" & sBookmarkID & "&rdSharedBookmarkID=" & sSharedBookmarkID & sBookmarkLookupDefaultDescription) Dim eleTargetBookmark As XmlElement = eleAction.SelectSingleNode("Target[@Type='RunBookmark']") If Not IsNothing(eleTargetBookmark) Then If eleTargetBookmark.GetAttribute("FrameID").Length <> 0 Then eleTargetLink.SetAttribute("FrameID", eleTargetBookmark.GetAttribute("FrameID")) End If eleAction.RemoveChild(eleTargetBookmark) End If Return Me.sSetAction(eleDef, sHtmlElement) Case "AddBookmark" '23824 mbAddAjaxSupport = True Dim sActionId As String = eleAction.GetAttribute("ID") If sActionId.Length = 0 Then _ Throw New Exception("Action.AddBookmark elements must have an ID value.") 'Create a hidden Div containing the request values. 'Dim eleHiddenLabelsContainer As XmlElement = eleDef.SelectSingleNode("ancestor::Body | ancestor::ReportHeader | ancestor::ReportFooter") '#10211 'Find the first ancestor element that is not an Action. Add hidden labels for the request values in there. '11525 Dim eleHiddenLabelsContainer As XmlElement = eleDef.ParentNode Do Until eleHiddenLabelsContainer.Name <> "Action" eleHiddenLabelsContainer = eleHiddenLabelsContainer.ParentNode Loop 'When exiting here, we may be on a Label or something like that. Go to it's parent node to add the new hidden Labels. eleHiddenLabelsContainer = eleHiddenLabelsContainer.ParentNode Dim eleHiddenLabelsDiv As XmlElement = eleHiddenLabelsContainer.AppendChild(eleAction.OwnerDocument.CreateElement("Division")) eleHiddenLabelsDiv.SetAttribute("ShowModes", "None") Dim sBookmarkRequestIDs As String = eleAction.GetAttribute("BookmarkRequestIDs").Replace(" ", "").Replace(vbCr, "").Replace(vbLf, "") Dim eleCharts As XmlNodeList = eleDef.SelectNodes("//ChartCanvas") For Each eleChart As XmlElement In eleCharts sBookmarkRequestIDs &= String.Format(",{0}_viewstates", eleChart.GetAttribute("ID")) Next sBookmarkRequestIDs = sBookmarkRequestIDs.TrimStart(",") For Each sId As String In sBookmarkRequestIDs.Split(",") Dim eleLabel As XmlElement = eleHiddenLabelsDiv.AppendChild(eleAction.OwnerDocument.CreateElement("Label")) eleLabel.SetAttribute("ID", "rdBookmarkReqId_" & sId) eleLabel.SetAttribute("Caption", "@Request." & sId & "~") Next Dim sBookmarkSessionIDs As String = eleAction.GetAttribute("BookmarkSessionIDs").Replace(" ", "").Replace(vbCr, "").Replace(vbLf, "") For Each sId As String In sBookmarkSessionIDs.Split(",") Dim eleLabel As XmlElement = eleHiddenLabelsDiv.AppendChild(eleAction.OwnerDocument.CreateElement("Label")) eleLabel.SetAttribute("ID", "rdBookmarkSessionId_" & sId) eleLabel.SetAttribute("Caption", "@Session." & sId & "~") Next Dim sBookmarkCollection As String = rdBookmark.GetCollectionNameFromAttr(st, eleAction) If sBookmarkCollection.Length = 0 Then _ Throw New Exception("BookmarkCollection cannot be blank for Action.AddBookmark.") Dim eleTarget As XmlElement : Dim eleAddBookmarkTarget As XmlElement If Not eleAction.HasAttribute("BookmarkDescriptionMessage") Then ' Code path when there is no "BookmarkDescriptionMessage", so no prompt. 'Convert to javascript...RD20907 eleAction.SetAttribute("Type", "Javascript") Dim sLink As String = "rdAddBookmark(" sLink &= "'" & sActionId & "'," sLink &= "'" & msRequestedPage & "'," sLink &= "'" & sBookmarkRequestIDs & "'," sLink &= "'" & sBookmarkSessionIDs & "'," sLink &= "'" & rdBookmark.GetCollectionNameFromAttr(st, eleAction) & "'," Dim sBookmarkName As String = eleAction.GetAttribute("BookmarkName").Replace("'", "\'") sBookmarkName = st.sAppendTokenEncoding(sBookmarkName, rdState.EncodingType.Json_Encode) sBookmarkName = st.sAppendTokenEncoding(sBookmarkName, rdState.EncodingType.SingleQuoteJavascript_Encode) sLink &= "'" & sBookmarkName & "'," sLink &= "'" & eleAction.GetAttribute("BookmarkCustomColumn1").Replace("'", "\'") & "'," sLink &= "'" & eleAction.GetAttribute("BookmarkCustomColumn2").Replace("'", "\'") & "'," Dim sBookmarkDesc As String = eleAction.GetAttribute("BookmarkDescription").Replace("'", "\'") sBookmarkDesc = st.sAppendTokenEncoding(sBookmarkDesc, rdState.EncodingType.Json_Encode) sBookmarkDesc = st.sAppendTokenEncoding(sBookmarkDesc, rdState.EncodingType.SingleQuoteJavascript_Encode) sLink &= "'" & sBookmarkDesc & "'," sLink &= "'" & eleAction.GetAttribute("BookmarkDescriptionMessage").Replace("'", "\'") & "'," Dim sRowNumber As String = String.Empty If bUnderDataRepeater(eleDef) Then sRowNumber = "@Function.RowNumber~" End If sLink &= "'" & sRowNumber & "')" eleAction.SetAttribute("Javascript", sLink) Else eleAction.SetAttribute("Type", "ShowElement") eleAction.SetAttribute("ElementID", "ppAddBookmarks_" & sActionId) Dim elePopupPanel As XmlElement If eleAction.ParentNode.Name = "PopupOption" Then elePopupPanel = eleAction.ParentNode.AppendChild(eleAction.OwnerDocument.CreateElement("PopupPanel")) Else elePopupPanel = eleAction.ParentNode.ParentNode.AppendChild(eleAction.OwnerDocument.CreateElement("PopupPanel")) End If elePopupPanel.SetAttribute("ID", "ppAddBookmarks_" & sActionId) elePopupPanel.SetAttribute("PopupModal", "True") elePopupPanel.SetAttribute("Draggable", "True") elePopupPanel.SetAttribute("PopupPanelLocation", "Mouse") elePopupPanel.SetAttribute("Caption", " ") Dim eleInputGrid As XmlElement = elePopupPanel.AppendChild(eleAction.OwnerDocument.CreateElement("InputGrid")) Dim eleDescriptionTextbox As XmlElement = eleInputGrid.AppendChild(eleAction.OwnerDocument.CreateElement("InputText")) eleDescriptionTextbox.SetAttribute("ID", "txtBookmarkDescription") eleDescriptionTextbox.SetAttribute("Caption", eleAction.GetAttribute("BookmarkDescriptionMessage")) If st.sGetRequestVar("rdEditThinkspace") = "True" Then eleDescriptionTextbox.SetAttribute("DefaultValue", String.Empty) Else eleDescriptionTextbox.SetAttribute("DefaultValue", eleAction.GetAttribute("BookmarkDescription")) End If eleDescriptionTextbox.SetAttribute("InputSize", "50") Dim eleDescriptionValidator As XmlElement = eleDescriptionTextbox.AppendChild(eleAction.OwnerDocument.CreateElement("Validation")) eleDescriptionValidator.SetAttribute("Type", "Required") If eleAction.HasAttribute("BookmarkBlankErrorMessage") Then eleDescriptionValidator.SetAttribute("ErrorMsg", eleAction.GetAttribute("BookmarkBlankErrorMessage")) Else eleDescriptionValidator.SetAttribute("ErrorMsg", "Value cannot be blank.") 'This message actually does not get displayed, but the submit is prevented which is good. DP. End If eleDescriptionValidator.SetAttribute("Class", "ThemeErrorText") Dim sPopupPanelId As String = elePopupPanel.GetAttribute("ID") Dim bIsThinkspace As Boolean = Not String.IsNullOrEmpty(sPopupPanelId) AndAlso sPopupPanelId.Contains("rdTsActionBookmark") Dim bCanEditSharedBookbark As Boolean = rdBookmark.CanCurrentUserEditThisBookmark() Or (Not String.IsNullOrEmpty(st.sGetRequestVar("rdBookmarkUserName")) AndAlso Not String.IsNullOrEmpty(st.sReplaceTokens("@Function.UserName~")) AndAlso st.sGetRequestVar("rdBookmarkUserName") = st.sReplaceTokens("@Function.UserName~")) 'If bIsThinkspace AndAlso Not String.IsNullOrEmpty(st.sGetRequestVar("rdBookmarkID")) Then ' Dim eleOverwriteThinkspace As XmlElement = elePopupPanel.AppendChild(eleAction.OwnerDocument.CreateElement("InputCheckbox")) ' eleOverwriteThinkspace.SetAttribute("ID", "overWrite") ' eleOverwriteThinkspace.SetAttribute("CheckedValue", "overwriteChecked") ' eleOverwriteThinkspace.SetAttribute("Caption", "Overwrite ?") ' eleOverwriteThinkspace.SetAttribute("DefaultValue", "over Write dv") ' eleOverwriteThinkspace.SetAttribute("Tooltip", "Do you want to overWrite the current Thinkspace configuration ?") ' eleOverwriteThinkspace.SetAttribute("UncheckedValue", "unchecked value") ' eleOverwriteThinkspace.SetAttribute("runat", "server") ' 'HttpContext.Current.Session("rdNGPBookmarkId") = st.sGetRequestVar("rdBookmarkID") ' Dim eleNGPBookmarkId As XmlElement = elePopupPanel.AppendChild(eleAction.OwnerDocument.CreateElement("InputHidden")) ' eleNGPBookmarkId.SetAttribute("ID", "rdNGPBookmarkId") ' eleNGPBookmarkId.SetAttribute("runat", "server") ' eleNGPBookmarkId.SetAttribute("DefaultValue", st.sGetRequestVar("rdBookmarkID")) 'End If If bIsThinkspace AndAlso bCanEditSharedBookbark AndAlso (Not String.IsNullOrEmpty(st.sGetRequestVar("rdBookmarkID")) OrElse Not String.IsNullOrEmpty(st.sGetRequestVar("rdNGPBookmarkId"))) AndAlso Not (st.sGetRequestVar("rdEditThinkspace").ToLower() = "true" OrElse st.sGetRequestVar("rdResetThinkspace").ToLower() = "true") Then Dim eleSaveAsNewBookmarkButton As XmlElement = elePopupPanel.AppendChild(eleAction.OwnerDocument.CreateElement("Label")) eleSaveAsNewBookmarkButton.SetAttribute("Class", "ThemeLinkButton") eleSaveAsNewBookmarkButton.SetAttribute("ID", "saveAsNew") eleSaveAsNewBookmarkButton.SetAttribute("runat", "server") 'If eleAction.HasAttribute("BookmarkSaveCaption") Then ' eleSaveAsNewBookmarkButton.SetAttribute("Caption", eleAction.GetAttribute("BookmarkSaveCaption")) 'Else eleSaveAsNewBookmarkButton.SetAttribute("Caption", "Save") 'End If Dim eleSaveAsNewBookmarkAction As XmlElement = eleSaveAsNewBookmarkButton.AppendChild(eleAction.OwnerDocument.CreateElement("Action")) eleSaveAsNewBookmarkAction.SetAttribute("Type", "Link") eleSaveAsNewBookmarkAction.SetAttribute("Validate", "True") eleAddBookmarkTarget = eleSaveAsNewBookmarkAction.OwnerDocument.CreateElement("Target") eleSaveAsNewBookmarkAction.AppendChild(eleAddBookmarkTarget) eleAddBookmarkTarget.SetAttribute("Type", "Link") Dim sSaveAsNewookmarkLink As String = "javascript:rdAddBookmarkNgpSave(" sSaveAsNewookmarkLink &= "'" & sActionId & "'," sSaveAsNewookmarkLink &= "'" & msRequestedPage & "'," sSaveAsNewookmarkLink &= "'" & sBookmarkRequestIDs & "'," sSaveAsNewookmarkLink &= "'" & sBookmarkSessionIDs & "'," Dim sBookmarkOwnerUserName As String = st.sGetRequestVar("rdBookmarkUserName") sSaveAsNewookmarkLink &= "'" & rdBookmark.GetCollectionNameFromAttr(st, eleAction, sBookmarkOwnerUserName).Replace("'", "\'") & "'," sSaveAsNewookmarkLink &= "'" & eleAction.GetAttribute("BookmarkName").Replace("'", "\'") & "'," sSaveAsNewookmarkLink &= "'" & eleAction.GetAttribute("BookmarkCustomColumn1").Replace("'", "\'") & "'," sSaveAsNewookmarkLink &= "'" & eleAction.GetAttribute("BookmarkCustomColumn2").Replace("'", "\'") & "'," sSaveAsNewookmarkLink &= "'" & eleAction.GetAttribute("BookmarkDescription").Replace("'", "\'") & "'," sSaveAsNewookmarkLink &= "'" & eleAction.GetAttribute("BookmarkDescriptionMessage").Replace("'", "\'") & "'," Dim sSaveAsNewRowNumber As String = String.Empty If bUnderDataRepeater(eleDef) Then sSaveAsNewRowNumber = "@Function.RowNumber~" End If sSaveAsNewookmarkLink &= "'" & sSaveAsNewRowNumber & "')" eleAddBookmarkTarget.SetAttribute("Link", sSaveAsNewookmarkLink) Dim eleSaveASNew As XmlElement = elePopupPanel.AppendChild(eleAction.OwnerDocument.CreateElement("InputHidden")) eleSaveASNew.SetAttribute("ID", "rdSaveASNew") eleSaveASNew.SetAttribute("runat", "server") Dim eleNGPBookmarkId As XmlElement = elePopupPanel.AppendChild(eleAction.OwnerDocument.CreateElement("InputHidden")) eleNGPBookmarkId.SetAttribute("ID", "rdNGPBookmarkId") eleNGPBookmarkId.SetAttribute("runat", "server") Dim sBookmarkId As String = st.sGetRequestVar("rdBookmarkID") If String.IsNullOrEmpty(sBookmarkId) Then sBookmarkId = st.sGetRequestVar("rdNGPBookmarkId") End If eleNGPBookmarkId.SetAttribute("DefaultValue", sBookmarkId) End If Dim eleAddBookmarkButton As XmlElement = elePopupPanel.AppendChild(eleAction.OwnerDocument.CreateElement("Label")) eleAddBookmarkButton.SetAttribute("Class", "ThemeLinkButton") If eleAction.HasAttribute("BookmarkSaveCaption") Then eleAddBookmarkButton.SetAttribute("Caption", eleAction.GetAttribute("BookmarkSaveCaption")) Else eleAddBookmarkButton.SetAttribute("Caption", "Save") End If Dim eleAddBookmarkAction As XmlElement = eleAddBookmarkButton.AppendChild(eleAction.OwnerDocument.CreateElement("Action")) eleAddBookmarkAction.SetAttribute("Type", "Javascript") eleAddBookmarkAction.SetAttribute("Validate", "True") Dim sAddBookmarkLink As String = "rdAddBookmark(" sAddBookmarkLink &= "'" & sActionId & "'," sAddBookmarkLink &= "'" & msRequestedPage & "'," sAddBookmarkLink &= "'" & sBookmarkRequestIDs & "'," sAddBookmarkLink &= "'" & sBookmarkSessionIDs & "'," sAddBookmarkLink &= "'" & rdBookmark.GetCollectionNameFromAttr(st, eleAction).Replace("'", "\'") & "'," Dim sBookmarkName As String = eleAction.GetAttribute("BookmarkName").Replace("'", "\'") sBookmarkName = st.sAppendTokenEncoding(sBookmarkName, rdState.EncodingType.Json_Encode) sBookmarkName = st.sAppendTokenEncoding(sBookmarkName, rdState.EncodingType.SingleQuoteJavascript_Encode) sAddBookmarkLink &= "'" & sBookmarkName & "'," sAddBookmarkLink &= "'" & eleAction.GetAttribute("BookmarkCustomColumn1").Replace("'", "\'") & "'," sAddBookmarkLink &= "'" & eleAction.GetAttribute("BookmarkCustomColumn2").Replace("'", "\'") & "'," Dim sBookmarkDesc As String = eleAction.GetAttribute("BookmarkDescription").Replace("'", "\'") sBookmarkDesc = st.sAppendTokenEncoding(sBookmarkDesc, rdState.EncodingType.Json_Encode) sBookmarkDesc = st.sAppendTokenEncoding(sBookmarkDesc, rdState.EncodingType.SingleQuoteJavascript_Encode) sAddBookmarkLink &= "'" & sBookmarkDesc & "'," sAddBookmarkLink &= "'" & eleAction.GetAttribute("BookmarkDescriptionMessage").Replace("'", "\'") & "'," Dim sRowNumber As String = String.Empty If bUnderDataRepeater(eleDef) Then sRowNumber = "@Function.RowNumber~" End If sAddBookmarkLink &= "'" & sRowNumber & "')" eleAddBookmarkAction.SetAttribute("Javascript", sAddBookmarkLink) End If 'There is a child Action that refreshes the page or an element. 'Move the child action to the Add to Bookmark button in the popup panel. Dim eleChildAction As XmlElement = eleAction.SelectSingleNode("Action") If IsNothing(eleChildAction) Then Return Me.sSetAction(eleDef, sHtmlElement) Else ' Code path to process the child action element added to the action.addbookmark. This child element might need to go under the 'Add to Bookmark' button in the popup panel. 'eleChildAction.SetAttribute("Validate", "True") If Not IsNothing(eleTarget) Then ' This code path is taken when the 'BookmarkDescriptionMessage' attribute is left empty, because no popup panel is needed in this scenario. eleTarget.ParentNode.AppendChild(eleChildAction) Else eleAddBookmarkTarget.ParentNode.AppendChild(eleAction.RemoveChild(eleChildAction)) End If Return Me.sSetAction(eleDef, sHtmlElement) End If Case "EditBookmark" '23824 mbAddAjaxSupport = True Dim sActionId As String = eleAction.GetAttribute("ID") If sActionId.Length = 0 Then _ Throw New Exception("Action.EditBookmark elements must have an ID value.") Dim sBookmarkID As String = eleAction.GetAttribute("BookmarkID") If sBookmarkID.Length = 0 Then _ Throw New Exception("BookmarkID cannot be blank for Action.EditBookmark.") Dim sBookmarkCollection As String = rdBookmark.GetCollectionNameFromAttr(st, eleAction) If sBookmarkCollection.Length = 0 Then _ Throw New Exception("BookmarkCollection cannot be blank for Action.EditBookmark.") Dim sDescriptionMessage As String = eleAction.GetAttribute("BookmarkDescriptionMessage") If sDescriptionMessage.Length = 0 Then _ Throw New Exception("BookmarkDescriptionMessage cannot be blank for Action.EditBookmark.") eleAction.SetAttribute("Type", "ShowElement") eleAction.SetAttribute("ElementID", "ppEditBookmarks_" & sActionId) Dim elePopupPanel As XmlElement If eleAction.ParentNode.Name = "PopupOption" Then elePopupPanel = eleAction.ParentNode.ParentNode.ParentNode.ParentNode.AppendChild(eleAction.OwnerDocument.CreateElement("PopupPanel")) '12652 Else elePopupPanel = eleAction.ParentNode.ParentNode.AppendChild(eleAction.OwnerDocument.CreateElement("PopupPanel")) End If elePopupPanel.SetAttribute("ID", "ppEditBookmarks_" & sActionId) elePopupPanel.SetAttribute("PopupModal", "True") elePopupPanel.SetAttribute("Draggable", "True") elePopupPanel.SetAttribute("PopupPanelLocation", "Mouse") elePopupPanel.SetAttribute("Caption", " ") Dim eleInputGrid As XmlElement = elePopupPanel.AppendChild(eleAction.OwnerDocument.CreateElement("InputGrid")) Dim eleDescriptionTextbox As XmlElement = eleInputGrid.AppendChild(eleAction.OwnerDocument.CreateElement("InputText")) eleDescriptionTextbox.SetAttribute("ID", "txtEditBookmarkDescription") eleDescriptionTextbox.SetAttribute("Caption", sDescriptionMessage) eleDescriptionTextbox.SetAttribute("DefaultValue", eleAction.GetAttribute("BookmarkDescription")) eleDescriptionTextbox.SetAttribute("InputSize", "50") Dim eleDescriptionValidator As XmlElement = eleDescriptionTextbox.AppendChild(eleAction.OwnerDocument.CreateElement("Validation")) eleDescriptionValidator.SetAttribute("Type", "Required") If eleAction.HasAttribute("BookmarkBlankErrorMessage") Then eleDescriptionValidator.SetAttribute("ErrorMsg", eleAction.GetAttribute("BookmarkBlankErrorMessage")) Else eleDescriptionValidator.SetAttribute("ErrorMsg", "Value cannot be blank.") 'This message actually does not get displayed, but the submit is prevented which is good. DP. End If eleDescriptionValidator.SetAttribute("Class", "ThemeErrorText") Dim eleAddBookmarkButton As XmlElement = elePopupPanel.AppendChild(eleAction.OwnerDocument.CreateElement("Label")) eleAddBookmarkButton.SetAttribute("ID", "btnEditBookmarks_" & sActionId) eleAddBookmarkButton.SetAttribute("Class", "ThemeLinkButton") If eleAction.HasAttribute("BookmarkSaveCaption") Then eleAddBookmarkButton.SetAttribute("Caption", eleAction.GetAttribute("BookmarkSaveCaption")) Else eleAddBookmarkButton.SetAttribute("Caption", "Save") End If Dim eleAddBookmarkAction As XmlElement = eleAddBookmarkButton.AppendChild(eleAction.OwnerDocument.CreateElement("Action")) eleAddBookmarkAction.SetAttribute("Type", "Link") eleAddBookmarkAction.SetAttribute("Validate", "True") Dim eleAddBookmarkTarget As XmlElement = eleAddBookmarkAction.OwnerDocument.CreateElement("Target") eleAddBookmarkAction.AppendChild(eleAddBookmarkTarget) eleAddBookmarkTarget.SetAttribute("Type", "Link") Dim sEditBookmarkLink As String = "javascript:rdEditBookmark(" sEditBookmarkLink &= "'" & sActionId & "'," sEditBookmarkLink &= "'" & msRequestedPage & "'," sEditBookmarkLink &= "'" & sBookmarkCollection & "'," sEditBookmarkLink &= "'" & sBookmarkID & "'," sEditBookmarkLink &= "'" & eleAction.GetAttribute("BookmarkDescription").Replace("'", "\'") & "'," sEditBookmarkLink &= "'" & sDescriptionMessage.Replace("'", "\'") & "'," Dim sRowNumber As String = String.Empty If bUnderDataRepeater(eleDef) Then sRowNumber = "@Function.RowNumber~" End If sEditBookmarkLink &= "'" & sRowNumber & "'," sEditBookmarkLink &= "'" & eleAction.GetAttribute("UpdateElementID") & "')" 'Undocumented attribute for the ReportCenter. eleAddBookmarkTarget.SetAttribute("Link", sEditBookmarkLink) 'There is a child Action that refreshes the page or an element. 'Move the child action to the Add to Bookmark button in the popup panel. Dim eleChildAction As XmlElement = eleAction.SelectSingleNode("Action") If IsNothing(eleChildAction) Then Return Me.sSetAction(eleDef, sHtmlElement) Else 'eleChildAction.SetAttribute("Validate", "True") eleAddBookmarkTarget.ParentNode.AppendChild(eleAction.RemoveChild(eleChildAction)) Return Me.sSetAction(eleDef, sHtmlElement) End If Case "CopyBookmark" '23824 mbAddAjaxSupport = True Dim sActionId As String = eleAction.GetAttribute("ID") If sActionId.Length = 0 Then _ Throw New Exception("Action.CopyBookmark elements must have an ID value.") Dim sBookmarkID As String = eleAction.GetAttribute("BookmarkID") If String.IsNullOrEmpty(sBookmarkID) Then _ Throw New Exception("BookmarkID cannot be blank for Action.CopyBookmark") Dim sSharedBookmarkID As String = eleAction.GetAttribute("SharedBookmarkID") Dim sCurrentBookmarkUsername As String = eleAction.GetAttribute("BookmarkUserName") '25150 25393 Dim sSourceBookmarkCollection As String = "" Dim sBookmarkCollection As String = eleAction.GetAttribute("BookmarkCollection") If sCurrentBookmarkUsername.Contains("@Data.BookmarkUserName~") Then sSourceBookmarkCollection = eleAction.GetAttribute("BookmarkCollection") Else sSourceBookmarkCollection = rdBookmark.GetCollectionNameFromAttr(st, eleAction, st.sGetAttribute(eleAction, "BookmarkUserName")) End If If Not sCurrentBookmarkUsername.Contains("@Data.BookmarkUserName~") AndAlso String.IsNullOrEmpty(sSourceBookmarkCollection) Then Throw New Exception("BookmarkCollection cannot be blank for Action.CopyBookmark.") End If Dim sDestinationBookmarkCollection As String = eleAction.GetAttribute("DestinationBookmarkCollection") If String.IsNullOrEmpty(sDestinationBookmarkCollection) Then _ Throw New Exception("DestinationBookmarkCollection cannot be blank for Action.CopyBookmark.") Dim sCopiedBookmarkDescription As String = eleAction.GetAttribute("BookmarkDescription") 'Convert this into an Action.Link to get some Javascript. eleAction.SetAttribute("Type", "Link") Dim eleTarget As XmlElement = eleAction.OwnerDocument.CreateElement("Target") eleAction.AppendChild(eleTarget) eleTarget.SetAttribute("Type", "Link") Dim sLink As String = "javascript:rdCopyBookmark(" sLink &= "'" & sActionId & "'," sLink &= "'" & msRequestedPage & "'," sLink &= "'" & sSourceBookmarkCollection & "'," sLink &= "'" & sCurrentBookmarkUsername & "'," sLink &= "'" & sDestinationBookmarkCollection & "'," sLink &= "'" & sBookmarkID & "'," sLink &= "'" & sSharedBookmarkID & "'," sLink &= "'" & eleAction.GetAttribute("AcknowledgeMessage").Replace("'", "\'") & "'," sLink &= "'" & sCopiedBookmarkDescription & "')" eleTarget.SetAttribute("Link", sLink) Return Me.sSetAction(eleDef, sHtmlElement) Case "RemoveBookmark" '23824 mbAddAjaxSupport = True Dim sActionId As String = eleAction.GetAttribute("ID") If sActionId.Length = 0 Then _ Throw New Exception("Action.RemoveBookmark elements must have an ID value.") Dim sBookmarkID As String = eleAction.GetAttribute("BookmarkID") If sBookmarkID.Length = 0 Then _ Throw New Exception("BookmarkID cannot be blank for Action.RemoveBookmark") Dim sBookmarkCollection As String = rdBookmark.GetCollectionNameFromAttr(st, eleAction) If sBookmarkCollection.Length = 0 Then _ Throw New Exception("BookmarkCollection cannot be blank for Action.RemoveBookmark.") 'Convert this into an Action.Link to get some Javascript. eleAction.SetAttribute("Type", "Link") Dim eleTarget As XmlElement = eleAction.OwnerDocument.CreateElement("Target") eleAction.AppendChild(eleTarget) eleTarget.SetAttribute("Type", "Link") Dim sLink As String = "javascript:rdRemoveBookmark(" sLink &= "'" & sActionId & "'," sLink &= "'" & msRequestedPage & "'," sLink &= "'" & sBookmarkCollection & "'," sLink &= "'" & eleAction.GetAttribute("BookmarkUserName") & "'," sLink &= "'" & sBookmarkID & "'," sLink &= "'" & eleAction.GetAttribute("ConfirmMessage").Replace("'", "\'") & "'," sLink &= "'" & eleAction.GetAttribute("RemoveElementID") & "'," 'Undocumented attribute for the ReportCenter. sLink &= "'" & eleAction.GetAttribute("ReportCenterID") & "'," 'Undocumented attribute for the ReportCenter. Dim sRowNumber As String = String.Empty If bUnderDataRepeater(eleDef) Then sRowNumber = "@Function.RowNumber~" End If sLink &= "'" & sRowNumber & "')" 'Undocumented attribute for the ReportCenter.)" eleTarget.SetAttribute("Link", sLink) '15982,15625 'This is a better method for sub-actions. It creates a blank Label with an action which will get "clicked" at the end of the ActionRemoveBookmark. Dim eleChildAction As XmlElement = eleAction.SelectSingleNode("Action") If Not IsNothing(eleChildAction) Then 'Put the child action under a hidden Label. Dim sSubActionID As String = "rdSubAction_" & sActionId 'eleDef will be the parent of the action.RemoveBookmark, so we want to add the label to the parent of eleDef. 25500 Dim eleParent As XmlElement = eleDef.ParentNode 'The row number gets automatically appended for the ID for elements under a data repeater, but it doesn't get adjusted in the link below 'So we adjust the sub action ID after we set it because we need the link to match the value in the ID attribute Dim eleHidden As XmlElement = eleDef.OwnerDocument.CreateElement("Label") eleParent.AppendChild(eleHidden) eleHidden.SetAttribute("ID", sSubActionID) eleHidden.AppendChild(eleChildAction.ParentNode.RemoveChild(eleChildAction)) If bUnderDataRepeater(eleDef) Then sSubActionID &= "_Row@Function.RowNumber~" End If sLink &= ";NavigateLink2(document.getElementById('" & sSubActionID & "').parentNode.href)" '015982 Note2 eleTarget.SetAttribute("Link", sLink) End If Return Me.sSetAction(eleDef, sHtmlElement) Case "DragBookmark" '23824 'Call subAddIncludedScript("rdAjax/rdAjax2.js") 'Call subAddIncludedScript("rdBookmark.js") mbAddAjaxSupport = True Dim sActionId As String = eleAction.GetAttribute("ID") If sActionId.Length = 0 Then _ Throw New Exception("Action.DragBookmark elements must have an ID value.") Dim sBookmarkID As String = eleAction.GetAttribute("BookmarkID") If sBookmarkID.Length = 0 Then _ Throw New Exception("BookmarkID cannot be blank for Action.DragBookmark") Dim sBookmarkUserName As String = eleAction.GetAttribute("BookmarkUserName") Dim sBookmarkCollection As String = rdBookmark.GetCollectionNameFromAttr(st, eleAction, st.sGetAttribute(eleAction, "BookmarkUserName")) If sBookmarkCollection.Length = 0 Then _ Throw New Exception("BookmarkCollection cannot be blank for Action.DragBookmark.") Dim sBookmarkDescription As String = eleAction.GetAttribute("BookmarkDescription") Dim xmlDragTemplate As XmlDocument = rdUtility.GetSuperElementTemplate("rdBookmarkOrganizer/rdActionDragBookmarkTemplate.lgx") Dim eleDragDivision As XmlElement = xmlDragTemplate.SelectSingleNode("//DraggableDivision") eleDragDivision.SetAttribute("ID", sActionId) Dim eleLinkParams As XmlElement = eleDragDivision.SelectSingleNode("LinkedParams") Dim sActionLinkParam As String = eleLinkParams.GetAttribute("action") sActionLinkParam = sActionLinkParam.Replace("rdBookmarkID", sBookmarkID) sActionLinkParam = sActionLinkParam.Replace("rdBookmarkCollection", sBookmarkCollection) sActionLinkParam = sActionLinkParam.Replace("rdBookmarkDescription", sBookmarkDescription) sActionLinkParam = sActionLinkParam.Replace("rdBookmarkUserName", sBookmarkUserName) eleLinkParams.SetAttribute("action", sActionLinkParam) If IsNothing(HttpContext.Current.Session("rdBookmarkOrganizerAllDroppableGroups")) Then Call rdBookmark.subRunDataLayerBookmarks(sBookmarkCollection, "True") End If eleDragDivision.SetAttribute("DragGroup", HttpContext.Current.Session("rdBookmarkOrganizerAllDroppableGroups")) Return sProcess_DraggableDivision(eleDragDivision, sHtmlElement) Case "ShareBookmark" '23824 'Call subAddIncludedScript("rdAjax/rdAjax2.js") 'Call subAddIncludedScript("rdBookmark.js") mbAddAjaxSupport = True Dim sActionId As String = eleAction.GetAttribute("ID") If sActionId.Length = 0 Then _ Throw New Exception("Action.ShareBookmark elements must have an ID value.") Dim sBookmarkID As String = eleAction.GetAttribute("BookmarkID") Dim sFolderID As String = eleAction.GetAttribute("FolderID") If sBookmarkID.Length = 0 AndAlso sFolderID.Length = 0 Then _ Throw New Exception("Both BookmarkID and FolderID cannot be blank for Action.ShareBookmark") Dim sBookmarkCollection As String = rdBookmark.GetCollectionNameFromAttr(st, eleAction) If sBookmarkCollection.Length = 0 Then _ Throw New Exception("BookmarkCollection cannot be blank for Action.ShareBookmark.") Dim sSharedWith As String = eleAction.GetAttribute("SharedWith") Dim sFromInput As String = st.sGetAttribute(eleAction, "FromInput", "True") If sSharedWith.Length = 0 Then _ Throw New Exception("SharedWith cannot be blank for Action.ShareBookmark.") Dim sRefreshDatatableID As String = eleAction.GetAttribute("RefreshDTID") 'Convert this into an Action.Link to get some Javascript. ' convert to action javascript instead... eleAction.SetAttribute("Type", "Javascript") Dim sLink As String = "rdShareBookmarkOrFolder(" sLink &= "'" & sActionId & "'," sLink &= "'" & msRequestedPage & "'," sLink &= "'" & sBookmarkCollection & "'," sLink &= "'" & sBookmarkID & "'," sLink &= "'" & sFolderID & "'," sLink &= "'" & sSharedWith.Replace("'", "\'") & "'," sLink &= "'" & sRefreshDatatableID & "'," sLink &= "'" & sFromInput & "'," sLink &= "'" & eleAction.GetAttribute("AcknowledgeMessage").Replace("'", "\'") & "')" eleAction.SetAttribute("Javascript", sLink) If Not rdBookmark.bBookmarkOrFolderExists(st, sBookmarkCollection, sBookmarkID, sFolderID) Then Throw New Exception("Cannot re-share a bookmark.") End If Return Me.sSetAction(eleDef, sHtmlElement) Case "UnShareBookmark" '23824 'Call subAddIncludedScript("rdAjax/rdAjax2.js") 'Call subAddIncludedScript("rdBookmark.js") mbAddAjaxSupport = True Dim sActionId As String = eleAction.GetAttribute("ID") If sActionId.Length = 0 Then _ Throw New Exception("Action.ShareBookmark elements must have an ID value.") Dim sBookmarkID As String = eleAction.GetAttribute("BookmarkID") Dim sFolderID As String = eleAction.GetAttribute("FolderID") If sBookmarkID.Length = 0 AndAlso sFolderID.Length = 0 Then _ Throw New Exception("Both BookmarkID and FolderID cannot be blank for Action.UnShareBookmark") Dim sBookmarkCollection As String = rdBookmark.GetCollectionNameFromAttr(st, eleAction) If sBookmarkCollection.Length = 0 Then _ Throw New Exception("BookmarkCollection cannot be blank for Action.UnShareBookmark.") Dim sUnSharedWith As String = eleAction.GetAttribute("UnSharedWith") If sUnSharedWith.Length = 0 Then _ Throw New Exception("UnSharedWith cannot be blank for Action.UnShareBookmark.") Dim sRefreshDatatableID As String = eleAction.GetAttribute("RefreshDTID") 'Convert this into an Action.Link to get some Javascript. ' convert to action javascript instead... eleAction.SetAttribute("Type", "Javascript") Dim sLink As String = "rdUnShareBookmarkOrFolder(" sLink &= "'" & sActionId & "'," sLink &= "'" & msRequestedPage & "'," sLink &= "'" & sBookmarkCollection & "'," sLink &= "'" & sBookmarkID & "'," sLink &= "'" & sFolderID & "'," sLink &= "'" & sUnSharedWith.Replace("'", "\'") & "'," sLink &= "'" & sRefreshDatatableID & "'," sLink &= "'" & eleAction.GetAttribute("AcknowledgeMessage").Replace("'", "\'") & "')" eleAction.SetAttribute("Javascript", sLink) Return Me.sSetAction(eleDef, sHtmlElement) Case "ShowBookmarkSharing" Return Me.sSetAction(sProcess_ActionShowBookmarkSharing(eleAction, eleDef), sHtmlElement) Case "DialPhone" Dim sPhoneNumber As String = eleAction.GetAttribute("PhoneNumber") Dim sLink As String = "tel:" & sPhoneNumber 'Turn this Action into an Action.Link. eleAction.SetAttribute("Type", "Link") Dim eleTarget As XmlElement = eleAction.AppendChild(eleAction.OwnerDocument.CreateElement("Target")) eleTarget.SetAttribute("Type", "Link") eleTarget.SetAttribute("Link", sLink) Return Me.sSetAction(eleDef, sHtmlElement) Case "DraftTextMessage" Dim sPhoneNumber As String = eleAction.GetAttribute("PhoneNumber") 'Dim sBody As String = eleAction.GetAttribute("Text") ' sms:" & sPhoneNumber & "?body=" & sBody & """" 'As of 2010/11/11, this "body=" breaks iPhone and Android. Dim sLink As String = "sms:" & sPhoneNumber ' & "?" & sBody 'Turn this Action into an Action.Link. eleAction.SetAttribute("Type", "Link") Dim eleTarget As XmlElement = eleAction.AppendChild(eleAction.OwnerDocument.CreateElement("Target")) eleTarget.SetAttribute("Type", "Link") eleTarget.SetAttribute("Link", sLink) Return Me.sSetAction(eleDef, sHtmlElement) Case "DraftEmail" Dim sTo As String = eleAction.GetAttribute("ToEmailAddress") Dim sCc As String = eleAction.GetAttribute("CcEmailAddress") Dim sBcc As String = eleAction.GetAttribute("BccEmailAddress") Dim sSubject As String = eleAction.GetAttribute("EmailSubject") Dim sBody As String = eleAction.GetAttribute("EmailBody") Dim sLink As String = "mailto:" & sTo & "?" If sCc.Length <> 0 Then _ sLink &= "&cc=" & sCc 'Doesn't work well on Android's Exchange. If sBcc.Length <> 0 Then _ sLink &= "&bcc=" & sBcc 'Doesn't work well on Android's Exchange. If sSubject.Length <> 0 Then _ sLink &= "&subject=" & sSubject If sBody.Length <> 0 Then _ sLink &= "&body=" & sBody sLink = sLink.Replace("?&", "?") 'No ampersand for the first parameter. 'Turn this Action into an Action.Link. eleAction.SetAttribute("Type", "Link") Dim eleTarget As XmlElement = eleAction.AppendChild(eleAction.OwnerDocument.CreateElement("Target")) eleTarget.SetAttribute("Type", "Link") eleTarget.SetAttribute("Link", sLink) Return Me.sSetAction(eleDef, sHtmlElement) Case "MapLocation" Dim sQuery As String = Nothing Dim sLatitude As String = eleAction.GetAttribute("Latitude") Dim sLongitude As String = eleAction.GetAttribute("Longitude") Dim sPlaceQuery As String = eleAction.GetAttribute("PlaceQuery") Dim sPlaceCaption As String = eleAction.GetAttribute("PlaceCaption") If sLatitude.Length <> 0 AndAlso sLongitude.Length <> 0 Then sQuery = "q=" & sLatitude & "," & sLongitude ElseIf sPlaceQuery.Length <> 0 Then sQuery = "q=" & sPlaceQuery Else Throw New Exception("Action.MapLocation must have Latitude and Longitude or a PlaceQuery attribute.") End If If sPlaceCaption.Length <> 0 Then _ sQuery &= "(" & sPlaceCaption & ")&iwloc=A" 'Turn this Action into an Action.Link. eleAction.SetAttribute("Type", "Link") Dim eleTarget As XmlElement = eleAction.AppendChild(eleAction.OwnerDocument.CreateElement("Target")) eleTarget.SetAttribute("Type", "Link") eleTarget.SetAttribute("Link", "http://maps.google.com/maps?" & sQuery) Return Me.sSetAction(eleDef, sHtmlElement) Case "Javascript" '23824 'subAddIncludedScript("rdInputValidation.js") Dim sJavascript As String = String.Empty If sValidate Then _ sJavascript = "rdConfirmAndValidateActionJavascript.bind(this)(event,null,true,function(){},function(){});" '#15378. If Not String.IsNullOrEmpty(sConfirm) Then If Not String.IsNullOrEmpty(sJavascript) Then sJavascript = sJavascript.Replace("null", "'" & sConfirm & "'") '#15290. Else sJavascript = "rdConfirmAndValidateActionJavascript.bind(this)(event,'" & sConfirm & "',false,function(){},function(){});" End If End If Dim sJavascriptFromAttr As String = eleAction.GetAttribute("Javascript").Trim() If sJavascriptFromAttr.Length = 0 Then Throw New Exception("Action.Javascript must have a Javascript attribute.") End If If String.IsNullOrEmpty(sJavascript) Then sJavascript = sJavascriptFromAttr Else Dim sOnCancel As String = eleAction.GetAttribute("OnCancel") sJavascript = sJavascript.Replace(",function(){},function(){});", String.Format(",function(){{{0}}},function(){{{1}}});", sJavascriptFromAttr, sOnCancel)) End If Call subAddAdditionalScriptFiles(eleAction) 'Turn this Action into a Target.Link. 14592 eleAction.SetAttribute("Type", "Link") Dim eleTarget As XmlElement = eleAction.AppendChild(eleAction.OwnerDocument.CreateElement("Target")) eleTarget.SetAttribute("Type", "Link") eleTarget.SetAttribute("Link", "javascript:" & sJavascript.Replace("""", "'")) Dim sTarget As String = sGetTarget(eleTarget, TargetType.TargetType_JScript) sAction = " href=""javascript:void 0"" onClick=""" & sTarget & """" '#13969, #13998. Case "EmailReport" Dim eleChildAction As XmlElement = eleAction.SelectSingleNode("Action") If IsNothing(eleChildAction) Then _ Throw New Exception("Action.EmailReport elements must have a child Action element.") Return sProcess_EmailReport(eleAction, eleChildAction, sHtmlElement) End Select 'Is this the default action if the user presses the Enter key? If eleAction.GetAttribute("EnterKeyDefault") = "True" Then 'Ensure that this is the only element with it's ID, because the ID value must be unique. Dim sID As String = eleDef.GetAttribute("ID") If sID.Length = 0 Then _ Throw New Exception("The parent element of an Action with EnterKeyDefault=True must have an ID value.") If eleDef.SelectNodes("//*[@ID='" & sID & "']").Count > 1 Then _ Throw New Exception("The parent element of an Action with EnterKeyDefault=True must have a unique ID value.") If eleDef.Name = "EventHandler" Then _ Throw New Exception("The parent element of an Action with EnterKeyDefault=True cannot be an EventHandler.") msJavaEventFunctionBodyPressEnter = "onKeyPress=""if (event.keyCode==13)rdBodyPressEnter('" & sID & "')""" 'Call subAddIncludedScript("rdActionSubmit2.js") End If 'Special fixups. If eleDef.Name = "Button" Then 'sAction = sAction.Replace("href=""javascript:SubmitForm", "onClick=""SubmitForm") If sAction.IndexOf("onClick=""ShowElement") <> -1 _ Or sAction.IndexOf("onClick=""javascript:rdShowMenu") <> -1 Then sAction = sAction.Replace("href=""javascript:void 0""", "") Else If Not sAction.Contains("onClick=") Then sAction = sAction.Replace("href=""javascript:", "onClick=""") End If End If End If If sAction.Contains("href") _ AndAlso eleDef.Name <> "EventHandler" Then sAction = sAction.Replace("HrefOrClick", "null") Else sAction = sAction.Replace("HrefOrClick", "true") End If Dim bPopupActionsAdded As Boolean = False If eleDef.Name = "PopupOption" Then sSetAction = sAction ElseIf Not String.IsNullOrEmpty(sHtmlElement) AndAlso (sHtmlElement.StartsWith("") If nLastIndexOfTD <> -1 Then 'replace ids Dim eleParentRow As XmlElement = IIf(sStartTag = " 0) Then sParentIdStart = sParentId.Substring(0, nIndexOf_Row) sParentIdEnd = sParentId.Substring(nIndexOf_Row) End If Dim nIndexStart As Integer = sAddPopupActions.IndexOf("id=""") Dim nEndIndex As Integer = sAddPopupActions.IndexOf("""", nIndexStart + 4) sAddPopupActions = sAddPopupActions.Substring(0, nIndexStart + 4) + sParentIdStart + "_rdPopup" + sParentIdEnd + sAddPopupActions.Substring(nEndIndex) End If End If sSetAction = sSetAction.Substring(0, nLastIndexOfTD) + sAddPopupActions + sSetAction.Substring(nLastIndexOfTD) bPopupActionsAdded = True End If Else sSetAction = sSetID(eleAction, "") & sHtmlElement & "" End If If Not bPopupActionsAdded Then 'Insert the popup code at the end, if there was an Action.Popup. sSetAction &= sAddPopupActions ' & sAddPopupJScripts End If End If If eleDef.GetAttribute("Class") = "ThemeLinkButton" Then 'For this special class, the class needs to be applied to the A tag so that text-decoration=none will work for FF and Chrome. sSetAction = sSetAction.Replace("CLASS=""ThemeLinkButton""", "") 'Pull out the class from the parent element's HTML. sSetAction = sSetClass(eleDef, sSetAction) ElseIf eleDef.GetAttribute("Class") = "ThemeLinkButtonSmall" Then sSetAction = sSetAction.Replace("CLASS=""ThemeLinkButtonSmall""", "") 'Pull out the class from the parent element's HTML. sSetAction = sSetClass(eleDef, sSetAction) End If 'Sometimes Class needs to be defined at the A tag, like to set the color for link text. If eleAction.GetAttribute("Class").Length <> 0 Then sSetAction = sSetClass(eleAction, sSetAction) End If End Function Friend Function CreatePopupMenusForMultipleActions(ByVal eleDef As XmlElement, ByVal nlActions As XmlNodeList) As XmlElement Dim sElementID As String = eleDef.GetAttribute("ID") Dim elePopupMenu As XmlElement = Nothing Dim lstActions As List(Of XmlElement) = New List(Of XmlElement) For Each eleAction As XmlElement In nlActions lstActions.Add(eleAction) Next elePopupMenu = eleDef.AppendChild(eleDef.OwnerDocument.CreateElement("Action")) elePopupMenu.SetAttribute("Type", "Popup") elePopupMenu.SetAttribute("ID", String.Format("ppAction_{0}", sElementID)) Dim i As Integer = 0 For Each eleAction As XmlElement In lstActions i += 1 Dim elePopupOption As XmlElement = elePopupMenu.AppendChild(elePopupMenu.OwnerDocument.CreateElement("PopupOption")) elePopupOption.SetAttribute("ID", String.Format("ppOption_{0}_{1}", sElementID, i)) Dim sCaption As String = eleAction.GetAttribute("PopupMenuCaption") If String.IsNullOrEmpty(sCaption) Then sCaption = eleAction.GetAttribute("Type") End If elePopupOption.SetAttribute("Caption", sCaption) elePopupOption.AppendChild(eleAction) Next Return elePopupMenu End Function Private Sub subConvertActionToEventHandler(ByVal eleCol As XmlElement) Dim eleAction As XmlElement = eleCol.SelectSingleNode("Action") If IsNothing(eleAction) Then eleAction = eleCol.SelectSingleNode("EventHandler") If Not IsNothing(eleAction) Then 'column with action must always have an ID If String.IsNullOrEmpty(eleCol.GetAttribute("ID")) Then eleCol.SetAttribute("ID", Guid.NewGuid().ToString()) End If End If Exit Sub End If 'Need to use EventHandlers for Actions inside columns. 10831 'Convert to an EventHandler with "onclick" 'This call be made before sSetEventHandler. Dim eleEventHandler As XmlElement = eleCol.InsertAfter(eleCol.OwnerDocument.CreateElement("EventHandler"), eleAction) eleEventHandler.SetAttribute("DhtmlEvent", "onclick") eleCol.RemoveChild(eleAction) eleEventHandler.AppendChild(eleAction) 'column with action must always have an ID If String.IsNullOrEmpty(eleCol.GetAttribute("ID")) Then eleCol.SetAttribute("ID", Guid.NewGuid().ToString()) End If End Sub Friend Function sGetTarget(ByVal eleTarget As XmlElement, ByVal Type As TargetType) As String If IsNothing(eleTarget) Then _ Throw New Exception("The Target element is required.") Dim sTarget As String Select Case eleTarget.GetAttribute("Type") Case "IncludeFrameReport", "Report", "Export", "PDF", "CSV", "NativeExcel", "NativeWord", "XML", "Widget", "GoogleSpreadsheet" sTarget = eleTarget.GetAttribute("Report") If sTarget.Length = 0 Or sTarget = "CurrentReport" Or sTarget = "CurrentWidget" Then sTarget = msRequestedPage End If Case "Template" sTarget = eleTarget.GetAttribute("TemplateDefinition") Case "Link", "IncludeFrameLink" sTarget = eleTarget.GetAttribute("Link") If sTarget.IndexOf("?") = -1 And sTarget.IndexOf("#") = -1 And sTarget <> "-rdDebugURL-" And sTarget.ToLower.IndexOf("javascript:") = -1 Then 'Usually, add a ? at the end of the target. (Might have been better to add the ? at the begging of LinkParams?) 'There's no great solution. Can't add this without breaking backward compatibility. If sTarget = st.sReplaceTokens(sTarget) Then 'Not if the target contains tokens. '9/19/2005 Here's the fix. "NoQuestionMark": If eleTarget.GetAttribute("NoQuestionMark") <> "True" Then sTarget += "?" End If End If If Type = TargetType.TargetType_JScript AndAlso sTarget.ToLower.StartsWith("javascript:") Then '25721 'RD19773 edited the regex to not remove // if it is part of the url (like http://) RD20417 Dim rgx As New Regex("(? 0 Then _ ' sTarget &= "&" & sBookmarkParams 'Data Cache '19042 removed rdLinkDataLayers - we want BuildHTML to create a new rdDataCache key when in sub-report. If (eleTarget.GetAttribute("Report") = "CurrentReport" _ OrElse eleTarget.GetAttribute("Report") = "CurrentWidget" _ ) _ AndAlso Not eleTarget.GetAttribute("ID").StartsWith("tgtAx") _ AndAlso IsNothing(eleTarget.SelectSingleNode("//DataLayer[@Type='ActiveSQL']")) _ Then 'tgtAx excludes DataCache for AnalysisCrosstab in AnalysisGrid. sTarget &= "&rdDataCache=rdInsertDataCacheKeyHere" End If If eleTarget.GetAttribute("LinkDataLayers") = "True" Then sTarget &= "&rdLinkDataLayers=" & HttpContext.Current.Items("rdRequestedPage") End If 'Report Paging If eleTarget.GetAttribute("Paging").Length <> 0 Then _ sTarget &= "&rdPaging=" & eleTarget.GetAttribute("Paging") 'Report ShowModes If eleTarget.GetAttribute("ReportShowModes").Length <> 0 Then _ sTarget &= "&rdShowModes=" & eleTarget.GetAttribute("ReportShowModes") 'Report Format If eleTarget.GetAttribute("ReportFormat").Length <> 0 Then _ sTarget &= "&rdReportFormat=" & eleTarget.GetAttribute("ReportFormat") If eleTarget.GetAttribute("Type") = "CSV" Then sTarget &= "&rdReportFormat=CSV" If eleTarget.GetAttribute("CsvStringColumns").Length <> 0 Then _ sTarget &= "&rdCsvStringColumns=" & eleTarget.GetAttribute("CsvStringColumns") If eleTarget.GetAttribute("CsvFieldDelimiter").Length <> 0 Then _ sTarget &= "&rdCsvFieldDelimiter=" & util.SimpleDoubleUrlEncode(eleTarget.GetAttribute("CsvFieldDelimiter")) If eleTarget.GetAttribute("CsvRowDelimiter").Length <> 0 Then _ sTarget &= "&rdCsvRowDelimiter=" & util.SimpleDoubleUrlEncode(eleTarget.GetAttribute("CsvRowDelimiter")) End If If eleTarget.GetAttribute("Type") = "NativeExcel" Then sTarget &= "&rdReportFormat=NativeExcel" If eleTarget.GetAttribute("NumericColumns").Length <> 0 Then _ sTarget &= "&rdNumericColumns=" & eleTarget.GetAttribute("NumericColumns") If eleTarget.GetAttribute("DateColumns").Length <> 0 Then _ sTarget &= "&rdDateColumns=" & eleTarget.GetAttribute("DateColumns") If eleTarget.GetAttribute("BooleanColumns").Length <> 0 Then _ sTarget &= "&rdBooleanColumns=" & eleTarget.GetAttribute("BooleanColumns") End If If eleTarget.GetAttribute("Type") = "GoogleSpreadsheet" Then sTarget &= "&rdReportFormat=GoogleSpreadsheet" End If If eleTarget.GetAttribute("Type") = "NativeWord" Then sTarget &= "&rdReportFormat=NativeWord" End If If eleTarget.GetAttribute("Type") = "XML" Then sTarget &= "&rdReportFormat=DataLayerXml" Dim eleXslTransform As XmlElement = eleTarget.SelectSingleNode("XslTransform") If Not IsNothing(eleXslTransform) Then Dim sXslFile As String = eleXslTransform.GetAttribute("XSLFile") If sXslFile.Length = 0 Then _ Throw New Exception("XSLFile is required for XslTransform elements.") sTarget &= "&rdDataLayerXsl=" & sXslFile End If End If If eleTarget.GetAttribute("Type") = "PDF" Then sTarget &= "&rdReportFormat=PDF" 'Need to determine and pass on the PDF page attributes. If eleTarget.GetAttribute("Timeout").Length > 0 Then _ sTarget &= "&rdPdfTimeout=" & eleTarget.GetAttribute("Timeout") 'If eleTarget.GetAttribute("PdfOrientation").Length > 0 Then _ - Orientation is automatic. ' sTarget = sTarget & "&rdPdfOrientation=" & eleTarget.GetAttribute("rdPdfOrientation") 'Dim elePdfPaging As XmlElement = eleTarget.OwnerDocument.SelectSingleNode("//*/PrintablePaging") 'If Not IsNothing(elePdfPaging) Then ' If elePdfPaging.GetAttribute("PageHeight").Length > 0 Then _ ' sTarget = sTarget & "&rdPdfPageHeight=" & elePdfPaging.GetAttribute("PageHeight") ' If elePdfPaging.GetAttribute("PageWidth").Length > 0 Then _ ' sTarget = sTarget & "&rdPdfPageWidth=" & elePdfPaging.GetAttribute("PageWidth") 'End If ' Adding this to the URL, so that studio preview knows whether to open directly(gecko) or launch reader(IE) to render PDF... If rdState.GetApplicationConstant("rdConstant-rdPdfRenderingType").ToUpper() = "MSHTML" Then sTarget &= "&rdPdfRenderOld=True" End If End If ''Request Forwarding. If eleTarget.GetAttribute("RequestForwarding") = "True" Then If eleTarget.GetAttribute("Type") = "PDF" Then '6921 sTarget &= "&rdRequestForwarding=Cache" Else 'An IncludeFrame. Can't submit the form to the frame so we need to forward vars in other ways. If eleTarget.ParentNode.Name = "IncludeFrame" Then 'Going inside the system. Keep the data out of the URL. (Helps with >2K URL limit.) sTarget &= "&rdRequestForwarding=Cache" Else 'Not an IncludeFrame. sTarget &= "&rdRequestForwarding=Form" End If End If End If Dim ExportDataTableID As String = eleTarget.GetAttribute("ExportDataTableID") If ExportDataTableID.Length <> 0 Then sTarget &= "&rdExportTableID=" & ExportDataTableID End If Dim ExportFilename As String = HttpUtility.UrlEncodeUnicode(eleTarget.GetAttribute("ExportFilename")).Replace("%40", "@").Replace("%7e", "~") If eleTarget.GetAttribute("Type") = "PDF" Then ' #10069. Dim KeepTabHeadWithMIR As String = eleTarget.GetAttribute("KeepTableHeadersWithMoreInfoRow") If KeepTabHeadWithMIR.Length <> 0 Then sTarget &= "&rdKeepTabHeadMIR=" & KeepTabHeadWithMIR End If ' Show Links ? '20608 Dim sShowLinks As String = eleTarget.GetAttribute("ShowLinks") If sShowLinks.Length <> 0 AndAlso sShowLinks.ToUpper = "TRUE" Then sTarget &= "&rdShowLinksInPdf=true" End If End If ' gridlines? If eleTarget.GetAttribute("Type") = "NativeExcel" Then Dim sShowGridlines As String = eleTarget.GetAttribute("ShowGridlines") If sShowGridlines.Length <> 0 Then sTarget &= "&rdShowGridlines=" & sShowGridlines End If If eleTarget.SelectSingleNode("WaitPage") IsNot Nothing Then '19212 sTarget &= "&rdHasWaitPanel=True" End If End If ' excel Output Format? #9569 Dim sExcelFormat As String = eleTarget.GetAttribute("ExcelOutputFormat") If sExcelFormat.Length <> 0 Then sTarget &= "&rdExcelOutputFormat=" & sExcelFormat End If ' PaperSize ? 11813 Dim sPaperSize As String = eleTarget.GetAttribute("ExcelPaperSize") If sPaperSize.Length <> 0 Then sTarget &= "&rdExcelPaperSize=" & sPaperSize End If Call subAddIncludedScript("rdScroll.js") If eleTarget.GetAttribute("KeepScrollPosition") = "True" Then Call subAddJavaEventFunction("rdBodyLoad", _ "rdSetScroll()") sTarget &= "&rdSubmitScroll" Else If Not String.IsNullOrEmpty(HttpContext.Current.Session("rdIsEmbeddedReport")) Then Call subAddJavaEventFunction("rdBodyLoad", _ "rdResetScroll(); ") End If End If If eleTarget.GetAttribute("KeepShowElements") = "True" Then sTarget &= "&rdKeepShowElements=True" End If ''Setup the appropriate encoding by changing the Data tokens. 'Select Case eleTarget.GetAttribute("Type") ' Case "IncludeFrameReport", "Report", "Export", "PDF", "CSV", "NativeExcel" ' If Type = TargetType.TargetType_JScript Then ' sTarget = sTarget.Replace("@Data.", "@DataJScriptLink.") 'Data token values need to be UrlEncoded later. ' End If 'End Select 'sTarget = sTarget.Replace("@Data.", "@DataHrefLink.") 'Data token values need to be UrlEncoded later. 'This takes care of parameters. Select Case Type Case TargetType.TargetType_JScript If eleTarget.ParentNode.Attributes("Type").Value = "Link" _ AndAlso sTarget.ToLower.StartsWith("javascript:") Then '10828 sTarget = sTarget.Replace("@Data.", "@DataJScript.") sTarget = sTarget.Replace("@Local.", "@LocalJScript.") sTarget = sTarget.Replace("@Request.", "@RequestJScript.") sTarget = sTarget.Replace("@Cookie.", "@CookieJScript.") sTarget = sTarget.Replace("@Session.", "@SessionJScript.") sTarget = sTarget.Replace("@Constant.", "@ConstantJScript.") sTarget = sTarget.Replace("@Constants.", "@ConstantsJScript.") Else sTarget = sTarget.Replace("@Data.", "@DataJScriptLink.") sTarget = sTarget.Replace("@Local.", "@LocalJScriptLink.") sTarget = sTarget.Replace("@Request.", "@RequestJScriptLink.") sTarget = sTarget.Replace("@Cookie.", "@CookieJScriptLink.") sTarget = sTarget.Replace("@Session.", "@SessionJScriptLink.") sTarget = sTarget.Replace("@Constant.", "@ConstantJScriptLink.") sTarget = sTarget.Replace("@Constants.", "@ConstantsJScriptLink.") End If Case TargetType.TargetType_URL sTarget = sTarget.Replace("@Data.", "@DataHrefLink.").Replace("@Request.", "@RequestHrefLink.") End Select 'sTarget = sTarget.Replace("@DataTarget.", "@Data.").Replace("@RequestTarget.", "@Request.") sTarget = sTokenToXsl(sTarget, xslValueType.Attribute, , True) '15738 - Added "True" for encoding- of curly braces. sTarget = sTarget.Replace(""", """").Replace(" ", "").Replace(" ", "") sTarget = rdUtility.HtmlEncode4(sTarget) ' Refactored to fix issue 26352 which was caused by 25115 & 25549. Url unicode encode ONLY the export filename. Account for tokens. If ExportFilename.Length <> 0 Then sTarget &= rdUtility.HtmlEncode4("&rdExportFilename=") & ExportFilename End If Return sTarget End Function Private Function sEscapeAndTokenize(ByVal value As String, Optional sWrapCharacter As Char = " ") As String 'sWrapCharacter could be ' or " If value.Length = 0 Then _ Return value value = value.Replace(vbCr, "") value = value.Replace(vbLf, "\n") If sWrapCharacter = "'" Then value = value.Replace("'", "\'") ElseIf sWrapCharacter = """" Then value = value.Replace("""", """""") End If value = value.Replace("{", "{{").Replace("}", "}}") value = value.Replace("@Request.", "@RequestJScriptFormLink.") value = value.Replace("@Data.", "@DataJScriptParam.") value = value.Replace("@Local.", "@LocalJScript.") value = value.Replace("@Session.", "@SessionJScript.") value = sTokenToXsl(value, xslValueType.Attribute) value = rdUtility.HtmlEncode4(value) Return value End Function ''' ''' ''' ''' ''' Should be either ' or " ''' ''' Private Function sEscapeAndTokenizeJs(ByVal value As String, sWrapCharacter As Char) As String If value.Length = 0 Then _ Return value value = value.Replace("@Request.", "@Request!Js.") value = value.Replace("@Data.", "@Data!Js.") value = value.Replace("@Local.", "@Local!Js.") value = value.Replace("@Session.", "@Session!Js.") Return sEscapeAndTokenize(value, sWrapCharacter) End Function Private Function sSetTooltipPanel(ByVal eleDef As XmlElement) As String Dim eleTooltipPanel As XmlElement = eleDef.SelectSingleNode("TooltipPanel") If IsNothing(eleTooltipPanel) Then Return "" sProcess_TooltipPanel(eleTooltipPanel, eleTooltipPanel.GetAttribute("ID")) Dim elePopupPanel As XmlElement = eleDef.SelectSingleNode("PopupPanel") If IsNothing(elePopupPanel) Then Return "" Return sProcess_PopupPanel(elePopupPanel, elePopupPanel.GetAttribute("ID")) End Function 'Private Function sSetClass(ByVal eleDef As XmlElement, ByVal sHtmlElement As String, Optional ByVal sClassSuffix As String = "") As String ' sSetClass = sHtmlElement ' If sHtmlElement.Length = 0 Then _ ' Exit Function ' 'Get the current element's class. Look at the ancestors if the current element doesn't have a class. ' Dim sClass As String = eleDef.GetAttribute(ATTR_CLASS) ' Dim eleParent As XmlElement = eleDef ' Do While sClass.Length = 0 ' If eleParent.ParentNode.GetType.Name = "XmlElement" Then ' eleParent = eleParent.ParentNode ' sClass = eleParent.GetAttribute(ATTR_CLASS) ' Else ' Exit Do 'Got to the grand-daddy and never found a class. ' End If ' Loop ' If sClass.Length <> 0 Then ' sClass = sClass & sClassSuffix ' 'If sHtmlElement.Substring(0, 1) = "<" Then ' Dim nPosCloseTag As Integer = sHtmlElement.IndexOf(">") ' If nPosCloseTag <> -1 Then ' sSetClass = sHtmlElement.Substring(0, nPosCloseTag) & " CLASS=""" & sClass & """>" ' If sHtmlElement.Length > nPosCloseTag + 1 Then ' sSetClass = sSetClass & sHtmlElement.Substring(nPosCloseTag + 1) ' End If ' End If ' 'Else ' ' sSetClass = "" & sHtmlElement & "" ' 'End If ' End If 'End Function Private Function sSetClass(ByVal eleDef As XmlElement, ByVal sHtmlElement As String, Optional ByVal sClassAttributeName As String = "Class", Optional ByVal bDontDoConditionalClass As Boolean = False) As String sSetClass = sHtmlElement If sHtmlElement.Length = 0 Then _ Exit Function 'Get the current element's class. Dim sClass As String = eleDef.GetAttribute(sClassAttributeName) If sClass.Contains(",") Then _ sClass = sClass.Replace(",", " ") 'Change commas into spaces. 10730 If sClass.Contains(" ") Then _ sClass = sClass.Replace(" ", " ") 'Change multiple spaces into single spaces. If sClass.Length <> 0 Then sClass = sTokenToXsl(sClass, xslValueType.Attribute) Dim nPosCloseTag As Integer = sHtmlElement.IndexOf(">") If nPosCloseTag <> -1 Then Dim sHtmlElementContent As String = sHtmlElement.Substring(0, nPosCloseTag) '#13093 Class could already have been set by template modifier. sClass should be inserted in the front. If sHtmlElementContent.ToUpper().Contains(" CLASS=""") Then '22141 sSetClass = sHtmlElementContent.Insert(sHtmlElementContent.ToUpper().IndexOf("CLASS=""") + 7, sClass & " ") & ">" Else sSetClass = sHtmlElementContent & " CLASS=""" & sClass & """>" End If If sHtmlElement.Length > nPosCloseTag + 1 Then sSetClass &= sHtmlElement.Substring(nPosCloseTag + 1) End If End If End If If Not bDontDoConditionalClass Then Dim nlConditionalClass As XmlNodeList = eleDef.GetElementsByTagName("ConditionalClass") If nlConditionalClass.Count <> 0 Then Dim sCond As String = "" Dim sConds As String = "" Dim eleCondClass As XmlElement For Each eleCondClass In eleDef.SelectNodes("ConditionalClass") sCond = "IIF(" & eleCondClass.GetAttribute("Condition") & ",""" & eleCondClass.GetAttribute("Class") & """,""rdNoClass"")" If sConds.Length = 0 Then sConds = sCond Else sConds = sConds.Replace("""rdNoClass""", sCond) End If Next If sConds.Length <> 0 Then sConds = rdUtility.HtmlEncode4(sConds) sConds = sConds.Replace("@Request.", "@RequestXmlEncoded.").Replace("@Local.", "@LocalHtmlEncoded.").Replace("@Session.", "@SessionHtmlEncoded.") 'Issue 1629, 8612 Dim sCondClass As String = " rdCondClass=""" & sTokenToXsl(sConds, xslValueType.Attribute) & """ " Dim nPos As Integer = sSetClass.IndexOf(" ") If nPos = -1 Then _ nPos = sSetClass.IndexOf(">") - 1 If nPos > -1 Then _ sSetClass = sSetClass.Insert(nPos + 1, sCondClass) End If End If End If Return sSetClass End Function Private Function sSetStyle(ByVal eleDef As XmlElement, ByVal sHtmlElement As String, Optional ByVal sStyleAttributeName As String = "Style") As String 'This will be used later to allow setting of style for all the low-level elements. sSetStyle = sHtmlElement If sHtmlElement.Length = 0 Then _ Exit Function 'Get the current element's class. Dim sStyle As String = eleDef.GetAttribute(sStyleAttributeName) If sStyle.Length <> 0 Then sStyle = sTokenToXsl(sStyle, xslValueType.Attribute) Dim nPosCloseTag As Integer = sHtmlElement.IndexOf(">") If nPosCloseTag <> -1 Then sSetStyle = sHtmlElement.Substring(0, nPosCloseTag) & " STYLE=""" & sStyle & """>" If sHtmlElement.Length > nPosCloseTag + 1 Then sSetStyle = sSetStyle & sHtmlElement.Substring(nPosCloseTag + 1) End If End If End If Return sSetStyle End Function Private Function sSetEventHandler(ByVal eleDef As XmlElement, ByVal sHtmlElement As String) As String sSetEventHandler = sHtmlElement If sHtmlElement.Length = 0 Then _ Exit Function Dim nlEventHandlers As XmlNodeList = eleDef.SelectNodes("EventHandler") If nlEventHandlers.Count = 0 Then _ Exit Function Dim sChangeFlagJavascript As String = "" Dim nlOnChangeAction As XmlNodeList = eleDef.SelectNodes("EventHandler[@DhtmlEvent='onchange']") '26017 In order to make the change flag work with other onchange events, we need to get the change flag javascript 'and remove the element and add the javascript to the other onchange event. If eleDef.HasAttribute("ChangeFlagElementID") AndAlso nlOnChangeAction.Count > 1 Then Dim eleChangeFlagEventHandler As XmlElement = eleDef.SelectSingleNode("EventHandler[@DhtmlEvent='onchange'][Action/Target[contains(@Link, 'javascript:rdChangeFlag')]]") If Not IsNothing(eleChangeFlagEventHandler) Then Dim eleTarget As XmlElement = eleChangeFlagEventHandler.SelectSingleNode(".//Target[contains(@Link, 'javascript:rdChangeFlag')]") sChangeFlagJavascript = eleTarget.GetAttribute("Link") eleChangeFlagEventHandler.ParentNode.RemoveChild(eleChangeFlagEventHandler) 'Since we have removed an element, we should rebuild the node list to make sure that it is current. nlEventHandlers = eleDef.SelectNodes("EventHandler") End If End If 'Load the element's XSL / XHTML. Dim s As String = "" & sHtmlElement & "" Dim xmlHtml As New XmlDocument() : xmlHtml.LoadXml(s) Dim eleHtml As XmlElement = xmlHtml.DocumentElement.ChildNodes(0) 'This is the HTML element. Dim eleEventHandler As XmlElement For Each eleEventHandler In nlEventHandlers Dim sEvent As String = eleEventHandler.GetAttribute("DhtmlEvent") If sEvent.Length = 0 Then _ Throw New Exception("EventHandler elements must have an Event attribute.") If IsNothing(eleEventHandler.SelectSingleNode("Action")) Then _ Throw New Exception("EventHandler elements must have an Action element.") Dim sHref As String = "" & sSetAction(eleEventHandler, "") & "" sHref = sHref.Replace("xsl:", "xxXSLxx") 'Prevent "undeclared namespace" errors. Dim xmlHref As New XmlDocument() xmlHref.LoadXml(sHref) sHref = xmlHref.DocumentElement.ChildNodes(0).Attributes("href").Value 'The first child always has an href attribute. If sHref = "javascript:void 0" _ AndAlso xmlHref.DocumentElement.ChildNodes(0).Attributes("onClick") IsNot Nothing Then sHref = xmlHref.DocumentElement.ChildNodes(0).Attributes("onClick").Value End If sHref = sHref.Replace("xxXSLxx", "xsl:") '26017 If sEvent = "onchange" AndAlso Not String.IsNullOrEmpty(sChangeFlagJavascript) Then sHref = sChangeFlagJavascript & ";" & sHref End If 'Special for PopupMenus. If eleDef.SelectSingleNode(".//Action[@Type='Popup']") IsNot Nothing Then Return sSetAction(eleEventHandler, sHtmlElement) If Not IsNothing(eleHtml.Attributes.GetNamedItem("data-values")) Then '24592. 'This is for AutoComplete and InputComboList only. There's a bug in which the event type, so the event is always fired. 'Autocomplete may have more than one onchange event, so we need eleHtml.SetAttribute("data-event-" & sEvent.ToLower, sHref) Else If eleEventHandler.GetAttribute("ThrottleTimeout").Length <> 0 Then '25945 add a delay. sHref = String.Format("rdEventThrottle(""{0}"",{1})", sHref, (eleEventHandler.GetAttribute("ThrottleTimeout") * 1000)) End If eleHtml.SetAttribute(sEvent, sHref) End If Next Return xmlHtml.DocumentElement.InnerXml '#13993. End Function Private Function sSetPositioning(ByVal eleDef As XmlElement, ByVal sHtmlElement As String) As String sSetPositioning = sHtmlElement If http.Request("rdWysiwygEdit") = "True" Then 'Normally shouldn't check for request variables here but it's OK for this. 'The lgxKey is a unique identifier for every LGX element used by the IDE for WYSIWYG editing. 'This provides a cross-reference between LGX elements and HTML elements. Dim sLgxKey As String = eleDef.GetAttribute("lgxKey") If sLgxKey.Length <> 0 Then If sHtmlElement.Length = 0 Then _ Exit Function 'AME will force an update of the file, thus "decaching" this definition's XSL. 'Get the current element's ReportDev name. Dim nPosCloseTag As Integer = sHtmlElement.IndexOf(">") If nPosCloseTag <> -1 Then sSetPositioning = sHtmlElement.Substring(0, nPosCloseTag) & " lgxKey=""" & sLgxKey & """ lgxName=""" & eleDef.Name & """>" If sHtmlElement.Length > nPosCloseTag + 1 Then sSetPositioning = sSetPositioning & sHtmlElement.Substring(nPosCloseTag + 1) End If End If End If End If Static bBeenHere As Boolean = False Static bAbsolutePositioning As Boolean = False If Not bBeenHere Then bBeenHere = True If eleDef.OwnerDocument.DocumentElement.GetAttribute("ElementPositioning") = "Absolute" _ OrElse eleDef.OwnerDocument.DocumentElement.GetAttribute("idePositioning") = "Absolute" Then 'idePositioning is for legacy pre version 9.1. bAbsolutePositioning = True End If End If If bAbsolutePositioning Then sSetPositioning = sSetAbsolutePosition(eleDef, sSetPositioning) End If End Function Private Function sSetAbsolutePosition(ByVal eleDef As XmlElement, ByVal sHtmlElement As String) As String 'This function sets absolution positioning when the attributes are present. Static bAbsolutePositioning As Boolean = False Static nAbsoluteMaxTop As Integer = 0 If bAbsolutePositioning And eleDef.GetAttribute("ID") = "rdDebug" Then eleDef.SetAttribute("AbsoluteLeft", 0) eleDef.SetAttribute("AbsoluteTop", nAbsoluteMaxTop + 200) End If sSetAbsolutePosition = sHtmlElement Dim sAbsoluteStyle As String If Not IsNothing(eleDef.Attributes("AbsoluteLeft")) Then bAbsolutePositioning = True sAbsoluteStyle = "Position:absolute;" _ & "Left:" & eleDef.GetAttribute("AbsoluteLeft") & "px;" _ & "Top:" & eleDef.GetAttribute("AbsoluteTop") & "px;" nAbsoluteMaxTop = Math.Max(Val(eleDef.GetAttribute("AbsoluteTop")), nAbsoluteMaxTop) If Array.IndexOf("Division,IncludeHtmlFile,Label".Split(","), eleDef.Name) <> -1 Then If Not IsNothing(eleDef.Attributes("Width")) Then _ sAbsoluteStyle &= "Width:" & eleDef.GetAttribute("Width") & "px;" If Not IsNothing(eleDef.Attributes("Height")) Then _ sAbsoluteStyle &= "Height:" & eleDef.GetAttribute("Height") & "px;" End If If Not IsNothing(eleDef.Attributes("ZIndex")) Then sAbsoluteStyle &= "z-index:" & eleDef.GetAttribute("ZIndex") & ";" End If Dim nPosCloseTag As Integer = sSetAbsolutePosition.IndexOf(">") If nPosCloseTag <> -1 Then Dim nPosStyle As Integer = sSetAbsolutePosition.ToLower.IndexOf("style=""") If nPosStyle <> -1 And nPosStyle < nPosCloseTag Then 'The element already has a style element. Use that one. sSetAbsolutePosition = sSetAbsolutePosition.Insert(nPosStyle + 7, sAbsoluteStyle) Else 'Insert a new style element. sSetAbsolutePosition = sSetAbsolutePosition.Substring(0, nPosCloseTag) & " style=""" & sAbsoluteStyle & """" & sSetAbsolutePosition.Substring(nPosCloseTag) End If End If End If End Function 'Private Function nVersionSequence(ByVal sVersion As String) As Integer ' 'Return a numeric value respresenting a version that can be compared against another version number. ' Dim aParts() As String = sVersion.Split(".") ' nVersionSequence = aParts(0) * 1000000 + aParts(1) * 10000 + aParts(2) 'End Function Private Function bPreEvaluatedConditionIsFalse(eleDef As XmlElement) As Boolean 'See if this is a Condition which can be evaluated now. If so, save some time by doing here instead making an in sSetConditionalElement(). 'Return True when the Condition is fully resolved and evaluated = False. 'When fully evaluated = True, remove the Condition. 'When not fully evaluated, save the Condition for later. If eleDef.GetAttribute("Condition").Trim.Length = 0 Then 'Same has not having the attribute. Return False End If Dim sCond As String = eleDef.GetAttribute("Condition") Dim aMatchTokens As New Regex("(@Data|@Session|@Function.PageCount|@Function.PageNumber|@Function.RowNumber)") '25534 If aMatchTokens.IsMatch(sCond) Then 'Cannot resolve @Data and evaluate the condition until later. 'In some cases, @Session variables are set after the element is processed, so these need to be deferred until later too. #24862 'Condition value is unknown. Return False 'Evaluate later. Else 'Evaluate the condition now. Dim sResolvedCond As String = st.sReplaceTokens(sCond) If sResolvedCond <> sCond Then sCond = sResolvedCond mbDontCacheXsl = True 'There are tokens that have been replaced, can't cache this. End If If sCond.Trim.Length = 0 Then Return True 'There was a condition set, but it's not True, so it's False. 19041 ElseIf sCond.Trim.ToUpper = "FALSE" Then Return True ElseIf sCond.Trim.ToUpper = "TRUE" Then eleDef.RemoveAttribute("Condition") Else Static evl As New rdScriptEvaluator() Dim sResult As String = evl.Eval(sCond) If IsNothing(sResult) Then Return True ElseIf CBool(sResult) Then eleDef.RemoveAttribute("Condition") Else Return True End If End If Return False End If End Function Private Function sSetConditionalElement(ByVal eleDef As XmlElement, ByVal sHtmlElement As String) As String sSetConditionalElement = sHtmlElement If sHtmlElement.Length = 0 Then _ Exit Function If eleDef.GetAttribute("Condition").Trim.Length = 0 Then 'Same has not having the attribute. Exit Function End If Dim sCond As String = eleDef.GetAttribute("Condition") If sCond.Contains("@Request") Then 'This is a very specfic targeted encoding fix for 18935. sCond = st.sReplaceTokens(sCond, , , HttpContext.Current.Application("rdScriptingLanguage"), , New String() {"Request"}) sCond = sCond.Replace("{", "{{").Replace("}", "}}") mbDontCacheXsl = True 'There are tokens that have been replaced, can't cache this. End If sCond = rdUtility.HtmlEncode4(sCond, True) Dim sCondAttr As String = " rdCondition=""" _ & sTokenToXsl(sCond, xslValueType.Attribute).Replace("""", """) _ & """ " Static nCondCnt As Integer nCondCnt += 1 'Make each element unique so that they can be easily parsed in the HTML post-processing that handles rdCondElements. sSetConditionalElement = "" & sHtmlElement & "" If Not IsNothing(eleDef.SelectSingleNode("ancestor::PageHeader | ancestor::PageFooter")) Then sSetConditionalElement = sSetConditionalElement.Replace("rdCondElement", "rdCondPrintable") '#8131 End If End Function 'End Function Private SET_NAME_TOO As Boolean = True Private Function GetUniqueIdForDataTableColumn(ByVal value As String) As String If String.IsNullOrEmpty(value) Then Return GetUniqueIdForDataTableColumn("DataColumn") End If If (_dataColumnNames.ContainsKey(value)) Then Dim count As Integer = _dataColumnNames(value) _dataColumnNames(value) = count + 1 Return value & count End If _dataColumnNames.Add(value, 1) Return value End Function Private Shared Function sSetHtmlStyle(ByVal eledef As XmlElement, ByVal sHtmlElement As String) As String Dim eleHtmlStyle As XmlElement eleHtmlStyle = CType(eledef.SelectSingleNode("./HtmlStyle"), XmlElement) If IsNothing(eleHtmlStyle) OrElse eleHtmlStyle.Attributes.Count = 0 Then Return sHtmlElement End If Dim attributeValues As List(Of String) = New List(Of String) For Each attr As XmlAttribute In eleHtmlStyle.Attributes attributeValues.Add(String.Format("{0}:{1}", attr.Name, attr.Value)) Next Dim attributeValuesArr() As String = attributeValues.ToArray() Dim attributes As String = String.Join(";", attributeValuesArr) & ";" If Not sHtmlElement.Contains("style=") AndAlso Not sHtmlElement.Contains("STYLE=") Then Return sHtmlElement.Insert(sHtmlElement.IndexOf(">"), String.Format(" style='{0}' ", attributes)) Else Dim nStyleIndex As Integer = sHtmlElement.IndexOf("style=") If nStyleIndex = -1 Then nStyleIndex = sHtmlElement.IndexOf("STYLE=") End If Return sHtmlElement.Insert(nStyleIndex + 7, " " & attributes & " ") End If End Function Private Function sSetID(ByVal eleDef As XmlElement, ByVal sHtmlElement As String, Optional ByVal sSuffix As String = "", Optional ByVal bSetNameToo As Boolean = False, Optional ByVal sIdPostfix As String = "") As String sSetID = sHtmlElement If sSetID.Length = 0 Then _ Exit Function Dim nPosCloseTag As Integer = sHtmlElement.IndexOf(">") If nPosCloseTag <> -1 Then ' REPDEV-20312 ' We don't want to call GetAttribute because that will un-xml-encode, ' and we are not re-encoding, we're keeping this value as is and writing it directly to another xml document as text, ' so we need to keep the xml encoding intact Dim sTemp As String = rdUtility.GetAttributeEncoded(eleDef, "ID") & sSuffix If sTemp.Length <> 0 Then Dim bDontOutputElementIDs As Boolean = False If bUnderDataRepeater(eleDef, bDontOutputElementIDs) _ And Not (sHtmlElement.StartsWith(" -1 Then 'Skip the first. It's just the current table. If Not bBeenHere Then bBeenHere = True Else 'This is a parent table. sRowNr = "concat(concat($" & nod.Attributes("ID").Value & "-Position,'.')," & sRowNr & ")" End If End If nod = nod.ParentNode Loop If sRowNr = "position() + $nPageRowCnt * ($nPageNr - 1)" And sHtmlElement.StartsWith("" Else 'Append the row number of this table, and all parent tables, to the end of the id. 'sTemp = "" sSetID = "" If bSetNameToo = SET_NAME_TOO Then _ sSetID &= "" sSetID = sHtmlElement.Substring(0, nPosCloseTag) & " >" & sSetID End If End If Else sSetID = "id=""" & sTemp & sIdPostfix & """" If bSetNameToo = SET_NAME_TOO Then _ sSetID &= " NAME=""" & sTemp & """" sSetID = sHtmlElement.Substring(0, nPosCloseTag) & " " & sSetID & ">" End If If sHtmlElement.Length > nPosCloseTag + 1 Then 'Include the stuff after the closing tag. sSetID = sSetID & sHtmlElement.Substring(nPosCloseTag + 1) End If End If End If End Function Private Function sSetQuicktip(ByVal eleDef As XmlElement, ByVal sHtmlElement As String) As String 'NOTE!! Quicktips under Label, Division, and other elements besides charts is not currently supported. 188914 If sHtmlElement.Length = 0 Then _ Return "" 'There is token replacement done during the XSL creation, so XSL caching won't work. mbDontCacheXsl = True ' Not for exports... If bExportReport() Then _ Return sHtmlElement Dim nPosCloseTag As Integer = sHtmlElement.IndexOf(">") If nPosCloseTag <> -1 Then Dim quicktipAttributes As Hashtable Dim eleQuicktip As XmlElement = eleDef.SelectSingleNode("Quicktip") If Not IsNothing(eleQuicktip) Then ' I tried dynamically loading CSS via YUI Loader but it would add CSS link to bottom of ' This in turn caused the default CSS to override our Theme CSS, so revert to old server driven loading. subAddIncludedCss("rdYui/rdQuicktip.css") ' Pull any customized options from element and generate JS call subAddYUIInitializer("'quicktip'", rdQuicktip.generateQuicktipJsInitialization()) ' get and add quicktip attributes to the element. Dim rdQt As rdQuicktip = New rdQuicktip quicktipAttributes = rdQt.getQuicktipAttributes(eleDef) For Each attribute As DictionaryEntry In quicktipAttributes HTMLUtility.appendAttribute(attribute.Key, attribute.Value, " ", True, sHtmlElement) Next attribute 'Add a new label with script containing Json quicktip data for this element. If Not IsNothing(rdQt.JsonGuid) And Not IsNothing(rdQt.JsonData) Then Dim sJsonData As String = rdQt.JsonGuid & "=" & rdQt.JsonData & ";" sJsonData = String.Format("", sJsonData) 'Insert a new Label element with Format="HTML". Dim eleLabel As XmlElement = eleDef.ParentNode.InsertAfter(eleDef.OwnerDocument.CreateElement("Label"), eleDef) eleLabel.SetAttribute("Caption", sJsonData) eleLabel.SetAttribute("Format", "HTML") End If rdQt = Nothing End If End If sSetQuicktip = sHtmlElement End Function 'Private Function sSetBackgroundImage(ByVal eleDef As XmlElement, ByVal sHtmlElement As String) As String ' sSetBackgroundImage = sHtmlElement 'This isn't supported. Background images can usually be set in the style sheet. 'We may bring this back to support dynammic background images based on a DataLayer. 'If sHtmlElement.Length = 0 Then _ ' Exit Function ''Get the current element's background image. 'Dim sImageFile As String = eleDef.GetAttribute("ImageFile") 'If sImageFile.Length <> 0 Then ' If sImageFile.IndexOf("/") = -1 And sImageFile.IndexOf("@") = -1 Then ' 'sImageFile = "../../_Images/" & sImageFile 'Add the _Images when there's not a token. ' sImageFile = "_Images/" & sImageFile 'Add the _Images when there's not a token. ' End If ' sImageFile = sTokenToXsl(sImageFile, xslValueType.Attribute) ' 'If sHtmlElement.Substring(0, 1) = "<" Then ' Dim nPosCloseTag As Integer = sHtmlElement.IndexOf(">") ' If nPosCloseTag <> -1 Then ' sSetBackgroundImage = sHtmlElement.Substring(0, nPosCloseTag) & " background=""" & sImageFile & """>" ' If sHtmlElement.Length > nPosCloseTag + 1 Then ' sSetBackgroundImage = sSetBackgroundImage & sHtmlElement.Substring(nPosCloseTag + 1) ' End If ' End If 'End If 'End Function 'Private Function sSetAlign(ByVal eleDef As XmlElement, ByVal sHtmlElement As String) As String ' 'Commented, Arman doesn't like feature. ' 'If sHtmlElement.Length = 0 Then _ ' ' Exit Function ' 'Dim sAlign = eleDef.GetAttribute("Align") ' 'Dim sVAlign = eleDef.GetAttribute("VAlign") ' 'If sAlign.Length + sVAlign.Length <> 0 Then ' ' Dim nPosCloseTag As Integer = sHtmlElement.IndexOf(">") ' ' If nPosCloseTag <> -1 Then ' ' If sAlign.Length <> 0 Then ' ' sHtmlElement = sHtmlElement.Substring(0, nPosCloseTag) & " align=""" & sAlign & """" & sHtmlElement.Substring(nPosCloseTag) ' ' End If ' ' If sVAlign.Length <> 0 Then ' ' sHtmlElement = sHtmlElement.Substring(0, nPosCloseTag) & " valign=""" & sVAlign & """" & sHtmlElement.Substring(nPosCloseTag) ' ' End If ' ' End If ' 'End If ' sSetAlign = sHtmlElement 'End Function Private Function sSetVisibility(ByVal eleDef As XmlElement, ByVal sHtmlElement As String) As String If sHtmlElement.Length = 0 Then _ Return "" Dim nPosCloseTag As Integer = sHtmlElement.IndexOf(">") If nPosCloseTag <> -1 Then Dim sStyleValue As String If bElementInitiallyVisible(eleDef) Then ' sStyleValue = "display: " Else sStyleValue = DISPLAY_STYLE_NONE Dim nPosStyle As Integer = sHtmlElement.ToLower.IndexOf("style=""") If nPosStyle <> -1 And nPosStyle < nPosCloseTag Then 'The element already has a style element. Use that one. sHtmlElement = sHtmlElement.Insert(nPosStyle + 7, sStyleValue) Else 'Insert a new style element. sHtmlElement = sHtmlElement.Substring(0, nPosCloseTag) & " style=""" & sStyleValue & """" & sHtmlElement.Substring(nPosCloseTag) End If End If End If sSetVisibility = sHtmlElement End Function Private Function sSetCellSpacing(ByVal eleDef As XmlElement, ByVal sHtmlElement As String) As String sSetCellSpacing = sHtmlElement If sSetCellSpacing.Length = 0 Then _ Exit Function Dim sTemp As String = eleDef.GetAttribute("CellSpacing") If sTemp.Length <> 0 Then Dim nPosCloseTag As Integer = sHtmlElement.IndexOf(">") If nPosCloseTag <> -1 Then sSetCellSpacing = sHtmlElement.Substring(0, nPosCloseTag) & " cellspacing=""" & sTemp & """>" If sHtmlElement.Length > nPosCloseTag + 1 Then sSetCellSpacing = sSetCellSpacing & sHtmlElement.Substring(nPosCloseTag + 1) End If End If End If 'NOTE: CellPadding is currently in a Prototype status (for Calvin). This attribute is not in the Rules. sTemp = eleDef.GetAttribute("CellPadding") If sTemp.Length <> 0 Then Dim nPosCloseTag As Integer = sHtmlElement.IndexOf(">") If nPosCloseTag <> -1 Then sSetCellSpacing = sHtmlElement.Substring(0, nPosCloseTag) & " cellpadding=""" & sTemp & """>" If sHtmlElement.Length > nPosCloseTag + 1 Then sSetCellSpacing = sSetCellSpacing & sHtmlElement.Substring(nPosCloseTag + 1) End If End If End If End Function 'Private Function sGetImageTextAttributes(ByVal eleDef As XmlElement) As String ' sGetImageTextAttributes = "" ' If eleDef.GetAttribute("Tooltip").Length <> 0 Then _ ' sGetImageTextAttributes &= " TITLE=""" & sTokenToXsl(eleDef.GetAttribute("Tooltip"), xslValueType.Attribute, True) & """" ' If eleDef.GetAttribute("AltText").Length <> 0 Then _ ' sGetImageTextAttributes &= " ALT=""" & sTokenToXsl(eleDef.GetAttribute("AltText"), xslValueType.Attribute, True) & """" 'End Function Private Function sGetImageTextAttributes(ByVal eleDef As XmlElement) As String sGetImageTextAttributes = "" If eleDef.GetAttribute("Tooltip").Length <> 0 Then _ sGetImageTextAttributes &= sGetTooltipTitle(eleDef) Dim sAltText As String = eleDef.GetAttribute("AltText") If sAltText.Length = 0 Then sGetImageTextAttributes &= " alt=""""" 'For 508 accessibility, write a blank alt attribute. 20560 Else If sAltText.IndexOf("@Chart.") = -1 And sAltText.IndexOf("@Marker.") = -1 Then sGetImageTextAttributes &= " alt=""" & sTokenToXsl(sAltText, xslValueType.Attribute, True) & """" End If End If End Function Private Function sGetTooltipTitle(ByVal eleDef As XmlElement, Optional ByVal sTooltipAttribute As String = "Tooltip") As String Dim sTooltip As String = eleDef.GetAttribute(sTooltipAttribute) If sTooltip.Length = 0 Then Return String.Empty ElseIf sTooltip.IndexOf("@Chart.") <> -1 Then Return String.Empty ElseIf sTooltip.StartsWith("=") Then 'The tooltip is a formula. The value is calculated post-XSL transformation. sTooltip = rdUtility.HtmlEncode4(sTooltip, True) sTooltip = " rdFormulaTitle=""" & sTokenToXsl(sTooltip.Substring(1), xslValueType.Attribute, True) & """ " Return sTooltip & " TITLE=""rdFormulaTitleValue""" Else Return " TITLE=""" & sTokenToXsl(sTooltip, xslValueType.Attribute, True) & """" End If Return sTooltip End Function Friend Function bElementInitiallyVisible(ByVal eleDef As XmlElement, Optional ByVal bSearchAncestors As Boolean = False) As Boolean 'This function determines if the current element is initially visible. Dim sShowModes As String = eleDef.GetAttribute("ShowModes") If sShowModes.Contains("@") Then mbDontCacheXsl = True 'Don't cache the definition if ShowModes has a token. sShowModes = st.sReplaceTokens(sShowModes) End If If sShowModes.Length = 0 Or sShowModes = "All" Then bElementInitiallyVisible = True Else If sShowModes <> "None" Then Dim aVisibleModes() As String = Split(sShowModes, ",") If Not IsNothing(maReportShowModes) AndAlso maReportShowModes.Length > 0 AndAlso maReportShowModes(0).Length = 0 Then bElementInitiallyVisible = True Else Dim sMode As String For Each sMode In maReportShowModes If Array.IndexOf(aVisibleModes, sMode) > -1 Then bElementInitiallyVisible = True End If Next End If ' built in showmodes.12533 Dim aAllVisibleModes() As String = sShowModes.Replace(" ", "").Split(",") '12660 Dim aExportShowModes() As String = st.sGetRequestVar("rdShowModes").Replace(" ", "").Split(",") Select Case st.sGetRequestVar("rdReportFormat") '12661 Case "PDF" If Array.IndexOf(aAllVisibleModes, "rdExportPdf") <> -1 Or Array.IndexOf(aAllVisibleModes, "rdExport") <> -1 Then bElementInitiallyVisible = True ElseIf bElementVisible(aAllVisibleModes, aExportShowModes) Then bElementInitiallyVisible = True ElseIf Array.IndexOf(aAllVisibleModes, "rdExportExcel") <> -1 Or Array.IndexOf(aAllVisibleModes, "rdBrowser") <> -1 _ Or Array.IndexOf(aAllVisibleModes, "rdExportWord") <> -1 Or Array.IndexOf(aAllVisibleModes, "rdExportCsv") <> -1 Then bElementInitiallyVisible = False End If Case "NativeExcel" If Array.IndexOf(aAllVisibleModes, "rdExportExcel") <> -1 Or Array.IndexOf(aAllVisibleModes, "rdExport") <> -1 Then bElementInitiallyVisible = True ElseIf bElementVisible(aAllVisibleModes, aExportShowModes) Then bElementInitiallyVisible = True ElseIf Array.IndexOf(aAllVisibleModes, "rdExportPdf") <> -1 Or Array.IndexOf(aAllVisibleModes, "rdBrowser") <> -1 _ Or Array.IndexOf(aAllVisibleModes, "rdExportWord") <> -1 Or Array.IndexOf(aAllVisibleModes, "rdExportCsv") <> -1 Then bElementInitiallyVisible = False End If Case "NativeWord" If Array.IndexOf(aAllVisibleModes, "rdExportWord") <> -1 Or Array.IndexOf(aAllVisibleModes, "rdExport") <> -1 Then bElementInitiallyVisible = True ElseIf bElementVisible(aAllVisibleModes, aExportShowModes) Then bElementInitiallyVisible = True ElseIf Array.IndexOf(aAllVisibleModes, "rdExportExcel") <> -1 Or Array.IndexOf(aAllVisibleModes, "rdBrowser") <> -1 _ Or Array.IndexOf(aAllVisibleModes, "rdExportPdf") <> -1 Or Array.IndexOf(aAllVisibleModes, "rdExportCsv") <> -1 Then bElementInitiallyVisible = False End If Case "CSV" If Array.IndexOf(aAllVisibleModes, "rdExportCsv") <> -1 Or Array.IndexOf(aAllVisibleModes, "rdExport") <> -1 Then bElementInitiallyVisible = True ElseIf bElementVisible(aAllVisibleModes, aExportShowModes) Then bElementInitiallyVisible = True ElseIf Array.IndexOf(aAllVisibleModes, "rdExportExcel") <> -1 Or Array.IndexOf(aAllVisibleModes, "rdBrowser") <> -1 _ Or Array.IndexOf(aAllVisibleModes, "rdExportPdf") <> -1 Or Array.IndexOf(aAllVisibleModes, "rdExportWord") <> -1 Then bElementInitiallyVisible = False End If Case "" If Array.IndexOf(aAllVisibleModes, "rdBrowser") <> -1 Then bElementInitiallyVisible = True ElseIf bElementVisible(aAllVisibleModes, maReportShowModes) Then bElementInitiallyVisible = True ElseIf Array.IndexOf(aAllVisibleModes, "rdExport") <> -1 Or Array.IndexOf(aAllVisibleModes, "rdExportPdf") <> -1 _ Or Array.IndexOf(aAllVisibleModes, "rdExportWord") <> -1 Or Array.IndexOf(aAllVisibleModes, "rdExportExcel") <> -1 _ Or Array.IndexOf(aAllVisibleModes, "rdExportCsv") <> -1 Then '15456 bElementInitiallyVisible = False End If End Select End If End If If sShowModes = "None" Then bElementInitiallyVisible = False End If 'Special case for PrintablePaging. Should be invisible unless doing printable paging or has ShowModes. If (eleDef.Name = "PageHeader" Or eleDef.Name = "PageFooter") _ And Len(eleDef.GetAttribute("ShowModes")) = 0 Then If sGetPagingMethod() <> "Printable" Then bElementInitiallyVisible = False End If End If 'Special case for PopupPanel elements. They always start hidden. If eleDef.Name = "PopupPanel" Then bElementInitiallyVisible = False End If 'If Not http.Items("SupportShowElementHistory") Then 'Don't base this items visibility on it's ancestors when we're using KeepShowElements. '21994 - Exclude NativeExcel from list to mirror the behavior of the PDF export. If Array.IndexOf("Excel,Word,NativeWord,CSV".Split(","), st.sGetRequestVar("rdReportFormat")) <> -1 Then 'IE handles hiding of children fine, so does Word, but not Excel. Done for Word anyway just to reduce size, or maybe for older versions of Word too. 'Next check this element's parents. If any are not Visible, then this isn't visible either. If eleDef.Name <> "DataTableColumn" Then 'Don't search ancestors of DataTableColumns. bSearchAncestors = True End If End If If bSearchAncestors Then If bElementInitiallyVisible Then If Not IsNothing(eleDef.ParentNode) Then If eleDef.ParentNode.NodeType = XmlNodeType.Element Then 'If Not bElementInitiallyVisible(eleDef.ParentNode) Then If Not bElementInitiallyVisible(eleDef.ParentNode, True) Then '#6156 bElementInitiallyVisible = False End If End If End If End If End If ' ''bElementInitiallyVisible = True ' ''Dim nod As XmlNode = eleDef ' ''Do While True ' '' nod = nod.ParentNode ' '' If IsNothing(nod) Then ' '' Exit Do ' '' End If ' '' If nod.GetType.ToString = "System.Xml.XmlElement" Then ' '' Dim ele As XmlElement = nod ' '' If ele.GetAttribute("Visible") = "False" Thens ' '' bElementInitiallyVisible = False ' '' Exit Do ' '' End If ' '' End If ' ''Loop End Function Private Function bElementVisible(ByVal aAllVisibleModes() As String, Optional ByVal aShowModes() As String = Nothing) As Boolean Dim beleVisible As Boolean = False Dim i As Integer = Nothing If Not IsNothing(aShowModes) Then For i = 0 To aShowModes.Length - 1 If Array.IndexOf(aAllVisibleModes, aShowModes(i)) <> -1 Then beleVisible = True End If Next End If Return beleVisible End Function Private Function bUnderDataRepeater(ByVal eleDef As XmlElement, Optional ByRef bDontOuputIDs As Boolean = False) As Boolean 'This function determines if the current element is under a data table. Static DataTableChildren() As String = "DataTableColumn,GroupHeaderRow,GroupSummaryRow,MoreInfoRow,DataTreeBranch,GoogleMapMarkers,GoogleMapPolygons,GoogleMapPolylines".Split(",") Dim nod As XmlNode = eleDef Do While Not IsNothing(nod) If Array.IndexOf(DataTableChildren, nod.Name) <> -1 Then If nod.SelectNodes("ancestor::DataTable[@DontOutputElementIDs='True']").Count <> 0 Then '#9301 bDontOuputIDs = True End If Return True End If nod = nod.ParentNode If Not IsNothing(nod) Then _ If nod.Name = "DataMultiColumnList" Or nod.Name = "DataList" Then _ Return True 'A child of a DataMultiColumnList, but not the DataMultiColumnList itself. Loop '#2871-Added "GroupHeaderRow,GroupSummaryRow" above. '#9087-Added "DataMultiColumnList" End Function Private Function bUnderGoogleMapMarkers(ByVal eleDef As XmlElement) As Boolean Static DataTableChildren() As String = "GoogleMapMarkers".Split(",") Dim nod As XmlNode = eleDef Do While Not IsNothing(nod) If Array.IndexOf(DataTableChildren, nod.Name) <> -1 Then Return True End If nod = nod.ParentNode Loop End Function 'Private Function sGetIncludedJavaScript() As String ' Dim sbScript As New StringBuilder() ' Dim saScripts As String() = msScriptList.Split(",") ' Dim sScriptFile As String ' For Each sScriptFile In saScripts ' sbScript.Append(ReadFile(rdState.sGetphysicalpath() & "\rdTemplate\rd" & sScriptFile & ".js")) ' Next ' sGetIncludedJavaScript = sbScript.ToString 'End Function Friend Sub subAddIncludedScript(ByVal sScriptName As String) ' what if there was a script named hello_world.js ' and also a script named not_hello_world.js ' and what if the not_hello_world.js was added first ' then when we try to add hello_world.js, it would not add the second one ' ... actually yes it would, because we would have prefixed the files with a folder name + slash If msScriptList.IndexOf(sScriptName & ",") = -1 Then If (sScriptName = "rdScroll.js") _ AndAlso Not IsNothing(HttpContext.Current.Items("rdIsWidgetRequest")) Then 'Don't add this file for Widgets. Else msScriptList = msScriptList & sScriptName & "," End If End If End Sub Private Sub subAddAdditionalScriptFiles(ByVal eleAction As XmlElement) 'Add ScriptFiles that are defined under Action.Javascript. For Each atrScriptFile As XmlAttribute In eleAction.SelectNodes(".//@ScriptFile") If System.IO.File.Exists(rdState.sGetPhysicalPath() & Path.DirectorySeparatorChar & "_SupportFiles" & Path.DirectorySeparatorChar & atrScriptFile.Value) Then subAddIncludedScript("_SupportFiles/" & atrScriptFile.Value) ElseIf System.IO.File.Exists(rdState.sGetPhysicalPath() & Path.DirectorySeparatorChar & "_Scripts" & Path.DirectorySeparatorChar & atrScriptFile.Value) Then subAddIncludedScript("_Scripts/" & atrScriptFile.Value) Else subAddIncludedScript(atrScriptFile.Value) End If Next End Sub Private Sub subAddFormulaScriptFilesUnderChart(ByRef eleDef As XmlElement) 'Add ScriptFiles directly under the chart definition. Dim eleRoot As XmlDocument = eleDef.OwnerDocument Dim nlScript As XmlNodeList = eleRoot.SelectNodes("/*//FormulaScriptFile") Dim iEnd As Integer = nlScript.Count - 1 For i As Integer = 0 To iEnd 'For Each eleScript As XmlElement In nlScript Dim eleScript As XmlElement = nlScript.Item(i).Clone '18401 eleDef.AppendChild(eleScript) Next End Sub Private Function sGetIncludedJavaScript() As String Dim sbScript As New StringBuilder() Dim saScripts As String() = msScriptList.Split(",") Dim sScriptFile As String Dim m As Match Dim iLimit As Integer Dim saSrc As New List(Of String)(saScripts.Length) For i As Integer = 0 To saScripts.Length - 1 sScriptFile = saScripts(i) If sScriptFile.Length <> 0 Then m = Regex.Match(sScriptFile, "^\(\d+\)") If m.Success Then iLimit = CInt(m.Value.Substring(1, m.Value.Length - 2)) sScriptFile = sScriptFile.Substring(m.Value.Length) Else iLimit = -1 End If If Not (sScriptFile.StartsWith("http:") OrElse sScriptFile.StartsWith("https:")) _ AndAlso Not sScriptFile.StartsWith("_SupportFiles") _ AndAlso Not sScriptFile.StartsWith("_Scripts") Then _ sScriptFile = "rdTemplate/" & sScriptFile ''This can be uncommented for debugging purposes. It will load the full Yahoo javascript files. 'sScriptFile = sScriptFile.Replace("-min.js", ".js") sScriptFile = sTokenToXsl(sScriptFile, xslValueType.Attribute, True) 'Get special characters in the URL through XSL. If iLimit > 0 Then Dim iCnt As Integer = 0 For j As Integer = 0 To saSrc.Count - 1 If saSrc(j) = sScriptFile Then iCnt += 1 If iCnt >= iLimit Then Exit For End If End If Next If iCnt >= iLimit Then Continue For End If End If saSrc.Add(sScriptFile) '#6785 Special case for the rdInputValueDelimiter. If mbAddAjaxSupport Then '23824 --- old:'If sScriptFile.Contains("rdAjax2.js") Then Dim sInputValueDelimiter As String = st.InputValueDelimiter If sInputValueDelimiter <> "," Then If sInputValueDelimiter = "?" Then sInputValueDelimiter = "\u00b6" 'This needs to be encoded. sbScript.Append("" & CrLf) End If End If Dim sScriptLanguage As String = IIf(sScriptFile.IndexOf(".vbs") = -1, "JAVASCRIPT", "VBSCRIPT") sbScript.Append("" & CrLf) 'sbScript.Append("" & CrLf) End If Next sGetIncludedJavaScript = sbScript.ToString End Function Friend Sub subAddJavaEventFunction(ByVal sCallingEvent As String, ByVal sFunction As String) Select Case sCallingEvent Case "rdBodyLoad" If msJavaEventFunctionBodyLoad.IndexOf(sFunction & CrLf) = -1 Then msJavaEventFunctionBodyLoad &= sFunction & CrLf End If Case "rdBodyResize" If msJavaEventFunctionBodyResize.IndexOf(sFunction & CrLf) = -1 Then msJavaEventFunctionBodyResize &= sFunction & CrLf End If 'Case "rdBodyClick" ' If msJavaEventFunctionBodyClick.IndexOf(sFunction & CrLf) = -1 Then ' msJavaEventFunctionBodyClick &= sFunction & CrLf ' End If Case "domready" If msJavaEventFunctionDomReady.IndexOf(sFunction) = -1 Then msJavaEventFunctionDomReady &= sFunction & CrLf End If Case Else Throw New Exception("An invalid CallingEvent was specified for subAddJavaFunction().") End Select End Sub Friend Sub subAddYUIInitializerOnce(yuiUse As String, script As String) If Not msYUIInitialize.Contains(script) Then subAddYUIInitializer(yuiUse, script) End If End Sub Friend Sub subAddYUIInitializer(yuiUse As String, script As String) Dim arrUse() As String = yuiUse.Split(",") Dim strSep As String = "" 'Add "new" libraries to the main use For Each strYUILib As String In arrUse If msYUIUse.Length > 0 Then strSep = "," If Not msYUIUse.Contains(strYUILib) Then msYUIUse &= strSep & strYUILib Next msYUIInitialize &= script End Sub Friend Sub subAddIncludedCss(ByVal sCssFilename As String) 'This sub added for 15133. If msCssList.IndexOf(sCssFilename & ",") = -1 Then 'Only add each .css once. msCssList &= sCssFilename & "," End If End Sub Private Function sGetIncludedCssLinks() As String Dim sbCss As New StringBuilder() Dim saCsss As String() = msCssList.Split(",") Dim sCssFilename As String For Each sCssFilename In saCsss If sCssFilename.Length <> 0 Then sbCss.AppendLine("") End If Next Return sbCss.ToString End Function Friend Sub subAddCustomHtmlIntoHead(ByVal key As String, ByVal scriptText As String) If IsNothing(lstHeadCustomHtmlKyes) Then lstHeadCustomHtmlKyes = New List(Of String) sbHeadCustomHtml = New StringBuilder() End If 'already added If lstHeadCustomHtmlKyes.Contains(key) Then Return End If lstHeadCustomHtmlKyes.Add(key) sbHeadCustomHtml.Append(scriptText) End Sub Friend Sub subDataSort9(ByRef xmlDef As XmlDocument, ByRef streamData As Stream, ByRef bDataModified As Boolean) 'Dataset Sorting. Const TABLE As Integer = 0 Const COLUMN As Integer = 1 Const DATA_TYPE As Integer = 2 Const ORDER As Integer = 3 Const REVERSE_ORDER As Integer = 4 Dim bContinueSort As Boolean = False '26372 If Array.IndexOf("NativeExcel,PDF".Split(","), st.sGetRequestVar("rdReportFormat")) <> -1 AndAlso Not IsNothing(http.Session("rdRememberSort-" & msRequestedPage)) Then bContinueSort = True End If 'NewPageNr can be True, True1, or True2. If st.sGetRequestVar("rdNewPageNr").StartsWith("True") _ AndAlso st.sGetRequestVar("rdResort") <> "True" Then ' rdResort is special for Fresenius. Exit Sub 'Don't resort when paging. ElseIf st.sGetRequestVar("rdEmbeddedSubReport") = "True" And Not bContinueSort Then Exit Sub 'Don't do any sorting for embedded SubReports. (They would have to be IFrame SubReports.) '#8473 End If Dim bRememberedSort As Boolean = False Dim sSort As String = http.Request("rdSort") If IsNothing(sSort) Then '#21132. If st.sGetRequestVar("rdAgCommand") = "CalcAdd" OrElse st.sGetRequestVar("rdAgCommand") = "AggrUpdateLayout" _ OrElse st.sGetRequestVar("rdAgCommand") = "LayoutSet" OrElse st.sGetRequestVar("rdAgCommand") = "LayoutSet" _ OrElse st.sGetRequestVar("rdAgCommand") = "OrderAdd" OrElse st.sGetRequestVar("rdAgCommand") = "OrderRemove" OrElse st.sGetRequestVar("rdAgCommand") = "OrderReplace" _ OrElse st.sGetRequestVar("rdAgCommand") = "ChartAdd" OrElse st.sGetRequestVar("rdAgCommand") = "ChartRemove" OrElse st.sGetRequestVar("rdAgCommand") = "ChartReplace" _ OrElse st.sGetRequestVar("rdAgCommand") = "CrosstabAdd" OrElse st.sGetRequestVar("rdAgCommand") = "CrosstabRemove" OrElse st.sGetRequestVar("rdAgCommand") = "CrosstabReplace" _ OrElse st.sGetRequestVar("rdAgCommand") = "GroupAdd" OrElse st.sGetRequestVar("rdAgCommand") = "GroupRemove" OrElse st.sGetRequestVar("rdAgCommand") = "GroupReplace" OrElse st.sGetRequestVar("rdAgCommand") = "GroupRemove" _ OrElse st.sGetRequestVar("rdAgCommand") = "AggrAdd" OrElse st.sGetRequestVar("rdAgCommand") = "AggrRemove" OrElse st.sGetRequestVar("rdAgCommand") = "AggrReplace" _ OrElse st.sGetRequestVar("rdAgCommand") = "Paging" OrElse st.sGetRequestVar("rdAgCommand") = "UpdateAgFromQb" _ OrElse st.sGetRequestVar("rdAgReset") = "True" Then Exit Sub '#19927, 20042, 20259, 20266, 23324. End If If IsNothing(sSort) Then sSort = http.Session("rdRememberSort-" & msRequestedPage) If IsNothing(sSort) Then Exit Sub Else bRememberedSort = True End If End If 'Issue 17209 - Sorting on column names with spaces. The original replace code removed all the spaces, ' that prevented sorting on column names containing spaces. The reason we perform the ' replace is undocumented, so I have switched it to a simple trim. Now only the leading and ' trailing spaces are removed from the string. Further down I encode the column names so that ' they match the encoded attribute names. sSort = sSort.Trim() 'sSort = sSort.Replace(" ", "") If sSort.Length = 0 Then Exit Sub 'Issue 8457 - DataLayer ID needed to sort only that datalayer. Dim sID As String = "" If sSort.IndexOf("~") <> -1 Then sID = sSort.Substring(0, sSort.IndexOf("~")) If bRememberedSort Then '#20086. If IsNothing(xmlDef.DocumentElement.SelectSingleNode("//*[@ID='" & sID & "']/DataLayer[@Type='ActiveSQL']")) AndAlso IsNothing(streamData) Then Exit Sub End If Dim eleAGGroupFilter As XmlElement = xmlDef.SelectSingleNode(".//DataTable[@ID='dtAnalysisGrid']/GroupHeaderRow") '19288 Dim saSortRequest() As String = sSort.Split("~") 'There may be multiple sort columns, delimited by commas. Dim sSortElements As String = "" Dim aSortColNames() As String = saSortRequest(COLUMN).Split(",") Dim aSortDataTypes() As String = saSortRequest(DATA_TYPE).ToLower.Split(",") Dim aSortOrders() As String = saSortRequest(ORDER).ToLower.Split(",") Dim aSortReverseOrders() As String = saSortRequest(REVERSE_ORDER).ToLower.Split(",") ''#6684 Fixup the DataTypes and Orders arrays if they don't have the same number of items. ReDim Preserve aSortDataTypes(UBound(aSortColNames)) ReDim Preserve aSortOrders(UBound(aSortColNames)) ReDim Preserve aSortReverseOrders(UBound(aSortColNames)) Dim i As Integer For i = 0 To aSortColNames.Length - 1 If IsNothing(aSortDataTypes(i)) OrElse aSortDataTypes(i).Length = 0 Then _ aSortDataTypes(i) = "text" If IsNothing(aSortOrders(i)) OrElse aSortOrders(i).Length = 0 Then _ aSortOrders(i) = "ascending" If IsNothing(aSortReverseOrders(i)) OrElse aSortReverseOrders(i).Length = 0 Then 'Set up the sort order for next time. If aSortOrders(i) = "descending" Then aSortReverseOrders(i) = "ascending" Else aSortReverseOrders(i) = "descending" End If End If Next For i = 0 To aSortColNames.Length - 1 Dim sSortColName As String = aSortColNames(i) Dim sSortDataType As String = "" sSortDataType = aSortDataTypes(i) If sSortDataType <> "number" Then sSortDataType = "text" 'Dates are sorted as text, since the format works out that way anyhow. End If Dim sSortElement As String = "" sSortElement = sSortElement.Replace("rdColumn", XmlConvert.EncodeLocalName(sSortColName)) 'This is a number. Check for internationalization. If sSortDataType = "number" Then If rdInternational.ServerDecimalCharacter = "," Then sSortElement = sSortElement.Replace("@rdColumn", "translate(@rdColumn,',','.')") End If End If sSortElement = sSortElement.Replace("rdDataType", sSortDataType) sSortElements &= sSortElement 'Bug: Any datalayer with the same column name will be sorted. Should be fixable in rdDatalayerSort.xsl? Next '20271 Dim sAddedColumn As Boolean = False If aSortColNames.Length >= 2 AndAlso aSortColNames(aSortColNames.Length - 2).Contains("rdAgGrpOpCol_" & aSortColNames(aSortColNames.Length - 1) & "_") Then sAddedColumn = True End If Dim bSortReversed As Boolean = False For i = 0 To aSortColNames.Length - 1 If http.Session("rdOldSort") <> http.Request("rdSort") _ Or http.Session("rdOldSortReversed") = "True" _ Or bRememberedSort _ Or http.Request("rdSortNoSwap") = "True" Then 'Use the default or remembered order - when the sort is different, or we're remembering the sort. If bRememberedSort Then bSortReversed = http.Session("rdRememberSortReversed-" & msRequestedPage) If bSortReversed AndAlso IsNothing(eleAGGroupFilter) Then '19288 aSortOrders(i) = aSortReverseOrders(i) ElseIf Not IsNothing(eleAGGroupFilter) AndAlso i = aSortColNames.Length - 1 Then aSortOrders(i) = aSortReverseOrders(i) ElseIf Not IsNothing(eleAGGroupFilter) AndAlso sAddedColumn AndAlso i = aSortColNames.Length - 2 Then aSortOrders(i) = aSortReverseOrders(i) End If End If Else 'Swap the order. If IsNothing(eleAGGroupFilter) Then '19288 bSortReversed = True aSortOrders(i) = aSortReverseOrders(i) ElseIf Not IsNothing(eleAGGroupFilter) AndAlso aSortColNames(i).Contains("rdAgAggr_") Then bSortReversed = True aSortOrders(i) = aSortReverseOrders(i) ElseIf Not IsNothing(eleAGGroupFilter) AndAlso i = aSortColNames.Length - 1 Then bSortReversed = True aSortOrders(i) = aSortReverseOrders(i) ElseIf Not IsNothing(eleAGGroupFilter) AndAlso sAddedColumn AndAlso i = aSortColNames.Length - 2 Then bSortReversed = True aSortOrders(i) = aSortReverseOrders(i) End If End If Next If bRememberedSort Then http.Session("rdOldSort") = sSort 'bSortReversed = http.Session("rdRememberSortReversed-" & msRequestedPage) Else http.Session("rdOldSort") = http.Request("rdSort") End If If bSortReversed Then http.Session("rdOldSortReversed") = "True" Else http.Session.Remove("rdOldSortReversed") End If Dim sArrowDirection As String = "" 'Run the sort Dim eleActiveSqlDl As XmlElement = xmlDef.DocumentElement.SelectSingleNode("//*[@ID='" & sID & "']/DataLayer[@Type='ActiveSQL']") If Not IsNothing(eleActiveSqlDl) Then '...but not for DataLayer.ActiveSQL. It will be run as part of the paging process. HttpContext.Current.Items("rdActiveSqlDl") = True For i = 0 To aSortColNames.Length - 1 If (i < aSortOrders.Length) AndAlso (aSortOrders(i).IndexOf("Descending", StringComparison.CurrentCultureIgnoreCase) >= 0) Then sArrowDirection = "desc" Else sArrowDirection = "asc" End If Next Else '17163 - New engine still uses old sort code when sorting by column heading. If (rdState.GetApplicationConstant("rdConstant-rdDataEngine") <> "Version10.0") Then dbug.AddDebugMessage(, "XMLSort", "Starting sort") Dim nSortArrayLimit As Long Dim sSortArrayLimit As String = HttpContext.Current.Application.Get("rdConstant-rdFlexSortArrayLimit") If (Not String.IsNullOrEmpty(sSortArrayLimit)) AndAlso Long.TryParse(sSortArrayLimit, nSortArrayLimit) Then dbug.AddDebugMessage(, "XmlSort", String.Format("Array limit set to {0:#,##0} items.", nSortArrayLimit)) End If Using xmlSort As New rdXmlSort(st.DataCacheLocation(), sSortArrayLimit, dbug) For i = 0 To aSortColNames.Length - 1 Dim sColDataType As String = "Text" Dim sDirection As String = "ASC" If (i < aSortDataTypes.Length) AndAlso (aSortDataTypes(i).IndexOf("Number", StringComparison.CurrentCultureIgnoreCase) >= 0) Then sColDataType = "Number" If (i < aSortOrders.Length) AndAlso (aSortOrders(i).IndexOf("Descending", StringComparison.CurrentCultureIgnoreCase) >= 0) Then sDirection = "DESC" sArrowDirection = "desc" '#9653 #14316 Else sArrowDirection = "asc" '#9653 #14316 End If 'Issue 17393 - Multi-column sorts passed the column names with leading spaces. If (aSortColNames(i) IsNot Nothing) Then aSortColNames(i) = aSortColNames(i).Trim() 'Issue 17209 - Sorting on column names with spaces. Added call to EncodeXmlName. xmlSort.AddKey(rdUtility.EncodeDataColumnName(aSortColNames(i)), sColDataType, sDirection) Next Dim eleElement As XmlElement = CType(xmlDef.SelectSingleNode(String.Format("//*[@ID='{0}']", sID)), XmlElement) If eleElement IsNot Nothing Then Dim eleDataLayer As XmlElement = eleElement.SelectSingleNode(".//DataLayer") If eleDataLayer IsNot Nothing Then If Not CachingAllowedForDataLayer(eleDataLayer) Then streamData = _db9.xmlGetData(eleElement, ".//DataLayer") End If End If End If streamData = xmlSort.Sort(streamData, sID) 'Issue 8457 - Use ID to sort a single datalayer. End Using dbug.AddDebugMessage(, "XMLSort", "Sorting completed.") ElseIf HttpContext.Current.Application.Get("rdConstant-rdFlexSort") <> "False" Then 'Issue 14195 - Make FlexSort the default method. dbug.AddDebugMessage(, "XMLSort", "Starting sort") Dim nFlexSortArrayLimit As Long Dim sFlexSortArrayLimit As String = HttpContext.Current.Application.Get("rdConstant-rdFlexSortArrayLimit") If (Not String.IsNullOrEmpty(sFlexSortArrayLimit)) AndAlso Long.TryParse(sFlexSortArrayLimit, nFlexSortArrayLimit) Then dbug.AddDebugMessage(, "XmlSort", String.Format("Array limit set to {0:#,##0} items.", nFlexSortArrayLimit)) End If Using xmlSort As New rdXmlSort2_9(st.DataCacheLocation(), sFlexSortArrayLimit) For i = 0 To aSortColNames.Length - 1 Dim sColDataType As String = "Text" Dim sDirection As String = "ASC" If (i < aSortDataTypes.Length) AndAlso (aSortDataTypes(i).Equals("Number", StringComparison.CurrentCultureIgnoreCase)) Then sColDataType = "Number" If (i < aSortOrders.Length) AndAlso (aSortOrders(i).Equals("Descending", StringComparison.CurrentCultureIgnoreCase)) Then sDirection = "DESC" sArrowDirection = "desc" '#9653 #14316 Else sArrowDirection = "asc" '#9653 #14316 End If xmlSort.AddKey(aSortColNames(i), sColDataType, sDirection) Next streamData = xmlSort.Sort(streamData, sID) 'Issue 8457 - Use ID to sort a single datalayer. End Using dbug.AddDebugMessage(, "XMLSort", "Sorting completed.") Else dbug.AddDebugMessage(, "XMLSort", "rdFlexSort = False") Dim sortDirection As rdXmlSortDirection = rdXmlSortDirection.AscendingOrder Dim sortDataType As rdXmlSortDataType = rdXmlSortDataType.TextValue Dim sort As New rdXmlSort9(streamData) 'sort.InternalSortMemoryLimit = mnMemoryStreamLimit sort.WorkDirectory = st.DataCacheLocation() For i = 0 To aSortColNames.Length - 1 If aSortDataTypes(i) = "number" Then sortDataType = rdXmlSortDataType.NumericValue Else sortDataType = rdXmlSortDataType.TextValue 'Text and Date are the same. End If If aSortOrders(i) = "descending" Then sortDirection = rdXmlSortDirection.DescendingOrder sArrowDirection = "desc" '#9653 Else sortDirection = rdXmlSortDirection.AscendingOrder sArrowDirection = "asc" '#9653 End If sort.AddSortAttribute(aSortColNames(i), sortDataType, sortDirection) Next 'sort.DataLayerName = CType(eleDataLayerColumnFilter.ParentNode, XmlElement).GetAttribute("ID") 'Get the DataLayer Name from the rdOldSort in session sort.DataLayerName = sID 'Issue 8457 - Use ID to sort a single datalayer. sort.Sort() streamData.Close() streamData = sort.SortedStream End If 'Do we need to rebuild any RunningTotalColumns, SequenceColumns, etc? Dim eleDataLayerColumnFilter As XmlElement For Each eleDataLayerColumnFilter In xmlDef.SelectNodes("//*/DataLayer/*[@ReCalculateAfterSort='True']") Dim sDataLayerID As String = CType(eleDataLayerColumnFilter.ParentNode.ParentNode, XmlElement).GetAttribute("ID") Dim db9 As New rdDb9(xmlSettings, dbug) Select Case eleDataLayerColumnFilter.Name Case "DifferenceColumn" Call db9.DataLayerFilter_DifferenceColumn(eleDataLayerColumnFilter, st, dbug, streamData, eleDataLayerColumnFilter.ParentNode, sDataLayerID) 'Issue 8457 - added sDataLayerID Case "MovingAverageColumn" Call db9.DataLayerFilter_MovingAverageColumn(eleDataLayerColumnFilter, st, dbug, streamData, eleDataLayerColumnFilter.ParentNode, sDataLayerID) 'Issue 8457 - added sDataLayerID Case "RunningTotalColumn" Call db9.DataLayerFilter_RunningTotalColumn(eleDataLayerColumnFilter, st, dbug, streamData, eleDataLayerColumnFilter.ParentNode, sDataLayerID) 'Issue 8457 - added sDataLayerID Case "SequenceColumn" Call db9.DataLayerFilter_SequenceColumn(eleDataLayerColumnFilter, st, dbug, streamData, eleDataLayerColumnFilter.ParentNode, sDataLayerID) 'Issue 8457 - added sDataLayerID End Select Next End If If Not IsNothing(http.Session("SortArrowKeyId")) Then http.Session.Remove(http.Session("SortArrowKeyId")) '#12792. End If Dim sSortArrowKey As String = st.sGetRequestVar("rdSortArrowTable") If sSortArrowKey.Length = 0 Then sSortArrowKey = http.Session("rdRememberArrowId-" & msRequestedPage) If Not IsNothing(sSortArrowKey) Then '15827 http.Session(sSortArrowKey) = http.Session("rdRememberArrowKey-" & msRequestedPage) End If Else http.Session(sSortArrowKey) = sArrowDirection End If http.Session("SortArrowKeyId") = sSortArrowKey '#12792. If Not IsNothing(eleActiveSqlDl) Then Dim aColNameOrder As New Dictionary(Of Integer, String()) Dim aUsedColumns As New Dictionary(Of String, Integer) For iCol As Integer = 0 To aSortColNames.Length - 1 If (aUsedColumns.ContainsKey(aSortColNames(iCol))) Then Dim aVal As String() = aColNameOrder(aUsedColumns((aSortColNames(iCol)))) aVal(1) = aSortOrders(iCol) aColNameOrder(aUsedColumns((aSortColNames(iCol)))) = aVal Else Dim aValues As String() = New String() {aSortColNames(iCol), aSortOrders(iCol)} aUsedColumns.Add(aSortColNames(iCol), aColNameOrder.Count) aColNameOrder.Add(aColNameOrder.Count, aValues) End If Next Dim sbNames As New StringBuilder() Dim sbOrder As New StringBuilder() For iCol As Integer = 0 To aColNameOrder.Count - 1 If (iCol > 0) Then sbNames.Append(", ") sbOrder.Append(", ") End If Dim aVal As String() = aColNameOrder(iCol) sbNames.Append(aVal(0)) sbOrder.Append(aVal(1)) Next eleActiveSqlDl.SetAttribute("rdSortColumn", sbNames.ToString()) ' String.Join(",", aSortColNames)) eleActiveSqlDl.SetAttribute("rdSortDirection", sbOrder.ToString()) ' String.Join(",", aSortOrders)) End If If http.Request("rdRememberSort") = "True" Then 'sSort = saSortRequest(TABLE) & "~" 'sSort &= String.Join(",", aSortColNames) & "~" 'sSort &= String.Join(",", aSortDataTypes) & "~" 'sSort &= String.Join(",", aSortOrders) & "~" http.Session("rdRememberSort-" & msRequestedPage) = sSort http.Session("rdRememberSortReversed-" & msRequestedPage) = bSortReversed http.Session("rdRememberArrowId-" & msRequestedPage) = sSortArrowKey http.Session("rdRememberArrowKey-" & msRequestedPage) = http.Session(sSortArrowKey) End If bDataModified = True If Not IsNothing(streamData) Then dbug.AddDebugMessage("Sort Data", "XML Data", "View Data", streamData, , True) End If End Sub 'xxPrivate Sub subClearSortArrows() '' 'End Sub 'Private Sub subDataFindDuplicates(ByRef xmlDef As XmlDocument, ByRef xmlData As XmlDocument, ByRef bDataModified As Boolean) ' If st.sGetRequestVar("rdNewPageNr").StartsWith("True") Then 'NewPageNr can be True, True1, or True2. ' Exit Sub 'Don't do this when paging. ' End If ' Dim nlHideDups As XmlNodeList = xmlDef.SelectNodes("//HideDuplicates") ' If nlHideDups.Count = 0 Then Exit Sub ' Dim eleHideDups As XmlElement ' For Each eleHideDups In nlHideDups ' 'Get the DataTableID. It's the last ancestor with a DataLayer. ' 'Dim sDataTableID As String = eleHideDups.SelectSingleNode("ancestor::*/DataLayer").ParentNode.Attributes("ID").Value ' Dim nlDataLayer As XmlNodeList = eleHideDups.SelectNodes("ancestor::*/DataLayer | ancestor::*/SubDataLayer/DataLayer") ' If nlDataLayer.Count <> 0 Then ' Dim eleDataLayer As XmlElement = nlDataLayer(nlDataLayer.Count - 1) ' Dim eleDataTable As XmlElement = eleDataLayer.ParentNode ' If eleDataTable.Name = "SubDataLayer" Then eleDataTable = eleDataTable.ParentNode 'Need to go one step up for SubDataTables. ' Dim sDataTableID As String = eleDataTable.GetAttribute("ID") ' Dim sDupAttr As String = "rdDuplicate-" & eleHideDups.GetAttribute("DataColumn").Replace(",", "-").Replace(" ", "") ' Dim aDataCols() As String = eleHideDups.GetAttribute("DataColumn").Replace(" ", "").Split(",") ' Dim sPrevVal As String = "RedskinsAre#1" ' Dim sCurrVal As String ' Dim sDataCol As String ' 'For Each sCurrVal In aDataVals ' ' sCurrVal = "RedskinsAre#1" 'Initialize with unique values. ' 'Next ' Dim eleRow As XmlElement ' For Each eleRow In xmlData.SelectNodes("//" & sDataTableID) ' sCurrVal = "" ' For Each sDataCol In aDataCols ' sCurrVal &= eleRow.GetAttribute(sDataCol) & "|" ' Next ' If sCurrVal = sPrevVal Then ' eleRow.SetAttribute(sDupAttr, "True") ' Else ' 'eleRow.SetAttribute(sDupAttr, "False") ' eleRow.RemoveAttribute(sDupAttr) ' sPrevVal = sCurrVal ' End If ' Next ' End If ' Next ' bDataModified = True ' dbug.AddDebugMessage(, "Flag Duplicate Values", "View Data", xmlData) 'End Sub 'Private Sub subDataFindGroupHeaderRows(ByRef xmlDef As XmlDocument, ByRef xmlData As XmlDocument, ByRef bDataModified As Boolean) ' If st.sGetRequestVar("rdNewPageNr").StartsWith("True") Then 'NewPageNr can be True, True1, or True2. ' Exit Sub 'Don't do this when paging. ' End If ' Dim nlGroupRows As XmlNodeList = xmlDef.SelectNodes("//GroupHeaderRow") ' If nlGroupRows.Count = 0 Then Exit Sub ' Dim eleGroupRow As XmlElement ' For Each eleGroupRow In nlGroupRows ' Dim eleDataLayerGroupFilter As XmlElement = eleGroupRow.SelectSingleNode("ancestor::*//GroupFilter[@ID='" & eleGroupRow.GetAttribute("GroupFilterID") & "']") ' Dim sGroupAttr As String = "rdGroupStartRow-" & st.sGetAttribute(eleDataLayerGroupFilter, "GroupColumn").Replace(" ", "").Replace(",", "-") ' Dim aDataCols() As String = st.sGetAttribute(eleDataLayerGroupFilter, "GroupColumn").Replace(" ", "").Split(",") ' Dim sPrevVal As String = "RedskinsAre#1" ' Dim sCurrVal As String ' Dim sDataCol As String ' Dim eleRow As XmlElement ' Dim eleDataLayer As XmlElement ' eleDataLayer = eleGroupRow.SelectSingleNode("ancestor::*/SubDataLayer") 'Look for a SubDataLayer first. ' If IsNothing(eleDataLayer) Then _ ' eleDataLayer = eleGroupRow.SelectSingleNode("ancestor::*/DataLayer") 'There must be one. ' Dim sDataTableID As String = eleDataLayer.ParentNode.Attributes("ID").Value ' Dim nlRows As XmlNodeList = xmlData.SelectNodes("//" & sDataTableID) ' For i As Integer = 0 To nlRows.Count - 1 ' eleRow = nlRows(i) ' sCurrVal = "" ' For Each sDataCol In aDataCols ' sCurrVal &= eleRow.GetAttribute(sDataCol) & "|" ' Next ' If sCurrVal = sPrevVal Then ' eleRow.RemoveAttribute(sGroupAttr) ' Else ' eleRow.SetAttribute(sGroupAttr, "True") ' If i > 0 Then ' ' Dim elePrevRow As XmlElement = nlRows(i - 1) ' elePrevRow.SetAttribute(sGroupAttr.Replace("StartRow-", "EndRow-"), "True") ' End If ' End If ' If i = nlRows.Count - 1 Then 'Last row? ' Dim elePrevRow As XmlElement = nlRows(i) ' elePrevRow.SetAttribute(sGroupAttr.Replace("StartRow-", "EndRow-"), "True") ' End If ' sPrevVal = sCurrVal ' Next ' Next ' bDataModified = True ' dbug.AddDebugMessage(, "Flag Group Header Rows", "View Data", xmlData) 'End Sub 'Private Sub subDataFindGroupSummaryRows(ByRef xmlDef As XmlDocument, ByRef xmlData As XmlDocument, ByRef bDataModified As Boolean) ' If st.sGetRequestVar("rdNewPageNr").StartsWith("True") Then 'NewPageNr can be True, True1, or True2. ' Exit Sub 'Don't do this when paging. ' End If ' Dim nlGroupRows As XmlNodeList = xmlDef.SelectNodes("//GroupSummaryRow") ' If nlGroupRows.Count = 0 Then Exit Sub ' Dim eleGroupRow As XmlElement ' For Each eleGroupRow In nlGroupRows ' Dim sGroupFilterID As String = eleGroupRow.GetAttribute("GroupFilterID") ' Dim eleDataLayerGroupFilter As XmlElement = eleGroupRow.SelectSingleNode("ancestor::*//GroupFilter[@ID='" & sGroupFilterID & "']") ' If IsNothing(eleDataLayerGroupFilter) Then _ ' Throw New Exception("Could not find a GroupFilter with ID=" & sGroupFilterID) ' Dim sGroupAttr As String = "rdGroupEndRow-" & st.sGetAttribute(eleDataLayerGroupFilter, "GroupColumn").Replace(" ", "").Replace(",", "-") ' Dim aDataCols() As String = st.sGetAttribute(eleDataLayerGroupFilter, "GroupColumn").Replace(" ", "").Split(",") ' Dim elePrevRow As XmlElement = Nothing ' Dim sPrevVal As String = "RedskinsAre#1" ' Dim sCurrVal As String ' Dim sDataCol As String ' Dim eleRow As XmlElement ' Dim eleDataLayer As XmlElement ' eleDataLayer = eleGroupRow.SelectSingleNode("ancestor::*/SubDataLayer") 'Look for a SubDataLayer first. ' If IsNothing(eleDataLayer) Then _ ' eleDataLayer = eleGroupRow.SelectSingleNode("ancestor::*/DataLayer") ' If IsNothing(eleDataLayer) Then _ ' eleDataLayer = eleGroupRow.SelectSingleNode("ancestor::*//DataLayer") '"//" added to support grouping in crosstabs. #2536 ' Dim sDataTableID As String = eleDataLayer.ParentNode.Attributes("ID").Value ' For Each eleRow In xmlData.SelectNodes("//" & sDataTableID) ' sCurrVal = "" ' For Each sDataCol In aDataCols ' sCurrVal &= eleRow.GetAttribute(sDataCol) & "|" ' Next ' If Not IsNothing(elePrevRow) Then ' If sCurrVal = sPrevVal Then ' elePrevRow.RemoveAttribute(sGroupAttr) ' Else ' elePrevRow.SetAttribute(sGroupAttr, "True") ' End If ' End If ' sPrevVal = sCurrVal ' elePrevRow = eleRow ' Next ' If Not IsNothing(elePrevRow) Then ' elePrevRow.SetAttribute(sGroupAttr, "True") 'The last row. ' End If ' Next ' bDataModified = True ' dbug.AddDebugMessage(, "Flag Group Summary Rows", "View Data", xmlData) 'End Sub Private Sub subSetupTablePagingValues9(ByVal nlDataLayerDefs As XmlNodeList, ByVal xmlDataLayersInfo As XmlDocument) Dim i As Integer Dim eleDataLayerDef As XmlElement For Each eleDataLayerDef In nlDataLayerDefs 'Issue 14243 - Object reference error when using IfDataError element. If (eleDataLayerDef.ParentNode IsNot Nothing) AndAlso (eleDataLayerDef.ParentNode.Name = "IfDataError") Then 'Skip these alternate datalayers Continue For ElseIf (eleDataLayerDef.ParentNode IsNot Nothing) AndAlso (eleDataLayerDef.ParentNode.Name = "Lookup") Then 'Issue 16209 - Skip lookup datalayers, they are really join datalayers. Continue For ElseIf (eleDataLayerDef.ParentNode IsNot Nothing) AndAlso (eleDataLayerDef.ParentNode.Name = "DataLayer") Then 'Issue 16290 - DataLayers do not require IDs, prevents incorrect paging. Continue For End If Dim sParentElementId As String = "" 'eleDataLayerDef.ParentNode.Attributes("ID").Value 'Issue 16290 - Code to pull the ID from the "container" element (Datatable, Chart, etc). Dim nlParents As XmlNodeList = eleDataLayerDef.SelectNodes("ancestor::*") If (nlParents IsNot Nothing) AndAlso (nlParents.Count > 0) Then For iNode As Integer = nlParents.Count - 1 To 0 Step -1 If (nlParents(iNode).Name <> "IfDataError") AndAlso (nlParents(iNode).Name <> "DataLayer") Then sParentElementId = CType(nlParents(iNode), XmlElement).GetAttribute("ID") Exit For End If Next End If '#End If Dim elePaging As XmlElement = eleDataLayerDef.ParentNode.SelectSingleNode("InteractivePaging[not(@Remove='True')] | AppendPaging") Dim eleDataLayersInfo As XmlElement = xmlDataLayersInfo.SelectSingleNode("rdData/rdDataLayers") Dim nRowCnt As Integer If Not IsNothing(eleDataLayersInfo) Then nRowCnt = Val(eleDataLayersInfo.GetAttribute("rdRowCount_" & sParentElementId)) End If Dim groupByValue As String = st.sReplaceTokens("@Request.ahGroupByValue~") If st.sReplaceTokens("@Request.rdSubReport~") = "True" AndAlso Not String.IsNullOrEmpty(groupByValue) Then http.Session(sParentElementId & "_" & groupByValue.Trim & "-RowCnt") = nRowCnt Else http.Session(sParentElementId & "-RowCnt") = nRowCnt End If If sGetPagingMethod() = "Interactive" _ AndAlso Not IsNothing(elePaging) Then Dim nPageRowCnt As Integer = CInt("0" & st.sGetAttribute(elePaging, "PageRowCount")) If nPageRowCnt < 1 Then nPageRowCnt = 10 'Default value. Dim sPageNr As String = "" If st.sGetRequestVar("rdNewPageNr").Length <> 0 Then '8808 rdNewPageNr must be set to change pages. sPageNr = st.sGetRequestVar(sParentElementId & "-PageNr") End If If sPageNr.IndexOf(",") <> -1 Then 'Two page numbers came in, because Location="Both". Figure out which one to use. Dim aPageNr() As String = sPageNr.Split(",") If st.sGetRequestVar("rdNewPageNr") = "True2" Then sPageNr = aPageNr(1) Else sPageNr = aPageNr(0) End If End If Dim nPageNr As Integer = Val(sPageNr) Dim nPageCnt As Integer = CInt((nRowCnt - 1) \ nPageRowCnt) + 1 If st.sGetRequestVar("rdAgReset") = "True" Then nPageNr = 1 If nPageNr = 0 Then nPageNr = 1 If nPageNr < 1 Then nPageNr = 1 'When the row count is unknown, hide the "last page" link. Dim bRowCountKnown As Boolean = False If eleDataLayersInfo.GetAttribute("rdRowCountKnown_" & sParentElementId) = "False" Then 'The page count is unknown. (ActiveSQL only.) http.Session("rdRowCountKnown_" & sParentElementId) = "false" nRowCnt = Integer.MaxValue 'Prevent limiting the value of the "next page" page number. nPageCnt = Integer.MaxValue Else http.Session("rdRowCountKnown_" & sParentElementId) = "true" If nPageNr > nPageCnt Then _ nPageNr = nPageCnt 'Put the user-entered row count back to the max row count. bRowCountKnown = True End If http.Session(sParentElementId & "-PageRowCnt") = nPageRowCnt http.Session(sParentElementId & "-PageNr") = nPageNr http.Session(sParentElementId & "-PrevPageNr") = IIf(nPageNr > 1, nPageNr - 1, 1) http.Session(sParentElementId & "-NextPageNr") = IIf(nPageNr < nPageCnt, nPageNr + 1, nPageCnt) http.Session(sParentElementId & "-LastPageNr") = nPageCnt 'Set session vars that will hide the first, previous, next and last links. http.Session(sParentElementId & "-NotFirstPage") = IIf(nPageNr = 1, "false", "true") http.Session(sParentElementId & "-NotLastPage") = IIf(nPageNr = nPageCnt, "false", "true") If st.sGetAttribute(elePaging, "ShowPageNumber") = "Numbered" Then Dim nNumberedPageCount As Integer = Val(st.sGetAttribute(elePaging, "NumberedPageCount")) If nNumberedPageCount < 1 Then _ nNumberedPageCount = 10 http.Session(sParentElementId & "-NumberedPageCount") = nNumberedPageCount End If 'Commented because this must be set before DLs are run. 'DataLayer.ActiveSQL? If eleDataLayerDef.GetAttribute("Type") = "ActiveSQL" Then Try If bRowCountKnown Then eleDataLayerDef.SetAttribute("FirstRow", (nPageNr - 1) * nPageRowCnt + 1) Else eleDataLayerDef.SetAttribute("FirstRow", Integer.MaxValue - 100000) End If Catch ex As Exception eleDataLayerDef.SetAttribute("FirstRow", Integer.MaxValue - 10000) End Try 'Adjust everything for DataLayer.ActiveSQL. eleDataLayerDef.SetAttribute("RowCount", nPageRowCnt) End If Else 'No paging http.Session(sParentElementId & "-PageNr") = "1" http.Session(sParentElementId & "-PageRowCnt") = "999999" 'Hide the first, prev, next and last links. http.Session(sParentElementId & "-NotFirstPage~") = "false" http.Session(sParentElementId & "-NotLastPage~") = "false" ''Commented because this must be set before DLs are run. 'If eleDataLayerDef.GetAttribute("Type") = "ActiveSQL" Then ' 'Adjust everything for DataLayer.ActiveSQL. ' eleDataLayerDef.RemoveAttribute("FirstRow") ' eleDataLayerDef.RemoveAttribute("RowCount") 'End If End If i = i + 1 Next '' ''Dim i As Integer End Sub 'Private Function sHideHiddenControls(ByVal sHtml As String) As String ' Dim sHiddenID As String ' For Each sHiddenID In msHiddenIDList.Split(",") ' If sHiddenID.Length <> 0 Then ' sHtml = sHtml.Replace("id=""" & sHiddenID & """", "style=""display:none""id=""" & sHiddenID & """") ' End If ' Next ' sHideHiddenControls = sHtml 'End Function Private Function sGetAndValidateElementIDs(ByVal eleDef As XmlElement) As String Dim sElementIDs() As String = eleDef.GetAttribute("ElementID").Replace(" ", "").Split(",") Dim sExtraIds As String = "" '#4749 Tables with InteractivePaging need the entire "wrapper" DIV's ID. 'Ensure that the ElementID's exist. 'Can't do this for some elements, like Charts, that are processed individually, without the entire definition file. If eleDef.OwnerDocument.DocumentElement.Name = "Report" Then 'If Not st.sGetRequestVar("rdAjaxCommand") = "RefreshElement" Then Commented for Note1 rework of #4749. If Not eleDef.GetAttribute("rdNoValidate") = "True" Then Dim i As Integer For i = 0 To sElementIDs.Length - 1 'Dim ele As XmlElement = xmlDef.SelectSingleNode("//[@ID=""" & sElementIDs(i) & """]") Dim ele As XmlElement = xmlDef.SelectSingleNode("//DataTable[@ID=""" & sElementIDs(i) & """] | //CrosstabTable[@ID=""" & sElementIDs(i) & """] | //InputSlider[@ID=""" & sElementIDs(i) & """] | //InputChart[@ID=""" & sElementIDs(i) & """]") '16992 If IsNothing(ele) Then 'Dim sOriginalElement As String = st.sGetAttribute(eleAction, "OriginalElement", "Action.ShowElement") 'Throw New Exception(eleDef.Name & " element """ & eleDef.GetAttribute("ID") & """ has an invalid ElementID """ & sElementIDs(i) & """. It should reference the ID of another element.") 'If there are multiple elements seperated by commas, this just checks the first. 'dbug.AddDebugMessage("***WARNING***", "Invalid ElementID in " & eleDef.Name & "." & eleDef.GetAttribute("Type"), sElementIDs(i)) Else If ele.Name.Contains("Table") Then If Not IsNothing(ele.SelectSingleNode("InteractivePaging")) Then sExtraIds &= "," & "rdDataTableDiv-" & sElementIDs(i) End If ElseIf ele.Name = "InputSlider" Then 'sElementIDs(i) = "rdInputSliderBg_" & sElementIDs(i) sExtraIds &= ",rdInputSliderBg_" & sElementIDs(i) ElseIf ele.Name = "InputChart" Then '16992 Dim chartNode As XmlElement = ele.SelectSingleNode("Chart") ' Make sure Chart has an ID otherwise Refresh won't work If String.IsNullOrEmpty(chartNode.GetAttribute("ID")) Then ChartBuilder.generateAndSetChartID(chartNode) End If sExtraIds &= "," & chartNode.GetAttribute("ID") End If End If Next End If 'End If End If Return String.Join(",", sElementIDs) & sExtraIds End Function Friend Sub subAddDebugLinks() 'Call dbug.NewTransaction() If bExportReport() Or st.sGetRequestVar("rdEmbeddedSubReport") = "True" Then _ Exit Sub 'Add a debug link to the bottom of the page. Dim elePage As XmlElement = xmlDef.SelectSingleNode("//Report | //MobileReport | //Widget") If IsNothing(elePage) Then _ Exit Sub Dim eleDebug As XmlElement = xmlDef.CreateElement("Image") eleDebug.SetAttribute("ID", "rdDebug") eleDebug.SetAttribute("Caption", "rdTemplate/rdDebug.png") eleDebug.SetAttribute("Tooltip", "Show the Debugger Trace Report") eleDebug.SetAttribute("AltText", "Chart Debug") eleDebug.SetAttribute("Style", "position:fixed;bottom:0px;right:0px;border-style:none;") Dim eleAction As XmlElement = eleDebug.AppendChild(xmlDef.CreateElement("Action")) eleAction.SetAttribute("Type", "Link") Dim eleTarget As XmlElement = eleAction.AppendChild(xmlDef.CreateElement("Target")) eleTarget.SetAttribute("Type", "Link") eleTarget.SetAttribute("Link", "-rdDebugURL-") 'This value is replaced at the last moment with the actual value. Dim eleHoverHandler As XmlElement = eleDebug.AppendChild(xmlDef.CreateElement("EventHandler")) eleHoverHandler.SetAttribute("DhtmlEvent", "onmouseover") Dim sHoverUrl As String = "rdTemplate/rdDebugHover.png" If Not IsNothing(HttpContext.Current.Items("rdIsWidgetRequest")) Then _ sHoverUrl = HttpContext.Current.Request("rdServerUrl") & "/" & sHoverUrl eleAction = eleHoverHandler.AppendChild(xmlDef.CreateElement("Action")) eleAction.SetAttribute("Type", "Javascript") eleAction.SetAttribute("Javascript", "this.setAttribute('src','" & sHoverUrl & "')") sHoverUrl = "rdTemplate/rdDebug.png" If Not IsNothing(HttpContext.Current.Items("rdIsWidgetRequest")) Then _ sHoverUrl = HttpContext.Current.Request("rdServerUrl") & "/" & sHoverUrl eleHoverHandler = eleDebug.AppendChild(xmlDef.CreateElement("EventHandler")) eleHoverHandler.SetAttribute("DhtmlEvent", "onmouseout") eleAction = eleHoverHandler.AppendChild(xmlDef.CreateElement("Action")) eleAction.SetAttribute("Type", "Javascript") eleAction.SetAttribute("Javascript", "this.setAttribute('src','" & sHoverUrl & "')") elePage.AppendChild(xmlDef.CreateElement("LineBreak")) elePage.AppendChild(eleDebug) End Sub Private Sub subSetReportShowModes(ByRef xmlDef As XmlDocument) maReportShowModes = Split(st.sGetRequestVar("rdShowModes"), ",") 'Get the ShowModes from the request. If maReportShowModes(0).Length <> 0 Then dbug.AddDebugMessage("", "Report Show Modes", st.sGetRequestVar("rdShowModes")) Else Dim sDefaultShowModes As String = xmlDef.DocumentElement.GetAttribute("DefaultShowModes") If sDefaultShowModes.Contains("@") Then mbDontCacheXsl = True 'Don't cache the definition if ShowModes has a token. End If 'maReportShowModes = Split(st.sReplaceTokens(sDefaultShowModes), ",") 'Get the default ReportShowModes maReportShowModes = st.sReplaceTokens(sDefaultShowModes).Replace(" ", "").Split(",") '12660 dbug.AddDebugMessage("Report Show Modes", "", Join(maReportShowModes, ",")) End If End Sub Private Sub subSetGlobalCss(ByRef xmlDef As XmlDocument) Dim localStyleNodes As XmlNodeList = xmlDef.SelectNodes("//StyleSheet[@StyleSheet] | //StyleSheet[@Theme]") Dim globalStyleNodes As XmlNodeList = xmlSettings.SelectNodes("//GlobalCSS") Dim appliedLocalTheme As Boolean = False Dim nglobalStyleNodesCt As Integer = globalStyleNodes.Count '19119 'Apply local theme For Each eleStyle As XmlElement In localStyleNodes If Len(st.sGetAttribute(eleStyle, "Theme")) = 0 Then 'Issue #10287 Theme will be set along side the users stylesheet. For Each eleGlobalStyle As XmlElement In globalStyleNodes '10340 eleStyle.SetAttribute("Theme", eleGlobalStyle.GetAttribute("Theme")) appliedLocalTheme = True Exit For Next Else '#12901 appliedLocalTheme = True End If addThemeModifier(xmlDef, eleStyle) Next 'Apply the global style For Each eleGlobalStyle As XmlElement In globalStyleNodes Dim sTheme As String = eleGlobalStyle.GetAttribute("Theme") Dim sGlobalStyleSheet As String = eleGlobalStyle.GetAttribute("StyleSheet") If Len(sTheme.Trim()) > 0 Then 'Allow the theme to be accessed from @Constant.GlobalTheme~ http.Application.Set("rdConstant-GlobalTheme", sTheme) Dim eleStyle As XmlElement = xmlDef.DocumentElement.PrependChild(xmlDef.CreateElement("StyleSheet")) eleStyle.SetAttribute("StyleSheet", sGlobalStyleSheet) If Not appliedLocalTheme Or nglobalStyleNodesCt > 1 Then '19119 eleStyle.SetAttribute("Theme", sTheme) End If addThemeModifier(xmlDef, eleStyle) ElseIf Len(sGlobalStyleSheet.Trim()) > 0 Then '#11706 If Not IsDuplicateStyleSheetGlobal(localStyleNodes, sGlobalStyleSheet) Then '13120 ' #15732 - Global stylesheets are used in the wrong order ' themes PREPEND, styles APPEND Dim eleStyle As XmlElement = xmlDef.DocumentElement.AppendChild(xmlDef.CreateElement("StyleSheet")) eleStyle.SetAttribute("StyleSheet", sGlobalStyleSheet) End If End If Next End Sub Private Sub subInjectGlobalChartExport(ByRef xmlDef As XmlDocument) Dim eleGlobalChartExport As XmlElement = xmlSettings.SelectSingleNode(".//General/GlobalChartExport") If Not IsNothing(eleGlobalChartExport) Then Dim eleChartCanvases As XmlNodeList = xmlDef.SelectNodes("//ChartCanvas | //Gauge[@Type='Angular' or @Type='BalloonBar' or @Type='BulletBar' or @Type='Arc']") For Each eleChartCanvas As XmlElement In eleChartCanvases Dim eleChartExport As XmlElement = eleChartCanvas.SelectSingleNode(".//ChartExport") If IsNothing(eleChartExport) Then Dim eleChartExportFragment As XmlDocumentFragment = xmlDef.CreateDocumentFragment() eleChartExportFragment.InnerXml = eleGlobalChartExport.OuterXml.Replace(" "PDF" Then Return False End If Dim bReturnValue As Boolean = False For Each eleStyle As XmlElement In localStyleNodes If eleStyle.GetAttribute("StyleSheet").Trim() = sGlobalStyleSheet Then bReturnValue = True End If Next Return bReturnValue End Function Private Sub addThemeModifier(ByRef xmlDef As XmlDocument, ByRef eleStyle As XmlElement) If Not IsNothing(eleStyle) Then If bElementInitiallyVisible(eleStyle) Then If eleStyle.GetAttribute("Theme") <> st.sGetAttribute(eleStyle, "Theme") Then mbDontCacheXsl = True 'The Theme has a token, so definition XSL cannot be cached. End If Dim sTheme As String = st.sGetAttribute(eleStyle, "Theme") If sTheme.Length <> 0 Then 'There is a theme, apply the appropriate DefinitionModifierFile. Dim eleDmf As XmlElement = xmlDef.DocumentElement.PrependChild(xmlDef.CreateElement("DefinitionModifierFile")) 'First look in the user '_Themes' folder Dim sDmfFilename As String = rdState.sGetPhysicalPath() & Path.DirectorySeparatorChar & "_Themes" & Path.DirectorySeparatorChar & sTheme & Path.DirectorySeparatorChar & "ThemeModifier.xml" If Not System.IO.File.Exists(sDmfFilename) Then 'Second look in the rdTemplate theme folder sDmfFilename = rdState.sGetPhysicalPath() & Path.DirectorySeparatorChar & "rdTemplate" & Path.DirectorySeparatorChar & "rdTheme" & Path.DirectorySeparatorChar & sTheme & Path.DirectorySeparatorChar & "ThemeModifier.xml" If Not System.IO.File.Exists(sDmfFilename) Then Throw New Exception("Theme " & sTheme & " not found. Cannot find file " & sDmfFilename) End If End If eleDmf.SetAttribute("DefinitionModifierFile", sDmfFilename) eleDmf.SetAttribute("ThemeName", sTheme) ''#11532 'dbug.AddDebugMessage("Apply Theme", "Theme Name", sTheme) End If End If End If End Sub Private Sub subSetCssUrlToFile(ByRef xmlDef As XmlDocument) 'Dim eleCssNode As XmlElement = xmlDef.SelectSingleNode("//StyleSheet") Dim cssNodes As XmlNodeList = xmlDef.SelectNodes("//StyleSheet") For Each eleCssNode As XmlElement In cssNodes '10500 Dim sCssUrl As String = st.sGetAttribute(eleCssNode, "StyleSheet") If sCssUrl.Length <> 0 Then If sCssUrl.ToUpper.StartsWith("HTTP") Then Dim UriCss As New Uri(sCssUrl) Dim wrCssReq As HttpWebRequest = WebRequest.Create(UriCss) Dim wCssResponse As WebResponse Try ' #9657 wCssResponse = wrCssReq.GetResponse() Catch ex As Exception Throw New Exception("Unable to find the requested stylesheet at the URL - " & sCssUrl & ". ", ex) End Try Dim IOCssStream As System.IO.Stream = wCssResponse.GetResponseStream Dim cssReader As StreamReader = New StreamReader(IOCssStream) Dim sCssContent As String = cssReader.ReadToEnd Dim sUrl As String = "" Randomize() Dim sCssFilename As String = CStr(CLng(Rnd() * 100000)) & CStr(CLng(Rnd() * 100000)) & ".css" Dim sFilename As String = sCssFilename Call rdState.MakeTempDownloadFilename("css", sUrl, sFilename) Dim cssWriter As StreamWriter = New StreamWriter(sFilename) cssWriter.Write(sCssContent) cssWriter.Close() 'eleCssNode.SetAttribute("StyleSheet", "..\rdDownload\" & sCssFilename) Dim slash As String = System.IO.Path.DirectorySeparatorChar eleCssNode.SetAttribute("StyleSheet", ".." & slash & "rdDownload" & slash & sCssFilename) '10500 wCssResponse.Close() IOCssStream.Close() End If End If Next End Sub Public Sub subRemoveElementsFromExport(ByRef xmlDef As XmlElement) 'For exporting only, 'Remove all Action elements, except for Links. ' 13916 - Changed the input from xmlDocument to xmlElement and supporting changes in this routine to support this fix. If bExportReport() Or sGetPagingMethod() = "Printable" Then '10665 Adds CrosstabValueColumnSort Dim sRemoveXPath As String = "//Action | //EventHandler | //DataColumnSort | //CrosstabValueColumnSort" 'Remove Actions and DataColumnSorts. Dim ele As XmlElement ele = xmlDef.SelectSingleNode(sRemoveXPath) Do While Not IsNothing(ele) 'If ele.GetAttribute("Type") <> "Link" Then ele.ParentNode.RemoveChild(ele) 'End If ele = xmlDef.SelectSingleNode(sRemoveXPath) Loop End If If bExportCsv() Then 'Remove all elements not needed for the CSV export. Call subRecursivelyRemoveNonCsvElements(xmlDef) ElseIf bExportNativeExcel() Then Call subRecursivelyRemoveNonNativeExcelElements(xmlDef) Call subRecursivelyRemoveNonNativeExcelLabelFormats(xmlDef) End If End Sub Friend Function bExportReport() As Boolean Dim sReportFormat As String = st.sGetRequestVar("rdReportFormat") If sReportFormat.Length <> 0 Then If Array.IndexOf("HtmlExport,Excel,NativeExcel,NativeWord,Word,PDF,CSV,HtmlEmail,GoogleSpreadsheet".Split(","), sReportFormat) <> -1 Then Return True End If End If End Function Private Function bExportPdf() As Boolean If st.sGetRequestVar("rdReportFormat") = "PDF" Then Return True End If End Function Private Function bExportCsv() As Boolean If st.sGetRequestVar("rdReportFormat") = "CSV" Then Return True End If 'Dim sReportFormat As String = st.sGetRequestVar("rdReportFormat") 'If sReportFormat.Length <> 0 Then ' If sReportFormat = "CSV" Then ' Return True ' End If 'End If End Function Private Function bExportNativeExcel() As Boolean If st.sGetRequestVar("rdReportFormat") = "NativeExcel" Then Return True End If 'Dim sReportFormat As String = st.sGetRequestVar("rdReportFormat") 'If sReportFormat.Length <> 0 Then ' If sReportFormat = "NativeExcel" Then ' Return True ' End If 'End If End Function Private Function bExportExcel() As Boolean If st.sGetRequestVar("rdReportFormat") = "Excel" Then Return True End If End Function Private Function bExportNativeWord() As Boolean If st.sGetRequestVar("rdReportFormat") = "NativeWord" Then Return True End If 'Dim sReportFormat As String = st.sGetRequestVar("rdReportFormat") 'If sReportFormat.Length <> 0 Then ' If sReportFormat = "NativeExcel" Then ' Return True ' End If 'End If End Function Private Sub subRecursivelyRemoveNonCsvElements(ByVal eleDef As XmlElement, Optional ByVal bFirstTime As Boolean = True) Static aCsvElements As String() = { _ "AnalysisGrid", _ "AnalysisGridColumn", _ "Body", _ "DataTable", _ "CrosstabTable", _ "DataTableColumn", _ "AutoColumns", _ "Label", _ "DataLayer", _ "Division", _ "Spaces", _ "CrosstabTableLabelColumn", _ "CrosstabTableHeaderColumns", _ "CrosstabTableSummaryColumns", _ "CrosstabColumn", _ "CrosstabTableValueColumns", _ "ExtraCrosstabLabelColumn", _ "ExtraCrosstabValueColumn", _ "ReportHeader", _ "Rows", _ "Row", _ "Column", _ "ExcelColumnFormat", _ "HideDuplicates", _ "Tabs", _ "TabPanel", _ "LocalData", _ "SetSessionVariables", _ "SessionParams", _ "DefaultRequestParams", _ "AnalysisCrosstab", _ "AnalysisCrosstabColumn", _ "ResponsiveRow", _ "ResponsiveColumn" _ } '12072, 24484 'Static aCsvElements As String() = {"Body", "DataTable", "CrosstabTable", "DataTableColumn", "Label", "DataLayer", "Division", "Space", "CrosstabTableLabelColumn", "CrosstabColumn", "CrosstabTableValueColumns", "ReportHeader", "Rows", "Row", "Column", "ExcelColumnFormat", "HideDuplicates"} Dim nlChildren As XmlNodeList = eleDef.SelectNodes("*") Dim eleChild As XmlElement #If JAVA Then '7278 Workaround the removeChild bug and ensure that the foreign elements are removed Dim iRow As Integer = 0 Do While iRow < nlChildren.Count eleChild = nlChildren.ItemOf(iRow) iRow = iRow + 1 If Array.IndexOf(aCsvElements, eleChild.Name) <> -1 Then 'Keep this element. If eleChild.Name <> "DataLayer" And eleChild.Name <> "ReportHeader" Then 'Don't remove elements under these. ' Check the children. Call subRecursivelyRemoveNonCsvElements(eleChild, False) End If Else 'Toss this element. eleChild.ParentNode.RemoveChild(eleChild) nlChildren = eleDef.SelectNodes("*") iRow = iRow - 1 End If Loop #Else For Each eleChild In nlChildren If Array.IndexOf(aCsvElements, eleChild.Name) <> -1 Then 'Keep this element. If eleChild.Name <> "DataLayer" And eleChild.Name <> "ReportHeader" Then 'Don't remove elements under these. ' Check the children. Call subRecursivelyRemoveNonCsvElements(eleChild, False) End If Else 'Toss this element. eleChild.ParentNode.RemoveChild(eleChild) End If Next #End If If bFirstTime Then 'Remove all IncludeHTML elements, wherever they may be. 'These may not be valid XHTML and will easily fail during the export, and are nothing but trouble. Do While True Dim ele As XmlElement = eleDef.SelectSingleNode("//*/IncludeHtmlFile") If IsNothing(ele) Then Exit Do End If ele.ParentNode.RemoveChild(ele) Loop End If End Sub Private Sub subRecursivelyRemoveNonNativeExcelElements(ByVal eleDef As XmlElement, Optional ByVal bFirstTime As Boolean = True) 'Static aExcelElements As String() = {"AnalysisGrid", "AnalysisGridColumn", "OlapTable", "OlapGrid", "Body", "DataTable", "CrosstabTable", "DataTableColumn", "AutoColumns", "Label", "DataLayer", "Division", "Space", "CrosstabTableLabelColumn", "CrosstabTableHeaderColumn", "CrosstabTableSummaryColumn", "CrosstabColumn", "CrosstabTableValueColumns", "ExtraCrosstabLabelColumn", "ExtraCrosstabValueColumn", "ReportHeader", "Rows", "Row", "Column", "ExcelColumnFormat", "HideDuplicates", "DataColumnSummary", "HeaderRow", "SummaryRow", "GroupSummaryRow", "GroupHeaderRow"} Static aExcelElements As String() '15506 - remove version7. aExcelElements = New String() { _ "FormulaScriptFile", _ "StyleSheet", _ "ExcelSheetBreak", _ "LineBreak", _ "Chart", _ "Gauge", _ "Image", _ "Label", _ "AnalysisGrid", _ "AnalysisGridColumn", _ "OlapTable", _ "OlapGrid", _ "Body", _ "DataTable", _ "ExtraColumnHeader", _ "CrosstabTable", _ "DataTableColumn", _ "AutoColumns", _ "Label", _ "DataLayer", _ "Division", _ "Spaces", _ "CrosstabTableLabelColumn", _ "CrosstabTableHeaderColumn", _ "CrosstabTableSummaryColumn", _ "CrosstabColumn", _ "CrosstabTableValueColumns", _ "ExtraCrosstabLabelColumn", _ "ExtraCrosstabValueColumn", _ "ReportHeader", _ "Rows", _ "Row", _ "Column", _ "ExcelColumnFormat", _ "HideDuplicates", _ "DataColumnSummary", _ "HeaderRow", _ "SummaryRow", _ "GroupSummaryRow", _ "GroupHeaderRow", _ "LocalData", _ "PluginCall", _ "SetSessionVariables", _ "SessionParams", _ "DefaultRequestParams", _ "GeneratedElementPluginCall", _ "DefinitionModifierFile" _ } Static aParentElements() As String = {"Chart", "Gauge", "ReportHeader", "DataLayer"} Dim nlChildren As XmlNodeList = eleDef.SelectNodes("*") Dim eleChild As XmlElement #If JAVA Then '7278 Workaround the removeChild bug and ensure that the foreign elements are removed Dim iRow As Integer = 0 Do While iRow < nlChildren.Count eleChild = nlChildren.ItemOf(iRow) iRow = iRow + 1 If Array.IndexOf(aExcelElements, eleChild.Name) <> -1 Then 'Keep this element. If Not Array.IndexOf(aParentElements, eleChild.Name) = -1 Then 'Don't remove elements under these. ' Check the children. Call subRecursivelyRemoveNonNativeExcelElements(eleChild, False) End If Else 'Toss this element. eleChild.ParentNode.RemoveChild(eleChild) nlChildren = eleDef.SelectNodes("*") iRow = iRow - 1 End If Loop #Else For Each eleChild In nlChildren If Array.IndexOf(aExcelElements, eleChild.Name) <> -1 Then 'Keep this element. If Not Array.IndexOf(aParentElements, eleChild.Name) = -1 Then 'Don't remove elements under these. ' Check the children. Call subRecursivelyRemoveNonNativeExcelElements(eleChild, False) End If Else 'Toss this element. eleChild.ParentNode.RemoveChild(eleChild) End If Next #End If If bFirstTime Then 'Remove all IncludeHTML elements, wherever they may be. 'These may not be valid XHTML and will easily fail during the export, and are nothing but trouble. Do While True Dim ele As XmlElement = eleDef.SelectSingleNode("//*/IncludeHtmlFile") If IsNothing(ele) Then Exit Do End If ele.ParentNode.RemoveChild(ele) Loop End If End Sub Private Sub subRecursivelyRemoveNonNativeExcelLabelFormats(ByVal eleDef As XmlElement) '#6097 Export to Excel not working for European Browser if Data Type: Number is used. 'Remove formats that could cause number to be formatted with commas instead of points. That messes up Excel, which needs points. Dim nlExcelColumnFormatElements As XmlNodeList = eleDef.SelectNodes("//ExcelColumnFormat[@DataType='Number']") For Each eleExcelColumnFormatElement As XmlElement In nlExcelColumnFormatElements Dim nlLabels As XmlNodeList = eleExcelColumnFormatElement.ParentNode.SelectNodes(".//Label") For Each eleLabel As XmlElement In nlLabels eleLabel.RemoveAttribute("Format") Next Next End Sub Public Sub subSortHeadersAndFooters(ByRef xmlDef As XmlDocument) 'Sort all the root elements like this: 'ReportHeader 'PageHeader 'PageFooter 'Body 'ReportFooter 'Done by moving elements in relation to a single Body element, which has to exist. 'This order is now important to maintain for NativePDF. Dim eleReport As XmlElement = xmlDef.DocumentElement 'If IsNothing(eleReport) Then _ ' Throw New Exception("Report definition does not have a Report element.") If eleReport.Name = "Report" Then 'This is not needed for mobile reports. Dim eleBody As XmlElement = eleReport.SelectSingleNode("Body") If Not IsNothing(eleBody) Then Dim eleMove As XmlElement eleMove = eleReport.SelectSingleNode("//*/PageHeader") If Not IsNothing(eleMove) Then _ eleReport.InsertBefore(eleMove, eleBody) eleMove = eleReport.SelectSingleNode("//*/PageFooter") If Not IsNothing(eleMove) Then _ eleReport.InsertBefore(eleMove, eleBody) eleMove = eleReport.SelectSingleNode("ReportHeader") If Not IsNothing(eleMove) Then _ eleReport.InsertBefore(eleMove, eleBody) eleMove = eleReport.SelectSingleNode("ReportFooter") If Not IsNothing(eleMove) Then _ eleReport.InsertAfter(eleMove, eleBody) End If End If End Sub Public Function sGetPagingMethod() As String 'The paging method can come from many different sources. Static sPagingMethod As String = Nothing If Not IsNothing(sPagingMethod) AndAlso Not sPagingMethod = "NoPaging" Then 'Below, return the static/cached value sPagingMethod. ElseIf st.sGetRequestVar("rdReportFormat") = "PDF" Or st.sGetRequestVar("rdReportFormat") = "NativeWord" Then sPagingMethod = "Printable" ' updated for 15303 ElseIf Array.IndexOf("HtmlExport,Excel,Word,NativeExcel,GoogleSpreadsheet,CSV,DataLayerXml,HtmlEmail".Split(","), st.sGetRequestVar("rdReportFormat")) <> -1 Then sPagingMethod = "NoPaging" 'From request? ElseIf st.sGetRequestVar("rdPaging").Length <> 0 Then sPagingMethod = st.sGetRequestVar("rdPaging") If sPagingMethod.Length = 0 Then sPagingMethod = "Interactive" End If If "Interactive,Printable,NoPaging,".IndexOf(sPagingMethod & ",") = -1 Then Throw New Exception("An invalid value for rdPaging was specified. It must be Interactive, Printable, or NoPaging.") End If 'From existence of interactive paging? ElseIf Not IsNothing(xmlDef.SelectSingleNode("//InteractivePaging[not(@Remove='True')] | //AppendPaging")) Then sPagingMethod = "Interactive" Else 'Give up, no paging. sPagingMethod = "NoPaging" End If Return sPagingMethod End Function Private Function bPassesLinkDataLayers(ByVal xmldef As XmlDocument) As Boolean If Not IsNothing(xmldef.DocumentElement.SelectSingleNode("//*/Target[@LinkDataLayers='True']")) Then Return True End If End Function Friend Sub subReplaceLocalDataTokens(ByVal eleDef As XmlElement, Optional ByVal sInstanceId As String = Nothing) If eleDef.OuterXml.IndexOf("@Local.") = -1 Then _ Exit Sub Dim atr As XmlAttribute For Each atr In eleDef.SelectNodes(".//@*") '#10175, # 10373 - changed the nodelookup to include the current node plus children. If atr.Value.IndexOf("@Local.") <> -1 Then atr.Value = st.sReplaceTokens(atr.Value, , , , , New String() {"Local"}, , , sInstanceId) End If Next End Sub Private Function sMakeCellColorSpectrumImage(ByVal sStartColor As String, ByVal sEndColor As String, ByVal nWidth As Integer) As String mbDontCacheXsl = True '18505 - CellColorSlider Images May Get Deleted by Cleanup Dim sImageFormat As String = "png" Dim iformat As Imaging.ImageFormat = Imaging.ImageFormat.Png If st.sGetRequestVar("rdReportFormat") = "PDF" Then 'The PDF files don't work well with png files. sImageFormat = "gif" iformat = Imaging.ImageFormat.Gif End If Dim colorStart As Color = Color.FromArgb(GetColorFromString(sStartColor)) Dim colorEnd As Color = Color.FromArgb(GetColorFromString(sEndColor)) Dim bmp As New Bitmap(nWidth, 1) Dim r As Byte Dim g As Byte Dim b As Byte Dim x As Integer For x = 0 To nWidth - 1 r = colorStart.R + x * (CInt(colorEnd.R) - CInt(colorStart.R)) / nWidth g = colorStart.G + x * (CInt(colorEnd.G) - CInt(colorStart.G)) / nWidth b = colorStart.B + x * (CInt(colorEnd.B) - CInt(colorStart.B)) / nWidth bmp.SetPixel(x, 0, Color.FromArgb(r, g, b)) Next Dim sUrl As String = "" Dim sFilename As String = "" Call rdState.MakeTempDownloadFilename(sImageFormat, sUrl, sFilename) Dim stream As New System.IO.FileStream(sFilename, FileMode.Create) bmp.Save(stream, iformat) stream.Flush() : stream.Dispose() '#5430 Return sUrl End Function Private Function GetColorFromString(ByVal sColor As String) As Integer Dim nColor As Integer If IsNumeric(sColor) Then nColor = CInt(sColor) + &HFF000000 ElseIf sColor.StartsWith("#") Then 'Hex color. nColor = Convert.ToInt32(sColor.Substring(1), 16) + &HFF000000 Else 'It's a color name, like "red". nColor = Color.FromName(sColor).ToArgb End If Return nColor End Function Function HexStringFromColor(ByVal cColor As Color) As String If cColor.ToArgb = 0 Then Return "#000000" Else Return "#" & cColor.ToArgb().ToString("X").Substring(2) End If End Function Friend Sub subIncludeAllStandardScript() '23824 'Call subAddIncludedScript("rdAjax/rdAjax2.js") 'Call subAddIncludedScript("rdActionSubmit2.js") 'Call subAddIncludedScript("rdActionProcess.js") 'Call subAddIncludedScript("rdScroll.js") 'Call subAddIncludedScript("rdActionShowElement.js") : subAddJavaEventFunction("rdBodyLoad", "rdShowElementsFromHistory()") 'Call subAddIncludedScript("rdChart.js") 'Call subAddIncludedScript("rdResizer.js") 'Call subAddIncludedScript("rdCalendar/CalendarPopup.js") 'We don't use this popup anymore, but do use the isDate function. 'Call subAddIncludedScript("rdInputValidation.js") 'Call subAddIncludedScript("rdCookie.js") 'Call subAddIncludedScript("rdIFrameResize.js") 'Call subAddIncludedScript("rdAnimatedChart/FusionCharts.js") 'Call subAddIncludedScript("rdFusionMap/FusionMaps.js") 'Call subAddIncludedScript("rdBookmark.js") 'Call subAddIncludedScript("rdPopup/rdDataMenuTree.js") 'Call subAddIncludedScript("rdCalendar/rdDatePicker.js") '18889 ' Maurice 06Sep12 #17608 Call Me.addStandardScriptForQuickTips() 'HighCharts libraries not in DOM in time, must be included for all reports Call IncludeChartCanvasRequiredScripts() End Sub Private Sub addStandardScriptForQuickTips() subAddIncludedCss("rdYui/rdQuicktip.css") subAddYUIInitializer("'quicktip'", rdQuicktip.generateQuicktipJsInitialization()) End Sub Private Function sProcess_IncludeScriptFile(ByRef eleDef As XmlElement) As String Dim sReturn As String = String.Empty '18921 If Array.IndexOf("NativeExcel,NativeWord".Split(","), st.sGetRequestVar("rdReportFormat")) <> -1 Then Return sReturn End If Dim sIncludeFile As String = st.sGetAttribute(eleDef, "IncludedScriptFile", "") sIncludeFile = st.sReplaceTokens(sIncludeFile) sIncludeFile = rdSupportFile.getRelativeWebPath(sIncludeFile, rdState.sGetPhysicalPath(), rdSupportFile.SupportFileType.Script) For Each eleJson As XmlElement In eleDef.SelectNodes("JsonData") Dim sJsonData As String = rdJSON.sProcess_IncludeJSON(eleJson, st, dbug, sbHead) If Not String.IsNullOrEmpty(sJsonData) Then sReturn += String.Format("", rdUtility.HtmlEncode4(sJsonData)) End If Next sIncludeFile = sTokenToXsl(sIncludeFile, xslValueType.Attribute, True) sReturn += String.Format("", sIncludeFile) If eleDef.ParentNode.Name = "Report" OrElse eleDef.ParentNode.Name = "MobileReport" Then 'This goes into the header, not the body. sbHead.Append(sReturn) sReturn = "" End If Return sReturn End Function Private Function sProcess_IncludeScript(ByRef eleDef As XmlElement) As String Dim sReturn As String = String.Empty '18921 If Array.IndexOf("NativeExcel,NativeWord".Split(","), st.sGetRequestVar("rdReportFormat")) <> -1 Then Return sReturn End If For Each eleJson As XmlElement In eleDef.SelectNodes("JsonData") Dim sJsonData As String = rdJSON.sProcess_IncludeJSON(eleJson, st, dbug, sbHead) If Not String.IsNullOrEmpty(sJsonData) Then sReturn += String.Format("", sJsonData) End If Next Dim sIncludeScript As String = eleDef.GetAttribute("IncludedScript") If sIncludeScript.ToLower().IndexOf("{0}", sIncludeScript) 'Insert a new Label element with Format="HTML". Dim eleLabel As XmlElement = eleDef.ParentNode.InsertAfter(eleDef.OwnerDocument.CreateElement("Label"), eleDef) eleLabel.SetAttribute("Caption", sReturn + sIncludeScript) eleLabel.SetAttribute("Format", "HTML") If eleDef.GetAttribute("ID").Length <> 0 Then _ eleLabel.SetAttribute("ID", eleDef.GetAttribute("ID")) Return Nothing End Function Public Sub subProcess_GroupDrillthrough(ByRef eleDef As XmlElement) lgxLicense10.LicenseCheck(eleDef) 'Do not Process if export If Array.IndexOf("Excel,NativeExcel,Word,NativeWord,GoogleSpreadsheet,CSV,PDF,HtmlEmail,HtmlExport,DataLayerXml".Split(","), st.sGetRequestVar("rdReportFormat")) <> -1 Then Return End If 'Check required attributes: ID, GroupFilterID If st.sGetAttribute(eleDef, "ID", "").Length = 0 Then _ Throw New Exception("The GroupDrillthrough elements must have an ID value.") Dim ownerElement As XmlElement If eleDef.ParentNode.Name = "Chart" _ OrElse eleDef.ParentNode.Name = "ChartCanvas" _ OrElse eleDef.ParentNode.Name = "Series" Then ownerElement = eleDef.ParentNode Else ownerElement = eleDef.ParentNode.ParentNode End If '15077 If ownerElement.Name = "SubDataTable" Then Throw New Exception(String.Format("SubDataTables don't support GroupDrillthrough elements . GroupDrillthrough element ID={0}.", st.sGetAttribute(eleDef, "ID", ""))) End If 'get parent datalayer Dim sGroupFilterId As String = st.sGetAttribute(eleDef, "GroupFilterID", "") Dim eleDataLayer As XmlElement = ownerElement.SelectSingleNode("DataLayer") If IsNothing(eleDataLayer) Then Throw New Exception(String.Format("The DataLayer element is not found as a sibling to the GroupDrillthrough element. GroupDrillthrough element ID={0}", st.sGetAttribute(eleDef, "ID", ""))) End If If eleDataLayer.HasAttribute("OriginalDataLayerID") Then eleDataLayer = ownerElement.SelectSingleNode("DataLayer[@ID='" & eleDataLayer.GetAttribute("OriginalDataLayerID") & "']") End If Dim eleGroupFilter As XmlElement = Nothing If sGroupFilterId.Length > 0 Then eleGroupFilter = eleDataLayer.SelectSingleNode(".//GroupFilter[@ID='" + sGroupFilterId + "'] | .//CrosstabFilter[@ID='" + sGroupFilterId + "'] | .//SqlFilter[@ID='" + sGroupFilterId + "'] | .//RelevanceFilter[@ID='" + sGroupFilterId + "'] | .//SqlGroup[@ID='" + sGroupFilterId + "'] | .//SqlCrosstab[@ID='" + sGroupFilterId + "']") If IsNothing(eleGroupFilter) Then Throw New Exception("Filter with ID """ & sGroupFilterId & """ was not found.") End If '19358 While Not IsNothing(eleGroupFilter.ParentNode) AndAlso (eleGroupFilter.ParentNode.Name = "GroupFilter" Or eleGroupFilter.ParentNode.Name = "SqlGroup") eleGroupFilter = eleGroupFilter.ParentNode End While Else eleGroupFilter = eleDataLayer.SelectSingleNode(".//GroupFilter | .//CrosstabFilter | .//RelevanceFilter | .//SqlGroup | .//SqlCrosstab") End If '15077 checking for Linked datalayer. If IsNothing(eleGroupFilter) AndAlso st.sGetAttribute(eleDataLayer, "Type") = "Linked" Then Dim eleDataLayerLink As XmlElement = eleDataLayer.OwnerDocument.DocumentElement.SelectSingleNode(".//DataLayerLink[@ID='" + st.sGetAttribute(eleDataLayer, "LinkedDataLayerID") + "']") eleDataLayer = eleDataLayerLink.ParentNode If sGroupFilterId.Length > 0 Then eleGroupFilter = eleDataLayer.SelectSingleNode(".//GroupFilter[@ID='" + sGroupFilterId + "'] | .//CrosstabFilter[@ID='" + sGroupFilterId + "'] | .//RelevanceFilter[@ID='" + sGroupFilterId + "']") Else eleGroupFilter = eleDataLayer.SelectSingleNode(".//GroupFilter | .//CrosstabFilter | .//RelevanceFilter") End If End If If IsNothing(eleGroupFilter) Then Throw New Exception("GroupDrillthrough elements require GroupFilter, CrosstabFilter or RelevanceFilter under DataLayer.") End If 'Check actions 19619 'Alow for chart canvas If eleDef.ParentNode.Name <> "ChartCanvas" AndAlso eleDef.ParentNode.Name <> "Series" Then Dim actionList As XmlNodeList = eleDef.ParentNode.SelectNodes("Action[not(@ForLegendFilterOnly='True')]") If actionList.Count > 0 Then Throw New Exception("The GroupDrillthrough element does not support the Action element as a sibling.") End If End If 'If eleDef.ParentNode.Name = "ChartCanvas" Then ' If Not IsNothing(eleDef.ParentNode.SelectSingleNode("Series/Action")) Then ' Throw New Exception("The GroupDrillthrough cannot be used with an Action element in a ChartCanvas Series.") ' End If 'End If Dim sMetricPrefix As String Select Case ownerElement.Name Case "DataTable", "CrosstabTable" sMetricPrefix = "Data" Case "Chart", "ChartCanvas", "Series" sMetricPrefix = "Chart" Case Else sMetricPrefix = "Data" End Select Dim sValueTokens As List(Of String) = New List(Of String) Select Case eleGroupFilter.Name Case "GroupFilter", "SqlGroup" '19358 If sGroupFilterId = eleGroupFilter.GetAttribute("ID") Then For Each s As String In st.sGetAttribute(eleGroupFilter, "GroupColumn").Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries) sValueTokens.Add("@" + sMetricPrefix + "." + s + "~") Next Else 'If the ID doesn't match the filter we have, we proceed down until we reach it For Each eleGroupFilterChild As XmlElement In eleGroupFilter.SelectNodes("self::GroupFilter|.//GroupFilter|self::SqlGroup|.//SqlGroup") For Each s As String In st.sGetAttribute(eleGroupFilterChild, "GroupColumn").Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries) sValueTokens.Add("@" + sMetricPrefix + "." + s + "~") Next 'Test to see if we've gone down far enough If eleGroupFilterChild.GetAttribute("ID") = sGroupFilterId Then Exit For Next End If Case "CrosstabFilter", "SqlCrosstab" sValueTokens.Add("@" + sMetricPrefix + ".rdCrosstabColumn~") sValueTokens.Add("@" + sMetricPrefix + "." + st.sGetAttribute(eleGroupFilter, "CrosstabLabelColumn") + "~") Case "RelevanceFilter" For Each s As String In st.sGetAttribute(eleGroupFilter, "DataColumn").Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries) sValueTokens.Add("@" + sMetricPrefix + "." + s + "~") Next Case Else Throw New Exception("The Drillthrough element does not support the " + eleDef.ParentNode.Name + " element as a parent node.") End Select 'Where does the Action go? Dim eleForAction As XmlElement = ownerElement If Not ownerElement.Name.StartsWith("Chart") AndAlso Not ownerElement.Name = "Series" Then 'NOT Chart nor ChartCanvas nor ChartCanvas/Series. 'Add link Dim eleDiv As XmlElement = eleDef.ParentNode.InsertAfter(eleDef.OwnerDocument.CreateElement("Division"), eleDef) eleDiv.SetAttribute("ShowModes", st.sGetAttribute(eleDef, "ShowModes")) eleDiv.SetAttribute("SecurityRightID", st.sGetAttribute(eleDef, "SecurityRightID")) Dim eleDrillImage As XmlElement = eleDiv.AppendChild(eleDef.OwnerDocument.CreateElement("Image")) Dim sImageUrl As String = st.sGetAttribute(eleDef, "Image") If sImageUrl.Trim().Length = 0 Then _ sImageUrl = "rdTemplate/rdGroupDrillthrough/rdDrillthroughBlank.gif" eleDrillImage.SetAttribute("Caption", sImageUrl) eleDrillImage.SetAttribute("ID", "imgDrillthrough") eleDrillImage.SetAttribute("AltText", "Drillthrough") eleDrillImage.SetAttribute("Tooltip", "Drillthrough") eleForAction = eleDrillImage If st.sGetAttribute(eleDef, "Image").Length = 0 Then 'Do this only when the Image attribute is not provided. 'Make the image only appear when the user hovers over the cell. This code is duplicated in rdOlap.vb!! Dim eleHoverEvent As XmlElement = eleDiv.ParentNode.AppendChild(eleDef.OwnerDocument.CreateElement("EventHandler")) eleHoverEvent.SetAttribute("DhtmlEvent", "onmouseover") Dim eleHoverAction As XmlElement = eleHoverEvent.AppendChild(eleDef.OwnerDocument.CreateElement("Action")) eleHoverAction.SetAttribute("Type", "Javascript") eleHoverAction.SetAttribute("Javascript", "rdShowDrillthroughIcon(this,true)") 'Mouseout. eleHoverEvent = eleDiv.ParentNode.AppendChild(eleDef.OwnerDocument.CreateElement("EventHandler")) eleHoverEvent.SetAttribute("DhtmlEvent", "onmouseout") eleHoverAction = eleHoverEvent.AppendChild(eleDef.OwnerDocument.CreateElement("Action")) eleHoverAction.SetAttribute("Type", "Javascript") eleHoverAction.SetAttribute("Javascript", "rdShowDrillthroughIcon(this,false)") 'Script and css needed. '23824 'subAddIncludedScript("rdGroupDrillthrough/rdDrillthrough.js") subAddIncludedCss("rdGroupDrillthrough/rdDrillthrough.css") End If ElseIf ownerElement.Name = "ChartCanvas" Then eleForAction = ownerElement.SelectSingleNode("Series") If IsNothing(eleForAction) Then _ Throw New Exception("ChartCanvas is missing Series element for GroupDrillthrough.") End If 'Add the Action element. Dim eleAction As XmlElement = eleForAction.AppendChild(eleDef.OwnerDocument.CreateElement("Action")) eleAction.SetAttribute("Type", "Report") eleAction.SetAttribute("ID", "actDrillthrough") 'Add target Dim eleTarget As XmlElement = eleAction.AppendChild(eleAction.OwnerDocument.CreateElement("Target")) eleTarget.SetAttribute("Type", "Report") eleTarget.SetAttribute("RequestForwarding", "True") eleTarget.SetAttribute("FrameID", st.sGetAttribute(eleDef, "FrameID", "")) eleTarget.SetAttribute("Report", "rdGroupDrillthrough") 'Add link params Dim eleLinkParams As XmlElement = eleAction.AppendChild(eleAction.OwnerDocument.CreateElement("LinkParams")) For i As Integer = 0 To sValueTokens.Count - 1 eleLinkParams.SetAttribute("rdGroupDrillthroughValue_" + i.ToString(), sValueTokens(i)) Next eleLinkParams.SetAttribute("rdGroupDrillthroughID", st.sGetAttribute(eleDef, "ID")) eleLinkParams.SetAttribute("rdGroupDrillthroughValuesCount", sValueTokens.Count.ToString()) eleLinkParams.SetAttribute("rdParentReport", http.Items("rdRequestedPage")) eleAction.SetAttribute("PopupMenuCaption", "Group Drillthrough") End Sub ' Issue with Action.RefreshElement and AnimatedCharts. 19103 ' Move the refresh element ids for animatedcharts from the charts to the containing div. Private Sub sEditAnimatedChartRefreshIds(ByRef sElementIDs As String, ByRef eleDef As XmlElement) If eleDef.OwnerDocument.DocumentElement.Name = "Report" Then Dim aElements() As String = sElementIDs.Split(",") Dim i As Integer For i = 0 To aElements.Length - 1 Dim ele As XmlElement = xmlDef.SelectSingleNode("//AnimatedChart[@ID='" & aElements(i) & "']") If Not IsNothing(ele) Then aElements(i) = aElements(i).Replace(st.sGetAttribute(ele, "ID"), "rdAnimatedChart" & st.sGetAttribute(ele, "ID")) End If Next sElementIDs = String.Join(",", aElements) End If End Sub Private Function sProcess_FieldsetBox(eleDef As XmlElement) As String Dim sReturn As String = Nothing sReturn = "
    " Dim legendCaption As String = st.sGetAttribute(eleDef, "Caption") Dim legendClass As String = st.sGetAttribute(eleDef, "CaptionClass") sReturn = sSetID(eleDef, sReturn) sReturn = sSetClass(eleDef, sReturn) sReturn = sSetStyle(eleDef, sReturn) 'Style attribute is normally not supported. This is added for nowrap in CellBar elements. If Not String.IsNullOrEmpty(legendCaption) Then sReturn += String.Format("{1}", legendClass, legendCaption) End If sReturn = sReturn & sProcessDefinitionElementChildren(eleDef) sReturn += "
    " Return sReturn End Function Private Sub SetRefreshSeriesTimer(ByVal eleDef As XmlElement) Dim sChartId As String = st.sGetAttribute(eleDef, "ID") For Each eleRefreshSeriesTimer As XmlElement In eleDef.SelectNodes(".//Series/RefreshSeriesTimer") Dim eleSeries As XmlElement = CType(eleRefreshSeriesTimer.ParentNode, XmlElement) Dim sSeriesId As String = st.sGetAttribute(eleSeries, "ID") If st.sGetAttribute(eleSeries, "ID") = "" Then Throw New Exception("ID attribute is required for Series with RefreshSeriesTimer.") End If 'If st.sGetAttribute(eleRefreshSeriesTimer, "RefreshInterval") = "" Then ' Throw New Exception("RefreshInterval attribute is required for RefreshSeriesTimer.") 'End If 'Dim eleRefreshTimer As XmlElement = eleDef.OwnerDocument.CreateElement("RefreshElementTimer") 'eleDef.ParentNode.AppendChild(eleRefreshTimer) 'eleRefreshTimer.SetAttribute("ID", String.Format("rdRefreshSeriesTimer_{0}_{1}", sChartId, sSeriesId)) 'eleRefreshTimer.SetAttribute("ElementID", sSeriesId) 'eleRefreshTimer.SetAttribute("RefreshInterval", eleRefreshSeriesTimer.GetAttribute("RefreshInterval")) 'Dim sVisibleTimeSpan As String = st.sGetAttribute(eleRefreshSeriesTimer, "TimeSpan") 'Dim sSeriesRefreshType As String = "UpdateData" 'If Not String.IsNullOrEmpty(sVisibleTimeSpan) Then ' Dim sXAxisDataColumn As String = st.sGetAttribute(eleSeries, "ChartXDataColumn") ' If String.IsNullOrEmpty(sXAxisDataColumn) Then ' Throw New Exception("ChartXDataColumn attribute is required for Series with RefreshSeriesTimer and TimeSpan attribute.") ' End If ' Dim dateParts As String() = sVisibleTimeSpan.Split(":") ' If sVisibleTimeSpan.Length <> 8 OrElse dateParts.Length <> 3 Then ' Throw New Exception("TimeSpan attribute must be in the format ""hh:mm:ss"". Example: ""00:01:05"" (1 minute and 5 seconds)") ' End If ' sSeriesRefreshType = "AppendData" 'End If 'Dim eleLinkParams As XmlElement = eleRefreshTimer.OwnerDocument.CreateElement("LinkParams") 'eleRefreshTimer.AppendChild(eleLinkParams) 'eleLinkParams.SetAttribute("rdRefreshSeriesTimerEvent", "True") 'eleLinkParams.SetAttribute("rdChartRefreshType", sSeriesRefreshType) 'eleLinkParams.SetAttribute("rdChartCanvasId", sChartId) 'eleLinkParams.SetAttribute("rdChartCanvasSeriesId", sSeriesId) Dim eleHiddenInput As XmlElement = eleDef.OwnerDocument.CreateElement("InputHidden") eleDef.ParentNode.AppendChild(eleHiddenInput) eleHiddenInput.SetAttribute("ID", String.Format("rdSeriesPreviousValue_{0}_{1}", sChartId, sSeriesId)) eleHiddenInput.SetAttribute("DefaultValue", "") Next End Sub Private Sub CreateSessionTimeoutControl() Dim eleSessionTimeout As XmlElement = xmlSettings.SelectSingleNode("Setting/SessionTimeout") Dim sForWizard As String = st.sGetRequestVar("rdForWizard") If IsNothing(eleSessionTimeout) OrElse sForWizard.ToLower() = "true" Then Return End If '23824 'subAddIncludedScript("rdSessionTimeoutControl/rdSessionTimeoutControl.js") 'subAddIncludedScript("rdAjax/rdAjax2.js") ' if SessionAutoKeepAlive=True, then we have to ping server to keep the session alive. ' we don't need nothing then Dim isPingingMode As Boolean = st.sGetAttribute(eleSessionTimeout, "SessionAutoKeepAlive") = "True" If (isPingingMode) Then Dim nPingInterval As Integer If http.Session.Timeout > 4 Then nPingInterval = http.Session.Timeout - 3 Else If http.Session.Timeout < 2 Then _ Throw New Exception("Session timeout must be greater than 1.") nPingInterval = http.Session.Timeout / 2 'For short timeout, set ping to 1/2 of session timeout duration. End If Call subAddYUIInitializerOnce("'sessionTimeout'", _ String.Format("LogiXML.sessionTimeout = new Y.LogiXML.SessionTimeoutControl({{mode:'{0}', pingInterval:{1}}});", _ "pinging", nPingInterval)) ' Return Else Dim slash As String = rdState.GetSlash() Dim xmlSessionTimeoutTemplate As New XmlDocument() xmlSessionTimeoutTemplate.Load(rdState.sGetPhysicalPath & slash & "rdTemplate" & slash & "rdSessionTimeoutControl" & slash & "rdSessionTimeoutWarningPopup.lgx") Call rdUtility.ApplyTemplateModifier(st, dbug, eleSessionTimeout, xmlSessionTimeoutTemplate.DocumentElement) Dim sSessionWarningCaption As String = st.sGetAttribute(eleSessionTimeout, "SessionWarningCaption") If Not String.IsNullOrEmpty(sSessionWarningCaption) Then CType(xmlSessionTimeoutTemplate.SelectSingleNode("//Label[@ID='lblEndingSoon']"), XmlElement).SetAttribute("Caption", sSessionWarningCaption) End If Dim sSessionWarningClass As String = st.sGetAttribute(eleSessionTimeout, "SessionWarningClass") If Not String.IsNullOrEmpty(sSessionWarningClass) Then CType(xmlSessionTimeoutTemplate.SelectSingleNode("//Label[@ID='lblEndingSoon']"), XmlElement).SetAttribute("Class", sSessionWarningClass) End If Dim sSessionKeepAliveCaption As String = st.sGetAttribute(eleSessionTimeout, "SessionKeepAliveCaption") If Not String.IsNullOrEmpty(sSessionKeepAliveCaption) Then CType(xmlSessionTimeoutTemplate.SelectSingleNode("//Label[@ID='lblContinueSession']"), XmlElement).SetAttribute("Caption", sSessionKeepAliveCaption) End If Dim sSessionKeepAliveCaptionClass As String = st.sGetAttribute(eleSessionTimeout, "SessionKeepAliveCaptionClass") If Not String.IsNullOrEmpty(sSessionKeepAliveCaptionClass) Then CType(xmlSessionTimeoutTemplate.SelectSingleNode("//Label[@ID='lblContinueSession']"), XmlElement).SetAttribute("Class", sSessionKeepAliveCaptionClass) End If Dim nodeSessionTimeoutTemplate As XmlNode = xmlDef.ImportNode(xmlSessionTimeoutTemplate.SelectSingleNode("//PopupPanel[@ID='pnlSessionTimeoutControl']"), True) If Not IsNothing(xmlDef.DocumentElement.Item("Body")) Then xmlDef.DocumentElement.Item("Body").AppendChild(nodeSessionTimeoutTemplate) End If Dim sSessionWarningDuration As Integer = st.sGetAttribute(eleSessionTimeout, "SessionWarningDuration", "3") Dim sSessionEndedPage As String = st.sGetAttribute(eleSessionTimeout, "SessionEndedUrl", "rdLogout.aspx") Call subAddYUIInitializerOnce("'sessionTimeout'", _ String.Format("LogiXML.sessionTimeout = new Y.LogiXML.SessionTimeoutControl({{mode:'{0}',sessionWarningDuration:{1},sessionTimeout:{2},logoutUrl:'{3}'}});", _ "redirect", sSessionWarningDuration, HttpContext.Current.Session.Timeout, rdUtility.HtmlEncode4(sSessionEndedPage))) End If End Sub 'TODO Internal control for ReportAuthor element (for now) Private Function sProcess_DraggableDivision(eleDef As XmlElement, Optional ByVal sInnerHTML As String = "") As String Dim cssClass As String = st.sGetAttribute(eleDef, "Class") Dim dragHandlerId As String = st.sGetAttribute(eleDef, "DragHandlerElementID") Dim preventCloneNode As Boolean = st.sGetAttribute(eleDef, "PreventCloneNode") = "True" Dim dropStubId As String = st.sGetAttribute(eleDef, "DropStubID") Dim id As String If eleDef.GetAttribute("ID").Contains("@Data") Then id = sTokenToXsl(eleDef.GetAttribute("ID"), xslValueType.Attribute) Else id = st.sGetAttribute(eleDef, "ID") End If Dim dataIgnore As String If eleDef.GetAttribute("Ignore").Contains("@Data") Then dataIgnore = sTokenToXsl(eleDef.GetAttribute("Ignore"), xslValueType.Attribute) Else dataIgnore = st.sGetAttribute(eleDef, "Ignore") End If Dim dragGroup As String If eleDef.GetAttribute("DragGroup").Contains("@Data") Then dragGroup = sTokenToXsl(eleDef.GetAttribute("DragGroup"), xslValueType.Attribute) Else dragGroup = st.sGetAttribute(eleDef, "DragGroup") End If Dim proxyElement As XmlElement = eleDef.SelectSingleNode("ProxyDivision") Dim proxyMode As String = "none" Dim proxyCssClass As String = String.Empty Dim proxyId As String = String.Empty Dim proxyContent As String = String.Empty Dim proxyMoveOnEnd As String = String.Empty Dim proxyHideOnEnd As String = String.Empty Dim proxyHideOnStart As String = String.Empty If Not IsNothing(proxyElement) Then proxyCssClass = st.sGetAttribute(proxyElement, "Class") proxyMoveOnEnd = st.sGetAttribute(proxyElement, "MoveOnEnd") proxyHideOnEnd = st.sGetAttribute(proxyElement, "HideOnEnd") proxyHideOnStart = st.sGetAttribute(proxyElement, "HideOnStart") If proxyElement.HasChildNodes() Then proxyMode = "element" proxyId = st.sGetAttribute(proxyElement, "ID", Guid.NewGuid().ToString()) proxyContent = String.Format("
    {2}
    ", proxyId, proxyCssClass, sProcessDefinitionElementChildren(proxyElement)) eleDef.RemoveChild(proxyElement) Else proxyMode = "cloneNode" End If End If Dim eleLinkedParams As XmlElement = eleDef.SelectSingleNode("LinkedParams") Dim extraAttributes As String = String.Empty If Not IsNothing(eleLinkedParams) Then For Each attr As XmlAttribute In eleLinkedParams.Attributes If attr.Value.Contains("@") Then extraAttributes += String.Format(" data-{0}=""{1}""", attr.Name, rdUtility.HtmlEncode4(sTokenToXsl(eleLinkedParams.GetAttribute("action"), xslValueType.Attribute))) Else extraAttributes += String.Format(" data-{0}=""{1}""", attr.Name, rdUtility.HtmlEncode4(st.sGetAttribute(eleLinkedParams, attr.Name))) End If Next eleDef.RemoveChild(eleLinkedParams) End If '25514 25523 25425 'Dragging on the windows surface only works when the style ms-touch-action:none is set on the drag node. Dim sReturn As String = String.Format("
    ", _ id, cssClass, dragHandlerId, dragGroup, proxyMode, proxyId, proxyMoveOnEnd, proxyHideOnEnd, proxyHideOnStart, preventCloneNode, dataIgnore, dropStubId, extraAttributes) sReturn = sReturn + sProcessDefinitionElementChildren(eleDef) 'Need to allow for already processed html as the text of the div (not logi elements) sReturn = sReturn + sInnerHTML sReturn = sReturn + "
    " sReturn = sReturn + proxyContent '23824 'Call subAddIncludedScript("rdYui/draggable-element.js") Call subAddYUIInitializerOnce("'draggableElement'", "Y.LogiXML.DraggableElement.createElements();") Return sReturn End Function Private Function sProcess_DroppableDivision(eleDef As XmlElement) As String Dim cssClass As String = st.sGetAttribute(eleDef, "Class") Dim hideGhost As Boolean = st.sGetAttribute(eleDef, "HideGhost") = "True" 'Dim id As String 'If eleDef.GetAttribute("ID").Contains("@Data") Then ' id = sTokenToXsl(eleDef.GetAttribute("ID"), xslValueType.Attribute) 'Else ' id = st.sGetAttribute(eleDef, "ID") 'End If Dim dragGroup As String If eleDef.GetAttribute("DragGroup").Contains("@Data") Then dragGroup = sTokenToXsl(eleDef.GetAttribute("DragGroup"), xslValueType.Attribute) Else dragGroup = st.sGetAttribute(eleDef, "DragGroup") End If Dim dataIgnore As String If eleDef.GetAttribute("Ignore").Contains("@Data") Then dataIgnore = sTokenToXsl(eleDef.GetAttribute("Ignore"), xslValueType.Attribute) Else dataIgnore = st.sGetAttribute(eleDef, "Ignore") End If Dim targetID As String If eleDef.GetAttribute("TargetID").Contains("@Data") Then targetID = sTokenToXsl(eleDef.GetAttribute("TargetID"), xslValueType.Attribute) Else targetID = st.sGetAttribute(eleDef, "TargetID") End If Dim linkedParams As String = String.Empty Dim eleLinkedParams As XmlElement = eleDef.SelectSingleNode("LinkedParams") If Not IsNothing(eleLinkedParams) Then For Each attr As XmlAttribute In eleLinkedParams If linkedParams.Length > 0 Then linkedParams += "," End If linkedParams += String.Format("'{0}':'{1}'", attr.Name, rdUtility.HtmlEncode4(st.sGetAttribute(eleLinkedParams, attr.Name))) Next eleDef.RemoveChild(eleLinkedParams) End If linkedParams = "{" + linkedParams + "}" Dim sReturn As String = String.Format("
    ", _ cssClass, dragGroup, hideGhost, targetID, dataIgnore) sReturn = sSetID(eleDef, sReturn) sReturn = sReturn + sProcessDefinitionElementChildren(eleDef) sReturn = sReturn + "
    " '23824 'Call subAddIncludedScript("rdYui/droppable-container.js") Call subAddYUIInitializerOnce("'droppableContainer'", "Y.LogiXML.DroppableContainer.createElements();") Return sReturn End Function Public Function getAutoCompleteData(ByVal xmlData As XmlDocument, ByVal eleDef As XmlElement) As String Dim sDataString As String = "" Dim sValColumn As String = eleDef.GetAttribute("ColumnName") If String.IsNullOrEmpty(sValColumn) Then _ Throw New Exception("AutoComplete requires the ColumnName attribute.") Dim sValue As String = Nothing Dim nlDataLayerRows As XmlNodeList = xmlData.SelectNodes("/rdData/*") If nlDataLayerRows.Count <> 0 Then For Each eleDLRow As XmlElement In nlDataLayerRows sValue = SecurityElement.Escape(eleDLRow.GetAttribute(sValColumn)) If sValue = "" Then sValue = " " 'Explicitly add a space to show up in the dropdown.RD19896 End If sDataString &= "||" & sValue Next End If If sDataString.Length > 2 Then sDataString = sDataString.Substring(2) End If Return sDataString End Function Sub ReplaceReport(reportToEdit As XmlDocument) Throw New NotImplementedException End Sub Private Function sProcess_Anchor(eleDef As XmlElement) As String Dim sReturn As StringBuilder = New StringBuilder() sReturn.Append("") sReturn.Append(sProcessDefinitionElementChildren(eleDef)) sReturn.Append("") Dim result As String = sSetID(eleDef, sReturn.ToString()) Return sSetEventHandler(eleDef, result) End Function Private Function sProcess_AnalysisCrosstab(ByRef eleDef As XmlElement) As String lgxLicense10.LicenseCheck(eleDef) If st.sGetRequestVar("rdForWizard") = "True" Then HttpContext.Current.Session("rdForWizard") = "True" End If Dim ax As New rdAnalysisCrosstab(st, dbug, xmlSettings) Dim eleAx As XmlElement = ax.BuildAnalysisCrosstab(eleDef) Dim eleComparison As XmlElement = eleDef.SelectSingleNode("CrosstabComparison") If Not IsNothing(eleComparison) Then subAddIncludedCss("rdCrosstabComparison/rdCcStyle.css") End If Call subAddIncludedCss("rdAnalysisGrid/rdAg10Style.css") Call subAddIncludedCss("rdColumnColorStyle.css") Return sProcessDefinitionElement(eleAx) End Function Public Shared Function GetCSRFGUID() As String Dim oCsrf As Object = HttpContext.Current.Session("rdCSFRTest") If IsNothing(oCsrf) Then 'If start of session/first request will need a new GUID. HttpContext.Current.Session("rdCSFRTest") = Guid.NewGuid() GetCSRFGUID = HttpContext.Current.Session("rdCSFRTest").ToString Else GetCSRFGUID = oCsrf.ToString End If End Function Private Sub buildClearVarString(ByVal sNewString As String) If clearVarString.IndexOf(sNewString) = -1 Then clearVarString &= sNewString End If End Sub ''' ''' Returns False if the data layer should not be cached - Otherwise True ''' ''' ''' ''' Private Function CachingAllowedForDataLayer(eleDataLayer As XmlElement) As Boolean If eleDataLayer Is Nothing _ OrElse eleDataLayer.GetAttribute("Type") <> "XMLFile" Then Return True End If Dim sXmlFile As String = st.sGetAttribute(eleDataLayer, "XMLFile").Trim().Replace("/"c, "\"c) If sXmlFile.Length = 0 Then Return True End If Dim sPhysPath As String = rdState.sGetPhysicalPath() Dim sSettingsFile As String = Path.Combine(Path.Combine(sPhysPath, "_Definitions"), "_Settings.lgx").Replace("/"c, "\"c) If sXmlFile.Equals(sSettingsFile, StringComparison.InvariantCultureIgnoreCase) Then ' Don't cache settings file - we need it to remain live for Web Metadata Builder Return False End If Return True End Function Private Function bDontResolveTokensInData(xmlDef As XmlDocument) As Boolean If xmlDef IsNot Nothing _ AndAlso xmlDef.DocumentElement IsNot Nothing Then ' REPDEV-19959 - rdTemplate/rdMetadata/Columns.lgx should not resolve tokens due to LinkURL Dim sDontResolveTokensInData As String = xmlDef.DocumentElement.GetAttribute("DontResolveTokensInData") If sDontResolveTokensInData.Equals("True") Then Return True End If If sDontResolveTokensInData.Equals("False") Then Return False End If End If 'This is only used for LogiXML online help that needs to report data values that contain tokens. Dim resolveNode As XmlNode = xmlSettings.SelectSingleNode("/Setting/General/@DontResolveTokensInData") 'Issue 17876 - Removed Try-Catch construct. If resolveNode IsNot Nothing _ AndAlso resolveNode.Value.Equals("True") Then Return True End If If st.sGetRequestVar("rdReportAuthorViewMode") = "DesignEdit" Then Return True End If Return False End Function Private Sub subAddElementSeeker() If Array.IndexOf("Excel,NativeExcel,Word,NativeWord,PDF".Split(","), st.sGetRequestVar("rdReportFormat")) <> -1 Then Exit Sub End If Dim atrStudioElementSeekerPort As XmlAttribute = xmlSettings.SelectSingleNode("/Setting/General/@StudioElementSeekerPort") Dim iHttpPort As Integer If atrStudioElementSeekerPort IsNot Nothing _ AndAlso Not String.IsNullOrEmpty(atrStudioElementSeekerPort.Value) _ AndAlso Integer.TryParse(atrStudioElementSeekerPort.Value, iHttpPort) _ AndAlso iHttpPort > 0 Then Dim elePage As XmlElement = xmlDef.SelectSingleNode("//Report | //MobileReport") If elePage IsNot Nothing Then Dim eleBody As XmlElement = elePage.SelectSingleNode("Body") If eleBody IsNot Nothing Then Dim rdElementSeeker1 As New rdElementSeekerModel(eleBody, Me) rdElementSeeker1.AddElementSeekerToDefinition(iHttpPort, rdState.sGetApplicationName()) End If End If End If End Sub Private Sub subAddJsUtilities() Call subAddScript("@Function.AppPhysicalPath~/rdTemplate/rdUtilities.js") End Sub Private Function subAddScript(src As String) As XmlElement Dim elePage As XmlElement = xmlDef.SelectSingleNode("//Report | //MobileReport") Dim eleScript As XmlElement = Nothing If elePage IsNot Nothing Then eleScript = xmlDef.CreateElement("IncludeScriptFile") eleScript.SetAttribute("IncludedScriptFile", src) End If Return eleScript End Function Private Sub LoadXmlDef(xml As String) xmlDef.LoadXml(xml) End Sub ''' ''' value will be double quoted, and not escaped, please take this into consideration when calling this function ''' ''' ''' ''' ''' ''' Private Function sAddAttributeToFirstElement(sHtml As String, name As String, value As String) As String If String.IsNullOrEmpty(sHtml) _ OrElse String.IsNullOrEmpty(name) Then Return sHtml End If Dim m As Match = Regex.Match(sHtml, "<[A-Za-z]+[^:]*?>") If Not m.Success Then Return sHtml End If Dim sTest As String = String.Format(" {0}=""", name) If m.Value.Contains(sTest) Then Return sHtml End If Dim idx As Integer If m.Value.Substring(m.Length - 2, 1).Equals("/") Then idx = m.Index + m.Length - 2 Else idx = m.Index + m.Length - 1 End If Return String.Format("{0} {1}=""{2}""{3}", sHtml.Substring(0, idx), name, value, sHtml.Substring(idx)) End Function Private Function sAddRdIdeIdx(ele As XmlElement, sHtml As String) As String If Not bAddIdeIndices _ OrElse ele Is Nothing _ OrElse String.IsNullOrEmpty(sHtml) Then Return sHtml End If Dim rdIdeIdx As String = ele.GetAttribute("rdIdeIdx") If String.IsNullOrEmpty(rdIdeIdx) Then Return sHtml End If Return sAddAttributeToFirstElement(sHtml, "rdIdeIdx", rdIdeIdx) End Function Friend Shared Sub CopyRdIdeIdx(eleSource As XmlElement, eleTarget As XmlElement) Dim sRdIdeIdx As String = eleSource.GetAttribute("rdIdeIdx") If Not String.IsNullOrEmpty(sRdIdeIdx) Then eleTarget.SetAttribute("rdIdeIdx", sRdIdeIdx) End If End Sub ''' ''' Ajax paging/sorting on a dtable from say a dashboard panel needs to have relavent Afilters added... ''' ''' ''' Public Sub AddAnalysisFilterToPagedContent(ByRef xmlDef As XmlDocument) Try Dim eleTable As XmlElement = xmlDef.SelectSingleNode(".//DataTable") Dim sTableId As String = eleTable.GetAttribute("ID") If sTableId.IndexOf("_") <> -1 Then sTableId = sTableId.Substring(0, sTableId.LastIndexOf("_")) End If Dim sAfInsertID As String = "rdAfInsertID-" & sTableId Dim sAfSaveFileId As String = http.Session(sAfInsertID) If Not String.IsNullOrEmpty(sAfSaveFileId) Then Dim eleDl As XmlElement = eleTable.SelectSingleNode("DataLayer") Dim sAfSaveFile As String = HttpContext.Current.Session("rdDataCacheLocation") & "/rdAfState_" & HttpContext.Current.Session.SessionID & "_" & sAfSaveFileId & ".xml" If Not (IO.File.Exists(sAfSaveFile)) Then ' Probably a stand alone global filter... sAfInsertID = "rdAfGlobalInsertID-" & sTableId sAfSaveFileId = http.Session(sAfInsertID) sAfSaveFile = HttpContext.Current.Session("rdDataCacheLocation") & "/rdAfState_" & HttpContext.Current.Session.SessionID & "_" & sAfSaveFileId & ".xml" End If If IO.File.Exists(sAfSaveFile) Then Dim xmlAfState As New XmlDocument xmlAfState.Load(sAfSaveFile) Dim sAfInstance As String = sAfSaveFileId.Substring(sAfSaveFileId.LastIndexOf("_") + 1) Dim nlAfState As XmlNodeList = xmlAfState.SelectNodes(".//AfState[@PanelInstanceID='" & sAfInstance & "'] | .//AfState[starts-with(@ID,'rdGlobalAf')]") For Each eleAfState As XmlElement In nlAfState 'Import the AfState xmlDef.DocumentElement.AppendChild(eleTable.OwnerDocument.ImportNode(eleAfState, True)) 'Create the AfInsert Dim eleAfInsert As XmlElement = eleTable.OwnerDocument.CreateElement("AnalysisFilterInsert") eleAfInsert.SetAttribute("AnalysisFilterID", eleAfState.GetAttribute("ID")) ' and add to the dlayer... Dim nlNodesBeforeAfInsert As XmlNodeList = eleDl.SelectNodes("(SqlColumn | SqlCalculatedColumn | SqlTimePeriodColumn | SqlConditionFilter | AnalysisFilterInsert)") If nlNodesBeforeAfInsert.Count = 0 Then eleDl.PrependChild(eleAfInsert) Else eleDl.InsertAfter(eleAfInsert, nlNodesBeforeAfInsert(nlNodesBeforeAfInsert.Count - 1)) End If Next End If End If Catch : End Try End Sub End Class Public Class JsonColumn Public Id As String Public DataType As String Public DataColumn As String Public AllowedTypes As String() Public DefaultType As String = "Text" Public Sub New(ByVal eleJsonColumn As XmlElement, ByRef st As rdState) Me.New(st.sGetAttribute(eleJsonColumn, "ID"), st.sGetAttribute(eleJsonColumn, "DataType", "Text"), st.sGetAttribute(eleJsonColumn, "DataColumn")) End Sub Public Sub New(ByVal sId As String, ByVal sDataType As String, ByVal sDataColumn As String) Id = sId If Id.Length = 0 Then Throw New Exception("JsonColumn must have an ID attribute.") DataType = sDataType If DataType.Length = 0 Then Throw New Exception(String.Format("JsonColumn elements must have a DataType attribute value. JsonColumn element ID={0}.", Id)) DataColumn = sDataColumn If DataColumn.Length = 0 Then Throw New Exception(String.Format("JsonColumn elements must have a DataColumn attribute value. JsonColumn element ID={0}.", Id)) End Sub Public Sub New(ByVal sId As String, ByVal sDataType As String, ByVal sDataColumn As String, ByVal sAllowedTypes As String(), ByVal sDefaultType As String) Id = sId If Id.Length = 0 Then Throw New Exception("JsonColumn must have an ID attribute.") DataType = sDataType If DataType.Length = 0 Then Throw New Exception(String.Format("JsonColumn elements must have a DataType attribute value. JsonColumn element ID={0}.", Id)) DataColumn = sDataColumn If DataColumn.Length = 0 Then Throw New Exception(String.Format("JsonColumn elements must have a DataColumn attribute value. JsonColumn element ID={0}.", Id)) AllowedTypes = sAllowedTypes DefaultType = sDefaultType End Sub Public Shared Function ParseColumns(ByVal lstColumns As XmlNodeList, ByRef st As rdState) As System.Collections.Specialized.OrderedDictionary Dim columns As System.Collections.Specialized.OrderedDictionary = New System.Collections.Specialized.OrderedDictionary For Each eleColumn As XmlElement In lstColumns Dim column As JsonColumn = New JsonColumn(eleColumn, st) If Not columns.Contains(column.DataColumn) Then columns.Add(column.DataColumn, column) End If Next Return columns End Function End Class Public Class rdPdfUtil Public Shared Function GetPdfType(ByVal st As rdState) As String Dim sPdfType As String = "" 'The report can have a request parameter to set the export method. sPdfType = st.sGetRequestVar("rdPdfExportMethod") #If JAVA Then '7283 sPdfType = "JavaPdf" #Else If sPdfType.Length = 0 Then Const PDF_CONST As String = "rdConstant-rdNativePdf" 'Already determined, or coded in a constant. If Not IsNothing(HttpContext.Current.Application(PDF_CONST)) Then If HttpContext.Current.Application(PDF_CONST) = "True" Then sPdfType = "Version7" Else sPdfType = HttpContext.Current.Application(PDF_CONST) End If Else ''Undetermined. If the BCL PDF Pack is installed, we use that. 'Dim pdfTest As Object = Nothing 'Try ' pdfTest = CreateObject("BCLeasyPDF.easyPDF") 'Catch : End Try 'If IsNothing(pdfTest) Then 'This sets the default PDF method. ' 'sPdfType = "Version7" ' sPdfType = "Version8" 'Else ' pdfTest = Nothing ' sPdfType = "PdfPack" 'End If ' Version 10 - Jan 2010, removed PDF Pack(BCL) - so default to version 8. sPdfType = "Version8" HttpContext.Current.Application(PDF_CONST) = sPdfType End If End If #End If Return sPdfType End Function End Class Public Class rdNativeExcelUtil Public Shared Function GetGridLinesType(ByVal st As rdState) As String Dim sRenderGridlines As String = "" ' Does the excel target element have the gridlines attribute set ? sRenderGridlines = st.sGetRequestVar("rdShowGridlines") Const GL_CONST As String = "rdConstant-rdShowExcelGridlines" If Not IsNothing(HttpContext.Current.Application(GL_CONST)) Then sRenderGridlines = HttpContext.Current.Application(GL_CONST) End If Return sRenderGridlines End Function End Class