USP_SEARCHLIST_FAFPAGE

Search for current FAF event site pages

Parameters

Parameter Parameter Type Mode Description
@NAME nvarchar(100) IN Name
@SITEID int IN Filter by site
@ContentTypesID int IN
@MAXROWS smallint IN Input parameter indicating the maximum number of rows to return.

Definition

Copy


CREATE procedure dbo.USP_SEARCHLIST_FAFPAGE
(
    @NAME nvarchar(100) = null,
  @SITEID int = null,
  --@FolderID int = null,

  @ContentTypesID int = null,
    @MAXROWS smallint = 500
)
as

  declare @totalCount int;
    declare @Where nvarchar(500);
  set @Where = 'vwSitePagesTab.Deleted=0 AND ((~vwSitePagesTab.IsTemplatePage)<>0 OR (vwSitePagesTab.IsTemplatePage)<>0) AND PM.OBJECTGUID is null AND vwSitePagesTab.IsTemplatePage=0';
  if @NAME is not null
    set @Where += ' and vwSitePagesTab.PageName LIKE ''' + @NAME + '%''';

  if @SITEID is not null
    set @Where += ' and vwSitePagesTab.ClientSitesID=' + cast(@SITEID as nvarchar(20));

  --if @FolderID is not null

  --  set @Where += ' and vwSitePagesTab.FolderID=' + cast(@FolderID as nvarchar(20));


  if @ContentTypesID is not null
    set @Where += N' and dbo.fnPageHasContentType(vwSitePagesTab.ID, ' + cast(@ContentTypesID as nvarchar(20)) + ')=1'

  declare @temp table (ID int, PAGENAME nvarchar(200), TEMPLATEPAGENAME nvarchar(200), OWNER nvarchar(200), TABID int, PKID int)
  insert into @temp exec spGetPagedSQL @PKFieldName=N'vwSitePagesTab.ID',@CKFields=N'',@SelectClause=N'distinct vwSitePagesTab.id,vwSitePagesTab.PageName,vwSitePagesTab.TemplatePageName,ClientUsers.UserName AS Owner,vwSitePagesTab.Tabid',@FromClause=N'vwSitePagesTab LEFT JOIN ClientUsers ON vwSitePagesTab.OwnerID=ClientUsers.ID  left outer join (select PAGEMODELITEM.OBJECTGUID from [dbo].PAGEMODEL inner join [dbo].PAGEMODELITEM on PAGEMODEL.ID = PAGEMODELITEM.PAGEMODELID where PAGEMODEL.LOCKARTIFACTS=1)PM on PM.OBJECTGUID = vwSitePagesTab.Guid', @WhereClause=@Where,@OrderByClause=N'PageName',@ResultsPerPage=@MAXROWS,@CurrentPage=1,@RowCount=@totalCount output,@Distinct=0

  select ID, TABID, PAGENAME, TEMPLATEPAGENAME, OWNER from @temp