Gossamer Forum
Home : Products : DBMan : Customization :

Add own "private" addittion

Quote Reply
Add own "private" addittion
Just got started with DBMan.
Quick question: What mod do I need to use to get this done.
I am planning a database with Field1, Field2 and Field3.
Field3 is for private view only (eg. only registered member may view own Field3 record, and nobody's elses)
Users dont see Field3 unless they've added that.


Quote Reply
Re: Add own "private" addittion In reply to
It would be possible to set up such a field. However, you must first set up your database and create your own form (sub html_record_form) and display (sub html_record). Once you get things set up and working correctly, I'll be glad to help you with this feature.

JPD
http://www.jpdeni.com/dbman/
Quote Reply
Re: Add own "private" addittion In reply to
JPD Wow....Thanks for taking time to post anything in my post.BTW I printed your whole site last year,and I think its one of the best resources available for DBMan. Learned few tricks for Links....;)

But for business now...OK done....Forms.
And next? Is this going to be a major thing....,or is there a mod I should try to do with this?

Quote Reply
Re: Add own "private" addittion In reply to
This is actually pretty easy to do. The best way to explain it is to give an example. Let's say your html_record includes the following:

Code:

print qq|
<table><tr><td>Name:</td>
<td>$rec{'Name'}</td></tr>
<tr><td>Address:</td>
<td>$rec{'Address'}</td></tr>
<tr><td>Private Field:</td>
<td>$rec{'Field3'}</td></tr>
<tr><td>Public Field:</td>
<td>$rec{'Field4'}</td></tr></table>
|;
You want the "Private Field" only to appear for the person who owns the record.

Code:

print qq|
<table><tr><td>Name:</td>
<td>$rec{'Name'}</td></tr>
<tr><td>Address:</td>
<td>$rec{'Address'}</td></tr>|;
if ($db_userid eq $rec{$db_cols[$auth_user_field]}) {
print qq|

<tr><td>Private Field:</td>
<td>$rec{'Field3'}</td></tr>|;
}
print qq|

<tr><td>Public Field:</td>
<td>$rec{'Field4'}</td></tr></table>
|;
That should do it.

I'm pleased that you found my site to be helpful. Smile

JPD
http://www.jpdeni.com/dbman/
Quote Reply
Re: Add own "private" addittion In reply to
Thank you so much....Its getting late....I will give it a try, and looks like this is going to work.



Quote Reply
Re: Add own "private" addittion In reply to
Did not try it yet, but looking at the code, I started thinking again. Hmm
I might be wrong, but let me try to explain what I want the script to do.

Users have that private field for them only. And could have multiple users for the same record. Make sense? Sound so confusing.

Kinda like a test:
field1: question (What is 1+1)
field2: hint (pretty close to 2)
field3: Answer (Private field ie every user has something different here)

And I have ten questions and lets say 100 users, This looks too easy....like I said did not tried it yet...My stuff is on my other computer.

I thought maybe I need to have two separate databases for this, one for questions and hints and another one for answers? Not sure?

Thanks again :)



Quote Reply
Re: Add own "private" addittion In reply to
I'm really not sure what you're doing. Can you explain a little more? And, if it's not a matter of national security, can you give me a real example? I'm having a hard time understanding what's going on.

JPD
http://www.jpdeni.com/dbman/
Quote Reply
Re: Add own "private" addittion In reply to
Thats what is it for.
A Test.
I have about 100 students, who will be using this.I want to every body have their own answers, which they may modify, as they learn new things. Field1 is a public view (ie everyone may view all the questions) Field2 is a recommended answer field or "hint" field. And Field3 is the private field, which has students own answer saved, and him to able to modify it. (Essay type answers).

Maybe I should look some other script for this purpose? What you think?

Quote Reply
Re: Add own "private" addittion In reply to
I think you can use DBMan, but not in the way you are using it, if I understand correctly.

You may need to set up a relational database. One .db file would have the questions and the associated hints. The other one would have each user's answers to the questions. Sorta like this

question database fields:
QuestionID (a counter -- key field)
Question
Hint

user database fields:
AnswerID (a counter -- key field)
QuestionID (matches the record in the question database)
Userid
Answer

The only way I can think of that you would be able to set this up with just one database would be for you to have a field for each user within the record.

JPD
http://www.jpdeni.com/dbman/