westdc-zf1/application/admin/views/scripts/data/md-dataset.phtml

99 lines
3.5 KiB
PHTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>数据存档</title>
<link rel="stylesheet" type="text/css" media="screen" href="/css/default.css" />
<script src='/static/js/jquery-1.7.2.min.js' type="text/javascript"></script>
<script type="text/javascript" src="/js/jquery.colorbox-min.js"></script>
<link href="/css/author.css" media="screen" rel="stylesheet" type="text/css"/>
<link href="/static/js/uploadify/uploadify.css" media="screen" rel="stylesheet" type="text/css" />
<link href="/css/colorbox.css" media="screen" rel="stylesheet" type="text/css" />
<style>
#loading{margin:0px;border:none;height:50px;width:98%;background:url(/static/img/colorbox-images/loading.gif) center center no-repeat;display:none;position:absolute;left:0px;top:0px;overflow:hidden;background:#ccc;}
</style>
</head>
<body>
<!-- 页面内容 -->
<div id="warpper">
<div id="loading" class="info info-box"></div>
<div id="datalist">
<?php
if(!empty($this->dataset))
{?>
<p>主机:<br /><input type="text" id="host" name="host" value="<?= $this->dataset['host']?>" class="full" /></p>
<p>路径:<br /><input type="text" id="path" name="path" value="<?= $this->dataset['path']?>" class="full" /></p>
<p><button type="button" class="btn btn-green" onclick="updateDataSet()">修改</button></p>
<?php }else{ ?>
<p>主机:<br /><input type="text" id="host" name="host" value="" class="full" /></p>
<p>路径:<br /><input type="text" id="path" name="path" value="" class="full" /></p>
<p><button type="button" class="btn btn-green" onclick="addDataSet()">添加</button></p>
<?php } ?>
</div>
</div>
<!-- //页面内容 -->
<script>
function updateDataSet(){
if(confirm("是否确定修改") == false)
{return false;}
$.ajax({
'type':"POST",
'url':'/admin/data/dataset',
'data':'ac=update&uuid=<?= $this->uuid ?>&host='+$('#host').val()+'&path='+$('#path').val(),
'success':function(data){
if (typeof(data)=='object')
{
if(typeof(data.error)!='undefined')
{Alert(data.error);return false;}
if(data.ok != null)
{
Alert('修改成功!');
setTimeout("parent.$.fn.colorbox.close();",2000);
}
}
else{
Alert('出现错误,请稍后再试');
}
},
'timeout': 30000,
'error': function(){
Alert('出现错误,请稍后再试');
}
});
}
function addDataSet(){
$.ajax({
'type':"POST",
'url':'/admin/data/dataset',
'data':'ac=add&uuid=<?= $this->uuid ?>&host='+$('#host').val()+'&path='+$('#path').val(),
'success':function(data){
if (typeof(data)=='object')
{
if(typeof(data.error)!='undefined')
{Alert(data.error);return false;}
if(data.ok != null)
{
Alert('添加成功!');
setTimeout("parent.$.fn.colorbox.close();parent.window.location.href=parent.window.location.href;",2000);
}
}
else{
Alert('出现错误,请稍后再试');
}
},
'timeout': 30000,
'error': function(){
Alert('出现错误,请稍后再试');
}
});
}
$(".iframe").colorbox({iframe:true, width:"80%", height:"80%"});
$(".inline").colorbox({inline:true, width:"50%"});
function Alert(html){
$.colorbox({'innerWidth':'50%','html':'<h4 style="font-size:16px;font-weight:bold;">'+html+'</h4>'});
}
</script>
</body>
</html>