Commit e591623d authored by Aurel's avatar Aurel

add button for hot relaoding of Constraints

do not create Constraint with empty class name


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11366 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 14037ed6
...@@ -8,3 +8,4 @@ from CategoryExistence import CategoryExistence ...@@ -8,3 +8,4 @@ from CategoryExistence import CategoryExistence
from PortalTypeClass import PortalTypeClass from PortalTypeClass import PortalTypeClass
from CategoryAcquiredMembershipArity import CategoryAcquiredMembershipArity from CategoryAcquiredMembershipArity import CategoryAcquiredMembershipArity
from TALESConstraint import TALESConstraint from TALESConstraint import TALESConstraint
from BankAccountRIB import BankAccountRIB
...@@ -545,7 +545,11 @@ class Test(ERP5TypeTestCase): ...@@ -545,7 +545,11 @@ class Test(ERP5TypeTestCase):
def newConstraint(self, class_id, REQUEST=None): def newConstraint(self, class_id, REQUEST=None):
""" """
Updates a Constraint with a new text Updates a Constraint with a new text
""" """
if class_id == '':
if REQUEST is not None:
REQUEST.RESPONSE.redirect('%s/manage_viewConstraintList?message=You+must+specify+a+class+name' % (self.absolute_url(),))
return
text = """ text = """
############################################################################## ##############################################################################
# #
...@@ -608,6 +612,22 @@ class ConstraintTemplate(Constraint): ...@@ -608,6 +612,22 @@ class ConstraintTemplate(Constraint):
if REQUEST is not None: if REQUEST is not None:
REQUEST.RESPONSE.redirect('%s/manage_editConstraintForm?class_id=%s&message=Constraint+Saved' % (self.absolute_url(), class_id)) REQUEST.RESPONSE.redirect('%s/manage_editConstraintForm?class_id=%s&message=Constraint+Saved' % (self.absolute_url(), class_id))
security.declareProtected( Permissions.ManageExtensions, 'importConstraint' )
def importConstraint(self, class_id, REQUEST=None):
"""
Imports a Constraint class
"""
from Products.ERP5Type.Utils import importLocalConstraint
local_product = self.Control_Panel.Products.ERP5Type
app = local_product._p_jar.root()['Application']
importLocalConstraint(class_id)
# Reset _aq_dynamic after reload
# There is no need to reset the cache in this case because
# XXX it is not sure however that class defined propertysheets will be updated
_aq_reset()
if REQUEST is not None:
REQUEST.RESPONSE.redirect('%s/manage_editConstraintForm?class_id=%s&message=Constraint+Reloaded+Successfully' % (self.absolute_url(), class_id))
security.declareProtected( Permissions.ManageExtensions, 'generateProduct' ) security.declareProtected( Permissions.ManageExtensions, 'generateProduct' )
def generateProduct(self, product_id, def generateProduct(self, product_id,
document_id_list=(), property_sheet_id_list=(), constraint_id_list=(), document_id_list=(), property_sheet_id_list=(), constraint_id_list=(),
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
<br> <br>
<input type="hidden" name="class_id:string" value="<dtml-var class_id>"> <input type="hidden" name="class_id:string" value="<dtml-var class_id>">
<input type="submit" value="Save" name="editConstraint:method"> <input type="submit" value="Save" name="editConstraint:method">
<input type="submit" value="Reload" name="importConstraint:method">
</form> </form>
<dtml-var manage_page_footer> <dtml-var manage_page_footer>
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<dtml-var manage_tabs> <dtml-var manage_tabs>
<div class="std-text"><p><strong>Local Constraint Classes</strong></p></div> <div class="std-text"><p><strong>Local Constraint Classes</strong></p></div>
<dtml-if message><dtml-var message></dtml-if>
<form method="POST" action="newConstraint"> <form method="POST" action="newConstraint">
<table width="100%"> <table width="100%">
<tr class="list-header"> <tr class="list-header">
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment