<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:76:"D:\phpStudy\PHPTutorial\WWW\ceshi/application/index\view\admin\download.html";i:1562826328;s:74:"D:\phpStudy\PHPTutorial\WWW\ceshi\application\index\view\header_admin.html";i:1562826328;}*/ ?>
<!DOCTYPE html>
<html lang="zh_cn">

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <meta name="description" content="">
  <meta name="author" content="">
  <title>离线下载 - <?php echo $options['siteName']; ?></title>
  <!-- Bootstrap core CSS-->
  <link href="/static/css/bootstrap4/bootstrap.min.css" rel="stylesheet">
  <!-- Custom fonts for this template-->
  <link href="/static/css/font-awesome.min.css" rel="stylesheet" type="text/css">
  <!-- Page level plugin CSS-->
  <link href="/static/css/datatables/dataTables.bootstrap4.css" rel="stylesheet">
  <link href="/static/css/toastr.min.css" rel="stylesheet">

  <!-- Custom styles for this template-->
  <link href="/static/css/sb-admin.css" rel="stylesheet">
</head>

<body class="<?php echo $options['admin_color_body']; ?>" id="page-top">
  <!-- Navigation-->
  <nav class="<?php echo $options['admin_color_nav']; ?>" id="mainNav">
    <a class="navbar-brand" href="index.html">Cloudreve</a>
    <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>
    <div class="collapse navbar-collapse" id="navbarResponsive">
      <ul class="navbar-nav navbar-sidenav" id="exampleAccordion">
        <li class="nav-item" data-toggle="tooltip" data-placement="right" title="面板首页">
          <a class="nav-link" href="/Admin">
            <i class="fa fa-fw fa-dashboard"></i>
            <span class="nav-link-text">面板首页</span>
          </a>
        </li>
         <li class="nav-item" data-toggle="tooltip" data-placement="right" title="设置">
          <a class="nav-link nav-link-collapse collapsed" data-toggle="collapse" href="#collapseComponents" data-parent="#exampleAccordion">
            <i class="fa fa-fw fa-wrench"></i>
            <span class="nav-link-text">设置</span>
          </a>
          <ul class="sidenav-second-level collapse" id="collapseComponents">
            <li>
              <a href="/Admin/Setting">基础设置</a>
            </li>
            <li>
              <a href="/Admin/SettingReg">注册访问</a>
            </li>
            <li>
              <a href="/Admin/SettingMail">邮件发送</a>
            </li>
            <li>
              <a href="/Admin/Config">配置文件</a>
            </li>
            <li>
              <a href="/Admin/SettingOther">杂项</a>
            </li>
          </ul>
        </li>
        <li class="nav-item" data-toggle="tooltip"  data-placement="right" title="模板">
          <a class="nav-link nav-link-collapse collapsed" data-toggle="collapse" href="#theme">
            <i class="fa fa-fw fa-paint-brush"></i>
            <span class="nav-link-text">模板</span>
          </a>
          <ul class="sidenav-second-level collapse" id="theme">
            <li>
              <a  href="/Admin/Theme">模板</a>
            </li>
            <li>
              <a href="/Admin/Color">配色方案</a>
            </li>
          </ul>
        </li>
        <li class="nav-item" data-toggle="tooltip" data-placement="right" title="文件">
          <a class="nav-link" href="/Admin/Files">
            <i class="fa fa-fw fa-folder"></i>
            <span class="nav-link-text">文件</span>
          </a>
        </li>
        <li class="nav-item" data-toggle="tooltip" data-placement="right" title="分享">
          <a class="nav-link" href="/Admin/Shares">
            <i class="fa fa-fw fa-send"></i>
            <span class="nav-link-text">分享</span>
          </a>
        </li>
        <li class="nav-item" data-toggle="tooltip" data-placement="right" title="离线下载">
          <a class="nav-link" href="/Admin/RemoteDownload">
            <i class="fa fa-fw fa-cloud-download"></i>
            <span class="nav-link-text">离线下载</span>
          </a>
        </li>
        <li class="nav-item" data-toggle="tooltip" data-placement="right" title="用户">
          <a class="nav-link" href="/Admin/Users" data-parent="#user">
            <i class="fa fa-fw fa-user"></i>
            <span class="nav-link-text">用户</span>
          </a>
        </li>
        <li class="nav-item" data-toggle="tooltip" data-placement="right" title="用户组">
          <a class="nav-link nav-link-collapse collapsed" data-toggle="collapse" href="#group" data-parent="#group">
            <i class="fa fa-fw fa-users"></i>
            <span class="nav-link-text">用户组</span>
          </a>
          <ul class="sidenav-second-level collapse" id="group">
            <li>
              <a href="/Admin/GroupList">管理</a>
            </li>
            <li>
              <a href="/Admin/GroupAdd">添加</a>
            </li>
          </ul>
        </li>
        <li class="nav-item" data-toggle="tooltip" data-placement="right" title="上传策略">
          <a class="nav-link nav-link-collapse collapsed" data-toggle="collapse" href="#policy" data-parent="#policy">
            <i class="fa fa-fw fa-upload"></i>
            <span class="nav-link-text">上传策略</span>
          </a>
          <ul class="sidenav-second-level collapse" id="policy">
            <li>
              <a href="/Admin/PolicyList">管理</a>
            </li>
            <li>
              <a href="/Admin/PolicyAdd">添加</a>
            </li>
          </ul>
        </li>
        <li class="nav-item" data-toggle="tooltip" data-placement="right" title="其他">
          <a class="nav-link nav-link-collapse collapsed" data-toggle="collapse" href="#else" data-parent="#else">
            <i class="fa fa-fw fa-ellipsis-h"></i>
            <span class="nav-link-text">其他</span>
          </a>
          <ul class="sidenav-second-level collapse" id="else">
              <li>
                  <a href="/Admin/Queue">任务队列</a>
                </li>
            <li>
              <a href="/Admin/Cron">定时任务</a>
            </li>
            <li>
              <a href="/Admin/About">关于</a>
            </li>
          </ul>
        </li>
      </ul>
      <ul class="navbar-nav sidenav-toggler">
        <li class="nav-item">
          <a class="nav-link text-center" id="sidenavToggler">
            <i class="fa fa-fw fa-angle-left"></i>
          </a>
        </li>
      </ul>
      <ul class="navbar-nav ml-auto">
       <li class="nav-item">
          <a class="nav-link" href="javascript:void" id="toggleNavColor">
          <i class="fa fa-fw fa-toggle-on" aria-hidden="true"></i>切换配色</a>
        </li>
    
        <li class="nav-item">
          <a class="nav-link" href="/">
            <i class="fa fa-fw fa-home"></i>返回首页</a>
        </li>
    
        <li class="nav-item">
          <a class="nav-link" data-toggle="modal" data-target="#exampleModal">
            <i class="fa fa-fw fa-sign-out"></i>登出</a>
        </li>
      </ul>
    </div>
  </nav>
  
