[Home] [Recent] [Site Map] [SharePoint] [XBOX]
I have had quite a few emails recently about ways of either hiding, showing, adding or modifying the item level menu items that appear within lists and document library. In this post I thought I would examine what you can do and what the best approach would be (in my opinion anyway). Firstly the bulk of the menu items are drawn from the “CORE.JS” file that resides in the “12” hive.
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\LAYOUTS\1033
This file is a few thousand lines long so can be slightly cumbersome to work with. However the easiest way to find what you are after is to look at the name of the menu item you wish to change in UI and use this to search through the “CORE.JS”. For example I want to hide the “Send To” menu on all document libraries. To do this I would simply search the “CORE.JS” for the text “Send To”.
Notice when I do it highlights the variable called “L_Send_Text”.
Now call we have to do is search for that variable and hey presto we have found the function that is called when creating the menus.
So using this example let’s look at completely hiding the send to menu items. This is quite a simple request but has to be done in a certain way. There are really a couple of ways of doing this. They are:
1. Comment out the functions that are called within the CORE.JS
2. Use a content editor web part and add this to the relevant pages (all of them)
3. Use inline script within the Master Page
Option 1 will work well, however where possible it is not best to modify the underline files when modifying MOSS2007. Option 2 is a favourite of mine but is very hard to maintain unless you are building custom list definitions for all your content. Also it is very hard to ensure that the web part is added to every list or library. Option 3 is the best option here, simply adding the functions as inline script code will mean that any page that calls this function will automatically call the function in the Master Page, not the CORE.JS.
So let’s take option 2 for now just so we can see how this option works. The steps to take are:
1. Comment out the “AddSendSubMenu” in the CORE.JS
2. Add Content Editor Web Part to the “AllItems.aspx” page for the relevant list or library
3. Add the “AddSendSubMenu” function to the Content Editor Web Part
To comment out the function simply use the following at the beginning and the top of the function.
Now we need to add the content editor web part to the relevant pages. We will open up a document library for this and select the “Edit Page” option from the site actions menu. Once the page is edit mode press the “Add a Web Part” button.
Now we need to select the “Content Editor Web Part” to the page.
Once it is on the page press the “Open Tool Pane” link within the web part and then press the “Source Editor” button. When the dialog opens add the following code:
Once this added, if you select the item menu the “Send To” menu items will not appear.
Ok, so not everyone will want to hide functionality but the principle is the same for each menu item. I have worked on a few projects where the “DELETE” menu item has either been moved or removed from the item menu and the list or library menu bar. So let’s look at adding it back but only the email link menu item. To do this we will change the code that exists in the content editor web part to be the following:
When we now run the page the menu should then render as below:
Let’s say we wanted to have an external process run from the menu item when we click a custom link. For example we might want to send the document to another system for processing or even copy the document somewhere else. This can be done quite easy by creating a new menu item and making the link a custom “aspx” page that contains our custom code. For this example we will simply pass a few query strings to custom page. To begin with let’s modify our code slightly.
Now when we load the page it should render as below:
I won’t show the code for the other page here, as you can really do whatever you want. The URL that we constructed in the JavaScript should now look as below:
http://intranet.labs.local/StaffDirectory/_layouts/custompages/QueryStringExample.aspx?FileID=2&FileURL=http%3A%2F%2Fintranet%2Elabs%2Elocal/StaffDirectory/Team%20Documents/DemoDoc1.doc
Notice that the variables that we created have now been populated. As you can see without knowing lots of complex c# or VB.Net you can create highly customisable menus within MOSS2007.
Hi, everyone. Hope you are all well. Since my last post on the Http Handler I am writing, I have not been able to fix the issue I get with the constant looping within the code and lack of attaching the “PreInit” method to the page.
However it works really well for normal team sites and site collections, well basically Windows SharePoint Services (WSS). I have had a little more time to work on this and have decided to expand it slightly. My original idea behind this was to simply change the master page upon loading the page and overwrite any master page selections done via the UI. Now however it has changed to the following:
1. Overwrite Master Page selections done through the UI
2. Show different Master Pages based on Group Membership to the sites
3. Show different Master Pages based on the URL that is used to access the site
For a project I am working on this is a key requirement for an Intranet / Extranet solution. Firstly the code I used before is the same but now has a few changes. The first change is that I am capturing the current site collection URL and checking this against an “AppSettings” in the “Web.Config” file. If this matches then I move onto the next code block. If the code fails the test then it must be coming in from one of the other Alternate Access Mapping (AAM) URL’s and then applies a “defaultGuest.master” page.
ActualURL = site.Url.ToString();
if (ActualURL.ToString() == InternalSCURL.ToString())
{
{Code here to check the user group membership}
}
else
{
page.MasterPageFile = "/_catalogs/masterpage/defaultGuest.master";
}
The second change is that I am now checking the group membership of the current user, by using the inbuilt method:
site.IsCurrentUserMemberOfGroup
I am not looping through the groups, I already know that anyone who is an Owner or Member belongs to the “Members” group and should get Master Page one and anyone else should get Master Page 2. Once I have worked out what membership the current user has I then apply the relevant master page. As I know that all the groups in the various sites will have the following format “{Site Title} {Group Name}” I can simply check using the following code and concatenate the “site.Title” and the custom variable “siteGroup” together as shown below.
bool isMember;
string siteGroup = " Members";
isMember = site.IsCurrentUserMemberOfGroup(site.Groups[site.Title.ToString() + siteGroup.ToString()].ID);
if (isMember == true)
{
page.MasterPageFile = "/_catalogs/masterpage/defaultMember.master";
}
else
{
page.MasterPageFile = "/_catalogs/masterpage/defaultReader.master";
}
The master pages simply have been edited to display the name of the master page as part of the title, so Member, Reader or Guest. With this code in place and the enabled I get the following:
1. User Accessing site using Extranet URL Only
2. User (Member) using Internal URL
3. User (Reader) using the Internal URL
With a little more code and a nice interface (which I am working on) you are able to map user groups, URL’s and master pages all together to create a simple system for managing look and feel across your Windows SharePoint Services (WSS) Sites.
Maybe the title here should be called "Hacking STP files", but there may be some reasons you would like to know how to accomplish this.
WARNING: Any details here are for educational purposes only, making changes to .STP files is not recommended, probably not supported, and generally is a bad idea. Why not instead restore the STP file, make a few tweaks, then re-save as a new template? It"s much more simple, it"s supported with tools, and it"s going to be faster in any case.
Basically there are very few circumstances ("almost none") when actually using any of the information from this file autopsy would be a good idea. But I like to take things apart and see how they work, so here"s the results of my investigation.
The .STP files created by SharePoint whenever you save a site as a template are, surprise, actually .CAB files! So, to explore the contents of an .STP file, do the following:
Inside you will see one manifest.xml file, which is the key item in the template. You may see a number of other files with .000 extensions; these are other templates contained in the site, for example, if you had a document library containing user-customized default templates, they would be contained inside your .stp file with the .000 extension. If you trace the relationships between these files and your manifest.xml file you may just be able to replace a document template.
The manifest.xml file is the really interesting part of this, though. At the top level, these are the nodes:
This entry is designed to walk through the steps needed to backup and restore production SharePoint 2003 databases to test servers. These steps have worked well for me especially when preparing for a SharePoint 2003 to MOSS 2007 Upgrade. (This example is based on Microsoft SQL Server 2000.) See the attached file for a PDF with screenshots.
Hello
Recently i have installed quite a few MOSS and WSS3.0 servers, and have ran into this problem more than once.
The company has several word templates and quite a few contains differnt macros. They all worked in SPS2003 where you uploaded them to the FORM folder overwriting the template.doc file there - and.... it worked like a charm.
Today more likely than not you will use content types for templates and the forms library trick dosnt do no more. But I dont se no reason why the macros shouldnt work.--- well ... but they dont.
I have a working template.doc with macroes and everything, but assigning them as a template from the content type advanced options dosnt work. I DO get the warning - " this doc. contains macroes - you want do run them or disable them" (or something close to that) . and agreeing to load macroes lets the doc load - BUT the macros dosnt work - dont throw no errors either ,but dosnt work.
I found that if i upload the template.doc directely into the doc. library and start it as any other item the macros works fine Veeeery strange.
I have seen Tods article about writing VSTO-documents - but - comeon - the company in focus has already used a fortune gettin the existing macros done. So rewriting them is not an option.
Any ideas - anyone?
I have a team site that has a blank meeting site below it. The blank meeting site contains links to all meetings below it. I would like a content rollup that takes all major version of documents from the meeting sites and shows them in the shared documents at the team site level. I also want the same for contacts. Any attendees of the meetings should rollup into project contacts. Any action items get rolled up into project tasks. So the team site will be able to be managed as a project site with Contacts, Team Members, Tasks can be rolled up from Meeting sites.
Has this been done before? Are there any web parts that can do this?
The following steps walk through changing custom template IDs so they are greater than 10000 per documented best practices. Always make sure to backup all databases and files prior to making any changes.
NOTE: This method is not backed by Microsoft. Use at your own risk.
<Templates>
<Template Name="SPSCONTOSOSERVICES" ID="37">
<Configuration ID="0" Title="Area Template" Type="0" Hidden="TRUE" ImageUrl="../images/spshome.gif" Description="Contoso Services Template."><!-- _locID@Title="webtemp_title_spstopic0" _locComment="{StringCategory=HTX}" --> <!-- _locID@Description="webtemp_desc_spstopic0" _locComment="{StringCategory=HTX}" --></Configuration>
</Template>
<Template Name="SPSCONTOSOBUSINESSES" ID="38">
<Configuration ID="0" Title="Contoso Businesses Template" Type="0" Hidden="TRUE" ImageUrl="../images/spshome.gif" Description="Area Template."><!-- _locID@Title="webtemp_title_spstopic0" _locComment="{StringCategory=HTX}" --> <!-- _locID@Description="webtemp_desc_spstopic0" _locComment="{StringCategory=HTX}" --></Configuration>
</Template>
<Template Name="SPSCONTOSOTOPICS" ID="39">
<Configuration ID="0" Title="Contoso Topics Template" Type="0" Hidden="TRUE" ImageUrl="../images/spshome.gif" Description="Area Template."><!-- _locID@Title="webtemp_title_spstopic0" _locComment="{StringCategory=HTX}" --> <!-- _locID@Description="webtemp_desc_spstopic0" _locComment="{StringCategory=HTX}" --></Configuration>
</Template>
</Templates>
<Templates>
<Template Name="SPSCONTOSOSERVICES" ID="10037">
<Configuration ID="0" Title="Area Template" Type="0" Hidden="TRUE" ImageUrl="../images/spshome.gif" Description="Contoso Services Template."><!-- _locID@Title="webtemp_title_spstopic0" _locComment="{StringCategory=HTX}" --> <!-- _locID@Description="webtemp_desc_spstopic0" _locComment="{StringCategory=HTX}" --></Configuration>
</Template>
<Template Name="SPSCONTOSOBUSINESSES" ID="10038">
<Configuration ID="0" Title="Contoso Businesses Template" Type="0" Hidden="TRUE" ImageUrl="../images/spshome.gif" Description="Area Template."><!-- _locID@Title="webtemp_title_spstopic0" _locComment="{StringCategory=HTX}" --> <!-- _locID@Description="webtemp_desc_spstopic0" _locComment="{StringCategory=HTX}" --></Configuration>
</Template>
<Template Name="SPSCONTOSOTOPICS" ID="10039">
<Configuration ID="0" Title="Contoso Topics Template" Type="0" Hidden="TRUE" ImageUrl="../images/spshome.gif" Description="Area Template."><!-- _locID@Title="webtemp_title_spstopic0" _locComment="{StringCategory=HTX}" --> <!-- _locID@Description="webtemp_desc_spstopic0" _locComment="{StringCategory=HTX}" --></Configuration>
</Template>
</Templates>
update webs set webtemplate = 10038 where webtemplate = 37;
update webs set webtemplate = 10038 where webtemplate = 38;
update webs set webtemplate = 10039 where webtemplate = 39;
GO
Replace the numbers in the query with ones specific to the environment. These numbers must match the ones included in the webtempXXX.xml file(s).
Adam Buenz has gone over the edge with Forms Based Authentication by creating a provider for finger print authentication.
http://www.sharepointsecurity.com/blog/sharepoint/sharepoint-2007-development/biometric-authentication-for-sharepoint/
A customer of mine wanted to have the personal sites of the Students and the Teachers separated in different content databases as he wants to provide better operation services for the Teachers.
He also requested to have different sites qouta for students and teachers personal sites.
"In your dreams !!!!", I"d say if we are working on SPS 2003. Backed up with MOSS, I said "What you wish is what you get".
I"ve documented the solution in a .doc and attached it
Tell me what you think
Mohammdu Khalilo
Site List:
>>Xbox Live_s Major Nelson
>>Xbox 360 & SharePoint 2007 Weblog
>>Carsten Keutmann_s Blog
>>Mohamed Zaki_s Blog [Sharepoint MVP]
>>The Mit_s Blog
>>Mart Muller_s Sharepoint Weblog
>>Microsoft SharePoint Products and Technologies Team Blog
>>SharePoint Solutions Blog
>>4GuysFromRolla.com Headlines
>>ASP.NET Blogs
>>SharePoint Blogs
>>SharePoint Blogs
>>Joel on Software
>>ADO Guy_s Rants and Raves
>>Microsoft Live Labs
>>GadgetNews
>>Windows Vista Team Blog
>>VoIP & Gadgets Blog
>>schrankmonster blog
>>Via Virtual Earth Blog
>>Feed
>>MSDN Blogs
>>Mashable!
Links:
Jack's Readings
Month Archives:
Oct 2007
Sep 2007
Top Tags:
social software social networking .NET mashable Sharepoint ASP.NET Web 2.0 Web2.0 Startups Community News Search Marketplace General Software Development AJAX Windows Vista Visual Studio Microsoft myspace Silverlight People Powered! YouTube Vista MOSS Featured News C# Events MOSS 2007 Google WPF Office 2007 Web Community Security General Personal Xbox 360 facebook Tools development SharePoint 2007 Fun Atlas Architecture ASP.NET AJAX myspace codes TheLongTail IIS SQL Server Developers Revenue Sharing Video Pictures WCF Mobile 2.0 Announcements Orcas MIX07 Arcade Team System JavaScript News
@2007 All rights Reserved |