Fixed DisplayCommand bug that made it impossible to display a term if there query.entry was null.

This commit is contained in:
dubtraxis 2003-10-21 19:27:54 +00:00
parent ed9e9c0982
commit cd65eb18b9
2 changed files with 19 additions and 9 deletions

View File

@ -64,18 +64,28 @@ public class DisplayCommand extends LexCommand implements Command
try
{
LexQuery query = visit.getQuery();
if ( null != component )
if ( component instanceof ITerm )
{
component.populate( req.getParameterMap() );
query.setQueryComponent( component );
LexComponentRepository.loadTermByPk( query );
ITerm term = (ITerm) component;
if ( null != query.getEntry() && term.getMetaId().equals( query.getEntry().getMetaId() ) )
{
LexComponentRepository.update( query.getEntry() );
}
else
{
LexComponentRepository.loadTermByPk( term );
query.setEntry( term );
}
displayHelper.populate( req.getParameterMap() );
}
else
{
LexComponentRepository.update( query.getEntry() );
setNext( "menu.jsp" );
msg = "The component you were trying to display was not a term.";
}
displayHelper.populate( req.getParameterMap() );
req.setAttribute( LexConstants.MESSAGE_REQ_ATTR, msg );
return next;

View File

@ -95,8 +95,8 @@ translations
<c:if test="${ sessionScope.visit.helper.showEditOptions }">
<c:set var="ckd" value='checked="checked"'/>
</c:if>
<c:out value='<input name="showEditOptions" type="checkbox" value="true" ${ckd}/>' escapeXml='false'/>
| edit options
| <c:out value='<input name="showEditOptions" type="checkbox" value="true" ${ckd}/>' escapeXml='false'/>
edit options
</c:if>
<input type="hidden" name="cmd" value="displayFull"/>