<commit_before><%-- 
 * UniTime 3.1 (University Timetabling Application)
 * Copyright (C) 2008, UniTime LLC
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 --%>
<%@ page language="java" autoFlush="true" errorPage="../error.jsp" %>
<%@ page import="org.unitime.timetable.form.EditRoomForm" %>
<%@ page import="org.apache.struts.util.LabelValueBean" %>
<%@ page import="org.unitime.timetable.util.Constants" %>
<%@ page import="org.unitime.timetable.model.Department" %>
<%@ page import="org.unitime.timetable.model.Building" %>
<%@ page import="org.unitime.commons.web.Web" %>
<%@ page import="org.unitime.timetable.model.Roles" %>
<%@ taglib uri="/WEB-INF/tld/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tld/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tld/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tld/struts-tiles.tld" prefix="tiles" %>
<%@ taglib uri="/WEB-INF/tld/timetable.tld" prefix="tt" %>

<%
	// Get Form 
	String frmName = "editRoomForm";	
	EditRoomForm frm = (EditRoomForm) request.getAttribute(frmName);
	boolean admin = Web.hasRole(request.getSession(), new String[] { Roles.ADMIN_ROLE});
	boolean examMgr = Web.hasRole(request.getSession(), new String[] { Roles.EXAM_MGR_ROLE});
%>	

