Fixed DisplayCommand bug that made it impossible to display a term if there query.entry was null.
This commit is contained in:
parent
ed9e9c0982
commit
cd65eb18b9
2 changed files with 19 additions and 9 deletions
|
@ -64,18 +64,28 @@ public class DisplayCommand extends LexCommand implements Command
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
LexQuery query = visit.getQuery();
|
LexQuery query = visit.getQuery();
|
||||||
if ( null != component )
|
if ( component instanceof ITerm )
|
||||||
{
|
{
|
||||||
component.populate( req.getParameterMap() );
|
ITerm term = (ITerm) component;
|
||||||
query.setQueryComponent( component );
|
|
||||||
LexComponentRepository.loadTermByPk( query );
|
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
|
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 );
|
req.setAttribute( LexConstants.MESSAGE_REQ_ATTR, msg );
|
||||||
|
|
||||||
return next;
|
return next;
|
||||||
|
|
|
@ -95,8 +95,8 @@ translations
|
||||||
<c:if test="${ sessionScope.visit.helper.showEditOptions }">
|
<c:if test="${ sessionScope.visit.helper.showEditOptions }">
|
||||||
<c:set var="ckd" value='checked="checked"'/>
|
<c:set var="ckd" value='checked="checked"'/>
|
||||||
</c:if>
|
</c:if>
|
||||||
<c:out value='<input name="showEditOptions" type="checkbox" value="true" ${ckd}/>' escapeXml='false'/>
|
| <c:out value='<input name="showEditOptions" type="checkbox" value="true" ${ckd}/>' escapeXml='false'/>
|
||||||
| edit options
|
edit options
|
||||||
</c:if>
|
</c:if>
|
||||||
|
|
||||||
<input type="hidden" name="cmd" value="displayFull"/>
|
<input type="hidden" name="cmd" value="displayFull"/>
|
||||||
|
|
Loading…
Reference in a new issue