web/views/basecomponents.py
changeset 9445 65d93a4fd11c
parent 8694 d901c36bcfce
child 9552 1358f8ef1b5b
equal deleted inserted replaced
9444:6012cf57f48e 9445:65d93a4fd11c
     1 # copyright 2003-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     1 # copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
     2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
     3 #
     3 #
     4 # This file is part of CubicWeb.
     4 # This file is part of CubicWeb.
     5 #
     5 #
     6 # CubicWeb is free software: you can redistribute it and/or modify it under the
     6 # CubicWeb is free software: you can redistribute it and/or modify it under the
   186     """display messages given using the __message parameter into a special div
   186     """display messages given using the __message parameter into a special div
   187     section
   187     section
   188     """
   188     """
   189     __select__ = yes()
   189     __select__ = yes()
   190     __regid__ = 'applmessages'
   190     __regid__ = 'applmessages'
   191     # don't want user to hide this component using an cwproperty
   191     # don't want user to hide this component using a cwproperty
   192     cw_property_defs = {}
   192     cw_property_defs = {}
   193 
   193 
   194     def call(self, msg=None):
   194     def call(self, msg=None):
   195         if msg is None:
   195         if msg is None:
   196             msgs = []
   196             msg = self._cw.message # XXX don't call self._cw.message twice
   197             if self._cw.cnx:
       
   198                 srcmsg = self._cw.get_shared_data('sources_error', pop=True, txdata=True)
       
   199                 if srcmsg:
       
   200                     msgs.append(srcmsg)
       
   201             reqmsg = self._cw.message # XXX don't call self._cw.message twice
       
   202             if reqmsg:
       
   203                 msgs.append(reqmsg)
       
   204         else:
       
   205             msgs = [msg]
       
   206         self.w(u'<div id="appMsg" onclick="%s" class="%s">\n' %
   197         self.w(u'<div id="appMsg" onclick="%s" class="%s">\n' %
   207                (toggle_action('appMsg'), (msgs and ' ' or 'hidden')))
   198                (toggle_action('appMsg'), (msg and ' ' or 'hidden')))
   208         for msg in msgs:
   199         self.w(u'<div class="message" id="%s">%s</div>' % (self.domid, msg))
   209             self.w(u'<div class="message" id="%s">%s</div>' % (self.domid, msg))
       
   210         self.w(u'</div>')
   200         self.w(u'</div>')
   211 
   201 
   212 
   202 
   213 class EtypeRestrictionComponent(component.Component):
   203 class EtypeRestrictionComponent(component.Component):
   214     """displays the list of entity types contained in the resultset
   204     """displays the list of entity types contained in the resultset