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("", 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) = "
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("
" & vbCrLf
Next
' 17244 Probably shouldn't be looking for tags in text, but... not going to go there.
' Code was looking for separate element beginning and end (),
' check() for empty element with combined beginning and end ().
If sHtml.IndexOf(PageBuilder.RD_HIDDEN) <> -1 Then
sHtml = sHtml.Replace(PageBuilder.RD_HIDDEN, sHidden)
Else
sHtml = sHtml.Replace("", sHidden)
End If
'Dim sUrl As String = http.Response.ApplyAppPathModifier(http.Request.RawUrl) 'ApplyAppPathModifier adds a session identifier for cookieless sessions. Issue #1274.
'Dim sUrl As String = http.Response.ApplyAppPathModifier(http.Request.Url.PathAndQuery) 'ApplyAppPathModifier adds a session identifier for cookieless sessions. Issue #1274.
'ApplyAppPathModifier adds a session identifier for cookieless sessions. Issue #1274.
Dim sUrl As String
If http.Response.ApplyAppPathModifier(http.Request.Url.PathAndQuery) <> http.Request.Url.PathAndQuery Then
'Cookieless session. The root of the path will be included, and a proxy will not work.
sUrl = http.Response.ApplyAppPathModifier(http.Request.Url.PathAndQuery)
Else
'Standard path. This will work with proxies because the root path is not included. The URL will start with "rdPage.aspx..." 16331
sUrl = http.Request.Url.Segments(http.Request.Url.Segments.Length - 1) & http.Request.Url.Query
End If
sUrl = sUrl.Replace("'", "\'") 'This url is quoted in a JavaScript function. Need to encode quotes. Issue 1644
sHtml = sHtml.Replace("rdHTTPS", HttpContext.Current.Request.ServerVariables("HTTPS")) 'HTTPS returns "on" for HTTPS sessions. HTTPS doesn't cache images, making this animation kill the server. Issue #2397
sHtml = sHtml.Replace("rdUrl", sUrl)
sHtml = sHtml.Replace("rdShowWait=", "rdNoShowWait=") 'Prevent infinate loop.
'sHtml = sHtml.Replace("rdUID", CStr(CLng(Rnd() * 100000))) 'This helps with the the Back button.
sHtml = sHtml.Replace("rdUID", Guid.NewGuid.ToString) '#6380 'This helps with the the Back button.
http.Response.Write(sHtml)
http.Response.End()
End Sub
End Class
Public Class PageBuilder
Friend sHtmlOutput As String = ""
Friend srHtmlOutputReader As StreamReader
Friend msRequestedPage As String = ""
Friend isAjaxRequest As Boolean = False
Friend needLocalization As Boolean = True
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 http As HttpContext = HttpContext.Current
Friend st As New rdState()
Dim _db9 As rdDb9 = Nothing
Dim util As New rdUtility()
Dim dbug As rdDebug
Friend xmlSettings As XmlDocument
Dim sSettings As String
Private _xmlDef As XmlDocument
Friend Property xmlDef As XmlDocument
Get
If _xmlDef Is Nothing Then
_xmlDef = New XmlDocument()
End If
Return _xmlDef
End Get
Set(value As XmlDocument)
_xmlDef = value
End Set
End Property
Dim mbDontCacheXsl As Boolean = False
Dim mbPageHasSorting As Boolean = False
'Dim mbPageHasFileUpload As Boolean = False
'Dim mbCantUseDataCache As Boolean = False Commented for 15115
Dim mnNextID As Integer = 0
Dim sbHtml As New StringBuilder()
Friend sbHead As New StringBuilder()
Dim sbBody As New StringBuilder()
Dim msScriptList As String = ""
Dim msCssList As String = ""
Dim msJavaEventFunctionBodyLoad As String = ""
Dim msJavaEventFunctionBodyUnload As String = ""
Dim msJavaEventFunctionBodyPressEnter As String = ""
Dim msJavaEventFunctionBodyResize As String = ""
Dim msJavaEventFunctionDomReady As String = ""
Dim msYUIUse As String = ""
Dim msYUIInitialize As String = ""
Dim lstHeadCustomHtmlKyes As List(Of String) = Nothing
Friend sbHeadCustomHtml As StringBuilder = Nothing
Dim msJScriptValidationStatements As String = " " '25320
Dim msJScriptInputCookieStatements As String = ""
Dim msJScriptInputLocalStorageStatements As String = ""
Dim msPopupJScript As String = ""
Dim mnPopupMaxWidth As Integer = 0
Dim maReportShowModes() As String = New String() {}
Friend mbAddAjaxSupport As Boolean
Dim melePrintablePaging As XmlElement
Private checkboxNames As Dictionary(Of String, Integer) = New Dictionary(Of String, Integer)
Private columnIndex As Integer
Private _dataColumnNames As Dictionary(Of String, Integer) = New Dictionary(Of String, Integer)()
Private chartCanvasIds As Dictionary(Of String, Integer) = New Dictionary(Of String, Integer)()
Private colorPickerIds As Dictionary(Of String, Integer) = New Dictionary(Of String, Integer)()
Private clearVarString As String = ""
'Const BODY_MARGIN = "bottomMargin=""0"" leftMargin=""0"" topMargin=""0"" rightMargin=""0"""
Const DISPLAY_STYLE_NONE As String = "display:none;"
Const XSL_LINEFEED As String = ""
Public Const RD_HIDDEN As String = ""
Private Shared HIDDEN_COLUMNS() As String = New String() {"lgxPeekNextRow"}
Enum TargetType
TargetType_URL
TargetType_JScript
End Enum
Enum xslValueType
Element
Attribute
End Enum
Enum RowType
Header
Summary
End Enum
Dim plugin As rdPlugin
Private ReadOnly Property bAddIdeIndices As Boolean
Get
Return iStudioElementSeekerPort > 0
End Get
End Property
Private _iStudioElementSeekerPort As Integer = -1
Private ReadOnly Property iStudioElementSeekerPort As Integer
Get
If _iStudioElementSeekerPort < 0 Then
Dim attrStudioElementSeekerPort As XmlAttribute = xmlSettings.SelectSingleNode("//General/@StudioElementSeekerPort")
If attrStudioElementSeekerPort Is Nothing _
OrElse String.IsNullOrEmpty(attrStudioElementSeekerPort.Value) _
OrElse Not Integer.TryParse(attrStudioElementSeekerPort.Value, _iStudioElementSeekerPort) _
OrElse _iStudioElementSeekerPort <= 0 Then
_iStudioElementSeekerPort = 0
End If
End If
Return _iStudioElementSeekerPort
End Get
End Property
Public Sub New()
End Sub
Public Sub New(ByVal rdDebugObject As rdDebug, Optional ByVal xmlSettingsIn As XmlDocument = Nothing)
dbug = rdDebugObject
If IsNothing(xmlSettingsIn) Then
xmlSettings = New XmlDocument
If String.IsNullOrEmpty(http.Application("_Settings-rdDef-string")) Then
http.Application.Set("_Settings-rdDef-string", st.sGetDefinition("_Settings"))
End If
xmlSettings.LoadXml(http.Application("_Settings-rdDef-string"))
Else
xmlSettings = xmlSettingsIn
End If
Me.plugin = New rdPlugin(dbug)
'Issue 11210 - remove rdDb from build.
_db9 = New rdDb9(xmlSettings, dbug)
'The value is in megabytes.
Const MB As Integer = 1048576
Dim nMemoryStreamLimitBytes As Integer = 10 * 1048576
Dim sMemoryStreamLimit As String = HttpContext.Current.Application("rdConstant-rdMemoryStreamLimit")
If (Not lgxLicense10.IsOkToRun(LogiProducts.Info_Server)) Then
'Free reporting never uses the file system. So we max the value of the memory stream limit.
nMemoryStreamLimitBytes = Integer.MaxValue
If Not IsNothing(sMemoryStreamLimit) Then
dbug.AddDebugMessage("Hybrid Data Engine", "** Warning **", "Setting the Hybrid Engine rdMemoryStreamLimit constant requires a Logi Info or Info Lite license.")
End If
Else
If Not IsNothing(sMemoryStreamLimit) Then
If Val(sMemoryStreamLimit) * MB > Integer.MaxValue Then
nMemoryStreamLimitBytes = Integer.MaxValue
Else
nMemoryStreamLimitBytes = Val(sMemoryStreamLimit) * MB
End If
End If
dbug.AddDebugMessage("Hybrid Data Engine", "MemoryStreamLimit", CType(nMemoryStreamLimitBytes / MB, Integer) & " MB")
End If
HttpContext.Current.Application("rdMemoryStreamLimitBytes") = nMemoryStreamLimitBytes 'This constant is used throughtout the app to remember the limit size. #5745
_db9.MemoryStreamLimit = nMemoryStreamLimitBytes
End Sub
Public Sub BuildHtml(Optional ByVal RequestedPage As String = "")
Dim tra As System.Xml.Xsl.XslTransform = Nothing
Dim sXsl As String = ""
Dim xSchemaDoc As XmlDocument = Nothing
'Defintion File
dbug.AddDebugMessage("Determine Definition")
msRequestedPage = RequestedPage
If msRequestedPage.Length = 0 Then msRequestedPage = st.sReplaceTokens("@Request.rdReport~")
If msRequestedPage.Length = 0 Then msRequestedPage = st.sReplaceTokens("@Request.lgx_ReportID~")
If msRequestedPage.Length = 0 Then
'Need to get the default page from the settings.
Try
msRequestedPage = xmlSettings.SelectSingleNode("/Setting/Application").Attributes("DefaultReport").Value
Catch : End Try
If msRequestedPage.Length = 0 Then
msRequestedPage = "Default"
End If
End If
msRequestedPage = msRequestedPage.Replace(".lgx", "")
If msRequestedPage.Length = 0 Then
msRequestedPage = "Default"
End If
If rdMetaBuilder.IsDisabled _
AndAlso rdMetaBuilder.IsMetadataBuilderReport(msRequestedPage) Then
Throw New Exception(rdMetaBuilder.DisabledMessage)
End If
http.Items("rdReport") = msRequestedPage
rdEventLogging.LogEvent("BuildReport", "Report", rdEventLogging.EventSequence.Starting, "ReportID=" & msRequestedPage)
dbug.AddDebugMessage(, "Requested Definition", msRequestedPage)
'http.Session("rdRequestedPage") = msRequestedPage 'This is used for the DefaultRequestValue definition element.
http.Items("rdRequestedPage") = msRequestedPage 'This is used for the DefaultRequestValue definition element and DataLayer linking and IntelligenceReporting.
Dim intelReporting As rdIntelligenceReporting = HttpContext.Current.Items("rdIntelligenceReporting")
intelReporting.RunReport(msRequestedPage)
'Get the report definition.
'sUniqueRequestInfo contains request variables that can effect the XSL generation. So we can't cache unless they're all the same.
Dim sec As rdSecurity = http.Session("rdSecurity")
Dim sUniqueRequestInfo As String = sec.UserRightsString & "-" & st.sGetRequestVar("rdShowModes") & "-" & st.sGetRequestVar("rdReportFormat") & "-" & st.sGetRequestVar("rdPaging") & "-" & st.sGetRequestVar("rdEmbeddedSubReport")
'This subGetBookmarkParams is used for when a Bookmark is getting loaded with an rdBookmarkID parameter.
'Below, we may load bookmark parameters based on an AutoBookmark.
Call rdBookmark.subGetBookmarkParams()
Dim eleAutoBookmark As XmlElement = Nothing
Dim bFromProcess As Boolean = False
Dim bUseDefinitionCache As Boolean = False
If st.sGetDefinition(msRequestedPage) = http.Application(msRequestedPage & sUniqueRequestInfo & "-rdDef") Then
'The definition file is the same since the last request.
'Cached in application
bUseDefinitionCache = True
ElseIf st.sGetDefinition(msRequestedPage) = http.Session(msRequestedPage & sUniqueRequestInfo & "-rdDef") Then
'Cached in session
bUseDefinitionCache = True
End If
'22383
If st.sGetRequestVar("rdRequestFromProcess") = "True" Then
bFromProcess = True
End If
mbDontCacheXsl = False
If st.bRepeaterProcessed Then '19746
bUseDefinitionCache = False
mbDontCacheXsl = True
ElseIf http.Request("rdPrompt") = "True" Then
bUseDefinitionCache = False
ElseIf st.sGetRequestVar("rdAjaxCommand") = "RefreshElement" Then
bUseDefinitionCache = False
mbDontCacheXsl = True
ElseIf st.sGetRequestVar("rdAjaxCommand") = "CalendarRefreshElement" Then
bUseDefinitionCache = False
mbDontCacheXsl = True
ElseIf st.sGetRequestVar("rdAgCommandID").Length <> 0 _
AndAlso rdAnalysisGrid10.bIsNewCommand(st.sGetRequestVar("rdAgCommandID"), False) Then
bUseDefinitionCache = False
ElseIf st.sGetRequestVar("rdAgReset").Length <> 0 _
OrElse st.sGetRequestVar("rdAgLoadSaved").Length <> 0 _
OrElse st.sGetRequestVar("rdAgRefreshData").Length <> 0 Then
bUseDefinitionCache = False
ElseIf Not IsNothing(HttpContext.Current.Request.Form("rdNoXslCache")) Then
bUseDefinitionCache = False
ElseIf Not IsNothing(HttpContext.Current.Request.Form("rdAgPaging")) _
AndAlso st.sGetRequestVar("rdReportFormat").Length <> 0 Then
'The presence of rdAgPaging indicates we are running the AG. Don't a cached definition for AG exports.
bUseDefinitionCache = False
ElseIf st.sGetRequestVar("rdProcessAction").Length <> 0 Then '#9663
bUseDefinitionCache = False
ElseIf st.sGetRequestVar("rdGroupDrillthroughId").Length > 0 Then
bUseDefinitionCache = False
ElseIf st.sGetRequestVar("rdRcCommand").Length > 0 Then
bUseDefinitionCache = False
End If
#If JAVA Then
Try '18804 Fresenius XML Prefix error workaround
If bUseDefinitionCache Then
xmlDef = http.Application.Get(msRequestedPage & sUniqueRequestInfo & "-xmlDef")
Dim sXml As String = xmlDef.OuterXml
End If
Catch 'ex As Exception
'Try
' Dim Writer As New IO.StringWriter
' Dim Serializer As New Xml.Serialization.XmlSerializer(xmlDef.GetType)
' Serializer.Serialize(Writer, http.Application.Get(msRequestedPage & sUniqueRequestInfo & "-xmlDef"))
' Dim serializedObject As String = Writer.ToString()
' dbug.AddDebugMessage("***WARNING***", "Unable to Read Definition from Cache - rereading", ex.Message & " " & serializedObject)
'Catch exx As Exception
' dbug.AddDebugMessage("***WARNING***", "Unable to Read Definition from Cache - rereading failure serializing", ex.Message & " " & exx.Message)
'End Try
bUseDefinitionCache = False
End Try
#End If
If bUseDefinitionCache Then
'Get cached objects.
dbug.AddDebugMessage("Definition", "Read Definition from Cache", "True")
tra = http.Application.Get(msRequestedPage & sUniqueRequestInfo & "-tra")
If Not IsNothing(tra) Then
sXsl = http.Application.Get(msRequestedPage & sUniqueRequestInfo & "-Xsl")
xmlDef = http.Application.Get(msRequestedPage & sUniqueRequestInfo & "-xmlDef")
mbPageHasSorting = http.Application(msRequestedPage & sUniqueRequestInfo & "-bUsesSort")
Else
'This is for the AnalysisGrid. It get's cached stuff from session instead of application scope.
LoadXmlDef(http.Session(msRequestedPage & sUniqueRequestInfo & "-xmlDef"))
'Fix for #3910
'Load the XSL into a Transform object.
'tra = http.Session(msRequestedPage & sUniqueRequestInfo & "-tra")
sXsl = http.Session(msRequestedPage & sUniqueRequestInfo & "-Xsl")
Dim sr As New System.IO.StringReader(sXsl)
Dim xtr As New Xml.XmlTextReader(sr)
tra = New System.Xml.Xsl.XslTransform()
tra.Load(xtr)
mbPageHasSorting = http.Session(msRequestedPage & sUniqueRequestInfo & "-bUsesSort")
If Not IsNothing(http.Session("rdModifiedAGLayout")) OrElse st.sGetRequestVar("rdAgCommandExcludeDetailRows") = "True" OrElse st.sGetRequestVar("rdAgCommandHideFunctionNames") = "True" Then '#15045, #15049.
bUseDefinitionCache = False
End If
End If
'13911
Dim sScriptValueCacheCount As String = xmlDef.DocumentElement.GetAttribute("ScriptValueCacheCount")
If Not String.IsNullOrEmpty(sScriptValueCacheCount) Then
HttpContext.Current.Items.Add("rdReportScriptValueCacheCount", sScriptValueCacheCount)
End If
'20327
Dim sUnsafeScriptAllowed As String = xmlDef.DocumentElement.GetAttribute("UnsafeScriptAllowed")
If Not String.IsNullOrEmpty(sUnsafeScriptAllowed) Then
HttpContext.Current.Items.Add("rdReportUnsafeScriptAllowed", sUnsafeScriptAllowed)
End If
If IsNothing(tra) OrElse IsNothing(xmlSettings) Then
bUseDefinitionCache = False
Else
'Issue 11210 - remove rdDb from build.
Call st.subGetReportStartupParams(xmlDef.DocumentElement, _db9, xmlSettings)
End If
HttpContext.Current.Session.Remove("rdBookmarkOrganizerSharing")
End If
If Not bUseDefinitionCache Then
'Make new objects.
dbug.AddDebugMessage(, "Read Definition from Cache", "False")
'Get the definition file for the current page.
LoadXmlDef(st.sGetDefinition(msRequestedPage, , , , , , , bFromProcess))
Call rdSecurityUtil.subCheckDefinitionSecurityRights(xmlDef, st)
Call st.subGetReportStartupParams(xmlDef.DocumentElement, _db9, xmlSettings, msRequestedPage)
If rdMetaBuilder.IsMetadataBuilderReport(msRequestedPage) Then
rdMetadataUndoRedo.subInitUndoRedo()
End If
eleAutoBookmark = xmlDef.SelectSingleNode("//AutoBookmark")
'''''''''eleAutoBookmark = xmlDef.SelectSingleNode("//AnalysisGrid/AutoBookmark | //Dashboard2/AutoBookmark | //ReportAuthor/AutoBookmark | ") 'Find an Autobookmark under a SuperElement.
If Not IsNothing(eleAutoBookmark) AndAlso Not "Report,MobileReport".Contains(eleAutoBookmark.ParentNode.Name) Then
' "" AndAlso sRefreshAnimChartId.Contains(st.sGetRequestVar("rdAnimDBInstanceId")) Then
sRefreshAnimChartId = sRefreshAnimChartId.Substring(0, sRefreshAnimChartId.IndexOf(st.sGetRequestVar("rdAnimDBInstanceId")) - 1)
End If
Dim xmlAnimatedChartNode As XmlElement = xmlDef.DocumentElement.SelectSingleNode(".//*[@ID='" & sRefreshAnimChartId & "']")
Dim xmlAnimatedChartDef As New XmlDocument()
Dim sAnimChartDef As String = "" & xmlAnimatedChartNode.OuterXml & ""
xmlAnimatedChartDef.LoadXml(sAnimChartDef)
Dim acRefresh As rdAnimatedChart = New rdAnimatedChart(dbug)
acRefresh.subBuildAnimatedChartDataTextFile(xmlAnimatedChartDef, st.sGetRequestVar("rdRefreshElementID"), Nothing, "", st.sGetRequestVar("rdAnimatedChartRenderer"))
End If
'13911
Dim sScriptValueCacheCount As String = xmlDef.DocumentElement.GetAttribute("ScriptValueCacheCount")
If Not String.IsNullOrEmpty(sScriptValueCacheCount) Then
HttpContext.Current.Items.Add("rdReportScriptValueCacheCount", sScriptValueCacheCount)
End If
'20327
Dim sUnsafeScriptAllowed As String = xmlDef.DocumentElement.GetAttribute("UnsafeScriptAllowed")
If Not String.IsNullOrEmpty(sUnsafeScriptAllowed) Then
HttpContext.Current.Items.Add("rdReportUnsafeScriptAllowed", sUnsafeScriptAllowed)
End If
'14873
If http.Items("rdRequestedPage") = "rdGroupDrillthrough" Then
Dim GroupDrillthrough As rdGroupDrillthrough = New rdGroupDrillthrough()
xmlDef = GroupDrillthrough.Process_DrillthroughReport(xmlDef)
End If
'If this is an embedded SubReport, remove column sorting and interactive paging elements.
If st.sGetRequestVar("rdEmbeddedSubReport") = "True" Then '13215
Dim eleRemove As XmlElement
Dim sRemoveElementXPath As String = "//DataColumnSort | //InteractivePaging | //AppendPaging"
Dim nlRows As XmlNodeList = xmlDef.SelectNodes(sRemoveElementXPath)
Do While 0 < nlRows.Count
eleRemove = nlRows.ItemOf(0)
eleRemove.ParentNode.RemoveChild(eleRemove)
nlRows = xmlDef.SelectNodes(sRemoveElementXPath)
Loop
End If
'excel sub report, add defintion to the request object for column formats.
If st.sGetRequestVar("rdSubReport") = "True" AndAlso st.sGetRequestVar("rdReportFormat") = "NativeExcel" Then
'Store it
Dim sXlList As String = "," : Dim bAddToList As Boolean = True
If IsNothing(HttpContext.Current.Items("excelSubReportList")) Then
sXlList = ""
Else
If HttpContext.Current.Items("excelSubReportList").ToString.Contains("xlSubRep-" & msRequestedPage) Then
bAddToList = False
End If
sXlList = HttpContext.Current.Items("excelSubReportList") & ","
End If
If bAddToList Then
HttpContext.Current.Items("excelSubReportList") = sXlList & "xlSubRep-" & msRequestedPage
HttpContext.Current.Items("xlSubRep-" & msRequestedPage) = xmlDef
End If
End If
'Debugging?
If dbug.DebuggingEnabled Then
Call subAddDebugLinks()
End If
Call subAddElementSeeker()
'===========================
'Dashboard-specific code
If HttpContext.Current.Items("isMobileDef") Then
If xmlDef.SelectNodes("//*/MobileDashboard").Count > 1 Then _
Throw New Exception("There is only one MobileDashboard allowed in a Definition.") '#13721.
Dim eleMobileDashboard As XmlElement = xmlDef.SelectSingleNode("//MobileDashboard")
If Not IsNothing(eleMobileDashboard) Then
Dim sDashboardSourceReport As String = eleMobileDashboard.GetAttribute("DashboardDefinitionFile")
Dim xmlDashboard2 As XmlDocument
If sDashboardSourceReport.Length = 0 Then _
Throw New Exception("Missing DashboardDefinitionFile attribute for MobileDashboard.")
Try
xmlDashboard2 = New XmlDocument() : xmlDashboard2.LoadXml(st.sGetDefinition(sDashboardSourceReport, "Reports", , True))
Catch ex As Exception
Throw New Exception("Invalid DashboardDefinitionFile attribute value.", ex)
End Try
Dim eleImportDashboard As XmlElement = xmlDashboard2.SelectSingleNode("//Dashboard2")
If IsNothing(eleImportDashboard) Then _
Throw New Exception("The DashboardDefinitionFile needs to reference a report that has a Dashboard.")
eleMobileDashboard.ParentNode.InsertAfter(xmlDef.ImportNode(eleImportDashboard, True), eleMobileDashboard)
End If
End If
'Fix up the dashboard early on to let the initialization code to work.
Dim eleDashboard As XmlElement = xmlDef.SelectSingleNode(".//Dashboard2")
Dim instDashboard As rdDashboard = New rdDashboard(Me, st, dbug)
If Not IsNothing(eleDashboard) Then
If st.sGetRequestVar("rdLoadBookmark") = "True" _
OrElse st.sGetRequestVar("rdNewBookmark") = "True" _
OrElse st.sGetRequestVar("rdCaller") = "rdScheduler" Then
If Not IsNothing(eleAutoBookmark) Then
'Run the bookmark code and retreive the SaveFileName.
rdBookmark.InitAutoBookmark(st, msRequestedPage, eleAutoBookmark)
If st.sGetAttribute(eleAutoBookmark, "ReadOnlyBookmark") = "True" Then
eleDashboard.SetAttribute("DashboardAdjustable", "False")
eleDashboard.RemoveChild(eleAutoBookmark) 'Prevent autosaving this read-only bookmark.
End If
End If
End If
FixUpDashboardDefWithCustomDashboardPanels(eleDashboard, instDashboard)
If st.sGetRequestVar("rdAjaxCommand") = "RefreshElement" Then
Call FixupDashboardContentForRefresh(eleDashboard)
End If
For Each eleDashboardPlugin As XmlElement In eleDashboard.SelectNodes("LoadPanelsPluginCall")
Dim plugin As rdPlugin = New rdPlugin(dbug)
plugin.CallPlugin_GeneratedElement(xmlDef.DocumentElement, eleDashboardPlugin)
Next
End If
'This code path runs for the AddToDashboard code.
If st.sGetRequestVar("rdCommand") = "AddDashboardPanel" Then
subAddPanelToDashboardGallery(xmlDef.DocumentElement)
End If
'===========================
If st.sGetRequestVar("rdAjaxCommand") = "RefreshElement" _
AndAlso st.sGetRequestVar("rdEmbeddedSubReport") <> "True" Then
'Remove non-RefreshElement elements.
'Make a new xmlDef with just the element we're refreshing, and a couple others too.
'Dim sElementIDs() As String = (st.sGetRequestVar("rdRefreshElementID") & ",rdDebug").Split(",")
Dim sElementIDs() As String = st.sReplaceTokens(st.sGetRequestVar("rdRefreshElementID").Replace("$"c, "@"c)).Split(",")
If sElementIDs.Length = 0 Then
sHtmlOutput = ""
Exit Sub 'This is an error.
End If
'Maurice 01Aug12 - #17420 "Data set doubled when refreshing multiple elements in dashboard."
'Remove duplicate element IDs.
Dim dicIds As Dictionary(Of String, String) = New Dictionary(Of String, String)()
Dim sId As String
For Each sId In sElementIDs
If Not dicIds.ContainsKey(sId) Then
dicIds.Add(sId, sId)
End If
Next
If st.sGetRequestVar("rdAcRefresh") = "True" _
OrElse st.sGetRequestVar("rdAxRefresh") = "True" _
OrElse st.sGetRequestVar("rdAfRefresh") = "True" Then
'Special so the AnalysisGrid gets run when the AnalysisChart or AnalysisCrosstab is inside.
Dim eleAg As XmlElement = xmlDef.SelectSingleNode("//AnalysisGrid")
If Not IsNothing(eleAg) Then
sId = eleAg.GetAttribute("ID")
If Not dicIds.ContainsKey(sId) Then
dicIds.Add(sId, sId)
End If
End If
End If
''''No longer needed because the entire panel now gets updated with AF design/simple mode changes.
'''''Make AF under the Dashboard work when switching between Design and Simple modes. For this case, we don't want to refresh the entire panel.
''''If Not IsNothing(eleDashboard) Then
'''' 'If st.sGetRequestVar("rdAfRefresh") = "True" Then
'''' If st.sGetRequestVar("rdAfCommand") = "Design" OrElse st.sGetRequestVar("rdAfCommand") = "Simple" Then
'''' 'Special so the AnalysisFilter can get it's definition from under the Dashboard. .
'''' Dim sAnalysisFilterID As String = st.sGetRequestVar("rdAnalysisFilterID")
'''' Dim eleAfUnderDashboard As XmlElement = eleDashboard.SelectSingleNode(".//AnalysisFilter[@ID='" & sAnalysisFilterID & "']")
'''' If IsNothing(eleAfUnderDashboard) Then
'''' 'There may be an instance ID, strip it off.
'''' If sAnalysisFilterID.Contains("_") Then
'''' Dim sFilterID As String = sAnalysisFilterID.Substring(0, sAnalysisFilterID.LastIndexOf("_"))
'''' eleAfUnderDashboard = eleDashboard.SelectSingleNode(".//AnalysisFilter[@ID='" & sFilterID & "']")
'''' End If
'''' End If
'''' If IsNothing(eleAfUnderDashboard) Then
'''' 'The panel came from the gallery, not the Dashboard definition. Load the panel's definition from cache.
'''' Dim xmlCachedDashboard As New XmlDocument
'''' Dim sDashboardPanelCacheFile As String = HttpContext.Current.Session("rdDataCacheLocation") & "/rdDashboardState_" & HttpContext.Current.Session.SessionID & ".xml"
'''' xmlCachedDashboard.Load(sDashboardPanelCacheFile)
'''' Dim sPanelID As String = sAnalysisFilterID.Replace("rdAf_", "rdDashboardPanel-")
'''' Dim elePanel As XmlElement = xmlCachedDashboard.SelectSingleNode(".//Division[@ID='" & sPanelID & "']")
'''' If Not IsNothing(elePanel) Then
'''' xmlDef.DocumentElement.AppendChild(xmlDef.ImportNode(elePanel, True))
'''' End If
'''' 'Else
'''' ' Dim eleAfDashboard As XmlElement = eleAfUnderDashboard.SelectSingleNode("ancestor::Dashboard2")
'''' ' eleAfUnderDashboard.SetAttribute("SaveFile", st.sGetAttribute(eleAfDashboard, "SaveFile"))
'''' End If
'''' End If
''''End If
Dim idsToDelete As List(Of String) = New List(Of String)()
Dim idsToAdd As List(Of String) = New List(Of String)()
Dim idsToSkip As List(Of String) = New List(Of String)()
'Requested elements.
Dim eleElement As XmlElement = Nothing
Dim sXmlDef As String = ""
Dim sElementID As String
For Each sId In dicIds.Keys
sElementID = sId
If sElementID.Length <> 0 Then
eleElement = xmlDef.SelectSingleNode("//*[@ID='" & sElementID & "']")
'Make sure we don't add the ThemeEditor element twice
If st.sGetRequestVar("rdChangeTheme") = "True" OrElse st.sGetRequestVar("rdThemeEditorRefresh") = "True" Then
eleElement = xmlDef.DocumentElement.SelectSingleNode(".//ThemeEditor")
If Not IsNothing(eleElement) Then
If sXmlDef.Contains(eleElement.OuterXml) Then
Continue For
End If
End If
End If
If Not String.IsNullOrEmpty(st.sGetRequestVar("rdReportAuthorViewMode")) _
AndAlso (st.sGetRequestVar("rdRefreshAddPanelsList") = "True" AndAlso st.sGetRequestVar("rdRefreshDashboard") = "True" _
OrElse st.sGetRequestVar("rdRefreshElementID") = "dtAnalysisGrid" _
OrElse st.sGetRequestVar("rdRefreshElementID").Contains("Crosstab")) Then
eleElement = xmlDef.DocumentElement.SelectSingleNode(".//Body")
End If
If IsNothing(eleElement) Then
If st.sGetRequestVar("rdDataTablePaging") = "True" Then
'There is a good chance we didn't find the element because it was created using the AG template, so we will look in the cached def
Call subFindTableForSuperElementAjaxPaging(sElementID, eleElement)
ElseIf st.sGetRequestVar("rdResizeRequest") = "True" AndAlso Not String.IsNullOrEmpty(st.sGetRequestVar("rdReportAuthorViewMode")) Then
'it is ReportAuthor -> chart resizer
eleElement = xmlDef.DocumentElement.SelectSingleNode(".//Body")
End If
End If
If IsNothing(eleElement) AndAlso sElementID.StartsWith("axTable_") Then
Dim sAnalysisCrosstabElementId As String = sElementID.Replace("axTable_", "")
eleElement = xmlDef.DocumentElement.SelectSingleNode(String.Format(".//AnalysisCrosstab[@ID='{0}']", sAnalysisCrosstabElementId))
End If
If Not IsNothing(eleElement) Then
Select Case eleElement.Name
Case "Panel"
Static bDashboardAdded As Boolean = False '13324
If Not bDashboardAdded Then
bDashboardAdded = True
eleElement = eleElement.ParentNode 'We need the parent Dashboard2 element.
'19625 19773
Dim nlDashboardPanels As XmlNodeList = eleElement.SelectNodes("Panel")
For Each elePanel As XmlElement In nlDashboardPanels
If elePanel.GetAttribute("ID") <> sElementID Then
eleElement.RemoveChild(elePanel)
End If
Next
End If
Case "Chart" '18395 Defect - InputChart.Range: js error when refreshing the chart
If Not IsNothing(eleElement.ParentNode) AndAlso eleElement.ParentNode.Name = "InputChart" Then
eleElement = eleElement.ParentNode
End If
'Case Else
'Dim eleIncludeScripts As XmlNodeList = eleElement.SelectNodes(".//IncludeScript") '#18808. 19450 19991
'If Not IsNothing(eleIncludeScripts) Then
'For i As Integer = 0 To eleIncludeScripts.Count - 1
'Dim eleIncludeScript As XmlElement = eleIncludeScripts(i)
'If IsNothing(eleIncludeScript.SelectNodes(".//JsonData")) Then '19450
'eleIncludeScript.ParentNode.RemoveChild(eleIncludeScript)
'End If
'Next
'End If
Case "Series"
CType(eleElement.ParentNode, XmlElement).SetAttribute("rdSeriesUpdate", "True")
CType(eleElement.ParentNode, XmlElement).SetAttribute("rdSeriesIDs", st.sGetRequestVar("rdRefreshElementID"))
Dim chartId As String = CType(eleElement.ParentNode, XmlElement).GetAttribute("ID")
idsToDelete.Add(CType(eleElement, XmlElement).GetAttribute("ID"))
If Not idsToAdd.Contains(chartId) Then
'TODO remove it
eleElement = eleElement.ParentNode
idsToAdd.Add(chartId)
sElementID = chartId
Else
Continue For
End If
Case "GoogleMap"
If Not idsToSkip.Contains(eleElement.GetAttribute("ID")) Then
idsToSkip.Add(eleElement.GetAttribute("ID"))
End If
Case "GoogleMapMarkers"
If Not (idsToSkip.Contains(eleElement.ParentNode.Attributes("ID").Value)) Then
idsToSkip.Add(eleElement.ParentNode.Attributes("ID").Value)
eleElement = eleElement.ParentNode
End If
End Select
sXmlDef &= eleElement.OuterXml
Continue For
End If
End If
'INFOGO-336 - refresh timers and local tokens dont work in SSRM Design Report
If eleElement Is Nothing AndAlso _
st.sGetRequestVar("rdReportAuthorViewMode") <> "DesignEdit" AndAlso _
eleReportAuthor IsNot Nothing Then
Dim sSaveFile As String = st.sGetAttribute(eleReportAuthor, "SaveFile")
If sSaveFile.Length = 0 Then _
sSaveFile = http.Session("rdRaAutoBookmarkSaveFile")
If File.Exists(sSaveFile) Then
Dim eleRASaveFile As XmlDocument = New XmlDocument()
eleRASaveFile.Load(sSaveFile)
Dim eleLocalDatas As XmlNodeList = eleRASaveFile.SelectNodes("//LocalData")
For Each eleLocalData As XmlElement In eleLocalDatas
Call st.subGetLocalData9(eleLocalData, xmlSettings)
Next
If Not sXmlDef.Contains(" -1) Then
Dim sDashboardPanelElementId As String = sElementID.Substring(0, sElementID.LastIndexOf("_"))
eleElement = xmlDef.SelectSingleNode("//*[@ID='" & sDashboardPanelElementId & "']")
If Not IsNothing(eleElement) Then
If eleElement.Name <> "Panel" Then
'Get containing dashboard panel
Dim eleParentPanel As XmlElement = eleElement.SelectSingleNode("ancestor::Panel")
If eleElement.Name = "AnalysisFilter" Then
Continue For
End If
Dim eleAnalysisFilterWithoutSaveFile As XmlElement = eleParentPanel.SelectSingleNode(".//AnalysisFilter[not(@SaveFile)]")
If Not IsNothing(eleAnalysisFilterWithoutSaveFile) Then
'This applies to AnalysisFilters under Dashboards which inherit their SaveFile from the Dashboard.
eleAnalysisFilterWithoutSaveFile.SetAttribute("SaveFile", eleDashboard.GetAttribute("SaveFile"))
End If
'Create dashboard instance and call setmultiinstancepanelids method
Dim dashboardInstance As rdDashboard = New rdDashboard(Me, st, dbug)
dashboardInstance.subSetMultiInstancePanelIDs(eleParentPanel, sDashboardPanelElementGUID, Nothing) '19044
'Re-run Local DL for this panel - this is when content inside the panel is being refreshed wihout refreshing the entire panel itself. '19693
Dim nlLocal As XmlNodeList = eleParentPanel.SelectNodes(".//LocalData") ' Run all local dl's under this panel ... 21153
If nlLocal.Count <> 0 Then
For Each eleLocalTest As XmlElement In nlLocal
If Not IsNothing(eleElement.SelectSingleNode(".//DataLayer[@Type='Linked']")) Or Not IsNothing(eleElement.SelectSingleNode(".//@*[contains(.,'@Local.')]")) Then
Call st.subGetLocalData9(eleLocalTest, xmlSettings)
End If
Next
End If
'Charts inside single instance panels that have action element (refresh,toggle,legendfilter) get a Guid appended to them as well
'In initial load those items have an associated action the chart and force the guid to be appended, however on ajax refresh
'the action element may not always be here so we recheck to see if we need to add the Guid
If Not eleElement.GetAttribute("ID").Contains(sDashboardPanelElementGUID) Then
eleElement.SetAttribute("ID", eleElement.GetAttribute("ID") & "_" & sDashboardPanelElementGUID)
End If
If eleElement.Name = "Chart" Then
If IsNothing(eleElement.SelectSingleNode("Legend[@LegendFilter]")) Then '#19000.
eleElement.SetAttribute("Class", "dashboardChart")
End If
End If
Dim atr As XmlAttribute
Dim nlAttrs As XmlNodeList = eleElement.SelectNodes(".//@*[contains(., 'Request.')]")
For Each atr In nlAttrs
Dim tzr As New Tokenizer(atr.Value)
Dim tok As Tokenizer.Token
For Each tok In tzr.Tokens
If tok.Text.Contains("Request.") Then
If Not tok.Name.Contains(sDashboardPanelElementGUID) Then
atr.Value = atr.Value.Replace("Request." & tok.Name & "~", "Request." & tok.Name & "_" & sDashboardPanelElementGUID & "~")
End If
End If
Next
Next
sXmlDef &= eleElement.OuterXml
End If
End If
End If
End If
Next
'update rdRefreshElementIDs and save it
For Each id As String In idsToDelete
dicIds.Remove(id)
Next
For Each id As String In idsToAdd
dicIds.Add(id, id)
Next
Dim rdRefreshElementID As String = String.Empty
For Each key As String In dicIds.Keys
rdRefreshElementID += IIf(rdRefreshElementID.Length > 0, ",", "") + key
Next
st.SetRequestVar("rdRefreshElementID", rdRefreshElementID)
If st.sGetRequestVar("rdCtCompDrags") = "True" Then '#14164.
If Not String.IsNullOrEmpty(st.sGetRequestVar("rdAnalysisGridId")) Then
sXmlDef &= FixUpAnalysisGridForCrosstabComparison(st.sGetRequestVar("rdAnalysisGridId"), sElementID)
End If
'If Not String.IsNullOrEmpty(st.sGetRequestVar("bModifyCrosstabIdForDashboard")) Then '#16166.
' Dim sElementOriginalId As String = sElementID
' sElementID = sElementID.Replace(sElementID.Substring(sElementID.LastIndexOf("_")), "")
' eleElement = xmlDef.SelectSingleNode("//*[@ID='" & sElementID & "']")
' If Not IsNothing(eleElement) Then
' eleElement.SetAttribute("ID", sElementOriginalId)
' sXmlDef &= eleElement.OuterXml
' End If
'End If
End If
If st.sGetRequestVar("rdOgId").Length > 0 AndAlso st.sGetRequestVar("rdRefreshElementID").Contains("heatmapGrid") Then
If Not IsNothing(HttpContext.Current.Session("rdOgHeatmap")) AndAlso HttpContext.Current.Session("rdOgHeatmap").ToString().Length > 0 Then
sXmlDef &= HttpContext.Current.Session("rdOgHeatmap").ToString()
'Dim xmlAnalysisChart As New XmlDocument()
'xmlAnalysisChart.LoadXml(agDefinition)
End If
End If
'Default request parameters and other elements to keep.
'11153, added //StyleSheet[@Theme]
For Each eleElement In xmlDef.SelectNodes("//DefaultRequestParams|//PluginCall|//StyleSheet[@Theme]|//DefinitionModifierFile")
sXmlDef &= eleElement.OuterXml
Next
If Not String.IsNullOrEmpty(st.sGetRequestVar("rdReportAuthorViewMode")) Then '24990
For Each eleElement In xmlDef.SelectNodes("//IncludedHtmlFile|//StyleSheet")
sXmlDef &= eleElement.OuterXml
Next
End If
Dim xmlRefreshDef As New XmlDocument
xmlRefreshDef.LoadXml("" & sXmlDef & "")
'Load the root attributes from the Report element. #7370
For Each atrRoot As XmlAttribute In xmlDef.DocumentElement.Attributes
xmlRefreshDef.DocumentElement.SetAttribute(atrRoot.Name, atrRoot.Value)
Next
xmlDef = xmlRefreshDef
End If
'Block added to support the Ajax refresh for the Calendar element
If st.sGetRequestVar("rdAjaxCommand") = "CalendarRefreshElement" _
AndAlso st.sGetRequestVar("rdEmbeddedSubReport") <> "True" Then
Dim sElementIDs() As String = st.sGetRequestVar("rdCalendarRefreshElementID").Split(",")
If sElementIDs.Length = 0 Then
sHtmlOutput = ""
Exit Sub 'This is an error.
End If
'Requested elements.
Dim eleElement As XmlElement
Dim sXmlDef As String = ""
Dim sElementID As String
For Each sElementID In sElementIDs
Dim sDashboardGUID As String = String.Empty '# 10794
If sElementID.Contains("_rdInputDateElement") Or sElementID.Contains("_rdDatePickerElement") Or sElementID.Contains("_rdInputTimeElement") Then 'Added to handle the Ajax refresh issue for the Date Picker and InputDate.
sElementID = sElementID.Replace("_rdInputDateElement", "").Replace("_rdDatePickerElement", "").Replace("_rdInputTimeElement", "")
End If
If sElementID.Length <> 0 Then
sElementID = subFixUpDashboardManipulatedElementID(sElementID, sDashboardGUID)
End If
If sElementID.Length <> 0 Then
eleElement = xmlDef.SelectSingleNode("//*[@ID='" & sElementID & "']")
If Not String.IsNullOrEmpty(sDashboardGUID) And Not IsNothing(eleElement) Then eleElement.SetAttribute("DashBoardGUID", sDashboardGUID)
If Not IsNothing(eleElement) Then
If eleElement.Name = "InputDate" Or eleElement.Name = "InputTime" Then
eleElement.SetAttribute("AjaxRefresh", "True")
If String.IsNullOrEmpty(st.sGetAttribute(eleElement, "CalendarLinkType")) Then '#11797.
eleElement.SetAttribute("CalendarLinkType", "Image")
End If
End If
sXmlDef &= eleElement.OuterXml
ElseIf sElementID.StartsWith("datSchStartDate") _
Or sElementID.StartsWith("datSchEndDate") _
Or sElementID.StartsWith("selSchFirstRunTime") _
Or sElementID.StartsWith("selSchEndTime") Then ' Scheduler
Dim sSchedulerID As String = sElementID.Substring(sElementID.IndexOf("_") + 1)
Dim eleScheduler As XmlElement = xmlDef.SelectSingleNode("//*[@ID='" & sSchedulerID & "']")
sXmlDef &= FixUpDateTimeInputsForScheduler(sElementID, eleScheduler)
ElseIf sElementID.StartsWith("rdAfFilterStartDate") And Not sElementID.StartsWith("DpForInputDate_rdAfFilterStartDate") _
OrElse sElementID.StartsWith("rdAfFilterEndDate") And Not sElementID.StartsWith("DpForInputDate_rdAfFilterEndDate") _
OrElse sElementID.StartsWith("rdAfFilterStartTime") _
OrElse sElementID.StartsWith("rdAfFilterEndTime") Then
' AnalysisFilter
'Dim eleAnalysisFilter As XmlElement = xmlDef.SelectSingleNode("//AnalysisFilter")
'sXmlDef &= FixUpInputDateForAnalysisFilter(sElementID, eleAnalysisFilter)
Dim eleSuperElement As XmlElement = xmlDef.SelectSingleNode("//AnalysisFilter | //AnalysisGrid | //Dashboard2")
If sDashboardGUID.Length <> 0 Then
sElementID = sElementID & "_" & sDashboardGUID
End If
sXmlDef &= FixUpInputDateForAnalysisFilter(sElementID, eleSuperElement)
End If
End If
Next
'Default request parameters and other elements to keep.
For Each eleElement In xmlDef.SelectNodes("//DefaultRequestParams|//PluginCall|//StyleSheet[@Theme]|//DefinitionModifierFile") '#11850.
sXmlDef &= eleElement.OuterXml
Next
Dim xmlRefreshDef As New XmlDocument
xmlRefreshDef.LoadXml("" & sXmlDef & "")
'Load the root attributes from the Report element. #7370
For Each atrRoot As XmlAttribute In xmlDef.DocumentElement.Attributes
xmlRefreshDef.DocumentElement.SetAttribute(atrRoot.Name, atrRoot.Value)
Next
xmlDef = xmlRefreshDef
End If
'13405 DMFs require an Info license.
Dim eleDmf As XmlElement = xmlDef.SelectSingleNode("//DefinitionModifierFile")
If Not IsNothing(eleDmf) Then _
lgxLicense10.LicenseCheck(eleDmf)
'Do some preprocessing on the defintion file.
'Call st.subRemoveRemarks(xmlDef)
Call rdSecurity.subRemoveSecuredElements(xmlDef)
Call subSetReportShowModes(xmlDef)
Call subSetGlobalCss(xmlDef)
Call subInjectGlobalChartExport(xmlDef)
'eleDmf = xmlDef.SelectSingleNode("//DefinitionModifierFile")
'If Not IsNothing(eleDmf) Then _
Call rdUtility.ApplyDefinitionModifierFiles(st, dbug, xmlDef, xmlDef.DocumentElement)
' Stylesheet URL ? #9453. Call this only for exports to avoid creating multiple css files in rdDownload.
If Array.IndexOf("Excel,NativeExcel,Word,NativeWord,PDF".Split(","), st.sGetRequestVar("rdReportFormat")) <> -1 Then
Call subSetCssUrlToFile(xmlDef)
End If
'Call subInsertIncludes(xmlDef)
If IsNothing(HttpContext.Current.Items("rdIsWidgetRequest")) Then
Call subRemoveElementsFromExport(xmlDef.DocumentElement) '13916
Call subSortHeadersAndFooters(xmlDef)
End If
If http.Request("rdPrompt") = "True" Then
Dim prmPage As New rdPromptPage()
mbDontCacheXsl = prmPage.Build(xmlDef)
End If
http.Items("rdResolveFunctionGUIDs") = False
Dim htmlString As String = ""
Dim lang As String = st.sGetAttribute(xmlDef.DocumentElement, "ReportLanguage")
If Not String.IsNullOrEmpty(lang) Then
htmlString = String.Format("", lang)
End If
sbHtml.Append(htmlString & CrLf)
sbHead.Append("" & CrLf)
'23824
If IsNothing(HttpContext.Current.Items("rdIsWidgetRequest")) Then
subAddIncludedScript(rdUtility.IncludeMinifiedScripts("rdYui"))
subAddIncludedScript(rdUtility.IncludeMinifiedScripts("rdScript"))
subAddIncludedScript(rdUtility.IncludeMinifiedScripts("rdChartCanvas")) '23903
Else
needLocalization = True
subAddYUIInitializer("'rd-script-full', 'rd-chartcanvas-full'", "{};") 'stub for forcing loading of standard scripts into widget
End If
Call subAddJavaEventFunction("rdBodyLoad", "document.body.appendChild(YUI.Env.cssStampEl);")
'Look for sub reports for init
If xmlDef.SelectSingleNode("//IncludeFrame | //ThemeEditor") IsNot Nothing Then
subAddJavaEventFunction("domready", "LogiXML.SubReport.initSubReports(); LogiXML.Ajax.AjaxTarget().on('reinitialize', function(e) { LogiXML.SubReport.initSubReports(); });")
End If
'YUI initializers
'Look for a Dashboard for init
If xmlDef.SelectSingleNode("//Dashboard2") IsNot Nothing Then
subAddYUIInitializer("'dashboard'", "LogiXML.Dashboard.pageDashboard = new Y.LogiInfo.Dashboard();")
End If
'Look for an AnalysisGrid for init
If xmlDef.SelectSingleNode("//AnalysisGrid") IsNot Nothing Then
subAddYUIInitializer("'analysis-grid'", "LogiXML.AnalysisGrid = new Y.LogiInfo.AnalysisGrid();")
End If
'Look for InputSliders for init
If xmlDef.SelectSingleNode("//InputSlider") IsNot Nothing Then
subAddYUIInitializer("'inputslider'", "LogiXML.InputSlider.initialize();")
End If
'Look for HoverHighlighting for init (#18796)
If xmlDef.SelectSingleNode("//HoverHighlight | //AnalysisGrid | //AnalysisChart | //AnalysisCrosstab | //DimensionGrid | //OlapGrid | //Heatmap ") IsNot Nothing Then 'Heatmap added for old Heatmap conversion.
subAddYUIInitializer("'chartfx-highlight'", "Y.LogiXML.ChartFX.Highlight.initializeAll();")
End If
'Look for Input / Zoom charts for init
If xmlDef.SelectSingleNode("//InputChart | //ZoomChart") IsNot Nothing Then
subAddYUIInitializer("'inputchart', 'chartfx-selection'", "Y.LogiXML.Form.initializeInputCharts(); Y.LogiXML.ChartFX.Selection.initializeAll();")
End If
'Look for popup menus for init
If xmlDef.SelectSingleNode("//Action[@Type='Popup'] | //ReportCenterMenu") IsNot Nothing Then
subAddYUIInitializer("'popupmenu'", "LogiXML.PopupMenu.popupMenuManager = new Y.LogiXML.PopupMenu();")
End If
'Look for draggable columns for init
'If xmlDef.SelectSingleNode("//*[@DraggableColumns='True'] | //AnalysisGrid") IsNot Nothing Then
If xmlDef.SelectSingleNode("//DataTable[@DraggableColumns='True'] | //CrosstabTable[@DraggableColumns='True'] | //AnalysisGrid") IsNot Nothing Then
subAddYUIInitializer("'draggable-columns'", "LogiXML.DraggableColumns.initialize();")
End If
'Look for resizable columns for init
If xmlDef.SelectSingleNode("//DataTable[@ResizableColumns='True'] | //CrosstabTable[@ResizableColumns='True'] | //AnalysisGrid") IsNot Nothing Then
subAddYUIInitializer("'resizable-columns'", "LogiXML.ResizableColumns.initialize();")
End If
'Look for wait page for init
If xmlDef.SelectSingleNode("//WaitPage") IsNot Nothing Then
subAddYUIInitializer("'waitpanel'", "LogiXML.WaitPanel.pageWaitPanel = LogiXML.WaitPanel.pageWaitPanel || new Y.LogiXML.WaitPanel();")
End If
'Look for ChartCanvas for init
'21025, 21029 load the scripts for Analysis Chart, otherwise heatmap will bypass this process
If Not IsNothing(xmlDef.SelectSingleNode("//ChartCanvas")) _
OrElse Not IsNothing(xmlDef.SelectSingleNode("//AnalysisChart")) _
OrElse Not IsNothing(xmlDef.SelectSingleNode("//DimensionGrid")) _
OrElse Not IsNothing(xmlDef.SelectSingleNode("//OlapGrid")) Then
Call subIncludeAllStandardScript()
End If
If st.sGetRequestVar("rdSubReport") <> "True" AndAlso st.sGetRequestVar("rdDefInDataCache") <> "True" Then 'RD17469
CreateSessionTimeoutControl()
End If
setResponsiveVisibilityGeneral(xmlDef.DocumentElement)
'Responsive css
If Not IsNothing(xmlDef.DocumentElement.SelectSingleNode(".//ResponsiveRow|.//ResponsiveVisibility")) Then
If http.Request("rdReportFormat") = "PDF" Then
#If JAVA Then
Call subAddIncludedCss("rdGridSystemJavaPDF.css")
#Else
Call subAddIncludedCss("rdGridSystemPDF.css")
#End If
Else
Call subAddIncludedCss("rdGridSystem.css")
End If
End If
'26081 Defect - TE: Color picker issues.
subAddIncludedCss("rdPopup/rdPopupPanel.css")
Dim processedXSL As String = sProcessDefinitionElement(xmlDef.DocumentElement)
'21402 - Action.Refresh Element Element ID validation.
'The following code will search for the encoded flag of 'PROCESSACTIONAFTER%' and '%ENDOFELEMENTID' within the XSL transform string
'If found, the it will validate the ElementIDs for the Action.Refresh Element and will replace them if there are parent/child relationships between them.
'Will remove the child ID if relationship is established.
'Dim processAfterExpression As String = "PROCESSACTIONAFTER%(\w+,)*\w+%ENDOFELEMENTID"
'For Each processAfter As Match In Regex.Matches(processedXSL, processAfterExpression)
' Dim elementIDs As String = processAfter.Value.Split("%")(1)
' Dim refreshElementIds As New ArrayList(elementIDs.Split(","))
' Dim replacementElementIds As New ArrayList(elementIDs.Split(","))
' For Each refreshId As String In refreshElementIds
' Dim originalRefreshId As String = refreshId
' refreshId = refreshId.Trim()
' Dim refreshElement As XmlElement = xmlDef.DocumentElement.SelectSingleNode("//*[@ID='" + refreshId + "']")
' Dim isRemoved As Boolean = False
' Dim removeString As String = ""
' For Each returnElement As String In replacementElementIds
' returnElement = returnElement.Trim()
' If Not IsNothing(refreshElement) AndAlso Not IsNothing(refreshElement.SelectSingleNode("ancestor::*[@ID='" + returnElement + "']")) Then
' isRemoved = True
' removeString = originalRefreshId
' Exit For
' End If
' Next
' If isRemoved Then
' replacementElementIds.Remove(removeString)
' End If
' Next
' Dim sbReplacementIds As New StringBuilder '23082
' For i As Integer = 0 To replacementElementIds.Count - 1
' sbReplacementIds.Append(replacementElementIds(i) & ",")
' Next
' processedXSL = StringUtility.replaceFirst(processedXSL, processAfter.Value, sbReplacementIds.ToString(0, sbReplacementIds.Length - 1))
'Next
sbBody.Append(processedXSL)
'sbBody.Append(sProcessDefinitionElement(xmlDef.DocumentElement))
'Look for wait page for init
If xmlDef.SelectSingleNode("//WaitPage") IsNot Nothing Then
subAddYUIInitializer("'waitpanel'", "LogiXML.WaitPanel.pageWaitPanel = LogiXML.WaitPanel.pageWaitPanel || new Y.LogiXML.WaitPanel();")
End If
sbHead.Append("")
'Add META tags for mobile reports.
If Not IsNothing(http.Items("isMobileDef")) Then
'sbHead.Append("")
' user-scalable=no allows position=fixed to work on Android but not iOS, helpful for floating DIVs.
sbHead.Append("")
End If
http.Items.Remove("rdResolveFunctionGUIDs")
'Look for popup menus for init
'If xmlDef.SelectSingleNode("//Action[@Type='Popup'] ") IsNot Nothing Then
If Not IsNothing(http.Items("rdAddPopupMenuScript")) Then
subAddJavaEventFunction("domready", "Y.use('popupmenu', function(Y) { LogiXML.PopupMenu.popupMenuManager = new Y.LogiXML.PopupMenu(); LogiXML.PopupMenu.popupMenuManager.initializePopupMenus(); LogiXML.Ajax.AjaxTarget().on('reinitialize', function(e) { LogiXML.PopupMenu.popupMenuManager.initializePopupMenus(); });});")
End If
'23824
'If mbAddAjaxSupport Then
' subAddIncludedScript("rdAjax/rdAjax2.js")
' subAddIncludedScript("rdInputValidation.js")
'End If
If HttpContext.Current.Items("isMobileDef") = True Then 'Use this variable in client-side JavaScript to determine if the current report is mobile.
sbHtml.Append("")
End If
If Not IsNothing(xmlSettings.SelectSingleNode("//GlobalCSS[@ShowElementEffect='FadeIn']")) Then
sbHtml.Append("")
End If
sbHead.Insert(sbHead.ToString.IndexOf("") + 8, sGetIncludedCssLinks())
' 23910 The x-ua-compatible meta tag must come before all other elements that aren't meta or title.
Dim sIeCompatibility As String = "IE=edge"
Dim atrIeCompatibility As XmlAttribute = xmlSettings.SelectSingleNode("/Setting/General/@IeCompatibility")
If Not IsNothing(atrIeCompatibility) Then
sIeCompatibility = st.sReplaceTokens(atrIeCompatibility.Value)
End If
If sIeCompatibility <> "None" Then
sbHead.Insert(sbHead.ToString.IndexOf("") + 8, "")
End If
' Localizaton
'22809 - Changed path for localization file to use rdDownload in lieu of rdDataCache
Dim isWidgetRequest As Boolean = Not IsNothing(HttpContext.Current.Items("rdIsWidgetRequest"))
If needLocalization OrElse isWidgetRequest Then
Dim sessionID As String = HttpContext.Current.Session.SessionID
Dim localizationFileName As String = rdState.sGetPhysicalPath + System.IO.Path.DirectorySeparatorChar + "rdDownload" + System.IO.Path.DirectorySeparatorChar + "rdLocalizationInfo_" + sessionID + ".js"
If Not File.Exists(localizationFileName) Then
File.WriteAllText(localizationFileName, rdLocalization.GetLocalizationClientScript())
End If
subAddIncludedScript("../rdDownload/rdLocalizationInfo_" + sessionID + ".js")
End If
If Not String.IsNullOrEmpty(HttpContext.Current.Session("rdIsEmbeddedReport")) Then ' 24658
subAddIncludedScript("rdEmbedApi/rdEmbedded.js")
End If
sbHead.Append(vbCrLf & "")
'Included JavaScript comes from files and is the same for every request.
sbHead.Append(sGetIncludedJavaScript())
''Embedded JavaScript is included in the source XSL and can be different for every request.
If IsNothing(HttpContext.Current.Items("rdIsWidgetRequest")) Then
'This embedded JScript is not supported with Widgets.
'10807.
sbHead.Append(vbCrLf & "")
If msJScriptInputCookieStatements.Length <> 0 Then _
sbHead.Append(vbCrLf & "")
If msJScriptInputLocalStorageStatements.Length <> 0 Then _
sbHead.Append(vbCrLf & "")
End If
sbHead.Append(vbCrLf & "")
'Initialize all YUI objects
If msYUIInitialize.Length > 0 Then
sbHead.Append("")
End If
If msJavaEventFunctionDomReady.Length Then
sbHead.Append(vbCrLf & "")
End If
If Not IsNothing(sbHeadCustomHtml) AndAlso sbHeadCustomHtml.Length > 0 Then
sbHead.Append(sbHeadCustomHtml)
End If
sbHead.Append("" & CrLf)
sbHtml.Append(sbHead)
sbHtml.Append(sbBody)
sbHtml.Append("" & CrLf)
'sExtraXsl = "3" & vbCrLf
'rdXslExtension:GetTokenValue('@Request." & eleData.GetAttribute("ID") & "-PageNr')
'Get the stock XSL file.
sXsl = rdUtility.ReadFile(rdState.sGetPhysicalPath() & rdState.GetSlash() & "rdTemplate" & rdState.GetSlash() & "rdPage.xsl")
'Change the encoding for office documents.
If Array.IndexOf("Excel,Word".Split(","), st.sGetRequestVar("rdReportFormat")) <> -1 Then
sXsl = sXsl.Replace("method=""xml""", "method=""html""")
End If
'Insert the generated XSL.
'sXsl = sXsl.Replace("", sExtraXsl)
sXsl = sXsl.Replace("", sbHtml.ToString())
' ''Create session variables for all DataColumnSummary elements.
''sXsl = sXsl.Replace("", sGetSummaryDataXsl(xmlDef))
'XSL post-processing.
If Array.IndexOf("Excel,NativeExcel,Word,NativeWord,CSV,PDF,HtmlEmail".Split(","), st.sGetRequestVar("rdReportFormat")) <> -1 Then
If st.sGetRequestVar("rdKeepShowElements") <> "True" Then
If sXsl.Contains(DISPLAY_STYLE_NONE) Then
'Some elements are invisible.
'Excel and Word can't handle Style="display:none".
'Have to remove any elements with this.
Dim xmlHtml As New XmlDocument()
xmlHtml.LoadXml(sXsl)
Dim sXPath As String = "//*[contains(@style,'display:none')]"
Dim eleInvisible As XmlElement = xmlHtml.SelectSingleNode(sXPath)
' #10273 For AG, if the export excel button from the AG menu is clicked, ignore the "display:none" and export whole table.
Dim bIsExportAg As Boolean = False
If st.sGetRequestVar("rdExportTableID") = "dtAnalysisGrid" Then
bIsExportAg = True
End If
Do While Not IsNothing(eleInvisible)
If bIsExportAg Then
' # 10273 remove the "display:none" style from the AG table, to enable export !
Dim eleTestParent As XmlNode = eleInvisible.ParentNode
If st.sGetAttribute(eleTestParent, "id") = "rowsTable" Or st.sGetAttribute(eleTestParent, "id") = "rowContentTable" Then
eleInvisible.RemoveAttribute("style")
Else
eleInvisible.ParentNode.RemoveChild(eleInvisible)
End If
eleInvisible = xmlHtml.SelectSingleNode(sXPath)
Else ' Normal execution.
eleInvisible.ParentNode.RemoveChild(eleInvisible)
eleInvisible = xmlHtml.SelectSingleNode(sXPath)
End If
Loop
sXsl = xmlHtml.DocumentElement.OuterXml
End If
End If
End If
dbug.AddDebugMessage("Show XSL", "XSL Data", "View XSL", sXsl)
'Load up the modified XSL file into a Transform object.
Dim sr As New System.IO.StringReader(sXsl)
Dim xtr As New Xml.XmlTextReader(sr)
dbug.AddDebugMessage("Load XSL", "Success", "True")
'Create the transformation object
tra = New System.Xml.Xsl.XslTransform()
tra.Load(xtr)
mbPageHasSorting = (sXsl.IndexOf("rdSort=") <> -1)
If Not mbDontCacheXsl Then
'Don't cache Prompt requests.
'Also can't cache definitions that contain a Chart, they read @Request and @Local variables.
'Can't cache dashboards because the Panels may be adjusted according to user cookie values.
If IsNothing(xmlDef.DocumentElement.SelectSingleNode("//*/AnalysisGrid")) Then
If IsNothing(xmlDef.DocumentElement.SelectSingleNode("//*[Schedule or AnalysisChart or AnalysisCrosstab or InteractiveDataView or Chart or Gauge or ColorSpectrumLegend or AnimatedChart or AnimatedGauge or AnimatedMap or Dashboard or Dashboard2 or AutoColumns or TrellisChart or Tabs or DataLayerPluginCall or @FromOlapTable='True' or DataCalendar]")) Then
If xmlDef.DocumentElement.GetAttribute("ID") <> "rdMobileDetect" Then '14413
'Keep definition in application scope
http.Application(msRequestedPage & sUniqueRequestInfo & "-rdDef") = st.sGetDefinition(msRequestedPage)
http.Application(msRequestedPage & sUniqueRequestInfo & "-tra") = tra
http.Application(msRequestedPage & sUniqueRequestInfo & "-Xsl") = sXsl
http.Application(msRequestedPage & sUniqueRequestInfo & "-xmlDef") = xmlDef
http.Application(msRequestedPage & sUniqueRequestInfo & "-bUsesSort") = mbPageHasSorting
End If
End If
Else 'Fix #3687
'Keep definition in session scope
http.Session(msRequestedPage & sUniqueRequestInfo & "-rdDef") = st.sGetDefinition(msRequestedPage)
'http.Session(msRequestedPage & sUniqueRequestInfo & "-tra") = tra 'tra can't be serialized
http.Session(msRequestedPage & sUniqueRequestInfo & "-Xsl") = sXsl
http.Session(msRequestedPage & sUniqueRequestInfo & "-xmlDef") = xmlDef.OuterXml 'xmlDef can't be serialized, but OuterXML can.
http.Session(msRequestedPage & sUniqueRequestInfo & "-bUsesSort") = mbPageHasSorting
http.Application(msRequestedPage & sUniqueRequestInfo & "-tra") = Nothing '#5468
End If
End If
End If
'Get the data.
dbug.AddDebugMessage("Get XML DataLayers")
'Dim sDataCacheKey As String = ""
Dim xmlData As XmlDocument = Nothing
'These are used with rdDb9
Dim streamData As Stream = Nothing
Dim xmlDataLayersInfo As XmlDocument = Nothing
Dim bDataModified As Boolean = False
Dim _bDontResolveTokensInData As Boolean = bDontResolveTokensInData(xmlDef)
Dim bUseCachedDataLayers As Boolean = False
'19042 - reloading from source causes the table to lose the sort information.
'If st.sGetRequestVar("rdLinkDataLayers").Length = 0 Then
Dim sCacheKey As String = http.Request("rdDataCache")
If Not String.IsNullOrEmpty(sCacheKey) Then
http.Items("rdPagingCacheKey") = sCacheKey
End If
bUseCachedDataLayers = st.bGetCachedDataSet9(streamData, xmlDataLayersInfo, sCacheKey, xmlSettings)
'End If
If Not bUseCachedDataLayers Then
If st.sGetRequestVar("rdReportFormat") = "DataLayerSchema" Then
Dim nl As XmlNodeList = xmlDef.DocumentElement.SelectNodes("//DataLayer")
If Not IsNothing(nl) Then
For Each xE As XmlElement In nl
xE.SetAttribute("GenerateSchema", "True")
xE.SetAttribute("MaxRows", 0)
Next
End If
ElseIf st.sGetRequestVar("rdReportFormat") = "DataLayerXml" Then '#20375.
For Each eleActiveSqlDataLayer As XmlElement In xmlDef.DocumentElement.SelectNodes(".//DataLayer[@Type='ActiveSQL']")
'Set up to return all rows.
eleActiveSqlDataLayer.RemoveAttribute("FirstRow")
eleActiveSqlDataLayer.RemoveAttribute("RowCount")
Next
End If
If String.IsNullOrEmpty(sCacheKey) Then
Call subDataSort9(xmlDef, streamData, bDataModified) '#20086.
End If
Dim bMultiThreadXslDataLayers As Boolean = HttpContext.Current.Application.Get("rdConstant-rdMultiThreadXslDataLayers") <> "False"
streamData = _db9.xmlGetData(xmlDef.DocumentElement, , bMultiThreadXslDataLayers)
If st.sGetRequestVar("rdReportFormat") = "DataLayerSchema" Then xSchemaDoc = _db9.DataLayerSchema
xmlDataLayersInfo = New XmlDocument : xmlDataLayersInfo.LoadXml(_db9.rdDataLayersInfoXml.OuterXml)
If dbug.DebuggingEnabled Then 'This is expensive, so check first.
If streamData.GetType.Name = "MemoryStream" Then
dbug.AddDebugMessage("Generated DataLayers", "Memory stream", "View Data", streamData, , True)
dbug.AddDebugMessage(, "DataLayer Summary XML", "View Data", xmlDataLayersInfo, , True)
Else
dbug.AddDebugMessage("Generated DataLayers", "File stream", "View Data", "file:" & CType(streamData, FileStream).Name, , True)
dbug.AddDebugMessage(, "DataLayer Summary XML", "View Data", xmlDataLayersInfo, , True)
End If
End If
'14253 Call Plugins from more places - FinishData
Dim plugin As rdPlugin = New rdPlugin(dbug)
plugin.CallPlugin_FinishData(xmlDef, streamData)
If _bDontResolveTokensInData Then
'Version9
'Issue 11210 - remove rdDb from build.
_db9.XmlReplace(streamData, "@", "rdDontReplaceAt")
xmlData = New XmlDocument()
If (Not streamData.CanRead) AndAlso (streamData.GetType.Name = "FileStream") Then
streamData = New FileStream(CType(streamData, FileStream).Name, FileMode.Open, FileAccess.Read)
ElseIf (streamData.CanRead) Then
streamData.Position = 0
End If
xmlData.Load(streamData)
End If
Call subAnalysisGridFormatActiveSqlError() 'If there was an error in a DataLayer.ActiveSql query, fixup the message that's in a session variable.
''Cache the data?
'If (sGetPagingMethod() <> "Printable") _
' And (sGetPagingMethod() = "Interactive" _
' Or mbPageHasSorting _
' Or bPassesLinkDataLayers(xmlDef)) _
' Or sXsl.IndexOf("rdInsertDataCacheKeyHere") <> -1 Then
' http.Items("rdPagingCacheKey") = st.sCacheDataset9(streamData, xmlDataLayersInfo, xmlSettings)
'End If
Else
' Else the data is cached, so we need to get the data cache key.
dbug.AddDebugMessage(, "Using cached data.")
End If
If (st.sGetRequestVar("rdReportFormat") = "DataLayerSchema") AndAlso (Not IsNothing(xSchemaDoc)) Then
http.Response.ContentType = "text/xml"
sHtmlOutput = xSchemaDoc.OuterXml
'15849 - Schema only requests leave the data file open and on the drive.
If (streamData IsNot Nothing) Then
If streamData.CanRead Then streamData.Close()
If streamData.GetType.Name = "FileStream" Then File.Delete(CType(streamData, FileStream).Name)
End If
Exit Sub
ElseIf st.sGetRequestVar("rdReportFormat") = "DataLayerXml" Then
Dim sResponseContentType As String = "text/xml"
Dim xmlTransformDef As XmlDocument = Nothing
If st.sGetRequestVar("rdDataLayerXsl").Length <> 0 Then
xmlTransformDef = New XmlDocument()
'Issue 14602 - Xsl Paramters are being ignored.
xmlTransformDef.LoadXml("")
Dim xNode As XmlNode = xmlDef.SelectSingleNode("//*[@XSLFile='" & st.sGetRequestVar("rdDataLayerXsl") & "']")
If IsNothing(xNode) Then Throw New Exception("XSLFile information was not found.")
xmlTransformDef.DocumentElement.InnerXml = xNode.OuterXml
'xmlTransformDef.LoadXml("")
'Does the transform emit an HTML file?
Try
If System.IO.File.ReadAllText(st.sGetRequestVar("rdDataLayerXsl")).ToUpper.IndexOf(" -1 Then
sResponseContentType = "text/html"
End If
Catch : End Try
End If
'Version 9 rdDb
If st.sGetRequestVar("rdDataLayerXsl").Length <> 0 Then
'Issue 11210 - remove rdDb from build.
_db9.subApplyXslTransform(xmlTransformDef.DocumentElement, streamData, "xslt", dbug)
End If
'http.Response.Writefile(streamData..) Write the stream.
'Does the transform emit an HTML file?
Dim htmlStreamSearch As New rdServerHtmlStreamer(streamData, st.DataCacheLocation)
If htmlStreamSearch.IndexOf(" -1 OrElse htmlStreamSearch.IndexOf(" -1 Then
sResponseContentType = "text/html"
End If
'Take care of the final output.
sHtmlOutput = ""
Me.srHtmlOutputReader = New StreamReader(streamData)
http.Response.ContentType = sResponseContentType
Exit Sub
End If
If st.sGetRequestVar("rdReportFormat") = "PdfFormFields" Then
Dim t As New rdTemplate()
xmlData = t.subGetPdfFormFields()
http.Response.ContentType = "text/xml"
sHtmlOutput = xmlData.OuterXml
Exit Sub
End If
If st.sGetRequestVar("rdReportFormat") = "WordFormFields" Then
Dim t As New rdTemplate()
xmlData = t.subGetWordFormFields()
http.Response.ContentType = "text/xml"
sHtmlOutput = xmlData.OuterXml
Exit Sub
End If
Dim xmlCrosstabsData As XmlDocument = Nothing
Dim lstCrosstabIDs As List(Of String) = Nothing
Dim colCrosstabColumnSeqs As Collection = Nothing
If sXsl.Contains("rdCrosstab=""True""") Then
' 'The XML for a crosstab won't be very big. It can fit into the XML document.
'Dim sModifiedCrosstabDataID As String = Nothing 'If DraggableColumns changed the column order, this will get the CrosstabTable ID.
lstCrosstabIDs = New List(Of String)
Call subCopyCrosstabsToDocument(streamData, xmlCrosstabsData, lstCrosstabIDs)
Call subInsertCrosstabsColumns(xmlCrosstabsData, sXsl) 'Insert Crosstab columns into sXsl.
'Reload the modified xsl into a Transform object.
dbug.AddDebugMessage("Show Crosstab-Modified XSL", "XSL Data", "View Crosstab XSL", sXsl.Replace(" xmlns:", vbCrLf & " xmlns:")) '#7211 For some reason the browser won't show this without the CRLF.
Dim sr As New System.IO.StringReader(sXsl)
Dim xtr As New Xml.XmlTextReader(sr)
dbug.AddDebugMessage("Load XSL", "Success", "True")
tra = New System.Xml.Xsl.XslTransform()
tra.Load(xtr)
End If
If sXsl.Contains("rdDraggableColumnsID") Then
Call subReorderDraggableColumns(sXsl, colCrosstabColumnSeqs) 'Reorder columns in the sXsl.
'Reload the modified xsl into a Transform object.
dbug.AddDebugMessage("Show DraggableColumns-Modified XSL", "XSL Data", "View DraggableColumns XSL", sXsl.Replace(" xmlns:", vbCrLf & " xmlns:")) '#7211 For some reason the browser won't show this without the CRLF.
Dim sr As New System.IO.StringReader(sXsl)
Dim xtr As New Xml.XmlTextReader(sr)
dbug.AddDebugMessage("Load XSL", "Success", "True")
tra = New System.Xml.Xsl.XslTransform()
tra.Load(xtr)
End If
If sXsl.Contains("rdResizableColumnsID") Then
Call subResizeResizableColumns(sXsl, colCrosstabColumnSeqs) 'Resize columns in the sXsl.
'Reload the modified xsl into a Transform object.
dbug.AddDebugMessage("Show ResizableColumns-Modified XSL", "XSL Data", "View ResizableColumns XSL", sXsl.Replace(" xmlns:", vbCrLf & " xmlns:")) '#7211 For some reason the browser won't show this without the CRLF.
Dim sr As New System.IO.StringReader(sXsl)
Dim xtr As New Xml.XmlTextReader(sr)
dbug.AddDebugMessage("Load XSL", "Success", "True")
tra = New System.Xml.Xsl.XslTransform()
tra.Load(xtr)
End If
If Not IsNothing(xmlCrosstabsData) Then
If sXsl.Contains("rdCtCompReportID") Then
'This is for CrosstabComparisons. It adds the data columns and values necessary for arrows and colors and such.
If Not bUseCachedDataLayers _
OrElse st.sGetRequestVar("rdCtCompDrags") = "True" _
OrElse st.sGetRequestVar("rdReportFormat").Length <> 0 Then
'Don't do this for cached data unless we are actually reordering columns.
'This is run the first time the Crosstab data is getting loaded, and later if the column order has changed by dragging columns.
'18394: We check for an export because DataLayer cache ID may be old in the export link when there have been crosstab drag-drop ajax requests.
For Each sCrosstabID As String In lstCrosstabIDs
'Dim eleCosstabFilter As XmlElement = xmlDef.SelectSingleNode("//CrosstabTable[@ID='" & sCrosstabID & "']//DataLayer/CrosstabFilter")
Dim eleCosstabTable As XmlElement = xmlDef.SelectSingleNode("//CrosstabTable[@ID='" & sCrosstabID & "']")
Dim lstDraggedColSeq As List(Of Integer) = Nothing
If Not IsNothing(colCrosstabColumnSeqs) AndAlso colCrosstabColumnSeqs.Contains(sCrosstabID) Then _
lstDraggedColSeq = colCrosstabColumnSeqs(sCrosstabID)
Dim db As New rdDb9(Nothing, Nothing)
Call db.subCalcCrosstabComparisonValues(st, sCrosstabID, eleCosstabTable, xmlCrosstabsData, lstDraggedColSeq)
bDataModified = True
Next
dbug.AddDebugMessage(, "CrosstabComparison Data", "View Data", xmlCrosstabsData)
streamData = subReplaceCrosstabsIntoStream(streamData, xmlCrosstabsData, lstCrosstabIDs)
End If
End If
End If
xmlCrosstabsData = Nothing
Call subSetupTablePagingValues9(xmlDef.SelectNodes("//*/DataLayer"), xmlDataLayersInfo)
Call subDataSort9(xmlDef, streamData, bDataModified)
Dim db9 As New rdDb9(xmlSettings, dbug)
db9.subDataFindDuplicates(xmlDef, streamData, st, bDataModified, bExportReport())
db9.subDataFindGroupHeaderRows(xmlDef, streamData, st, bDataModified, bExportReport())
db9.subDataFindGroupSummaryRows(xmlDef, streamData, st, bDataModified, bExportReport())
'If bDataModified Then
' If Not http.Request("rdEmbeddedSubReport") = "True" Then '#10059
' Call st.sCacheDataset9(streamData, xmlDataLayersInfo, xmlSettings, http.Items("rdPagingCacheKey")) 'This is a re-cache.
' End If
'End If
'Cache the data?
If Not bUseCachedDataLayers OrElse bDataModified Then
If (sGetPagingMethod() <> "Printable") _
And (sGetPagingMethod() = "Interactive" _
Or mbPageHasSorting _
Or bPassesLinkDataLayers(xmlDef)) _
Or sXsl.IndexOf("rdInsertDataCacheKeyHere") <> -1 Then
http.Items("rdPagingCacheKey") = st.sCacheDataset9(streamData, xmlDataLayersInfo, xmlSettings, st.sGetRequestVar("rdDataCache"))
'Issue 16072 - closed stream.
If streamData.GetType.Name.Equals("FileStream") AndAlso (Not streamData.CanRead) Then
streamData = New FileStream(CType(streamData, FileStream).Name, FileMode.Open, FileAccess.Read)
End If
End If
End If
If bExportReport() Then
If Not IsNothing(HttpContext.Current.Items("rdActiveSqlExport")) Then '#18412
Dim paging As New rdDataPaging9
streamData = paging.RemoveOffPageRows(dbug, streamData, xmlDef, msRequestedPage, xmlSettings, bUseCachedDataLayers)
End If
Else
'Get XML for just the rows of the current page.
If (xmlDef.SelectSingleNode("//InteractivePaging[not(@Remove='True')] | //AppendPaging") IsNot Nothing) _
OrElse (Not IsNothing(HttpContext.Current.Items("rdActiveSqlDl")) AndAlso Not IsNothing(http.Request("rdSort"))) _
Then
Dim bGotActiveSqlData As Boolean = False
' Look for and add AnalysisFilter content.RD20573
AddAnalysisFilterToPagedContent(xmlDef)
Dim paging As New rdDataPaging9
streamData = paging.RemoveOffPageRows(dbug, streamData, xmlDef, msRequestedPage, xmlSettings, bUseCachedDataLayers, bGotActiveSqlData, xmlDataLayersInfo)
If bGotActiveSqlData Then
'Need to reset the paging values.
Call subSetupTablePagingValues9(xmlDef.SelectNodes("//*/DataLayer"), xmlDataLayersInfo)
End If
End If
End If
'Add the LogiXML XSL extension object.
Dim xslArg As New Xsl.XsltArgumentList()
Dim rdX As New rdXslExtension()
xslArg.AddExtensionObject("urn:rdXslExtension", rdX)
dbug.AddDebugMessage("XSL Transformation", "Start")
'Apply the data to the XSL, creating the output.
Dim sWorkingFilename As String = Nothing
Dim memstream As MemoryStream = Nothing
Dim xw As XmlTextWriter
If streamData.Length < http.Application("rdMemoryStreamLimitBytes") / 10 Then
'Transform to a memory stream.
memstream = New MemoryStream(sXsl.Length * 10) 'This is just the initial size.
xw = New XmlTextWriter(memstream, Nothing)
Else
'Transform to a file stream.
sWorkingFilename = rdState.GetNewDataCacheFilename("xml")
xw = New XmlTextWriter(sWorkingFilename, Nothing)
End If
'/* Adding doctype, by first confirming that this is not an export loop (11158), for PDF too(11180). 15303
If Not Array.IndexOf("Excel,NativeExcel,GoogleSpreadsheet,Word,NativeWord,CSV,PDF,HtmlEmail".Split(","), st.sGetRequestVar("rdReportFormat")) <> -1 _
AndAlso Not isAjaxRequest _
AndAlso Not st.sGetRequestVar("rdNoDoctype") = "True" _
AndAlso IsNothing(HttpContext.Current.Items("rdIsWidgetRequest")) Then
'10032.
'Build something like this:
Dim sDoctypeDeclaration As String = HttpContext.Current.Application("rdDoctypeDeclaration")
Select Case sDoctypeDeclaration
Case "", "Html5"
xw.WriteDocType("HTML", Nothing, Nothing, Nothing)
Case "XhtmlTransitional"
xw.WriteDocType("html", "-//W3C//DTD XHTML 1.0 Transitional//EN", "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd", Nothing)
Case "XhtmlStrict"
xw.WriteDocType("html", "-//W3C//DTD XHTML 1.0 Strict//EN", "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd", Nothing)
Case "HtmlFrameset"
xw.WriteDocType("html", "-//W3C//DTD HTML 4.01 Frameset//EN", "http://www.w3.org/TR/html4/frameset.dtd", Nothing)
Case "HtmlTransitional"
xw.WriteDocType("html", "-//W3C//DTD HTML 4.01 Transitional//EN", "http://www.w3.org/TR/html4/loose.dtd", Nothing)
Case "HtmlStrict"
xw.WriteDocType("html", "-//W3C//DTD HTML 4.01//EN", "http://www.w3.org/TR/html4/strict.dtd", Nothing)
Case "None"
Exit Select
Case "XhtmlFrameset"
xw.WriteDocType("html", "-//W3C//DTD XHTML 1.0 Frameset//EN", "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd", Nothing)
Case Else '14328
If sDoctypeDeclaration.StartsWith(" 1 Then
xw.WriteRaw(sDoctypeDeclaration)
Else
Throw New Exception("Invalid DoctypeDeclaration attribute in the General element.")
End If
End Select
'xw.WriteDocType("HTML", "-//W3C//DTD HTML 4.01 Transitional//EN", "http://www.w3.org/TR/html4/loose.dtd", Nothing)
End If
Dim lStreamDataLength As Long = streamData.Length
streamData.Position = 0
Dim xPathDoc As New XPath.XPathDocument(streamData)
tra.Transform(xPathDoc, xslArg, xw)
dbug.AddDebugMessage(, "Finish")
'Dim rdHS As rdServerHtmlStreamer
If Not IsNothing(memstream) Then
xw.Flush()
rdHS = New rdServerHtmlStreamer(memstream, st.DataCacheLocation)
Else
xw.Flush() : xw.Close()
rdHS = New rdServerHtmlStreamer(sWorkingFilename, st.DataCacheLocation)
End If
rdHS.MemoryStreamLimit = http.Application("rdMemoryStreamLimitBytes")
Dim rdFixup As New rdHtmlFixup
rdFixup.dbug = dbug
rdFixup.st = st
rdFixup.hs = rdHS
rdFixup.streamData = streamData
rdFixup.streamDataLength = lStreamDataLength
rdFixup.bDontResolveTokensInData = _bDontResolveTokensInData
rdFixup.sXsl = sXsl
rdFixup.sDataCacheKey = http.Items("rdPagingCacheKey")
rdFixup.isAjaxRequest = isAjaxRequest
rdFixup.sPagingMethod = sGetPagingMethod()
rdFixup.xmlDefinition = xmlDef
Call rdFixup.FixupHtml()
' Moved this code after the html fix up code,replacing strings for IE too...13495
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(" 10000000 Then '10137
Dim rt As java.lang.Runtime = java.lang.Runtime.getRuntime()
rt.gc()
End If
#End If
'#If Not java Then
rdEventLogging.LogEvent("BuildReport", "Report", rdEventLogging.EventSequence.Ending, "ReportID=" & msRequestedPage)
'#End If
End Sub
'Private Function sGetCleanShowElementHistory(ByVal sShowElementHistory As String) As String()
' 'The use may show and hide the same elements. This function gets rid of these self-cancelling events.
' Dim aEvents() As String = sShowElementHistory.Split(",")
' Dim sEvent As String
' Dim nCancellingEvent As Integer
' Dim i As Integer
' For i = 0 To aEvents.Length - 1
' sEvent = aEvents(i)
' If sEvent.Length <> 0 Then
' If sEvent.IndexOf("=Show") <> -1 Then
' nCancellingEvent = Array.IndexOf(aEvents, sEvent.Replace("=Show", "=Hide"))
' If nCancellingEvent <> -1 Then
' 'Remove the two cancelling events.
' aEvents(nCancellingEvent) = String.Empty
' aEvents(i) = String.Empty
' End If
' End If
' End If
' Next
' Return aEvents
'End Function
Private Sub subCopyCrosstabsToDocument(ByRef streamData As Stream, ByRef xmlData As XmlDocument, ByRef lstCrosstabIDs As List(Of String))
'Create the xml document object.
xmlData = New XmlDocument
xmlData.LoadXml("")
Dim nlCrosstabTables As XmlNodeList = xmlDef.SelectNodes("//DataTable[@rdCrosstab='True']")
Dim eleCrosstabTable As XmlElement
For Each eleCrosstabTable In nlCrosstabTables
Dim sCrosstabTableID As String = eleCrosstabTable.GetAttribute("ID")
lstCrosstabIDs.Add(sCrosstabTableID)
'Read the stream, loading the document with the rows for the current DataLayer.
streamData.Position = 0
Dim xr As New XmlTextReader(streamData)
Do While xr.Read
If xr.NodeType = XmlNodeType.Element Then
If xr.Name = "rdData" Then
'Lood the root element's attributes. #7248
For i As Integer = 0 To xr.AttributeCount - 1
xr.MoveToAttribute(i)
xmlData.DocumentElement.SetAttribute(xr.Name, xr.Value)
Next
ElseIf xr.Name = sCrosstabTableID Then
'Load a row.
Dim eleRow As XmlElement = xmlData.DocumentElement.AppendChild(xmlData.CreateElement(sCrosstabTableID))
For i As Integer = 0 To xr.AttributeCount - 1
xr.MoveToAttribute(i)
eleRow.SetAttribute(xr.Name, xr.Value)
Next
End If
End If
Loop
Next 'CrosstabTable
End Sub
Private Function subReplaceCrosstabsIntoStream(ByRef streamData As Stream, ByRef xmlCrosstab As XmlDocument, ByRef lstCrosstabIDs As List(Of String)) As Stream
Dim streamResult As Stream = Nothing
Dim sOutputFilename As String = Nothing
Dim xws As New XmlWriterSettings()
xws.Indent = True
If (streamData.GetType.Name = "FileStream") Then
'File stream is closed, reopen.
If (Not streamData.CanRead) Then
streamData = New FileStream(CType(streamData, FileStream).Name, FileMode.Open, FileAccess.Read)
End If
streamData.Position = 0
'Set up the output stream.
sOutputFilename = st.DataCacheLocation() & Path.DirectorySeparatorChar & "CtDrag_" & Guid.NewGuid.ToString & ".xml"
streamResult = New FileStream(sOutputFilename, FileMode.Create, FileAccess.Write, FileShare.None)
xws.CloseOutput = True
Else
'Jump to start of memory/(or open)file stream.
streamData.Position = 0
streamResult = New MemoryStream()
xws.CloseOutput = False
End If
Dim xTempDoc As New XmlDocument()
Dim xCurrentNode As XmlNode
Dim xrs As New XmlReaderSettings()
xrs.CloseInput = True
Using xr As XmlReader = XmlReader.Create(streamData, xrs)
Using xw As XmlWriter = XmlWriter.Create(streamResult, xws)
'Copy all the existing elements - except those that match the sCrosstabID
While (Not xr.EOF)
If (xr.NodeType = XmlNodeType.Element) AndAlso (xr.Depth = 0) Then
'Write the root
xw.WriteStartElement(xr.Name)
xw.WriteAttributes(xr, True)
xr.Read()
ElseIf (xr.NodeType = XmlNodeType.Element) AndAlso (xr.Depth = 1) Then
xCurrentNode = xTempDoc.ReadNode(xr)
If Not lstCrosstabIDs.Contains(xCurrentNode.Name) Then
'write the node
xCurrentNode.WriteTo(xw)
End If
Else
xr.Read()
End If
End While
'Now add all the newly processed sCrosstabID elements.
Dim nl As XmlNodeList = xmlCrosstab.SelectNodes("rdData/*")
For Each xE As XmlElement In nl
xE.WriteTo(xw)
Next
xw.WriteEndElement()
xw.Close()
End Using
xr.Close()
End Using
'Memorystream will still be open, reposition to start.
If streamResult.CanSeek Then
streamResult.Position = 0
Else
'Reopen filestream for reading.
streamResult = New FileStream(sOutputFilename, FileMode.Open, FileAccess.Read, FileShare.Read)
End If
Return streamResult
End Function
Private Sub subInsertCrosstabsColumns(ByVal xmlCrosstabsData As XmlDocument, ByRef sXsl As String)
'There's one or more Crosstab tables. The definition the XSL needs to be updated, with
'the Crosstab columns added to the data table.
Dim xmlXsl As New XmlDocument() : xmlXsl.LoadXml(sXsl)
Dim nsmgr As XmlNamespaceManager = New XmlNamespaceManager(xmlXsl.NameTable)
nsmgr.AddNamespace("xsl", "http://www.w3.org/1999/XSL/Transform")
Dim nlCrosstabTables As XmlNodeList = xmlDef.SelectNodes("//DataTable[@rdCrosstab='True']")
Dim eleCrosstabTable As XmlElement
For Each eleCrosstabTable In nlCrosstabTables
'Get the Crosstab column template elements. The header and value rows.
'These will be duplicated for each Crosstab column, then removed.
'Also need to create summary rows for Crosstab columns, when they exist.
Dim eleXslFirstHeader As XmlElement = Nothing
Dim eleXslFirstValue As XmlElement = Nothing
Dim bCrosstabComparison As Boolean = Not IsNothing(eleCrosstabTable.SelectSingleNode("CrosstabComparison"))
'Get the first row.
Dim eleFirstDataRow As XmlElement = xmlCrosstabsData.SelectSingleNode("rdData/" & eleCrosstabTable.GetAttribute("ID") & "[@rdCrosstabValueColumnCount]")
If Not IsNothing(eleFirstDataRow) Then
Dim sPrevHeaderId As String = ""
Dim nColCnt As Integer = Val(eleFirstDataRow.GetAttribute("rdCrosstabValueColumnCount"))
For i As Integer = 0 To nColCnt - 1
'Process any HeaderRow and SummaryRow elements.
Call subProcessCrosstabHeaderAndSummaryRows(RowType.Header, eleCrosstabTable, xmlXsl, xmlCrosstabsData, eleFirstDataRow, i)
Call subProcessCrosstabHeaderAndSummaryRows(RowType.Summary, eleCrosstabTable, xmlXsl, xmlCrosstabsData, eleFirstDataRow, i)
Dim elePrevHeaderSummaryCol As XmlElement = Nothing
Dim elePrevSummarySummaryCol As XmlElement = Nothing
Dim eleValueCol As XmlElement
For Each eleValueCol In eleCrosstabTable.SelectNodes("CrosstabTableValueColumns")
Dim sId As String = eleValueCol.GetAttribute("ID")
Dim eleXslCrosstabHeader As XmlElement = xmlXsl.SelectSingleNode("//TABLE[@id='" & eleCrosstabTable.GetAttribute("ID") & "']//TH[@id='" & sId & "-TH' and @rdCrosstab='True']")
Dim eleXslCrosstabValue As XmlElement = xmlXsl.SelectSingleNode("//TABLE[@id='" & eleCrosstabTable.GetAttribute("ID") & "']//TD[@id='" & sId & "-TD' and @rdCrosstab='True']")
'Get elements that will be used for all the InsertBefore()'s. These are the first encountered for each table.
If IsNothing(eleXslFirstHeader) Then eleXslFirstHeader = eleXslCrosstabHeader
If IsNothing(eleXslFirstValue) Then eleXslFirstValue = eleXslCrosstabValue
If Not IsNothing(eleXslCrosstabHeader) Then 'eleXslCrosstabHeader IsNothing when the crosstab is hidden and is being exported.
eleXslCrosstabHeader.SetAttribute("rdCtColNr", i)
Dim atrColumn As XmlAttribute = eleFirstDataRow.Attributes("rdCrosstabColumn-" & i)
If IsNothing(atrColumn) Then _
Exit For
'Add a new Crosstab column header.
Dim eleNewHdr As XmlElement = eleXslCrosstabHeader.CloneNode(True)
Dim id As String = eleNewHdr.Attributes("id").Value
eleNewHdr.Attributes("id").Value = GetUniqueFormattedId(id)
Dim sHeadersAttr As String = eleXslCrosstabValue.GetAttribute("headers")
If Not sHeadersAttr = "" Then
eleXslCrosstabValue.SetAttribute("headers", sHeadersAttr.Replace(id, eleNewHdr.Attributes("id").Value))
If Not sPrevHeaderId = "" Then
eleXslCrosstabValue.SetAttribute("headers", eleXslCrosstabValue.GetAttribute("headers").Replace(sPrevHeaderId, eleNewHdr.Attributes("id").Value))
End If
End If
sPrevHeaderId = eleNewHdr.Attributes("id").Value
eleXslCrosstabHeader.ParentNode.InsertBefore(eleNewHdr, eleXslFirstHeader)
Dim sQuote As String = IIf(atrColumn.Value.IndexOf("'") = -1, "'", """") 'This will fail if the value has both double and single quotes.
Call rdUtility.ReplaceAttributeValues(eleNewHdr, "@rdCrosstabColumn", sQuote & atrColumn.Value & sQuote, True)
'There might be an rdCrosstabValue that needs to be replaced with a value from the data row.
Dim atrCrosstabValue As XmlAttribute
For Each atrCrosstabValue In eleNewHdr.SelectNodes(".//@*") 'Get all the attributes in the header XSL.
If atrCrosstabValue.Name = "select" Then
If atrCrosstabValue.Value.StartsWith("@rdCrosstabValue-") Then
Dim sHeaderValue As String = eleFirstDataRow.GetAttribute(atrCrosstabValue.Value.Replace("@rdCrosstabValue-", "rdCrosstabValue-" & i & "-"))
atrCrosstabValue.Value = sQuote & sHeaderValue & sQuote
End If
End If
Next
If i = 0 OrElse Not bCrosstabComparison Then
Call rdUtility.ReplaceAttributeValues(eleNewHdr, "rdCrosstabSort", "rdCrosstabValue-" & i, True)
Else 'For columns 1 thru x with CrosstabComparisons. Sort by the difference rather than the value. #14087
Call rdUtility.ReplaceAttributeValues(eleNewHdr, "rdCrosstabSort", "rdCrosstabDifferencePercent-" & i, True)
End If
eleNewHdr.RemoveAttribute("rdCrosstab") 'Prevent this from getting removed below.
'Add a new Crosstab column value.
Dim eleNewVal As XmlElement = eleXslCrosstabValue.CloneNode(True)
eleXslCrosstabValue.ParentNode.InsertBefore(eleNewVal, eleXslFirstValue)
Call rdUtility.ReplaceAttributeValues(eleNewVal, "rdCrosstabValue", "rdCrosstabValue-" & i, True)
Call rdUtility.ReplaceAttributeValues(eleNewVal, "rdCrosstabColumn", "rdCrosstabColumn-" & i, True)
Call rdUtility.ReplaceAttributeValues(eleNewVal, "rdCrosstabValCount", "rdCrosstabValCount-" & i, True)
Call rdUtility.ReplaceAttributeValues(eleNewVal, "rdCrosstabDifferenceValue", "rdCrosstabDifferenceValue-" & i, True)
Call rdUtility.ReplaceAttributeValues(eleNewVal, "rdCrosstabDifferencePercent", "rdCrosstabDifferencePercent-" & i, True)
Call rdUtility.ReplaceAttributeValues(eleNewVal, "rdCrosstabDifferenceColor", "rdCrosstabDifferenceColor-" & i, True)
Call rdUtility.ReplaceAttributeValues(eleNewVal, "rdCrosstabDifferenceTextColor", "rdCrosstabDifferenceTextColor-" & i, True)
'Call rdUtility.ReplaceAttributeValues(eleNewVal, "rdDebugGuid=", "rdDebugGuid=" & i & "-", True) '16114
If Not eleValueCol.GetAttribute("NoCtCol") = "True" Then
Call rdUtility.ReplaceAttributeValues(eleNewVal, "_Row'", "_CtCol" & i & "_Row'", True)
End If
eleNewVal.RemoveAttribute("rdCrosstab") 'Prevent this from getting removed below.
'If there's a HeaderRow with automatic columns, its Crosstab columns need to be created too.
Dim eleXslCrosstabSummaryCol As XmlElement = xmlXsl.SelectSingleNode("//TABLE[@id='" & eleCrosstabTable.GetAttribute("ID") & "']//TR/TH[@rdAutoColumns='True' and @rdSummaryColParentID='" & sId & "' and @rdCrosstab='True']")
If Not IsNothing(eleXslCrosstabSummaryCol) Then
If IsNothing(elePrevHeaderSummaryCol) Then _
elePrevHeaderSummaryCol = eleXslCrosstabSummaryCol 'Fix for 2646.
If String.IsNullOrEmpty(eleXslCrosstabSummaryCol.InnerXml) Then '11392 16386
eleXslCrosstabSummaryCol.InnerText = ""
End If
Dim eleNewSummaryCol As XmlElement = eleXslCrosstabSummaryCol.CloneNode(True)
eleXslCrosstabSummaryCol.ParentNode.InsertBefore(eleNewSummaryCol, elePrevHeaderSummaryCol)
eleNewSummaryCol.RemoveAttribute("rdCrosstab") 'Prevent this from getting removed below.
'Get the xsl element that displays the value.
Dim eleValue As XmlElement = Nothing
Try
eleValue = eleNewSummaryCol.SelectSingleNode(".//xsl:value-of", nsmgr) 'fixes issue 1073.
Catch : End Try
If Not IsNothing(eleValue) Then
eleValue.SetAttribute("select", eleValue.GetAttribute("select") & "-" & i)
End If
End If
'Warning: almost duplicate code here, except //TR/TH becomes //TR/TD
'If there's a SummaryRow with automatic columns, its Crosstab columns need to be created too.
eleXslCrosstabSummaryCol = xmlXsl.SelectSingleNode("//TABLE[@id='" & eleCrosstabTable.GetAttribute("ID") & "']//TR/TD[@rdAutoColumns='True' and @rdSummaryColParentID='" & sId & "' and @rdCrosstab='True']")
If Not IsNothing(eleXslCrosstabSummaryCol) Then
If IsNothing(elePrevSummarySummaryCol) Then _
elePrevSummarySummaryCol = eleXslCrosstabSummaryCol 'Fix for 2646.
If String.IsNullOrEmpty(eleXslCrosstabSummaryCol.InnerXml) Then '11392 16386
eleXslCrosstabSummaryCol.InnerText = ""
End If
Dim eleNewSummaryCol As XmlElement = eleXslCrosstabSummaryCol.CloneNode(True)
eleXslCrosstabSummaryCol.ParentNode.InsertBefore(eleNewSummaryCol, elePrevSummarySummaryCol)
eleNewSummaryCol.RemoveAttribute("rdCrosstab") 'Prevent this from getting removed below.
'Get the xsl element that displays the value.
Dim eleValue As XmlElement = Nothing
Try
eleValue = eleNewSummaryCol.SelectSingleNode(".//xsl:value-of", nsmgr) 'fixes issue 1073.
Catch : End Try
If Not IsNothing(eleValue) Then
eleValue.SetAttribute("select", eleValue.GetAttribute("select") & "-" & i)
End If
End If
End If
Next
Next
End If
Next
'Remove all the Crosstab template elements.
Dim eleXslCrosstabElement As XmlElement = xmlXsl.SelectSingleNode("//*[@rdCrosstab='True']")
Do Until IsNothing(eleXslCrosstabElement) 'Incident 6667
eleXslCrosstabElement.ParentNode.RemoveChild(eleXslCrosstabElement)
eleXslCrosstabElement = xmlXsl.SelectSingleNode("//*[@rdCrosstab='True']")
Loop
sXsl = xmlXsl.OuterXml
End Sub
'20587
Private Sub subFindTableForSuperElementAjaxPaging(ByVal sElementID As String, ByRef eleElement As XmlElement)
Dim eleDef As XmlElement = xmlDef.SelectSingleNode(".//AnalysisGrid")
'23000 - Report Author - Paging/Sorting Causes Ajax Error
'We need to set the eleElement to eleDef so the ReportAuthor is processed
If IsNothing(eleDef) Then
eleDef = xmlDef.SelectSingleNode(".//ReportAuthor")
If Not IsNothing(eleDef) Then
eleElement = eleDef
Return
End If
End If
'For AG paging, get the definition from session or file state, use that instead of rebuilding the AG.
If sElementID.StartsWith("axTable_") Then
'This is a crosstab under the AG.
Dim xmlDefDoc As New XmlDocument()
Dim sCrosstabID As String = sElementID.Replace("axTable_", "")
'24626 it can be dashboard, then session variable will be empty
If IsNothing(HttpContext.Current.Session("rdAxDef-" & sCrosstabID)) Then
Return
End If
xmlDefDoc.LoadXml(HttpContext.Current.Session("rdAxDef-" & sCrosstabID))
eleElement = xmlDefDoc.SelectSingleNode(".//CrosstabTable[@ID='" & sElementID & "']")
eleElement.SetAttribute("rdAnalysisGrid", "True") 'This attribute is looked up in Template modifier files to apply column header styles on paging, #21661, 21663.
Else
'AG main table paging.
If Not IsNothing(eleDef) Then
Dim xmlDefDoc As New XmlDocument()
xmlDefDoc.Load(HttpContext.Current.Session("rdAgDefFile-" & eleDef.GetAttribute("ID")))
eleElement = xmlDefDoc.SelectSingleNode(".//DataTable[@ID='" & sElementID & "']")
eleElement.SetAttribute("rdAnalysisGrid", "True") 'This attribute is looked up in Template modifier files to apply column header styles on paging, #21661, 21663.
End If
End If
End Sub
Private Sub subFixupCrosstabColumnSummaryDataTokens(ByRef eleXsl As XmlElement, ByVal xmlData As XmlDocument, ByVal nColumnNr As Integer)
Dim atrSelect As XmlAttribute
For Each atrSelect In eleXsl.SelectNodes("*//@select") 'Get all the select nodes. These were @Data tokens.
If atrSelect.Value.StartsWith("@") Then
Dim sSummaryAttrName As String = atrSelect.Value.Substring(1) & "-" & nColumnNr
If Not IsNothing(xmlData.DocumentElement.Attributes(sSummaryAttrName)) Then
'There is a column summary value for this @Data token. Change it so that it has the column number included.
atrSelect.Value = "@" & sSummaryAttrName
End If
End If
Next
End Sub
Private Function FixUpDateTimeInputsForScheduler(ByVal sElementId As String, ByVal eleScheduler As XmlElement) As String
' Function builds the scheduler definition and gets the InputDate definition.
Dim sch As New rdSchedule(Me, xmlSettings)
Dim eleSch As XmlElement = sch.BuildSchedule(eleScheduler)
Dim eleInputDate As XmlElement = eleSch.SelectSingleNode(".//InputDate[@ID='" & sElementId & "'] | .//InputTime[@ID='" & sElementId & "']")
eleInputDate.SetAttribute("AjaxRefresh", "True")
Return eleInputDate.OuterXml
End Function
Private Function FixUpInputDateForAnalysisFilter(ByVal sElementId As String, ByVal eleAnalysisFilter As XmlElement) As String
Dim sTemplateId As String = sElementId.Substring(0, sElementId.IndexOf("_")) & "_rdAfID"
' Function builds the AnalysisFilter definition and gets the InputDate definition.
Dim xmlAfTemplate As XmlDocument = rdUtility.GetSuperElementTemplate("rdAnalysisFilter/rdAfTemplate.lgx")
'Is there a template modifier?
Call rdUtility.ApplyTemplateModifier(st, dbug, eleAnalysisFilter, xmlAfTemplate.DocumentElement)
'Is there a theme or DefinitionModifierFile? Run them too.
Call rdUtility.ApplyDefinitionModifierFiles(st, dbug, eleAnalysisFilter.OwnerDocument, xmlAfTemplate.DocumentElement)
Dim eleInputDate As XmlElement = xmlAfTemplate.SelectSingleNode(".//InputDate[@ID='" & sTemplateId & "'] | .//InputTime[@ID='" & sTemplateId & "']")
eleInputDate.SetAttribute("AjaxRefresh", "True")
eleInputDate.SetAttribute("ID", sElementId)
Return eleInputDate.OuterXml
End Function
Private Function FixUpAnalysisGridForCrosstabComparison(ByVal sAGId As String, ByVal sCrosstabId As String) As String
If IsNothing(HttpContext.Current.Session("rdAgDefFile-" & sAGId)) Then '#19459.
Return String.Empty
End If
Dim xmlAGDef As New XmlDocument()
xmlAGDef.Load(HttpContext.Current.Session("rdAgDefFile-" & sAGId))
Dim eleCrosstabDef As XmlElement = xmlAGDef.SelectSingleNode("*//CrosstabTable[@ID='" & sCrosstabId & "']")
Return eleCrosstabDef.OuterXml
End Function
'This version keeps stuff on the AddPanel list that were in the Gallery, added to the dashboard, then removed from the gallery.
'But that's not necessary.
'Public Function FixUpDashboardDefWithCustomDashboardPanels(ByRef eleDef As XmlElement, sDashboardInstance As rdDashboard) As XmlElement
' If eleDef.GetAttribute("SaveFile").Length = 0 _
' AndAlso Not IsNothing(eleDef.SelectSingleNode("AutoBookmark")) Then _
' eleDef.SetAttribute("SaveFile", "@Session.rdDashboardAutoBookmarkSaveFile~")
' If Not eleDef.HasAttribute("SaveFile") Then _
' Throw New Exception("Dashboard elements must have a SaveFile.")
' Dim aFiles As New ArrayList()
' Dim sSaveFile As String = st.sGetAttribute(eleDef, "SaveFile")
' aFiles.Add(sSaveFile)
' If eleDef.HasAttribute("GalleryFile") Then
' aFiles.Add(st.sGetAttribute(eleDef, "GalleryFile"))
' End If
' For i As Integer = 0 To aFiles.Count - 1
' If aFiles(i).ToString.Length <> 0 Then
' If System.IO.File.Exists(aFiles(i)) Then
' Dim xmlSavedDashboard As New XmlDocument
' xmlSavedDashboard.Load(aFiles(i))
' 'INFOGO SECURITY
' Call rdSecurity.subRemoveSecuredElements(xmlSavedDashboard)
' sDashboardInstance.subAddCustomPanelsToDashboard(eleDef, xmlSavedDashboard)
' End If
' End If
' Next
' Return eleDef
'End Function
Public Function FixUpDashboardDefWithCustomDashboardPanels(ByRef eleDef As XmlElement, sDashboardInstance As rdDashboard) As XmlElement
If eleDef.GetAttribute("SaveFile").Length = 0 AndAlso Not IsNothing(eleDef.SelectSingleNode("AutoBookmark")) Then
eleDef.SetAttribute("SaveFileFromAutoBookmark", "True")
eleDef.SetAttribute("SaveFile", "@Session.rdDbAutoBookmarkSaveFile~")
End If
If Not eleDef.HasAttribute("SaveFile") Then _
Throw New Exception("Dashboard elements must have a SaveFile.")
Dim sFile As String
'If eleDef.HasAttribute("GalleryFile") Then
' sFile = st.sGetAttribute(eleDef, "GalleryFile")
'Else
sFile = st.sGetAttribute(eleDef, "SaveFile")
Dim eleAutoBookmark As XmlElement = eleDef.SelectSingleNode("AutoBookmark")
If st.sGetRequestVar("rdCommand") = "Undo" Then
st.SetRequestVar("rdCommand", "UndoRedoProcessed")
rdBookmark.Undo(sFile, eleAutoBookmark)
End If
If st.sGetRequestVar("rdCommand") = "Redo" Then
st.SetRequestVar("rdCommand", "UndoRedoProcessed")
rdBookmark.Redo(sFile, eleAutoBookmark)
End If
'End If
If System.IO.File.Exists(sFile) Then
Dim xmlSavedDashboard As New XmlDocument
xmlSavedDashboard.Load(sFile)
If st.sGetRequestVar("rdEditThinkspace") = "True" Then
If (UpdateEditedThinkspacePanel(xmlSavedDashboard.DocumentElement)) Then
xmlSavedDashboard.Save(sFile)
End If
End If
sDashboardInstance.subAddCustomPanelsToDashboard(eleDef, xmlSavedDashboard)
'INFOGO SECURITY
Call rdSecurity.subRemoveSecuredElements(xmlSavedDashboard)
End If
Return eleDef
End Function
Private Sub FixupDashboardContentForRefresh(ByRef eleDashboard As XmlElement)
Dim itemsToUpdate As XmlNodeList = eleDashboard.SelectNodes(".//ChartCanvas | .//Gauge[@Type='BalloonBar' or @Type='BulletBar' or @Type='Arc' or @Type='Angular'] | .//NgpVisualization")
For Each dashboardItem As XmlElement In itemsToUpdate
dashboardItem.SetAttribute("RemoveWidthAttribute", "True")
Next
'fix resizers in Dashboard after refresh
Dim eleResizers As XmlNodeList = eleDashboard.SelectNodes(".//ChartCanvas/Resizer | .//Gauge[@Type='BalloonBar' or @Type='BulletBar' or @Type='Arc' or @Type='Angular']/Resizer | .//NgpVisualization/Resizer")
For Each eleResizer As XmlElement In eleResizers
If Not IsNothing(eleResizer) Then
eleResizer.SetAttribute("HeightOnly", "True")
eleResizer.RemoveAttribute("MinWidth")
eleResizer.RemoveAttribute("MaxWidth")
Dim eleChart As XmlElement = eleResizer.ParentNode
eleChart.RemoveAttribute("ChartWidth") 'This will be 100% of the container.
End If
Next
End Sub
Private Function UpdateEditedThinkspacePanel(xmlSavedDashboard As XmlElement) As Boolean
Dim sOriginalPanelId As String = st.sGetRequestVar("rdDashPanelId")
Dim sPanelId As String = sOriginalPanelId.Substring(sOriginalPanelId.IndexOf("-") + 1, sOriginalPanelId.LastIndexOf("_") - sOriginalPanelId.IndexOf("-") - 1)
Dim sInstanceId As String = sOriginalPanelId.Substring(sOriginalPanelId.LastIndexOf("_") + 1, sOriginalPanelId.Length - sOriginalPanelId.LastIndexOf("_") - 1)
Dim elePanel As XmlElement = xmlSavedDashboard.SelectSingleNode(String.Format("//ExtraPanelDefinition/Panel[@ID='{0}' and @InstanceID='{1}']", sPanelId, sInstanceId)) 'For saved file
If IsNothing(elePanel) Then 'For current dashboard
elePanel = xmlSavedDashboard.SelectSingleNode(String.Format("//Panel[@ID='{0}' and @InstanceID='{1}']", sPanelId, sInstanceId))
End If
Dim sVisualizationConfig As String = st.sGetRequestVar("rdNgpDataVizConfig")
If IsNothing(elePanel) OrElse String.IsNullOrEmpty(sVisualizationConfig) Then
Return False
End If
Dim eleVisualization As XmlElement = elePanel.SelectSingleNode(".//NgpVisualization")
eleVisualization.SetAttribute("NgpVisualizaionConfig", sVisualizationConfig)
Dim eleThinkspace As XmlElement = eleVisualization.SelectSingleNode("Thinkspace")
Dim sTSFileName As String = HttpContext.Current.Session(String.Format("rdTsDefFile-{0}", eleThinkspace.GetAttribute("ID")))
Dim xDocSavedTS As XmlDocument = New XmlDocument()
xDocSavedTS.Load(sTSFileName)
Dim eleSavedDataLayer As XmlElement = xDocSavedTS.SelectSingleNode("//Thinkspace/DataLayer")
eleSavedDataLayer.ParentNode.RemoveChild(eleSavedDataLayer)
'may happen empty datalayer (replaced before in query builder)
If eleSavedDataLayer.GetAttribute("Type") = "EmptyDataLayer" Then
eleSavedDataLayer.SetAttribute("Type", eleSavedDataLayer.GetAttribute("OriginalType"))
End If
'update thinkspace
eleThinkspace.ParentNode.RemoveChild(eleThinkspace)
Dim eleImportedThinkspace As XmlElement = eleVisualization.OwnerDocument.ImportNode(xDocSavedTS.SelectSingleNode("//Thinkspace"), True)
Dim eleSavedQueryBuilder As XmlElement = eleImportedThinkspace.SelectSingleNode(".//SavedQueryBuilder")
If Not IsNothing(eleSavedQueryBuilder) Then
Dim eleSQBDL As XmlElement = eleSavedQueryBuilder.SelectSingleNode(".//DataLayer")
If Not IsNothing(eleSQBDL) Then
eleSQBDL.ParentNode.RemoveChild(eleSQBDL)
End If
End If
eleVisualization.AppendChild(eleImportedThinkspace)
eleImportedThinkspace.SetAttribute("ThinkspaceConfig", st.sGetRequestVar("rdThinkspaceConfig"))
'update datalayer
eleVisualization.RemoveChild(eleVisualization.SelectSingleNode("DataLayer"))
Dim eleImportedDataLayer As XmlElement = eleVisualization.OwnerDocument.ImportNode(eleSavedDataLayer, True)
Dim eleAnalysisFilterInsert As XmlElement = eleImportedDataLayer.SelectSingleNode(".//AnalysisFilterInsert")
If Not IsNothing(eleAnalysisFilterInsert) Then
eleAnalysisFilterInsert.ParentNode.RemoveChild(eleAnalysisFilterInsert)
End If
eleVisualization.AppendChild(eleImportedDataLayer)
eleVisualization.SetAttribute("NgpDataview", st.sGetRequestVar("rdNgpDataViewName"))
eleVisualization.SetAttribute("DataViewId", st.sGetRequestVar("rdDataViewId"))
Return True
End Function
Private Sub subResolveGaugeTokens(ByRef elePanel As XmlElement)
Dim eleGauge As XmlElement = elePanel.SelectSingleNode(".//Gauge")
Dim eleDefaultRequestParams As XmlElement = elePanel.SelectSingleNode(".//DefaultRequestParams")
For Each atrDefaultRequestParam As XmlAttribute In eleDefaultRequestParams.Attributes
Dim sAttribute As String = "@Request." & atrDefaultRequestParam.Name & "~"
Dim nlRequestAttrs As XmlNodeList = eleGauge.SelectNodes(".//@*[contains(., '" & sAttribute & "')]")
For Each atrRequest As XmlAttribute In nlRequestAttrs
If atrRequest.Value.Contains(sAttribute) Then
atrRequest.Value = atrRequest.Value.Replace(sAttribute, atrDefaultRequestParam.Value)
End If
Next
Next
End Sub
Private Function FixUpAddToDashboardAction(sActionID As String, eleDef As XmlElement) As XmlElement
Dim eleDummyLabel As XmlElement = eleDef.OwnerDocument.CreateElement("Label")
eleDummyLabel.SetAttribute("Caption", "Sample")
sActionID = sActionID.Substring(sActionID.IndexOf("_") + 1)
Dim eleActionDashboardPanel As XmlElement = eleDef.OwnerDocument.CreateElement("Action")
eleActionDashboardPanel.SetAttribute("Type", "AddDashboardPanel")
eleActionDashboardPanel.SetAttribute("AddPanelContentElementID", st.sGetRequestVar("rdPanelContentElementID"))
eleActionDashboardPanel.SetAttribute("DashboardSaveFile", st.sGetRequestVar("rdSaveFile"))
eleActionDashboardPanel.SetAttribute("ID", sActionID)
eleActionDashboardPanel.SetAttribute("AddPanelButtonCaption", st.sGetRequestVar("rdAddButtonCaption"))
eleActionDashboardPanel.SetAttribute("AddPanelContentHeight", st.sGetRequestVar("rdPanelContentHeight"))
eleActionDashboardPanel.SetAttribute("AddPanelTitle", st.sGetRequestVar("rdPanelTitle"))
eleActionDashboardPanel.SetAttribute("AddPanelDescription", st.sGetRequestVar("rdPanelDescription"))
eleActionDashboardPanel.SetAttribute("AddPanelParamsElementID", st.sGetRequestVar("rdPanelParamsElementID"))
eleActionDashboardPanel.SetAttribute("AddPanelPopupCaption", st.sGetRequestVar("rdPopupCaption"))
eleActionDashboardPanel.SetAttribute("AddPanelSecurityRightID", st.sGetRequestVar("rdPanelSecurityRightID"))
eleActionDashboardPanel.SetAttribute("AddPanelSkipElementIDs", st.sGetRequestVar("rdPanelSkipElementIDs"))
eleActionDashboardPanel.SetAttribute("Image", st.sGetRequestVar("rdPanelImage"))
eleActionDashboardPanel.SetAttribute("MultipleInstances", st.sGetRequestVar("rdMultipleInstances"))
eleActionDashboardPanel.SetAttribute("SecurityRightID", st.sGetRequestVar("rdSecurityRightID"))
eleActionDashboardPanel.SetAttribute("AgAddToDashboard", st.sGetRequestVar("rdAgAddToDashboard"))
eleActionDashboardPanel.SetAttribute("AcAddToDashboard", st.sGetRequestVar("rdAcAddToDashboard"))
eleActionDashboardPanel.SetAttribute("OgAddToDashboard", st.sGetRequestVar("rdOgAddToDashboard"))
eleActionDashboardPanel.SetAttribute("AddPanelRequestIDs", st.sGetRequestVar("rdPanelRequestIDs"))
eleActionDashboardPanel.SetAttribute("AddPanelSessionIDs", st.sGetRequestVar("rdPanelSessionIDs"))
eleActionDashboardPanel.SetAttribute("AddPanelLocalDataIDs", st.sGetRequestVar("rdPanelLocalDataIDs"))
eleActionDashboardPanel.SetAttribute("AddPanelLocalDataLayerIDs", st.sGetRequestVar("rdAddPanelLocalDataLayerIDs"))
eleActionDashboardPanel.SetAttribute("AddPanelSkipLocalData", st.sGetRequestVar("rdSkipLocalData"))
eleActionDashboardPanel.SetAttribute("OgDataTable", st.sGetRequestVar("rdOgDataTable"))
eleActionDashboardPanel.SetAttribute("OgHeatmap", st.sGetRequestVar("rdOgHeatmap"))
eleActionDashboardPanel.SetAttribute("OgChart", st.sGetRequestVar("rdOgChart"))
'If Not String.IsNullOrEmpty(st.sGetRequestVar("rdBookmarkCollection")) Then
Dim eleBookmarkLinkback As XmlElement = eleDef.OwnerDocument.CreateElement("BookmarkLinkback")
eleBookmarkLinkback.SetAttribute("BookmarkCollection", st.sGetRequestVar("rdBookmarkCollection"))
eleBookmarkLinkback.SetAttribute("Caption", st.sGetRequestVar("rdBookmarkLinkbackCaption"))
eleBookmarkLinkback.SetAttribute("FrameID", st.sGetRequestVar("rdBookmarkFrameID"))
eleDummyLabel.AppendChild(eleActionDashboardPanel)
eleActionDashboardPanel.AppendChild(eleBookmarkLinkback)
'End If
Return eleDummyLabel
End Function
Private Function subFixUpDashboardManipulatedElementID(ByVal sElementID As String, ByRef sDashboardGUID As String) As String
'Strip off the last part of the ID, if it's a guid.
If Not sElementID.Contains("_") Then
Return sElementID
End If
sDashboardGUID = sElementID.Substring(sElementID.LastIndexOf("_") + 1)
'Is it a valid GUID?
Try
Dim g As New Guid(sDashboardGUID) 'This throws an error if sGuid is invalid
Catch ex As Exception
sDashboardGUID = ""
Return sElementID
End Try
Return sElementID.Substring(0, sElementID.LastIndexOf("_"))
End Function
'Private Function FixUpDefinitionForMobileDashboards(ByRef xmlDef As XmlDocument) As Boolean
' ' Subroutine gets the source report for the MobileDashboard and loads it in to xmlDef.
' Dim bIsMobileReport As Boolean = False
' If xmlDef.DocumentElement.Name = "MobileReport" Then
' bIsMobileReport = True
' If xmlDef.SelectNodes("//*/MobileDashboard").Count > 1 Then _
' Throw New Exception("There is only one Dashboard allowed in a Definition.")
' Dim eleMobileDashboard As XmlElement = xmlDef.SelectSingleNode("//MobileDashboard")
' If Not IsNothing(eleMobileDashboard) Then
' Dim sDashboardSourceReport As String = eleMobileDashboard.GetAttribute("DashboardDefinitionFile")
' xmlDef = New XmlDocument() : xmlDef.LoadXml(st.sGetDefinition(sDashboardSourceReport, "Reports"))
' Dim eleDashboardElement As XmlElement = xmlDef.SelectSingleNode("//Dashboard2")
' If IsNothing(eleDashboardElement) Then _
' Throw New Exception("The DashboardDefinitionFile must have a Dashboard2 element.")
' eleDashboardElement.SetAttribute("DashboardColumn", 0)
' eleDashboardElement.SetAttribute("DashboardColumns", 1)
' eleDashboardElement.SetAttribute("DashboardTabs", "True")
' eleDashboardElement.SetAttribute("DashboardAdjustable", "True")
' eleDashboardElement.SetAttribute("IsMobileDashboard", "True")
' End If
' End If
' Return bIsMobileReport
'End Function
Private Function ConvertFormatNameToFormatString(ByVal sDateFormat As String) As String
Select Case sDateFormat
Case "General Date"
sDateFormat = "g"
Case "Long Date"
sDateFormat = "D"
Case "Short Date"
sDateFormat = "d"
Case "Medium Date"
sDateFormat = "dd-MMM-yy "
Case Else
sDateFormat = sDateFormat.Trim()
End Select
Return sDateFormat
End Function
Private Sub subProcessCrosstabHeaderAndSummaryRows( _
ByVal rowType As RowType, _
ByVal eleCrosstabTable As XmlElement, _
ByVal xmlXsl As XmlDocument, _
ByVal xmlData As XmlDocument, _
ByVal eleFirstDataRow As XmlElement, _
ByVal iColumn As Integer)
Dim eleSummaryRow As XmlElement
Static sSpannedHeaderValue As String
Static eleXslFirstRowHeader As XmlElement
Static eleSpannedHeaderCol As XmlElement
Static sSpannedSummaryValue As String
Static eleXslFirstRowSummary As XmlElement
Static eleSpannedSummaryCol As XmlElement
If iColumn = 0 And rowType = RowType.Header Then
'Run this once for the crosstab table.
sSpannedHeaderValue = ""
eleXslFirstRowHeader = Nothing
eleSpannedHeaderCol = Nothing
sSpannedSummaryValue = ""
eleXslFirstRowSummary = Nothing
eleSpannedSummaryCol = Nothing
End If
For Each eleSummaryRow In eleCrosstabTable.SelectNodes(IIf(rowType = RowType.Header, "HeaderRow", "SummaryRow"))
'There are two modes for SummaryRows, automatic and manual. Automatic is used when there are no Column elements.
Dim bSummaryRowAutomatic As Boolean = True
If eleSummaryRow.SelectNodes("*").Count <> 0 Then _
bSummaryRowAutomatic = False
If bSummaryRowAutomatic Then
Else 'Manual summary rows.
Dim eleSummaryCol As XmlElement
For Each eleSummaryCol In eleSummaryRow.SelectNodes(IIf(rowType = RowType.Header, "CrosstabTableHeaderColumn", "CrosstabTableSummaryColumn"))
'Add an extra Summary column for the current crosstab column.
Dim sId As String = eleSummaryCol.GetAttribute("ID")
If sId.Length = 0 Then _
Throw New Exception(IIf(rowType = RowType.Header, "CrosstabTableHeaderColumns", "CrosstabTableSummaryColumns") & " must have a unique, non-blank ID.")
Dim eleXslCrosstabSummaryColumn As XmlElement = xmlXsl.SelectSingleNode("//TABLE[@id='" & eleCrosstabTable.GetAttribute("ID") & "']//*[@id='" & sId & "' and @rdCrosstab='True']")
If Not IsNothing(eleXslCrosstabSummaryColumn) Then
If iColumn = 0 Then
If rowType = RowType.Header Then
If IsNothing(eleXslFirstRowHeader) Then eleXslFirstRowHeader = eleXslCrosstabSummaryColumn
Else
If IsNothing(eleXslFirstRowSummary) Then eleXslFirstRowSummary = eleXslCrosstabSummaryColumn
End If
End If
Dim atrColumn As XmlAttribute = eleFirstDataRow.Attributes("rdCrosstabColumn-" & iColumn)
If IsNothing(atrColumn) Then _
Exit For
'Add a new Summary.
Dim eleNewSummaryCol As XmlElement = eleXslCrosstabSummaryColumn.CloneNode(True)
eleNewSummaryCol.SetAttribute("id", eleNewSummaryCol.GetAttribute("id") & "-" & iColumn.ToString())
Call subFixupCrosstabColumnSummaryDataTokens(eleNewSummaryCol, xmlData, iColumn)
eleXslCrosstabSummaryColumn.ParentNode.InsertBefore(eleNewSummaryCol, IIf(rowType = RowType.Header, eleXslFirstRowHeader, eleXslFirstRowSummary))
Dim sQuote As String = IIf(atrColumn.Value.IndexOf("'") = -1, "'", """") 'This will fail if the value has both double and single quotes.
'If atrColumn.Value.startswith("=") Then
' Dim evl As New rdScriptEvaluator()
' atrColumn.Value = evl.sEvaluateFormula(atrColumn.Value)
'End If
Dim sSummaryValue As String = eleNewSummaryCol.InnerText
If sSummaryValue.Contains("rdFormulaValue") Then '#3062
For Each eleLabelWithFormula As XmlElement In eleNewSummaryCol.SelectNodes(".//*[@rdFormula]") '#8069
Dim atrFormula As XmlAttribute = eleLabelWithFormula.Attributes("rdFormula")
sSummaryValue = atrFormula.Value
For Each atrSummary As XmlAttribute In eleFirstDataRow.ParentNode.Attributes
If atrSummary.Name.EndsWith("-" & iColumn) Then
Dim sColName As String = atrSummary.Name.Replace("-" & iColumn, "")
sSummaryValue = sSummaryValue.Replace("{@" & sColName & "}", "{@" & sColName & "-" & iColumn & "}")
End If
Next
sSummaryValue = sSummaryValue.Replace("{@rdCrosstabColumn}", eleFirstDataRow.GetAttribute("rdCrosstabColumn-" & iColumn))
eleLabelWithFormula.SetAttribute("rdFormula", sSummaryValue)
Next
'Else
End If
Call rdUtility.ReplaceAttributeValues(eleNewSummaryCol, "@rdCrosstabColumn", sQuote & atrColumn.Value & sQuote, True)
sSummaryValue = eleNewSummaryCol.OuterXml
If eleNewSummaryCol.InnerXml.Contains("rdCondClass") Then '#12796.
Dim sConditionValue As String
For Each eleLabelWithConditionalElement As XmlElement In eleNewSummaryCol.SelectNodes(".//*[@rdCondClass]")
Dim atrCondition As XmlAttribute = eleLabelWithConditionalElement.Attributes("rdCondClass")
sConditionValue = atrCondition.Value
For Each atrSummary As XmlAttribute In eleFirstDataRow.ParentNode.Attributes
If atrSummary.Name.EndsWith("-" & iColumn) Then
Dim sColName As String = atrSummary.Name.Replace("-" & iColumn, "")
sConditionValue = sConditionValue.Replace("{@" & sColName & "}", "{@" & sColName & "-" & iColumn & "}")
End If
Next
eleLabelWithConditionalElement.SetAttribute("rdCondClass", sConditionValue)
Next
End If
If eleNewSummaryCol.InnerXml.Contains("src") Then '#16141.
Dim sConditionValue As String
For Each eleLabelWithConditionalElement As XmlElement In eleNewSummaryCol.SelectNodes(".//*[@src]")
Dim atrCondition As XmlAttribute = eleLabelWithConditionalElement.Attributes("src")
sConditionValue = atrCondition.Value
For Each atrSummary As XmlAttribute In eleFirstDataRow.ParentNode.Attributes
If atrSummary.Name.EndsWith("-" & iColumn) Then
Dim sColName As String = atrSummary.Name.Replace("-" & iColumn, "")
sConditionValue = sConditionValue.Replace("rdXslExtension:HrefUrlEncode(@" & sColName & ")", "rdXslExtension:HrefUrlEncode(@" & sColName & "-" & iColumn & ")")
End If
Next
eleLabelWithConditionalElement.SetAttribute("src", sConditionValue)
Next
End If
'eleNewHdr.SetAttribute("rdSummaryValue", sSummaryValue)
'These columns are spanned if there are duplicate values.
If rowType = RowType.Header Then
If sSpannedHeaderValue.Length = 0 Or sSpannedHeaderValue <> sSummaryValue Then
'This is a new value. Keep this Summary column
sSpannedHeaderValue = sSummaryValue
'atrCrosstabValue.Value = sQuote & sSummaryValue & sQuote
eleSpannedHeaderCol = eleNewSummaryCol
If eleSpannedHeaderCol.GetAttribute("COLSPAN").Length = 0 Then _
eleSpannedHeaderCol.SetAttribute("COLSPAN", 1)
Else
'It's the same value, get rid of this column Summary, and span the first.
eleNewSummaryCol.ParentNode.RemoveChild(eleNewSummaryCol)
eleSpannedHeaderCol.SetAttribute("COLSPAN", eleSpannedHeaderCol.GetAttribute("COLSPAN") + 1)
End If
Else
If sSpannedSummaryValue.Length = 0 Or sSpannedSummaryValue <> sSummaryValue Then
'This is a new value. Keep this Summary column
sSpannedSummaryValue = sSummaryValue
'atrCrosstabValue.Value = sQuote & sSummaryValue & sQuote
eleSpannedSummaryCol = eleNewSummaryCol
If eleSpannedSummaryCol.GetAttribute("COLSPAN").Length = 0 Then _
eleSpannedSummaryCol.SetAttribute("COLSPAN", 1)
Else
'It's the same value, get rid of this column Summary, and span the first.
eleNewSummaryCol.ParentNode.RemoveChild(eleNewSummaryCol)
eleSpannedSummaryCol.SetAttribute("COLSPAN", eleSpannedSummaryCol.GetAttribute("COLSPAN") + 1)
End If
End If
'Prevent this from getting removed below.
eleNewSummaryCol.RemoveAttribute("rdCrosstab")
End If
Next 'eleSummaryCol
End If
Next 'eleSummaryRow
End Sub
Private Sub subResizeResizableColumns(ByRef sXsl As String, ByRef colCrosstabSeq As Collection)
Dim bXslChanged As Boolean = False
Dim xmlXsl As New XmlDocument() : xmlXsl.LoadXml(sXsl)
Dim nsmgr As XmlNamespaceManager = New XmlNamespaceManager(xmlXsl.NameTable)
nsmgr.AddNamespace("xsl", "http://www.w3.org/1999/XSL/Transform")
'Loop through the tables that have resizable columns.
For Each eleTable As XmlElement In xmlXsl.SelectNodes("//TABLE[@rdResizableColumnsID]")
Dim sTableID As String = eleTable.GetAttribute("id")
Dim sSessionVarKey As String = "rdResizedColumns_" & msRequestedPage & "_" & sTableID
If st.sGetRequestVar("rdResizableColumnsReset") = "True" _
OrElse st.sGetRequestVar("rdAgReset") = "True" Then
HttpContext.Current.Session.Remove(sSessionVarKey)
End If
Dim sResizedColumns As String = HttpContext.Current.Session(sSessionVarKey)
If Not IsNothing(sResizedColumns) Then
bXslChanged = True
'Loop through the parent nodes that have column elements. These are COLS and THs and TDS.
For Each eleSeq0 As XmlElement In eleTable.SelectNodes("//TH")
'Columns have been resized.
For Each sResize As String In sResizedColumns.Split(",")
If sResize.Length <> 0 Then
Dim sColStyle As String = ""
Dim columnID As String = sResize.Split(":")(0)
Dim rdCrosstabColNo As Integer = Nothing
Dim width As Integer = Nothing
'Find crosstab column number if it exists
If (columnID.Contains("_rdctcolnr")) Then
If Integer.TryParse(sResize.Split(":")(1).Split("_")(1), Nothing) Then
rdCrosstabColNo = sResize.Split(":")(1).Split("_")(1)
Else
columnID = columnID.Split("_rdctcolnr")(0)
End If
width = sResize.Split(":")(1).Split("_")(0)
Else
If Integer.TryParse(sResize.Split(":")(1), width) = True Then '19772
width = sResize.Split(":")(1)
Else
width = 100
End If
End If
If eleSeq0.GetAttribute("id") = (columnID & "-TH") Or eleSeq0.GetAttribute("id") = (columnID) Then
sColStyle = "width: " & width & "px"
eleSeq0.SetAttribute("style", sColStyle)
'Crosstabs do not have unique ID so we go by column number
ElseIf (eleSeq0.GetAttribute("id") & "_rdctcolnr" = columnID Or (eleSeq0.GetAttribute("id").Replace("-TH", "") & "_rdctcolnr") = columnID) _
AndAlso Not IsNothing(rdCrosstabColNo) AndAlso Not IsNothing(eleSeq0.GetAttribute("rdCtColNr")) _
AndAlso eleSeq0.GetAttribute("rdCtColNr") = rdCrosstabColNo.ToString Then
sColStyle = "width: " & width & "px"
eleSeq0.SetAttribute("style", sColStyle)
End If
'19409
'If eleTable.GetAttribute("id") = (columnID) Then
'sColStyle = "width: " & width & "px;"
'eleTable.SetAttribute("style", sColStyle)
'End If
End If
Next
Next
End If
Next
If bXslChanged Then
sXsl = xmlXsl.OuterXml
End If
End Sub
Private Sub subReorderDraggableColumns(ByRef sXsl As String, ByRef colCrosstabSeq As Collection)
Dim bXslChanged As Boolean = False
Dim xmlXsl As New XmlDocument() : xmlXsl.LoadXml(sXsl)
Dim nsmgr As XmlNamespaceManager = New XmlNamespaceManager(xmlXsl.NameTable)
nsmgr.AddNamespace("xsl", "http://www.w3.org/1999/XSL/Transform")
'Loop through the tables that have draggable columns.
For Each eleTable As XmlElement In xmlXsl.SelectNodes("//TABLE[@rdDraggableColumnsID]")
Dim sTableID As String = eleTable.GetAttribute("id")
Dim sSessionVarKey As String = "rdDraggedColumns_" & msRequestedPage & "_" & sTableID
If st.sGetRequestVar("rdDraggableColumnsReset") = "True" _
OrElse st.sGetRequestVar("rdAgReset") = "True" Then
HttpContext.Current.Session.Remove(sSessionVarKey)
End If
Dim sDraggedColumns As String = HttpContext.Current.Session(sSessionVarKey)
If Not IsNothing(sDraggedColumns) Then
bXslChanged = True
'Add sequence numbers to all the rdColumnSeq attributes, which are blank now. This helps identify the elements that have child column elements.
Dim nSeq As Integer = 0
Dim elePrevParent As XmlElement = xmlXsl.DocumentElement
For Each eleWithSeq As XmlElement In eleTable.SelectNodes("*//*[@rdColumnSeq]")
If Not elePrevParent.Equals(eleWithSeq.ParentNode) Then
nSeq = 0
elePrevParent = eleWithSeq.ParentNode
End If
eleWithSeq.SetAttribute("rdColumnSeq", nSeq)
nSeq += 1
Next
'Are there table headers that don't have a sequence number? This will mess up reordering so we add the sequence number 20397
If Not IsNothing(eleTable.SelectSingleNode("THEAD")) Then '20979
If Not IsNothing(eleTable.SelectSingleNode("THEAD").SelectSingleNode(".//TH[not(@rdColumnSeq)]")) Then
Dim eleSummaryRows As XmlNodeList = eleTable.SelectSingleNode("THEAD").SelectNodes(".//TR")
For Each eleSummaryRow As XmlElement In eleSummaryRows
nSeq = 0
For Each eleHeaderWithoutSeq As XmlElement In eleSummaryRow.SelectNodes("TH[not(@rdColumnSeq)]")
eleHeaderWithoutSeq.SetAttribute("rdColumnSeq", nSeq)
nSeq += 1
Next
Next
End If
End If
'Loop through the parent nodes that have column elements. These are COLS and THs and TDS.
For Each eleSeq0 As XmlElement In eleTable.SelectNodes("*//*[@rdColumnSeq='0']")
Dim eleParent As XmlElement = eleSeq0.ParentNode
Try
'Columns have been dragged.
For Each sDrag As String In sDraggedColumns.Split(",")
If sDrag.Length <> 0 Then
Dim nFrom As Integer = sDrag.Split(":")(0)
Dim nTo As Integer = sDrag.Split(":")(1)
Dim eleFrom As XmlElement = eleParent.SelectNodes("*[@rdColumnSeq]")(nFrom)
Dim eleTo As XmlElement = eleParent.SelectNodes("*[@rdColumnSeq]")(nTo)
If nFrom < nTo Then
eleParent.InsertAfter(eleParent.RemoveChild(eleFrom), eleTo)
Else
eleParent.InsertBefore(eleParent.RemoveChild(eleFrom), eleTo)
End If
End If
Next
Catch ex As Exception
'dbug.AddDebugMessage(, "** WARNING ** DraggableColumns error, perhaps a column was removed.", ex.Message)
End Try
'Need to get the order of CrosstabColumns so that CrosstabComparisons can be calculated.
Dim lstCrosstabSeq As New List(Of Integer)
For Each eleCtCol As XmlElement In eleParent.SelectNodes("*[@rdCtColNr]")
If IsNothing(colCrosstabSeq) Then _
colCrosstabSeq = New Collection
If Not colCrosstabSeq.Contains(sTableID) Then _
colCrosstabSeq.Add(lstCrosstabSeq, sTableID)
'lstCrosstabSeq.Add(Val(eleCtCol.GetAttribute("rdColumnSeq")) - 1) '
lstCrosstabSeq.Add(Val(eleCtCol.GetAttribute("rdCtColNr")))
Next
Next
'If st.sGetRequestVar("rdCtCompDrags") = "True" Then
If eleTable.HasAttribute("rdDraggableCtComp") Then '14387
'The first column sorts on the crosstab value, all other columns sort on the difference percent.
Dim bFirstSortHeader As Boolean = True
For Each atrSortLink As XmlAttribute In eleTable.SelectNodes("THEAD/TR/TH[@rdCtColNr]/a/@href") 'Get all the sort links.
If atrSortLink.Value.Contains("rdSort=") Then
If bFirstSortHeader Then
bFirstSortHeader = False
atrSortLink.Value = atrSortLink.Value.Replace("rdCrosstabDifferencePercent-", "rdCrosstabValue-")
Else
atrSortLink.Value = atrSortLink.Value.Replace("rdCrosstabValue-", "rdCrosstabDifferencePercent-")
End If
End If
Next
End If
End If
Next
If bXslChanged Then
sXsl = xmlXsl.OuterXml
End If
End Sub
Private _lastRdIdeIdx As Integer
Private Function GetNextRdIdeIdx() As Integer
_lastRdIdeIdx += 1
Return _lastRdIdeIdx
End Function
Friend Function sProcessDefinitionElement(ByRef eleDef As XmlElement) As String
Dim sReturn As String = ""
Dim sElementID As String = eleDef.GetAttribute("ID")
Dim sElementRdIdeID As String = eleDef.GetAttribute("rdIdeID")
Dim sRdIdeIdx As String = eleDef.GetAttribute("rdIdeIdx")
Static Dim bIsForWizard As Boolean = False
If Array.IndexOf("submit,action,target".Split(","), sElementID) <> -1 Then _
Throw New Exception("Elements cannot have an ID value of ""action"", ""submit"", nor ""target"". Change the ID to something else.")
Select Case eleDef.Name
Case "Report", "MobileReport", "Widget"
sReturn = sProcess_Report(eleDef)
Case "MetaNames"
sReturn = sProcess_MetaNames(eleDef)
Case "AdhocMetadata"
'Do nothing, this prevents processing of any elements under AdhocMetadata
Case "AnalysisChart"
sReturn = sProcess_AnalysisChart(eleDef)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "AnalysisFilter"
sReturn = sProcess_AnalysisFilter(eleDef)
Case "AnalysisGrid"
sReturn = sProcess_AnalysisGrid(eleDef)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "AnalysisFilterDistinctValues"
sReturn = sProcess_AnalysisFilterDistinctValues(eleDef)
Case "DashboardEditAgViz"
sReturn = sProcess_DashboardEditAgViz(eleDef)
Case "Schedule"
sReturn = sProcess_Schedule(eleDef)
Case "SavedQueryBuilder"
sReturn = sProcess_SavedQueryBuilder(eleDef)
Case "AnimatedChart", "AnimatedGauge"
sReturn = sProcess_AnimatedChart(eleDef, sElementID)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "Body"
sReturn = sProcess_Body(eleDef)
Case "BookmarkOrganizer"
sReturn = sProcess_BookmarkOrganizer(eleDef)
Case "Bullet"
sReturn = sProcess_Bullet(eleDef)
Case "Button"
sReturn = sProcess_Button(eleDef, sElementID)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "Chart", "Gauge"
sReturn = sProcess_Chart_or_Gauge(eleDef, sElementID)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "Sparkline"
sReturn = sProcess_Sparkline(eleDef, sElementID)
Case "InputChart"
sReturn = sProcess_InputChart(eleDef)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "TrellisChart"
sReturn = sProcess_TrellisChart(eleDef, sElementID)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "ChartGrid"
sReturn = sProcess_ChartGrid(eleDef)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "ColorSpectrumLegend"
sReturn = sProcess_ColorSpectrumLegend(eleDef, sElementID)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "DefaultRequestParams"
'sReturn = sProcess_DefaultRequestParams(eleDef)
'These are already processed.
Case "DefinitionModifierFile"
sReturn = sProcess_DefinitionModifierFile(eleDef)
Case "Dashboard2"
sReturn = sProcess_Dashboard2(eleDef)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "Division", "ExtraColumnHeader", "DragDivision", "DropDivision" ' "Division2"
sReturn = sProcess_Division(eleDef)
Case "AnimatedMap"
sReturn = sProcess_AnimatedMap(eleDef, sElementID)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "GoogleMap"
sReturn = sProcess_GoogleMap(eleDef, sElementID)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "HR"
sReturn = sProcess_HR(eleDef)
Case "HtmlTag"
sReturn = sProcess_HtmlTag(eleDef)
Case "Image"
sReturn = sProcess_Image(eleDef)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "ToggleImage"
sReturn = sProcess_ToggleImage(eleDef, sElementID)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "TooltipPanel"
sReturn = sProcess_TooltipPanel(eleDef, sElementID)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "Label"
sReturn = sProcess_Label(eleDef)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "LineBreak"
sReturn = sProcess_LineBreak(eleDef)
Case "PopupPanel"
sReturn = sProcess_PopupPanel(eleDef, sElementID)
'Case "FloatingPanel"
' sReturn = sProcess_FloatingPanel(eleDef, sElementID)
Case "PrinterPageBreak"
sReturn = sProcess_PrinterPageBreak(eleDef)
Case "ExcelSheetBreak"
sReturn = sProcess_ExcelSheetBreak(eleDef)
Case "Rectangle"
sReturn = sProcess_Rectangle(eleDef)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "VerticalLine", "HorizontalLine"
sReturn = sProcess_Line(eleDef)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "SpaceForBorders"
sReturn = sProcess_SpaceForBorders(eleDef)
Case "Spaces"
sReturn = sProcess_Spaces(eleDef)
Case "DataCalendar"
sReturn = sProcess_DataCalendar(eleDef, sElementID)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "InputDateCalendar"
sReturn = sProcess_InputDateCalendar(eleDef, sElementID)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "DatePicker"
sReturn = sProcess_DatePicker(eleDef, sElementID)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "DataTable"
sReturn = sProcess_DataTable(eleDef, sElementID)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "DataTableColumn"
'Don't do anything for these orphan DataTableColumns, they are processed under the DataTable.
'Case "HoverCell"
' sReturn = sProcess_HoverCell(eleDef, sElementID)
Case "DataList"
sReturn = sProcess_DataList(eleDef, sElementID)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "DataMenu"
sReturn = sProcess_DataMenu(eleDef, sElementID)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "DataMenuTree"
sReturn = sProcess_DataMenuTree(eleDef, sElementID)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "MenuTree"
sReturn = sProcess_MenuTree(eleDef, sElementID)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "ReportCenterMenu"
sReturn = sProcess_ReportCenterMenu(eleDef, sElementID)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "ListItem"
sReturn = sProcess_ListItem(eleDef, sElementID)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "SubDataTable"
sReturn = sProcess_SubDataTable(eleDef, sElementID)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "CrosstabTable"
sReturn = sProcess_CrosstabTable(eleDef)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "OlapTable"
sReturn = sProcess_OlapTable(eleDef)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "OlapGrid"
sReturn = sProcess_OlapGrid(eleDef)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "XolapTable"
sReturn = sProcess_XolapTable(eleDef)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "DimensionGrid"
sReturn = sProcess_DimensionGrid(eleDef)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "OlapChart"
sReturn = sProcess_OlapChart(eleDef)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "OlapHeatmap"
sReturn = sProcess_OlapHeatmap(eleDef)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "DataLayer"
'Don't do anything else. DataLayers are handled later.
Case "DataTree"
sReturn = sProcess_DataTree(eleDef, sElementID)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "DataTreeBranch"
sReturn = sProcess_DataTreeBranch(eleDef, sElementID)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "DataMultiColumnList", "SubDataMultiColumnList"
sReturn = sProcess_DataMultiColumnList(eleDef, sElementID)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "TextCloud"
sReturn = sProcess_TextCloud(eleDef, sElementID)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "SharedElement"
'Do nothing.
Case "Tabs"
sReturn = sProcess_Tabs(eleDef, sElementID)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "TabPanel"
sReturn = sProcess_TabPanel(eleDef, sElementID)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "InputSlider"
sReturn = sProcess_InputSlider(eleDef, sElementID)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "IncludeHtmlFile"
sReturn = sProcess_IncludeHtmlFile(eleDef)
Case "IncludeHtml"
sReturn = sProcess_IncludeHtml(eleDef)
Case "IncludeFrame"
sReturn = sProcess_IncludeFrame(eleDef)
Case "InteractiveDataView"
sReturn = sProcess_InteractiveDataView(eleDef, sElementID)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "ReportHeader", "ReportFooter", "PageHeader", "PageFooter"
sReturn = sProcess_HeadersAndFooters(eleDef)
Case "StyleSheet"
sReturn = sProcess_StyleSheet(eleDef)
Case "RefreshElementTimer"
sReturn = sProcess_RefreshElementTimer(eleDef)
Case "Rows"
sReturn = sProcess_Rows(eleDef)
Case "Row"
sReturn = sProcess_Row(eleDef)
Case "Column", "CrosstabTableHeaderColumn", "CrosstabTableSummaryColumn", "MoreInfoRowColumn"
sReturn = sProcess_Column(eleDef)
Case "InputGrid"
sReturn = sProcess_InputGrid(eleDef)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "InputHidden"
sReturn = sProcess_InputHidden(eleDef)
Case "InputText", "InputPassword", "InputNumber", "InputEmail", "InputTelephone", "InputComboList"
sReturn = sProcess_InputText(eleDef)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "InputTextArea"
sReturn = sProcess_InputTextArea(eleDef)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "InputCheckbox"
sReturn = sProcess_InputCheckbox(eleDef)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "InputDate"
sReturn = sProcess_InputDate(eleDef, sElementID)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "InputTime"
sReturn = sProcess_InputTime(eleDef, sElementID)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "InputFileUpload"
sReturn = sProcess_InputFileUpload(eleDef)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "InputRadioButtons"
sReturn = sProcess_InputRadioButtons(eleDef, sElementID)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "InputSelectList"
sReturn = sProcess_InputSelectList(eleDef, sElementID)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "InputCheckboxList"
sReturn = sProcess_InputCheckboxList(eleDef, sElementID)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "ElementTemplate"
Call subProcess_ElementTemplate(eleDef)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "GroupDrillthrough"
'Dim GroupDrillthrough As rdGroupDrillthrough = New rdGroupDrillthrough()
subProcess_GroupDrillthrough(eleDef)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "IncludeScriptFile"
sReturn = sProcess_IncludeScriptFile(eleDef)
Case "IncludeScript"
sReturn = sProcess_IncludeScript(eleDef)
Case "ChartCanvas"
sReturn = sProcess_ChartCanvas(eleDef, sElementID)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "Heatmap"
Call subConvert_OldHeatmapApplet(eleDef)
addRdIdeIDSpan(sReturn, sElementRdIdeID)
Case "FieldsetBox"
sReturn = sProcess_FieldsetBox(eleDef)
Case "ResponsiveRow"
sReturn = sProcess_ResponsiveRow(eleDef)
Case "DraggableDivision"
sReturn = sProcess_DraggableDivision(eleDef)
Case "DroppableDivision"
sReturn = sProcess_DroppableDivision(eleDef)
Case "ReportAuthor"
sReturn = sProcess_ReportAuthor(eleDef)
Case "InputColorPicker"
sReturn = sProcess_InputColorPicker(eleDef)
Case "Thinkspace"
sReturn = sProcess_Thinkspace(eleDef, sElementID)
Case "NgpVisualization"
sReturn = sProcess_NgpVisualization(eleDef, sElementID)
Case "Anchor"
sReturn = sProcess_Anchor(eleDef)
Case "AnalysisCrosstab"
sReturn = sProcess_AnalysisCrosstab(eleDef)
Case "ThemeEditor"
sReturn = sProcess_ThemeEditor(eleDef)
Case Else
'This is an unknown element. Still want to process any children.
sReturn = sProcessDefinitionElementChildren(eleDef)
End Select
sProcessDefinitionElement = sAddRdIdeIdx(eleDef, sReturn)
End Function
Friend Function sProcessDefinitionElementChildren(ByVal eleDefParent As XmlElement) As String
Dim sReturn As StringBuilder = New StringBuilder()
'This function is called for all elements that may have children.
Dim eleDefChild As XmlElement
eleDefChild = eleDefParent.FirstChild
Do Until IsNothing(eleDefChild)
If Not eleDefChild.GetAttribute("rdRemark") = "True" Then
sReturn.Append(sProcessDefinitionElement(eleDefChild))
End If
eleDefChild = eleDefChild.NextSibling
Loop
sProcessDefinitionElementChildren = sReturn.ToString()
End Function
''TODO Dima: refactor it later and move it to utilities. It clones the code from rdHighcharts.GetSeriesAction
'Private Function ExtractAction(ByVal eleAction As XmlElement) As String
' Const span As String = ""
' Dim sAction As String = sSetAction(eleAction.ParentNode, span)
' If String.IsNullOrEmpty(sAction) Then
' Return ""
' End If
' If (st.sGetAttribute(eleAction, "CrawlerFriendly") = "True") Then
' Dim ex As Regex = New Regex("\w*CrawlerFriendly(.*);")
' Dim match As String = ex.Match(sAction).Value
' Return match
' End If
' sAction = sAction.Replace("javascript:void 0", "")
' Dim rxHref As Regex = New Regex("((?<=href="")[^""]*)")
' Dim rxClick As Regex = New Regex("((?<=onClick="")[^""]*)")
' Dim sHref As String = rxHref.Match(sAction).Value
' Dim sClick As String = rxClick.Match(sAction).Value
' If String.IsNullOrEmpty(sHref) Then
' sAction = sClick
' Else
' sAction = sHref
' End If
' If sAction.StartsWith("javascript:") Then
' sAction = sAction.Substring("javascript:".Length)
' End If
' Return sAction
'End Function
Private Function sProcess_ThemeEditor(ByRef eleDef As XmlElement) As String
Dim sTheme As String = ""
'Theme defined in the ThemeEditor Theme attribute
If Not String.IsNullOrEmpty(st.sGetAttribute(eleDef, "Theme")) Then
sTheme = st.sGetAttribute(eleDef, "Theme")
End If
If String.IsNullOrEmpty(sTheme) Then
Throw New Exception("ThemeEditor requires the Theme attribute.")
End If
If rdUtility.bThemeLocatedInrdTemplate(sTheme) Then
Throw New Exception("ThemeEditor cannot edit " & sTheme & ", which is a built-in theme under rdTemplate/rdTheme. To edit this built-in theme, make a copy into the _Themes folder and give it a new name.")
End If
If rdUtility.bThemeDoesNotExist(sTheme) Then
Throw New Exception("The theme " & sTheme & " does not exist.")
End If
If Not rdThemeEditor.bThemeIsEditable(sTheme) Then
Throw New Exception("The theme is not flagged as ThemeEditor-ready.")
End If
dbug.AddDebugMessage("ThemeEditor", "Generate Definition")
Dim oThemeEditor As New rdServer.rdThemeEditor(st, dbug)
Call subAddIncludedCss("rdGridSystem.css")
Call subAddIncludedCss("rdThemeEditor/rdThemeEditor.css")
Dim eleThemeEditor As XmlElement = oThemeEditor.sProcess_ThemeEditor(eleDef, msRequestedPage, sTheme)
Return ""
End Function
Private Function sProcess_ReportAuthor(ByRef eleDef As XmlElement) As String
needLocalization = True
HttpContext.Current.Response.AddHeader("Cache-Control", "no-store")
dbug.AddDebugMessage("ReportAuthor", "Generate Definition")
Dim reportAuthor As New rdServer.ReportAuthor(Me, st, dbug)
Return reportAuthor.sProcess_ReportAuthor(eleDef)
End Function
Private Function sProcess_ResponsiveRow(ByRef eleDef As XmlElement) As String
Dim sCss As String = "horizontalScrollbar" 'default.
Select Case st.sGetAttribute(eleDef, "CollisionBehavior")
Case "Wrap"
sCss = "wrap"
Case "Overlap"
sCss = "overlap"
End Select
Dim nlColumns As XmlNodeList = eleDef.SelectNodes("ResponsiveColumn")
For Each column As XmlElement In nlColumns
FillMissingColspanAttributes(column)
Next
'Set default colspans if needed. For ColspanLargeScreen, ColspanMediumScreen, ColspanSmallScreen
Dim eleEmptyColspans As XmlNodeList = eleDef.SelectNodes("ResponsiveColumn[not(@ColspanLargeScreen or @ColspanMediumScreen or @ColspanSmallScreen)]")
Dim eleFullColspans As XmlNodeList = eleDef.SelectNodes("ResponsiveColumn[@ColspanLargeScreen | @ColspanMediumScreen | @ColspanSmallScreen]")
If eleEmptyColspans.Count > 0 Then
'need to set default colspans.
Dim colspanLargeScreenCalculated As Single
Dim colspanMediumScreenCalculated As Single
Dim colspanSmallScreenCalculated As Single
'Dim colspanExtraSmallScreenCalculated As Single
Dim sumColspanLargeScreen As Integer = 0
Dim sumColspanMediumScreen As Integer = 0
Dim sumColspanSmallScreen As Integer = 0
'Dim sumColspanExtraSmallScreen As Integer = 0
For Each column As XmlElement In eleFullColspans
'Dim colspanExtraSmallScreen As String = st.sGetAttribute(column, "ColspanExtraSmallScreen")
Dim colspanSmallScreen As String = st.sGetAttribute(column, "ColspanSmallScreen")
Dim colspanMediumScreen As String = st.sGetAttribute(column, "ColspanMediumScreen")
Dim colspanLargeScreen As String = st.sGetAttribute(column, "ColspanLargeScreen")
Dim temp As Integer
If Integer.TryParse(colspanLargeScreen, temp) Then
sumColspanLargeScreen += temp
End If
If Integer.TryParse(colspanMediumScreen, temp) Then
sumColspanMediumScreen += temp
End If
If Integer.TryParse(colspanSmallScreen, temp) Then
sumColspanSmallScreen += temp
End If
' If Integer.TryParse(colspanExtraSmallScreen, temp) Then
' sumColspanExtraSmallScreen += temp
' End If
Next
colspanLargeScreenCalculated = GetColspanCalculated(eleEmptyColspans, sumColspanLargeScreen)
colspanMediumScreenCalculated = GetColspanCalculated(eleEmptyColspans, sumColspanMediumScreen)
colspanSmallScreenCalculated = GetColspanCalculated(eleEmptyColspans, sumColspanSmallScreen)
'colspanExtraSmallScreenCalculated = GetColspanCalculated(eleEmptyColspans, sumColspanExtraSmallScreen)
For i As Integer = 0 To eleEmptyColspans.Count - 1 '23378
Dim eleEmptyColspan As XmlElement = eleEmptyColspans.Item(i)
eleEmptyColspan.SetAttribute("ColspanLargeScreen", Convert.ToInt32(Math.Floor(colspanLargeScreenCalculated)))
eleEmptyColspan.SetAttribute("ColspanMediumScreen", Convert.ToInt32(Math.Floor(colspanMediumScreenCalculated)))
eleEmptyColspan.SetAttribute("ColspanSmallScreen", Convert.ToInt32(Math.Floor(colspanSmallScreenCalculated)))
'eleEmptyColspan.SetAttribute("ColspanExtraSmallScreen", Convert.ToInt32(Math.Floor(colspanExtraSmallScreenCalculated)))
Next
If Not IsNothing(eleEmptyColspans.ItemOf(eleEmptyColspans.Count - 1)) Then '23378
CType(eleEmptyColspans.ItemOf(eleEmptyColspans.Count - 1), XmlElement).SetAttribute("ColspanLargeScreen", Convert.ToInt32((colspanLargeScreenCalculated - Math.Floor(colspanLargeScreenCalculated)) * eleEmptyColspans.Count + Math.Floor(colspanLargeScreenCalculated)))
CType(eleEmptyColspans.ItemOf(eleEmptyColspans.Count - 1), XmlElement).SetAttribute("ColspanMediumScreen", Convert.ToInt32((colspanMediumScreenCalculated - Math.Floor(colspanMediumScreenCalculated)) * eleEmptyColspans.Count + Math.Floor(colspanMediumScreenCalculated)))
CType(eleEmptyColspans.ItemOf(eleEmptyColspans.Count - 1), XmlElement).SetAttribute("ColspanSmallScreen", Convert.ToInt32((colspanSmallScreenCalculated - Math.Floor(colspanSmallScreenCalculated)) * eleEmptyColspans.Count + Math.Floor(colspanSmallScreenCalculated)))
'CType(eleEmptyColspans.ItemOf(eleEmptyColspans.Count - 1), XmlElement).SetAttribute("ColspanExtraSmallScreen", Convert.ToInt32((colspanExtraSmallScreenCalculated - Math.Floor(colspanExtraSmallScreenCalculated)) * eleEmptyColspans.Count + Math.Floor(colspanExtraSmallScreenCalculated)))
End If
End If
'Set colspans for ExtraSmallScreen
Dim eleEmptyESColspans As XmlNodeList = eleDef.SelectNodes("ResponsiveColumn[not(@ColspanExtraSmallScreen)]")
If eleEmptyESColspans.Count > 0 Then
Dim eleReferentESColspan As XmlElement = eleDef.SelectSingleNode("ResponsiveColumn[@ColspanExtraSmallScreen and not(@ColspanExtraSmallScreen='0')][1]")
Dim referentColspanValue As Integer = 12
If Not IsNothing(eleReferentESColspan) Then
referentColspanValue = Convert.ToInt32(eleReferentESColspan.GetAttribute("ColspanExtraSmallScreen"))
End If
For Each eleEmptyEsColspan As XmlElement In eleEmptyESColspans
eleEmptyEsColspan.SetAttribute("ColspanExtraSmallScreen", referentColspanValue)
Next
End If
Dim isExport As Boolean = http.Request("rdReportFormat") = "PDF"
Dim isHtmlEmailExport As Boolean = http.Request("rdReportFormat") = "HtmlEmail"
Dim sb As StringBuilder = New StringBuilder()
If isExport Then
ConvertResponsiveRowToTable(eleDef)
End If
If isHtmlEmailExport Then
ConvertResponsiveRowToTableWebMail(eleDef)
End If
'it is hack for java pdf export
If (Not isExport) Then
sb.Append(String.Format("
", sCss))
For Each eleColumn As XmlElement In nlColumns
sb.Append(sProcess_ResponsiveColumn(eleColumn))
Next
sb.Append("
")
End If
Return sb.ToString()
End Function
Private Sub ConvertResponsiveRowToTable(ByVal eleDef As XmlElement)
Dim eleRows As XmlElement = eleDef.OwnerDocument.CreateElement("Rows")
eleRows.SetAttribute("ID", st.sGetAttribute(eleDef, "ID"))
eleRows.SetAttribute("Width", "100")
eleRows.SetAttribute("WidthScale", "%")
eleDef.ParentNode.InsertAfter(eleRows, eleDef)
Dim eleRow As XmlElement = eleDef.OwnerDocument.CreateElement("Row")
eleRows.AppendChild(eleRow)
Dim nlColumns As XmlNodeList = eleDef.SelectNodes("ResponsiveColumn")
For Each responsiveColumn As XmlElement In nlColumns
Dim tableColumn As XmlElement = eleDef.OwnerDocument.CreateElement("Column")
tableColumn.SetAttribute("ID", st.sGetAttribute(responsiveColumn, "ID"))
tableColumn.SetAttribute("Class", st.sGetAttribute(responsiveColumn, "Class"))
If st.sGetAttribute(responsiveColumn, "ColspanLargeScreen").Length > 0 Then
tableColumn.SetAttribute("Class", String.Format("{0} col-lg-{1}-rd", st.sGetAttribute(tableColumn, "Class"), st.sGetAttribute(responsiveColumn, "ColspanLargeScreen")))
ElseIf st.sGetAttribute(responsiveColumn, "ColspanMediumScreen").Length > 0 Then
tableColumn.SetAttribute("Class", String.Format("{0} col-lg-{1}-rd", st.sGetAttribute(tableColumn, "Class"), st.sGetAttribute(responsiveColumn, "ColspanMediumScreen")))
ElseIf st.sGetAttribute(responsiveColumn, "ColspanSmallScreen").Length > 0 Then
tableColumn.SetAttribute("Class", String.Format("{0} col-lg-{1}-rd", st.sGetAttribute(tableColumn, "Class"), st.sGetAttribute(responsiveColumn, "ColspanSmallScreen")))
ElseIf st.sGetAttribute(responsiveColumn, "ColspanExtraSmallScreen").Length > 0 Then
tableColumn.SetAttribute("Class", String.Format("{0} col-lg-{1}-rd", st.sGetAttribute(tableColumn, "Class"), st.sGetAttribute(responsiveColumn, "ColspanExtraSmallScreen")))
End If
eleRow.AppendChild(tableColumn)
tableColumn.InnerXml = responsiveColumn.InnerXml
responsiveColumn.InnerXml = ""
Next
End Sub
Private Sub ConvertResponsiveRowToTableWebMail(ByVal eleDef As XmlElement)
Dim eleRows As XmlElement = eleDef.OwnerDocument.CreateElement("Rows")
eleRows.SetAttribute("ID", st.sGetAttribute(eleDef, "ID"))
eleRows.SetAttribute("Width", "100")
eleRows.SetAttribute("WidthScale", "%")
eleDef.ParentNode.InsertAfter(eleRows, eleDef)
Dim eleRow As XmlElement = eleDef.OwnerDocument.CreateElement("Row")
eleRows.AppendChild(eleRow)
Dim nlColumns As XmlNodeList = eleDef.SelectNodes("ResponsiveColumn")
For Each responsiveColumn As XmlElement In nlColumns
Dim tableColumn As XmlElement = eleDef.OwnerDocument.CreateElement("Column")
tableColumn.SetAttribute("ID", st.sGetAttribute(responsiveColumn, "ID"))
tableColumn.SetAttribute("Class", st.sGetAttribute(responsiveColumn, "Class"))
Dim iCurrentColSpan As Integer
If st.sGetAttribute(responsiveColumn, "ColspanLargeScreen").Length > 0 Then
iCurrentColSpan = CInt(st.sGetAttribute(responsiveColumn, "ColspanLargeScreen"))
ElseIf st.sGetAttribute(responsiveColumn, "ColspanMediumScreen").Length > 0 Then
iCurrentColSpan = CInt(st.sGetAttribute(responsiveColumn, "ColspanMediumScreen"))
ElseIf st.sGetAttribute(responsiveColumn, "ColspanSmallScreen").Length > 0 Then
iCurrentColSpan = CInt(st.sGetAttribute(responsiveColumn, "ColspanSmallScreen"))
ElseIf st.sGetAttribute(responsiveColumn, "ColspanExtraSmallScreen").Length > 0 Then
iCurrentColSpan = CInt(st.sGetAttribute(responsiveColumn, "ColspanExtraSmallScreen"))
End If
Dim iColWidth As Integer = (100 / 12) * iCurrentColSpan
tableColumn.SetAttribute("Style", String.Format("width:{0}%;vertical-align:top;", iColWidth))
eleRow.AppendChild(tableColumn)
tableColumn.InnerXml = responsiveColumn.InnerXml
responsiveColumn.InnerXml = ""
Next
End Sub
Private Function GetColspanCalculated(ByVal eleEmptyColspans As XmlNodeList, ByVal sumColspans As Integer) As Single
Dim calculatedColspan As Single
Dim multiplier As Integer = 0
Do
multiplier += 1
calculatedColspan = (12 * multiplier - sumColspans) / eleEmptyColspans.Count
Loop While calculatedColspan <= 0
If calculatedColspan < 1 Then
calculatedColspan = 1
End If
Return calculatedColspan
End Function
Private Sub FillMissingColspanAttributes(ByVal eleDef As XmlElement)
Dim colspanSmallScreen As String = st.sGetAttribute(eleDef, "ColspanSmallScreen")
Dim colspanMediumScreen As String = st.sGetAttribute(eleDef, "ColspanMediumScreen")
Dim colspanLargeScreen As String = st.sGetAttribute(eleDef, "ColspanLargeScreen")
'Large:
If String.IsNullOrEmpty(colspanLargeScreen) Then
If Not String.IsNullOrEmpty(colspanMediumScreen) AndAlso colspanMediumScreen <> 0 Then
eleDef.SetAttribute("ColspanLargeScreen", eleDef.GetAttribute("ColspanMediumScreen"))
ElseIf Not String.IsNullOrEmpty(colspanSmallScreen) AndAlso colspanSmallScreen <> 0 Then
eleDef.SetAttribute("ColspanLargeScreen", eleDef.GetAttribute("СolspanSmallScreen"))
' ElseIf Not String.IsNullOrEmpty(colspanExtraSmallScreen) AndAlso colspanExtraSmallScreen <> 0 Then
' eleDef.SetAttribute("ColspanLargeScreen", eleDef.GetAttribute("СolspanExtraSmallScreen"))
End If
colspanLargeScreen = st.sGetAttribute(eleDef, "ColspanLargeScreen")
End If
'Medium
If String.IsNullOrEmpty(colspanMediumScreen) Then
If Not String.IsNullOrEmpty(colspanLargeScreen) AndAlso colspanLargeScreen <> "0" Then
eleDef.SetAttribute("ColspanMediumScreen", eleDef.GetAttribute("ColspanLargeScreen"))
colspanMediumScreen = st.sGetAttribute(eleDef, "ColspanMediumScreen")
End If
End If
'Small
If String.IsNullOrEmpty(colspanSmallScreen) Then
If Not String.IsNullOrEmpty(colspanMediumScreen) AndAlso colspanMediumScreen <> "0" Then
eleDef.SetAttribute("ColspanSmallScreen", eleDef.GetAttribute("ColspanMediumScreen"))
'colspanSmallScreen = st.sGetAttribute(eleDef, "ColspanSmallScreen")
End If
End If
End Sub
Private Function sProcess_ResponsiveColumn(ByRef eleDef As XmlElement) As String
Dim isExport As Boolean = http.Request("rdReportFormat") = "PDF"
Dim colspanExtraSmallScreen As String = st.sGetAttribute(eleDef, "ColspanExtraSmallScreen")
Dim colspanSmallScreen As String = st.sGetAttribute(eleDef, "ColspanSmallScreen")
Dim colspanMediumScreen As String = st.sGetAttribute(eleDef, "ColspanMediumScreen")
Dim colspanLargeScreen As String = st.sGetAttribute(eleDef, "ColspanLargeScreen")
Dim cssExtraSmallScreen As String = String.Empty
Dim cssSmallScreen As String = String.Empty
Dim cssMediumScreen As String = String.Empty
Dim cssLargeScreen As String = String.Empty
Dim isSizeSet As Boolean = False
#If JAVA Then
If colspanLargeScreen = "0" Then
cssLargeScreen = "hidden-lg"
ElseIf Not String.IsNullOrEmpty(colspanLargeScreen) Then
If isExport Then
cssLargeScreen = String.Format("col-lg-{0}-rd", colspanLargeScreen)
isSizeSet = True
Else
cssLargeScreen = String.Format("col-lg-{0}", colspanLargeScreen)
End If
End If
#Else
If colspanLargeScreen = "0" Then
cssLargeScreen = "hidden-lg"
ElseIf Not String.IsNullOrEmpty(colspanLargeScreen) Then
cssLargeScreen = String.Format("col-lg-{0}", colspanLargeScreen)
End If
#End If
If colspanMediumScreen = "0" Then
cssMediumScreen = "hidden-md"
#If JAVA Then
ElseIf Not String.IsNullOrEmpty(colspanMediumScreen) Then
If isExport Then
If Not isSizeSet Then
cssMediumScreen = String.Format("col-md-{0}-rd", colspanMediumScreen)
isSizeSet = True
End If
Else
cssMediumScreen = String.Format("col-md-{0}", colspanMediumScreen)
End If
End If
#Else
ElseIf Not String.IsNullOrEmpty(colspanMediumScreen) Then
cssMediumScreen = String.Format("col-md-{0}", colspanMediumScreen)
End If
#End If
' ElseIf cssLargeScreen <> "hidden-lg" Then
' cssMediumScreen = String.Format("col-md-{0}", cssLargeScreen.Substring(7))
If colspanSmallScreen = "0" Then
cssSmallScreen = "hidden-sm"
#If JAVA Then
ElseIf Not String.IsNullOrEmpty(colspanSmallScreen) Then
If isExport Then
If Not isSizeSet Then
cssSmallScreen = String.Format("col-sm-{0}-rd", colspanSmallScreen)
isSizeSet = True
End If
Else
cssSmallScreen = String.Format("col-sm-{0}", colspanSmallScreen)
End If
End If
#Else
ElseIf Not String.IsNullOrEmpty(colspanSmallScreen) Then
cssSmallScreen = String.Format("col-sm-{0}", colspanSmallScreen)
End If
#End If
If colspanExtraSmallScreen = "0" Then
cssExtraSmallScreen = "hidden-xs"
ElseIf Not String.IsNullOrEmpty(colspanExtraSmallScreen) Then
#If JAVA Then
If isExport Then
If Not isSizeSet Then
cssExtraSmallScreen = String.Format("col-xs-{0}-rd", colspanExtraSmallScreen)
isSizeSet = True
End If
Else
cssExtraSmallScreen = String.Format("col-xs-{0}", colspanExtraSmallScreen)
End If
End If
#Else
cssExtraSmallScreen = String.Format("col-xs-{0}", colspanExtraSmallScreen)
End If
#End If
Dim sRdIdeIdx As String = eleDef.GetAttribute("rdIdeIdx")
Dim sReturn As String = String.Format("
"
sReturn = sSetEventHandler(eleDef, sReturn) '#13993.
sReturn = sSetAction(eleDef, sReturn)
Return sReturn
End Function
Private Sub setResponsiveVisibilityGeneral(ByVal eleDef As XmlElement)
Dim listResponsiveVisibility As XmlNodeList = eleDef.SelectNodes(".//ResponsiveVisibility")
Dim listIgnoredElements As String() = New String() {"DataTableColumn"}
For Each ele As XmlElement In listResponsiveVisibility
If Array.IndexOf(listIgnoredElements, ele.ParentNode.Name) <> -1 Then
Continue For
End If
setResponsiveVisibility(ele.ParentNode)
Next
End Sub
Private Sub setResponsiveVisibility(ByVal eleDef As XmlElement)
Dim responsiveVisibility As XmlElement = eleDef.SelectSingleNode("ResponsiveVisibility")
If IsNothing(responsiveVisibility) Then
Return
End If
If eleDef.Name = "DataTableColumn" Then
If st.sGetAttribute(eleDef.ParentNode, "ResizableColumns") = "True" _
OrElse st.sGetAttribute(eleDef.ParentNode, "DraggableColumns") = "True" Then
Throw New Exception("Cannot use ResponsiveVisibility together with ResizeableColumns and DraggableColumns.")
End If
End If
Dim hideLargeScreen As Boolean = st.sGetAttribute(responsiveVisibility, "HideForLargeScreen") = "True"
Dim hideMediumScreen As Boolean = st.sGetAttribute(responsiveVisibility, "HideForMediumScreen") = "True"
Dim hideSmallScreen As Boolean = st.sGetAttribute(responsiveVisibility, "HideForSmallScreen") = "True"
Dim hideExtraSmallScreen As Boolean = st.sGetAttribute(responsiveVisibility, "HideForExtraSmallScreen") = "True"
'.visible-xs
'.visible-sm
'.visible-md
'.visible-lg
'.hidden-xs
'.hidden-sm
'.hidden-md
'.hidden -lg
Dim sClass As String = String.Empty
If hideLargeScreen Then
sClass &= " hidden-lg"
End If
If hideMediumScreen Then
sClass &= " hidden-md"
End If
If hideSmallScreen Then
sClass &= " hidden-sm"
End If
If hideExtraSmallScreen Then
sClass &= " hidden-xs"
End If
If Not String.IsNullOrEmpty(sClass) Then
eleDef.SetAttribute("Class", st.sGetAttribute(eleDef, "Class") + sClass)
'For DataTableColumn only.
If eleDef.Name = "DataTableColumn" Then
If String.IsNullOrEmpty(st.sGetAttribute(eleDef, "ColumnHeaderClass")) Then
'No class for the column. Possibly get the header class from the parent DataTable.
If Not String.IsNullOrEmpty(st.sGetAttribute(eleDef.ParentNode, "ColumnHeaderClass")) Then
eleDef.SetAttribute("ColumnHeaderClass", st.sGetAttribute(eleDef.ParentNode, "ColumnHeaderClass"))
End If
End If
eleDef.SetAttribute("ColumnHeaderClass", st.sGetAttribute(eleDef, "ColumnHeaderClass") & sClass)
End If
End If
End Sub
Private Function sProcess_RefreshElementTimer(ByRef eleDef As XmlElement) As String
If st.sGetRequestVar("rdAjaxCommand") = "RefreshElement" Then
'With the javascript that's added below, we can't do this for RefreshElement commands.
'The javascript is invalid XML, and wouldn't be executed anyway.
Return Nothing
End If
If bExportReport() Then '17930
Return Nothing
End If
Dim sID As String = eleDef.GetAttribute("ID")
If sID.Length = 0 Then _
Throw New Exception("ID cannot be blank for RefreshElementTimer.")
Dim sElementIDs As String = sGetAndValidateElementIDs(eleDef)
If sElementIDs.Length = 0 Then _
Throw New Exception("ElementID cannot be blank for RefreshElementTimer.")
Dim sLinkParams As String = ""
Dim eleLinkParams As XmlElement
Dim atrLinkParams As XmlAttribute
Dim nlLinkParams As XmlNodeList = eleDef.SelectNodes("LinkParams")
For Each eleLinkParams In nlLinkParams
For Each atrLinkParams In eleLinkParams.Attributes
sLinkParams &= String.Format("&{0}={1}", atrLinkParams.Name, util.SimpleDoubleUrlEncode(atrLinkParams.Value).Replace("'", "\'"))
Next
'eleAction.RemoveChild(eleLinkParams)
Next
'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.SimpleUrlEncode(sShowModes)
'RequestForwarding
If eleDef.GetAttribute("RequestForwarding") = "True" Then _
sLinkParams &= "&rdRequestForwarding=Form"
Dim sInterval As String = eleDef.GetAttribute("RefreshInterval")
If sInterval.Length = 0 Then _
Throw New Exception("RefreshInterval cannot be blank for RefreshElementTimer.")
Dim sFunctionName As String = "rdRefreshElementTimer_" & sID
Dim sSetTimeout As String = "setTimeout('" & sFunctionName & "()',nInterval_" & sID & " * 1000);"
Dim sJScript As String = ""
If eleDef.GetAttribute("animatedChartRealTimeData") = "True" Then ' for real time animated charts, the ajax command is different.
sJScript &= String.Format("var nInterval_{0} = parseInt('{1}'){2}", sID, sInterval, vbCrLf)
sJScript &= String.Format("if (nInterval_{0} > 0) {{{1}}}", sID, sSetTimeout)
'sJScript &= "else {alert('Invalid RefreshElementTimer RefreshInterval.')}" 'This is the first call to get things started."
sJScript &= String.Format("function {0}(){1}", sFunctionName, vbCrLf)
sJScript &= String.Format(" {{if(typeof rdModalShade=='undefined'){{rdAjaxRequestWithFormVars(""rdAjaxCommand=RequestRealTimeAnimatedChartData&rdRET=True&rdRefreshElementID={0}{1}"");}}{2}", sElementIDs, sLinkParams, vbCrLf) '16442 adds rdRET
sJScript &= sSetTimeout & vbCrLf 'This is called when there's a timeout
sJScript &= "}" & vbCrLf
Else
sJScript &= String.Format("var nInterval_{0} = parseInt('{1}'){2}", sID, sInterval, vbCrLf)
sJScript &= String.Format("if (nInterval_{0} > 0) {{{1}}}", sID, sSetTimeout)
'sJScript &= "else {alert('Invalid RefreshElementTimer RefreshInterval.')}" 'This is the first call to get things started."
sJScript &= String.Format("function {0}(){1}", sFunctionName, vbCrLf)
sJScript &= String.Format(" {{if(typeof rdModalShade=='undefined'){{rdAjaxRequestWithFormVars(""rdAjaxCommand=RefreshElement&rdRET=True&rdRefreshElementID={0}{1}"");}}{2}", sElementIDs, sLinkParams, vbCrLf) '16442 adds rdRET
sJScript &= sSetTimeout & vbCrLf 'This is called when there's a timeout
sJScript &= "}" & vbCrLf
'Checking for the presence of rdModalShade (above) disables the Ajax refresh when there is a modal PopupPanel displayed. #6723
End If
sJScript = ""
mbAddAjaxSupport = True
Return sJScript
End Function
Private Function sProcess_Report(ByRef eleDef As XmlElement) As String
If eleDef.Name = "MobileReport" Then _
lgxLicense10.LicenseCheck(eleDef)
'16847 - Embedded reports - include required javascript
If Not String.IsNullOrEmpty(st.sGetRequestVar("rdembedded")) Then
HttpContext.Current.Session("rdIsEmbeddedReport") = True
End If
Dim sReturn As String = Nothing
sReturn &= "" & CrLf
sReturn = sSetClass(eleDef, sReturn)
sReturn &= "" & CrLf
'If http.Request("rdReportFormat") = "PDF" Then
'sReturn &= msPopupJScript
sReturn &= "" & CrLf & clearVarString
sReturn = "" & sReturn & "" 'Process the one document-level element.
Return sReturn
End Function
Private Function sProcess_MetaNames(ByRef eleDef As XmlElement) As String
Dim sName As String
sName = st.sGetAttribute(eleDef, "MetaKeywords")
If sName.Length <> 0 Then _
sbHead.Append("")
sName = st.sGetAttribute(eleDef, "MetaDescription")
If sName.Length <> 0 Then _
sbHead.Append("")
sName = st.sGetAttribute(eleDef, "MetaRobots")
If sName.Length <> 0 Then _
sbHead.Append("")
'sName = st.sGetAttribute(eleDef, "MetaViewport")
'If sName.Length <> 0 Then _
' sbHead.Append("")
sName = st.sGetAttribute(eleDef, "MetaGenerator")
If sName.Length = 0 Then sName = "LGXReporting"
sbHead.Append("")
sName = st.sGetAttribute(eleDef, "Refresh")
If sName.Length <> 0 Then _
sbHead.Append("")
Return ""
End Function
Private Function sProcess_AnalysisChart(ByRef eleDef As XmlElement) As String
needLocalization = True
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("rdNotifyCommand") = "SetElementSize" Then '#23024.
Return String.Empty
End If
'23579 this is inside the wizard, so set the session (request variable will be cleared when user switches to other chart eg. Bar chart)
' and clear the resizer session, so that it looks appropriate when user goes next, then previous.
If st.sGetRequestVar("rdForWizard") = "True" Then
HttpContext.Current.Session("rdForWizard") = "True"
HttpContext.Current.Session.Remove("rdResizer__rdAcChart_" & eleDef.GetAttribute("ID"))
End If
'If Me.isAjaxRequest _
' AndAlso Not st.sGetRequestVar("rdAcRefresh") = "True" _
' AndAlso String.IsNullOrEmpty(st.sGetRequestVar("rdReportAuthorAction")) Then _
' Throw New Exception("The element """ & eleDef.Name & """ does not work with Action.RefreshElement.")
dbug.AddDebugMessage("AnalysisChart", "Generate Definition")
'23824
'Call subAddIncludedScript("rdActionShowElement.js")
'Call subAddIncludedScript("rdAnalysisChart/rdAcScript.js")
Dim ac As New rdAnalysisChart(Me, xmlSettings)
Dim eleAg As XmlElement = ac.BuildAnalysisChart(eleDef)
If dbug.DebuggingEnabled Then _
dbug.AddDebugMessage(, "Generated AnalysisChart", "View Definition", eleAg)
plugin.CallPlugins_GeneratedElement(eleAg, eleDef) '14254 - Call Plugins from more places - ElementPluginCall
'Please the AGs css so that it goes before the developer's css.
'This makes the developer's css take precedence.
Call subAddIncludedCss("rdColumnColorStyle.css")
Call subAddIncludedCss("rdAnalysisChart/rdAcStyle.css")
Return sProcessDefinitionElement(eleAg)
End Function
Private Function sProcess_AnalysisFilter(ByRef eleDef As XmlElement) As String
needLocalization = True
lgxLicense10.LicenseCheck(eleDef)
'If Me.isAjaxRequest _
' AndAlso st.sGetRequestVar("rdAfCommand") = "" _
' AndAlso String.IsNullOrEmpty(st.sGetRequestVar("rdReportAuthorAction")) Then _
' Throw New Exception("The element """ & eleDef.Name & """ does not work with Action.RefreshElement.")
dbug.AddDebugMessage("AnalysisFilter", "Generate Definition")
Dim af As New rdAnalysisFilter(Me, xmlSettings)
Dim eleAg As XmlElement = af.BuildAnalysisFilter(eleDef)
If dbug.DebuggingEnabled Then _
dbug.AddDebugMessage(, "Generated AnalysisFilter", "View Definition", eleAg)
plugin.CallPlugins_GeneratedElement(eleAg, eleDef) '14254 - Call Plugins from more places - ElementPluginCall
'Please the AGs css so that it goes before the developer's css.
'This makes the developer's css take precedence.
'Call subAddIncludedCss("rdAnalysisFilter/rdAfStyle.css") Using the AnalysisChart CSS, keeping it the same.
Call subAddIncludedCss("rdAnalysisGrid/rdAg10Style.css")
Call subAddIncludedCss("rdColumnColorStyle.css")
Return sProcessDefinitionElement(eleAg)
End Function
Private Function sProcess_AnalysisGrid(ByRef eleDef As XmlElement) As String
lgxLicense10.LicenseCheck(eleDef)
'23644 this is inside the wizard, so set the session (gets cleared when clicking on buttons like column, formula etc)
If st.sGetRequestVar("rdForWizard") = "True" Then
HttpContext.Current.Session("rdForWizard") = "True"
End If
If eleDef.OwnerDocument.SelectNodes("//AnalysisGrid").Count > 1 Then _
Throw New Exception("There is only one AnalysisGrid element allowed for a single report definition.")
dbug.AddDebugMessage("AnalysisGrid", "Generate Definition")
Dim ag As New rdAnalysisGrid10(Me, xmlSettings, st)
Dim eleAg As XmlElement = ag.BuildAnalysisGrid(eleDef)
Call subRemoveElementsFromExport(eleAg) '13916
If dbug.DebuggingEnabled Then _
dbug.AddDebugMessage("AnalysisGrid", "Generated AnalysisGrid", "View Definition", eleAg)
plugin.CallPlugins_GeneratedElement(eleAg, eleDef) '14254 - Call Plugins from more places - ElementPluginCall
subAddIncludedCss("rdAnalysisGrid/rdAg10Style.css")
subAddIncludedCss("rdColumnColorStyle.css")
Return sProcessDefinitionElementChildren(eleAg)
End Function
Private Function sProcess_AnalysisFilterDistinctValues(ByVal eleDef As XmlElement) As String
'This special element is for showing a distinct list of values for the AnalysisGrid when using DataLayer.ActiveSql.
mbDontCacheXsl = True
If Not IsNothing(http.Session("rdAfPickDistinctTheme")) Then
Dim eleStyle As XmlElement = eleDef.OwnerDocument.SelectSingleNode("Report/StyleSheet")
If Not IsNothing(eleStyle) Then
eleStyle.SetAttribute("Theme", http.Session("rdAfPickDistinctTheme"))
End If
End If
Dim sAfId As String = st.sGetRequestVar("rdAnalysisFilterID")
Dim sDataType As String = st.sGetRequestVar("rdAfColumnDataType")
Dim sDataColumnID As String = st.sGetRequestVar("rdAfDataColumn")
Dim sOperator As String = st.sGetRequestVar("rdAfFilterOperator")
If sOperator.Contains("List") Then 'For "In List" and "Not In List"
'Remove the single item picking DataTable.
Dim eleRemove As XmlElement = eleDef.SelectSingleNode("//DataTable")
If Not IsNothing(eleRemove) Then _
eleRemove.ParentNode.RemoveChild(eleRemove)
Dim eleFormattedColumn As XmlElement = eleDef.SelectSingleNode("..//InputCheckboxList/DataLayer/FormattedColumn")
Dim eleCalculatedColumn As XmlElement = eleDef.SelectSingleNode("..//InputCheckboxList/DataLayer/CalculatedColumn")
If sDataType = "Number" OrElse String.IsNullOrEmpty(st.sReplaceTokens(eleFormattedColumn.GetAttribute("Format"))) Then
eleFormattedColumn.ParentNode.RemoveChild(eleFormattedColumn)
Else
eleCalculatedColumn.ParentNode.RemoveChild(eleCalculatedColumn)
End If
Else
'Remove the multi-selection checkbox list.
Dim eleRemove As XmlElement = eleDef.SelectSingleNode("//InputCheckboxList")
If Not IsNothing(eleRemove) Then _
eleRemove.ParentNode.RemoveChild(eleRemove)
'Single selection from the DataTable
Dim eleLabel As XmlElement = eleDef.OwnerDocument.DocumentElement.SelectSingleNode("//Label[@ID='lblFilter']")
eleLabel.SetAttribute("Caption", "@Data." & sDataColumnID & "~")
If sDataType = "Number" Then
eleLabel.RemoveAttribute("Format")
End If
End If
Dim eleDataLayer As XmlElement = eleDef.SelectSingleNode("..//DataLayer")
'Get the cached DataLayer definition.
Dim sCacheFilename As String = HttpContext.Current.Session("rdDataCacheLocation") & "/rdAfPickDistinct_" & HttpContext.Current.Session.SessionID & "_" & sAfId & ".lgx"
Dim xmlDataLayerDef As New XmlDocument
xmlDataLayerDef.Load(sCacheFilename)
If xmlDataLayerDef.DocumentElement.GetAttribute("Type") = "ActiveSQL" Then
'If there's an Empty DataLayer, remove it so it doesn't get in the way below.
Dim eleEmpty As XmlElement = xmlDataLayerDef.DocumentElement.SelectSingleNode("DataLayer[@Type='EmptyDataLayer']")
If Not IsNothing(eleEmpty) Then _
xmlDataLayerDef.DocumentElement.RemoveChild(eleEmpty)
'Get rid of the extra SqlColumns. This can help response time some.
Dim eleSqlColumnRemove As XmlElement = xmlDataLayerDef.SelectSingleNode("//SqlColumn")
Dim eleSqlColumnKeep As XmlElement = Nothing
Dim eleSqlColumnKeepParent As XmlElement = Nothing
Do While Not IsNothing(eleSqlColumnRemove)
If eleSqlColumnRemove.GetAttribute("ID") = sDataColumnID Then
eleSqlColumnKeepParent = eleSqlColumnRemove.ParentNode
eleSqlColumnKeep = eleSqlColumnRemove.ParentNode.RemoveChild(eleSqlColumnRemove)
Else
eleSqlColumnRemove.ParentNode.RemoveChild(eleSqlColumnRemove)
End If
eleSqlColumnRemove = xmlDataLayerDef.SelectSingleNode("//SqlColumn")
Loop
If IsNothing(eleSqlColumnKeep) Then
'The filter column was not in the original query. Make a new SqlColumn.
'Find the element (DataLayer or SqlJoin) which gets the single new SqlColumn.
For Each eleQuery As XmlElement In xmlDataLayerDef.DocumentElement.SelectNodes(". | //SqlQuery")
Dim sTableIDPrefix As String = eleQuery.GetAttribute("QueryBuilderTableID") & "_"
If sDataColumnID.StartsWith(sTableIDPrefix) Then
eleSqlColumnKeepParent = eleQuery
eleSqlColumnKeep = xmlDataLayerDef.CreateElement("SqlColumn")
eleSqlColumnKeep.SetAttribute("ID", sDataColumnID)
eleSqlColumnKeep.SetAttribute("DataColumn", sDataColumnID.Substring(sTableIDPrefix.Length))
End If
Next
End If
If Not IsNothing(eleSqlColumnKeep) Then
eleSqlColumnKeepParent.PrependChild(eleSqlColumnKeep)
End If
eleDataLayer.SetAttribute("Type", "ActiveSQL")
rdAnalysisGrid10.ConvertDataLayerToActiveSQL(eleDataLayer)
End If
'Insert the cached DataLayer definition into the location of the DataLayer template.
'Remove DataLayer's AnalysisFilterInsert and all children after that. These should be grouping or other children not necessary to build the distinct list.
Dim eleRemoveChild As XmlElement = xmlDataLayerDef.SelectSingleNode(".//AnalysisFilterInsert")
Do Until IsNothing(eleRemoveChild)
Dim eleNextRemove As XmlElement = eleRemoveChild.NextSibling
eleRemoveChild.ParentNode.RemoveChild(eleRemoveChild)
eleRemoveChild = eleNextRemove
Loop
Dim eleDataLayerDef As XmlElement = eleDef.OwnerDocument.ImportNode(xmlDataLayerDef.DocumentElement, True)
eleDataLayer.ParentNode.InsertAfter(eleDataLayerDef, eleDataLayer)
eleDataLayer.ParentNode.RemoveChild(eleDataLayer)
'Copy the child elements of the template DataLayer into the inserted DataLayer.
For Each eleChild As XmlElement In eleDataLayer.SelectNodes("*")
eleDataLayerDef.AppendChild(eleChild.CloneNode(True))
Next
dbug.AddDebugMessage(, "Generated Distinct Values List", "View Definition", eleDef.OwnerDocument)
Return Nothing
End Function
Private Function sProcess_DashboardEditAgViz(ByVal eleEditAgViz As XmlElement) As String
'This special element is for showing a frame allowing editing if AG-derived visualizations.
mbDontCacheXsl = True
Dim rdDashboardEdit As New rdDashboardEditAgViz(xmlSettings.DocumentElement, st, dbug)
Call rdDashboardEdit.GenerateVizualizationEditor(eleEditAgViz)
dbug.AddDebugMessage(, "Generated Visualization Editor", "View Definition", eleEditAgViz)
Return sProcessDefinitionElementChildren(eleEditAgViz)
End Function
Private Sub subAnalysisGridFormatActiveSqlError()
If IsNothing(http.Session("rdActiveSqlErrorMsg")) Then
If http.Session("rdActiveSqlError") IsNot Nothing Then
http.Session.Remove("rdActiveSqlError")
End If
Exit Sub
End If
If IsNothing(HttpContext.Current.Items("rdIsAgRequest")) Then
'If Not st.sGetRequestVar("rdAgCommand").StartsWith("Calc") AndAlso Not st.sGetRequestVar("rdAgCommand").StartsWith("Filter") Then
'Throw this error to the developer.
Dim sErrorMsg As String = http.Session("rdActiveSqlErrorMsg")
http.Session.Remove("rdActiveSqlErrorMsg") 'Prevent infinate display of this message within the current the session.
'Throw New Exception("There is an error in the ActiveSQL Source. " & sErrorMsg)
dbug.AddDebugMessage(, "** WARNING ** ActiveSql SQL Error", sErrorMsg)
Return
End If
'Display "nice" messages for the user that just added a bad formula or filter.
Dim s As String = http.Session("rdActiveSqlErrorMsg")
If s.StartsWith("ORA-") AndAlso s.Contains(": ") Then
'Something like "ORA-01476: divisor is equal to zero". Remove the ORA part.
s = s.Substring(s.IndexOf(": ") + 2)
End If
'Capitalize the first character.
s = s.Substring(0, 1).ToUpper & s.Substring(1)
'Replace double quotes with single quotes so that scripting in rdAgTemplate does not break.
s = s.Replace("""", "'")
dbug.AddDebugMessage("***WARNING***", "Invalid ActiveSql Query", s)
http.Session("rdActiveSqlErrorMsg") = s
http.Session("rdActiveSqlError") = "true" 'This sets a Condition which shows the rdActiveSqlErrorMsg.
End Sub
Private Function sProcess_SavedQueryBuilder(ByRef eleDef As XmlElement) As String
'Don't do anything with this element.
Return ""
End Function
Private Function sProcess_Schedule(ByRef eleDef As XmlElement) As String
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 bUnderDataRepeater(eleDef) Then _
Throw New Exception("Schedule elements cannot go under a DataTable or other element with a DataLayer.")
dbug.AddDebugMessage("Schedule", "Generate Definition")
'23824
'Call subAddIncludedScript("rdActionShowElement.js")
Call subAddIncludedScript("rdSchedule/rdScheduleScript.js")
'23824
'Call subAddIncludedScript("rdCalendar/CalendarPopup.js")
mbAddAjaxSupport = True
Dim sch As New rdSchedule(Me, xmlSettings)
Dim eleSch As XmlElement = sch.BuildSchedule(eleDef)
If dbug.DebuggingEnabled Then _
dbug.AddDebugMessage(, "Generated Schedule", "View Definition", eleSch)
plugin.CallPlugins_GeneratedElement(eleSch, eleDef) '14254 - Call Plugins from more places - ElementPluginCall
'sbHead.Insert(sbHead.ToString.IndexOf("") + 8, "")
subAddIncludedCss("rdSchedule/rdScheduleStyle.css")
Dim sReturn As String = sProcessDefinitionElement(eleSch)
'20370 - Need to force the new label to be hidden on first run.
sReturn = sReturn.Insert(sReturn.IndexOf("lblSchRunOn") - 4, "Style='display: none;' ")
Return sReturn
End Function
Private Function sProcess_Body(ByRef eleDef As XmlElement) As String
Dim sReturn As String = Nothing
Const idAttributeName As String = "ID"
Dim chartCanvases As XmlNodeList = eleDef.SelectNodes("ChartCanvas | Gauge[@Type='Angular' or @Type='BalloonBar' or @Type='BulletBar' or @Type='Arc']")
Dim canvasIds As Dictionary(Of String, Integer) = New Dictionary(Of String, Integer)()
Const suffix As String = "Serie_"
Dim index As Integer
For Each chartCanvas As XmlNode In chartCanvases
If (IsNothing(chartCanvas.Attributes(idAttributeName))) Then
Dim idAttribute As XmlAttribute = chartCanvas.OwnerDocument.CreateAttribute(idAttributeName)
idAttribute.Value = suffix & index
index += 1
chartCanvas.Attributes.Append(idAttribute)
If (Not canvasIds.ContainsKey(suffix)) Then
canvasIds.Add(suffix, index)
Else
canvasIds(suffix) = index
End If
Else
Dim id As String = chartCanvas.Attributes(idAttributeName).Value
If (canvasIds.ContainsKey(id)) Then
Dim chartId As Integer = canvasIds(id)
chartId += 1
chartCanvas.Attributes(idAttributeName).Value = id & chartId
Else
canvasIds.Add(id, 0)
End If
End If
Next
sReturn = sReturn & sProcessDefinitionElementChildren(eleDef) 'Children may include validation elements.
If sGetPagingMethod() = "Printable" Then
' ''With Printable Paging, we only process the ReportHeader, ReportFooter, and the first DataTable of the Body.
' ''Remove all other child elements from the Body, keeping only the first DatatTable.
''Dim eleDataTable As XmlElement = eleDef.SelectSingleNode("//*/DataTable")
''If IsNothing(eleDataTable) Then _
'' Throw New Exception( "For Printable Paging, there must be a DataTable element.")
''eleDef.RemoveAll()
''eleDef.AppendChild(eleDataTable)
' ''Setup dynamic paging by IE.
''Dim elePrintablePaging As XmlElement
''elePrintablePaging = eleDataTable.SelectSingleNode("PrintablePaging")
''If IsNothing(elePrintablePaging) Then _
'' Throw New Exception( "For Printable Paging, there must be a DataTable with a PrintablePaging element.")
'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.
'sbHead.Append("")
'If Not IsNothing(elePrintablePaging) Then
' Call subAddIncludedScript("rdPrintablePageBreaks.js")
' Call subAddJavaEventFunction("rdBodyLoad", _
' "DoPrintablePageBreaks('" & eleDataTable.GetAttribute("ID") & "','" & elePrintablePaging.GetAttribute("PageHeight") & "','" & elePrintablePaging.GetAttribute("ShowPrintDialog") & "')")
' '"DoPrintablePageBreaks('" & eleDef.GetAttribute("ID") & "','" & elePrintablePaging.GetAttribute("PageHeight") & "','" & elePrintablePaging.GetAttribute("ShowPrintDialog") & "')")
'End If
End If
If Not IsNothing(HttpContext.Current.Items("rdIsWidgetRequest")) Then
'May need to get the ConditionalClass element from the top-level Widget element. Otherwise it will get stripped out in rdWidget.BuildResponse().
Dim eleWidgetConditionalClass As XmlElement = eleDef.ParentNode.SelectSingleNode("ConditionalClass")
If Not IsNothing(eleWidgetConditionalClass) Then
eleDef.AppendChild(eleWidgetConditionalClass.CloneNode(True))
End If
End If
Dim sWrapper As String = ""
sWrapper = sSetID(eleDef, sWrapper)
sWrapper = sSetClass(eleDef, sWrapper)
sWrapper = sSetPositioning(eleDef, sWrapper)
Dim sMainBodyStart As String = ""
Dim sMainBodyEnd As String = ""
If sWrapper.Length = 6 _
AndAlso http.Application("rdConstant-rdMinimizeSpans") <> "False" Then
sReturn = "
" & sReturn & "
"
Else
sReturn = "
" & sWrapper & sReturn & "
"
End If
sReturn = sMainBodyStart & sReturn & sMainBodyEnd
Return sReturn
End Function
Private Function sProcess_Bullet(ByRef eleDef As XmlElement) As String
Dim sReturn As String = Nothing
sReturn = ""
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 = "" & CrLf
sReturn &= sSetTooltipPanel(eleDef) '#13993.
sReturn = sSetID(eleDef, sReturn, , SET_NAME_TOO)
sReturn = sSetClass(eleDef, sReturn)
sReturn = sSetEventHandler(eleDef, sReturn)
sReturn = sSetAction(eleDef, sReturn)
sReturn = sSetPositioning(eleDef, sReturn) '#6904, sSetPositioning after sSetAction.
sReturn = sSetQuicktip(eleDef, sReturn)
Return sReturn
End Function
Private Function sProcess_Division(ByRef eleDef As XmlElement) As String
Dim sReturn As String = Nothing
If eleDef.HasAttribute("sReturn") Then
Return eleDef.GetAttribute("sReturn")
End If
If eleDef.Name <> "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 & "" & sTagName & ">"
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 & "" & sTagName & ">"
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
'
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 & "" & sHTMLTag & ">" '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 = "
"
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 = "
"
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, "
", 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("
", "")
' 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, "
"
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("
", 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(" 0 Then
eleHidden.SetAttribute("ID", sSlider2ID)
eleHidden.SetAttribute("DefaultValue", eleDef.GetAttribute("SecondDefaultValue"))
sHiddenHtml &= sProcessDefinitionElement(eleHidden).Insert(sHiddenHtml.IndexOf("", sHiddenHtml)
Dim eleStyleSheet As XmlElement = eleDef.OwnerDocument.CreateElement("StyleSheet")
eleStyleSheet.SetAttribute("StyleSheet", "rdTemplate/rdInputSlider/rdInputSliderStyle.css")
eleStyleSheet.SetAttribute("InsertFirst", "True")
sSliderHtml &= sProcessDefinitionElement(eleStyleSheet)
Return sSliderHtml
End Function
Private Function sProcess_CellColorSlider( _
ByRef eleCellColorSlider As XmlElement, _
ByVal eleDataTable As XmlElement, _
ByVal eleDataTableColumn As XmlElement, _
ByRef sColHeader As String) As String
If bExportPdf() OrElse bExportNativeWord() Then _
Return "" 'CellColorSlider doesn't work with these exports.
Dim sDataColumn As String = st.sGetAttribute(eleCellColorSlider, "DataColumn")
If sDataColumn.Length = 0 Then _
Throw New Exception("CellColorSlider elements must have a DataColumn attribute.")
Dim nWidth As Integer = Val(st.sGetAttribute(eleCellColorSlider, "Width", "60"))
Dim nHeight As Integer = Val(st.sGetAttribute(eleCellColorSlider, "Height", "6"))
Dim sColorLow As String = st.sGetAttribute(eleCellColorSlider, "LowValueColor", "red")
Dim sColorMed As String = st.sGetAttribute(eleCellColorSlider, "MediumValueColor", "yellow")
Dim sColorHi As String = st.sGetAttribute(eleCellColorSlider, "HighValueColor", "green")
sColorLow = HexStringFromColor(Color.FromArgb(GetColorFromString(sColorLow)))
sColorMed = HexStringFromColor(Color.FromArgb(GetColorFromString(sColorMed)))
sColorHi = HexStringFromColor(Color.FromArgb(GetColorFromString(sColorHi)))
Dim sForegroundBlackAndWhite As String = IIf(st.sGetAttribute(eleCellColorSlider, "ForegroundBlackAndWhite", "False") = "True", "true", "false")
Dim sIndicatorTooltip As String = eleCellColorSlider.GetAttribute("IndicatorTooltip")
Dim sSliderTooltip As String = eleCellColorSlider.GetAttribute("SliderTooltip")
Dim sClass As String = eleCellColorSlider.GetAttribute("Class")
'Add a PercentOfSpread element under the DataLayer.
Dim sPercentOfSpreadId As String = "rdCellValue_" & eleCellColorSlider.GetAttribute("ID") & "_" & eleDataTableColumn.GetAttribute("ID") & "ccSlider" '15115,15156.
Dim eleDataLayer As XmlElement = eleDataTable.SelectSingleNode("DataLayer")
Dim elePercentOfSpread As XmlElement = eleDataLayer.AppendChild(eleDataTable.OwnerDocument.CreateElement("PercentOfSpreadColumn"))
elePercentOfSpread.SetAttribute("DataColumn", sDataColumn)
elePercentOfSpread.SetAttribute("ID", sPercentOfSpreadId)
If eleCellColorSlider.HasAttribute("MinValue") Then
elePercentOfSpread.SetAttribute("MinValue", eleCellColorSlider.GetAttribute("MinValue"))
elePercentOfSpread.SetAttribute("MaxValue", eleCellColorSlider.GetAttribute("MaxValue"))
End If
'Add the PercentOfSpread values to the DataTable cells with a Label element with HTML formatting.
'We end up with this: SomeValue?
Dim eleHiddenDiv As XmlElement = eleDataTableColumn.AppendChild(eleDataTable.OwnerDocument.CreateElement("Division"))
eleHiddenDiv.SetAttribute("ShowModes", "None")
Dim eleHiddenLabel As XmlElement = eleHiddenDiv.AppendChild(eleDataTable.OwnerDocument.CreateElement("Label"))
eleHiddenLabel.SetAttribute("ID", sPercentOfSpreadId)
eleHiddenLabel.SetAttribute("Format", "HTML")
eleHiddenLabel.SetAttribute("Caption", "")
Dim sSliderID As String = ""
Dim sSpectrum1ID As String = ""
Dim sSpectrum2ID As String = ""
If eleCellColorSlider.GetAttribute("ShowSlider") <> "False" Then
'Add to the slider Column Header.
Dim eleSliderHeader As XmlElement = eleDataTable.OwnerDocument.CreateElement("ExtraColumnHeader")
eleSliderHeader.SetAttribute("ID", "rdCellColorSlider_" & st.sGetAttribute(eleDataTableColumn, "ID"))
eleSliderHeader.AppendChild(eleDataTable.OwnerDocument.CreateElement("LineBreak"))
'Prevent the two spectrum images from wrapping each other.
Dim eleDiv As XmlElement = eleSliderHeader.AppendChild(eleDataTable.OwnerDocument.CreateElement("Division"))
eleDiv.SetAttribute("Style", "white-space: nowrap;")
'Make the Slider image.
sSliderID = sPercentOfSpreadId.Replace("rdCellValue_", "rdCellColorSlider_")
Dim eleSlider As XmlElement = eleSliderHeader.AppendChild(eleDataTable.OwnerDocument.CreateElement("Image"))
eleSlider.SetAttribute("ID", sSliderID)
eleSlider.SetAttribute("Caption", "rdTemplate/rdCellColorSlider/rdCellColorSlider.png")
If sSliderTooltip.Length <> 0 Then _
eleSlider.SetAttribute("Tooltip", sSliderTooltip)
eleSlider.SetAttribute("Height", nHeight + 4) 'Sets the image to its stock height of 10.
'Make the Spectrum images. There are two so they can be streched and shrunk as the slider moves.
sSpectrum1ID = sPercentOfSpreadId.Replace("rdCellValue_", "rdColorSpectrum1_")
sSpectrum2ID = sPercentOfSpreadId.Replace("rdCellValue_", "rdColorSpectrum2_")
Dim eleSpectrum As XmlElement
eleSpectrum = eleDiv.AppendChild(eleDataTable.OwnerDocument.CreateElement("Image"))
eleSpectrum.SetAttribute("ID", sSpectrum1ID)
eleSpectrum.SetAttribute("Caption", sMakeCellColorSpectrumImage(sColorLow, sColorMed, 50))
eleSpectrum.SetAttribute("Width", nWidth / 2)
eleSpectrum.SetAttribute("Height", nHeight)
If sSliderTooltip.Length <> 0 Then _
eleSpectrum.SetAttribute("Tooltip", sSliderTooltip)
eleSpectrum = eleDiv.AppendChild(eleDataTable.OwnerDocument.CreateElement("Image"))
eleSpectrum.SetAttribute("ID", sSpectrum2ID)
eleSpectrum.SetAttribute("Caption", sMakeCellColorSpectrumImage(sColorMed, sColorHi, 50))
eleSpectrum.SetAttribute("Width", nWidth / 2)
eleSpectrum.SetAttribute("Height", nHeight)
If sSliderTooltip.Length <> 0 Then _
eleSpectrum.SetAttribute("Tooltip", sSliderTooltip)
'Process the CellColorSlider header.
eleSliderHeader.SetAttribute("ProcessExtraColumnHeader", "T")
sColHeader &= sProcessDefinitionElement(eleSliderHeader)
eleSliderHeader.RemoveAttribute("ProcessExtraColumnHeader")
End If
'Set the display character, if there is one.
Dim sColorAttribute As String = "foreground"
Dim eleIndicatorLabel As XmlElement = Nothing
Select Case st.sGetAttribute(eleCellColorSlider, "ColorIndicator", "Background")
Case "Circle"
eleIndicatorLabel = eleDataTableColumn.InsertAfter(eleDataTable.OwnerDocument.CreateElement("Label"), eleCellColorSlider)
eleIndicatorLabel.SetAttribute("Caption", "n")
Case "Square"
eleIndicatorLabel = eleDataTableColumn.InsertAfter(eleDataTable.OwnerDocument.CreateElement("Label"), eleCellColorSlider)
eleIndicatorLabel.SetAttribute("Caption", "g")
eleIndicatorLabel.SetAttribute("Format", "HTML")
Case Else 'Background
sColorAttribute = "background"
End Select
If Not IsNothing(eleIndicatorLabel) Then
eleIndicatorLabel.SetAttribute("Format", "HTML")
If sIndicatorTooltip.Length <> 0 Then _
eleIndicatorLabel.SetAttribute("Tooltip", sIndicatorTooltip)
If sClass.Length <> 0 Then _
eleIndicatorLabel.SetAttribute("Class", sClass)
'Is there an Action element?
Dim eleAction As XmlElement = eleCellColorSlider.SelectSingleNode("Action")
If Not IsNothing(eleAction) Then _
eleIndicatorLabel.AppendChild(eleAction.CloneNode(True))
End If
If eleCellColorSlider.GetAttribute("ShowSlider") <> "False" Then
subAddJavaEventFunction("rdBodyResize", "rdRepositionSliders();")
End If
'Slider DHTML scripting.
Dim sliderConfig As String = "id : '" & sSliderID & "'," _
& "spectrum1ID: '" & sSpectrum1ID & "'," _
& "spectrum2ID: '" & sSpectrum2ID & "'," _
& "rankColumnID: '" & sPercentOfSpreadId & "'," _
& "colorLow: '" & sColorLow & "'," _
& "colorMedium: '" & sColorMed & "'," _
& "colorHigh: '" & sColorHi & "'," _
& "colorAttribute: '" & sColorAttribute & "'," _
& "isForegroundBlackAndWhite: " & sForegroundBlackAndWhite
subAddYUIInitializer("'cell-color-slider'", "LogiXML.CellColorSlider = new Y.LogiInfo.CellColorSlider({ " & sliderConfig & "});")
End Function
Private Sub subProcess_CellBar( _
ByRef eleCellBar As XmlElement, _
ByVal eleDataTable As XmlElement, _
ByVal eleDataTableColumn As XmlElement)
Dim sDataColumn As String = st.sGetAttribute(eleCellBar, "DataColumn")
If sDataColumn.Length = 0 Then _
Throw New Exception("CellBar elements must have a DataColumn attribute.")
Dim nWidth As Integer = Val(st.sGetAttribute(eleCellBar, "Width", "60"))
Dim nHeight As Integer = Val(st.sGetAttribute(eleCellBar, "Height", "10"))
Dim sBarTooltip As String = eleCellBar.GetAttribute("Tooltip")
Dim sBarAltText As String = eleCellBar.GetAttribute("AltText")
Dim sColor As String = st.sGetAttribute(eleCellBar, "Color", "blue")
sColor = HexStringFromColor(Color.FromArgb(GetColorFromString(sColor)))
Dim sBgColor As String = st.sGetAttribute(eleCellBar, "BackgroundColor")
If sBgColor.Length <> 0 Then _
sBgColor = HexStringFromColor(Color.FromArgb(GetColorFromString(sBgColor)))
'Add a PercentOfSpread element under the DataLayer.
Dim sPercentOfSpreadId As String = "rdCellValue_" & eleCellBar.GetAttribute("ID") & "_" & eleDataTableColumn.GetAttribute("ID") & "cellBar" '15115,15156
Dim eleDataLayer As XmlElement = eleDataTable.SelectSingleNode("DataLayer")
Dim elePercentOfSpread As XmlElement = eleDataLayer.AppendChild(eleDataTable.OwnerDocument.CreateElement("PercentOfSpreadColumn"))
elePercentOfSpread.SetAttribute("ID", sPercentOfSpreadId)
elePercentOfSpread.SetAttribute("DataColumn", sDataColumn)
'Add a CalculatedColumn element below PercentOfSpread to get the actual image width.
Dim eleCalcPosWidth As XmlElement = eleDataLayer.AppendChild(eleDataTable.OwnerDocument.CreateElement("CalculatedColumn"))
eleCalcPosWidth.SetAttribute("ID", sPercentOfSpreadId)
eleCalcPosWidth.SetAttribute("Formula", "@Data." & sPercentOfSpreadId & "~ * " & nWidth)
'Add a Division to contain the two CellBar images.
Dim eleDiv As XmlElement = eleDataTableColumn.InsertAfter(eleDataTable.OwnerDocument.CreateElement("Division"), eleCellBar)
eleDiv.SetAttribute("Style", "white-space: nowrap;")
'Add the bar image under the DataTableColumn.
Dim sBarID As String = sPercentOfSpreadId.Replace("rdCellValue_", "rdCellBar_")
Dim eleBarImage As XmlElement = eleDiv.AppendChild(eleDataTable.OwnerDocument.CreateElement("Image"))
eleBarImage.SetAttribute("ID", sBarID)
eleBarImage.SetAttribute("Caption", sMakeCellColorSpectrumImage(sColor, sColor, 1)) 'Make a single-pixel image.
eleBarImage.SetAttribute("Width", "@Data." & sPercentOfSpreadId & "~")
eleBarImage.SetAttribute("Height", nHeight)
eleBarImage.SetAttribute("Tooltip", sBarTooltip)
eleBarImage.SetAttribute("AltText", sBarAltText)
'Is there an Action element?
Dim eleAction As XmlElement = eleCellBar.SelectSingleNode("Action")
If Not IsNothing(eleAction) Then _
eleBarImage.AppendChild(eleAction.CloneNode(True))
If sBgColor.Length <> 0 Then
'Add a CalculatedColumn element to get the actual Bg image width.
Dim eleCalcPosBgWidth As XmlElement = eleDataLayer.AppendChild(eleDataTable.OwnerDocument.CreateElement("CalculatedColumn"))
Dim sBgColumnID As String = sPercentOfSpreadId.Replace("rdCellValue_", "rdCellPosBgValue_")
eleCalcPosBgWidth.SetAttribute("ID", sBgColumnID)
eleCalcPosBgWidth.SetAttribute("Formula", nWidth & " - @Data." & sPercentOfSpreadId & "~")
'Add the Bg bar image under the DataTableColumn.
Dim sBgBarID As String = sPercentOfSpreadId.Replace("rdCellValue_", "rdCellBgBar_")
Dim eleBgBarImage As XmlElement = eleDiv.AppendChild(eleDataTable.OwnerDocument.CreateElement("Image"))
eleBgBarImage.SetAttribute("ID", sBgBarID)
eleBgBarImage.SetAttribute("Caption", sMakeCellColorSpectrumImage(sBgColor, sBgColor, 1)) 'Make a single-pixel image.
eleBgBarImage.SetAttribute("Width", "@Data." & sBgColumnID & "~")
eleBgBarImage.SetAttribute("Height", nHeight)
eleBgBarImage.SetAttribute("Tooltip", sBarTooltip)
eleBgBarImage.SetAttribute("AltText", sBarAltText)
'Action element?
If Not IsNothing(eleAction) Then _
eleBgBarImage.AppendChild(eleAction.CloneNode(True))
End If
End Sub
Private Function sProcess_SubDataTable(ByRef eleDef As XmlElement, ByVal sElementID As String) As String
Dim sReturn As String = Nothing
Dim sTableID As String = eleDef.GetAttribute("ID")
If sTableID.Length = 0 Then _
Throw New Exception("SubDataTables must have an ID value.")
Dim eleSubDataLayer As XmlElement = eleDef.SelectSingleNode("SubDataLayer")
'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
'Build the header.
Dim eleCol As XmlElement
Dim sTblHeader As String = ""
Dim sTblCols As String = "" 'COLS allow setting of styles for entire columns at once.
Dim bTableHeaderPresent As Boolean
For Each eleCol In eleDef.SelectNodes("DataTableColumn")
If Not bExportReport() Or bElementInitiallyVisible(eleCol) Then
'Added for Issue # 1455. Don't create invisible columns for exported reports.
'Prevent sorts.
If Not IsNothing(eleCol.SelectSingleNode("DataColumnSort")) Then _
Throw New Exception("You cannot have a DataColumnSort under a SubDataTable.")
Dim sColStyle As String = ""
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") & """"
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 sScopeAttr As String = " scope=""col"""
Dim sColHeader As String = ""
If eleCol.GetAttribute("HeaderType") = "Image" Then
Dim eleHeaderImage As XmlElement = eleCol.AppendChild(xmlDef.CreateElement("Image"))
eleHeaderImage.SetAttribute("ID", eleCol.GetAttribute("ID") & "-HeaderImage")
eleHeaderImage.SetAttribute("Caption", eleCol.GetAttribute("Header"))
sColHeader = sProcessDefinitionElement(eleHeaderImage)
eleCol.RemoveChild(eleHeaderImage)
Else
sColHeader = sTokenToXsl(eleCol.GetAttribute("Header"), xslValueType.Element, True)
Dim sFormat As String = eleCol.GetAttribute("Format")
If sFormat.Length > 0 Then
sColHeader = "" & sColHeader & ""
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 sColHeader.Length > 0 Then bTableHeaderPresent = True
'(Sorting ignored here for SubDataTables.)
'(CellColorSlider and CellBar ignored here for SubDataTables.)
Dim sColumnHeaderClass As String = "Class"
If eleDef.GetAttribute("ColumnHeaderClass").Length <> 0 Then sColumnHeaderClass = "ColumnHeaderClass"
sColHeader = sSetClass(eleDef, "
"
sTblCol = sSetID(eleCol, sTblCol)
sTblCol = sSetVisibility(eleCol, sTblCol)
sTblCol &= ""
sTblCol = sSetConditionalElement(eleCol, sTblCol) ' #3446, 3975
sTblCols &= sTblCol
End If
Next
If bTableHeaderPresent Then 'Don't include a header if no header names where defined.
sTblHeader = "
" & sTblHeader & "
" & CrLf
Else
sTblHeader = ""
End If
'Make an HTML table record, leaving the @Data tokens in.
Dim sListRecord As String = eleDef.GetAttribute("Display")
'DCT sListRecord = "
"
sListRecord = "
" '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 nColumns As Integer = 0
For Each eleCol In eleDef.SelectNodes("DataTableColumn")
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 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") & """"
End If
End If
Dim sOpenTD As String = "
"
sListField = sOpenTD & sColStyle & sScopeRowAttr & " >" 'This had a space after the >. Fixed for issue 1068.
sListField = sSetClass(eleCol, sListField)
'sListField = sSetAlign(eleCol, sListField)
'sListField = sSetBackgroundImage(eleCol, sListField)
Dim sCellXsl As String = sProcessDefinitionElementChildren(eleCol)
Call HideDuplicateColumnValues(eleCol, sElementID, sCellXsl)
sListField = sListField & sCellXsl
sListField = sListField & sCloseTD & CrLf
sListField = sSetConditionalElement(eleCol, sListField) ' #3446, 3975
'10831 - Actions and EventHandlers for Columns.
Call subConvertActionToEventHandler(eleCol)
sListField = sSetEventHandler(eleCol, sListField)
sListRecord = sListRecord & sListField
nColumns += 1
End If
Next
sListRecord = sListRecord & "
" & XSL_LINEFEED & CrLf
'MoreInfoRow: Are there any More Info Rows?
sListRecord += sGetMoreInfoRows(eleDef, nColumns)
'Not wanted for SubDataTables.
'sListRecord = sListRecord & "" 'This is used for pagebreaking on the client side to determine where the end of each row is located.
'GroupHeaderRow:
GetGroupHeaderRows(eleDef, sListRecord) 'sListRecord may be changed.
'GroupSummarRow:
sListRecord &= sGetGroupSummaryRows(eleDef)
'Get the Xsl template for a data table.
Dim sXsl As String = rdUtility.ReadFile(rdState.sGetPhysicalPath() & slash & "rdTemplate" & slash & "rdSubDataTable.xsl")
sXsl = sXsl.Replace("", sListRecord)
If IsNothing(eleSubDataLayer) 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"))
' Dont include end tags for subdatatables...18985 (PDF fix)
sXsl = sXsl.Replace("", "")
'Dim sTblHeaderRow As String = sGetSummaryRow(eleDef, eleDef.SelectSingleNode("HeaderRow"))
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.
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
Next
sTblTopHeaderRows = sTblTopHeaderRows.Replace("
", "")
Dim sTblSummaryRow As String = sGetSummaryRow(eleDef, eleDef.SelectSingleNode("SummaryRow"))
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
End If
If eleDef.GetAttribute("Layout") = "Fixed" Then
sTblStyle &= "table-layout:fixed;"
End If
sTblStyle = "style=""" & sTblStyle & """"
sReturn = sSetClass(eleDef, "
"
''Replace values in the XSL template.
'sReturn = sReturn.Replace("rdDataLayerID", sDatalayerID)
Return sReturn
End Function
Private Function sProcess_CrosstabTable(ByRef eleDef As XmlElement) As String
'The CrosstabTable definition gets turned into a DataTable definition.
Dim sReturn As String = Nothing
'Edit checks.
''This is no longer a problem
''If Not IsNothing(eleDef.SelectSingleNode("//SubDataTable")) Then _
'' Throw New Exception("You cannot have a SubDataTable with a CrosstabTable.")
'Look for draggable columns for init
If st.sGetAttribute(eleDef, "DraggableColumns") = "True" Then
subAddYUIInitializer("'draggable-columns'", "LogiXML.DraggableColumns.initialize();")
End If
If st.sGetAttribute(eleDef, "ResizableColumns") = "True" Then
subAddYUIInitializer("'resizable-columns'", "LogiXML.ResizableColumns.initialize();")
End If
Dim sTableID As String = eleDef.GetAttribute("ID")
If sTableID.Length = 0 Then _
Throw New Exception("CrosstabTables must have an ID value.")
'22486
'24230, set the definition of this crosstab table for the wizard.
If HttpContext.Current.Session("rdForWizard") IsNot Nothing Then
HttpContext.Current.Session("rdForWizard") = eleDef.OuterXml
End If
_dataColumnNames.Clear()
For Each dtColumn As XmlElement In eleDef.SelectNodes("CrosstabTableLabelColumn|CrosstabTableValueColumns|ExtraCrosstabValueColumnID")
If String.IsNullOrEmpty(st.sGetAttribute(dtColumn, "ID")) Then
dtColumn.SetAttribute("ID", GetUniqueIdForDataTableColumn(dtColumn.Name))
End If
Next
If sTableID = "ctAnalysisCrosstab" Then _
Return Nothing 'This is just a Template element for the AnalysisGrid. Don't process it.
'Create a DataTable from the CrosstabTable. Copy all attributes and child elements.
'They will then be processed by the "DataTable" code.
Dim eleDataTable As XmlElement = util.CopyElementToName(eleDef, "DataTable")
eleDataTable.SetAttribute("rdCrosstab", "True")
Dim eleDataLayer As XmlElement = eleDef.SelectSingleNode("DataLayer")
If IsNothing(eleDataLayer) Then _
Throw New Exception("This Crosstab's table does not have a DataLayer.") '#7958
Dim bIsActiveSql As Boolean = False
If eleDataLayer.GetAttribute("Type") = "ActiveSQL" Then _
bIsActiveSql = True
If bIsActiveSql Then
If IsNothing(eleDataTable.SelectSingleNode(".//SqlCrosstab")) AndAlso eleDataLayer.GetAttribute("Type") <> "Linked" Then _
dbug.AddDebugMessage("** WARNING **", , "This Crosstab's table does not have a DataLayer with a SqlCrosstab.")
Else
If IsNothing(eleDataTable.SelectSingleNode(".//CrosstabFilter")) AndAlso eleDataLayer.GetAttribute("Type") <> "Linked" Then _
dbug.AddDebugMessage("** WARNING **", , "This Crosstab's table does not have a DataLayer with a CrosstabFilter.")
End If
'Remove the data layer from the original CrosstabTable element, so that it's not processed twice in the DB code.
eleDef.RemoveChild(eleDataLayer)
'Is there a CrosstabComparison?
Dim eleComparison As XmlElement = eleDef.SelectSingleNode("CrosstabComparison")
If Not IsNothing(eleComparison) Then
lgxLicense10.LicenseCheck(eleComparison)
dbug.AddDebugMessage("CrosstabComparison", "Generate Definition")
If Not IsNothing(eleDef.SelectSingleNode(".//SubDataTable")) Then _
Throw New Exception("Cannot have a SubDataTable with CrosstabComparison.")
If Not IsNothing(eleDef.SelectSingleNode(".//SubDataMultiColumnList")) Then _
Throw New Exception("Cannot have a SubDataMultiColumnList with CrosstabComparison.")
'If IsNothing(eleCrosstabFilter) Then _
' Throw New Exception("CrosstabComparison requires a CrosstabFilter under the DataLayer.")
eleDef.SetAttribute("CrosstabDifferenceValue", "True")
Dim eleValueColumns As XmlElement = eleDef.SelectSingleNode("CrosstabTableValueColumns")
If Not IsNothing(eleValueColumns) Then 'There should always be CrosstabTableValueColumns but check anyway.
'Get the template definition.
Dim xmlComparisonTemplate As XmlDocument = rdUtility.GetSuperElementTemplate("rdCrosstabComparison/rdCcTemplate.lgx")
'Is there a template modifier?
Call rdUtility.ApplyTemplateModifier(st, dbug, eleComparison, xmlComparisonTemplate.DocumentElement)
'Is there a theme or DefinitionModifierFile? Run them too.
Call rdUtility.ApplyDefinitionModifierFiles(st, dbug, eleDef.OwnerDocument, xmlComparisonTemplate.DocumentElement)
'Set the Format for the comparison/difference values.
'Get it either from the CrosstabComparison's Format attribute or find a Format attribute in the CrosstabTable definition.
'Set the Format attributes in the template for elements that will show value differences. They start with Format="rdValueFormat".
Dim sFormat As String = st.sGetAttribute(eleComparison, "Format") 'Use the hard-coded format.
If sFormat.Length = 0 Then
Dim atrValueColumnFormat As XmlAttribute = eleValueColumns.SelectSingleNode("*//@Format") 'Get the Format from the CrosstabTableValueColumns?
If Not IsNothing(atrValueColumnFormat) Then _
sFormat = atrValueColumnFormat.Value
End If
Dim nlTemplateFormats As XmlNodeList = xmlComparisonTemplate.SelectNodes("//*[@Format='rdValueFormat']")
For Each eleTemplateFormat As XmlElement In nlTemplateFormats
If sFormat.Length = 0 Then
eleTemplateFormat.RemoveAttribute("Format")
Else
eleTemplateFormat.SetAttribute("Format", sFormat)
End If
Next
eleDef.SetAttribute("CrosstabDifferencePercent", "True")
'Include PopupPanels that show the difference value and percentage?
Select Case eleComparison.GetAttribute("ComparisonStyle")
Case "None"
'None
Case "ColorSpectrum"
eleValueColumns.SetAttribute("BackgroundColor", "@Data.rdCrosstabDifferenceColor~")
eleValueColumns.SetAttribute("TextColor", "@Data.rdCrosstabDifferenceTextColor~")
eleDef.SetAttribute("CrosstabDifferenceSpectrum", "True")
If eleComparison.HasAttribute("LowValueColor") Then _
eleDef.SetAttribute("LowValueColor", eleComparison.GetAttribute("LowValueColor"))
If eleComparison.HasAttribute("MediumValueColor") Then _
eleDef.SetAttribute("MediumValueColor", eleComparison.GetAttribute("MediumValueColor"))
If eleComparison.HasAttribute("HighValueColor") Then _
eleDef.SetAttribute("HighValueColor", eleComparison.GetAttribute("HighValueColor"))
If eleComparison.GetAttribute("SwitchColors") = "True" Then
Dim eleShowPopupTemplate As XmlElement = xmlComparisonTemplate.SelectSingleNode("//*[@ID='rdCtCompTooltip']")
Dim ttNodeUp As XmlElement = eleShowPopupTemplate.SelectSingleNode("//*[@ID='rdPopupArrowUp']")
Dim ttNodeDown As XmlElement = eleShowPopupTemplate.SelectSingleNode("//*[@ID='rdPopupArrowDown']")
Dim sTtClassUp As String = ttNodeUp.GetAttribute("Class")
Dim sTtClassDown As String = ttNodeDown.GetAttribute("Class")
ttNodeUp.SetAttribute("Class", sTtClassDown)
ttNodeDown.SetAttribute("Class", sTtClassUp)
End If
Case Else ' "Arrows"
Dim eleArrowTemplate As XmlElement = xmlComparisonTemplate.SelectSingleNode("//*[@ID='rdCrosstabComparisonArrow']")
Dim eleShowPopupTemplate As XmlElement = xmlComparisonTemplate.SelectSingleNode("//*[@ID='rdCtCompTooltip']")
If eleComparison.GetAttribute("SwitchColors") = "True" Then
Dim nodeUp As XmlElement = eleArrowTemplate.SelectSingleNode("//*[@ID='rdArrowUp']")
Dim nodeDown As XmlElement = eleArrowTemplate.SelectSingleNode("//*[@ID='rdArrowDown']")
Dim sClassUp As String = nodeUp.GetAttribute("Class")
Dim sClassDown As String = nodeDown.GetAttribute("Class")
nodeUp.SetAttribute("Class", sClassDown)
nodeDown.SetAttribute("Class", sClassUp)
Dim ttNodeUp As XmlElement = eleShowPopupTemplate.SelectSingleNode("//*[@ID='rdPopupArrowUp']")
Dim ttNodeDown As XmlElement = eleShowPopupTemplate.SelectSingleNode("//*[@ID='rdPopupArrowDown']")
Dim sTtClassUp As String = ttNodeUp.GetAttribute("Class")
Dim sTtClassDown As String = ttNodeDown.GetAttribute("Class")
ttNodeUp.SetAttribute("Class", sTtClassDown)
ttNodeDown.SetAttribute("Class", sTtClassUp)
End If
eleValueColumns.AppendChild(eleDef.OwnerDocument.ImportNode(eleArrowTemplate, True))
End Select
'Include PopupPanels that show the difference value and percentage?
Dim sShowTooltips As String = st.sGetAttribute(eleComparison, "ComparisonShowTooltips", "None")
If sShowTooltips <> "None" Then
Dim eleShowPopupTemplate As XmlElement = xmlComparisonTemplate.SelectSingleNode("//*[@ID='rdCtCompTooltip']")
eleShowPopupTemplate = eleValueColumns.AppendChild(eleDef.OwnerDocument.ImportNode(eleShowPopupTemplate, True))
eleShowPopupTemplate.SetAttribute("ID", "rdCtCompTooltip_" & sTableID)
Select Case sShowTooltips
Case "Percent" 'Remove the Label for the value and Spaces too.
eleShowPopupTemplate.RemoveChild(eleShowPopupTemplate.SelectSingleNode("Label[@ID='rdValue']"))
eleShowPopupTemplate.RemoveChild(eleShowPopupTemplate.SelectSingleNode("Spaces"))
Case "Value" 'Remove the Label for the percentage and Spaces too.
eleShowPopupTemplate.RemoveChild(eleShowPopupTemplate.SelectSingleNode("Label[@ID='rdPercent']"))
eleShowPopupTemplate.RemoveChild(eleShowPopupTemplate.SelectSingleNode("Spaces"))
Case "All"
'Don't remove anything.
End Select
End If
Dim sShowValues As String = st.sGetAttribute(eleComparison, "ComparisonShowValues", "None")
If sShowValues <> "None" Then
Dim eleShowValuesTemplate As XmlElement = xmlComparisonTemplate.SelectSingleNode("//*[@ID='rdCrosstabComparisonShowValues']")
eleShowValuesTemplate = eleValueColumns.AppendChild(eleDef.OwnerDocument.ImportNode(eleShowValuesTemplate, True))
Select Case sShowValues
Case "Percent" 'Remove the Label for the value and Spaces too.
eleShowValuesTemplate.RemoveChild(eleShowValuesTemplate.SelectSingleNode("Label[@ID='rdValue']"))
eleShowValuesTemplate.RemoveChild(eleShowValuesTemplate.SelectSingleNode("Spaces"))
Case "Value" 'Remove the Label for the percentage and Spaces too.
eleShowValuesTemplate.RemoveChild(eleShowValuesTemplate.SelectSingleNode("Label[@ID='rdPercent']"))
eleShowValuesTemplate.RemoveChild(eleShowValuesTemplate.SelectSingleNode("Spaces"))
Case "All"
'Don't remove anything.
End Select
End If
End If
End If
'If there's a PrintablePaging element from the original CrosstabTable, revove it, or there will be an error while processing the DataTable.
Dim elePrintablePaging As XmlElement = eleDef.SelectSingleNode("PrintablePaging")
If Not IsNothing(elePrintablePaging) Then
eleDef.RemoveChild(elePrintablePaging)
End If
'Create the label and Crosstab columns.
Dim eleDefColumn As XmlElement
For Each eleDefColumn In eleDef.ChildNodes
Select Case eleDefColumn.Name
Case "CrosstabTableLabelColumn"
'Create label columns. They're pretty much the same as any other DataTableColumn.
eleDataTable.AppendChild(util.CopyElementToName(eleDefColumn, "DataTableColumn"))
Case "CrosstabTableValueColumns"
'Copy the Crosstab Value element. It's the template for the rest of the Crosstab column definition.
Dim eleCrosstabCol As XmlElement = util.CopyElementToName(eleDefColumn, "DataTableColumn")
eleCrosstabCol.SetAttribute("rdCrosstab", "True")
'Sorting needs to be renamed and a couple attributes set.
Dim eleCrosstabValSort As XmlElement = eleCrosstabCol.SelectSingleNode("CrosstabValueColumnSort")
If Not IsNothing(eleCrosstabValSort) Then
Dim eleSort As XmlElement = util.CopyElementToName(eleCrosstabValSort, "DataColumnSort")
Dim sExtraCrosstabValueColumnID As String = eleSort.GetAttribute("ExtraCrosstabValueColumnID")
If sExtraCrosstabValueColumnID.Length = 0 Then
eleSort.SetAttribute("DataColumn", "rdCrosstabSort")
Else
If Not IsNothing(eleComparison) Then _
Throw New Exception("Cannot have CrosstabValueColumnSort with ExtraCrosstabValueColumnID attribute and CrosstabComparison.") '14170
eleSort.SetAttribute("DataColumn", "rdCrosstabSort-" & sExtraCrosstabValueColumnID)
End If
If IsNothing(eleSort.Attributes("DataType")) Then _
eleSort.SetAttribute("DataType", "Number")
eleCrosstabCol.InsertAfter(eleSort, eleCrosstabValSort)
eleCrosstabValSort.ParentNode.RemoveChild(eleCrosstabValSort)
End If
'Add the Crosstab Columns' definition to the DataTable.
eleDataTable.AppendChild(eleCrosstabCol)
End Select
Next
Dim eleDefOriginal As XmlElement = eleDef.CloneNode(True) '14254 - let's keep original definition
'The Crosstab is now converted to a DataTable. Remove all the Crosstab's child elements so they don't get in the way or cause extra work later. 11542
Dim eleRemove As XmlElement = eleDef.SelectSingleNode("*")
Do While Not IsNothing(eleRemove)
eleDef.RemoveChild(eleRemove)
eleRemove = eleDef.SelectSingleNode("*")
Loop
'Add the newly created DataTable, and process the DataTable.
eleDef.AppendChild(eleDataTable)
If dbug.DebuggingEnabled Then _
dbug.AddDebugMessage("CrosstabTable", "Generated", "View Definition", eleDef)
plugin.CallPlugins_GeneratedElement(eleDataTable, eleDefOriginal) '14254 - Call Plugins from more places - ElementPluginCall
'Issue 19664, 19784 - ActiveSQL Crosstab pulls entire dataset down, So datalayer converted to XMLFile .
Dim nodeActiveSQL As XmlNode = eleDataTable.SelectSingleNode("DataLayer[@Type='ActiveSQL']")
If (nodeActiveSQL IsNot Nothing) AndAlso (nodeActiveSQL.SelectSingleNode("SqlCrosstab") IsNot Nothing) Then
'22741 - Need to remove SqlSort elements for crosstab tables.
'The only valid sort would be one on the Label Value Column, which the user can do manually after the creation of the crosstab table.
Dim nlSqlSorts As XmlNodeList = nodeActiveSQL.SelectNodes("SqlSort")
For Each eleSqlSort As XmlElement In nlSqlSorts
nodeActiveSQL.RemoveChild(eleSqlSort)
Next
Dim eleActiveDL As XmlElement = CType(nodeActiveSQL, XmlElement)
Dim oDB As New rdDb(xmlSettings, dbug)
Dim sFilename As String = oDB.xmlGetDataFileName(eleActiveDL, ".")
Dim sOriginalID As String = eleActiveDL.GetAttribute("ID")
Dim sBufferFilename As String = eleActiveDL.GetAttribute("rdResultsetGuid")
Dim eleNew As XmlElement = eleActiveDL.OwnerDocument.CreateElement("DataLayer")
eleNew.SetAttribute("Type", "XMLFile")
eleNew.SetAttribute("ID", "lgxCached")
eleNew.SetAttribute("OriginalDataLayerID", sOriginalID)
eleNew.SetAttribute("XMLFile", String.Format("{0}{2}RB_{1}.xml", st.DataCacheLocation, sBufferFilename, System.IO.Path.DirectorySeparatorChar))
eleActiveDL.SetAttribute("Type", "EmptyDataLayer")
eleActiveDL.ParentNode.PrependChild(eleNew)
End If
Dim isExport As Boolean = http.Request("rdReportFormat") = "NativeExcel" OrElse http.Request("rdReportFormat") = "Excel" OrElse _
http.Request("rdReportFormat") = "NativeWord" OrElse http.Request("rdReportFormat") = "Word"
If isExport Then
eleDataTable.SetAttribute("Class", "rdAgCrossTabDataTable")
End If
sReturn = sProcessDefinitionElement(eleDataTable)
If Not IsNothing(eleComparison) Then
sReturn &= "rdInsertDataCacheKeyHere" '14056
sReturn &= ""
'sbHead.Insert(sbHead.ToString.IndexOf("") + 8, "")
subAddIncludedCss("rdCrosstabComparison/rdCcStyle.css")
End If
Return sReturn
End Function
Private Function sProcess_OlapTable(ByRef eleDef As XmlElement) As String
Dim sReturn As String = Nothing
'For Xolap
If Not eleDef.SelectSingleNode("XolapCube") Is Nothing Then
Return sProcess_XolapTable(eleDef)
End If
'for filters
If Not eleDef.SelectSingleNode("DataLayer[@Type='XolapQuery']") Is Nothing Then
Return sProcess_XolapTable(eleDef)
End If
Dim isXolap As Boolean = False
If Not IsNothing(eleDef.SelectSingleNode("XolapCube")) Then _
isXolap = True
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
Dim rdOlap As New rdOlap.rdOlapTable()
rdOlap.isXolap = isXolap
Dim eleDataTable As XmlElement = Nothing
Try
eleDataTable = rdOlap.OlapTableToDataTable(eleDef, xmlSettings)
Catch ex As Exception
If eleDef.GetAttribute("rdFromOlapGrid") = "True" Then
Dim eleErrorRow As XmlElement = eleDef.AppendChild(eleDef.OwnerDocument.CreateElement("Row"))
eleErrorRow.SetAttribute("Class", "rdOgContentRow")
eleErrorRow.SetAttribute("FromOlapTable", "True")
Dim eleErrorCol As XmlElement = eleErrorRow.AppendChild(eleDef.OwnerDocument.CreateElement("Column"))
eleErrorCol.SetAttribute("ColSpan", 99)
Dim eleErrorLabel As XmlElement = eleErrorCol.AppendChild(eleErrorCol.OwnerDocument.CreateElement("Label"))
eleErrorLabel.SetAttribute("Caption", ex.Message)
eleErrorLabel.SetAttribute("Class", "rdOgError")
eleDef.ParentNode.InsertAfter(eleErrorRow, eleDef)
dbug.AddDebugMessage("OlapGrid", "Error", ex.ToString)
Else
Throw New Exception("Error processing an OlapTable.", ex)
End If
End Try
If Not IsNothing(eleDataTable) Then
eleDataTable.SetAttribute("FromOlapTable", "True")
dbug.AddDebugMessage("OlapTable", "Generated", "View Definition", eleDataTable)
HttpContext.Current.Session(msRequestedPage & "_rdOgTable_" & eleDef.GetAttribute("ID")) = eleDataTable.OuterXml
If eleDef.GetAttribute("AddedToDashboard") = "True" Then
subModifyOlapComponentsForDashboard(eleDataTable)
End If
eleDef.ParentNode.InsertAfter(eleDataTable, eleDef)
plugin.CallPlugins_GeneratedElement(eleDataTable, eleDef) '14254 - Call Plugins from more places - ElementPluginCall
End If
Return sReturn
End Function
Private Function sProcess_OlapGrid(ByRef eleDef As XmlElement) As String
Dim sReturn As String = Nothing
'' ''14376 - Enable OlapGrid with Xolap with Java.
'' ''#If JAVA Then '5190
'' '' Throw New Exception("Olap Grid elements are not available in the Java version.")
'' ''#Else
lgxLicense10.LicenseCheck(eleDef)
If eleDef.OwnerDocument.SelectNodes("//OlapGrid").Count > 1 Then _
Throw New Exception("There is only one OlapGrid element allowed for a single report definition.")
'23824
'Call subAddIncludedScript("rdAjax/rdAjax2.js") 'Charts use AJAX to 1) POST back new width/height after Resize 2) Pull down image maps
Call subAddIncludedScript("rdOlapGrid/rdOgScript.js")
'subAddIncludedScript("rdGroupDrillthrough/rdDrillthrough.js")
subAddIncludedCss("rdGroupDrillthrough/rdDrillthrough.css")
Call subAddJavaEventFunction("rdBodyLoad", "rdOgShowTabsState()")
Dim og As New rdOlap.rdOlapGrid(xmlSettings)
Dim eleOg As XmlElement = og.BuildOlapGrid(eleDef)
If dbug.DebuggingEnabled Then _
dbug.AddDebugMessage("OlapGrid", "Generated", "View Definition", eleOg)
plugin.CallPlugins_GeneratedElement(eleOg, eleDef) '14254 - Call Plugins from more places - ElementPluginCall
If og.isXolap Then
CacheXolapCubeDataLayer(eleDef)
End If
HttpContext.Current.Session("rdOgDef-" & eleDef.GetAttribute("ID")) = eleDef.OuterXml
'Position the OGs 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("rdOlapGrid/rdOgStyle.css")
sReturn = sReturn & sProcessDefinitionElementChildren(eleOg)
'sReturn = sSetClass(eleDef, sReturn)
'' ''#End If
Return sReturn
End Function
Private Function sProcess_DimensionGrid(ByRef eleDef As XmlElement) As String
Dim sReturn As String = Nothing
lgxLicense10.LicenseCheck(eleDef)
'#If JAVA Then '5190
' Throw New Exception("Xolap elements are not available in the Java version.")
'#Else
If eleDef.OwnerDocument.SelectNodes("//DimensionGrid").Count > 1 Then _
Throw New Exception("Only one DimensionGrid element is allowed in a report definition.")
'23824
Call subAddIncludedScript("rdOlapGrid/rdOgScript.js")
'subAddIncludedScript("rdGroupDrillthrough/rdDrillthrough.js")
subAddIncludedCss("rdGroupDrillthrough/rdDrillthrough.css")
mbAddAjaxSupport = True
'CacheXolapCubeDataLayer(eleDef)
Dim og As New rdOlap.rdOlapGrid(xmlSettings)
og.isDimGrid = True
Dim eleOg As XmlElement = og.BuildOlapGrid(eleDef)
If dbug.DebuggingEnabled Then _
dbug.AddDebugMessage("DimensionGrid", "Generated", "View Definition", eleOg)
plugin.CallPlugins_GeneratedElement(eleOg, eleDef) '14254 - Call Plugins from more places - ElementPluginCall
CacheXolapCubeDataLayer(eleDef)
HttpContext.Current.Session("rdOgDef-" & eleDef.GetAttribute("ID")) = eleDef.OuterXml
'Position the OGs 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("rdOlapGrid/rdDgStyle.css")
sReturn &= sProcessDefinitionElementChildren(eleOg)
'#End If
Return sReturn
End Function
Sub CacheXolapCubeDataLayer(ByRef eleDef As XmlElement)
'This is used for DimensionGrids AND OlapGrids.
Dim eleDataLayer As XmlElement = eleDef.SelectSingleNode(".//XolapCube/DataLayer")
If eleDataLayer Is Nothing Then
Throw New Exception("The XolapCube element must contain a data layer.")
End If
If eleDataLayer.GetAttribute("Type") = "EmptyDataLayer" Then 'already done
Exit Sub
End If
Dim eleCachedDataLayer As XmlElement = Nothing
'If eleDataLayer.GetAttribute("ID") = "xgCached" Then
' If st.sGetRequestVar("rdAgRefreshData") = "True" Or st.sGetRequestVar("rdAgLoadSaved").Length <> 0 Then
' Try '#8235
' IO.File.Delete(eleDataLayer.GetAttribute("XMLFile"))
' Catch : End Try
' End If
' 'Has the XML file cache expired? The file would have been deleted by the line above or the cache cleanup.
' If Not IO.File.Exists(eleDataLayer.GetAttribute("XMLFile")) Then
' 'Remove the cache DataLayer
' eleCachedDataLayer = eleDataLayer.ParentNode.RemoveChild(eleDataLayer)
' 'Restore the original DataLayer element.
' eleDataLayer = eleDef.SelectSingleNode("//*[@ID='dtXolapGrid']/DataLayer[@OriginalType]")
' eleDataLayer.SetAttribute("Type", eleDataLayer.GetAttribute("OriginalType"))
' End If
'End If
If eleDataLayer.GetAttribute("rdCachedData") = "" Then
'Get and cache the data.
Dim sCacheKey As String
'TODO: data table link
'sSetDataTableLinkID() 'Allow DataLayerLinking to work.
Dim db9 As New rdDb9(xmlSettings, dbug)
Dim streamData As System.IO.Stream = db9.xmlGetData(eleDataLayer.ParentNode, "DataLayer")
'streamData = rdOlap.OlapUtility.CleanseSpecialCharacters(streamData, eleDataLayer.ParentNode)
sCacheKey = st.sCacheDataset9(streamData, db9.rdDataLayersInfoXml, xmlSettings)
rdState.SetSessionVarExpiration(sCacheKey) 'We don't want these to timeout like other cached data
Dim sCacheFilename As String = HttpContext.Current.Session("rdDataCache-" & sCacheKey)
'Convert the DataLayer into a type that won't do anything.
eleDataLayer.SetAttribute("OriginalType", eleDataLayer.GetAttribute("Type"))
eleDataLayer.SetAttribute("Type", "EmptyDataLayer") 'Don't process this later.
'Create a new working DataLayer that points to our cached XML file.
If IsNothing(eleCachedDataLayer) Then
'TODO: data table link
'Does the XG's DataLayer have a DataLayerLink element at the end? If so, move it to the end of the DataLayer.XML so that it stays updated.
'Dim eleDataLayerLink As XmlElement = eleDataLayer.LastChild '#7555
eleDataLayer = eleDataLayer.ParentNode.PrependChild(eleDef.OwnerDocument.CreateElement("DataLayer"))
eleDataLayer.SetAttribute("Type", "XMLFile")
eleDataLayer.SetAttribute("ID", "rdCachedData")
eleDataLayer.SetAttribute("rdCachedData", "True")
'TODO: enable data table link
'If Not IsNothing(eleDataLayerLink) _
' AndAlso eleDataLayerLink.Name = "DataLayerLink" _
' AndAlso eleDataLayerLink.GetAttribute("ID") <> "rdAgDataLayerLink" Then
' eleDataLayer.AppendChild(eleDataLayerLink.ParentNode.RemoveChild(eleDataLayerLink))
'End If
Else
eleDataLayer = eleDataLayer.ParentNode.PrependChild(eleCachedDataLayer)
End If
eleDataLayer.SetAttribute("XMLFile", sCacheFilename)
streamData.Close() '10582/10586
End If
End Sub
Private Function sProcess_OlapChart(ByRef eleDef As XmlElement) As String
Dim sReturn As String = Nothing
'#If JAVA Then '5190
' Throw New Exception("Olap Chart elements are not available in the Java version.")
'#Else
If eleDef.GetAttribute("Build") = "True" Then
' rdChartToCanvas.GetCanvasChart(eleDef.SelectSingleNode("Chart"))
Dim ogChart As New rdOlap.rdOlapChart()
Dim eleChart As XmlElement = ogChart.BuildOlapChartCanvas(eleDef)
If Not IsNothing(eleChart) Then
Dim eleCanvas As XmlElement = eleChart.SelectSingleNode("ChartCanvas")
dbug.AddDebugMessage("OlapChart", "Generated", "View Definition", eleCanvas)
rdUtility.ApplyDefinitionModifierFiles(st, dbug, eleCanvas.OwnerDocument, eleCanvas.ParentNode)
HttpContext.Current.Session(msRequestedPage & "_rdOgChart_" & eleCanvas.GetAttribute("ID")) = eleCanvas.OuterXml
HttpContext.Current.Session(msRequestedPage & "_rdOgOlapChart_" & eleCanvas.GetAttribute("ID")) = eleDef.OuterXml
'If rdState.GetApplicationConstant("rdFavorChartCanvas") <> "False" Then
'End If
sReturn = sProcessDefinitionElementChildren(eleChart)
End If
End If
'#End If
Return sReturn
End Function
Private Function sProcess_OlapHeatmap(ByRef eleDef As XmlElement) As String
Dim sReturn As String = Nothing
'#If JAVA Then '5190
' Throw New Exception("Olap Heatmap elements are not available in the Java version.")
'#Else
If eleDef.GetAttribute("Build") = "True" Then
Dim ogHeatmap As New rdOlap.rdOlapHeatmap()
Dim eleHeatmap As XmlElement = ogHeatmap.BuildOlapHeatmap(eleDef)
If Not IsNothing(eleHeatmap) Then
dbug.AddDebugMessage("OlapHeatmap", "Generated", "View Definition", eleHeatmap)
HttpContext.Current.Session(msRequestedPage & "_rdOgHeatmap_" & eleHeatmap.GetAttribute("ID")) = eleHeatmap.OuterXml
HttpContext.Current.Session(msRequestedPage & "_rdOgOlapChart_" & eleHeatmap.GetAttribute("ID")) = eleDef.OuterXml
sReturn = sProcessDefinitionElement(eleHeatmap)
End If
End If
'#End If
Return sReturn
End Function
Private Function sProcess_DataTree(ByRef eleDef As XmlElement, ByVal sElementID As String) As String
Dim sReturn As String = Nothing
If sElementID.Length = 0 Then _
Throw New Exception("DataTrees must have an ID value.")
'Dim eleSubDataLayer As XmlElement = eleDef.SelectSingleNode("SubDataLayer")
Dim sTreeContent As String = sProcessDefinitionElementChildren(eleDef) & XSL_LINEFEED
sReturn = sSetClass(eleDef, "
"
Return sReturn
End Function
Private Function sProcess_DataTreeBranch(ByRef eleDef As XmlElement, ByVal sElementID As String) As String
Dim sReturn As String = Nothing
If sElementID.Length = 0 Then _
Throw New Exception("DataTreeBranches must have an ID value.")
'Determine the current branch level.
Dim nLevel As Integer
If eleDef.ParentNode.ParentNode.Name <> "DataTreeBranch" Then
'Top-level branch.
nLevel = 0
Else
nLevel = eleDef.ParentNode.ParentNode.Attributes("rdBranchLevel").Value + 1
End If
eleDef.SetAttribute("rdBranchLevel", nLevel) 'Save so it can be read by the next child.
'Build a DIV for the child branches.
Dim eleDivBranch As XmlElement = Nothing 'Child branches. These get hidden and shown.
Dim eleChildBranch As XmlElement = Nothing
Dim eleDivContent As XmlElement 'The content for this branch.
'Setup the DIV for the current branch.
eleDivContent = eleDef.OwnerDocument.CreateElement("Division")
eleDivContent.SetAttribute("ID", "rdDivContent" & sElementID)
If eleDef.GetAttribute("Condition").Length <> 0 Then _
eleDivContent.SetAttribute("Condition", eleDef.GetAttribute("Condition"))
Dim nl As XmlNodeList = eleDef.SelectNodes("*")
Dim eleChild As XmlElement
Dim iRows As Integer = 0
#If JAVA Then '6706
Do While iRows < nl.Count
eleChild = nl.ItemOf(iRows)
#Else
For Each eleChild In nl
#End If
'Move each element into one of two DIVs.
iRows = iRows + 1
If eleChild.Name = "DataTreeBranch" Then
'There is a sub-branch.
eleChildBranch = eleChild
eleDivBranch = eleDef.PrependChild(eleDef.OwnerDocument.CreateElement("Division"))
'eleDivBranch.SetAttribute("HtmlDiv", "True") 'Make a DIV instead of a SPAN.
eleDivBranch.SetAttribute("ID", "rdDivBranch" & sElementID)
'Move the branch under the DIV.
eleDivBranch.AppendChild(eleDef.RemoveChild(eleChild))
'Visible or not?
If st.sGetAttribute(eleDef, "Expanded", "False") = "False" Then
eleDivBranch.SetAttribute("ShowModes", "None")
End If
Else
'This is content (like Label elements) for the current branch.
eleDivContent.AppendChild(eleChild.ParentNode.RemoveChild(eleChild))
iRows = iRows - 1
End If
#If JAVA Then
nl = eleDef.SelectNodes("*")
Loop
#Else
Next
#End If
'eleDef.PrependChild(eleDef.OwnerDocument.CreateElement("Division")
Dim eleTree As XmlElement = eleDef.SelectSingleNode("ancestor::DataTree")
'Add the ToggleImage (These elements are added in reverse order).
Dim ele As XmlElement
If IsNothing(eleChildBranch) Then
'This is the bottom level.
Dim sImage As String = eleTree.GetAttribute("LeafImage")
If sImage <> "(None)" And sImage <> "None" Then
ele = eleDivContent.PrependChild(eleDef.OwnerDocument.CreateElement("Image"))
ele.SetAttribute("ID", "item" & sElementID)
If sImage.Length <> 0 Then
ele.SetAttribute("Caption", sImage)
Else
ele.SetAttribute("Caption", "rdTemplate/rdItem.gif")
End If
End If
Else
'There are sub-branches.
ele = eleDivContent.PrependChild(eleDef.OwnerDocument.CreateElement("ToggleImage"))
ele.SetAttribute("ID", "toggle" & sElementID)
ele.SetAttribute("Value", st.sGetAttribute(eleDef, "Expanded", "False")) 'Tokens don't work with this for now. :(
ele.SetAttribute("ElementID", "rdDivBranch" & sElementID)
Dim sImage As String
sImage = eleTree.GetAttribute("BranchCollapsedImage")
If sImage.Length <> 0 Then _
ele.SetAttribute("FalseImage", sImage)
sImage = eleTree.GetAttribute("BranchExpandedImage")
If sImage.Length <> 0 Then _
ele.SetAttribute("TrueImage", sImage)
'Still might be the bottom level.
If eleChildBranch.GetAttribute("Value").Length <> 0 Then
'Show the toggle image if there is anything below it.
'Otherwise show the Leaf image.
'This sets a condition to show the ToggleImage Division or not.
ele.SetAttribute("Condition", "Len(""" & eleChildBranch.GetAttribute("Value") & """)<>0")
'This sets a condition to show a Leaf or not.
sImage = eleTree.GetAttribute("LeafImage")
If sImage <> "(None)" And sImage <> "None" Then
ele = eleDivContent.PrependChild(eleDef.OwnerDocument.CreateElement("Image"))
ele.SetAttribute("ID", "item" & sElementID)
If sImage.Length <> 0 Then
ele.SetAttribute("Caption", sImage)
Else
ele.SetAttribute("Caption", "rdTemplate/rdItem.gif")
End If
ele.SetAttribute("Condition", "Len(""" & eleChildBranch.GetAttribute("Value") & """)=0")
End If
End If
End If
'Add the indentation elements.
ele = eleDivContent.PrependChild(eleDef.OwnerDocument.CreateElement("Spaces"))
ele.SetAttribute("Size", nLevel * 5)
'Add a new line.
ele = eleDivContent.PrependChild(eleDef.OwnerDocument.CreateElement("LineBreak"))
'Only show this branch if there's something under it.
If eleDef.GetAttribute("Value").Length <> 0 Then
eleDivContent.SetAttribute("Condition", "Len(""" & eleDef.GetAttribute("Value") & """)")
End If
'Get the XSL for our 2 DIVs.
eleDef.AppendChild(eleDivContent)
Dim sBranchContent As String = sProcessDefinitionElement(eleDivContent) & XSL_LINEFEED
If Not IsNothing(eleDivBranch) Then
eleDef.AppendChild(eleDivBranch)
sBranchContent &= sProcessDefinitionElement(eleDivBranch)
End If
Dim slash As String = rdState.GetSlash()
Dim sXsl As String = rdUtility.ReadFile(rdState.sGetPhysicalPath() & slash & "rdTemplate" & slash & "rdDataTree.xsl")
sXsl = sXsl.Replace("", sBranchContent)
sXsl = sXsl.Replace("rdDataTreeID", eleDef.GetAttribute("ID"))
If nLevel = 0 Then
sXsl = sXsl.Replace("rdDataID", "/*/" & eleTree.GetAttribute("ID"))
Else
'sXsl = sXsl.Replace("rdDataID", eleTree.GetAttribute("ID"))
sXsl = sXsl.Replace("rdDataID", "*")
End If
'sReturn = sSetClass(eleDef, sReturn)
'sReturn = sSetID(eleDef, sReturn)
sReturn &= sXsl
'sReturn &= ""
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 = "
")
'End If
sReturn &= sBuildTableCaption(eleDef)
sReturn &= "
" & sXsl & "
"
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
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("
"
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("
"
'Internal usage to add event Handlers on to the LI elements in HTML.
sHtmlLI = sSetEventHandler(elePopupOption, sHtmlLI)
'24118
If Not IsNothing(elePopupOption.GetAttribute("Condition")) Then
sHtmlLI = sSetConditionalElement(elePopupOption, sHtmlLI)
End If
sAddPopupActions &= sHtmlLI
Next
sAddPopupActions &= "
"
'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("", 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 = ""
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("
"
'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