The Holy Grail of SharePoint branding – at least as far as I’m concerned – is rounded corners on Web Parts. Every design that comes in has this at first. As mentioned yesterday there are examples of doing this for the web part’s title – I’ve done this using Madalina’s instructions and Heather Solomon has some instructions too.
However, as far as I know nobody has yet figured out a way of putting rounded corners on the bottom corners of web parts. The HTML they have does not suit them to do this via CSS. The only idea I’ve had previously was to use ControlAdapters to modify the output of of the Web Part itself. And I’m pretty sure you’d have to write an adapter per web parts. That kind of sucks; no customer is going to be in a hurry to pay for that.
Well, when I was looking at putting borders around an entire web part zone, I had a thought. What we really need to do is insert elements into our page. jQuery can do that sort of thing. Could I use jQuery to find each web part and wrap some tags around it? Continue reading “Rounded Corners on Web Parts”
Ages ago I observed that the ‘Add New Document’ link in a summary toolbar takes you to an ‘Upload’ page, rather than creating a new document based on that template, and suggested doing something about that. That was a bit of a hack, though, so now I’ve written a web part to allow you to display ‘Add new…’ links and if you click on them, it opens up a new document based on that content type’s template. I’ve called it the ‘Create New Document Web Part’
Curious problem this – I had a web part zone where all web parts being put in it would be displayed without their titles. Didn’t matter if you manually went and turned on the chrome to show a title – that setting never saved, and the web parts didn’t ever have a title.
After tracking through all the page’s code, I found that when I set the WebPartZone’s ID to be ‘Main’ then my web parts ceased functioning correctly; their titles disappeared. If I set the ID back to ‘Left’, then all was fine.
I don’t know why this happens, but certainly using a different ID for my zone fixes it. If anyone knows why this actually happens, please let me know.
So yesterday I was trying to add a content editor webpart to a page I was deploying through ONET.XML. I wondered how to add custom web parts, and how you’d know what the XML for them was.
Turns out it isn’t very hard. An example:
<type name="SourceCode.Solutions.GenericCaseWebParts.CaseSSRSReportViewer" />
<importErrorMessage>Cannot import this Web Part.</importErrorMessage>
<property name="TitleUrl" type="string" />
<property name="TitleIconImageUrl" type="string" />
<property name="ReportServerUrl" type="string">http://vm-moss:8088/ReportServer</property>
<property name="Parameters" type="string"><ReportParameters><Parameter Name="CaseId" MultiValue="false" Value="[Case Id]" /></ReportParameters></property>
<property name="ChromeState" type="chromestate">Normal</property>
<property name="Title" type="string">Context Info</property>
<property name="ReportPath" type="string">/Reports/Case Details</property>
<!-- Snip -->
As you can see, at the top we define the class to use, then we set various properties (I’ve trimmed that set quite a lot). But how did I get the XML? Well… I set the web part up in SharePoint and exported the web part to a file; this was the XML I needed to put into my ONET.xml. Copy and paste… job done.
When you provision sites you can provide various pages (normal pages, not just publishing ones!) However, what if you want to put web parts onto those pages?
Well, you could build multiple pages for your different site configurations. Or you could use a feature receiver to add it programmatically. Or, you could add it via your site configuration. Continue reading “Putting CEWP into a page in ONET.XML”
Pointed out to me by a colleague (ages ago!) – Ton Stegeman’s ‘Content by Type‘ web part. A good way of rolling up content of diverse types, without lots of XSL. If your content type structure is right, may well be other ways of doing this (the content query web part and data view may work) – but this is quite a nice looking tool, and simpler. Need to download and have a play sometime soon.
I’ve just downloaded (from codeplex) and had a look at the Polling Web Part by Phil Wicklund. We’ve a customer who wants exactly this sort of functionality – surveys are too heavy weight; they just want a little radio-button panel. That’s what the Polling Web Part does:
Cool. And it shows it’s results as:
Hmm. So how does it store it’s data? Well, that seems to me a little strange – each poll, options and responses are a single row in a list:
Bit strange if you ask me. Some consequences of this are that:
- You can’t have more than 5 options
- You can’t be sure that someone doesn’t respond twice (although it appears that a cookie is set to prevent that from being too easy).
- Curiously, you can’t tell the web part to point to a particular poll question. It appears to always point to the latest. It’d be nice to have a drop down to select the poll in the Web Part Toolbox menu.
I must confess that I’d have considered having different polls in different lists, and reading the values available out of a Choice column on that list. Each response would be a List Item, so you’d know if someone has already created one. Still, Phil’s approach is probably quicker to process.
Other thoughts – well, it’d be nice to have bar chart rendering too.
All of which is, I must point out, quite picky. It does what it does well, and is free, and the source code is available; I may try and have a look at that at some time.