环境:Sharepoint2010
需求:在审批任务页面中插入或显示表单或列表内容,让内容与审核在同一页面上。
修改文件:WrkTaskIp.aspx(改前记得备份)
文件所在的路径:C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\template\layouts
列表效果:
表单效果:
具体做法:
将WrkTaskIp.aspx与jquery-1.8.3.js两个件拷贝到C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\template\layouts里,拷贝前记得备份源文件。
WrkTaskIp.aspx 代码:
<%-- _lcid="1033" _version="14.0.4758" _dal="1" --%> <%-- _LocalBinding --%> <%@ Assembly Name="Microsoft.Office.Workflow.Pages, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%> <%@ Assembly Name="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%> <%@ Page Language="C#" DynamicMasterPageFile="~masterurl/default.master" Inherits="Microsoft.Office.Workflow.WrkTaskIPPage" EnableSessionState="true" AutoEventWireup="false" %> <%@ Import Namespace="Microsoft.SharePoint.WebControls" %> <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Import Namespace="Microsoft.SharePoint" %> <%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="InfoPath" Namespace="Microsoft.Office.InfoPath.Server.Controls" Assembly="Microsoft.Office.InfoPath.Server, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register TagPrefix="wssuc" TagName="LinksTable" src="/_controltemplates/LinksTable.ascx" %> <%@ Register TagPrefix="wssuc" TagName="InputFormSection" src="/_controltemplates/InputFormSection.ascx" %> <%@ Register TagPrefix="wssuc" TagName="InputFormControl" src="/_controltemplates/InputFormControl.ascx" %> <%@ Register TagPrefix="wssuc" TagName="LinkSection" src="/_controltemplates/LinkSection.ascx" %> <%@ Register TagPrefix="wssuc" TagName="ButtonSection" src="/_controltemplates/ButtonSection.ascx" %> <%@ Register TagPrefix="wssuc" TagName="ActionBar" src="/_controltemplates/ActionBar.ascx" %> <%@ Register TagPrefix="wssuc" TagName="ToolBar" src="/_controltemplates/ToolBar.ascx" %> <%@ Register TagPrefix="wssuc" TagName="ToolBarButton" src="/_controltemplates/ToolBarButton.ascx" %> <%@ Register TagPrefix="wssuc" TagName="Welcome" src="/_controltemplates/Welcome.ascx" %> <asp:Content ContentPlaceHolderId="PlaceHolderAdditionalPageHead" runat="server"> </asp:Content> <asp:Content ContentPlaceHolderId="PlaceHolderPageTitle" runat="server"> <SharePoint:EncodedLiteral runat="server" text="<%$Resources:dlc, WrkTask_PageTitle%>" EncodeMethod=‘HtmlEncode‘/> </asp:Content> <asp:Content ContentPlaceHolderId="PlaceHolderPageTitleInTitleArea" runat="server"> <a tabindex=1 id=onetidListHlink HREF=<% SPHttpUtility.AddQuote(SPHttpUtility.UrlPathEncode(List.DefaultViewUrl,true),Response.Output);%>><%SPHttpUtility.HtmlEncode(List.Title,Response.Output);%></A>: <% SPHttpUtility.HtmlEncode(m_taskName,Response.Output); %></asp:Content> <asp:Content ContentPlaceHolderId="PlaceHolderTitleBreadcrumb" runat="server"> <asp:SiteMapPath SiteMapProvider="SPContentMapProvider" id="ContentMap" SkipLinkText="" runat="server"/> </asp:Content> <asp:Content ContentPlaceHolderId="PlaceHolderLeftNavBar" runat="server"> </asp:Content> <asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server"> <SharePoint:FormComponent TemplateName="WorkflowEditFormToolBar" ControlMode="Edit" runat="server"/> <table class="ms-informationbar" style="margin-top: 10px;" border="0" cellpadding="2" cellspacing="0" width="100%" > <tr> <td width="10" valign="center" style="padding: 4px;"> <img IMG SRC="/_layouts/images/Workflows.gif" alt=<%SPHttpUtility.AddQuote(SPHttpUtility.HtmlEncode(GetLocString("WrkTask_PageTitle")),Response.Output);%>/> </td> <td id="itemLink"> <% SPHttpUtility.NoEncode(m_pageDescription,Response.Output); %></td> </tr> </table> <div style="width:100%;height:250px;border:1px solid #666;overflow-x:hidden; overflow-y:auto"> <iframe width="100%" height="400px" frameborder="no" style=" margin-top:-140px;margin-left:50px;" id="showItemDisplayForm"></iframe> </div> <InfoPath:XmlFormView id="XmlFormControl" runat="server" style="width:100%;" /> <SharePoint:FormDigest runat=server/> <script src="/_layouts/jquery-1.8.3.js"></script> <script language="javascript"> var showDialog = function () { var itemlink = $("#itemLink").find("a").attr("href"); var newItemLink; var v = itemlink.split("/"); v.splice(3, v.length - 3); var homePageUrl = v.join("/"); if (itemlink.substring(itemlink.length - 4, itemlink.length) == ".xml") { newItemLink = homePageUrl + "/_layouts/FormServer.aspx?XmlLocation=" + encodeURI(itemlink) + "&DefaultItemOpen=1"; } else { newItemLink = itemlink + "&isdlg=1"; } $("#showItemDisplayForm").attr("src", newItemLink); } _spBodyOnLoadFunctionNames.push(‘showDialog‘); </script> </asp:Content>
如你有更好的方法,请分享下。
时间: 2024-10-15 04:57:23