In Sharepoint I need to include a preview image for the screen of selecting layout for a new page - sharepoint

In Sharepoint 2007, I have created a layout. As you know when the user creates a page he chooses a layout from a listbox.
When you select a different element in the listbox, there is a preview image that changes on the left.
I thought this was controlled by the node PublishingPreviewImage in the xml of the layout. I have verified that the image exists in that place.
It is not working.
The code I use is:
<File Path="TituloTextoCtrl.aspx" Url="TituloTextoCtrl.aspx" Type="GhostableInLibrary" IgnoreIfAlreadyExists ="TRUE">
<Property Name="PublishingPreviewImage" Value="~SiteCollection/_catalogs/masterpage/$Resources:core,Culture;/Preview Images/titulotextoctrl.png, ~SiteCollection/_catalogs/masterpage/$Resources:core,Culture;/Preview Images/titulotextoctrl.png" />
<Property Name="MasterPageDescription" Value="Plantilla Titulo+Texto+Control" />
<Property Name="ContentType" Value="Titulo+Texto+Control" />
<Property Name="PublishingAssociatedContentType" Value=";#Vialibre_ContentTypeGeneral;#0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF39005215cca003b74e479baa123eb1dc5702;#" />
</File>

You also need XML to provision the image:
<Module Name="MyPreviewImages" Url="_catalogs/masterpage" IncludeFolders="??-??" Path="" RootWebOnly="TRUE">
<File Url="titulotextoctrl.png" Name="Preview Images/titulotextoctrl.png" Type="GhostableInLibrary">
</File>
</Module>

first of all upload yor layout page image in site collection document library or picture libary. Then Go to site actions--> site settings-->Galleries-->master pages and pagelayouts-->. In pagelayouts you can see your new layoutpage.
choose edit properties of your layoutpage there you can see the properties of that layout page. There is one column called preview image, give the url of image there that you already uploaed in the docu libary. click on Ok, now you have got preview image of your layout page.

Thx to Rich Bennema and Hojo for answering, there are right, but at the same time, my problem is that this layouts were deployed, and when I deploy again changing the PublishingPreviewImage, the layout is not updating. So my problem was a problem of controlling events so that everytime that I deploy the layouts are recreated in case there is changes.
This I know because it has worked for new layouts.
So for those who try this. Use the code I have provided with the one of Rich Bennema to upload the image.

Related

How to get space between icon and label on button?

I am working on one of my first xPages applications. I want to add a nice little icon (from the FamfamFam collection) to some of my buttons, e.g. "New","Save", "Cancel", etc.
I add the GIF images as image resource, and specify the image for the buttons I want the icons on.
It all works, but the label (text) on the button is right next to the icon. I would like them to be spaced out some, perhaps 4-6 pixels. I would prefer not to have to add spaces to the label, I am sure there is a better way, probably using CSS somehow.
Anyone know a good way to do this?
OneUI v2.1 is set as the theme for the application and I am using Domino Designer 8.5.3 and Domino Server 8.5.3.
You can use the following custom CSS to add some margin to the right of the icon:
.lotusBtn img {
margin-right: 10px;
}
To add a space I use an <xp:text themeId="Text.Blank"></xp:text>
Text.Blank is in my Theme resource with the following control block:
<control override="true">
<name>Text.Blank</name>
<property mode="override">
<name>escape</name>
<value>#{false}</value>
</property>
<property mode="override">
<name>value</name>
<value>&nbsp;</value>
</property>
</control>

How can I get a Content Query Web Part to show items from more than one type of list?

