id	summary	reporter	owner	description	type	status	priority	component	severity	resolution	keywords	cc	release
9854	Download the images and fonts locally, instead of using the web browser	ajo	airadier	I've changed some code in the wikiprint.py in order to enable the local access to the images, fonts and other ressources instead of downloading them via webserver. This can be usefull if you are using IIS on Windows, or you have SSON authentication enabled...\r\n\r\nIt's a draft, I don't have the time to submit it to SVN, but I hope, someone will take care of it :)\r\n\r\n== Code ==\r\n{{{\r\n    def getFileName(self, name, relative=''):\r\n        try:\r\n            self.env.log.debug('WikiPrint.linkLoader => Orignal name: %s' % name)     \r\n            if name.startswith('http://') or name.startswith('https://'):\r\n                self.env.log.debug('WikiPrint.linkLoader => Resolving URL: %s' % name)\r\n                url = urlparse.urljoin(relative, name)\r\n                rawpost = url.find('/raw-attachment/')\r\n                if rawpost > -1:\r\n                   if self.env.config.get('wikiprint', 'raw_attachment_path'):\r\n                      raw_attachment_path = self.env.config.get('wikiprint', 'raw_attachment_path')\r\n                      self.env.log.debug('WikiPrint.linkLoader => raw_attachment_path will be applied')\r\n                      name = url[rawpost+16:]\r\n                      self.env.log.debug('WikiPrint.linkLoader => Stripped name: %s' % name)\r\n                      name1=os.path.join(raw_attachment_path, name)\r\n                      self.env.log.debug('WikiPrint.linkLoader => Changed name: %s' % name1)\r\n                      inj_control=name1.find(raw_attachment_path)\r\n                      if inj_control == 0:\r\n                         return name1\r\n                      else:\r\n                         self.env.log.error('WikiPrint.linkLoader => Injection found!' % name1)\r\n                         return ''\r\n                \r\n                self.env.log.debug('WikiPrint.linkLoader => urljoined URL: %s' % url)\r\n            elif self.allow_local:\r\n                self.req.perm.assert_permission('WIKIPRINT_FILESYSTEM')\r\n                self.env.log.debug("WikiPrint.linkLoader => Resolve local filesystem %s", name)\r\n                return name\r\n            else:\r\n                #Relative path\r\n                if self.env.config.get('wikiprint', 'relative_path'):\r\n                     self.env.log.debug("WikiPrint.linkLoader => Using path %s ",self.env.config.get('wikiprint', 'relative_path'))\r\n                     url = os.path.join(self.env.config.get('wikiprint', 'relative_path'), name)\r\n                     self.env.log.debug("WikiPrint.linkLoader => Substituing relative path %s to %s", name, url)\r\n                     return url\r\n                else: \r\n                     self.env.log.debug("WikiPrint.linkLoader => Relative path %s to %s", name, urlparse.urljoin(self.req.abs_href(), name))\r\n                     url = urlparse.urljoin(self.req.abs_href(), name)\r\n                \r\n            path = urlparse.urlsplit(url)[2]\r\n}}}\r\n\r\n== Usage ==\r\n\r\nAdd following rows in to [wikiprint] section of trac.ini :\r\n{{{\r\nraw_attachment_path = D:\\Support\\Projects\\ABC\\attachments\\\r\nrelative_path = D:\\FontStorage\\\r\n}}}\r\n\r\nThe raw_attachment_path is the path to wiki and ticket attachments in the trac project directory\r\n\r\nrelative_path is the path to ressource storage... (like fonts used in css etc..)	enhancement	new	high	TracWikiPrintPlugin	normal				0.12
