Friday, May 1, 2009

Using resources with webpart definitions

Scenario:
I was working on a site definition and wanted to drop a Content Editor Webpart on default page. I was not sure about his content.

Solution:
I thought of using resource files and hacked the webpart we see when we land to Report Center site.

WebPart Content Tag Declaration:

<Content xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor">$Resources:spscore,ReportCenterOnet_CEWP_Content;</Content>
Resource File:
<Data Name="ReportCenterOnet_CEWP_Content">
<Value><DIV class="ms-vb">
<SPAN class="ms-announcementtitle">Report Center features include:</SPAN>
<UL>
<LI><A title="" href="../Lists/Sample KPIs/KPIListViewPage.aspx" target="">Key Performance Indicators</A> (KPIs) enable you to communicate goals, trends and track progress.</LI>
<LI><A title="" href="../ReportsLibrary/sample dashboard.aspx" target="">Dashboards</A> enable you to give a more detailed explanation of your information using Excel workbooks and KPIs. Dashboard filters make it easy to select a range of information to view. To create your own dashboard go to the <A title="" href="../ReportsLibrary/Forms/scsummpg.aspx" target="">Dashboards</A> view of the Reports library and click 'New'.</LI>
<LI>The <A title="" href="../ReportsLibrary/forms/current.aspx" target="">Reports</A> library is designed to store files containing reports and dashboards and allow easy access to information from previous time periods.</LI>
</UL>
<SPAN class="ms-announcementtitle">To prepare this Report Center for use, the following actions are suggested:</SPAN>
<UL>
<LI>View the sample <A href="../ReportsLibrary/sample dashboard.aspx">dashboard</A> and <A title="" href="../ReportsLibrary/sampleworkbook.xlsx" target="">workbook</A> to understand some of the capabilities of this Report Center</LI>
<LI>If the samples do not work correctly ask an administrator to ensure that Excel Services are enabled and that this Report Center is a Trusted Location</LI>
<LI>If you plan to use Excel to analyze information from existing data servers, create and upload data connection (ODC) files to the <A title="" href="../Data Connections" target="">Data Connection Library</A>. If you want users to create new KPI Lists then add them to the "Owners" group. Users in the "Members" group can edit pages but can not create KPI Lists.</LI>
<LI>Update or remove sample content</LI>
</UL>
</DIV></Value>
</Data>

0 comments: