<commit_before><%--
  #%L
  Eureka! Clinical User Webapp
  %%
  Copyright (C) 2016 Emory University
  %%
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
  
       http://www.apache.org/licenses/LICENSE-2.0
  
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  #L%
  --%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<%@ taglib uri="/WEB-INF/tlds/template.tld" prefix="template" %>


<template:insert template="/templates/eureka_main.jsp">
	<template:content name="content">
		<h3>Account Settings ${user.username}</h3>
		<div id="passwordExpirationMsg" class="passwordExpirationMsg">
			<%=request.getAttribute("passwordExpiration")%>
			<br>
		</div>
		<form id="userInfoForm" action="#" method="POST" role="form">                 
                        <input type="hidden" name="fullName" id="fullName" value="${user.fullName}" />
                        <input type="hidden" name="username" id="username" value="${user.username}" />                        
                        <div class="row">
                                <div class="col-sm-6">
                                        <div class="form-group">
                                                <label for="firstName" class="control-label">First Name</label>
                                                <input id="firstName" name="firstName" type="text"
                                                           class="form-control" value="${user.firstName}"/>
                                                <span class="help-block default-hidden"></span>
                                        </div>
                                </div>
                        </div>
                        <div class="row">
                                <div class="col-sm-6">
                                        <div class="form-group">
                                                <label for="lastName" class="control-label">Last Name</label>
                                                <input id="lastName" name="lastName" type="text"
                                                           class="form-control" value="${user.lastName}"/>
                                                <span class="help-block default-hidden"></span>
                                        </div>
                                </div>
                        </div>                               
                        <div class="row">
                                <div class="col-sm-6">
                                        <div class="form-group">
                                                <label for="organization" class="control-label">Organization</label>
                                                <input id="organization" name="organization" type="text"
                                                           class="form-control" value="${user.organization}"/>
                                                <span class="help-block default-hidden"></span>
                                        </div>
                                </div>
                        </div>
                        <c:choose>  
                                <c:when test="${user.username == 'superuser'}">
                                        <div class="row">
                                                <div class="col-sm-6">
                                                        <div class="form-group">
                                                                <label for="title_superuser" class="control-label">Title</label>
                                                                <input id="title_superuser" name="title_superuser" type="text"
                                                                           class="form-control" 
                                                                           <c:choose>
                                                                                <c:when test="${user.title == 'undefined' || user.title == '' || user.title == 'null' }">
                                                                                    value=""
                                                                                </c:when>
                                                                                <c:otherwise>
                                                                                    value="${user.title}"
                                                                                </c:otherwise>
                                                                           </c:choose>
                                                                />
                                                                <span class="help-block default-hidden"></span>
                                                        </div>
                                                </div>
                                        </div>
                                        <div class="row">
                                                <div class="col-sm-6">
                                                        <div class="form-group">
                                                                <label for="department_superuser" class="control-label">Department</label>
                                                                <input id="department_superuser" name="department_superuser" type="text"
                                                                           class="form-control"  
                                                                           <c:choose>
                                                                                <c:when test="${user.department == 'undefined' || user.department == '' || user.department == 'null' }">
                                                                                    value=""
                                                                                </c:when>
                                                                                <c:otherwise>
                                                                                    value="${user.department}"
                                                                                </c:otherwise>
                                                                           </c:choose>                                                                           
                                                                />
                                                                <span class="help-block default-hidden"></span>
                                                        </div>
                                                </div>
                                        </div>
                                </c:when>
                                <c:otherwise> 
                                        <div class="row">
                                                <div class="col-sm-6">
                                                        <div class="form-group">
                                                                <label for="title" class="control-label">Title</label>
                                                                <input id="title" name="title" type="text"
                                                                           class="form-control" value="${user.title}"/>
                                                                <span class="help-block default-hidden"></span>
                                                        </div>
                                                </div>
                                        </div>
                                        <div class="row">
                                                <div class="col-sm-6">
                                                        <div class="form-group">
                                                                <label for="department" class="control-label">Department</label>
                                                                <input id="department" name="department" type="text"
                                                                           class="form-control" value="${user.department}"/>
                                                                <span class="help-block default-hidden"></span>
                                                        </div>
                                                </div>
                                        </div>                                    
                                </c:otherwise>    
                        </c:choose>                        
                        <div class="row">
                                <div class="col-sm-6">
                                        <div class="form-group">
                                                <label for="email" class="control-label">Email Address</label>
                                                <input id="email" name="email" type="text"
                                                           class="form-control" value="${user.email}"/>
                                                <span class="help-block default-hidden"></span>
                                        </div>
                                </div>
                        </div>        
                        <div class="row">
                                <div id="infoNotificationFailure" class="default-hidden help-block has-error">
                                            <div id="infoNotificationFailureMsg"></div>                                    
                                </div>
                        </div>                                                    
                        <div class="row">
                                <div class="col-sm-6">
                                        <div class="form-group">                                                
                                                <c:if test="${user['class'].name == 'org.eurekaclinical.eureka.client.comm.LocalUser'}">                        
                                                        <button id="changePasswordBtn" class="btn btn-primary text-center">Change Password</button>
                                                </c:if>                                                
                                                <button id="cancelBtn" class="btn btn-primary text-center">Cancel</button>     
                                                <input type="hidden" name="id" id="id" value="${user.id}" /> 
                                                <input type="hidden" name="action" value="saveinfo"/>                                                        
                                                <input type="submit" value="Save Changes" id="saveEditBtn" class="btn btn-primary text-center"/>  
                                        </div>
                                </div>
                        </div>                            
		</form>
		<div id="infoNotificationSuccess" class="default-hidden alert alert-success">
                        <p><strong>Your changes has been saved successfully.</strong></p>
		</div>                                        
		<c:if test="${user['class'].name == 'org.eurekaclinical.eureka.client.comm.LocalUser'}">
                        <div id="newPasswordModal" class="modal fade" role="dialog" aria-labelledby="newPasswordModalLabel"
                                 aria-hidden="true">
                                <div class="modal-dialog">
                                        <div class="modal-content">
                                                <form id="userCredentialForm" class="form-horizontal" action="#" method="post"
                                                          role="form">
                                                        <div class="modal-header">
                                                                <h4 id="newPasswordModalLabel" class="modal-title">
                                                                        Change Password
                                                                </h4>
                                                        </div>
                                                        <div class="modal-body">
                                                            
                                                                <div class="form-group">
                                                                    <label class="col-sm-3 control-label" for="oldPassword">Old Password:</label>                                                                
                                                                </div>
                                                                <div class="form-group">
                                                                        <div class="col-sm-7">                                                                 
                                                                                <input type="password" name="oldPassword" id="oldPassword"
                                                                                           class="form-control"/>
                                                                        </div>
                                                                        <span class="col-sm-5 help-inline"></span>
                                                                </div>   
                                                                
                                                                <div class="form-group">
                                                                        <label class="col-sm-3 control-label" for="newPassword">New Password:</label>
                                                                </div>
                                                                <div class="form-group">
                                                                        <div class="col-sm-7">                                                                        
                                                                                <input type="password" name="newPassword" id="newPassword"
                                                                                           class="form-control"/>
                                                                        </div>
                                                                        <span class="col-sm-5 help-inline"></span>
                                                                </div>  
                                                            
                                                          
                                                                <div class="form-group">
                                                                        <label class="col-sm-4 control-label" for="verifyPassword">Re-enter New Password:</label>  
                                                                </div>
                                                                <div class="form-group">
                                                                        <div class="col-sm-7">                                                                      
                                                                                <input type="password" name="verifyPassword" id="verifyPassword"
                                                                                           class="form-control col-sm-4"/>
                                                                        </div>
                                                                        <span class="col-sm-5 help-inline"></span>
                                                                </div>

                                                            
                                                                <div class="row">
                                                                        <div id="passwordChangeNotificationMsg" class="col-sm-10 default-hidden">
                                                                        </div>
                                                                </div>
                                                        </div>
                                                        <div class="modal-footer">
                                                                <input type="hidden" name="action" value="savepassword"/>
                                                                <input type="submit" value="Save Password" id="savePasswordBtn" class="btn btn-primary"/>
                                                                <button type="button" class="btn btn-primary" data-dismiss="modal">Close</button>
                                                        </div>
                                                </form>
                                        </div>
                                </div>
                        </div>
		</c:if>
		<script type="text/javascript" src="${pageContext.request.contextPath}/assets/js/jquery.validate.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/assets/js/eureka.account.js"></script>
		<script>var ctx = "${eurekaWebappURL}/#/index"</script>
		<script type="text/javascript">
			$(document).ready(function () {
                                
				eureka.account.setup('#changePasswordBtn', '#cancelBtn', '#userInfoForm', '#infoNotificationFailure', '#infoNotificationFailureMsg', '#infoNotificationSuccess', '#newPasswordModal', '#userCredentialForm', '#passwordChangeNotificationMsg', '#passwordExpirationMsg');
			});
		</script>
	</template:content><commit_msg>Implement enhancement#3, rearrange button positions and restyle button labels in change password popup window<commit_after><%--
  #%L
  Eureka! Clinical User Webapp
  %%
  Copyright (C) 2016 Emory University
  %%
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
  
       http://www.apache.org/licenses/LICENSE-2.0
  
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  #L%
  --%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<%@ taglib uri="/WEB-INF/tlds/template.tld" prefix="template" %>


