<%
Dim strPageName
Dim strAction 'Edit or Add
Dim strMBPName
Dim strMBPType
Dim objPublisherRO
Dim objPublisherWO
Dim rsTabsAndColumns 'Combined tabs and columns
Dim intTabCount 'Total number of tabs (existing or new MBP)
Dim rsColumns 'Columns within a tab
Dim arrColumnCounts() 'Number of columns within each tab
Dim strNumOfColsPerTab 'CSV separated string containing number of columns within each tab
Dim strDelimiter
Dim intTotColCount 'Total column count - for assign unique column ids
Dim i 'Tab counter (for iterating through the tab collection)
Dim c 'Column sequencer (for generating unique column ids for each column)
Dim j 'Column counter (for iterating through the column collection for a tab)
Dim intTabOrder
Dim strTabName
Dim lngTabId
Dim intColOrder
Dim strColName
Dim lngColId
Dim strColType
Dim rsRows
Dim intRowCount
Dim intRowOrder
Dim strRowName
Dim lngRowId
Dim rsRowGroups
Dim intRowGroupCount
Dim intRowGroupOrder
Dim strRowGroupName
Dim lngRowGroupId
Dim rsCustomLinks
Dim intLinkCount
Dim intLinkOrder
Dim strLinkName
Dim lngLinkId
Dim strLinkURL
strPageName = "InputForAddModifyGrid.asp"
'*** Fetch input variables
strAction = Request("strAction")
strMBPName = Request("strMBPName")
strMBPType = Request("strMBPType")
'*** If editing an existing MBP then fetch the recordsets for each section of the page
If strAction = "Edit" Then
Set objPublisherRO = Server.CreateObject("ChvCITCPublisher.clsPublisherRO")
Set rsTabsAndColumns = objPublisherRO.rsGetTabsAndColumns(gstrAppInstAbbr, strMBPName)
If Err.number <> 0 Then call HandleError(Err.number,Err.Source,Err.Description, strPageName)
If Not (rsTabsAndColumns.EOF And rsTabsAndColumns.BOF) Then
'*** Count the tabs
intTabCount = rsTabsAndColumns.RecordCount
i = 1
intTotColCount = 0
strNumOfColsPerTab = ""
strDelimiter = ""
'*** For each tab, count the columns and accumulate all the columns
While rsTabsAndColumns.EOF <> True
Set rsColumns = rsTabsAndColumns("rsColumns").Value
ReDim Preserve arrColumnCounts(i)
arrColumnCounts(i) = rsColumns.RecordCount
strNumOfColsPerTab = strNumOfColsPerTab & strDelimiter & arrColumnCounts(i)
intTotColCount = intTotColCount + arrColumnCounts(i)
strDelimiter = ","
i = i + 1
rsTabsAndColumns.MoveNext
Wend
End If
'*** Fetch the rows for the selected MBP
Set rsRows = objPublisherRO.rsGetRows(gstrAppInstAbbr, strMBPName, gstrUserId)
If Err.Number <> 0 Then Call HandleError(Err.Number, Err.source, Err.description, strPageName)
If Not (rsRows.EOF And rsRows.BOF) Then
intRowCount = rsRows.RecordCount
End If
'*** Fetch the row groups for the selected MBP
Set rsRowGroups = objPublisherRO.rsGetRowGroups(gstrAppInstAbbr, strMBPName)
If Err.Number <> 0 Then Call HandleError(Err.Number, Err.source, Err.description, strPageName)
If Not (rsRowGroups.EOF And rsRowGroups.BOF) Then
intRowGroupCount = rsRowGroups.RecordCount
End If
'*** Fetch the custom links for the selected MBP
Set rsCustomLinks = objPublisherRO.rsGetCustomLinks(gstrAppInstAbbr, strMBPName)
If Err.Number <> 0 Then Call HandleError(Err.Number, Err.source, Err.description, strPageName)
If Not (rsCustomLinks.EOF And rsCustomLinks.BOF) Then
intLinkCount = rsCustomLinks.RecordCount
End If
'*** Destroy all objects
If Not (objPublisherRO Is Nothing) Then Set objPublisherRO = Nothing
'*** Else initialize the elements counts to zero
Else
intTabCount = 0
ReDim Preserve arrColumnCounts(0)
arrColumnCounts(0) = 0
intTotColCount = 0
intRowCount = 0
intRowGroupCount = 0
intLinkCount = 0
End If
%>
<%
'*** VBScript subs and functions
Sub htmlDrawColumnTypeList(strName, strCurrColType, strDisabled)
Dim arrColumnTypes
Dim i
'*** Initialize list values
arrColumnTypes = Array("File","Text","URL","Date","YesNo")
%>
<%
End Sub
%>