Gossamer Forum
Home : Products : DBMan : Customization :

Personal and Public Viewing

Quote Reply
Personal and Public Viewing
Hi,

I found an old entry about Personal and Public Viewing and would like to know if anyone knows if it works and what part of this I should use in my database.

http://gossamer-threads.com/...c;guest=1578936#1492

Anyone?

Jan Peter

Jan Peter
Quote Reply
Re: [JPWiese] Personal and Public Viewing In reply to
I haven't used that specific modification but by testing it within your database or with a backup copy you could test it.

What part would work with your database would depend on what you are wanting to do specifically.

Please explain what you are wanting to do. There are various threads related to different viewing options in the FAQ under "Viewing", perhaps by checking out the related thread you can come up with ideas on what exactly you want to do.

If you explain more fully here .. perhaps we can help you find a solution.

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] Personal and Public Viewing In reply to
We have some 200 families as members. Today when they sign up they say


Yes, you can post our name, address and info on the internet - or
No, you can not post...


If they say Yes... I will copy their info to a address.html page in our site. Then I will put the childrens birthdays into a javascript on the index.htm a static page. (This script prints todays birthdays to the index.htm Saying Congratulation: <Name> is <Yrs> <mailto:Email>) In other words a lot of work copying modifying and pasting.

If they say No... I just forward the mail to those who keep the memberfiles.

With this I want everyone to fill in their info to the DBMan and choose Yes or No. Choosing Yes means that every one (Everyone that is registered - No guests are allowed) can view it. Only owner and admin can modify/delete it. Choosing No means that that only admin and the owner of the post can view it (and modify/delete).

Jan Peter
Quote Reply
Re: [JPWiese] Personal and Public Viewing In reply to
Here's a few ideas taken from previous threads.

Hiding complete records:

I need to completely hide some records to be viewed from users, but to be seen from admins.

I placed a field like this:

FYEO => [18, 'alpha', -2, 2, 0, 'No', '']

this field is a radio box that when selected at "No" a user can see the record,
if setup as "Si" user cannot see the record.

well, I've tried to use hidden fields but when someone searches the database all records are displayed.
-------------------------------
Response:

I don't think that will work.

At that point in sub html_view_success, the value of the field for a particular record is not yet known.

The only way I can see this working is to add lines in sub query. At the beginning of sub query in the db.cgi file,

after: local (%sortby);

add code:
unless ($per_admin) {
$in{'FYEO'} = 'Si';
}

That will prevent the records that are not supposed to be seen from even being returned by the search.
------------------
JPD

---------------------------------
Show fields to record owner only:

How can I setup the script, to show one or two fields in the 'html_record_long' only to the owner of the record?

Answer:

First, close off the previous print qq| statement with a |;
Then add code:

if ($rec{'Userid'} eq $db_userid) {
print qq| [print out your fields you want displayed] |;
}
--------------------

Want only the owner of the record and those with admin permissions to see a field(s):

|;
if (($db_userid eq $rec{'UserID'}) || ($per_admin)) {
print qq| [The record information] |;
}
print qq|


Hope this provides you with ideas on how to accomplish your task.

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] Personal and Public Viewing In reply to
I want the owner of record to choose

Yes (all registered users can view) or
No (only record owner and admin can view)

This is the closest I think:
Quote:
Hiding complete records:

I need to completely hide some records to be viewed from users, but to be seen from admins.

I placed a field like this:

FYEO => [18, 'alpha', -2, 2, 0, 'No', '']

this field is a radio box that when selected at "No" a user can see the record,
if setup as "Si" user cannot see the record.

well, I've tried to use hidden fields but when someone searches the database all records are displayed.
-------------------------------
Response:

I don't think that will work.

At that point in sub html_view_success, the value of the field for a particular record is not yet known.

The only way I can see this working is to add lines in sub query. At the beginning of sub query in the db.cgi file,

after: local (%sortby);

add code:
unless ($per_admin) {
$in{'FYEO'} = 'Si';
}

That will prevent the records that are not supposed to be seen from even being returned by the search.
Two questions: Is this all I need do make this? And how about the solution in

http://gossamer-threads.com/...c;guest=1578936#1492

Jan Peter

Jan Peter
Quote Reply
Re: [JPWiese] Personal and Public Viewing In reply to
I'm not sure I understand the question is this all I need.

You would have to add an extra field to provide the user a choice of making their record public or private. Adding this to your field list and to the forms.

Then you would add the codes in sub query. Changing the name of the field and also the response option to match your field names.

Have you given this a try to see if it works? That is the best way to tell. Adding different mods is sometimes a matter of trial and error finding what works best.

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] Personal and Public Viewing In reply to
When asked if this is all I need, I was thinking about other things needing page up and page down with code :-)

I'll try this and tell you later if it works.

Jan Peter

Jan Peter
Quote Reply
Re: [LoisC] Personal and Public Viewing In reply to
I inserted the code in db.cgi, changed til db_def and made the fields in html.pl - But

Something is wrong:
Quote:
DBMan encountered an internal error. Please enable debugging to view.


I made an error.txt file but it is emty


http:www.colombiaklubben.no/dbman_txt/error.txt


My files van be viewed at:


http:www.colombiaklubben.no/dbman_txt/db_cgi.txt
http:www.colombiaklubben.no/dbman_txt/default_cfg.txt
http:www.colombiaklubben.no/dbman_txt/html_pl.txt


The database is here:


http:www.colombiaklubben.no/cgi-bin/dbman/db.cgi


Jan Peter
Quote Reply
Re: [JPWiese] Personal and Public Viewing In reply to
Hi again,

I think I found the answer in the FAQ.

Quote:


Hiding complete records

Question:

I need to completely hide some records to be viewed from users, but to be seen from admins.

I placed a field like this:

FYEO => [18, 'alpha', -2, 2, 0, 'No', '']

this field is a radio box that when selected at ''No'' a user can see the record, if setup as ''Si'' user cannot see the record.

well, I've tried to use hidden fields but when someone searches the database all records are displayed.
-------------------------------
Response:

I don't think that will work.

At that point in sub html_view_success, the value of the field for a particular record is not yet known.

The only way I can see this working is to add lines in sub query. At the beginning of sub query in the db.cgi file,

after: local (%sortby);

add code:
unless ($per_admin) {
$in{'FYEO'} = 'Si';
}

That will prevent the records that are not supposed to be seen from even being returned by the search.
-----------------
JPD


This did the trick.

Now there is another thing about this. I want the owner of the record to set this herself and I only see this while I am logged on as admin. How can I present this to the owner of the record, both in add and modify view?

Jan Peter
Quote Reply
Re: [JPWiese] Personal and Public Viewing In reply to
I don't read your language but I'm assuming that this is the option presented in your add form. If so just take it out of the codes for admin view only.

Change:

if ($per_admin) {
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="150"><$font_color>Offentlig:</FONT></TD>
<TD VALIGN="TOP" WIDTH="450">&nbsp;|; print &build_radio_field("Vis_reg",$rec{'Vis_reg'}); print qq|</TD></TR>
</TABLE>
&nbsp;Ved velge "Offentlig = <b>Ja</b>" kan alle med brukernavn og passord se det du legger inn her.<BR>
&nbsp;Ved velge "Offentlig = <b>Nei</b>" kan bare du og styret se det. |;
}
else {
print qq| <input type="hidden" NAME="Vis_reg" VALUE="$rec{'Vis_reg'}"> |;

}
print qq|

TO:

|;
print qq|<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="150"><$font_color>Offentlig:</FONT></TD>
<TD VALIGN="TOP" WIDTH="450">&nbsp;|; print &build_radio_field("Vis_reg",$rec{'Vis_reg'}); print qq|</TD></TR>
</TABLE>
&nbsp;Ved velge "Offentlig = <b>Ja</b>" kan alle med brukernavn og passord se det du legger inn her.<BR>
&nbsp;Ved velge "Offentlig = <b>Nei</b>" kan bare du og styret se det. |;
print qq|

This would also correct any problems with having the ending table tag within an admin view only command. Otherwise the table would not end properly for other users. There might also now be extra opening and closing print tags you may need to adjust.

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] Personal and Public Viewing In reply to
OK - Now I and the record owners can make a record personal, but (there's allways a but *S*) When I make a record personal only admin kan view. The owner of the record can not make their own record public again. The admin have to change this back to public for the oner to view or modify.

Jan Peter
Quote Reply
Re: [JPWiese] Personal and Public Viewing In reply to
Then use something like this which will only make the field available when entering a new record and only available to admin to modify that field:

print qq|<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="150"><$font_color>Offentlig:</FONT></TD>
<TD VALIGN="TOP" WIDTH="450">&nbsp;|;

if (($per_admin) or (!$in{'modify'})) {
print &build_select_field("Vis_reg",$rec{'Vis_reg'}); }
else {
print qq|<input type="hidden" name="Vis_reg" value="$rec{'Vis_reg'}">$rec{'Vis_reg'}|; }
print qq|</TD></TR>

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] Personal and Public Viewing In reply to
The owner should be able to see the record with the public/personal choise all the time when they search their own record to modify or deletion - not only while adding new record. This way they can change their mind about letting other members view their record.

Jan Peter

Last edited by:

JPWiese: Oct 9, 2002, 10:43 PM
Quote Reply
Re: [JPWiese] Personal and Public Viewing In reply to
The code change is just to keep them from being able to modify the one specific field as you stated:

The owner of the record can not make their own record public again. The admin have to change this back to public for the oner to view or modify.

Did you try the change to see what it does? You are really confusing me as to exactly what you want as you seem to be keep changing your mind.

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] Personal and Public Viewing In reply to
First: Sorry about the confusion, I guess I was doing a bad job explaining this. I'll try again.

I want members to be able to make their record public or personal. They should be able to change this both ways whenever they want to.

The result should be:


Public:
- Everyone with a username and password can view the record. (Guests are not allowed in the database)
- Owner of record and admin can view, modify and/or delete the record.
- Both owner of record and admin can change to personal.

Personal:
- Only owner of record and admin can view, modify and/or delete the record.
- Both owner of record and admin can change to public.


I hope this explaines my thoughts better.

Jan Peter
Quote Reply
Re: [JPWiese] Personal and Public Viewing In reply to
I was thinking about your thread early this morning when I couldn't sleep and realized what you were asking :)

Okay, you have $auth_user_field = 1; so that must mean that 'Brukernavn' is your userid field. Is this correct?

At the beginning of sub query in the db.cgi file, after: local (%sortby);

you have this?

unless ($per_admin) {
$in{'Vis_reg'} = 'Nei';
}

Try changing to:

if (($db_userid eq $rec{'Brukernavn'}) || ($per_admin)) {
$in{'Vis_reg'} = 'Nei';
}

I hope this gives you what you need :)

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] Personal and Public Viewing In reply to
I hope I didn't destroy your sleep.

Yes Brukernavn (Norwegian for Username) is my userid field. (Ja=Yes, Nei=No, Vis_reg=Show record)

I changed as you said and now only admin can change Public/Personal. I would like the owner to make this change too :-)

Edit:

I changed it back again to the state before the last change. After the change it didn't work

Jan Peter

Last edited by:

JPWiese: Oct 10, 2002, 12:49 PM
Quote Reply
Re: [JPWiese] Personal and Public Viewing In reply to
Well, I'm an out of suggestions at this point. You could maybe change the setting for in your .cfg file from:

$auth_modify_own = 1;
to:
$auth_modify_own = 0;

and see if that makes a difference.

Also in your .cgi file sub get_record try commenting out the following line and see if it makes a difference:

# ($restricted = 1) if ($auth_modify_own and !$per_admin);

Perhaps someone else may be able to help shed some light on a possible solution.

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] Personal and Public Viewing In reply to
Thank you for all your help.

I tried to comment out the line


# ($restricted = 1) if ($auth_modify_own and !$per_admin);


but nothing happened.

Even if I didn't get all the way with this I succeded in the main thing: The posibility to change between public and personal view.

So if no one comes up with a new idea I say goodbye for now.

Jan Peter