Ticket #114 (closed defect: fixed)

Opened 5 years ago

Last modified 3 years ago

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

Attachments

proposed_solution.txt Download (0.6 KB) - added by NilsLindenberg 5 years ago.
the proposed soultion in a txt file for better readability

Change History

Changed 5 years ago by NilsLindenberg

the proposed soultion in a txt file for better readability

Changed 5 years ago by dartar

  • description modified (diff)

Changed 5 years ago by dartar

  • milestone set to 1.1.6.2

Changed 4 years ago by NilsLindenberg

//copied a very old discussion from the suggestion-box. Note the proposal from GeorgePetsagourakis!//

It is me again! What is the function of the "Please add a note on your edit" - field? Again and again: Keep on the good work.

-- SkyWalk

~& this note is shown in some lists like the RecentChanges and the page revisions. it's just a little helper to keep the wiki organized and has no effect on the page itself. use it whenever you can to drop a short abstract of what has changed, even if you have corrected some typos to let others know that no essential changes were made. it is a really useful feature --DreckFehler

maybe we could have a level switch on that feature, constituting it obligatory, optional, or off... an addittion to the conf will be neccessary thought.. --GeorgePetsagourakis

Changed 4 years ago by DarTar

  • owner changed from unassigned to DarTar
  • status changed from new to assigned

Changed 4 years ago by DarTar

  • status changed from assigned to closed
  • resolution set to fixed

Fixed in [84]. Added new config option require_edit_note. Possible values are:

  • 0: edit note optional (default)
  • 1: edit note required (edit handler displays error message if note is empty)
  • 2: edit note disabled (note field is removed)

Changed 3 years ago by JavaWoman

  • status changed from reopened to closed
  • resolution set to fixed

Seems to have been reopened by spam removal; closing again...

Note: See TracTickets for help on using tickets.