Join Now

Click here to join our
growing community:

JOIN LOGIN



Docs

Welcome Tour
Handbook
      Markups
      Variables
      Conditions
      Functions
      Forms
      Commands
      Concepts
Extensions
Pro Modules
Developers



Copyright © 2020
Terms of Use
Privacy Policy
BoltWire

Handbook

Edit

This command allows you to overwrite the content of a page, or a section of a page. If you retrieve the existing content into your edit form, you can make changes to it, and then save those changes.

This command writes to the specified page parameter or it defaults to the current page. The latter is useful only in an action page, or the form will overwrite itself.

The new content is drawn from either the content parameter, or the value of the parameter in position 1. Normally this is pulled in through a field replacement like this:

[box content rows=5 cols=40]
[edit {=content}]

This command fails if the user does not have write authorizations.

If a page does not exist it will be created.

If you try and create a page with no content, a page with a single space is created.

Existing Content

Here's how you normally retrieve existing content into a form for editing. Let's assume this is some kind of action page being called on top of another page you wish to edit.

[form]
[box content rows=5 cols=40]<(source {p} post=content)>[box]
[submit]
[command edit {=content}]
[form]

The source function pulls in existing content. The post=content parameter means the script will substitute the post value of the content field should the form fail for some reason and abort. This allows the user to preserve the changes, perhaps fix the problem, and eventually try again.

You can also do section edits in BoltWire. Pages can be divided into sections using anchors using this format:

Title of Page
[[#intro]]Heres the intro
Some more text

[[#body]]My three main points
Point 1
Point 2
Point 3

[[#conclusion]]My Ending
The grand finale

It is possible to edit any of the sections in the page by retrieving and saving to the anchor. Compare this form with the one above:

[form]
[box content rows=5 cols=40]<(source {p}#body post=content)>[box]
[submit]
[command edit {=content} page={p}#body]
[form]


Overwrites

BoltWire can check to make sure more than one person is not editing a page, and overwriting each other's content. To turn this on, add loadtime=1627685794 to the edit command. Basically. if the content of the page is been modified between the time you load the existing content, and save your new content, BoltWire assumes there has been a conflict and adds a special warning message to the top of the page.

If this happens, use the undo action to see what content was overwritten, decide the final form you want the page to take, and then re-edit the page. You will be able to remove the warning message at the top of the page at that time.

Miscellaneous

If you wish to replace \n's in the content with line breaks, set lines=true. It is not enabled by default, nor is it enabled in the default edit action (action.edit).

At this time, the edit command does not use templates, like the create command. It may be added at some point in the future.