[interchange-cvs] interchange - heins modified 13 files
interchange-core@icdevgroup.org
interchange-core@icdevgroup.org
Sat Oct 5 21:38:00 2002
User: heins
Date: 2002-10-06 01:37:43 GMT
Modified: . MANIFEST
Modified: dist/foundation/pages flypage.html
Modified: dist/foundation/products mv_metadata.asc variable.txt
Added: code/UserTag forum.tag
Added: dist/foundation/dbconf/default_db forum.dbm
Added: dist/foundation/dbconf/mysql forum.mysql
Added: dist/foundation/dbconf/pgsql forum.pgsql
Added: dist/foundation/include/forum reply_form submit_form
Added: dist/foundation/pages/forum display.html reply.html
Added: submit.html
Log:
* Add "forum" feature to foundation. Allows commenting on products and
also as a byproduct arbitrary blog-style forums.
This is a complete forum display:
[forum top=3DTHREAD_ID /]
You can get more complex than that. There is an illustration of the
templated version in the pages/forum/display.html page.
Disabled by default for DBM and Oracle. No database def is
supplied for Oracle.
With Postgres and MySQL, the forum is displayed in the flypage
automatically by default. The thread doesn't exist until the
first comment is made, at which time we create a top-level thread
named for the SKU.
An email notification goes out with new comments if that is
enabled.
There is some scoring logic for display, but no way to assign
scores yet (except by editing the database directly).
The reply and submit pages use include files from include/forum.
Arbitrary forums need to be enabled by setting the artid equal
to the code. If the artid is 0, as is the default on a random
submit, no display will be done. (The enabling is done automatically
for products by passing the product=3D1 parameter in the URL and
finding the product in the database.)
Revision Changes Path
2.67 +9 -0 interchange/MANIFEST
rev 2.67, prev_rev 2.66
Index: MANIFEST
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /var/cvs/interchange/MANIFEST,v
retrieving revision 2.66
retrieving revision 2.67
diff -u -r2.66 -r2.67
--- MANIFEST 5 Oct 2002 05:26:28 -0000 2.66
+++ MANIFEST 6 Oct 2002 01:37:42 -0000 2.67
@@ -187,6 +187,7 @@
code/UserTag/fedex_query.tag
code/UserTag/formel.tag
code/UserTag/fortune.tag
+code/UserTag/forum.tag
code/UserTag/get_url.tag
code/UserTag/history_scan.tag
code/UserTag/load_cart.tag
@@ -291,6 +292,7 @@
dist/foundation/dbconf/mysql/cat.mysql
dist/foundation/dbconf/mysql/component.dbm
dist/foundation/dbconf/mysql/country.mysql
+dist/foundation/dbconf/mysql/forum.mysql
dist/foundation/dbconf/mysql/gift_certs.mysql
dist/foundation/dbconf/mysql/inventory.mysql
dist/foundation/dbconf/mysql/locale.dbm
@@ -341,6 +343,7 @@
dist/foundation/dbconf/pgsql/cat.pgsql
dist/foundation/dbconf/pgsql/component.dbm
dist/foundation/dbconf/pgsql/country.pgsql
+dist/foundation/dbconf/pgsql/forum.pgsql
dist/foundation/dbconf/pgsql/gift_certs.pgsql
dist/foundation/dbconf/pgsql/inventory.pgsql
dist/foundation/dbconf/pgsql/locale.dbm
@@ -571,6 +574,8 @@
dist/foundation/include/checkout/shipping_address
dist/foundation/include/checkout/shopping_cart
dist/foundation/include/checkout/tax_popup
+dist/foundation/include/forum/reply_form
+dist/foundation/include/forum/submit_form
dist/foundation/pages/aboutus.html
dist/foundation/pages/account.html
dist/foundation/pages/admin/report_def/Order%20Status.html
@@ -587,6 +592,9 @@
dist/foundation/pages/customerservice.html
dist/foundation/pages/deliver.html
dist/foundation/pages/flypage.html
+dist/foundation/pages/forum/display.html
+dist/foundation/pages/forum/reply.html
+dist/foundation/pages/forum/submit.html
dist/foundation/pages/help.html
dist/foundation/pages/index.html
dist/foundation/pages/login.html
@@ -627,6 +635,7 @@
dist/foundation/products/country.txt
dist/foundation/products/downloadable.txt
dist/foundation/products/files.txt
+dist/foundation/products/forum.txt
dist/foundation/products/gift_certs.txt
dist/foundation/products/inventory.txt
dist/foundation/products/locale.txt
1.1 interchange/code/UserTag/forum.tag
rev 1.1, prev_rev 1.0
Index: forum.tag
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
UserTag forum-userlink PosNumber 0
UserTag forum-userlink addAttr=20
UserTag forum-userlink Routine <<EOR
sub {
my ($row) =3D @_;
return $row->{name} || 'Anonymous Coward'
if $row->{anon} or ! $row->{username};
my $realname =3D tag_data('userdb', 'handle', $row->{username})
|| tag_data('userdb', 'fname', $row->{username});
return $realname || $row->{username};
}
EOR
UserTag forum Order top
UserTag forum addAttr=20
UserTag forum hasEndTag=20
UserTag forum Routine <<EOR
my @uls;
my $lastlevel;
sub {
my ($id, $opt, $tpl) =3D @_;
if(! $id) {
$id =3D '0';
}
my $forum_header;
my $forum_footer;
my $forum_link;
my $forum_scrub;
$tpl ||=3D '';
$tpl =3D~ s{\[forum[-_]header\](.*)\[/forum[-_]header\]}{}is
and $forum_header =3D $1;
$tpl =3D~ s{\[forum[-_]footer\](.*)\[/forum[-_]footer\]}{}is
and $forum_footer =3D $1;
$tpl =3D~ s{\[forum[-_]link\](.*)\[/forum[-_]link\]}{}is
and $forum_link =3D $1;
$tpl =3D~ s{\[forum[-_]scrub\](.*)\[/forum[-_]scrub\]}{}is
and $forum_scrub =3D $1;
$forum_header ||=3D $opt->{header_template} || <<EOF;
<table>
<tr>
<td class=3Dcontentbar1>
<b>{SUBJECT}</b>
by <b>{USERINFO}</b>
on {DATE}
</td>
</tr>
<tr>
<td>
{COMMENT}
</td>
</tr>
{ADDITIONAL?}
<tr>
<td>
{ADDITIONAL}
</td>
</tr>
{/ADDITIONAL?}
<tr>
<td>
[=20
{TOP_URL?}<A HREF=3D"{TOP_URL}">Top</A> |{/TOP_URL?}
{PARENT_URL?}<A HREF=3D"{PARENT_URL}">Parent</A> |{/PARENT_URL?}
<A HREF=3D"{REPLY_URL}">Reply</A>
]=20
</td>
</tr>
</table>
<hr>
EOF
$forum_link ||=3D $opt->{link_template} || <<EOF;
<A HREF=3D"{DISPLAY_URL}">{SUBJECT}</a> by {USERINFO} on {DATE}
EOF
$opt->{threshold_message} ||=3D errmsg("Message below your threshold");
$forum_scrub ||=3D $opt->{scrub_template} || <<EOF;
<A HREF=3D"{DISPLAY_URL}">$opt->{threshold_message}</a>
EOF
$tpl ||=3D <<EOF;
<table cellspacing=3D0 cellpadding=3D2>
<tr>
<td class=3Dcontentbar1>
<A HREF=3D"{DISPLAY_URL}"><b>{SUBJECT}</b></A>
by <b>{USERINFO}</b>
on {DATE}
</td>
<td class=3Dcontentbar1 align=3Dright>
<small>[ <A HREF=3D"{REPLY_URL}"><b>Reply</b></A> ]</font></small>
</td>
</tr>
<tr>
<td colspan=3D2>
{COMMENT}
<!--
prior to UL: {MSG1}
prior to /UL: {MSG2}
prior to END: {MSG3}
-->
</td>
</tr>
</table>
EOF
$forum_footer ||=3D <<EOF;
<!-- end of forum -->
EOF
my $lastlevel =3D 0;
my @uls;
my $Tag =3D new Vend::Tags;
my $row =3D shift;
$opt->{reply_page} ||=3D 'forum/reply';
$opt->{submit_page} ||=3D 'forum/submit';
$opt->{display_page} ||=3D $Global::Variable->{MV_PAGE};
my $menu_row =3D sub {
shift;
my $row =3D shift;
$row->{reply_url} =3D $Tag->area({
href =3D> $opt->{reply_page},
arg =3D> $row->{code},
});
if($row->{code} ne $row->{artid}) {
$row->{top_url} =3D $Tag->area( {
href =3D> $opt->{display_page},
arg =3D> $row->{artid},
});
}
if($row->{parent}) {
$row->{parent_url} =3D $Tag->area( {
href =3D> $opt->{display_page},
arg =3D> $row->{parent},
});
}
$row->{display_url} =3D $Tag->area({
href =3D> $opt->{display_page},
arg =3D> $row->{code},
});
$row->{userinfo} =3D $Tag->forum_userlink($row);
$row->{date} =3D $Tag->convert_date({
fmt =3D> '%B %e, %Y @%H:%M',
body =3D> $row->{created},
});
my $lev =3D $row->{mv_level};
my $children =3D $row->{mv_children};
my $last =3D $row->{mv_last};
my $pre =3D '';
my $post =3D '';
my $num_uls =3D scalar(@uls);
$row->{msg1} =3D "lastlevel=3D$lastlevel lev=3D$lev children=3D$children=
uls=3D$num_uls";
if(! $lev) {
$pre .=3D join "", splice (@uls);
}
elsif ($lastlevel < $lev) {
$lastlevel =3D $lev;
}
elsif ($lastlevel > $lev) {
$lastlevel =3D $lev;
$pre .=3D join "", splice (@uls,$lev);
}
if($children) {
push @uls, '</ul>';
}
$num_uls =3D scalar(@uls);
$row->{msg2} =3D "lastlevel=3D$lastlevel lev=3D$lev children=3D$children=
uls=3D$num_uls";
if($children) {
$post .=3D '<ul>';
}
elsif($last) {
$post .=3D join "", splice (@uls, $lev);
}
$num_uls =3D scalar(@uls);
$row->{msg3} =3D "lastlevel=3D$lastlevel lev=3D$lev children=3D$children=
uls=3D$num_uls";
$row->{forum_prepend} =3D $pre;
$row->{forum_append} =3D $post;
return $row;
};
my $fdb =3D database_exists_ref('forum')
or die "No forum DB!";
my $record =3D $fdb->row_hash($id);
return undef unless $record;
$menu_row->(undef, $record);
my @out;
$opt->{full} =3D 1 if ! defined $opt->{full};
push @out, $Tag->uc_attr_list($record, $forum_header);
my %o =3D (
table =3D> 'forum',
start =3D> $id,
master =3D> 'parent',
subordinate =3D> 'code',
full =3D> $opt->{full},
sort =3D> 'code',
spacer =3D> " ",
autodetect =3D> 1,
iterator =3D> $menu_row,
spacing =3D> 4,
);
$Tag->tree(\%o);
my $rows =3D $o{object}{mv_results};
$opt->{scrub_score} ||=3D 0;
$opt->{show_score} ||=3D 1;
if(! defined $opt->{show_level}) {
if($record->{code} =3D=3D $record->{artid}) {
$opt->{show_level} =3D 0;
}
else {
$opt->{show_level} =3D 2;
}
}
for(\$tpl, \$forum_link, \$forum_scrub) {
$$_ =3D "{FORUM_PREPEND}$$_" unless $$_ =3D~ /\{FORUM_PREPEND\}/;
$$_ .=3D '{FORUM_APPEND}' unless $$_ =3D~ /\{FORUM_APPEND\}/;
}
for my $record (@$rows) {
my $this_tpl;
if($record->{score} <=3D $opt->{scrub_score}) {
$this_tpl =3D $forum_scrub;
}
elsif($record->{score} >=3D $opt->{show_score}) {
$this_tpl =3D $tpl;
}
elsif($record->{mv_level} <=3D $opt->{show_level}) {
$this_tpl =3D $tpl;
}
else {
$this_tpl =3D $forum_link;
}
push @out, $Tag->uc_attr_list($record, $this_tpl);
}
push @out, join "", @uls;
push @out, $Tag->uc_attr_list($opt, $forum_footer);
return join "\n", @out;
}
EOR
1.1 interchange/dist/foundation/dbconf/default_db/forum.dbm
rev 1.1, prev_rev 1.0
Index: forum.dbm
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Database forum forum.txt TAB
Database forum AUTO_NUMBER 100000
1.1 interchange/dist/foundation/dbconf/mysql/forum.mysql
rev 1.1, prev_rev 1.0
Index: forum.mysql
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Database forum forum.txt __SQLDSN__
ifdef SQLUSER
Database forum USER __SQLUSER__
endif
ifdef SQLPASS
Database forum PASS __SQLPASS__
endif
Database forum AUTO_NUMBER 100000
Database forum COLUMN_DEF "code=3Dvarchar(20) NOT NULL PRIMARY KEY"
Database forum COLUMN_DEF "parent=3Dvarchar(20)"
Database forum COLUMN_DEF "artid=3Dvarchar(20)"
Database forum COLUMN_DEF "mod_time=3Dtimestamp"
Database forum COLUMN_DEF "created=3Dvarchar(20)"
Database forum COLUMN_DEF "username=3Dvarchar(64)"
Database forum COLUMN_DEF "email=3Dvarchar(255)"
Database forum COLUMN_DEF "name=3Dvarchar(64)",
Database forum COLUMN_DEF "host=3Dvarchar(255)"
Database forum COLUMN_DEF "score=3Dint"
Database forum COLUMN_DEF "lastscore=3Dint"
Database forum COLUMN_DEF "reason=3Dvarchar(255)"
Database forum COLUMN_DEF "anon=3Dint"
Database forum COLUMN_DEF "extended=3Dtext"
Database forum COLUMN_DEF "subject=3Dcharacter varying(255)"
Database forum COLUMN_DEF "comment=3Dtext"
Database forum COLUMN_DEF "additional=3Dtext"
Database forum INDEX parent
Database forum INDEX artid
Database forum INDEX created
1.1 interchange/dist/foundation/dbconf/pgsql/forum.pgsql
rev 1.1, prev_rev 1.0
Index: forum.pgsql
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Database forum forum.txt __SQLDSN__
ifdef SQLUSER
Database forum USER __SQLUSER__
endif
ifdef SQLPASS
Database forum PASS __SQLPASS__
endif
Database forum AUTO_NUMBER 100000
Database forum COLUMN_DEF "code=3Dvarchar(20) NOT NULL PRIMARY KEY"
Database forum COLUMN_DEF "parent=3Dvarchar(20)"
Database forum COLUMN_DEF "artid=3Dvarchar(20)"
Database forum COLUMN_DEF "mod_time=3Dtimestamp"
Database forum COLUMN_DEF "created=3Dvarchar(20)"
Database forum COLUMN_DEF "username=3Dvarchar(64)"
Database forum COLUMN_DEF "email=3Dvarchar(255)"
Database forum COLUMN_DEF "name=3Dvarchar(64)",
Database forum COLUMN_DEF "host=3Dvarchar(255)"
Database forum COLUMN_DEF "score=3Dint"
Database forum COLUMN_DEF "lastscore=3Dint"
Database forum COLUMN_DEF "reason=3Dvarchar(255)"
Database forum COLUMN_DEF "anon=3Dint"
Database forum COLUMN_DEF "extended=3Dtext"
Database forum COLUMN_DEF "subject=3Dcharacter varying(255)"
Database forum COLUMN_DEF "comment=3Dtext"
Database forum COLUMN_DEF "additional=3Dtext"
Database forum INDEX parent
Database forum INDEX artid
Database forum INDEX created
1.1 interchange/dist/foundation/include/forum/reply_form
rev 1.1, prev_rev 1.0
Index: reply_form
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
[loop list=3D"[data session arg]"]
<form ACTION=3D"[area @@MV_PAGE@@]" METHOD=3D"GET">
<input type=3Dhidden name=3Dartid VALUE=3D"[loop-data forum artid]">
<input type=3Dhidden name=3Dparent VALUE=3D"[loop-code]">
<input type=3Dhidden name=3D"mv_arg" VALUE=3D"[loop-code]">
<table BORDER=3D"0" CELLSPACING=3D"0" CELLPADDING=3D"1">
<tr>
<td ALIGN=3D"RIGHT">
Subject:
</td>
<td>
<input TYPE=3D"text" NAME=3D"subject" VALUE=3D"[loop-calc]
my $subj =3D $CGI->{subject} || q{[loop-data forum subject]};
$subj =3D "Re: $subj" unless $subj =3D~ /^\s*re:/i;
return $Tag->filter('restrict_html', $subj);
[/loop-calc]"
SIZE=3D50 MAXLENGTH=3D50>
</td>
</tr>
<tr>
<td ALIGN=3D"RIGHT" VALIGN=3D"TOP">Comment</td>
<td><textarea WRAP=3D"VIRTUAL" NAME=3D"comment" ROWS=3D"10"
COLS=3D"60">[cgi
name=3Dcomment
filter=3D"
restrict_html.a.b.i.u.blockquote.li.ol.ul.em.br.tt.p.strong.div
textarea_put
"]</textarea>
<br>(Use the Preview Button! Check those URLs! Don't forget the http://!)
</td></tr>
<tr><td> </td><td>
[if session logged_in]
<input TYPE=3D"checkbox" NAME=3D"anon" [if cgi anon]CHECKED[/if]> Post Anon=
ymously
[/if]
<br>
<input type=3D"submit" name=3D"operation" VALUE=3D"[L]Submit[/L]">
<input type=3D"submit" name=3D"operation" VALUE=3D"[L]Preview[/L]">
<select NAME=3D"commtype">
<option VALUE=3D"2"[selected cgi=3D1 name=3Dcommtype value=3D2]>Plain Old T=
ext</option>
<option VALUE=3D"3"[selected cgi=3D1 name=3Dcommtype value=3D3]>HTML Format=
ted</option>
<option VALUE=3D"4"[selected cgi=3D1 name=3Dcommtype value=3D4]>Code</optio=
n>
</select>
</td></tr><tr>
<td VALIGN=3D"TOP" ALIGN=3D"RIGHT">Allowed HTML: </td><td><font SIZE=3D"1">
<B> <I> <P> <A> <LI> <OL> <UL> &l=
t;EM> <BR> <TT> <STRONG> <BLOCKQUOTE> <DIV>
</font>
</td></tr>
</table>
</form>
[/loop]
1.1 interchange/dist/foundation/include/forum/submit_form
rev 1.1, prev_rev 1.0
Index: submit_form
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
[if !session arg]
[calc]
$Session->{arg} =3D $Variable->{FORUM_DEFAULT_THREAD} || 'TOP';
return;
[/calc]
[/if]
[loop list=3D"[data session arg]"]
<form ACTION=3D"[area @@MV_PAGE@@]" METHOD=3D"GET">
<input TYPE=3D"HIDDEN" NAME=3D"artid" VALUE=3D"[loop-data forum artid]">
<input TYPE=3D"HIDDEN" NAME=3D"parent" VALUE=3D"[loop-code]">
<input TYPE=3D"HIDDEN" NAME=3D"mv_arg" VALUE=3D"[loop-code]">
<table BORDER=3D"0" CELLSPACING=3D"0" CELLPADDING=3D"1">
<tr><td WIDTH=3D"130" ALIGN=3D"RIGHT">Name: </td><td WIDTH=3D"500">
[page href=3Dforum_user arg=3D"[loop-data forum username]"][data table=3Dus=
erdb column=3Dnickname key=3D"[loop-data forum username]"][ [page logou=
t]Log Out</a> ]</td></tr>
<tr><td ALIGN=3D"RIGHT">Subject: </td>
<td><input TYPE=3D"text" NAME=3D"subject" VALUE=3D"[loop-calc]
my $subj =3D $CGI->{subject} || q{[loop-data forum subject]};
$subj =3D "Re: $subj" unless $subj =3D~ /^\s*re:/i;
return $Tag->filter('restrict_html', $subj);
[/loop-calc]" SIZE=3D50 MAXLENGTH=3D50></td>
</tr>
<tr>
<td ALIGN=3D"RIGHT" VALIGN=3D"TOP">Story:</td>
<td><textarea WRAP=3D"VIRTUAL" NAME=3D"comment" ROWS=3D"10"
COLS=3D"60">[cgi
name=3Dcomment
filter=3D"
restrict_html.a.b.i.u.blockquote.li.ol.ul.em.br.tt.p.strong.div
textarea_put
"]</textarea>
</td></tr>
<tr>
<td ALIGN=3D"RIGHT" VALIGN=3D"TOP">Additional (not required, shown on secon=
d page):</td>
<td><textarea WRAP=3D"VIRTUAL" NAME=3D"additional" ROWS=3D"10"
COLS=3D"60">[cgi
name=3Dadditional
filter=3D"
restrict_html.a.b.i.u.blockquote.li.ol.ul.em.br.tt.p.strong.div
textarea_put
"]</textarea>
<br>(Use the Preview Button! Check those URLs! Don't forget the http://!)
</td></tr>
<tr><td> </td><td>
[if session logged_in]
<input TYPE=3D"checkbox" NAME=3D"anon" [if cgi anon]CHECKED[/if]> Post Anon=
ymously
[/if]
<br>
<input TYPE=3D"SUBMIT" NAME=3D"operation" VALUE=3D"Submit">
<input TYPE=3D"SUBMIT" NAME=3D"operation" VALUE=3D"Preview">
<select NAME=3D"commtype">
<option VALUE=3D"2">Plain Old Text</option>
<option VALUE=3D"3"[selected name=3Dcommtype cgi=3D1 value=3D3]>HTML Format=
ted (no wiki)</option>
<option VALUE=3D"4"[selected name=3Dcommtype cgi=3D1 value=3D4]>Code</optio=
n>
</select>
</td></tr><tr>
<td VALIGN=3D"TOP" ALIGN=3D"RIGHT">Allowed HTML: </td><td><font SIZE=3D"1">
<B> <I> <P> <A> <LI> <OL> <UL> &l=
t;EM> <BR> <TT> <STRONG> <BLOCKQUOTE> <DIV>
</font>
</td></tr>
</table>
</form>
[/loop]
2.3 +15 -0 interchange/dist/foundation/pages/flypage.html
rev 2.3, prev_rev 2.2
Index: flypage.html
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /var/cvs/interchange/dist/foundation/pages/flypage.html,v
retrieving revision 2.2
retrieving revision 2.3
diff -u -r2.2 -r2.3
--- flypage.html 24 Mar 2002 12:50:50 -0000 2.2
+++ flypage.html 6 Oct 2002 01:37:42 -0000 2.3
@@ -154,6 +154,21 @@
=20
</td>
</tr>
+[if variable FORUM_PRODUCTS]
+ <tr>
+ <td>
+ [forum top=3D"[item-code]" display_page=3D"forum/display" /]
+ <p>
+ [page href=3D"forum/reply"
+ form=3D"
+ product=3D1
+ mv_arg=3D[item-code]
+ "
+ ]Comment on this product.</A>
+ </p>
+ </td>
+ </tr>
+[/if]
</table>
=20
</form>
1.1 interchange/dist/foundation/pages/forum/display.html
rev 1.1, prev_rev 1.0
Index: display.html
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
[comment]
ui_template: Yes
ui_template_name: leftonly
[/comment]
[tmp page_title]
Forum thread: [data table=3Dforum col=3Dsubject key=3D"[data session arg]"]
[/tmp]
[control reset=3D1]
[control-set]
[component]search_box_small[/component]
[/control-set]
[control-set]
[component]cart_tiny[/component]
[/control-set]
[control-set]
[component]category_vertical[/component]
[/control-set]
[control reset=3D1]
@_LEFTONLY_TOP_@=20
<!-- BEGIN CONTENT -->
<div style=3D"text-align: left; margin-top: 10px; margin-left: 15px">
[comment]
These options for the forum tag were initialized with something
very close to the default. Modify to suit.
[/comment]
[tmp forum-header]
<table cellspacing=3D0 cellpadding=3D5>
<tr>
<td class=3Dcontentbar1 style=3D"font-size: larger">
<b>{SUBJECT}</b>
by <b>{USERINFO}</b>
on {DATE}
</td>
</tr>
<tr>
<td>
{COMMENT}
</td>
</tr>
{ADDITIONAL?}
<tr>
<td>
{ADDITIONAL}
</td>
</tr>
{/ADDITIONAL?}
<tr>
<td>
[=20
{TOP_URL?}<A HREF=3D"{TOP_URL}">Top</A> |{/TOP_URL?}
{PARENT_URL?}<A HREF=3D"{PARENT_URL}">Parent</A> |{/PARENT_URL?}
<A HREF=3D"{REPLY_URL}">Reply</A>
]=20
</td>
</tr>
</table>
<hr>
[/tmp]
[tmp forum-link]
<A HREF=3D"{DISPLAY_URL}">{SUBJECT}</a> by {USERINFO} on {DATE}
[/tmp]
[tmp forum-scrub]
<A HREF=3D"{DISPLAY_URL}">One message below your threshold</a>
[/tmp]
[forum
top=3D"[data session arg]"
show-score=3D2
header-template=3D"[scratch forum-header]"
link-template=3D"[scratch forum-link]"
scrub-template=3D"[scratch forum-scrub]"
]<table cellspacing=3D0 cellpadding=3D2 width=3D"65%">
<tr>
<td class=3Dcontentbar1>
<A HREF=3D"{DISPLAY_URL}"><b>{SUBJECT}</b></A>
by <b>{USERINFO}</b>
on {DATE}
</td>
<td class=3Dcontentbar1 align=3Dright>
<small>[ <A HREF=3D"{REPLY_URL}"><b>Reply</b></A> ]</font></smal=
l>
</td>
</tr>
<tr>
<td colspan=3D2>
{COMMENT}
</td>
</tr>
</table>
[/forum]
</div>
<!-- END CONTENT -->
@_LEFTONLY_BOTTOM_@
1.1 interchange/dist/foundation/pages/forum/reply.html
rev 1.1, prev_rev 1.0
Index: reply.html
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
[comment]
ui_template: Yes
ui_template_name: leftonly
[/comment]
[tmp page_title]Reply to [data table=3Dforum col=3Dsubject key=3D"[data ses=
sion arg]"][/tmp]
[control reset=3D1]
[control-set]
[component]search_box_small[/component]
[/control-set]
[control-set]
[component]cart_tiny[/component]
[/control-set]
[control-set]
[component]category_vertical[/component]
[/control-set]
[control reset=3D1]
[comment]
Form shamelessly stolen from Slash, thanks guys.
[/comment]
@_LEFTONLY_TOP_@
[if cgi product]
[flag type=3Dwrite table=3Dforum]
[if type=3D!data term=3D"forum:code:[data session arg]"]
[perl tables=3D"forum products"]
my $db =3D $Db{forum};
my $code =3D $Session->{arg};
my $desc =3D tag_data('products', 'description', $code);
my $parent =3D 0;
if($CGI->{subsidiary}) {
$parent =3D $CGI->{subsidiary};
}
return unless $desc;
my $record =3D {
created =3D> $Tag->convert_date( { fmt =3D> '%Y%m%d%H%M' }),
artid =3D> $code,
subject =3D> "Comments on $desc",
username =3D> "interch",
name =3D> "Product Manager",
email =3D> $Variable->{FORUM_EMAIL_NOTIFY} || '',
score =3D> 1,
comment =3D> "",
parent =3D> $parent,
};
$db->set_slice($code, $record);
return;
[/perl]
[/if]
[/if]
<div align=3Dleft>
[if !cgi operation]
[loop list=3D"[data session arg]" prefix=3Ditem]
[if-item-data forum code]
<table>
<tr>
<td bgcolor=3D"#eeeeee">
<b>[item-data forum subject]</b>
<small>[if-item-data forum score](Score: [item-data forum score][if-it=
em-data forum reason], [item-data forum reason][/if-item-data])[/if-item-da=
ta]=20
by <b>[forum-userlink
username=3D"[item-data forum username]"
name=3D"[item-data forum name]"
anon=3D"[item-data forum anon]"
]</b> on [convert-date fmt=3D"%A, %B %e, %Y @%H:%M"][item-data forum crea=
ted][/convert-date]</small>
</li>
</td>
</tr>
<tr>
<td>
[item-data forum comment]
</td>
</tr>
[if-item-data forum additional]
<tr>
<td>
[item-data forum additional]
</td>
</tr>
[/if-item-data]
<tr>
<td>
<hr>
<B>You are replying to the above.</b>
</td>
</tr>
</table>
[/if-item-data]
[/loop]
[/if]
[if cgi operation eq '[L]Preview[/L]']
<table>
<tr>
<td class=3Dcontentbar1>
<B>[cgi name=3Dsubject filter=3Drestrict_html]<br>
by=20
[if !session logged_in]
[either]__FORUM_ANON_NAME__[or]Anonymous Coward[/either]
[else]
[if cgi anon]
[either]__FORUM_ANON_NAME__[or]Anonymous Coward[/either]
[else]
[either][value handle][or][value fname][or][data session username][/eith=
er]
[/else]
[/if]
[/else]
[/if]
on [convert-date fmt=3D"%A, %B %e, %Y @%H:%M"][/convert-date]</B>
</td>
</tr>
<td>
[if cgi commtype eq 2]
[cgi name=3Dcomment filter=3D"text2html" keep=3D1 enable_html=3D1]
[elsif cgi commtype eq 4]
<xmp>[cgi name=3Dcomment]</xmp>
[/elsif]
[else]
[cgi name=3Dcomment filter=3D"restrict_html.a.b.i.u.blockquote.li.ol.ul.e=
m.br.tt.p.strong.div" keep=3D1 enable_html=3D1]
[/else]
[/if]
</td>
</tr>
</table>
<P>
Above is a preview of what you just entered. Use <b>Submit</b> to actually
submit if you are satisfied.
</P>
[/if]
[if cgi operation eq '[L]Submit[/L]']
[flag type=3Dwrite table=3Dforum]
[perl tables=3D"forum"]
# code parent artid mod_time created username host score
# lastscore reason anon extended subject comment
my @allowed =3D qw/ a b i u blockquote li ol ul em br tt p strong div /;
my %v;
delete $Scratch->{tmp_code};
my $db =3D $Db{forum}
or return "Database error.";
$v{host} =3D $Session->{host};
$v{score} =3D 1;
my $noscrub;
if(! $CGI->{commtype}) {
# do nothing
}
elsif($CGI->{commtype} eq '2') {
$CGI->{comment} =3D $Tag->filter('text2html', $CGI->{comment});
}
elsif($CGI->{commtype} eq '4') {
unless ($CGI->{comment} =3D~ m{</\s*xmp\s*>}i) {
$noscrub =3D 1;
$CGI->{comment} =3D "<XMP>$CGI->{comment}</XMP>";
}
}
$v{comment} =3D $CGI->{comment};
my $filter =3D join ".", 'restrict_html', @allowed;
$v{comment} =3D $Tag->filter($filter,$v{comment})
unless $noscrub;
$v{username} =3D $Session->{username} || '';
$v{anon} =3D $CGI->{anon} ? 1 : 0;
$v{created} =3D
$v{mod_time} =3D $Tag->time( { body =3D> "%Y-%m-%d %H:%M:%S" });
#Debug("mod_time $v{mod_time}");
$v{subject} =3D $Tag->filter('encode_entities', $CGI->{subject}, 'subject=
');
$v{artid} =3D $CGI->{artid};
$v{parent} =3D $CGI->{parent};
$Scratch->{tmp_code} =3D $db->set_slice(undef, [ keys %v ], [values %v])
or return "Error submitting reply!";
$Scratch->{tmp_code} =3D~ s/'//g;
$Scratch->{tmp_parent} =3D $v{parent};
my $mrecord =3D $db->row_hash($v{artid});
## This is special processing only if main article ID record
## is found
if($mrecord and $mrecord->{email}) {
my $cc =3D $mrecord->{email};
my $url =3D $Tag->area(
{ href =3D> 'admin/flex_editor',
form =3D> "
mv_data_table=3Dforum
item_id=3D$Scratch->{tmp_code}
",
});
my $message =3D <<EOF;
Subject: $v{subject}
From: $v{name} <$v{email}>
Host: $v{host}
$v{comment}
Edit/delete:
$url
EOF
$Tag->email( {
subject =3D> "Posting from $v{artid} forum: $v{subject}",
to =3D> $cc,
body =3D> $message,
});
}
return;
[/perl]
[if scratch tmp_code]
[bounce href=3D"[area href=3Dforum/display arg=3D'[scratch tmp_parent]']"]
[/if]
[else]
[include include/forum/reply_form]
[/else]
[/if]
<P>
[if variable FORUM_DEFAULT_THREAD]
[page forum __FORUM_DEFAULT_THREAD__]__COMPANY__ forum[/page]
[/if]
</div>
@_LEFTONLY_BOTTOM_@
1.1 interchange/dist/foundation/pages/forum/submit.html
rev 1.1, prev_rev 1.0
Index: submit.html
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
[comment]
ui_template: Yes
ui_template_name: leftonly
[/comment]
[tmp page_title]Submit a forum story[/tmp]
[control reset=3D1]
[control-set]
[component]search_box_small[/component]
[/control-set]
[control-set]
[component]cart_tiny[/component]
[/control-set]
[control-set]
[component]category_vertical[/component]
[/control-set]
[control reset=3D1]
[comment]
Form shamelessly stolen from Slash, thanks guys.
[/comment]
@_LEFTONLY_TOP_@
[perl tables=3D"forum"]
#code parent artid mod_time created username host score lastscore reason an=
on extended subject comment
sub scrub {
my ($value, $type) =3D @_;
my @allowed =3D qw/ a b i u blockquote li ol ul em br tt p strong div /;
my %v;
my $db =3D $Db{forum}
or return "Database error.";
my $noscrub;
if(! $type) {
# do nothing
}
elsif($type eq '2') {
$value =3D $Tag->filter('text2html', $value);
}
elsif($type eq '4') {
unless ($value =3D~ m{</\s*xmp\s*>}i) {
$noscrub =3D 1;
$value =3D "<XMP>$value</XMP>";
}
}
my $filter =3D join ".", 'restrict_html', @allowed;
$value =3D $Tag->filter($filter,$value)
unless $noscrub;
return $value;
}
return;
[/perl]
[if cgi operation eq 'Preview']
<B>This is what would go on the front page:</b>
<P>
<table>
<tr>
<td bgcolor=3D"#eeeeee">
<B>[cgi name=3Dsubject filter=3Drestrict_html]<br>
by [either][value fname][or]Shrinking Violet[/either] on [convert-date fmt=
=3D"%A, %B %e, %Y @%H:%M"][/convert-date]<B>
</td>
</tr>
<tr>
<td>
[perl tables=3D"forum"]
return scrub($CGI->{comment}, $CGI->{commtype});
[/perl]
</td>
</tr>
[if cgi additional]
<tr>
<td>
<B>This is what goes on "Read More":</b>
<P>
[perl tables=3D"forum"]
return scrub($CGI->{additional}, $CGI->{commtype});
[/perl]
</td>
</tr>
[/if]
</table>
<blockquote><hr></blockquote>
Above is a preview of what you just entered. Use <b>Submit</b> to actually
submit if you are satisfied.
[/if]
</P>
[if cgi operation eq 'Submit']
[perl tables=3D"forum"]
#code parent artid mod_time created username host score lastscore reason an=
on extended subject comment
my %v;
delete $Scratch->{tmp_code};
my $db =3D $Db{forum}
or return "Database error.";
$v{host} =3D $Session->{host};
$v{score} =3D 0;
my $noscrub;
if(! $CGI->{commtype}) {
# do nothing
}
elsif($CGI->{commtype} eq '2') {
$CGI->{comment} =3D $Tag->filter('text2html', $CGI->{comment});
}
elsif($CGI->{commtype} eq '4') {
unless ($CGI->{comment} =3D~ m{</\s*xmp\s*>}i) {
$noscrub =3D 1;
$CGI->{comment} =3D "<XMP>$CGI->{comment}</XMP>";
}
}
$v{comment} =3D scrub($CGI->{comment}, $CGI->{commtype});
$v{additional} =3D scrub($CGI->{additional}, $CGI->{commtype});
$v{username} =3D $Session->{username} || '';
$v{anon} =3D $CGI->{anon} ? 1 : 0;
$v{mod_time} =3D
$v{created} =3D $Tag->time( { body =3D> "%Y-%m-%d %H:%M:%S" });
$v{subject} =3D $Tag->filter('encode_entities', $CGI->{subject}, 'subject=
');
$v{artid} =3D '0';
$v{parent} =3D '0';
$Scratch->{tmp_code} =3D $db->set_slice(undef, [ keys %v ], [values %v])
or return "Error submitting reply!";
$Scratch->{tmp_code} =3D~ s/'//g;
## This is special processing only if there is a submission email address
## is found
if($Variable->{FORUM_SUBMIT_EMAIL}) {
my $cc =3D $Variable->{FORUM_SUBMIT_EMAIL};
my $url =3D $Tag->area(
{ href =3D> 'admin/flex_editor',
form =3D> "
mv_data_table=3Dforum
item_id=3D$Scratch->{tmp_code}
",
});
my $message =3D <<EOF;
Subject: $v{subject}
From: $v{name} <$v{email}>
Host: $v{host}
Subject: $v{subject}
Content
--------
$v{comment}
EOF
$message .=3D <<EOF if $v{additional};
Additional
-----------
$v{additional}
EOF
$message .=3D <<EOF;
Edit/delete:
$url
EOF
$Tag->email( {
subject =3D> "Posting from $v{artid} forum: $v{subject}",
to =3D> $cc,
body =3D> $message,
});
}
return;
[/perl]
[if scratch tmp_code]
Your story has been submitted. You will receive a response when it
is handled. For questions, contact <A HREF=3D"mailto:webmaster@perusion.c=
om">webmaster@perusion.com</A>
<P>
[page index]Return to the Intranet home</A>
[/if]
[else]
[include include/forum/submit_form]
[/else]
[/if]
<P>
[if variable FORUM_DEFAULT_THREAD]
[page forum __FORUM_DEFAULT_THREAD__]__COMPANY__ forum[/page]
[/if]
@_LEFTONLY_BOTTOM_@
2.16 +3 -0 interchange/dist/foundation/products/mv_metadata.asc
rev 2.16, prev_rev 2.15
Index: mv_metadata.asc
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /var/cvs/interchange/dist/foundation/products/mv_metadata.asc,v
retrieving revision 2.15
retrieving revision 2.16
diff -u -r2.15 -r2.16
--- mv_metadata.asc 27 Sep 2002 07:16:46 -0000 2.15
+++ mv_metadata.asc 6 Oct 2002 01:37:43 -0000 2.16
@@ -260,6 +260,9 @@
variable::Variable::COD_ACCEPTED select 0=3DNo, 1=3DYes=09=09=09=09=
=09=09=09=09=09=09=09=09=09
variable::Variable::CREDIT_CARDS_ACCEPTED checkbox visa=3DVisa, mc=
=3DMastercard, discover=3DDiscover, amex=3DAmerican Express null_to_spa=
ce=09=09=09=09=09=09=09=09
variable::Variable::DOCROOT text Document root This is the directo=
ry where your HTML originates. It should match the DocumentRoot=0Dof your H=
TTP server. http://www.apache.org/docs/mod/core.html#documentroot=09=09=
=09=09=09=09=09
+variable::Variable::FORUM_EMAIL_NOTIFY text 50 Forum notify email A=
n email address to send copies of user comments on products.=09=09=09=09=09=
=09=09=09=09=09
+variable::Variable::FORUM_ANON_NAME text 20 Forum Anonymous Name Na=
me to use when a user posts anonymously to a forum=09=09=09=09=09=09=09=09=
=09=09
+variable::Variable::FORUM_PRODUCTS yesno Enable Product Forums Thi=
s enables user comments on products in the flypage. Only enabled by default=
if using MySQL or Postgres, as it will not work well on DBM and is not tes=
ted on Oracle.=09=09=09=09=09=09=09=09=09=09
variable::Variable::MULTIORDER select =3DNo,1=3DYes Whether users =
should by default have multipage order forms.=09=09=09=09=09=09=09=09=09=09
variable::Variable::MYSQL select 0=3DNo, 1=3DYes=09=09=09=09=09=09=
=09=09=09=09=09=09=09
variable::Variable::POSTAL_ACCEPTED select =3DNo,=0D1=3DYes Accept =
postal orders?=09=09=09=09=09=09=09=09=09=09=09
2.15 +3 -0 interchange/dist/foundation/products/variable.txt
rev 2.15, prev_rev 2.14
Index: variable.txt
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /var/cvs/interchange/dist/foundation/products/variable.txt,v
retrieving revision 2.14
retrieving revision 2.15
diff -u -r2.14 -r2.15
--- variable.txt 13 Sep 2002 12:37:00 -0000 2.14
+++ variable.txt 6 Oct 2002 01:37:43 -0000 2.15
@@ -30,6 +30,9 @@
EMAIL_SERVICE __MVC_EMAILSERVICE__ Company
ENCRYPTOR Encryption
FAX __MVC_FAX__ Company
+FORUM_ANON_NAME Anonymous Coward Forums
+FORUM_PRODUCTS __MVC_MYSQL____MVC_PGSQL__ Forums
+FORUM_EMAIL_NOTIFY __MVC_EMAILSERVICE__ Forums
IMAGE_DIR __MVC_IMAGEURL__ Directories and Paths
IMG_ADDCART __MVC_IMGADDCART__ Images
IMG_CHECKOUT __MVC_IMGCHECKOUT__ Images