SharePoint 2020

The Vision for a Future of Clarity

Skype Lync 2013 Presence Indicator Web Part

This post is to embed a users Skype for Business (Lync 2013) presence indicator in a Content Editor Web Part for SharePoint 2010.

From reading this post:

http://geekswithblogs.net/jacobladams/archive/2011/05/03/use-hmtl-and-javascript-to-display-presence-controls-in-sharepoint.aspx

The code works exactly for SharePoint 2010, though I’ve added a Sype button and when clicked opens the Chat window in Skype.

sype button

 

 

 

  • Replace the paths below with your SharePoint path.
  • Replace my name with another email address or SIP Address.
  • Download the the Skype image below and upload it to the same folder as the code below.
<script type="text/javascript" src="/sites/SP2010/_layouts/1033/init.js"></script>
<script type="text/javascript" src="/sites/SP2010/_layouts/1033/core.js"></script>
<style type="text/css">
img.presenceIndicator {
border-style: None;
height: 12px;
width: 12px;
border-width: 0px;
vertical-align: middle;
}
</style>
<div>
<img id="uniqueID" onload="IMNRC('brett.anderson@example.com',getElementById('uniqueID'))" showofflinepawn="1" src="/sites/SP2010/_layouts/images/blank.gif" class="presenceIndicator" />
<a href="sips:brett.anderson@example.com">Brett Anderson</a>
<div>
<a href="sips:brett.anderson@example.com">
<img width="86" height="32" role="Button" style="BORDER-TOP: 0px; BORDER-RIGHT: 0px; VERTICAL-ALIGN: -41px; BORDER-BOTTOM: 0px; MARGIN: 10px; BORDER-LEFT: 0px" alt="Skype chat, instant message" src="/sites/SP2010/scripts/Sypebutton/chatbutton_32px.png"></a>
</div></pre>
<pre></div></pre>
<pre>

 

chatbutton_32px

Image button to upload to SharePoint server.

Advertisements

September 11, 2015 Posted by | SharePoint 2010, SharePoint 2013, SharePoint Designer 2010 | , | 1 Comment

Save list item as PDF file from Display Form using SWF buttons

This article explains how to add swf Flash buttons using TableTools to your List View and Default Display Form.

I’ve tested this in SharePoint 2010, using IE8. I have not tested this in SharePoint 2013 but it would work there too.

This is a pure front-end solution, using only SP Designer or notepad for those on a locked down intranet.

The only requirement is that your browser needs to be able to display Flash and SWF files.

The original post and code came from Danish Islam, which explains the how the code and buttons are linked to a List View.

Use jQuery Datatables for SharePoint List Webpart with export to CSV, EXCEL, PDF and Print features

The buttons contained in jQuery Datatable TableTools are:

Copy, CSV, Excel, PDF, Print.

buttons

This is the result of adding the script to the List View:

listTableTools

Note: The search box is live “Search as you type” filtering the list. The paging is Ajax and loads instantly.

All that you require are:

  • The files to be uploaded
  • Change the file paths in the the code
  • Change the file paths of the images in the CSS files.
  • Add a Content Editor Web Part to your List View or Display Form view.

If you place this script in a content editor web part above a list view, the full affect of Datatable Tabletools will be displayed.

Also, important note: Use the jQuery.js file that comes with the Datatables Zip Package.  Using jQuery v1.12 the buttons did NOT display and it took me a couple hours to determine it was the jQuery.js file.

<style type="text/css">
.even, .odd, .sorting_1 {
 background-color: transparent !important;
}
.dataTable THEAD TH {
 border: 0 !important;
}
</style>
<script type="text/javascript" src="/scripts/datatables/jquery.js"></script>
<script type="text/javascript" src="/scripts/datatables/jquery.dataTables.min.js"></script>
<link type="text/css" rel="stylesheet" href="/scripts/datatables/css/jquery.dataTables.css">
<script type="text/javascript" src="/scripts/datatables/dataTables.tableTools.js"></script>
<link type="text/css" rel="stylesheet" href="/scripts/datatables/css/dataTables.tableTools.css">

<script type="text/javascript" >
 $(document).ready(function(){
 $(".ms-listviewtable").prepend($("<thead></thead>").append($(".ms-listviewtable").find("tr:first"))).DataTable({"sDom": 'T<"clear">lfrtip', 

 "tableTools": {
 "sSwfPath": "/scripts/datatables/copy_csv_xls_pdf.swf"
 // Change this path according to file location 

 } 

 });
 });
</script>

For a List Display Item, I removed the CSV and Excel buttons and also added an “Email Link” button.

displayform


<style type="text/css">
.even, .odd, .sorting_1 {
background-color: transparent !important;
}
.dataTable THEAD TH {
border: 0 !important;
}
</style>
<link type="text/css" rel="stylesheet" href="/scripts/datatables/css/jquery.dataTables.css">
<link type="text/css" rel="stylesheet" href="/scripts/datatables/css/dataTables.tableTools.css">
<script type="text/javascript" src="/scripts/datatables/jquery.js"></script>
<script type="text/javascript" src="/scripts/datatables/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="/scripts/datatables/dataTables.tableTools.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(".ms-formtable").prepend($("<thead></thead>").append($(".ms-formtable").find("tr:first"))).DataTable({"sDom": 'T<"clear">rt',
"tableTools": {
"sSwfPath": "/scripts/datatables/copy_csv_xls_pdf.swf",

"aButtons": [

{

"sExtends": "copy",
"sButtonText": "Copy to clipboard"
},
{
"sExtends": "pdf",
"sButtonText": "Save as PDF",

"fnComplete": function ( nButton, oConfig, oFlash, sFlash ) {
SP.UI.Notify.addNotification('<img src="/_layouts/images/loadingcirclests16.gif" style="vertical-align: top;"/> PDF Exported to file ...',false);
}
},
{

"sExtends": "print",
"sButtonText": "Print this item"
},

{

"sExtends":    "text",
"sButtonText": "Email link",
"sButtonClass":  "DTTT_button_csv",
"fnClick": function ( nButton, oConfig, oFlash ) {
window.location='mailto:?subject=' + document.title + '&body=' + window.location;
}
}
]
} // end of tabletools

});

});

</script>

The Saving to PDF button is the only front-end solution I have found that works without for IE8 and SharePoint 2010.

Any comments, questions, hit me up. Enjoy.

 

August 9, 2015 Posted by | SharePoint 2010, SharePoint Designer 2010, SharePoint Javascript | , , , | 7 Comments

Add a PDF Thumbnail Hover Preview Column to a Document Library

I got this request from Jewell from my previous post:

Display PDF Thumbnail Preview on Hover in Search Results Web Part

“Is there away to apply this to a document library?”

Here are the steps to add a pic of a magnifying glass to a column in a Document Library.

So that when your mouse hovers, it displays the first page of the PDF inside an iFrame window.

The only down-side to having this implemented, is that as the user hovers over each PDF, it needs to download the entire PDF file to display the first page.
 

* Document Library with the PDF Preview column added

pdfs - All Documents

* On Mouse-Over

pdfs preview

Step 1: First you’ll need to create a workflow that copies the Document Name to the Title column.

Follow this post to do exactly that: http://www.knowledgegroup.no/blogg/post/2012/05/13/Add-filename-in-title-field-using-workflow.aspx

Step 2: Go to http://cssglobe.com/easiest-tooltip-and-image-preview-using-jquery/ and download the Scripts Zip file.

You’ll need the 3rd Example files uploaded to a Document Library to hold your script files.

Step 3: Open up main.js and replace the text with this modified version: PDF thumbnail script .docx or the pastebin version: http://pastebin.com/Gb5mGw1c

Step 4:  Create a html file in the same folder as your scripts and paste the following:

Don’t forget to change the paths to your script files.

<script src="/server/site/scripts/jquery.js" type="text/javascript" ></script>
 <script src="/server/site/scripts/main.js" type="text/javascript"></script>
 <style>
 #screenshot{
 position:absolute;
 border:1px solid #ccc;
 background:#333;
 padding:5px;
 display:none;
 color:#fff;
 }
 </style>
Step 5:
Add the HTML file to the source of a Content Editor Web Part in the document library that holds the PDF files.
Step 6: Add a Calculated Column in the Document Library, call it Preview and select type returned as:
Number (1,2,3…).
Add the following from here:
http://pastebin.com/XgQA85m7
or from here:
="<DIV><a href='..\"&Title&".pdf' class='screenshot' rel='..\"&Title&".pdf' ><img border='0' src='/_layouts/images/MAGNIFY.GIF' alt='' style='padding-right: 5px; padding-left: 5px; vertical-align:bottom'></a></DIV>"
That’s it! Now hover over the magnifying glass image and you should see the PDF thumbnail display.
Any questions or comments, post it below. Thanks for reading.

November 4, 2013 Posted by | SharePoint 2010, SharePoint Designer 2010 | , | 12 Comments

Hide Ribbon from Users with Read Permissions

Hiding the ribbon depending on users permissions.

Read access will hide the ribbon so it will behave like an anonymous user navigating to the site.

Open up your custom master Page in SP Designer 2010.

1. Add a display:none style to the s4-ribbonrow element so it looks like the below code

<div id=”s4-ribbonrow” class=”s4-pr s4-ribbonrowhidetitle” style=”display:none”>

2. add the below snippet inbetween the s4-ribboncont and the s4-ribbonrow Div

<Sharepoint:SPSecurityTrimmedControl runat=”server” Permissions=”ManageLists”>
<script type=”text/javascript”> document.getElementById(“s4-ribbonrow”).style.display = “block”;</script>

3. Close the control by adding the below snippet just above the the s4-ribboncont and the s4-ribbonrow Div

</Sharepoint:SPSecurityTrimmedControl>

Your code should look like this:


<div id="s4-ribbonrow" style="display: none">

<Sharepoint:SPSecurityTrimmedControl runat="server" Permissions="ManageLists">

<script type="text/javascript"> document.getElementById("s4-ribbonrow").style.display = "block";</script>

</Sharepoint:SPSecurityTrimmedControl>

Notes:

I have only tested this in SharePoint 2010 as I do not use SharePoint 2013.

I copied this from s SharePoint Design course I participated in with www.synergyonline.com

For other useful tips, check out their Blog Posts: http://www.synergyonline.com/blog

October 30, 2013 Posted by | SharePoint 2010, SharePoint Designer 2010 | 1 Comment

Record Search Results Queries to a List using a Hit Counter

This is how I am using a Search Results page to record individual Users Search Queries in a list.  Each Search Query is displayed as how the user typed them in.

What I’ll explain is how we can grab the URL from the Search Results and strip out the unnecessary code to display only the User’s Search Query.

For Example

This Search Result URL:

?k=pdf&cs=This%20Site&u=https%3A%2F%2Fwww%2Enothingbutsharepoint%2Ecom&r=fileextension%3D"ascx"%20fileextension%3D"asp"%20fileextension%3D"aspx"%20fileextension%3D"htm"%20fileextension%3D"html"%20fileextension%3D"jhtml"%20fileextension%3D"js"%20fileextension%3D"mht"%20fileextension%3D"mhtml"%20fileextension%3D"mspx"%20fileextension%3D"php"

Will be converted to display only what the user has typed in the Search Box, which in this example, is: “pdf“.

Each time a user types in a Search, their query is recorded with their name, date and keywords typed.

Firstly, you need to install and configure the “Hit-Counter and Star-rating for SharePoint” from Alexander’s SharePoint JavaScripts site.

Once you have this configured it and you can see the users data added to the  HitCounter List , we can now modify the HitCounterAndStarRatingForSharePoint.js file to include the Users keywords entered.

1: First create a new column within the HitCounter list call it UserKeywords.  Add this column to your default view.

2: Edit the HitCounterAndStarRatingForSharePoint.js  and scroll down to about line 218:  //Add item.  Within that block of code you will see the column variables, make a new line under ReferringURL:refURL, and type in the new column name which is attached to the variable as such:

