<!-- confidentiality.vm -->

#set ($notset_text = $CommonFunctions.displayTermFromResourceBundle($currentUserId, "Controls", "controls.common.notset"))
#set ($accesslist_text = $CommonFunctions.displayTermFromResourceBundle($currentUserId, "ProjectDialogs", "confidentiality.access_list"))

<html>
	<head>
		
		#parse ("viewconstants.vm")
		
		<title>$CommonFunctions.displayTermFromResourceBundle($currentUserId, "ProjectDialogs", "confidentiality.windowtitle")</title>

		<link type="text/css" rel="stylesheet" href="../themes/$theme/main.css" />
	    <link type="text/css" rel="stylesheet" href="../themes/$theme/xmenu.css" />
	    <link type="text/css" rel="stylesheet" href="../themes/$theme/xlistbox.css" />
	    <link type="text/css" rel="stylesheet" href="../themes/$theme/standardtable.css" />

		#parse("common_js.vm")
		#parse("systemmanager_js.vm")
		<script type="text/javascript" src="../common/system/systemmanager.js"></script>
		<script type="text/javascript" src="../common/system/communication.js"></script>
		<script type="text/javascript" src="../common/application/itimpact/projectmanager.js"></script>
		<script type="text/javascript" src="../common/system/modalwindow.js"></script>
		#parse("itimpactdialogs_js.vm")
		<script type="text/javascript" src="../common/application/itimpact/itimpactdialogs.js"></script>
		<script type="text/javascript" src="../common/system/legautils.js"></script>
        #parse ("xlistbox.vm")
		<script type="text/javascript" src="../common/system/xlistbox.js"></script>
		<script type="text/javascript" src="../common/system/chooser.js"></script>
		<script type="text/javascript" src="../common/system/xmenu.js"></script>
		<script type="text/javascript" src="../common/system/scrollingtable.js"></script>
        #parse ("changedetector.vm")
		<script type="text/javascript" src="../common/system/changedetector.js"></script>
		<script type="text/javascript">

			var lpcp = null ;
			var dcd = new DocumentChangeDetector() ;
			var origListBoxItems = "" ;

			function init()
			{
				initSystemManager() ;
				lpcp = new LPCP(document.formPosting);
				initScrollingTable() ;

            #if ($canSpecifyConfidentiality)
				origListBoxItems = listbox.getValuesStringFormat() ;
			#end

				// Initialize the change detector.
				dcd.init()
			}

			var confidentiality = "$pCon.getConfidentiality()";
			var accessList = "$pCon.getAccessList()";
						
			function getAccessList()
			{
				return accessList ;
			}

			function setAccessList(id)
			{
				accessList = id ;
			}

			function showMenu()
			{
			}

			function hasFormChanges()
			{
				var result = dcd.checkForChanges() ;

				#if ($canSpecifyConfidentiality)
					var values =  listbox.getValuesStringFormat() ;
					result = result || (origListBoxItems != values) ;
				#end

				return result ;
			}

			#if ($canSpecifyConfidentiality)

				function applyChooserSettings(nameList, idList, controlId)
				{
					var listControl = eval(controlId);

					if (listControl)
					{
						listControl.reset();

						listControl.addFromStringList(nameList, idList, true);

						listControl.refresh();

						// Update the chooser control with the selected items.
						var selectedItems = listControl.getValuesStringFormat() ;

	                    chooser.updateSelectedItems(selectedItems) ;
						setAccessList(selectedItems) ;
					}
				}

				function setProjectInfoByUser()
				{
					if (hasFormChanges())
					{
						var projectManager 		= new ProjectManager() ;


						var changeComment = "" ;
						if (document.all.changeComment)
							changeComment = document.all.changeComment.value ;
							
							
						confidentiality = document.all.statusList.options[document.all.statusList.selectedIndex].value ;

																						  
						var xmlMethodSignature = projectManager.setParticipation('$projectID', '', '', '', '','', changeComment, '', '', confidentiality, accessList);
					
						lpcp.invoke(xmlMethodSignature) ;
					}
					else
					{
						window.close() ;
					}
				}
			#end

			function closeWindow()
			{
				var closeWin = true ;

				#if ($canSpecifyConfidentiality)
					if (hasFormChanges())
					{
						closeWin = confirm(dcd.getMessage()) ;
					}
				#end

				if (closeWin)
				{
					close() ;
				}
			}

/*-----------------------------------------------------------------------------\
|									T A B L E 								   |
\-----------------------------------------------------------------------------*/

			/* HISTORY TABLE */
			var history			 = new TableInfo() 	  			;
			history.name    	 = "history" 					;
			history.hasSliderBar = false    					;
			history.infoHeader   = 1        			 		;
			history.hasEntries	 = $projectLogSet.size() > 0	;
			history.isAscending	 = false			  			;

			// Table Declarations
			scrollingTables[0] = history ;

            function getActiveHeader(currentTable)
		    {
		    	var activeHeader = document.all.historyheader1 ;
				return activeHeader ;
		    }

		</script>
  	</head>


	<body onload="init()" onresize="resizeAllTables()">
	 	<form id='formPosting' name='formPosting' method='post' action='../servlet/LPCPRouter'>
			<input type='hidden' name='xmlMethodSignature'/>
		</form>
		<table style="border-collapse:collapse;width:100%;height:100%">
			<tr>
				<td style="padding:0px;height:auto">
					<script>
						/*-----------------------------------------------------------------\
						|								M E N U							   |
						\-----------------------------------------------------------------*/

						var menubar = new XMenuBar("menubar","left") ;
						#if ($canSpecifyConfidentiality)
			           		var menuButtonSave = new XMenuButton("$CommonFunctions.displayTermFromResourceBundle($currentUserId, "Controls", "controls.buttons.save.label")","../themes/$theme/images/save16x16.gif","setProjectInfoByUser()","$CommonFunctions.displayTermFromResourceBundle($currentUserId, "Controls", "controls.buttons.save.hint")") ;
							menubar.add(menuButtonSave) ;
						#end
			           	var menuButtonClose = new XMenuButton("$CommonFunctions.displayTermFromResourceBundle($currentUserId, "Controls", "controls.buttons.cancel.label")","../themes/default/images/cancel16x16.gif","closeWindow()","$CommonFunctions.displayTermFromResourceBundle($currentUserId, "Controls", "controls.buttons.cancel.hint")") ;
						menubar.add(menuButtonClose) ;
						menubar.draw() ;
					</script>
				</td>
			</tr>
			<tr>
				<td style="height:auto;padding:5px">
					<table style="border-collapse:collapse;width:100%">
						<tr>
							<td style="padding:0px;border:1px solid black;width:100%;background-image:url('../themes/$theme/images/top.png');text-align:center">
								<span class="systemLabel">
									$CommonFunctions.displayTermFromResourceBundle($currentUserId, "ProjectDialogs", "confidentiality.headertitle")
								</span>
							</td>
						</tr>
						<tr>
							<td style="padding:0px;border:1px solid black;width:100%">
		               			<table style="border-collapse:collapse;width:100%;background-color:#FFFFFF">
		               				<tr>
		  								<td style="white-space:nowrap" class="systemLabel">&nbsp;$CommonFunctions.getDisplayReadyLabel("Project"):&nbsp;</td>
		  								<td style="width:100%" class="systemText">&nbsp;$CommonFunctions.displayReady($projectName)</td>
		  							</tr>
									<tr>
										<td style="white-space:nowrap" class="systemLabel">&nbsp;$CommonFunctions.getDisplayReadyLabel("Confidentiality"):&nbsp;</td>
		  								<td style="width:100%" class="systemText">&nbsp;#if ($pCon.getConfidentiality().length() == 0)$notset_text#else$CommonFunctions.displayReady($pCon.getConfidentiality())#end</td>
		  							</tr>
								</table>
							</td>
						</tr>
					</table>
				</td>
			</tr>
			
		#if ($canSpecifyConfidentiality)
		
			<tr>
				<td style="height:auto;padding:5px">
					<table style="border-collapse:collapse;width:100%">
						<tr>
							<td style="padding:0px;border:1px solid black;width:100%;background-image:url('../themes/$theme/images/top.png');text-align:center">
								<span class="systemLabel">
									$CommonFunctions.displayTermFromResourceBundle($currentUserId, "ProjectDialogs", "confidentiality.modifysettings")
								</span>
							</td>
						</tr>
						
						<tr>
							<td style="border:1px solid black">
					       		<table style="border-collapse:collapse;width:100%;background-color:#FFFFFF">
					       		
									<tr>
						     			<td style="width:auto;white-space:nowrap">
						     				<span class="systemLabel">
										 		$CommonFunctions.getDisplayReadyLabel("Confidentiality"):
										 	</span>
										</td>
							        	<td style="width:100%">
											<select class="formControl" id='statusList' name='statusList'>
												#if ( ($pCon.getConfidentiality().length() == 0) || ($pCon.getConfidentiality().equals("No")) )
													<option value='No' selected> $CommonFunctions.displayTermFromResourceBundle($currentUserId, "Controls", "controls.common.no") </option>
												#else
													<option value='No'> $CommonFunctions.displayTermFromResourceBundle($currentUserId, "Controls", "controls.common.no") </option>
												#end
												
												#if ($pCon.getConfidentiality().equals("Yes"))
													<option value='Yes' selected> $CommonFunctions.displayTermFromResourceBundle($currentUserId, "Controls", "controls.common.yes") </option>
												#else
													<option value='Yes'> $CommonFunctions.displayTermFromResourceBundle($currentUserId, "Controls", "controls.common.yes") </option>
												#end
							                </select>
										</td>
						     		</tr>
						     		
						     		<tr>
										<td colspan='2' class='tablebodyhint' align='left' style="padding:0px;border:1px solid black;width:100%;">
											$CommonFunctions.displayTermFromResourceBundle($currentUserId, "ProjectDialogs", "getcoredatadetail.generalinfoconfidentiality.instruction")
                                			<br>$CommonFunctions.displayTermFromResourceBundle($currentUserId, "ProjectDialogs", "getcoredatadetail.generalinfoconfidentiality.line1")
                                			<br>$CommonFunctions.displayTermFromResourceBundle($currentUserId, "ProjectDialogs", "getcoredatadetail.generalinfoconfidentiality.line2")
                                			<br>$CommonFunctions.displayTermFromResourceBundle($currentUserId, "ProjectDialogs", "getcoredatadetail.generalinfoconfidentiality.line3")
										</td>
									</tr>
					       			
						       		<tr valign='top'>
						            	<td style="white-space:nowrap;vertical-align:top">
											<span class="systemLabel">
												$CommonFunctions.displayTermFromResourceBundle($currentUserId, "ProjectDialogs", "confidentiality.accesslist")&nbsp;
											</span>
										</td>

							     		<td style="width:100%; height:100px; padding:0px">
								     		<script>
												var chooser = new Chooser('USER', '$pCon.getAccessList()', "listbox") ;

												var listbox = new XListBox("listbox") ;
												listbox.setActionHandler("chooser.launch()","$CommonFunctions.getEncodedTermFromResourceBundle($currentUserId, "Controls", "controls.buttons.addremove.label")");

												#foreach ($item in $selectedItems)
													listbox.add("$CommonFunctions.displayReady($item.getName())","$item.getId()") ;
												#end

                                                listbox.configMenubar("top","left") ;
												listbox.draw() ;
											</script>
										</td>
						     		</tr>
									<tr valign='top'>
										<td style="white-space:nowrap">
											<span class="systemLabel">
												$CommonFunctions.displayTermFromResourceBundle($currentUserId, "ProjectDialogs", "confidentiality.changecomment")
											</span>
										</td>
				 						<td style="width:100%; padding:0px">
										 	<textarea id='changeComment' name='changeComment' class="formControl" wrap style="height:50px;overflow:auto"></textarea>
										</td>
									</tr>
					        	</table>
							</td>
						</tr>
						
						
					</table>
				</td>
			</tr>
		#end
		
			<tr>
				<td style="height:100%">
  					<table style="border-collapse:collapse;width:100%;height:100%">
						<tr>
							<td style="padding:5x;width:100%;height:100%">
								#set ($projectLogList = $projectLogSet)
								<table class="mainTable">
									<tr>
										<td class="tableTitleBarContainer">
											<table class="tableTitleBar">
												<tr>
													<td style="padding:0px;width:100%;text-align:center;background-image:url('../themes/$theme/images/top.png')">
														<span class="systemLabel">
															$CommonFunctions.displayTermFromResourceBundle($currentUserId, "ProjectDialogs", "confidentiality.headerhistoryofchanges")
														</span>
													</td>
													<td class="tableTitleControlsContainer"></td>
												</tr>
											</table>
										</td>
									</tr>

									<tr>
										<td class="tableBodyContainer">
											<table class="tableBody">
												<tr>
													<td class="tableHeaderContainer">
														<div id="historyheaderDiv" class="headerDiv">
															<table class="tableHeader">
																<tr>
																	<td id="historyheader1" class="tableHeaderElementLeft" name=""><span id="historyheader1SortImage"></span><span class="tableHeaderText">$CommonFunctions.displayTermFromResourceBundle($currentUserId, "ProjectDialogs", "changelog.columndatetime")</span></td>
																	<td id="historyheader2" class="tableHeaderElement" name=""><span id="historyheader2SortImage"></span><span class="tableHeaderText">$CommonFunctions.displayTermFromResourceBundle($currentUserId, "ProjectDialogs", "changelog.columnattribute")</span></td>
																	<td id="historyheader3" class="tableHeaderElement" name=""><span id="historyheader3SortImage"></span><span class="tableHeaderText">$CommonFunctions.displayTermFromResourceBundle($currentUserId, "ProjectDialogs", "changelog.columnchangedby")</span></td>
																	<td id="historyheader4" class="tableHeaderElement" name=""><span id="historyheader4SortImage"></span><span class="tableHeaderText">$CommonFunctions.displayTermFromResourceBundle($currentUserId, "ProjectDialogs", "changelog.columnchangedto")</span></td>
																	<td id="historyheader5" class="tableHeaderElement" name=""><span id="historyheader5SortImage"></span><span class="tableHeaderText">$CommonFunctions.displayTermFromResourceBundle($currentUserId, "ProjectDialogs", "changelog.columncomment")</span></td>
																	<td id="historyheaderspacer" class="tableHeaderScrollingSpacer"></td>
																</tr>
															</table>
														</div>
													</td>
												</tr>
												<tr>
													<td class="tableBodyContentContainer">
														<div id="historyscrolling_div" class="scrolling_div" onscroll="updateHeaderPositions('history')">
															<table id="historytableBodyContent" class="tableBodyContent">

															#if ($isPrinting)
																<tr>
																	<td id="historyheader1" class="tableHeaderElementLeft" name=""><span id="historyheader1SortImage"></span><span class="tableHeaderText">$CommonFunctions.displayTermFromResourceBundle($currentUserId, "ProjectDialogs", "changelog.columndatetime")</span></td>
																	<td id="historyheader2" class="tableHeaderElement" name=""><span id="historyheader2SortImage"></span><span class="tableHeaderText">$CommonFunctions.displayTermFromResourceBundle($currentUserId, "ProjectDialogs", "changelog.coilmnattribute")</span></td>
																	<td id="historyheader3" class="tableHeaderElement" name=""><span id="historyheader3SortImage"></span><span class="tableHeaderText">$CommonFunctions.displayTermFromResourceBundle($currentUserId, "ProjectDialogs", "changelog.columnchangedby")</span></td>
																	<td id="historyheader4" class="tableHeaderElement" name=""><span id="historyheader4SortImage"></span><span class="tableHeaderText">$CommonFunctions.displayTermFromResourceBundle($currentUserId, "ProjectDialogs", "changelog.columnchangedto")</span></td>
																	<td id="historyheader5" class="tableHeaderElementRight" name=""><span id="historyheader5SortImage"></span><span class="tableHeaderText">$CommonFunctions.displayTermFromResourceBundle($currentUserId, "ProjectDialogs", "changelog.columncomment")</span></td>
																</tr>
															#end

								                            #foreach ($projectLog in $projectLogList)
								                            
								                      		#set ($imgSrc = "../themes/$theme/images/commentempty.gif")
								                            #if ($projectLog.getChangeComment().length() >0)
								                            	#set ($imgSrc = "../themes/$theme/images/comment.gif")
								                            #end
																<tr onmouseover="onMouseOverSTRow(this)" onmouseout="onMouseOutSTRow(this)">
																	<td class="tableBodyContentElementLeft" name=""><span class="systemText">$CommonFunctions.formatDate($currentUserId,$projectLog.getLogTime())</span></td>
																	<td class="tableBodyContentElement" name=""><span class="systemText">#if ($projectLog.getAttrName().equals("AccessList"))Access List#else$CommonFunctions.getDisplayReadyLabel("Confidentiality")#end</span></td>
																	<td class="tableBodyContentElement" name=""><span class="systemText">$CommonFunctions.displayReady($projectLog.getFullName())</span></td>
																	<td class="tableBodyContentElement" name=""><span class="systemText">#if ($projectLog.getAttrValue().length() == 0)$notset_text#else #if ($projectLog.getAttrName().equals("AccessList")) $accesslist_text #else$CommonFunctions.displayReady($projectLog.getAttrValue())#end#end</span></td>
																	<td class="tableBodyContentElement" name="" style="text-align:center"><span class="systemText"><a href="javascript:showCommentDialog('$projectLog.getProjectId()', '$projectLog.getLogId()')"><img src='$imgSrc' border='0' ALT='$CommonFunctions.displayReady($projectLog.getChangeComment())'></a></span></td>
																</tr>
															#end

																<tr id="historysizerContainer" class="sizerContainer">
																	<td id="historybody1" class="sizerElement"><span class="tableHeaderText">$CommonFunctions.displayTermFromResourceBundle($currentUserId, "ProjectDialogs", "changelog.columndatetime")</span></td>
																	<td id="historybody2" class="sizerElement"><span class="tableHeaderText">$CommonFunctions.displayTermFromResourceBundle($currentUserId, "ProjectDialogs", "changelog.columnattribute")</span></td>
																	<td id="historybody3" class="sizerElement"><span class="tableHeaderText">$CommonFunctions.displayTermFromResourceBundle($currentUserId, "ProjectDialogs", "changelog.columnchangedby")</span></td>
																	<td id="historybody4" class="sizerElement"><span class="tableHeaderText">$CommonFunctions.displayTermFromResourceBundle($currentUserId, "ProjectDialogs", "changelog.columnchangedto")</span></td>
																	<td id="historybody5" class="sizerElement"><span class="tableHeaderText">$CommonFunctions.displayTermFromResourceBundle($currentUserId, "ProjectDialogs", "changelog.columncomment")</span></td>
																</tr>
															</table>
														</div>
													</td>
												</tr>
											</table>
										</td>
									</tr>
								</table>
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>

#if (!$isPrinting)
	<script type="text/javascript">
		history.headerCount = getHeaderCount("history") ;
	</script>
#end
	</body>
</html>