B i t s O f S h a r e P o i n t C o n s u l t i n g L L C > ExamplePoint > Site > SiteOwner  

Web Part Page Title Bar image
Site Owner

 Examples

Expand/Collapse M E N U (click) : Examples ‎(21)

 Overview

Site Owner Web Part Setup

 

Goal: Provide a centralized management setup to display the site owner and other contacts for a site.

 

Requirements:  You will need the following:

·         Document Library for script with read permission for all.

·         Custom list to list out site owners

·         Save Web Part to add to Web Part library called site Owner

 

Implementation:

1.       Add below script as a text file to the document library

2.       Create Web Part to be used by all

a.        Create  a Content Editor Web Part with the link to the text file in the Content Link

b.       Name the web part Site Owner or Site:

c.        Save Web Part in site collections where to be used

3.       Create a custom list in a centralized place with the following:

a.        Title – this will not be used so make default value EDIT

b.       Listing Type – This will be a choice field identifying what type of person is listed.  Example:

                                                               i.      Owner

                                                              ii.      Admin

                                                            iii.      Help Desk

                                                            iv.      Designer

                                                              v.      (The list can be of what you want to communicate)

c.        Person – This is the name of the person that will be listed.  You have a choice for show Field.  I like Name with Picture and Details or Name with Presence.  These provide links to the persons contact information.

d.       URL – Add a text field for the url of the site where the person should show up. 

                                                               i.      Add a description.  The URL is the link of the site that you should show up.

4.       Change code text file to the URL where the list is located.  Look at the red URLS listed in the script below and change.

a.        First URL is the setup link and will take the person to the library so if they are not listed they can add themselves.

b.       Second link is the view of the list that you want to show up in the web part.

                                                               i.      Create a view called SiteView

                                                              ii.      Make sure that Listing Type, Person and URL fileds how up in this view.

                                                            iii.      Save this view

                                                            iv.      Copy the URL for this list view and add it to the var SelectedView=.  This will tell the web part what view to show.

 

 

 

 

SCRIPT

 

 

<!--  Created 3/22/10 by Peter Allen
 site: www.bitsofsharepoint.com
 Version 1.0
-->

<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>

<style type="text/css">
.hideListItemSO { display: none; }
</style>

<table cellspacing='0' cellpadding='0' border='0' width='100%'><tbody><tr class='ms-WPHeader'><td style='width: 100%;'><h3 class='ms-standardheader ms-WPTitle'><nobr><span id="ListPlaceholderTitle">Site:</span></nobr></h3></td></tr></tbody></table>
<DIV id="ListPlaceholder"><IMG src="/_layouts/images/GEARS_AN.GIF" width="24" height="24"></DIV>
<div style="text-align: right;"><a href="http://www.bitsofsharepoint.com/ExamplePoint/Lists/SiteList/SiteView.aspx" target="_blank">setup</a></div>

<script type="text/javascript">
// Paste the URL of the source list below:
var SelectedView = "http://www.bitsofsharepoint.com/ExamplePoint/Lists/SiteList/SiteView.aspx";
  $("#ListPlaceholder").load(SelectedView+" #WebPartWPQ1 .ms-listviewtable",function() {
  $("#ListPlaceholder *").removeAttr("id");
  $("#ListPlaceholder *").removeAttr("onclick");
  $("#ListPlaceholder *").removeAttr("onfocus");
  $("#ListPlaceholder *").removeAttr("onmouseover");
 loadData();
});


$.extend($.expr[":"], {
 "containsNoCase": function(elem, i, match, array) {
  return (elem.textContent || elem.innerText || "").toLowerCase
  ().indexOf((match[3] || "").toLowerCase()) >= 0;
 }
});

function loadData() {

  $('div#ListPlaceholder').children("table.ms-listviewtable").addClass('siteOwner').removeClass('ms-listviewtable');
  $('div#ListPlaceholder').children('table.siteOwner tr:first').addClass('SO').hide();
  $('div#ListPlaceholder').children("table.ms-viewheadertr").addClass('SO').hide().removeClass('ms-viewheadertr');

var urlpath = this.location.href.split("?");
var url = urlpath[0];

  $('div#ListPlaceholder').children("table.siteOwner").children('tbody').children('tr').addClass('hideListItemSO');
  // show the matching rows (using the containsNoCase from Rick Strahl)
  $('div#ListPlaceholder').children("table.siteOwner").children('tbody').children('tr:containsNoCase(\'' + url + '\')').removeClass('hideListItemSO');
  $('div#ListPlaceholder').children("table.siteOwner").children('tbody').children('tr').children('td:containsNoCase(\'' + url + '\')').addClass('hideListItemSO');

};
</SCRIPT>

 

 

Site: