Gossamer Forum
Home : Products : DBMan : Customization :

regarding long and short display records.

Quote Reply
regarding long and short display records.
the script is kinda blur... I am not sure where to edit

can anyone help me?
Quote Reply
Re: regarding long and short display records. In reply to
What do you need help with?

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





Quote Reply
Re: regarding long and short display records. In reply to
anyway, I've tried the mod shown in http://www.gossamer-threads.com/scripts/resources/Detailed/35.html

But for my case, i have 3 types of viewing for registered, admin and default user.

so how do i goes abt not showing all the fields when different types of user view on the data?
Quote Reply
Re: regarding long and short display records. In reply to
I see. I need to get Alex to delete that. It's an old one and my other mod is much better.

But it wouldn't suit your purposes anyway, since the point of that mod is to show a partial listing of fields for a number of records and then to show the full record when the user clicks a link.

The best way to tell you how to get what you want is to use an example. Here's a short html_record subroutine:

Code:
<table>
<tr><td>Name:</td>
<td>$rec{'Name'}</td></tr>
<tr><td>Address:</td>
<td>$rec{'Address'}</td></tr>
<tr><td>City:</td>
<td>$rec{'City'}</td></tr>
</table>

Let's say you wanted default users to just be able to see the name, registered users to be able to see the name and the city and admins to see everything.

You would make the changes that are in bold:

Code:
<table>
<tr><td>Name:</td>
<td>$rec{'Name'}</td></tr>|;
if ($per_admin) {
print qq|

<tr><td>Address:</td>
<td>$rec{'Address'}</td></tr>|;
}
unless ($db_userid eq "default") {
print qq|

<tr><td>City:</td>
<td>$rec{'City'}</td></tr>|;
}
print qq|

</table>


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


[This message has been edited by JPDeni (edited June 29, 1999).]
Quote Reply
Re: regarding long and short display records. In reply to
now I am really blur...

Cause previously, wonder if u remember, I was asking abt having 3 type of search for different lvl of user. Default, registered and admin.

That part is ok b4 using the long short display.

