<%
' ********************************************************************
' 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/Posting/
'			Common/CNCGridDecorator_PostingEopList.inc
' Version: 	Microsoft Content Management Server
' Author:	Microsoft Corporation.
' Purpose:	Implements the INCGridDecorator Interface for the Page Revision History
'			display-as-list page
'
' Implement INCGridDecorator Interface:
'	- Sub RenderSubdivisionHeadTDAttrib( strColumnIndex )
'	- Sub RenderSubdivisionHeadTDContent( strColumnIndex )
'	- Sub RenderItemTDAttrib( pObject, nCollectionIndex, nDisplayIndex, strColumnIndex )
'	- Sub RenderItemTDContent( pObject, nCollectionIndex, nDisplayIndex, strColumnIndex )
'	- Sub SortCollection( strSortByColumn, colObjects, bAscending )
' ********************************************************************


Class CNCGridDecorator_PostingEopList

	' ---- [Public] Render the column head <Tr> attributes
	Sub RenderColumnHeadTRAttrib()
		response.Write( IDS_UI_COLUMN_HEAD_BG_NS & " class='WBC_styclsBackground1' align='center' " )
	End Sub

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

	' ---- [Public] Render the column head <TD> attributes
	Public Sub RenderColumnHeadTDAttrib( strColumnIndex )

		Response.Write( "class='WBC_styclsHeavyTextColor3' align='center' valign='middle' " )
		Select Case strColumnIndex
			Case IDS_GRIDINDEX_NAME
				Response.Write("width='150'")
			Case IDS_GRIDINDEX_PROPS
				Response.Write("width='60'")
			Case IDS_GRIDINDEX_TYPE
				Response.Write("width='80'")
			Case IDS_GRIDINDEX_DEFAULT
				Response.Write("width='80'")
			Case IDS_GRIDINDEX_VALUE
				Response.Write("width='140'")
		End Select
	End Sub

	' ---- [Public] Render the column head <TD> content
	Public Sub RenderColumnHeadTDContent( strColumnIndex )

		Response.Write( "<font " & IDS_UI_COLUMN_HEAD_TEXT_NS & " class='WBC_styclsHeavyTextColor3'>" )
		Select Case strColumnIndex
			Case IDS_GRIDINDEX_NAME
				Response.Write( IDS_UI_EOP_NAME )
			Case IDS_GRIDINDEX_PROPS
				Response.Write( IDS_UI_EOP_PROPERTIES )
			Case IDS_GRIDINDEX_TYPE
				Response.Write( IDS_UI_EOP_TYPE )
			Case IDS_GRIDINDEX_DEFAULT
				Response.Write( IDS_UI_EOP_DEFAULT )
			Case IDS_GRIDINDEX_VALUE
				Response.Write( IDS_UI_EOP_VALUE )
		End Select
		Response.Write( "</font>" )
	End Sub

	' ---- [Public]
	Public Sub RenderItemTDAttrib( pObject, nCollectionIndex, nDisplayIndex, strColumnIndex )

		Response.Write( "class='WBC_styclsTextColor0' valign='middle' " )
		Select Case strColumnIndex
			Case IDS_GRIDINDEX_PROPS
				Response.Write( "align='center' " )
			Case IDS_GRIDINDEX_TYPE
				Response.Write( "align='center' " )
			Case IDS_GRIDINDEX_DEFAULT
				Response.Write( "align='center' " )
		End Select
	End Sub

	' ---- [Public]
	Public Sub RenderItemTDContent( pObject, nCollectionIndex, nDisplayIndex, strColumnIndex )
		Dim strEopId
		strEopId = IDS_TABLE_ITEM_NAME & nCollectionIndex

		Response.Write( "<font " & IDS_UI_COLUMN_ROW_TEXT_NS & " " & IDS_UI_COLUMN_FONT_SIZE_NS & " class='WBC_styclsTextColor0'>" )
		Select Case strColumnIndex
			Case IDS_GRIDINDEX_NAME

				Response.Write("<input type='hidden' name='" & strEopId & "_name" & "'  value=""")
				Call WBC_writeMBCSEopName(pObject, false)
				Response.Write("""><nobr>")
				Call WBC_writeMBCSEopName(pObject, true)
				Response.Write("</nobr>")
			Case IDS_GRIDINDEX_PROPS

				Response.Write("<a href='#' onclick='WBC_onClickPostingModifyDialog(" & nCollectionIndex & "); " & _
					"return false;'><img src='" & IDS_PATH_IMAGES_COMMON & IDS_IMG_ICON_PROPS & "' width='16' height='16' border='0' alt=''></a>")
			Case IDS_GRIDINDEX_TYPE

				Response.Write("<input type='hidden' name='" & strEopId & "_type" & _
					"' value=""" & WBC_getEopType(pObject) & """>")
				Response.Write( "<nobr>" & WBC_getEopType(pObject) & "</nobr>" )
			Case IDS_GRIDINDEX_DEFAULT


				Response.Write("<input type='hidden' name='" & strEopId & "_defaultvalue" & "' value=""")
				Call WBC_writeMBCSEopValue(pObject.DefaultValue)
				Response.Write("""><input type='hidden' name='" & strEopId & "_isdefault" & _
					"' value='" & Bool2LCaseStr(IsUsesDefaultValue(pObject)) & "'>")
				Response.Write("<img name='" & strEopId & "_image" & "' src='" & GetEopDefaultImage(pObject) & _
					"' width='22' height='10' border='0' alt=''>")
			Case IDS_GRIDINDEX_VALUE

				Response.Write("<input type='hidden' name='" & strEopId & "_value" & "' value=""")
				Call WBC_writeMBCSEopValue(pObject.Value)
				Response.Write("""><nobr><input type='text' ReadOnly onfocus='this.blur();' name='" & strEopId & "_label' value=""")
				Call WBC_writeMBCSEopValue(pObject.Value)
				Response.Write(""" size='" & WBC_getNumOfCols() & "' " & IDS_TABLE_ITEM_STYLE & "></nobr>")
		End Select
		Response.Write( "</font>" )
	End Sub

	' ---- [Public] Render the Grid content area when there are no items to show
	Public Sub RenderEmptyGrid()
		Response.Write( "<span class='WBC_styclsTextColor1'>There are no Custom Properties in this Page</span>" )
	End Sub

	' ---- [Public] Gives Decorator a chance to sort the collection
	Public Sub SortCollection( strSortByColumn, colObjects, bAscending )
		' do nothing
	End Sub

	' ---- [Private] return the "check" image if the EOP is using default value.
	Private Function GetEopDefaultImage( pObject )
		Dim strImageSrc

		If (pObject.UsesDefaultValue) Then
			strImageSrc = IDS_PATH_IMAGES_COMMON & IDS_IMG_ICON_YES
		Else
			strImageSrc = IDS_TRANSPARENT_GIF
		End If

		GetEopDefaultImage = strImageSrc
	End Function


	Private Function IsUsesDefaultValue( pObject )
		Dim bIsDefault

		If (pObject.UsesDefaultValue) Then
			bIsDefault = true
		Else
			bIsDefault = false
		End If

		IsUsesDefaultValue = bIsDefault
	End Function


	' ---- [Private] Write the hidden field for a specified property item
	Private Function WBC_getNumOfCols()
		If isIE Then
			WBC_getNumOfCols = 40
		Else
			WBC_getNumOfCols = 28
		End If
	End Function
End Class

%>