• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python chrome.add_script函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中trac.web.chrome.add_script函数的典型用法代码示例。如果您正苦于以下问题:Python add_script函数的具体用法?Python add_script怎么用?Python add_script使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了add_script函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: process_admin_request

    def process_admin_request(self, req, cat, page, path_info):
        # Page locations
        req.hdf['tracforge.href'] = {
            'prototypes': req.href.admin(cat, page),
            'configset': req.href.admin(cat, page, 'configset'),
            'new': req.href.admin(cat, page, 'new'),
            'htdocs': req.href.chrome('tracforge'),
        }
        
        # General stuff
        add_stylesheet(req, 'tracforge/css/admin.css')
        add_script(req, 'tracforge/js/jquery.js')
        req.cat = cat
        req.page = page

        # Subpage dispatchers
        if path_info:
            if path_info == 'configset':
                return self.process_configset_admin_request(req, cat, page, path_info)
            elif path_info == 'new':
                return self._show_prototype(req, path_info, action='new')
            else:
                return self._show_prototype(req, path_info, action='edit')
        
    
        req.hdf['tracforge.prototypes.tags'] = list(Prototype.select(self.env))
        
        return 'admin_tracforge_prototypes.cs', None
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:28,代码来源:prototypes_admin.py


示例2: process_request

    def process_request(self, req):
        # Create request context.
        context = Context.from_request(req)
        context.realm = 'screenshots-core'

        # Template data dictionary.
        req.data = {}

        # Get database access.
        db = self.env.get_db_cnx()
        context.cursor = db.cursor()

        # Prepare data structure.
        req.data['title'] = self.mainnav_title or self.metanav_title
        req.data['has_tags'] = self.env.is_component_enabled(
          'tracscreenshots.tags.ScreenshotsTags')

        # Get action from request and perform them.
        actions = self._get_actions(context)
        self.log.debug('actions: %s' % (actions,))
        template, content_type = self._do_actions(context, actions)

        # Add CSS style and JavaScript scripts.
        add_stylesheet(req, 'screenshots/css/screenshots.css')
        add_script(req, 'screenshots/js/screenshots.js')

        # Return template and its data.
        db.commit()
        return (template + '.html', {'screenshots' : req.data}, content_type)
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:29,代码来源:core.py


示例3: post_process_request

 def post_process_request(self, req, template, data, content_type):
     path = req.path_info
     if path.startswith('/ticket/') or path.startswith('/wiki') \
        or path.startswith('/attachment/'):
         add_script(req, EMBED_PATH_FLOWPLAYER['js'])
         add_stylesheet(req, EMBED_PATH_FLOWPLAYER['css'])
     return template, data, content_type
开发者ID:arielnetworks,项目名称:TracMovieMacro,代码行数:7,代码来源:macro.py


示例4: post_process_request

 def post_process_request(self, req, template, data, content_type):
     self.log.debug("TicketRefsTemplate: post_process_request, %s, %s" % (
                    req.path_info, template))
     if req.path_info.startswith("/ticket/"):
         add_stylesheet(req, "ticketref/ticket.css")
         add_script(req, "ticketref/ticket.js")
     return template, data, content_type
开发者ID:karlamalta,项目名称:ProjetoFinal,代码行数:7,代码来源:web_ui.py


示例5: _render_config_panel

    def _render_config_panel(self, req, cat, page):
        req.perm.require('SPAM_CONFIG')
        filter_system = FilterSystem(self.env)

        strategies = []
        for strategy in filter_system.strategies:
            for variable in dir(strategy):
                if variable.endswith('karma_points'):
                    strategies.append({
                        'name': strategy.__class__.__name__,
                        'karma_points': getattr(strategy, variable),
                        'variable': variable,
                        'karma_help': gettext(getattr(strategy.__class__,
                                                      variable).__doc__)
                    })

        add_script(req, 'spamfilter/adminconfig.js')
        return {
            'strategies': sorted(strategies, key=lambda x: x['name']),
            'min_karma': filter_system.min_karma,
            'authenticated_karma': filter_system.authenticated_karma,
            'attachment_karma': filter_system.attachment_karma,
            'register_karma': filter_system.register_karma,
            'trust_authenticated': filter_system.trust_authenticated,
            'logging_enabled': filter_system.logging_enabled,
            'nolog_obvious': filter_system.nolog_obvious,
            'purge_age': filter_system.purge_age,
            'spam_monitor_entries_min': self.MIN_PER_PAGE,
            'spam_monitor_entries_max': self.MAX_PER_PAGE,
            'spam_monitor_entries': self.DEF_PER_PAGE
        }
开发者ID:Puppet-Finland,项目名称:trac,代码行数:31,代码来源:admin.py


示例6: post_process_request

 def post_process_request(self, req, template, data, content_type):
     if req.path_info.startswith('/ticket/') or \
        req.path_info.startswith('/newticket'):
         add_script(req, 'keywordsuggest/jquery.bgiframe.min.js')
         add_script(req, 'keywordsuggest/jquery.autocomplete.pack.js')
         add_stylesheet(req, 'keywordsuggest/autocomplete.css')
     return template, data, content_type
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:7,代码来源:keywordsuggest.py


示例7: _do_login

 def _do_login(self, req):
     # check the referer
     referer = req.get_header('Referer')
     if referer and not (referer == req.base_url or referer.startswith(req.base_url.rstrip('/')+'/')):
         # only redirect to referer if it is from the same site
         referer = None
     if referer:
        req.session['oid.referer'] = referer
     if self.default_openid:
        req.args['openid_identifier'] = self.default_openid
        return self._do_verify(req)
     add_stylesheet(req, 'authopenid/css/openid.css')
     add_script(req, 'authopenid/js/openid-jquery.js')
     return 'openidlogin.html', {
         'images': req.href.chrome('authopenid/images') + '/',
         'action': req.href.openidverify(),
         'message': 'Login using OpenID.',
         'signup': self.signup_link,
         'whatis': self.whatis_link,
         'css_class': 'error',
         'providers_regexp': self.providers_regexp,
         'custom_provider_name': self.custom_provider_name,
         'custom_provider_label': self.custom_provider_label,
         'custom_provider_url': self.custom_provider_url,
         'custom_provider_image': self.custom_provider_image,
         'custom_provider_size': self.custom_provider_size,
         }, None
开发者ID:edgimar,项目名称:authopenid-plugin,代码行数:27,代码来源:authopenid.py


示例8: filter_stream

    def filter_stream(self, req, method, filename, stream, data):
        selector = ['.user-field']
        page_map = {
            "ticket.html": ["#field-owner", "#field-reporter"],
            "query.html": ["#mods-filters input[name$='_" + field + "']"
                            for field in ("owner", "reporter")],
            "admin_components.html": ["input[name='owner']"],
            "taskboard.html": ["input[class='user-field']"]
        }

        page_map["hours_timeline.html"] = page_map["query.html"]

        def _template_filenames():
            for plugin in self.extra_templates:
                for filename in plugin.get_templates():
                    yield filename

        if filename in page_map:
            if filename == "ticket.html":
                selector.extend('#field-' + n for n in self._user_fields())
            if self.transform_owner_reporter:
                selector.extend(page_map[filename])

        if filename in page_map or filename in _template_filenames():
            self._add_groups_data(req)
            add_script_data(req, {'userfieldSelector': ','.join(selector) })
            add_script(req, 'userfield/js/userfield.js')

        return stream
开发者ID:CGI-define-and-primeportal,项目名称:trac-plugin-userfield,代码行数:29,代码来源:filter.py


示例9: projects

    def projects(self,req):
        add_stylesheet(req, 'cp/css/customers.css')
        projects = self.getProjects()
        inactive_count = 0
        ticketCountP = self.getTicketCountByProject()
        projectTimes = self.getProjectTime()
        for project in projects:
            if ticketCountP.has_key('%s' % project['id']):
                project['ticketCount'] = ticketCountP['%s' % project['id']]
            else:
                project['ticketCount'] = 0

            if projectTimes.has_key('%s' % project['id']):
                project['totalTime'] = projectTimes['%s' % project['id']]
            else:
                project['totalTime'] = '0:00'
            if project['active'] == 0:
                project['class'] = 'inactive'
                project['style'] = 'display: none'
                inactive_count += 1
        customers = self.getCustomers()
        url = req.abs_href(req.path_info)
        edit = req.perm.has_permission('CUST_EDIT')
        data = locals().copy()
        data['c_base_url'] = req.href.cust()
        data['p_base_url'] = req.href.c_projects()
        data['t_base_url'] = req.href.ticket()
        del data['self']
        del data['projectTimes']
        del data['ticketCountP']
        add_script(req, 'cp/js/cust.js')

        return 'projects.html',data,None
