<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
// +----------------------------------------------------------------------+
// | PHP version 4/5                                                      |
// +----------------------------------------------------------------------+
// | Copyright (c) 2005-2006 ARMIA INC                                    |
// +----------------------------------------------------------------------+
// | This source file is a part of iScripts EasyCreate 1.1                 |
// +----------------------------------------------------------------------+
// | Authors: jimmy<jimmy.jos@armia.com>        		              	  |
// +----------------------------------------------------------------------+
//Modifying a form in the editable area.
//It modifies the form properties using javascript.
include "../includes/session.php";
include "../includes/config.php";
$currentloc="../";	  
include "../includes/applicationheader.php";
?>
<script language=javascript>
var myPage = window.opener;

window.onload = setValues;

var formName = myPage.selectedForm.name;
var formAction = myPage.selectedForm.action;
var formMethod = myPage.selectedForm.method;
//setValues called at the time of loading
//set values passed to the document and sets it to the input fields. 
function setValues() {

	formForm.form_name.value = formName;
	formForm.form_action.value = formAction;
	this.focus();
}
//User clicking the modify button invokes this function
//It modifies the form properties with the values given in this screen and closes the window.
function doModify() {

	if (formForm.form_name.value != "") {
		myPage.selectedForm.name = formForm.form_name.value
	} else {
		myPage.selectedForm.removeAttribute('name',0)
	}

	if (formForm.form_action.value != "") {
		myPage.selectedForm.action = formForm.form_action.value
	} else {
		myPage.selectedForm.removeAttribute('action',0)
	}

	if (formForm.method[formForm.method.selectedIndex].text != "None") {
    	myPage.selectedForm.method = formForm.method[formForm.method.selectedIndex].text
    } else {
		myPage.selectedForm.removeAttribute('method',0)
    }
        
    window.close()
}

function printMethod() {
	if ((formMethod != undefined) && (formMethod != "")) {
		document.write('<option selected>' + formMethod)
		document.write('<option>None')
	} else {
		document.write('<option selected>None')
	}
}

document.onkeydown = function () { 
			if (event.keyCode == 13) {	// ENTER
				doModify()
			}
	};

document.onkeypress = onkeyup = function () {
	if (event.keyCode == 13) {	// ENTER
	event.cancelBubble = true;
	event.returnValue = false;
	return false;			
	}
};

</script>
</head>
<body>
		<div class="MainBody" style="width:100%; height:100%">
				<table width="96%" height="10%" align="center" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td width="10" height="11"><img src="images/main_lc.gif" width="10" height="11"></td>
						<td background="images/main_tbg.gif" height="11"><font size="1"><img src="images/1x1.gif" width="1" height="1"></font></td>
						<td width="10" height="11"><img src="images/main_rc.gif" width="10" height="11"></td>
					</tr>
					<tr>
						<td width="10" height="11" background="images/main_lm.gif"></td>
						<td bgcolor="#F7F7F7" height="100%" class="body" style="padding:10px" valign="top">
			

<form name=formForm>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
	<td width="15"><img src="_images/1x1.gif" width="15" height="1"></td>
	  <td class="maintext"><b>Modify Form Properties</b></td>
  </tr>
  <tr>
	<td>&nbsp;</td>
	  <td class="maintext"><br>Enter the required information and click &quot;Modify Form&quot; to modify the form properties of your form.<br>
		Click the &quot;Cancel&quot; Button to  close this window.<br>&nbsp;</td>
  </tr>
  <tr>
	<td>&nbsp;</td>
	<td class="body">&nbsp;</td>
  </tr>
  <tr>
	<td>&nbsp;</td>
	<td class="body">
	 	  
		<table border="0" cellspacing="0" cellpadding="5" width="98%" class="bevel2">
		  <tr>
		    <td class="maintext" width="80">Name:</td>
			<td class="maintext">
			  <input type="text" name="form_name" size="30" class="Text90" maxlength="50">
		  </td>
		  </tr>
		  <tr>
		    <td class="maintext" width="80">
			Action:</td>
			<td class="maintext">
			  <input type="text" name="form_action" size="30" class="Text250">
		  </td>
		  </tr>
		  <tr>
			<td class="maintext" width="80">Method:</td>
			<td class="body">
			  <SELECT class=text70 name=method>
			    <script>printMethod()</script>
			    <option>Post
			    <option>Get</option>
			  </select>
		  </td>
		  </tr>
	    </table>
	</td>
  </tr>
  <tr>
	<td colspan="2"><img src="images/1x1.gif" width="1" height="10"></td>
  </tr>
  <tr>
	<td>&nbsp;</td>
	<td align="center">
	    <input type="button" name="modifyForm" value="Modify Form" class="editorbutton" onClick="javascript:doModify();">
	<input type="button" name="Submit" value="Cancel" class="editorbutton" onClick="javascript:window.close()">
	</td>
  </tr>
</table>
</form>
						</td>
						<td width="10" background="images/main_rm.gif" height="11"></td>
					</tr>
					<tr>
						<td width="10" height="11"><img src="images/main_lcb.gif" width="10" height="11"></td>
						<td background="images/main_bbg.gif" height="11"><font size="1"><img src="images/1x1.gif" width="1" height="1"></font></td>
						<td width="10" height="11"><img src="images/main_rcb.gif" width="10" height="11"></td>
					</tr>
				</table>
				<br>&nbsp;
					</div>
					</div>
<?php
  include "./includes/editorfooter.php";
?> 	