Gossamer Forum
Home : Products : DBMan : Customization :

sub html_view_success based on permissions

Quote Reply
sub html_view_success based on permissions
I'm trying to have on sub html_view_success for all registerd users and one for the default user. I've found these 2 threads on permissons sub html_record,

layout based on permission :
http://www.gossamer-threads.com/...ew=&sb=&vc=1

and

different layout when viewing :
http://www.gossamer-threads.com/...ew=&sb=&vc=1


but I haven't been able to adapt them succsessfully to sub html_view_success.

An alternative would of course be to use 2 different html.pl files but I think it would be much better to have differnet sub html_view_success.


:water
Quote Reply
Re: sub html_view_success based on permissions In reply to
What you need to do is edit the sub view_records routine in the db.cgi file, like the following:

RED codes are what you need to add.
BLUE codes are the standard codes in this sub-routine.

Code:

sub view_records {
# --------------------------------------------------------
# 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") {

if ($db_uid eq "default") {
&html_view_default_success(@hits);
}
else {
&html_view_success(@hits);
}

}
else {
&html_view_failure($status);
}
}
You will also need to create a new sub called sub html_view_default_success in your html.pl, which should be a copy of the sub html_view_success routine with different codes that you want to appear for default users.

Regards,

Eliot Lee