How to Embed ViewCVS in Plone — plone.org

来源:百度文库 编辑:神马文学网 时间:2024/04/29 13:11:31
How to Embed ViewCVS in PloneThis How-to applies to: Any version.
This How-to is intended for: Server Administrators
An example of how to ‘persuade‘ ViewCVS to embed in a Plone page. Provides an account of how to do rewriting with Apache, converting ViewCVS, and adding externally created, dynamic content to Plone pages.
The original content of this how-to can be foundat this location.
A working example can be foundat this location.
I can‘t just paste the code, since your setup will be different from mine. And beware for those who want elegance, this is not the epitome of pretty code. It is just a plain quick hack that took under 2 hours to implement. I have no doubt this How-To will take me at least double that length of time. Furthermore, my deepest respect to the ViewCVS team for an excellent product. I am sorry that I had to do what I did to get it to work how I wanted it to. I would send you a patch but I am far too scared. And last but not least, Plone and Zope, absolutely killer products from the minds of geniuses.
The nature of the problem
The nice thing about Plone, and I have only been using it for 4 days, is that everything looks the same. I think the Human Computer Interface Designers would call this something like uniformity and consistency , and for me as the end user it is just lovely.
That is all well, but what about prepackaged scripts that don‘t look like plone, how can you embed them in a Plone page? ViewCVS is one such script. It is used almost universally for displaying CVS contents with HTML over HTTPfor example. Incredibly, and if you checked the link, you will see that even Sourceforge display a naked ViewCVS page with no formatting. Yuck!
How are we going to fix it?
Well, there are about 14,000 solutions to this problem, and I really should have approached it in one of the other ways (like importing the mod-python viewcvs modules and using them, or even calling the cgi scripts directly) but instead, I decided to use my existing Apache based viewcvs setup.
I shall force viewCVS requests to be passed to a Zope request-handler which will independently request the actual ViewCVS content and embed it in a plone page.:
USER -> APACHE -> REWRITE -> ZOPE -> VIEWCVS(APACHE) -> ZOPE -> USER
Well that is it. If you understand that, you are done with this how-to. If you need more information on some or all of the steps that it took (and remember doing it takes very little actual time) please read on.
Requirements
ViewCVS Note: you will not be able to run this copy of ViewCVS outside Plone after these changes, you will need to use another copyPloneZopeApache with Rewrite and Proxy modules
Apache Rewriting
The plan is to have all requests to the root / on the server to be redirected to the Plone (Zope) server, while all requests to /local/ to be allowed to pass through to Apache. I understand this is a very common way of using Zope and Plone, and it certainly works fairly smoothly on my set up.
I am barely literate in Apache mod-rewrite, but the best I can do is to paste my example configuration and explain it. If you alreday have rewrite set up, you may need to review your config to see exactly what is going on.: RewriteEngine OnRewriteRule ^/local - [L]RewriteRule ^/(.*) http://localhost:8080/VirtualHostBase/http/aa.homelinux.com:80/VirtualHostRoot/$1 [P]
 
The first line turns rewriting on. The second line tells the server to stop processing and pass through to the local server - [L] any requests to /local. And the third line rewrite all other requests to that weird url on the local machine. If you don‘t know what they all mean, don‘t worry, just know that localhost:8080 is the location of the Zope server, and aa.homelinux.com:80 is the location of the Apache Server. Leave the other words as they are. They are needed by the virtual host monster.
Do it now, install a virtual host monster in the root of your Zope installation. It is in the dropdown box on the right. You don‘t need to edit this in any way. And while you are at it, if you have changed any Apache settings, restart the server.
ViewCVS
Currently, I have an alias for /local/cvs/ which points to my actual viewcvs directory using Apache2. If you haven‘t already set it up, a simple alias like this will usually do the job for making ViewCVS work with Apache: Alias /local/cvs /usr/lib/cgi-bin/viewcvs.cgi
 
Where /local/cvs/ is the browseable url for ViewCVS on the Apache server, and /usr/lib/cgi-bin/viewcvs.cgi is the actual location of ViewCVS on your filesystem. Before I put Plone in the mix, this is how the outside world would access ViewCVS.
When ViewCVS renders it‘s pages it sets up the url for the link and in our case it sets them up as: /