Gossamer Forum
Home : Products : DBMan : Customization :

Can this be done?

Quote Reply
Can this be done?
We have a High School Alumni database and we have two tiers of users - registered alumni(add and modify own record only), and members (add, modify own, and view all records) - the admin sets permissions.

What we are now trying to do is when the admin sets the new permissions we would like to somehow automatically trigger a small "member" graphic to be added (appear) to their record in the database.

Any ideas on how this can be accomplished?

Thanks!

-----------
donm
Quote Reply
Re: Can this be done? In reply to
The only way I can think to do it would be to add a checkbox field to the database, saying that the person is a member. Then you can print out the graphic based on whether there is anything in the field or not.


------------------
JPD





Quote Reply
Re: Can this be done? In reply to
Thank you JPD for the code for this.... however, once I add the code everything works with one big exception.... the graphic shows up on everyone's record no matter if they are a member or not.

Any ideas?

----------
donm
Quote Reply
Re: Can this be done? In reply to
Okay. Try this

Code:
|;
if ($rec{'Member'} eq 'Yes') {
print qq|<img src="http://url/to/member_graphic">|;
}
print qq|

------------------
JPD





Quote Reply
Re: Can this be done? In reply to
JPD - that was it ! I have all the mods added and everything is working ..... wow, I wasn't sure about this when I started.

Just a few tweaks to the HTML part of it now and it will be complete. I was really skeptical about the upload mod after all the problems you and I went through with the very first upload mod a few months ago but this time it worked like a charm !

You should be receiving one of those Amazon.com certificates soon !

Thanks again!
-------------------
donm
Quote Reply
Re: Can this be done? In reply to
ok - I haven't worked with checkboxes at all along with DBMan yet. Could you tell me what I need to do? I already have a field setup in the default.cfg for it (easy part).

I would like for the checkbox to be for the admin only - and it would need to go somewhere in the "modify" part of the html.pl (ok, now I am rambling - I'll wait for an answer on this one) <g>

Thanks!
--------------
donm

[This message has been edited by donm (edited August 17, 1999).]
Quote Reply
Re: Can this be done? In reply to
I'll assume that your field is called "Member."

In default.cfg, use

Code:
%db_checkbox_fields = ( Member => 'Yes' );

In sub html_record_form (html.pl) add

Code:
|;
if ($per_admin) {
print qq|<tr><td>Member</td>
<td>&nbsp;|; print &build_checkbox_field("Member",$rec{'Member'}); print qq|</td></tr>|;
}
else {
print qq|<input type="hidden" name="Member" value="$rec{'Member'}">|;
}
print qq|

In html_record, where you want to print out the member graphic, use

Code:
|;
if ($rec{'Member'}) {
print qq|<img src="http://url/to/member_graphic">|;
}
print qq|

Then, when someone becomes a member, you'll need to go to their record and check the "Member" box.


------------------
JPD





Quote Reply
Re: Can this be done? In reply to
JPD - can you add multiple checkboxes to the default.cfg?

I have another checkbox that is needed to do basically the same thing as above but will indicate if they are on the class reunion committee.

I have setup another field called "Reunion"

But I am not sure what I need to change in the default.cfg to add another checkbox?

Thanks!
---------------
donm
Quote Reply
Re: Can this be done? In reply to
No problemo.

Code:
%db_checkbox_fields = (
Member => 'Yes',
Reunion => 'Yes'
);

You can add as many as you want. Just be sure that all *except the last one* has a comma at the end of it.

So you could have

Code:
%db_checkbox_fields = (
Member => 'Yes',
Reunion => 'Yes',
TeachersPet => 'Yes',
ClassClown => 'Yes',
StudentBodyOfficer => 'Yes'
);

As many as you want. Smile

------------------
JPD





Quote Reply
Re: Can this be done? In reply to
JPD- Thanks so much for your help ! Our database is now complete and will go live tomorrow !

I see you received our gift certificate - I realize it does not even begin to pay you for your expertise with the DBMan program or your patience in dealing with those of us who post our questions here on this messageboard - but I hope it shows a little of how much you are appreciated !

Thanks again !
-----------------
donm