[Home]WikiPatches/CustomAction

UseModWiki | WikiPatches | RecentChanges | Preferences

Custom Action

Short description

You can pass custom values from a form etc to another wiki site. Simply add two hidden fields named "action" and "id" to your form and everything should get passed alright. Actually I don't think this patch can be of any use without WikiPatches/EmbeddedCode.

Example:

  <form action="wiki.pl">
  <input type="hidden" name="action" value="custom" />
  <input type="hidden" name="id" value="FormReceivingSite?" />
  <input type="text" name="name" value="John" />
  </form>

How to apply

After line 3126:

    } elsif ($action eq "links") {
    &DoLinks();

(or somewhere around there, obviously) insert:

    } elsif ($action eq "custom") {
      &Custom();

and then insert somewhere inside the script:

  
sub Custom {

    my @Params;
    my $id = $q->param( 'id' );
    push( @Params, $id );
    for ( $q->param() ) {
        push( @Params, $_ . '=' . $q->param( $_ ) ) unless $_ eq 'action' or $_ eq 'id';
    }
    $FullUrl .= '?' . join( '&', @Params );
    my $Text = &GetParam("text", undef);
    &OpenPage($id);
    &OpenDefaultText();
    my $fullHtml = &GetHeader($id, &QuoteHtml($id));
    $fullHtml .= '<div class=wikitext>';
    $fullHtml .= &WikiToHTML($Text{'text'}, $id);
    $fullHtml .= '</div>';
    $fullHtml .= &GetFooterText($id);
    print $fullHtml;
  }

That should do the job, hopefully. --UdoGüngerich, 2005-08-22


UseModWiki | WikiPatches | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited October 22, 2007 8:44 pm by JuanmaMP (diff)
Search: