##<!-- $Header: /cvs/sakai2/legacy/tools/src/webapp/vm/sitesetup/chef_site-changeRoles.vm,v 1.2 2005/05/19 19:55:05 gsilver.umich.edu Exp $ -->
## Change Roles Change the roles of participants of the worksite
<div class ="chefPortletContainer">
	<h3>
		$tlang.getString("chrol.changing") $validator.escapeHtml($siteTitle)...
	</h3>
	<div class ="chefPortletContent">
		#if ($alertMessage)
			<div class="alertMessage">$tlang.getString("gen.alert") $validator.escapeHtml($alertMessage)</div>
			<div class="clear"></div>
		#end
		<form name="roleForm" action="#toolForm("SiteAction")" method="post">
			<input type="hidden" name="option" value="x" /> 
			<input type="hidden" name="eventSubmit_doSiteinfo_edit_role" value="x" />
			#if ($participantSelectedList.size() == 1)
				## only change one user's role?
				<div class="chefPageviewTitle">
					$tlang.getString("chrol.selected")
				</div>
				<table class ="chefItemDetail">
					#foreach($participant in $participantSelectedList)
						<tr>
							<td class="chefLabel">
								$tlang.getString("chrol.partic")
							</td>
							<td>
								$participant.getName()
							</td>
						</tr>
						<tr>
							<td class="chefLabel">
								$tlang.getString("addconf.username"):
							</td>
							<td>
								$participant.getDisplayId()
							</td>
						</tr>
						<tr>
							<td class="chefLabel">
								$tlang.getString("chrol.current")
							</td>
							<td>
								#foreach ($role in $roles)
									#if($participant.hasRole($role.getId())) 
										$role.getId()<br />
									#end
								#end
							</td>
						</tr>
					#end
				</table>
				<fieldset style="width:50%">
					<legend>
						$tlang.getString("addsame.roles")
					</legend>
					<div style="float:right;text-align:right">
						<a href="$config.getString("help.rolesurl")" target="umcthelp" onclick="sitehelp('$config.getString("help.rolesurl")');return false" title="Help on roles" ><img src = "#imageLink("help.gif")" border="0" alt ="$tlang.getString('java.help')" /></a>
					</div>
					<table cellspacing="0" cellpadding="0" class="chefEditItem" summary ="Table holds checkboxes for different roles." >
						#foreach ($role in $roles)
							<tr>
								<td valign="middle" nowrap="nowrap">
									<input type="radio" name="role_to_all" value="$role.Id" 
										#if ($currentRole == $role.Id)
											checked="checked"
										#end
									/>
									$role.Id
								</td>
								<td valign="middle" nowrap="nowrap">
									<div class="instruction">
										#set($description = "")
										#set($description = $role.Description)
										$!description
									</div>
								</td>
							</tr>
						#end
					</table>
				</fieldset>
			#else
				##multiple users' change
				<table cellspacing="0" cellpadding="0" class="chefEditItem" summary ="Table holds fields for entering users." >
					<tr>
						<td>
							<input type="radio" name="same" value="true" 
								#if ($same_role)
									checked="checked"
								#end
								onClick="document.roleForm.option.value='same_role_true';javascript:document.roleForm.submit();"
							/>
							$tlang.getString('chrol.change')
						</td>
					</tr>
					<tr>
						<td>
							<input type="radio" name="same_role" value="false" 
								#if (!$same_role)
									checked="checked"
								#end
								onClick="document.roleForm.option.value='same_role_false';javascript:document.roleForm.submit();"
							/>
							$tlang.getString("chrol.indiv")
						</td>
					</tr>
				</table>
				<br />
				#if ($same_role)
					## change all participant role
					<fieldset style="width:50%">
						<legend>
							$tlang.getString("addsame.participants")
						</legend>
						<div style="float:right;text-align:right">
							<a href="$config.getString("help.rolesurl")" target="umcthelp" onclick="sitehelp('$config.getString("help.rolesurl")');return false" title="$tlang.getString('chrol.help')" ><img src = "#imageLink("help.gif")" border="0" alt ="$tlang.getString('java.help')" /></a>
						</div>
						<table cellspacing="0" cellpadding="0" class="chefEditItem" summary ="Table holds checkboxes for different roles." >
							#foreach ($role in $roles)
								<tr>
									<td valign="middle" nowrap="nowrap">
										<input type="radio" name="role_to_all" value="$role.Id" 
											#if ($currentRole == $role.Id)
												checked="checked"
											#end
										/>
										$role.Id
									</td>
									<td valign="middle" nowrap="nowrap">
										<div class="instruction">
											#set($description = "")
											#set($description = $role.Description)
											$!description
										</div>
									</td>
								</tr>
							#end
						</table>
						<br />
						<table class ="chefFlatListViewTable" cellspacing="0" summary ="Table holds information of selected participants and their roles">
							<tr>
								<th id="name">
									$tlang.getString("addconf.name")
								</th>
								<th id="uniqname">
									$tlang.getString("chrol.uniq")
								</th>
								<th id="id">
									$tlang.getString("addsame.roles")
									<a href="$config.getString("help.rolesurl")" target="umcthelp" onclick="sitehelp('$config.getString("help.rolesurl")');return false" title="$tlang.getString('chrol.help')" ><img src = "#imageLink("help.gif")" border="0" alt ="$tlang.getString('java.help')" /></a>
								</th>
							</tr>
							#foreach($participant in $participantSelectedList)
								<tr>
									<td headers="name">
										$participant.getName()
									</td>
									<td headers="uniqname">
										$participant.getDisplayId()
									</td>
									<td headers="id">
										#set($role = "")
										#set($role = $participant.getRole())
										$!role
									</td>
								</tr>
							#end
						</table>
						<br/>
					</fieldset>
				#else
					## change roles individually 
					<table class ="chefFlatListViewTable" cellspacing="0" summary ="Table holds information of selected participants and their roles">
						<tr>
							<th id="name">
								$tlang.getString("addconf.name")
							</th>
							<th id="uniqname">
								$tlang.getString("chrol.uniq")
							</th>
							<th id="id">
								$tlang.getString("addsame.roles")
								<a href="$config.getString("help.rolesurl")" target="umcthelp" onclick="sitehelp('$config.getString("help.rolesurl")');return false" title="$tlang.getString('chrol.help')" ><img src = "#imageLink("help.gif")" border="0" alt ="$tlang.getString('java.help')" /></a>
							</th>
						</tr>
						#foreach($participant in $participantSelectedList)
							#set($uniqname = "")
							#set($uniqname=$participant.getUniqname())
							#set($oRole = "")
							#set($oRole = $participant.getRole())
							<tr>
								<td headers="name">
									$participant.getName()
								</td>
								<td headers="uniqname">
									$participant.getDisplayId()
								</td>
								<td>
									<select name="role$uniqname">
										#foreach($role in $roles)
											<option value ="$role.Id"
												#if($role.Id == $oRole)
													selected="selected"
												#end
											>
												$role.Id
											</option>
										#end
									</select>
								</td>
							</tr>
						#end
					</table>
					<table cellspacing="0" cellpadding="0" class="chefEditItem" summary ="Table holds a text box for entering associated role." >
						<tr>
							<td colspan="2">
							$tlang.getString("chrol.descr")
							</td>
						</tr>
						<tr>
							<td colspan="2">
								&nbsp;
							</td>
						</tr>
						#foreach ($role in $roles)
							<tr>
								<td>
									$role.Id
								</td>
								<td>
									<div class="instruction">
										#set($description = "")
										#set($description = $role.Description)
										$!description
									</div>
								</td>
							</tr>
						#end
					</table>
				#end
			#end
			<br/>
			<input type="hidden" name="back" value="18" />
			<input type="hidden" name="template-index" value="7" />
			<input type="hidden" name="continue" value="25" />
			<div class ="act">
				<input type="button" name="Continue" 
						value="$tlang.getString('gen.continue')" 
						onclick="document.roleForm.option.value='continue';javascript:document.roleForm.submit();" />
				<input type="button" name="Back" 
						value="$tlang.getString('gen.back')" 
						onclick="document.roleForm.option.value='back';javascript:document.roleForm.submit();" />
				<input type="button" name="Cancel" 
						value="$tlang.getString('gen.cancel')" 
						onclick="document.roleForm.option.value='cancel';javascript:document.roleForm.submit();" />
			</div>
		</form>
	</div>
</div>