I have a sub html_default_search_form { ,
sub html_registered_search_form { & sub html_record { .

how do I add into the long short display ?
Quote Reply
Re: regarding long and short display records. In reply to
Please go into detail about what you want to do. I am lost.


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





Quote Reply
Re: regarding long and short display records. In reply to
if u refer to http://www.gossamer-threads.com/scripts/forum/resources/Forum12/HTML/000418.html

*snip*
I'm not sure how many levels of searching you want to allow. You can have as many as you want. Do you want a default user to search on, for example 5 fields, a registered user to search on 10 and the admin to search on all?

I'm going to assume that is what you want.

The easiest way to do this is to copy sub html_record_form and paste it just below the current one. You'll now have two identical subroutines. Change the name of the second subroutine to
sub html_registered_search_form {

Now go through the subroutine and delete all the fields you do not want registered users to search on. (By doing it this way, you don't have to retype all of the field names and you are less likely to make a mistake.)

Once you get that done, copy sub html_registered_search_form and paste it below the current one. Rename this new subroutine html_default_search_form. Again, go through and delete fields, this time just deleting the ones you don't want default users to search on.

*snip*

I've done the mod and now, I want to use the long short display record..how do i goes abt?
Quote Reply
Re: regarding long and short display records. In reply to
anyway, I've use the html.pl from ur site which include the long short display record script in it.

to make it simple..I want to have the above mention 3 level of search , admin, registered and default.

Pls advice and really thks alot for ur help.
Quote Reply
Re: regarding long and short display records. In reply to
None of the links work on the page you gave me.

I thought you had worked out the different search routines for the different users and now we were working on which fields different users were going to be allowed to see.



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





Quote Reply
Re: regarding long and short display records. In reply to
the link doesnt work? hm.. ok, can u try again?

previous when I was using the friendly html.pl (without the short long display record script) the searching part is ok.

But now after using the short long display..I dun know how to mod it.



Quote Reply
Re: regarding long and short display records. In reply to
I need more than a couple of sentences from you. I do not understand what you want. If you want me to help you, I need for you to fully explain everything you want to do.

For example, you say you are using the short/long mod from my site. What do you want in the "short" display? Do you want different "short" displays for different types of users? Or do you only want different "long" displays for different users?

I understand that there might be a problem with language, but I can't help you if I don't know what you want.

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





Quote Reply
Re: regarding long and short display records. In reply to
I use the short/long mod from ur site that was in the friendly Html.pl

For the search part, registered user can search for Sex, age, height, weight, race, religion, education and also hobbies. at the short display, it will show Login ID, email, sex , age and Breif description.

For non registered user, they can only search for sex and race, but at the short display, the Email wont be shown to non registered user.

for more detail of what I want...maybe you can go to http://www.it-g.com/temp1.htm , and click on JANE.
Quote Reply
Re: regarding long and short display records. In reply to
miss out this one..

in the MEMBER DETAIL PROFILE PAGE, those words in RED are the data that the user have entererd.
Quote Reply
Re: regarding long and short display records. In reply to
The "jane" link works now. I see what you want to do with a long display. Sorta.

What I don't see is what you want to do with the different levels of users. Do you want all users to see the same thing on the "long" display? Do you want all users to see the same thing on the "short" display? If not, what fields do you want different people to see in which display?

I cannot tell you how to modify the script unless I know what you want me to do.


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





Quote Reply
Re: regarding long and short display records. In reply to
For the long display, Admin, registered user and non registered user will see what is like in http://www.it-g.com/temp2.htm. But in the future, Registered user can put up their Photos, and only Admin and REgistered user can see the Photo. As u can see from the temp2.htm, those words in Red are the extract of data from the database.

As for the short display, it will be the same as what is on http://www.it-g.com/temp1.htm, only that Admin and Registered user will be shown the EMAIL field.

Quote Reply
Re: regarding long and short display records. In reply to
Okay. So you want one display for the default user and a different display for admin/registered users in both the short and the long displays. Whew!

You are using the short/long mod I wrote, which is available on my site at http://www.jpdeni.com/dbman/short.txt
right? (Just making sure. Smile If you don't recognize the code below, go pick up the mod.)

In html_record, you will see:

Code:
# <-- Start of short display formatting -- >

print qq|
<a href="$long_url">$rec{'Title'}</a>
|;

# if you want to display your fields in columns, use the following format:
# print qq|
# $rec{'Field'}</td>
# <td>$rec{'Field'}</td>
# <td>$rec{'Field'}</td>
# <td>$rec{'Field'}|;

# Add or remove columns as needed. Be sure you add the $long_url link to one of your fields

# <-- End of short display formatting -- >

Since you want your information to be in columns on a table, you would use

Code:
print qq|<a href="$long_url">$rec{'LoginID'}</a></td>|;
unless ($db_userid eq "default") {
print qq|<td><a href="mailto:$rec{'Email'}">$rec{'Email'}</a>|;
}
print qq|
<td>$rec{'Sex'}</td>
<td>$rec{'Age'}</td>
<td>$rec{'BriefDescription'}|;

Remember that the first <td> tag and the last </td> tag are alread in the script, with dire warnings not to remove them. Don't remove them.

You'll need to set up your html_record_long display yourself.

Starting after the line

# <-- Start of record display -->

and ending before the line

# <-- End of record display -->

define your display just as you have it on your page, substituting $rec{'FieldName'}{/b] for the data in red.

The only difference will be that default users can't see the picture, right?

In the place where you will put the picture file, use

Code:
|;
unless ($db_userid eq "default") {
print qq|<img src="$rec{'Photo'}">|;
}
print qq|

Okay. Now you're also going to want to put labels on the table columns for your "short display, right?

In html_view_success you will see:

Code:
else {
print qq|<p><$font>Your search returned <b>$db_total_hits</b> matches.</font>|;
if ($db_next_hits) { print "<br><$font>Pages: $db_next_hits</font>"; }
$i = 1;
print "<table>";
for (0 .. $numhits - 1) {
print "<tr>";
&html_record (&array_to_hash($_, @hits));
print "</tr>";
++$i;
}
print "</table>";

Change this to

Code:
else {
print qq|<p><$font>Your search returned <b>$db_total_hits</b> matches.</font>|;
if ($db_next_hits) { print "<br><$font>Pages: $db_next_hits</font>"; }
$i = 1;
print "<table width=100%>
<tr><td>LoginID</td>";
unless ($db_userid eq "default") {
print "<td>Email</td>";
}
print "<td>Sex</td>
<td>Age</td>
<td>Brief Description</td></tr>|";
for (0 .. $numhits - 1) {
print "<tr>";
&html_record (&array_to_hash($_, @hits));
print "</tr>";
++$i;
}
print "</table>";

That should give you what you want.

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





Quote Reply
Re: regarding long and short display records. In reply to
Are you having trouble figuring out where to put the changes for the three levels of forms in the short/long display mod? The html_record_form subroutine is exactly the same in the mod as it is in the html.pl file in the DBMan distribution. If you got the forms to work correctly in the other file, just copy the html_record_form subroutine from the old file and paste it over the html_record_form subroutine in the new file.

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





Quote Reply
Re: regarding long and short display records. In reply to
Yes.

In sub html_footer, right at the beginning of the subroutine, add

unless ($db_userid eq "default") {

and then add another

{

at the end of the subroutine.

You're welcome. Smile


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





Quote Reply
Re: regarding long and short display records. In reply to
ok..everything is ok now. thks alot for ur time. Smile

Isit possible to show the sub html_search_options { to only registered user and admin only?

how do i goes abt
Quote Reply
Re: [eskimoz] regarding long and short display records. In reply to
Sorry to dig up such an old thread but it seems to be most relevant to what I'm trying to do.

I haven't implemented the long/short mod but perhaps it will be needed in order to meet my intentions. The spreadsheet display mod may also be useful but I'm not quite sure which to use.

I have a database which is being used in order to collect RSVP registrations for an upcoming event. Due to my limited knowledge of Perl, I've removed all the built-in navigation (in the footer) in favour of passing URL arguments from my website - for instance if a user wishes to modify their registration information, I have a JavaScript popup obtaining the user's username and password and then passing it along with other arguments to

db=default&userid=" + UserName + "&pw=" + Pw + "&login=1&modify_form=1&ID=*

I realize that the password will remain unencrypted as a result, but there is nothing TOO sensitive contained in the database.

As such, I don't think that I can have different subroutines to display the database information based on the user type unless they can somehow be called with an argument.

I would like to have it setup so that the default user/registered will only be shown specific fields (ideally in a spreadsheet format) whereas the admin will still have access to view/edit all of the fields.

For instance, I would like certain fields displayed (eg name, number of guests) and then pass a search argument along which will determine whether that individual will be participating in a specific event which they have selected from a drop-down menu (Yes,Maybe,No). In other words, this would show a list of all participants to any given event if the user clicks on a corresponding link. However, I'd also like it to display the status (Yes or Maybe) for that particular event. I suppose that I could do this by calling a search for event1=yes separately from a search for event1=maybe by SSI and then displaying a Yes or Maybe heading within the HTML file which calls the SSI.

Easy enough, but I would also like to generate a separate default user search display which lists the name, number of guests, and then their status for each event (Yes,No,Maybe) in order to get a list of all participants at a glance.

And of course, I'd like the admin to be able to see the full record (in non-spreadsheet format) so as to be able to edit admin-specific fields (such as Event1_paid) for each user.

If it helps to visualize, the user add/modify/delete functions are called from http://www.seadoovii.com/register.html and the searches will be called from http://www.seadoovii.com/participants.html

Many thanks for your suggestions.

Last edited by:

cedricn: Jul 16, 2005, 12:28 PM