开发者

Default Sharepoint 2010 Tabs

开发者 https://www.devze.com 2023-01-16 10:34 出处:网络
I\'ve been searching on stackoverflow and google for a solution for my \'problem\' and still didn\'t find anything that worked.

I've been searching on stackoverflow and google for a solution for my 'problem' and still didn't find anything that worked.

I'm developing a solution using Sharepoint 2010 translated to Portuguese, but in some points of the systems, the translation isn't accurate, or, it's a different word that has many other meanings.

I really need (if possible) to change the text of the default 'Browse' tab on this project. I'm messing around trying to find it but still don't have success.

Does anyone know if it's possible to change the default text of the Browse tab, and if yes, where i can do it?

开发者_JAVA技巧Thank you.


Navigate to "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\Resources\" in your windows explorer, and open core.pt-br.resx with Notepad.

Find words: "ReadTab".

Change value of this resource to whatever you want. For example:

<data name="TabRead">
  <value>Browse test</value>
</data>

Make iisreset (press Start, type "iisreset", and press Enter).

Refresh your site. You will see:

Default Sharepoint 2010 Tabs

It is most fast way to achieve what you want. But, most likely, you should need to redo this operation every time you install fresh service pack, so it is not the best way. Microsoft do not recommend change internal SharePoint files.


Another way here, the right one, is to create simple SharePoint solution with one little feature. It is the right way, but it takes a little more time.

But if you have Visual Studio and base programming skills, you can do this easily.

What we will do:

  1. We will add our own resource file, so later we can add translations for other languages and add resources for other places, where you want to change the translation.
  2. We will add feature, which will modify browse tab, changing it title, so it will point now to our own language resource value

Let's start!

First of all, please, open Visual Studio 2010 and create empty SharePoint project:

Default Sharepoint 2010 Tabs

Choose farm solution in creation wizard, and press Finish. Ok, solution is ready now.

Next step is to add mapped folder for resource files. Right-click on project, and select Add -> SharePoint mapped folder.

Default Sharepoint 2010 Tabs

Select Resources folder, and press OK. Now, you should add your own resources file. Right-click on Resources folder, and select Add -> New item.

Select "General" group under C#, and scroll down to Resource file. Click Add.

Default Sharepoint 2010 Tabs

Now you should add your resource. For example, name it "MyBrowseTabTitle":

Default Sharepoint 2010 Tabs

Next, you should add a new feature. Right-click on Features folder in your project tree, and select Add feature.

Default Sharepoint 2010 Tabs

You can name your feature as you wish. Next step is creating module with some elements. Right-click on project title and select Add -> New item. Select SharePoint -> 2010 element group, and find Module element. Click Add to confirm.

Default Sharepoint 2010 Tabs

File with elements manifest should open up (it is inside your new Module). Replace elements.xml file contents with following code:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction
  Id="ChangeBrowseTabTitle"
  Location="CommandUI.Ribbon">
    <CommandUIExtension>
      <CommandUIDefinitions>
        <CommandUIDefinition
          Location="Ribbon.Read">
          <Tab
            Id="Ribbon.Read"
            Title="$Resources:Resource1,MyBrowseTabTitle;"
            Sequence="100"
            Command="ReadTab"
            Description=""
            CssClass="ms-browseTab"
            >
            <Scaling Id="Ribbon.Read.Scaling" />
            <Groups Id="Ribbon.Read.Groups" />
          </Tab>
        </CommandUIDefinition>
      </CommandUIDefinitions>
    </CommandUIExtension>
  </CustomAction>
</Elements>

For details on customising ribbon, you can follow this link:

http://msdn.microsoft.com/en-us/library/ff458373.aspx

Ok, now you're ready to deploy. First, right-click on project name and select "Package". Now make sure, that your Package.package file inside project folder, contains following files:

Default Sharepoint 2010 Tabs

If all is right, now you should point your SharePoint Project to your own site. Modify your project properties (right-click on project title, select "Properties", and find "Site URL" setting). Here I expect, what SharePoint is installed on the same machine, where the Visual Studio is running.

Finally, you should right-click on project, and select Deploy.

You should see some output in your Visual Studio output window, ending with this line:

========== Deploy: 1 succeeded, 0 failed, 0 skipped ==========

Great! All is ready now. Now open Internet Explorer and navigate to your sharepoint site. You will see something like this:

Default Sharepoint 2010 Tabs

Later, if you need, you can change feature scope, to use this feature on site collections, or to deploy it globally on your farm.

Default Sharepoint 2010 Tabs

Feel free to ask for any details.

Hope it helps!


A bit dirty, but search through the resource files in your Web Application's 'App_GlobalResources' directory.

Alternatively you should be able to search through all '.resx' files in your '14 hive'. Once changed run stsadm -o copyappbincontent to apply these changes.

Note that if you apply patches or service packs in the future then you'll most likely need to make these changes again.


I created something very usefull and I want to share my knowledge. I needed to make one master element with multiple details, so I created several tabs one for each detail. This is how I created it:

The HTML code:

  <div class="tabs" id="divTabs">
   <ul class="tab-links">
     <li class="tab-links"><a id="linkTab1" href="#tab1">Tab 1  </a>  </li>
     <li class="active"><a id="linkTab2" href="#tab2">Tab 2  </a>  </li>
     <li class="tab-links"><a id="linkTab3" href="#tab3">Tab 3  </a>  </li>
     <li class="tab-links"><a id="linkTab4" href="#tab4">Tab 4  </a>  </li>
   </ul>
 <div class="tab-content">  

 <div id="tab1" class="tab" >
   <WebPartPages:WebPartZone runat="server" FrameType="None" ID="customWP1" Title="TabWPZ-1">         
     <ZoneTemplate>
     </ZoneTemplate>
   </WebPartPages:WebPartZone>
 </div>

 <div id="tab4" class="tab">
   <WebPartPages:WebPartZone runat="server" FrameType="None" ID="customWP4" Title="TabWPZ-4"> 
     <ZoneTemplate>
     </ZoneTemplate>
   </WebPartPages:WebPartZone>
 </div>
 </div>
 </div>

Here is the style I used:

 <style type="text/css">
  .tabs {
DISPLAY: inline-block; WIDTH: 100%
   }
  .tab-links:after {
CONTENT: ''; CLEAR: both; DISPLAY: block
   }
   .tab-links LI {
LIST-STYLE-TYPE: none; FLOAT: left; LIST-STYLE-IMAGE: none; MARGIN: 0px 5px
   }
   .tab-links A {
FONT-SIZE: 16px; BACKGROUND: #7fb5da; FONT-WEIGHT: 600; COLOR: #4c4c4c; PADDING-BOTTOM: 9px; PADDING-TOP: 9px; PADDING-LEFT: 15px; DISPLAY: inline-block; PADDING-RIGHT: 15px; border-radius: 3px 3px 0px 0px; transition: all linear 0.15s
   }
   .tab-links A:hover {
BACKGROUND: #a7cce5; TEXT-DECORATION: none
   }
   LI.active A {
BACKGROUND: #fff; COLOR: #4c4c4c
   }
   LI.active A:hover {
BACKGROUND: #fff; COLOR: #4c4c4c
   }
   .tab-content {
BACKGROUND: #fff; PADDING-BOTTOM: 15px; PADDING-TOP: 15px; PADDING-LEFT: 15px; PADDING-RIGHT: 15px; box-shadow: -1px 1px 1px rgba(0, 0, 0, 0.15); border-radius: 3px
   }
   .tab {
DISPLAY: none
   }
   .tab.active {
DISPLAY: block
   }</style>

To make it work properly you also need a little jquery:

  $('.tabs .tab-links a').on('click', function (e) {
var currentAttrValue = $(this).attr('href');
switch (currentAttrValue) {
    case "#tab1":
        break;
    case "#tab2":
        break;
    case "#tab3":
        break;
    case "#tab4":
        break;
    }
    // Show/Hide Tabs
    $('.tabs ' + currentAttrValue).show().siblings().hide();
    // Change/remove current tab to active
    $(this).parent('li').addClass('active').siblings().removeClass('active');
    e.preventDefault();
});

After you insert this in SPD you open this page in browser and edit the page. Now in each tab you can add any web part you want. That's it and it is very easy to customize the content of each tab.

Hope it helps, Dragos.T.E.

0

精彩评论

暂无评论...
验证码 换一张
取 消