共享点> 自定义页面库和 页面布局

发布于 2024-07-29 18:07:48 字数 2520 浏览 0 评论 0原文

我有一个自定义页面库,其中自定义内容类型和页面布局都位于站点定义内。

按预期工作。 我唯一无法解决的问题是,如果我通过 stsadm 使用 page-lib、ctype、页面布局升级解决方案,则除页面布局之外的所有内容都会更新。

ctype 中的新字段 --> 没问题 更改了页面库中的视图 --> 没问题

更新了PageLayout --> 错误

页面布局部分:

<!-- specific page-layout to display LKW data -->
    <File Url="CustomPage.aspx" Type="GhostableInLibrary" IgnoreIfAlreadyExists="TRUE" >
      <Property Name="Title" Value="$Resources:CustomLayouts,Title;" />
      <Property Name="MasterPageDescription"
                Value="$Resources:cmscore,PageLayout_BlankWebPartPage_Description;" />
      <Property Name="ContentType"
                Value="$Resources:cmscore,contenttype_pagelayout_name;" />
      <Property Name="PublishingPreviewImage"
                Value="~SiteCollection/_catalogs/masterpage/$Resources:core,Culture;/Preview Images/BlankWebPartPage.png, ~SiteCollection/_catalogs/masterpage/$Resources:core,Culture;/Preview Images/BlankWebPartPage.png" />
      <Property Name="PublishingAssociatedContentType"
                Value=";#$Resources:FieldsCTypes,cTypeDisplayName;;#0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900D38AAFB8072F441984BC947D49503947;#" />
    </File>

onet.xml 中的相关部分:

<Module Name="Home" Url="$Resources:cmscore,List_Pages_UrlName;Custom" Path="">
      <File Url="Default.aspx" Type="GhostableInLibrary" IgnoreIfAlreadyExists="TRUE">
        <Property Name="Title"
                  Value="$Resources:Layouts,DisplayName;" />
        <Property Name="ContentType"
                  Value="$Resources:cmscore,contenttype_welcomepage_name;"/>
        <Property Name="PublishingPageLayout"
                  Value="~SiteCollection/_catalogs/masterpage/CustomPage.aspx, $Resources:PalfingerPlatformsOrderRoot,LKWpageDefaultTitle;" />
        <Property Name="PublishingPageContent"
                  Value="" />
      </File>
    </Module>

奇怪的是,如果我只有一个没有底层页面库的页面布局,我可以更新页面布局。 仅当我在自定义页面库中使用自定义页面布局时,才会出现此问题。

我做了一些谷歌搜索并发现了一个提示 - 问题可能是页面布局没有被隐藏。 我用一个小示例代码检查了这一点:

SPFile file = folder.Files["Default.aspx"];
 if (file.CustomizedPageStatus == SPCustomizedPageStatus.Customized)
 {
   file.RevertContentStream();
 }

执行代码后,页面布局将升级并使用新的页面布局。

问题是这对我来说不是真正的解决方案,因为我有大约。 使用 site-def 的 1000 个网站集。 和页面布局。 更新所有这些是相当痛苦的。 有人知道这个问题的解决方案吗?

I have a custom page-library which a custom content-type and a page-layout all inside a site-definition.

Works as expected. The only thing I cannot get around is that if I upgrade the solution with the page-lib, ctype, page-layout via stsadm everything is updated except the page-layout.

New fields in the ctype --> no problem
Changed views in the page-lib --> no problem

Updated PageLayout --> ERROR

The page-layout section:

<!-- specific page-layout to display LKW data -->
    <File Url="CustomPage.aspx" Type="GhostableInLibrary" IgnoreIfAlreadyExists="TRUE" >
      <Property Name="Title" Value="$Resources:CustomLayouts,Title;" />
      <Property Name="MasterPageDescription"
                Value="$Resources:cmscore,PageLayout_BlankWebPartPage_Description;" />
      <Property Name="ContentType"
                Value="$Resources:cmscore,contenttype_pagelayout_name;" />
      <Property Name="PublishingPreviewImage"
                Value="~SiteCollection/_catalogs/masterpage/$Resources:core,Culture;/Preview Images/BlankWebPartPage.png, ~SiteCollection/_catalogs/masterpage/$Resources:core,Culture;/Preview Images/BlankWebPartPage.png" />
      <Property Name="PublishingAssociatedContentType"
                Value=";#$Resources:FieldsCTypes,cTypeDisplayName;;#0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900D38AAFB8072F441984BC947D49503947;#" />
    </File>

The relevant section in the onet.xml:

<Module Name="Home" Url="$Resources:cmscore,List_Pages_UrlName;Custom" Path="">
      <File Url="Default.aspx" Type="GhostableInLibrary" IgnoreIfAlreadyExists="TRUE">
        <Property Name="Title"
                  Value="$Resources:Layouts,DisplayName;" />
        <Property Name="ContentType"
                  Value="$Resources:cmscore,contenttype_welcomepage_name;"/>
        <Property Name="PublishingPageLayout"
                  Value="~SiteCollection/_catalogs/masterpage/CustomPage.aspx, $Resources:PalfingerPlatformsOrderRoot,LKWpageDefaultTitle;" />
        <Property Name="PublishingPageContent"
                  Value="" />
      </File>
    </Module>

The strange thing is, if I just have a page-layout with no underlying page-library I can update the page-ayout.
The problem only occurs if I use a custom page-layout inside a custom page-library.

I did some Google search and found a hint - the problem could be that the page-layout is unghosted.
I checked this with a small sample code:

SPFile file = folder.Files["Default.aspx"];
 if (file.CustomizedPageStatus == SPCustomizedPageStatus.Customized)
 {
   file.RevertContentStream();
 }

After executing the code the Page-Layout is upgraded and uses the new page-layout.

The Problem is that this is no real solution for me because I have approx. 1000 site-collections using the site-def. and the page-layout.
Updating all of them is quite painful. Does anybody know a solution for this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

江挽川 2024-08-05 18:07:48

我想评论一件事。 看起来 IgnoreIfAlreadyExists="TRUE" 无法正常工作,请参阅此链接,可能将值恢复为 FALSE 应该会有所帮助。

<File Url="CustomPage.aspx" Type="GhostableInLibrary" IgnoreIfAlreadyExists="TRUE" >

I would like to comment on one thing. Looks like IgnoreIfAlreadyExists="TRUE" is not working properly refer to this link, may be reverting the value to FALSE should help.

<File Url="CustomPage.aspx" Type="GhostableInLibrary" IgnoreIfAlreadyExists="TRUE" >
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文