<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
		<title>软件下载设置</title>
		<link rel="stylesheet" href="../static/web/font/css/font-awesome.min.css">
		<link rel="stylesheet" href="../static/web/css/bootstrap.min.css">
		<link rel="stylesheet" href="../static/web/css/admin.css">
		<script src="../static/web/js/jquery.min.js"></script>
		<script src="../static/web/js/bootstrap.min.js"></script>
		<script src="js/main.js"></script>
	</head>
	<body>
		<form name="form1" action="soft_config.php" method="post">
			<input type="hidden" name="dopost" value="save">
			<table cellpadding="3" cellspacing="1" align="center" class="table maintable my-3">
				<tr>
					<td bgcolor="#f5f5f5" colspan="2">软件下载设置</td>
				</tr>
				<tr>
					<td colspan="2">
						<div class="alert alert-info mb-0">软件模型的附件下载方式都必须链接到中转页，否则无效</div>
					</td>
				</tr>
				<tr>
					<td width="260">链接显示方式：</td>
					<td>
						<label><input type="radio" name="downtype" value="0" <?php if ($row['downtype']==0) echo " checked='checked' ";?>> 直接显示地址列表</label>
						<label><input type="radio" name="downtype" value="1" <?php if ($row['downtype']==1) echo " checked='checked' ";?>> 要求进入下载地址列表页</label>
					</td>
				</tr>
				<tr>
					<td>附件下载方式：</td>
					<td>
						<label><input type="radio" name="gotojump" value="0" <?php if ($row['gotojump']==0) echo " checked='checked' ";?>> 链接到真实软件地址</label>
						<label><input type="radio" name="gotojump" value="1" <?php if ($row['gotojump']==1) echo " checked='checked' ";?>> 链接到跳转页面</label>
					</td>
				</tr>
				<tr>
					<td>是否启用镜像站点：</td>
					<td>
						<label><input type="radio" name="ismoresite" value="1" <?php if ($row['ismoresite']==1) echo " checked='checked' ";?>> 启用</label>
						<label><input type="radio" name="ismoresite" value="0" <?php if ($row['ismoresite']==0) echo " checked='checked' ";?>> 不启用</label>
					</td>
				</tr>
				<tr>
					<td>启用镜像站点后是否保留本地下载：</td>
					<td>
						<label><input type="radio" name="islocal" value="1" <?php if ($row['islocal']==1) echo " checked='checked' ";?>> 保留</label>
						<label><input type="radio" name="islocal" value="0" <?php if ($row['islocal']==0) echo " checked='checked' ";?>> 不保留</label>
					</td>
				</tr>
				<tr>
					<td>镜像处理方式：</td>
					<td>
						<label><input type="radio" name="moresitedo" value="1" <?php if ($row['moresitedo']==1) echo " checked='checked' ";?>> 根据本地地址和服务器列表自动生成</label>
						<label><input type="radio" name="moresitedo" value="0" <?php if ($row['moresitedo']==0) echo " checked='checked' ";?>> 发布时按服务器生成列表由我手工填写</label>
					</td>
				</tr>
				<tr>
					<td>下载默认等级：</td>
					<td>
						<select name="dfrank" id="dfrank" class="admin-input-sm">
							<?php
							$urank = $cuserLogin->getUserRank();
							$dsql->SetQuery("SELECT * FROM `#@__arcrank` where `rank`>=0 ");
							$dsql->Execute();
							while($nrow = $dsql->GetArray())
							{
								if ($nrow['rank']==0) $nrow['membername'] = "开放下载";
								if ($nrow['rank']==$row['dfrank']) echo "<option value='{$nrow['rank']}' selected>{$nrow['membername']}</option>";
								else echo "<option value='{$nrow['rank']}'>{$nrow['membername']}</option>";
							}
							?>
						</select>
					</td>
				</tr>
				<tr>
					<td>下载默认金币：</td>
					<td><input type="text" name="dfywboy" value="<?php echo $row['dfywboy'];?>" class="admin-input-xs">
					</td>
				</tr>
				<tr>
					<td>参数限制方式：</td>
					<td>
						<label><input type="radio" name="argrange" value="0" <?php if ($row['argrange']==0) echo " checked='checked' ";?>> 允许发布时重新选择权限</label>
						<label><input type="radio" name="argrange" value="2" <?php if ($row['argrange']==1) echo " checked='checked' ";?>> 所有软件均使用此权限</label>
					</td>
				</tr>
				<tr>
					<td>镜像服务器列表：</td>
					<td>
						<label>服务器网址：<input type="text" name="serverurl" id="serverurl" value="http://"></label>
						<label>服务器名称：<input type="text" name="servername" id="servername"></label>
						<label>服务器类型：<input type="text" name="servertype" id="servertype" value="默认"></label>
						<button type="button" name="Submit" onclick="AddServer()" class="btn btn-success btn-sm">添加一项</button>
					</td>
				</tr>
				<tr>
					<td colspan="2"><textarea name="sites" id="sites" class="admin-textarea-xl"><?php echo $row['sites'];?></textarea></td>
				</tr>
				<tr>
					<td colspan="2">下载说明：</td>
				</tr>
				<tr>
					<td colspan="2"><?php GetEditor('downmsg',$row['downmsg'],400);?></td>
				</tr>
				<tr>
					<td bgcolor="#f5f5f5" colspan="2" align="center">
						<button type="submit" name="Submit" class="btn btn-success btn-sm">保存</button>
						<button type="reset" name="rset" id="rset" class="btn btn-outline-success btn-sm">重置</button>
					</td>
				</tr>
			</table>
		</form>
		<script>
			function AddServer() {
				if (document.form1.serverurl.value == "" || document.form1.serverurl.value == "http://") { ShowMsg('服务器网址不能为空'); return; }
				if (document.form1.servername.value == "") { ShowMsg('服务器名称不能为空'); return; }
				if (document.form1.servertype.value == "") { ShowMsg('服务器类型不能为空'); return; }
				document.form1.sites.value += document.form1.serverurl.value + " | " + document.form1.servername.value + " | " + document.form1.servertype.value + "";
			}
		</script>
	</body>
</html>