internal package
Foswiki::
Plugins::
EditTablePlugin::
Core
Work in progress: changing the table based on form parameters
(sub handleTableChangeParams)
Test in topic:
%EDITTABLE{}%
Add rows from table 1
Delete rows from table 1
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:
- Adding rows:
- param etaddrows_position
- param etaddrows_count
- Deleting rows
- param etdeleterows_position
- param etdeleterows_count
- 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:
gets rendered as:
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).