• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item6077: SendEmailPlugin: add support for TWiki-5, fix to send emails to login names

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Extension SendEmailPlugin Enhancement Closed   n/a  

Edit Form Data

Summary:
Reported By:
Codebase:
Applies To:
Component:
Priority:
Current State:
Waiting For:
Target Release:
Released In:
 

Detail

In TWiki-5, the way cgi scripts are called has changed completely. Those plugins that ship with a cgi script need to do two things

1rst, create a separate cgi, e.g. sendemail-5. That's then the one to use on TWiki-5, as it is currently available on svn/trunk.

2nd, the plugin has to add the cgi handler to the SwitchBoard, adding the following line to LocalSite.cfg:

$TWiki::cfg{SwitchBoard}{sendemail} = ['TWiki::Plugins::SendEmailPlugin::Core, 'sendemail', {sendemail => 1}];

A better place to register the cgi is to add it to the BEGIN block of your plugin:

BEGIN {
$TWiki::cfg{SwitchBoard}{sendemail} = ['TWiki::Plugins::SendEmailPlugin::Core, 'sendemail', {sendemail => 1}];
}

An even better way to do it would be to have something like the following in your initPlugin():

TWiki::Func::registerCgiHandler('sendemail', \&TWiki::Plugins::SendEmailPlugin::handleSendEmail);

and add lazy compilation again implementing:

sub handleSendEmail {
   require TWiki::Plugins::SendEmailPlugin::Core;
   TWiki::Plugins::SendEmailPlugin::Core::sendemail(@_);
}

Adding a registerCgiHandler() however would need a bit of a redesign of the SwitchBoard logic.

-- TWiki:Main/MichaelDaum - 17 Oct 2008

I solved this in a single cgi script (publish) using the TWiki 5.0 view as a template and the following modification:

if (defined $TWiki::engine) {
    # TWiki >= 5.0
    $TWiki::cfg{SwitchBoard}->{publish} =
      [ 'TWiki::Contrib::Publish', 'publish', { publish => 1 } ];
    $TWiki::engine->run();
} else {
    # TWiki < 5.0
    TWiki::UI::run( \&TWiki::Contrib::Publish::publish );
}

-- CrawfordCurrie - 17 Oct 2008

That does not work with twiki_(fast)cgi.pl Here's a slew of switchboard entries that I currently added to LocalSite.cfg

$TWiki::cfg{SwitchBoard}{natsearch} = ['TWiki::Plugins::NatSkinPlugin::Search', 'searchCgi', {natsearch => 1}];
$TWiki::cfg{SwitchBoard}{plucsearch} = ['TWiki::Contrib::SearchEnginePluceneAddOn', 'searchCgi', {plucsearch => 1}];
$TWiki::cfg{SwitchBoard}{xmlrpc} = ['TWiki::Contrib::XmlRpcContrib', 'dispatch', {xmlrpc => 1}];
$TWiki::cfg{SwitchBoard}{rtf} = ['TWiki::Contrib::RtfContrib', 'export', {rtf => 1}] ;
$TWiki::cfg{SwitchBoard}{publish} = ['TWiki::Contrib::Publish', 'publish', {publish => 1}] ;
$TWiki::cfg{SwitchBoard}{compare} = ['TWiki::UI::Compare', 'compare', {compare => 1}] ;
$TWiki::cfg{SwitchBoard}{genpdf} = ['TWiki::Contrib::GenPDF', 'viewPDF', {genpdf => 1}] ;
$TWiki::cfg{SwitchBoard}{convert} = ['TWiki::Contrib::OpenOffice2TWikiAddOn', 'convert', {convert => 1}];
$TWiki::cfg{SwitchBoard}{sendemail} = ['TWiki::Plugins::SendEmailPlugin::Core', 'sendEmail', {sendemail => 1}];
$TWiki::cfg{SwitchBoard}{topics2excel} = ['TWiki::Plugins::ExcelImportExportPlugin::Export', 'topics2excel', {topics2excel => 1}];
$TWiki::cfg{SwitchBoard}{table2excel} = ['TWiki::Plugins::ExcelImportExportPlugin::Export', 'table2excel', {table2excel => 1}];
$TWiki::cfg{SwitchBoard}{excel2topics} = ['TWiki::Plugins::ExcelImportExportPlugin::Import', 'excel2topics', {excel2topics => 1}];
$TWiki::cfg{SwitchBoard}{uploadexcel2table} = ['TWiki::Plugins::ExcelImportExportPlugin::Import', 'uploadexcel2table', {uploadexcel2table => 1}];

As you see: pretty ugly, but works.

-- TWiki:Main.MichaelDaum - 17 Oct 2008

This discussion has to be picked up elsewhere. For now I close this bug as the plugin has been fixed.

-- TWiki:Main.MichaelDaum - 17 Oct 2008

Updated MANIFEST.

-- TWiki:Main.ArthurClemens - 17 Oct 2008

ItemTemplate
Summary SendEmailPlugin: add support for TWiki-5, fix to send emails to login names
ReportedBy TWiki:Main.MichaelDaum
Codebase

SVN Range TWiki-5.0.0, Sun, 05 Oct 2008, build 17588
AppliesTo Extension
Component SendEmailPlugin
Priority Enhancement
CurrentState Closed
WaitingFor

Checkins TWikirev:17661 TWikirev:17663 TWikirev:17666
TargetRelease n/a
ReleasedIn

Edit | Attach | Watch | Print version | History: r7 < r6 < r5 < r4 < r3 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r7 - 2008-10-17 - ArthurClemens
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback