Simian Design

Tony Stephens in his corner of the web.
minimize

Sharepoint

Content Type ID

Posted in Sharepoint, Tip on August 15th, 2007 by Tony – 1 Comment

Another Sharepoint quick tip here.  I was recently working on putting in a custom feature, and needed to add the ‘Content Type ID’ to the xml. (sidenote: if you’re creating publishing sites as your main site template, and you need set pages created for each site, it looks like you want to create those additional pages as a feature.  This will allow for central administration of those pages, so you can easily change them down the road rather than a site by site update, since the site definition or site templates really won’t let you do this for additional “pages”.   Chris O’Brien talks about some of this, and has some nice walkthroughs on custom features.)
For the life of me I couldn’t find out where to get the Content Type ID of a custom content type I created.  Then, thankfully, I ran across this post by Andrew May talking about Content Type IDs.  Which stopped me running head first into a wall, as there isn’t much out there on this subject.

The main point I found useful on this topic was (emphasis mine):

If you want to take a look at actual content type IDs in WSS, here’s what you can do: navigate to the Content Type Gallery for a site. When you click on a content type, the URL to that content type contains a parameter, ctype, which is in fact the content type ID for that content type.

So you don’t need to do digging through the database, or write up some custom code.  Just browse to your Content Type Gallery.

Custom Sharepoint Reports.

Posted in Coding, Sharepoint on June 13th, 2007 by Tony – Be the first to comment

Okay, you’ve maybe seen the reports.  You know, Site Actions > View Reports > Checked Out To Me?

Did you know it’s not that impossible to add to that list?  All you really need to know is some CAML.  (I know this isn’t really about UI customization, but it’s still cool, so bear with me.)
To access the reports, go to your root directory, and click on Site Actions > View All Site Content.  The directory you’re looking for is called “Content and Structure Reports “.

report.gif

When you click into this folder, you’ll see a normal list.  Let’s edit the report called “Checked Out To Me”. reportedit.gif

Here are the fields  that we care about when you create a new report.

Report Title: What it’s called.  This can be anything.

Resource Id: both of them.   Don’t know why there are two.  (oh, apparently it’s an internal naming convention.  You can ignore it.)  Don’t use these.
CAML List Type: This is where you’d link it up to a list template here if you only want your report to search through a specific type.  You can get a list of the internal ID’s here.
CAML Query: The actual query.  I really find it easier to copy and existing one and modify it.

Target Audiences: If you were to target an audience with this report, you’d put that here.

Report Description: What the description of the report will be in the drop down.

The end result is a nice customization of the drop-down.   (note: Another site that talks about just this exact thing is located here.)

Widon’t in XSLT.

Posted in Coding, Sharepoint on June 4th, 2007 by Tony – Be the first to comment

In typesetting, a widow is a single word on a line by itself at the end of a paragraph and is considered bad style.

Shaun Inman created a widget/do-dad that fixed this autmatically.  This was called Widon’t.  Now it’s been recreated in XSL, thanks to Oleg Kourapov.

Now given my recent Sharepoint leanings, you might wonder why I’m excited about this.  It’s the itemstyle.xsl.

The itemstyle.xsl controls a great deal of the MOSS  2007 outputs.  Most noticeably is the Content Query.

It seems by adding a line for this function into our itemstyle, we can control widows.  I’ll be playing with this shortly, should update you on how it turns out.

There are three main areas in rebranding Sharepoint 2007. Three.

Posted in Reference, Sharepoint on May 31st, 2007 by Tony – Be the first to comment

Heh. Of course as soon as I decide that I ought to start writing about my efforts into branding MOSS 2007, a big name designer comes forth and reveals he’s been doing the same thing. Nice job Cameron. Go ahead, steal the spotlight.

Anyways, I figure today I’ll write about my base files I deal with when I’m rebranding Sharepoint. This will keep me consistent at least in bouncing all over the map. One of these days I’ll organize these posts into something worthwhile.

Okay, the main areas I deal with are as follows:

  1. Master Pages and Layouts. /_catalogs/masterpage/ in Sharepoint Designer. These two items form the foundation and _code structure_ of the sites. Very, very important stuff in here. note: You have to be a member of the “Designer” group to edit any of these files. “Administrators” don’t get this right, it’s a separate right. This is most excellent because now, by default, you have to manually assign people who are going to muck with your design. This prevents any administrator from going in and doing anything.
  2. CSS. I create a root folder I call _assets and stick all my extra supporting files in there. I turn on versioning, turn off search indexing, and restrict write permissions. Then I go to town. I stick my custom CSS, JS, layout images, etc all in there. This is normal web-design stuff. You can stick yours wherever you’d like. Yes, you can even stick it there.
  3. ItemStyle.xsl, Header.xsl, ContentQueryMain.xsl. These files are SO IMPORTANT. /Style Library/XSL Style Sheets/ I use them all the time. This XSL controls how most of your webparts will display.

Those really are the 3 main sections I spend a great deal of time in when I’m reworking Sharepoint. You can do an awful lot with just those three sections.

I’m going to talk a little bit more about the ItemStyle.xsl. I use the Content Query webpart all day long. The Contennt Query webpart is very nice, very powerful and a welcome addition to Sharepoint. Basically what it does is allow you to query your content and display it back based upon some XSL. You get your content you define in an XML stream. Not to shabby. I do wish it did paging (hint hint to Microsoft.), but really, other than that, I’m pretty happy with it.

There is a dropdown in the part that references these files. The drop downs match up to the templates. Want a different display? Change this. Now if you want extra information to display in your content query (say Site column information or something) that’s a different beast, and probably a different post someday.

itemstyl.gif

The Group style: dropdown references your Header.xsl. Your Item style: drop down references your ItemStyle.xsl. Pretty straightforward. If you know XSL, you can start modifying these pretty easily. Heather Solomon has written a decent guide to customizing the Content Query and the ItemStyle.xsl. You can go check it out. I figure I’ll write up what I’ve learnt another day.

tip: if you want to add a “read more” or something along those lines to your content query, you want to modify ContentQueryMain.xsl and put in a case statement.

Restricting Layouts

Posted in Sharepoint, Tip on May 30th, 2007 by Tony – 1 Comment

In Sharepoint 2007 it is now possible to restrict layouts on a site-by-site basis.

This is really nice because it allows for you to create custom layouts for specific purposes, and then only make that layout visible where you want it. So when you have that special case, that one request that breaks your normal layout, you can create the layout and expose it in a singular instance.

Okay, to get to where you restrict your layouts, go to your site settings, modify all site settings.
pagelayouts.gif

When you click on the restrict page layouts, you’re presented with two combo-boxes.  The top section combo-boxes are to restrict your site templates for any subsites created under this site.  The bottom section is the page layouts.

layout2.gif

Now when you create a page or site, your layout options and site templates are restricted.

Easy as pie.

Saving a Publishing Site as a Template in Sharepoint 2007

Posted in Reference, Sharepoint, Tip on May 29th, 2007 by Tony – 2 Comments

Okay, since I’ve been doing a LOT of MOSS 007 branding recently, I figured it was only fair enough I write about it.  I can’t find too much information online other than Heather Solomon, but yet I doubt we’re the only two people out there rebranding MOSS.  So I’ve decided that I’m going to make a real concerted effort to write up more of what I’m figuring out in my efforts to make Sharepoint 2007 operate and look like I want.

I’ve been working with MOSS for about a year now, since the first beta.  Not working on private stuff, but with clients and real requirements.  So I do have a fair amount of practical experience.

So most every site I build out seems to be a Publishing Site.  I find the Pages feature to be so incredibly worthwhile I’m puzzled whenever it isn’t available.

But of course, nothing is ever easy.  So I found when I had a Publishing Site I had created, and went to go save it as a template.  Well guess what.  That option isn’t available.  It just isn’t there.

Well I was stumped.  I needed this site to be a template, and it needed to be a Publishing Site.  And trying to create a Publishing Site via the Schema?  I was stumped.

Till I tried writing out the URL by hand.

/PATH/TO/SITE/_layouts/savetmpl.aspx

That is the magic URL.  Put that in, and you can save your Publishing Site out to a template, content included.  Seems to work pretty okay so-far.