Gossamer Forum
Home : Products : DBMan : Installation :

as an admin I would like to add more than 1 dataset

Quote Reply
as an admin I would like to add more than 1 dataset
dbman is running ;-))))

but as THE ONE AND ONLY admin, I would like to add MORE then 1 dataset to my database.

I allow all users to have only on set per registrated user to add(modify/delete) but

I need to add some informations (e.g. as a preview for further adds) into the database.

but I cant???

I tried to change the "$print footer" within the admin section. now I can modify/delete all other informations, but canīt add more than 1 dataset.

to me itīs not a good idear to signup as a new user all the times that I need to add new information and Iīm sure that this great database can solve this problem somehow.

but....... how????

Iīve never learned perl or any other programming language and so Iīm really proud that I managed (with a little help of alex and JPD {really donīt wanted to argue with you ;-)}
to configure it a little bit to make it fit to my needs

wanna say: talk to me very slow like to a little child!!!

where do I have to change what???

and:
can I add (and how) another date-field that gives an information about:
"last updated""

thanks for your help, Iīm sure Iīll be back soon!!!

------------------
zappa
zappa@skydiver.de
skydiver.de


[This message has been edited by zappa (edited February 14, 1999).]
Quote Reply
Re: as an admin I would like to add more than 1 dataset In reply to
Hey, zappa! Smile

You could add a field in your html_record_form for admin only (if you need help doing that, let me know) to hold the user id. Then, in db.cgi, in the add_record subroutine, find

Code:
if ($auth_user_field >= 0) {
$in{$db_cols[$auth_user_field]} = $db_userid;
}

and add lines to make it

Code:
unless ($per_admin) {
if ($auth_user_field >= 0) {
$in{$db_cols[$auth_user_field]} = $db_userid;
}
}

This way you can fill in a unique userid for the records you want to add. The only problem you might run into is if a new user decides to use that same userid. Make it unique!

Quote:
can I add (and how) another date-field that gives an information about:
"last updated"

Adding the field to the .cfg file isn't too much of a problem. The problem comes when you already have records in your database.

You'll want to make the "last updated" field the last one in your database. Then download your database to your home computer and load it into a text editor. (I like Programmer's File Editor, a free program you can get from download.com)

If you only have a few records in your database, you can pretty easily go to the end of each record and paste a | and a date there. (Since you won't know when the record was actually added, all of the current ones might as well have the same date -- 1-Jan-1999 is not a bad choice.)

If you have a lot of records, you will probably want to do a search and replace. If you use PFE (mentioned above) or some other text editor, you can search for \n and replace it with |1-Jan-1999\n[\b].

One little tip. In case a user came in while you were doing your editing, check for new users before you upload the edited .db file.

Also, if you want to change the date when a record is modified, you'll need to go into the html_modify_record_form subroutine. After
the line that starts with

if (!%rec) { &html_modify_failure

add

$rec{'Date'} = &get_date;

replacing, of course, "Date" with your own field name.


------------------
JPD
Quote Reply
Re: as an admin I would like to add more than 1 dataset In reply to
hi jpd,

adding the data fields (last updated) did`t mean any problem to me, but ........

first of all I dont know how to add a

"admin only-field" in the html-section. maybe I couldnīt get the sense, maybe I would have managed it after having prepared the db.cgi, but (as you know Iīm missing my glasses) I couldīt find the words you were talking about in there!!!

the only thing I found was:
--------------------------------------------
# If we have userid's and this is not an admin, then we force the record to keep it's own
# userid.
if ($auth_user_field >= 0 and (!$per_admin or !$in{$db_cols[$auth_user_field]})) {
$in{$db_cols[$auth_user_field]} = $data[$auth_user_field];
}
$output .= &join_encode(%in);
$found = 1;

-------------------------------------------

is this the right place????

how do I have to add the expression then??

thanx
zappa



[This message has been edited by zappa (edited February 17, 1999).]
Quote Reply
Re: as an admin I would like to add more than 1 dataset In reply to
Oops! I gotta stop looking at my old version of DBMan.

You don't have to change anything in db.cgi since the version you're doing already has what you need.

As for an admin-only field:

If you're using auto_generate, just set the field length of the userid field to -2.

If you're not using auto_generate, enter the following into html_record_form (assuming that each line of input is a row in a table):

Code:
|;
if ($per_admin) {
print qq|<TR><TD>UserID:</TD>
<TD> <INPUT TYPE="text" NAME="UserID" VALUE=$rec{'UserID'}</TD></TR>|;
}
print qq|

Replace UserID above with whatever you have named the field that holds the user name.

------------------
JPD
Quote Reply
Re: as an admin I would like to add more than 1 dataset In reply to
thanx a lot!!!

I didnīt expect your help that fast!!!!

gonna check it out and keep yoou informed.

but first of all:
I have to go to sleep now!!!!

itīsshort after midnite noe in bad olīgermany

by and agai:
many thanx.

havenīt seen such a great support-forum before
(there is only one that works as well:
ask anything about skydiving at skydiver.de
and your question will be answered as soon as possible as well!!! ;-))

good night
Quote Reply
Re: as an admin I would like to add more than 1 dataset In reply to
whouuu.
i couldnīt go to sleep before testing your hint!!!

working fine now, but,
for other users who want to cut and paste
the code as I did:

there is a > missing in that code!!!
<TD> <INPUT TYPE="text" NAME="UserID" VALUE=$rec{'UserID'}</TD></TR>|;

you forgot to close the tag
<input type.........{'UserID'}></TD></TR>|;

and I also added
VALUE="$rec{'UserID'}"

though I donīt know if this is really necessary.

thanx a lot,
wait for my next question
(the users want me to add something sometimes!!)

thanx for that absolutely great support
zappa


[This message has been edited by zappa (edited February 17, 1999).]