|
|
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
|
|
|
|
"http://www.w3.org/TR/html4/loose.dtd">
|
|
|
|
|
<html>
|
|
|
|
|
<head>
|
|
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
|
|
|
|
<title>复选框属性</title>
|
|
|
|
|
<script type="text/javascript" src="../internal.js"></script>
|
|
|
|
|
<link rel="stylesheet" href="../../../bootstrap/bootstrap.css">
|
|
|
|
|
<link rel="stylesheet" href="../../../bootstrap/bootstrap-responsive.css">
|
|
|
|
|
<style type="text/css">
|
|
|
|
|
*{color: #838383;margin: 0;padding: 0}
|
|
|
|
|
html,body {font-size: 12px;}
|
|
|
|
|
body {
|
|
|
|
|
padding-left: 20px;padding-right: 20px;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
</head>
|
|
|
|
|
<body>
|
|
|
|
|
<table class="table table-striped table-bordered" style="margin-top:18px;margin-bottom: 0;">
|
|
|
|
|
<tr>
|
|
|
|
|
<th><span>控件名称</span><span class="label label-important">*</span></th>
|
|
|
|
|
<th><span>选中状态</span></th>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td> <input id="txtName" placeholder="控件的名字,必填" type="text" size="20" /> </td>
|
|
|
|
|
<td>
|
|
|
|
|
<label class="checkbox"><input id="checked_false" checked="checked" name="checked" type="radio"> 不选中 </label>
|
|
|
|
|
<label class="checkbox"><input id="checked_true" name="checked" type="radio"> 选中 </label>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
</table>
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
var oNode = null;
|
|
|
|
|
window.onload = function() {
|
|
|
|
|
//弹出窗口初始化函数,这里主要是判断是编辑下拉列表还是新增
|
|
|
|
|
if( UE.plugins['checkbox'].editdom ){
|
|
|
|
|
oNode = UE.plugins['checkbox'].editdom;
|
|
|
|
|
$G('txtName').value = oNode.getAttribute('title');
|
|
|
|
|
var checked = oNode.getAttribute('checked');
|
|
|
|
|
checked ? $G('checked_true').checked = true : $G('checked_false').checked = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
dialog.oncancel = function () {
|
|
|
|
|
if( UE.plugins['checkbox'].editdom ) {
|
|
|
|
|
delete UE.plugins['checkbox'].editdom;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
dialog.onok = function (){
|
|
|
|
|
if( $G('txtName').value == '') {
|
|
|
|
|
alert('控件名称不能为空');
|
|
|
|
|
$G('txtName').focus();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if( !oNode ) {
|
|
|
|
|
var sUrl = parent.getItemUrl;
|
|
|
|
|
var nItemId = null;
|
|
|
|
|
ajax.request(sUrl, {timeout:60000,onsuccess:function (xhr) {
|
|
|
|
|
try {
|
|
|
|
|
nItemId = xhr.responseText;
|
|
|
|
|
oNode = document.createElement("input");
|
|
|
|
|
oNode.setAttribute('title',$G('txtName').value.replace("\"","""));
|
|
|
|
|
oNode.setAttribute('name','data_' + nItemId);
|
|
|
|
|
oNode.setAttribute('type','checkbox');
|
|
|
|
|
if ($G('checked_true').checked) {
|
|
|
|
|
oNode.setAttribute('checked','checked');
|
|
|
|
|
} else {
|
|
|
|
|
oNode.checked = false;
|
|
|
|
|
}
|
|
|
|
|
editor.execCommand('insertHtml',oNode.outerHTML);
|
|
|
|
|
return true ;
|
|
|
|
|
} catch ( e ) {
|
|
|
|
|
alert ( '插入控件出错,请联系OA管理员解决 ');
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
},onerror:function() {
|
|
|
|
|
alert('Request TimeOut');
|
|
|
|
|
}});
|
|
|
|
|
} else {
|
|
|
|
|
oNode.setAttribute('title',$G('txtName').value.replace("\"","""));
|
|
|
|
|
if ($G('checked_true').checked) {
|
|
|
|
|
oNode.setAttribute('checked','checked');
|
|
|
|
|
} else {
|
|
|
|
|
oNode.removeAttribute('checked');
|
|
|
|
|
}
|
|
|
|
|
delete UE.plugins['checkbox'].editdom; //使用后清空这个对象,变回新增模式
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|