use constant MAX_FILE_DISPLAYNAME_LENGTH => 255;
use constant ARTICLE_CUSTOM_FIELDS_CFG => "article custom fields";
-our $VERSION = "1.034";
+our $VERSION = "1.035";
=head1 NAME
my $cgi = $request->cgi;
my $show_full = $cgi->param('f_showfull');
my $if_error = $msg || ($errors && keys %$errors) || $request->cgi->param("_e");
- $msg ||= join "\n", map escape_html($_), $cgi->param('message'), $cgi->param('m');
- $msg ||= $request->message($errors);
+ #$msg ||= join "\n", map escape_html($_), $cgi->param('message'), $cgi->param('m');
+ $msg .= $request->message($errors);
my $parent;
if ($article->{id}) {
if ($article->{parentid} > 0) {
return $self->_service_error($req, $article, $articles, $why_not, {}, $code);
}
- my $id = $article->id;
+ my $data = $article->data_only;
my $parentid = $article->{parentid};
$article->remove($req->cfg);
return $req->json_content
(
success => 1,
- article_id => $id,
+ article_id => $data->{id},
);
}
my $url = $req->cgi->param('r');
unless ($url) {
- my $urlbase = admin_base_url($req->cfg);
- $url = "$urlbase$ENV{SCRIPT_NAME}?id=$parentid";
- $url .= "&message=Article+deleted";
+ $url = $req->cfg->admin_url("add", { id => $parentid });
}
+
+ $req->flash_notice("msg:bse/admin/edit/remove", [ $data ]);
+
return BSE::Template->get_refresh($url, $self->{cfg});
}
use BSE::Cfg;
use BSE::Cache;
use DevHelp::HTML;
+use Scalar::Util qw(reftype blessed);
use overload
"&{}" => sub { my $self = $_[0]; return sub { $self->_old_msg(@_) } },
"bool" => sub { 1 };
-our $VERSION = "1.005";
+our $VERSION = "1.006";
my $single;
my $value = $parms->[$index-1];
if (ref $value) {
local $@;
- my $good = eval { $value = $value->$method; 1; };
- unless ($good) {
- return "(Bad parameter $index - ref but no $method)";
+ if (blessed $value) {
+ my $good = eval { $value = $value->$method; 1; };
+ unless ($good) {
+ return "(Bad parameter $index - blessed but no $method)";
+ }
+ }
+ elsif (reftype $value eq "HASH") {
+ defined $value->{$method}
+ or return "(Unknown key $method for $index)";
+ $value = $value->{$method};
+ }
+ else {
+ return "(Can't handle ".reftype($value)." values)";
}
}
--
-# VERSION=1.005
+# VERSION=1.006
id: bse/
description: BSE messages
id: bse/admin/edit/uplabelsect
description: label in parent list to make article a section
+id: bse/admin/edit/remove
+description: Flashed when an article is removed (%1 - the original article data)
+
id: bse/admin/edit/tags/
description: System tags management
---
-# VERSION=1.005
+# VERSION=1.006
# defaults for the following
language_code: en
priority: 0
id: bse/admin/edit/uplabelsect
message: -- move up a level -- become a section
+id: bse/admin/edit/remove
+message: Article '%1:{title}s' (%1:{id}d) deleted.
+
id: bse/admin/edit/tags/saved
message: Tag renamed from '%1:s' to '%2:s'
<:wrap admin/base.tmpl title=>"Manage Sections":>
<h1>Manage Sections</h1>
-<:ifMessage:>
-<p><b><:message:></b></p>
-<:or:><:eif:>
+<:.call "messages" -:>
<:include admin/include/site_menu.tmpl:>
<:if Or [iadminuser_count] [iadmingroup_count]:>
<form action="/cgi-bin/admin/adminusers.pl">
#!perl -w
use strict;
use Test::More tests => 22;
-use BSE::Test qw(base_url make_ua check_form post_ok
+use BSE::Test qw(base_securl make_ua check_form post_ok
check_content follow_ok);
use URI::QueryParam;
#use WWW::Mechanize;
++$|;
-my $baseurl = base_url;
+my $baseurl = base_securl;
my $ua = make_ua;
ok($ua->get("$baseurl/cgi-bin/admin/add.pl?parentid=-1"), "edit page");
{
text => "Delete",
url_regex => qr/id=$id/
- }, qr/Article deleted/);
+ }, qr/Article 'Test Article' \($id\) deleted/);
#!perl -w
use strict;
-use BSE::Test qw(make_ua base_url fetch_ok follow_ok click_ok follow_refresh_ok);
+use BSE::Test qw(make_ua base_securl fetch_ok follow_ok click_ok follow_refresh_ok);
use Test::More tests => 114;
-my $base_url = base_url;
+my $base_url = base_securl;
my $ua = make_ua;
my $title = "t40images.t ".time;
text => "Delete",
url_regex => qr/id=$article_id/
},
- qr/Article deleted/);
+ qr/Article '\Q$title\E' \([0-9]+\) deleted/);
sub image1 {
# based on testout/t105pal.gif from Imager
use vars qw(@ISA @EXPORT @EXPORT_OK);
use Exporter 'import';
@EXPORT = qw(base_url fetch_ok make_url skip make_ua);
-@EXPORT_OK = qw(base_url make_ua fetch_url fetch_ok make_url skip
+@EXPORT_OK = qw(base_url base_securl make_ua fetch_url fetch_ok make_url skip
make_post check_form post_ok check_content follow_ok
follow_refresh_ok click_ok config test_actions);
use lib 'site/cgi-bin/modules';