--- EditTablePlugin.pm 17 Jun 2004 07:43:43 -0000 1.2 +++ EditTablePlugin.pm 18 Aug 2004 15:51:05 -0000 1.9 @@ -116,6 +116,16 @@ $tmp = &TWiki::Func::extractNameValuePair( $theArgs, "editbutton" ); $$theHashRef{"editbutton"} = $tmp if( $tmp ); + + $tmp = &TWiki::Func::extractNameValuePair( $theArgs, "keywordmove" ); + $$theHashRef{"keywordmove"} = $tmp if( $tmp ); + + $tmp = &TWiki::Func::extractNameValuePair( $theArgs, "moverows" ); + $$theHashRef{"moverows"} = $tmp if( $tmp ); + + $tmp = &TWiki::Func::extractNameValuePair( $theArgs, "keywordlock" ); + $$theHashRef{"keywordlock"} = $tmp if( $tmp ); + return; } @@ -225,8 +235,9 @@ $rowNr--; next; } - s/^(\s*)\|(.*)/&handleTableRow( $1, $2, $tableNr, $cgiRows, $rowNr, $doEdit, 0 )/eo; + s/^(\s*)\|(.*)/&handleTableRow( $1, $2, $tableNr, $cgiRows, $rowNr, $doEdit, 0 )/eo + unless ( $params{"keywordlock"} and /\|\s+($params{"keywordlock"})\s+\|/ ); } elsif( $insideTable ) { # end of table $insideTable = 0; @@ -349,6 +360,10 @@ "quietsave" => $prefQUIETSAVE, "helptopic" => "", "editbutton" => "", + "moverows" => "", + "keywordmove" => "", + "keywordlock" => "", + ); my $iTopic = &TWiki::Func::extractNameValuePair( $theArgs, "include" ); @@ -713,6 +728,9 @@ my $insideTable = 0; my $doSave = 0; my $result = ""; + my $append=""; + my $topicAppend=""; + foreach( split( /\n/, $text ) ) { if( /%EDITTABLE{(.*)}%/o ) { $tableNr += 1; @@ -730,7 +748,10 @@ next; } s/^(\s*)\|(.*)/&handleTableRow( $1, $2, $tableNr, $cgiRows, $rowNr, 1, 1 )/eo; - + if ( $params{"keywordmove"} and /\|\s+($params{"keywordmove"})\s+\|/ ) { + if ( $append ) { $append .= "\n$_"; } else { $append = "$_"; } + next; + } } elsif( $insideTable ) { $insideTable = 0; if( $rowNr < $cgiRows ) { @@ -741,6 +762,12 @@ } $doSave = 0; $rowNr = 0; + if ( $append and $params{"keywordmove"} ) { + if ( $params{"moverows"} =~ /^after$/oi) { $result .= "\n$append"; } + if ( $params{"moverows"} =~ /^end$/oi) { $result .= "$append\n"; } + if ( $params{"moverows"} =~ /^topicend$/oi) { $topicAppend .= "$append\n"; } + } + $append=""; } if( /^\s*$/ ) { # empty line if( $doSave ) { @@ -762,7 +789,7 @@ $result .= "$_\n"; } - my $error = &TWiki::Func::saveTopicText( $theWeb, $theTopic, $result, "", $quiet ); + my $error = &TWiki::Func::saveTopicText( $theWeb, $theTopic, $result.$topicAppend, "", $quiet ); TWiki::Func::setTopicEditLock( $theWeb, $theTopic, 0 ); # unlock Topic my $url = &TWiki::Func::getViewUrl( $theWeb, $theTopic ); if( $error ) {