<div class="content-wrapper">
  <div class="container-fluid">
    <!-- Breadcrumbs-->
    <ol class="breadcrumb">
      <li class="breadcrumb-item">
        <a href="/Admin">管理面板</a>
      </li>
      <li class="breadcrumb-item active">离线下载</li>
      <li class="breadcrumb-item active">配置</li>
    </ol>
    
    <!-- Area Chart Example-->
    <div class="row">
      <div class="col-12">
        <h2>离线下载</h2>
        <br>
        <div class="card">
          <div class="card-header">
            <ul class="nav nav-tabs card-header-tabs">
              <li class="nav-item">
                <a class="nav-link active" data-toggle="tab" href="#options"><i class="fa fa-cog" aria-hidden="true"></i> Aria2配置</a>
              </li>
              <li class="nav-item">
                <a class="nav-link" data-toggle="tab" href="#list"><i class="fa fa-list" aria-hidden="true"></i> 任务列表</a>
              </li>
            </ul>
          </div>
          <div class="card-body">
            <div class="tab-content" >
              <div class="tab-pane fade show active" id="options" role="tabpanel" aria-labelledby="pills-home-tab">
                <form id="aria2Options">
                  <div class="row form-setting">
                    <div class="col-md-1 form-label ">
                      <label for="fromName" class="col-form-label col-form-label-sm">RPC Server</label>
                    </div>
                    <div class="col-md-4"> <input type="text" class="form-control" name="aria2_rpcurl" value="<?php echo $optionsForSet['aria2_rpcurl']; ?>" spellcheck="false"></div>
                    <div class="col-md-4 option-des"> aria2的RPC服务器地址，请在aria2的配置文件中启用RPC服务。例如：http://127.0.0.1:6800/</div>
                  </div>
                  <div class="row form-setting">
                    <div class="col-md-1 form-label ">
                      <label for="fromName" class="col-form-label col-form-label-sm">RPC Token</label>
                    </div>
                    <div class="col-md-4"> <input type="text" class="form-control" name="aria2_token" value="<?php echo $optionsForSet['aria2_token']; ?>" spellcheck="false"></div>
                    <div class="col-md-4 option-des"> 在配置文件中设置的RPC服务的Token</div>
                  </div>
                  <div class="row form-setting">
                    <div class="col-md-1 form-label ">
                      <label for="fromName" class="col-form-label col-form-label-sm">下载临时目录</label>
                    </div>
                    <div class="col-md-4"> <input type="text" class="form-control" name="aria2_tmppath" value="<?php echo $optionsForSet['aria2_tmppath']; ?>" spellcheck="false"></div>
                    <div class="col-md-4 option-des"> 下载文件数据的临时存放目录，请确保PHP对该目录拥有读写权限</div>
                  </div>
                  <div class="row form-setting">
                    <div class="col-md-1 form-label ">
                      <label for="aria2_options" class="col-form-label col-form-label-sm">其他下载参数</label>
                    </div>
                    <div class="col-md-4"> <textarea class="form-control" name="aria2_options" spellcheck="false"><?php echo $optionsForSet['aria2_options']; ?></textarea></div>
                    <div class="col-md-4 option-des"> aria2启动下载的其他附带参数，请以json格式书写。你可也可以将这些设置写在aria2配置文件里。可用参数请查阅<a href="https://aria2.github.io/manual/en/html/aria2c.html#options" target="_blank">官方文档</a></div>
                  </div>
                  <div class="row form-setting">
                    <div class="col-md-1 form-label ">
                    </div>
                    <div class="col-md-4"> <button type="button" class="btn btn-primary" id="saveAria2">保存设置</button></div>
                    <div class="col-md-4 option-des"> </div>
                    <br><br><br>
                  </div>
                </form>
              </div>
              
              <div class="tab-pane fade" id="list" role="tabpanel" aria-labelledby="pills-profile-tab">
                <table class="table">
                  <thead>
                    <tr>
                      <th scope="col" class="textCenter">#</th>
                      <th scope="col" width="50%">文件名</th>
                      <th scope="col" class="textCenter">创建者</th>
                      <th scope="col" class="textCenter">文件大小</th>
                      <th scope="col" class="textCenter">状态</th>
                      <th scope="col" class="textCenter">进度</th>
                      <th scope="col" class="textCenter">操作</th>
                    </tr>
                  </thead>
                  <tbody id="listContent">
                  <?php if(is_array($list) || $list instanceof \think\Collection || $list instanceof \think\Paginator): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$download): $mod = ($i % 2 );++$i;?>
                    <tr id="i-<?php echo $download['id']; ?>" data-pid="<?php echo $download['pid']; ?>">
                      <th scope="row" class="textCenter"><?php echo $download['id']; ?></th>
                      <td><?php echo is_array($originList[$key]['fileName'])?"未知":$originList[$key]['fileName']; ?></td>
                      <td class="textCenter"><?php echo $originList[$key]['user']["user_nick"]; ?></td>
                      <td class="textCenter"><?php echo countSize($download['total_size']); ?></td>
                      <td class="textCenter"><?php echo $download['status']; ?></td>
                      <td class="textCenter"><?php if($originList[$key]['totalLength'] == '0'): ?>-<?php else: ?><?php echo floor($originList[$key]['completedLength']/$originList[$key]['totalLength']*10000)/100; ?>%<?php endif; ?></td>
                      <td class="textCenter"><?php if($download['status'] == 'active'): ?><a href="javascript:" onclick="cancel('<?php echo $download['id']; ?>')">取消任务</a><?php else: ?> - <?php endif; ?></td>
                    </tr>
                  <?php endforeach; endif; else: echo "" ;endif; ?>
                   
                  </tbody>
                </table>
                <?php echo $list->render(); ?>
              </div>
              <div class="tab-pane fade" id="tools" role="tabpanel" aria-labelledby="pills-profile-tab">
                ddd
              </div>
            </div>
          </div>
        </div><br>
        
      </div>
    </div>
    
    <!-- Example DataTables Card-->
  </div>
  <!-- /.container-fluid-->
