I don't know the answer to the first question.
With regards to the second question...What you could do is create another sub-routine that will allow the administrator to view a separate table of data.
Follow these instructions:
1) Insert the following codes:
Code:
elsif ($in{'print_view'}) { if ($per_view) { &print_view; } else { &html_unauth; } }
AFTER the following lines of codes in the
sub main in default.cgi:
Code:
if ($in{'add_form'}) { if ($per_add) { &html_add_form; } else { &html_unauth; } }
elsif ($in{'add_record'}) { if ($per_add) { &add_record; } else { &html_unauth; } }
elsif ($in{'preview_record'}) { if ($per_add) { &preview_record; } else { &html_unauth; } }
elsif ($in{'view_search'}) { if ($per_view) { &html_view_search; } else { &html_unauth; } }
2) Add a sub-routine called
sub print_view in default.cgi AFTER
sub view_records:
Code:
sub print_view {
# --------------------------------------------------------
# This is called when a user is searching the database for
# viewing. All the work is done in query() and the routines just
# checks to see if the search was successful or not and returns
# the user to the appropriate page.
my ($status, @hits) = &query("view");
if ($status eq "ok") {
&html_print_view(@hits);
}
else {
&html_view_failure($status);
}
}
3) Create a sub-routine (could be called
sub admin_view). Copy the
html_record sub-routine and modify the
sub admin_view to your liking. Use HTML codes and field names (e.g., $rec{'
FieldName'}) to create the format you like.
4) In the
sub view_search of the
html.pl file, add these codes:
Code:
|;
if ($per_admin) {
print qq|<INPUT TYPE="SUBMIT" NAME="print_view" VALUE="View Printable Format">|;
print qq|
AFTER this line:
Code:
<INPUT TYPE="SUBMIT" NAME="vr" VALUE="View Records">
5) Create another sub-routine called
sub html_print_view. You can copy the
html_view_success.
6) Replace
&html_record(%rec); with
admin_view in
html_print_view.
This should work. I have a similar routine working on the following web site:
www.coco.cc.az.us/cgi-bin/schedules/index.cgi?&uid=default Of course, the difference is that the codes I've provided you are only for administrators to view versus the example, which allows everyone to view the records in a printable format.
Regards,
------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
[This message has been edited by Eliot (edited August 04, 1999).]
[This message has been edited by Eliot (edited August 04, 1999).]