listview.php

来自「极限网络智能办公系统 Office Automation V3.0官方100%源」· PHP 代码 · 共 118 行

PHP
118
字号
<?
include_once 'inc/auth.php';
$ITEM_MAX = 50;
echo '
<html>
<head>
<title>列表控件设定</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script>
function my_submit()
{
if(ITEM_NAME.value=="")
{
	 alert("控件名称不能为空");
	 return;
}
var parent_window = parent.dialogArguments;
var option_str="";
var LV_TITLE="";
var LV_SIZE="";
var count=0;
for(i=1;i<=';
echo $ITEM_MAX;
echo ';i++)
{
		var item_str="item_"+i;
		var size_str="size_"+i;
		if(document.all(item_str).value!="")
		{
			LV_TITLE+=document.all(item_str).value+"`";
			count++;
			if(document.all(size_str).value!="")
				 LV_SIZE+=document.all(size_str).value+"`";
			else
				 LV_SIZE+="10`";
		}
}
if(count==0)
{
	 alert("表头项目不能为空");
	 return;
}
var control_html="<img src=\\"listview.gif\\" class=\\"LIST_VIEW\\" align=absmiddle border=0 style=\\"cursor:hand\\" title=\\""+ITEM_NAME.value.replace("\\"","&quot;")+"\\" LV_TITLE=\\""+LV_TITLE+"\\" LV_SIZE=\\""+LV_SIZE+"\\">";
if(edit_flag==1)
{
	oSelection =  parent.dialogArguments.document.selection.createRange();
	oSelection(0).title=ITEM_NAME.value;
	parent_window.doStyle("delete");
	parent_window.insertHtml(control_html);
}
else
	parent_window.EDIT_HTML.insertHtml(control_html);
window.close();
}
//-- 获取控件属性 --
var edit_flag=0;
function LoadDo()
{
oSelection = dialogArguments.document.selection.createRange();
sRangeType = dialogArguments.document.selection.type;
if (sRangeType == "Control")
{
	edit_flag=1;
	ITEM_NAME.value = oSelection(0).title;
	var LV_TITLE = oSelection(0).LV_TITLE;
	var LV_SIZE = oSelection(0).LV_SIZE;
	var LV_TITLE_ARRAY=LV_TITLE.split("`");
	var LV_SIZE_ARRAY=LV_SIZE.split("`");
	for (i=0; i<LV_TITLE_ARRAY.length-1; i++)
	{
			var item_str="item_"+(i+1);
			var size_str="size_"+(i+1);
			document.all(item_str).value = LV_TITLE_ARRAY[i] ;
			document.all(size_str).value = LV_SIZE_ARRAY[i] ;
	}
}
ITEM_NAME.focus();
}
</script>
</head>
<body topmargin="0" onload="LoadDo();">
<table border="0" cellspacing="1" width="100%" class="small" bgcolor="#000000" cellpadding="3" align="center">
<tr class="TableContent">
		<td nowrap colspan="3">控件名称:
		<Input name="ITEM_NAME" type="text" class="SmallInput" size="20">
		<input type="button" onclick="my_submit();" value="确 定" class="SmallButton">
		</td>
</tr>
<tr class="TableHeader">
		<td nowrap align="center">序号</td>
		<td nowrap align="center" title="Tab键切换输入框">列表控件表头项目&nbsp;&nbsp;</td>
		<td nowrap align="center" title="Tab键切换输入框">宽度</td>
</tr>
';
for ($I = 1; $I <= $ITEM_MAX; ++$I)
{
	echo '  <tr class="TableContent">
		<td nowrap align="center">';
	echo $I;
	echo '</td>
		<td nowrap align="center" title="Tab键切换输入框">
			<Input name="item_';
	echo $I;
	echo '" type="text" class="SmallInput" size="25">
		</td>
		<td nowrap align="center" title="Tab键切换输入框">
			<Input name="size_';
	echo $I;
	echo '" type="text" class="SmallInput" size="5" value="10">
		</td>
</tr>
';
}
echo '</table>
</body>
</html>';
?>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?