<!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 enctype="multipart/form-data" name="form1" action="media_edit.php" method="POST" onSubmit="return CheckSubmit();">
			<input type="hidden" name="dopost" value="save">
			<input type="hidden" name="_csrf_token" value="<?php echo $GLOBALS['csrf_token'];?>">
			<input type="hidden" name="aid" value="<?php echo $aid?>">
			<table 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">图片类型仅支持jpg、png、gif、wbmp格式，视音频和附件为限定扩展名类型，在系统变量中修改</div>
					</td>
				</tr>
				<tr>
					<td width="260">媒体类型：</td>
					<td>
						<label><input type="radio" name="mediatype" value="1" <?php if ($myrow['mediatype']==1) echo "checked";?>> 图片</label>
						<label><input type="radio" name="mediatype" value="2" <?php if ($myrow['mediatype']==2) echo "checked";?>> FLASH</label>
						<label><input type="radio" name="mediatype" value="3" <?php if ($myrow['mediatype']==3) echo "checked";?>> 视频音频</label>
						<label><input type="radio" name="mediatype" value="4" <?php if ($myrow['mediatype']==4) echo "checked";?>> 附件其它</label>
					</td>
				</tr>
				<tr>
					<td>说明标题：</td>
					<td><input type="text" name="title" id="title" value="<?php echo $myrow['title']?>" class="admin-input-lg"></td>
				</tr>
				<tr>
					<td>附加参数：</td>
					<td>
						<label>宽：<input type="text" name="mediawidth" id="mediawidth" value="<?php echo $myrow['width']?>" class="admin-input-sm">（像素）</label>
						<label>高：<input type="text" name="mediaheight" id="mediaheight" value="<?php echo $myrow['height']?>" class="admin-input-sm">（像素）</label>
						<label>播放时间：<input type="text" name="playtime" id="playtime" value="<?php echo $myrow['playtime']?>" class="admin-input-sm">（分钟）</label>
					</td>
				</tr>
				<tr>
					<td>源文件：</td>
					<td>
						<input type="text" name="filename" id="filename" value="<?php echo $myrow['url']?>" class="admin-input-lg">
						<a href="<?php echo $myrow['url']?>" target="_blank" class="btn btn-success btn-sm">查看</a>
					</td>
				</tr>
				<?php
				if ($myrow['mediatype']==1)
				{
					$fullfilename = $cfg_basedir.$myrow['url'];
					if (file_exists($fullfilename)){
						$info = "";
						$sizes = getimagesize($fullfilename,$info);
						if (is_array($sizes)){
							if ($sizes[0]>200) $w=200;
							else $w = $sizes[0];
				?>
				<tr>
					<td>预览：</td>
					<td><a href="<?php echo $myrow['url']?>" target="_blank"><img src="<?php echo $myrow['url'].'?q='.time()?>" width="<?php echo $w?>" id="picview"></a></td>
				</tr>
				<?php }}}?>
				<tr>
					<td>修改文件：</td>
					<td><input type="file" name="upfile" id="upfile" class="admin-input-lg"></td>
				</tr>
				<tr>
					<td bgcolor="#f5f5f5" colspan="2" align="center"><button type="submit" class="btn btn-success btn-sm">保存</button></td>
				</tr>
			</table>
		</form>
		<script>
			function CheckSubmit() {
				if (document.form1.title.value == "") {
					ShowMsg("请设置标题");
					document.form1.title.focus();
					return false;
				}
			}
		</script>
	</body>
</html>