discourse-legacysite-perl/site/glist/templates/help/GT/SQL/Admin.html
2024-06-17 22:24:05 +10:00

412 lines
8.8 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>GT::SQL::Admin - instant admin for any sql table.</title>
<link rev="made" href="mailto:root@penguin.office.gossamer-threads.com" />
<style type="text/css">
/* $MVD$:fontset("Untitled Font Set 1","ARIEL","HELVETICA","HELV","SANSERIF") */
/* $MVD$:fontset("Arial","Arial") */
/* $MVD$:fontset("Arial Black","Arial Black") */
/* $MVD$:fontset("Algerian","Algerian") */
body {
background-color: white;
font-family: Verdana, Arial, sans-serif;
font-size: small;
color: black;
}
p {
background-color : white;
font-family : Verdana, Arial, sans-serif;
font-size : small;
color : black;
}
h1 {
font-family : Verdana, Arial, sans-serif;
font-weight : bold;
font-size : medium;
background-color : white;
color : maroon;
}
h2 {
font-family : Verdana, Arial, sans-serif;
font-size : medium;
font-weight : bold;
color : blue;
background-color : white;
}
h3 {
font-family : Verdana, Arial, sans-serif;
font-weight : bold;
font-size : medium;
color : black;
background-color : white;
}
h4 {
font-family : Verdana, Arial, sans-serif;
font-weight : bold;
font-size : small;
color : maroon;
background-color : white;
}
h5 {
font-family : Verdana, Arial, sans-serif;
font-weight : bold;
font-size : small;
color : blue;
background-color : white;
}
h6 {
font-family : Verdana, Arial, sans-serif;
font-weight : bold;
font-size : small;
color : black;
background-color : white;
}
ul {
font-family : Verdana, Arial, sans-serif;
font-size : small;
color : black;
}
ol {
font-family : Verdana, Arial, sans-serif;
font-size : small;
color : black;
}
dl {
font-family : Verdana, Arial, sans-serif;
font-size : small;
color : black;
}
li {
font-family : Verdana, Arial, sans-serif;
font-size : small;
color : black;
}
th {
font-family : Verdana, Arial, sans-serif;
font-size : small;
color : black;
}
td {
font-family : Verdana, Arial, sans-serif;
font-size : small;
color : black;
}
dl {
font-family : Verdana, Arial, sans-serif;
font-size : small;
color : black;
}
dd {
font-family : Verdana, Arial, sans-serif;
font-size : small;
color : black;
}
dt {
font-family : Verdana, Arial, sans-serif;
font-size : small;
color : black;
}
code {
font-family : Courier;
font-size : small;
color : black;
}
pre {
font-family : Courier;
font-size : small;
color : black;
}
.mvd-H1 {
font-family : Verdana, Arial, sans-serif;
font-weight : bold;
font-size : 14.0pt;
background-color : transparent;
background-image : none;
color : maroon;
}
.mvd-H2 {
font-family : Verdana, Arial, sans-serif;
font-size : 12.0pt;
color : blue;
}
p.indent {
font-family : "Verdana, Arial, sans-serif";
list-style-type : circle;
list-style-position : inside;
color : black;
margin-left : 16.0pt;
}
.mvd-P-indent {
font-family : Verdana, Arial, sans-serif;
list-style-type : circle;
list-style-position : inside;
color : black;
margin-left : 16.0pt;
}
pre.programlisting {
font-size : 9.0pt;
list-style-type : disc;
margin-left : 16.0pt;
margin-top : -14.0pt;
}
.mvd-PRE-programlisting {
font-size : 9.0pt;
list-style-type : disc;
margin-left : 16.0pt;
margin-top : -14.0pt;
}
.mvd-PRE {
font-size : 9.0pt;
}
p.note {
margin-left : 28.0pt;
}
.mvd-P-note {
margin-left : 28.0pt;
}
.mvd-H4 {
font-family : Verdana, Arial, sans-serif;
font-weight : normal;
font-size : 9.0pt;
color : black;
margin-left : 6.0pt;
margin-top : -14.0pt;
}
.mvd-P {
font-family : Verdana, Arial, sans-serif;
font-size : 10.0pt;
color : black;
}
.mvd-BODY {
font-family : Verdana, Arial, sans-serif;
background-color : white;
}
p.indentnobullet {
font-family : Verdana, Arial, sans-serif;
list-style-type : none;
}
.mvd-P-indentnobullet {
font-family : Verdana, Arial, sans-serif;
list-style-type : none;
}
</style>
</head>
<body style="background-color: white">
<p><a name="__index__"></a></p>
<!-- INDEX BEGIN -->
<ul>
<li><a href="#name">NAME</a></li>
<li><a href="#synopsis">SYNOPSIS</a></li>
<li><a href="#description">DESCRIPTION</a></li>
<ul>
<li><a href="#usage">Usage</a></li>
<li><a href="#subclassing_the_admin">Subclassing the admin</a></li>
</ul>
<li><a href="#copyright">COPYRIGHT</a></li>
<li><a href="#version">VERSION</a></li>
</ul>
<!-- INDEX END -->
<hr />
<p>
</p>
<h1><a name="name">NAME</a></h1>
<p>GT::SQL::Admin - instant admin for any sql table.</p>
<p>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<pre>
my $cgi = new GT::CGI;
my $db = new GT::SQL '/path/to/def';
my $admin = new GT::SQL::Admin;
if ($admin-&gt;for_me($cgi)) {
$admin-&gt;process ( db =&gt; $db, cgi =&gt; $cgi );
}</pre>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>GT::SQL::Admin provides an easy way to build a table/relation
management application. It provides all the HTML and code to
easily:</p>
<pre>
1. Add records
2. Delete records
3. Modify records
4. Search records
5. Add columns
6. Drop columns
7. Alter table properties
8. Import data
9. Export data</pre>
<p>all in about 6 lines of code.</p>
<p>
</p>
<h2><a name="usage">Usage</a></h2>
<p>To use GT::SQL::Admin you need to pass in an existing
<a href="glist.cgi?do=admin_gtdoc&topic=/GT/SQL.html">the GT::SQL manpage</a> object, and a <a href="glist.cgi?do=admin_gtdoc&topic=/GT/CGI.html">the GT::CGI manpage</a> object.</p>
<p>In it's simplest usage, you can simply call:</p>
<pre>
my $admin = new GT::SQL::Admin;
$admin-&gt;process ( db =&gt; $db, cgi =&gt; $cgi );</pre>
<p>and the admin module will figure out what was requested and display
the appropriate screen. There is a $admin-&gt;for_me method that will
look to see if the cgi object contains something for the admin
to do, returning 1 if yes, 0 otherwise. You would then do:</p>
<pre>
my $cgi = new GT::CGI;
my $admin = new GT::SQL::Admin;
if ($admin-&gt;for_me($cgi)) {
$admin-&gt;process ( db =&gt; $db, cgi =&gt; $cgi );
}</pre>
<p>You can also call any of the methods individually. You can create an
add form like:</p>
<pre>
$admin-&gt;add_form;</pre>
<p>and it will be printed to STDOUT.</p>
<p>To change the look of a page, you can pass in strings or code refs
to display any of the following items:</p>
<pre>
start_html
header
start_form
end_form
footer
end_html</pre>
<p>and the admin will use your html/code when displaying. You can also pass
in to process:</p>
<pre>
record =&gt; 'MyObject'</pre>
<p>and the admin will use that string when displaying titles like 'Add MyObject'.
If you don't specify, it will default to the name of the table.</p>
<p>
</p>
<h2><a name="subclassing_the_admin">Subclassing the admin</a></h2>
<p>You can enhance the functionality of an admin quite easily. By default
GT::SQL::Admin expects to find a GT::SQL object, a GT::CGI object, and uses
internally a GT::SQL::Display::HTML object for any form/record html
generation.</p>
<p>Alternatively, you can subclass one or more of the above and use your
own libraries. For instance, if you wanted to expand the form generation,
you could subclass the GT::SQL::Display::HTML object and override the <code>display()</code>
and <code>form()</code> method with your own.</p>
<p>The admin will pass in a 'mode' to both display and form that will tell
you what it is using the form for. This can be one of:</p>
<pre>
search_form
search_results
add_form
add_success
delete_search_form
delete_search_results
download_file
modify_search_form
modify_search_results
modify_form
modify_success
modify_multi_search_results
modify_multi_results_norec
modify_multi_result_changed
modify_multi_results_err</pre>
<p>There are also several options that can be passed in. See the
<a href="glist.cgi?do=admin_gtdoc&topic=/GT/SQL/Display/HTML.html">the GT::SQL::Display::HTML manpage</a> module for more information.
</p>
<p>Also be sure to read about subclassing in <a href="glist.cgi?do=admin_gtdoc&topic=/GT/SQL.html">the GT::SQL manpage</a>.
</p>
<p>
</p>
<hr />
<h1><a name="copyright">COPYRIGHT</a></h1>
<p>Copyright (c) 2004 Gossamer Threads Inc. All Rights Reserved.
<a href="http://www.gossamer-threads.com/">http://www.gossamer-threads.com/</a>
</p>
<p>
</p>
<hr />
<h1><a name="version">VERSION</a></h1>
<p>Revision: $Id: Admin.pm,v 1.146 2005/03/15 00:35:29 brewt Exp $
</p>
</body>
</html>