<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MyWorkFlowList.aspx.cs"
    Inherits="WorkFlow.FlowPage.MyWorkFlowPage.MyWorkFlowList" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>我的流程</title>
    <link href="../css/main.css" rel="stylesheet" type="text/css" />
    <link href="../css/ext-all.css" rel="stylesheet" type="text/css" />

    <script type="text/javascript">
       var renderTopic = function (value,p,record) {
           if(value=="等待发起")
            {
              return  String.format(  '<b style="color:red">{0}</b>', value);
            }    
           if(value=="进行中")
            {
              return  String.format(  '<b style="color:green">{0}</b>', value);
            }     
           if(value=="结束")
            {
              return  String.format(  '<b style="color:#1e4e90">{0}</b>', value);
            }             
        }; 
       var prepareCommand = function (grid, command, record, row) {
            // you can prepare group command           
             if (command.command == 'EditWorkFlow' && record.data.State =="进行中" || record.data.State =="结束" )
            {
                command.hidden = true;
                command.hideMode = 'visibility'; //you can try 'display' also                 
            } if (command.command == 'EditWorkFlow' && record.data.State =="等待发起" )
            {
                command.hidden = false;
                command.hideMode = 'visibility'; //you can try 'display' also                 
            }
             if (command.command == 'LookWorkFlow' && record.data.State =="进行中" || record.data.State =="结束" )
            {
                command.hidden = false;
                command.hideMode = 'visibility'; //you can try 'display' also                 
            }
            if(command.command == 'LookWorkFlow' &&  record.data.State =="等待发起" )
            {
              command.hidden = true;
                command.hideMode = 'visibility'; //you can try 'display' also    
            }
                  if(command.command == 'EditWorkFlow' &&  record.data.State =="结束" )
            {
              command.hidden = true;
                command.hideMode = 'visibility'; //you can try 'display' also    
            }
        };

    </script>
  <style type="text/css">
        .hg
        {
            height: 20px;
            padding-top: 3px;
        }
        .workflow-node
        {
            background-image: url(../images/workflow.gif) !important;
        }
        .workflow-folder
        {
            background-image: url(../images/folder.gif) !important;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <ext:ResourceManager ID="ResourceManager1" runat="server" DirectMethodNamespace="DirectMethod">
    </ext:ResourceManager>
    <ext:Viewport ID="Viewport1" runat="server" Layout="border">
        <Items>
            <ext:Panel ID="Panel6" runat="server" Collapsible="true" Layout="FitLayout" Region="West"
                Split="true" Title="个人流程管理" Width="175">
                <Items>
                    <ext:TreePanel ID="TreePanel1" runat="server" Title="">
                        <Root>
                            <ext:TreeNode Text="我创建的流程" Expanded="true"  IconCls="workflow-folder" >
                                <Nodes>
                                    <ext:TreeNode Text="进行中流程" NodeID="进行中" IconCls="workflow-node" Cls="hg">
                                    </ext:TreeNode>
                                </Nodes>
                                <Nodes>
                                    <ext:TreeNode Text="已完成流程" NodeID="结束" IconCls="workflow-node" Cls="hg">
                                    </ext:TreeNode>
                                </Nodes>
                                <Nodes>
                                    <ext:TreeNode Text="流程草稿箱" NodeID="等待发起" IconCls="workflow-node" Cls="hg">
                                    </ext:TreeNode>
                                </Nodes>
                            </ext:TreeNode>
                        </Root>
                        <Listeners>
                            <Click Handler="e.stopEvent();DirectMethod.NodeClick(node.id);" />
                        </Listeners>
                    </ext:TreePanel>
                </Items>
            </ext:Panel>
            <ext:Panel ID="Panel9" runat="server" Layout="Fit" Region="Center" Title="流程列表">
                <TopBar>
                    <ext:Toolbar runat="server">
                        <Items>
                            <ext:Button ID="Button2" runat="server" Text="发起" Icon="ControlPlayBlue" ToolTip="发起流程">
                                <DirectEvents>
                                    <Click OnEvent="FQ_Click">
                                        <Confirmation ConfirmRequest="true" Message="您确定发起吗?" Title="提示" />
                                        <EventMask ShowMask="true" Msg="<span style='font-size: 12px;'>正在发起中，请稍后...</span>"
                                            MinDelay="10" />
                                    </Click>
                                </DirectEvents>
                            </ext:Button>
                            <ext:ToolbarSeparator />
                            <ext:Button ID="Button1" runat="server" Text="删除" Icon="Delete" ToolTip="删除流程">
                                <DirectEvents>
                                    <Click OnEvent="Delete_Click">
                                        <Confirmation ConfirmRequest="true" Message="删除后不可恢复,确定删除所选的数据吗?" Title="提示" />
                                        <EventMask ShowMask="true" Msg="<span style='font-size: 12px;'>正在删除中，请稍后...</span>"
                                            MinDelay="10" />
                                    </Click>
                                </DirectEvents>
                            </ext:Button>
                            <ext:ToolbarSeparator />
                            <ext:Button ID="Button8" runat="server" Text="刷新" Icon="Reload" ToolTip="刷新">
                                <DirectEvents>
                                    <Click OnEvent="ReLoad_Click">
                                        <EventMask ShowMask="true" Msg="<span style='font-size: 12px;'>正在刷新中，请稍后...</span>"
                                            MinDelay="10" />
                                    </Click>
                                </DirectEvents>
                            </ext:Button>
                        </Items>
                    </ext:Toolbar>
                </TopBar>
                <Items>
                    <ext:GridPanel ID="GridPanel2" runat="server" Frame="true" StripeRows="true" ClicksToEdit="1"
                        AnimCollapse="false" Icon="Table" TrackMouseOver="true">
                        <Store>
                            <ext:Store ID="Store2" runat="server" OnRefreshData="Store2_RefreshData">
                                <Reader>
                                    <ext:JsonReader IDProperty="User_WorkFlow_Order_ID">
                                        <Fields>
                                            <ext:RecordField Name="Id" />
                                            <ext:RecordField Name="User_WorkFlow_Order_ID" />
                                            <ext:RecordField Name="User_WorkFlow_Order_ID1" />
                                            <ext:RecordField Name="WorkFlowViewXMLName" />
                                            <ext:RecordField Name="UserName" />
                                            <ext:RecordField Name="CreateDate" />
                                            <ext:RecordField Name="State" />
                                            <ext:RecordField Name="TitleInfo">
                                            </ext:RecordField>
                                        </Fields>
                                    </ext:JsonReader>
                                </Reader>
                            </ext:Store>
                        </Store>
                        <ColumnModel ID="ColumnModel1" runat="server">
                            <Columns>
                                <ext:Column Header="标题" DataIndex="TitleInfo" Width="183" />
                                <ext:Column Header="编号" DataIndex="User_WorkFlow_Order_ID1" Width="83" />
                                <ext:Column Header="流程名称" DataIndex="WorkFlowViewXMLName" Width="183" />
                                <ext:Column Header="创建人" DataIndex="UserName" Width="83" />
                                <ext:Column Header="创建时间" DataIndex="CreateDate" Width="153" />
                                <ext:Column Header="状态" DataIndex="State" Width="83">
                                    <Renderer Fn="renderTopic" />
                                </ext:Column>
                                <ext:ImageCommandColumn Width="120" Header="操作" GroupName="Id">
                                    <Commands>
                                        <ext:ImageCommand CommandName="EditWorkFlow" Icon="NoteEdit" Text="修改" ToolTip-Text="<span style='font-size: 12px;'>修改流程信息</span>">
                                        </ext:ImageCommand>
                                        <ext:ImageCommand CommandName="LookWorkFlow" Icon="PagePaste" Text="查看" ToolTip-Text="<span style='font-size: 12px;'>查看审批流程信息</span>">
                                        </ext:ImageCommand>
                                    </Commands>
                                    <PrepareCommand Fn="prepareCommand" />
                                </ext:ImageCommandColumn>
                            </Columns>
                        </ColumnModel>
                             <LoadMask ShowMask="true" />
                        <DirectEvents>
                            <Command OnEvent="UpdateLC">
                                <EventMask ShowMask="true" Msg="<span style='font-size: 12px;'>正在操作中，请稍后...</span>"
                                    MinDelay="10" />
                                <ExtraParams>
                                    <ext:Parameter Name="command" Value="command" Mode="Raw" />
                                    <ext:Parameter Name="Id" Value="record.data.Id" Mode="Raw" />
                                    <ext:Parameter Name="User_WorkFlow_Order_ID1" Value="record.data.User_WorkFlow_Order_ID1"
                                        Mode="Raw" />
                                </ExtraParams>
                            </Command>
                        </DirectEvents>
                        <SelectionModel>
                            <ext:CheckboxSelectionModel ID="CheckboxSelectionModel1" runat="server" />
                        </SelectionModel>
                        <BottomBar>
                            <ext:PagingToolbar ID="PagingToolbar1" runat="server" PageSize="14" DisplayInfo="true"
                                BeforePageText="<span style='font-size:12px'>第</span>" AfterPageText="<span style='font-size:12px'>页</span>"
                                DisplayMsg="<span style='font-size:12px'>显示 {0} - {1}， 共 {2} 条</span>" EmptyMsg="<span style='font-size:12px'>无数据可以显示</span>"
                                Cls="fontsize" />
                        </BottomBar>
                    </ext:GridPanel>
                </Items>
            </ext:Panel>
        </Items>
    </ext:Viewport>
    <ext:Window ID="Window1" runat="server" Closable="True" Resizable="false" Height="560"
        Icon="Anchor" Title="<span style='font-size:14px'>修改流程</span>" Draggable="true"
        Maximized="true" Width="1000" Modal="true" Padding="0" Hidden="true" AutoScroll="true">
        <AutoLoad Mode="IFrame" NoCache="true" ShowMask="true">
        </AutoLoad>
    </ext:Window>
    <ext:Window ID="Window2" runat="server" Closable="True" Resizable="false" Height="560"
        Icon="Anchor" Title="<span style='font-size:14px'>审批信息</span>" Draggable="true"
        Maximized="true" Width="1000" Modal="true" Padding="0" Hidden="true" AutoScroll="true">
        <AutoLoad Mode="IFrame" NoCache="true" ShowMask="true">
        </AutoLoad>
    </ext:Window>
    <ext:Hidden ID="Hidden1" runat="server">
    </ext:Hidden>
    <ext:Hidden ID="hifLJXValues" runat="server">
    </ext:Hidden>
    <ext:Window ID="Window3" runat="server" Closable="True" Resizable="false" Height="60"
        Icon="Anchor" Title="<span style='font-size:14px'>分支条件选择</span>" Draggable="true"
        Width="150" Modal="true" Padding="0" Hidden="true" AutoScroll="false">
        <Content>
            <table width="100%">
                <tr>
                    <td>
                    </td>
                </tr>
                <tr>
                    <td>
                    </td>
                </tr>
                <tr>
                    <td align="center">
                        <ext:ComboBox ID="cbXY" runat="server" ItemSelector="div.list-item" DisplayField="LJXValues"
                            ValueField="LJXValues" Editable="false">
                            <Store>
                                <ext:Store ID="Store1" runat="server" SerializationMode="Complex">
                                    <Reader>
                                        <ext:JsonReader IDProperty="LJXValues">
                                            <Fields>
                                                <ext:RecordField Name="LJXValues" />
                                                <ext:RecordField Name="LJXValues" />
                                            </Fields>
                                        </ext:JsonReader>
                                    </Reader>
                                </ext:Store>
                            </Store>
                            <Template ID="Template3" runat="server">
                                <Html>
                                <tpl for=".">
                                           <div class="list-item">
					                          <h3>{LJXValues}</h3>
					                       </div>				
		                                 </tpl>
                                </Html>
                            </Template>
                        </ext:ComboBox>
                    </td>
                </tr>
                <tr>
                    <td>
                    </td>
                </tr>
                <tr>
                    <td align="center">
                        <ext:Button ID="Button3" runat="server" Text="确定">
                            <DirectEvents>
                                <Click OnEvent="Yes_Click">
                                </Click>
                            </DirectEvents>
                        </ext:Button>
                    </td>
                </tr>
            </table>
        </Content>
    </ext:Window>
    </form>
</body>
</html>
