Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

FoxDelete

Summary: add delete links for deleting lines or sections with Fox
Version: 2008-07-12
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 as

include_once("$FarmD/cookbook/foxdelete.php");

 or

include_once("$FarmD/cookbook/fox/foxdelete.php");

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 #foxbegin# and #foxend# 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 #foxbegin# and #foxend# 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-07-12: Fixed bug preventing cancel in delete confirm dialogue.
  • 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 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

Edit - History - Print - Recent Changes - Search
Page last modified on July 18, 2008, at 10:30 AM