<% 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 %>
Modify Grid
Grid: <%=strMBPName%> 
Instance:
<%=gstrAppInstName%>
Grid   Grid Name - Rename (optional):

Tabs and Columns    Add or overwrite any changes to Tabs and Columns. Reorder Tabs and Columns by entering new order numbers.
* = Existing items. (Note: Deleting existing Tabs or Columns removes all content within!)
<% If intTabCount > 0 Then rsTabsAndColumns.MoveFirst i = 1 c = 0 While rsTabsAndColumns.EOF <> True intTabOrder = Trim(rsTabsAndColumns.Fields("tab_order").Value) strTabName = Trim(rsTabsAndColumns.Fields("group_name").Value) lngTabId = Clng(rsTabsAndColumns.Fields("id").Value) If Err.Number <> 0 Then Call HandleError(Err.Number, Err.source, Err.description, strPageName) %> <% i = i + 1 rsTabsAndColumns.MoveNext Wend End If %>
Tab <%=i%>
Tab Order:  Tab Name:  Deletes Tab and All Underlying Columns *
<% '*** Iterate through the columns for this tab Set rsColumns = rsTabsAndColumns("rsColumns").Value j = 1 %> <% While rsColumns.EOF <> True intColOrder = Trim(rsColumns.Fields("column_order").Value) strColName = Trim(rsColumns.Fields("type_name").Value) lngColId = Clng(rsColumns.Fields("id").Value) strColType = Trim(rsColumns.Fields("data_type").Value) If Err.Number <> 0 Then Call HandleError(Err.Number, Err.source, Err.description, strPageName) %> <% j = j + 1 c = c + 1 rsColumns.MoveNext Wend %>
Column:  Delete This Column *
Column Type:  <% Call htmlDrawColumnTypeList("lstColType", strColType, "DISABLED") %>

  Creates another Tab/Column Set.

Rows & Row Groups
Add or overwrite any changes to Row and Row Groups.
Reorder Rows or Groups by entering new order numbers.
* = Existing items. (Note: Deleting existing Rows removes all content within!)

Assign Rows To Groups  
<% If intRowCount > 0 Then rsRows.MoveFirst i = 1 While rsRows.EOF <> True intRowOrder = Trim(rsRows.Fields("row_order").Value) strRowName = Trim(rsRows.Fields("row_name").Value) lngRowId = Clng(rsRows.Fields("rec_id").Value) If Err.Number <> 0 Then Call HandleError(Err.Number, Err.source, Err.description, strPageName) %> <% i = i + 1 rsRows.MoveNext Wend End If %>
Rows
 Order  Name
 Deletes Row and All Content *
<% If intRowGroupCount > 0 Then rsRowGroups.MoveFirst i = 1 While rsRowGroups.EOF <> True intRowGroupOrder = Trim(rsRowGroups.Fields("display_order").Value) strRowGroupName = Trim(rsRowGroups.Fields("name").Value) lngRowGroupId = Clng(rsRowGroups.Fields("rgroup_id").Value) If Err.Number <> 0 Then Call HandleError(Err.Number, Err.source, Err.description, strPageName) %> <% i = i + 1 rsRowGroups.MoveNext Wend End If %>
Row Groups
 Order  Name
 Deletes Row Group *

Custom Links
Enter Link names and type (or paste) their full URLs.
Reorder Links by entering new order numbers. * = Existing items.
<% If intLinkCount > 0 Then rsCustomLinks.MoveFirst i = 1 While rsCustomLinks.EOF <> True intLinkOrder = Trim(rsCustomLinks.Fields("display_order").Value) strLinkName = Trim(rsCustomLinks.Fields("caption").Value) lngLinkId = Clng(rsCustomLinks.Fields("id").Value) strLinkURL = Trim(rsCustomLinks.Fields("url").Value) If Err.Number <> 0 Then Call HandleError(Err.Number, Err.source, Err.description, strPageName) %> <% i = i + 1 rsCustomLinks.MoveNext Wend End If %>

Modifies Grid with all the above settings.
 
Resets all the values to starting settings.
 
Return To Grid View Without Making Any Changes


<% '*** 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 %>