Commit 6320b0de authored by Adrian Hungate's avatar Adrian Hungate

Initial git commit

parents
How to install ZCGI
Simply unpack the tarball under your products folder
on your Zope server, then restart Zope.
How to uninstall ZCGI
Ensure all instances of ZCGIScript, ZCGIFolder and
ZCGIExtensionMap have been removed, then delete the
ZCGI folder from your products folder. Then restart
Zope.
How To Get ZCGI Working
* Create the folders
* Create a folder called **cgi-bin** under your
Zope root or your instance root. This is your
**zope-cgi-bin** folder
* *Optional* Create a cgi-bin folder, or locate your
Legacy webserver's existing cgi-bin folder. This
(Or these - you can have more than one) is (are) your
**additional-cgi-bin** folder(s).
* Create Zope objects
* For each script you place in your **zope-cgi-bin**
create a ZCGIScript object somewhere within your
Zope. This object can be called from HTML in the
same way as any other Zope object, but when called
it will run the cgi-bin script in the **zope-cgi-bin**
folder.
* For each **additional-cgi-bin** create a ZCGIFolder
object somewhere in your Zope. For instance your
default Apache cgi-bin folder could be represented
by a ZCGIFolder object call cgi-bin, in the root
of your zope. This will then function exactly as
a cgi-bin folder on a legacy webserver.
* If you want to add or change the handlers that are
run for particular extensions of cgi-bin scripts,
you can make changes to the ZCGIExtensionMap object
in the root of your Zope.
* If you would like a handler to only apply to a certain
section of your Zope, you can create a new
ZCGIExtensionMap object in that Zope folder, and add
the handler to it.
* You can optionally get ZCGI to replace the head/tail
of the returned HTML with either *standard_html_header*
and *standard_html_footer* - (**DTML**), with *standard_template.pt*
(macros/page, slot=body) (**Page Templates**), with *main_template*
(macros/master, slot=main) (**CMF**) or the head/tail can be removed
completely (**None**). If the output is not of
content-type text/html, or headers is set to **CGI**, then this
step is skipped.
* To publish web content from another site, but with your
site's look and feel, create a ZWebRipper object, with the
URL of the starting point within the target site.[1]
Special Notes
When calling the scripts in a ZCGIFolder, you must not include
the file extension in the URL you call. Doing so will cause a
404 - Not found error.
Under certain circumstances, ZCGIScripts and scripts in
ZCGIFolders may freeze until another script has finished
running. This is to prevent two scripts running within
the same script environment - It should not be possible as
most operating systems duplicate the environment rather than
referencing it, but I thought it best to be safe. If you
experience this, please let me know as soon as possible,
including details of the OS so I can find a work-around.
Credits
A big credit goes to "Fred Wilson Horch":mailto:fhorch@ecoaccess.org
for giving me the kick start I needed to get this
product going in the first place, and for support through
the initial development phase.
Special thanks go to Marc Lindahl - "http://www.zope.org/Members/bowerymarc":http://www.zope.org/Members/bowerymarc -
who helped me with a number of quite persistent problems and contributed
several changes and bug fixes to the code.
Thanks go to "Thomas Koester":mailto:tkoester@intevation.de for providing
the solution to the problem of multi-value fields.
Notes and Warnings
.. [1] It is **VERY** important that you obtain the permission of the target
site owner/copyright owner **BEFORE** using ZWebRipper. All web content
is the intellectual property of the creator, and it is your responsibility
to ensure you ask - Failure to do so could lead to unpleasant legal battles
and assorted other issues.
\ No newline at end of file
This diff is collapsed.
"""
ZCGI Init
==== ====
"""
# $Id: __init__.py,v 1.2 2002/10/20 23:17:14 adrian Exp $
#
# $Log: __init__.py,v $
# Revision 1.2 2002/10/20 23:17:14 adrian
# * Fixed and simplified CGI __bobo_traverse__ handling
# * Added support for "web ripping" - downloading pages from a remote server and (optionally) changing the headers etc
#
# Revision 1.1.1.1 2002/02/03 17:07:16 root
#
#
# Revision 1.3 2001/12/30 01:05:44 adrian
# * Added ZCGIFolder type to emulate CGI-BIN functionality exactly
# * Corrected environment for CGI script
# * Corrected passing POST data
# * Corrected handling of returned mime-headers
# * Added HTML-HEAD ripping (Can change CGI data to fit site look&feel)
# * Added code to fix mailman malformed HTML (spurious <BODY in output)
# * Changed error messages to be more standard for CGI-BIN
# * Can now add new ZCGIExtensionMap's to allow certain handlers only in certain areas
#
# Revision 1.2 2001/10/21 15:04:56 adrian
# no message
#
#
__version__ = '$Revision: 1.2 $'[11:-2]
import ZCGI
def initialize(context):
""" Initialize this product """
app = context._ProductContext__app
if not hasattr(app, ZCGI.ZCGIExtensionMap.id):
obj = ZCGI.ZCGIExtensionMap()
app._setObject(obj.getId(), obj)
get_transaction().note('Added Z CGI Extension Map')
get_transaction().commit()
context.registerClass(
ZCGI.ZCGIExtensionMap,
meta_type = 'Z CGI Extension Map',
permission = 'Add Z CGI Extension Maps',
icon='www/ZCGIExtensionMap.gif',
constructors=(ZCGI.manage_addZCGIExtensionMap,),
)
context.registerClass(
ZCGI.ZCGIScript,
meta_type = 'Z CGI Script',
permission = 'Add Z CGI Scripts',
icon='www/ZCGIScript.gif',
constructors=(ZCGI.manage_addZCGIScriptForm,
ZCGI.manage_addZCGIScript),
)
context.registerClass(
ZCGI.ZCGIFolder,
meta_type = 'Z CGI Folder',
permission = 'Add Z CGI Folders',
icon='www/ZCGIFolder.gif',
constructors=(ZCGI.manage_addZCGIFolderForm,
ZCGI.manage_addZCGIFolder),
)
context.registerClass(
ZCGI.ZWebRipper,
meta_type = 'Z Web Ripper',
permission = 'Add Z Web Rippers',
icon='www/ZWebRipper.gif',
constructors=(ZCGI.manage_addZWebRipperForm,
ZCGI.manage_addZWebRipper),
)
context.registerHelp()
Z CGI Folder - Add: Create a new Z CGI Folder
Description
This view allows you to create a new Z CGI Folder.
Special Note
When calling the scripts in a ZCGIFolder, you must not include
the file extension in the URL you call. Doing so will cause a
404 - Not found error.
Controls
'Id' -- Allows you to specify the id of the Z CGI Folder.
'Title' -- Allows you to specify the title of the Z CGI Folder.
'CGI Folder' -- Allows you to specify where the folder is within
your file-system. You should enter the complete path.
'Add' -- Create a new Z CGI Folder.
'And and Edit' -- Create a new Z CGI Folder and view its management interface.
Z CGI Script - Add: Create a new Z CGI Script
Description
This view allows you to create a new Z CGI Folder.
Controls
'Id' -- Allows you to specify the id of the Z CGI Folder.
'Title' -- Allows you to specify the title of the Z CGI Folder.
'CGI File' -- Allows you to specify the name of the CGI-BIN script.
This file can be in the Instance Main CGI-BIN Folder or the Zope
Main CGI-BIN Folder. You should exclude the file extension (If any)
including it will cause an error when the script is run.
'Add' -- Create a new Z CGI Script.
'And and Edit' -- Create a new Z CGI Script and view its management interface.
Z CGI Extension Map - Edit Extension Mappings
Description
This view allows you to review, edit, add and remove the extension mappings
used by all ZGIScripts and ZCGIFolders. An extension mapping maps a file
extension (.py, .pl etc) to a handler - the program that runs the script
(python, perl etc).
You can use the controls on this page to manage the handlers and extensions
you want to support within your Zope. Note, the order of this lines in this
list can be significant if you use a catch all - A blank extension - Anything
listed after it is effectivly disabled.
Controls - Top Form
'Select Box' -- Check this to operate on this line with the **Move First**
or **Delete** buttons.
'Extension' -- *(Fixed)* Shows the extension that will trigger this handler.
'Handler' -- The command line that is executed. Place **%s** where the name
of the CGI-BIN script file should go in the command line.
'Move First' -- Move the selected entries (If any) to the top of the list.
'Delete' -- Delete the selected entries (If any) from the list.
'Save Changes' -- Save any changes you have made to **Handlers** above.
Controls - Bottom Form
'Extension' -- The extension to trigger this handler (Or blank for catch all).
'Handler' -- The handler for this extension. Place **%s** where the name
of the CGI-BIN script file should go in the command line.
'Add Handler' -- Click this to add this new handler to the list.
Z CGI Script - Preview: Display the output of your CGI-BIN script within the management interface
Description
This view allows you to review the output of you CGI-BIN script within the
Zope management interface. If you would prefer it to be exactly as the
browser would see it, select Run instead.
Controls
None
ZCGI 1.3.0
\ No newline at end of file
<dtml-var manage_page_header>
<dtml-var "manage_form_title(this(), _,
form_title='Add Z CGI Folder',
help_product='ZCGI',
help_topic='AddZCGIFolder.stx'
)">
<form action="manage_addZCGIFolder" method="POST" enctype="multipart/form-data">
<table cellspacing="2">
<tr>
<th align="LEFT" valign="TOP">Id</th>
<td align="LEFT" valign="TOP"><input class="form-element" type="TEXT" name="id" size="35" /></td>
</tr>
<tr>
<th align="LEFT" valign="TOP">Title</th>
<td align="LEFT" valign="TOP"><input class="form-element" type="TEXT" name="title" size="35" /></td>
</tr>
<tr>
<th align="LEFT" valign="TOP">CGI Folder</th>
<td align="LEFT" valign="TOP"><input class="form-element" type="TEXT" name="cgifolder" size="35" /></td>
</tr>
<tr>
<td></td>
<td>
<input class="form-element" type="SUBMIT" value=" Add " name="submit" />&nbsp;
<input class="form-element" type="SUBMIT" value=" Add and Edit " name="submit" />
</td>
</tr>
</table>
</form>
<dtml-var manage_page_footer>
<dtml-var manage_page_header>
<dtml-var "manage_form_title(this(), _,
form_title='Add Z CGI Script',
help_product='ZCGI',
help_topic='AddZCGIScript.stx'
)">
<form action="manage_addZCGIScript" method="POST" enctype="multipart/form-data">
<table cellspacing="2">
<tr>
<th align="LEFT" valign="TOP">Id</th>
<td align="LEFT" valign="TOP"><input class="form-element" type="TEXT" name="id" size="35" /></td>
</tr>
<tr>
<th align="LEFT" valign="TOP">Title</th>
<td align="LEFT" valign="TOP"><input class="form-element" type="TEXT" name="title" size="35" /></td>
</tr>
<tr>
<th align="LEFT" valign="TOP">CGI File</th>
<td align="LEFT" valign="TOP"><input class="form-element" type="TEXT" name="cgifile" size="35" /></td>
</tr>
<tr>
<td></td>
<td>
<input class="form-element" type="SUBMIT" value=" Add " name="submit" />&nbsp;
<input class="form-element" type="SUBMIT" value=" Add and Edit " name="submit" />
</td>
</tr>
</table>
</form>
<dtml-var manage_page_footer>
<dtml-var manage_page_header>
<dtml-var "manage_form_title(this(), _,
form_title='Add Z Web Ripper',
help_product='ZCGI',
help_topic='AddZWebRipper.stx'
)">
<form action="manage_addZWebRipper" method="POST" enctype="multipart/form-data">
<table cellspacing="2">
<tr>
<th align="LEFT" valign="TOP">Id</th>
<td align="LEFT" valign="TOP"><input class="form-element" type="TEXT" name="id" size="35" /></td>
</tr>
<tr>
<th align="LEFT" valign="TOP">Title</th>
<td align="LEFT" valign="TOP"><input class="form-element" type="TEXT" name="title" size="35" /></td>
</tr>
<tr>
<th align="LEFT" valign="TOP">Target URL</th>
<td align="LEFT" valign="TOP"><input class="form-element" type="TEXT" name="url" size="35" /></td>
</tr>
<tr>
<td></td>
<td>
<input class="form-element" type="SUBMIT" value=" Add " name="submit" />&nbsp;
<input class="form-element" type="SUBMIT" value=" Add and Edit " name="submit" />
</td>
</tr>
</table>
</form>
<dtml-var manage_page_footer>
<dtml-var manage_page_header>
<dtml-var manage_tabs>
<p class="form-help">This form allows you to add/modify/delete
and order cgi-bin handlers for different file extenstion.</p>
<form action="<dtml-var URL1>" method="post">
<table cellspacing="0" cellpadding="2" border="0">
<tr class="list-header">
<th align="LEFT" valign="TOP">&nbsp;</th>
<th align="LEFT" valign="TOP">Extension</th>
<th align="LEFT" valign="TOP">Handler</th>
</tr>
<dtml-in getExtMap>
<tr>
<th align="LEFT" valign="TOP"><input type="checkbox" name="f_<dtml-var sequence-key>" value="1"></th>
<th align="LEFT" valign="TOP"><dtml-var sequence-key></th>
<td align="LEFT" valign="TOP"><input type="text"
name="h_<dtml-var sequence-key>" class="form-element"
value="<dtml-var sequence-item>"></td>
</tr>
</dtml-in>
<dtml-if getExtMap>
<tr>
<td align="left" valign="top" colspan="6">&nbsp;&nbsp;&nbsp;&nbsp;
<input name="manage_saveExtMap:method" type="submit"
class="form-element" value="Move First" />
<input name="manage_saveExtMap:method" type="submit"
class="form-element" value="Delete" />
<input name="manage_saveExtMap:method" type="submit"
class="form-element" value="Save Changes" />
</td>
</tr>
</dtml-if>
</table>
<p class="form-help">This form allows you to add new handlers to
the extension map.</p>
<p class="form-help">You should put %s where the path/name of the
cgi-bin script should be inserted.</p>
<table cellspacing="0" cellpadding="2" border="0">
<tr class="list-header">
<th align="LEFT" valign="TOP">Extension</th>
<th align="LEFT" valign="TOP">Handler</th>
</tr>
<tr>
<td align="LEFT" valign="TOP"><input type="text"
class="form-element" name="ext"></td>
<td align="LEFT" valign="TOP"><input type="text"
class="form-element" name="handler"></td>
</tr>
<tr>
<td align="left" valign="top" colspan="2">&nbsp;&nbsp;&nbsp;&nbsp;
<input name="manage_addExt:method" type="submit"
class="form-element" value="Add Handler" />
</td>
</tr>
</table>
</form>
<dtml-var manage_page_footer>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment