You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

144 lines
7.0 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!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>
<script type="text/javascript" src="radio.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" type="text" placeholder="必填项" size="20" /> </td>
<td> <span id="txtSelValue" class="uneditable-input" style="height:20px;"></span> </td>
</tr>
<tr>
<th colspan="2">
<span>单选框菜单项目</span><span class="label label-important">*</span>
</th>
</tr>
<tr>
<td colspan="2">
<select id="cmbText" style="width:100%;height: 100px;" multiple="multiple"></select>
</td>
</tr>
<tr>
<td>
<div class="btn-group">
<a title="上移" onclick="fnMove(-1);" class="btn btn-large"><i class="icon-arrow-up"></i></a>
<a title="下移" onclick="fnMove(1);" class="btn btn-large"><i class="icon-arrow-down"></i></a>
<a title="设为初始化时选定值" onclick="fnSetSelectedValue();" class="btn btn-large"><i class="icon-ok-circle"></i></a>
<a title="删除" onclick="fnDelete();" class="btn btn-large"><i class="icon-remove"></i></a>
</div>
</td>
<td>
<input type="text" placeholder="输入单选框值..." size="16" id="txtText">
<div class="btn-group" style="float:right;">
<a title="新增" onclick="fnAdd();" class="btn btn-large btn-primary"><i class="icon-plus"></i></a>
<a title="修改" onclick="fnModify();" class="btn btn-large"><i class="icon-edit"></i></a>
</div>
</td>
</tr>
</table>
<script type="text/javascript">
var oNode = null;
var oListText;
window.onload = function() {
oListText = $G( 'cmbText' ) ;
//弹出窗口初始化函数,这里主要是判断是编辑下拉列表还是新增
if( UE.plugins['radio'].editdom ){
oNode = UE.plugins['radio'].editdom;
$G('txtName').value = oNode.getAttribute('title');
$G('txtSelValue').innerHTML = oNode.getAttribute('radio_check');
var sDataField = oNode.getAttribute('radio_field');
var aDataField = sDataField.split('`');
var sLvCheck = oNode.getAttribute("radio_check");
// Load the actual options
for ( var i = 0 ; i < aDataField.length ; i++ ) {
var sText = aDataField[i] ;
if(aDataField[i] == "") {
continue;
}
fnAddComboOption( oListText, sText, sText ) ;
}
}
}
dialog.oncancel = function () {
if( UE.plugins['radio'].editdom ) {
delete UE.plugins['radio'].editdom;
}
};
dialog.onok = function (){
if($G('txtName').value == '') {
alert('控件名称不能为空');
$G('txtName').focus();
return false;
}
if( oListText.options.length == 0 ) {
alert('请添加单选选项!');
$G('txtText').focus();
return false;
}
var sDataField = '',sLvCheck = '';
for ( var i = 0 ; i < oListText.options.length ; i++ ) {
var sText = oListText.options[i].value ;
if ( sText.length == 0 ) sText = sText ;
if ( sText == $G('txtSelValue').innerHTML ) {
sLvCheck = sText;
}
if( sDataField.indexOf(sText+"`") != -1 && sText != "`") {
alert("菜单项目'"+sText+"'重复");
return false;
}
sDataField += sText+"`";
}
if( !oNode ) {
var sUrl = parent.getItemUrl;
var nItemId = null;
ajax.request(sUrl, {timeout:60000,onsuccess:function (xhr) {
try {
nItemId = xhr.responseText;
oNode = document.createElement("img");
oNode.setAttribute('title',$G('txtName').value.replace("\"","&quot;"));
oNode.setAttribute('name','data_' + nItemId);
oNode.setAttribute('radio_field',sDataField);
oNode.setAttribute('radio_check',sLvCheck);
oNode.setAttribute('class','radio');
oNode.setAttribute('className','radio');
oNode.setAttribute('src','/Public/diy_tf/image/form/radio.gif');
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("\"","&quot;"));
oNode.setAttribute('radio_field',sDataField);
oNode.setAttribute('radio_check',sLvCheck);
delete UE.plugins['radio'].editdom; //使用后清空这个对象,变回新增模式
return true;
}
};
</script>
</body>
</html>