Commits

cmlenz  committed ad3fa07

* Reenable the use of the `htdocs_location` for specifying the URL of the main static resources (source:trunk/trac/htdocs).
This should make it easier to deploy the Trac CGI on web servers that don't provide the configurability of Apache. Also,
it enables a group of Trac projects to use the same URL namespace for the resouces, thereby improving the cacheability of
those resources by the user agent.
* Remove the `diff/tab_width` option from the default config. This setting is deprecated in favor of `mimeview/tab_width`.

  • Participants
  • Parent commits 1384e30
  • Branches trunk

Comments (0)

Files changed (10)

File templates/footer.cs

 <div id="footer">
  <hr />
  <a id="tracpowered" href="http://trac.edgewall.com/"><img src="<?cs
-   var:chrome.href ?>/common/trac_logo_mini.png" height="30" width="107"
+   var:htdocs_location ?>trac_logo_mini.png" height="30" width="107"
    alt="Trac Powered"/></a>
  <p class="left">
   Powered by <a href="<?cs var:trac.href.about ?>"><strong>Trac <?cs

File templates/header.cs

   /each ?><?cs
  /each ?><style type="text/css"><?cs include:"site_css.cs" ?></style>
  <script type="text/javascript" src="<?cs
-   var:chrome.href ?>/common/js/trac.js"></script>
+   var:htdocs_location ?>js/trac.js"></script>
 </head>
 <body>
 <?cs include "site_header.cs" ?>

File templates/milestone.cs

     <input type="submit" name="cancel" value="Cancel" />
    </div>
    <script type="text/javascript" src="<?cs
-     var:chrome.href ?>/common/js/wikitoolbar.js"></script>
+     var:htdocs_location ?>js/wikitoolbar.js"></script>
   </form>
  <?cs elif:milestone.mode == "delete" ?>
   <form action="<?cs var:milestone.href ?>" method="post">

File templates/newticket.cs

  </fieldset>
 
  <script type="text/javascript" src="<?cs
-   var:chrome.href ?>/common/js/wikitoolbar.js"></script>
+   var:htdocs_location ?>js/wikitoolbar.js"></script>
 
  <div class="buttons">
   <input type="submit" name="preview" value="Preview" accesskey="r" />&nbsp;

File templates/query.cs

  <hr />
 </form>
 <script type="text/javascript" src="<?cs
-  var:chrome.href ?>/common/js/query.js"></script>
+  var:htdocs_location ?>js/query.js"></script>
 <script type="text/javascript"><?cs set:idx = 0 ?>
  var properties={<?cs each:field = query.fields ?><?cs
   var:name(field) ?>:{type:"<?cs var:field.type ?>",label:"<?cs

File templates/report.cs

      </div>
     </div>
     <script type="text/javascript" src="<?cs
-      var:chrome.href ?>/common/js/wikitoolbar.js"></script>
+      var:htdocs_location ?>js/wikitoolbar.js"></script>
    </form>
  <?cs /if?>
  

File templates/ticket.cs

  /if ?>
 
  <script type="text/javascript" src="<?cs
-   var:chrome.href ?>/common/js/wikitoolbar.js"></script>
+   var:htdocs_location ?>js/wikitoolbar.js"></script>
 
  <div class="buttons">
   <input type="hidden" name="ts" value="<?cs var:ticket.ts ?>" />

File templates/wiki.cs

      <input type="submit" name="cancel" value="Cancel" />
     </div>
     <script type="text/javascript" src="<?cs
-      var:chrome.href ?>/common/js/wikitoolbar.js"></script>
+      var:htdocs_location ?>js/wikitoolbar.js"></script>
    </form>
   <?cs /if ?>
   <?cs if wiki.action == "view" ?>

File trac/db_default.py

   ('header_logo', 'width', '236'),
   ('header_logo', 'height', '73'),
   ('attachment', 'max_size', '262144'),
-  ('diff', 'tab_width', '8'),
   ('mimeviewer', 'enscript_path', 'enscript'),
   ('mimeviewer', 'php_path', 'php'),
   ('mimeviewer', 'tab_width', '8'),

File trac/web/chrome.py

     """Add a link to a style sheet to the HDF data set so that it gets included
     in the generated HTML page.
     """
-    href = Href(req.cgi_location)
-    add_link(req, 'stylesheet', href.chrome(filename), mimetype=mimetype)
+    if filename.startswith('common/') and 'htdocs_location' in req.hdf:
+        href = Href(req.hdf['htdocs_location'])
+        filename = filename[7:]
+    else:
+        href = Href(req.cgi_location).chrome
+    add_link(req, 'stylesheet', href(filename), mimetype=mimetype)
 
 
 class INavigationContributor(Interface):
 
         href = Href(req.cgi_location)
         req.hdf['chrome.href'] = href.chrome()
-        req.hdf['htdocs_location'] = href.chrome('common', '/')
+        htdocs_location = self.config.get('trac', 'htdocs_location',
+                                          href.chrome('common'))
+        req.hdf['htdocs_location'] = htdocs_location.rstrip('/') + '/'
 
         # HTML <head> links
         add_link(req, 'start', self.env.href.wiki())