Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added new component 'news' to eg directory
This component enables the shop owner to easily add news items to the foundation catalog. A couple of sample news items are also provided to illustrate some features. A simple: cp -r news_feature/* catalogs/the_catalog followed by a restart of the server, will install this new feature. I welcome any comments for improvement.
- Loading branch information
Ton Verhagen
committed
Aug 4, 2001
1 parent
a400912
commit 4b96777
Showing
7 changed files
with
314 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Database news news.txt TAB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Database news news.txt __SQLDSN__ | ||
ifdef SQLUSER | ||
Database news USER __SQLUSER__ | ||
endif | ||
ifdef SQLPASS | ||
Database news PASS __SQLPASS__ | ||
endif | ||
Database news DEFAULT_TYPE text | ||
Database news AUTO_NUMBER 00001 | ||
|
||
Database news COLUMN_DEF "code=char(64) NOT NULL PRIMARY KEY" | ||
Database news COLUMN_DEF "featured=CHAR(32) NOT NULL DEFAULT '', index(featured)" | ||
Database news COLUMN_DEF "start_date=CHAR(24) NOT NULL DEFAULT '', index(start_date)" | ||
Database news COLUMN_DEF "finish_date=CHAR(24) NOT NULL DEFAULT '', index(finish_date)" | ||
Database news COLUMN_DEF "posted_on=CHAR(24) NOT NULL DEFAULT '', index(posted_on)" | ||
Database news COLUMN_DEF "posted_by=CHAR(64) NOT NULL DEFAULT '', index(posted_by)" | ||
Database news COLUMN_DEF "posted_email=CHAR(64)" | ||
Database news COLUMN_DEF "timed_news=CHAR(8)" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
Database news news.txt __SQLDSN__ | ||
Database news UPPERCASE 1 | ||
ifdef SQLUSER | ||
Database news USER __SQLUSER__ | ||
endif | ||
ifdef SQLPASS | ||
Database news PASS __SQLPASS__ | ||
endif | ||
Database news DEFAULT_TYPE VARCHAR2(2000) | ||
Database news COLUMN_DEF "code=VARCHAR2(64) PRIMARY KEY" | ||
Database news COLUMN_DEF "featured=VARCHAR2(32) DEFAULT ''" | ||
Database news POSTCREATE "CREATE INDEX news_featured ON news (featured)" | ||
Database news COLUMN_DEF "start_date=VARCHAR2(24) DEFAULT ''" | ||
Database news POSTCREATE "CREATE INDEX news_start_date ON news (start_date)" | ||
Database news COLUMN_DEF "finish_date=VARCHAR2(24) DEFAULT ''" | ||
Database news POSTCREATE "CREATE INDEX news_finish_date ON news (finish_date)" | ||
Database news COLUMN_DEF "posted_on=VARCHAR2(24) DEFAULT ''" | ||
Database news POSTCREATE "CREATE INDEX news_posted_on ON news (posted_on)" | ||
Database news COLUMN_DEF "posted_by=VARCHAR2(64) DEFAULT ''" | ||
Database news POSTCREATE "CREATE INDEX news_posted_by ON news (posted_by)" | ||
Database news COLUMN_DEF "posted_email=VARCHAR2(64)" | ||
Database news COLUMN_DEF "timed_news=VARCHAR2(8)" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
Database news news.txt __SQLDSN__ | ||
ifdef SQLUSER | ||
Database news USER __SQLUSER__ | ||
endif | ||
ifdef SQLPASS | ||
Database news PASS __SQLPASS__ | ||
endif | ||
Database news DEFAULT_TYPE text | ||
Database news COLUMN_DEF "code=varchar(64) NOT NULL PRIMARY KEY" | ||
Database news COLUMN_DEF "featured=varchar(32) DEFAULT '' NOT NULL" | ||
Database news COLUMN_DEF "start_date=varchar(24) DEFAULT '' NOT NULL" | ||
Database news COLUMN_DEF "finish_date=varchar(24) DEFAULT '' NOT NULL" | ||
Database news COLUMN_DEF "posted_on=varchar(24) DEFAULT '' NOT NULL" | ||
Database news COLUMN_DEF "posted_by=varchar(64) DEFAULT '' NOT NULL" | ||
Database news COLUMN_DEF "posted_email=varchar(64)" | ||
Database news COLUMN_DEF "timed_news=varchar(8)" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
[comment] | ||
ui_template: yes | ||
ui_template_name: leftright | ||
[/comment] | ||
|
||
[tmp page_title]__COMPANY__ -- News[/tmp] | ||
[tmp members_only][/tmp] | ||
|
||
[control reset=1] | ||
|
||
[control-set] | ||
[component]search_box_small[/component] | ||
[matches]10[/matches] | ||
[/control-set] | ||
|
||
|
||
[control-set] | ||
[component]category_vertical[/component] | ||
[set_selector]left[/set_selector] | ||
[page_class]all[/page_class] | ||
[timed]0[/timed] | ||
[/control-set] | ||
|
||
|
||
[control-set] | ||
[component]cart_tiny[/component] | ||
[/control-set] | ||
|
||
|
||
[control-set] | ||
[component]none[/component] | ||
[/control-set] | ||
|
||
|
||
[control-set] | ||
[component]cross[/component] | ||
[banner]Specials[/banner] | ||
[cross_codes][/cross_codes] | ||
[size]2[/size] | ||
[cols]2[/cols] | ||
[random][/random] | ||
[/control-set] | ||
|
||
|
||
[control-set] | ||
[component]news[/component] | ||
[cols]1[/cols] | ||
[news_type]general[/news_type] | ||
[banner]News...[/banner] | ||
[matches]3[/matches] | ||
[timed]60[/timed] | ||
[/control-set] | ||
|
||
[control reset=1] | ||
|
||
@_LEFTRIGHT_TOP_@ | ||
|
||
<!-- BEGIN CONTENT --> | ||
<div align=left> | ||
<table width="70%" border="0"> | ||
<tr> | ||
<td> | ||
<h2>__COMPANY__ News</h2> | ||
|
||
[loop prefix=news more=1 search=| | ||
fi=news | ||
st=db | ||
tf=posted_on | ||
to=r | ||
ml=10 | ||
|
||
[if session arg] | ||
sf=code | ||
op=eq | ||
se=[data session arg] | ||
[else] | ||
ra=yes | ||
[/else] | ||
[/if] | ||
|
||
rf=* | ||
|] | ||
|
||
[list]<div> | ||
<b>[news-param title]</b><br> | ||
<small>Posted on [convert-date][news-param posted_on][/convert-date] by [if-news-param posted_email]<a href="mailto:[news-param posted_email]">[news-param posted_by]</a>[else][news-param posted_by][/else][/if-news-param]</small><br> | ||
<br> | ||
[if session arg] | ||
[or value mv_search_match_count == 1] | ||
[news-param body] | ||
[else] | ||
[filter 200][news-param body][/filter]<br> | ||
<a href="[area href="news" arg="[news-param code]"]">Read more...</a> | ||
[/else] | ||
[/if] | ||
</div><br><br> | ||
[/list] | ||
[more-list] | ||
[more] | ||
[/more-list] | ||
[/loop] | ||
|
||
|
||
</td> | ||
</tr> | ||
</table> | ||
</div> | ||
<br><br><br> | ||
<!-- END CONTENT --> | ||
|
||
@_LEFTRIGHT_BOTTOM_@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
[comment] | ||
ui_component: news | ||
ui_component_type: content, vertical | ||
ui_component_group: news | ||
ui_component_label: News | ||
|
||
news_type: | ||
label: Promotion type | ||
options: general=General, company=Company, products=Products | ||
widget: select | ||
|
||
matches: | ||
label: Number to show | ||
widget: select | ||
options: 1,2,3*,4,5,6,7,8,9,10 | ||
|
||
cols: | ||
label: Columns | ||
options: 1,2,3*,4 | ||
widget: select | ||
|
||
banner: | ||
label: Banner for top box | ||
default: News | ||
widget: text | ||
width: 40 | ||
|
||
timed: | ||
label: Use timed build | ||
widget: select | ||
help: Makes more efficient for large/busy catalogs | ||
options: 0=No, 5=5 minutes, 10=10 minutes, 20=20 minutes, 60=60 minutes, 1440=Daily | ||
advanced: 1 | ||
[/comment] | ||
|
||
<!-- BEGIN COMPONENT [control component news] --> | ||
[timed-build if="[control timed 60]" minutes="[control timed 60]"] | ||
<table width="95%" align=center> | ||
<tr class="categorybar"> | ||
<td class="categorybar" align="left"><b>[control banner News]</b></td> | ||
</tr> | ||
<tr> | ||
<td> | ||
[query arrayref=main | ||
sql=" | ||
SELECT code,timed_news,start_date,finish_date | ||
FROM news | ||
WHERE featured = '[control news_type general]' | ||
ORDER BY posted_on DESC | ||
"][/query] | ||
[perl tables="news"] | ||
my @out; | ||
my $ref; | ||
my $db; | ||
my $count = 0; | ||
delete $Scratch->{news_codes}; | ||
my $date = $Tag->time( { body => '%Y%m%d' } ); | ||
$ref = $Tmp->{main} or return; | ||
my $matches = $Tag->control("matches",3); | ||
for(@$ref) { | ||
last if $count++ == $matches; | ||
my $line = $_; | ||
push(@out, $line->[0]), next if ! $line->[1]; | ||
next if $line->[2] gt $date; | ||
next if $line->[3] lt $date; | ||
push @out, $line->[0]; | ||
} | ||
$Scratch->{news_codes} = join(' ', @out); | ||
return; | ||
[/perl] | ||
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center"> | ||
[table-organize embed=1 pretty=1 cols="[control cols 2]"] | ||
[loop | ||
random="[control matches 3]" | ||
list="[scratch news_codes]" | ||
] | ||
<TD> | ||
<table border="0" cellspacing="0" cellpadding="0" width="100%"> | ||
<tr> | ||
<td align="center" class="contentbar1"> | ||
<b> | ||
[if-loop-data news blurb_begin] | ||
[loop-data news blurb_begin] | ||
[else] | ||
[loop-data news title] | ||
[/else] | ||
[/if-loop-data]</b> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td align="left"> | ||
<small>[convert-date][loop-data news posted_on][/convert-date]<br><br></small> | ||
</td> | ||
</tr> | ||
|
||
[if-loop-data news banner_image] | ||
<tr> | ||
<td align="center"> | ||
<img src="[loop-data news banner_image]" height="80"> | ||
</td> | ||
</tr> | ||
[/if-loop-data] | ||
<tr> | ||
<td align="left"> | ||
<small>[filter 200][loop-data news body][/filter]</small> | ||
</td> | ||
</tr> | ||
|
||
[if-loop-data news blurb_end] | ||
<tr> | ||
<td align="right"> | ||
<a href="[area href="news" arg="[loop-code]"]">[loop-data news blurb_end]</a> | ||
</td> | ||
</tr> | ||
[else] | ||
<tr> | ||
<td align="right"> | ||
<a href="[area href="news" arg="[loop-code]"]">[loc]Read more[/loc]</a>... | ||
</td> | ||
</tr> | ||
[/else] | ||
[/if-loop-data] | ||
<tr> | ||
<td align="center"> </td> | ||
</tr> | ||
</table> | ||
</TD> | ||
[/loop] | ||
[/table-organize] | ||
</table> | ||
|
||
<p> </p> | ||
|
||
</td> | ||
</tr> | ||
</table> | ||
[/timed-build] | ||
<!-- END COMPONENT [control component news] --> |