Yay, now we can actually create new vocabularies, classes and properties :-)
Here are a bunch of comments on the way the four forms for the four entity types currently work.
On creating entities via “Add content”
1. In the "Add content" screen, "Vocabulary", "Property" and "Class" should be hidden. You can only create them through a "Vocabulary Workspace".
Here's how we did that in D6:
/**
* Implementation of hook_menu_link_alter().
*/
function neologism_menu_link_alter(&$item, $menu) {
// Hide the Class and Property content types from the Create Content menu
switch ($item['link_path']) {
case 'node/add/neo-class':
case 'node/add/neo-property':
$item['hidden'] = 1;
break;
}
}
2. Now that we can see the data model we designed in an actual site, it turns out that the name "Project" is a bit confusing from a user perspective. It would be better to call it "Vocabulary Workspace". Sorry, my bad for not thinking this through properly earlier.
About the Workspace and Vocabulary forms
3. Since a Workspace only ever has exactly one Main Vocabulary, there is no real point in having two separate forms for these entities, and when creating one, it should automatically create the other.
(Later on when we get to external vocabularies, we will be able to add further external vocabularies to a workspace, but you can't change anything inside these external vocabularies and therefore don't need an edit form for them either. Just a form for adding/removing them.)
So, basically when we create a workspace, we want the fields for creating the main vocabulary to show up in the form. Then when saving the new workspace, it should automatically create the node for the main vocabulary as well.
The easiest way of getting the additional form fields might be to call drupal_get_form in order to generate the vocabulary form, and copy the relevant fields over to the workspace form.
4. When adding the vocabulary form fields to the workspace form, don't add a form field for the vocabulary title, and instead just automatically take the value of the workspace title when saving the vocabulary. These two titles will always be the same.
5. Authors list should be initialized with the user who is creating the workspace.
6. Project layout field should be hidden. It's XML for the layout of the diagram, and users should never see it
7. The main vocabulary for a workspace should be created automatically when you create the workspace. The "Main Vocabulary" form field should therefore never be visible in the Workspace form.
8. The form field for Namespace URI: The "Default" option for me shows "http://default/void#", it should be "http://neologism7.local/void#" (I'm running this on a host called neologism7.local)
About creating classes and properties
9. Adding a new class or property should be a "local action" on the workspace. So, when you look at the workspace node, and are logged in, you get an additional link "create class" and "create property". The local actions can be defined in hook_menu, see here for the D6 version:
http://code.google.com/p/neologism/source/browse/branches/drupal-6/neolo...
(the .../add-class and .../add-property bits are the interesting ones)
These menu items call neologism_add_term, which then just invokes the appropriate edit form:
http://code.google.com/p/neologism/source/browse/branches/drupal-6/neolo...
10. In the class/property edit form, the related vocabulary field should be hidden. When a class/property is first created, the related vocabulary should be pre-set to the main vocabulary of the workspace. In D6 this is done in neologism_add_term
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | review-fixes-1217934-4.patch | 19.42 KB | mayankkandpal |
| #2 | main-voc-1217934-2.patch | 19.48 KB | mayankkandpal |
| #1 | workspace-vocabulary-1217934-1.patch | 17.36 KB | mayankkandpal |
Comments
Comment #0.0
cygri commentedthere's a preview button for a reason :-( fixed formatting
Comment #1
mayankkandpal commentedPatch provides following functionality :
1. Hidden the "Add content" screen, "Vocabulary", "Property" and "Class"
2. Changed project to Workspace
3. When we create a workspace, the fields for creating the main vocabulary to show up in the form. This was achieved using drupal_get_form()
4. When saving the new workspace, it automatically creates the node for the main vocabulary.
5. Run coder review and removed whitespace errors.
6. Vocabulary title is same as workspace title
7. Authors list is initialized with the user who is creating the workspace.
8. Hidden the project layout field
9. Hidden the main vocabulary field from form and it gets value automatically when form is saved.
For future reference :
The notice :
was resolved by adding the attribute :
Comment #2
mayankkandpal commentedThe main vocabulary field were not getting saved properly in the previous patch. This patch fixes this issue.
Comment #3
cygri commentedSome quick comments on the latest patch:
The Review user script complains about extra whitespace at the end of line :-)
CSS doesn't seem like the right way of doing this. Isn't there some configuration option in the field setup to make a field not show up in the form?
I get some weird encoding error for the quotes around "Some value". Better remove the quotes.
Comment #4
mayankkandpal commentedPatch which fixes the above three issues. The form fields were hidden by setting the #access attribute to FALSE instead of using jQuery. I checked out the patch in Dreditor, seemed fine now.
Will start working on render arrays now, issue and discussion posted at #1190784: [D7 Port] Customising the vocabulary hosting page
Comment #5
cygri commentedAwesome! Will apply and test it ASAP.
Comment #6
cygri commentedCommitted the patch:
http://drupalcode.org/project/neologism.git/commit/652052e
It still needs the links for creating classes and properties etc. Mayank, feel free to post that patch here, or close this issue and post the next patch on a different issue, however you see fit.
Comment #7
mayankkandpal commentedClosing.
Further Development (Links for adding class and properties) continued at #1190784: [D7 Port] Customising the vocabulary hosting page.
Comment #7.0
mayankkandpal commentedadd numbers to comments for easier reference