Changeset 893


Ignore:
Timestamp:
11/23/08 21:47:27 (3 years ago)
Author:
ArthurClemens
Message:

Item265: update EditTablePlugin to Foswiki

Location:
trunk/EditTablePlugin
Files:
6 edited
3 moved

Legend:

Unmodified
Added
Removed
  • trunk/EditTablePlugin/data/System/EditTablePlugin.txt

    r886 r893  
    22---+!! Edit Table Plugin 
    33 
    4 Edit TWiki tables in place, using edit fields and drop down boxes, without having to edit the complete topic.  
     4Edit tables in place, using edit fields and drop down boxes, without having to edit the complete topic.  
    55 
    66Simply add an *[&nbsp;Edit&nbsp;table&nbsp;]* 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. 
     
    7575%RED% __Note:__ Please do not save this example table! Use Foswiki:Sandbox.EditTablePluginTesting if you want to try out this Plugin %ENDCOLOR% 
    7676 
    77 If this plugin is installed you will see an *[&nbsp;Edit&nbsp;table&nbsp;]* button above; if you were to click on it (please don't, use TWiki:Sandbox.EditTablePluginTesting for testing) you get this form: 
     77If this plugin is installed you will see an *[&nbsp;Edit&nbsp;table&nbsp;]* button above; if you were to click on it you get this form: 
    7878 
    7979<a name="edittable1"></a> 
     
    113113</div><!-- /editTable --> 
    114114 
    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. 
     115The 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. 
    116116 
    117117<table style="background:#f2f2f2;" cellpadding="6"> 
     
    153153 
    154154   * One line description, shown in the %SYSTEMWEB%.TextFormattingRules topic: 
    155       * Set SHORTDESCRIPTION = Edit TWiki tables using edit fields, date pickers and drop down boxes 
     155      * Set SHORTDESCRIPTION = Edit tables using edit fields, date pickers and drop down boxes 
    156156 
    157157   * Set DEBUG to 1 to get debug messages in =data/debug.txt=.  Default: =0= 
     
    183183---++ Limitations and Known Issues 
    184184 
    185    * This Plugin does not support TWiki table 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 |=) 
    186186   * There is a performance issue when editing a large table, say, with more then 50 rows 
    187187   * You cannot put two =%<nop>EDITTABLE{}%= statements on the same line in the source 
     
    199199      %$DEPENDENCIES% 
    200200   * 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 TWiki installation, and enable the plugin in the {Plugins} section. 
     201   * Visit =configure= in your installation, and enable the plugin in the {Plugins} section. 
    202202   * Test if the Plugin is correctly installed: 
    203203      * Check above example if there is an *[&nbsp;Edit&nbsp;table&nbsp;]* button below the table in above example 
     
    211211---++ Plugin Info 
    212212 
    213 |  Copyright: | &copy; 2002-2007 TWiki Contributors, TWiki:Main.PeterThoeny; &copy; 2008, Arthur Clemens |  
     213|  Copyright: | &copy; 2008, Arthur Clemens and Foswiki Contributors; &copy; 2002-2007 TWiki Contributors, TWiki:Main.PeterThoeny |  
    214214|  License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) | 
    215 |  Plugin Version: | 4.9 (01 Nov 2008) | 
     215|  Plugin Version: | 4.10 (23 Nov 2008) | 
    216216|  Change History: | <!-- specify latest version first -->&nbsp; | 
    217217|  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  
    22%META:TOPICPARENT{name="Macros"}% 
    33#VarEDITTABLE 
    4 ---+++ EDITTABLE{ _attributes_ } -- edit TWiki tables using edit fields and other input fields 
     4---+++ EDITTABLE{ _attributes_ } -- edit tables using edit fields and other input fields 
    55   * The =%<nop>EDITTABLE{}%= macro is handled by the EditTablePlugin 
    66   * Syntax: =%<nop>EDITTABLE{ _attributes_ }%= 
  • trunk/EditTablePlugin/lib/Foswiki/Plugins/EditTablePlugin.pm

    r781 r893  
    11# Plugin for Foswiki - The Free Open Source Wiki, http://foswiki.org/ 
    22# 
    3 # Copyright (C) 2008 Arthur Clemens, arthur@visiblearea.com 
     3# Copyright (C) 2008 Arthur Clemens, arthur@visiblearea.com and Foswiki contributors 
    44# Copyright (C) 2002-2007 Peter Thoeny, peter@thoeny.org and TWiki 
    55# Contributors. 
     
    1919# This is the EditTablePlugin used to edit tables in place. 
    2020 
    21 package TWiki::Plugins::EditTablePlugin; 
     21package Foswiki::Plugins::EditTablePlugin; 
    2222 
    2323use strict; 
     
    2929); 
    3030 
    31 # This should always be $Rev: 17303 $ so that TWiki can determine the checked-in 
     31# This should always be $Rev: 17303 $ so that Foswiki can determine the checked-in 
    3232# status of the plugin. It is used by the build automation tools, so 
    3333# you should leave it alone. 
     
    4949 
    5050    # 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( 
    5353            "Version mismatch between EditTablePlugin and Plugins.pm"); 
    5454        return 0; 
    5555    } 
    5656 
    57     $query = TWiki::Func::getCgiQuery(); 
     57    $query = Foswiki::Func::getCgiQuery(); 
    5858    if ( !$query ) { 
    5959        return 0; 
     
    6161 
    6262    # Get plugin debug flag 
    63     $debug = TWiki::Func::getPreferencesFlag('EDITTABLEPLUGIN_DEBUG'); 
     63    $debug = Foswiki::Func::getPreferencesFlag('EDITTABLEPLUGIN_DEBUG'); 
    6464    $usesJavascriptInterface = 
    65       TWiki::Func::getPreferencesFlag('EDITTABLEPLUGIN_JAVASCRIPTINTERFACE'); 
     65      Foswiki::Func::getPreferencesFlag('EDITTABLEPLUGIN_JAVASCRIPTINTERFACE'); 
    6666    $viewModeHeaderDone = 0; 
    6767    $editModeHeaderDone = 0; 
     
    6969 
    7070    # 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") 
    7373      if $debug; 
    7474 
     
    7878sub beforeCommonTagsHandler { 
    7979    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( 
    8282        $_[0] ); 
    8383} 
     
    8787 
    8888    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, 
    9191        $web ); 
    9292} 
     
    123123    return if ( !$_[0] ); 
    124124    $_[0] =~ s/\$n\(\)/\n/gos;               # expand '$n()' to new line 
    125     my $alpha = TWiki::Func::getRegularExpression('mixedAlpha'); 
     125    my $alpha = Foswiki::Func::getRegularExpression('mixedAlpha'); 
    126126    $_[0] =~ s/\$n([^$alpha]|$)/\n$1/gos;    # expand '$n' to new line 
    127127    $_[0] =~ s/\$nop(\(\))?//gos;      # remove filler, useful for nested search 
     
    147147</style> 
    148148EOF 
    149     TWiki::Func::addToHEAD( 'EDITTABLEPLUGIN', $header ); 
     149    Foswiki::Func::addToHEAD( 'EDITTABLEPLUGIN', $header ); 
    150150} 
    151151 
     
    162162      if !$usesJavascriptInterface && ( $paramJavascriptInterface ne 'on' ); 
    163163 
    164     require TWiki::Contrib::BehaviourContrib; 
    165     TWiki::Contrib::BehaviourContrib::addHEAD(); 
     164    require Foswiki::Contrib::BehaviourContrib; 
     165    Foswiki::Contrib::BehaviourContrib::addHEAD(); 
    166166 
    167167    $editModeHeaderDone = 1; 
     
    181181EOF 
    182182 
    183     TWiki::Func::addToHEAD( 'EDITTABLEPLUGIN', $header ); 
     183    Foswiki::Func::addToHEAD( 'EDITTABLEPLUGIN', $header ); 
    184184} 
    185185 
     
    193193      . $tableId . '" />'; 
    194194    $header .= "\n"; 
    195     TWiki::Func::addToHEAD( 'EDITTABLEPLUGIN_NO_JAVASCRIPTINTERFACE', $header ); 
     195    Foswiki::Func::addToHEAD( 'EDITTABLEPLUGIN_NO_JAVASCRIPTINTERFACE', $header ); 
    196196} 
    197197 
     
    205205      . $footerCount . '" />'; 
    206206    $header .= "\n"; 
    207     TWiki::Func::addToHEAD( 'EDITTABLEPLUGIN_HEADERFOOTERCOUNT', $header ); 
     207    Foswiki::Func::addToHEAD( 'EDITTABLEPLUGIN_HEADERFOOTERCOUNT', $header ); 
    208208} 
    209209 
  • trunk/EditTablePlugin/lib/Foswiki/Plugins/EditTablePlugin/Core.pm

    r781 r893  
    11# Plugin for Foswiki - The Free Open Source Wiki, http://foswiki.org/ 
    22# 
    3 # Copyright (C) 2008 Arthur Clemens, arthur@visiblearea.com 
     3# Copyright (C) 2008 Arthur Clemens, arthur@visiblearea.com and Foswiki contributors 
    44# Copyright (C) 2002-2007 Peter Thoeny, peter@thoeny.org and 
    55# TWiki Contributors. 
     
    1919# This is the EditTablePlugin used to edit tables in place. 
    2020 
    21 package TWiki::Plugins::EditTablePlugin::Core; 
     21package Foswiki::Plugins::EditTablePlugin::Core; 
    2222 
    2323use strict; 
     
    8181    #my $text = $_[0] 
    8282 
    83     $query = TWiki::Func::getCgiQuery(); 
     83    $query = Foswiki::Func::getCgiQuery(); 
    8484    if ( ( $query->param('etedit') ) && ( $query->param('ettablenr') ) ) { 
    8585        my $paramTableNr = $query->param('ettablenr'); 
    86         my $tmptable     = TWiki::Plugins::EditTable->new(); 
     86        my $tmptable     = Foswiki::Plugins::EditTable->new(); 
    8787        my ( $tablesTakenOutText, @tableTextRefs ) = 
    8888          $tmptable->parseText( $_[0] ); 
     
    129129sub process { 
    130130    init(); 
    131     my $saveMode      = $TWiki::Plugins::EditTablePlugin::saveMode{'NONE'}; 
     131    my $saveMode      = $Foswiki::Plugins::EditTablePlugin::saveMode{'NONE'}; 
    132132    my $saveTableNr   = 0; 
    133     my $saveQuietMode = $TWiki::Plugins::EditTablePlugin::saveMode{'SAVEQUIET'}; 
     133    my $saveQuietMode = $Foswiki::Plugins::EditTablePlugin::saveMode{'SAVEQUIET'}; 
    134134    processText( $saveMode, $saveTableNr, $saveQuietMode, @_ ); 
    135135} 
     
    149149sub processText { 
    150150 
    151     my $doSave = ( shift == $TWiki::Plugins::EditTablePlugin::saveMode{'SAVE'} ) 
     151    my $doSave = ( shift == $Foswiki::Plugins::EditTablePlugin::saveMode{'SAVE'} ) 
    152152      || 0; 
    153153    my $saveTableNr = shift; 
    154154    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( 
    160160        "- EditTablePlugin::commonTagsHandler( $_[2].$_[1] )") 
    161       if $TWiki::Plugins::EditTablePlugin::debug; 
     161      if $Foswiki::Plugins::EditTablePlugin::debug; 
    162162 
    163163    unless ($prefsInitialized) { 
    164164        $prefCHANGEROWS = 
    165              TWiki::Func::getPreferencesValue('CHANGEROWS') 
    166           || TWiki::Func::getPreferencesValue('EDITTABLEPLUGIN_CHANGEROWS') 
     165             Foswiki::Func::getPreferencesValue('CHANGEROWS') 
     166          || Foswiki::Func::getPreferencesValue('EDITTABLEPLUGIN_CHANGEROWS') 
    167167          || 'on'; 
    168168        $prefQUIETSAVE = 
    169              TWiki::Func::getPreferencesValue('QUIETSAVE') 
    170           || TWiki::Func::getPreferencesValue('EDITTABLEPLUGIN_QUIETSAVE') 
     169             Foswiki::Func::getPreferencesValue('QUIETSAVE') 
     170          || Foswiki::Func::getPreferencesValue('EDITTABLEPLUGIN_QUIETSAVE') 
    171171          || 'on'; 
    172172        $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') 
    175175          || 'Edit table'; 
    176176        $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') 
    179179          || 'Save table'; 
    180180        $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( 
    183183            'EDITTABLEPLUGIN_QUIET_SAVE_BUTTON') 
    184184          || 'Quiet save'; 
    185185        $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') 
    188188          || 'Add row'; 
    189189        $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( 
    192192            'EDITTABLEPLUGIN_DELETE_LAST_ROW_BUTTON') 
    193193          || 'Delete last row'; 
    194194        $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') 
    197197          || 'Cancel'; 
    198198        $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( 
    201201            'EDITTABLEPLUGIN_INCLUDED_TOPIC_DOES_NOT_EXIST') 
    202202          || 'Warning: \'include\' topic does not exist!'; 
     
    232232    my @tableTextRefs; 
    233233    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(); 
    236236        ( $tablesTakenOutText, @tableTextRefs ) = $table->parseText($topicText); 
    237237    } 
     
    239239        $topicText = $_[0]; 
    240240        if ( !defined $table ) { 
    241             $table = TWiki::Plugins::EditTable->new(); 
     241            $table = Foswiki::Plugins::EditTable->new(); 
    242242            ( $tablesTakenOutText, @tableTextRefs ) = 
    243243              $table->parseText($topicText); 
     
    290290                && (  $theWeb . '.' 
    291291                    . $theTopic eq 
    292 "$TWiki::Plugins::EditTablePlugin::web.$TWiki::Plugins::EditTablePlugin::topic" 
     292"$Foswiki::Plugins::EditTablePlugin::web.$Foswiki::Plugins::EditTablePlugin::topic" 
    293293                ) 
    294294              ) 
     
    299299                    # [Save table] button pressed 
    300300                    my $theSaveMode = 
    301                       $TWiki::Plugins::EditTablePlugin::saveMode{'SAVE'}; 
     301                      $Foswiki::Plugins::EditTablePlugin::saveMode{'SAVE'}; 
    302302                    my $theSaveQuietMode = 
    303                       $TWiki::Plugins::EditTablePlugin::saveMode{'NONE'}; 
     303                      $Foswiki::Plugins::EditTablePlugin::saveMode{'NONE'}; 
    304304 
    305305                    return processText( $theSaveMode, $tableNr, 
     
    310310                    # [Quiet save] button pressed 
    311311                    my $theSaveMode = 
    312                       $TWiki::Plugins::EditTablePlugin::saveMode{'SAVE'}; 
     312                      $Foswiki::Plugins::EditTablePlugin::saveMode{'SAVE'}; 
    313313                    my $theSaveQuietMode = 
    314                       $TWiki::Plugins::EditTablePlugin::saveMode{'SAVEQUIET'}; 
     314                      $Foswiki::Plugins::EditTablePlugin::saveMode{'SAVEQUIET'}; 
    315315                    return processText( $theSaveMode, $tableNr, 
    316316                        $theSaveQuietMode, @_ ); 
     
    367367            # match with a TablePlugin line 
    368368            # 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); 
    370370            $headerRowCount = $tablePluginParams{'headerrows'} || 0; 
    371371            $footerRowCount = $tablePluginParams{'footerrows'} || 0; 
     
    586586    if ($doSave) { 
    587587        my $error = 
    588           TWiki::Func::saveTopic( $theWeb, $theTopic, $meta, 
     588          Foswiki::Func::saveTopic( $theWeb, $theTopic, $meta, 
    589589            $tablesTakenOutText, { dontlog => $doSaveQuiet } ); 
    590590 
    591         TWiki::Func::setTopicEditLock( $theWeb, $theTopic, 0 );   # unlock Topic 
    592         my $url = TWiki::Func::getViewUrl( $theWeb, $theTopic ); 
     591        Foswiki::Func::setTopicEditLock( $theWeb, $theTopic, 0 );   # unlock Topic 
     592        my $url = Foswiki::Func::getViewUrl( $theWeb, $theTopic ); 
    593593        if ($error) { 
    594             $url = TWiki::Func::getOopsUrl( $theWeb, $theTopic, 'oopssaveerr', 
     594            $url = Foswiki::Func::getOopsUrl( $theWeb, $theTopic, 'oopssaveerr', 
    595595                $error ); 
    596596        } 
    597         TWiki::Func::redirectCgiQuery( $query, $url ); 
     597        Foswiki::Func::redirectCgiQuery( $query, $url ); 
    598598        return; 
    599599    } 
     
    610610    my $tmp; 
    611611 
    612     $tmp = TWiki::Func::extractNameValuePair( $theArgs, 'header' ); 
     612    $tmp = Foswiki::Func::extractNameValuePair( $theArgs, 'header' ); 
    613613    $$theHashRef{'header'} = $tmp if ($tmp); 
    614614 
    615     $tmp = TWiki::Func::extractNameValuePair( $theArgs, 'footer' ); 
     615    $tmp = Foswiki::Func::extractNameValuePair( $theArgs, 'footer' ); 
    616616    $$theHashRef{'footer'} = $tmp if ($tmp); 
    617617 
    618     $tmp = TWiki::Func::extractNameValuePair( $theArgs, 'headerislabel' ); 
     618    $tmp = Foswiki::Func::extractNameValuePair( $theArgs, 'headerislabel' ); 
    619619    $$theHashRef{'headerislabel'} = $tmp if ($tmp); 
    620620 
    621     $tmp = TWiki::Func::extractNameValuePair( $theArgs, 'format' ); 
     621    $tmp = Foswiki::Func::extractNameValuePair( $theArgs, 'format' ); 
    622622    $tmp =~ s/^\s*\|*\s*//o; 
    623623    $tmp =~ s/\s*\|*\s*$//o; 
    624624    $$theHashRef{'format'} = $tmp if ($tmp); 
    625625 
    626     $tmp = TWiki::Func::extractNameValuePair( $theArgs, 'changerows' ); 
     626    $tmp = Foswiki::Func::extractNameValuePair( $theArgs, 'changerows' ); 
    627627    $$theHashRef{'changerows'} = $tmp if ($tmp); 
    628628 
    629     $tmp = TWiki::Func::extractNameValuePair( $theArgs, 'quietsave' ); 
     629    $tmp = Foswiki::Func::extractNameValuePair( $theArgs, 'quietsave' ); 
    630630    $$theHashRef{'quietsave'} = $tmp if ($tmp); 
    631631 
    632     $tmp = TWiki::Func::extractNameValuePair( $theArgs, 'helptopic' ); 
     632    $tmp = Foswiki::Func::extractNameValuePair( $theArgs, 'helptopic' ); 
    633633    $$theHashRef{'helptopic'} = $tmp if ($tmp); 
    634634 
    635     $tmp = TWiki::Func::extractNameValuePair( $theArgs, 'editbutton' ); 
     635    $tmp = Foswiki::Func::extractNameValuePair( $theArgs, 'editbutton' ); 
    636636    $$theHashRef{'editbutton'} = $tmp if ($tmp); 
    637637 
    638     $tmp = TWiki::Func::extractNameValuePair( $theArgs, 'javascriptinterface' ); 
     638    $tmp = Foswiki::Func::extractNameValuePair( $theArgs, 'javascriptinterface' ); 
    639639    $$theHashRef{'javascriptinterface'} = $tmp if ($tmp); 
    640640 
    641     $tmp = TWiki::Func::extractNameValuePair( $theArgs, 'buttonrow' ); 
     641    $tmp = Foswiki::Func::extractNameValuePair( $theArgs, 'buttonrow' ); 
    642642    $$theHashRef{'buttonrow'} = $tmp if ($tmp); 
    643643 
     
    662662        $theFormat =~ s/<nop>//gos; 
    663663        $theFormat = 
    664           TWiki::Func::expandCommonVariables( $theFormat, $theTopic, $theWeb ); 
     664          Foswiki::Func::expandCommonVariables( $theFormat, $theTopic, $theWeb ); 
    665665    } 
    666666 
     
    695695 
    696696    # include topic to read definitions 
    697     my $iTopic = TWiki::Func::extractNameValuePair( $theArgs, 'include' ); 
     697    my $iTopic = Foswiki::Func::extractNameValuePair( $theArgs, 'include' ); 
    698698    my $iTopicExists = 0; 
    699699    if ($iTopic) { 
     
    703703        } 
    704704 
    705         $iTopicExists = TWiki::Func::topicExists( $theWeb, $iTopic ) 
     705        $iTopicExists = Foswiki::Func::topicExists( $theWeb, $iTopic ) 
    706706          if $iTopic ne ''; 
    707707        if ( $iTopic && !$iTopicExists ) { 
     
    710710        if ($iTopicExists) { 
    711711 
    712             my $text = TWiki::Func::readTopicText( $theWeb, $iTopic ); 
     712            my $text = Foswiki::Func::readTopicText( $theWeb, $iTopic ); 
    713713            $text =~ /$regex{edit_table_plugin}/os; 
    714714            if ($1) { 
    715715                my $args = $1; 
    716                 if (   $theWeb ne $TWiki::Plugins::EditTablePlugin::web 
    717                     || $iTopic ne $TWiki::Plugins::EditTablePlugin::topic ) 
     716                if (   $theWeb ne $Foswiki::Plugins::EditTablePlugin::web 
     717                    || $iTopic ne $Foswiki::Plugins::EditTablePlugin::topic ) 
    718718                { 
    719719 
    720720                    # expand common vars, unless oneself to prevent recursion 
    721                     $args = TWiki::Func::expandCommonVariables( $1, $iTopic, 
     721                    $args = Foswiki::Func::expandCommonVariables( $1, $iTopic, 
    722722                        $theWeb ); 
    723723                } 
     
    729729    extractParams( $theArgs, \%params ); 
    730730 
    731     # FIXME: should use TWiki::Func::extractParameters 
     731    # FIXME: should use Foswiki::Func::extractParameters 
    732732    $params{'header'} = '' if ( $params{header} =~ /^(off|no)$/oi ); 
    733733    $params{'header'} =~ s/^\s*\|//o; 
     
    760760      = @_; 
    761761 
    762     my $viewUrl = TWiki::Func::getScriptUrl( $theWeb, $theTopic, 'viewauth' ) 
     762    my $viewUrl = Foswiki::Func::getScriptUrl( $theWeb, $theTopic, 'viewauth' ) 
    763763      . "\#edittable$theTableNr"; 
    764764    my $text = ''; 
    765765    if ($doEdit) { 
    766         require TWiki::Contrib::JSCalendarContrib; 
     766        require Foswiki::Contrib::JSCalendarContrib; 
    767767        unless ($@) { 
    768             TWiki::Contrib::JSCalendarContrib::addHEAD('twiki'); 
     768            Foswiki::Contrib::JSCalendarContrib::addHEAD('twiki'); 
    769769        } 
    770770    } 
     
    791791    # pass to javascript (through META tag vars) how many header rows 
    792792    # and footer rows we have 
    793     &TWiki::Plugins::EditTablePlugin::addHeaderAndFooterCountToHead( 
     793    &Foswiki::Plugins::EditTablePlugin::addHeaderAndFooterCountToHead( 
    794794        $headerRowCount, $footerRowCount ) 
    795795      if ( $doEdit 
     
    868868            } 
    869869            my $helpText = 
    870               TWiki::Func::readTopicText( $theWeb, $params{'helptopic'} ); 
     870              Foswiki::Func::readTopicText( $theWeb, $params{'helptopic'} ); 
    871871 
    872872            #Strip out the meta data so it won't be displayed. 
     
    881881        # table specific script 
    882882        my $tableNr = $query->param('ettablenr'); 
    883         &TWiki::Plugins::EditTablePlugin::addEditModeHeadersToHead( $tableNr, 
     883        &Foswiki::Plugins::EditTablePlugin::addEditModeHeadersToHead( $tableNr, 
    884884            $params{'javascriptinterface'} ); 
    885         &TWiki::Plugins::EditTablePlugin::addJavaScriptInterfaceDisabledToHead( 
     885        &Foswiki::Plugins::EditTablePlugin::addJavaScriptInterfaceDisabledToHead( 
    886886            $tableNr) 
    887887          if ( $params{'javascriptinterface'} eq 'off' ); 
    888         &TWiki::Plugins::EditTablePlugin::addJavaScriptInterfaceDisabledToHead( 
     888        &Foswiki::Plugins::EditTablePlugin::addJavaScriptInterfaceDisabledToHead( 
    889889            $tableNr) 
    890890          if ( $params{'changerows'} eq '' ); 
     
    913913 
    914914sub parseEditCellFormat { 
    915     $_[1] = TWiki::Func::extractNameValuePair( $_[0] ); 
     915    $_[1] = Foswiki::Func::extractNameValuePair( $_[0] ); 
    916916    return ''; 
    917917} 
     
    923923sub viewEditCell { 
    924924    my ($theAttr) = @_; 
    925     $theAttr = TWiki::Func::extractNameValuePair($theAttr); 
     925    $theAttr = Foswiki::Func::extractNameValuePair($theAttr); 
    926926    return '' unless ( $theAttr =~ /^editbutton/ ); 
    927927 
     
    10141014    if ( $type eq 'select' ) { 
    10151015        my $expandedValue = 
    1016           TWiki::Func::expandCommonVariables( $theValue, $theTopic, $theWeb ); 
     1016          Foswiki::Func::expandCommonVariables( $theValue, $theTopic, $theWeb ); 
    10171017        $size = 1 if $size < 1; 
    10181018        $text = 
     
    10411041    elsif ( $type eq "radio" ) { 
    10421042        my $expandedValue = 
    1043           &TWiki::Func::expandCommonVariables( $theValue, $theTopic, $theWeb ); 
     1043          &Foswiki::Func::expandCommonVariables( $theValue, $theTopic, $theWeb ); 
    10441044        $size = 1 if $size < 1; 
    10451045        my $elements = ( @bits - 2 ); 
     
    10801080    elsif ( $type eq "checkbox" ) { 
    10811081        my $expandedValue = 
    1082           &TWiki::Func::expandCommonVariables( $theValue, $theTopic, $theWeb ); 
     1082          &Foswiki::Func::expandCommonVariables( $theValue, $theTopic, $theWeb ); 
    10831083        $size = 1 if $size < 1; 
    10841084        my $elements = ( @bits - 2 ); 
     
    11451145        unless ( defined $table and $digestedCellValue ) { 
    11461146 
    1147             # To deal with the situation where TWiki variables, like 
     1147            # To deal with the situation where Foswiki variables, like 
    11481148            # %CALC%, have already been processed and end up getting saved 
    11491149            # in the table that way (processed), we need to read in the 
    11501150            # topic page in raw format 
    1151             my $topicContents = TWiki::Func::readTopicText( 
    1152                 $TWiki::Plugins::EditTablePlugin::web, 
    1153                 $TWiki::Plugins::EditTablePlugin::topic 
     1151            my $topicContents = Foswiki::Func::readTopicText( 
     1152                $Foswiki::Plugins::EditTablePlugin::web, 
     1153                $Foswiki::Plugins::EditTablePlugin::topic 
    11541154            ); 
    1155             $table = TWiki::Plugins::EditTable->new(); 
     1155            $table = Foswiki::Plugins::EditTable->new(); 
    11561156            $table->parseText($topicContents); 
    11571157        } 
     
    11611161          : $rawValue; 
    11621162        $theValue = $cell if ( defined $cell );    # original value from file 
    1163         TWiki::Plugins::EditTablePlugin::encodeValue($theValue) 
     1163        Foswiki::Plugins::EditTablePlugin::encodeValue($theValue) 
    11641164          unless ( $theValue eq '' ); 
    11651165 
     
    11741174        $rows |= 3  if !defined $rows; 
    11751175        $cols |= 30 if !defined $cols; 
    1176         TWiki::Plugins::EditTablePlugin::encodeValue($theValue) 
     1176        Foswiki::Plugins::EditTablePlugin::encodeValue($theValue) 
    11771177          unless ( $theValue eq '' ); 
    11781178        $text .= 
     
    11841184        my $ifFormat = ''; 
    11851185        $ifFormat = $bits[3] if ( @bits > 3 ); 
    1186         $ifFormat ||= $TWiki::cfg{JSCalendarContrib}{format} || '%e %B %Y'; 
     1186        $ifFormat ||= $Foswiki::cfg{JSCalendarContrib}{format} || '%e %B %Y'; 
    11871187        $size = 10 if ( !$size || $size < 1 ); 
    1188         TWiki::Plugins::EditTablePlugin::encodeValue($theValue) 
     1188        Foswiki::Plugins::EditTablePlugin::encodeValue($theValue) 
    11891189          unless ( $theValue eq '' ); 
    11901190        $text .= CGI::textfield( 
     
    11991199        ); 
    12001200        $text .= saveEditCellFormat( $cellFormat, $theName ); 
    1201         eval 'use TWiki::Contrib::JSCalendarContrib'; 
     1201        eval 'use Foswiki::Contrib::JSCalendarContrib'; 
    12021202 
    12031203        unless ($@) { 
     
    12071207                -name    => 'calendar', 
    12081208                -onclick => "return showCalendar('id$theName','$ifFormat')", 
    1209                 -src     => TWiki::Func::getPubUrlPath() . '/' 
    1210                   . TWiki::Func::getTwikiWebname() 
     1209                -src     => Foswiki::Func::getPubUrlPath() . '/' 
     1210                  . Foswiki::Func::getTwikiWebname() 
    12111211                  . '/JSCalendarContrib/img.gif', 
    12121212                -alt   => 'Calendar', 
     
    12191219    else {    #  if( $type eq 'text') 
    12201220        $size = $DEFAULT_FIELD_SIZE if $size < 1; 
    1221         TWiki::Plugins::EditTablePlugin::encodeValue($theValue) 
     1221        Foswiki::Plugins::EditTablePlugin::encodeValue($theValue) 
    12221222          unless ( $theValue eq '' ); 
    12231223        $text = 
     
    13771377 
    13781378    # render final value in view mode (not edit or save) 
    1379     TWiki::Plugins::EditTablePlugin::decodeFormatTokens($text) 
     1379    Foswiki::Plugins::EditTablePlugin::decodeFormatTokens($text) 
    13801380      if ( !$doSave && !$doEdit ); 
    13811381 
     
    14101410    my ( $theWeb, $theTopic ) = @_; 
    14111411 
    1412     TWiki::Func::writeDebug( 
     1412    Foswiki::Func::writeDebug( 
    14131413        "- 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 ) ); 
    14201420} 
    14211421 
     
    14271427    my ( $theWeb, $theTopic, $doCheckIfLocked ) = @_; 
    14281428 
    1429     TWiki::Func::writeDebug( 
     1429    Foswiki::Func::writeDebug( 
    14301430        "- 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(); 
    14341434    if ( 
    1435         !TWiki::Func::checkAccessPermission( 
     1435        !Foswiki::Func::checkAccessPermission( 
    14361436            'change', $wikiUserName, undef, $theTopic, $theWeb 
    14371437        ) 
     
    14401440 
    14411441        # user has no permission to change the topic 
    1442         throw TWiki::OopsException( 
     1442        throw Foswiki::OopsException( 
    14431443            'accessdenied', 
    14441444            def    => 'topic_access', 
     
    14521452    unless ($breakLock) { 
    14531453        my ( $oopsUrl, $lockUser ) = 
    1454           TWiki::Func::checkTopicEditLock( $theWeb, $theTopic, 'view' ); 
     1454          Foswiki::Func::checkTopicEditLock( $theWeb, $theTopic, 'view' ); 
    14551455        if ($oopsUrl) { 
    1456             my $loginUser = TWiki::Func::wikiToUserName($wikiUserName); 
     1456            my $loginUser = Foswiki::Func::wikiToUserName($wikiUserName); 
    14571457            if ( $lockUser ne $loginUser ) { 
    14581458 
     
    14631463                # add info of the edited table 
    14641464                my $params = ''; 
    1465                 $query = TWiki::Func::getCgiQuery(); 
     1465                $query = Foswiki::Func::getCgiQuery(); 
    14661466                $params .= ';ettablenr=' . $query->param('ettablenr'); 
    14671467                $params .= ';etedit=on'; 
     
    14691469 
    14701470                # warn user that other person is editing this topic 
    1471                 TWiki::Func::redirectCgiQuery( $query, $oopsUrl ); 
     1471                Foswiki::Func::redirectCgiQuery( $query, $oopsUrl ); 
    14721472                return 0; 
    14731473            } 
     
    14761476 
    14771477    # We are allowed to edit 
    1478     TWiki::Func::setTopicEditLock( $theWeb, $theTopic, 1 ); 
     1478    Foswiki::Func::setTopicEditLock( $theWeb, $theTopic, 1 ); 
    14791479 
    14801480    return 1; 
     
    15021502=cut 
    15031503 
    1504 package TWiki::Plugins::EditTable; 
     1504package Foswiki::Plugins::EditTable; 
    15051505 
    15061506use vars qw( 
     
    15861586 
    15871587                # EDITTABLE and TABLE on one line (order does not matter) 
    1588                 TWiki::Plugins::EditTablePlugin::Core::putTmpTagInTableTagLine( 
     1588                Foswiki::Plugins::EditTablePlugin::Core::putTmpTagInTableTagLine( 
    15891589                    $_); 
    15901590                $inEditTable = 1; 
     
    16001600 
    16011601# 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( 
    16031603                        $storedTableRow); 
    16041604                    $editTableTag .= $storedTableRow . "\n"; 
     
    16151615                # TABLE on the line after EDITTABLE 
    16161616                # we will include it in the editTableTag 
    1617                 TWiki::Plugins::EditTablePlugin::Core::putTmpTagInTableTagLine( 
     1617                Foswiki::Plugins::EditTablePlugin::Core::putTmpTagInTableTagLine( 
    16181618                    $_); 
    16191619                $doCopyLine = 0; 
  • trunk/EditTablePlugin/lib/Foswiki/Plugins/EditTablePlugin/MANIFEST

    r14 r893  
    1 data/TWiki/EditTablePlugin.txt 0644 
    2 data/TWiki/VarEDITTABLE.txt 0644 
    3 lib/TWiki/Plugins/EditTablePlugin.pm 0444 
    4 lib/TWiki/Plugins/EditTablePlugin/Core.pm 0444 
    5 pub/TWiki/EditTablePlugin/btn_delete_disabled.gif 0644 
    6 pub/TWiki/EditTablePlugin/btn_delete_over.gif 0644 
    7 pub/TWiki/EditTablePlugin/btn_delete.gif 0644 
    8 pub/TWiki/EditTablePlugin/btn_move_disabled.gif 0644 
    9 pub/TWiki/EditTablePlugin/btn_move_over.gif 0644 
    10 pub/TWiki/EditTablePlugin/btn_move.gif 0644 
    11 pub/TWiki/EditTablePlugin/edittable.css 0644 
    12 pub/TWiki/EditTablePlugin/edittable.gif 0644 
    13 pub/TWiki/EditTablePlugin/edittable.js 0644 
    14 pub/TWiki/EditTablePlugin/EditTablePluginCalendarExample.gif 0644 
    15 pub/TWiki/EditTablePlugin/img.gif 0644 
    16 pub/TWiki/EditTablePlugin/menuarrow.gif 0644 
    17 pub/TWiki/EditTablePlugin/ScreenshotEditCell1.gif 0644 
    18 pub/TWiki/EditTablePlugin/ScreenshotEditCell2.gif 0644 
    19 pub/TWiki/EditTablePlugin/separator_bg_anim.gif 0644 
     1data/System/EditTablePlugin.txt 0644 
     2data/System/VarEDITTABLE.txt 0644 
     3lib/Foswiki/Plugins/EditTablePlugin.pm 0444 
     4lib/Foswiki/Plugins/EditTablePlugin/Core.pm 0444 
     5pub/System/EditTablePlugin/btn_delete_disabled.gif 0644 
     6pub/System/EditTablePlugin/btn_delete_over.gif 0644 
     7pub/System/EditTablePlugin/btn_delete.gif 0644 
     8pub/System/EditTablePlugin/btn_move_disabled.gif 0644 
     9pub/System/EditTablePlugin/btn_move_over.gif 0644 
     10pub/System/EditTablePlugin/btn_move.gif 0644 
     11pub/System/EditTablePlugin/edittable.css 0644 
     12pub/System/EditTablePlugin/edittable.gif 0644 
     13pub/System/EditTablePlugin/edittable.js 0644 
     14pub/System/EditTablePlugin/EditTablePluginCalendarExample.gif 0644 
     15pub/System/EditTablePlugin/img.gif 0644 
     16pub/System/EditTablePlugin/menuarrow.gif 0644 
     17pub/System/EditTablePlugin/ScreenshotEditCell1.gif 0644 
     18pub/System/EditTablePlugin/ScreenshotEditCell2.gif 0644 
     19pub/System/EditTablePlugin/separator_bg_anim.gif 0644 
  • trunk/EditTablePlugin/lib/Foswiki/Plugins/EditTablePlugin/build.pl

    r14 r893  
    99} 
    1010 
    11 use TWiki::Contrib::Build; 
     11use Foswiki::Contrib::Build; 
    1212 
    1313# Create the build object 
    14 $build = new TWiki::Contrib::Build( 'EditTablePlugin' ); 
     14$build = new Foswiki::Contrib::Build( 'EditTablePlugin' ); 
    1515 
    1616# Build the target on the command line, or the default target 
Note: See TracChangeset for help on using the changeset viewer.