开发者ID:sparkintegration,项目名称:CustProj,代码行数:33,代码来源:customerProjects.py


示例10: post_process_request

    def post_process_request(self, req, template, data, content_type):
        """Do any post-processing the request might need; typically adding
        values to the template `data` dictionary, or changing template or
        mime type.
        
        `data` may be update in place.

        Always returns a tuple of (template, data, content_type), even if
        unchanged.

        Note that `template`, `data`, `content_type` will be `None` if:
         - called when processing an error page
         - the default request handler did not return any result

        (Since 0.11)
        """

        if template != "query.html":
            return (template, data, content_type)

        geoticket = self.geoticket()
        location = req.args.get("center_location", "").strip()
        lat = lon = None
        if location:
            try:
                location, (lat, lon) = geoticket.geolocate(location)
            except GeolocationException, e:
                add_script(req, "geoticket/js/query_location_filler.js")
                add_warning(req, Markup(e.html()))
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:29,代码来源:query.py


示例11: _show_regular_page

    def _show_regular_page(self, req):
        req_data = {}
        # Resolve some static data needed on page (categories and project count)
        cs = CQDECategoryStore()
        all_categories = cs.get_all_categories()

        all_contexts = cs.get_contexts()
        combined_context_ids, combined_contexts, non_combined_contexts = self.get_combined_contexts(all_contexts)

        # Total count of projects and count of projects in categories
        direct_category_counts = Projects().get_project_counts_per_category(req.authname)

        req_data['direct_category_counts'] = direct_category_counts
        req_data['combined_context_ids'] = combined_context_ids
        req_data['non_combined_contexts'] = non_combined_contexts

        self.set_category_data_into_request_data(all_categories, req_data)

        add_stylesheet(req, 'multiproject/css/multiproject.css')
        add_script(req, 'multiproject/js/jquery.ba-bbq.js')
        add_script(req, 'multiproject/js/explore.js')

        return "find.html", {
            'top_categories': req_data['top_categories'],
            'categories': req_data['root_categories_of_combined_contexts'],
            'nonbrowsable_cntxt': req_data['non_empty_non_combined_contexts'],
            'selected_tab': self.DEFAULT_TAB,
            'tabs': self.TABS}, \
            None
开发者ID:alvabai,项目名称:trac-multiproject,代码行数:29,代码来源:explore.py


示例12: post_process_request

 def post_process_request(self, req, template, data, content_type):
     # Add Google Map API key using a link tag:
     if self.api_key:
         add_link (req, rel='google-key', href='', title=self.api_key, classname='google-key')
         add_stylesheet  (req, 'googlemap/tracgooglemap.css')
         add_script (req, 'googlemap/tracgooglemap.js')
     return (template, data, content_type)
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:7,代码来源:macro.py


示例13: render_voter

 def render_voter(self, req):
     resource = self.normalise_resource(req.path_info)
     vote = self.get_vote(req, resource)
     up = tag.img(src=req.href.chrome('vote/' + self.image_map[vote][0]), 
                  alt='Up-vote')
     down = tag.img(src=req.href.chrome('vote/' + self.image_map[vote][1]), 
                  alt='Down-vote')         
     if 'VOTE_MODIFY' in req.perm and get_reporter_id(req) != 'anonymous':
         down = tag.a(down, id='downvote',
                      href=req.href.vote('down', resource),
                      title='Down-vote')
         up = tag.a(up, id='upvote', href=req.href.vote('up', resource),
                    title='Up-vote')
         add_script(req, 'vote/js/tracvote.js')
         shown = req.session.get('shown_vote_message')
         if not shown:
             add_notice(req, 'You can vote for resources on this Trac '
                        'install by clicking the up-vote/down-vote arrows '
                        'in the context navigation bar.')
             req.session['shown_vote_message'] = '1'
     body, title = self.format_votes(resource)
     votes = tag.span(body, id='votes')
     add_stylesheet(req, 'vote/css/tracvote.css')
     elm = tag.span(up, votes, down, id='vote', title=title)
     req.chrome.setdefault('ctxtnav', []).insert(0, elm)
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:25,代码来源:__init__.py


示例14: process_request

    def process_request(self, req):
        messages = []

        def addMessage(s):
            messages.extend([s]);

        if not re.search('/Billing', req.path_info):
            return None


        if req.method == 'POST':
            if req.args.has_key('setbillingtime'):
                self.set_bill_date(req.authname)
                addMessage("All tickets last bill date updated")

        mgr = CustomReportManager(self.env, self.log)
        req.hdf["billing_info"] = {"messages":         messages,
                                   "href":             req.href.Billing(),
                                   "report_base_href": req.href.report(),
                                   "reports":          mgr.get_reports_by_group("Timing and Estimation Plugin"),
                                   "usermanual_href":  req.href.wiki(user_manual_wiki_title),
                                   "usermanual_title": user_manual_title
                                   }
        self.set_request_billing_dates(req)
        add_stylesheet(req, "Billing/billingplugin.css")
        add_script(req, "Billing/linkifyer.js")
        return 'billing.cs', 'text/html'
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:27,代码来源:webui.py


示例15: process_downloads

    def process_downloads(self, context):
        # Clear data for next request.
        self.data = {}

        # Get database access.
        db = self.env.get_db_cnx()
        context.cursor = db.cursor()

        # Get request mode
        modes = self._get_modes(context)
        self.log.debug('modes: %s' % modes)

        # Perform mode actions
        self._do_action(context, modes)

        # Fill up HDF structure and return template
        self.data['authname'] = context.req.authname
        self.data['time'] = format_datetime(datetime.now(utc))
        self.data['realm'] = context.resource.realm

        # Add CSS styles
        add_stylesheet(context.req, 'common/css/wiki.css')
        add_stylesheet(context.req, 'downloads/css/downloads.css')
        add_stylesheet(context.req, 'downloads/css/admin.css')

        # Add JavaScripts
        add_script(context.req, 'common/js/trac.js')
        add_script(context.req, 'common/js/wikitoolbar.js')

        # Commit database changes and return template and data.
        db.commit()
        self.env.log.debug(self.data)
        return modes[-1] + '.html', {'downloads' : self.data}
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:33,代码来源:api.py


示例16: post_process_request

    def post_process_request(self, req, template, data, content_type):
        get = self.env.config.get

        for link in self.links:
            rel       = get(self.section, link + '.rel'   )
            href      = get(self.section, link + '.href'  )
            title     = get(self.section, link + '.title' )
            mimetype  = get(self.section, link + '.type'  )
            classname = get(self.section, link + '.class' )

            if rel and href:
                add_link(req, rel, href, title or None, mimetype or None, classname or None)


        for stylesheet in self.stylesheets:
            filename  = get(self.section, stylesheet + '.filename', unicode(self.default_style_base) + stylesheet + '.css' )
            mimetype  = get(self.section, stylesheet + '.mimetype', 'text/css')

            if filename:
                add_stylesheet(req, filename, mimetype)


        for script in self.scripts:
            filename  = get(self.section, script     + '.filename', unicode(self.default_script_base) + script + '.js' )
            mimetype  = get(self.section, script     + '.mimetype', 'text/javascript')

            if filename:
                add_script(req, filename, mimetype)


        return (template, data, content_type)
开发者ID:lkraav,项目名称:trachacks,代码行数:31,代码来源:plugin.py


示例17: render_admin_panel

    def render_admin_panel(self, req, cat, page, path_info):
        if req.method == 'POST':
            self.config.set('theme', 'theme', req.args['theme'].lower())
            self.config.save()
            
            req.redirect(req.href.admin(cat, page)) 
        
        data = {
            'themeengine': {
                'info': self.system.info.items(),
            },
        }

        theme_name = self.system.theme and self.system.theme['name'] or 'default'
        theme_name = theme_name.islower() and theme_name.title() or theme_name
        data['themeengine']['current'] = theme_name
        index = 0
        curtheme = None
        for i, (k, v) in enumerate(data['themeengine']['info']):
            if k.lower() == theme_name.lower():
                index = i
                curtheme = v
                break
        data['themeengine']['current_index'] = index
        data['themeengine']['current_theme'] = curtheme
            
        #add_stylesheet(req, 'themeengine/jquery.jcarousel.css')
        #add_stylesheet(req, 'themeengine/skins/tango/skin.css')
        #add_script(req, 'themeengine/jquery.jcarousel.pack.js')
        add_stylesheet(req, 'themeengine/admin.css')
        add_script(req, 'themeengine/jcarousellite_1.0.1.js')
        return 'admin_theme.html', data
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:32,代码来源:admin.py


示例18: _do_login

 def _do_login(self, req):
     # check the referer
     referer = req.get_header("Referer")
     if referer and not (referer == req.base_url or referer.startswith(req.base_url.rstrip("/") + "/")):
         # only redirect to referer if it is from the same site
         referer = None
     if referer:
         req.session["oid.referer"] = referer
     if self.default_openid:
         req.args["openid_identifier"] = self.default_openid
         return self._do_verify(req)
     add_stylesheet(req, "authopenid/css/openid.css")
     add_script(req, "authopenid/js/openid-jquery.js")
     return (
         "openidlogin.html",
         {
             "images": req.href.chrome("authopenid/images") + "/",
             "action": req.href.openidverify(),
             "message": "Login using OpenID.",
             "signup": self.signup_link,
             "whatis": self.whatis_link,
             "css_class": "error",
             "providers_regexp": self.providers_regexp,
             "custom_provider_name": self.custom_provider_name,
             "custom_provider_label": self.custom_provider_label,
             "custom_provider_url": self.custom_provider_url,
             "custom_provider_image": self.custom_provider_image,
             "custom_provider_size": self.custom_provider_size,
         },
         None,
     )
开发者ID:trac-hacks,项目名称:authopenid-plugin,代码行数:31,代码来源:authopenid.py


示例19: post_process_request

 def post_process_request(self, req, template, data, content_type):
     add_script(req, 'wikicomments/wikicomments.js')
     add_script_data(req,  {
         '_wikicomments_author': req.authname,
         '_wikicomments_base': "%s/chrome/wikicomments" % req.base_path 
     })
     return template, data, content_type        
开发者ID:jarnik,项目名称:trac-wikicomments,代码行数:7,代码来源:wikicomments.py


示例20: expand_macro

    def expand_macro(self, formatter, name, content):
        
        data=dict(user_profiles=[], user_profile_fields={})
        rendered_result=""
        content_args={}
        layout_args={}
        user_profile_templates=[]     
        
        # collecting arguments
        if content:    
            for i, macro_args in enumerate( content.split('|') ):
                if i == 0:
                    content_args = MacroArguments( macro_args )
                    continue
                if i == 1: 
                    layout_args = MacroArguments( macro_args )
                    break
            
            # extracting userProfile attrs 
            if len(content_args)>0:
                user_profile_templates.append(User(**content_args))
                
            if len(content_args.get_list_args())>0:
                for list_item in content_args.get_list_args():
                    user_profile_templates.append(User( **MacroArguments(list_item[1:len(list_item)-1])))
        
        # adding profiles fields description 
        data['user_profile_fields'].update(UserProfileManager(self.env).get_user_profile_fields(ignore_internal=True))

        # removing picture_href
        data['user_profile_fields'].pop('picture_href')
        
        
        def inline_wiki_to_html(text):
            return wiki_to_html(text, self.env, formatter.req)
        data['wiki_to_html'] = inline_wiki_to_html
        
        # grabbing users
        if len(user_profile_templates)>0:
            data['user_profiles'] = UserManager(self.env).search_users(user_profile_templates)
        else:
            data['user_profiles'] = UserManager(self.env).get_active_users()
        
        data['cells']=list(self._get_cells(data['user_profiles']))
        
        # add stylesheet&script
        add_stylesheet(formatter.req,'tracusermanager/css/macros_um_profile.css')
        add_script(formatter.req,'tracusermanager/js/macros_um_profile.js')
        
        # render template
        template = Chrome(self.env).load_template('macro_um_profile.html',method='xhtml')
        data = Chrome(self.env).populate_data(formatter.req, {'users':data})

        rendered_result = template.generate(**data)

        # wrap everything 
        if len(layout_args)>0:
            rendered_result= html.div(rendered_result, **layout_args)

        return rendered_result
开发者ID:okamototk,项目名称:kanonconductor,代码行数:60,代码来源:macros.py



注:本文中的trac.web.chrome.add_script函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python chrome.add_script_data函数代码示例发布时间:2022-05-27
下一篇:
Python chrome.add_notice函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap