-- identifier for the file for use with filelink[]
name varchar(80) not null default '',
+ hide_from_list integer not null default 0,
+
primary key (id)
);
sub columns {
return qw/id articleId displayName filename sizeInBytes description
contentType displayOrder forSale download whenUploaded
- requireUser notes name/;
+ requireUser notes name hide_from_list/;
}
sub remove {
'select * from other_parents where childId = ? or parentId = ?',
addArticleFile =>
- 'insert into article_files values (null,?,?,?,?,?,?,?,?,?,?,?,?,?)',
+ 'insert into article_files values (null,?,?,?,?,?,?,?,?,?,?,?,?,?,?)',
replaceArticleFile =>
- 'replace article_files values (?,?,?,?,?,?,?,?,?,?,?,?,?,?)',
+ 'replace article_files values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)',
deleteArticleFile => 'delete from article_files where id = ?',
getArticleFileByArticleId =>
'select * from article_files where articleId = ? order by displayOrder desc',
my %errors;
- $file{forSale} = 0 + exists $file{forSale};
- $file{articleId} = $article->{id};
- $file{download} = 0 + exists $file{download};
- $file{requireUser} = 0 + exists $file{requireUser};
+ $file{forSale} = 0 + exists $file{forSale};
+ $file{articleId} = $article->{id};
+ $file{download} = 0 + exists $file{download};
+ $file{requireUser} = 0 + exists $file{requireUser};
+ $file{hide_from_list} = 0 + exists $file{hide_from_list};
my $downloadPath = $self->{cfg}->entryVar('paths', 'downloads');
my $cgi = $req->cgi;
my %seen_name;
for my $file (@files) {
- if (defined $cgi->param("description_$file->{id}")) {
- $file->{description} = $cgi->param("description_$file->{id}");
- if (defined(my $type = $cgi->param("contentType_$file->{id}"))) {
+ my $id = $file->{id};
+ if (defined $cgi->param("description_$id")) {
+ $file->{description} = $cgi->param("description_$id");
+ if (defined(my $type = $cgi->param("contentType_$id"))) {
$file->{contentType} = $type;
}
- if (defined(my $notes = $cgi->param("notes_$file->{id}"))) {
+ if (defined(my $notes = $cgi->param("notes_$id"))) {
$file->{notes} = $notes;
}
- my $name = $cgi->param("name_$file->{id}");
+ my $name = $cgi->param("name_$id");
defined $name or $name = $file->{name};
if (length $name && $name !~ /^\w+$/) {
return $self->edit_form($req, $article, $articles,
return $self->edit_form($req, $article, $articles,
"Duplicate file identifier $name");
}
- $file->{name} = $name;
- $file->{download} = 0 + defined $cgi->param("download_$file->{id}");
- $file->{forSale} = 0 + defined $cgi->param("forSale_$file->{id}");
- $file->{requireUser} = 0 + defined $cgi->param("requireUser_$file->{id}");
+ $file->{name} = $name;
+ $file->{download} = 0 + defined $cgi->param("download_$id");
+ $file->{forSale} = 0 + defined $cgi->param("forSale_$id");
+ $file->{requireUser} = 0 + defined $cgi->param("requireUser_$id");
+ $file->{hide_from_list} = 0 + defined $cgi->param("hide_from_list_$id");
}
}
for my $file (@files) {
return;
}
if ($article->{id} == $Constants::SHOPID) {
- $$rmsg = "Sorry, these pages are essential to the store - they cannot be deleted - you may want to hide the the store instead.";
+ $$rmsg = "Sorry, these pages are essential to the store - they cannot be deleted - you may want to hide the store instead.";
return;
}
my @iter_images;
my $image_index = -1;
my $had_image_tags = 0;
- my @files = sort { $b->{displayOrder} <=> $a->{displayOrder} }
+ my @all_files = sort { $b->{displayOrder} <=> $a->{displayOrder} }
ArticleFiles->getBy(articleId=>$article->{id});
+ my @files = grep !$_->{hide_from_list}, @all_files;
my $blank = qq!<img src="$IMAGES_URI/trans_pixel.gif" width="17" height="13" border="0" align="absbottom" alt="" />!;
auto_images => !$had_image_tags,
templater => $templater,
images => \@images,
- files => \@files,
+ files => \@all_files,
articles => $articles);
},
Information from the current file in the files iterator.
+The file fields are:
+
+=over
+
+=item *
+
+id - identifier for this file
+
+=item *
+
+articleId - article this file belongs to
+
+=item *
+
+displayName - the filename of the file as displayed
+
+=item *
+
+filename - filename of the file as stored on disk,
+
+=item *
+
+sizeInBytes - size of the file in bytes.
+
+=item *
+
+description - the entered description of the file
+
+=item *
+
+contentType - the MIME content type of the file
+
+=item *
+
+displayOrder - number used to control the listing order.
+
+=item *
+
+forSale - non-zero if the file needs to be paid for to be downloaded.
+
+=item *
+
+download - if this is non-zero BSE will attempt to make the browser
+download the file rather than display it.
+
+=item *
+
+whenUploaded - date/time when the file was uploaded.
+
+=item *
+
+requireUser - if non-zero the user must be logged on to download this
+file.
+
+=item *
+
+notes - longer descriptive text.
+
+=item *
+
+name - identifier for the file for filelink[]
+
+=item *
+
+hide_from_list - if non-zero the file won't be listed by the files
+iterator, but will still be available to filelink[].
+
+=back
+
=back
=head2 Article attributes
add tags to display the cart on any dynamic page
+=item *
+
+files now have a flag to hide them from the files iterator. This will
+require a change to the admin/filelist.tmpl template in custom
+template sets.
+
+=item *
+
+fixed a repeated "the" in the message from attempting to delete the
+store.
+
=back
=head2 0.15_40
=back
There are also the <:wrap ... :> and <:embed ... :> tags, which are
-described under L<WRAPPING> and L<Embedding tags> respectively.
+described under L</WRAPPING> and L</Embedding tags> respectively.
=head2 Data tags
=head2 Embedding tags
-To embed the current child article (within an C<E<lt>:iterator begin
-... endE<gt>:> block), use:
+To embed the current child article (within an C<<E<lt>:iterator begin
+... endE<gt>:>> block), use:
<:embed child:>
Tags are documented without the <: and :>.
-If a tag is documented as C<iterator ...I<name>> then it's an iterator
+If a tag is documented as C<<iterator ...I<name> >> then it's an iterator
tag and can be used:
<:iterator begin I<name>:>
Information from the current file in the files iterator.
+The file fields are:
+
+=over
+
+=item *
+
+id - identifier for this file
+
+=item *
+
+articleId - article this file belongs to
+
+=item *
+
+displayName - the filename of the file as displayed
+
+=item *
+
+filename - filename of the file as stored on disk,
+
+=item *
+
+sizeInBytes - size of the file in bytes.
+
+=item *
+
+description - the entered description of the file
+
+=item *
+
+contentType - the MIME content type of the file
+
+=item *
+
+displayOrder - number used to control the listing order.
+
+=item *
+
+forSale - non-zero if the file needs to be paid for to be downloaded.
+
+=item *
+
+download - if this is non-zero BSE will attempt to make the browser
+download the file rather than display it.
+
+=item *
+
+whenUploaded - date/time when the file was uploaded.
+
+=item *
+
+requireUser - if non-zero the user must be logged on to download this
+file.
+
+=item *
+
+notes - longer descriptive text.
+
+=item *
+
+name - identifier for the file for filelink[]
+
+=item *
+
+hide_from_list - if non-zero the file won't be listed by the files
+iterator, but will still be available to filelink[].
+
+=back
+
=back
The following tags produce output only in admin mode.
</td>
<td nowrap="nowrap" bgcolor="#FFFFFF"><:help file requireUser:> <:error_img requireUser:></td>
</tr>
+ <tr>
+ <th bgcolor="#FFFFFF" align="left">Hide from list:</th>
+ <td bgcolor="#FFFFFF">
+ <input type="checkbox" name="hide_from_list" value="1" />
+ </td>
+ <td nowrap="nowrap" bgcolor="#FFFFFF"><:help file hide_from_list:> <:error_img hide_from_list:></td>
+ </tr>
<tr>
<td bgcolor="#FFFFFF" colspan="3" align="right">
<input type="submit" name="fileadd" value="Add File" />
<td valign="top" align="center" nowrap="nowrap"> <:if UserCan edit_files_save:article:><input type="checkbox" name="requireUser_<:file id:>"
<:ifFile requireUser:> checked<:or:><:eif:> /><:or UserCan:><img src="/images/admin/<:ifFile requireUser:>checked.gif<:or:>unchecked.gif<:eif:>" width="16" height="16" /><:eif UserCan:>Require login
</td>
+ <td valign="top" align="center" nowrap="nowrap"> <:if UserCan edit_files_save:article:><input type="checkbox" name="hide_from_list_<:file id:>"
+ <:ifFile hide_from_list:> checked<:or:><:eif:> /><:or UserCan:><img src="/images/admin/<:ifFile hide_from_list:>checked.gif<:or:>unchecked.gif<:eif:>" width="16" height="16" /><:eif UserCan:>Hide from file list
+ </td>
<td nowrap="nowrap" align="right" width="100%"> <:ifUserCan edit_files_delete:article:><b><a href="<:script:>?filedel=1&id=<:article id:>&file=<:file id:>&_t=file" onClick="return window.confirm('Are you sure you want to delete this File')">Delete</a></b> <:or:><:eif:>
<:movefiles:></td>
</tr>