Commits

mpagnon committed 3d355ba

Bug Fix 679 + 766: part 1 : Search ordered by project

Comments (0)

Files changed (2)

tm/org.squashtest.csp.tm.web/src/main/webapp/WEB-INF/jsp/fragment/generics/search-result-display-ordered.jsp

 		- search-result-display-ordered-by-requirement
 		- search-result-display
  --%>
-<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
 <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="f"%>
-<%@ taglib prefix="dt" tagdir="/WEB-INF/tags/datatables" %>
-<%@ taglib prefix="comp" tagdir="/WEB-INF/tags/component" %>
+<%@ taglib prefix="dt" tagdir="/WEB-INF/tags/datatables"%>
+<%@ taglib prefix="comp" tagdir="/WEB-INF/tags/component"%>
 <?xml version="1.0" encoding="utf-8" ?>
-<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
-<c:set var="servContext" value="${ pageContext.servletContext.contextPath }"/>
+<%@ page language="java" contentType="text/html; charset=utf-8"
+	pageEncoding="utf-8"%>
+<c:set var="servContext"
+	value="${ pageContext.servletContext.contextPath }" />
 <c:url var="objectUrl" value="${workspace}" />
 <div id="search-result">
 	<table id="search-result-datatable">
-	<thead>
-		<tr>
-			<th> Id </th>
-			<th><f:message key="${workspace}.header.title" />s</th>
-			<c:if test="${ icon != 'Requirement' }"><th><f:message key="test-case.importance.combo.label"/></th></c:if>
-			<c:if test="${ icon == 'Requirement' }">
-			<th><f:message key="requirement.reference.label"/></th>
-			<th><f:message key="search.criticality.label"/></th>
-			</c:if>
-			<th><f:message key="test-case.calling-test-cases.table.project.label"/></th>
-		</tr>
-	</thead>
-	<tbody>
-		<c:forEach var="object" items="${resultList}" varStatus="index" >
-			<c:set var="currentProject" value="${object.project.name}"></c:set>
-			
-			<c:if test="${currentProject != oldProject}">
-				<tr> 
-					<td> ${object.id}</td>
-					<c:if test="${ icon != 'Requirement' }"><c:set var="colSpan" value="3" /></c:if>
-					<c:if test="${ icon == 'Requirement' }"><c:set var="colSpan" value="4" /></c:if>
-					<td colspan="${colSpan}" id="searchnode-${object.class.simpleName}Library-${object.project.id}" class="searched-project non-tree" style="border: none;"> 
-						<a style="color: white; text-decoration: none; border: none;" href="#">
-							<img class="search-image" src="${servContext}/images/root.png">
-							<span class="search-text">${object.project.name}</span>
+
+		<tbody>
+			<c:forEach var="object" items="${resultList}" varStatus="index">
+				<c:set var="currentProject" value="${object.project.name}"></c:set>
+				<c:if test="${currentProject != oldProject}">
+					<c:set var="oldProject" value="${currentProject}"></c:set>
+					<tr>
+						<td>${object.id}</td>
+						<c:if test="${ icon == 'TestCase' }">
+							<c:set var="colSpan" value="2" />
+						</c:if>
+						<td colspan="${colSpan}"
+							id="searchnode-${object.class.simpleName}Library-${object.project.id}"
+							class="searched-project non-tree" style="border: none;"><a
+							style="color: white; text-decoration: none; border: none;"
+							href="#"> <img class="search-image"
+								src="${servContext}/images/root.png"> <span
+									class="search-text">${object.project.name}</span>
 						</a>
-					</td> 
-					<td></td>
-					<td></td>
-					<c:if test="${colSpan ==4}"><td></td></c:if>
-					
-				</tr>
-				<c:set var="oldProject" value="${currentProject}"></c:set>
-			</c:if>
-		
-			<c:choose>
-				<c:when test="${object.class.simpleName== icon}">
+						</td>
+						<c:choose>
+							<c:when test="${ icon == 'TestCase' }">
+								<td style="display: none">${object.project.name}</td>
+								<td>${object.project.name}</td>
+							</c:when>
+							<c:when test="${ icon == 'Requirement' }">
+								<td>${object.project.name}</td>
+								<td>${object.project.name}</td>
+								<td>${object.project.name}</td>
+							</c:when>
+							<c:otherwise>
+								<td>${object.project.name}</td>
+							</c:otherwise>
+						</c:choose>
+					</tr>
+
+				</c:if>
+
 				<c:choose>
-					<c:when test="${ icon == 'Requirement' }">
-						<tr  class=" requirement-${object.criticality}">
-								<td class = "objectId"> ${object.id}</td>
-								<td id="searchnode-${object.class.simpleName}-${object.id}" class="non-tree requirement-${object.criticality}" style="border: none;">
-									<a href="#" style="text-decoration: none; border: none;">
-										<img class="search-image" src="${servContext}/images/Icon_Tree_${icon}.png"/>
-										<span class="search-text">${object.reference}-${object.name}</span>
-									</a>
-								</td>
-								<td>
-									${object.project.name }-${object.criticality}
-								</td>
-								<td>
-									${object.project.name }-${object.reference}
-								</td>
-								<td>
-									${object.project.name }-${object.name }
-								</td>
-						
+					<c:when test="${ object.class.simpleName == 'Requirement' }">
+						<tr class=" requirement-${object.criticality}">
+							<td class="objectId">${object.id}</td>
+							<td id="searchnode-${object.class.simpleName}-${object.id}"
+								class="non-tree requirement-${object.criticality}"
+								style="border: none;"><a href="#"
+								style="text-decoration: none; border: none;"> <img
+									class="search-image"
+									src="${servContext}/images/Icon_Tree_${icon}.png" /> <span
+									class="search-text">${object.reference}-${object.name}</span> </a>
+							</td>
+							<td>${object.project.name }-${object.criticality}</td>
+							<td>${object.project.name }-${object.reference}</td>
+							<td>${object.project.name }-${object.name }</td>
+
+						</tr>
+					</c:when>
+					<c:when test="${ object.class.simpleName == 'TestCase' }">
+						<tr>
+							<td class="objectId">${object.id}</td>
+							<td id="searchnode-${object.class.simpleName}-${object.id}"
+								class="non-tree" style="border: none;"><a href="#"
+								style="text-decoration: none; border: none;"> <img
+									class="search-image"
+									src="${servContext}/images/Icon_Tree_${icon}.png" /> <span
+									class="search-text">${object.name}</span> </a>
+							</td>
+							<td><f:message key="${object.importance.i18nKey}" /></td>
+							<td>${object.project.name }-${object.name }</td>
+						</tr>
+					</c:when>
+					<c:when test="${ object.class.simpleName == 'Campaign' }">
+						<tr>
+							<td class="objectId">${object.id}</td>
+							<td id="searchnode-${object.class.simpleName}-${object.id}"
+								class="non-tree" style="border: none;"><a href="#"
+								style="text-decoration: none; border: none;"> <img
+									class="search-image"
+									src="${servContext}/images/Icon_Tree_${icon}.png" /> <span
+									class="search-text">${object.name}</span> </a>
+							</td>
+							<td>${object.project.name }-${object.name }</td>
+						</tr>
+					</c:when>
+					<c:when test="${object.class.simpleName == 'Iteration'}">
+						<tr>
+							<td class="objectId">${object.id}</td>
+							<td id="searchnode-${object.class.simpleName}-${object.id}"
+								class="non-tree" style="border: none;"><a href="#"
+								style="text-decoration: none; border: none;"> <img
+									class="search-image"
+									src="${servContext}/images/Icon_Tree_Iteration.png"> <span
+										class="search-text">${object.name}</span>
+							</a>
+							</td>
+							<td>${object.project.name }-${object.name }</td>
 						</tr>
 					</c:when>
 					<c:otherwise>
 						<tr>
-							<td class = "objectId"> ${object.id}</td>
-							<td id="searchnode-${object.class.simpleName}-${object.id}" class="non-tree" style="border: none;">
-								<a href="#" style="text-decoration: none; border: none;">
-									<img class="search-image" src="${servContext}/images/Icon_Tree_${icon}.png"/>
-									<span class="search-text">${object.name}</span>
-								</a>
+							<td class="objectId">${object.id}</td>
+							<td id="searchnode-${object.class.simpleName}-${object.id}"
+								class="non-tree" style="border: none;"><a href="#"
+								style="text-decoration: none; border: none;"> <img
+									class="search-image"
+									src="${servContext}/images/Icon_Tree_Folder.png"> <span
+										class="search-text">${object.name}</span>
+							</a>
 							</td>
-							<td><f:message key="${object.importance.i18nKey}" /></td>
-							<td>
-								${object.project.name }-${object.name }
-							</td>
+							<c:if test="${ icon == 'TestCase' }">
+								<td>---</td>
+							</c:if>
+							<c:if test="${ icon == 'Requirement' }">
+								<td>${object.project.name }-</td>
+								<td>${object.project.name }-</td>
+							</c:if>
+							<td>${object.project.name }-${object.name }</td>
+
 						</tr>
 					</c:otherwise>
-				</c:choose>		
-			</c:when>
-			<c:when test="${object.class.simpleName== 'Iteration'}">
-				<tr> 
-					<td class = "objectId"> ${object.id}</td> 
-					<td id="searchnode-${object.class.simpleName}-${object.id}" class="non-tree" style="border: none;"> 
-						<a href="#" style="text-decoration: none; border: none;">
-							<img class="search-image" src="${servContext}/images/Icon_Tree_Iteration.png">
-							<span class="search-text">${object.name}</span>
-						</a>
-					</td>
-					<td>---</td>
-					<td>
-						${object.project.name }-${object.name }
-					</td>
-				</tr>	
-				</c:when>
-				<c:otherwise>
-					<tr> 
-						<td class = "objectId"> ${object.id}</td>
-						<td id="searchnode-${object.class.simpleName}-${object.id}" class="non-tree" style="border: none;"> 
-							<a href="#" style="text-decoration: none; border: none;">
-								<img class="search-image" src="${servContext}/images/Icon_Tree_Folder.png">
-								<span class="search-text">${object.name}</span>
-							</a>
-						</td>
-						<c:if test="${ icon != 'Requirement' }"><td>---</td></c:if>
-						<c:if test="${ icon == 'Requirement' }">
-						<td>${object.project.name }-</td>
-						<td>${object.project.name }-</td>
-						</c:if>
-						<td>
-							${object.project.name }-${object.name }
-						</td>
-					
-					</tr>	
-				</c:otherwise>
-			</c:choose>
-			
-				
-		</c:forEach>
-	</tbody>
+				</c:choose>
+			</c:forEach>
+		</tbody>
 	</table>
 </div>
-
-<c:if test="${ icon == 'Requirement' }">
-	<comp:decorate-ajax-search-table tableId="search-result-datatable" >
-		<jsp:attribute name="initialSort">[[4,'asc']]</jsp:attribute>
-		<jsp:attribute name="columnDefs">
+<c:choose>
+	<c:when test="${ icon == 'Requirement' }">
+		<comp:decorate-ajax-search-table tableId="search-result-datatable">
+			<jsp:attribute name="initialSort">[[4,'asc']]</jsp:attribute>
+			<jsp:attribute name="columnDefs">
 			<dt:column-definition targets="0" sortable="false" visible="false" />
 			<dt:column-definition targets="1" sortable="false" />
 			<dt:column-definition targets="2, 3" sortable="true" visible="false" />
-			<dt:column-definition targets="4" sortable="true" visible="false" lastDef="true"/>
+			<dt:column-definition targets="4" sortable="true" visible="false"
+					lastDef="true" />
 		</jsp:attribute>
-	</comp:decorate-ajax-search-table>
-</c:if>
-<c:if test="${ icon != 'Requirement' }">
-	<comp:decorate-ajax-search-table tableId="search-result-datatable" >
-		<jsp:attribute name="initialSort">[[2,'asc']]</jsp:attribute>
-		<jsp:attribute name="columnDefs">
+		</comp:decorate-ajax-search-table>
+	</c:when>
+	<c:when test="${ icon == 'TestCase' }">
+		<comp:decorate-ajax-search-table tableId="search-result-datatable">
+			<jsp:attribute name="initialSort">[[3,'asc']]</jsp:attribute>
+			<jsp:attribute name="columnDefs">
 			<dt:column-definition targets="0" sortable="false" visible="false" />
 			<dt:column-definition targets="1" sortable="false" />
 			<dt:column-definition targets="2" sortable="false" />
-			<dt:column-definition targets="3" sortable="false" visible="false" lastDef="true" />
+			<dt:column-definition targets="3" sortable="true" visible="false"
+					lastDef="true" />
 		</jsp:attribute>
-	</comp:decorate-ajax-search-table>
-</c:if>
+		</comp:decorate-ajax-search-table>
+	</c:when>
+	<c:otherwise>
+		<comp:decorate-ajax-search-table tableId="search-result-datatable">
+			<jsp:attribute name="initialSort">[[2,'asc']]</jsp:attribute>
+			<jsp:attribute name="columnDefs">
+			<dt:column-definition targets="0" sortable="false" visible="false" />
+			<dt:column-definition targets="1" sortable="false" />
+			<dt:column-definition targets="2" sortable="true" visible="false"
+					lastDef="true" />
+		</jsp:attribute>
+		</comp:decorate-ajax-search-table>
+	</c:otherwise>
+</c:choose>

tm/org.squashtest.csp.tm.web/src/main/webapp/WEB-INF/tags/layout/search-panel.tag

 			data['order'] = order;
 			url = '${searchReqUrl}';
 		</c:when>
-		<c:otherwise>
-			if (document.getElementById("linkable-test-cases-tree") != null){
-				data['name'] = rename;
-				data['order'] = order;
-				data['importance'] = getImportanceParams();
-				url = '${searchTCUrl}';
-			}
-			else{
-				data['name'] = rename;
-				data['order'] = order;
-				data['importance'] = getImportanceParams();
-				url = '${searchUrl}';
-			}
-		</c:otherwise>
-		</c:choose>
-		
-		<c:if test="${ (workspace eq 'requirement' && linkable eq 'test-case') }" >
+		<c:when test="${ (workspace eq 'test-case' || linkable eq 'test-case') }">
 			data['name'] = rename;
 			data['order'] = order;
 			data['importance'] = getImportanceParams();
 			url = '${searchTCUrl}';
-		</c:if>
+			
+			<%-- the following is just more wtf on the pile of wtf, I don't care anymore --%>
+			if (data['importance']!=null&&data['importance'].length==0) delete data['importance'];
+		</c:when>
+		<c:when test="${ workspace eq 'campaign' && empty linkable}">
+				data['name'] = rename;
+				data['order'] = order;
+				url = '${searchUrl}';
+		</c:when>
+		</c:choose>
 		
-		<%-- the following is just more wtf on the pile of wtf, I don't care anymore --%>
-		if (data['importance']!=null&&data['importance'].length==0) delete data['importance'];
-
 		<%-- load with data issues a POST --%>
 		$.get(url, data, function(data) {
 			$("#search-result-pane").html(data);