-VERSION=0.15_03
+VERSION=0.15_04
DISTNAME=bse-$(VERSION)
DISTBUILD=$(DISTNAME)
DISTTAR=../$(DISTNAME).tar
select ar.* from article ar, other_parents op
where op.childId = ar.id
and op.parentId = ?
- and date_format(?, '%Y%m%d') between date_format(op.release, '%Y%m%d') and date_format(op.expire, '%Y%m%d')
+ and date_format(?, '%Y%m%d') between date_format(op.release, '%Y%m%d') and date_format(op.expire, '%Y%m%d') and listed <> 0
EOS
'Articles.ids'=>'select id from article',
my $value = $req->cfg->entry($section, $col);
defined($value) and return $value;
+ $value = $self->type_default_value($req, $col);
+ defined $value and return $value;
+
exists $defaults{$col} and return $defaults{$col};
$col eq 'release' and return now_sqldate();
return;
}
+sub type_default_value {
+ my ($self, $req, $col) = @_;
+
+ return $req->cfg->entry('article defaults', $col);
+}
+
sub flag_sections {
return ( 'article flags' );
}
return ( 'catalog flags', $self->SUPER::flag_sections );
}
+sub type_default_value {
+ my ($self, $req, $col) = @_;
+
+ my $value = $req->cfg->entry('catalog defaults', $col);
+ defined $value and return $value;
+
+ return $self->SUPER::type_default_value($req, $col);
+}
+
1;
return;
}
+sub type_default_value {
+ my ($self, $req, $col) = @_;
+
+ my $value = $req->cfg->entry('product defaults', $col);
+ defined $value and return $value;
+
+ return $self->SUPER::type_default_value($req, $col);
+}
+
1;
=head1 CHANGES
+=head2 0.15_04
+
+=over
+
+=item *
+
+the allkids iterator no longer lists unlisted stepkids
+
+=item *
+
+added the [article defaults], [product defaults] and [catalog
+defaults] configuration file sections, see L<config.pod> for details.
+
+=back
+
=head2 0.15_03
=over
Use the id of the flag as the key, and a description of the flag as
it's value.
+=head2 [article defaults]
+
+=head2 [catalog defaults]
+
+=head2 [product defaults]
+
+These sections contain defaults values for the corresponding article
+types.
+
+Each key is the name of a column for the article type.
+
+If an entry is not found in [catalog defaults] then [article defaults]
+is also checked.
+
+If an entry is not found in [product defaults] then [article defaults]
+is also checked.
+
+These sections are checked B<after> the C<[children of >I<id>C<]> and
+C<[level >I<level>C<]> sections.
+
+These defaults are used when creating an article where no value is
+supplied, they can also be accessed via the <:default I<name>:> tag.
+
=head1 AUTHOR
Tony Cook <tony@develop-help.com>
<th nowrap="nowrap" bgcolor="#FFFFFF" align="left">Title:
</th>
<td bgcolor="#FFFFFF" width="100%">
- <:ifFieldPerm title:><input type="text" name="title" maxlength="<:cfg fields title_size 255:>" size="64" value="<: old title article title :>" />
+ <:ifFieldPerm title:><input type="text" name="title" maxlength="<:cfg fields title_size 255:>" size="64" value="<: old title default title :>" />
<:or:><:default title:><:eif:></td>
<td nowrap="nowrap" bgcolor="#FFFFFF"><:help edit title:> <:error_img title:></td>
</tr>
<tr>
<th valign="top" nowrap="nowrap" bgcolor="#FFFFFF" align="left"> Body: </th>
<td bgcolor="#FFFFFF" width="100%">
- <:if FieldPerm body:><textarea name="body" rows="10" cols="60" wrap="virtual"><: old body article body :></textarea>
+ <:if FieldPerm body:><textarea name="body" rows="10" cols="60" wrap="virtual"><: old body default body :></textarea>
<:or FieldPerm:><:bodytext article body:><:eif FieldPerm:>
</td>
<td valign="top" nowrap="nowrap" bgcolor="#FFFFFF"><:help body body:> <:error_img body:></td>
<tr>
<th nowrap="nowrap" bgcolor="#FFFFFF" align="left">Release date:</th>
<td bgcolor="#FFFFFF" width="100%">
- <:if FieldPerm release:><input type="text" name="release" value="<: old release date "%d/%m/%Y" article release :>" size="10" maxlength="10" />
+ <:if FieldPerm release:><input type="text" name="release" value="<: old release date "%d/%m/%Y" default release :>" size="10" maxlength="10" />
(dd/mm/yyyy<: ifNew :> - default is today<: or :><: eif :>)<:or FieldPerm:><: date "%d/%m/%Y" article release :><:eif FieldPerm:></td>
<td nowrap="nowrap" bgcolor="#FFFFFF"><:help edit release:> <:error_img release:></td>
</tr>
<tr>
<th nowrap="nowrap" bgcolor="#FFFFFF" align="left">Expiry date:</th>
<td bgcolor="#FFFFFF" width="100%">
- <:if FieldPerm expire:><input type="text" name="expire" value="<: old expire date "%d/%m/%Y" article expire :>" size="10" maxlength="10" />
+ <:if FieldPerm expire:><input type="text" name="expire" value="<: old expire date "%d/%m/%Y" default expire :>" size="10" maxlength="10" />
(dd/mm/yyyy - <: ifNew :>default is never, <: or :><: eif :>blank
for never expires)<:or FieldPerm:><: date "%d/%m/%Y" article expire :><:eif FieldPerm:></td>
<td nowrap="nowrap" bgcolor="#FFFFFF"><:help edit expire:> <:error_img expire:></td>
<tr>
<th nowrap="nowrap" bgcolor="#FFFFFF" align="left">Summary length:</th>
<td bgcolor="#FFFFFF" width="100%">
- <:if FieldPerm summaryLength:><input type="text" name="summaryLength" size="10" maxlength="10" value="<: old summaryLength article summaryLength :>" />
+ <:if FieldPerm summaryLength:><input type="text" name="summaryLength" size="10" maxlength="10" value="<: old summaryLength default summaryLength :>" />
(in characters - <: ifNew :>default inherited from <:parentType:>, <: or :><: eif :>
zero for no summary)<:or FieldPerm:><: article summaryLength :><:eif FieldPerm:></td>
<td nowrap="nowrap" bgcolor="#FFFFFF"><:help edit summary:> <:error_img summaryLength:></td>
<tr>
<th nowrap="nowrap" bgcolor="#FFFFFF" align="left">Display threshold:</th>
<td bgcolor="#FFFFFF" width="100%">
- <:ifFieldPerm threshold:><input type="text" name="threshold" size="10" maxlength="10" value="<: old threshold article threshold :>" /><:or:><: article threshold :><:eif:>
+ <:ifFieldPerm threshold:><input type="text" name="threshold" size="10" maxlength="10" value="<: old threshold default threshold :>" /><:or:><: article threshold :><:eif:>
</td>
<td nowrap="nowrap" bgcolor="#FFFFFF"><:help edit threshold:> <:error_img
threshold:></td>
<tr>
<th nowrap="nowrap" bgcolor="#FFFFFF" align="left">Keywords:</th>
<td bgcolor="#FFFFFF" width="100%">
- <:ifFieldPerm keyword:><input type="text" name="keyword" maxlength="255" size="60" value="<: old keyword article keyword :>" />
+ <:ifFieldPerm keyword:><input type="text" name="keyword" maxlength="255" size="60" value="<: old keyword default keyword :>" />
(comma separated)<:or:><: article threshold :><:eif:></td>
<td nowrap="nowrap" bgcolor="#FFFFFF"><:help edit keywords:> <:error_img keyword:></td>
</tr>
<tr>
<th bgcolor="#FFFFFF" nowrap align="left"> Catalog title: </th>
<td bgcolor="#FFFFFF" width="100%">
- <:ifFieldPerm title:><input type="text" name="title" maxlength="64" size="64" value="<: old title article title :>"><:or:><:default title:><:eif:>
+ <:ifFieldPerm title:><input type="text" name="title" maxlength="64" size="64" value="<: old title default title :>"><:or:><:default title:><:eif:>
</td>
<td nowrap bgcolor="#FFFFFF"><:help catalog title:> <:error_img title:></td>
</tr>
<tr>
<th valign="top" bgcolor="#FFFFFF" nowrap align="left"> Body:</th>
<td bgcolor="#FFFFFF" width="100%">
- <:ifFieldPerm body:><textarea name="body" rows="10" cols="60" wrap="virtual"><: old body article body :></textarea><:or:><:bodytext article body:><:eif:>
+ <:ifFieldPerm body:><textarea name="body" rows="10" cols="60" wrap="virtual"><: old body default body :></textarea><:or:><:bodytext article body:><:eif:>
</td>
<td valign="top" nowrap bgcolor="#FFFFFF"><:help body body:> <:error_img
body:></td>
<tr>
<th bgcolor="#FFFFFF" nowrap align="left"> Release date: </th>
<td bgcolor="#FFFFFF" width="100%">
- <:if FieldPerm release:><input type="text" name="release" value="<: old release date "%d/%m/%Y" article release :>" size="10" maxlength="10">
+ <:if FieldPerm release:><input type="text" name="release" value="<: old release date "%d/%m/%Y" default release :>" size="10" maxlength="10">
(dd/mm/yyyy<: ifNew :> - default is today<: or :><: eif :>)<:or FieldPerm:><: date "%d/%m/%Y" article release :><:eif FieldPerm:></td>
<td nowrap bgcolor="#FFFFFF"><:help catalog release:> <:error_img release:></td>
</tr>
<tr>
<th bgcolor="#FFFFFF" nowrap align="left"> Expiry date: </th>
<td bgcolor="#FFFFFF" width="100%">
- <:if FieldPerm expire:><input type="text" name="expire" value="<: old expire date "%d/%m/%Y" article expire :>" size="10" maxlength="10">
+ <:if FieldPerm expire:><input type="text" name="expire" value="<: old expire date "%d/%m/%Y" default expire :>" size="10" maxlength="10">
(dd/mm/yyyy - <: ifNew :>default is never, <: or :><: eif :>blank
for never expires)<:or FieldPerm:><: date "%d/%m/%Y" article expire :><:eif FieldPerm:></td>
<td nowrap bgcolor="#FFFFFF"><:help catalog expire:> <:error_img expire:></td>
<tr>
<th bgcolor="#FFFFFF" nowrap align="left"> Summary length: </th>
<td bgcolor="#FFFFFF" width="100%">
- <:if FieldPerm summaryLength:><input type="text" name="summaryLength" size="10" maxlength="10" value="<: old summaryLength article summaryLength :>">
+ <:if FieldPerm summaryLength:><input type="text" name="summaryLength" size="10" maxlength="10" value="<: old summaryLength default summaryLength :>">
(in characters - default inherited from parent catalog or shop, zero
for no summary)<:or FieldPerm:><: article summaryLength :><:eif FieldPerm:></td>
<td nowrap bgcolor="#FFFFFF"><:help catalog summary:> <:error_img summaryLength:></td>
<tr>
<th bgcolor="#FFFFFF" nowrap align="left"> Display threshold: </th>
<td bgcolor="#FFFFFF" width="100%">
- <:ifFieldPerm threshold:><input type="text" name="threshold" size="10" maxlength="10" value="<: old threshold article threshold :>"><:or:><: article threshold :><:eif:>
+ <:ifFieldPerm threshold:><input type="text" name="threshold" size="10" maxlength="10" value="<: old threshold default threshold :>"><:or:><: article threshold :><:eif:>
</td>
<td nowrap bgcolor="#FFFFFF"><:help catalog threshold:> <:error_img threshold:></td>
</tr>
<tr>
<th bgcolor="#FFFFFF" nowrap align="left"> Keywords: </th>
<td bgcolor="#FFFFFF" width="100%">
- <:ifFieldPerm keyword:><input type="text" name="keyword" maxlength="255" size="60" value="<: old keyword article keyword :>"><:or:><: article threshold :><:eif:>
+ <:ifFieldPerm keyword:><input type="text" name="keyword" maxlength="255" size="60" value="<: old keyword default keyword :>"><:or:><: article threshold :><:eif:>
(comma separated) </td>
<td nowrap bgcolor="#FFFFFF"><:help catalog keywords:> <:error_img keyword:></td>
</tr>
</tr>
<tr>
<th align="left" bgcolor="#FFFFFF">Title*:</th>
- <td bgcolor="#FFFFFF"><:ifFieldPerm title:><input type="text" name="title" value="<:old title:>" size="60"><:or:><:product title:><:eif:> </td>
+ <td bgcolor="#FFFFFF"><:ifFieldPerm title:><input type="text" name="title" value="<:old title default title:>" size="60"><:or:><:product title:><:eif:> </td>
<td nowrap bgcolor="#FFFFFF"><:help product title:> <:error_img title:></td>
</tr>
<tr>
<th nowrap align="left" bgcolor="#FFFFFF">Summary*:</th>
- <td nowrap bgcolor="#FFFFFF"><:ifFieldPerm summary:><input type="text" name="summary" value="<:old summary:>" size=60><:or:><:product summary:><:eif:> </td>
+ <td nowrap bgcolor="#FFFFFF"><:ifFieldPerm summary:><input type="text" name="summary" value="<:old summary default summary:>" size=60><:or:><:product summary:><:eif:> </td>
<td nowrap bgcolor="#FFFFFF"><:help product summary:> <:error_img
summary:></td>
</tr>
<tr>
<th align="left" bgcolor="#FFFFFF" valign="top"> Body:</th>
<td bgcolor="#FFFFFF">
- <:ifFieldPerm body:><textarea name=body rows=15 cols=60 wrap=virtual><:old body product body:></textarea><:or:><:bodytext product body:><:eif:>
+ <:ifFieldPerm body:><textarea name=body rows=15 cols=60 wrap=virtual><:old body default body:></textarea><:or:><:bodytext product body:><:eif:>
</td>
<td nowrap bgcolor="#FFFFFF" valign="top"><:help body body:> <:error_img
body:></td>
<th nowrap align="left" bgcolor="#FFFFFF">Lead time:</th>
<td nowrap bgcolor="#FFFFFF">
<:ifFieldPerm leadTime:>
- <input type="text" name="leadTime" value="<:old leadTime:>" size=5><:or:><:product leadTime:><:eif:>
+ <input type="text" name="leadTime" value="<:old leadTime default leadTime:>" size=5><:or:><:product leadTime:><:eif:>
days</td>
<td nowrap bgcolor="#FFFFFF"><:help product leadtime:> <:error_img
leadTime:></td>
<tr>
<th align="left" bgcolor="#FFFFFF"><:cfg "product fields" retailPrice "Retail price":>:</th>
<td bgcolor="#FFFFFF">$
- <:ifFieldPerm retailPrice:><input type="text" name="retailPrice" value="<:old retailPrice money product retailPrice:>" size=7>
+ <:ifFieldPerm retailPrice:><input type="text" name="retailPrice" value="<:old retailPrice money default retailPrice:>" size=7>
(0.00)<:or:><:money product retailPrice:><:eif:> </td>
<td nowrap bgcolor="#FFFFFF"><:help product retail:> <:error_img retailPrice:></td>
</tr>
<tr>
<th align="left" bgcolor="#FFFFFF">Wholesale price:</th>
<td bgcolor="#FFFFFF">$
- <:ifFieldPerm wholesalePrice:><input type="text" name="wholesalePrice" value="<:old wholesalePrice money product wholesalePrice:>" size=7>
+ <:ifFieldPerm wholesalePrice:><input type="text" name="wholesalePrice" value="<:old wholesalePrice money default wholesalePrice:>" size=7>
(0.00)<:or:><:money product wholesalePrice:><:eif:></td>
<td nowrap bgcolor="#FFFFFF"><:help product wholesale:> <:error_img wholesalePrice:></td>
</tr>
<tr>
<th align="left" bgcolor="#FFFFFF">GST:</th>
<td bgcolor="#FFFFFF">$
- <:ifFieldPerm gst:><input type="text" name="gst" value="<:old gst money product gst:>" size=7>
+ <:ifFieldPerm gst:><input type="text" name="gst" value="<:old gst money default gst:>" size=7>
(0.00)<:or:><:money product gst:><:eif:></td>
<td nowrap bgcolor="#FFFFFF"><:help product gst:> <:error_img gst:></td>
</tr>
<tr>
<th align="left" bgcolor="#FFFFFF">Release date:</th>
<td bgcolor="#FFFFFF">
- <:ifFieldPerm release:><input type="text" name="release" value="<:old release date "%d/%m/%Y" product release:>" size=11>
+ <:ifFieldPerm release:><input type="text" name="release" value="<:old release date "%d/%m/%Y" default release:>" size=11>
(dd/mm/yyyy)<:or:><:date "%d/%m/%Y" product release:><:eif:></td>
<td nowrap bgcolor="#FFFFFF"><:help product release:> <:error_img
release:></td>
<tr>
<th align="left" bgcolor="#FFFFFF">Expiry date:</th>
<td bgcolor="#FFFFFF">
- <:ifFieldPerm expire:><input type="text" name="expire" value="<:old expire date "%d/%m/%Y" product expire:>" size=11>
+ <:ifFieldPerm expire:><input type="text" name="expire" value="<:old expire date "%d/%m/%Y" default expire:>" size=11>
(dd/mm/yyyy)<:or:><:date "%d/%m/%Y" product expire:><:eif:></td>
<td nowrap bgcolor="#FFFFFF"><:help product expire:> <:error_img
expire:></td>
<tr>
<th nowrap align="left" bgcolor="#FFFFFF">Summary length:</th>
<td nowrap bgcolor="#FFFFFF">
- <:ifFieldPerm summaryLength:><input type="text" name="summaryLength" size="10" maxlength="10" value="<:old summaryLength product summaryLength:>"><:or:><:product summaryLength:><:eif:>
+ <:ifFieldPerm summaryLength:><input type="text" name="summaryLength" size="10" maxlength="10" value="<:old summaryLength default summaryLength:>"><:or:><:product summaryLength:><:eif:>
</td>
<td nowrap bgcolor="#FFFFFF"><:help product summary:> <:error_img
summaryLength:></td>
<tr>
<th nowrap align="left" bgcolor="#FFFFFF">Display threshold:</th>
<td nowrap bgcolor="#FFFFFF">
- <:ifFieldPerm threshold:><input type="text" name="threshold" size=10 maxlength=10 value="<:old threshold product threshold:>"><:or:><:product threshold:><:eif:>
+ <:ifFieldPerm threshold:><input type="text" name="threshold" size=10 maxlength=10 value="<:old threshold default threshold:>"><:or:><:product threshold:><:eif:>
</td>
<td nowrap bgcolor="#FFFFFF"><:help product threshold:> <:error_img
threshold:></td>
<tr>
<th align="left" bgcolor="#FFFFFF">Options:</th>
<td bgcolor="#FFFFFF">
- <:ifFieldPerm options:><input type="text" name="options" value="<:old options product options:>" size=30>
+ <:ifFieldPerm options:><input type="text" name="options" value="<:old options default options:>" size=30>
(<:alloptions:>)<:or:><:product options:><:eif:> </td>
<td bgcolor="#FFFFFF"><:help product options:> <:error_img options:></td>
</tr>
test formmail validation.company_required=0
site.secureadmin=1
+article defaults.title=<set the article title>
+article defaults.body=<set the body>
+product defaults.title=<set the product title>
+catalog defaults.title=<set the catalog title>