tags:

views:

714

answers:

3

When a list item has an attachment, SharePoint automatically renders a paperclip image for that particular row, which indicates that the item has an attachment. Is there any way to change the image that is rendered?

The site is in a shared hosting environment, so I can't simply replace the image on the file system. Also, there are other lists that are part of the same site that should use the default image.

Is there any way to change the image that is rendered for items with an attachment on an individual list basis?

EDIT: Following is the HTML that is rendered:


<td class="ms-vb2">
    <img align="absbottom" src="http://devsandbox/_layouts/images/attach.gif" alt="Attachment"/>
</td>
A: 

i don't know which element off the top, but I would look for it in one of the stylesheets and use SharePoint designer to do the replacement work for a specific list.

Jason
The problem is that it's rendered inside of a WebPart, which means that I don't have the ability to edit it directly in SPD.
senfo
A: 

Use Firebug to inspect the element that you want to revert. This will tell you the css class and other properties used by that element. Then write your own class and add it to the core.css file or if you want, add it to the css for the Site/Site Collection through the MasterPages link in Site Settings.

EDIT

I used firebug to look at an image in SharePoint and here is how it is rendering.

<img id="img_1-2_" class="rpo-gif rpo-gif-2" border="0" style="padding: 0px;" alt="Expand/Collapse" src="/_layouts/images/minus.gif"/>

As you can see it is using a class and setting a src to '/_layouts/images/minus.gif'. Well you can go find that file in the 12Hive directory and then replace it with an image of your choice that has the same name.

AboutDev
It actually renders as an image tag, so there isn't anything (that I know of) that I can override in a custom CSS class.
senfo
Sorry but I don't have enough space in this comment to put in the process I am thinking about. Will need to post it as an answer.
AboutDev
+5  A: 

The only real way you'll be able to do this is to use jQuery (or some other javascript library). You'll need to locate the elements you want to update on the page and change the URL's

$('img[src*=attach.gif]').each(function() { 
  $(this).attr('src', '/path/to/new/image.png');
}

My jQuery may be a touch wrong but that should be near enough to give you an idea of what to do

Edit - The best way to have this down would be via a custom WebPart which renders the JavaScript. This way it can easily be dropped into any page you want

Slace
This is probably better if you want to replace the image on select pages. If you want it across the SharePoint site collection or Farm, then its going to be painful to implement.
AboutDev
Instead of writing and deploying a custom web part (probably not an option on shared hosting) you can use the built in Content Editor Web Part to host the javascript - see Christophe's excellent blog for more ideashttp://pathtosharepoint.wordpress.com/
Ryan