Ejemplo n.º 1
0
    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'
Ejemplo n.º 2
0
    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()))
Ejemplo n.º 3
0
    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
Ejemplo n.º 4
0
    def print_edit_view(self, req, error=None, filter=None, warning=None):

        userMail = self.get_user_email(req.authname)
        fields = TicketSystem(self.env).get_ticket_fields()
        customFields = TicketSystem(self.env).get_custom_fields()

        for f in fields[:]:
            for cf in customFields:
                if f['name'] == cf['name']:
                    fields.remove(f)

        disableSubmitButton = ""
        if not userMail:
            userMail = ["No email specified"]
            disableSubmitButton = "disabled"

        data = {
            'userEmail': userMail,
            'submitDisabled': disableSubmitButton,
            'datetime_hint': get_datetime_format_hint(),
            'fields': fields,
            'filter': filter,
            'error': error,
            'warning': warning
        }

        add_stylesheet(req, 'hw/css/style.css')
        add_script(req, 'hw/js/xmail.js')

        return 'xmail-edit.html', data, None
Ejemplo n.º 5
0
    def render_admin_panel(self, req, cat, page, path_info):
        req.perm.assert_permission('TRAC_ADMIN')
        if req.method == 'POST':
            self._parse_request(req)

        action, status = self._conf_to_inner_format(self.config)
        operations = self.operations
        permissions = self._get_permissions(req)
        add_stylesheet(req, 'tracworkflowadmin/themes/base/jquery-ui.css')
        add_stylesheet(req, 'tracworkflowadmin/css/tracworkflowadmin.css')
        add_stylesheet(req, 'tracworkflowadmin/css/jquery.multiselect.css')
        add_script(req, 'tracworkflowadmin/scripts/jquery-ui.js')
        add_script(req, 'tracworkflowadmin/scripts/jquery.json-2.2.js')
        add_script(req, 'tracworkflowadmin/scripts/jquery.multiselect.js')
        add_script(req, 'tracworkflowadmin/scripts/main.js')
        add_script_data(req, {'auto_update_interval': int(self.auto_update_interval)})
        if req.locale and str(req.locale) in self.msgjs_locales:
            add_script(req, 'tracworkflowadmin/scripts/messages/%s.js' % req.locale)
        data = {
            'actions': action,
            'status': status,
            'perms': permissions,
            'operations': operations,
            'editor_mode': req.args.get('editor_mode') or self.default_editor,
            'text': self._conf_to_str(self.config)
        }
        return 'tracworkflowadmin.html', data
Ejemplo n.º 6
0
    def _prepare_diff(self, req, page, old_text, new_text,
                      old_version, new_version):
        diff_style, diff_options, diff_data = get_diff_options(req)
        diff_context = 3
        for option in diff_options:
            if option.startswith('-U'):
                diff_context = int(option[2:])
                break
        if diff_context < 0:
            diff_context = None
        diffs = diff_blocks(old_text, new_text, context=diff_context,
                            ignore_blank_lines='-B' in diff_options,
                            ignore_case='-i' in diff_options,
                            ignore_space_changes='-b' in diff_options)
        def version_info(v, last=0):
            return {'path': get_resource_name(self.env, page.resource),
                    # TRANSLATOR: wiki page
                    'rev': v or _('currently edited'),
                    'shortrev': v or last + 1,
                    'href': req.href.wiki(page.name, version=v) if v else None}
        changes = [{'diffs': diffs, 'props': [],
                    'new': version_info(new_version, old_version),
                    'old': version_info(old_version)}]

        add_stylesheet(req, 'common/css/diff.css')
        add_script(req, 'common/js/diff.js')
        return diff_data, changes
Ejemplo n.º 7
0
    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
        }
Ejemplo n.º 8
0
 def post_process_request(self, req, template, data, content_type):
     if template == 'admin_perms.html':
         add_stylesheet(req,
                        'tracprojectmanager/css/jquery.autocomplete.css')
         add_script(req, 'tracprojectmanager/js/jquery.autocomplete.js')
         add_script(req, '../autocompleteperms/autocompleteperms.js')
     return template, data, content_type
Ejemplo n.º 9
0
    def process_request(self, req):
        req.perm.require('TRAC_ADMIN')
        data = {}
        args = {}
        data['reponame'], repos, path = RepositoryManager(self.env).get_repository_by_path('/')
        data['current_path_selection'] = '';
        data['current_author_selection'] = '';

        if (req.args) and (req.args['filter-by-path']):
            args['path__prefix'] = req.args['filter-by-path'];
            data['current_path_selection'] = req.args['filter-by-path']
        if (req.args) and (req.args['filter-by-author']):
            args['author'] = req.args['filter-by-author']
            data['current_author_selection'] = req.args['filter-by-author']

        data['comments'] = Comments(req, self.env).search(args, 'DESC')

        data.update(Comments(req, self.env).get_filter_values())

        data['can_delete'] = 'TRAC_ADMIN' in req.perm
        # DataTables lets us filter and sort comments table
        add_script(req, 'code-comments/DataTables/js/jquery.dataTables.min.js')
        add_stylesheet(req, 'code-comments/DataTables/css/demo_page.css')
        add_stylesheet(req, 'code-comments/DataTables/css/demo_table.css')
        return 'comments.html', data, None
Ejemplo n.º 10
0
    def render(self, context, mimetype, content, filename=None, rev=None):
        req = context.req
        content = content_to_unicode(self.env, content, mimetype)
        changes = self._diff_to_hdf(content.splitlines(),
                                    Mimeview(self.env).tab_width)
        if not changes or not any(c['diffs'] for c in changes):
            self.log.debug(
                "Invalid unified diff content: %.40r... (%d "
                "characters)", content, len(content))
            return
        data = {
            'diff': {
                'style': 'inline'
            },
            'no_id': True,
            'changes': changes,
            'longcol': 'File',
            'shortcol': ''
        }

        add_script(req, 'common/js/diff.js')
        add_stylesheet(req, 'common/css/diff.css')
        return Chrome(self.env).render_template(req,
                                                'diff_div.html',
                                                data,
                                                fragment=True)
Ejemplo n.º 11
0
    def pre_process_request(self, req, handler):
        """Called after initial handler selection, and can be used to change
    the selected handler or redirect request.
    
    Always returns the request handler, even if unchanged.
    """
        if (type(handler) == Chrome):
            self.log.debug(
                "AddStaticResourceComponent: skipping, dont futz with other static resources"
            )
            return handler

        self.log.debug(
            "AddStaticResourceComponent: about to add resources, %s ,%s" %
            (req, handler))
        c = self.env.config
        resources = c.options(srkey)
        for regex, value in resources:
            self.log.debug(
                "AddStaticResourceComponent: Regex:'%s' matched:%s" %
                (regex, re.search(regex, req.path_info)))
            if re.search(regex, req.path_info, re.IGNORECASE):
                paths = c.getlist(srkey, regex)
                for p in paths:
                    if p.endswith("js"):
                        add_script(req, urljoin(srkey, p))
                    elif p.endswith("css"):
                        add_stylesheet(req, urljoin(srkey, p))

        return handler
Ejemplo n.º 12
0
 def process_request(self, req):
     req.perm.assert_permission('WIKI_VIEW')
     req.perm.assert_permission('MILESTONE_VIEW')
     req.perm.assert_permission('TICKET_VIEW')
     try:
         req.args['helpmenu']
         add_stylesheet(req, 'common/css/wiki.css')
         return 'helpmenu.cs', 'text/html'
     except:
         pass
     add_script(req, 'wikinavmap/js/prototype.js')
     add_script(req, 'wikinavmap/js/scriptaculous.js')
     add_script(req, 'wikinavmap/js/popup.js')
     add_script(req, 'wikinavmap/js/mapdata.js')
     add_script(req, 'wikinavmap/js/configuration.js')
     add_stylesheet(req, 'wikinavmap/css/map.css')
     #req.hdf['wikinavmap.map_html'] = self.map_html(req)
     wikinavmap = {
         'default_base_colour': self.default_base_colour,
         'default_colour_no': self.default_colour_no,
         'default_ticket_filter': self.default_ticket_filter,
         'default_wiki_filter': self.default_wiki_filter
     }
     req.hdf['wikinavmap'] = wikinavmap
     # Get the users for the filter options w_username and t_username
     db = self.env.get_db_cnx()
     cursor = db.cursor()
     cursor.execute(
         "SELECT DISTINCT author FROM wiki WHERE author!='' UNION SELECT DISTINCT owner FROM ticket WHERE owner!='' UNION SELECT DISTINCT reporter FROM ticket WHERE reporter!=''"
     )
     users = []
     for row in cursor:
         users.append(row[0])
     req.hdf['users'] = users
     return 'wikinavmap.cs', 'text/html'
Ejemplo n.º 13
0
    def detail_view(self, req, cat, page, name):
        if req.args.get('team_member'):
            # show detail page for a specific member
            team_member = self.tmm.get(name=req.args['team_member'])
            if team_member:
                return self.member_view(req, cat, page, name, team_member)

        if name=='unassigned':
            # team members without a team
            members = self.tmm.select(criteria={'team': None})
            if not members:
                # no unassigned team members, redirect to team page
                return req.redirect(req.href.admin(cat, page))
            
            data = {
                'view': 'unassigned',
                'members': members,
            }
            return 'agilo_admin_team.html', data
        
        team = self.tm.get(name=name)
        if not team:
            return req.redirect(req.href.admin(cat, page))
        
        # show the list of team members
        data = {
            'view': 'detail',
            'team': team,
        }
        add_script(req, 'common/js/wikitoolbar.js')
        return 'agilo_admin_team.html', data
Ejemplo n.º 14
0
def add_jscript(req, scripts, debug=False):
    if isinstance(scripts, basestring):
        scripts = [
            scripts,
        ]
    for script in scripts:
        add_script(req, map_script(script, debug))
Ejemplo n.º 15
0
 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
Ejemplo n.º 16
0
    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
Ejemplo n.º 17
0
    def render_bookmarker(self, req):
        if 'action' in req.args and \
                req.args['action'] in self.nonbookmarkable_actions:
            return

        resource = self._get_resource_uri(req)
        bookmark = self.get_bookmark(req, resource)

        if bookmark:
            class_ = 'bookmark_on'
            title = _('Delete Bookmark')
            href = req.href.bookmark('delete', resource)
        else:
            class_ = 'bookmark_off'
            title = _('Bookmark this page')
            href = req.href.bookmark('add', resource)
        anchor = tag.a(u'\u200b',
                       id='bookmark_this',
                       class_=class_,
                       title=title,
                       href=href,
                       data_list=req.href.bookmark())
        req.chrome.setdefault('ctxtnav', []).insert(0, anchor)

        add_script(req, 'bookmark/js/tracbookmark.js')
        add_stylesheet(req, 'bookmark/css/tracbookmark.css')

        menu = self._get_bookmarks_menu(req)
        item = tag.span(tag.a(_('Bookmarks'), href=req.href.bookmark()),
                        menu,
                        id='bookmark_menu')
        add_ctxtnav(req, item)
Ejemplo n.º 18
0
    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'
Ejemplo n.º 19
0
    def _generate_form(self, req, data):
        batchFormData = dict(data)
        batchFormData['query_href']= req.session['query_href'] \
                                     or req.href.query()
        batchFormData['notify_enabled'] = self.config.getbool(
            'notification', 'smtp_enabled', False)

        ticketSystem = TicketSystem(self.env)
        fields = []
        for field in ticketSystem.get_ticket_fields():
            if field['name'] not in ('summary', 'reporter', 'description'):
                fields.append(field)
            if field['name'] == 'owner' \
                and hasattr(ticketSystem, 'eventually_restrict_owner'):
                ticketSystem.eventually_restrict_owner(field)
        fields.sort(key=lambda f: f['name'])
        batchFormData['fields'] = fields

        add_script(req, 'batchmod/js/batchmod.js')
        add_stylesheet(req, 'batchmod/css/batchmod.css')
        stream = Chrome(self.env).render_template(req,
                                                  'batchmod.html',
                                                  batchFormData,
                                                  fragment=True)
        return stream.select('//form[@id="batchmod_form"]')
