Location: PHPKode > projects > PHPDug > adm/scripts/form_form.htm
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="style/editor.css" rel="stylesheet" type="text/css">
<script>
	var sLangDir=dialogArguments.oUtil.langDir;
	document.write("<scr"+"ipt src='language/"+sLangDir+"/form_form.js'></scr"+"ipt>");
</script>
<script>writeTitle()</script>
<script>
function GetElement(oElement,sMatchTag)
	{
	while (oElement!=null&&oElement.tagName!=sMatchTag)
		{
		if(oElement.tagName=="BODY")return null;
		oElement=oElement.parentElement;
		}
	return oElement;
	}

function doWindowFocus()
	{
	dialogArguments.oUtil.onSelectionChanged=new Function("realTime()");
	}
function bodyOnLoad()
	{	
	window.onfocus=doWindowFocus;	
	dialogArguments.oUtil.onSelectionChanged=new Function("realTime()");
	
	realTime()
	}	
function realTime()
	{
	if(!dialogArguments.oUtil.obj.checkFocus()){return;}//Focus stuff
	var oEditor=dialogArguments.oUtil.oEditor;
	var oSel=oEditor.document.selection.createRange();

	if (oSel.parentElement)	oEl=GetElement(oSel.parentElement(),"FORM");
	else oEl=GetElement(oSel.item(0),"FORM");

	if (oEl)
		{
		btnInsert.style.display="none";
		btnApply.style.display="block";
		btnOk.style.display="block";

		inpName.value=oEl.name;		
		inpMethod.value=oEl.method;
		inpAction.value=oEl.action;
		}
	else
		{
		btnInsert.style.display="block";
		btnApply.style.display="none";
		btnOk.style.display="none";

		inpName.value="form1";
		inpMethod.value="post";
		inpAction.value="";
		}			
	}

function doApply()
	{
	if(!dialogArguments.oUtil.obj.checkFocus()){return;}//Focus stuff
	var oEditor=dialogArguments.oUtil.oEditor;
	var oSel=oEditor.document.selection.createRange();

	dialogArguments.oUtil.obj.saveForUndo();

	if (oSel.parentElement)	oEl=GetElement(oSel.parentElement(),"FORM");
	else oEl=GetElement(oSel.item(0),"FORM");

	if (oEl)
		{
		if(oEl.NAME) oEl.NAME=inpName.value;		
		else if(oEl.name) //else if(oEl.name) oEl.name=inpName.value;	
			{
			oEl.removeAttribute("name",0);
			oEl.NAME=inpName.value;	
			}
		else oEl.NAME=inpName.value; 
		oEl.id=inpName.value;
		oEl.method=inpMethod.value;
		oEl.action=inpAction.value;
		}
	else
		{
		sHTML = "<form method=\""+inpMethod.value+"\" action=\""+inpAction.value+"\" name=\""+inpName.value+"\" id=\""+inpName.value+"\" selThis=\"selThis\"><br></form>"
		if(oSel.parentElement) oSel.pasteHTML(sHTML);
		else oSel.item(0).outerHTML = sHTML;	
		
		for(var i=0;i<oEditor.document.all.length;i++)
			{
			if(oEditor.document.all[i].getAttribute("selThis")=="selThis")
				{
				oEditor.document.all[i].removeAttribute("selThis",0);				
				var oSelRange = oEditor.document.body.createTextRange();
				oSelRange.moveToElementText(oEditor.document.all[i]);
				oSelRange.select();					
				}
			}
		}
	
	realTime();
	
	//*** RUNTIME STYLES ***
	dialogArguments.oUtil.obj.runtimeStyles();
	//***********************	
	
	dialogArguments.realTime(dialogArguments.oUtil.oName);
	dialogArguments.oUtil.obj.selectElement(0);
	}				
</script>
</head>
<body onload="loadText();bodyOnLoad()" style="overflow:hidden;">

<table width=100% height=100% align=center cellpadding=0 cellspacing=0>
<tr>
<td valign=top style="padding:5;height:100%">
	<table width=100%>
	<tr>
		<td nowrap><span id=txtLang name=txtLang>Name</span>:&nbsp;&nbsp;</td>
		<td width=100%><INPUT type="text" ID="inpName" NAME="inpName" style="width:100%;padding-left:2" value="form1" class="inpTxt"></td>
	</tr>
	<tr>
		<td nowrap><span id=txtLang name=txtLang>Action</span>:&nbsp;&nbsp;</td>
		<td><INPUT type="text" ID="inpAction" NAME="inpAction" style="width:100%;padding-left:2" class="inpTxt"></td>
	</tr>
	<tr>
		<td nowrap><span id=txtLang name=txtLang>Method</span>:&nbsp;&nbsp;</td>
		<td>
		<select ID="inpMethod" NAME="inpMethod" style="width:100%" class="inpSel">
			<option value="post">post</option>
			<option value="get">get</option>
		</select></td>
	</tr>	
	</table>
</td>
</tr>
<tr>
<td class="dialogFooter" style="padding:6;" align="right">
		<table cellpadding=1 cellspacing=0>
		<td>
		<input type=button name=btnCancel id=btnCancel value="cancel" onclick="self.close()" class="inpBtn" onmouseover="this.className='inpBtnOver';" onmouseout="this.className='inpBtnOut'">
		</td>
		<td>
		<input type=button name=btnInsert id=btnInsert value="insert" onclick="doApply();self.close()" class="inpBtn" onmouseover="this.className='inpBtnOver';" onmouseout="this.className='inpBtnOut'">
		</td>
		<td>
		<input type=button name=btnApply id=btnApply value="apply" style="display:none" onclick="doApply()" class="inpBtn" onmouseover="this.className='inpBtnOver';" onmouseout="this.className='inpBtnOut'">
		</td>
		<td>
		<input type=button name=btnOk id=btnOk value=" ok " style="display:none;" onclick="doApply();self.close()" class="inpBtn" onmouseover="this.className='inpBtnOver';" onmouseout="this.className='inpBtnOut'">
		</td>
		</table>
</td>
</tr>
</table>
</body>
</html>
Return current item: PHPDug