BPlan Construction - Update #2
Yes, it's 2:30am and I am up writing after two days of gruesome hard work. I have been busy designing a next-generation library catalog system, watching the NBA playoffs, hanging out at my folks place, and um, taking my business plan competition project head on. Not to mention, I have been crazy sick the last few days.
Lots of work:
- Set up Entrepreneur and Donor profile content types and roles
- Configured a lot of roles and permissions
- Created Business Project node type
- Created Team node type and made it an Organic Group type
However, behind the scenes, this is a lot easier said than done. I have learned a lot about Organic Groups, Views 2, and just about every node reference or node referrer module on the planet.
To give a sense of what I have been going through, here is the list of modules that I have installed, the bulk of which are currently enabled:
|
|
The difficulty was setting up the business project and team content types -- at odd hours of the night. What I wanted is to be able to make a node's field reference another node: simple. But I also wanted the user to be able to create that referenced node on the fly. Essentially, I wanted to have an Entrepreneur create a Business Project and then create a Team. I wanted the entrepreneur's business projects to be associated with the entrepreneur and the business projects to be associated with the team and so forth. And with all of this, I wanted to use Organic Groups to handle the "team".
It took a few times to get it right.
First try:
- Entrepreneur node with a node reference field that referenced Business Project node
- Business Project as an Organic Group type
- So "business project" was the team
Problems with first try:
- I never had the right node reference modules installed at the right time, or this may have worked
- Either way, good thing it did not!
- Had problems with creating the content from the entrepreneur page
So, instead of doing what most Drupal developers would do and just hack away, I had to basically go back and do the right thing... LEARN:
- A node reference field allows a user to point to another node
- A node referrer field allows the node that is pointed to to list other nodes that point to it
How are node references usually used?
- To create a link to another node from a node's body text
- To group nodes together, for example, in some sort of entity relationship module
- To create a node container for multiple node types
After I grasped this concept, I was able to find my way through a handful of modules with documentation pages and README.txt files that don't explain what they do very well. However, the next question is very important: which comes first the "node reference" or the "node referrer" or both? And secondly, how do you want to create these nodes? In what form?
If at least the node being reference is already created, whether the node referring to it is created or not, then all is well; just use CCK.
If the referring node is already created and I want to create a node that is referenced, I can just need CCK, but you will have to create a 2-way referencing system. Think of it as a "reference" and a "back-reference". And I can then decide how much work a user should do to get this done.
- Typically, I will need to allow for 2-way referencing; so both node types will use CCK's node reference field set such that each node type refers to the other type
- Now, I can use a module called Corresponding Node References to automatically synchronize the references, regardless of which node type is making the initial reference
- There are some other modules out there as well, especially for Drupal 5... you can find these on your own
Afterward, I may want the user to create at least one node on the fly or from the same page/form. This is usually called "add and create" or "add and reference" or "auto-create". There are a lot of modules out there that can confuse you on what they do. Moreover, there is a lot of confusion added because of the different versions of Drupal and the different choice of words and the need some developers have of promoting their other projects. Then, when I settled on some modules, I found out that they didn't work well together or did not support the same CCK widgets.
Overall, here are my suggestions:
- Popups: Add and Reference -- this is probably the best choice for a user to "add and reference" because it puts the whole node form in a cool Lightbox-looking popup and supossedly adds the information to the form
- Noderefcreate -- found this online and NOT on Drupal's module list, but it works the best from my tests if you DON'T want a popup and don't need the user to fill out the node form; it uses an autocomplete text box for the user to type in a title to find the node and then if the node does not exist (that is, no node is selected), it simply creates the new node with the title and adds the reference
- Nodereferrer Create -- adds this functionality for node referrers/backreferences, so that a back reference, during creation, can specify and create a node to reference it if that node does not exist
- Again, there are other modules out there you can find or create to meet every wish your heart desires
In my case, I wanted the user to be able to create both at the same time, but I did not like the popup form. After pondering on some other subjects, I decided exactly what I wanted and did another try.
Second try:
- Entrepreneur node had no node references -- I don't want the user to choose which business projects to show on their profile -- at least not right now, I want them to choose to MAKE business projects
- Created a Business Project and Team content type -- they are two separate things; this allows the same team to be associated with multiple business projects
- Business Project nodes have a SINGLE node reference to a Team node using CCK's node reference field and the widget created by the Noderefcreate module, which automatically adds and creates a team if necessary and uses a nice AJAX autocomplete text box
- Team nodes have a node referrer field which simply creates a back reference for Teams to refer back to their Business Projects, but does so without the user having to do anything
- Team nodes will be an Organic Group type
That is how you become a gangsta like me.
Now that I had this set up, I started my first date with Organic Groups and then proceeded to work with Views 2. OG was pretty easy to set up. I already can tell that I will have a long-term love-hate relationship with Views 2. Honestly, Views 1 was very easy and simple. Views 2 has a new interface and is very complex. It takes forever to get setup and to learn the way it works. But it can do very poewrful things. After about 7 hours, I had my views all customized and running. I was able to change a lot of URLs from "og" and "groups" to "teams" and modify titles of the views and menu structures... geez!
What can be done so far:
- Users can create accounts, making them “Members”
- Members can add personal and professional information about themselves
- Members can apply to be “Entrepreneurs” or “Donors”
- Administrators can control the application process
- Entrepreneurs can create Business Projects and start Teams
- Entrepreneurs can associate Teams with their Business Projects
- Entrepreneurs can list their projects
- Members can join Teams
- Members can list their teams
- Members can list the content posted to their teams, called an Inbox
What comes next:
- BACKUP ALL MY DATA AGAIN!!!
- Create Organization content type for non-profit organizations
- Create Business Plan content type
- Add more fields to the Business Project node
- A "business project" is what the entrepreneur eventually wants to be a "company" or an "enterprise"
- Add more fields for user profiles -- such as birthdate
- Add more groups/team functionality -- ability to post different types of content, private/public content, team positions, calendar for events, etc.
Get some sleep...
Share Your Thoughts Below
You can follow any responses to this entry via its RSS comments feed. You may also leave a trackback by clicking this link.