I am trying to use a Content Query Web Part to create a "What's New" page in Sharepoint 2010. The goal of this page is to display any documents that have been uploaded in the last 14 days. The trick is that these documents could belong to any number of lists that are defined in any number of list definitions. These are custom list definitions based on custom content types. We do have a base content type that each of our custom content types inherit from. They are also all part of the same content type group. I have determined that it is not possible to use the SP UI to set up the CQWP to return items from multiple list types, since one of the required query fields is list type. So - I'm attempting to use CAML to define this CQWP and this is where I'm having trouble. My end goal is for the CAML to be defined in a site definition (onet.xml file) but I've also not had any luck with uploading a .webpart file from the SP UI. I have found several articles that explain how this should be done but haven't been able to get the suggested solutions to work. This MSDN article tells me it should be possible using the ListsOverride element. This is how the article tells me to do it:
<![CDATA[
<Lists BaseType="0">
</Lists> ]]>
Since I'm looking for Document Libraries I would use a base type of 1 rather than 0.
I have been unable to determine the syntax for what that would actually look like from within the onet.xml file so I thought I'd start with trying to get it uploaded as a .webpart file.
This is what the ListsOverride element looks like:
<property name="ListsOverride" type="string">
<![CDATA[<Lists BaseType="1"></Lists>]]>
</property>
However - as soon as I upload a .webpart file with this in the CAML and add the webpart to a page I break that page in Sharepoint. This is what I get:
Server Error in '/' Application.
Attempted to use an object that has ceased to exist.
Research on that error points me to code that disposes of an object such as SPContext.Current.Web but I don't even have any code at all here. It almost looks like the CQWP has a bug in it. OR - I'm either not formatting that CAML properly or maybe I need to change something in a different element in the CAML?
I am running Sharepoint 2010 SP1 with all the latest patches. (I believe)
I've tried several other formats but without luck.
I tried getting rid of the embedded CDATA tags like this:
<property name="ListsOverride" type="string">
<Lists BaseType="1"></Lists>
</property>
But then Sharepoint won't let me upload the .webpart file. (Invalid .webpart file)
The format with the embedded CDATA tags seems to be the only way it lets me upload the file.
I've tried (just for the sake of narrowing down my issue) to specify specific lists like this:
<property name="ListsOverride" type="string">
<![CDATA[<Lists><List Id="{5a2f79bb-cc82-4171-88ac-65f20e7b5fa8}" /></Lists>]]>
That doesn't break the page but the webpart gives me less than useful error on the page (Unable to display this Web Part)
I'm not 100% sure that I used the appropriate GUID in that attempt. I got it from looking in the server explorer in Visual Studio (Under Lists and Libraries >> Document Libraries >> My List Type. (I got the GUID from the Id property)
I should mention that I am fairly new with Sharepoint development. I would have hoped that something seemingly so core to what Sharepoint does would be much easier than this.
Can someone please point out what I am doing wrong? Maybe I'm going about the whole thing in the wrong way? I appreciate any help that anyone can give me!
I found that the issue was all the "extra" fields that SharePoint had populated.
In my case, I started by configuring the content query web part on the page and then exporting it to get the xml. Then, I put the XML in my onet.xml file of my site definition. That worked fine initially, but as I tried to configure the base types, it did not behave as expected.
If I removed all the additional fields and just used the few fields that I actually needed to configure, then it started to work. In fact, I didn't even need to use the ListsOverride element, since there is a BaseType property that works just fine. It appears that one of the other properties that I was pulling in was really the cause of my issues.
Here's a webpart definition that I used in my onet.xml:
<AllUsersWebPart WebPartZoneID="WebPartZone" WebPartOrder="1">
<![CDATA[
<webParts>
<webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
<metaData>
<type name="Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart, Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<importErrorMessage>Cannot import this Web Part.</importErrorMessage>
</metaData>
<data>
<properties>
<property name="Title" type="string">Recently Updated Documents</property>
<property name="ChromeType" type="chrometype">TitleOnly</property>
<property name="ChromeState" type="chromestate">Normal</property>
<property name="WebUrl" type="string">~site</property>
<property name="BaseType" type="string">1</property>
<property name="ContentTypeBeginsWithId" type="string">0x0101008B0856395DCD40F99C9B42B6BF92BDDB</property>
<property name="FilterField1" type="string">{28cf69c5-fa48-462a-b5cd-27b6f9d2bd5f}</property>
<property name="FilterType1" type="string">DateTime</property>
<property name="FilterOperator1" type="Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart+FilterFieldQueryOperator, Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">Geq</property>
<property name="FilterDisplayValue1" type="string">-14</property>
<property name="FilterValue1" type="string">-14</property>
<property name="SortBy" type="string">{8c06beca-0777-48f7-91c7-6da68bc07b69}</property>
<property name="SortByFieldType" type="string">DateTime</property>
<property name="SortByDirection" type="Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart+SortDirection, Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">Desc</property>
<property name="ItemXslLink" type="string">~sitecollection/Style Library/DealerPortal/ItemStyle.xsl</property>
<property name="CommonViewFields" type="string">Name,Text;Created,DateTime;Modified,DateTime;Body,Note;DocumentIconImageUrl;OnClickForWebRendering</property>
</properties>
</data>
</webPart>
</webParts>
]]>
</AllUsersWebPart>

