Gossamer Forum
Home : Products : DBMan : Customization :

Catagory Listing/Last Mod by

Quote Reply
Catagory Listing/Last Mod by
Hello,

I am new to the forum and to DBman. I have been customizing the script to see if I can make it fit my needs. So far so good. There are two modifications that I have not been able to locate or figure out.

The first is the "Record Last Modified by". I can sometimes get the date but not the user name. I have two separate fields (UserID, DateMod) The date last mod sometimes appears and sometimes does not. The username never updates.

The second thing is that I would like on the 'Homepage' for there to be a list of all my statuses with the number of records within. And have that linked to display those records.

Last but not least, would any one know why my log file is recording that every event took place on 31-Dec-1969?

Thank you very much for any help that is given.

Ezra
Quote Reply
Re: Catagory Listing/Last Mod by In reply to
Welcome BetterThan,

I am not clear on the first two requests, go into a little more detail.

As for the bad date in your logs. As long as you are not using a modified get_date, try replacing your get_date sub with the one below. I too had the 31-Dec-1969 in my logs, I found that moving MY @months... to the top solved the problem for me.

############## G E T _ D A T E #############################
sub get_date {

my (@months) = qw!Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec!;
my ($sec, $min, $hour, $day, $mon, $year, $dweek, $dyear, $daylight) = localtime(time());
($day < 10) and ($day = "0$day");
$year = $year + 1900;

return "$day-$months[$mon]-$year";
}
###

If you are using a modified get_date, try moving your MY @months... line to the top. Also, make sure localtime(time()) looks the same as above.

It would be helpful to know if the above sub fixes your log problem.

Cheers!
------------------
Larry "NgtCrwlr" Mingus
www.makeitsimple.com

PS: I forgot to mention that the get_date subroutine is in db.cgi Smile

[This message has been edited by NgtCrwlr (edited November 13, 1999).]
Quote Reply
Re: Catagory Listing/Last Mod by In reply to
NgtCrwlr,

Thank you very much for that tip, it worked. I was using the following modified get_date. When I switched to the following that is when the log date freaked out. Converting to the original and moving the 'my @month..' did the trick.
###################################
my ($time1) = $_[0];
($time1) or ($time1 = time());

my ($sec, $min, $hour, $day, $mon, $year, $dweek, $dyear, $daylight) = localtime($time1);
my (@months) = qw!Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec!;
($day < 10) and ($day = "0$day");
$year = $year + 1900;

return "$day-$months[$mon]-$year";
}
#####################################

To clarify my two requests, here goes.

I would like to keep track of the 'user' and 'date' in which a record was modified and have it stored with the record. Fields-UserID and DateUID. This way when you view the record you will see who and when the record was last modified. I did find how to add the date but the username will not save with the record. For the date I used the suggestion in the following post:

http://www.gossamer-threads.com/scripts/forum/resources/Forum12/HTML/000856.html

Now how do I get the userid to be updated in the 'UserID' field in my dB?

The second request was to have a start page like the one in Links. A list of my Categories with the total number of records in each. Clicking on the Category will list out the records.

I hope this clarifies. And thank you...

Ezra
Quote Reply
Re: Catagory Listing/Last Mod by In reply to
Glad to hear the code fixed the log - date problem. I know the question has come up a lot. I am going to post a new topic that addresses the fix.

I will try to help with one more of your questions. To update the UserID field try adding a field to sub html_modify_form_record.

Hidden:
<input type=hidden name="UserID" value="$db_userid" size=15 maxlength=20>

If you have modified your html.pl to have a separate modify form, you can add a visible field to your ???_form sub.

ModifiedBy: <input type=text name="UserID" value="$db_userid" size=20 maxlength=35>

The above is assuming you have $auth_modify_own = 0 in your config file.

I am a little short on time, I am hoping that you can follow these brief examples. Let me know if this is to criptic.


------------------
Larry "NgtCrwlr" Mingus
www.makeitsimple.com
Quote Reply
Re: Catagory Listing/Last Mod by In reply to
I do have $auth_modify_own = 0 in the config file and I have tried <input type=hidden name="UserID" value="$db_userid" size=15 maxlength=20> I even tried making it not hidden. This is why this what seems to be a simple mod is frustrating me.

I know the other mod is more complicated.

Please keep me posted and thank you very much for your help.

Ezra
Quote Reply
Re: Catagory Listing/Last Mod by In reply to
Okay, I just tested this on one of our databases and it works. Maybe the quickest way to solve this, is for me to take a look at your .cfg and html.pl file. Save both files as .txt files to a public readable folder. Post the URL's to the files here, and I'll see if I can spot any problems.

------------------
Larry "NgtCrwlr" Mingus
www.makeitsimple.com
Quote Reply
Re: Catagory Listing/Last Mod by In reply to
Per a post by JPDeni, do the following to get the last modified by who:

If you have a field called LastModifiedBy -

In html.pl, sub html_modify_form_record, just after the line that starts with

if (!%rec) { &html_modify_failure(

add

$rec{'LastModifiedBy'} = $db_userid;

Quote Reply
Re: Catagory Listing/Last Mod by In reply to
Okay, I have tried the above...I must of screwed something up! Believe me I have tried every suggestion I could find in this forum...

Here is the link to the html and .cfg files:
http://www.liaisons.com/test

Thanks,

Ezra
Quote Reply
Re: Catagory Listing/Last Mod by In reply to
Hi Ezra,
I think that you don't have a field in your DB "LastModifiedBy" (At least I didn't see it in your html file).

Add that field to your db structure, to your forms (NgtCrwlr post), and the mod (BrianYork post).

[This message has been edited by Fred (edited November 15, 1999).]
Quote Reply
Re: Catagory Listing/Last Mod by In reply to
I have a field called 'UserID' instead of "LastModifyBy". I changed all the suggested mods to reflect that.

If I have to have that field name for some reason then I will change my settings.

But I didn't think that mattered.
Quote Reply
Re: Catagory Listing/Last Mod by In reply to
Ezra,

Is 'UserID' the $auth_user_field?

If yes, you need ANOTHER field which stores the ID of "LastModifyBy".
Quote Reply
Re: Catagory Listing/Last Mod by In reply to
I thought I had that feature turned off. Any user can modify any record. I now have a -1. Still no go...I think I will change that back to 1 and add another field.

I don't know.....
Quote Reply
Re: Catagory Listing/Last Mod by In reply to
Sounds as though you are still having problems. Frown

I tried to find your files, but get file not found at http://www.liaisons.com/test.

Copy html.pl and default.cfg to the above path, then rename them to html.txt and default.txt

Email me to get my attention and I'll take a look. Just send an I'm ready email, continue posting your qestions here.

------------------
Larry "NgtCrwlr" Mingus
www.makeitsimple.com

[This message has been edited by NgtCrwlr (edited November 16, 1999).]
Quote Reply
Re: Catagory Listing/Last Mod by In reply to
Yes I am still having trouble. But the "last mod by" username is not as important to me as my other question (though it is frustrating) If you have a solution PLEASE, let me know.

---List Categories Question-----
I tried the SSI Mod that was listed..no luck and I would like the Categories to appear on the DBman generated homepage with the total number of records in each.
--------------------------------
Links:
http://www.liaisons.com/test/default.txt
http://www.liaisons.com/test/html.txt

Thank you for your help.
Quote Reply
Re: Catagory Listing/Last Mod by In reply to
Do you have a lot of records entered already? The reason I ask is, I would suggest adding a new field (Modifyed_by), and then setup the UserID field to work the way it did when you originaly setup DBMan. That way you would have a record of who created the record plus a field of the last person that modified the record. To me keeping two separate fields would be easier.

I assume that you have a working database now, however, I would seriously consider changing the field names to either no spaces OR replace the spaces with underlines. I have read serveral threads where people ran into problems using spaces in field names. I am not sure about using single quotes around field names and select list names. I am guessing that you have the single quotes because of the spaces in the names, but you shouldn't need them in your db_select_field names. You also, wouldn't need them in the db_def if you remove or replace the spaces in the field names with underlines. Maybe the quotes are'nt a big deal?

Another item I noticed is in the db_def, your defaults for http:// are 'http:/', '^http:/'] You should add another slash to each, unless there is a reason not too.

Let's see where we are at before I go digging around in the html.pl file.





------------------
Larry "NgtCrwlr" Mingus
www.makeitsimple.com
Quote Reply
Re: Catagory Listing/Last Mod by In reply to
I have set up a test dB now in which I made the changes you suggested above. The only reason I did the spaces and the quotes is I didn't like the "sort by" drop-down list displaying the underlines or as one clumped word.

I added the new field and no go..I will post the files and the URL of the test dB later. When I look at the dB file, it is not even entered in thier.

Oh, well...I can do without this function for starters but I really need the listing function befor I can make this live within my company.