<%@ Page Title="procDef" Language="C#" MasterPageFile="~/iPhone.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="ProcessDefinition.m.Default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">

    <script type="text/javascript" charset="utf-8">
        var currentRepos = 'bp';
        var currentProcess = '';
        var currentSearch = '';
        
        // Repository load functions:
        $(function() {
            //  Add repos selection event
            $('.reposSel').click(selRepos);

            $('#selClassic').click(selClassic);
        });

        function selRepos() {
            currentRepos = $(this).text();
            $("#repos .toolbar h1").text(currentRepos);
            $("#repos #content").load('repos.aspx?r=' + currentRepos, null, function() {
                $('#aspnetForm').bind('submit', searchRepos);
                $('.processSel').click(selProcess);                
            });

        }

        function searchRepos() {
            currentSearch = $('#repos #content #searchBox').val();
            $("#repos .toolbar h1").text(currentRepos);
            $("#repos #content").html('<h2>Loading...</h2>');
            $("#repos #content").load('repos.aspx?r=' + currentRepos + '&search=' + encodeURI(currentSearch), null, function() {
                $('.processSel').click(selProcess);            
            });
            return false;
        }

        function selProcess() {
            currentProcess = $(this).attr('data');
            $("#process .toolbar h1").text($(this).text());
            $("#process #content").html('<h2>Loading...</h2>');
            $("#process #content").load('process.aspx?r=' + currentRepos + '&process=' + currentProcess, null, function() {
                $('#aspnetForm').bind('submit', searchRepos);
            });
        }

        function selClassic() {
            window.location.href='../../'+currentProcess;
        }
        
    </script>            
    
        <style type="text/css" media="screen">
            body.fullscreen #home .info {
                display: none;
            }
            #about {
                padding: 100px 10px 40px;
                text-shadow: rgba(255, 255, 255, 0.3) 0px -1px 0;
                font-size: 13px;
                text-align: center;
                background: #161618;
            }
            #about p {
                margin-bottom: 8px;
            }
            #about a {
                color: #fff;
                font-weight: bold;
                text-decoration: none;
            }
        </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentBody" runat="server">
    <ajax:ToolkitScriptManager runat="server" ID="scrMan" />

        <div id="about" class="selectable"> 
            
                <p><img src="../App_Themes/Default/images/avatar.png" /></p> 
                <p><strong>Process Definition</strong><br />Version 1.0 beta<br /> 
                    <a href='<%=pd.R.CurrentScheme+pd.R.Site %>'>Process Definition</a></p>                
                <p> 
                    <a href="http://twitter.com/procdef" target="_blank">@procDef on Twitter</a> 
                </p> 
                <p><br /><br /><a href="#" class="grayButton goback">Close</a></p> 
                
        </div> 

        <div id="home" class="current">
            <div class="toolbar">
                <h1>procDef</h1>
                <a class="button" href="/">Classic</a>                
            </div>
            
            <asp:Panel ID="pnlSignIn" runat="server">
            
                <h2>Sign in</h2>
                
                <asp:UpdatePanel runat="server" ID="pnlLogin">
                <ContentTemplate>
                    <ul class="rounded">
                            <li><asp:TextBox ID="userName" runat="server" placeholder="Enter your email..."  />
                            <li><asp:TextBox ID="userPassword" runat="server" placeholder="Password" TextMode="Password" /></li> 
                           <li>Remember me <span class="toggle"><asp:CheckBox runat="server" ID="rememberMe" /></span></li> 
                    </ul>

                    <asp:LinkButton rel="external" runat="server" ID="btnSignIn" Text="Sign In" CssClass="whiteButton" style="margin: 10px" OnClick="btnSignIn_Click" />
                
                </ContentTemplate>
                </asp:UpdatePanel>
            
            </asp:Panel>
            
            <asp:Panel ID="pnlRepos" runat="server" Visible="false">
            
                <h2>Libraries</h2>
            
                <asp:Repeater runat="server" ID="rptRepositories">
                    <HeaderTemplate><ul></HeaderTemplate>
                    <ItemTemplate><li class="arrow"><a class="slide reposSel" href="#repos"><%# Eval("RepositoryName") %></a><small class="counter"><%# Eval("AssignedToCount") %></small></li></ItemTemplate>
                    <FooterTemplate></ul></FooterTemplate>
                </asp:Repeater>
                
            </asp:Panel>
            
            
        </div>

        <div id="repos">
            <div class="toolbar"> 
                <h1>Repos</h1> 
                <a class="back" href="#home">Back</a> 
            </div> 
            <div id="content" ><h2>Loading...</h2></div>
        </div>
        
        <div id="process">
            <div class="toolbar"> 
                <h1>Process</h1> 
                <a class="back" href="#repos">Back</a> 
                <a class="button" id="selClassic" href="#classic">Classic</a>                
            </div> 
            <div id="content" ><h2>Loading...</h2></div>
        </div>
        
        <div id="metrics">
            <div class="toolbar"> 
                <h1>Project Metadata</h1> 
                <a class="back" href="#repos">Back</a> 
                <a class="button goback" id="infoButton" href="#process">Process</a>                
            </div> 
            <div id="content" ><h2>Loading...</h2></div>
        </div>

</asp:Content>