Ejemplo n.º 20
0
 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)
Ejemplo n.º 21
0
    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")

        req.hdf["billing_info"] = {
            "messages": messages,
            "href": self.env.href.Billing(),
            "reports": self.get_copy_report_hash_for_render(),
            "usermanual_href": self.env.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'
Ejemplo n.º 22
0
 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)
Ejemplo n.º 23
0
 def filter_stream(self, req, method, filename, stream, data):
     if req.path_info.startswith('/ticket'):
         button = tag.div(
             tag.input(type="submit",
                       title=_("Translate to %s") %
                       req.locale.get_display_name(),
                       value=_("Translate"),
                       forward=_("Translate"),
                       backward=_("Untranslate"),
                       working=_("Working"),
                       name="translate",
                       class_="translate"))
         button(class_="inlinebuttons")
         script = tag.script('')
         script(src='https://www.google.com/jsapi?key=' + self.googleApiKey)
         script(type='text/javascript')
         stream |= Transformer('//head').prepend(script)
         stream |= Transformer(
             '//div[@id="content"]/div[@id="ticket"]/div[@class="description"]/h3'
         ).after(button)
         stream |= Transformer(
             '//div[@id="content"]/div/div[@id="changelog"]/div[@class="change"]/h3'
         ).after(button)
         add_stylesheet(req, 'translate/translate.css')
         add_script_data(req, {'googleApiKey': self.googleApiKey})
         add_script_data(req, {'sessionLanguage': req.locale.language})
         add_script(req, 'translate/translate.js')
     return stream
Ejemplo n.º 24
0
    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()))
Ejemplo n.º 25
0
    def process_admin_request(self, req, cat, page, path_info):
        filter = ThemeFilterModule(self.env)
        info = filter.info.items()
        theme_name = filter.theme_name
        index = 0
        for i, (k, _) in enumerate(info):
            if k == theme_name:
                index = i
                break

        if req.method == 'POST':
            theme = req.args.get('theme', '')
            self.config.set('theme', 'theme', theme)
            self.config.save()
            req.redirect(req.href.admin(cat, page))

        for k, v in info:
            req.hdf['themeengine.info.' + k] = v
        req.hdf['themeengine.current'] = theme_name
        req.hdf['themeengine.current_index'] = index + 1
        req.hdf['themeengine.href'] = req.href.admin(cat, page)
        req.hdf['themeengine.href.htdocs'] = req.href.chrome('themeengine')
        req.hdf['themeengine.href.screenshot'] = req.href.themeengine(
            'screenshot')

        add_script(req, 'themeengine/jquery.js')
        add_script(req, 'themeengine/jcarousel.js')
        return 'admin_themeengine.cs', None
Ejemplo n.º 26
0
    def process_request(self, req):
        interfaces = {}
        for interface in Interface.__subclasses__():
            data = self._base_data(req, interface)
            data['implemented_by'] = []
            interfaces[data['name']] = data

        components = {}
        for component in [c.__class__ for c in self.env.components.values()]:
            if hasattr(component, '_implements'):
                impl = [
                    interfaces['%s.%s' % (i.__module__, i.__name__)]
                    for i in component._implements
                ]
            else:
                impl = []
            data = self._base_data(req, component)
            data['_extension_points'] = self._extension_points(req, component)
            data['implements'] = [i['name'] for i in impl]
            for imp in impl:
                imp['implemented_by'].append(data['name'])
            components[data['name']] = data

        add_script(req, 'developer/js/apidoc.js')
        add_script(req, 'developer/js/plugins.js')
        add_stylesheet(req, 'developer/css/apidoc.css')
        add_stylesheet(req, 'developer/css/plugins.css')
        return 'developer/plugins.html', {
            'components': components,
            'interfaces': interfaces
        }, None
Ejemplo n.º 27
0
    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}
Ejemplo n.º 28
0
    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
Ejemplo n.º 29
0
 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
    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
Ejemplo n.º 31
0
 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        
Ejemplo n.º 32
0
    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
Ejemplo n.º 33
0
    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
Ejemplo n.º 34
0
    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)
Ejemplo n.º 35
0
 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
Ejemplo n.º 36
0
 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,
     )
Ejemplo n.º 37
0
 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
Ejemplo n.º 38
0
    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
Ejemplo n.º 39
0
    def process_request(self, req):
        req.perm.require(self.BILLING_PERMISSION)
        messages = []

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

        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)
        data = {};
        data["statuses"] = get_statuses(self)
        data["reports"] = mgr.get_reports_by_group(CustomReportManager.TimingAndEstimationKey);
        #self.log.debug("DEBUG got %s, %s" % (data["reports"], type(data["reports"])));
        data["billing_info"] = {"messages":         messages,
                                "href":             req.href.Billing(),
                                "report_base_href": req.href.report(),
                                "usermanual_href":  req.href.wiki(user_manual_wiki_title),
                                "usermanual_title": user_manual_title }

        self.set_request_billing_dates(data)

        add_stylesheet(req, "Billing/billingplugin.css")
        add_script(req, "Billing/date.js")
        add_script(req, "Billing/linkifyer.js")
        return 'billing.html', data, None
Ejemplo n.º 40
0
    def render_preference_panel(self, req, panel):
        """"""
        userProfileData = {}
        userProfile = UserProfilesSystem(self.env).get_userProfile(
            req.session.sid)

        if req.method == 'POST':
            userProfile.name = req.args.get('tr_userProfile_name')
            userProfile.email = req.args.get('tr_userProfile_email')
            userProfile.bio = req.args.get('tr_userProfile_bio')
            userProfile.picture_href = TeamAdminPage(
                self.env)._do_uploadPicture(req, userProfile, {},
                                            'tr_userProfile_picture')
            userProfile.role = req.args.get('tr_userProfile_role')
            if userProfile.save():
                userProfileData['message'] = 'Profile updated'

        userProfileData['userProfile'] = userProfile
        add_stylesheet(req, 'tracteamroster/css/teamroster.css')

        # wiki toolbar
        add_script(req, 'common/js/wikitoolbar.js')
        add_stylesheet(req, 'common/css/wiki.css')

        return 'prefs_teamroster_user.html', {'teamRoster': userProfileData}
Ejemplo n.º 41
0
    def _prepare_diff(self, req, page, old_text, new_text,
                      old_version, new_version):
        diff_style, diff_options, diff_data = get_diff_options(req)
        diff_context = 3
        for option in diff_options:
            if option.startswith('-U'):
                diff_context = int(option[2:])
                break
        if diff_context < 0:
            diff_context = None
        diffs = diff_blocks(old_text, new_text, context=diff_context,
                            ignore_blank_lines='-B' in diff_options,
                            ignore_case='-i' in diff_options,
                            ignore_space_changes='-b' in diff_options)
        def version_info(v, last=0):
            return {'path': get_resource_name(self.env, page.resource),
                    # TRANSLATOR: wiki page
                    'rev': v or _("currently edited"),
                    'shortrev': v or last + 1,
                    'href': req.href.wiki(page.name, version=v)
                            if v else None}
        changes = [{'diffs': diffs, 'props': [],
                    'new': version_info(new_version, old_version),
                    'old': version_info(old_version)}]

        add_stylesheet(req, 'common/css/diff.css')
        add_script(req, 'common/js/diff.js')
        return diff_data, changes