UserKeywords:searchQuery,

3:  Then under the following code at about Line: 152

// Get url and referrer
refURL = document.referrer;

Add the following lines of code:

searchURL = window.location.search;                               //returns string ?k=Users%20Search%20String
  modURL = searchURL.substring(3);                                   //removes characters ?k= from string
  decodedURL = decodeURIComponent(modURL);       //decode URL to translate encoded characters from string
  searchQuery = decodedURL.split('&')[0];                         //removes characters all after &

Each line I’ve added a comment that describes what each line does.  I don’t know how to write code in Javascript, so I had to Google Search each line to work out how to accomplish each Javascript function.

4:  Now you can test the Search Results page by entering in a Search Query and then checking the HitCounter List.

The UserKeywords column will now display the Search Keywords exactly how they are typed by the user.

Any questions, please comment below, thanks for reading.

July 1, 2013 Posted by | SharePoint 2010, SharePoint Designer 2010, SharePoint Javascript | , , | Leave a comment

Open all PDF files in Maximum Dialog Box

This code grabs any PDF file on the page and rather have them opening in the same window or a new window, they open conveniently in a SharePoint modal pop up dialog window.

All you need to do is:

1: Place the code below into a TXT or HTML file,

2: Upload it to a Document Library

3: Your could edit the file and change the path of JQuery to a local copy of JQuery1.9.1.min.js if required.

4: You could either reference the file path in a Content Editor Web Part.  eg: \sharepointserver\sites\sitecollection\subsite\scripts\pdfmaxdialogcode.html

or add the code to your Master Page in a .JS file . (Need help with this, post a comment below)

5: Open up a page where PDF files are located and test it out.

Fullscreen SharePoint Dialog

To see a preview of the result, refer to my previous post: https://sharepoint2020.wordpress.com/2013/02/15/how-to-open-a-pop-up-dialog-maximized-fullscreen/

This script was created by Alexander Bautz from http://spjsblog.com/

His post is located here: http://spjsblog.com/2013/05/31/open-pdf-files-in-a-maximized-dialog/

For redundancy, I’ll post the code here as well.

* After you Paste the code, you will need to remove the < code > < / code > tags from the script below, it’s the only way I can paste the code in WordPress without the Object tags being stripped out.
<!-- Put this code below the list view web part -->
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
$("a[href$='.pdf']").each(function(){
$(this).removeAttr("onclick").attr("href","javascript:openPDFinDlg(\""+this.href+"\")");
});
function openPDFinDlg(href){
var o;
$("body").append("<div id='pdfTemp' style='min-height:600px;min-width:800px;height:100%;overflow:hidden'><<code>object</code> data='"+href+"' width='100%' height='100%' type='application/pdf' ></<code>object</code>></div>");
o = {};
o.html = $("#pdfTemp")[0];
o.showMaximized = true;
o.title = href.substring(href.lastIndexOf("/")+1);
o.dialogReturnValueCallback = openPDFinDlgCallback;
SP.UI.ModalDialog.showModalDialog(o);
}

function openPDFinDlgCallback(){
// do something here when the dialog closes
}
// ]]></script>

To enhance the display of PDF files to your site vistors

When dealing with PDF files, you can also add parameters from Adobe’s PDF Open Parameters documentation to the +href+ variable to present the PDF to your users.

Some examples of Adobe PDF Open Parameters:

The following table lists and describes the available PDF open parameters. Italics indicate user-specified variables.

page=pagenum
Specifies a numbered page in the document, using an integer value. The document’s first page has a pagenum value of 1.
zoom=scale
zoom=scale,left,top
view=Fit
view=FitH
view=FitH,top
view=FitV
view=FitV,left
view=FitB
view=FitBH
view=FitBH,top
view=FitBV
view=FitBV,left

Use the page command before this command.
pagemode=bookmarks
pagemode=thumbs
pagemode=none (default)
Displays bookmarks or thumbnails.
scrollbar=1|0
Turns scrollbars on or off.
toolbar=1|0
Turns the toolbar on or off.
statusbar=1|0
Turns the status bar on or off.
messages=1|0
Turns the document message bar on or off.
navpanes=1|0
Turns the navigation panes and tabs on or off.

for example: Within line 11, you can change this portion:

 data='"+href+"' width='100%' height='100%' type='application/pdf' 

to this

 data='"+href+"#page=1&view=fitV&pagemode=thumbs' width='100%' height='100%' type='application/pdf' 

For further documentation on Adobe Open Parameters see this link:

http://partners.adobe.com/public/developer/en/acrobat/PDFOpenParameters.pdf

* Possible issues: If the PDF link is located outside of your SharePoint server, the dialog window will display but the PDF may not.

Hope the code is useful for your site, thanks for reading.

June 3, 2013 Posted by | SharePoint 2010, SharePoint Designer 2010 | , , | Leave a comment

Reply to Discussion: Send Email to Item Owner using Workflow

After a few Google Searches, I finally found how to Send an Email, using SharePoint 2010 Designer Workflow, to the Original Creator of a Discussion Item when someone posts a reply to the discussion item.

Here is the original URL I used for the instructions: http://answers.flyppdevportal.com/categories/sharepoint2010/sharepoint2010customization.aspx?ID=03d57a50-17d6-4013-bb58-b816d97f63ec

“I learned that discussions have two different content types, Discussion for a new topic posted and Message for a reply to that topic.

The ID for the original discussion (topic) post is the column “ID” on that item. But the reply messages store this same number in the “Parent Folder ID” column.

So, I created a workflow with one condition, that the content type is Message. When the condition is met (only by replies), I send an email with the To field populated by: “Workflow Lookup for a User”, with the data source as the Current List, the Field from source as Created by and the Return field as Email Address.

Under Find the List Item, the column is ID and the Value is Current Item:Parent Folder ID. Then fill in the body of the email with whatever data you need.”

SP2010WorkflowDiscussionReply

Note:  Condition – “Current Item Content Type equals Message  (You’ll have to type in the word “Message”)

For the Action, just follow the picture that shows the correct way of determining the Originator of the Discussion Item.

For the Body, you could add a direct URL to the Discussion List Item from the following Blog Page: http://geekswithblogs.net/bjackett/archive/2011/02/18/sharepoint-designer-2010-email-link-to-item.aspx

Ask if anything is unclear. Thanks for reading.

April 17, 2013 Posted by | SharePoint 2010, SharePoint Designer 2010 | , | 8 Comments

How to Open a Pop-up Dialog Maximized Fullscreen

This is a great way to open links on your page without using Browser tabs or “Open in New Window” options.

This feature enables a specified link, when clicked to open in a dialog window with one extra feature, it opens in Maximized View to the exact dimensions of the users monitor.

I find this method is more user friendly, great for hiding the URL of the dialog content and perfect for showing PDF files while still keeping the user on your site.

Fullscreen SharePoint Dialog

First test this code in a html page and attach it as a Content Editor Web Part first, just to make sure everything is working.

<style type="text/css" >
#wrapper {
 width: 960px;
 margin: auto;
}
html.ms-dialog #wrapper {
 width: 100%;
}
</style>

<script type="text/javascript" >
function openDialog(strPageURL) {
var options = {
url: strPageURL,
showMaximized: true,
width: 800,
height: 500,
title: "Title of Dialog" };
SP.UI.ModalDialog.showModalDialog(options);
}
</script>

Once this code is pasted in use the following with your hyper link:

<a onclick='javascript:openDialog("/server/teamsite/document.pdf");javascript:return false;' href="#" target=_self> Click to Open</a>  

So on each hyper-link you just add this extra code to your URL for it to open in a maximized dialog window.

Please let me know if the code helps you in your SharePoint Enviroment or if you have any questions, just comment below.

* I’ve tried to find the site where I first obtained this code to give credit but cannot find which site I gathered most of the code from.

February 15, 2013 Posted by | SharePoint 2010, SharePoint Designer 2010 | , , | 1 Comment

jQuery Masonry for SharePoint 2010

This slideshow requires JavaScript.

jQuery Masonry http://masonry.desandro.com/  is a page layout feature involving the use of Divs, CSS and jQuery and I thought that would look great for web parts on a SharePoint page.  So using my SharePoint design/hacking skills, I created a Page Layout to work with jQuery Masonry.

No need to position web parts according to the default templates provided out-of-the-box, just add your web parts to the individual web part zones and let the users browser position them dynamically.

I find positioning web parts on a page tedious and time-consuming, trying to fit them in a 1024×768 area without scrolling horizontally can be frustrating, so when I stumbled on jQuery Masonry, I had to get this working in my environment.

I’ve adjusted jQuery Masonry to function with Web Part Zones on a SharePoint 2010 Publishing Page Layout. (code below).  All you need to do is place the most relevant or important web parts at the top of the page and the users browser would do the rest.

1: Instructions to add jQuery Masonry to your SharePoint environment:

2: Download jQuery Masonry files from link above

3: Open SharePoint Designer 2010

4: Copy Masonry Files to a Document Library, ie: scripts

5: Create new Page Layout at the top-level site collection.

6: Copy this code to a text editor and update the Masonry file paths.

7: Paste this code after this line: <asp:Content ContentPlaceholderID=”PlaceHolderMain” runat=”server”>

<WebPartPages:SPProxyWebPartManager runat="server" id="spproxywebpartmanager"></WebPartPages:SPProxyWebPartManager>

<!--[if lte IE 7]>
<link rel="stylesheet" type="text/css" href="../../scripts/masonry-site/css/ie7.css" />
<![endif]-->

 <style type="text/css">

.col1 { width: auto; }

.box {
 margin: 2px;
 padding: 2px;
 background: #D8D5D2;
 float: left;
 -webkit-border-radius: 5px;
 -moz-border-radius: 5px;
 border-radius: 5px;
}

 .clearfix { zoom: 1; }
 </style>

 <div id="container" class="clearfix">

<div class="box col1">

 <WebPartPages:WebPartZone id="g_A08B0D214A4D4D2AAA747A4FC19941FB" runat="server" title="Zone 1"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone>

 </div>

<div class="box col1">

 <WebPartPages:WebPartZone id="g_DC055C5704EF427DA2E38F851900937B" runat="server" title="Zone 2"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone>

 </div>

<div class="box col1">

 <WebPartPages:WebPartZone id="g_F7B0518D8025480F931833EEFCA92129" runat="server" title="Zone 3"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone>

 </div>

<div class="box col1">

 <WebPartPages:WebPartZone id="g_7BCF356FE81A427BB4EDC8EB36FCB10F" runat="server" title="Zone 4"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone>

 </div>

<div class="box col1">

 <WebPartPages:WebPartZone id="g_F379EB375FC143F292F52CD1393E2544" runat="server" title="Zone 5"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone>

 </div>

<div class="box col1">

 <WebPartPages:WebPartZone id="g_94E95467DCA3410381D64A184F3A5716" runat="server" title="Zone 6"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone>

 </div>

<div class="box col1">

 <WebPartPages:WebPartZone id="g_0C39484DF210480884A8ECD0828AD1C5" runat="server" title="Zone 7"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone>

 </div>

<div class="box col1">

 <WebPartPages:WebPartZone id="g_90C8F765302B4D45942E22B8D90E7B77" runat="server" title="Zone 9"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone>

 </div>

<div class="box col1">

 <WebPartPages:WebPartZone id="g_EBBDA9C3986C4388875859746F01C1E7" runat="server" title="Zone 10"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone>

 </div>

<div class="box col1">

 <WebPartPages:WebPartZone id="g_4535738D283D4533AB249BFF19FFB200" runat="server" title="Zone 8"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone>

 </div>

<div class="box col1">

 <WebPartPages:WebPartZone id="g_6A1674E0E7894655A6C92E84D1747A7D" runat="server" title="Zone 11"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone>

 </div>

<div class="box col1">

 <WebPartPages:WebPartZone id="g_F1A07AFC0DBD466889A24252A531C7D3" runat="server" title="Zone 12"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone>

 </div>

