Ticket #114 (closed defect: fixed)
Making the edit-note mandatory
| Reported by: | SamuelDr (copied by NilsLindenberg) | Owned by: | DarTar |
|---|---|---|---|
| Priority: | low | Milestone: | 1.1.6.2 |
| Component: | core | Version: | 1.1.6.1 |
| Severity: | normal | Keywords: | edit note |
| Cc: |
Description (last modified by dartar) (diff)
I think it would be a good idea to let the administrator choose if the field is mandatory.
If it is, the form doesn't submit until there is content into it, and it should warn too with an alertbox.
Only a little bit of PHP is necessary, the big part is in JS, if i don't make any mistake... --SamuelDr
Actually, for the most basic validation, you don't even need any JS. I have implemented both, but the integration of the client side validation using JS is a bit of a hack (and needs to be streamlined, and own't currently work as an administrator setting), so I'm a bit hesistant to publish it (also I'm not sure on what page, I'm still a bit new here).
The server side validation goes like this. First, add a line to wikka.config.php: "edit_note_required" => true,
Then modify handlers/page/edit.php. Find the code that says
// check for overwriting
if ($this->page)
{
if ($this->page['id'] != $_POST['previous'])
{
$error = 'OVERWRITE ALERT: This page was modified by someone else while you were editing it.<br />'."\n".'Please copy your changes and re-edit this page.';
}
}
and modify it so it says:
// check for overwriting
if ($this->page)
{
if ($this->page['id'] != $_POST['previous'])
{
$error = 'OVERWRITE ALERT: This page was modified by someone else while you were editing it.<br />'."\n".'Please copy your changes and re-edit this page.';
}
}
// check for edit note
if ($this->config['edit_note_required'] && $_POST['note']=='')
{
$error .= 'EDIT NOTE ALERT: You must include an edit note!<br/>'."\n";
}
--CyneBeald
