Summary: add delete links for deleting lines or sections with Fox
Version: 2008-04-19
Prerequisites: Pmwiki 2.2.0 beta
Status: beta
Maintainer: HansB?
Categories: Forms Fox

Questions answered by this recipe

How can I add delete links or buttons with which to delete lines or sections?

Description

An add-on for the Fox form processor which enables line or section delete links and buttons.

Install in the usual manner by copying to cookbook/ or cookbook/fox/ folder and including in local config file.

This script adds template markup {[foxdelline]}, {[foxdelrange]}, {[foxdelline button]} and {[foxdelrange button]} which can be used in a Fox template to create a delete link or button to delete a line or posted content section.

Note that the markup is for fox templates only! The delete link or button form gets created via a Fox posting. Thereby Fox adds an id number to the link and button, which makes it possible to target the line or section for deletion in which the link or button is situated. Sections are marked by using and markers in the template.

Examples

The following will add a line of input text with a foxdelete (line) link for line deletion above the foxappend marker, thereby following additions are added below previous ones (use (:foxprepend frm:) to achieve the opposite, i.e. latest on top):

(:fox frm1 :)
(:foxtemplate "* {$$comment} {[foxdelline]}":)
(:input text comment size=50:)
(:input submit post 'Add Comment':)
(:foxend frm1:)

(:foxappend frm1:)

The following will add a section of text to the page, with a foxdelete (range) link for deleting the whole section:

(:fox frm2 template=commenttmpl:)
(:input textarea comment rows=6 cols=50:)
(:input submit post 'Add Comment':)
(:foxend frm2:)
(:if false:)
[[#commenttmpl]]
#foxbegin#
----
%rfloat%{[foxdelrange]}
{$$comment}
#foxend#
[[#commenttmplend]]
(:if:)

Note the template uses and markers for identifying the delete range.
The template here is defined on the same page, but can be equally or better defined on a separate template page, like Site.FoxTemplates. (:if false:)...(:if:) is used to suppress the template from being shown in the page.

Notes

The foxdelete markup and action handling function was previously included in fox.php.

Release Notes

  • 2008-04-19: Modified markup definition and added option tooltip='STRING'.
  • 2008-03-16: Changed handling of $FoxAuth so customisations applied after foxdelete.php is included will be honoured. Moved delete warning messages from fox.php to foxdelete.php
  • 2008-02-07a: Modified which edit functions are called.
  • 2008-02-07: Fixed bug which prevented ChangeSummary to appear in page history.
  • 2008-02-05: Added handling of $ChangeSummary, so any value from an input field named 'csum' will be written into the page attributes and be available for the page history.
  • 2008-01-09: Initial release. Previously part of fox.php. Still part in the older Fox version Attach:fox-1.php Δ

If the recipe has multiple releases, then release notes can be placed here. Note that it's often easier for people to work with "release dates" instead of "version numbers".

See Also

Contributors

Comments

RightBar

The Right Bar is just another wiki page inserted to the right of the main content, so that text will flow around it. It will expand downwards. It could be used for links or news alerts and more.

The RightBar in Triad appears as the right column. It's width is fixed. Using >>clip<< markup generates boxes for text clips.

Page Width Style (disabled by default)