Hi,

the doc link in the top right corner of the pootle web interface does not
respect the baseurl setting.

Additionally the links within the documentation are absolute, too.

The first attached patch fixes these problems for me.

The second patch fixes the absolute URLs within autogenerated robots.txt files.

Additionally there is another rather non-simple problem regarding the baseurl:
the javascript 'sorttable.js' refers to the location of some icons. Here it is
not possible to use relative paths (e.g.: "../../"), as the script is included
in templates which are used at different levels of the URL hierarchie (e.g.
project.html and language.html).
See the third patch for a solution, that works and seems to be quite clean for
my taste. It is tested with firefox, ie55 and ie6. Beware: I do not know
anything about javascript.

Furthermore pootle.py and translatepage.py contain absolute references to
"/js/spellui.js". As the spell check does not seem to be implemented yet, I
could not fix this (if it would be necessary). Maybe a TODO-comment would be
useful there?

Furthermore pagelayout.py contains two absolute references in line 175 and 185,
but I could not figure out how to reach these conditional paths. Maybe they need
to be changed, too.

regards,
Lars
diff -ruN -x '*.pyc' Pootle.orig/html/doc/en/howto.html Pootle/html/doc/en/howto.html
--- Pootle.orig/html/doc/en/howto.html	2007-05-11 11:33:30.000000000 +0200
+++ Pootle/html/doc/en/howto.html	2007-06-15 03:25:20.000000000 +0200
@@ -96,14 +96,14 @@
         register.<br>
         You can register following two simple steps, providing you
         have a current email address:<br>
-        1. <a href="/register.html"
+        1. <a href="../../register.html"
         target="_blank">Fill in your User Name, Password and a
         valid E-mail account</a>, choose "Register" and an
         activation code will be sent to the E-mail address you've
         provided.<br>
         2. When you receive the activation code and login details
         by E-mail go to the <a href=
-        "/activate.html" target=
+        "../../activate.html" target=
         "_blank">Activation page</a> and fill them in. Choose
         "Activate Account" and your account will be activated,
         giving you permission to edit the Pootle translation
@@ -118,7 +118,7 @@
 
       <div class="intro">
         Now that you are a registered user, <a href=
-        "/login.html" target=
+        "../../login.html" target=
         "_blank">login to Pootle</a>.<br>
         Once you have logged in, you will be presented with your
         User Page, which includes links to your selected languages
@@ -138,7 +138,7 @@
         desired files for translation directly through the links in
         it.<br>
         Another way to find the file you wish to translate is
-        through the <a href="/" target=
+        through the <a href="../../" target=
         "_blank">the main page</a>.<br>
         The main page displays two categories - Languages and
         Projects. Choosing a language will give you the list of
diff -ruN -x '*.pyc' Pootle.orig/templates/pootlepage.html Pootle/templates/pootlepage.html
--- Pootle.orig/templates/pootlepage.html	2007-06-11 16:55:46.000000000 +0200
+++ Pootle/templates/pootlepage.html	2007-06-15 03:13:13.000000000 +0200
@@ -66,7 +66,7 @@
       | <a href="${baseurl}languages/" py:content="links.languages">All Languages</a> 
       <span py:if="session.isopen" py:strip="True"> | <a href="${baseurl}home/" py:content="links.account">My account</a> </span> 
       <span py:if="session.issiteadmin" py:strip="True"> | <a href="${baseurl}admin/" py:content="links.admin">Admin</a> </span>
-      | <a href="/doc/${links.doclang}/index.html" py:content="links.doc">Docs &amp; Help</a>
+      | <a href="${baseurl}doc/${links.doclang}/index.html" py:content="links.doc">Docs &amp; Help</a>
     </div>
 
   </div>
Binärdateien Pootle.orig/indexpage.pyc and Pootle/indexpage.pyc sind verschieden.
diff -ruN Pootle.orig/pootle.py Pootle/pootle.py
--- Pootle.orig/pootle.py	2007-05-16 14:25:25.000000000 +0200
+++ Pootle/pootle.py	2007-06-15 05:01:29.000000000 +0200
@@ -195,11 +195,15 @@
     """generates the robots.txt file"""
     langcodes = self.potree.getlanguagecodes()
     excludedfiles = ["login.html", "register.html", "activate.html"]
+    baseurl = self.instance.baseurl
+    # we cannot rely on self.instance.baseurl ending with a slash
+    if not baseurl.endswith("/"):
+    	baseurl += "/"
     content = "User-agent: *\n"
     for excludedfile in excludedfiles:
-      content += "Disallow: /%s\n" % excludedfile
+      content += "Disallow: %s%s\n" % (baseurl, excludedfile)
     for langcode in langcodes:
-      content += "Disallow: /%s/\n" % langcode
+      content += "Disallow: %s%s/\n" % (baseurl, langcode)
     return content
 
   def getpage(self, pathwords, session, argdict):
Binärdateien Pootle.orig/versioncontrol.pyc and Pootle/versioncontrol.pyc sind verschieden.
diff -ruN -x '*.pyc' Pootle.orig/html/js/sorttable.js Pootle/html/js/sorttable.js
--- Pootle.orig/html/js/sorttable.js	2006-07-18 13:39:21.000000000 +0200
+++ Pootle/html/js/sorttable.js	2007-06-15 03:56:53.000000000 +0200
@@ -35,9 +35,10 @@
 
 var SORT_COLUMN_INDEX;
 
-var arrowUp = "/images/up.png";
-var arrowDown = "/images/down.png";
-var arrowBlank = "/images/none.png";
+/* the variable "baseurl" must be defined in any page including sorttable.js */
+var arrowUp = baseurl + "images/up.png";
+var arrowDown = baseurl + "images/down.png";
+var arrowBlank = baseurl + "images/none.png";
 
 function trim(str) {
     return str.replace(/^\s*|\s*$/g, "");
diff -ruN -x '*.pyc' Pootle.orig/templates/fileindex.html Pootle/templates/fileindex.html
--- Pootle.orig/templates/fileindex.html	2007-01-26 10:20:54.000000000 +0100
+++ Pootle/templates/fileindex.html	2007-06-15 03:58:54.000000000 +0200
@@ -8,6 +8,8 @@
   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
   <link rel="stylesheet" type="text/css" href="${baseurl}pootle.css" />
   <link rel="shortcut icon" href="${baseurl}favicon.ico" />
+  <!-- the 'sorttable.js' script depends on the variable 'baseurl' -->
+  <script type="text/javascript"> var baseurl = "${baseurl}"; </script>
   <script type="text/javascript" src="${baseurl}js/sorttable.js"></script>
   <!--[if lt IE 7.]>
     <script defer type="text/javascript" src="${baseurl}js/correctpng.js"></script>
diff -ruN -x '*.pyc' Pootle.orig/templates/language.html Pootle/templates/language.html
--- Pootle.orig/templates/language.html	2007-01-26 10:20:54.000000000 +0100
+++ Pootle/templates/language.html	2007-06-15 04:17:38.000000000 +0200
@@ -8,6 +8,8 @@
   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
   <link rel="stylesheet" type="text/css" href="${baseurl}pootle.css" />
   <link rel="shortcut icon" href="${baseurl}favicon.ico" />
+  <!-- the 'sorttable.js' script depends on the variable 'baseurl' -->
+  <script type="text/javascript"> var baseurl = "${baseurl}"; </script>
   <script type="text/javascript" src="${baseurl}js/sorttable.js"></script>
   <!--[if lt IE 7.]>
     <script defer type="text/javascript" src="${baseurl}js/correctpng.js"></script>
diff -ruN -x '*.pyc' Pootle.orig/templates/project.html Pootle/templates/project.html
--- Pootle.orig/templates/project.html	2007-01-26 10:20:54.000000000 +0100
+++ Pootle/templates/project.html	2007-06-15 03:58:30.000000000 +0200
@@ -9,6 +9,8 @@
   <meta name="description" content="${meta_description}" />
   <link rel="stylesheet" type="text/css" href="${baseurl}pootle.css" />
   <link rel="shortcut icon" href="${baseurl}favicon.ico" />
+  <!-- the 'sorttable.js' script depends on the variable 'baseurl' -->
+  <script type="text/javascript"> var baseurl = "${baseurl}"; </script>
   <script type="text/javascript" src="${baseurl}js/sorttable.js"></script>
   <!--[if lt IE 7.]>
     <script defer type="text/javascript" src="${baseurl}js/correctpng.js"></script>
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Translate-pootle mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/translate-pootle

Reply via email to