SPCLONE_SITEPAGES

Parameters

Parameter Parameter Type Mode Description
@PKID int INOUT
@CurrentUsersID int IN
@NewName nvarchar(255) IN
@NewGuid uniqueidentifier IN

Definition

Copy


CREATE  PROCEDURE [dbo].[SPCLONE_SITEPAGES]
(
  @PKID        int OUTPUT,
  @CurrentUsersID int,
  @NewName    nvarchar(255),
  @NewGuid        uniqueidentifier
)

        AS

        INSERT INTO SitePages (
        Guid,
        ClientSitesID,
        PageName,
        AuthorizedRoles,
        IsAdmin,
        BaseURL,
        ExpireDate,
        PublishDate,
        TemplateID,
        TemplatePageID,
        IsTemplatePage,
        OwnerID,
        Category,
        DisplayName,
        FolderId,
        [Description],
        Keywords,
        UseTemplateKeywords,
        IsThemed,
        ThemeLayoutNumber
        )SELECT
        @NewGuid,
        ClientSitesID,
        @NewName,
        AuthorizedRoles,
        IsAdmin,
        BaseURL,
        ExpireDate,
        PublishDate,
        TemplateID,
        TemplatePageID,
        IsTemplatePage,
        @CurrentUsersID,
        Category,
        DisplayName,
        FolderId,
        [Description],
        Keywords,
        UseTemplateKeywords,
        IsThemed,
        ThemeLayoutNumber
        FROM
        SitePages
        WHERE
        ID = @PKID

        DECLARE @origPKID int
        set @origPKID=@PKID

        SELECT  @PKID = @@Identity

        exec spAuditThis @CurrentUsersID, 1, @NewGuid, 2

        /* Insert record into PageContent table */
        insert into PageContent(
        SitePagesID,
        SiteContentID,
        ContentOrder,
        PaneName
        )
        select @PKID,
        SiteContentID,
        ContentOrder,
        PaneName
        from PageContent where SitePagesID = @origPKID

        /* Copy template layout mappings */
        declare @CHANGEAGENTID uniqueidentifier;
        exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output;
        declare @CURRENTDATE datetime;
        set @CURRENTDATE = getdate();

        insert into CMSTEMPLATELAYOUT 
        (
        TEMPLATEID,
        CMSDELIVERYCHANNELID,
        SITELAYOUTSID,
        ADDEDBYID, 
        CHANGEDBYID,
        DATEADDED,
        DATECHANGED
        )
        select
        @PKID,
        CMSDELIVERYCHANNELID,
        SITELAYOUTSID,
        @CHANGEAGENTID,
        @CHANGEAGENTID,
        @CURRENTDATE,
        @CURRENTDATE    
        from CMSTEMPLATELAYOUT
        where TEMPLATEID = @origPKID;