zoukankan      html  css  js  c++  java
  • 拆分SharePoint 2013 中CreatedModifiedInfo 的时间

    最近在自定义DisForm.aspx页面时 发现 创建时间信息无法进行拆分,人事MM只想要修改时间,去掉创建人,创建时间和修改人。

    于是我的重新研究下在SPD里面如何去拆分这个时间。

    在详情页面上找到的时间信息是如下控件。(默认的DisForm页面没有,这里我是新建了一个列表显示页面)

    <SharePoint:CreatedModifiedInfo Visible="false" ControlMode="Display" runat="server"/>

    其实就这个东东。但是在转换成html的时候会变成个table,所以我们要分析下里面有什么东西。

    问了下其他人,列表的基本模板可以在C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\CONTROLTEMPLATES

    的DefaultTemplates.ascx下找到具体对应的数据绑定,查找 CreatedModifiedInfo 大概在485行左右。

    <SharePoint:RenderingTemplate id="CreatedModifiedInfo" runat="server">
        <Template>
            <table cellpadding="0" cellspacing="0">
              <tr><td nowrap="nowrap" class="ms-descriptiontext" id="onetidinfoblock1">
                    <SharePoint:FormAuthorEditorFormattedString
                        UserOnlyFormatText="<%$Resources:wss,form_createdby_user%>"
                        AppOnlyFormatText="<%$Resources:wss,form_createdby_app%>"
                        UserAppFormatText="<%$Resources:wss,form_createdby_user_app%>"
                        IsAuthorField="true"
                        runat="server">
                        <SharePoint:FormField ControlMode="Display" FieldName="Created" DisableInputFieldLabel="true" runat="server"/>
                        <SharePoint:FormField ControlMode="Display" FieldName="Author" DisableInputFieldLabel="true" runat="server"/>
                        <SharePoint:CreationType runat="server"/>
                        <SharePoint:FormAppInfo ControlMode="Display" FieldName="AppAuthor" runat="server" />
                    </SharePoint:FormAuthorEditorFormattedString>
                </td></tr>
                <tr><td nowrap="nowrap" class="ms-descriptiontext" id="onetidinfoblock2">
                    <SharePoint:FormAuthorEditorFormattedString
                        UserOnlyFormatText="<%$Resources:wss,form_modifiedby_user%>"
                        AppOnlyFormatText="<%$Resources:wss,form_modifiedby_app%>"
                        UserAppFormatText="<%$Resources:wss,form_modifiedby_user_app%>"
                        IsAuthorField="false"
                        runat="server">
                        <SharePoint:FormField ControlMode="Display" FieldName="Modified" DisableInputFieldLabel="true" runat="server"/>
                        <SharePoint:FormField ControlMode="Display" FieldName="Editor" DisableInputFieldLabel="true" runat="server"/>
                        <SharePoint:FormAppInfo ControlMode="Display" FieldName="AppEditor" runat="server" />
                    </SharePoint:FormAuthorEditorFormattedString>
                </td></tr>
            </table>
        </Template>
    </SharePoint:RenderingTemplate>

    这时,可以发现这个空间也是由许多数据绑定而成,例如

    <SharePoint:FormField ControlMode="Display" FieldName="Created" DisableInputFieldLabel="true" runat="server"/>
    <SharePoint:FormField ControlMode="Display" FieldName="Author" DisableInputFieldLabel="true" runat="server"/>

    上面的代码是显示创建时间和创建人的。
    我们回到原来的详细页面设计下。将

    <SharePoint:FormField ControlMode="Display" FieldName="Modified" DisableInputFieldLabel="true" runat="server"/>

    复制到需要显示的位置。

    <tr>
        <td width="190px" valign="top" class="ms-formlabel" style="display:none">
                                            
        <H3 class="ms-standardheader">
        <nobr>标题</nobr>
        </H3>
        </td>
        <td width="400px" valign="top" class="ms-formbody" style="font-family:微软雅黑;font-weight:bolder;font-size:20px;text-align:center">
                                            
        <xsl:value-of select="@Title"/>
        </td>
    </tr>
    <tr>
        <td colspan="2" width="400px" valign="top" class="ms-formbody" style="font-family:微软雅黑;font-size:12px;text-align:center">
    <SharePoint:FormField FieldName="Modified" runat="server" ControlMode="Display" DisableInputFieldLabel="true"/>
    </td> </tr> <tr> <td width="190px" valign="top" class="ms-formlabel" style="display:none"> <H3 class="ms-standardheader"> <nobr>Content</nobr> </H3> </td> <td width="400px" valign="top" class="ms-formbody"> <xsl:value-of select="@Content" disable-output-escaping="yes"/> </td> </tr>

    具体显示的效果如下

     搞定~

     收工!

  • 相关阅读:
    导包路径
    django导入环境变量 Please specify Django project root directory
    替换django的user模型,mysql迁移表报错 django.db.migrations.exceptions.InconsistentMigrationHistory: Migration admin.0001_initial is applied before its dependen cy user.0001_initial on database 'default'.
    解决Chrome调试(debugger)
    check the manual that corresponds to your MySQL server version for the right syntax to use near 'order) values ('徐小波','XuXiaoB','男','1',' at line 1")
    MySQL命令(其三)
    MySQL操作命令(其二)
    MySQL命令(其一)
    [POJ2559]Largest Rectangle in a Histogram (栈)
    [HDU4864]Task (贪心)
  • 原文地址:https://www.cnblogs.com/AsprosL/p/4024948.html
Copyright © 2011-2022 走看看