coolite实例1

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MyFolderTree.aspx.cs" Inherits="Com.DRPENG.INFOPLAT.UI.NetDisk.MyFolderTree" %>

<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Src="~/Include/ChoosePriUnsers_N.ascx" TagName="ChoosePriUnsers" TagPrefix="uc1" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>

    <script language="javascript" type="text/javascript">
        function DeleteNode(tree, _nodeId) {
            tree = Ext.getCmp("FolderTreeList");
            var _Node = tree.getNodeById(_nodeId);
            _Node.remove();
        }

        function AddNode(tree, _pNodeId, _nodeId, _nodeName) {
            var _pNode = tree.getNodeById(_pNodeId);
            var _newNode = new Ext.tree.TreeNode({ text: _nodeName, id: _nodeId });

            _pNode.leaf = false;
            _pNode.appendChild(_newNode);
        }

        function UpdateNode(tree, _nodeId, _nodeName) {
            var _oldNode = tree.getNodeById(_nodeId);
            _oldNode.setText(_nodeName);
        }

        var prepare = function(grid, toolbar, rowIndex, record) {
            var btnShare = toolbar.items.get(1);
            var btnUnShare = toolbar.items.get(2);
            if (record.data.FileType == "文件夹") {
                btnShare.setText("共享");
            
            }
            else {
                btnShare.setText("下载");
                btnUnShare.hide(true);
            }
        };
        function ChooseUser() {
            var ids = window.showModalDialog('../Include/SetManChoose.aspx', '', 'dialogHeight:600px;dialogWidth:600px; dialogTop:screen.height/4;dialogLeft:screen.width/4; edge:sunken ; center: Yes; help: No; resizable: No; status: No; scroll:yes;');
            var id = "";
            if (ids != undefined) {
                for (var i = 0; i < ids.length; i++) {

                    id += ids[i + 1].toString() + ",";
                    i = i + 1;
                }
                document.getElementById("hidUserIds").value = id;
            }
        }
        function check() {

            if (document.all.btnChoose.style.visibility == "hidden")
                document.all.btnChoose.style.visibility = "visible"
            else
                document.all.btnChoose.style.visibility = "hidden"
        }
       
    </script>

    <script runat="server">
        [AjaxMethod]
        public void SetValue(string value)
        {

            System.Collections.Generic.Dictionary<string, string>[] dataList = JSON.Deserialize<System.Collections.Generic.Dictionary<string, string>[]>(value);
            StringBuilder textSb = new StringBuilder();//text集合
            StringBuilder valueSb = new StringBuilder();//value集合

            foreach (System.Collections.Generic.Dictionary<string, string> di in dataList)
            {


                string[] array = new string[2];
                di.Values.CopyTo(array, 0);
                textSb.Append(array[0]);
                textSb.Append(",");

                valueSb.Append(array[1]);
                valueSb.Append(",");


            }

            //this.txt_Area.Text = textSb.ToString();
            this.txt_AreaHidden2.Text = textSb.ToString();
            string[] tempA = valueSb.ToString().Split('~');
            this.txt_AreaHidden1.Text = tempA[2].ToString();
        }
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <ext:ScriptManager ID="ScriptManager1" runat="server">
    </ext:ScriptManager>
    <uc1:ChoosePriUnsers ID="ChoosePriUnsers1" runat="server" CallbackName="Coolite.AjaxMethods.SetValue" />
    <ext:Store runat="server" ID="StorefileList" OnRefreshData="StorefileList_RefreshData">
        <Reader>
            <ext:JsonReader ReaderID="ID">
                <Fields>
                    <ext:RecordField Name="ID">
                    </ext:RecordField>
                    <ext:RecordField Name="Name">
                    </ext:RecordField>
                    <ext:RecordField Name="FileSize">
                    </ext:RecordField>
                    <ext:RecordField Name="VPath">
                    </ext:RecordField>
                    <ext:RecordField Name="CreateDate">
                    </ext:RecordField>
                    <ext:RecordField Name="shareState">
                    </ext:RecordField>
                    <ext:RecordField Name="FileType">
                    </ext:RecordField>
                    <ext:RecordField Name="RPath">
                    </ext:RecordField>
                </Fields>
            </ext:JsonReader>
        </Reader>
    </ext:Store>
    <ext:ViewPort ID="ViewPort1" runat="server">
        <Body>
            <ext:BorderLayout runat="server" ID="BorderLayout1">
                <West Split="True" Collapsible="True">
                    <ext:TreePanel runat="server" ID="FolderTreeList" RootVisible="true" Title="文件夹目录" Icon="ApplicationViewList"
                        Width="200px" AutoScroll="True" IDMode="Legacy">
                        <Listeners>
                            <Click Handler="Coolite.AjaxMethods.ClickFolderTree(node.id);" />
                        </Listeners>
                        <Root>
                            <ext:TreeNode Text="根目录">
                            </ext:TreeNode>
                        </Root>
                        <BottomBar>
                        <ext:StatusBar ID="statusBar1"></ext:StatusBar>
                        </BottomBar>
                    </ext:TreePanel>
                </West>
                <Center>
                    <ext:Panel runat="server" ID="CenterPanel" Icon="ApplicationViewList" Title="文件夹\文件"
                        IDMode="Legacy" AutoExpandColumn="Name">
                        <Body>
                            <ext:BorderLayout runat="server">
                            <Center>
                                <ext:GridPanel runat="server" ID="FlieAndFolderListInfo" StoreID="StorefileList"
                                    Icon="ApplicationViewList" SelectionMemory=Disabled>
                                    <columnmodel>
                                    <Columns>
                                        <ext:Column DataIndex="ID" ColumnID="ID" Header="" Hidden="true">
                                        </ext:Column>
                                        <ext:Column DataIndex="Name" ColumnID="Name" Header="文件名">
                                        </ext:Column>
                                        <ext:Column DataIndex="FileType" ColumnID="FileType" Header="类型">
                                        </ext:Column>
                                        <ext:Column DataIndex="FileSize" ColumnID="FileSize" Header="文件大小[K]">
                                        </ext:Column>
                                        <ext:Column DataIndex="CreateDate" ColumnID="CreateDate" Header="创建日期">
                                        </ext:Column>
                                        <ext:Column DataIndex="shareState" ColumnID="shareState" Header="共享状态">
                                        </ext:Column>
                                        <ext:CommandColumn Header="操作" Width="120">
                                            <Commands>
                                                <ext:GridCommand CommandName="ResetName" Text="重命名" Icon="ApplicationEdit">
                                                </ext:GridCommand>
                                                <ext:GridCommand CommandName="Share" Text="共享" Icon="Share">
                                                </ext:GridCommand>
                                                  <ext:GridCommand CommandName="UnShare" Text="取消共享" Icon="Share">
                                                </ext:GridCommand>
                                            </Commands>
                                            <PrepareToolbar Fn="prepare" />
                                        </ext:CommandColumn>
                                    </Columns>
                                </columnmodel>
                                    <selectionmodel>
                                    <ext:CheckboxSelectionModel>
                                    </ext:CheckboxSelectionModel>
                                </selectionmodel>
                                    <listeners>
                                    <Command Handler="Coolite.AjaxMethods.GridCommmand(command,record.data.ID,record.data.FileType);" />
                                </listeners>
                                    <bottombar>
                                    <ext:PagingToolbar runat="server" ID="PagingEBookList" StoreID="StorefileList" PageSize="20">
                                        <Items>
                                            <ext:ComboBox ID="CBfolders" runat="server" Editable="false" FieldLabel="移动到:" TypeAhead="true"
                                                ForceSelection="true" EmptyText="请选择目标文件夹" Resizable="true" SelectOnFocus="true">
                                                <AjaxEvents>
                                                <Select OnEvent="MoveFolderOrFile"></Select>
                                                </AjaxEvents>
                                            </ext:ComboBox>
                                        </Items>
                                    </ext:PagingToolbar>
                                </bottombar>
                                </ext:GridPanel>
                                </Center>
                            </ext:BorderLayout>
                        </Body>
                        <TopBar>
                            <ext:Toolbar ID="Toolbar2" runat="server" AllowDomMove="true">
                                <Items>
                                    <ext:Button ID="BtnBuidNewFolder" runat="server" Width="200px" Icon="Add" Text="新建文件夹"
                                        CausesValidation="false">
                                        <AjaxEvents>
                                            <Click OnEvent="InitBuidNewFolder">
                                            <EventMask ShowMask="true" />
                                            </Click>
                                        </AjaxEvents>
                                    </ext:Button>
                                    <ext:Button ID="BtnUpLoad" runat="server" Text="上传文件" Width="200px" Icon="FolderUp"
                                        CausesValidation="false">
                                        <AjaxEvents>
                                            <Click OnEvent="SendUpFile">
                                            </Click>
                                        </AjaxEvents>
                                    </ext:Button>
                                    <ext:Button ID="BtnDel" runat="server" Width="200px" Icon="Delete" Text="删除文件/文件夹">
                                        <AjaxEvents>
                                            <Click OnEvent="DeleteFolderOrFile">
                                            </Click>
                                        </AjaxEvents>
                                    </ext:Button>
                                    <ext:Hidden runat="server" ID="HidFolderID" Width="200px" Text="">
                                    </ext:Hidden>
                                    <ext:ToolbarFill ID="ToolbarFill1" runat="server" Width="200px">
                                    </ext:ToolbarFill>
                                </Items>
                            </ext:Toolbar>
                        </TopBar>
                    </ext:Panel>
                </Center>
            </ext:BorderLayout>
            <ext:Window ID="e_windows" runat="server" Closable="true" Resizable="false" Height="180"
                Icon="TableEdit" Title="新建文件夹" Width="350" Modal="true" BodyStyle="padding:12px;"
                Collapsible="true" ShowOnLoad="false">
                <Body>
                    <ext:BorderLayout ID="BorderLayout2" runat="server">
                        <Center>
                            <ext:FormPanel runat="server" ID="EditPanel" Frame="true">
                                <Body>
                                    <ext:Hidden ID="hiddenID" runat="server">
                                    </ext:Hidden>
                                    <ext:FormLayout ID="FormLayout1" runat="server">
                                        <ext:Anchor>
                                            <ext:TextField FieldLabel="文件夹名:" AllowBlank="false" BlankText="名称不能为空" runat="server"
                                                ID="txtFolderName" MaxLength="50">
                                            </ext:TextField>
                                          
                                        </ext:Anchor>
                                        <ext:Anchor>
                                            <ext:TextField FieldLabel="位置:" AllowBlank="true" BlankText="" runat="server" ReadOnly="true"
                                                ID="TxtPosition" MaxLength="50">
                                            </ext:TextField>
                                        </ext:Anchor>
                                        <ext:Anchor>
                                            <ext:TextField FieldLabel="备注:" AllowBlank="true" runat="server" ID="TextField1"
                                                MaxLength="50">
                                            </ext:TextField>
                                        </ext:Anchor>
                                    </ext:FormLayout>
                                </Body>
                            </ext:FormPanel>
                        </Center>
                    </ext:BorderLayout>
                </Body>
                <Buttons>
                    <ext:Button runat="server" ID="btnAdd" Text="添加" Icon="Add">
                        <AjaxEvents>
                            <Click OnEvent="BuildNewFolder" Before="if (!#{EditPanel}.getForm().isValid()) {return false;}">
                            </Click>
                        </AjaxEvents>
                    </ext:Button>
                    <ext:Button runat="server" ID="btnClose" Text="关闭" Icon="Cancel">
                        <Listeners>
                            <Click Handler="#{e_windows}.hide(null);"></Click>
                        </Listeners>
                    </ext:Button>
                </Buttons>
            </ext:Window>
            <ext:Window ID="fileUpWIndow" runat="server" Closable="true" Resizable="false" Height="200"
                Icon="TableEdit" Title="上传文件" Width="500" Modal="true" BodyStyle="padding:12px;"
                Collapsible="true" ShowOnLoad="false">
                <Body>
                    <ext:BorderLayout ID="BorderLayout3" runat="server">
                        <Center>
                            <ext:FormPanel runat="server" ID="FormPanel1" Frame="true">
                                <Body>
                                    <ext:Hidden ID="hidden1" runat="server">
                                    </ext:Hidden>
                                    <ext:FormLayout ID="FormLayout2" runat="server">
                                        <ext:Anchor>
                                            <ext:MultiField runat="server" ID="MultiResource" FieldLabel="上传资源" LabelStyle="text-align:right"
                                                Note="上传说明:<br />允许格式为:gif, jpg, png, bmp, ppt, doc, xls, rar, psd, pdf, zip, txt, mp3, rm, rmvb, avi, swf,asf,mpg,wma,dat">
                                                <Fields>
                                                    <ext:FileUploadField runat="server" ID="fileResource" Width="300" ButtonText="浏览..."
                                                        Regex="^.+\.((asf)|(mpg)|(wma)|(ASF)|(MPG)|(WMA)|(jpg)|(JPG)|(gif)|(GIF)|(swf)|(SWF)|(jpeg)|(pdf)|(PDF)|(JPEG)|(png)|(PNG)|(bmp)|(BMP)|(ppt)|(PPT)|(doc)|(DOC)|(xls)|(XLS)|(rar)|(RAR)|(psd)|(PSD)|(zip)|(ZIP)|(txt)|(TXT)|(mp3)|(MP3)|(rm)|(RM)|(rmvb)|(RMVB)|(avi)|(AVI)|(dat)|(DAT))$"
                                                        RegexText="文件格式不正确" AllowBlank="false" BlankText="请选择上传资源" MsgTarget="Side">
                                                    </ext:FileUploadField>
                                                    <ext:Button runat="server" ID="btnClearResource" Text="清空">
                                                        <Listeners>
                                                            <Click Handler="fileResource.setValue('');" />
                                                        </Listeners>
                                                    </ext:Button>
                                                    <%--<ext:Button runat="server" ID="btnAddRow" Text="添加">
                                                                    <Listeners>
                                                                        <Click Handler="AddUpLoadRow();"/>
                                                                    </Listeners>
                                                                </ext:Button>--%>
                                                </Fields>
                                            </ext:MultiField>
                                        </ext:Anchor>
                                        <ext:Anchor>
                                            <ext:TextField FieldLabel="上传文件到此:" AllowBlank="false" BlankText="名称不能为空" runat="server"
                                                ID="TxtSendto" MaxLength="50">
                                            </ext:TextField>
                                        </ext:Anchor>
                                        <ext:Anchor>
                                            <ext:TextField FieldLabel="备注:" AllowBlank="true" runat="server" ID="TextField4"
                                                MaxLength="50">
                                            </ext:TextField>
                                        </ext:Anchor>
                                    </ext:FormLayout>
                                </Body>
                            </ext:FormPanel>
                        </Center>
                    </ext:BorderLayout>
                </Body>
                <Buttons>
                    <ext:Button runat="server" ID="Button1" Text="添加" Icon="Add">
                        <AjaxEvents>
                            <Click OnEvent="SendUp" Before="if (!#{FormPanel1}.getForm().isValid()) {return false;}">
                            </Click>
                        </AjaxEvents>
                    </ext:Button>
                    <ext:Button runat="server" ID="Button2" Text="关闭" Icon="Cancel">
                        <Listeners>
                            <Click Handler="#{fileUpWIndow}.hide(null);"></Click>
                        </Listeners>
                    </ext:Button>
                </Buttons>
            </ext:Window>
            <ext:Window ID="ResetNameWindow" runat="server" Closable="true" Resizable="false"
                Height="150" Icon="TableEdit" Title="重命名文件/文件夹" Width="350" Modal="true" BodyStyle="padding:12px;"
                Collapsible="true" ShowOnLoad="false">
                <Body>
                    <ext:BorderLayout ID="BorderLayout4" runat="server">
                        <Center>
                            <ext:FormPanel runat="server" ID="FormPanel2" Frame="true">
                                <Body>
                                    <ext:FormLayout ID="FormLayout3" runat="server">
                                        <ext:Anchor>
                                            <ext:TextField FieldLabel="原文件夹名称:" AllowBlank="true" BlankText="" runat="server"
                                                ReadOnly="true" ID="txt_FolderName" MaxLength="50">
                                            </ext:TextField>
                                        </ext:Anchor>
                                        <ext:Anchor>
                                            <ext:TextField FieldLabel="修改后的名称:" AllowBlank="false" BlankText="名称不能为空" runat="server"
                                                ID="txt_NewFolderName" MaxLength="50">
                                            </ext:TextField>
                                        </ext:Anchor>
                                        <ext:Anchor>
                                            <ext:Hidden ID="hidReNameFolderID" runat="server" AllowBlank="true">
                                            </ext:Hidden>
                                        </ext:Anchor>
                                    </ext:FormLayout>
                                </Body>
                            </ext:FormPanel>
                        </Center>
                    </ext:BorderLayout>
                </Body>
                <Buttons>
                    <ext:Button runat="server" ID="btnSave" Text="保存" Icon="Add">
                        <AjaxEvents>
                            <Click OnEvent="ResetFolderName" Before="if (!#{FormPanel2}.getForm().isValid()) {return false;}">
                            </Click>
                        </AjaxEvents>
                    </ext:Button>
                    <ext:Button runat="server" ID="Button4" Text="取消" Icon="Cancel">
                        <Listeners>
                            <Click Handler="#{ResetNameWindow}.hide(null);"></Click>
                        </Listeners>
                    </ext:Button>
                </Buttons>
            </ext:Window>
            <ext:Window ID="ShareFolderWindow" runat="server" Closable="true" Resizable="false"
                Icon="TableEdit" Title="共享文件夹" Width="400" Height="110" Modal="true" Collapsible="true"
                ShowOnLoad="false">
                <Body>
                    <ext:BorderLayout ID="BorderLayout5" runat="server">
                        <Center>
                            <ext:FormPanel runat="server" ID="ShareFolderPanel" Frame="true">
                                <Body>
                                    <ext:FormLayout ID="FormLayout4" runat="server">
                                        <ext:Anchor>
                                            <ext:MultiField runat="server" FieldLabel="共享方式" LabelStyle="text-align:right">
                                                <Fields>
                                                    <ext:RadioGroup runat="server" ID="radGBedRoomType" Width="160" AllowBlank="false">
                                                        <Items>
                                                            <ext:Radio ID="Radio1" runat="server" BoxLabel="完全共享" InvalidText="1" AutoWidth="true">
                                                            </ext:Radio>
                                                            <ext:Radio ID="Radio2" runat="server" BoxLabel="部分共享" InvalidText="0" AutoWidth="true"
                                                                Checked="true">
                                                                <Listeners>
                                                                    <Check Handler="check();" />
                                                                </Listeners>
                                                            </ext:Radio>
                                                        </Items>
                                                    </ext:RadioGroup>
                                                    <ext:Button ID="btnChoose" runat="server" Text="选择人员">
                                                        <Listeners>
                                                            <Click Handler="#{WinChooseUsers}.show();" />
                                                        </Listeners>
                                                    </ext:Button>
                                                    <ext:Hidden ID="txt_AreaHidden1" runat="server">
                                                    </ext:Hidden>
                                                    <ext:Hidden ID="txt_AreaHidden2" runat="server">
                                                    </ext:Hidden>
                                                    <ext:Hidden ID="hidWileShareFolderId" runat="server" AllowBlank="true">
                                                    </ext:Hidden>
                                                </Fields>
                                            </ext:MultiField>
                                        </ext:Anchor>
                                    </ext:FormLayout>
                                </Body>
                            </ext:FormPanel>
                        </Center>
                    </ext:BorderLayout>
                </Body>
                <Buttons>
                    <ext:Button runat="server" ID="Button5" Text="保存" Icon="Add">
                        <AjaxEvents>
                            <Click OnEvent="ShareFolder" Before="if (!#{ShareFolderPanel}.getForm().isValid()) {return false;}">
                            </Click>
                        </AjaxEvents>
                    </ext:Button>
                    <ext:Button runat="server" ID="Button6" Text="取消" Icon="Cancel">
                        <Listeners>
                            <Click Handler="#{ShareFolderWindow}.hide(null);"></Click>
                        </Listeners>
                    </ext:Button>
                </Buttons>
            </ext:Window>
        </Body>
    </ext:ViewPort>
    </form>
</body>
</html>

posted on 2010-01-08 09:25  不悔的青春  阅读(2632)  评论(0编辑  收藏  举报

导航