<div class="box col1">

 <WebPartPages:WebPartZone id="g_E48F91568389441083A17C4BA841CA39" runat="server" title="Zone 13"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone>

 </div>

<div class="box col1">

<WebPartPages:WebPartZone id="g_956FE13F1AA04B748DC75A4192BBFC96" runat="server" title="Zone 14"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone>

</div>

<div class="box col1">

 <WebPartPages:WebPartZone id="g_2AB70C79E55A4354976FE591C9D356BA" runat="server" title="Zone 15"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone>

 </div>

<div class="box col1">

 <WebPartPages:WebPartZone id="g_EF783A5A11AA456D807BB9DD5F1E2B12" runat="server" title="Zone 16"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone>

 </div>

</div> <!-- #container -->

<script src="/scripts/masonry-site/js/jquery-1.7.1.min.js"></script>
<script src="/scripts/masonry-site/jquery.masonry.min.js"></script>
<script>
 $(function(){

 $('#container').masonry({
 itemSelector: '.box',
 columnWidth: 10,
 isAnimated: true
 });

 });
</script>

8: Save, check in, publish.

9: Create a new Publishing Page

Publishing Page Layout
For IE7 Users add the follwing CSS, because of the way IE7 uses width: 100% inside Width: Auto, the web part zones will expand to 100% of the page.

.s4-ca table {
 width: auto; !important
}
.box {
 margin: 0px;
 padding: 0px;
}
/* toolpane */
.ms-ToolPaneOuter {
 position: relative;
}

This is how I achieved jQuery Masonry for SharePoint 2010 Publishing Page Layout.
Any questions or ideas for improvement, please comment.

September 2, 2012 Posted by | SharePoint 2010, SharePoint Designer 2010 | , | Leave a comment

Create PDF thumbnail view in column using iframes

This is how I created a thumbnail view of PDF files in a Document Library.

Using a Document Library to store PDF Files. Call it “Uploads”

1: Create workflow using SharePoint Designer to copy Name column to Title column.  This will allow us to use the Title column in a Calculated Column.  This Blog post describes the process: http://www.knowledgegroup.no/blogg/post/2012/05/13/Add-filename-in-title-field-using-workflow.aspx

2: Add a Calculated Column to the document library, call it “Preview”

Copy this formula:

=CONCATENATE("<DIV><iframe width='200px', height='200px', scrolling='no', src='http://server/uploads/",Title,".pdf#page=1&toolbar=0&scrollbar=0&navpanes=0&statusbar=0'></iframe></DIV>")

* change http address to your SharePoint server name and change to location of PDF files.  

3:  Add a Content Editor Web Part to the Document Libary view and copy the link to Christophe’s Text to HTML code:

Or use the Calc column, Number option work-around.

<script type="text/javascript">// <![CDATA[
//
// Text to HTML
// Feedback and questions: Christophe@PathToSharePoint.com
//
var theTDs = document.getElementsByTagName("TD");
var i=0;
var TDContent = " ";
while (i < theTDs.length)
{
try
{
TDContent = theTDs[i].innerText || theTDs[i].textContent;
if ((TDContent.indexOf("<DIV") == 0) && (TDContent.indexOf("</DIV>

") >= 0)) {
theTDs[i].innerHTML = TDContent;
}
}
catch(err){}
i=i+1;
}
// ]]></script>

That’s it, upload your pdf files, test and adjust.

One down-side is the page does load a little slow as it’s trying to load multiple pdf files.

I’ve tested it on IE9 and IE7 using different hardware and the page loads fine for my purposes.

If someone knows of a solution that can be used to convert the first page to a picture thumbnail that would be better for performance, or if you have any questions, please post in the comments section below.

Thanks for reading.

Request from to Ben, here is the calculated column as it should appear.

*Please note, you must have the filename of the PDF in the TITLE Column.
* Using Number as the data type, you won’t require Christophe’s code snippet above.

 

PDFthumbcalc_column

August 10, 2012 Posted by | SharePoint 2010, SharePoint Designer 2010 | , , , , | 20 Comments