Esempio n. 1
0
    def get_content(self, req, entry, data):

        # Make sure that repository is a Subversion repository, since
        # we're relying for now on Subversion to provide WebDAV
        # support.
        if not is_subversion_repository(data.get('repos')):
            return None
        # don't show up in the menu if the user is browsing a non-HEAD revision
        if data.get('stickyrev'):
            return None

        reponame = data['reponame'] or ''
        ext = os.path.splitext(entry.name)[1][1:]

        if not entry.isdir and ext in self.office_file_extensions:

            path = self.get_subversion_path(entry)
            href = self.get_subversion_href(data, path)

            if re.search('(MSIE |Trident/)',
                         req.environ.get('HTTP_USER_AGENT', '')):
                # for IE, we'll use ActiveX as this may work with older Office installations
                return tag.a(tag.i(class_="fa fa-edit"),
                             ' %s with Microsoft Office' % self._verb,
                             href=href,
                             class_=self._link_class)
            else:
                # otherwise, let's try https://msdn.microsoft.com/en-us/library/office/dn906146.aspx
                # which is Office 2010 SP2 and above
                application = self.office_file_extensions[ext]
                return tag.a(tag.i(class_="fa fa-edit"),
                             ' %s with Microsoft %s' %
                             (self._verb, application.title()),
                             href="ms-%s:%s|u|%s" %
                             (application, self._href_mode, href))
    def get_content(self, req, entry, data):
        
        # Make sure that repository is a Subversion repository, since
        # we're relying for now on Subversion to provide WebDAV
        # support.
        if not is_subversion_repository(data.get('repos')):
            return None
        # don't show up in the menu if the user is browsing a non-HEAD revision
        if data.get('stickyrev'):
            return None

        reponame = data['reponame'] or ''
        ext = os.path.splitext(entry.name)[1][1:]

        if not entry.isdir and ext in self.office_file_extensions:

            path = self.get_subversion_path(entry)
            href = self.get_subversion_href(data, path)

            if re.search('(MSIE |Trident/)',
                         req.environ.get('HTTP_USER_AGENT', '')):
                # for IE, we'll use ActiveX as this may work with older Office installations
                return tag.a(tag.i(class_="fa fa-edit"),
                             ' %s with Microsoft Office' % self._verb,
                             href=href,
                             class_=self._link_class)
            else:
                # otherwise, let's try https://msdn.microsoft.com/en-us/library/office/dn906146.aspx
                # which is Office 2010 SP2 and above
                application = self.office_file_extensions[ext]
                return tag.a(tag.i(class_="fa fa-edit"),
                             ' %s with Microsoft %s' % (self._verb, application.title()),
                             href="ms-%s:%s|u|%s" % (application, self._href_mode, href))
Esempio n. 3
0
 def filter_stream(self, req, method, filename, stream, data):
     if filename == 'browser.html' and is_subversion_repository(
             data.get('repos')):
         add_script(req, 'tracsharepoint/js/opendocuments.js')
     return stream
 def filter_stream(self, req, method, filename, stream, data):
     if filename == 'browser.html' and is_subversion_repository(data.get('repos')):
         add_script(req, 'tracsharepoint/js/opendocuments.js')
     return stream