internal package Foswiki::Plugins::EditTablePlugin::Core

See PublishedAPI for packages intended to be used by Plugin and Contrib authors, or browse all packages.
See also Developing plugins, Developer's Bible, Technical Overview

Work in progress: changing the table based on form parameters

(sub handleTableChangeParams)

Test in topic:

AAA

Add rows from table 1

Position: Count:

Delete rows from table 1

Position: Count:

Initializes variables.

Init variables again. If called from INCLUDE this is the first time we init

StaticMethod parseTables($text, $topic, $web)

Read and parse table data once for each topic. Stores data in hash $tableMatrix{webname}{topicname}. Even if we are just viewing table data (not editing), we can deal with text inside edit tables in a special way. For instance by calling handleTmlInTables on the table text.

process( $text, $topic, $web, $includingTopic, $includingWeb )

Called from commonTagsHandler. Pass over to processText in 'no Save' mode.

processText( $mode, $saveTableNr, $text, $topic, $web, $includingTopic, $includingWeb )

Process the text line by line. When a EditTablePlugin table is encountered, its contents is rendered according to the view:
  • View mode - default
  • Edit mode - when an Edit button is clicked, renders the rest of the table in edit mode
  • Save mode - when called from a Save button: calls processText again, only renders the selected table number, then saves the topic text

NOT FULLY IMPLEMENTED YET

Change table by means of parameters:
  1. Adding rows:
    • param etaddrows_position
    • param etaddrows_count
  2. Deleting rows
    • param etdeleterows_position
    • param etdeleterows_count

TODO:
  • addRows: existing rows need to shift down
  • deleteRows: check limit start and end of table
  • create unit test
  • write documentation

StaticMethod handleButtonActions( $mode, $editTableData, $tableStats, $tableChanges, $web, $topic ) -> $mode

Handles button interaction; for each state updates the $mode to a value of $MODE.

StaticMethod addRows( $tableStats, $tableChanges, $position, $count )

Adds one or more rows.

StaticMethod deleteRows( $tableStats, $tableChanges, $position, $count )

Deletes one or more rows.

StaticMethod processTableData( $tableNr, $editTableData, $tableChanges, $doEdit, $doSave, $web, $topic ) -> (\@processedText, \%tableChanges)

StaticMethod getPreferencesValues()

Read preferences from plugin topic of preferences.

StaticMethod extractParams( $arguments, \%params )

Creates the HTML for the start of the table.

digestedCellValue: properly handle labels whose result may have been moved around by javascript, and therefore no longer correspond to the raw saved table text.

Add one space to both sides of the text to allow TML expansion. Convert multiple (existing) spaces to one space.

stripCommentsFromRegex($pattern) -> $pattern

For debugging: removes all spaces and comments from a regular expression.

StaticMethod _handleSpreadsheetFormula( $text ) -> $text

Replaces a SpreadSheetPlugin formula by a static text.

StaticMethod handleTmlInTables( \@lines )

Users using the plugin would be confused when they enter newlines, which get replaced with
, and thus might not render their TML

So we hack it here so that all TML and HTML tags have spaces around them: - adds spaces around
to render TML around linebreaks - add spaces around TML next to HTML tags, again to render TML - expands variables, for example %CALC% Check Foswikibug:Item1017

StaticMethod addSpacesToTmlNextToHtml( \$text )

So that:

*bold*
_italic_

gets rendered as:

bold
italic

StaticMethod getHeaderAndFooterCount( $text ) -> ($headerRowCount, $footerRowCount)

Reads the headerrows and footerrows parameters from the TABLE macro (if any) and returns them as tuple.

If no TABLE tag is present, returns (0,0).
Topic revision: r1 - 03 May 2016, UnknownUser
This site is powered by FoswikiCopyright © by the contributing authors. All material on this site is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback