web/views/basecomponents.py
changeset 2799 b703639614e7
parent 2650 18aec79ec3a3
child 2818 326375561412
equal deleted inserted replaced
2798:9c650701cb17 2799:b703639614e7
    27     }
    27     }
    28 
    28 
    29 class RQLInputForm(component.Component):
    29 class RQLInputForm(component.Component):
    30     """build the rql input form, usually displayed in the header"""
    30     """build the rql input form, usually displayed in the header"""
    31     id = 'rqlinput'
    31     id = 'rqlinput'
    32     property_defs = VISIBLE_PROP_DEF
    32     cw_property_defs = VISIBLE_PROP_DEF
    33     visible = False
    33     visible = False
    34 
    34 
    35     def call(self, view=None):
    35     def call(self, view=None):
    36         if hasattr(view, 'filter_box_context_info'):
    36         if hasattr(view, 'filter_box_context_info'):
    37             rset = view.filter_box_context_info()[0]
    37             rset = view.filter_box_context_info()[0]
    57 
    57 
    58 
    58 
    59 class ApplLogo(component.Component):
    59 class ApplLogo(component.Component):
    60     """build the instance logo, usually displayed in the header"""
    60     """build the instance logo, usually displayed in the header"""
    61     id = 'logo'
    61     id = 'logo'
    62     property_defs = VISIBLE_PROP_DEF
    62     cw_property_defs = VISIBLE_PROP_DEF
    63     # don't want user to hide this component using an cwproperty
    63     # don't want user to hide this component using an cwproperty
    64     site_wide = True
    64     site_wide = True
    65 
    65 
    66     def call(self):
    66     def call(self):
    67         self.w(u'<a href="%s"><img class="logo" src="%s" alt="logo"/></a>'
    67         self.w(u'<a href="%s"><img class="logo" src="%s" alt="logo"/></a>'
    69 
    69 
    70 
    70 
    71 class ApplHelp(component.Component):
    71 class ApplHelp(component.Component):
    72     """build the help button, usually displayed in the header"""
    72     """build the help button, usually displayed in the header"""
    73     id = 'help'
    73     id = 'help'
    74     property_defs = VISIBLE_PROP_DEF
    74     cw_property_defs = VISIBLE_PROP_DEF
    75     def call(self):
    75     def call(self):
    76         self.w(u'<a href="%s" class="help" title="%s">&nbsp;</a>'
    76         self.w(u'<a href="%s" class="help" title="%s">&nbsp;</a>'
    77                % (self.build_url(_restpath='doc/main'),
    77                % (self.build_url(_restpath='doc/main'),
    78                   self.req._(u'help'),))
    78                   self.req._(u'help'),))
    79 
    79 
    80 
    80 
    81 class UserLink(component.Component):
    81 class UserLink(component.Component):
    82     """if the user is the anonymous user, build a link to login
    82     """if the user is the anonymous user, build a link to login
    83     else a link to the connected user object with a loggout link
    83     else a link to the connected user object with a loggout link
    84     """
    84     """
    85     property_defs = VISIBLE_PROP_DEF
    85     cw_property_defs = VISIBLE_PROP_DEF
    86     # don't want user to hide this component using an cwproperty
    86     # don't want user to hide this component using an cwproperty
    87     site_wide = True
    87     site_wide = True
    88     id = 'loggeduserlink'
    88     id = 'loggeduserlink'
    89 
    89 
    90     def call(self):
    90     def call(self):
   122     section
   122     section
   123     """
   123     """
   124     __select__ = yes()
   124     __select__ = yes()
   125     id = 'applmessages'
   125     id = 'applmessages'
   126     # don't want user to hide this component using an cwproperty
   126     # don't want user to hide this component using an cwproperty
   127     property_defs = {}
   127     cw_property_defs = {}
   128 
   128 
   129     def call(self):
   129     def call(self):
   130         msgs = [msg for msg in (self.req.get_shared_data('sources_error', pop=True),
   130         msgs = [msg for msg in (self.req.get_shared_data('sources_error', pop=True),
   131                                 self.req.message) if msg]
   131                                 self.req.message) if msg]
   132         self.w(u'<div id="appMsg" onclick="%s" class="%s">\n' %
   132         self.w(u'<div id="appMsg" onclick="%s" class="%s">\n' %
   138 
   138 
   139 
   139 
   140 class ApplicationName(component.Component):
   140 class ApplicationName(component.Component):
   141     """display the instance name"""
   141     """display the instance name"""
   142     id = 'appliname'
   142     id = 'appliname'
   143     property_defs = VISIBLE_PROP_DEF
   143     cw_property_defs = VISIBLE_PROP_DEF
   144     # don't want user to hide this component using an cwproperty
   144     # don't want user to hide this component using an cwproperty
   145     site_wide = True
   145     site_wide = True
   146 
   146 
   147     def call(self):
   147     def call(self):
   148         title = self.req.property_value('ui.site-title')
   148         title = self.req.property_value('ui.site-title')
   168     to be able to filter accordingly.
   168     to be able to filter accordingly.
   169     """
   169     """
   170     id = 'etypenavigation'
   170     id = 'etypenavigation'
   171     __select__ = two_etypes_rset() | match_form_params('__restrtype', '__restrtypes',
   171     __select__ = two_etypes_rset() | match_form_params('__restrtype', '__restrtypes',
   172                                                        '__restrrql')
   172                                                        '__restrrql')
   173     property_defs = VISIBLE_PROP_DEF
   173     cw_property_defs = VISIBLE_PROP_DEF
   174     # don't want user to hide this component using an cwproperty
   174     # don't want user to hide this component using an cwproperty
   175     site_wide = True
   175     site_wide = True
   176     visible = False # disabled by default
   176     visible = False # disabled by default
   177 
   177 
   178     def call(self):
   178     def call(self):