Closed (fixed)
Project:
Organic Groups Menu (OG Menu)
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
15 Jan 2011 at 08:36 UTC
Updated:
19 Aug 2011 at 12:42 UTC
Jump to comment: Most recent file
Comments
Comment #1
geerlingguy commentedI may start work on this today, as I have a few hours, and am interested in getting it up and running with a live site.
Tracking here: http://archstldev.com/node/803
Comment #2
marcp commented@geerlingguy - If you've got any input on either #1031886: HEAD or DRUPAL-6--2?, #1031716: Node gets removed from menu when user has 'administer nodes' but not 'administer menu' or #993518: JS Error when Audience becomes a Select I'd love to see another stable 6.x release before this gets ported to 7.x.
Comment #3
bryancasler commentedsubscribe
Comment #4
jide commentedYes this is a good idea, of course ;) I'll try to fix remaining issues before and then port the module to 7.x.
Comment #5
pjcdawkins commentedSubscribing
Comment #6
TapioK commentedSubscribing.
Comment #7
jide commentedI'll have to update OG Menu to D7 for a project I'll be working on soon (next month), so don't worry, it will be real.
Comment #8
geerlingguy commentedSweet. That's the last puzzle piece in one side project I've almost completed, it'll be great to have it to test!
Comment #9
Jackinloadup commentedFollowing.
Comment #10
s.daniel commentedHas anyone started work yet?
We are currently thinking about wether to use Domain or OG for a new site and would like to team up in case OG is the choice.
Comment #11
Aeternum commentedFollowing too
Comment #12
stefan vaduva commentedI've started to modify this module in order to use it on a D7 website. Please note that:
- the code is still alpha quality (so I don't recommend to use it on production);
- the migration is a little bit "hackerish" (i.e. I just wanted this to work for now and I didn't care about any optimization);
- there are some very minor changes in the logic;
- I didn't looked at the JS yet.
Please test it and let me know if there are any issues (I'll probably get back to you very slowly, but eventually I will if nobody solves the issues before me).
Ashsc, feel free to use this to make a new D7 branch if you wish.
Comment #13
jide commentedHi Stefan,
Nice to see someone taking the initiative of the D7 port. Ashsc is not the official maintainer of the module anymore (for a long time ;) ), I am.
I will look at the code as soon as I can. Thanks !
Comment #14
s.daniel commentedInteresting post about the changes and the current state of og: http://www.gizra.com/content/og-7x-11-rc2-out
Comment #15
endiku commentedsubscribing
Comment #16
mlconnor commentedsubscribing
Comment #17
bryancasler commentedJust tried installing the D7 version provided in #12. Ran into this right away.
Comment #18
stefan vaduva commentedJide, sorry. I didn't checked the commits.. I was just looking at the owner of the module page :) Let me know if you need help.
Animelion, remove the calls to drupal_install_schema('og_menu') and drupal_uninstall_schema('og_menu') from og_menu.install.
[edit]Regarding Animelion's problem: back then I didn't know that you don't need to explicitly call drupal_install_schema and drupal_uninstall_schema in .install for D7.
Comment #19
crispinbailey commentedsubscribing
Comment #20
nicksanta commentedHey guys, I need to get the ball rolling on a D7 port as it's holding up one of our projects now. I'm taking @Stefan's zip from #19, patching a copy of the current d6 HEAD with the changes, and putting them up on a public github repo. Will report back here when I get that done.
Comment #21
nicksanta commentedIn response to #20, I've created a 7.x-2.x branch of the module on github: https://github.com/nicksantamaria/og_menu
Nothing worth pulling yet though.
Comment #22
nicksanta commented@jide: I've gotten the 7.x-2.x branch to a workable state, and is ready to be pulled from https://github.com/nicksantamaria/og_menu
If you're needing someone to do this for you, I'd be more than happy for you to add me as a co-maintainer. If you view my profile you'll see I've been maintaining a few modules for a while.
Comment #23
treksler commentedSUBSCRIBE
Comment #24
rv0 commentedsubscribe
@nicksanta: thanks for your effort.. How "safe" is this module? I mean, if I install it and use it, decide to uninstall it later, will it leave a mess?
Btw, it would be better to make a sandbox project for this, as it has a normal issue queue.
Comment #25
rv0 commented@nicksanta
on submit of admin/structure/menu/add i get "undefined function og_menu_edit_menu_form_submit()"
Comment #26
mefisto75 commentedsubscribing
Comment #27
nicksanta commented@rv0 - Thanks for reporting that. I'd moved some submit handlers into an include file, which wasn't being included for that particular form. Pull again and you'll get the fixes. It shouldn't require a cache clear.
Also, in terms of it being "safe" - as far as my testing has shown, all the og_menu database tables are removed when you uninstall the module.
Comment #28
rv0 commented@nicksanta - Thanks for the quick fix! I'll let you know when I run into any other issues
Comment #29
rv0 commented@nicksanta
I'm delving into the code as I ran into some issues.
I think a fatal mistake is being made by using the entity id instead of the group id
I'm gonna try and roll a patch for the next few hours
Comment #30
rv0 commented@nicksanta - Ok so I went through the code and changed nid to gid everywhere I could
Appears to be working so far, but I doubt all work is already done.
Patch made against latest head from https://github.com/nicksantamaria/og_menu
this _WILL_ break your current og menu's as their name and gid changes in db (unless, the only content on your site is OG's, because then nid and gid would be synced)
Comment #31
rv0 commented@nicksanta - Fixed some minor issues in #30
Comment #32
Pavlos-1 commented+1
Comment #33
fubhy commentedI didn't have time to look at the code (yet)... What concept are you going for in D7?! I feel that the "Single Menu" / "Multiple menu" Block approach and thousands of menus in the Drupal core menu table is not the right way to go. I was thinking about something like having admins create normal menus in the menu table and then assigning them to a group content type, thus making it available to the group to maintain its own links in there (admins can also insert global links). The custom per-group links would then be stored in a {menu_items} fashioned way in a {og_menu_items} table and managed through the group admin interface. Upon rendering of the menu via any of the native rendering methods (normal menu block, static, or menu_blocks module) we would then append the custom group links to the global menu links of those menus. That way it would be possible to maintain a group-type dependent global structure (views pages with group context, etc.) + static node links in one single menus without cluttering the global menu table.
... Thoughts?
Comment #34
Aeternum commentedMany thanks for your efforts rv0, nicksanta.
I've just checked out the latest git and applied rv0's patch and I get:
Notice: Trying to get property of non-object in og_menu_form_alter() (line 316 of \sites\all\modules\og_menu\og_menu.module).When clicking Add menu.
Will look into it and post a patch if I manage to find the problem
Comment #35
rv0 commented@fubhy -I fully agree with what you say. Seems like a lot of work though. Maybe we should first try to push a stable D7 port. Then work on an upgrade path / partial rewrite
@Aeternum - I couldn't reproduce your errors. Are you using the latest version of og (dev) ?
Please try if the error occurs with nicksanta's unpatched module.
----
Some more info about my patch:
In drupal 6 the nid and gid are always the same, in D7 that is not the case. The current port was using node id everywhere (and calling it a gid), I changed that to use the gid as that seems more logical to me.
Comment #36
Aeternum commentedOkay, the issue had to do with when you did not have an existing group that matched a database query.
Patch which continues off rv0's work attached
Comment #37
Aeternum commentedrv0, didn't see your comment until now.
The problem was the query on line 309 was not returning anything:
$value = db_query("SELECT gid FROM {og_menu} WHERE menu_name = :mname", array(':mname' => $form['menu_name']['#default_value']));And the module was trying to use the result. I was using the code from nicksanta's repo and applied your patch. Did you still want me to roll back and try it without the patch?
Comment #38
fubhy commented@rv0 : Thanks for the quick reply. I am available nearly 24/7 on IRC (#drupal-omega / #drupal-contribute). I think it's not much more work than the current approach and since its a heavy API change it should be done before any serious implementations on this module are done as migration could be tricky! I am fairly experienced with the menu system and could help you with the implementation. We could make a second sandbox for this code until its finished if you want to keep og_menu 7.x the way it is, however I sense that we are going to run into a dead end with the current concept. The menu administration is going to be a pain on a large group based community website. Imagine the bazillion menus on the global menu table.
Comment #39
Aeternum commented@rv0: It seems that numerous things don't work when trying to add a menu through the admin/structure/menu/add path. og_menu expects a group context, and it isn't there.
I've never worked with the D6 version of og_menu, so I don't know the expected behaviour of the module there.
However, I've just tried going to the menu tab on a group, and that works nicely.
Comment #40
rv0 commented@Aeternum - ah indeed, I see whats going wrong there. Think it can be fixed easily, might have time for it this evening.
been talking to fubhy on irc, I agree with him that a more thorough rewrite would be better. Flooding the core menu table like in D6 is very dirty if you have a lot of groups.
Comment #41
Aeternum commentedrv0, fubhy: I understand that you would like a clean code base, but on the other hand I've been waiting on a D7 version of this module for a while.
If I continue using it as it is, and contributing the occasional patch when something breaks am I wasting my time? ie. Will there be an upgrade path from this dev version to what you're planning to do?
Sorry if that sounds selfish! But as i said, I'm happy to contribute where I can
Comment #42
fubhy commented@Aeternum: rv0 will continue developing the current approach and I will start building my concept into a Sandbox Project soon. It's way too soon to make any promises for upgrad path and the like but I guess that its a requirement.
I concluded that merging this with the current menu system is not 100% possible as it is not pluggable to the degree that I would need it to be (I can't alter the list of menu items, etc.). A solution would probably be duplicate the Core menu system functionality (including a similiar UI) into a new module. This would basically replicate the whole menu system functionality in a "Contextual Menu" way (not even Organic Groups only... Any context should be possible). I would probably go about this my assigning each menu item to a entity_id and entity_type. My "og_menu" implementation would then implement this functionality and allow for administratos to create menus and assign them to entity bundles (in the case of Organic Group that would be any node bundle that is a Group Content Type). The assigned "Contextual Menus" could then be edited from within each group of that Group Content Type individually.
The caching would have to be changed slightly to include the context in the Hash ID of the cache, but apart from that this should work!
Comment #43
Aeternum commented@fubhy: Thank you for the explanation. In that case, I will continue as normal.
@rv0: I think I found another issue. function og_menu_access, line 489, of og.module has:
if ($node && og_is_member($node)) {og_is_member expects a a $gid, not a $node so it always returns false. I've worked around this for the moment by replacing it with:
if ($node && node_access('update', $node)) {But I'm unsure if this is the right approach to take. Certainly calling og_context()->gid is incorrect.
Cheers,
Frederik Grunta
Comment #44
Aeternum commented@rv0: Found another that I'm unsure of how to approach
At node/x/og_menu/menu_name the current menu is shown. If there are no items, the text:
There are no menu links yet. Add link.is displayed. This links to admin/structure/menu/manage/menu_name/add. A user without permission to access admin screens gets an Access Denied message if they click "Add link", while the tab with "Add Item" links to /node/x/og_menu/menu_name/add and works correctly.
The "There are no menu links yet. Add link." is generated by menu_overview_form, and I'm not sure how to override that.
Comment #45
Aeternum commentedIssue:
og_menu_overview_form() tries to set a submit callback to menu_overview_form_submit, but this doesn't work. Adding:
to og_menu.pages.inc resolves the issue.
Comment #46
Aeternum commentedIssue: Users can add menu items to any menu in the site, even if they don't have permission for it.
Resolution: Change og_menu_edit_item_form() to the following:
Also, og_menu_menu() access arguments are wrong.
I can submit a patch with my changes so far, if anyones interested.
Comment #47
fubhy commentedPatches are always prefered over simple "code" snippets in the Issue :P
Comment #48
Aeternum commentedAll changes so far + fix for #44
Comment #49
Jackinloadup commentedi would be interested. I'm planning on attempting to use this soon and would love to have the lastest changes available.
Thanks for the hard work @rv0 and @Aeternum and anyone else I missed.
Comment #50
Aeternum commentedThanks, Jackinloadup
- Fixed code which still used D6 style theme functions
- Fixed a couple more calls to menu_parent_options(). This allows new content to be added directly to a menu - but the option doesn't exist when no normal menu items are available - unsure if this was how the original D6 version worked or not.
I'll leave it here for today. The module still isn't usable - everything breaks when a non-admin user tries to create a page which is a group content type.
Comment #51
Jackinloadup commented@Aeternum do you know the scope of what else needs to completed before we have a useable module?
Comment #52
Aeternum commented@jackinloadup: Really not sure - I keep thinking "almost there" and something bad keeps happening.
Next patch attached - it seems to be working okay now - users are able to create and edit menu items. The node edit form still doesn't show the current state of the menu, though.
Then ran into #942782: Custom menus never receive an active trail which stopped me testing further, but could be a major problem for this module
Comment #53
rv0 commented@Aeternum
Got some whitespace warnings applying your latest patch to nicksanta's branch
Looking into remaining issue(s) now
Comment #54
rv0 commentedSome tiny changes
- added extra contributor credit to the .module file
og_menu_overview_form
- changed the "There are not menu links yet." text to include a link to add an item.. bit nicer than Aeternum's fix ;)
og_menu_edit_menu_form
- was still using nid
Listing the menu's on /og_menu was broken, this patch should fix it.
Comment #55
Aeternum commented@rv0 Argh, I just had my changes and now yours too!
If we are going to continue developing on this, I don't think we can keep commiting in a patch file that gets larger and larger. As Nick Santa seems to have dropped off the radar for the moment, I have started a sandbox and commited our latest changes to there. It's over at http://drupal.org/sandbox/Aeternum/1237772.
I added all of your changes in, but couldn't find your change for "Listing the menu's on /og_menu was broken, this patch should fix it."
Comment #56
rv0 commented@Aeternum - What changes have you made?
The listing of menu's is fixed by the changes to the functions I mentioned.
good idea about the sandbox, I don't know if you can make me co-maintainer on the sandbox? Don't have to, I can keep posting patches in the issue queue there.
TO ALL: please submit issues for the project in Aeternum's sandbox (see #55)
http://drupal.org/sandbox/Aeternum/1237772
from now on, all patches in this issue should be ignored and development may continue from the sandbox's codebase.
It is important that everybody tests and makes issues for the bugs so they can be fixed :) http://drupal.org/sandbox/Aeternum/1237772
Comment #57
Aeternum commented@rv0: Good stuff! I've made you a full maintainer.
Also, I have posted an issue for you in the issue queue :-)
Comment #58
fubhy commentedAeternum, please contact me on IRC once more... I can give you another hint for the menu blocks problem.
Comment #59
kika commentedsubscribing
Comment #60
jlaurin commentedSubscribe
Comment #61
rv0 commentedquick update:
Sadly no time this week to push this forward.
The project in the sandbox is pretty well advanced, but we need to fix some issues (including one critical) before pushing forward a dev release.
Stay tuned or help fix them :)
Comment #62
philipz commentedsubscribing
Comment #63
rv0 commenteda dev version for D7 is now available
please create issues for any bugs you might find.
there currently is _no_ upgrade path from D6