<%
' ********************************************************************
' Copyright (C) 2001 Microsoft Corporation. All rights reserved.
'
'	IMPORTANT.  Please read the legal.txt file, located in the
'	"<CMS Install Directory>\Server\httpexec\WBC\Internals"
'	directory, governing the use of this internal file."
' ********************************************************************

' ********************************************************************
' File:		/NR/System/WBC/Internals/WBCFuncPages/Cross-Browser/
'			ResourceBrowser/Management/ResGalleries/
'			CNCGridDecorator_GalleriesBrowse.inc
' Version: 	Microsoft Content Management Server
' Author:	Microsoft Corporation.
' Purpose:	Implements the INCGridDecorator Interface for the Resource
'			Management display-as-list page
'
' Implement INCGridDecorator Interface:
'	- Sub RenderColumnHeadTRAttrib()
'	- Sub RenderColumnHeadTDAttrib( strColumnIndex )
'	- Sub RenderColumnHeadTDContent( strColumnIndex )
'	- Sub RenderItemTRAttrib( pObject, nCollectionIndex, nDisplayIndex )
'	- Sub RenderItemTDAttrib( pObject, nCollectionIndex, nDisplayIndex, strColumnIndex )
'	- Sub RenderItemTDContent( pObject, nCollectionIndex, nDisplayIndex, strColumnIndex )
'	- Sub RenderEmptyGrid()
'	- Sub SortCollection( strSortByColumn, colObjects, bAscending )
' ********************************************************************

Class CNCGridDecorator_GalleriesBrowse

	' ---- [Public] Render the column head <TR> attributes
	Public Sub RenderColumnHeadTRAttrib()
		Response.Write( "class='WBC_styclsBackground2' " )
	End Sub

	' ---- [Public] Render the column head <TD> attributes
	Public Sub RenderColumnHeadTDAttrib( strColumnIndex )
		Response.Write( "class='WBC_styclsHeavyTextColor1' align='center' " )
	End Sub

	' ---- [Public] Render the column head <TD> content
	Public Sub RenderColumnHeadTDContent( strColumnIndex )
		Select Case strColumnIndex
			Case IDS_GRIDINDEX_NAME
				Call WriteAsNonbreakingBlock( IDS_UI_RESOURCE_GALLERY )
			Case IDS_GRIDINDEX_PATH
				Call WriteAsNonbreakingBlock( IDS_UI_LABEL_PATH )
			Case IDS_GRIDINDEX_LASTMOD
				Call WriteAsNonbreakingBlock( IDS_UI_LABEL_LASTMOD )
			Case IDS_GRIDINDEX_DESC
				Call WriteAsNonbreakingBlock( IDS_UI_LABEL_DESCRIPTION )
		End Select
	End Sub

	' ---- [Public] Render the column head <TR> attributes
	Public Sub RenderItemTRAttrib( pObject, nCollectionIndex, nDisplayIndex )
		If (nDisplayIndex Mod 2 = 0) Then
			Response.Write( "class='WBC_styclsAlternateRowBg1' " )
		Else
			Response.Write( "class='WBC_styclsAlternateRowBg2' " )
		End If
	End Sub


	' ---- [Public]
	Public Sub RenderItemTDAttrib( pObject, nCollectionIndex, nDisplayIndex, strColumnIndex )
		Select Case strColumnIndex
			Case IDS_GRIDINDEX_LASTMOD
				Response.Write( "align='center' " )
		End Select

		Response.Write( "class='WBC_styclsTextColor0' " )
	End Sub

	' ---- [Public]
	Public Sub RenderItemTDContent( pObject, nCollectionIndex, nDisplayIndex, strColumnIndex )
		Dim strDrillDownURL
		Dim strPropertiesURL, strReplaceURL


		Dim pASPUtils
		Set pASPUtils = g_pASPPageManager.ASPUtils

		Select Case strColumnIndex

			Case IDS_GRIDINDEX_NAME
				strDrillDownURL = "../ResourcesBrowse/ResourcesBrowse.asp?" & IDS_QPARAM_GALLERY & "=" & pObject.GUID & _
									"&" & IDS_QPARAM_TIMESTAMP & "=" & CDbl(CDate(now))
				Response.write("<table border='0'><tr><td><a href='" & strDrillDownURL & "'>")
				Response.write("<img border='0' src='" & IDS_RESOURCEBROWSER_IMG_PATH & IDS_IMG_ICON_CLOSED_RESOURCE_GALLERY & "'></a>")
				Response.write("</td><td class='WBC_styclsTextColor0'><a href='" & strDrillDownURL & "'>" )
				
				Call pASPUtils.MBCSWrite( pASPUtils.HTMLEncode(pObject.Name), g_pASPPageManager.CodePage )

				Response.write( "</a><span class='WBC_styclsSmallTextColor0'>(" & pObject.Resources.Count & ")</span>" )
				Response.Write( "</td></tr></table>" )

			Case IDS_GRIDINDEX_PATH
				Call pASPUtils.MBCSWrite( pASPUtils.HTMLEncode(pObject.Path), g_pASPPageManager.CodePage )

			Case IDS_GRIDINDEX_LASTMOD
				' ideally, we want the last modified date to be a non-breaking
				' piece of text, but this has problems in Netscape with column
				' overlap. Since the column looks much nicer with <nobr> we do
				' a browser check
				Call WriteAsNonbreakingBlock( "<script language='JavaScript' type='text/javascript'>" & vbcrlf & _
											  "<!--"  & vbcrlf & _
											  "WBC_writeUTC2Local('" & FormatDate( pObject.LastModifiedDate ) & "');"  & vbcrlf & _
											  "//-->"  & vbcrlf & _
											  "</script>"  & vbcrlf )

			Case IDS_GRIDINDEX_DESC
				If (pObject.Description = "") Then
					Response.Write( IDS_UI_NA )
				Else
					Call Response.Write( pObject.Description & " " )
				End If


		End Select

	End Sub

	' ---- [Public] Render the Grid content area when there are no items to show
	Public Sub RenderEmptyGrid()
		Response.Write( "<span class='WBC_styclsTextColor1'>You do not have rights to any Resource Gallery</span>" )
	End Sub

	' ---- [Public] Gives Decorator a chance to sort the collection
	Public Sub SortCollection( strSortByColumn, colObjects, bAscending )
		Select Case strSortByColumn
			Case IDS_GRIDINDEX_NAME
				Call colObjects.SortByName( bAscending )
			Case IDS_GRIDINDEX_PATH
				Call colObjects.SortByPath( bAscending )
			Case IDS_GRIDINDEX_LASTMOD
				Call colObjects.SortByLastModifiedDate( bAscending )
		End Select
	End Sub

End Class

%>