<tiles:importAttribute />
<html:form action="/editRoom" focus="name">
	<html:hidden property="id"/>

	<TABLE width="93%" border="0" cellspacing="0" cellpadding="3">
		<TR>
			<TD valign="middle" colspan='2'>
				<tt:section-header>
					<logic:empty name="<%=frmName%>" property="id">
						<html:submit property="doit" onclick="displayLoading();" styleClass="btn" accesskey="S" titleKey="title.saveRoom">
							<bean:message key="button.save" />
						</html:submit>
					</logic:empty>
					<logic:notEmpty name="<%=frmName%>" property="id">
						<html:submit property="doit" onclick="displayLoading();" styleClass="btn" accesskey="U" titleKey="title.updateRoom">
							<bean:message key="button.update" />
						</html:submit>
					</logic:notEmpty>
					&nbsp;
					<html:submit property="doit" onclick="displayLoading();" styleClass="btn" accesskey="B" titleKey="title.returnToRoomList">
						<bean:message key="button.returnToRoomDetail" />
					</html:submit>
				</tt:section-header>
			</TD>
		</TR>

		<logic:messagesPresent>
			<TR>
				<TD colspan="2" align="left" class="errorCell">
						<B><U>ERRORS</U></B><BR>
					<BLOCKQUOTE>
					<UL>
					    <html:messages id="error">
					      <LI>
							${error}
					      </LI>
					    </html:messages>
				    </UL>
				    </BLOCKQUOTE>
				</TD>
			</TR>
		</logic:messagesPresent>
		
		<logic:empty name="<%=frmName%>" property="id">
			<TR>
				<TD>Building:</TD>
				<TD width='100%'>
					<html:select property="bldgId" onchange="javascript: buldingChanged(this.value);">
						<html:option value="<%=Constants.BLANK_OPTION_VALUE%>"><%=Constants.BLANK_OPTION_LABEL%></html:option>
						<html:options collection="<%=Building.BLDG_LIST_ATTR_NAME%>" property="value" labelProperty="label"/>
					</html:select>
				<TD>
			</TR>

			<TR>
				<TD>Room Number:</TD>
				<TD width='100%'>
					<html:text property="name" maxlength="20" size="20" />
				<TD>
			</TR>

			<TR>
				<TD nowrap>Department:</TD>
				<TD>
					<html:select property="controlDept">
						<html:options collection="<%=Department.DEPT_ATTR_NAME%>" property="value" labelProperty="label"/>
					</html:select>
				</TD>
			</TR>
		</logic:empty>
		
		
		<logic:notEmpty name="<%=frmName%>" property="id">
			<TR>
				<TD>Name:</TD>
				<% if (examMgr) { %>
					<TD width='100%'>
						<bean:write name="<%=frmName%>" property="bldgName"/>
						<bean:write name="<%=frmName%>" property="name"/>
						<html:hidden property="name"/>
					<TD>
				<% } else {%>
				<TD width='100%'>
					<bean:write name="<%=frmName%>" property="bldgName"/>
					<html:text property="name" maxlength="20" size="20" />
				<TD>
				<% } %>
			</TR>
		</logic:notEmpty>
			
		<logic:equal name="<%=frmName%>" property="room" value="true">
			<% if (admin) { %>
				<TR>
					<TD>External Id:</TD>
					<TD width='100%'>
						<html:text property="externalId" maxlength="40" size="40" />
					<TD>
				</TR>
			<% } else { %>
				<html:hidden property="externalId"/>
			<% } %>
		</logic:equal>
		
		<% if (admin) { %>
			<TR>
				<TD>Type:</TD>
				<TD width='100%'>
					<html:select property="type">
						<html:optionsCollection property="roomTypes" label="label" value="uniqueId"/><commit_msg>non-university location name can be long up to 20 characters room number can be long up to 10 characters<commit_after><%-- 
 * UniTime 3.1 (University Timetabling Application)
 * Copyright (C) 2008, UniTime LLC
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 --%>
<%@ page language="java" autoFlush="true" errorPage="../error.jsp" %>
<%@ page import="org.unitime.timetable.form.EditRoomForm" %>
<%@ page import="org.apache.struts.util.LabelValueBean" %>
<%@ page import="org.unitime.timetable.util.Constants" %>
<%@ page import="org.unitime.timetable.model.Department" %>
<%@ page import="org.unitime.timetable.model.Building" %>
<%@ page import="org.unitime.commons.web.Web" %>
<%@ page import="org.unitime.timetable.model.Roles" %>
<%@ taglib uri="/WEB-INF/tld/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tld/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tld/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tld/struts-tiles.tld" prefix="tiles" %>
<%@ taglib uri="/WEB-INF/tld/timetable.tld" prefix="tt" %>

<%
	// Get Form 
	String frmName = "editRoomForm";	
	EditRoomForm frm = (EditRoomForm) request.getAttribute(frmName);
	boolean admin = Web.hasRole(request.getSession(), new String[] { Roles.ADMIN_ROLE});
	boolean examMgr = Web.hasRole(request.getSession(), new String[] { Roles.EXAM_MGR_ROLE});
%>	

<tiles:importAttribute />
<html:form action="/editRoom" focus="name">
	<html:hidden property="id"/>

	<TABLE width="93%" border="0" cellspacing="0" cellpadding="3">
		<TR>
			<TD valign="middle" colspan='2'>
				<tt:section-header>
					<logic:empty name="<%=frmName%>" property="id">
						<html:submit property="doit" onclick="displayLoading();" styleClass="btn" accesskey="S" titleKey="title.saveRoom">
							<bean:message key="button.save" />
						</html:submit>
					</logic:empty>
					<logic:notEmpty name="<%=frmName%>" property="id">
						<html:submit property="doit" onclick="displayLoading();" styleClass="btn" accesskey="U" titleKey="title.updateRoom">
							<bean:message key="button.update" />
						</html:submit>
					</logic:notEmpty>
					&nbsp;
					<html:submit property="doit" onclick="displayLoading();" styleClass="btn" accesskey="B" titleKey="title.returnToRoomList">
						<bean:message key="button.returnToRoomDetail" />
					</html:submit>
				</tt:section-header>
			</TD>
		</TR>

		<logic:messagesPresent>
			<TR>
				<TD colspan="2" align="left" class="errorCell">
						<B><U>ERRORS</U></B><BR>
					<BLOCKQUOTE>
					<UL>
					    <html:messages id="error">
					      <LI>
							${error}
					      </LI>
					    </html:messages>
				    </UL>
				    </BLOCKQUOTE>
				</TD>
			</TR>
		</logic:messagesPresent>
		
		<logic:empty name="<%=frmName%>" property="id">
			<TR>
				<TD>Building:</TD>
				<TD width='100%'>
					<html:select property="bldgId" onchange="javascript: buldingChanged(this.value);">
						<html:option value="<%=Constants.BLANK_OPTION_VALUE%>"><%=Constants.BLANK_OPTION_LABEL%></html:option>
						<html:options collection="<%=Building.BLDG_LIST_ATTR_NAME%>" property="value" labelProperty="label"/>
					</html:select>
				<TD>
			</TR>

			<TR>
				<TD>Room Number:</TD>
				<TD width='100%'>
					<html:text property="name" maxlength="10" size="10" />
				<TD>
			</TR>

			<TR>
				<TD nowrap>Department:</TD>
				<TD>
					<html:select property="controlDept">
						<html:options collection="<%=Department.DEPT_ATTR_NAME%>" property="value" labelProperty="label"/>
					</html:select>
				</TD>
			</TR>
		</logic:empty>
		
		
		<logic:notEmpty name="<%=frmName%>" property="id">
			<TR>
				<TD>Name:</TD>
				<% if (examMgr) { %>
					<TD width='100%'>
						<bean:write name="<%=frmName%>" property="bldgName"/>
						<bean:write name="<%=frmName%>" property="name"/>
						<html:hidden property="name"/>
					<TD>
				<% } else {%>
				<TD width='100%'>
					<bean:write name="<%=frmName%>" property="bldgName"/>
					<logic:empty name="<%=frmName%>" property="bldgName">
						<html:text property="name" maxlength="20" size="20" />
					</logic:empty>
					<logic:notEmpty name="<%=frmName%>" property="bldgName">
						<html:text property="name" maxlength="10" size="10" />
					</logic:notEmpty>
				<TD>
				<% } %>
			</TR>
		</logic:notEmpty>
			
		<logic:equal name="<%=frmName%>" property="room" value="true">
			<% if (admin) { %>
				<TR>
					<TD>External Id:</TD>
					<TD width='100%'>
						<html:text property="externalId" maxlength="40" size="40" />
					<TD>
				</TR>
			<% } else { %>
				<html:hidden property="externalId"/>
			<% } %>
		</logic:equal>
		
		<% if (admin) { %>
			<TR>
				<TD>Type:</TD>
				<TD width='100%'>
					<html:select property="type">
						<html:optionsCollection property="roomTypes" label="label" value="uniqueId"/>
{'fraction_non_alphanumeric': 0.18780050909776563, 'fraction_numerical': 0.011124728952578485, 'mean_word_length': 3.7719298245614037, 'pattern_counts': {'":': 0, '<': 282, '<?xml version=': 0, '>': 282, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1437231', 'n_tokens_mistral': 4524, 'n_tokens_neox': 3557, 'n_words': 753}