Ejemplo n.º 42
0
    def filter_stream(self, req, method, filename, stream, data):
        """This extension point is used to make hidden duplicates of depselect fields
        in the ticket template.  We do this to get around some CSS difficulties in
        Internet Explorer, see the comments in the ticket_depselect_fettler.js for more
        details."""

        if not filename == 'ticket.html':
            return stream

        # Iterate through the list of all the depselect fields
        for d in [f for f in data['fields'] if f['type'] == 'depselect']:

            # Add a hidden select for every depselect field
            elm = tag.select(style="display: none", id='field-%s%s' % (d['parent'], d['name']))
            if d['optional']:
                elm(tag.option)
            ticket_val = data['ticket'].get_value_or_default(d['name'])
            for val, parent_val in d['options']:
                if ticket_val == val:
                    elm(tag.option(val, class_=parent_val, selected='selected'))
                else:
                    elm(tag.option(val, class_=parent_val))
            stream |= Transformer('.//body').append(elm)

        add_script(req, 'multiproduct/js/ticket_depselect_fettler.js')
        return stream
Ejemplo n.º 43
0
    def print_main_view(self, req):
        filter = self._getFilterObject(req)
        userMail = self.get_user_email(filter.username)

        if not userMail:
            userMail = ["No email specified"]

#        header_names = [_('id'), _('filter name'), _('next execution'), _('last successful execution'),
#                        _('interval in sec'), _('actions')]

        sql = "select " + get_col_list(
            ['username', 'selectfields', 'whereclause'])
        sql += " from " + XMAIL_TABLE.name + " where username='******' order by filtername"
        self.log.debug("print_main_view -- sql: %s" % sql)
        rows, col_list = self.get_data(sql)
        col_list.append('actions')

        data = {
            'userEmail': userMail[0],
            'table_headers': col_list,
            'sql_result': rows,
            'filter': filter,
            'list_interval': INTERVAL_LIST
        }

        add_stylesheet(req, 'hw/css/style.css')
        add_script(req, 'hw/js/xmail.js')

        return 'xmail-mainview.html', data, None
Ejemplo n.º 44
0
    def _process_add(self, req, ticket):
        if req.method == "POST" and self._validate_add(req):
            if req.args.get('reminder_type') == 'interval':
                time = clear_time(to_datetime(None))
                delta = _time_intervals[req.args.get('unit')](
                    req.args.get('interval'))
                time += delta
                time = to_utimestamp(time)
            else:
                time = to_utimestamp(parse_date(req.args.get('date')))
            origin = to_utimestamp(to_datetime(None))

            self.env.db_transaction(
                """
                INSERT INTO ticketreminder
                 (ticket, time, author, origin, reminded, description)
                VALUES (%s, %s, %s, %s, 0, %s)
                """, (ticket.id, time, get_reporter_id(
                    req, 'author'), origin, req.args.get('description')))

            add_notice(req, "Reminder has been added.")
            req.redirect(
                get_resource_url(self.env, ticket.resource, req.href) +
                "#reminders")

        add_script(req, 'ticketreminder/js/ticketreminder.js')

        data = {
            'ticket': ticket,
            'date_hint': get_date_format_hint(),
        }

        return ("ticket_reminder_add.html", data, None)
Ejemplo n.º 45
0
 def index(self, req):
     data = {}
     # floor = req.args.get('floor', 0)
     # rows = []
     # typenames = self.history.keys()
     # typenames.sort()
     # for typename in typenames:
     #     hist = self.history[typename]
     #     maxhist = max(hist)
     #     if maxhist > int(floor):
     #         row = ('<div class="typecount">%s<br />'
     #                '<img class="chart" src="%s" style="height: 20px;" /><br />'
     #                'Min: %s Cur: %s Max: %s <a href="%s">TRACE</a></div>'
     #                % (cgi.escape(typename),
     #                   req.href.developer('dozer', 'chart', typename), #url(req, "chart/%s" % typename),
     #                   min(hist), hist[-1], maxhist,
     #                   req.href.developer('dozer', 'trace', typename), #url(req, "trace/%s" % typename),
     #                   )
     #                )
     #         rows.append(row)
     #res = Response()
     #res.body = template(req, "graphs.html", output="\n".join(rows))
     #return res
     #data['output'] = Markup('\n'.join(rows))
     data['history'] = self.history
     add_script(req, 'dozer/excanvas.compiled.js')
     add_script(req, 'dozer/jspark.js')
     return 'graphs.html', data, None
Ejemplo n.º 46
0
    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")
                
        req.hdf["billing_info"] = {"messages": messages,
                                   "href":self.env.href.Billing(),
                                   "reports": self.get_copy_report_hash_for_render(),
                                   "usermanual_href":self.env.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'
Ejemplo n.º 47
0
    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)
    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 == 'ticket.html':
            add_stylesheet(req, '%s/css/autocomplete.css' % self.prefix)
            add_script(req, '%s/js/autocomplete.js' % self.prefix)
            if req.path_info.rstrip() == '/newticket':
                add_script_data(req, {'KEYWORDS_AC_PATH': 'ac-keywords'})
            else:
                add_script_data(req, {'KEYWORDS_AC_PATH': '../ac-keywords'})
            add_script(req, '%s/js/autocomplete_ticket_keywords.js' % self.prefix)
        return (template, data, content_type)
Ejemplo n.º 49
0
 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
 def _make_graph(self, req, repos, info):
     # Generate graph data
     graph = {}
     threads, vertices, columns = \
         make_log_graph(repos, (item['rev'] for item in info))
     graph.update(threads=threads, vertices=vertices, columns=columns,
                  colors=self.graph_colors,
                  line_width=0.04, dot_radius=0.1)
     add_script(req, 'revisiongraph/js/excanvas.js')
     add_script(req, 'revisiongraph/js/log_graph.js')
     add_script_data(req, {'graph': graph})
     
     script = Markup("//<![CDATA[") + """
     jQuery(document).ready(function($) {
       $('th.trac-graph, td.trac-graph').show();
       var canvas = $('""" + Markup("<canvas>") + """').css({width: '%dem',
                                       height: '%dem'})
                                 .appendTo('td.trac-graph')[0];
       canvas.width = $(canvas).width();
       canvas.height = $(canvas).height();
       if (typeof(G_vmlCanvasManager) != 'undefined')
         canvas = G_vmlCanvasManager.initElement(canvas);
       $.paintLogGraph(graph, canvas);
     });
     """ % (graph['columns'] * 2, len(info) * 2) + Markup("//]]>")
     
     th = tag.th('Graph', class_='trac-graph')
     td = tag.td(class_='trac-graph', rowspan='%d' % len(info))
     
     script_filter = Transformer('//head').append(tag.script(script, type="text/javascript"))
     table_filter = Transformer('//table[@class="listing chglist"]').attr('class', 'listing chglist trac-graph')
     th_filter = Transformer('//table/thead/tr/th[@class="diff"]').before(th)
     td_filter = Transformer('//table/tbody/tr[1]/td[@class="diff"]').before(td)
     
     return [script_filter, table_filter, th_filter, td_filter]
 def post_process_request (self, req, template, data, content_type):
     if template in ('ticket.html', 'query.html'):
         Chrome(self.env).add_jquery_ui(req)
         add_script(req, self.ID + '/js/autocompluseraccount.js')
         if template == 'query.html':
             add_script(req, self.ID + '/js/jquery-observe.js')
     return template, data, content_type
Ejemplo n.º 52
0
    def process_request(self, req):
        #Retrieve the information needed to display in the /modifiedfiles/ page
        (ticket_id, files, deletedfiles, ticketsperfile, filestatus,
         conflictingtickets, ticketisclosed, revisions,
         ticketsdescription) = self.__process_ticket_request(req)
        #Pack the information to send to the html file
        data = {
            'ticketid': ticket_id,
            'files': files,
            'deletedfiles': deletedfiles,
            'ticketsperfile': ticketsperfile,
            'filestatus': filestatus,
            'conflictingtickets': conflictingtickets,
            'ticketisclosed': ticketisclosed,
            'revisions': revisions,
            'ticketsdescription': ticketsdescription
        }

        add_ctxtnav(req, 'Back to Ticket #%s' % ticket_id,
                    req.href.ticket(ticket_id))

        #Add the custom stylesheet
        add_stylesheet(req, 'common/css/timeline.css')
        add_stylesheet(req, 'tmf/css/ticketmodifiedfiles.css')
        add_script(req, 'tmf/js/ticketmodifiedfiles.js')
        return 'ticketmodifiedfiles.html', data, None