<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head><title><!--{$UUDEV_PAGE_TITLE}--></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="css/ubb.css" rel="stylesheet"/>
<script src="js/ajaxupload.js" charset="utf-8"></script>
<script>
	$(document).ready(function(){
		new AjaxUpload($("#uploadimg"), {
			action: 'index.php?r=Upload.image',
			name: 'upload',
			onSubmit: function(file, ext){
				if (!(ext && /^(jpg|png|jpeg|gif|bmp)$/i.test(ext))) {
					alert(ext + '文件格式不支持 ，请重新上传！');
					return false;
				}
				
				this.disable();
				$("#uploadimg").html('<img src="images/ajax.gif"/>');
			},
			onComplete: function(file, response){
				var data = eval('(' + response + ')');
				if (data.flag == 1) {
					$("#image-url").val(data.name);
					$("#preview").attr("src",data.name).fadeIn("slow");
					$("#managerframe").attr("src",'./index.php?r=Upload.manager');
					
				}else {
					alert("图片上传失败");
				}
				$("#uploadimg").html('上传图片');
				this.enable();
			}
		});
		
		$(".portlet").css({height:'100%'});
	});
</script>
</head>
<body>
<div class="portlet ui-widget ui-widget-content ui-helper-clearfix ui-corner-all" style="hight:auto;">
<div class="portlet-header ui-widget-header"><span class="ui-icon ui-icon-circle-arrow-s" style="float:right;"></span>添加图片</div>
<div class="portlet-content" style="display: block;padding:10px;">
	<div class="panel-body">
		<table width="98%" class="ubbpad3">
			<tr>
				<td width="100">图片地址：</td>
				<td><input type="text" name="image-url" id="image-url" class="image-url"/><span id="uploadimg" class="button" style="margin-left:5px; text-decoration:underline; cursor:pointer;">上传图片</span></td>
				<td rowspan="4"><img style="display:none; border:1px #999999 solid;" id="preview" src="" width="80" height="80"/></td>
			</tr>
			<tr>
				<td>图片说明：</td>
				<td><input type="text" name="image-alt" id="image-alt" class="image-alt"/></td>
			</tr>
			<tr>
				<td>高：</td>
				<td><input type="text" name="image-height" id="image-height" class="image-height"/></td>
			</tr>
			<tr>
				<td>宽：</td>
				<td><input type="text" name="image-width" id="image-width" class="image-width"/></td>
			</tr>
		</table>
		<fieldset style="padding-left:10px;-moz-border-radius:8px;">
			<legend style="padding:0px 3px;">图片管理</legend>
			<div class="">
				<iframe id="managerframe" style="width:100%;height:auto;border:0px;" src="./index.php?r=Upload.manager" frameborder="0"></iframe>
			</div>
		</fieldset>
	</div>
	<div class="panel-bottom">
		<button class="but5font insertBtn" role="button" aria-disabled="false"><span class="ui-button-text">插入</span></button>
		<button class="but5font cancelBtn" role="button" aria-disabled="false"><span class="ui-button-text">取消</span></button>
	</div>
</div>
</div>
</body>
</html>