<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://sakaiproject.org/jsf/sakai" prefix="sakai" %>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>

<style>

	.nameColumn {
	    width: 100%;
	    text-align: left;
	    font-size: small;
	}
	.editColumn {
	    width: 30px;
		text-align: center;
		font-size: small;
	}
	.removeColumn {
	    width: 30px;
		text-align: center;
		font-size: small;
	}
	.row {
		height: 30px;
		vertical-align: middle;
	}
	
	.messageColumn {
		vertical-align: baseline;
	
	}
	
	.pagerColumn {
		width: 400px;
	}
	
	
	hr.hr2 {
	height:1px;
	}
	
	
	tr.dataTableHighlight 
	{
	
		background-color: #ECF3FE;
	}
	
	.short2 {
		clear:both;
		border:1px solid #FFFFFF;
		margin:0.8em 1em;
	}
	
	.toolBarLink
	{
		font-family:Verdana,Geneva,Arial,Helvetica,sans-serif;
		font-size:0.9em;
		margin-right:2px;
	}

</style>


<script type="text/javascript">
<!--
function highlight() 
{
    var previousClass = null;
    // simple script for highlighting rows
    var table = document.getElementById("dataTable1");
    var tbody = table.getElementsByTagName("tbody")[0];
    var rows = tbody.getElementsByTagName("tr");
    for (i=0; i < rows.length; i++) 
    {
        rows[i].onmouseover = function() { previousClass=this.className;this.className='dataTableHighlight' };
        rows[i].onmouseout = function() { this.className=previousClass };
	}

}

//-->
</script>


<%-- This file generated by Sakai App Builder --%>
<f:loadBundle basename="messages" var="msgs"/>

<f:view>
	<sakai:view title="WebLab Tool">
	
		<style>			
			.navIntraTool a, .navIntraTool a:link
			{
				margin-right:0px;
			}	
		</style>
		
		
		<h:form id="createWebLab" >
			<sakai:tool_bar>
				<sakai:tool_bar_item action="#{ExperimentBean.processActionNew}" value="Novo Experimento"/>
				<sakai:tool_bar_spacer />
				<sakai:tool_bar_item action="#{MaterialBean.processActionList}" value="Cadastrar/Listar Materiais"/>
			</sakai:tool_bar>
		</h:form>
		<sakai:view_content>
					
			<sakai:view_title value="#{msgs.weblabs_list_title}"/>
							
			<h:outputFormat value="#{msgs.weblabs_list_welcome}" > 
				<f:param value="#{ExperimentBean.currentUserDisplayName}"/>
			</h:outputFormat>
						
			<br><br>
			<hr width="100%" class="hr2" >
			
			<h:outputText value="#{msgs.weblabs_list_empty}" styleClass="short2" rendered="#{ExperimentBean.listExperiments.rowCount eq 0}"  />
			
			<h:form id="pagerForm" >
			
				<h:panelGrid columns="2" width="100%" columnClasses="messageColumn, pagerColumn" rendered="#{ExperimentBean.listExperiments.rowCount gt 0}" >
				
					<sakai:messages />	
					<sakai:pager  totalItems="#{ExperimentBean.rowCount}" pageSize="8" 
								  textItem="#{msgs.weblabs_list_pager_textitem}" 
								  textStatus="#{msgs.pager_status_text}" 
								  renderPageSize="false"								  
								  firstItem="#{ExperimentBean.firstRow}"
								  valueChangeListener="#{ExperimentBean.changePagingState}" immediate="true"/>
				</h:panelGrid>
			</h:form>
					
			
			<h:dataTable id="dataTable1" binding="#{ExperimentBean.dataTable}" var="experiment" value="#{ExperimentBean.listExperiments}" 
						 styleClass="listHier" style="margin-top: 0px;" columnClasses="nameColumn, editColumn, removeColumn" rowClasses="row"
						 rows="8" first="#{ExperimentBean.firstRow}"
						 onmouseover="highlight()"
			             onmouseout="highlight()" 
			             rendered="#{ExperimentBean.listExperiments.rowCount gt 0}"> 
				<h:column>
					<f:facet name="header">
						<h:outputText value="#{msgs.weblabs_list_header_name}" />
					</f:facet>
					<h:form>
					<h:commandLink action="#{ExperimentBean.processActionDetail}" >
						<h:outputText value="#{experiment.experiment.name}" />
					</h:commandLink>
					</h:form>
				</h:column>
				<h:column>
					<f:facet name="header">
						<h:outputText value="#{msgs.weblabs_list_header_edit}" />
					</f:facet>
					<h:form>
					<h:commandLink action="#{ExperimentBean.processActionUpdate}" rendered="#{experiment.canEdit}">
						<h:graphicImage alt="#{msgs.weblabs_list_header_edit}" value="/images/edit3.png" />
					</h:commandLink>
					</h:form>
				</h:column>
				<h:column>
					<f:facet name="header">
						<h:outputText value="#{msgs.weblabs_list_header_remove}" />
					</f:facet>
					<h:form>
					<h:commandLink action="#{ExperimentBean.processActionDelete}" rendered="#{experiment.canDelete}">
						<h:graphicImage alt="#{msgs.weblabs_list_header_remove}" value="/images/drop.png" />
						<a4j:support event="onclick" reRender="pagerForm, dataTable1" />
					</h:commandLink>
					</h:form>
				</h:column>
			</h:dataTable>
			
			


										
			
		</sakai:view_content>
	
	</sakai:view>
</f:view> 
