- Timestamp:
- 11/23/08 21:47:27 (4 years ago)
- Location:
- trunk/EditTablePlugin/lib/Foswiki
- Files:
-
- 1 edited
- 1 moved
-
. (moved) (moved from trunk/EditTablePlugin/lib/TWiki)
-
Plugins/EditTablePlugin/Core.pm (modified) (46 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/EditTablePlugin/lib/Foswiki/Plugins/EditTablePlugin/Core.pm
r781 r893 1 1 # Plugin for Foswiki - The Free Open Source Wiki, http://foswiki.org/ 2 2 # 3 # Copyright (C) 2008 Arthur Clemens, arthur@visiblearea.com 3 # Copyright (C) 2008 Arthur Clemens, arthur@visiblearea.com and Foswiki contributors 4 4 # Copyright (C) 2002-2007 Peter Thoeny, peter@thoeny.org and 5 5 # TWiki Contributors. … … 19 19 # This is the EditTablePlugin used to edit tables in place. 20 20 21 package TWiki::Plugins::EditTablePlugin::Core;21 package Foswiki::Plugins::EditTablePlugin::Core; 22 22 23 23 use strict; … … 81 81 #my $text = $_[0] 82 82 83 $query = TWiki::Func::getCgiQuery();83 $query = Foswiki::Func::getCgiQuery(); 84 84 if ( ( $query->param('etedit') ) && ( $query->param('ettablenr') ) ) { 85 85 my $paramTableNr = $query->param('ettablenr'); 86 my $tmptable = TWiki::Plugins::EditTable->new();86 my $tmptable = Foswiki::Plugins::EditTable->new(); 87 87 my ( $tablesTakenOutText, @tableTextRefs ) = 88 88 $tmptable->parseText( $_[0] ); … … 129 129 sub process { 130 130 init(); 131 my $saveMode = $ TWiki::Plugins::EditTablePlugin::saveMode{'NONE'};131 my $saveMode = $Foswiki::Plugins::EditTablePlugin::saveMode{'NONE'}; 132 132 my $saveTableNr = 0; 133 my $saveQuietMode = $ TWiki::Plugins::EditTablePlugin::saveMode{'SAVEQUIET'};133 my $saveQuietMode = $Foswiki::Plugins::EditTablePlugin::saveMode{'SAVEQUIET'}; 134 134 processText( $saveMode, $saveTableNr, $saveQuietMode, @_ ); 135 135 } … … 149 149 sub processText { 150 150 151 my $doSave = ( shift == $ TWiki::Plugins::EditTablePlugin::saveMode{'SAVE'} )151 my $doSave = ( shift == $Foswiki::Plugins::EditTablePlugin::saveMode{'SAVE'} ) 152 152 || 0; 153 153 my $saveTableNr = shift; 154 154 my $doSaveQuiet = 155 ( shift == $ TWiki::Plugins::EditTablePlugin::saveMode{'SAVEQUIET'} ) || 0;156 157 $query = TWiki::Func::getCgiQuery();158 159 TWiki::Func::writeDebug(155 ( shift == $Foswiki::Plugins::EditTablePlugin::saveMode{'SAVEQUIET'} ) || 0; 156 157 $query = Foswiki::Func::getCgiQuery(); 158 159 Foswiki::Func::writeDebug( 160 160 "- EditTablePlugin::commonTagsHandler( $_[2].$_[1] )") 161 if $ TWiki::Plugins::EditTablePlugin::debug;161 if $Foswiki::Plugins::EditTablePlugin::debug; 162 162 163 163 unless ($prefsInitialized) { 164 164 $prefCHANGEROWS = 165 TWiki::Func::getPreferencesValue('CHANGEROWS')166 || TWiki::Func::getPreferencesValue('EDITTABLEPLUGIN_CHANGEROWS')165 Foswiki::Func::getPreferencesValue('CHANGEROWS') 166 || Foswiki::Func::getPreferencesValue('EDITTABLEPLUGIN_CHANGEROWS') 167 167 || 'on'; 168 168 $prefQUIETSAVE = 169 TWiki::Func::getPreferencesValue('QUIETSAVE')170 || TWiki::Func::getPreferencesValue('EDITTABLEPLUGIN_QUIETSAVE')169 Foswiki::Func::getPreferencesValue('QUIETSAVE') 170 || Foswiki::Func::getPreferencesValue('EDITTABLEPLUGIN_QUIETSAVE') 171 171 || 'on'; 172 172 $prefEDIT_BUTTON = 173 TWiki::Func::getPreferencesValue('EDIT_BUTTON')174 || TWiki::Func::getPreferencesValue('EDITTABLEPLUGIN_EDIT_BUTTON')173 Foswiki::Func::getPreferencesValue('EDIT_BUTTON') 174 || Foswiki::Func::getPreferencesValue('EDITTABLEPLUGIN_EDIT_BUTTON') 175 175 || 'Edit table'; 176 176 $prefSAVE_BUTTON = 177 TWiki::Func::getPreferencesValue('SAVE_BUTTON')178 || TWiki::Func::getPreferencesValue('EDITTABLEPLUGIN_SAVE_BUTTON')177 Foswiki::Func::getPreferencesValue('SAVE_BUTTON') 178 || Foswiki::Func::getPreferencesValue('EDITTABLEPLUGIN_SAVE_BUTTON') 179 179 || 'Save table'; 180 180 $prefQUIET_SAVE_BUTTON = 181 TWiki::Func::getPreferencesValue('QUIET_SAVE_BUTTON')182 || TWiki::Func::getPreferencesValue(181 Foswiki::Func::getPreferencesValue('QUIET_SAVE_BUTTON') 182 || Foswiki::Func::getPreferencesValue( 183 183 'EDITTABLEPLUGIN_QUIET_SAVE_BUTTON') 184 184 || 'Quiet save'; 185 185 $prefADD_ROW_BUTTON = 186 TWiki::Func::getPreferencesValue('ADD_ROW_BUTTON')187 || TWiki::Func::getPreferencesValue('EDITTABLEPLUGIN_ADD_ROW_BUTTON')186 Foswiki::Func::getPreferencesValue('ADD_ROW_BUTTON') 187 || Foswiki::Func::getPreferencesValue('EDITTABLEPLUGIN_ADD_ROW_BUTTON') 188 188 || 'Add row'; 189 189 $prefDELETE_LAST_ROW_BUTTON = 190 TWiki::Func::getPreferencesValue('DELETE_LAST_ROW_BUTTON')191 || TWiki::Func::getPreferencesValue(190 Foswiki::Func::getPreferencesValue('DELETE_LAST_ROW_BUTTON') 191 || Foswiki::Func::getPreferencesValue( 192 192 'EDITTABLEPLUGIN_DELETE_LAST_ROW_BUTTON') 193 193 || 'Delete last row'; 194 194 $prefCANCEL_BUTTON = 195 TWiki::Func::getPreferencesValue('CANCEL_BUTTON')196 || TWiki::Func::getPreferencesValue('EDITTABLEPLUGIN_CANCEL_BUTTON')195 Foswiki::Func::getPreferencesValue('CANCEL_BUTTON') 196 || Foswiki::Func::getPreferencesValue('EDITTABLEPLUGIN_CANCEL_BUTTON') 197 197 || 'Cancel'; 198 198 $prefMESSAGE_INCLUDED_TOPIC_DOES_NOT_EXIST = 199 TWiki::Func::getPreferencesValue('INCLUDED_TOPIC_DOES_NOT_EXIST')200 || TWiki::Func::getPreferencesValue(199 Foswiki::Func::getPreferencesValue('INCLUDED_TOPIC_DOES_NOT_EXIST') 200 || Foswiki::Func::getPreferencesValue( 201 201 'EDITTABLEPLUGIN_INCLUDED_TOPIC_DOES_NOT_EXIST') 202 202 || 'Warning: \'include\' topic does not exist!'; … … 232 232 my @tableTextRefs; 233 233 if ($doSave) { 234 ( $meta, $topicText ) = TWiki::Func::readTopic( $theWeb, $theTopic );235 $table = TWiki::Plugins::EditTable->new();234 ( $meta, $topicText ) = Foswiki::Func::readTopic( $theWeb, $theTopic ); 235 $table = Foswiki::Plugins::EditTable->new(); 236 236 ( $tablesTakenOutText, @tableTextRefs ) = $table->parseText($topicText); 237 237 } … … 239 239 $topicText = $_[0]; 240 240 if ( !defined $table ) { 241 $table = TWiki::Plugins::EditTable->new();241 $table = Foswiki::Plugins::EditTable->new(); 242 242 ( $tablesTakenOutText, @tableTextRefs ) = 243 243 $table->parseText($topicText); … … 290 290 && ( $theWeb . '.' 291 291 . $theTopic eq 292 "$ TWiki::Plugins::EditTablePlugin::web.$TWiki::Plugins::EditTablePlugin::topic"292 "$Foswiki::Plugins::EditTablePlugin::web.$Foswiki::Plugins::EditTablePlugin::topic" 293 293 ) 294 294 ) … … 299 299 # [Save table] button pressed 300 300 my $theSaveMode = 301 $ TWiki::Plugins::EditTablePlugin::saveMode{'SAVE'};301 $Foswiki::Plugins::EditTablePlugin::saveMode{'SAVE'}; 302 302 my $theSaveQuietMode = 303 $ TWiki::Plugins::EditTablePlugin::saveMode{'NONE'};303 $Foswiki::Plugins::EditTablePlugin::saveMode{'NONE'}; 304 304 305 305 return processText( $theSaveMode, $tableNr, … … 310 310 # [Quiet save] button pressed 311 311 my $theSaveMode = 312 $ TWiki::Plugins::EditTablePlugin::saveMode{'SAVE'};312 $Foswiki::Plugins::EditTablePlugin::saveMode{'SAVE'}; 313 313 my $theSaveQuietMode = 314 $ TWiki::Plugins::EditTablePlugin::saveMode{'SAVEQUIET'};314 $Foswiki::Plugins::EditTablePlugin::saveMode{'SAVEQUIET'}; 315 315 return processText( $theSaveMode, $tableNr, 316 316 $theSaveQuietMode, @_ ); … … 367 367 # match with a TablePlugin line 368 368 # works when TABLE tag is just above OR just below the EDITTABLE tag 369 my %tablePluginParams = TWiki::Func::extractParameters($1);369 my %tablePluginParams = Foswiki::Func::extractParameters($1); 370 370 $headerRowCount = $tablePluginParams{'headerrows'} || 0; 371 371 $footerRowCount = $tablePluginParams{'footerrows'} || 0; … … 586 586 if ($doSave) { 587 587 my $error = 588 TWiki::Func::saveTopic( $theWeb, $theTopic, $meta,588 Foswiki::Func::saveTopic( $theWeb, $theTopic, $meta, 589 589 $tablesTakenOutText, { dontlog => $doSaveQuiet } ); 590 590 591 TWiki::Func::setTopicEditLock( $theWeb, $theTopic, 0 ); # unlock Topic592 my $url = TWiki::Func::getViewUrl( $theWeb, $theTopic );591 Foswiki::Func::setTopicEditLock( $theWeb, $theTopic, 0 ); # unlock Topic 592 my $url = Foswiki::Func::getViewUrl( $theWeb, $theTopic ); 593 593 if ($error) { 594 $url = TWiki::Func::getOopsUrl( $theWeb, $theTopic, 'oopssaveerr',594 $url = Foswiki::Func::getOopsUrl( $theWeb, $theTopic, 'oopssaveerr', 595 595 $error ); 596 596 } 597 TWiki::Func::redirectCgiQuery( $query, $url );597 Foswiki::Func::redirectCgiQuery( $query, $url ); 598 598 return; 599 599 } … … 610 610 my $tmp; 611 611 612 $tmp = TWiki::Func::extractNameValuePair( $theArgs, 'header' );612 $tmp = Foswiki::Func::extractNameValuePair( $theArgs, 'header' ); 613 613 $$theHashRef{'header'} = $tmp if ($tmp); 614 614 615 $tmp = TWiki::Func::extractNameValuePair( $theArgs, 'footer' );615 $tmp = Foswiki::Func::extractNameValuePair( $theArgs, 'footer' ); 616 616 $$theHashRef{'footer'} = $tmp if ($tmp); 617 617 618 $tmp = TWiki::Func::extractNameValuePair( $theArgs, 'headerislabel' );618 $tmp = Foswiki::Func::extractNameValuePair( $theArgs, 'headerislabel' ); 619 619 $$theHashRef{'headerislabel'} = $tmp if ($tmp); 620 620 621 $tmp = TWiki::Func::extractNameValuePair( $theArgs, 'format' );621 $tmp = Foswiki::Func::extractNameValuePair( $theArgs, 'format' ); 622 622 $tmp =~ s/^\s*\|*\s*//o; 623 623 $tmp =~ s/\s*\|*\s*$//o; 624 624 $$theHashRef{'format'} = $tmp if ($tmp); 625 625 626 $tmp = TWiki::Func::extractNameValuePair( $theArgs, 'changerows' );626 $tmp = Foswiki::Func::extractNameValuePair( $theArgs, 'changerows' ); 627 627 $$theHashRef{'changerows'} = $tmp if ($tmp); 628 628 629 $tmp = TWiki::Func::extractNameValuePair( $theArgs, 'quietsave' );629 $tmp = Foswiki::Func::extractNameValuePair( $theArgs, 'quietsave' ); 630 630 $$theHashRef{'quietsave'} = $tmp if ($tmp); 631 631 632 $tmp = TWiki::Func::extractNameValuePair( $theArgs, 'helptopic' );632 $tmp = Foswiki::Func::extractNameValuePair( $theArgs, 'helptopic' ); 633 633 $$theHashRef{'helptopic'} = $tmp if ($tmp); 634 634 635 $tmp = TWiki::Func::extractNameValuePair( $theArgs, 'editbutton' );635 $tmp = Foswiki::Func::extractNameValuePair( $theArgs, 'editbutton' ); 636 636 $$theHashRef{'editbutton'} = $tmp if ($tmp); 637 637 638 $tmp = TWiki::Func::extractNameValuePair( $theArgs, 'javascriptinterface' );638 $tmp = Foswiki::Func::extractNameValuePair( $theArgs, 'javascriptinterface' ); 639 639 $$theHashRef{'javascriptinterface'} = $tmp if ($tmp); 640 640 641 $tmp = TWiki::Func::extractNameValuePair( $theArgs, 'buttonrow' );641 $tmp = Foswiki::Func::extractNameValuePair( $theArgs, 'buttonrow' ); 642 642 $$theHashRef{'buttonrow'} = $tmp if ($tmp); 643 643 … … 662 662 $theFormat =~ s/<nop>//gos; 663 663 $theFormat = 664 TWiki::Func::expandCommonVariables( $theFormat, $theTopic, $theWeb );664 Foswiki::Func::expandCommonVariables( $theFormat, $theTopic, $theWeb ); 665 665 } 666 666 … … 695 695 696 696 # include topic to read definitions 697 my $iTopic = TWiki::Func::extractNameValuePair( $theArgs, 'include' );697 my $iTopic = Foswiki::Func::extractNameValuePair( $theArgs, 'include' ); 698 698 my $iTopicExists = 0; 699 699 if ($iTopic) { … … 703 703 } 704 704 705 $iTopicExists = TWiki::Func::topicExists( $theWeb, $iTopic )705 $iTopicExists = Foswiki::Func::topicExists( $theWeb, $iTopic ) 706 706 if $iTopic ne ''; 707 707 if ( $iTopic && !$iTopicExists ) { … … 710 710 if ($iTopicExists) { 711 711 712 my $text = TWiki::Func::readTopicText( $theWeb, $iTopic );712 my $text = Foswiki::Func::readTopicText( $theWeb, $iTopic ); 713 713 $text =~ /$regex{edit_table_plugin}/os; 714 714 if ($1) { 715 715 my $args = $1; 716 if ( $theWeb ne $ TWiki::Plugins::EditTablePlugin::web717 || $iTopic ne $ TWiki::Plugins::EditTablePlugin::topic )716 if ( $theWeb ne $Foswiki::Plugins::EditTablePlugin::web 717 || $iTopic ne $Foswiki::Plugins::EditTablePlugin::topic ) 718 718 { 719 719 720 720 # expand common vars, unless oneself to prevent recursion 721 $args = TWiki::Func::expandCommonVariables( $1, $iTopic,721 $args = Foswiki::Func::expandCommonVariables( $1, $iTopic, 722 722 $theWeb ); 723 723 } … … 729 729 extractParams( $theArgs, \%params ); 730 730 731 # FIXME: should use TWiki::Func::extractParameters731 # FIXME: should use Foswiki::Func::extractParameters 732 732 $params{'header'} = '' if ( $params{header} =~ /^(off|no)$/oi ); 733 733 $params{'header'} =~ s/^\s*\|//o; … … 760 760 = @_; 761 761 762 my $viewUrl = TWiki::Func::getScriptUrl( $theWeb, $theTopic, 'viewauth' )762 my $viewUrl = Foswiki::Func::getScriptUrl( $theWeb, $theTopic, 'viewauth' ) 763 763 . "\#edittable$theTableNr"; 764 764 my $text = ''; 765 765 if ($doEdit) { 766 require TWiki::Contrib::JSCalendarContrib;766 require Foswiki::Contrib::JSCalendarContrib; 767 767 unless ($@) { 768 TWiki::Contrib::JSCalendarContrib::addHEAD('twiki');768 Foswiki::Contrib::JSCalendarContrib::addHEAD('twiki'); 769 769 } 770 770 } … … 791 791 # pass to javascript (through META tag vars) how many header rows 792 792 # and footer rows we have 793 & TWiki::Plugins::EditTablePlugin::addHeaderAndFooterCountToHead(793 &Foswiki::Plugins::EditTablePlugin::addHeaderAndFooterCountToHead( 794 794 $headerRowCount, $footerRowCount ) 795 795 if ( $doEdit … … 868 868 } 869 869 my $helpText = 870 TWiki::Func::readTopicText( $theWeb, $params{'helptopic'} );870 Foswiki::Func::readTopicText( $theWeb, $params{'helptopic'} ); 871 871 872 872 #Strip out the meta data so it won't be displayed. … … 881 881 # table specific script 882 882 my $tableNr = $query->param('ettablenr'); 883 & TWiki::Plugins::EditTablePlugin::addEditModeHeadersToHead( $tableNr,883 &Foswiki::Plugins::EditTablePlugin::addEditModeHeadersToHead( $tableNr, 884 884 $params{'javascriptinterface'} ); 885 & TWiki::Plugins::EditTablePlugin::addJavaScriptInterfaceDisabledToHead(885 &Foswiki::Plugins::EditTablePlugin::addJavaScriptInterfaceDisabledToHead( 886 886 $tableNr) 887 887 if ( $params{'javascriptinterface'} eq 'off' ); 888 & TWiki::Plugins::EditTablePlugin::addJavaScriptInterfaceDisabledToHead(888 &Foswiki::Plugins::EditTablePlugin::addJavaScriptInterfaceDisabledToHead( 889 889 $tableNr) 890 890 if ( $params{'changerows'} eq '' ); … … 913 913 914 914 sub parseEditCellFormat { 915 $_[1] = TWiki::Func::extractNameValuePair( $_[0] );915 $_[1] = Foswiki::Func::extractNameValuePair( $_[0] ); 916 916 return ''; 917 917 } … … 923 923 sub viewEditCell { 924 924 my ($theAttr) = @_; 925 $theAttr = TWiki::Func::extractNameValuePair($theAttr);925 $theAttr = Foswiki::Func::extractNameValuePair($theAttr); 926 926 return '' unless ( $theAttr =~ /^editbutton/ ); 927 927 … … 1014 1014 if ( $type eq 'select' ) { 1015 1015 my $expandedValue = 1016 TWiki::Func::expandCommonVariables( $theValue, $theTopic, $theWeb );1016 Foswiki::Func::expandCommonVariables( $theValue, $theTopic, $theWeb ); 1017 1017 $size = 1 if $size < 1; 1018 1018 $text = … … 1041 1041 elsif ( $type eq "radio" ) { 1042 1042 my $expandedValue = 1043 & TWiki::Func::expandCommonVariables( $theValue, $theTopic, $theWeb );1043 &Foswiki::Func::expandCommonVariables( $theValue, $theTopic, $theWeb ); 1044 1044 $size = 1 if $size < 1; 1045 1045 my $elements = ( @bits - 2 ); … … 1080 1080 elsif ( $type eq "checkbox" ) { 1081 1081 my $expandedValue = 1082 & TWiki::Func::expandCommonVariables( $theValue, $theTopic, $theWeb );1082 &Foswiki::Func::expandCommonVariables( $theValue, $theTopic, $theWeb ); 1083 1083 $size = 1 if $size < 1; 1084 1084 my $elements = ( @bits - 2 ); … … 1145 1145 unless ( defined $table and $digestedCellValue ) { 1146 1146 1147 # To deal with the situation where TWiki variables, like1147 # To deal with the situation where Foswiki variables, like 1148 1148 # %CALC%, have already been processed and end up getting saved 1149 1149 # in the table that way (processed), we need to read in the 1150 1150 # topic page in raw format 1151 my $topicContents = TWiki::Func::readTopicText(1152 $ TWiki::Plugins::EditTablePlugin::web,1153 $ TWiki::Plugins::EditTablePlugin::topic1151 my $topicContents = Foswiki::Func::readTopicText( 1152 $Foswiki::Plugins::EditTablePlugin::web, 1153 $Foswiki::Plugins::EditTablePlugin::topic 1154 1154 ); 1155 $table = TWiki::Plugins::EditTable->new();1155 $table = Foswiki::Plugins::EditTable->new(); 1156 1156 $table->parseText($topicContents); 1157 1157 } … … 1161 1161 : $rawValue; 1162 1162 $theValue = $cell if ( defined $cell ); # original value from file 1163 TWiki::Plugins::EditTablePlugin::encodeValue($theValue)1163 Foswiki::Plugins::EditTablePlugin::encodeValue($theValue) 1164 1164 unless ( $theValue eq '' ); 1165 1165 … … 1174 1174 $rows |= 3 if !defined $rows; 1175 1175 $cols |= 30 if !defined $cols; 1176 TWiki::Plugins::EditTablePlugin::encodeValue($theValue)1176 Foswiki::Plugins::EditTablePlugin::encodeValue($theValue) 1177 1177 unless ( $theValue eq '' ); 1178 1178 $text .= … … 1184 1184 my $ifFormat = ''; 1185 1185 $ifFormat = $bits[3] if ( @bits > 3 ); 1186 $ifFormat ||= $ TWiki::cfg{JSCalendarContrib}{format} || '%e %B %Y';1186 $ifFormat ||= $Foswiki::cfg{JSCalendarContrib}{format} || '%e %B %Y'; 1187 1187 $size = 10 if ( !$size || $size < 1 ); 1188 TWiki::Plugins::EditTablePlugin::encodeValue($theValue)1188 Foswiki::Plugins::EditTablePlugin::encodeValue($theValue) 1189 1189 unless ( $theValue eq '' ); 1190 1190 $text .= CGI::textfield( … … 1199 1199 ); 1200 1200 $text .= saveEditCellFormat( $cellFormat, $theName ); 1201 eval 'use TWiki::Contrib::JSCalendarContrib';1201 eval 'use Foswiki::Contrib::JSCalendarContrib'; 1202 1202 1203 1203 unless ($@) { … … 1207 1207 -name => 'calendar', 1208 1208 -onclick => "return showCalendar('id$theName','$ifFormat')", 1209 -src => TWiki::Func::getPubUrlPath() . '/'1210 . TWiki::Func::getTwikiWebname()1209 -src => Foswiki::Func::getPubUrlPath() . '/' 1210 . Foswiki::Func::getTwikiWebname() 1211 1211 . '/JSCalendarContrib/img.gif', 1212 1212 -alt => 'Calendar', … … 1219 1219 else { # if( $type eq 'text') 1220 1220 $size = $DEFAULT_FIELD_SIZE if $size < 1; 1221 TWiki::Plugins::EditTablePlugin::encodeValue($theValue)1221 Foswiki::Plugins::EditTablePlugin::encodeValue($theValue) 1222 1222 unless ( $theValue eq '' ); 1223 1223 $text = … … 1377 1377 1378 1378 # render final value in view mode (not edit or save) 1379 TWiki::Plugins::EditTablePlugin::decodeFormatTokens($text)1379 Foswiki::Plugins::EditTablePlugin::decodeFormatTokens($text) 1380 1380 if ( !$doSave && !$doEdit ); 1381 1381 … … 1410 1410 my ( $theWeb, $theTopic ) = @_; 1411 1411 1412 TWiki::Func::writeDebug(1412 Foswiki::Func::writeDebug( 1413 1413 "- EditTablePlugin::doCancelEdit( $theWeb, $theTopic )") 1414 if $ TWiki::Plugins::EditTablePlugin::debug;1415 1416 TWiki::Func::setTopicEditLock( $theWeb, $theTopic, 0 );1417 1418 TWiki::Func::redirectCgiQuery( $query,1419 TWiki::Func::getViewUrl( $theWeb, $theTopic ) );1414 if $Foswiki::Plugins::EditTablePlugin::debug; 1415 1416 Foswiki::Func::setTopicEditLock( $theWeb, $theTopic, 0 ); 1417 1418 Foswiki::Func::redirectCgiQuery( $query, 1419 Foswiki::Func::getViewUrl( $theWeb, $theTopic ) ); 1420 1420 } 1421 1421 … … 1427 1427 my ( $theWeb, $theTopic, $doCheckIfLocked ) = @_; 1428 1428 1429 TWiki::Func::writeDebug(1429 Foswiki::Func::writeDebug( 1430 1430 "- EditTablePlugin::doEnableEdit( $theWeb, $theTopic )") 1431 if $ TWiki::Plugins::EditTablePlugin::debug;1432 1433 my $wikiUserName = TWiki::Func::getWikiName();1431 if $Foswiki::Plugins::EditTablePlugin::debug; 1432 1433 my $wikiUserName = Foswiki::Func::getWikiName(); 1434 1434 if ( 1435 ! TWiki::Func::checkAccessPermission(1435 !Foswiki::Func::checkAccessPermission( 1436 1436 'change', $wikiUserName, undef, $theTopic, $theWeb 1437 1437 ) … … 1440 1440 1441 1441 # user has no permission to change the topic 1442 throw TWiki::OopsException(1442 throw Foswiki::OopsException( 1443 1443 'accessdenied', 1444 1444 def => 'topic_access', … … 1452 1452 unless ($breakLock) { 1453 1453 my ( $oopsUrl, $lockUser ) = 1454 TWiki::Func::checkTopicEditLock( $theWeb, $theTopic, 'view' );1454 Foswiki::Func::checkTopicEditLock( $theWeb, $theTopic, 'view' ); 1455 1455 if ($oopsUrl) { 1456 my $loginUser = TWiki::Func::wikiToUserName($wikiUserName);1456 my $loginUser = Foswiki::Func::wikiToUserName($wikiUserName); 1457 1457 if ( $lockUser ne $loginUser ) { 1458 1458 … … 1463 1463 # add info of the edited table 1464 1464 my $params = ''; 1465 $query = TWiki::Func::getCgiQuery();1465 $query = Foswiki::Func::getCgiQuery(); 1466 1466 $params .= ';ettablenr=' . $query->param('ettablenr'); 1467 1467 $params .= ';etedit=on'; … … 1469 1469 1470 1470 # warn user that other person is editing this topic 1471 TWiki::Func::redirectCgiQuery( $query, $oopsUrl );1471 Foswiki::Func::redirectCgiQuery( $query, $oopsUrl ); 1472 1472 return 0; 1473 1473 } … … 1476 1476 1477 1477 # We are allowed to edit 1478 TWiki::Func::setTopicEditLock( $theWeb, $theTopic, 1 );1478 Foswiki::Func::setTopicEditLock( $theWeb, $theTopic, 1 ); 1479 1479 1480 1480 return 1; … … 1502 1502 =cut 1503 1503 1504 package TWiki::Plugins::EditTable;1504 package Foswiki::Plugins::EditTable; 1505 1505 1506 1506 use vars qw( … … 1586 1586 1587 1587 # EDITTABLE and TABLE on one line (order does not matter) 1588 TWiki::Plugins::EditTablePlugin::Core::putTmpTagInTableTagLine(1588 Foswiki::Plugins::EditTablePlugin::Core::putTmpTagInTableTagLine( 1589 1589 $_); 1590 1590 $inEditTable = 1; … … 1600 1600 1601 1601 # store the TABLE tag from the previous line together with the current EDITTABLE tag 1602 TWiki::Plugins::EditTablePlugin::Core::putTmpTagInTableTagLine(1602 Foswiki::Plugins::EditTablePlugin::Core::putTmpTagInTableTagLine( 1603 1603 $storedTableRow); 1604 1604 $editTableTag .= $storedTableRow . "\n"; … … 1615 1615 # TABLE on the line after EDITTABLE 1616 1616 # we will include it in the editTableTag 1617 TWiki::Plugins::EditTablePlugin::Core::putTmpTagInTableTagLine(1617 Foswiki::Plugins::EditTablePlugin::Core::putTmpTagInTableTagLine( 1618 1618 $_); 1619 1619 $doCopyLine = 0;
Note: See TracChangeset
for help on using the changeset viewer.
