v9.6.2017.0808   重构正向工程,基于映射表查找数据库字段类型到实体类型的映射
大石头 authored at 2017-08-08 21:38:06
5.14 KiB
X
@using System.Diagnostics;
@using NewLife.Common;
@using NewLife.Cube.Admin;
@{
    //ViewBag.Title = "服务器信息";
    var fs = Model as List<FileItem>;
    var r = ViewBag.Current as String;
    var clips = ViewBag.Clip as ICollection<FileItem>;
}
<div class="form-inline">
    <form action="~/Admin/File" id="tool" method="post">
        <div class="input-group">
            <span class="input-group-addon">
                <i class="ace-icon fa fa-check"></i>
            </span>
            <input name="r" type="search" id="r" value="@r" class="form-control" placeholder="当前路径" />
            <span class="input-group-btn">
                <button type="submit" class="btn btn-primary btn-sm">
                    <span class="glyphicon glyphicon-folder-open icon-on-right bigger-110"></span>
                    打开
                </button>
            </span>
        </div>
        <div class="input-group">
            <span class="input-group-addon">
                <i class="glyphicon glyphicon-file"></i>
            </span>
            <input name="file" type="file" id="file" placeholder="上传文件" />
            <span class="input-group-btn">
                <button type="submit" class="btn btn-success btn-sm" onclick="$('#tool').attr('action', '/Admin/File/Upload');$('#tool').attr('enctype', 'multipart/form-data'); return true;">
                    <span class="glyphicon glyphicon-plus icon-on-right bigger-110"></span>
                    上传
                </button>
            </span>
        </div>
        @if (clips.Count > 0)
        {
            <div class="input-group">
                <span class="input-group-addon">
                    <i class="glyphicon glyphicon-floppy-disk" title="剪切板共有 @clips.Count 项">@clips.Count</i>
                </span>
                <span class="input-group-btn">
                    <button type="button" class="btn btn-pink btn-sm" onclick="location.href = '/Admin/File/Paste?r=@r';">
                        <span class="glyphicon glyphicon-floppy-save icon-on-right bigger-110"></span>
                        粘贴
                    </button>
                </span>
                <span class="input-group-btn">
                    <button type="button" class="btn btn-gray btn-sm" onclick="location.href = '/Admin/File/Move?r=@r';">
                        <span class="glyphicon glyphicon-floppy-save icon-on-right bigger-110"></span>
                        移动
                    </button>
                </span>
                <span class="input-group-btn">
                    <button type="button" class="btn btn-yellow btn-sm" onclick="location.href = '/Admin/File/ClearClipboard?r=@r';">
                        <span class="glyphicon glyphicon-retweet icon-on-right bigger-110"></span>
                        清空
                    </button>
                </span>
            </div>
        }
    </form>
</div>
<table class="table table-bordered table-hover table-striped table-condensed">
    <thead>
        <tr>
            <th class="text-center"><a href="~/Admin/File?r=@r&sort=name">名称</a></th>
            <th class="text-center"><a href="~/Admin/File?r=@r&sort=size">大小</a></th>
            <th class="text-center"><a href="~/Admin/File?r=@r&sort=lastwrite">修改时间</a></th>
            <th class="text-center">复制</th>
            <th class="text-center">压缩</th>
            <th class="text-center">删除</th>
        </tr>
    </thead>
    <tbody>
        @foreach (var item in fs)
        {
            <tr>
                @if (item.Directory)
                {
                    <td>&nbsp;&nbsp;<a href="~/Admin/File?r=@item.FullName" title="进入目录">@item.Name</a></td>
                }
                else
                {
                    <td>&nbsp;&nbsp;<a href="~/Admin/File/Download?r=@item.FullName" title="下载文件">@item.Name</a></td>
                }
                <td class="text-right">@item.Size</td>
                <td class="text-center">@item.LastWrite.ToFullString("")</td>
                <td class="text-center">
                    @if (!clips.Any(e => e.FullName == item.FullName))
                    {
                        <a href="~/Admin/File/Copy?r=@r&f=@item.FullName" title="复制到剪切板,然后去目标目录粘贴">复制</a>
                    }
                    else
                    {
                        <a href="~/Admin/File/CancelCopy?r=@r&f=@item.FullName" title="从剪切板移除">取消复制</a>
                    }
                </td>
                @if (item.Name.EndsWithIgnoreCase(".zip"))
                {
                    <td class="text-center"><a href="~/Admin/File/Decompress?r=@item.FullName" title="解压缩到当前目录">解压缩</a></td>
                }
                else
                {
                    <td class="text-center"><a href="~/Admin/File/Compress?r=@item.FullName" title="压缩到当前目录,加上时间后缀">压缩</a></td>
                }
                <td class="text-center"><a href="~/Admin/File/Delete?r=@item.FullName" onclick="return confirm('确认删除?');">删除</a></td>
            </tr>
        }
    </tbody>
</table>