Closed (fixed)
Project:
Outline Designer
Version:
6.x-1.2
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
30 Jul 2010 at 00:07 UTC
Updated:
2 Dec 2010 at 14:37 UTC
Jump to comment: Most recent file
Comments
Comment #1
btopro commentedThis type of functionality was actually in the original 5.x roadmap. The outline designer could be used at the time with hooks into og and sub_og to make groups and sub groups visually and manage their placement in hierarchies.
Would this module help as a roadmap for creation of what you're talking about? http://drupal.org/project/book_manager I think I'll be using outline designer to tap into functionality of the recently created http://drupal.org/project/flat_book project as I love the concept of being able to use OD to tell branches of content how to organize themselves on the site.
This sounds like a cool add-on for OD. I've always wanted to start moving down the OG path and the book permission structure is waaaay too simplistic. http://drupal.org/project/outline while abandoned might be another good module to cherry pick from. I've had a bunch of people asking me to integrate features of that in OD but it's a bit outside the scope of the core module.
Let me know if you need any help figuring out books to make your sub-module.
Comment #2
kyle_mathews commentedI've attached a rough 1st version of the module. If you enable it, you can go to node/%group_node/outline_designer and see a list of all books in that group. If you click on the book title, you're taken to the normal book edit form.
At first, none of the css/js was loading for outline_designer until I moved the drupal_add_stuff functions to the hook_form_alter function -- which, btw, I think makes more sense to add them there vs. hook_init.
Some bugs I'm seeing:
* I can edit things as normal but when it submits the changes, it says an error has occurred in "/outline_designer/ajax/reload_table/".
* We need to give group admins access to "access ajax path". Is there a standard drupal pattern for letting other modules override permissions? I couldn't think of one. The only solution I've thought of so far is making an "access callback" for "outline_designer/ajax" which can check first if someone has permission for "access ajax path" but also call a hook that outline_designer_og can implement to say that group admins can also access that callback.
* If you add a node to a book that resides in a group w/ outline_designer, that new node isn't being placed in a group. That should be pretty easy to fix, just have new nodes inherit the og settings of their parent book, correct?
Comment #3
kyle_mathews commentedAnd the file.
Comment #4
btopro commentedHmm... don't have a chance to look over this until I get back to work but here's my thoughts on the issues you mentioned:
*Form_alter makes sense, unfortunately I did it in hook_init as a left over from the D5 days ;).
*The reload_table issue is probably something to do with AHAH (I hate how it works :p)
$nid = $var1;
module_load_include('inc', 'book', 'book.admin');
$output = drupal_get_form('book_admin_edit', node_load($nid));
drupal_json(array('status' => TRUE, 'data' => $output));
book_admin_edit if you don't have permission to load that form would be the issue is my guess
*changing that path seems to make sense but maybe if we left the current one and the OG one was added in an OG specific way. That way you could have admin-esk roles that could work across books / load all books still in the admin/content/book area where outline designer resides currently
*add just runs a node_save function so it would be easy enough to look at the parent node, copy it and then see how it constructed it's OG component and put it in the new node_save
-----
This seems like it could be related.. there's been requests in the past for people to be able to access outline designer w.o. needing the administer books permission. Maybe we could expand upon the admin books permission in general OR leave the current one as like a global admin books permission for admins and then make a new permission structure for adding permissions either per book or in some kind of ownership way. This starts to sound like we should try and implement / integrate with book manager as it sounds like something they have figured out in terms of feature set: http://drupal.org/project/book_manager
Comment #5
kyle_mathews commentedI'd suggest not trying to integrate w/ book_manager. I looked through their code and it doesn't seem like it'd help. They work on a similar but different concept. They focus on letting people create "personal books" that only they or admins can control. What I'm trying to do is similar, give permissions to non-book admins, but it's different in that we give group admins control over books created in their groups not users control over their "personal books".
What would be nice perhaps is to create an abstract API to grant administrator book permissions to different people. But I'm not volunteering for that job.
Changes made in the patch:
* I removed the "access ajax" permission as it's redundant. If someone can administer books they can access the ajax callback.
* Move the hook_footer stuff into the form #suffix. That html wasn't being loaded on the outline_designer_og form.
* Removed the license declarations. Drupal.org automatically adds a LICENSE.txt file.
* Added the outline_designer_og module which provides a link to groups to edit books created within that group.
* Rearranged hook_init + hook_form_alter implementations to remove coupling w/ the admin book edit form.
* Added a drupal_alter to the add_content action so outline_designer_og can add og info to the $node object.
* Reformatted a bunch of stuff (which added the bulk of new code in the patch. I really didn't change *that* much).
* Turned a number of the functions in scripts.js into Drupal.behaviors so they'd apply again on form elements once the form was reloaded.
Errors I'm seeing
* After reweight. I see in firebug
uncaught exception: Syntax error, unrecognized expression:* After adding a new node or duplicating a node, the title isn't added until I refresh the page.
* When duplicating a node, if I leave the text field on how the new title should be formed as "%title (Copy)" I get a HTTP 400 Bad Request error.
Still needs to be done
* Fix above errors.
* Add documentation on new code.
In retrospect it would of been nice to break this into several patches. Several to add the pieces of new functionality and then another to fix formatting but I didn't really know where I was going when I started and it all got tangled up. Anyways, I think the new changes are pretty solid and don't affect any existing functionality (though I haven't checked for the above errors yet against a new checkout.
Comment #6
kyle_mathews commentedAlso, the patch is made against HEAD (http://drupal.org/node/235929/cvs-instructions/HEAD). I'm not sure if this was the actual branch which you're committing to so if I need to make a new patch, tell me posthaste.
Comment #7
btopro commentedYeah I'm pretty poor at branch management so I don't think head has been used. Semester is pretty crazy at the moment so it'll take me some time to review. Anyone else able to apply this and give feedback?
I agree on the API for access to books but that'd be a pretty big undertaking / seemingly needing integration with a different module. Seems a bit outside the scope of a usability project at this time.
* I removed the "access ajax" permission as it's redundant. If someone can administer books they can access the ajax callback.
So now the ajax path is protected by the admin book permission? I think if you're going to give people permission to it based on OG then maybe there needs to be permissions per function in that ajax path.
* Removed the license declarations. Drupal.org automatically adds a LICENSE.txt file.
I was told for release purposes of the university that I needed to have that statement in each file used in the project. If it's the same as the liscence.txt then everything after the initial line can be removed and something saying "refer to liscence.txt" would probably work. It's purely a legal release thing on the part of our environment.
* Added the outline_designer_og module which provides a link to groups to edit books created within that group.
Haven't looked at the patch yet but is possible for the hook to the page rendering the book on a non admin path also be used by people outside of OG? It's been in the queue for a long time to allow non-admins to use this module to outline their material. Could be related to the permission restructuring issues we've already outlined though unfortunately.
* Rearranged hook_init + hook_form_alter implementations to remove coupling w/ the admin book edit form.
This probably steps in the right direction for the previous statement.
* Added a drupal_alter to the add_content action so outline_designer_og can add og info to the $node object.
makes sense. This actually was in an internal dev 5.x version and then removed because of system complexity.
* Turned a number of the functions in scripts.js into Drupal.behaviors so they'd apply again on form elements once the form was reloaded.
Already thought I did that but if you applied it to more then cool.
Comment #8
kyle_mathews commentedSo your worry is that just giving blanket permission to OG admins to delete, duplicate, rename, etc is too much? So that there should be the ability to turn off those permissions as needed? So how would that work? Build into the ajax callback permission checking on the user for the different actions? It's probably not the best idea on the other hand to show people functionality that they can't do so it should be removed before hand.
It'd be entirely possible to setup something like that. You'd just need to follow the same pattern as outline_designer_og and create three pages, one to show books that belong to a person, another to edit that book, and then another ajax callback w/ each menu item having its own access control in place.
Comment #9
btopro commentedObviously people wouldn't be able to create content of type x if they already don't have that permission (these escalations are all ready checked for and built in) but I'm saying maybe you want members of a group to be able to reorder content and create it but not to mass delete it. Instead of giving the ability to do something or not do something that they can't already do, you just remove their ability to do it through that interface. Duplicate content, yeah I can copy and paste stuff to make new nodes but maybe people don't want users to be able to automatically replicate tons of content. Just thinking out loud with the concept if permissions are something we're delving into.
I'll have to investigate the non-admins and people outlining books as this is something that's been asked for a bunch in the past and I end up giving our internal people some admin permissions to be able to get to book outlines (which I'd rather not do).
Comment #10
kyle_mathews commentedFound another bug. If you do an action but then grab an item to move it before the table is reloaded, you won't be able set it back down after the table is reloaded. Every time I try clicking to place it somewhere, in Firebug I just see the error
uncaught exception: Syntax error, unrecognized expression:.Comment #11
btopro commentedare we talking after patch or before? Start reporting bugs if they're general to 1.1 :p
Comment #12
kyle_mathews commentednot sure... :) I do need to compare a 1.1 install w/ my changes to see.
Comment #13
kyle_mathews commentedOh and is it turns out, cvs diff doesn't include new files/directories. Stupid cvs. Attached is the outline_designer_og module which should be added as a subdirectory.
Comment #14
kyle_mathews commentedSlight update to outline_designer_og. If the node isn't a group node, never show the edit books link.
Comment #15
kyle_mathews commentedCheck that the group has a book in it. If not, don't show the edit book link.
Comment #16
btopro commenteddo I need to apply each of these patches or just this last one? Working through some OG issue queue issues today and wanted to lump your upgrades into version 1.2
Comment #17
kyle_mathews commentedJust the last one. I was updating the patch as I changed things.
Comment #18
btopro commentedHmm... applied patch, added outline_designer_og. White screen / error on install (fresh copy of D6 w/ og module and outline_designer only). If I kill off the outline_designer_og module it comes back up. Investigating...
Comment #19
btopro commentedFixed the wsd. Had to do with a db object not being stored locally before trying to check if it was empty or not. Must have been something specific to PHP versioning. I'm trying to make the tab show up that displays all the books that are in a group cause it seems to show up sparingly but I believe these patches are almost ready for the next version.
Comment #20
btopro commentedIn case you're wondering what issues I had to fix since I know you patched OD for eduglu. There flaw I had to fix was:
line 75, you couldn't do the empty() check on the entire thing without storing it in a variable first (using MAMP php 5.3). So I replaced it with the following
$val = db_result(db_query("SELECT bid
FROM {book} b
JOIN {og_ancestry} o
ON b.bid = o.nid
WHERE o.group_nid = %d
LIMIT 1", $node->nid));
if (empty($val)) {
return 0;
}
Also. You had !empty return 0 which was removing the edit books menu item for groups that had a book in them and putting it on screen when there weren't any books in a group :)
Patch should be good to go, I'm going to try and make the collapse by default stuff work now and hopefully will have a new version out today or tomorrow.
Comment #21
kyle_mathews commentedK, I think I might of been seeing the bug related to what you found. Awesomesauce. I'll be looking forward to the new release and will test it when it gets out.
Comment #22
btopro commented1.2 will have this feature, kyle confirms it's working. awesomesauce indeed!
Comment #24
btopro commented1.2 has this functionality, marking as such because of the SA delay