Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

EditMore

Summary:Provides desirable Site.EditForm additions for title, keywords, description, tags (categories), and notes (so far!).
Version:1.2
Prerequisites:
Status:Functional
Maintainer:MikeShanley

Questions answered by this recipe

  • How can I add an input field for Title, Description, Keywords, Tags, and Notes?
  • How can I make it manditory to fill in a Summary, Title, Description, Keywords, Tags, or Notes?
  • How can I make the Title, by default, equal to {$Namespaced}?
  • How can I make my list of categories (Tags) visible or hidden?
  • How can I maintain pagelist templates, WikiStyles, and development notes separate from the page's text and have them automatically hidden from people reading the page (Notes)?

Live Demo: http://demo.upisup.com

Description

This recipe is based on Waylan's EditTitle script, and the ideas of the pmwiki-users list.

There are some changes to this version, so if you are already using the recipe, read carefully.


EditForm Fields

This script adds new input fields that you can add to Site.EditForm if you like:

  • (:input e_title :) - for a page title.
  • (:input e_description :) - for a metatag description.
  • (:input e_keywords :) - for metatag keywords.
  • (:input e_tags :) - for a list of categories or links to relevant pages.
  • (:input e_notes :) - for development notes, pagelist templates, wikistyles, or page directives (ala (:nogroupheader:).

You can turn some of these off by removing them from this variable:
$EMFields = array('title','description','keywords','tags','notes');


Mandatory Fields

To make certain fields mandatory, use this variable:
$EMForcefully = array('title','summary','description','keywords','notes','tags');

This code would make all of them mandatory!!!


Other Options

To make the Title default to {$Namespaced},
$EMTitleFillEmpty = 1;

This is the default. Set to = 0 to turn it off.

To make the Notes field display on the page, set this variable equal to the CSS ID you would like to use to format it...
$EMNotesDisplay = 'EMNotesID';

By default, it remains hidden. Set $EMNotesDisplay = 0; to achieve the same effect.

To mkae Notes go to the top of the page instead of the bottom,
$EMNotesPosition = 'top';

Otherwise, it will stay at the bottom.

Instructions

  1. upload editmore.phpΔ to your /cookbook/ folder.
  2. add include_once("$FarmD/cookbook/editmore.php"); to your /local/config.php.
  3. add Title: (:input e_title:)\\Keywords: (:input e_keywords:)\\Description: (:input e_description:)\\Tags: (:input e_tags:)\\Notes:\\(:input e_notes:)\\ to somewhere in your Site.EditForm
  4. to display tags, reference {$:tags} somewhere on the page. It's done this way so that you can add it to your Group.GroupFooter using {{*$FullName}$:tags}

Notes

Filling In Tags

When filling in the Tags box, all categories or links should be separated by a comma (,). However, all of the following inputs are accepted:

Will become a link to your {$CategoryGroup}

  • The word Category: [[category:This|that]], [[Category.This]], [[category/This]], Category:This, category.This, Category/This
  • Your actual Categories Group: [[{$CategoryGroup}:This|that]], [[{$CategoryGroup}.This]], [[{$CategoryGroup}/This]], {$CategoryGroup}:This, {$categorygroup}.This, {$CategoryGroup}/This
  • !: [[!This|that]], !This
  • Just a word: This, this

Will become a regular link

  • ANY PAGE ON YOUR SITE: [[Group/This]], [[group.This]], Group/This, Group.This
  • Path: [Wikipedia:This, [[Path:../this/is/the/place|germs]] * ''URLs:'' [=[[http://www.example.com/this|that]], http://mike.upisup.com
  • Attach (be careful when linking to other pages uploads): Attach:editmore.php

As I'm sure you've gathered, it's case insensitive in any case that PmWiki would be.


These variables are enabled so that you can customize the look of the <input fields, either by specific attributes (size=, rows=, etc.) or by assigning classes (class=''):
* $EMTitleInputDisplay

  • $EMKeywordsInputDisplay
  • $EMDescriptionInputDisplay
  • $EMTagsInputDisplay
  • $EMNotesInputDisplay

These variables are so that you can customize the message for when a user does not fill in a required field:
* $EMForceTitleFmt

  • $EMForceKeywordsFmt
  • $EMForceDescriptionFmt
  • $EMForceTagsFmt
  • $EMForceNotesFmt
  • $EMForceSummaryFmt

Release Notes

2007-09-18
Added Notes box, added //easy// linking in **Tags** box, option to have **Title** default to {$Namespaced} when empty, and completely revised code to be "tighter".
2007-08-31
Revised release! Now you can add hidden categories to your page, which are added to the <div> made with MediaCategories.
2007-08-30
First Release, comments desired and welcomed.

Comments

  • looks great, can it cope with page text variables, eg Summary (viz ( :Summary:Page summary here: )
  • can it make the change summary mandatory?
  • please note that skins may use another edit-form. Triad uses Site.Popup-EditForm for example.
    • This should be fine as you can add the new (:input's anywhere.
  • thanks. this is very useful. however, here are a few bugs/corrections i noticed and would suggest incorporating:
    • was unable to change the size/width of Tags b/c the $EMTagsInputDisplay is printed in lowercase as $emtagsinputdisplay when placed in the stylesheet (same for $emdescriptioninputdisplay, $emnotesinputdisplay, etc...)
    • when using tags: once tags are entered and saved, if you go back to change them, they aren't being removed from the text-area... instead they're being appended to an evergrowing list of all the tags you've ever entered. the result is that the $:tags variable remains assigned to the earliest entry.
      • example: 1st enter: tag1, tag2... Save, then change your mind, and enter: tag1, tag3
      • when you come back the next time, tag1, tag2 will still be in there, and when posted to the screen they're not changing
    • figured out that the problem is solved if you change this:
      • $new['text'] = "(:tags:".$new['tags'].":)\n".$new['text']; ---> to
      • $new['text'] = "(:tags:".$new['tags'].":)\n"; // old 'text' begone!!

overtones99 March 02, 2008, at 06:56 AM

  • keywords and title also mass replicating with every save
    • ... and again, just discovered that the same thing happens as in the above note, but with (:keywords:) and (:title:)
      ** overtones99 May 05, 2008, at 04:58 PM
      • It's actually working just fine for me. Maybe a little more information about your setup? Mike Stop Continues January 13, 2009, at 01:32 AM
  • For me this doesn't work at all. The forms show up, but adding text doesn't have any effect. Only tried with the Title so far, but I can't change the title with the form. Bergwitz
    • I have the same problem. Does anyone have any idea how to fix it? eseval

Hi this breaks "delete" page function. replaceing all text with "delete" does not delete the page anymore. Using this with gemini skin.
config.php:
# Enhanced Edit functions

 $EMFields = array('title','keywords','tags');
 include_once("$FarmD/cookbook/editmore.php");

Site.Popup-EditForm:
Title: (:input e_title :)

 Keywords: (:input e_keywords :)
 Tags: (:input e_tags :)

Anyone have any ideas???
Apart from that very nice recipe
Regards Nigel


See Also

Contributors

User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.

Edit - History - Print - Recent Changes - Search
Page last modified on September 10, 2011, at 11:42 AM