</div>

  <footer class="sticky-footer">
  <div class="container">
    <div class="text-center">
      <small>Copyright © Cloudreve <?php echo date("Y"); ?> </small>
    </div>
  </div>
</footer>
<!-- Scroll to Top Button-->
<a class="scroll-to-top rounded" href="#page-top">
  <i class="fa fa-angle-up"></i>
</a>
  <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
      <div class="modal-dialog" role="document">
        <div class="modal-content">
          <div class="modal-header">
            <h5 class="modal-title" id="exampleModalLabel">确认</h5>
            <button class="close" type="button" data-dismiss="modal" aria-label="Close">
              <span aria-hidden="true">×</span>
            </button>
          </div>
          <div class="modal-body">点击“登出”按钮退出当前账户。</div>
          <div class="modal-footer">
            <button class="btn btn-secondary" type="button" data-dismiss="modal">取消</button>
            <a class="btn btn-primary" href="/Member/LogOut">登出</a>
          </div>
        </div>
      </div>
    </div>
   <script src="/static/js/jquery.min.js"></script>
    <script src="/static/js/bootstrap4/bootstrap.bundle.min.js"></script>
    <!-- Core plugin JavaScript-->
    <script src="/static/js/chart.js/Chart.min.js"></script>
    <!-- Custom scripts for all pages-->
    <script src="/static/js/sb-admin.min.js"></script>
    <script type="text/javascript" src="/static/js/toastr.min.js"></script>
    
<script src="/static/js/admin/summernote.min.js"></script>
<script src="/static/js/admin/summernote-zh-CN.min.js"></script>
<script src="/static/js/admin/aria2.js"></script>

  </div>
</body>

</html>