WhatsPopularWebPart as delegate control

I want to add the WhatsPopularWebPart as a delegate control. Registered a controlid in the masterpage and created a feature with this XML-manifest:
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Control ControlAssembly="Microsoft.Office.Server.WebAnalytics.UI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" ControlClass="Microsoft.Office.Server.WebAnalytics.Reporting.WhatsPopularWebPart" Id="WebAnalyticsDelegate" >
<Property Name="Title">Most viewed pages</Property>
<Property Name="DateRange">SevenDays</Property>
<Property Name="ItemLimit">6</Property>
</Control>
However, the webpart keeps saying "Loading". I think the callback is not executed. When I look at the HTML, the WebPartId is only zeroes (0000-00000-00 etc.) instead of a valid GUID. Perhaps that is the problem?
I want to add the webpart to every page on the site, therefore using delegate controls.
Hum...
I don't see why it is not working. See this link :
http://blog.brianfarnhill.com/2008/12/08/using-the-delegate-control-to-deploy-a-web-part-through-features/
Maybe it is a problem with This particular webpart : http://social.msdn.microsoft.com/Forums/en/sharepoint2010general/thread/93782f9c-b582-436c-8c66-12349fd752b2
Have you tried with other webpart ?
Solution: ContentPlaceHolder in masterpage and in every page layout a webpart zone in that ContentPlaceHolder. Further in the provisioning of the pagelayout an with the webpart definition of the WhatsPopularWebPart. Problem solved.

What is the difference between the "Path" and "SetupPath" attibutes on the Module element

So I have a SharePoint feature definition that deploys page layouts to a publishing site. The definition looks something like this:
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Module Name="Page Layouts" Url="_catalogs/masterpage" RootWebOnly="True">
<File Path="Page Layouts\layout1.aspx" Url="layout1.aspx" Type="GhostableInLibrary" IgnoreIfAlreadyExists="True">
<Property Name="Title" Value="Layout 1" />
<Property Name="ContentType" Value="$Resources:cmscore,contenttype_pagelayout_name;" />
</File>
</Module>
</Elements>
The Module element also can accept the attributes "Path" and "SetupPath." My understanding is that if these two attributes are omitted then SharePoint looks for layout1.aspx in the same folder as this feature, if Path is specified then SharePoint looks for the file in a path relative to this features' folder and if SetupPath is specified SharePoint looks for the file relative to the 14 Hive.
So is this basic understanding correct? Once the feature is activated and live on the site, would this layout page be stored or handled any differently had I specified Path or SetupPath? Would load time of the layout file be in any way affected?
Thanks,
Greg
To extend on what ashish mentioned.
Path = path relative to WSS 12 hive Features\Feature folder
SetupPath = path relateive to WSS 12 hive Template folder.
Please check following documentation in SharePoint SDK: http://msdn.microsoft.com/en-us/library/ms434127.aspx

Only one web part added to the wp gallery when multiple webpart files specified in module

I'm trying to deploy multiple web parts as part of the same feature. SharePoint itself seems to do this quite happily by specifying multiple File elements in a single Module element (see C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\SearchWebParts); in my case, only the first web part is added to the Web Parts gallery, albeit to the Miscellaneous group instead of the group specified in the Property element.
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Module Name="WebPartPopulation" Url="_catalogs/wp" Path="WebParts">
<File Url="Test1.webpart" Type="GhostableInLibrary">
<Property Name="Group" Value="MyGroup" />
</File>
<File Url="Test2.webpart" Type="GhostableInLibrary">
<Property Name="Group" Value="Mygroup" />
</File>
</Module>
</Elements>
My .webpart files are located in the same directory as the elements file; I tried setting Path="" on the Elements element but nothing gets deployed then. Switching around the two File elements deploys Test2.webpart instead of Test1 and Test1.webpart is not added on feature activation. Adding a single File per Module does work but that means duplicating the Module elements.
I'm self-closing the Property elements but that's surely not a sin?? What am I doing wrong?
The above would seem to be correct: after a reboot and a sleep, both web parts ended up in their proper groups when I came back to it the next day. It's surprising how often I find a reboot fixes up weird SharePoint things like this that even and iisreset won't touch. Maybe other services that should be reset/caching these things?

Resources