<commit_before>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="ec" uri="http://www.extremecomponents.org" %>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
<html>
<head>
    <title>AEs for ${command.participant.fullName} on ${command.study.shortTitle}</title>
    <tags:stylesheetLink name="extremecomponents"/>
    <tags:dwrJavascriptLink objects="createAE"/>
    <style type="text/css">
        .notify-unit.success {
            color: #090;
        }

        .notify-unit.failure {
            color: #900;
        }
        
        
    </style>
    <script type="text/javascript">
    
    	function toggleImage(id){
			imageStr=document.getElementById(id).src;
			//	alert(imageStr);
			if(imageStr.indexOf('plus')==-1)
				document.getElementById(id).src=imageStr.replace('minus','plus');
			else
				document.getElementById(id).src=imageStr.replace('plus','minus');	
			//	alert(document.getElementById(id).src)
		}
		
		function withdraw(aeReportId,reportId) {
            AE.showIndicator("notify-indicator-" + aeReportId)
            createAE.withdrawReportVersion(aeReportId, reportId, function(result) {
                AE.hideIndicator("notify-indicator-" + aeReportId)
                 var status = $("status"+reportId)
         		 var statusData = "<span class='submittedOn' ><i>Withdrawn <\/i><\/span>";
          
          		var action = $("action"+reportId)
          		actionData = $("amend"+reportId).innerHTML;
          
          		Element.update(status, statusData)
          		Element.update(action, actionData)
            })
        }
    
    
        function notifyPsc(aeReportId) {
            AE.showIndicator("notify-indicator-" + aeReportId)
            createAE.pushAdverseEventToStudyCalendar(aeReportId, function(result) {
                AE.hideIndicator("notify-indicator-" + aeReportId)
                var unit = $("notify-unit-" + aeReportId)
                if (result) {
                    Element.update(unit, "Notified")
                    Element.addClassName(unit, "success")
                } else {
                    Element.update(unit, "Notification failed")
                    Element.addClassName(unit, "failure")
                }
            })
        }
		

		function notifyPscRoutineEvent(aeReportId) {

            AE.showIndicator("notify-indicator-routine-" + aeReportId)
            createAE.pushRoutineAdverseEventToStudyCalendar(aeReportId, function(result) {
                AE.hideIndicator("notify-indicator-routine-" + aeReportId)
                var unit = $("notify-unit-routine-" + aeReportId)
                if (result) {
                    Element.update(unit, "Notified")
                    Element.addClassName(unit, "success")
                } else {
                    Element.update(unit, "Notification failed")
                    Element.addClassName(unit, "failure")
                }
            })
        }
        
        function executeAction(aeReportId,url){
			
			var actions = $("actions-"+aeReportId)
			 for ( i=0; i < actions.length; i++)
               {
                  if (actions.options[i].selected && actions.options[i].value != "none") {
                     window.open(url + "&format="+ actions.options[i].value,"_self")
                   }
               }
        }

		
        Event.observe(window, "load", function() {
            
            $$("a.notify").each(function(a) {
                Event.observe(a, "click", function(e) {
                    Event.stop(e);
                    var aeReportId = Event.element(e).id.substring(7)
                    notifyPsc(aeReportId)
                })
            })

            $$("a.notify-routine").each(function(a) {
                Event.observe(a, "click", function(e) {
                    Event.stop(e);
                    var roReportId = Event.element(e).id.substring(14)
                    notifyPscRoutineEvent(roReportId)
                })
            })
        })
        

            function showTable2(t) {
                //$('indicator').className = 'indicator'
                var testDiv = document.getElementById(t);
               // testDiv.innerHTML = "xyz";
                testDiv.show();
            }
            function hideTable2(t) {
                //$('indicator').className = 'indicator'
                var testDiv = document.getElementById(t);
               // testDiv.innerHTML = "xyz";
                testDiv.hide();
            }
        
        
    </script>
</head>
<body>
<c:if test="${not empty configuration.map.pscBaseUrl}">
<p>
    View this person's schedule in the <a href="${configuration.map.pscBaseUrl}/pages/cal/schedule?assignment=${command.assignment.gridId}" class="sso">study calendar</a>.
</p>
</c:if>

<h2>Expedited Reports<c:if test="${command.study.status ne 'Administratively Complete'}">
<a href="<c:url value="/pages/ae/create?participant=${command.participant.id}&study=${command.study.id}&action=create"/>">( create )</a>
</c:if>
</h2>
<!-- STUDY SEARCH RESULTS START HERE -->
<div id="test"></div>
<div class="eXtremeTable" >
<table width="80%" border="0" cellspacing="0" cellpadding="0" class="tableRegion">
	<c:if test="${fn:length(command.assignment.aeReports) > 0}">
		<thead>
		<tr align="center" class="label">
			<td class="tableHeader"></td>
			<td class="tableHeader">Term ( * refers to Primary AE data )</td>
			<td class="tableHeader">Primary AE start date</td><commit_msg>changed document.getElementById to prototype $()<commit_after>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="ec" uri="http://www.extremecomponents.org" %>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
<html>
<head>
    <title>AEs for ${command.participant.fullName} on ${command.study.shortTitle}</title>
    <tags:stylesheetLink name="extremecomponents"/>
    <tags:dwrJavascriptLink objects="createAE"/>
    <style type="text/css">
        .notify-unit.success {
            color: #090;
        }

        .notify-unit.failure {
            color: #900;
        }
        
        
    </style>
    <script type="text/javascript">
    
    	function toggleImage(id){
			imageStr=document.getElementById(id).src;
			//	alert(imageStr);
			if(imageStr.indexOf('plus')==-1)
				document.getElementById(id).src=imageStr.replace('minus','plus');
			else
				document.getElementById(id).src=imageStr.replace('plus','minus');	
			//	alert(document.getElementById(id).src)
		}
		
		function withdraw(aeReportId,reportId) {
            AE.showIndicator("notify-indicator-" + aeReportId)
            createAE.withdrawReportVersion(aeReportId, reportId, function(result) {
                AE.hideIndicator("notify-indicator-" + aeReportId)
                 var status = $("status"+reportId)
         		 var statusData = "<span class='submittedOn' ><i>Withdrawn <\/i><\/span>";
          
          		var action = $("action"+reportId)
          		actionData = $("amend"+reportId).innerHTML;
          
          		Element.update(status, statusData)
          		Element.update(action, actionData)
            })
        }
    
    
        function notifyPsc(aeReportId) {
            AE.showIndicator("notify-indicator-" + aeReportId)
            createAE.pushAdverseEventToStudyCalendar(aeReportId, function(result) {
                AE.hideIndicator("notify-indicator-" + aeReportId)
                var unit = $("notify-unit-" + aeReportId)
                if (result) {
                    Element.update(unit, "Notified")
                    Element.addClassName(unit, "success")
                } else {
                    Element.update(unit, "Notification failed")
                    Element.addClassName(unit, "failure")
                }
            })
        }
		

		function notifyPscRoutineEvent(aeReportId) {

            AE.showIndicator("notify-indicator-routine-" + aeReportId)
            createAE.pushRoutineAdverseEventToStudyCalendar(aeReportId, function(result) {
                AE.hideIndicator("notify-indicator-routine-" + aeReportId)
                var unit = $("notify-unit-routine-" + aeReportId)
                if (result) {
                    Element.update(unit, "Notified")
                    Element.addClassName(unit, "success")
                } else {
                    Element.update(unit, "Notification failed")
                    Element.addClassName(unit, "failure")
                }
            })
        }
        
        function executeAction(aeReportId,url){
			
			var actions = $("actions-"+aeReportId)
			 for ( i=0; i < actions.length; i++)
               {
                  if (actions.options[i].selected && actions.options[i].value != "none") {
                     window.open(url + "&format="+ actions.options[i].value,"_self")
                   }
               }
        }

		
        Event.observe(window, "load", function() {
            
            $$("a.notify").each(function(a) {
                Event.observe(a, "click", function(e) {
                    Event.stop(e);
                    var aeReportId = Event.element(e).id.substring(7)
                    notifyPsc(aeReportId)
                })
            })

            $$("a.notify-routine").each(function(a) {
                Event.observe(a, "click", function(e) {
                    Event.stop(e);
                    var roReportId = Event.element(e).id.substring(14)
                    notifyPscRoutineEvent(roReportId)
                })
            })
        })
        

            function showTable2(t) {
                //$('indicator').className = 'indicator'
                
                var testDiv = $(t);               
                testDiv.show();
            }
            function hideTable2(t) {
                //$('indicator').className = 'indicator'
                //var testDiv = document.getElementById(t);
               var testDiv = $(t);
                testDiv.hide();
            }
        
        
    </script>
</head>
<body>
<c:if test="${not empty configuration.map.pscBaseUrl}">
<p>
    View this person's schedule in the <a href="${configuration.map.pscBaseUrl}/pages/cal/schedule?assignment=${command.assignment.gridId}" class="sso">study calendar</a>.
</p>
</c:if>

<h2>Expedited Reports<c:if test="${command.study.status ne 'Administratively Complete'}">
<a href="<c:url value="/pages/ae/create?participant=${command.participant.id}&study=${command.study.id}&action=create"/>">( create )</a>
</c:if>
</h2>
<!-- STUDY SEARCH RESULTS START HERE -->
<div id="test"></div>
<div class="eXtremeTable" >
<table width="80%" border="0" cellspacing="0" cellpadding="0" class="tableRegion">
	<c:if test="${fn:length(command.assignment.aeReports) > 0}">
		<thead>
		<tr align="center" class="label">
			<td class="tableHeader"></td>
			<td class="tableHeader">Term ( * refers to Primary AE data )</td>
			<td class="tableHeader">Primary AE start date</td>
{'fraction_non_alphanumeric': 0.14892657405736964, 'fraction_numerical': 0.0037885621504600395, 'mean_word_length': 1.9755770263016639, 'pattern_counts': {'":': 0, '<': 99, '<?xml version=': 0, '>': 99, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5559363', 'n_tokens_mistral': 3442, 'n_tokens_neox': 3176, 'n_words': 496}