Changeset 893
- Timestamp:
- 11/23/08 21:47:27 (3 years ago)
- Location:
- trunk/EditTablePlugin
- Files:
-
- 6 edited
- 3 moved
-
data/System (moved) (moved from trunk/EditTablePlugin/data/TWiki)
-
data/System/EditTablePlugin.txt (modified) (7 diffs)
-
data/System/VarEDITTABLE.txt (modified) (1 diff)
-
lib/Foswiki (moved) (moved from trunk/EditTablePlugin/lib/TWiki)
-
lib/Foswiki/Plugins/EditTablePlugin.pm (modified) (14 diffs)
-
lib/Foswiki/Plugins/EditTablePlugin/Core.pm (modified) (46 diffs)
-
lib/Foswiki/Plugins/EditTablePlugin/MANIFEST (modified) (1 diff)
-
lib/Foswiki/Plugins/EditTablePlugin/build.pl (modified) (1 diff)
-
pub/System (moved) (moved from trunk/EditTablePlugin/pub/TWiki)
Legend:
- Unmodified
- Added
- Removed
-
trunk/EditTablePlugin/data/System/EditTablePlugin.txt
r886 r893 2 2 ---+!! Edit Table Plugin 3 3 4 Edit TWikitables in place, using edit fields and drop down boxes, without having to edit the complete topic.4 Edit tables in place, using edit fields and drop down boxes, without having to edit the complete topic. 5 5 6 6 Simply add an *[ Edit table ]* button to an existing table by writing =%<nop>EDITTABLE{}%= directly above the table. This can be added to tables that are formatted with TablePlugin: add the =EDITTABLE= macro just above or below the =TABLE= tag. It can also be used without any =TABLE= tag. … … 75 75 %RED% __Note:__ Please do not save this example table! Use Foswiki:Sandbox.EditTablePluginTesting if you want to try out this Plugin %ENDCOLOR% 76 76 77 If this plugin is installed you will see an *[ Edit table ]* button above; if you were to click on it (please don't, use TWiki:Sandbox.EditTablePluginTesting for testing)you get this form:77 If this plugin is installed you will see an *[ Edit table ]* button above; if you were to click on it you get this form: 78 78 79 79 <a name="edittable1"></a> … … 113 113 </div><!-- /editTable --> 114 114 115 The following example shows a simple table with key/value rows. The default edit field type for the value column is a text field. This is overloaded by a selector for the Gender, and a date picker for the DOB. This is typically used by TWiki applications where new topics with tables are created based on a template topic.115 The following example shows a simple table with key/value rows. The default edit field type for the value column is a text field. This is overloaded by a selector for the Gender, and a date picker for the DOB. This is typically used by Foswiki applications where new topics with tables are created based on a template topic. 116 116 117 117 <table style="background:#f2f2f2;" cellpadding="6"> … … 153 153 154 154 * One line description, shown in the %SYSTEMWEB%.TextFormattingRules topic: 155 * Set SHORTDESCRIPTION = Edit TWikitables using edit fields, date pickers and drop down boxes155 * Set SHORTDESCRIPTION = Edit tables using edit fields, date pickers and drop down boxes 156 156 157 157 * Set DEBUG to 1 to get debug messages in =data/debug.txt=. Default: =0= … … 183 183 ---++ Limitations and Known Issues 184 184 185 * This Plugin does not support TWikitable formatting like Multi-span cells (e.g. =| ... ||=) and cell justification (e.g. =| centered | right |=)185 * This Plugin does not support table formatting like Multi-span cells (e.g. =| ... ||=) and cell justification (e.g. =| centered | right |=) 186 186 * There is a performance issue when editing a large table, say, with more then 50 rows 187 187 * You cannot put two =%<nop>EDITTABLE{}%= statements on the same line in the source … … 199 199 %$DEPENDENCIES% 200 200 * The Plugin depends on the =viewauth= script to authenticate the user. As described in %SYSTEMWEB%.AccessControl, copy the =view= script to =viewauth= (or better, create a symbolic link) and add =viewauth= to the list of authenticated scripts in the =.htaccess= file. 201 * (Dakar) Visit =configure= in your TWikiinstallation, and enable the plugin in the {Plugins} section.201 * Visit =configure= in your installation, and enable the plugin in the {Plugins} section. 202 202 * Test if the Plugin is correctly installed: 203 203 * Check above example if there is an *[ Edit table ]* button below the table in above example … … 211 211 ---++ Plugin Info 212 212 213 | Copyright: | © 200 2-2007 TWiki Contributors, TWiki:Main.PeterThoeny; © 2008, Arthur Clemens|213 | Copyright: | © 2008, Arthur Clemens and Foswiki Contributors; © 2002-2007 TWiki Contributors, TWiki:Main.PeterThoeny | 214 214 | License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) | 215 | Plugin Version: | 4. 9 (01Nov 2008) |215 | Plugin Version: | 4.10 (23 Nov 2008) | 216 216 | Change History: | <!-- specify latest version first --> | 217 217 | 01 Nov 2008: | 4.9: Arthur Clemens: Fixed rendering of =verbatim= blocks when editing. Added parameter =buttonrow="top"= to allow the buttons to be positioned at the top of the table. | -
trunk/EditTablePlugin/data/System/VarEDITTABLE.txt
r693 r893 2 2 %META:TOPICPARENT{name="Macros"}% 3 3 #VarEDITTABLE 4 ---+++ EDITTABLE{ _attributes_ } -- edit TWikitables using edit fields and other input fields4 ---+++ EDITTABLE{ _attributes_ } -- edit tables using edit fields and other input fields 5 5 * The =%<nop>EDITTABLE{}%= macro is handled by the EditTablePlugin 6 6 * Syntax: =%<nop>EDITTABLE{ _attributes_ }%= -
trunk/EditTablePlugin/lib/Foswiki/Plugins/EditTablePlugin.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 TWiki 5 5 # Contributors. … … 19 19 # This is the EditTablePlugin used to edit tables in place. 20 20 21 package TWiki::Plugins::EditTablePlugin;21 package Foswiki::Plugins::EditTablePlugin; 22 22 23 23 use strict; … … 29 29 ); 30 30 31 # This should always be $Rev: 17303 $ so that TWiki can determine the checked-in31 # This should always be $Rev: 17303 $ so that Foswiki can determine the checked-in 32 32 # status of the plugin. It is used by the build automation tools, so 33 33 # you should leave it alone. … … 49 49 50 50 # check for Plugins.pm versions 51 if ( $ TWiki::Plugins::VERSION < 1.026 ) {52 TWiki::Func::writeWarning(51 if ( $Foswiki::Plugins::VERSION < 1.026 ) { 52 Foswiki::Func::writeWarning( 53 53 "Version mismatch between EditTablePlugin and Plugins.pm"); 54 54 return 0; 55 55 } 56 56 57 $query = TWiki::Func::getCgiQuery();57 $query = Foswiki::Func::getCgiQuery(); 58 58 if ( !$query ) { 59 59 return 0; … … 61 61 62 62 # Get plugin debug flag 63 $debug = TWiki::Func::getPreferencesFlag('EDITTABLEPLUGIN_DEBUG');63 $debug = Foswiki::Func::getPreferencesFlag('EDITTABLEPLUGIN_DEBUG'); 64 64 $usesJavascriptInterface = 65 TWiki::Func::getPreferencesFlag('EDITTABLEPLUGIN_JAVASCRIPTINTERFACE');65 Foswiki::Func::getPreferencesFlag('EDITTABLEPLUGIN_JAVASCRIPTINTERFACE'); 66 66 $viewModeHeaderDone = 0; 67 67 $editModeHeaderDone = 0; … … 69 69 70 70 # Plugin correctly initialized 71 TWiki::Func::writeDebug(72 "- TWiki::Plugins::EditTablePlugin::initPlugin( $web.$topic ) is OK")71 Foswiki::Func::writeDebug( 72 "- Foswiki::Plugins::EditTablePlugin::initPlugin( $web.$topic ) is OK") 73 73 if $debug; 74 74 … … 78 78 sub beforeCommonTagsHandler { 79 79 return unless $_[0] =~ /%EDIT(TABLE|CELL){(.*)}%/os; 80 require TWiki::Plugins::EditTablePlugin::Core;81 TWiki::Plugins::EditTablePlugin::Core::protectVariables(80 require Foswiki::Plugins::EditTablePlugin::Core; 81 Foswiki::Plugins::EditTablePlugin::Core::protectVariables( 82 82 $_[0] ); 83 83 } … … 87 87 88 88 addViewModeHeadersToHead(); 89 require TWiki::Plugins::EditTablePlugin::Core;90 TWiki::Plugins::EditTablePlugin::Core::process( $_[0], $_[1], $_[2], $topic,89 require Foswiki::Plugins::EditTablePlugin::Core; 90 Foswiki::Plugins::EditTablePlugin::Core::process( $_[0], $_[1], $_[2], $topic, 91 91 $web ); 92 92 } … … 123 123 return if ( !$_[0] ); 124 124 $_[0] =~ s/\$n\(\)/\n/gos; # expand '$n()' to new line 125 my $alpha = TWiki::Func::getRegularExpression('mixedAlpha');125 my $alpha = Foswiki::Func::getRegularExpression('mixedAlpha'); 126 126 $_[0] =~ s/\$n([^$alpha]|$)/\n$1/gos; # expand '$n' to new line 127 127 $_[0] =~ s/\$nop(\(\))?//gos; # remove filler, useful for nested search … … 147 147 </style> 148 148 EOF 149 TWiki::Func::addToHEAD( 'EDITTABLEPLUGIN', $header );149 Foswiki::Func::addToHEAD( 'EDITTABLEPLUGIN', $header ); 150 150 } 151 151 … … 162 162 if !$usesJavascriptInterface && ( $paramJavascriptInterface ne 'on' ); 163 163 164 require TWiki::Contrib::BehaviourContrib;165 TWiki::Contrib::BehaviourContrib::addHEAD();164 require Foswiki::Contrib::BehaviourContrib; 165 Foswiki::Contrib::BehaviourContrib::addHEAD(); 166 166 167 167 $editModeHeaderDone = 1; … … 181 181 EOF 182 182 183 TWiki::Func::addToHEAD( 'EDITTABLEPLUGIN', $header );183 Foswiki::Func::addToHEAD( 'EDITTABLEPLUGIN', $header ); 184 184 } 185 185 … … 193 193 . $tableId . '" />'; 194 194 $header .= "\n"; 195 TWiki::Func::addToHEAD( 'EDITTABLEPLUGIN_NO_JAVASCRIPTINTERFACE', $header );195 Foswiki::Func::addToHEAD( 'EDITTABLEPLUGIN_NO_JAVASCRIPTINTERFACE', $header ); 196 196 } 197 197 … … 205 205 . $footerCount . '" />'; 206 206 $header .= "\n"; 207 TWiki::Func::addToHEAD( 'EDITTABLEPLUGIN_HEADERFOOTERCOUNT', $header );207 Foswiki::Func::addToHEAD( 'EDITTABLEPLUGIN_HEADERFOOTERCOUNT', $header ); 208 208 } 209 209 -
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; -
trunk/EditTablePlugin/lib/Foswiki/Plugins/EditTablePlugin/MANIFEST
r14 r893 1 data/ TWiki/EditTablePlugin.txt 06442 data/ TWiki/VarEDITTABLE.txt 06443 lib/ TWiki/Plugins/EditTablePlugin.pm 04444 lib/ TWiki/Plugins/EditTablePlugin/Core.pm 04445 pub/ TWiki/EditTablePlugin/btn_delete_disabled.gif 06446 pub/ TWiki/EditTablePlugin/btn_delete_over.gif 06447 pub/ TWiki/EditTablePlugin/btn_delete.gif 06448 pub/ TWiki/EditTablePlugin/btn_move_disabled.gif 06449 pub/ TWiki/EditTablePlugin/btn_move_over.gif 064410 pub/ TWiki/EditTablePlugin/btn_move.gif 064411 pub/ TWiki/EditTablePlugin/edittable.css 064412 pub/ TWiki/EditTablePlugin/edittable.gif 064413 pub/ TWiki/EditTablePlugin/edittable.js 064414 pub/ TWiki/EditTablePlugin/EditTablePluginCalendarExample.gif 064415 pub/ TWiki/EditTablePlugin/img.gif 064416 pub/ TWiki/EditTablePlugin/menuarrow.gif 064417 pub/ TWiki/EditTablePlugin/ScreenshotEditCell1.gif 064418 pub/ TWiki/EditTablePlugin/ScreenshotEditCell2.gif 064419 pub/ TWiki/EditTablePlugin/separator_bg_anim.gif 06441 data/System/EditTablePlugin.txt 0644 2 data/System/VarEDITTABLE.txt 0644 3 lib/Foswiki/Plugins/EditTablePlugin.pm 0444 4 lib/Foswiki/Plugins/EditTablePlugin/Core.pm 0444 5 pub/System/EditTablePlugin/btn_delete_disabled.gif 0644 6 pub/System/EditTablePlugin/btn_delete_over.gif 0644 7 pub/System/EditTablePlugin/btn_delete.gif 0644 8 pub/System/EditTablePlugin/btn_move_disabled.gif 0644 9 pub/System/EditTablePlugin/btn_move_over.gif 0644 10 pub/System/EditTablePlugin/btn_move.gif 0644 11 pub/System/EditTablePlugin/edittable.css 0644 12 pub/System/EditTablePlugin/edittable.gif 0644 13 pub/System/EditTablePlugin/edittable.js 0644 14 pub/System/EditTablePlugin/EditTablePluginCalendarExample.gif 0644 15 pub/System/EditTablePlugin/img.gif 0644 16 pub/System/EditTablePlugin/menuarrow.gif 0644 17 pub/System/EditTablePlugin/ScreenshotEditCell1.gif 0644 18 pub/System/EditTablePlugin/ScreenshotEditCell2.gif 0644 19 pub/System/EditTablePlugin/separator_bg_anim.gif 0644 -
trunk/EditTablePlugin/lib/Foswiki/Plugins/EditTablePlugin/build.pl
r14 r893 9 9 } 10 10 11 use TWiki::Contrib::Build;11 use Foswiki::Contrib::Build; 12 12 13 13 # Create the build object 14 $build = new TWiki::Contrib::Build( 'EditTablePlugin' );14 $build = new Foswiki::Contrib::Build( 'EditTablePlugin' ); 15 15 16 16 # Build the target on the command line, or the default target
Note: See TracChangeset
for help on using the changeset viewer.
