[Erp5-report] r11366 - in /erp5/trunk/products/ERP5Type: Constraint/ Tool/ dtml/

nobody at svn.erp5.org nobody at svn.erp5.org
Sat Nov 18 13:16:49 CET 2006


Author: aurel
Date: Sat Nov 18 13:16:42 2006
New Revision: 11366

URL: http://svn.erp5.org?rev=11366&view=rev
Log:
add button for hot relaoding of Constraints
do not create Constraint with empty class name

Modified:
    erp5/trunk/products/ERP5Type/Constraint/__init__.py
    erp5/trunk/products/ERP5Type/Tool/ClassTool.py
    erp5/trunk/products/ERP5Type/dtml/editConstraintForm.dtml
    erp5/trunk/products/ERP5Type/dtml/viewConstraintList.dtml

Modified: erp5/trunk/products/ERP5Type/Constraint/__init__.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Constraint/__init__.py?rev=11366&r1=11365&r2=11366&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Constraint/__init__.py (original)
+++ erp5/trunk/products/ERP5Type/Constraint/__init__.py Sat Nov 18 13:16:42 2006
@@ -8,3 +8,4 @@
 from PortalTypeClass import PortalTypeClass
 from CategoryAcquiredMembershipArity import CategoryAcquiredMembershipArity
 from TALESConstraint import TALESConstraint
+from BankAccountRIB import BankAccountRIB

Modified: erp5/trunk/products/ERP5Type/Tool/ClassTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Tool/ClassTool.py?rev=11366&r1=11365&r2=11366&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Tool/ClassTool.py (original)
+++ erp5/trunk/products/ERP5Type/Tool/ClassTool.py Sat Nov 18 13:16:42 2006
@@ -545,7 +545,11 @@
       def newConstraint(self, class_id, REQUEST=None):
         """
           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 = """
 ##############################################################################
 #
@@ -607,6 +611,22 @@
         writeLocalConstraint(class_id, text, create=0)
         if REQUEST is not None:
           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' )
       def generateProduct(self, product_id,

Modified: erp5/trunk/products/ERP5Type/dtml/editConstraintForm.dtml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/dtml/editConstraintForm.dtml?rev=11366&r1=11365&r2=11366&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/dtml/editConstraintForm.dtml (original)
+++ erp5/trunk/products/ERP5Type/dtml/editConstraintForm.dtml Sat Nov 18 13:16:42 2006
@@ -10,6 +10,7 @@
 <br>
 <input type="hidden" name="class_id:string" value="<dtml-var class_id>">
 <input type="submit" value="Save" name="editConstraint:method">
+<input type="submit" value="Reload" name="importConstraint:method">  
 </form>
 
 <dtml-var manage_page_footer>

Modified: erp5/trunk/products/ERP5Type/dtml/viewConstraintList.dtml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/dtml/viewConstraintList.dtml?rev=11366&r1=11365&r2=11366&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/dtml/viewConstraintList.dtml (original)
+++ erp5/trunk/products/ERP5Type/dtml/viewConstraintList.dtml Sat Nov 18 13:16:42 2006
@@ -2,7 +2,7 @@
 <dtml-var manage_tabs>
 
 <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">
 <table width="100%">
   <tr class="list-header">




More information about the Erp5-report mailing list