Home
Sitecore A/S - the Sitecore Developer Network
Contents
1. cha Jes Country City Copenhagen v Latest News Configuration Select a configuration item Current time in Copenhagen Denmark 2 50 19 PM 15 05 2008 15 09 3 news x Polar bear is added to the en ered species list Appearance Image of the Day Minimize Close Delete Edit 15 05 2008 14 37 Title The Top 10 Social Networking Annoyances News 15 05 2008 14 10 Chrome Type Spam king phishing buddy hit for 200m Default Direction Minimize Close Edit Height 8 May 2008 e c z Width C Hidden Layout Chrome State Zone Right Web Part Zone Zone Index Ee RK Early Bird at Zabriskie Point e ok mB hk KR amp be e R amp S Local intranet 100 Sitecore Web Part Framework Page 18 of 35 Sitecore is a trademark of Sitecore A S All other brand and product names are the property of their respective holders The contents of this document are the property of Sitecore A S Copyright 2001 2008 Sitecore A S All rights reserved Q sitecore Class descriptions The Sitecore Web part framework solution has some components which are similar to those of ASP NET 2 0 a WebPartManager All functionality of this class is the same as that of the standard WebPartManager Some new properties were introduced for correct instantiations of the Sitecore web parts 1 Source property defines the location of the configuration portal item T
2. public string TitleText get return titleText public string TitleCssClass get return titleCssClass public string TitleStyle ger return titleStyle public string TextCssClass get return textCssClass public string TextStyle ger return textstyle endregion region Behavior Properties public int NewsCount get Item item this ConfigItem if item null return int Parse item Fields count Value return newsCount endregion endregion region Overrides Web Part Framework Q sitecore Page 31 of 35 Sitecore is a trademark of Sitecore A S All other brand and product names are the property of their respective holders The contents of this document are the property of Sitecore A S Copyright 2001 2008 Sitecore A S All rights reserved sitecore protected override void RenderContents System Web UI HtmlTextWriter writer string borderClass GetSpecifiedAttribute class this CssClass string borderStyle GetSpecifiedAttribute style this Style Value WELTer Write String Frormar lt div 0 1 gt bord erClass borderStyle writer Write lt table border 0 width 100 height 100 gt Render Title Text string textClass GetSpecifiedAttribute class TitleCssClass CesC lass string textStyle GetSpecifiedAttribute style TitleStyle this Style Value Rende
3. server gt lt asp LayoutEditorPart ID LayoutEditorPart1l runat server gt lt ZoneTemplate gt lt PartStyle CssClass PortletBody gt lt HeaderStyle CssClass PortletCaption gt lt HeaderVerbStyle CssClass CatalogToolbutton gt lt InstructionTextStyle CssClass CatalogCaption gt lt PartTitleStyle CssClass EditPartCaption gt lt framework EditorZone gt lt td gt LI Er lt table gt Sitecore Web Part Framework Page 26 of 35 Sitecore is a trademark of Sitecore A S All other brand and product names are the property of their respective holders The contents of this document are the property of Sitecore A S Copyright 2001 2008 Sitecore A S All rights reserved Q sitecore lt contenttemplate gt lt asp updatepanel gt lt form gt lt ooOdy gt lt html gt Sitecore Web Part Framework Page 27 of 35 Sitecore is a trademark of Sitecore A S All other brand and product names are the property of their respective holders The contents of this document are the property of Sitecore A S Copyright 2001 2008 Sitecore A S All rights reserved Q sitecore World Time Sublayout ascx listing lt Control Language c AutoEventWireup true TargetSchema http schemas microsoft com intellisense ie5 gt lt S Register TagPrefix sc Namespace Sitecore Web UI WebControls Assembly Sitecore Kernel gt lt S Register Assembly System Web Extensions Version 3 5 0 0 Culture neu
4. void DisplayModeDropdown SelectedIndexChanged object sender System EventArgs args String selectedMode DisplayModeDropdown SelectedValue WebPartDisplayMode mode WebPartManagerl SupportedDisplayModes selectedMode if mode null WebPartManagerl DisplayMode mode lt SCript gt lt body gt lt form id forml runat server gt lt asp scriptmanager runat server id ScriptManagerl gt lt asp updatepanel runat server id UpdatePanell UpdateMode Conditional gt lt contenttemplate gt lt framework WebPartManager ID WebPartManagerl runat server gt lt table border 0 cellpadding 5 cellspacing 10 style width 100 bordercolor SsSilver height 100 S gt lt tr gt lt td colspan 3 style height 21px bgcolor white gt lt asp DropDownList ID DisplayModeDropdown runat server AutoPostBack true OnSelectedIndexChanged DisplayModeDropdown SelectedIndexChanged j gt p lt td gt lt tr gt lt tr gt lt td colspan 3 valign top gt lt asp CatalogZone ID CatalogZonel runat server Width 100 HeaderText Catalog Zone CssClass Catalogwindow gt lt ZoneTemplate gt lt asp PageCatalogPart ID PageCatalogPartl runat server gt lt asp DeclarativeCatalogPart ID DeclarativeCatalogPartl runat server gt lt WebPartsTemplate gt lt WebPartsTemplate gt lt asp DeclarativeCatalogPart gt lt framework SitecoreCatalogPart id SitecoreCatalogPartl runat server
5. CssClass CatalogToolbutton gt lt InstructionTextStyle CssClass CatalogCaption gt lt PartTitleStyle CssClass EditPartCaption gt lt framework EditorZone gt Two EditorPart controls are situated inside EditorZone control e AppearanceEditorPart enables end users to edit several user interface properties on an associated WebPart control such as title dimensions etc e LayoutEditorPart enables users to edit several ayout oriented user interface properties on an associated WebPart control Sitecore Web Part Framework Page 12 of 35 Sitecore is a trademark of Sitecore A S All other brand and product names are the property of their respective holders The contents of this document are the property of Sitecore A S Copyright 2001 2008 Sitecore A S All rights reserved Q sitecore Web Parts Based on Sublayouts Another way to configure the initial view for Web portal is to create a portal item with zones and controls which should be placed under the zones To implement such solution we should create additional Sitecore controls a sublayout for example You can use the World Time Sublayout ascx listing given in Chapter 12 World Time user control contains two Label controls two DropDownList controls and Label control which will display the local time of a city chosen by DropDownList controls Create a portal tem with zones The template for portal and zone items can be arbitrary In this example we use the Fold
6. Framework Pe are ee eee x PortalToolbutton cursor default display inline font pt verdana padding 4 4 4 4 color Maroon Cataloglink cursor default display inline font 9 9pt verdana padding 4 4 4 4 color Purple CatalogLabel cursor default display inline font 9pt verdana tont weight bold padding 4 4 4 4 color Maroon CatalogToolbutton cursor default display inline font pt verdana padding 4 4 4 4 color Maroon PorvtalTooloutton Hover cursor default display inline font pt verdana text decoration underline padding 0 4 0 4 Sitecore Web Part Framework Page 34 of 35 Sitecore is a trademark of Sitecore A S All other brand and product names are the property of their respective holders The contents of this document are the property of Sitecore A S Copyright 2001 2008 Sitecore A S All rights reserved Q sitecore PortletOptions border top px solid b6b8cb text aligniright padding 4 CatalogWindow margin 0 0 12 0 padding O 0 0 0 width 100 border solid lpx B6B8CB background icicrr l CatalogCaption font bold 8pt tahoma width 100 CatalogBody border top none background white PortletWindow margin 0 0 12 0 padding 0 0 0 0 width 100 border solid lpx B6B8CB border top none PortlecCaption background f 8f8fa url sitecore portal tech c
7. Guest exists in the extranet database and has a blank password Sitecore Web Part Framework Page 6 of 35 Sitecore is a trademark of Sitecore A S All other brand and product names are the property of their respective holders The contents of this document are the property of Sitecore A S Copyright 2001 2008 Sitecore A S All rights reserved Q sitecore This page contains web part based on standard ASP NET calendar control and DropDownList DropDownList is used to display the page modes browse design edit and catalog In the browse mode web parts situated in the page statically and users are able to minimize web parts or close them In the design mode users are able to move web parts on the page However web parts can be situated only inside of web part zones E Portal Page Windows Internet Explorer o X JS X E http flocalhost wpf 20sample aspx File Edit view Favorites Tools Help we a SPortal Page i Design Mode v Left Web Part Zone Right Web Part Zone Se AG Minimize Close J Local intranet 100 Sitecore Web Part Framework Page 7 of 35 Sitecore is a trademark of Sitecore A S All other brand and product names are the property of their respective holders The contents of this document are the property of Sitecore A S Copyright 2001 2008 Sitecore A S All rights reserved sitecore Edit mode allow users to change properties of web parts An Editor
8. Source 083EE64E BEAE 4AF6 BE83 684FC2D6925D gt lt ZoneTemplate gt lt InstructionTextStyle CssClass CatalogCaption gt lt HeaderVerbStyle CssClass CatalogToolbutton gt lt PartTitleStyle CssClass CatalogCaption gt lt PartChromeStyle CssClass CatalogBody gt lt PartLinkStyle CssClass CatalogLink gt lt PartStyle CssClass CatalogWindow gt lt SelectedPartLinkStyle CssClass CatalogLabel gt lt HeaderStyle CssClass PortletCaption gt lt asp CatalogZone gt eJd lt tr gt lt tr gt Sitecore Web Part Framework Page 25 of 35 Sitecore is a trademark of Sitecore A S All other brand and product names are the property of their respective holders The contents of this document are the property of Sitecore A S Copyright 2001 2008 Sitecore A S All rights reserved sitecore lt td valign top width 40 bgcolor white gt lt framework WebPartZone ID WebPartZonel runat server Padding 6 Width 100 HeaderText Left Web Part Zone BorderStyle NotSet PartChromeType TitleOnly WebPartVerbRenderMode TitleBar gt lt ZoneTemplate gt lt ZoneTemplate gt lt PartStyle CssClass PortletBody gt lt PartChromeStyle CssClass PortletWindow gt lt PartTitleStyle CssClass PortletCaption gt lt TitleBarVerbStyle CssClass PortalToolbutton gt lt framework WebPartZone gt lt td gt lt td valign top width 40 bgcolor white gt lt framework WebPartZone ID WebPart
9. Zone becomes visible when a Web Parts page enters edit mode Click Edit button in the caption of web part and Editor Zone will appear There you can modify caption dimensions appearance etc Go X 6 http flocalhost wpf 20sample aspx Portal Page Windows Internet Explorer o ey Fie Edit view Favorites Tools Help w amp Pora Page Edit Mode m Left Web Part Zone Right Web Part Zone Minimize Close Add a Web Part to this zone by dropping it here Editor Zone Modify the properties of the Web Part then click OK or Apply to apply your changes Appearance Title Calendar Chrome Type Default Direction Height 20 piels _ Width 330 pixels O Hidden Layout Chrome State Zone Left Web Part Zone x Zone Index _ 0 a Local intranet Close 100 Catalog mode gives users ability to add new web parts or web parts closed before Available Web Parts catalog contains web parts which realized as items in the content tree Sitecore Web Part Framework Page 8 of 35 Sitecore is a trademark of Sitecore A S All other brand and product names are the property of their respective holders The contents of this document are the property of Sitecore A S Copyright 2001 2008 Sitecore A S All rights reserved Q sitecore Close Calendar and it will appear in the Page Catalog of Catalog Zone Select this catalog c
10. the parent item of all Sitecore web parts Sitecore system modules web parts You should be logged into the Sitecore front end to work in catalog mode design and edit modes Sitecore Web Part Framework Page 20 of 35 Sitecore is a trademark of Sitecore A S All other brand and product names are the property of their respective holders The contents of this document are the property of Sitecore A S Copyright 2001 2008 Sitecore A S All rights reserved Q sitecore If you work with partial portal for example you use the same layout for different items Personalization option of the WebPartManager is set to PerLayout Each item has common set of zones and custom zones you should be aware of the fact that the state of one page may be overwritten by the state of another page Say we use one layout with 3 zones the third zone is hidden for some item If we change the portal state from this item which has only 2 zones the state for 3 rd zone will be lost Sitecore Web Part Framework Page 21 of 35 Sitecore is a trademark of Sitecore A S All other brand and product names are the property of their respective holders The contents of this document are the property of Sitecore A S Copyright 2001 2008 Sitecore A S All rights reserved Q sitecore Security notes You can manage the portal configuration with the Sitecore security tools For example you can deny read access rights to some web parts for customers Inaccessible
11. web parts will be removed from the portal page Note the state of the removed web parts won t be restored after read access rights are given Default configuration for these items predefined items in zones will be used on portal page when access is granted Sitecore Web Part Framework Page 22 of 35 Sitecore is a trademark of Sitecore A S All other brand and product names are the property of their respective holders The contents of this document are the property of Sitecore A S Copyright 2001 2008 Sitecore A S All rights reserved Q sitecore Global Zones It is possible to create a solution with global zones for example you can create a portal with global zones configure it and add configured zones to other pages on your site PersonalizationScope property has been added to the Sitecore WebPartManager control for the purpose Default value for this property is PerPage This means that WebPartManager works as a standard ASP NET web part manager e g web part state will be saved for each page separately I you want to use the global zone set the PersonalizationScope property to Global This means than the personalization info for all pages will be stored with the same key So you can render one or more zones configured on the portal page on different pages You should place Sitecore WebPartManager control on the layout and set PersonalizationScope property to Global for the purpose By using the placeholders or by adding zones to
12. Font Bold True Font Size 8pt ForeColor White gt lt DayHeaderStyle Font Bold True Font Size 8pt ForeColor 333333 Height 8pt gt lt TitleStyle BackColor 333399 BorderStyle Solid Font Bold True Font Size 12pt ForeColor White Height 12pt gt lt asp Calendar gt lt ZoneTemplate gt lt PartStyle CssClass PortletBody gt lt PartChromeStyle CssClass PortletWindow gt lt PartTitleStyle CssClass PortletCaption gt lt TitleBarVerbStyle CssClass PortalToolbutton gt lt framework WebPartZone gt Sitecore Web Part Framework Page 11 of 35 Sitecore is a trademark of Sitecore A S All other brand and product names are the property of their respective holders The contents of this document are the property of Sitecore A S Copyright 2001 2008 Sitecore A S All rights reserved Q sitecore The other aspect of modifying Web Parts pages includes editing Users can edit the appearance layout behavior and other properties of the visible Web Part controls EditorZone control provides these editing features lt framework EditorZone ID EditorZonel runat server CssClass Catalogwindow gt lt ZoneTemplate gt lt asp AppearanceEditorPart ID AppearanceEditorPartl runat server gt lt asp LayoutEditorPart ID LayoutEditorPartl runat server gt lt ZoneTemplate gt lt PartStyle CssClass PortletBody gt lt HeaderStyle CssClass PortletCaption gt lt HeaderVerbStyle
13. Sitecore A S Copyright 2001 2008 Sitecore A S All rights reserved Q sitecore WebPart Control in Edit Mode Let s create the Sitecore WebPart control which can be displayed in the Edit mode and can be configured from the Sitecore Items Create a control which derives from Sitecore Modules WebPartFramework Web WebParts WebPart class WebPart for the purpose This class contains several additional properties which allow retrieving WebPartlItem Configuration item and ReferredItem ReferredItem property can be used to get the web part which was created from the predefined item for this control Let s create the News WebPart control which shows the latest news This control retrieves the source and the number of items to show from the Web Part configuration item The template of the news items must contain the Date and the Description text fields the content of these fields will be shown m sitecore Po olar Bear Br I amp content lm i py E i Home E Gd Gallery a Data E Gd myPortal Date DW Fonel 15 05 2008 15 09 w zonez F Description ls Mews a REIER Polar bear is added to the endangered species list The listing of the News control can be found in Chapter 13 7 1 Item based on the Web Part template Create an item based on the Web Part template Fill the Type field with full class name and Assembly name In our solution the load string is Sitecore Modules WebPartFramework Examples News NewsWe
14. Web Parts e DeclarativeCatalogPart gives ability to a user add Web Parts inserted directly in it WebPartsTemplate tag e SitecoreCatalogPart gives ability to a user add Web Parts realized as items It refers to the Catalog item in the content tree Use the Source attribute for the purpose 083 EE64E BEAE 4AF6 BE83 684FC2D6925D is the Catalog Item ID Note WPF Layout uses the DefaultFramework stylesheet which can be found here Within the Web Parts control set a zone is a region on a Web page that contains Web Parts controls All web parts presented on a page must be situated inside of Web Part zones Our page consists of two Web Part zones One of them is empty and the other contains the definition of the ASP NET Calendar control lt framework WebPartZone ID WebPartZone2 runat server Padding 6 Width 100 HeaderText Right Web Part Zone BorderStyle NotSet PartChromeType TitleOnly WebPartVerbRenderMode TitleBar gt lt ZoneTemplate gt lt asp Calendar Title Calendar ID Calendari runat server BackColor White BorderColor Black BorderStyle Solid CellSpacing 1 Font Names Verdana Font Size 9pt ForeColor Black Height 250px NextPrevFormat ShortMonth Width 330px gt lt SelectedDayStyle BackColor 333399 ForeColor White gt lt TodayDayStyle BackColor 999999 ForeColor White gt lt DayStyle BackColor CCCCCC gt lt OtherMonthDayStyle ForeColor 999999 gt lt NextPrevStyle
15. Zone2 runat server Padding 6 Width 100 HeaderText Right Web Part Zone BorderStyle NotSet PartChromeType TitleOnly WebPartVerbRenderMode TitleBar gt lt ZoneTemplate gt lt asp Calendar Title Calendar ID Calendari runat server BackColor White BorderColor Black BorderStyle Solid CellSpacing 1 Font Names Verdana Font Size 9pt ForeColor Black Height 250px NextPrevFormat ShortMonth Width 330px gt lt SelectedDayStyle BackColor 333399 ForeColor White gt lt TodayDayStyle BackColor 999999 ForeColor White gt lt DayStyle BackColor CCCCCC gt lt OtherMonthDayStyle ForeColor 999999 gt lt NextPrevStyle Font Bold True Font Size 8pt ForeColor White gt lt DayHeaderStyle Font Bold True Font Size 8pt ForeColor 333333 Height 8pt gt lt TitleStyle BackColor 333399 BorderStyle Solid Font Bold True Font Size 12pt ForeColor White Height 12pt gt lt asp Calendar gt lt ZoneTemplate gt lt PartStyle CssClass PortletBody gt lt PartChromeStyle CssClass PortletWindow gt lt PartTitleStyle CssClass PortletCaption gt lt TitleBarVerbStyle CssClass PortalToolbutton gt lt framework WebPartZone gt lt td gt lt td valign top width 20 bgcolor white gt lt framework EditorZone ID EditorZonel runat server CssClass CatalogWindow gt lt ZoneTemplate gt lt asp AppearanceEditorPart ID AppearanceEditorPartl runat
16. ap m gif repeat x Font bold Spt tahoma width 1003 border bottom sty le solid border bottom width 1px border bottom color b6becb EditPartCaption font bold Spt tahoma PortletBody border top none background fcrere Sitecore Web Part Framework Page 35 of 35 Sitecore is a trademark of Sitecore A S All other brand and product names are the property of their respective holders The contents of this document are the property of Sitecore A S Copyright 2001 2008 Sitecore A S All rights reserved
17. bPartsProject Sitecore Web Part Framework Page 17 of 35 Sitecore is a trademark of Sitecore A S All other brand and product names are the property of their respective holders The contents of this document are the property of Sitecore A S Copyright 2001 2008 Sitecore A S All rights reserved sitecore Also you must create a special template and place the configuration items based on this template under Web Part items This template must contain the Count and Source text fields El Modules ane El web Parts ei 3 news amp h l Composite Sitecore Rendering I E News Web Part Data l 3news Count i So news 3 Gd DW Proxies Q Publishing targets Stair E Settings sitecore content home News Note In order to display browser friendly names for the WebParts and Config items instead of item names please fill in the Title field Now you can add the News WebPart from the Catalogue and edit it in Edit mode Portal Page Win nternet Explorer f GO http localhost wpf 20sample aspx v x lLive Search p z File Edit View Favorites Tools Help we we E Portal Page l ig dh v z Edit Mode Configuration form for Sitecore News Web Part News Sitecore Web Part Left Web Part Zone Right Web Part Zone Editor Zone Close pe Modify the properties of the Web Part World Time Minimize Close Edit News Minimize Close Delete then click OK or Apply to apply your
18. cture below Name system 2 Aliases Dictionary a Field types py Languages S Modules J web Parts Title Composite Reference rendering title Referred Renderings shared 493B3483 0F47 4484 8FC9 4680991CF 743 493B3483 0F47 4484 8FC9 4680991CF 743 4908CF 1F 00E4 4021 A8E9 8D2B DataSources fsitecore content home test sitecore content home portalitem2 Spellcheck v E E NewsWebPart E Web pat EEE ReferendceRendering template consists of 3 fields Title Reference Renderings and DataSources Use Title field to display custom control title If the Title filed is empty the item DisplayName will be substituted with the web part title Use Reference Rendering field to add items which should be rendered as a single web part You will be able to add only simple renderings such as xsl file xml control Url renderings and method renderings to composite control Control IDs should be separated by the pipes as shown in the picture above You can also assign a datasource for each rendering by specifying item IDs or paths and separating them with pipes The IDs should appear in the same order as the renderings That is the first datasource ID should correspond to the first rendering the second ID to the second rendering and so on Sitecore Web Part Framework Page 15 of 35 Sitecore is a trademark of Sitecore A S All other brand and product names are the pro
19. ecore layout Layouts WPF Layout The layout which defines the presentation of the WPF Sample item e Templates under sitecore templates webpart framework o WebPart the template which defines web part items based on assemblies o ReferenceRendering the template which allows defining composite web part items the ones which are not derived from SitecoreWebPart class based on standard Sitecore renderings such as XslRendering XmlControl UrlRendering MethodRendering o Web Part Node the template which allows creating predefined configuration for web part zones e sitecore system modules web parts the framework catalogue item Under this item you can create your web parts from Web Part and ReferenceRendering templates The package also creates the WebPartFramework config file in the App_Config Include folder This file contains the module configuration strings To use the Web Part Framework you should change the following nodes in your web config file manually 2 1 configuration system web Add the following lines to lt configuration gt lt system web gt node Sitecore Web Part Framework Page 4 of 35 Sitecore is a trademark of Sitecore A S All other brand and product names are the property of their respective holders The contents of this document are the property of Sitecore A S Copyright 2001 2008 Sitecore A S All rights reserved Q sitecore lt webParts gt lt personalization defaultPro
20. ent Javaboript gt lt meta Neme Vs targetochema content http schemas microsoft com intellisense ie5 gt lt link href DefaultFramework css rel stylesheet gt lt head gt lt script runat server gt protected override void OnPreInit EventArgs e if Sitecore Context IsLoggedIn Sitecore Security Authentication AuthenticationManager Login extranet WPFGuest wpf void Page Load object sender EventArgs e if this Page IsPostBack DisplayModeDropdown Items Clear System Web UI WebControls WebParts WebPartManager webPartManagerl System Web UI WebControls WebParts WebPartManager GetCurrentWebPartManager Page 7 String browseModeName Sitecore Modules WebPartFramework Web WebParts WebPartManager BrowseDisplayMode Name Fill the dropdown with the names of supported display modes foreach WebPartDisplayMode mode in webPartManagerl SupportedDisplayModes String modeName mode Name Make sure a mode is enabled before adding it Sitecore Web Part Framework Page 24 of 35 Sitecore is a trademark of Sitecore A S All other brand and product names are the property of their respective holders The contents of this document are the property of Sitecore A S Copyright 2001 2008 Sitecore A S All rights reserved Q sitecore if mode IsEnabled webPartManager1 ListiIitem item new ListItem modeName Mode modeName DisplayModeDropdown Items Add item
21. er template MyPortal Zonet qi Zonez Now create an item under Zonel which will refer to our sublayout Use the Web Part Node template for the item This template has a single Section Data with a single text field WebPartItem Base template is Standard Template Zone with a field should look as shown in the picture below E sitecore j i i baml Can an EBs Il gt a i Sublayout Portal Sample hy Be iy Home GJ MyPortal Data E Zonet Reference to Web Part un ined sh I lt gt E 493B3A83 0FA7 4484 8FC9 4680991CF743 2one2 where 8D5E6712 8ECF 419C 817D A2CB5CCD8B57 is sublayout ID Note you can refer to the web parts defined under sitecore system modules Web Parts controls renderings as well as to the sublayouts as shown in the previous picture Note you can use any template for predefined web part item with different fields but for default reference will be taken from field with WebPartItem name If you want to change it you should redefine ReferenceFieldName property for Sitecore WebPartZone on the layout Sitecore Web Part Framework Page 13 of 35 Sitecore is a trademark of Sitecore A S All other brand and product names are the property of their respective holders The contents of this document are the property of Sitecore A S Copyright 2001 2008 Sitecore A S All rights reserved Q sitecore Now we should l
22. es are the property of their respective holders The contents of this document are the property of Sitecore A S Copyright 2001 2008 Sitecore A S All rights reserved News cs listing using System using System Collections Generic using System Text using Sitecore Modules WebPartFramework Web WebParts using System Collections using Sitecore Data Items using Sitecore Globalization using Sitecore Configuration using Sitecore SecurityModel using Sitecore namespace Sitecore Modules WebPartFramework Examples public class News WebPart region Variables private string titleCssClass private string textCssClass private string titleText Latest News private string sourceNode sitecore content Home private int newsCount 0 endregion region Properties region Appearance properties public string SourceNode cet using new SecurityEnabler Item item this ConfigItem if item null return item Fields source Value return sourceNode Sitecore Web Part Framework String Empty private string titleStyle string Empty string Empty private string textStyle string Empty sitecore Page 30 of 35 Sitecore is a trademark of Sitecore A S All other brand and product names are the property of their respective holders The contents of this document are the property of Sitecore A S Copyright 2001 2008 Sitecore A S All rights reserved Sitecore
23. his property can take on the following values 1 Portal Item id for example 601a51d4 87f3 4f2 1 a3 1e cS5eal26e0d90 2 Absolute path to the portal Item for example Sitecore content home MyPortal 3 Relative path to the portal Item for example MyPortal In this case the full path to the portal item will be current item _path MyPortal 4 Empty string In this case the path to portal item will be current item path ii PersonalizationScope property defines the scope of the portal This property can take on the following values 1 Global all web parts and web zones will be stored in the same place If the PersonalizationScope is set to Global the WebZones with the same ID placed on different layouts will be rendered the same way Sitecore Web Part Framework Page 19 of 35 Sitecore is a trademark of Sitecore A S All other brand and product names are the property of their respective holders The contents of this document are the property of Sitecore A S Copyright 2001 2008 Sitecore A S All rights reserved Notes Q sitecore 2 PerLayout all items which refer to the same layout with portal will accept the same configuration data This allows to include or exclude additional zones for different items and preserve the configuration for common zones at the same time 3 PerPage the configuration for zones will be unique for each page b WebPartZone C Thi
24. hoose name of the web part destination zone and click add button Calendar web part will appear in chosen zone Portal Page lt Windows Internet Exp porer nnn o l Jog Go v http flocalhost wpf gt 20sample aspx p 4 x Fie Edit View Favorites Tools Help w Gi Gort Page Catalog Mode v Catalog Zone Select the catalog you would like to browse Page Catalog 1 Declarative Catalog 0 Available Web Parts 0 Add to Let Web Par Zone_ e Ad ose Left Web Part Zone Right Web Part Zone Add a Web Part to this zone by dropping it here Add a Web Part to this zone by dropping it here Local intranet Qio Sitecore Web Part Framework Page 9 of 35 Sitecore is a trademark of Sitecore A S All other brand and product names are the property of their respective holders The contents of this document are the property of Sitecore A S Copyright 2001 2008 Sitecore A S All rights reserved Q sitecore Web Part Zones Let s examine the content of the WPF Layout which defines the representation of the page described in Chapter 3 Web Part Framework is based on AJAX technology So layout must contain ScriptManager control which that sits on your Web Form and enables the core of ASP NET AJAX lt asp scriptmanager runat server id ScriptManagerl gt Moreover all other controls and zones are situated inside UpdatePanel control The controls within UpdatePanel can be asynchr
25. ink the created zones in WPF Layout with the created items We should specify the sources of the Web Part Manager and Zones for the purpose See the listing below lt framework WebPartManager ID WebPartManagerl runat server Source sitecore content home myportal gt lt framework WebPartZone ID WebPartZonel runat server Source Zonel Padding 6 Width 100 lt framework WebPartZone ID WebPartZone2 runat server Source Zone2 Padding 6 Width 100 Now our zones are filled from the layout as well as from Sitecore items Refresh the portal page It should look like this Portal Page Windows Internet Explorer ale re SAZ 6A http flocalhost wpf 20sample aspx File Edit view Favorites Tools Help ww Portal Page Browse Mode x World Time Minimize Close cas Ciy Current time in Copenhagen Denmark 1 10 58 PM Minimize Close Local intranet Q100 Sitecore Web Part Framework Page 14 of 35 Sitecore is a trademark of Sitecore A S All other brand and product names are the property of their respective holders The contents of this document are the property of Sitecore A S Copyright 2001 2008 Sitecore A S All rights reserved Q sitecore Creating the Composite Control To define the new composite control you should create new item based on ReferenceRendering template under sitecore system modules web parts as shown in the pi
26. layout directly from portal page you can add or remove global zones which will be rendered Note Zone ID for zones should be the same as on the portal page but you can set different set of styles Note Due to the fact that the common key is used for storing portal configuration you should use the global zones in browse mode only on the non portal pages Sitecore Web Part Framework Page 23 of 35 Sitecore is a trademark of Sitecore A S All other brand and product names are the property of their respective holders The contents of this document are the property of Sitecore A S Copyright 2001 2008 Sitecore A S All rights reserved Q sitecore WPF Layout aspx listing lt S Page Language C AutoEventWireup true S gt lt S Register tagPrefix asp namespace System Web UI assembly System Web Extensions Version 3 5 0 0 Culture neutral PublicKeyToken 31BF3856AD364E35 gt lt S Register TagPrefix framework Namespace Sitecore Modules WebPartFramework Web WebParts Assembly Sitecore WebPartFramework gt lt DOCTYPE html PUBLIC W3C DTD XHTML 1 0 Transitional EN http www w3 org TR xhtml1 DTD xhtmll transitional dtd gt lt html xmlns http www w3 org 1999 xhtml gt lt head runat server gt lt title gt Portal Page lt title gt lt meta http equiv Content Type content text html charset UTF 8 gt lt meta name CODE LANGUAGE content C gt lt meta Name vs defaultCilientocript cont
27. logZone control provides a list or catalog of controls that users can add to a page lt asp CatalogZone ID CatalogZonel runat server Width 100 HeaderText Catalog Zone CssClass Catalogwindow gt lt ZoneTemplate gt lt asp PageCatalogPart ID PageCatalogPartl runat server gt Sitecore Web Part Framework Page 10 of 35 Sitecore is a trademark of Sitecore A S All other brand and product names are the property of their respective holders The contents of this document are the property of Sitecore A S Copyright 2001 2008 Sitecore A S All rights reserved Q sitecore lt asp DeclarativeCatalogPart ID DeclarativeCatalogPartl runat server gt lt WebPartsTemplate gt lt WebPartsTemplate gt lt asp DeclarativeCatalogPart gt lt framework SitecoreCatalogPart id SitecoreCatalogPartl runat server Source 083EE64E BEAE 4AF6 BE83 684FC2D6925D gt lt ZoneTemplate gt lt InstructionTextStyle CssClass CatalogCaption gt lt HeaderVerbStyle CssClass CatalogToolbutton gt lt PartTitleStyle CssClass CatalogCaption gt lt PartChromeStyle CssClass CatalogBody gt lt PartLinkStyle CssClass CatalogLink gt lt PartStyle CssClass CatalogWindow gt lt SelectedPartLinkStyle CssClass CatalogLabel gt lt HeaderStyle CssClass PortletCaption gt lt asp CatalogZone gt Three CatalogPart controls are situated inside CatalogZone control e PageCatalogPart contains closed by a user
28. milarly to the ASP NET Web Part framework the following elements can be web parts e Any existing ASP NET control including standard Web controls custom server controls and user controls ascx e Custom Web Parts controls that derive from the WebPart class Sitecore Web Part Framework is based on NET 3 5 Web Part framework and extends it in the following way e Standard Sitecore sublayouts and renderings can be used as web parts e Web parts can be configured using the Sitecore items e Sitecore security model is respected in terms of accessing different web parts The user specific information and the settings are accessible easily both from the Sitecore NET API and XSLT functions Sitecore Web Part Framework Page 3 of 35 Sitecore is a trademark of Sitecore A S All other brand and product names are the property of their respective holders The contents of this document are the property of Sitecore A S Copyright 2001 2008 Sitecore A S All rights reserved Q sitecore Installation Sitecore Web part framework is distributed as a standard Sitecore package hence in order to start using it you should install the package After the package installation the following items will be added to the database e sitecore content Home WPF Sample The item which demonstrates the abilities of web parts Note Sample item is installed under the Home item So the Home item will appear in your current site if you have deleted it e sit
29. onously updated through the facilities of AJAX lt asp updatepanel runat server id UpdatePanell UpdateMode Conditional gt lt contenttemplate gt lt contenttemplate gt lt asp updatepanel gt WebPartManager serves as the central control of the Web Parts control set managing all the Web Parts controls functionality and events that occur on a Web page There must be only one instance of the WebPartManager control on each page that uses Web Parts controls and it must be placed before any zone controls are placed lt framework WebPartManager ID WebPartManagerl runat server gt The ability to change page modes 1s realized by DropDownList coupled with corresponding script code This code is rather straight forward Only one thing could pay your attention Sitecore Security Authentication AuthenticationManager Login extranet WPFGuest W j wpf W This line is used to authenticate the user as WPFGuest on page load event This user will be added to the Core database after the installation of the WPF module package Feel free to change the extranet user credentials to some other values A key feature of Web Parts controls is that they allow end users to modify or personalize Web pages according to their preferences and save their personalized settings for future browser sessions One aspect of modifying Web Parts pages includes the ability to add WebPart controls or other server controls to a Web Parts page The Cata
30. perty of their respective holders The contents of this document are the property of Sitecore A S Copyright 2001 2008 Sitecore A S All rights reserved sitecore Refresh the portal page After you select Catalog mode mode you will see the design page where you can choose the available Sitecore Web parts and add them to the page al Page Win ernet Explorer wey fi Ia T http localhost wpf 20sample aspx v 4 x lLive Search File Edit View Favorites Tools Help we we Portal Page Catalog Mode a amp Catalog Zone Select the catalog you would like to browse Page Catalog 0 ASP NET 2 0 standard catalog options Declarative Catalog 0 Available Web Parts 2 Available Sitecore Web Parts Available Web Parts CO Image of the Day E News Add to Left Web Part Zone Left Web Part Zone Right Web Part Zone World Time Minimize Close Country Denmark a Ciy Copenhagen a Current time in Copenhagen Denmark 1 51 59 PM Minimize Close g May 2008 a amp 5 g 0 Minimize Close Delete O S a a amp Be Ee w NB b amp Composite Sitecore WebPart control Early Bird at Zabriskie Point a Local intranet Sitecore Web Part Framework Page 16 of 35 Sitecore is a trademark of Sitecore A S All other brand and product names are the property of their respective holders The contents of this document are the property of
31. rText TitleText textClass textStyle writer Item parent Sitecore Context Database Items SourceNode if parent null Item items GetChildren parent Sitecore Globalization Language contextLanguage Sitecore Context Language int news items Length if NewsCount gt 0 amp amp NewsCount lt news news NewsCount for int 1 0 i lt news i RenderItem items i writer contextLanguage Wre_per Write lt table gt Writer write lt dive protected void RenderText string text string textClass string textStyle System Web UI HtmlTextWriter output output Write string Format lt div 0 l gt textClass textStyle output Write text o tput Write lt div gt protected void RenderItem Item item System Web UI HtmlTextWriter output Language contextLanguage l Item renderedItem item output Write String Format lt p 10 4172 GetSpecifiedAttribute class TextCssClass CssClass GetSpecifiedAttribute style TextStyle this Style Value try output Write string Format lt span style font size 80 gt item Paths GetFriendlyUrl output Write item Fields Date ToString output Write lt span gt output Write string Format lt br gt lt a href 0 target self text decoration none gt item Paths GetFriendlyUrl output Write item Fields Description ToString Sitecore Web Pa
32. rt Framework Page 32 of 35 Sitecore is a trademark of Sitecore A S All other brand and product names are the property of their respective holders The contents of this document are the property of Sitecore A S Copyright 2001 2008 Sitecore A S All rights reserved Q sitecore output Write lt a gt catch Exception ex string s ex Message output Write lt p gt j endregion region Protected Scope protected string GetSpecifiedAttribute string attributeName params string attributeValues string attr GetAttribute attributeValues 1f attr l string Empty return string Format O 1 attributeName attr return string Empty protected string GetAttribute params string attributeValues for int 1 0 1 lt attributeValues Length itt if attributeValues i null amp amp attributeValues i Trim Length gt 0 return string Format 0 attributeValues i return string Empty protected Item GetChildren Item item return item Children ToArray endregion Sitecore Web Part Framework Page 33 of 35 Sitecore is a trademark of Sitecore A S All other brand and product names are the property of their respective holders The contents of this document are the property of Sitecore A S Copyright 2001 2008 Sitecore A S All rights reserved Q sitecore DefaultFramework css listing ee ae a ee ee x Portal
33. rved Q sitecore Timmeri Tick this null protected void dropCity SelectedindexChanged object sender EventArgs e Timer Tick this null lt SCript gt lt asp Label ID Label1l runat server Text Country gt lt asp DropDownList ID dropCountry runat server OnSe ected ndexChangeo CGropCountry Se lectedIndexChanged AutoPostCBack IrusT gt lt asp ListItem Value 0 gt Denmark lt asp ListItem gt lt asp ListItem Value 1 gt Ukraine lt asp ListItem gt lt asp ListItem Value 2 gt USA lt asp ListItem gt lt asp DropDownList gt amp nbsp lt asp Label ID l1b1City runat server Text City gt lt asp DropDownList ID dropCity runat server OnSelectedIndexChanged dropCity SelectedIndexChanged AutoPostBack True gt lt asp ListItem Value 2 gt Copenhagen lt asp ListItem gt lt asp DropDownList gt lt p gt lt br 7 gt lt asp UpdatePanel ID UpdatePanelTime runat server UpdateMode Conditional gt lt ContentTemplate gt lt asp Timer ID Timerl runat server Interval 1000 OnTick Timerl Tick gt lt asp Label ID l1blInfo runat server Text Current time in gt amp nbsp lt asp Label ID l1b1Time runat server Text 12 33 33 Font Bold False ForeColor Navy gt lt asp Label gt lt ContentTemplate gt lt asp UpdatePanel gt Sitecore Web Part Framework Page 29 of 35 Sitecore is a trademark of Sitecore A S All other brand and product nam
34. s component is analogous to standard WebPartZone with two additional properties Source and ReferenceFieldName The webpart zone has a property named ReferenceFieldName The value of this property is the Item s field name which contains the web part ID which will be loaded to the portal The ID may be the ID of the web part placed under Sitecore system modures web parts or the ID of a standard Sitecore rendering for instance Sublayout XSL file XML Control etc See the example items under Sitecore content home MyPortal for more details Source property is analogous to the Source property of WebPartManager and can take on the following values i Zone Item id source to current web part zone will be the Zone item with corresponding ID the Source property defined in WebPartManager will be ignored in this case ii Absolute path full path to the zone configuration item the Source property defined in WebPartManager will be ignored iii Relative path Relative path to the zone configuration item The resulting path will be portal source of webpartmanager relative_path iv Empty string The current item will be the configuration item for the zone SitecoreCatalogPart Sitecore catalog specific part which allows modifying the CatalogZone DeclarativeCatalogPart and other zones SitecoreCatalogPart has the Source property which works in the same way as that of the WebPartManager This property should point to
35. sitecore compelling web experiences Sitecore Web Part Framework Administrator s Guide Installation and configuration advice for administrators and developers Table of Contents Chapter 1 Introduction Chapter 2 Installation 2 1 configuration system web Chapter 3 User manual Chapter 4 Web Part Zones Chapter 5 Web Parts Based on Sublayouts Chapter 6 Creating the Composite Control Chapter 7 WebPart Control in Edit Mode 7 1 Item based on the Web Part template Chapter 8 Class descriptions Chapter 9 Security notes Chapter 10 Global Zones Chapter 11 WPF Layout aspx listing Chapter 12 World Time Sublayout ascx listing Chapter 13 News cs listing Chapter 14 DefaultFramework css listing Sitecore Web Part Framework Q sitecore O a A Q 10 13 15 17 17 19 22 23 24 28 30 34 Page 2 of 35 Sitecore is a trademark of Sitecore A S All other brand and product names are the property of their respective holders The contents of this document are the property of Sitecore A S Copyright 2001 2008 Sitecore A S All rights reserved Q sitecore Introduction Web Parts allow users to customize the web pages by adding removing or tuning the page elements at runtime With the Web Part Framework users can rearrange the elements on a page using the drag and drop functionality add and remove elements on a page and modify the pages and controls The user settings can be saved for future working sessions Si
36. tral PublickKeyToken 31bf3856ad364e35 Namespace System Web UI TagPrefix asp gt lt script runat server gt protected void Page Load object sender EventArgs e Timerl Tok Ehis mul protected void Timer Tick ob ect Sender EventArgs amp string place dropCity SelectedItem Text dropCountry SelectediItem Text lblinfo Text Current time 1n place t Te lblTime Text getLocalTime int Parse dropCity SelectedValue protected string getLocalTime int city DateTime cur DateTime UtcNow cur cur AddHours city return cur Tohonglimestring protected void dropCountry SelectedindexChanged ob 7ect sender EventArgs dropCity Items Clear Switch int Parse dropCountry SelectedValue Denmark case 0 dropCity Items Add new ListItem Copenhagen 2 break Ukraine case 1 dropCity Items Add new ListItem Dnipropetrovsk 3 break USA case 2 dropCity Items Add new ListItem Dallas 5 dropCity Items Add new ListItem New York 4 dropCity Items Add new ListItem San Fransico 7 break if dropCiry items Count gt dropCity SelectediIndex 0 O Sitecore Web Part Framework Page 28 of 35 Sitecore is a trademark of Sitecore A S All other brand and product names are the property of their respective holders The contents of this document are the property of Sitecore A S Copyright 2001 2008 Sitecore A S All rights rese
37. vider SitecorePersonalizationProvider gt lt providers gt lt add name SitecorePersonalizationProvider type Sitecore Modules WebPartFramework Web WebParts SitecorePersonalizationProv ider driver RegistryPersonalizationDriver database master gt lt providers gt lt authorization gt lt deny users verbs enterSharedScope gt lt allow users verbs modifyState gt lt authorization gt lt personalization gt lt webParts gt These lines register the SitecorePersonalizationProvider instead of standard provider You should perform Republish when the installation is completed Sitecore Web Part Framework Page 5 of 35 Sitecore is a trademark of Sitecore A S All other brand and product names are the property of their respective holders The contents of this document are the property of Sitecore A S Copyright 2001 2008 Sitecore A S All rights reserved Q sitecore Chapter 3 User manual Consider a sample web part page with the standard ASP NET calendar control Type the http lt your domain gt WPF Sample aspx address in your browser You will see the page like the one shown below E Portal Page Windows Internet Explorer G a E bette localhostiwprt 20sample aspx t X Live Search File Edit View Favorites Tools Help ir abr Portal Page ASP NET 2 0 Calendar Control Local intranet Hino i Note In all examples of the article we assume that the extranet user
Download Pdf Manuals
Related Search
Related Contents
MIM75 - Maxx Cold Food Service Super Talent Technology USB 3.0 Express Motile HP StorageWorks MDS600 K-BUS Binary Inputs, 4 fold User manual Lexmark 34S5164 Printer User Manual THE R-390 COOKBOOK BY A. CARMODY, w2LE/AAR2Q,R Buffalo LinkStation Mini 1 TB Samsung LA19R71B Manuel de l'utilisateur Copyright © All rights reserved.
Failed to retrieve file