<html>
<head>
	<link rel="stylesheet" type="text/css" href="../../../theme/css/censusmain.css"/>
	<link rel="stylesheet" type="text/css" href="../../../theme/css/mqwizard.css"/>
	<script type="text/javascript" src="../../../js/images.js"></script>
	<script type="text/javascript" src="../../js/workflow/tmpladdgroup.js"></script>
	<script type="text/javascript" src="../../js/workflow/ruleconstants.js"></script>
	<script type="text/javascript" src="../../../js/mqsysutils.js"></script>
	<script type="text/javascript" src="../../../js/mqformelements.js"></script>
	<script type="text/javascript" src="../../../js/window.js"></script>
	<script type="text/javascript" src="../../../js/cmqlookupitemint.js"></script>
	<script type="text/javascript" src="../../../js/initlookupitemint.js"></script>
	<script type="text/javascript" src="../../../js/mqloaddata.js"></script>

	<link rel="stylesheet" href="../../../js/jquery/jquery.ui.all.css">		
	<script type="text/javascript" src="../../../js/jquery/jquery-1.7.1.js"></script>
	<script type="text/javascript" src="../../../js/jquery/jquery.bgiframe-2.1.2.js"></script>
	<script type="text/javascript" src="../../../js/jquery/jquery.ui.core.js"></script>
	<script type="text/javascript" src="../../../js/jquery/jquery.ui.widget.js"></script>
	<script type="text/javascript" src="../../../js/jquery/jquery.ui.mouse.js"></script>
	<script type="text/javascript" src="../../../js/jquery/jquery.ui.draggable.js"></script>
	<script type="text/javascript" src="../../../js/jquery/jquery.ui.position.js"></script>
	<script type="text/javascript" src="../../../js/jquery/jquery.ui.resizable.js"></script>
	<script type="text/javascript" src="../../../js/jquery/jquery.ui.dialog.js"></script>
<title>Add Business Rule</title>

<script type="text/javascript">
	var m_objRef;
	m_objRef=parent.parent;
	
	var m_lngGroupID="<WC@TMPL_ID></WC@TMPL_ID>";
	var m_strName="<WC@TMPL_NAME></WC@TMPL_NAME>";
	var m_strDesc="<WC@TMPL_DESC></WC@TMPL_DESC>";
	var m_lngType="<WC@TMPL_TYPE></WC@TMPL_TYPE>";
	var m_strCondFields="<WC@TMPL_CONDS></WC@TMPL_CONDS>";
	var m_strCondFieldIDs="<WC@TMPL_COND_IDS></WC@TMPL_COND_IDS>";
	var m_strActFields="<WC@TMPL_ACTS></WC@TMPL_ACTS>";
	var m_strActFieldIDs="<WC@TMPL_ACT_IDS></WC@TMPL_ACT_IDS>";
	var m_strOnChange="<WC@TMPL_TRIGGER></WC@TMPL_TRIGGER>";
	var m_strEnabled="<WC@TMPL_STATE></WC@TMPL_STATE>";
	
	var m_blnOnChange=(m_strOnChange=="1");
	var m_blnEnabled=(m_strEnabled=="1");
	
	var m_objMqButton=new MqButton();
	
	var m_strWinID=parseInt( Math.random() * 1000);
	var m_objLookupItemInfoColl=new Array();
	var m_strPathToAdminHTML = "../../../HTML/";
	var DEFAULT_VALUE_DELIM=";";
	var strCondFieldsAddWhere="nDataType IN(103,104) AND fEnabled<>0";
	var strActionFieldsAddWhere="nDataType IN(103,104) AND fEnabled<>0";
	var strCondFieldsAddUnion="UNION SELECT '<User in Group>' AS tCaption, -10 AS nID FROM [tblDtsFields] UNION SELECT '<New Issue>' AS tCaption, -18 AS nID FROM [tblDtsFields]";
	
</script>
</head>

<body class="ToolbarBody" style="margin:0px;overflow:auto" onload="Form_OnLoad();SetFocus()">
<table width="100%" height="30" class="HeaderTop" marginwidth="0" cellpadding="0" cellspacing="0" border="0">	
		<tr>
			<td width="100%" align="left">
				<div id="HeaderText" class="SmallHeaderText">Add Business Rule</div>
			</td>
		</tr>
	</table>
<table width="100%" style="padding-left:10px; padding-top:10px">
<tr>
	<td width="20%" style="padding-bottom:10px">
		<font class="DialogLabel">Name:</font>
	</td>
	<td width="80%" style="padding-bottom:10px">
		<input type="text" name="txtGroupName" id="txtGroupName" style="width:90%" class="AdminTextBoxWidth" onmouseover="this.className='AdminTextBoxWidthHover';" onmouseout="this.className='AdminTextBoxWidth';" maxlength="50" onkeypress="Pressed()">
	</td>
</tr>
<tr>
	<td width="20%" style="padding-bottom:10px">
		<font class="DialogLabel">Type:</font>
	</td>
	<td width="80%" style="padding-bottom:10px">
		<select id="cboActionType" name="cboActionType" onchange="HandleUIByType()" style="width:90%">
			<option id="0">Possible Values</option>
			<option id="1">Dependent Values</option>
			<option id="2">Hidden Fields</option>
			<option id="3">Required Fields</option>
			<option id="5">Disabled Fields</option>
			<option id="4">Hidden Tabs</option>
			<option id="6">Disable Ticket</option>
		</select>
	</td>
</tr>
<tr>
	<td width="20%" valign="top" style="padding-bottom:10px">
		<font class="DialogLabel">Description:</font>
	</td>
	<td width="80%" style="padding-bottom:10px">
		<textarea name="txtGroupDesc" id="txtGroupDesc" style="width:90%" class="AdminTextBoxWidth" onmouseover="this.className='AdminTextBoxWidthHover';" onmouseout="this.className='AdminTextBoxWidth';" rows="5" cols="22" onkeypress="Pressed()"></textarea>
	</td>
</tr>
<tr>
	<td colspan="2" style="padding-right:20px"><hr class="LineSep" /></td>
</tr>

<tr>
	<td width="20%" valign="top" style="padding-top:10px; padding-bottom:10px">
		<font class="DialogLabel">Condition Fields:</font>
	</td>
	<td width="80%" style="padding-top:10px; padding-bottom:10px">
		<div class="FieldWithButton">
			<textarea  class='LargeList' mqcontroltype='LargeList' multiline readonly style="height:100px;"  name='CondFields' id='CondFields' width='30'></textarea>
			<script type='text/javascript'>
				var strURL="WCDisplayChoices.asp?WCI=DisplayChoices&TBL=tblDtsFields&DS=64&CO=0&AddWhere=" + 
								g_MqRef.MqStr.MqEncodeURIComponent(strCondFieldsAddWhere) + "&AddUnion=" + 
								g_MqRef.MqStr.MqEncodeURIComponent(strCondFieldsAddUnion);
				AddURLButton("LoadLargeListOrCombo(1, 'Condition Fields',strURL,'tblDtsFields', null, null, null, null, null, null, true)",
						"BrowseAlternateChoiceList","1","CondFields", null, m_objRef);
			</script>
		</div>
	</td>
</tr>

<tr id="ActionFlds" name="ActionFlds">
	<td width="20%" valign="top" style="padding-top:10px; padding-bottom:10px">
		<font class="DialogLabel">Action Fields:</font>
	</td>
	<td width="80%" style="padding-top:10px; padding-bottom:10px">
		<div class="FieldWithButton">
			<textarea  class='LargeList' mqcontroltype='LargeList' multiline readonly style="height:100px;"  name='ActionFields' id='ActionFields' width='30'></textarea>
			<script type='text/javascript'>
				AddURLButton('LoadLargeListOrCombo(2, \'Action Fields\',\'WCDisplayChoices.asp?WCI=DisplayChoices&TBL=tblDtsFields&DS=64&CO=0&AddWhere=' + g_MqRef.MqStr.MqEncodeURIComponent(strActionFieldsAddWhere) + '\',\'tblDtsFields\', null, null, null, null, null, null, true)','BrowseAlternateChoiceList','2','ActionFields', null, m_objRef);
			</script>
		</div>
	</td>
</tr>

<tr>
	<td colspan="2">
		<table width="100%">
			<tr>
				<td width="75%">
					<input id="chkState" type="checkbox" 
					title="Enable in all Web views of the project" checked>
					<span class="DialogLabel" onclick="ToggleChk('chkState')">Enable in all Web views of the project</span>
				</td>
				<td align="right" rowspan="2" valign="bottom">
					<script type="text/javascript">
						m_objMqButton.WriteTextButtonHTML("OK", g_MqRef.RESX["BUTTON_OK"], 'SaveGroup()', "", 32, "", g_MqRef.RESX["BUTTON_OK"], 90);
					</script>
				</td>
				<td align="right" rowspan="2" valign="bottom">
					<script type="text/javascript">
						m_objMqButton.WriteTextButtonHTML("Close", g_MqRef.RESX["BUTTON_CLOSE"], 'parent.CloseModalWindow()', "", 32, "", g_MqRef.RESX["BUTTON_CLOSE"], 90);
					</script>
				</td>
			</tr>

			<tr>
				<td>
					<input id="chkTrigger" type="checkbox" title="Evaluate when users change field values">
					<font class="DialogLabel" onclick="ToggleChk('chkTrigger')">Evaluate when users change field values</font>
				</td>
			</tr>
		</table>
	</td>
</tr>
</table>

<div style="visibility: hidden;display:none">
	<div id="dialog-modal" style="width:100%;height:100%;padding:0px;margin:0px;overflow:hidden">
		<iframe id="dialog-modal-url" width="100%" height="100%" marginWidth="0" marginHeight="0" frameBorder="0" scrolling="auto"></iframe>
	</div>
	<div id="dialog-modal-orig-width" name="dialog-modal-orig-width" style="display:none"></div>
	<div id="dialog-modal-orig-height" name="dialog-modal-orig-height" style="display:none"></div>
</div>
</body>
</html>