//------------------------------------------------------------------
// This template defines functions for Folders Title when Folder Tree is shown
//
// Folders Title HTML is built on the fly in
// js_treefl.js in the function BuildFoldersTitle()
//
// Folders Title frame is built once, each time the main report list frame
// is refreshed as a result of navigation in Folder Tree
// only function BuildFoldersTitle() is called to refresh Title HTML.
// All Report List params and info variables that could be changed
// are taken from main report list frame. They are defined in folderandreportlistflat.txt & folderandreportlistflat.htm
// Used syntax:  FID	= (*) Action ("MainRLWindow.szParams_FID")
//
// So this template only defines the icons for folder management
// and multiple print pop-up windows.
//
// It is also included by folderpath.txt, that also needs to display these icons.
//------------------------------------------------------------------
Template (PictureOnBar)
{
	Begin Label
		Label = "<div id='bar" + StrVariable.Mode() + "' class='FolderBar'>"
		EscapeType= NONE
	End

	Begin Picture
		url = StrVariable.Url()
		highlighturl = StrVariable.HUrl()
		TipText = StrVariable.ToolTip()
		width = 17
		height = 17

		Begin Event.OnClick
			Begin OpenWindow
				TargetWindow			= WindowByName
				TargetWindowName		= StrVariable.Mode() + "FolderPopup"
				TargetWindowParameters	= StrVariable.WinParam()

				Begin Request
					RequestType	  = Base
					Lang		  = $Params.Lang
					StrTemplate   = "foldermanagement.htm"
					ElemTemplate  = "foldermanagement.txt"
					SID			  = WhenExists($UserData.SID, WhenExists($STD.csid, $params.sid))
					FID			  = (*) Action ("MainRLWindow.szParams_FID")
					SubId		  = $Params.SubID

					Begin VariableAttribute u
						Mode = StrVariable.Mode()
						Name = (*) Action ("MainRLWindow.szParams_FolderName")

						//--------------------
						//Report List state
						//--------------------
						Filter = (*) Action ("MainRLWindow.szParams_Filter")
						Sort = (*) Action ("MainRLWindow.szParams_Sort")
						ReportListFields = (*) Action ("MainRLWindow.szParams_ReportListFields")

					End
				End
			End
		End
	End

	Begin Label
		Label = "</div>"
		EscapeType = NONE
	End
}

Begin Component	FolderPath.Bar
	if(ExistsAndEqual(%User.Applicationfeatures.FolderManagementCreateFeature.ischecked, 1) )
	{
		//CREATE
		Begin StrVariable Url
			value = "gif/create.gif"
		End

		Begin StrVariable HUrl
			value = "gif/create_on.gif"
		End

		Begin StrVariable Mode
			value = "Create"
		End

		Begin StrVariable ToolTip
			value = "{!WA FolderPath.Create}"
		End

		Begin StrVariable WinParam
			value = "toolbar=0,statusbar=0,menubar=0,resizable=0,width=510,height=130"
		End

		DoTemplate(PictureOnBar)
	}

	//RENAME
	if(ExistsAndEqual(%User.Applicationfeatures.FolderManagementRenameFeature.ischecked, 1) )
	{
		Begin StrVariable Url
			value = "gif/rename.gif"
		End

		Begin StrVariable HUrl
			value = "gif/rename_on.gif"
		End

		Begin StrVariable Mode
			value = "Rename"
		End

		Begin StrVariable ToolTip
			value = "{!WA FolderPath.Rename}"
		End

		Begin StrVariable WinParam
			value = "toolbar=0,statusbar=0,menubar=0,resizable=0,width=510,height=130"
		End

		DoTemplate(PictureOnBar)
	}

	//COPY
	if(ExistsAndEqual(%User.Applicationfeatures.FolderManagementCopyFeature.ischecked, 1) )
	{
		Begin StrVariable Url
			value = "gif/copy.gif"
		End
		Begin StrVariable HUrl
			value = "gif/copy_on.gif"
		End
		Begin StrVariable Mode
			value = "Copy"
		End

		Begin StrVariable ToolTip
			value = "{!WA FolderPath.Copy}"
		End

		Begin StrVariable WinParam
			value = "toolbar=0,statusbar=0,menubar=0,resizable=0,width=510,height=350"
		End

		DoTemplate(PictureOnBar)
	}

	//MOVE
	if(ExistsAndEqual(%User.Applicationfeatures.FolderManagementMoveFeature.ischecked, 1) )
	{
		Begin StrVariable Url
			value = "gif/move.gif"
		End

		Begin StrVariable HUrl
			value = "gif/move_on.gif"
		End

		Begin StrVariable Mode
			value = "Move"
		End

		Begin StrVariable ToolTip
			value = "{!WA FolderPath.Move}"
		End

		Begin StrVariable WinParam
			value = "toolbar=0,statusbar=0,menubar=0,resizable=0,width=510,height=320"
		End

		DoTemplate(PictureOnBar)
	}

	//DELETE
	if(ExistsAndEqual(%User.Applicationfeatures.FolderManagementDeleteFeature.ischecked, 1) )
	{
		Begin StrVariable Url
			value = "gif/delete.gif"
		End

		Begin StrVariable HUrl
			value = "gif/delete_on.gif"
		End

		Begin StrVariable Mode
			value = "Delete"
		End

		Begin StrVariable ToolTip
			value = "{!WA FolderPath.Delete}"
		End

		Begin StrVariable WinParam
			value = "toolbar=0,statusbar=0,menubar=0,resizable=0,width=510,height=130"
		End

		DoTemplate(PictureOnBar)
	}
End

if(ExistsAndEqual(%User.Applicationfeatures.ReportListMultiPrintFeature.ischecked, 1) &&
	 ExistsAndEqual(%User.Applicationfeatures.ReportPrintDialogType.value, 1) // we support multiple print only for ActiveX/Plug-In mode
	)
{
	Begin Component	MultiPrintAction
		Begin Event.OnClick
			Begin OpenWindow
				TargetWindow		= WindowByName
				TargetWindowName	= "MultiReportPrintPopup"
				TargetWindowParameters	= "toolbar=0,statusbar=0,menubar=0,resizable=0,width=450,height=350"

				Begin Request
					RequestType	= Base
					Lang		= $Params.Lang
					StrTemplate	= "multiple.htm"
					ElemTemplate	= "multiple.txt"
					ErrorFlowStr	= "onerrorclose.htm"
					ErrorFlowElem	= "onerrorclose.txt"
					SID = (*) Action ("MainRLWindow.szParams_SID")
					FID = (*) Action ("MainRLWindow.szParams_FID")
				End
			End
		End
	End
}

Begin Component	ReportsTarget
if(ExistsAndEqual(%User.Applicationfeatures.ReportListUnifiedReportFeature.ischecked, 1))
{
		Begin Label
			label = %User.GeneralSettings.ReportsTarget
			EscapeType = None
		End
}
else
{
		Begin Label
			label = " "
			EscapeType = None
		End
}
if(ExistsAndEqual(%User.Applicationfeatures.reportlistconcatnatetextreportfeature.ischecked, 1))
{
	Begin Label
		label = "T"
		EscapeType = None
	End
}
else
{
	Begin Label
		label = " "
		EscapeType = None
	End
}
if(ExistsAndEqual(%User.Applicationfeatures.reportlistaddtoziparchivereportfeature.ischecked, 1))
{
	Begin Label
		label = "Z"
		EscapeType = None
	End
}
else
{
	Begin Label
		label = " "
		EscapeType = None
	End
}
if(ExistsAndEqual(%User.Applicationfeatures.restorereportsfromlongtermarchivefeature.ischecked, 1))
{
	Begin Label
		label = "R"
		EscapeType = None
	End
}
else
{
	Begin Label
		label = " "
		EscapeType = None
	End
}
End


if(ExistsAndEqual(%User.Applicationfeatures.ReportListMultiFindFeature.ischecked, 1))
{
	Begin Component	MultiFindAction
		Begin Event.OnClick
			PreCondition = "MainRLWindow.onlyTextSelected()"

			Begin OpenWindow
				TargetWindow		= WindowByName
				TargetWindowName	= "MultiFindPopup"
				TargetWindowParameters	= (*) Action("'toolbar=0,statusbar=0,menubar=0,scrollbars=0,resizable=1,top=0,left=0,screenX=0,screenY=0,height=' + screen.availHeight * .8 + ',width=' + screen.availWidth")

				Begin Request
					RequestType	= Base
					Lang		= $Params.Lang
					StrTemplate	= "multifind.htm"
					ElemTemplate	= "multifind.txt"
					ErrorFlowStr	= "onerrorclose.htm"
					ErrorFlowElem	= "onerrorclose.txt"
				End
			End
		End
	End
}