<template:insert template="/templates/eureka_main.jsp">
	<template:content name="content">
		<h3>Account Settings ${user.username}</h3>
		<div id="passwordExpirationMsg" class="passwordExpirationMsg">
			<%=request.getAttribute("passwordExpiration")%>
			<br>
		</div>
		<form id="userInfoForm" action="#" method="POST" role="form">                 
                        <input type="hidden" name="fullName" id="fullName" value="${user.fullName}" />
                        <input type="hidden" name="username" id="username" value="${user.username}" />                        
                        <div class="row">
                                <div class="col-sm-6">
                                        <div class="form-group">
                                                <label for="firstName" class="control-label">First Name</label>
                                                <input id="firstName" name="firstName" type="text"
                                                           class="form-control" value="${user.firstName}"/>
                                                <span class="help-block default-hidden"></span>
                                        </div>
                                </div>
                        </div>
                        <div class="row">
                                <div class="col-sm-6">
                                        <div class="form-group">
                                                <label for="lastName" class="control-label">Last Name</label>
                                                <input id="lastName" name="lastName" type="text"
                                                           class="form-control" value="${user.lastName}"/>
                                                <span class="help-block default-hidden"></span>
                                        </div>
                                </div>
                        </div>                               
                        <div class="row">
                                <div class="col-sm-6">
                                        <div class="form-group">
                                                <label for="organization" class="control-label">Organization</label>
                                                <input id="organization" name="organization" type="text"
                                                           class="form-control" value="${user.organization}"/>
                                                <span class="help-block default-hidden"></span>
                                        </div>
                                </div>
                        </div>
                        <c:choose>  
                                <c:when test="${user.username == 'superuser'}">
                                        <div class="row">
                                                <div class="col-sm-6">
                                                        <div class="form-group">
                                                                <label for="title_superuser" class="control-label">Title</label>
                                                                <input id="title_superuser" name="title_superuser" type="text"
                                                                           class="form-control" 
                                                                           <c:choose>
                                                                                <c:when test="${user.title == 'undefined' || user.title == '' || user.title == 'null' }">
                                                                                    value=""
                                                                                </c:when>
                                                                                <c:otherwise>
                                                                                    value="${user.title}"
                                                                                </c:otherwise>
                                                                           </c:choose>
                                                                />
                                                                <span class="help-block default-hidden"></span>
                                                        </div>
                                                </div>
                                        </div>
                                        <div class="row">
                                                <div class="col-sm-6">
                                                        <div class="form-group">
                                                                <label for="department_superuser" class="control-label">Department</label>
                                                                <input id="department_superuser" name="department_superuser" type="text"
                                                                           class="form-control"  
                                                                           <c:choose>
                                                                                <c:when test="${user.department == 'undefined' || user.department == '' || user.department == 'null' }">
                                                                                    value=""
                                                                                </c:when>
                                                                                <c:otherwise>
                                                                                    value="${user.department}"
                                                                                </c:otherwise>
                                                                           </c:choose>                                                                           
                                                                />
                                                                <span class="help-block default-hidden"></span>
                                                        </div>
                                                </div>
                                        </div>
                                </c:when>
                                <c:otherwise> 
                                        <div class="row">
                                                <div class="col-sm-6">
                                                        <div class="form-group">
                                                                <label for="title" class="control-label">Title</label>
                                                                <input id="title" name="title" type="text"
                                                                           class="form-control" value="${user.title}"/>
                                                                <span class="help-block default-hidden"></span>
                                                        </div>
                                                </div>
                                        </div>
                                        <div class="row">
                                                <div class="col-sm-6">
                                                        <div class="form-group">
                                                                <label for="department" class="control-label">Department</label>
                                                                <input id="department" name="department" type="text"
                                                                           class="form-control" value="${user.department}"/>
                                                                <span class="help-block default-hidden"></span>
                                                        </div>
                                                </div>
                                        </div>                                    
                                </c:otherwise>    
                        </c:choose>                        
                        <div class="row">
                                <div class="col-sm-6">
                                        <div class="form-group">
                                                <label for="email" class="control-label">Email Address</label>
                                                <input id="email" name="email" type="text"
                                                           class="form-control" value="${user.email}"/>
                                                <span class="help-block default-hidden"></span>
                                        </div>
                                </div>
                        </div>        
                        <div class="row">
                                <div id="infoNotificationFailure" class="default-hidden help-block has-error">
                                            <div id="infoNotificationFailureMsg"></div>                                    
                                </div>
                        </div>                                                    
                        <div class="row">
                                <div class="col-sm-6">
                                        <div class="form-group">   
                                                <input type="submit" value="Save Changes" id="saveEditBtn" class="btn btn-primary text-center"/>     
                                                <button id="cancelBtn" class="btn btn-primary text-center">Cancel</button>                                                  
                                                <c:if test="${user['class'].name == 'org.eurekaclinical.eureka.client.comm.LocalUser'}">                        
                                                        <button id="changePasswordBtn" class="btn btn-primary text-center">Change Password</button>
                                                </c:if>      
                                                <input type="hidden" name="id" id="id" value="${user.id}" /> 
                                                <input type="hidden" name="action" value="saveinfo"/>                                                        

                                        </div>
                                </div>
                        </div>                            
		</form>
		<div id="infoNotificationSuccess" class="default-hidden alert alert-success">
                        <p><strong>Your changes has been saved successfully.</strong></p>
		</div>                                        
		<c:if test="${user['class'].name == 'org.eurekaclinical.eureka.client.comm.LocalUser'}">
                        <div id="newPasswordModal" class="modal fade" role="dialog" aria-labelledby="newPasswordModalLabel"
                                 aria-hidden="true">
                                <div class="modal-dialog">
                                        <div class="modal-content">
                                                        <div class="modal-header">
                                                                <h4 id="newPasswordModalLabel" class="modal-title">
                                                                        Change Password
                                                                </h4>
                                                        </div>
                                                        <form id="userCredentialForm" class="form-horizontal" action="#" method="post" role="form">
                                                                <div class="modal-body">
                                                                        <div class="col-sm-9">
                                                                                <div class="form-group">
                                                                                        <label for="oldPassword" class="control-label">Old Password</label>
                                                                                        <input id="oldPassword" name="oldPassword" type="password" class="form-control" 
                                                                                        />
                                                                                        <span class="help-inline"></span>
                                                                                </div>
                                                                        </div>

                                                                        <div class="col-sm-9">
                                                                                <div class="form-group">
                                                                                        <label for="newPassword" class="control-label" >New Password</label>
                                                                                        <input id="newPassword" name="newPassword" type="password" class="form-control"
                                                                                        />
                                                                                        <span class="help-inline"></span>
                                                                                </div>
                                                                        </div>

                                                                        <div class="col-sm-9">
                                                                                <div class="form-group">
                                                                                        <label for="verifyPassword" class="control-label">Re-enter New Password</label>
                                                                                        <input id="verifyPassword" name="verifyPassword" type="password" class="form-control" 
                                                                                        />
                                                                                        <span class="help-inline"></span>
                                                                                </div>
                                                                        </div>

                                                                        <div class="row">
                                                                                <div id="passwordChangeNotificationMsg" class="col-sm-10 default-hidden">
                                                                                </div>
                                                                        </div>
                                                                </div>
                                                                <div class="modal-footer">
                                                                        <input type="hidden" name="action" value="savepassword"/>
                                                                        <input type="submit" value="Save Password" id="savePasswordBtn" class="btn btn-primary"/>
                                                                        <button type="button" class="btn btn-primary" data-dismiss="modal">Close</button>
                                                                </div>
                                                        </form>
                                        </div>
                                </div>
                        </div>
		</c:if>
		<script type="text/javascript" src="${pageContext.request.contextPath}/assets/js/jquery.validate.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/assets/js/eureka.account.js"></script>
		<script>var ctx = "${eurekaWebappURL}/#/index"</script>
		<script type="text/javascript">
			$(document).ready(function () {
                                
				eureka.account.setup('#changePasswordBtn', '#cancelBtn', '#userInfoForm', '#infoNotificationFailure', '#infoNotificationFailureMsg', '#infoNotificationSuccess', '#newPasswordModal', '#userCredentialForm', '#passwordChangeNotificationMsg', '#passwordExpirationMsg');
			});
		</script>
	</template:content>
{'fraction_non_alphanumeric': 0.08811258830728153, 'fraction_numerical': 0.0016687990209712411, 'mean_word_length': 0.5688541757570469, 'pattern_counts': {'":': 0, '<': 429, '<?xml version=': 0, '>': 429, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 692, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7569943', 'n_tokens_mistral': 5387, 'n_tokens_neox': 5108, 'n_words': 1093}