web/request.py
changeset 5713 605f571198eb
parent 5685 17883ced01f8
child 5774 0d792bceb25d
equal deleted inserted replaced
5712:e136d392bd71 5713:605f571198eb
   567         for cssfile in cssfiles:
   567         for cssfile in cssfiles:
   568             if localfile:
   568             if localfile:
   569                 cssfile = self.datadir_url + cssfile
   569                 cssfile = self.datadir_url + cssfile
   570             add_css(cssfile, media, *extraargs)
   570             add_css(cssfile, media, *extraargs)
   571 
   571 
       
   572     @deprecated('[3.9] use ajax_replace_url() instead, naming rql and vid arguments')
   572     def build_ajax_replace_url(self, nodeid, rql, vid, replacemode='replace',
   573     def build_ajax_replace_url(self, nodeid, rql, vid, replacemode='replace',
   573                                **extraparams):
   574                                **extraparams):
       
   575         return self.ajax_replace_url(nodeid, replacemode, rql=rql, vid=vid,
       
   576                                      **extraparams)
       
   577 
       
   578     def ajax_replace_url(self, nodeid, replacemode='replace', **extraparams):
   574         """builds an ajax url that will replace nodeid's content
   579         """builds an ajax url that will replace nodeid's content
   575 
   580 
   576         :param nodeid: the dom id of the node to replace
   581         :param nodeid: the dom id of the node to replace
   577         :param rql: rql to execute
       
   578         :param vid: the view to apply on the resultset
       
   579         :param replacemode: defines how the replacement should be done.
   582         :param replacemode: defines how the replacement should be done.
   580 
   583 
   581         Possible values are :
   584           Possible values are :
   582         - 'replace' to replace the node's content with the generated HTML
   585           - 'replace' to replace the node's content with the generated HTML
   583         - 'swap' to replace the node itself with the generated HTML
   586           - 'swap' to replace the node itself with the generated HTML
   584         - 'append' to append the generated HTML to the node's content
   587           - 'append' to append the generated HTML to the node's content
   585         """
   588 
   586         url = self.build_url('view', rql=rql, vid=vid, __notemplate=1,
   589         Arbitrary extra named arguments may be given, they will be included as
   587                              **extraparams)
   590         parameters of the generated url.
   588         return "javascript: loadxhtml('%s', '%s', '%s')" % (
   591         """
   589             nodeid, xml_escape(url), replacemode)
   592         extraparams.setdefault('fname', 'view')
       
   593         url = self.build_url('json', **extraparams)
       
   594         return "javascript: $('#%s').loadxhtml(%s, null, 'get', '%s'); noop()" % (
       
   595                 nodeid, dumps(url), replacemode)
   590 
   596 
   591     # urls/path management ####################################################
   597     # urls/path management ####################################################
   592 
   598 
   593     def url(self, includeparams=True):
   599     def url(self, includeparams=True):
   594         """return currently accessed url"""
   600         """return currently accessed url"""