Adding a new, metadata-based navigation tab
For our example, we will add a new navigation tab based on the document metadata Division:
| |
|
|
|
Step
|
|
1
|
Go to Site Actions - Site Settings - Modify All Site Settings and select Master pages and page layouts under Galleries.
|
|
2
|
Locate TopicStructured.aspx, right-click on it and select Send To - Download a Copy. Save the downloaded aspx to your desktop with the name division.aspx.
|
| |
|
|
3
|
Open the division.aspx in Visual Studio and search for the text asp:menuitem. Your screen should look like this:
| |
|
|
Note
|
This aspx is an original SharePoint Web Part page layout that has been modified to work more intuitively with the richly organized content published by Hyper.Net.
|
|
|
4
|
Copy one of the lines representing an existing tab and paste the copy back into the code where you would like the Division tab to be displayed. Here we copy the tab for Author and paste it in immediately below the same line:
|
| |
|
|
5
|
Change Author to Division where appropriate and adjust the tooltip text as desired:
| |
|
|
Note
|
The sample code uses JavaScript to switch between views and jump to the correct location in the view. Views are displayed in an iFrame.
|
|
|
6
|
Save and upload division.aspx. On the upload form, be sure to select the correct Content Type Group and Content Type Name:
|
|
7
|
Now we need to create the Page that will be displayed by the navigation system when the user clicks on the Division tab we have just created.
Go to Site Actions - Site Settings - Modify All Site Settings, and then under Site Administration select Content and structure.
|
|
8
|
In the left navigation page, click on Pages. On the right, you will see existing pages corresponding to Title, Category, Author and Date.
|
|
9
|
Select New - Page. Enter the values indicated in the following image and click on Create:
|
|
10
|
We now need to create the Web Part that displays the content on the Division tab categorized by the Division metadata. Once again, we do this by copying existing code elements. Under Pages, click on the page named category and select Open Link in New Window.
|
|
11
|
Add the text "?toolpaneview=2" to the end of the URL displayed in the address bar as follows and open the URL by selecting ENTER:
|
| |
|
|
12
|
You now have access to the Web Part. Select Edit - Export as indicated in the following image and save the aspx to your Desktop or other desired location under the name HN Content Query Web Part - Division.webpart:
|
|
13
|
Open the Web Part file you just saved in Visual Studio. Modify the Title and ItemStyle properties as indicated below:
|
| |
|
|
14
|
Search for CommonViewFields. Add the Division to the list of available values (with its data type) and just below that modify the GroupBy property to use Division:
|
|
15
|
Go to Site Actions - Site Settings - Modify All Site Settings and select Web Parts under Galleries. Upload the new Web Part you created, for example HN Content Query Web Part - Division.webpart, and click on OK. On the properties form, be sure to select a useful group for the new Web Part. We always start the name of groups associated with our custom application with an exclamation mark (!) so that they always appear at the top of lists. If you are extending the HNWCMS solution without renaming it, enter !HNSPE here:
|
|
16
|
Now we need to update the division page to use the new aspx. Select Site Actions - Site Settings - Modify All Site Settings. Then under Site Administration select Content and structure.
|
|
17
|
Click on the division page and select Open Link in New Window. A blank window will appear (this is normal for this aspx because all unnecessary SharePoint code has been removed or hidden in iframe.master).
|
| |
|
|
18
|
Add the text "?toolpaneview=2" to the end of the URL displayed in the address bar as follows and open the URL by selecting ENTER. The tool pane will open again.
|
|
19
|
Select edit - Delete to remove the Category Web Part from the Top Zone:
|
|
20
|
Click on Add a Web Part, select the Division Web Part you created earlier and click on Add:
|
|
21
|
You have now successfully added a new tab to the navigation system that displays publications categorized by the metadata Division. You have also visited the key code elements you need to know about to customize the result to meet your requirements.
|