|
|
|
02-03-1999, 01:26 PM
|
Postid: 15571
|
|
Visitor
Join Date: Dec 1998
Location: Decatur, GA 30032
Posts: 447
|
UBB mods [was "not enough??"]
Hey justin,
Like your changes... how did you add that status label in your UBB? That's cool! and where did you add the "each message is a table" mod?
I need to make some mods myself!
Jake
|
|
|
02-03-1999, 07:42 PM
|
Postid: 15572
|
|
Visitor
Join Date: Jan 1999
Location: Kissimmee, FL
Posts: 3,672
|
Is this the sequel to "not enough??"
I will assume the free version (that's what I've got), and I would also assume that the full version would differ slightly.
I don't know the line numbers, either, because I've done a lot of HTML tweaking as well (I still say that the writers of the UBB don't know HTML like they do Perl). But anyway, here goes:
First, the tables. Open up ubb_library2.pl in your favorite text editor. Scroll down until you find this:
Quote:
} # end if not stat line and not father line
} # end reply loop
} # end Count > 0 loop
|
Those are comments, but they're the only thing that makes this sub distinct. Scroll up a few lines to the next $ThisThread .= qq( statement. Between the ( and ) is the reply loop, meaning it gets repeated for each reply. Here's what mine looks like:
Quote:
if (int($Num/2) == ($Num/2)) {
$Acol = $Cell1;
} else {
$Acol = $Cell2;
}
$Num = ($Num + 1);
$ThisThread .= qq(
<table width=$TableWidth border=0 cellpadding=2 cellspacing=2>
<tr bgcolor=$Acol>
<TD width=18% valign=top><FONT SIZE=3 face="$FontFace" color=$TextHiLite>$thisline[2]</FONT>
<font size=1 face="$FontFace">$UserType</font></td>
<TD><IMG SRC="$NonCGIURL/posticon.gif" BORDER=0>
<FONT SIZE=1 face="$FontFace">posted $ThisDate $FormatTime $TimeZone
<A HREF="$CGIURL/ubbmisc.cgi?action=getbio&UserName=$UserNameCoded" target=_new>
<IMG SRC="$NonCGIURL/profile.gif" WIDTH=22 HEIGHT=11 BORDER=0 ALT="Click Here to See the Profile for $thisline[2]"></A>$EmailString </font>
<HR><font size=2 face="$FontFace">$ReplyText</FONT></td>
</tr>
</table> );
|
The little math evaluation is what decides which of the two alternating colors to make the background of each reply - for some reason, the table thing breaks the alternating colors, so I just did it myself. Mine is the only one I've seen with the table mod AND still having alternating BGCOLOR's.
$Cell1 and 2 are defined in Styles.file and are set to my alternating colors. There are other variables that I created too, so I hope they don't confuse you too much.
Basically, just insert <table width=95% border=0> at the beginning of that loop, and </table> at the end, and also go above this to the part that looks similar and clost that table at the end, and set it's <tr bgcolor= to $Cell2. That way the starting color is 2, the next reply is 1, etc.
Now, you'll also notice another variable in there: $UserType. This is defined a few lines above the reply sub by me, and that sets the user's status:
Quote:
@thisprofile = &OpenProfile("$thisline[2].cgi");
$EmailView = $thisprofile[11];
$UserType = $thisprofile[8];
|
That will set the variable to the user's status and show it in the table.
You also have to open up postings.cgi and find the same subs (similar) and do the same mods, so that a new topic gets these too, not just replies.
If you are confused at all (I am) just let me know and maybe I can explain certain parts more clearly (I probably left out some details, asuming you know at least a little Perl - then again, you probably don't have an Apache server installed either  )
I have to say that without Apache installed I would have never even attempted to modify the crap out of a script. The point is that I'm not sure if I remember each individual step:
Quote:
|
try this, save, reload, that didn't work, cut this and paste that, save, reload, ok, that's better, maybe if that was over there, no, not quite, um, shoot, I screwed it up, ok, where did I just paste that, somewhere, ok, there it is, now if only I knew where I put that darn sub, which file was it in, too many notepads open, ok, it was one of these, not sure...
|
That's the programmer in me showing. I'm not the type to document every move, even in my real programs (hell, I don't even have the source to my two older versions anymore!).
Let me know (and good luck)  Actually, if you want, I could just send you the files (the colors are defined by variables, the way it should have been!).
Justin
-- I think I just confused myself --
|
|
|
02-04-1999, 08:42 AM
|
Postid: 15573
|
|
Visitor
Join Date: Jan 1999
Location: Kissimmee, FL
Posts: 3,672
|
Here's a mod that I think we at FQ could benefit from greatly. Actually, there are two.
In ubb_library.pl, in this sub:
sub UBBCode {
put in this line:
$ThePost =~ s/( )/\ \;/isg;
That will allow spaces in excess of the normal one allowed in HTML. Now, as for a new UBB code tag, how about [code]?
$ThePost =~ s/(\[CODE\])(\S+?)(\[\/CODE\])/<font face=\"Courier\" size=3><blockquote>$2<\/blockquote><\/font>/isg;
This allows a fixed width font, for code samples (like the one above), and in combination with the hack, you could easily format code snippets.
You could skip the blockquotes, but it makes for a nice display. I would use the <code> html tag, but the font size gets too small, plus it looks different in different browsersaurs. Of course, you could add HR's, but I prefer to leave that to quote's.
One note: the hack MUST go first in the UBBCode sub so as not to put 's in the HTML that it adds later. Remember, it converts every space to an nbsp. Makes for some nasty looking code, but the end result in nice.
I did this to mine locally and will be uploading it shortly. I also added a [red] tag, to hilight text in addition to the bold tag.
I really think that the code tag would be awesome (they are considering it in the next version - a one minute job to add!)
Justin
|
|
|
02-04-1999, 08:44 AM
|
Postid: 15574
|
|
Visitor
Join Date: Jan 1999
Location: Kissimmee, FL
Posts: 3,672
|
hehe  Everywhere in the above post where there is an extra space is an nbsp with an ampersand in front and a semicolon afterwords
Oops!
|
|
|
02-04-1999, 09:58 AM
|
Postid: 15575
|
|
Visitor
Join Date: Jan 1999
Location: Kissimmee, FL
Posts: 3,672
|
Ok, this is much easier shown than explained. If you'd like to see the code tags and the space hack in action, go to:
http://www.vdj.net/ubb/Forum1/HTML/000003.html
Feel free to post in there, too  I really don't care too much. It's not really all that official. I'd like any opinions on the mods, and it's easier to give an opinion if you've used it.
I will be leasing the full version when I can afford to, and I will probably modify it beyond recognition
Justin
|
|
|
02-04-1999, 01:19 PM
|
Postid: 15577
|
|
Visitor
Join Date: Jan 1999
Location: Kissimmee, FL
Posts: 3,672
|
Thanks  Don't use the above code, as it didn't quite come out right. I'm trying to get it to automagically show raw HTML like & nbsp ; without the spaces. It is supposed to convert these when it stores them, and it does, but when formatting the actual HTML page, it puts it back - resulting in a non breaking space being shown. I want it to show everything literally, as typed, like the spaces, but with code.
Especially useful for the HTML sections of this UBB. How do you show someone how to properly display a < and > if they come out < and >?  (they aren't supposed to look the same above).
Basically, I want to idiot-proof the thing, so that what you type in comes out exactly (except, of course, for the UBB tags).
Thanks for the compliments  I'm having a blast learning Perl.
Justin
-- Now, if only I can get some people to visit the thing --
|
|
|
02-04-1999, 03:35 PM
|
Postid: 15578
|
|
Visitor
Join Date: Nov 1998
Location: San Bernardino, CA, USA
Posts: 367
|
Okay, here's an idea. Instead of just having a [red] tag, how bout a [color=whatever] tag? I haven't tweaked on it at all yet, but it prolly should be similar to below (but I'm the first to admin my regexp's need some serious work. For the life of me I can't remember how well Perl handles nested parens to save stuff, and I'm at school without my Perl/O'Reilly library *sniffle*);
$ThePost =~ s/(\[COLOR=(\S+?)\])(\S+?)(\[\/COLOR\])/<font color=\"$2\">$3<\/font>/isg;
Or, it's quite possible noone likes that idea but me, so I'm gonna shut up now
<edit>
Oh yeah,
Justin, in the previous thread of 'not enough' you commented on Nutscape having a 'no self.status'. If I understand that correctly, you mean the status bar at the bottom displaying a message? (like onMouseOver="self.status='blah'; return true'"). The one that works for nutscape is
onMouseOver="window.status='blah'; return true'". However, please don't forget the
onMouseOut="window.status=''; return true;"
cause I really hate it when my status bar sticks on the last message I mouseovered 
</edit>
------------------
Del
www.downinit.com
da da da
[This message has been edited by Del (edited 02-04-99).]
|
|
|
02-04-1999, 11:21 PM
|
Postid: 15579
|
|
Visitor
Join Date: Jan 1999
Location: Kissimmee, FL
Posts: 3,672
|
I hate that too - I've always used the mouseout thing. I just tried the window.status, and it works in IE also. Why didn't I know that before?
I still don't know what "return true" is for - never noticed a difference at all, so I just leave it out.
About the [color=xxxxxx], I like that idea. Your code should work for that, or something similar. I might do that instead of red - I just figured that people might get too carried away. Then again, some UBB's allow HTML - big mistake IMO.
If I keep this up, I'm going to have to rewrite the faq for mine  I also did a copyright thing, where typing (c) becomes ©.
Justin
--©1999 SFE Inc. All Rights Reserved (reserved for who?)--
|
|
|
02-05-1999, 12:43 AM
|
Postid: 15576
|
|
FutureQuest, Inc.
Join Date: Jun 1998
Location: Franktown Colorado
Posts: 6,781
|
This is GREAT!!!
I know we'll be adding some of this to the v.2.5 as soon as they release it! Terra will like it for the A/B/G Forum w/o a doubt
(hate to add it now knowing will be upgrading soon)
Good job!!!
Deb
|
|
|
02-05-1999, 11:50 PM
|
Postid: 15580
|
|
Visitor
Join Date: Jan 1999
Location: Kissimmee, FL
Posts: 3,672
|
Well, I decided to add a search engine to the UBB and I ran into an infinate loop or two. Luckily it was only on my own computer  I am just glad that I did all of my experimenting locally.
The search thing works well so far, now that I figured out what was locking it up. It did this while writing an index of what it found - I wound up with an 8 meg index (of a few k site) after 20 seconds...
Just wondering if there is protection on FQ's server against this type of problem - in the unlikely event that someone cause an infinate loop like that. I remember seeing something about runaway scripts being killed or something - don't remember where though.
It didn't actually crash the computer though, just Apache - where in Visual Basic, certain API's, if not called carefully, can cause blue screen errors of death
I'm just curious (as always).
Justin
--may all your packets have optimal checksums-- <-- I stole that from somewhere...
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 visitors)
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 05:10 PM.
|
| |
|
|
|