- Fixed mail bounce processing.

- fix: Asset Manager displaying incorrectly
 - fix: Cannot paste from clipboard
 - Made the search indexer mor compatible with Chinese and other non-ascii
   characters. (Thanks to Zhou Xiaopeng)
This commit is contained in:
JT Smith 2006-07-24 22:18:39 +00:00
parent cf6185c74c
commit c65d9490e7
7 changed files with 41 additions and 22 deletions

View file

@ -478,7 +478,11 @@ sub getAssetAdderLinks {
my $addToUrl = shift;
my $type = shift || "assets";
my %links;
foreach my $class (@{$self->session->config->get($type)}) {
my $classesInType = $self->session->config->get($type);
if (ref $classesInType ne "ARRAY") {
$classesInType = [];
}
foreach my $class (@{$classesInType}) {
next unless $class;
my %properties = (
className=>$class,
@ -521,19 +525,21 @@ sub getAssetAdderLinks {
} else {
$constraint = $self->session->db->quoteAndJoin($self->session->config->get("assets"));
}
my $sth = $self->session->db->read("select asset.className,asset.assetId,assetData.revisionDate from asset left join assetData on asset.assetId=assetData.assetId where assetData.isPrototype=1 and asset.state='published' and asset.className in ($constraint) and assetData.revisionDate=(SELECT max(revisionDate) from assetData where assetData.assetId=asset.assetId) group by assetData.assetId");
while (my ($class,$id,$date) = $sth->array) {
my $asset = WebGUI::Asset->new($self->session,$id,$class,$date);
next unless ($asset->canView && $asset->canAdd($self->session) && $asset->getUiLevel <= $self->session->user->profileField("uiLevel"));
my $url = $self->getUrl("func=add;class=".$class.";prototype=".$id);
$url = $self->session->url->append($url,$addToUrl) if ($addToUrl);
$links{$asset->getTitle}{url} = $url;
$links{$asset->getTitle}{icon} = $asset->getIcon;
$links{$asset->getTitle}{'icon.small'} = $asset->getIcon(1);
$links{$asset->getTitle}{'isPrototype'} = 1;
$links{$asset->getTitle}{'asset'} = $asset;
if ($constraint) {
my $sth = $self->session->db->read("select asset.className,asset.assetId,assetData.revisionDate from asset left join assetData on asset.assetId=assetData.assetId where assetData.isPrototype=1 and asset.state='published' and asset.className in ($constraint) and assetData.revisionDate=(SELECT max(revisionDate) from assetData where assetData.assetId=asset.assetId) group by assetData.assetId");
while (my ($class,$id,$date) = $sth->array) {
my $asset = WebGUI::Asset->new($self->session,$id,$class,$date);
next unless ($asset->canView && $asset->canAdd($self->session) && $asset->getUiLevel <= $self->session->user->profileField("uiLevel"));
my $url = $self->getUrl("func=add;class=".$class.";prototype=".$id);
$url = $self->session->url->append($url,$addToUrl) if ($addToUrl);
$links{$asset->getTitle}{url} = $url;
$links{$asset->getTitle}{icon} = $asset->getIcon;
$links{$asset->getTitle}{'icon.small'} = $asset->getIcon(1);
$links{$asset->getTitle}{'isPrototype'} = 1;
$links{$asset->getTitle}{'asset'} = $asset;
}
$sth->finish;
}
$sth->finish;
my @sortedLinks;
foreach my $label (sort keys %links) {
push(@sortedLinks,{

View file

@ -783,6 +783,7 @@ sub postProcess {
sub publish {
my $self = shift;
$self->SUPER::publish(@_);
$self->getThread->sumReplies;
}

View file

@ -412,8 +412,8 @@ sub view {
$pageData->{"page.isSystem"} = $asset->get("isSystem");
$pageData->{"page.isHidden"} = $asset->get("isHidden");
$pageData->{"page.isViewable"} = $asset->canView;
$pageData->{'page.isContainer'} = isIn($asset->get('className'), @{$self->session->config->get("assetContainers")});
$pageData->{'page.isUtility'} = isIn($asset->get('className'), @{$self->session->config->get("utilityAssets")});
$pageData->{'page.isContainer'} = isIn($asset->get('className'), @{$self->session->config->get("assetContainers") || []});
$pageData->{'page.isUtility'} = isIn($asset->get('className'), @{$self->session->config->get("utilityAssets") || []});
$pageData->{"page.url"} = $asset->getUrl;
my $indent = $pageData->{"page.relDepth"};
$pageData->{"page.indent_loop"} = [];

View file

@ -252,9 +252,7 @@ sub create {
unless ($id =~ m/\@/) {
$id .= '@'.$domain;
}
my $returnPath = $headers->{returnPath} || $session->setting->get("mailReturnPath") || $from;
my $message = MIME::Entity->build(
"Return-Path"=>$returnPath,
Type=>$type,
From=>$from,
To=>$headers->{to},
@ -267,8 +265,7 @@ sub create {
Date=>$session->datetime->epochToMail,
"X-Mailer"=>"WebGUI"
);
# $message->head->delete("Return-Path");
# $message->head->add("Return-Path", "<". ($session->setting->get("mailReturnPath") || $from) . ">");
$message->head->add("X-Return-Path", $headers->{returnPath} || $session->setting->get("mailReturnPath") || $from);
$type = $headers->{contentType};
if ($session->config->get("emailOverride")) {
my $to = $headers->{to};
@ -392,8 +389,8 @@ sub send {
} else {
my $smtp = Net::SMTP->new($self->session->setting->get("smtpServer")); # connect to an SMTP server
if (defined $smtp) {
$smtp->mail($self->{_message}->head->get("from")); # use the sender's address here
$smtp->to(split(",",$self->{_message}->head->get("to"))); # recipient's address
$smtp->mail($self->{_message}->head->get("X-Return-Path"));
$smtp->to(split(",",$self->{_message}->head->get("to")));
$smtp->cc(split(",",$self->{_message}->head->get("cc")));
$smtp->bcc(split(",",$self->{_message}->head->get("bcc")));
$smtp->data(); # Start the mail

View file

@ -75,6 +75,14 @@ sub addKeywords {
my $self = shift;
my $text = shift;
$text = WebGUI::HTML::filter($text, "all");
#-------------------- added by zxp for chinese word segment
utf8::decode($text);
my @segs = split /([A-z|\d]+|\S)/, $text;
$text = join " ",@segs;
$text =~ s/\s{2,}/ /g;
$text =~ s/(^\s|\s$)//g;
$text =~ s/\s/\'\'/g;
#-------------------- added by zxp end
my ($keywords) = $self->session->db->quickArray("select keywords from assetIndex where assetId=?",[$self->getId]);
$self->session->db->write("update assetIndex set keywords =? where assetId=?", [$keywords.' '.$text, $self->getId]);
}