Gossamer Forum
Home : Products : DBMan : Customization :

Modify own

Quote Reply
Modify own
Forgive me if this has already been posted, I'm afraid my browsing time is cut short when there are 151 search result pages to be found. Oh my!

I'd like to know how you can make it so registered users can only modify their OWN records, and even then only certain feilds within it? The other fields, probably only 2 or 3, are only allowed to be modified by the admin.

Any assistance would be LOVELY!
Quote Reply
Re: [Kortnee] Modify own In reply to
In your .cfg file within the # Authorization Options section set:

$auth_modify_own = 1;

This is an example of one way to hide a field except for admin when records are modified. In your sub html_record_form setup each field this way that you only want admin to see.

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

This and more tips can be found in the FAQ noted below.

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] Modify own In reply to
Thanks a lot!

Is there anyway that everyone can see it, but only the admin can modify it?
Quote Reply
Re: [Kortnee] Modify own In reply to
This portion of the code includes the view of the field

<input type="hidden" name="duration" value="$rec{'duration'}">$rec{'duration'}

is has the hidden field code but includes the display as $rec{'duration'}

Did you give it a try?

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] Modify own In reply to
excuse me for being a total empty head, but the DB customization is totally new to me.

So here's what I got out of it - in the .cgf file change the modify own to a 1, making it a yes.

Now in the sub_record_html area I'm totally lost, this is what my files look like -

<TABLE WIDTH="400" CELLPADDING=0 CELLSPACING=0 BORDER=1 BGCOLOR="white" bordercolor="#000000">|;
if ($rec{'Owner Name'}) {
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><font color="#7D9F6F" face="tahoma" size="2"><b>Owner Name:</FONT></TD>
<TD WIDTH="80%">&nbsp;<$font>$rec{'Owner Name'}</Font></TD></TR>
|;
}
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><font color="#7D9F6F" face="tahoma" size="2"><b>E-mail:</FONT></TD>
<TD WIDTH="80%">&nbsp;<$font>$rec{'E-mail'}</Font></TD></TR>|;
if ($rec{'Property'}) {
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><font color="#7D9F6F" face="tahoma" size="2"><b>Property:</FONT></TD>
<TD WIDTH="80%">&nbsp;<$font>$rec{'Property'}</Font></TD></TR>
|;
}
print qq||;
if ($rec{'Acres'}) {
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><font color="#7D9F6F" face="tahoma" size="2"><b>Acres:</FONT></TD>
<TD WIDTH="80%">&nbsp;<$font>$rec{'Acres'}</Font></TD></TR>
|;
}
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><font color="#7D9F6F" face="tahoma" size="2"><b>Order:</FONT></TD>
<TD WIDTH="80%">&nbsp;<$font>$rec{'Order'}</Font></TD></TR>
</TABLE>
|;
}

I want to make it so that Order, Acres, and Property can't be changed, but E-mail and Name can be by the individual owner. And how do I make it so the DB knows which ones are the people's records?
Quote Reply
Re: [Kortnee] Modify own In reply to
When records are modified the script uses sub html_record_form, so that is where you need to add the codes so that the user can't modify their record. Not where the information is being displayed.

Since I don't know your field sizes, etc. I can only provide another example for you to follow for your fields. Change the size and maxlength to match your .cfg file.


<TR><TD><$font>Order:</font></TD><TD>|;
if (($per_admin) or (!$in{'modify'})) {
print qq| <INPUT TYPE="TEXT" NAME="Order" SIZE="12" VALUE="$rec{'Order'}" MAXLENGTH="15"> |;
}
else {
print qq|<input type="hidden" name="Order" value="$rec{'Order'}">$rec{'Order'}|;
}
print qq|</TD></TR>

<TR><TD><$font>Acres:</font></TD><TD>|;
if (($per_admin) or (!$in{'modify'})) {
print qq| <INPUT TYPE="TEXT" NAME="Acres" SIZE="12" VALUE="$rec{'Acres'}" MAXLENGTH="15"> |;
}
else {
print qq|<input type="hidden" name="Acres" value="$rec{'Acres'}">$rec{'Acres'}|;
}
print qq|</TD></TR>

<TR><TD><$font>Property:</font></TD><TD>|;
if (($per_admin) or (!$in{'modify'})) {
print qq| <INPUT TYPE="TEXT" NAME="Property" SIZE="12" VALUE="$rec{'Property'}" MAXLENGTH="15"> |;
}
else {
print qq|<input type="hidden" name="Property" value="$rec{'Property'}">$rec{'Property'}|;
}
print qq</TD></TR>

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/