node or page notes

Events happening in the community are now at Drupal community events on www.drupal.org.
newz2000's picture

OK, quick question...

There are a couple pages in my site that are special. I was wondering if there's a way to attach notes to a node (which in my case happens to be a page) so that whenever someone edits the page they can see the notes. The notes are hidden unless you're editing.

I could create a content type for these but that seems over kill since there's only one page. For example, I just created a page called "events" and it will be edited once per month. Just infrequently enough to forget the procedure for adding events to the page. I can think of a couple other pages that have to be treated specially. It'd be nice if there was a nice big "Hey dummy, don't hit save until you've done this..." message. Ideally right at the top of the form.

Any way to achieve this?

Comments

Try Event module for a complete solution.

Michael Hofmockel's picture

Assuming your using Drupal 6 ...

Simpliest answer:
If the directions are brief enough you could just put them as the "description". This will only be available to users that can edit.
- go to /admin/content/node-type/page on your site.

Robust answer:
Create your own module and create a markup field by implementing hook_form_alter.
- http://api.drupal.org/api/file/developer/topics/forms_api_reference.html...
- http://api.drupal.org/api/function/hook_form_alter/6
- http://api.drupal.org/api/file/developer/examples/nodeapi_example.module/6

Likely best answer:
Having users continually editing the same page is probably not the best solution for event management.
I suspect that an existing module would be a much better, more easily maintained, and feature rich solution.
Ideally, you will most likely want each event to be it's own node. Then list all the events (nodes) on a single page (view) or better yet on a calendar (view).
- http://drupal.org/project/Modules/category/61
I have used the event module many times.
http://drupal.org/project/event

Come to our next meeting and we'll flesh out these three avenues for you.
http://groups.drupal.org/node/18286

Regards,
Michael Hofmockel
iMed Studios

Open Source || Open Access || Open Mind

Regards,
Michael Hofmockel

Open Source || Open Access || Open Mind

Well, don't get caught up in

newz2000's picture

Well, don't get caught up in the name of my page... it's called events but its not really at all related to the events module. Plus I have a number of such pages.

Regarding the "description" field, I don't see a field like this at all. Is it only on certain content types? (Currently I'm looking at the "create 'page'" form)

The problem is that most pages need no special instructions, you just do the obvious thing. I was just wondering if there's a way to call attention to these special pages so that when a user does edit them they get an "in your face" warning. Here's a better example... Most times users will edit a page using a wysiwyg editor. There are a couple pages that have special styles that get foobar'd if you enable the wysiwyg. It'd be nice to have a warning on these pages that say "Don't enable the wysiwyg."

--
Matthew Nuzum
newz2000 on freenode

--
Matthew Nuzum
newz2000 on freenode

I understand better, how about this...

Michael Hofmockel's picture

"in your face warning"

Sounds like a good job for drupal_set_messge. You likely already have a hook_form_alter function already, what if you added something like this?

<?php
function yourmodule_form_alter(&$form, $form_state, $form_id) {
  if (arg(0)=='node' && is_numeric(arg(1)) && arg(2)=='edit') {
    if (arg(1) = '12')
      drupal_set_message('Your in your face warning goes here', $type = 'warning', $repeat = TRUE);
    }
  }
}

This should give you a warning message on node/12/edit page.

re - description: The description shows under the name of the content-type on /node/add page. Now that I am understanding better what you need this doesn't sound like the right solution as it is only shown on the node/add page and not on the actual form. You want it on the top of your form so your warning is on the same page.

Regards,
Michael Hofmockel
iMed Studios

Open Source || Open Access || Open Mind

Regards,
Michael Hofmockel

Open Source || Open Access || Open Mind

If the events page is really

jason ruyle's picture

If the events page is really that simple, revisions seem like a decent idea. You just add in notes to each new revision. This is not the best practice for events and seo (archiving options), but sometimes its just easier to have a single page to modify over and over.

Is this as simple as adding a block?

monan's picture

If this is a set of notes that goes on specific pages like node/add/event, isn't it as simple as adding a block that shows only on those pages (in the appropriate spot on those pages) containing the notes you want to display (styled to stand out, of course)?

Or am I missing something here?

Thanks!

Best solution

newz2000's picture

I think this is the best solution. It does give me everything I want and considering there are only a few pages will not be too much of a chore to update. Far better than correcting the mistakes by forgetting the best procedure.

--
Matthew Nuzum
newz2000 on freenode

--
Matthew Nuzum
newz2000 on freenode

create new content type

liabo's picture

What about creating a new body type in CCK using "plain text" so a wysiwyg editor isn't selectable? That way you can use that content type on all the other pages you're having trouble with.

--erica ^-^

--erica ^-^

Awesome tip

newz2000's picture

Awesome tip. I will definitely do this on the pages where the wysiwyg foobars things. Thanks for the suggestion.

--
Matthew Nuzum
newz2000 on freenode

--
Matthew Nuzum
newz2000 on freenode

The "annotate" module in Pro

mechler's picture

The "annotate" module in Pro Drupal Development 2nd Ed. is actually a module that the book walks you through writing as a primer. Modifying it to display the note while editing the node would be short and sweet.

Site Notes

rajmataj's picture

This module may be worth a look:

http://drupal.org/project/sitenotes

Central Iowa Drupal Users Group

Group categories

Category

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: