diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt index 0b3dd1bf8..bbb942335 100644 --- a/docs/changelog/6.x.x.txt +++ b/docs/changelog/6.x.x.txt @@ -1,4 +1,6 @@ 6.99.0 + - Run on registration and alert on new user have been converted to a single + workflow. - Many changes for better XHTML compliance. - Refactored admin bar to be more dynamic. - Added version tags menu to admin bar. diff --git a/docs/upgrades/upgrade_6.8.7-6.99.0.pl b/docs/upgrades/upgrade_6.8.7-6.99.0.pl index bbb972a22..3995d1bcc 100644 --- a/docs/upgrades/upgrade_6.8.7-6.99.0.pl +++ b/docs/upgrades/upgrade_6.8.7-6.99.0.pl @@ -243,6 +243,9 @@ sub addWorkflow { }, "pbworkflow000000000003"); $activity = $workflow->addActivity("WebGUI::Workflow::Activity::CommitVersionTag", "pbwfactivity0000000006"); $activity->set("title", "Commit Assets"); + $session->setting->remove("alertOnNewUser"); + $session->setting->remove("onNewUserAlertGroup"); + $session->setting->set("runOnRegistration",""); } #------------------------------------------------- diff --git a/lib/WebGUI/Auth.pm b/lib/WebGUI/Auth.pm index 6f8ffa458..36591bee6 100644 --- a/lib/WebGUI/Auth.pm +++ b/lib/WebGUI/Auth.pm @@ -28,6 +28,7 @@ use WebGUI::Utility; use WebGUI::User; use WebGUI::Operation::Shared; use WebGUI::Operation::Profile; +use WebGUI::Workflow::Instance; =head1 NAME @@ -267,10 +268,15 @@ sub createAccountSave { $self->session->var->start($userId,$self->session->getId); $self->_logLogin($userId,"success"); $self->session->http->setStatus(201,"Account Registration Successful"); - my $command = $self->session->setting->get("runOnRegistration"); - WebGUI::Macro::process($self->session,\$command); - system($command) if ($self->session->setting->get("runOnRegistration") ne ""); - WebGUI::MessageLog::addInternationalizedEntry('',$self->session->setting->get("onNewUserAlertGroup"),'',536) if ($self->session->setting->get("alertOnNewUser")); + if ($self->session->setting->get("runOnRegistration")) { + WebGUI::Workflow::Instance->create($self->session, { + workflowId=>$self->session->setting->get("runOnRegistration"), + methodName=>"new", + className=>"WebGUI::User", + parameters=>$self->session->userId, + priority=>1 + }); + } return ""; } diff --git a/lib/WebGUI/Form/Workflow.pm b/lib/WebGUI/Form/Workflow.pm index ae08f5705..5c2f604e0 100644 --- a/lib/WebGUI/Form/Workflow.pm +++ b/lib/WebGUI/Form/Workflow.pm @@ -53,19 +53,23 @@ The identifier for this field. Defaults to "workflowId". =head4 type -The type of workflows to list based upon the object type that will be passed to them "none", "versiontag", etc. If this is omitted, the entire list of workflows will be returned. +The type of workflows to list based upon the object type that will be passed to them "none", "WebGUI::VersionTag", etc. If this is omitted, the entire list of workflows will be returned. =head4 label A text label that will be displayed if toHtmlWithWrapper() is called. Defaults to getName(). +=head4 none + +If set to 1 then a "None" option will appear in the list of workflows, which will store a null value in the field. Defaults to 0. + =cut sub definition { my $class = shift; my $session = shift; my $definition = shift || []; - my $i18n = WebGUI::International->new($session, 'Workflow_Cron'); + my $i18n = WebGUI::International->new($session, 'Workflow'); push(@{$definition}, { formName=>{ defaultValue=>$i18n->get("topicName") @@ -76,9 +80,12 @@ sub definition { name=>{ defaultValue=>"workflowId" }, - namespace=>{ + type=>{ defaultValue=>undef }, + none=>{ + defaulValue=>0 + } }); return $class->SUPER::definition($session, $definition); } @@ -94,6 +101,7 @@ Renders a template picker control. sub toHtml { my $self = shift; my $workflowList = WebGUI::Workflow->getList($self->session, $self->get("type")); + $workflowList->{""} = "None"; $self->set("options", $workflowList); $self->setManageIcons(); return $self->SUPER::toHtml(); @@ -124,7 +132,7 @@ Adds code to the subtext field of the form so that buttons for managing or editi sub setManageIcons { my $self = shift; my $returnUrl = ";proceed=goBackToPage;returnUrl=".$self->session->url->escape($self->session->asset->getUrl) if $self->session->asset; - my $buttons = $self->session->icon->edit("op=editWorkflow".$returnUrl); + my $buttons = $self->session->icon->edit("op=editWorkflow;workflowId=".$self->get("workflowId").$returnUrl) if ($self->get("workflowId")); $buttons .= $self->session->icon->manage("op=manageWorkflows".$returnUrl); $self->set("subtext",$buttons . $self->get("subtext")); } diff --git a/lib/WebGUI/Help/WebGUI.pm b/lib/WebGUI/Help/WebGUI.pm index b330668b8..bfb521ce6 100644 --- a/lib/WebGUI/Help/WebGUI.pm +++ b/lib/WebGUI/Help/WebGUI.pm @@ -344,16 +344,6 @@ our $HELP = { description => '824 description', namespace => 'WebGUI', }, - { - title => '534', - description => '534 description', - namespace => 'WebGUI', - }, - { - title => '535', - description => '535 description', - namespace => 'WebGUI', - }, { title => '400', description => '400 description', diff --git a/lib/WebGUI/Mail/Send.pm b/lib/WebGUI/Mail/Send.pm index 2c675d914..2d8603ffa 100644 --- a/lib/WebGUI/Mail/Send.pm +++ b/lib/WebGUI/Mail/Send.pm @@ -190,7 +190,7 @@ sub new { =head2 send ( ) -Sends the message via SMTP. +Sends the message via SMTP. Returns 1 if successful. =cut @@ -202,6 +202,7 @@ sub send { close(MAIL) or $self->session->errorHandler->error("Couldn't close connection to mail server: ".$self->session->setting->get("smtpServer")); } else { $self->session->errorHandler->error("Couldn't connect to mail server: ".$self->session->setting->get("smtpServer")); + return 0; } } else { my $smtp = Net::SMTP->new($self->session->setting->get("smtpServer")); # connect to an SMTP server @@ -216,8 +217,10 @@ sub send { $smtp->quit; # Close the SMTP connection } else { $self->session->errorHandler->error("Couldn't connect to mail server: ".$self->session->setting->get("smtpServer")); + return 0; } } + return 1; } #------------------------------------------------------------------- diff --git a/lib/WebGUI/Operation/Settings.pm b/lib/WebGUI/Operation/Settings.pm index 3f7f1a983..1020206be 100644 --- a/lib/WebGUI/Operation/Settings.pm +++ b/lib/WebGUI/Operation/Settings.pm @@ -232,7 +232,9 @@ sub www_editSettings { -hoverHelp=>$i18n->get('118 description'), -value=>$session->setting->get("anonymousRegistration") ); - $tabform->getTab("user")->text( + $tabform->getTab("user")->workflow( + -none=>1, + -type=>"WebGUI::User", -name=>"runOnRegistration", -label=>$i18n->get(559), -hoverHelp=>$i18n->get('559 description'), diff --git a/lib/WebGUI/Workflow.pm b/lib/WebGUI/Workflow.pm index 2a3d3a9b9..c4b19231b 100644 --- a/lib/WebGUI/Workflow.pm +++ b/lib/WebGUI/Workflow.pm @@ -238,8 +238,8 @@ sub getList { my $session = shift; my $type = shift; my $sql = "select workflowId, title from Workflow where enabled=1"; - $sql .= " where type=?" if ($type); - return $session->db->buildHashRef($sql, $type); + $sql .= " and type=?" if ($type); + return $session->db->buildHashRef($sql, [$type]); } diff --git a/lib/WebGUI/Workflow/Activity/NotifyAboutUser.pm b/lib/WebGUI/Workflow/Activity/NotifyAboutUser.pm new file mode 100644 index 000000000..b090d26f9 --- /dev/null +++ b/lib/WebGUI/Workflow/Activity/NotifyAboutUser.pm @@ -0,0 +1,109 @@ +package WebGUI::Workflow::Activity::NotifyAboutUser; + + +=head1 LEGAL + + ------------------------------------------------------------------- + WebGUI is Copyright 2001-2006 Plain Black Corporation. + ------------------------------------------------------------------- + Please read the legal notices (docs/legal.txt) and the license + (docs/license.txt) that came with this distribution before using + this software. + ------------------------------------------------------------------- + http://www.plainblack.com info@plainblack.com + ------------------------------------------------------------------- + +=cut + +use strict; +use base 'WebGUI::Workflow::Activity'; +use WebGUI::International; +use WebGUI::Macro; +use WebGUI::Mail::Send; + +=head1 NAME + +Package WebGUI::Workflow::Activity::NotifyAboutUser + +=head1 DESCRIPTION + +Takes a user object and sends out a message. Can use macros in message. + +=head1 SYNOPSIS + +See WebGUI::Workflow::Activity for details on how to use any activity. + +=head1 METHODS + +These methods are available from this class: + +=cut + + +#------------------------------------------------------------------- + +=head2 definition ( session, definition ) + +See WebGUI::Workflow::Activity::defintion() for details. + +=cut + +sub definition { + my $class = shift; + my $session = shift; + my $definition = shift; + my $i18n = WebGUI::International->new($session, "Workflow_Activity_NotifyAboutUser"); + push(@{$definition}, { + name=>$i18n->get("topicName"), + properties=> { + to => { + fieldType=>"text", + label=>$i18n->get("to"), + defaultValue=>$session->setting->get("companyEmail"), + hoverHelp=>$i18n->get("to help") + }, + subject => { + fieldType=>"text", + label=>$i18n->get("subject"), + defaultValue=>undef, + hoverHelp=>$i18n->get("subject help") + }, + message => { + fieldType=>"textarea", + label=>$i18n->get("message"), + defaultValue=>undef, + hoverHelp=>$i18n->get("message help") + }, + } + }); + return $class->SUPER::definition($session,$definition); +} + + +#------------------------------------------------------------------- + +=head2 execute ( [ object ] ) + +See WebGUI::Workflow::Activity::execute() for details. + +=cut + +sub execute { + my $self = shift; + my $user = shift; + $self->session->user({user=>$user}); + my $message = $self->get("message"); + WebGUI::Macro::process(\$message); + my $mail = WebGUI::Mail::Send->new($self->session, { + to=>$self->get("to"), + subject=>$self->get("subject") + }); + $mail->addText($message); + return $mail->send; +} + + + +1; + + diff --git a/lib/WebGUI/Workflow/Activity/RunCommandAsUser.pm b/lib/WebGUI/Workflow/Activity/RunCommandAsUser.pm new file mode 100644 index 000000000..15c9363fc --- /dev/null +++ b/lib/WebGUI/Workflow/Activity/RunCommandAsUser.pm @@ -0,0 +1,95 @@ +package WebGUI::Workflow::Activity::RunCommandAsUser; + + +=head1 LEGAL + + ------------------------------------------------------------------- + WebGUI is Copyright 2001-2006 Plain Black Corporation. + ------------------------------------------------------------------- + Please read the legal notices (docs/legal.txt) and the license + (docs/license.txt) that came with this distribution before using + this software. + ------------------------------------------------------------------- + http://www.plainblack.com info@plainblack.com + ------------------------------------------------------------------- + +=cut + +use strict; +use base 'WebGUI::Workflow::Activity'; +use WebGUI::International; +use WebGUI::Macro; + +=head1 NAME + +Package WebGUI::Workflow::Activity::RunCommandAsUser + +=head1 DESCRIPTION + +This activity will tell the session to switch to the user object passed in as the current user, and then execute a command on the command line of the local operating system. It processes macros so feel free to use macros in the command line. + +=head1 SYNOPSIS + +See WebGUI::Workflow::Activity for details on how to use any activity. + +=head1 METHODS + +These methods are available from this class: + +=cut + + +#------------------------------------------------------------------- + +=head2 definition ( session, definition ) + +See WebGUI::Workflow::Activity::defintion() for details. + +=cut + +sub definition { + my $class = shift; + my $session = shift; + my $definition = shift; + my $i18n = WebGUI::International->new($session, "Workflow_Activity_RunCommandAsUser"); + push(@{$definition}, { + name=>$i18n->get("topicName"), + properties=> { + commandLine => { + fieldType=>"text", + label=>$i18n->get("command"), + defaultValue=>undef, + hoverHelp=>$i18n->get("command help") + }, + } + }); + return $class->SUPER::definition($session,$definition); +} + + +#------------------------------------------------------------------- + +=head2 execute ( [ object ] ) + +See WebGUI::Workflow::Activity::execute() for details. + +=cut + +sub execute { + my $self = shift; + my $user = shift; + my $cmd = $self->get("command"); + $self->session->user({user=>$user}); + WebGUI::Macro::process(\$cmd); + if (system($cmd)) { + return 0; + } else { + return 1; + } +} + + + +1; + + diff --git a/lib/WebGUI/i18n/English.pm b/lib/WebGUI/i18n/English.pm index bd7f2e10e..48a72e6c1 100644 --- a/lib/WebGUI/i18n/English.pm +++ b/lib/WebGUI/i18n/English.pm @@ -5,7 +5,7 @@ use strict; our $LANGUAGE = { label => 'English', - toolbar => 'metal', + toolbar => 'shiny', languageAbbreviation => 'en', # used by plugins such as javascript helpers and third-party perl modules locale => 'US' # same as above }; diff --git a/lib/WebGUI/i18n/English/WebGUI.pm b/lib/WebGUI/i18n/English/WebGUI.pm index dfab31218..b435de632 100644 --- a/lib/WebGUI/i18n/English/WebGUI.pm +++ b/lib/WebGUI/i18n/English/WebGUI.pm @@ -457,11 +457,6 @@ Be aware that any database links you create here will be available to all conten lastUpdated => 1031514049 }, - '536' => { - message => q|A new user named ^@; has joined the site.|, - lastUpdated => 1031514049 - }, - '379' => { message => q|Group ID|, lastUpdated => 1031514049 @@ -512,11 +507,6 @@ Be aware that any database links you create here will be available to all conten lastUpdated => 1031514049 }, - '535' => { - message => q|Group To Alert On New User|, - lastUpdated => 1031514049 - }, - '87' => { message => q|Edit Group|, lastUpdated => 1031514049 @@ -802,11 +792,6 @@ to add or remove users from their groups. lastUpdated => 1036046598 }, - '534' => { - message => q|Alert on new user?|, - lastUpdated => 1031514049 - }, - '400' => { message => q|Prevent Proxy Caching|, lastUpdated => 1031514049 @@ -3519,16 +3504,6 @@ Optionally, if you are running a sendmail server on the same machine as WebGUI, lastUpdated => 1120239343, }, - '534 description' => { - message => q|Should someone be alerted when a new user registers anonymously?|, - lastUpdated => 1120239343, - }, - - '535 description' => { - message => q|What group should be alerted when a new user registers?|, - lastUpdated => 1120239343, - }, - '400 description' => { message => q|Some companies have proxy servers that cause problems with WebGUI. If you're experiencing problems with WebGUI, and you have a proxy server, you may want to set this setting to Yes. Beware that WebGUI's URLs will not be as user-friendly after this feature is turned on.|, lastUpdated => 1120239343, @@ -3550,8 +3525,8 @@ Optionally, if you are running a sendmail server on the same machine as WebGUI, }, '559 description' => { - message => q|If there is a command line specified here, it will be executed each time a user registers anonymously.|, - lastUpdated => 1120239343, + message => q|If there is a workflow chosen here, it will be executed each time a user registers anonymously.|, + lastUpdated => 1141956483, }, '539 description' => { diff --git a/lib/WebGUI/i18n/English/Workflow_Activity_NotifyAboutUser.pm b/lib/WebGUI/i18n/English/Workflow_Activity_NotifyAboutUser.pm new file mode 100644 index 000000000..39c43909b --- /dev/null +++ b/lib/WebGUI/i18n/English/Workflow_Activity_NotifyAboutUser.pm @@ -0,0 +1,48 @@ +package WebGUI::i18n::English::Workflow_Activity_NotifyAboutUser; + +our $I18N = { + 'message help' => { + message => q|Type the message you want to send. Feel free to use macros for additional parameters.|, + context => q|the hover help for the message field|, + lastUpdated => 0, + }, + + 'message' => { + message => q|Message|, + context => q|a label for the message field|, + lastUpdated => 0, + }, + + 'subject help' => { + message => q|The subject of the message that will be sent.|, + context => q|the hover help for the subject field|, + lastUpdated => 0, + }, + + 'subject' => { + message => q|Subject|, + context => q|a label for the subject field|, + lastUpdated => 0, + }, + + 'to help' => { + message => q|The email address to send the message to. You may put in mutliple email addresses seperated by commas.|, + context => q|the hover help for the to field|, + lastUpdated => 0, + }, + + 'to' => { + message => q|To|, + context => q|a label for the to field|, + lastUpdated => 0, + }, + + 'topicName' => { + message => q|Notify About User|, + context => q|The name of this workflow activity.|, + lastUpdated => 0, + }, + +}; + +1; diff --git a/lib/WebGUI/i18n/English/Workflow_Activity_RunCommandAsUser.pm b/lib/WebGUI/i18n/English/Workflow_Activity_RunCommandAsUser.pm new file mode 100644 index 000000000..e8fc06bf6 --- /dev/null +++ b/lib/WebGUI/i18n/English/Workflow_Activity_RunCommandAsUser.pm @@ -0,0 +1,24 @@ +package WebGUI::i18n::English::Workflow_Activity_RunCommandAsUser; + +our $I18N = { + 'command help' => { + message => q|Type the command you wish to run here. Feel free to use macros for additional parameters.|, + context => q|the hover help for the command field|, + lastUpdated => 0, + }, + + 'command' => { + message => q|Command|, + context => q|a label for the command to be run|, + lastUpdated => 0, + }, + + 'topicName' => { + message => q|Run Command As User|, + context => q|The name of this workflow activity.|, + lastUpdated => 0, + }, + +}; + +1; diff --git a/www/extras/toolbar/metal/copy.gif b/www/extras/toolbar/metal/copy.gif deleted file mode 100644 index c1e84178e..000000000 Binary files a/www/extras/toolbar/metal/copy.gif and /dev/null differ diff --git a/www/extras/toolbar/metal/cut.gif b/www/extras/toolbar/metal/cut.gif deleted file mode 100644 index 164750bee..000000000 Binary files a/www/extras/toolbar/metal/cut.gif and /dev/null differ diff --git a/www/extras/toolbar/metal/delete.gif b/www/extras/toolbar/metal/delete.gif deleted file mode 100644 index 8b6214c3c..000000000 Binary files a/www/extras/toolbar/metal/delete.gif and /dev/null differ diff --git a/www/extras/toolbar/metal/drag.gif b/www/extras/toolbar/metal/drag.gif deleted file mode 100644 index 88953bab9..000000000 Binary files a/www/extras/toolbar/metal/drag.gif and /dev/null differ diff --git a/www/extras/toolbar/metal/edit.gif b/www/extras/toolbar/metal/edit.gif deleted file mode 100644 index 06ae51728..000000000 Binary files a/www/extras/toolbar/metal/edit.gif and /dev/null differ diff --git a/www/extras/toolbar/metal/export.gif b/www/extras/toolbar/metal/export.gif deleted file mode 100644 index 77f5b649b..000000000 Binary files a/www/extras/toolbar/metal/export.gif and /dev/null differ diff --git a/www/extras/toolbar/metal/help.gif b/www/extras/toolbar/metal/help.gif deleted file mode 100644 index f2f94c9c3..000000000 Binary files a/www/extras/toolbar/metal/help.gif and /dev/null differ diff --git a/www/extras/toolbar/metal/import.gif b/www/extras/toolbar/metal/import.gif deleted file mode 100644 index fb5ee0cb5..000000000 Binary files a/www/extras/toolbar/metal/import.gif and /dev/null differ diff --git a/www/extras/toolbar/metal/locked.gif b/www/extras/toolbar/metal/locked.gif deleted file mode 100644 index 5878e431c..000000000 Binary files a/www/extras/toolbar/metal/locked.gif and /dev/null differ diff --git a/www/extras/toolbar/metal/manage.gif b/www/extras/toolbar/metal/manage.gif deleted file mode 100644 index 25bfb67af..000000000 Binary files a/www/extras/toolbar/metal/manage.gif and /dev/null differ diff --git a/www/extras/toolbar/metal/moveBottom.gif b/www/extras/toolbar/metal/moveBottom.gif deleted file mode 100644 index b01ba65b5..000000000 Binary files a/www/extras/toolbar/metal/moveBottom.gif and /dev/null differ diff --git a/www/extras/toolbar/metal/moveDown.gif b/www/extras/toolbar/metal/moveDown.gif deleted file mode 100644 index 8c36825a6..000000000 Binary files a/www/extras/toolbar/metal/moveDown.gif and /dev/null differ diff --git a/www/extras/toolbar/metal/moveLeft.gif b/www/extras/toolbar/metal/moveLeft.gif deleted file mode 100644 index 629fa57cb..000000000 Binary files a/www/extras/toolbar/metal/moveLeft.gif and /dev/null differ diff --git a/www/extras/toolbar/metal/moveRight.gif b/www/extras/toolbar/metal/moveRight.gif deleted file mode 100644 index 72678c60a..000000000 Binary files a/www/extras/toolbar/metal/moveRight.gif and /dev/null differ diff --git a/www/extras/toolbar/metal/moveTop.gif b/www/extras/toolbar/metal/moveTop.gif deleted file mode 100644 index 32bd605a9..000000000 Binary files a/www/extras/toolbar/metal/moveTop.gif and /dev/null differ diff --git a/www/extras/toolbar/metal/moveUp.gif b/www/extras/toolbar/metal/moveUp.gif deleted file mode 100644 index feecb49dd..000000000 Binary files a/www/extras/toolbar/metal/moveUp.gif and /dev/null differ diff --git a/www/extras/toolbar/metal/paste.gif b/www/extras/toolbar/metal/paste.gif deleted file mode 100644 index 6eff478ea..000000000 Binary files a/www/extras/toolbar/metal/paste.gif and /dev/null differ diff --git a/www/extras/toolbar/metal/shortcut.gif b/www/extras/toolbar/metal/shortcut.gif deleted file mode 100644 index a853053bf..000000000 Binary files a/www/extras/toolbar/metal/shortcut.gif and /dev/null differ diff --git a/www/extras/toolbar/metal/view.gif b/www/extras/toolbar/metal/view.gif deleted file mode 100644 index d3399076a..000000000 Binary files a/www/extras/toolbar/metal/view.gif and /dev/null differ