<<O>>  Difference Topic EditContrib (r1.6 - 01 May 2005 - TWikiGuest)
Added:
>
>

Edit Contrib Package


Provides subroutines useful in writing plugins that edit and save parts of topics.
Changed:
<
<

Summary of Contents

>
>

Summary of Contents


This contrib provides subroutines that come in handy when editing and saving parts of topics (refered to as sections).

Line: 15 to 19

This contrib is used by TWiki:Plugins/SectionalEditPlugin, TWiki:Plugins/MultiEditPlugin, and TWiki:Plugins/ThreadedDiscussionPlugin. Examining these plugins will provide guidance of how to use these subroutines in implementing your own plugin.

Changed:
<
<

Detailed Documentation

>
>

Detailed Documentation


The use of this contrib follows closely the pattern used in TWiki core when editing a topic. A plugin implementing editing of a section of a topic has to

  • Implement code called during view which would provide appropriate controls for edting a section, and identify the section to be edited by differentiating
Line: 29 to 33

    • Pass these to finalize_edit() to generate the edit topic.
The contrib provides the rest of the plumbing (save script, edit templates).
Changed:
<
<

passFormForEdit ( $web, $topic, $form, $meta, $query, @fieldsInfo )

>
>

passFormForEdit ( $web, $topic, $form, $meta, $query, @fieldsInfo )


To be used instead of TWiki::Forms::renderForEdit when editing a topic should not display the forms for editing. In this case, form values are passed through to the save script unchanged. This would allow, for example, separating the editing of the form from editing the text of the topic.

Changed:
<
<

savemulti ( $web, $topic, $user, $query, $editlink )

>
>

savemulti ( $web, $topic, $user, $query, $editlink )


Works identical to TWiki::UI::Save::savemulti except

  • redirects to $editlink when "Checkpoint" is selected (thus a custom edit script can be called)
  • additional text can be passed via the pretxt and postxt URL parameters. These will be prepended and appended to the text coming from the edit box, respectively.
Changed:
<
<

quoteForXml ( $text )

>
>

quoteForXml ( $text )


Quotes characters in $text so that it can used for display and editing.

Changed:
<
<

edit ( )

>
>

edit ( )


Sets up a section of the topic for editing. This code is derived from bin/edit and lib/TWiki/UI/Edit.pm, but omits code related to topic creation (as the topic must exist for this function to be called).

Line: 58 to 62

%EDIT% URL to be invoked to edit the section (used when "Checkpoint" is selected)
%EDITPARAMS% URL parameters to be passed when the section is edited
Changed:
<
<

finalize_edit ( $query, $topic, $webName, $pretxt, $sectxt, $postxt, $pretxtRender, $postxtRender, $tmpl )

>
>

finalize_edit ( $query, $topic, $webName, $pretxt, $sectxt, $postxt, $pretxtRender, $postxtRender, $tmpl )


Sets up the final edit topic.

Line: 66 to 70

$postxtRender and $pretxtRender will be rendered for edit and displayed above and below the text area, respectively. Pass an empty string if no such text should be displayed. These will be encoded for display and substituted for %PRETEXTFIELD% and %POSTEXTFIELD%, respectively.

Changed:
<
<

bin/savesection

>
>

bin/savesection


Works identical to bin/save except

  • invokes TWiki::Contrib::savemulti
  • constructs the edit link (see above) from the URL parameters edit and editparams. The former has to be the edit script to be invoked when "Checkpoint" is selected, the latter determines any additional URL parameters to be passed to the edit script (must include the leading &).
Changed:
<
<

templates/editsection.tmpl, templates/editsection.pattern.tmpl

>
>

templates/editsection.tmpl, templates/editsection.pattern.tmpl


Templates supporting the editing of a section. The pretxt and postxt URL parameters (see savemulti) are generated by the two variables %PRETEXTFIELD% and %POSTEXTFIELD%. The size of the edit window is controlled by preference variables (see below).

Line: 80 to 84

Settings

Added:
>
>
Settings are stored as preferences variables. To reference a setting write %<plugin>_<setting>%, e.g. %JSCALENDARCONTRIB_STUB%

  • Name of the perl package
    • Set STUB = TWiki::Contrib::EditContrib
Line: 89 to 95

    • Set SECTIONEDITBOXHEIGHT = 27
    • Set SECTIONEDITBOXSTYLE = width: 99%;
Added:
>
>
  • One line description:
    • Set SHORTDESCRIPTION = Provides subroutines useful in writing plugins that edit and save parts of topics.

  • Name of the perl package
    • Set STUB = TWiki::Contrib::EditContrib

Installation Instructions

Added:
>
>
Note: You do not need to install anything on the browser to use this contrib package. The following instructions are for the administrator who installs the package on the server where TWiki is running.

  • Download the ZIP file from the Plugin web (see below)
  • Unzip EditContrib.zip in your twiki installation directory. Content:
    File: Description:
Line: 109 to 122

Author: TWiki:Main/ThomasWeigert
Copyright ©:  
Changed:
<
<
License: GPL
>
>
License: GPL (GNU General Public License)

Dependencies: none
Version: 07 Apr 2005
Change History: <!-- versions below in reverse order --> 
Line: 124 to 137

Related Topics: TWiki:Plugins/SectionalEditPlugin, TWiki:Plugins/MultiEditPlugin, TWiki:Plugins/ThreadedDiscussionPlugin, TWiki:Plugins/EditTablerowPlugin

Changed:
<
<
-- TWiki:Main/ThomasWeigert 21 Mar 2005
>
>
-- TWiki:Main/ThomasWeigert 07 Apr 2005

View topic | Diffs | r1.6 | > | r1.5 | > | r1.4 | More
Revision r1.5 - 07 Apr 2005 - 07:09 - TWikiGuest
Revision r1.6 - 01 May 2005 - 15:40 - TWikiGuest