Wednesday, September 21, 2011

Display a picture in a dataview web part

from: http://techtrainingnotes.blogspot.com/2009/04/sharepoint-displaying-pictures-and.html


4/27/2009
SharePoint: Displaying Pictures and Thumbnails in a Data View Web Part


This is in response to a question about displaying a thumbnail from a Picture Library in a Data View web part…



Displaying the full size picture is really easy. When selecting your fields for the Data View web part select “Url Path”. This will be added to the XSLT of the Data View web part as:

{@FileRef}

(@FileRef is the XSLT fieldname used for “Url Path”)



The trick is getting the URL to the picture library’s auto-created thumbnail. The thumbnail for “test.jpg” is “/_t/test_jpg.jpg” and is not a field in the SharePoint Designer list of fields. To get it you will need to do some XSLT string work:

concat(@FileDirRef,'/_t/', substring-before(@FileLeafRef,'.'),'_',substring-after(@FileLeafRef,'.'),'.',@FileType)

Note: the above will only work if only one “.” exists in the file name. It will fail for a file named my.airshow.picture.jpg

@FileDirRef is the name of the library (airshow%20pictures)

@FileLeafRef is the file name (helicopter.jpg)

@FileType is the file type (jpg)

‘/_t/’ is the path to the auto-created thumbnails

substring-before / after are XSLT string functions

The above “stuff” will convert:

/airshow%20pictures/helicopter.jpg

into

/airshow%20pictures/_t/helicopter_jpg.jpg

which is the path to the thumbnail.



The final tag looks like this:

{@FileRef}



If you would like to let the user click on the thumbnail to see the full picture and meta data then wrap the in a tag and supply the ID of the picture:


{@FileRef}

Thursday, August 18, 2011

Dynamically Show/Hide Multiple Web Parts - End User - NothingButSharePoint.com

Here's a great javascript that will allow you to dynamically hide web parts and build a table of them - that will then link to the hidden web part and un-hide it.

Dynamically Show/Hide Multiple Web Parts - End User - NothingButSharePoint.com

Thursday, February 10, 2011

Remove the 'Save' button from a SharePoint survey | EndUserSharePoint.com

Remove the 'Save' button from a SharePoint survey | EndUserSharePoint.com
Note there is an error in the script, the" needs to be replaced.


<script type="text/javascript">
if(typeof jQuery=="undefined"){
var jQPath="/javascripts/";
document.write("<script src='",jQPath,"jquery-1.3.2.min.js' type='text/javascript'><\/script>");
}
</script>
<script type="text/javascript">
$(function(){
$(":inputs[value='Save']").hide($);
});
</script>

Monday, February 7, 2011

Expand/collapse buttons for your Web Parts « Path to SharePoint

Expand/collapse buttons for your Web Parts « Path to SharePoint

HTML Escaped output

http://javascript.about.com/library/blscr01.htm

Allow Site Visitors To Change Font Sizes on your Blog

Working from this: Allow Site Visitors To Change Font Sizes on your Blog

I modified the tag it references to work better on SP 2007 pages. Paste the following into a CEWP.

<script language="JavaScript" type="text/javascript">
function changeFontSize(inc)
{
var p = document.getElementsByTagName('TD');
for(n=0; n<p.length; n++) {
if(p[n].style.fontSize) {
var size = parseInt(p[n].style.fontSize.replace("px", ""));
} else {
var size = 12;
}
p[n].style.fontSize = size+inc + 'px';
}
}
</script><div align=right>Adjust the screen font size:
<A href="javascript:changeFontSize(1)"><Font size=2>[+]</font></A> |
<A href="javascript:changeFontSize(-1)"><FONT size=2>[-]</FONT></A></div>

Thursday, January 13, 2011

No item exists error when I click edit link in DataView

No item exists error when I click edit link in DataView: "Never put the same name to your parameters what sharepoint is using as internal or display name.
Give your own name then you never get this problem.

like:- Instead of http://server/Pages/Publish.aspx?publishFileName=folderName/subfolderName/filename&ID=12

use this http://server/Pages/Publish.aspx?publishFileName=folderName/subfolderName/filename&PublishItemID=12"