(Redirect)How to create my own Corporate intranet(Site Definition In MOSS 2007)?(http://hermansberghem.blogspot.com/2008/04/crea

http://hermansberghem.blogspot.com/2008/04/creating-corporate-intranet-using-moss.html

How to create my own Corporate intranet?

 

This is how I would start:

  • Create a site collection using the Publishing Portal template
  • Open SharePoint designer and create a new master page
  • Use the minimal master page as a start (you can find an updated version on the Microsoft site)
  • Update the master page to your liking.
  • Add a CSS link after the other CSS links in the master page. Reference a css file, located at the _layouts/1033/styles/yourcompany/ folder. Note: this is what I like, you can also choose to upload a CSS file to your styles library of your site collection.
  • Add imagery to the same location. Reference images in your stylesheet relative to the styleheet path.

If you are done, I would suggest to package this as a solution because you don't want to deploy it manually with SharePoint designer. This is a very brief descriptions of what I would do:

  • Create a new project in Visual Studio
  • Use WSPBuilder (CodePlex) to create the initial folder structure within your project
  • Create a new feature inside the features folder called MyCompanyIntranetLayout and add your master page there. Update your feature.xml and Provisionedfiles.xml in the feature so that it provisions your master page to the _catalogs file of your site collection. Examples can be found plenty on the Net so I don't include one here. Scope the feature to the site collections.
  • Create the MyCompany folder inside the layouts/1033/styles folder of your project
  • Use WSPbuilder to create the WSP file for this and you can deploy it to your farm.

Let us face the challenges

So you have deployed you master page, custom CSS and images but they don't show up right? You will first have to activate the feature on your site collection, and change the master page using the site settings -> master page feature. Now, create a subsite and .. damn .. you'll have to do it again.

So, how to solve this. Well now we actually hit a fundamental issue and the objective of this post.

There are two options:

  • You could create a stapling feature and a feature event receiver to automate this process.
  • You could edit ONET.XML of the INTERNETBLANK site template (don't!) and add the feature and change the Chromemasterurl property.

To be honest, the second option I would never suggest. Do not touch the out of the box templates. Instead, you could create a copy of the INTERNETBLANK template and change the ONET.XML there.

So, what is the best option? As a matter of fact, we already build the masterpage as a feature so the question is how to activate it and when. Please read this excellent post from Mart Muller.

Stapling

You actually staple a feature to an existing template Configuration. An example is given below:

 

<FeatureSiteTemplateAssociation Id="B8DED45F-YOURFEATUREIDHERE" TemplateName="INTERNETBLANK#0" />

This is an excerpt from the elements.xml file of the stapling feature. Have a look at the existing examples and documentation of how to create one. Fact is that stapling gets activated after the site has been created!

Feature event receiver

Why do you need the event receiver? The event receiver is actually a dll which you build using Visual Studio and deploy with your feature in the same package. In your feature.xml file you define an eventreceiver assembly *which is your DLL*. In you DLL you have defined a method which gets called whenever you install or activate the feature. There you can switch out the default blueband.master page and replace it with your own. You can do more there! Like applying custom CSS, theme, setting navigation properties and so on.

Adding the feature to ONET.XML

Another option would be to add the the feature to the ONET.XML file and change the ChromeMasterUrl property to point to your new master.page.

Make sure that you add the feature before the property because everything in the ONET.XML will be processed sequential. Hey! That is an important difference with stapling! If you have several features that are dependent on each other and which need to get activated in a certain sequence, ONET.XML would be a good place to add them.

An example is shown below:

                <Feature ID="D7C7DCB7-C83A-4515-9F1A-38BC48B44166">
                    <!-- Company publishing layouts -->
                </Feature>
                <Feature ID="22A9EF51-737B-4ff2-9346-694633FE4416">
                    <!-- Publishing -->
                    <Properties xmlns="http://schemas.microsoft.com/sharepoint/">
                        <Property Key="ChromeMasterUrl" Value="~SiteCollection/_catalogs/masterpage/yourcompany.master"/>

Wow, when do I use stapling then?

The answer is that you use stapling when you want to add the feature to existing (out of the box) templates or more than one template.

You would not want to change the ONET.XML after it has been used by existing sites (eg. live situation).

What about Themes, page layouts, navigation properties, template selection for subsites and page defaults?

 

Every time, you face the challenge, will I add the feature through ONET.XML or use stapling. Or: will I modify the site properties through code in the event receiver or will I change ONET.XML properties?

Here are some guidelines which I think work very nicely:

Themes
  • Create a custom theme
  • Do not add it to spthemes.xml!
  • Create a feature which uses a event receiver to activate the theme on a web
  • Create a second feature to staple the activations feature to your template configuration(s)
  • Example of a themestapler can be found on CodePlex
Custom Page layouts
  • Create custom page layouts using SharePoint designer
  • When satisfied, copy them into your Visual Studio project where you define a Feature for your new layouts. This feature will also contain your new master page
  • Create a second stapling feature to provision the files to the _catalogs/masterpage folder of your site collection.
  • Create a event receiver to activate the masterpage or other settings
Site and subsite specific settings
  • I feel very comfortable with creating a copy of the INTERNETBLANK template
  • and then add a webtemp*.xml file for adding the new site template to the list of  templates
  • Change settings like navigation inhertiance through ONET.XML:

              <Feature ID="541F5F57-C847-4e16-B59A-B31E90E6F9EA">
                  <!-- Per-Web Portal Navigation Properties-->
                  <Properties xmlns="http://schemas.microsoft.com/sharepoint/">
                      <Property Key="InheritGlobalNavigation" Value="true"/>
                   <Property Key="InheritCurrentNavigation" Value="true"/>
                      <Property Key="IncludeSubSites" Value="true"/>
                      <Property Key="IncludePages" Value="false"/>
                  </Properties>
              </Feature>

  • Change settings like the available template for subsites through ONET.XML:

                <Feature ID="22A9EF51-737B-4ff2-9346-694633FE4416">
                    <!-- Publishing -->
                    <Properties xmlns="http://schemas.microsoft.com/sharepoint/">
                        <Property Key="ChromeMasterUrl" Value="~SiteCollection/_catalogs/masterpage/company.master"/>
                        <Property Key="WelcomePageUrl" Value="$Resources:cmscore,List_Pages_UrlName;/default.aspx"/>
                        <Property Key="PagesListUrl" Value=""/>
                        <Property Key="AvailableWebTemplates" Value="*-SPHEREPUBLISHING#1"/>
                        <Property Key="AvailablePageLayouts" Value=""/>
                        <Property Key="AlternateCssUrl" Value="" />
                        <Property Key="SimplePublishing" Value="false" />
                    </Properties>
                </Feature>

  • Change settings like the default page layout through ONET.XML:

<Modules>
    <Module Name="Home" Url="$Resources:cmscore,List_Pages_UrlName;" Path="">
        <File Url="default.aspx" Type="GhostableInLibrary" Level="Draft" >
            <Property Name="Title" Value="$Resources:cmscore,IPPT_HomeWelcomePage_Title;" />
            <Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/MyPageLayout.aspx, ~SiteCollection/_catalogs/masterpage/WelcomeLinks.aspx" />
            <Property Name="ContentType" Value="$Resources:cmscore,contenttype_welcomepage_name;" />
        </File>
    </Module>
</Modules>

Wrap up, rules of thumb!

 

  • This post is not the only truth! Feel free to add comments or convince me to do otherwise.
  • Create all customizations initially with SharePoint designer and after a while (first beta) deploy them through Features packaged nicely with WSPBuilder
  • Choose to staple your features whenever possible
  • Create a copy of INTERNETBLANK template and change site, subsite specific settings in ONET.XML. I use it to set add the master page feature and set the default master page. However, you could do that through stapling. Make this new site template also part of your solution!
  • I choose to use the Theme stapling from Codeplex to activate the theme on all sites (specifically for the application pages!) because I do not want to add the theme to spthemes.xml and ONET.XML does not provide a property for that!
  • Add default content to pages using the properties in ONET.XML.

Your final Visual Studio solution could look like something like this:

12     
 template    
  features   
   companylayouts  
    masterpages 
     company.master
     mylayout.aspx
     mysecondlayout.aspx
    feature.xml 
    provisionedfiles.xml 
   companythemechanger  
    feature.xml 
   companythemestapler  
    elements.xml 
    feature.xml 
  layouts   
   1033  
    styles 
     companyimages
     company.css
  sitetemplates   
   companypublishing  
    xml 
     onet.xml
    default.aspx 
  themes   
   companypublishing  
    company.inf 
    theme.css 
  GAC   
   themechanger.dll  

 

That is it! Hopefully this chaotic post helps you a little bit on how to design your Corporate Intranet. And yes, using this approach leaves everything uncustomized! So future updates through your visual studio project are reflected immediately on all sites! But keep in mind not to change ONET.XML afterwards.

 

http://blog.csdn.net/jiangxng/archive/2008/10/08/3033844.aspx

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值