Gossamer Forum
Home : Products : DBMan SQL : Discussion :

DBman sql template questions

Quote Reply
DBman sql template questions
Hi,

I just finished the install of DBmansql. No problems at all. I do have a couple questions though about how to get it to do what id like. Ie - whether its possible..or whether I need to rethink it a bit to make it work.

I am using the program to maintain a database of members. There are 4 levels of members. Each member level has a different amount of information that they are allowed to put into the database. In addition I would like some members to be able to use their own custom template to display their information. So my questions:

1. Is it possible to set the add modify permissions so they only have access to certain fields in the table? Or do I need to set up each lvl of membership as a totally different table? If so, how will this affect my searching?

2. Is it possible for the program to load a specific display template for a given member? Or in order to provide that do I need to have each member in their own table with their own template set? and if so how will this affect my searching?

Thanks in advance.

Michael
Quote Reply
Re: [mycah] DBman sql template questions In reply to
In Reply To:
1. Is it possible to set the add modify permissions so they only have access to certain fields in the table? QuoteOr do I need to set up each lvl of membership as a totally different table? If so, how will this affect my searching?


Yes, it is possible to give users limited access to a field. What you need to do is customize your templates. For example, for the add form instead of using the

<%Dbsql::HTML::generate_add_form%>

Create your own add form template (I've attached an example). For example if you create an add form template titled record_add_form.html then you would replace <%Dbsql::HTML::generate_add_form%> with <%include record_add_form.html%>. Make sure to save the add form template with rest of the templates.

Now to limit access to fields simply add a conditional statement. For example, if you have the following field:

<TD vAlign=
top align=right width="135" bordercolor="#003063" bgcolor="#003063" bordercolorlight="#003063" bordercolordark="#003063" height="25"><b><FONT face=Tahoma,Arial,Helvetica

size=
2 color="#FF0000">* </FONT><FONT face=Tahoma,Arial,Helvetica

size=
2 color="#FFFFFF">Case Title:</FONT></b></TD>

To make it such that it only displays when there is a certain user change it to:

<%if user_group_field_name%>

<TD vAlign=top align=right width="135" bordercolor="#003063" bgcolor="#003063" bordercolorlight="#003063" bordercolordark="#003063" height="25"><b><FONT face=Tahoma,Arial,Helvetica

size=
2 color="#FF0000">* </FONT><FONT face=Tahoma,Arial,Helvetica

size=
2 color="#FFFFFF">Case Title:</FONT></b></TD>

<%endif%>

Now this field will only be displayed if the user belongs to that user group.

In Reply To:
2. Is it possible for the program to load a specific display template for a given member? Or in order to provide that do I need to have each member in their own table with their own template set? and if so how will this affect my searching?




Well to display a different add form simply add a conditional statement:

<%if user_type eq 'type1'%>

<%include record_add_form_type1.html%>

<%else%>

<%include record_add_form_type2.html%>

<%endif%>



I'm a novice when it comes to all this stuff, but I hope what little I know actually helps. Also, these are things that I've done, but I'm pretty sure there are other ways to do this. Wink
Reena

Last edited by:

Reena0330: Sep 13, 2002, 1:21 PM
Quote Reply
Re: [Reena0330] DBman sql template questions In reply to
Reena,

Thanks so much for your insights. Those ideas have set me on the right track. I will just have to think through very carefully my user groups and permission lvls.

Your answer to my second question answered something I should have asked but hadnt. It is something I can use for sure with another thing I wanted to do. However, what I was trying to ask was:

I want to display a given template for a users record when other people view their record on the web. Ie - Lets say I have 100 members and each member wants to make their record look unique or different. Is there some way I can use the IF statements to somehow selectively apply a template to a given record when it is selected by Joe Public?



Thanks again.

Mycah
Quote Reply
Re: [mycah] DBman sql template questions In reply to
Well once again you can add a conditional statement to the display form (search results page). So lets say in the add form you have a field titled "templatetype". And there are 2 types of templates: temp1, temp2 (this field should be required, or you can set a default value).

Well now that you have your 2 template types add a conditional statement to the display page ( search results page):

<%if templatetype eq 'temp2'%>

<%include temp2.html%>

<%else%>

<%include temp1.html%>



So basically you put these statements within the <%loop%> that way as the database goes through the loop to display each record it should check to see what type of template is specified and it will use that specific template to display the record. I haven't actually tried this out myself, but I'm assuming it will work. Try it out and let me know how it goes. Cool
Reena
Quote Reply
Re: [mycah] DBman sql template questions In reply to
hmm...after reading your question again..I'm not sure if I answered it correctly. Do you want each user to be able to specify the look of the entire database? Not just their individual record?
Reena
Quote Reply
Re: [Reena0330] DBman sql template questions In reply to
I think you answered it correctlyWink

I want a given user to be able to select a specific template for just THEIR record. So when a random public person goes an views their record it will be set in their own custom template.

Ie- I have 100 members. Each member is a retail store in a neighborhood. Each store wants their own custom look.

thanks Reena...surprised me with the fast answers..looks like I will be working this weekend afterallTongue



mycah