bug 2935 : This proved to be a more complicated problem than it might have. Exceptions thrown during deletion were not caught by the user interface, so the user got a fairly ugly error message. Fixed.
status 2935 : resolved FIXED
This commit is contained in:
parent
9fac74f803
commit
b87e01bd64
|
@ -9,8 +9,8 @@
|
|||
Transform ADL into (partial) controller classes
|
||||
|
||||
$Author: sb $
|
||||
$Revision: 1.42 $
|
||||
$Date: 2009-05-12 14:29:12 $
|
||||
$Revision: 1.43 $
|
||||
$Date: 2009-05-12 15:43:18 $
|
||||
-->
|
||||
|
||||
<!-- WARNING WARNING WARNING: Do NOT reformat this file!
|
||||
|
@ -72,7 +72,7 @@
|
|||
//
|
||||
// Automatically generated abstract super class for controllers for the
|
||||
// <xsl:value-of select="/adl:application/@name"/> application; generated using
|
||||
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.42 $', 10)"/>
|
||||
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.43 $', 10)"/>
|
||||
//
|
||||
// <xsl:value-of select="/adl:application/@revision"/>
|
||||
//
|
||||
|
@ -182,7 +182,7 @@
|
|||
//
|
||||
// Controller for auto-generated forms for editing <xsl:value-of select="@name"/>s
|
||||
// Automatically generated from application description using
|
||||
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.42 $', 10)"/>
|
||||
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.43 $', 10)"/>
|
||||
//
|
||||
// This file is automatically generated; DO NOT EDIT IT.
|
||||
//
|
||||
|
@ -684,27 +684,33 @@
|
|||
/// <summary>
|
||||
/// Actually delete the selected record
|
||||
/// </summary>
|
||||
[AccessibleThrough(Verb.Post)]
|
||||
public void Delete()
|
||||
{
|
||||
AssertUserCanDelete();
|
||||
ISession hibernator = GetDBSession();
|
||||
[AccessibleThrough(Verb.Post)]
|
||||
public void Delete()
|
||||
{
|
||||
AssertUserCanDelete();
|
||||
ISession hibernator = GetDBSession();
|
||||
<xsl:value-of select="concat($entityns, '.', @name)"/> record = null;
|
||||
|
||||
if ( "true".Equals( Params["reallydelete"]))
|
||||
{
|
||||
<xsl:value-of select="concat($entityns, '.', @name)"/> record = FetchRecord( hibernator);
|
||||
if ( "true".Equals( Params["reallydelete"]))
|
||||
{
|
||||
record = FetchRecord( hibernator);
|
||||
|
||||
if ( record != null)
|
||||
{
|
||||
try {
|
||||
record.BeforeDeleteHook( hibernator);
|
||||
hibernator.Delete( record);
|
||||
hibernator.Flush();
|
||||
} catch ( DomainKnowledgeViolationException dkve) {
|
||||
AddError( dkve);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ApplicationException( "No such record?");
|
||||
}
|
||||
}
|
||||
if ( HasNoErrors()) {
|
||||
<xsl:choose>
|
||||
<xsl:when test="adl:list">
|
||||
Redirect( "<xsl:value-of select="concat(adl:list[position()=1]/@name, '.rails')"/>");
|
||||
|
@ -713,8 +719,12 @@
|
|||
Redirect( FormsAuthentication.DefaultUrl);
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
}
|
||||
</xsl:if>
|
||||
} else {
|
||||
PropertyBag[ "instance"] = record;
|
||||
RenderViewWithFailover( "maybedelete.vm", "maybedelete.auto.vm");
|
||||
}
|
||||
}
|
||||
</xsl:if>
|
||||
<xsl:apply-templates select="adl:form"/>
|
||||
|
||||
<xsl:if test="adl:list">
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
Transform ADL into velocity view templates
|
||||
|
||||
$Author: sb $
|
||||
$Revision: 1.59 $
|
||||
$Date: 2009-05-12 14:29:12 $
|
||||
$Revision: 1.60 $
|
||||
$Date: 2009-05-12 15:43:18 $
|
||||
-->
|
||||
<!-- WARNING WARNING WARNING: Do NOT reformat this file!
|
||||
Whitespace (or lack of it) is significant! -->
|
||||
|
@ -129,10 +129,10 @@
|
|||
</xsl:comment>
|
||||
<xsl:call-template name="head"/>
|
||||
#end
|
||||
<xsl:call-template name="maybe-delete">
|
||||
<xsl:with-param name="entity" select="."/>
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
<xsl:call-template name="maybe-delete">
|
||||
<xsl:with-param name="entity" select="."/>
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
<!-- generate views for an entity, assuming an empty layout
|
||||
(i.e. I'm responsible for html, head and body tags) -->
|
||||
|
@ -181,6 +181,32 @@
|
|||
<xsl:template name="maybe-delete">
|
||||
<xsl:param name="entity"/>
|
||||
<div class="content">
|
||||
<xsl:if test="$show-errors = 'true'">
|
||||
#if ( $errors)
|
||||
#if ( $errors.Count != 0)
|
||||
<ul class="errors">
|
||||
#foreach($e in $errors)
|
||||
#if($e.Message)
|
||||
<li>$t.Error($e)</li>
|
||||
#else
|
||||
<li>$t.Enc($e)</li>
|
||||
#end
|
||||
#end
|
||||
</ul>
|
||||
#end
|
||||
#end
|
||||
</xsl:if>
|
||||
<xsl:if test="$show-messages = 'true'">
|
||||
#if( $messages)
|
||||
#if ( $messages.Count != 0)
|
||||
<ul class="information">
|
||||
#foreach ( $message in $messages)
|
||||
<li>$message</li>
|
||||
#end
|
||||
</ul>
|
||||
#end
|
||||
#end
|
||||
</xsl:if>
|
||||
<form action="delete.rails" method="post">
|
||||
<xsl:for-each select="$entity/adl:key/adl:property">
|
||||
<xsl:choose>
|
||||
|
@ -1822,7 +1848,7 @@
|
|||
Auto generated Velocity macro for <xsl:value-of select="@name"/>,
|
||||
generated from ADL.
|
||||
|
||||
Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.59 $', 10)"/>
|
||||
Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.60 $', 10)"/>
|
||||
Generation parameters were:
|
||||
area-name: <xsl:value-of select="$area-name"/>
|
||||
default-url: <xsl:value-of select="$default-url"/>
|
||||
|
|
Loading…
Reference in a new issue