I hope this post is appropriate in this list. If not please accept my apology.
As Drupal newbie I was hoping to get some advise on how to accomplish what I feel is something very simple, yet being unfamiliar with Drupal seems very difficult for me.
I'd like to be able to add several form fields to an article (node) that would allow an administrator/author to specify if it is exclusive to a specific role.
If so I'd like a pulldown menu that allows me to select which role it should be exclusive to.
Then I'd like start date and end date fields to specify when this article should remain exclusive (the idea being that once it's past the end date it will no longer be exclusive and therefore be available to everyone).
So far I've tried using CCK along with the Date module and JsTools (jscalendar).
First off I cannot get jscalendar to work at all. no calendar is visible when you click on the text field, even though it is specified.
Secondly, there doesn't seem to be any way of requring that if the exclusive checkbox is checked that the Role pulldown and startdate and enddate fields are completed. I appear to only be able to say that the start date and end date are required, even though they should not be if the exclusive checkbox is not checked.
Third, I'm not sure how using CCK I would add a pulldown menu that dynamically gets filled with all roles. Is this possible?
Last, how does one go about adding special validation to a node so that if specific fields are checked that other fields are required, if they're not checked then the other fields are not required, etc.? Is this beyond the scope of CCK? If so, how would you recommend accomplishing this?
Any advice, insight, reference links would be GREATLY appreciated.
best regards, brian
On Monday 04 June 2007 11:56:44 Brian Tully wrote:
I'd like to be able to add several form fields to an article (node) that would allow an administrator/author to specify if it is exclusive to a specific role.
If so I'd like a pulldown menu that allows me to select which role it should be exclusive to.
If I understand what you are trying to do here, I'd recommend looking at an access control module [1], like Node privacy byrole [2] (though that one hasn't been formally ported to Drupal 5, yet, but there is a patch to do it), and combining it with the Actions [3] and Workflow [4] modules.
Then I'd like start date and end date fields to specify when this article should remain exclusive (the idea being that once it's past the end date it will no longer be exclusive and therefore be available to everyone).
What you want to use for this is the Actions [3] and Workflow [4] modules.
Secondly, there doesn't seem to be any way of requring that if the exclusive checkbox is checked that the Role pulldown and startdate and enddate fields are completed. I appear to only be able to say that the start date and end date are required, even though they should not be if the exclusive checkbox is not checked.
You're going to have to get your hands dirty and write some code to make that happen [5] [6].
Third, I'm not sure how using CCK I would add a pulldown menu that dynamically gets filled with all roles. Is this possible?
I'm surprised there hasn't been a CCK module created that does this. Therefore, the only way to make this happen, other than using an access control module [1], is custom coding [5] [6].
[1] http://drupal.org/project/Modules/category/74 [2] http://drupal.org/project/node_privacy_byrole [3] http://drupal.org/project/actions [4] http://drupal.org/project/workflow [5] http://api.drupal.org/api/5 [6] http://api.drupal.org/api/5/function/hook_form_alter