fixing some bugs relaed to cs mail replies
fixed a bug in the user manager where the user would take on the username/alias of the visitor fixed a bug in error handling where debug was being spewed for errors in approriately
This commit is contained in:
parent
91c4083d8a
commit
a7df0f7a55
9 changed files with 82 additions and 30 deletions
|
|
@ -487,6 +487,7 @@ sub addWorkflow {
|
|||
$session->setting->remove("onNewUserAlertGroup");
|
||||
$session->setting->set("runOnRegistration","");
|
||||
$session->setting->add("defaultVersionTagWorkflow","pbworkflow000000000003");
|
||||
$session->setting->add("mailReturnPath",undef);
|
||||
}
|
||||
|
||||
#-------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ use WebGUI::HTML;
|
|||
use WebGUI::HTMLForm;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Inbox;
|
||||
use WebGUI::Mail::Send;
|
||||
use WebGUI::Operation;
|
||||
use WebGUI::Paginator;
|
||||
use WebGUI::SQL;
|
||||
|
|
@ -55,6 +56,7 @@ sub addRevision {
|
|||
} else {
|
||||
$newSelf->update({threadId=>$newSelf->getParent->get("threadId"), dateSubmitted=>$now});
|
||||
}
|
||||
delete $newSelf->{_thread};
|
||||
}
|
||||
$newSelf->update({
|
||||
isHidden => 1,
|
||||
|
|
@ -62,7 +64,7 @@ sub addRevision {
|
|||
groupIdView=>$newSelf->getThread->getParent->get("groupIdView"),
|
||||
groupIdEdit=>$newSelf->getThread->getParent->get("groupIdEdit"),
|
||||
});
|
||||
$self->getThread->unmarkRead;
|
||||
$newSelf->getThread->unmarkRead;
|
||||
return $newSelf;
|
||||
}
|
||||
|
||||
|
|
@ -623,26 +625,31 @@ Send notifications to the thread and forum subscribers that a new post has been
|
|||
sub notifySubscribers {
|
||||
my $self = shift;
|
||||
my $i18n = WebGUI::International->new($self->session);
|
||||
my $inbox = WebGUI::Inbox->new($self->session);
|
||||
my $var = $self->getTemplateVars();
|
||||
$self->getThread->getParent->appendTemplateLabels($var);
|
||||
$var->{url} = $self->session->url->getSiteURL().$self->getUrl;
|
||||
$var->{'notify.subscription.message'} = $i18n->get(875,"Asset_Post");
|
||||
my $message = $self->processTemplate($var, $self->getThread->getParent->get("notificationTemplateId"));
|
||||
$inbox->addMessage({
|
||||
groupId=>$self->getThread->getParent->get("subscriptionGroupId"),
|
||||
status=>"completed",
|
||||
subject=>$self->getThread->getParent->get("mailPrefix").$self->get("subject"),
|
||||
message=>$message,
|
||||
my $from = $self->getThread->getParent->get("mailAddress");
|
||||
my $subject = $self->getThread->getParent->get("mailPrefix").$self->get("title");
|
||||
my $mail = WebGUI::Mail::Send->create($self->session, {
|
||||
from=>$from,
|
||||
toGroup=>$self->getThread->getParent->get("subscriptionGroupId"),
|
||||
subject=>$subject,
|
||||
messageId=>"cs-".$self->getId
|
||||
});
|
||||
$inbox->addMessage({
|
||||
groupId=>$self->getThread->get("subscriptionGroupId"),
|
||||
status=>"completed",
|
||||
subject=>$self->getThread->getParent->get("mailPrefix").$self->get("subject"),
|
||||
message=>$message,
|
||||
$mail->addHtml($message);
|
||||
$mail->addFooter;
|
||||
$mail->queue;
|
||||
my $mail = WebGUI::Mail::Send->create($self->session, {
|
||||
from=>$from,
|
||||
toGroup=>$self->getThread->get("subscriptionGroupId"),
|
||||
subject=>$subject,
|
||||
messageId=>"cs-".$self->getId
|
||||
});
|
||||
$mail->addHtml($message);
|
||||
$mail->addFooter;
|
||||
$mail->queue;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -723,7 +730,7 @@ See WebGUI::Asset::purgeCache() for details.
|
|||
|
||||
sub purgeCache {
|
||||
my $self = shift;
|
||||
WebGUI::Cache->new($self->session,"view_".$self->getThread->getId)->delete;
|
||||
WebGUI::Cache->new($self->session,"view_".$self->getThread->getId)->delete if ($self->getThread);
|
||||
$self->SUPER::purgeCache;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ sub getLastChild {
|
|||
|
||||
=head2 getLineage ( relatives,rules )
|
||||
|
||||
Returns an array reference of lineages of relatives based upon rules.
|
||||
Returns an array reference of relative asset ids based upon rules.
|
||||
|
||||
=head3 relatives
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ use MIME::Entity;
|
|||
use MIME::Parser;
|
||||
use LWP::MediaTypes qw(guess_media_type);
|
||||
use WebGUI::Group;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::User;
|
||||
|
||||
=head1 NAME
|
||||
|
|
@ -88,7 +89,9 @@ Adds the mail footer as set by the site admin to the end of this message.
|
|||
|
||||
sub addFooter {
|
||||
my $self = shift;
|
||||
$self->addText($self->session->setting->get("mailFooter"));
|
||||
my $text = "\n\n".$self->session->setting->get("mailFooter");
|
||||
WebGUI::Macro::process($self->session, \$text);
|
||||
$self->addText($text);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -215,9 +218,15 @@ sub create {
|
|||
}
|
||||
my $returnPath = $session->setting->get("mailReturnPath");
|
||||
$returnPath = "<".$returnPath.">" if $returnPath;
|
||||
my $from = $headers->{from};
|
||||
$from = $session->setting->get("companyEmail") if ($from eq "");
|
||||
my $type = $headers->{contentType};
|
||||
$type = "multipart/mixed" if ($type eq "");
|
||||
my $id = $headers->{messageId};
|
||||
$id = "WebGUI-".$session->id->generate if ($id eq "");
|
||||
my $message = MIME::Entity->build(
|
||||
Type=>$headers->{contentType} || "multipart/mixed",
|
||||
From=>$headers->{from} || $session->setting->get("companyEmail"),
|
||||
Type=>$type,
|
||||
From=>$from,
|
||||
To=>$headers->{to},
|
||||
Cc=>$headers->{cc},
|
||||
Bcc=>$headers->{bcc},
|
||||
|
|
@ -225,7 +234,7 @@ sub create {
|
|||
"In-Reply-To"=>$headers->{inReplyTo},
|
||||
"Return-Path"=>$returnPath,
|
||||
Subject=>$headers->{subject},
|
||||
"Message-Id"=>$headers->{messageId} || "WebGUI-".$session->id->generate,
|
||||
"Message-Id"=>$id,
|
||||
Date=>$session->datetime->epochToHuman("","%W, %d %C %y %j:%n:%s %O"),
|
||||
"X-Mailer"=>"WebGUI"
|
||||
);
|
||||
|
|
@ -344,7 +353,7 @@ sub send {
|
|||
my $group = $self->{_toGroup};
|
||||
delete $self->{_toGroup};
|
||||
if ($group) {
|
||||
my $group = WebGUI::Group->new($self->session, $self->{_toGroup});
|
||||
my $group = WebGUI::Group->new($self->session, $group);
|
||||
$self->{_message}->head->replace("bcc", undef);
|
||||
$self->{_message}->head->replace("cc", undef);
|
||||
foreach my $userId (@{$group->getUsers(1,1)}) {
|
||||
|
|
|
|||
|
|
@ -298,6 +298,7 @@ sub www_editUser {
|
|||
my $tabform = WebGUI::TabForm->new($session,\%tabs);
|
||||
|
||||
my $u = WebGUI::User->new($session,($uid eq 'new') ? '' : $uid); #Setting uid to '' when uid is 'new' so visitor defaults prefill field for new user
|
||||
my $username = $u->userId eq '1' ? '' : $u->username;
|
||||
$session->stow->set("editUser_UID", $uid);
|
||||
$session->style->setScript($session->config->get("extrasURL")."/swapLayers.js", {type=>"text/javascript"});
|
||||
$session->style->setRawHeadTags('<script type="text/javascript">var active="'.$u->authMethod.'";</script>');
|
||||
|
|
@ -311,7 +312,7 @@ sub www_editUser {
|
|||
$tabform->getTab("account")->text(
|
||||
-name=>"username",
|
||||
-label=>$i18n->get(50),
|
||||
-value=>$session->form->process("username")|| $u->username
|
||||
-value=>$username
|
||||
);
|
||||
my %status;
|
||||
tie %status, 'Tie::IxHash';
|
||||
|
|
@ -354,7 +355,11 @@ sub www_editUser {
|
|||
foreach my $field (@{$category->getFields}) {
|
||||
next if $field->getId =~ /contentPositions/;
|
||||
my $label = $field->getLabel . ($field->isRequired ? "*" : '');
|
||||
$tabform->getTab("profile")->raw($field->formField({label=>$label},1,$u));
|
||||
if ($field->getId eq "alias" && $u->userId eq '1') {
|
||||
$tabform->getTab("profile")->raw($field->formField({label=>$label},1,undef,1));
|
||||
} else {
|
||||
$tabform->getTab("profile")->raw($field->formField({label=>$label},1,$u));
|
||||
}
|
||||
}
|
||||
$tabform->getTab("profile")->fieldSetEnd($category->getLabel);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -132,6 +132,7 @@ sub formField {
|
|||
my $properties = shift || {};
|
||||
my $withWrapper = shift;
|
||||
my $u = shift;
|
||||
my $skipDefault = shift;
|
||||
$properties->{label} = $self->getLabel unless $properties->{label};
|
||||
$properties->{fieldType} = $self->get("fieldType");
|
||||
$properties->{name} = $self->getId;
|
||||
|
|
@ -143,7 +144,8 @@ sub formField {
|
|||
}
|
||||
$properties->{options} = $orderedValues;
|
||||
my $default;
|
||||
if (defined $self->session->form->process($properties->{name})) {
|
||||
if ($skipDefault) {
|
||||
} elsif (defined $self->session->form->process($properties->{name})) {
|
||||
$default = $self->session->form->process($properties->{name});
|
||||
} elsif (defined $u && defined $u->profileField($properties->{name})) {
|
||||
$default = $u->profileField($properties->{name});
|
||||
|
|
|
|||
|
|
@ -170,7 +170,6 @@ sub error {
|
|||
my $self = shift;
|
||||
my $message = shift;
|
||||
$self->getLogger->error($message);
|
||||
$self->session->output->print("\n\n".$message.":\n".$self->getStackTrace(), 1);
|
||||
$self->getLogger->debug("Stack trace for ERROR ".$message."\n".$self->getStackTrace());
|
||||
$self->session->stow->set("debug_error", $self->session->stow->get("debug_error").$message."\n");
|
||||
}
|
||||
|
|
@ -203,6 +202,7 @@ sub fatal {
|
|||
} else {
|
||||
$self->session->output->print("<h1>WebGUI Fatal Error</h1><p>Something unexpected happened that caused this system to fault.</p>\n",1);
|
||||
$self->session->output->print("<p>".$message."</p>\n",1);
|
||||
$self->session->output->print($self->getStackTrace(), 1);
|
||||
$self->session->output->print($self->showDebug(),1);
|
||||
}
|
||||
$self->session->close();
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ These methods are available from this class:
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 addPost ( parent, class, message, user )
|
||||
=head2 addPost ( parent, class, message, user, prefix )
|
||||
|
||||
Adds a post to this collaboration system.
|
||||
|
||||
|
|
@ -59,6 +59,10 @@ The message retrieved from WebGUI::Mail::Get.
|
|||
|
||||
The user doing the posting.
|
||||
|
||||
=head3 prefix
|
||||
|
||||
The mail prefix for this collaboration system.
|
||||
|
||||
=cut
|
||||
|
||||
sub addPost {
|
||||
|
|
@ -66,6 +70,7 @@ sub addPost {
|
|||
my $parent = shift;
|
||||
my $message = shift;
|
||||
my $user = shift;
|
||||
my $prefix = shift;
|
||||
my @attachments = ();
|
||||
my $content = "";
|
||||
my $class = (ref $parent eq "WebGUI::Asset::Wobject::Collaboration") ? "WebGUI::Asset::Post::Thread" : "WebGUI::Asset::Post";
|
||||
|
|
@ -80,11 +85,26 @@ sub addPost {
|
|||
push(@attachments, $part);
|
||||
}
|
||||
}
|
||||
$prefix =~ s/\\/\\\\/g;
|
||||
$prefix =~ s/\[/\\[/g;
|
||||
$prefix =~ s/\]/\\]/g;
|
||||
$prefix =~ s/\(/\\(/g;
|
||||
$prefix =~ s/\)/\\)/g;
|
||||
$prefix =~ s/\}/\\}/g;
|
||||
$prefix =~ s/\{/\\{/g;
|
||||
$prefix =~ s/\?/\\?/g;
|
||||
$prefix =~ s/\./\\./g;
|
||||
$prefix =~ s/\*/\\*/g;
|
||||
$prefix =~ s/\+/\\+/g;
|
||||
$prefix =~ s/\|/\\|/g;
|
||||
$prefix =~ s/\//\\\//g;
|
||||
my $title = $message->{subject};
|
||||
$title =~ s/$prefix//;
|
||||
my $post = $parent->addChild({
|
||||
className=>$class,
|
||||
title=>$message->{subject},
|
||||
menuTitle => $message->{subject},
|
||||
url=>$message->{subject},
|
||||
title=>$title,
|
||||
menuTitle =>$title,
|
||||
url=>$title,
|
||||
content=>$content,
|
||||
ownerUserId=>$user->userId,
|
||||
username=>$user->profileField("alias") || $user->username,
|
||||
|
|
@ -171,9 +191,9 @@ sub execute {
|
|||
$post = WebGUI::Asset->newByDynamicClass($self->session, $id);
|
||||
}
|
||||
if (defined $post && $cs->get("allowReplies") && $user->isInGroup($cs->get("postGroupId")) && ($user->isInGroup($cs->get("subscriptionGroupId")) || $user->isInGroup($post->get("subscriptionGroupId")))) {
|
||||
$self->addPost($post, $message, $user);
|
||||
$self->addPost($post, $message, $user, $cs->get("mailPrefix"));
|
||||
} elsif ($user->isInGroup($cs->get("postGroupId")) && $user->isInGroup($cs->get("subscriptionGroupId"))) {
|
||||
$self->addPost($cs, $message, $user);
|
||||
$self->addPost($cs, $message, $user, $cs->get("mailPrefix"));
|
||||
} else {
|
||||
my $send = WebGUI::Mail::Send->create($self->session, {
|
||||
to=>$message->{from},
|
||||
|
|
|
|||
|
|
@ -270,9 +270,17 @@ sub run {
|
|||
$self->session->errorHandler->error("Pass in object came back undefined for activity (".$activity->getId.") using ".$class.", ".$method.", ".$params.".");
|
||||
return "error";
|
||||
}
|
||||
$status = $activity->execute($object, $self);
|
||||
$status = eval{$activity->execute($object, $self)};
|
||||
if ($@) {
|
||||
$self->session->errorHandler->error("Caught exception executing workflow activity ".$activity->getId." for instance ".$self->getId." which reported ".$@);
|
||||
return "error";
|
||||
}
|
||||
} else {
|
||||
$status = $activity->execute(undef, $self);
|
||||
if ($@) {
|
||||
$self->session->errorHandler->error("Caught exception executing workflow activity ".$activity->getId." for instance ".$self->getId." which reported ".$@);
|
||||
return "error";
|
||||
}
|
||||
}
|
||||
if ($status eq "complete") {
|
||||
$self->set({"currentActivityId"=>$activity->getId, notifySpectre=>0});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue