<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Summary.aspx.cs" Inherits="ProcessDefinition.SubPages.Summary" Theme="" %>
<div class="summary">
<asp:panel id="pnlReader" runat="server" CssClass='summaryPanel'>
    <dp:RRPanel ID="RRPanel4" runat="server" MinimumRole="Author">

    <asp:Panel runat="server" ID="pnlSettingsWarning" CssClass="settingsWarning" visible="false">
        <h2>You have not completed the process library settings.  Complete these in <a href='<%=ReposRoot %>/Admin/Settings'>Process library settings</a>.</h2>
    </asp:Panel>
    </dp:RRPanel>

   <table class='libSumTable'>
        <tr>
            <td>

            <asp:ObjectDataSource ID="odsPublishedVersions" runat="server"
                OldValuesParameterFormatString="original_{0}" SelectMethod="GetPublishedVersions"
                TypeName="DevProcess.ProcessDefinitionService.ProcessDefinitionManager">
                <SelectParameters>
                    <asp:Parameter Name="repositoryName" Type="String"/>
                </SelectParameters>
            </asp:ObjectDataSource>
            <asp:ListView ID="lvPublishedVersions" runat="server" ItemPlaceholderID="itemList"
                    EnableViewState="False" DataSourceID="odsPublishedVersions" >

                <LayoutTemplate>
                    <h2>Published versions</h2>
                        <asp:PlaceHolder id="itemList" runat="server"/>
                </LayoutTemplate>
                
                <ItemTemplate>
                    <table class='summaryTable'>
                        <tr>
                        <th width='70%'>
                            <%#DevProcess.Common.Utils.StringHelper.Format("{0:multilinenourl} ~ version {1}", Eval("Title"),Eval("Version")) %>
                        </th>
                        <th><%#DevProcess.Common.Utils.StringHelper.Format("{0:localshortdatetime}, {1:roughtimespan} ago", Eval("PublishDate"), DateTime.UtcNow - (DateTime)Eval("PublishDate"))%></th></tr>
                        
                        <tr class="<%# ((ListViewDataItem)Container).DisplayIndex % 2 == 0 ? "" : "altZebra" %>"><td colspan='2'> <%# Eval("Description") %></td>
                        </tr>
                    </table>
                        
                </ItemTemplate>

                <EmptyDataTemplate>

                </EmptyDataTemplate>
            </asp:ListView>

            </td>
       </tr>

    </table>
    <dp:RRPanel ID="RRPanel1" runat="server" MinimumRole="Author">

    <table class='libSumTable'>
        <tr>
            <td>

            <h2>Process library maturity</h2>
            <dp:SparklineSummary ID="spkAccess" runat="server" LastValueFormatString="<b>{0:plural,</b><a href='~reposroot~/Reports/Report/LibraryUserAccess'>definitions,</b><a href='~reposroot~/Reports/Report/LibraryUserAccess'>definition} accessed this month</a>"/>
            <dp:SparklineSummary ID="spkProcessGrowth" runat="server" LastValueFormatString="<b>{0:plural,</b><a href='~reposroot~/Reports/Report/ProcessList'>definitions,</b><a href='~reposroot~/Reports/Report/ProcessList'>definition} created in total</a>"/>
            <dp:SparklineSummary ID="spkProcessChurn" runat="server" LastValueFormatString="<b>{0:plural,</b><a href='~reposroot~/Reports/Report/ProcessList'>definitions,</b><a href='~reposroot~/Reports/Report/ProcessList'>definition} created or updated this month</a>"/>
            <dp:SparklineSummary ID="spkMetrics" runat="server" LastValueFormatString="<b>{0:plural,</b><a href='~reposroot~/Reports/Report/ProcessLibraryMetrics'>metadata values,</b><a href='~reposroot~/Reports/Report/ProcessLibraryMetrics'>data value} entered this month</a>" />

            </td>
        </tr>
    </table>
    <table class='libSumTable'>
    
        <tr>

            <td>
                <asp:ObjectDataSource ID="odsNew" runat="server"
                    OldValuesParameterFormatString="original_{0}" SelectMethod="GetRepositoryLatestProcesses"
                    TypeName="DevProcess.ProcessDefinitionService.ProcessDefinitionManager">
                    <SelectParameters>
                        <asp:Parameter Name="repositoryName" Type="String"/>
                        <asp:Parameter Name="maxReturn" Type="Int32" DefaultValue="10" />
                    </SelectParameters>
                </asp:ObjectDataSource>
                <asp:ListView ID="lvNew" runat="server" ItemPlaceholderID="itemList"
                        EnableViewState="False" DataSourceID="odsNew" >

                    <LayoutTemplate>
                        <h2>Content</h2>
                        <table class='summaryTable'>
                            <tr><th>New and updated definitions</th><th></th></tr>
                            <asp:PlaceHolder id="itemList" runat="server"/>
                        </table>
                    </LayoutTemplate>
                    
                    <ItemTemplate>
                            <tr class="<%# ((ListViewDataItem)Container).DisplayIndex % 2 == 0 ? "" : "altZebra" %>"><td>
                                <asp:HyperLink ID='lnk' runat="server" NavigateUrl='<%#String.Format("{1}/{0}",Eval("PrettyPostTitle"),pd.R.GetReposRoot()) %>' Text='<%#DevProcess.Common.Utils.StringHelper.Format("{0:multilinenourl}", Eval("ProcessTitle")) %>'/></td>
                            <td><%#DevProcess.Common.Utils.StringHelper.Format("{0:roughtimespan} ago",DateTime.UtcNow-(DateTime)Eval("DateChanged")) %></td></tr>
                    </ItemTemplate>

                    <EmptyDataTemplate>

                    </EmptyDataTemplate>
                </asp:ListView>


            </td>
        </tr>

        <tr>
            <td>

            <asp:ObjectDataSource ID="odsLatestDiscussions" runat="server"
                OldValuesParameterFormatString="original_{0}" SelectMethod="GetLatestReposDiscussion"
                TypeName="DevProcess.ProcessDefinitionService.ProcessDefinitionManager">
                <SelectParameters>
                    <asp:Parameter Name="repositoryName" Type="String"/>
                </SelectParameters>
            </asp:ObjectDataSource>
            <asp:ListView ID="lvLatestDiscussions" runat="server" ItemPlaceholderID="itemList"
                    EnableViewState="False" DataSourceID="odsLatestDiscussions" >

                <LayoutTemplate>
                    <h2>Communication</h2>
                    <table class='summaryTable'>
                        <tr><th>Discussions</th><th></th></tr>
                        <asp:PlaceHolder id="itemList" runat="server"/>
                    </table>
                </LayoutTemplate>
                
                <ItemTemplate>
                        <tr class="<%# ((ListViewDataItem)Container).DisplayIndex % 2 == 0 ? "" : "altZebra" %>"><td>
                            <asp:HyperLink ID='lnk' runat="server" NavigateUrl='<%#String.Format("{1}/{0}",Eval("PrettyPostTitle"),pd.R.GetReposRoot()) %>' Text='<%#DevProcess.Common.Utils.StringHelper.Format("{0:multilinenourl}", Eval("ProcessTitle")) %>'/></td>
                        <td><%#DevProcess.Common.Utils.StringHelper.Format("{0:multilinenourl}, {1:roughtimespan} ago",Eval("DisplayName"), DateTime.UtcNow - (DateTime)Eval("CreatedDateTime"))%></td></tr>
                        
                </ItemTemplate>

                <EmptyDataTemplate>

                </EmptyDataTemplate>
            </asp:ListView>

            </td>
       </tr>
        
    </table>
    </dp:RRPanel>
</asp:panel>
</div>