web/request.py
branchstable
changeset 4860 cedb6afdb7da
parent 4719 aaed3f813ef8
child 4868 e34cbd85d14d
equal deleted inserted replaced
4859:f65208c9dbdc 4860:cedb6afdb7da
   490         for jsfile in jsfiles:
   490         for jsfile in jsfiles:
   491             if localfile:
   491             if localfile:
   492                 jsfile = self.datadir_url + jsfile
   492                 jsfile = self.datadir_url + jsfile
   493             self.html_headers.add_js(jsfile)
   493             self.html_headers.add_js(jsfile)
   494 
   494 
   495     def add_css(self, cssfiles, media=u'all', localfile=True, ieonly=False):
   495     def add_css(self, cssfiles, media=u'all', localfile=True, ieonly=False,
       
   496                 iespec=u'[if lt IE 8]'):
   496         """specify a CSS file to include in the HTML headers
   497         """specify a CSS file to include in the HTML headers
   497         :param cssfiles: a CSS filename or a list of CSS filenames
   498         :param cssfiles: a CSS filename or a list of CSS filenames
   498         :param media: the CSS's media if necessary
   499         :param media: the CSS's media if necessary
   499         :param localfile: if True, the default data dir prefix is added to the
   500         :param localfile: if True, the default data dir prefix is added to the
   500                           CSS filename
   501                           CSS filename
       
   502         :param ieonly: True if this css is specific to IE
       
   503         :param iespec: conditional expression that will be used around
       
   504                        the css inclusion. cf:
       
   505                        http://msdn.microsoft.com/en-us/library/ms537512(VS.85).aspx
   501         """
   506         """
   502         if isinstance(cssfiles, basestring):
   507         if isinstance(cssfiles, basestring):
   503             cssfiles = (cssfiles,)
   508             cssfiles = (cssfiles,)
   504         if ieonly:
   509         if ieonly:
   505             if self.ie_browser():
   510             if self.ie_browser():
       
   511                 extraargs = [iespec]
   506                 add_css = self.html_headers.add_ie_css
   512                 add_css = self.html_headers.add_ie_css
   507             else:
   513             else:
   508                 return # no need to do anything on non IE browsers
   514                 return # no need to do anything on non IE browsers
   509         else:
   515         else:
       
   516             extraargs = []
   510             add_css = self.html_headers.add_css
   517             add_css = self.html_headers.add_css
   511         for cssfile in cssfiles:
   518         for cssfile in cssfiles:
   512             if localfile:
   519             if localfile:
   513                 cssfile = self.datadir_url + cssfile
   520                 cssfile = self.datadir_url + cssfile
   514             add_css(cssfile, media)
   521             add_css(cssfile, media, *extraargs)
   515 
   522 
   516     def build_ajax_replace_url(self, nodeid, rql, vid, replacemode='replace',
   523     def build_ajax_replace_url(self, nodeid, rql, vid, replacemode='replace',
   517                                **extraparams):
   524                                **extraparams):
   518         """builds an ajax url that will replace `nodeid`s content
   525         """builds an ajax url that will replace `nodeid`s content
   519         :param nodeid: the dom id of the node to replace
   526         :param nodeid: the dom id of the node to replace