Scroll SVN-stored text file served by Apache - apache

I have a 1.7.9 SVN server exposed via Apache. It uses apache2-svn which allows to specify revision number as a part of the URL like this (for r65):
https://SERVER:PORT/REPO/FILE?p=65
I'd like to add a parameter to a query string that allows scrolling the file or even better - highlighting a range in the file. So users can send links pointing to "revision 65, lines 110-125".
Any ideas? The SVN stores only regular text files. Do browsers even support scrolling an arbitrary text file? Or would I need to transform the file into a HTML document? Any ready to use solution?
Cheers,
Pawel

Built-in Apache's SVN repository browsing feature is very simple and minimalistic. It does not allow you to specify the particular string to navigate to. The available URL syntax allows
viewing / downloading a particular file:
https://svn.domain.com/svn/MyProject/trunk/README.txt
viewing / downloading a particular file in revision 321:
https://svn.domain.com/svn/MyProject/trunk/README.txt?r=321
viewing / downloading a particular file, which is not available in the youngest revision, by specifying peg revision:
https://svn.domain.com/svn/MyProject/trunk/FILE_ID.DIZ?p=123
combining both of the above methods you can tune the view.
If you want more browsing features, install 3-rd party repository browsing UI. Take a closer look at ViewVC, WebSVN and Sventon.

Related

Can directory listings appear in different languages with .htaccess?

I have set up a simple site for a design client at pub.regularsite.com where I put finished design projects.
The site is set using Apache directory listings with subdirectories for logos, flyers etc.
The problem is that the listing headers (name, last modified & size are in English and I would like them to appear in French.
Is it possible to specify the header language in the .htaccess file or elsewhere?
Is it possible to make it automatic, based on the user's system language?
Sorry, I don't think you can do this with the default directory-listing module that ships with Apache.
By default, directory listings are generated by Apache's mod_autoindex, which according to the latest version in the repository [1] does not have any translations for strings such as "Last modified" etc.
If you don't care about it being in the user's preferred language and just be in French all the time, I'm guessing that if you translate all the strings in that file, recompile the module, reinstall it and restart Apache, it'll do what you want -- although it's probably more work than finding some other directory generation tool out there with support for translations on a per-user basis.
[1] See http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/generators/mod_autoindex.c?revision=1705983&view=markup at line 1584: the "Last modified" string is hardcoded, does not refer to a dictionary of translations.

Server side: detecting if a user is downloading (save as...) or visualizing a file in the browser

I'm writing an apache2 module
by default and when viewed in a web browser, the module would only print the first lines of a large file and convert them to HTML.
if the user choose to 'download as...', the whole raw file would be downloaded.
Is it possible to detect this choice on the server side ? (for example is there a specific http header set ?).
note: I would like to avoid any parameter in the GET url (e.g: "http://example.org/file?mode=raw" )
Pierre
added my own answer to close the question: as said #alexeyten there is no difference. I ended by a javascript code the alter the index.html file generated by apache.

Apache - Access files from multiple different folders

Is there anyway to have a bunch of iframes on one html page that link to several different text files located elsewhere on the server?
For example, if my apache server hosts its HTML pages in:
C:\Apache\WebDocs,
Is there anyway to link several different log files from different locations like" C:\game1\logs\log.txt and C:\GameServer\logs\console.txt all into one webpage using iframes?
I suggest you create shortcuts to your current apache document root and give apache user read permission to the original file. Personally, I haven't tested this on a windows machine. Otherwise, you can use Alias directive.
Alias /log1 C:\game1\logs\
and you can call the url as http://localhost/log1/
That should help as well.

Enable the use of SSI

Using HostGator, I can't seem to get SSI to work on my server. I'm using Dreamweaver to build the site and the everything works just fine in the preview. But when I actually upload the pages to my server, any elements that are includes files don't appear. Does anyone know how I can enable SSI on my web server?
Your last comment gave me the information I need. The issue is that the file is not in the same directory as the file you're trying to add the footer.inc file to. Try this code:
<!--#include virtual= "includes/footer.inc" -->
when using the file= parameter, the file you're including must be in the same directory. If the file you're including is not in the same directory, then you will have to use virtual. See this page for more information: SSI: The Include Command.
And here, from the source, is pretty much the rule of thumb: Use file= when the included file is within the same directory as the page that wants it. Use virtual= when it isn't.
EDIT: I think I got it now. Copy and paste the above code and it should work for you. Make sure you follow these guideline: after <!--, there is no space between the last - and #. Additionally, there is a space between the closing " and the first -. These rules must be adhered to. You can view more information here: Server Side Includes Not Working

How to use relative URL's in website with two base URL's

I have our basic corporate static html website installed in our web root directory and our billing software installed in /portal. I have integrated the websites to look like a single site by including the /menu.tpl smarty template file in the /portal/header.tpl file. However, if I use relative URL's, the menu sysem doesnt work as the base url for the billing script is /portal. i.e. if I create a link to faq.php in the menu.tpl and I load a page on the portal site, the link in the menu back to the faq page is now /portal/faq.php whereby if I load a page off the root site the link is just /faq.php as it should be.
The obvious answer is to just use absolute URL's, but I need the site to be portable as I have many developers who need to install and test it.
I cant find anyway to resolve this. Any ideas?
I ran into the same problem as you a while ago, and after trying a lot of dead ends, I finally ended up with the following solution:
For any URL you need to be a chamelion, i.e. change its path depending on the environment, insert a PHP function that writes out the correct URL.
If you include the PHP function from a single central file, then you can change all of the URL's in the entire site automatically, based on a setting, or some pre-detected switch such as the current domain name, etc.
Example:
<?php print_base_url_plus("/menu.php"); ?>
... where print_base_url_plus() is a function which appends the base URL onto the output.
You may find that you have to change some of the URL's to be php, so they are preprocessed by the PHP engine, or, you can alter the web settings so that standard .htm files are piped through the PHP engine, just like .php files.