I have tried to do this by 2 different approaches

Approach1: - Customization of Forms
1.      Create a picture library site.
2.      Open the site in SharePoint designer.
3.      Create a custom Display form (DispForm1.aspx).
4.      Remove the SharePoint:FormToolBar.
5.      Add new hyperlinks for Edit, Delete and Alert me.
6.      On Edit hyperlink, redirect to EditForm.aspx, with queryparameter EditForm.aspx?@ID={@ID}&RootFolder={@FileDirRef}
7.      On Edit Alert me, redirect to SubNew.aspx, with queryparameter List and Source

Issues with this approach:-
1.      How to call the DispForm1.aspx from AllItems.aspx? AllItems.aspx contains ListView webpart to display the image files and does not allow customization. If we delete the default DispForm.aspx and rename the newly created DispForm1.aspx to DispForm.aspx, the site will stop working, on click on the image in AllItems.aspx, it is not displaying DispForm.aspx.

Approach2:- Hide Items in the FormToolBar
1.      Override the .ascx based toolbar templates by using a custom template that overrides a toolbar.

<%@ Control Language="C#"   AutoEventWireup="false" %>
<%@Assembly Name="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@Register TagPrefix="SharePoint" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" namespace="Microsoft.SharePoint.WebControls"%>
<%@Register TagPrefix="SPHttpUtility" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" namespace="Microsoft.SharePoint.Utilities"%>
<%@ Register TagPrefix="wssuc" TagName="ToolBar" src="~/_controltemplates/ToolBar.ascx" %>
<%@ Register TagPrefix="wssuc" TagName="ToolBarButton" src="~/_controltemplates/ToolBarButton.ascx" %>

<SharePoint:RenderingTemplate ID="custoolbarpiclib" runat="server">
       <Template>
               <wssuc:ToolBar CssClass="ms-toolbar" EnableViewState="false" id="toolBarTbl" ButtonSeparator="<img src='/_layouts/images/blank.gif' alt=''>" RightButtonSeparator="&nbsp;&nbsp;" runat="server">

                     <Template_Buttons>                      
                        <SharePoint:EditItemButton  AccessKey ="<%Resources:wss,tb_EditItemButton_AK%>" runat ="server" />
                        <SharePoint:DeleteItemButton AccessKey ="<%Resources:wss,tb_DeleteItemButton_AK%>" runat ="server" />
                        <SharePoint:AlertMeButton AccessKey ="<%Resources:wss,tb_AlertMeButton_AK%>" runat ="server" />
                     </Template_Buttons>
               </wssuc:ToolBar>
       </Template>
</SharePoint:RenderingTemplate>

Create the .ascx file with custom template and add in C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\CONTROLTEMPLATES.
Issues:-
1.      This will affect all the sites.
2.      Instead of overriding, How create a new toolbar template and associate new template with our picture library?
posted on 2008-08-27 13:41  季博望  阅读(642)  评论(0编辑  收藏  举报