#484820: Initial D7UX admin header landed with a default set of shortcuts in a custom menu. The idea was that we'd allow admins to set up switching between different custom menus per user role, so that users in different roles will get shortcuts more relevant to their job (eg. moderators, content translators, etc. would get different shortcuts). User configurable shortcuts also came up. IMHO depending on what level of customization we need, this should either be implemented with a set of custom menus (if we have a small set of fixed shortcut sets) or some custom way, since setting up per-user custom menus would be pretty overkill (if per-user customization is deemed important).
Comment | File | Size | Author |
---|---|---|---|
#191 | please-STOP-this-HORRIBLE-Toolbar-coupling. | 11.74 KB | sun |
#188 | 511286-fix-menu-names-test.patch | 1.53 KB | Damien Tournoud |
#187 | 511286-fix-menu-names-test.patch | 1.34 KB | Damien Tournoud |
#182 | shortcuts-511286-182.patch | 64.73 KB | David_Rothstein |
#182 | interdiff_171_182.txt | 9.71 KB | David_Rothstein |
Comments
Comment #1
leisareichelt CreditAttribution: leisareichelt commentedhi Gabor, thanks for opening this up.
What Mark & I had envisaged for the toolbar was:
- initial state = role based shortcuts (following our 'make smart defaults' principle. So we would need to define what roles and associated shortcuts come out of the box. The only one we have done to date is Content Creator so we welcome input to for others
- then, once you're set up in Drupal you can over-ride the default state and choose your own set of shortcuts. What we had envisaged here was to identify a defined set of shortcuts/icons that the user can select - probably something in the region of 2 dozen options, which would probably include a completely customisable option.
Something we think is very important is to limit the number of shortcuts in this bar so that they actually still remain shortcuts. Once you start putting more than 5/6 icons in there then the efficiency intended for the icons will begin to reduce significantly and you effectively create a second, competing Information Architecture.
We have seen Jeff Noyes' proposal at http://blip.tv/file/2304921 and would strongly recommend that this *not* be the default implementation of shortcuts as they introduce far more complexity than is necessary for the average user. Having said that, it would probably make an excellent contrib option for people to install should they so desire, it is quite complex but also quite fun and for power users may definitely be a useful tool.
So, if we are to proceed as per the original vision, tasks remaining include:
- define a complete but limited set of optional shortcuts
- define sets of role based shortcuts as defaults.
Comment #2
moshe weitzman CreditAttribution: moshe weitzman commentedSubscribe.
Comment #3
joshmillerAs of Drupal 7, we have three default roles:
I'd say that Authenticated users only get a shortcut bar that includes the ability to list their own content, edit their profile, and logout.
Administrators should be able to add content, find content, see reports, and visit the dashboard.
Oh... and... uh... subscribe.
Josh
Comment #4
eigentor CreditAttribution: eigentor commentedAdded tag d7ux.
Comment #5
catchAuthenticated users won't see the toolbar at all unless they have permissions, which seems unlikely on anything but intranet sites, so for me the main thing would be an 'admin user' set of shortcuts, but make sure there's the ability to show more. Adding another role to core we can discuss in a separate issue, shouldn't let that discussion affect work here.
Couple of implementation questions - if we're having shortcuts per role, then we probably need to either merge shortcuts for users with more than one role, or add role weighting so one can have precedence. Not sure about either of those options in relation to this (although there's an issue for role weighting somewhere).
Comment #6
webchickSubscribing.
Comment #7
webchickI think we really need to see some traction on this issue this week, or figure out what else to do with that toolbar (such as remove it).
Comment #8
webchickComment #9
Gábor HojtsyMark designed a flow which calls for an "edit shortcuts" link at the top right of the shortcut bar. Since this one in itself will provide enough space to discuss, I'm putting up an initial patch.
This one just links this to the menu page, which is (cough, cough) something similar to what Mark proposes. The focal point of Mark's proposal though is that we have limited slots, and you cannot just add more items as you wish. The maximum number of slots could be defined based on the expected / max width of items including the icon and the expected / max width of the screen. So counted based on like 3-4 variable factors. You know this is like saying I have no idea :)
Also, maybe more importantly, we'd need a way for these menu items to get an icon. We might have a set of icons bundled with core and the user might need to upload another one. How do we handle the upload and storage of these icons is a question.
Finally, the mockups and original plans call for a list of predefined actions (additionally to letting you to add arbitrary items), so we'd need some kind of space to have these predefined actions and let them be added to the menu. The mockups have a set of slots with predefined and another set of slots with enabled/positioned items.
Whether we try to steer the menu UI towards this concept or just implement a specific UI for this purpose (like how books are another custom UI on top of menus) is also a point we can talk about.
Comment #10
Gábor HojtsyUps forgot to attach the pdf with the wireframe.
Comment #11
eigentor CreditAttribution: eigentor commentedIs there an easy way we could offer the user to choose an icon to his custom shortcut? The icons could be predefined - I know this from Software like Freemind or Mindmeister. So technically it could be a sprite that contains all options.
Comment #12
Gábor HojtsyVisuals for the "add to shortcuts" link on the overlay (but should work similarly in Seven when not delivered in the overlay).
There is a hover state for the add to shortcut link:
So in summary this is about:
- you have a fixed number of places to put shortcuts into
- we have a set of predefined icons assigned to shortcuts, you might want to upload another one
- you can add any page to the shortcuts via the "add shortcuts" button by the title
Comment #13
dmitrig01 CreditAttribution: dmitrig01 commentedInstalling the module after applying my patch is giving me a WSOD, not sure why. But, I've completed the schema and most of toolbar.module, now what's left is interface.
Comment #15
dmitrig01 CreditAttribution: dmitrig01 commentedFixed the problem, patch forthcoming.
Comment #16
dmitrig01 CreditAttribution: dmitrig01 commentedHere is today's progress - http://screencast.com/t/DStGmKZbXQm
Comment #17
dmitrig01 CreditAttribution: dmitrig01 commentedwhoops, without that content_types.js hunk
Comment #19
dmitrig01 CreditAttribution: dmitrig01 commentedvery slightly better JS logic
Comment #20
dmitrig01 CreditAttribution: dmitrig01 commentedI'm having trouble getting the submit function to fire. it's not related to the fact that this form has a custom theme - somehow, drupal_get_form is getting an empty $_POST array. However, when I print out the $_POST array before the page loads (e.g. before drupal_bootstrap in index.php), everything looks fine.
Comment #21
dmitrig01 CreditAttribution: dmitrig01 commentedOops, found the problem. Switching sets now works. Next up: adding the link next to the title (I need the graphics please) and saving the main page. Then editing and deleting shortcuts, last tests.
Comment #22
David_Rothstein CreditAttribution: David_Rothstein commentedCould you clarify why you are using a custom implementation for this rather than trying to add a "per-user" capability to the menu module or perhaps block module itself?
I realize we're painfully close to code freeze, but at first glance it seems to me like the toolbar module really should integrate with existing systems in Drupal rather than coming up with its own entirely separate system. And a more generic per-user capability is something that might be reusable in many places -- for example, the possibility of having per-user dashboards in #544360: D7UX dashboard module rather than being limited to a single site-wide admin dashboard.
Comment #23
Dries CreditAttribution: Dries commentedPersonally, I'm OK with using a custom storage model. I don't see why we need to force this into the menu system, especially because we don't want to leverage the menu system's UI.
Comment #24
Dries CreditAttribution: Dries commentedTagging.
Comment #25
karschsp CreditAttribution: karschsp commentedI think the text "Add shortcut" is a little unclear. It almost implies that you're adding a new shortcut or link to the current page you're on. Maybe a change to "Add to shortcut bar" or just "Add to shortcuts" would be better?
Also, I'm getting an error when attempting to edit or delete a shortcut:
Comment #26
franskuipers CreditAttribution: franskuipers commentedMore Awesomeness!
The link text is not very clear..... I could not imagine what would happen by clicking on the link
My suggestion would be: "Add shortcut to toolbar" (does a new user know difference between toolbar and shortcut bar?)
Now i have added "People" to the shortcut bar. I still see "Add shortcut" link on the page. When I click on it, I see "People twice in the shortcut bar.
Get the same error when i want to delete the second "People" on the "Edit shortcuts" page.
Comment #27
sunThis needs to be a separate module.
Comment #28
Gábor Hojtsy@sun: Many people said that the shortcuts without the ability to customize them are useless. How do you envision them working then? Especially if they are not tied to the menu system/schema anymore.
Comment #29
sunI'm just saying that a shortcut/bookmark functionality like this should live in a separate module, because the functionality is not bound to Toolbar module. There are other modules in contrib, for example, Administration menu, which would be able re-use the data without having the Toolbar enabled, if the shortcut functionality is properly separated.
Hence, just move the functions into a shortcut.module.
Comment #30
catchSeems like it wouldn't be too hard to have the shortcuts and expand/collapse buttons only appear if module_exists('shortcuts'); - or have shortcut.module as a requirement for toolbar.module
Comment #31
dmitrig01 CreditAttribution: dmitrig01 commentedThe link will change (it will look like the mockup) - that link it just to ensure that the functionality works. re: the delete page - that's not yet implemented - i'll upload a patch for that in a few minutes.
Comment #32
dmitrig01 CreditAttribution: dmitrig01 commentedOk this should work, now I just need tests and the graphic.
Comment #33
dmitrig01 CreditAttribution: dmitrig01 commentedother than the icon and the fact that this needs tests, please review
Comment #34
catchThis really looks like shortcut.module and a dependency for toolbar to me. Will try to review functionality later. Also can't see that an icon should be a dependency - could just use a link and fix after freeze IMO.
Comment #35
dmitrig01 CreditAttribution: dmitrig01 commentedI did the graphic myself and i think it came out really well, but i can't seem to install head. will try again tomorrow morning. If anyone can install head, please please PLEASE try out this patch.
The graphic belongs in modules/toolbar/toolbar.png
Comment #37
dmitrig01 CreditAttribution: dmitrig01 commentedI don't see how the fails have anything to do with the patch...
Comment #38
TheRec CreditAttribution: TheRec commentedMost functions header comments are not following the coding standard. They should all start with a verb in the third form, even the one-line header comment. This also concerns the theme functions AFAIK and since recently hooks implementations ("Implement" should be now "Implements" according to the current version of Coding standards).
I think you can remove one of those new line.
The description should be on a new line under @file.
Missing function header.
Hmm, this is not passing though FAPI, shouldn't we be more careful with the values used here ?
It could be before another function, but you should describe how are handled toolbar sets and what they are.
These should have complete function headers, you are not describing the parameters.
Should also start with a verb in the thrid form, even if it is Javascript :)
Would be more clear like this : Selects the corresponding radio button when user enters a text into the "New set" textfield.
The text of the link should be localized with t(). And maybe not include the "+" which is a visual aid, but for people with screenreader it is not really helpful.
Why are you removing the path based CSS ID ? It is buggy #551172: Use path based CSS classes instead of ID to style toolbar items individually (for icons) (reviews appreciated) but I don't see why you would remove it in this patch.
I leave it "CNR" to let you retest your patch, but you should set it to CNW if the testbot does not do it for you ;)
Comment #40
rfayI got a chance to take a quick spin with this, only as a user viewing the user experience.
It was easy enough to figure out how to use it.
It is very disconcerting that when you click the "Add to shortcuts" button you *always* get a new element named "shortcuts", pointing to admin/settings/shortcuts. I would expect a form to open with the title and link fields ready for editing, rather than an unuseful pre-created link.
Comment #41
sunuhm, please no dependency on Toolbar. That would be the same as stuffing the code right into Toolbar module, because Toolbar would have to be enabled for the Shortcut module.
Comment #42
David_Rothstein CreditAttribution: David_Rothstein commentedI agree that we need to implement this in a reusable way. As mentioned above, doing it within the menu system seeems like a serious option that is important to explore.
So, here's an alternative patch that implements things via the menu system (but still uses a large part of @dmitrig01's code, especially the theme-related parts). I think having the patches side by side will help compare the two options.
Possible advantages of this patch:
Things that don't work right yet:
Anyway, I don't mean to hijack this issue or anything :) But I think we should consider the two approaches and make a decision so that the code here is as effective and reusable as possible.
Comment #44
catch@sun #48 - I mean make the toolbar module depend on shortcuts rather than vice versa.
Since we've got a perfectly good mechanism for storing links to internal pages in Drupal, it makes sense to rely on the menu system here rather than bypass it, having said that I've not looked at David's patch at all.
Comment #45
ksenzeeI've looked at dmitri's patch and am reviewing David's now, but in the meantime, here's a reroll of David's that applies to HEAD.
Comment #46
ksenzeeI think it is probably wisest to reuse the menu system, rather than duplicate half its functionality. I have a few concerns:
* At the moment, the shortcuts in the toolbar don't change when I edit the shortcut menu. Not sure what's up with that.
* I'm a little iffy about the term "parent" for menus. "Parent" is already specific in the menu context, and this is an entirely different meaning for it.
* It seems odd to create an entirely separate "basic" UI just for toolbar shortcuts. I don't suppose there's any way around it. Maybe we should call it what it really is -- a UI specifically for shortcut menus -- instead of basic/advanced? Just thinking out loud here.
* How will per-user menus scale? Are we going to end up with 200 menu blocks exposed on a site with 200 toolbar users?
Mostly, my concern is putting this feature in core hours before code freeze, when only a handful of people have even tried out either of the extant patches. I guess there's nothing to be done about that, unless we kick the toolbar out into contrib. Certainly if the toolbar is in core, this needs to be, and I think the menu-based approach is the most sensible one.
Comment #47
David_Rothstein CreditAttribution: David_Rothstein commentedProbably you've already edited the shortcut bar, which means that the one in the toolbar is your own personal version, not the sitewide one that shows up in the Menu Module UI.
We'd need to fix that confusion by putting something like the following when you try to edit the global version of a customized menu:
Maybe it's just me, but I feel like I'd use that UI all the time. 90% of the time when I'm editing a menu, I only care about the top-level items, not the entire tree with all its complex options.
In the current version of my patch, per-user menus are not listed in the UI, and are not exported as blocks. I think that qualifies as a feature, not a bug, but I'm not sure :)
Comment #48
dmitrig01 CreditAttribution: dmitrig01 commentedI split out simple v. advanced into another patch - #564886: Remove 'expanded' checkbox from menu item overview. I'll re-roll this patch without it.
Comment #49
dmitrig01 CreditAttribution: dmitrig01 commentedComment #50
dmitrig01 CreditAttribution: dmitrig01 commentedComment #52
mgiffordOk, this would be great to get into D7.
There's a spelling error - /admin/structure/menu-customize/admin_shortcuts1/edit
The Admininstration shortcuts menu contains commonly used links for administrative tasks.
I can move around the links in the Administration shortcuts, but I can't add one. Well, not really. It looks like I can, but clicking on 'Add link' sends me - /admin/structure/menu-customize/admin_shortcuts1/add
Which is all fine until I hit save, when I jump from being in 'Administration shortcuts' to being in 'Main menu'.
All the links I add go into the wrong menu.
Anyways, do think that customizable links is a very good idea!
Comment #53
mcjim CreditAttribution: mcjim commentedFrom a UX perspective, the patch is almost there, but on closer inspection there are bigger issues.
Random notes:
It's a good idea to have separate menus per user.
This functionality should be in its own module or in menu.module, certainly not toolbar.
On clicking the add to shortcuts link, where do we want to go? I suggest staying where we are rather than taking the user to the menu_customize page.
Could potentially make the menu_links table HUGE.
There is a load of duplication for each menu link.
We should look at another way of storing these custom menus, a new table is called for with the following fields (possibly):
{menu_name} {uid} {mlid}
So, instead of creating a seperate menu_name for each user's customised menu, we check the new table to see if the user has customised that menu, and if they have, pull in their list of mlids.
Would need to add rows to menu_items for paths that don't already have an mlid and delete rows that don't appear in any user's custom menus to clean this table up.
Could add a flag for each menu to allow it to be customised by users.
Users should be able to add *any* path (i.e. not already in menu_links) to the shortcuts.
Potential scenario: an admin user has a page (node) they edit often, would like to have a quick link to that.
Potential scenario: a registered user on the site has a page they like to refer to often, would like a quick link to that.
I think these are useful scenarios. It's going to be weird to users if they add certain pages to their shortcuts, but not others.
Administrators need to be able to set defaults for these menus, including defaults for roles.
Comment #54
dmitrig01 CreditAttribution: dmitrig01 commented> This functionality should be in its own module or in menu.module, certainly not toolbar.
There is not much left in toolbar module.
> On clicking the add to shortcuts link, where do we want to go? I suggest staying where we are rather than taking the user to the menu_customize page.
I disagree.
> Could potentially make the menu_links table HUGE.
this table is built to be huge.
> Users should be able to add *any* path (i.e. not already in menu_links) to the shortcuts.
They can.
> Administrators need to be able to set defaults for these menus, including defaults for roles.
They can.
Comment #55
mcjim CreditAttribution: mcjim commented> This functionality should be in its own module or in menu.module, certainly not toolbar.
There is not much left in toolbar module.
OK
> On clicking the add to shortcuts link, where do we want to go? I suggest staying where we are rather than taking the user to the menu_customize page.
I disagree.
This could be argued both ways, but I found it strange that it took me to the menu_customize page. If you add a bookmark in your browser, it doesn't take you away from the page you're on.
> Could potentially make the menu_links table HUGE.
this table is built to be huge.
But does all the info need to be repeated like that?
> Users should be able to add *any* path (i.e. not already in menu_links) to the shortcuts.
They can.
They can once they're at the menu_customize page. I mean, for the admin pages there's the Add to shortcuts link next to the page title, but not for normal nodes.
> Administrators need to be able to set defaults for these menus, including defaults for roles.
They can.
It's not clear how this is done. I may be being thick, but I can't see it.
Comment #56
David_Rothstein CreditAttribution: David_Rothstein commentedHere's an updated version of the patch that I think will pass all tests.
No other changes yet.
Comment #57
David_Rothstein CreditAttribution: David_Rothstein commentedRegarding some of the other issues above:
1. Administrators can set site-wide defaults for the shortcuts menu by going through the normal Drupal menu interface and editing the "Administration shortcuts" menu that you see there. That one is the site-wide default, and all user-specific menus inherit from it when they're created.
2. Currently, there isn't an ability to have default menus per role. However, you can sort of approximate part of that because Drupal's menu system only shows each user links they have permission to use. So if you stuff a bunch of administrative menu items into the site-wide default menu, then a user who only has content creation privileges will not see most of them on their own personal toolbar; they will only see the ones they have access to and that are relevant for them. Personally, I think that's all that's necessary for core to support directly; however, we should make sure it is possible for contrib modules to implement full shortcuts-per-role functionality. One way to do that is that currently in the patch, the toolbar module hardcodes the name of its default shortcuts menu as 'admin_shortcuts'. We could maybe add some kind of hook that allows modules to modify that.
3. In terms of duplicating information in the {menu_links} table, duplicating it is what allows each user to fully customize each menu item any way they want. I can't think of an easy way to accomplish that without duplicating it, but maybe there is.
4. I would tend to agree that the "add to shortcuts" link should appear on every page, not just admin pages. Right now, the placement of that link is controlled by the theme, and only the Seven theme implements it in the patch. So it would be easy to add to other themes, such as Garland. We should probably think about whether that's the best way to do that, or if there's a good way for the module to automatically add it to any page regardless of the theme.
5. A number of the bugs mentioned above (such as the inability to add a new menu item by clicking on "add link") probably come from the same root cause. By default, the user-customized menus are hidden and don't show up on menu lists. This is good in most cases (since otherwise the list would be overwhelmed by all the menus), but causes problems on any page that has a menu dropdown. If you're editing a menu item that's in a user-specific menu, that menu does not exist in the dropdown, so an incorrect item is chosen when you save it. I'm not immediately sure how to solve that, but maybe the answer is that you simply shouldn't see a dropdown at all when you are editing a personal menu item. There probably isn't much of a use case for moving one of these personalized/duplicated items from one menu to another...
Comment #58
int CreditAttribution: int commentedadd tag
Comment #59
David_Rothstein CreditAttribution: David_Rothstein commentedHere's an updated version of the patch:
Still not done:
I'm probably going to put aside work on this for a little while, so if anyone wants to take up those issues, please do!
Comment #60
pwolanin CreditAttribution: pwolanin commentedneed to read in detail, but Moshe pointed me to this issue.
1st thought is that having a single per-user menu for the toolbar makes sense - making every menu be per user sounds like a bit of a disaster, especially in terms of caching the menu structure.
Comment #61
David_Rothstein CreditAttribution: David_Rothstein commentedThe current patch does not make every menu per-user. It only does so for the toolbar menu. So we're all on the same page, at least I hope :)
Comment #62
pwolanin CreditAttribution: pwolanin commentedthis seems rather specific to the toolbar module - is there a common enough use case for this to much with the menu schema and access callbacks?
What's the purpose of 'original_menu'? In this use case it is always just one menu. I'm not sure I'd want these per-user menus even exposed in the menu module UI - that seems like a real usability problem for admins
Comment #63
David_Rothstein CreditAttribution: David_Rothstein commentedSee comments by @sun above for one possible use case outside of the toolbar module.
Contrib modules could clone other menus, and without that database column I don't think there would be any way to track which menu came from which.
They aren't :)
Comment #64
David_Rothstein CreditAttribution: David_Rothstein commentedTo clarify my comment "they aren't" -- the menus are editable via the UI, but they are not linked to from any of the listings in the menu module's administration pages.
Comment #65
Dries CreditAttribution: Dries commentedIt looks to me like trying to reuse the menu system gets us down into a rathole that negatively impacts both performance, the DX experience of the menu system, and the usability of the shortcut bar.
Leveraging the menu system at the API level might make some sense although things like 'original_menu' really smell like a hack to me. The new API functions don't bring me a lot of joy either. I'm also worried about the performance implications.
Leveraging the menu system at the UI level doesn't make sense as illustrated by the fact that we had to create #564886: Remove 'expanded' checkbox from menu item overview. Furthermore, UI strings like "You have a personalized version of this menu which you can edit instead." really confuse me. All of a sudden, the user needs to know that shortcut are menus?
How does a site administrator go about editing user ABC's shortcuts bar? For example, ABC created a custom shortcut but needs help removing or configuring it?
Comment #66
dmitrig01 CreditAttribution: dmitrig01 commentedI agree 100%
Actually using the menu system, the site admin can type in a URL and get it right but currently there is no interface for them to do that with the non-menu version of the patch.
Comment #67
sunHm. I just put some more thought into this. Here are the issues I see with shortcuts:
- Those shortcuts should be treated as bookmarks. Just like in a browser, the user should be able to just click a link/icon to add a new one. Clicking a link appearing on hover to remove them. (they are non-critical, so this can be done without any form or whatever). Hence, we do not expose the menu UI at all.
- I actually do not see a use-case for shortcuts; the most visited pages are contained in the upper management menu bar already.
- Albeit not per-user, the top-level management menu links in the upper bar can be considered as shortcuts already. If you want a new, you just move an item to the top-level.
- Lastly, providing a very limited set of per-user bookmarks is not really the job of a web site. Your browser already allows you to do that, so I really think we're trying to duplicate existing functionality. If users fail to use the bookmarks of their browser, then that's a usability issue with their browser, but not Drupal.
Comment #68
mcjim CreditAttribution: mcjim commentedThose shortcuts should be treated as bookmarks. Just like in a browser, the user should be able to just click a link/icon to add a new one. Clicking a link appearing on hover to remove them. (they are non-critical, so this can be done without any form or whatever). Hence, we do not expose the menu UI at all.
- This makes total sense. I'm starting to see this shortcut bar as an extension to browser bookmarks, but specific to a site.
I actually do not see a use-case for shortcuts; the most visited pages are contained in the upper management menu bar already.
- We don't know which pages will be the most visited for any and every site.
Albeit not per-user, the top-level management menu links in the upper bar can be considered as shortcuts already. If you want a new, you just move an item to the top-level.
- This wouldn't be as user-friendly or obvious.
Lastly, providing a very limited set of per-user bookmarks is not really the job of a web site. Your browser already allows you to do that, so I really think we're trying to duplicate existing functionality. If users fail to use the bookmarks of their browser, then that's a usability issue with their browser, but not Drupal.
- I think it would be a very useful addition to a website.
Think of your browser bookmark bar as top-level navigation for the web
The per-site shortcut bar is secondary-level. So, once the user has used their browser bookmark to reach the site, then can continue to dig deeper to favourite pages by using the shortcut bar.
For a busy admin, or user on a site with a lot of content/screens that they visit regularly, this could be a great help.
If you're setting up a site and are having for a short while to jump between a small handful of pages (as often happens with Drupal), being able to easily add (and eventually easily remove) some bookmarks would certainly help productivity.
Comment #69
dmitrig01 CreditAttribution: dmitrig01 commentedWhen I want to work on a client's site, i don't want to see bookmarks from the other client's site. With browser bookmarks, I'd always have to see both. With our solution, you'd only see bookmarks specific to your site.
Comment #70
joachim CreditAttribution: joachim commentedUsing the menu system means having to rewrite most of it from what I can figure -- we'd end up with mlids per user in the menu_link table and so on.
We can't stored just mlids per user or role because not everything that the user may want to save is an mlid: eg node/4.
So why not just store an array of path strings? If we have a 'add current page to my toolbar' link then we already know the user has access to the current path.
If roles or permisssions change then the user gets to an Access Denied page, but meh. They can just go edit their toolbar.
Comment #71
David_Rothstein CreditAttribution: David_Rothstein commentedIt's very simple to substitute in a different UI for this particular menu if we really want to, but I'm not sure that's a good idea. A "menu" is basically just a list of links -- when an administrator looks around their site, they see a bunch of these, and the shortcut bar is one of them. How does it help usability to have the UI for editing some of them be totally different than the others? For example, how do you explain to someone why, if they want to edit the list of links in the top level of the toolbar, that's a "menu" and they have to go one place to do it, but if they want to edit the bottom level, that's something else entirely, and they need to go to a totally different place and use a totally different UI? Providing consistent patterns is a major aspect of usability.
I think the decision to split out #564886: Remove 'expanded' checkbox from menu item overview to its own issue was the right one, because it is about making the menu UI simpler and easier to use. That's a good idea in its own right, regardless of what happens with the shortcuts.
Anyone seeing that particular message would already know that they are menus, but the message that appears in the reverse direction, maybe not. Anyway, there certainly needs to be some kind of cross-linking between the different shortcut sets; I'm not aware of any design that considered this, so @dmitrig01 and I each came up with our own mini-design for it :) I think something closer to his might be better (basically, a "change" link inline with the name of the thing you are editing).
Either way, there's certainly no particular reason the word "menu" has to appear in this text.
Like @dmitrig01 said, this is already possible; the question is whether it's an important enough use case to provide a direct UI for within core. If we go with @dmitrig01's "'change' link" implementation mentioned in the previous point, that might provide an automatic solution (but the list of links would not scale well if the site gave many different users the ability to personalize their shortcuts). Alternatively, there could be some link to the user's shortcut menu from their user account page, I suppose.
If this is an important enough problem to solve, it probably needs some dedicated thought around the design.
The 'original_menu' information could be moved to a dedicated database table pretty easily (at the cost of a small amount of complexity in the code) -- then it would just be a simple mapping. Or it could be removed entirely, but then any module which wanted to keep track of these kinds of relationships would need to figure out how to keep track of it on its own...
@sun, I think there is room to run with this idea, but I feel like you would still need some other UI as a backup. It seems to me like there are four things you really need to be able to do with these shortcuts: (1) Add them, (2) remove them, (3) edit them (i.e., change their titles), and (4) rearrange them. I am not sure how easy it would be to do all of those inline, especially in an accessible way.
It could be possible, however, to try to do something here like what is being done with #544360: D7UX dashboard module -- where there's a spiffy UI for adding/dragging things, etc, but you can still go in and use the block module UI as a backup method to configure your dashboard.
@joachim, why do you think that would be necessary? The existing patch works fine without doing any of that. It doesn't touch the "core" part of the menu system at all (i.e., includes/menu.inc) and only makes a few small changes to the existing code in the menu module.
Comment #72
Noyz CreditAttribution: Noyz commentedMy two cents in trying to understand this and address change for this design:
http://skitch.com/jeff.noyes/b6shr/administration-shortcuts-d7sandbox
Comment #73
Gábor HojtsyTried this latest patch with the overlay. Unfortunately it does not work well. I've added Apperance to the toolbar. While it was added to the menu link, since the page request is in fact in the overlay, the parent page was not reloaded and therefore the shortcut bar did not reflect the change. Also, it got the "admin/appearance?render=overlay" "path" added as a link, which does not actually work.
Also, (unrelated to overlays), it is entirely possible to add as many shortcuts to the shortcut bar as one wants, and when the number grows high enough, the edit shortcuts link drops to the bottom of the shortcut bar instead of the top.
Finally (also unrelated to overlays), there still seems to be no way to assign/edit icons related to these items, which should be an important consideration item when building the underlying implementation.
Comment #74
David_Rothstein CreditAttribution: David_Rothstein commentedAny suggestions on what to do? At first glance, this sounds like a more generic problem with the overlay - since all this patch is doing is grabbing a link, saving it, and using a drupal_goto()...
The rationale for not limiting the number of shortcuts is as follows:
I agree that the particular way in which the page layout breaks could be improved, but it seems like a minor problem compared to the other issues that still need to be resolved.
It's easy to add something simple like an 'icon_path' database column to the underlying storage mechanism (which, as mentioned above, might be especially nice if we reuse the menu system, because it would then provide contrib modules an easy way to add icon support for other menus as well).
It does seem like there needs to be more work done on the interaction, though. It sounds like we'd need to have (a) a set of icons included with core, (b) some kind of default mapping between URLs and icons, (c) a way for contrib modules to expand on both of these, (d) a default fallback icon to use when none is specified, and (e) some user interface for people to change the icon after the shortcut was already added?
That's a lot to do, and not even getting into things like allowing users to upload their own - are we trying to support that here (and if so, does it require something like ImageField)?
Comment #75
David_Rothstein CreditAttribution: David_Rothstein commentedAlso, looking at the screenshot from @Noyz, it seems we could address most of that (if we stick within the menu system) by going back to some of the code and ideas that already exist above:
Comment #76
David_Rothstein CreditAttribution: David_Rothstein commentedHere's a copy of Jeff's screenshot from #72 - for posterity's sake, it seems better to save it here than to rely on an outside website :)
Comment #77
joachim CreditAttribution: joachim commentedI still think implementing per-user menus throughout the menu system for this is pretty horrendous, and total overkill. There is going to be a huge amount of duplication in the menulinks table, for starters.
Furthermore, I think the matter in hand calls for a per-role toolbar too.
> Finally (also unrelated to overlays), there still seems to be no way to assign/edit icons related to these items, which should be an important consideration item when building the underlying implementation.
The need for icons suggests this is not really a menu, but a slightly different kind of entity.
Comment #78
Gábor Hojtsy@joachim: well, having icons does not really rule out menus; the fact that menus do not support icons resulted in people doing all kinds of hacky solutions and custom modules to build icon solutions for menus, eg. http://drupal.org/project/menu_icons or http://www.anelloconsulting.com/custom_menu_item_icons_drupal or http://the.failbo.at/node/38
Comment #79
David_Rothstein CreditAttribution: David_Rothstein commentedIf we have per-user shortcuts, there is going to be duplication somewhere. Why is it worse to have it in menu_links (which is optimized in a variety of ways)? As mentioned above, we can benchmark something if there are actual, specific performance concerns...
Also, it's worth pointing out that the shortcuts don't need to be per-user (earlier versions of the patches in this issue did not do that - they had different shortcut sets that you could switch between, but no per-user separation). I think that by piecing together code from the various patches in this issue, it would actually be possible to come up with a solution for the shortcuts that didn't involve changing any database tables or adding new ones, but without the per-user functionality. And for some use cases, it might actually be simpler and better (e.g., sites with a single administrator).
The reason I moved to per-user shortcuts initially was that it seemed like where this issue was heading anyway, plus the user interface that was proposed seemed to really assume that. (If I see a convenient "add to shortcuts" link on every page of my site, I would find it pretty odd if clicking that link also caused some other person's shortcuts to be modified, etc.) But, it's a possibility.
Comment #80
Gábor HojtsyYes, the original intent of customizable shortcuts was to be per-role or selection from a set of shortcut sets, but given this convenient "Add to shortcuts" link requested by Dries, unless we only have one set of shortcuts for the whole site, it makes more sense to have per-user shortcuts IMHO.
Comment #81
joachim CreditAttribution: joachim commentedI was looking at this during the DrupalCon code sprint, and when I considered having menus per user my immediate reaction was: the core hackers will say it's crazy.
Storing this kind of data in this way just seems bats to me: it's overkill and duplication. Most menus will never get customized per user. Most users will add a couple of links and keep the defaults and the menu_links table fills with crud.
Let's take a step back here.
We're suggesting a non-trivial rejig of the menu system to get something like this module into core: http://drupal.org/project/menu_per_role, which has a mighty 2k users.
This is for a feature that on most sites will get turned off.
And being pragmatic, there are far better candidates for improvement to the menu system -- I don't know if http://drupal.org/project/menu_breadcrumb has made it into core for D7, but that is basically an essential fix for behaviour in D6 that's considered broken by most developers I speak to. Another candidate might be getting breadcrumbs on nodes to work (http://drupal.org/project/node_breadcrumb and other similar modules) -- for me, trying to navigate the DrupalCon Paris site showed up that our out-of-the-box breadcrumbs are not very good.
Furthermore, making menus per user doesn't even address the requirements of this feature! On sites that COULD make use of the toolbar, I expect admins will want to create default toolbars for different roles: regular member, editor, site admin. This strikes me as a far more useful feature than per-user; if I had to choose between per-role or per-user I would choose per-role.
I think if this feature is to go into core, then toolbar module needs to handle the customization itself -- ideally in some way that can then be extended by contrib modules for people who really want custom menus.
The best idea I can come up with is to put all links that users add to their menu into the menu_links table, and then have a masking table per user and role.
But there are better minds than me on this issue, I hope :D
Comment #82
David_Rothstein CreditAttribution: David_Rothstein commentedJust to clarify: With the proposed approach, most menus wouldn't be allowed to be customized per user, and those menus would not put anything different into the menu_links table than they do now.
Only the toolbar shortcuts would do this. (Unless you have a contrib module that allowed it to extend to other menus.) So the amount of extra data in the menu_links table would likely be small.
I agree this is a serious concern. Everything that is being discussed in this issue involves adding new front-and-center features to Drupal core, somewhat last minute, that have never really been tested or fully vetted. It is worrisome.
The situation we're in is that the standard Drupal "toolbar solution" is admin_menu which uses dropdowns, but for whatever reason, this D7 toolbar module decided not to do that. Without dropdowns, there is no way to use the toolbar to quickly get to links deep within your site. By itself, therefore, the toolbar would be pretty useless.
The only way it avoids being useless is via these shortcuts, which, because they are highly customizable, provide a targeted way to get to particular, important links deep within your site. It's an interesting idea, but whether people will use it or not, I really have no idea.
It seems like the issue to really discuss that all is at #543914: Administration menu or admin_menu should be in core ... but if the current D7 toolbar is to be of any use at all, I think it needs this shortcut feature and needs it to work well.
I think if we really want to have toolbar-per-role functionality within Drupal core, the best way to do that involves making the toolbar into a block. I know that was discussed and rejected elsewhere though, for different reasons (I don't have the issue number handy).
With blocks, you get per-role visibility for free, and then, figuring out which shortcuts to show to a particular user is just a matter of the toolbar module having a sortable list - the default toolbar that each user sees is the first one on the list they have access to (we're doing/proposing something very similar for text formats in D7 in #11218: Allow default text formats per role, and integrate text format permissions, and it works well).
Without the toolbar being a block, is it really worth coming up with a totally different per-role method?
Remember - it was mentioned above but worth repeating - one advantage of using the menu system is that menu access gives you a rudimentary form of "per role" toolbars for free, as long as each role's toolbar is a subset of the main one. For example, suppose you create a single toolbar for your site that contains five items: "Add Content", "Find Content", "Permissions", "Blocks", and "Menus". An administrator sees all five items. But if you then make an Editor role on your site who only has the relevant permissions for administering content, their toolbar will automatically contain only the first two items - no extra work required. I think it would not be so bad for Drupal core to stop there (as long as there is a way for modules to expand on it).
It seems like this would save some rows in the table, but at the cost of some complexity. What happens when a shared menu link is edited - do all users automatically see the changes, or if not, do we have to find some way to avoid that happening? (Not sure if I understand your proposal completely, but it seems to me that would be an issue.)
I don't think it's a bad idea per se -- as long as we use the menu_links table, we get all the benefits of the menu system (using the menu_custom table or not, by contrast, doesn't matter as much). But it seems more complicated, unless we really have a reason to be very concerned about not adding some extra rows to the menu links.
Comment #83
catchi think if a shortcut link is edited, it probably should affect everyone - say you move your custom admin panel to a different path or whatever, and we don't need to allow for per-user icons and text IMO. In fact that's almost an argument for a uid | path or uid | mlid mapping table, so that admins can easily go in and change stuff like this for people in an editor role. However we'd need to handle removing a shortcut so it first deletes rows from the mapping table then eventually the link if no-one's using it. Probably neither approaches are ideal.
With the current approach, even with 100 users having access to the toolbar, we're only talking about a maximum of 1,000-ish entries in {menu_links}, that's comparatively nothing. Note that book module adds a load of entries to {menu_links} too, which more or less 'duplicate' the bid/pid table and that works fine.
Comment #84
markboulton CreditAttribution: markboulton commentedI think that's a sweeping generalisation and certainly not what the testing we've done thus far would indicate. I think for most Drupal developers, that may be the case. In fact, most Drupal developers would probably turn this off completely. Which is fine. It's primarily designed for a completely different audience.
At this point, I'd like to reiterate - again - what the toolbar is, and who it is for.
How so? The toolbar is designed not to be a replacement for admin menu. Neither is it an an IA builder with unlimited options and flexibility. The toolbar is there to help content creators, or people administering sites. It's designed to provide quick links down to specific, repetitive tasks. It's also designed to be limited.
This issue - #543914: Administration menu or admin_menu should be in core - is completely separate. As the underpinning UX strategy of the shortcut bar is completely different to what the admin menu does.
As to how it's implemented, then that's up for discussion.
Comment #85
sun1) Seeing the impact of this patch on the menu system, I think it adds a major WTF to a system that is totally complex already. Forking an entire menu into another and optionally assigning that to a specific user looks like an edge-case the menu system was not built/intended for. The data in these tables is already one of the most challenging performance hits for Drupal sites. -- Don't get me wrong. We definitely have a great need for context support in menus. But it's definitely not a per-user context; instead, we have a need for per language context, site context, role context, domain context, etc. pp. The current approach hacks a single per-user context into the menu system, which means to hack a single use-case into a system that was meant to be as generic as possible.
2) Shortcuts neither can be expanded, nor need descriptions, nor need to be disabled, nor need a parent link. All they need is a title, path, and weight. Whereas the user shouldn't have to type or specify any path, because you want to add the current page and not an arbitrary one to your shortcuts.
3) After talking to Dries in Paris about this issue, it seems like per-user personalization may be wanted for smaller sites. To make any sense of this on larger sites, however, those sites would rather want to have different shortcuts per role, which may or may not can be overridden per user. Thus, we need default shortcuts that can be optionally specified differently per role.
4) Summarizing the above, we want to
a) build a settings page where default shortcuts can be specified (optionally per role)
b) use an own storage for those shortcuts
c) use an own UI for those shortcuts
5) Stop thinking about icons unless you want to waste your time on an utopian feature for D7.
FWIW, I do not agree that Toolbar does not make sense without those shortcuts. I can drive my car without a cup-holder, too. Drupal has to be usable without such helpers.
Comment #86
catchThat sounds like dmitri's patch from #20 to me, although this issue had already gone towards the menu system approach before I had a chance to look at that one.
Comment #87
David_Rothstein CreditAttribution: David_Rothstein commented@markboulton: Would it be possible to provide more details here of the testing that has been done on the customizable shortcuts feature? (I think any results would be useful, as we seem to be stumbling around this issue a bit trying to decide which components are the most important.)
@catch: What would you do about weights? Editing text and icons might not be necessary, but I think users need to be able to sort their own shortcuts.
And is moving the admin panel to a different path common enough to worry about? Worst case, people can delete or change back from their personal shortcuts to the sitewide one. Also, it is not hard to bulk-update a bunch of menu items (by which I mean, the database query is not hard).
@sun: So is the alternative to release D7 with the big gray boxes instead? :)
Using the menu system, icons shouldn't be a big problem - it's really simple to add an "icon path" key in hook_menu() and then each module's URLs can very easily specify an icon, or automatically inherit defaults from their parents if they don't. Plus hook_menu_alter() can be used to change it. Compared to the other issues here, this isn't complicated to implement.
I think you're probably right that a UI for changing or uploading these icons is not going to happen for D7 core, but that would not be a big deal.
So if there's agreement that only larger sites would need more per-role granularity than what was described previously, it seems OK to delegate that to a contrib module?
I think it's actually pretty simple to make any of the patches in this issue compatible with per-role in contrib. For example, in the latest patch, it might even be as easy as changing this:
to this:
And the same is true for many other menus on a typical Drupal site. At least from the end user's perspective, it's especially true for the top level of the toolbar (which has an entire tree underneath it that is visible when you edit the menu, but none of that tree is ever going to display in the toolbar). There's no particular reason shortcuts are a special case. That was the rationale for moving #564886: Remove 'expanded' checkbox from menu item overview to a separate issue - to at least try to solve the problem for real rather than working around it by inventing an entirely different UI for this one particular use case.
Well, sometimes code is not hard to generalize after it is written. Notice, the new functions in the latest patch basically take $account as a parameter and are hardcoded to check $account->uid against a 'uid' column in the database. Maybe it's not so hard to change that to $key + $object as parameters, and then compare $key and $object->key to two separate columns in the database? That's a fair amount of context support right there.
Probably we don't want to generalize this more than necessary. So if it's too hard to correctly use the {menu_custom} table, then so be it. But overall, there are a variety of options which range from not using the menu system at all to using it completely and we need something along that continuum. Using the menu system in general has these advantages:
1. Easier support for icons (see above)
2. Automatic access checks on each link (although writing this, I'm realizing that even if you don't use the menu system for storage, you can still use it for access checks without too much work)
3. Caching
4. Reusability (e.g., the main shortcuts are automatically a block which can appear elsewhere on the site)
This needs to be balanced against other considerations, but going too far towards ignoring the menu system seems like it leads to a lot of duplicate code that is not very flexible.
Also, I should not have said that the toolbar is "useless" without these customizable shortcuts - that's too strong, and I apologize. But I think to be such a front-and-center feature of core like this, it should really be targeted at a wide group of people. With easily customizable shortcuts, it can be, because the shortcuts you see every day adapt as you do. Without them, it's less useful for everyone.
Comment #88
joachim CreditAttribution: joachim commented> It's designed to provide quick links down to specific, repetitive tasks. It's also designed to be limited.
This is what makes me think this shouldn't be a menu -- and all that sun says in #85.
The menu is a hierarchy of locations.
The toolbar is just shortcuts to paths.
Comment #89
catchIf we stick with menus, and want to attach icons, what about something like http://drupal.org/project/menu_attributes then? (note I haven't reviewed the code).
Comment #90
David_Rothstein CreditAttribution: David_Rothstein commentedIt looks like that module uses the existing 'options' column in the database, which would work, I think. But the possible advantage of adding a new column for the icon is that you get inheritance - e.g., core could define a default icon for admin/config/people/* and a different default icon for admin/config/media/*, and any module's pages that exist under those paths would automatically use the default icon for that section (unless they provide their own).
Rereading the above comments, it also occurs to me that this isn't actually quite true:
First of all, descriptions could actually be useful (since they can be made to appear as hover text). Second, while we don't seem to need parenting features directly here, they would be necessary to support something like "bookmark folders", as in Jeff Noyes' design at http://blip.tv/file/2304921 (which was linked to near the beginning of this issue). It doesn't seem like we're likely to implement that design here, but it's a very standard "shortcut" functionality (used in many web browsers, for example), and we should support contrib modules adding that.
*****
Anyway, we really need to come to some sort of decision here. I think we definitely need to use menu_links. In theory, I think we should be using menu_custom also, but the arguments for that are less overwhelming - and it would involve more API changes which at this point in the development cycle we probably want to avoid if at all possible. Based on some comments above, it sounds like we really could model this after the book.module (which uses menu_links but otherwise has its own custom system) and that wouldn't be so bad.... we could then try to improve it further in Drupal 8, so that both the book module and this could use even more of the menu API.
Comment #91
yoroy CreditAttribution: yoroy commentedRe. icons:
We need a non-icon fallback that's better looking than the current situation anyway. Customizable means that links for which no icon is defined will get added. I'm not a coder, but from mentoring the icon.module GSOC project last year and talking with devs who worked on this, it seems unwise to 'make icons work in core' part of this issue. It's hard. I'd strongly advise to make it a seperate issue as it burdens the already broad scope of this discussion.
Comment #92
Gábor HojtsyUpdated patch since many of the hunks were only applying with fuzz and menu.module had a rejected hunk due to how range queries changed.
Comment #93
yoroy CreditAttribution: yoroy commentedtestbot?
Comment #95
JacobSingh CreditAttribution: JacobSingh commentedOkay, I think this at least brings the patch back to working order.
It was a lot of cut-and-paste because many hunks were failing, apologies if I missed anything.
Some APIs changed and some urls, but it looks right now. I'm not familiar enough yet with the current intention to decide if it is 100% back, but at least no errors, and I can edit shortcuts for my user :)
Comment #96
JacobSingh CreditAttribution: JacobSingh commentedOkay... Jumping into the fray :) Looks like this is a pretty contentious issue. I've tried to read everything up to this point and grok it. I realize I'm restating some arguments from before, but I just wanted to get a reset on these topics, because it feels like some resolution here is needed before we can make meaningful progress (and of course, I want to get my 2 bits in too).
Per user vs. per role
I think there is a much bigger use case for Per Role menus. In an organization, you have editors which edit stuff, writers which write stuff, admins who admin stuff, and a users who read stuff. They have different primary tasks, hence this issue. If a user needs their own bookmarks, that's what the browser is for. It's a better interface, and is accessible from anywhere, why are we replicating it?
Menu per Role is a popular module for a reason, lots of clients want this functionality. It is cleaner to implement from a front-end and backend standpoint and has no performance implications (unlike the menu-per-user one which IMO does).
There is the bookmarks module, and this sounds to me like something which belongs in contrib.
Icons
We should start a separate issue for this. It is generally a very good idea, and not really part of this.
Use of menu system
I can see both sides, but I have to say, it's duplicating code and making a new cluster-f of an API to do it any other way.
Proposal for Menu per-role and how it works
If we implement it this way, we can do it cleanly (add a menu_role table with a weight), provide for the biggest use case, and provide functionality a lot of sites want anyway (menu per role).
I can't see a big performance hit, and because we have a n:n relationship between menus and roles, there can be some level of per-user choice involved (if still pre-determined by the admin).
Some stuff from looking at the code:
I don't love this approach, but don't have a better idea at the moment (if we're trying to support menus per user). But even if we do go this route, why two columns (personalized and uid?).
I don't mean to spread FUD, because I haven't profiled this, but this query will likely get called a lot right? The conditional logic in it will slow it down at least somewhat, perhaps more than a little if you have a lot of users customizing their menus.
I'm on crack. Are you, too?
Comment #97
JacobSingh CreditAttribution: JacobSingh commentedJust talked w/ David and Gabor. Here's what we were thinking:
Not per role or per user
These can be done in contrib (and are).
Per role is widely used, however not applicable in 90% of sites (the dinky ones)
For organizations with multiple people using this feature, they are probably using different roles. Shortcuts by roles makes sense, by user does not. I.e. the sales team has common tasks, each sales guy doesn't
Per user creates kinda hacky implementations in the menu structure
Since the use case of individual users needing to use Drupal to manage thier bookmarks for a given site seems low enough, and the code to implement is nasty enough, we were thinking this should also be done in contrib. This also does little to benefit them because they cannot inherit changes from the parent they cloned from.
This is for the "WTF did that go?" use case
The Navigate module does a good job of this, and is popular with new admins to Drupal. It's easy to forget where that settings page is, or how to get to the user listing sorted by email or whatever. For these people, we want to make a simpler implementation of the menu module that is usable by non geeks and allows you to just "add this page to shortcuts"
Implementation
Dead simple now. With one site-wide shortcut bar, we just need to provide a customized interface for re-ordering / editing the shortcuts, and a button to "add this page to shortcuts". We use all the underlying menu structure, this is just a "special" menu with special theming status.
We also need to make it flexible enough so that contrib modules like menu per role or menu per user would be able to dynamically change which menu was loaded.
Sound good? So to wrap up:
Comment #99
yoroy CreditAttribution: yoroy commentedI get the impression that this proposed direction is informed mostly by time constraints and not so much by the minimum use case. (understandably so).
"Per role is widely used, however not applicable in 90% of sites (the dinky ones)"
I don't understand this sentence, at all. Per role is used a lot, but it is not? Immediately thereafter you say they do make sense again. Are you dissing 90% of the Drupal sites out there? I don't get how this helps getting your point across.
Anyway.
I assume the shortcuts would still be visible according to the user's permissions? If so, the visible shortcuts would still be different for each role? I could then add a lot of shortcuts to the toolbar and through permissions and roles the toolbar would still look different per role (different sub-sets of the 1 main set). Is that what would be happening here? If so, then +1.
Comment #100
JacobSingh CreditAttribution: JacobSingh commented"Per role is widely used, however not applicable in 90% of sites (the dinky ones)"
I guess what I meant was, most of the 10% of sites who have more than a couple admins need something like that. Although it is no where near the majority of sites, in terms of the size of contracts / participation in the Drupal economy, those sites are very important. So, widely used among big sites, but not needed on many others and easily provided in contrib.
-J
Comment #101
David_Rothstein CreditAttribution: David_Rothstein commentedPartially. However, if you define the minimum use case as a site with a single administrator, then the proposed direction is actually perfect for that.
Basically, I think we just came to the conclusion that there is no way to satisfy everyone... so core shouldn't try to :) Depending on the site, there are valid use cases for per-user, per-role, or the "shortcut sets" idea from the original patch (which is kind of a hybrid between the two). It's not even so much about the size of the site, but more about how it is structured - generalizing a bit, sites which are more "hierarchical" have more need for per-role shortcuts, while sites which are more decentralized (think drupal.org) have more need for per-user. Complicating things further is that the "add to shortcuts" button (which is probably the most interesting thing about this feature) can get messy for some of these use cases.
Ultimately, then, the best thing we can do for core right now is to provide the simplest solution possible and let contrib modules build off of it for specific use cases.
Yup, exactly! I tried to say that somewhere in a previous comment above, but understandably it got lost in the voluminous discussion :) What it means is that a site can actually take things pretty far with core before it reaches the limit where it would need to move to a contrib module.
User interface:
We will probably progress best if we stick to something that looks as similar to the normal menu interface as possible, but simplified where necessary, exactly as Jacob said above. A key point is that we don't want to totally reinvent the wheel here, because the last thing Drupal needs is yet another UI pattern for people to learn in addition to the ones that are already there :) Another key point is that hopefully, most users won't need to visit the UI much at all (the "add to shortcuts" button itself provides most of what they need).
For a start at how to form_alter() the menu UI to make it simpler for the case of the shortcuts, note that #42 had some code along those lines (at the top of the patch file). If we can farm out a simplification or two to the menu system as a whole (for example, the "show as expanded" row of checkboxes is pretty pointless for all menus, in my opinion), then we can try that at #564886: Remove 'expanded' checkbox from menu item overview and so much the better, but for here, we can focus on form-altering as the quickest way to get the shortcuts the way we want them.
Icons:
I could have sworn someone already spun off a separate issue about that, but apparently not, so I went and dug up #42493: Enable custom bullets/icons for specific menu items and posted a potential patch there just now. This is hopefully a lot, lot simpler than the icon module discussed in #91 -- that's a really neat module, but what it's trying to do (generic sets of icons that can be swapped between themes) is much more complicated than what we need here :) The idea of the patch I posted at #42493: Enable custom bullets/icons for specific menu items is to provide a default set of icons that themes can use if they choose, or ignore/replace if they want to, so hopefully we will still have a chance of getting something in.
Comment #102
Gábor HojtsyStill needs work due to test fails and a cleaned up focus :)
Comment #103
JacobSingh CreditAttribution: JacobSingh commentedOkay, I commented and/or posted to the other two issues:
#42493: Enable custom bullets/icons for specific menu items
and
#564886: Remove 'expanded' checkbox from menu item overview
Both of these are useful in their own write, and don't need to be duplicated code here.
This patch just got a lot smaller. It no longer patches the menu module at all, just adds the interface elements to toolbar.module. It still lacks a good way to be extended from the outside I think. Before we commit this, I think it would be nice to brainstorm how a contrib module would solve some this common use case:
I have a team of Moderators and I want them to be focused on the task at hand. The shortcut bar helps them get to their most frequently used screens quickly, and makes documenting their job / training a snap. When I want to add a new link to this bar, how do I do it while not screwing up the bar I have defined for the Translators.
-J
Comment #104
JacobSingh CreditAttribution: JacobSingh commentedHelps if you include the patch
Comment #105
JacobSingh CreditAttribution: JacobSingh commentedd'oh, left in my patch that makes CLI installs in core work again. :(
Btw, that needs some love:
#557542: Cache module_implements()
Here's another go
Comment #106
Gábor HojtsyReviewing:
- wow, small patch :) greato :)
- 'create own shortcuts' sounds quite misleading, after all you just edit a global menu which would have those shortcuts available for everyone
- minor: "(to add additional information." lacks closing parenthesis
- it would probably be a good idea to add phpdoc to toolbar_save_link_to_shortcuts(); how does it pick the right menu to add shortcut to, etc.
- toolbar_shortcut_edit_links() seems hosed... uses menu cloning, which is not in the patch anymore
- while toolbar_shortcuts_menu_name() now uses a variable, it is not clear to me, how would this support per-role or per user menus in contrib; they would fiddle with $config[] to override?
Marking needs work for the leftovers in toolbar_shortcut_edit_links()
Comment #107
JacobSingh CreditAttribution: JacobSingh commentedeek.. all kinds of skeletons, sorry, tried to sneak one in at the end of the day :)
Here's a slightly better version. BUT there are two outstanding issues AFAICT:
1. We have a separate perm to "create shortcuts". Right now, it is pretty useless IMO. How do we reconcile this with giving someone permission to edit ALL menus. Does it matter at this point? Should we just ditch the perm, make the links go straight to the menu page, and make this about just providing a quick way to build / edit a menu? (If so, I've got not problem with that - sounds good to me).
2. How do we make the "shortcut" construct extend-able in contrib? As I mentioned in my last comment, there is a use case we should be able to solve in core.
How to set which bar to show Currently, I used a var, because I figured people could mess around with $config, but this isn't great. The only other option though is to do something like this $shortcut_menu = array_shift(module_invoke_all('shortcut_bar')); or something. That's also not pretty, because only one can win, and we already use vars for primary and secondary menu.
How to change the behavior of the "add to" button
I was thinking the best thing here would be to include a place to specify an optional interim form, where a contrib module could ask the question: "Apply to the global shortcut bar or the bar for Moderators", etc.
But in that case, maybe the best thing to do is to just let them override the menu item.
Best,
J
Comment #108
Gábor HojtsyPatch review:
1. "create own shortcuts" is still used at one place as description of the permission and another place as the actual permission (but see below)
2. phpdoc you added to toolbar_save_link_to_shortcuts() seems like a total cover for not adding it ;) At least it should not end in **/
On the permission, if you can add shortcuts but not being able to edit them, that is a problem (and that is how it works now if you have no perm to edit menus). We either need a permission which would let you add and edit/remove items in the shortcut menu(s) only (that is it would be a different path with different access permissions for the given menu editing screens). Or we can just remove the separate creation permission and use the menu permissions. I think the first would be more granular, even if it requires more wrapping code on our part.
On editing, being able to override the menu from $conf is at least a way :) It also lets people to override it with whatever rules they wish (per user, per role, per daylight savings time or moon phase :D). I'd also expect that such a module could then be able to override the menu item for the addition of the shortcut and reuse our API. They could display a form or something and could reuse toolbar_save_link_to_shortcuts() (if well documented :), since it just picks the menu name from $con which is already overridable.
Comment #109
David_Rothstein CreditAttribution: David_Rothstein commentedI like the smaller patch size as well - although it's cheating a bit, since we don't yet have any of the potential code in there that would form_alter or otherwise change terminology in the menu UI for the shortcuts :)
Let's definitely keep it simple: If someone wants to override the "add to shortcuts" button with a form, they can do it via hook_menu_alter(). As long as we provide a good API for adding the shortcuts, that definitely sounds like the best way to go.
Also, using a variable for the shortcut menu name is probably the simplest method we have for making sure it is infinitely configurable. In addition, the shortcut menu itself is added to the overall page array, so hook_page_alter() is another method that modules have to dynamically replace it. (Not a great one, though, since it means two menus would get generated during the page request, even though only one is used.)
Comment #110
catchI'm not sure exactly what's planned for terminology changes but what we're adding here is a not-yet-graphical shortcut menu with some extra features attached. In that case, it seems completely reasonable to allow that to be called 'the shortcuts menu' and have 'menu links' in it - I don't think we need to mess around altering the menu interface changing all mentions of the word menu to shortcuts when the implementation is still going to resemble what people think of as a menu - my browser bookmarks are in a menu too, for example.
Comment #111
JacobSingh CreditAttribution: JacobSingh commentedOkay, here's another go.
I think I got Gabor's last review items.
Also:
Removed the perms for shortcut making (all are administer menu)
Documented some stuff which wasn't doc'd yet
One more question:
Should we alter Garland to support this? I'm thinking yes.
Best,
J
Comment #112
David_Rothstein CreditAttribution: David_Rothstein commentedI think if we have to add yet another template variable for themes to keep track of, it should definitely be something much more generic than $add_to_shortcuts. Hopefully we can find another way to do this, though...
Comment #113
Gábor HojtsyReviewing the latest patch:
- I don't see why admin/config/shortcuts/edit and it callback gets to live on?! It is just a redirect to a different path with the same structure.
- given the amount of markup used by the add_to_shortcuts item, it sounds sensible to have a #theme callback for it instead and only add the data in the array
- on the phpdoc of toolbar_save_link_to_shortcuts(), Drupal does not include type names in its phpdoc, so your phpdoc is non-standard
- also, on the same phpdoc, you should end it with */ and not with **/, as I've noted above
- on the phpdoc of toolbar_shortcut_edit_links(), you have an extra empty line, but you should actually have a one line summary and the longer explanation after an empty line (again part of our phpdoc standard)
Comment #114
JacobSingh CreditAttribution: JacobSingh commentedI was thinking so that contrib authors would have something to override when that link was pressed. They don't really want to override every menu edit page, just the one which is meant for shortcuts. Is there a better way to do this?
Good point - added.
Huh, okay non-standard non-standard phpdoc, fair enough. Is there a reason why we don't include types? I've changed it, but really, that just seems crazy to me. That's one of the main reasons to document code, to make it easier for people to figure out what a function requires.
Got it.
Got it.
Comment #115
mcrittenden CreditAttribution: mcrittenden commentedSub.
Comment #116
Gábor HojtsyOk, looks much better now. Good that it is now documented that the menu item is there to be overridden, I agree it is easier to do it this way. Minus a few whitespace issues in PHP code and some comments, this looks good with me now.
Comment #117
mcrittenden CreditAttribution: mcrittenden commentedAny reason why we're not also using plain old border-radius here as well? Seems like it might be good to have for completeness, as D7 will be around for quite some time (i.e., long enough for browsers to start accepting that property).
Thoughts?
This review is powered by Dreditor.
Comment #118
Dries CreditAttribution: Dries commentedI read up on this issue, and here is what we are going to do:
1. Per user shortcuts in core (with the option to do per-user defaults/starting points in contrib)
2. We will not leverage the menu system and use a custom storage mechanism
Comment #119
moshe weitzman CreditAttribution: moshe weitzman commentedI like the decisiveness!
Sounds to me like we need flag module in core (/me ducks). Otherwise, we get more one off infrastructure.
Comment #120
Linea CreditAttribution: Linea commentedsubscribe
Comment #121
David_Rothstein CreditAttribution: David_Rothstein commentedI like Moshe's comments because they're always open to interpretation :)
But, much more important than decisiveness is ideas and/or code. If someone can figure out how to make this happen without duplicating half the menu system and adding lots of unmaintainable code to core, while still providing all the features (including icons) that we want, then splendid.
Until then, we have working patches and approaches that use the menu system - and are very simple as a result.
Comment #122
Dries CreditAttribution: Dries commentedThe current patch does not implement per-user shortcuts which is a big part of Mark and Leisa's design and the whole point of having a shortcut bar to begin with. The current implementation may be simple, but it does not meet the functional requirements. So storage mechanism aside, this patch is still incomplete and we should not rely on contrib to make it functional.
Comment #123
joachim CreditAttribution: joachim commented> Sounds to me like we need flag module in core.
So the toolbar would essentially be users flagging menu link items?
I like the idea. But:
First problem: users will want to bookmark things that aren't menu links. What I call the 'node/4' case.
Second problem: flag module allows per-user flags and global flags on entities. How will contrib extend this to have per-role toolbars?
Comment #124
Gábor Hojtsy@Dries: given your feedback, I went back to dmitrig01's patch from August 31st (comment #35 above), the last version which used custom storage, was developed under your supervision and implemented Mark and Leisa's directions: (limitations of number of slots in toolbar and possible support for per role shortcuts). I did implement some of the feedback from TheRec in #38, but more should still be implemented. I also skipped implementing some of the suggested changes against Jacob's patch (like #theme-ifying the add to shortcuts link), to avoid wasting more time on this, if this one is not fine either.
Changes from #35 include
- updated for automated schema install/uninstall
- updated for IA changes (put shortcuts config in system category, up for discussion)
- updated for form callback changes (they get a $form as first argument, but this was not documented in the upgrade docs!)
- updated for theme function $variables changes (this is very recent and not yet documented either)
- fixed Safari compatibility issues
Functionality in summary:
- custom data storage is used (as Dries requested)
- its possible to have different shortcut sets (to support Mark&Leisa's per-role and Dries' per user concept)
- these sets support per-role assignments only on the schema level so far, not on the code or UI level yet, but this would cover Mark's and Leisa's vision
- these sets support per-user assignment, since once someone gets their per-role defaults, they can still start their own custom set instead of customizing the assigned set, this covers Dries' vision
- as Dries pointed out "the option to do per-user defaults/starting points in contrib" will be possible by pre-setting a set for a user
Limitations of this approach:
- shortcuts can use a path, but cannot use query string arguments or a fragment identifier in this patch (yet?)
- number of shortcut slots is limited to 7 (as designed by Mark and Leisa)
- live site has no "add to shortcuts" link (yet?), becase as understood from the design, we are having an **administration** shortcut bar here, and therefore should be able to save admin pages as shortcuts
- icon support is not included, and should probably go in a different patch (either fetching from the menu system or again via custom coding for shortcuts)
Here is a video with all of the functionality shown, highlighting missing items as well:
Comment #125
leisareichelt CreditAttribution: leisareichelt commentedGabor - firstly, thanks so much for making that video, it makes it so much easier to grok the work you've been doing and to give feedback to it. ++ to screencasts in the issue queue!
A few quick thoughts in response:
- suggest we rename 'create set' to something a little more descriptive like 'create custom shortcuts'
- suggest that when a custom set is created it starts with the default shortcuts included, will probably be faster for the user to delete these than to refind and add them and the reason they've been chosen is because they are quite universally required
- suggest that we come up with an alternative to designing icons for every single shortcut possible and instead design icons for those where there are really good clear, obvious icons where imagery will add value and then design a simple 'bullet' like image that can be used for the rest, as a visual target more so than to assist the user in determining what the shortcut is. (This will assist both with workload and also the overall quality of the icons, I think)
With regards to Gabor's frequent mention of Mark & I insisting on restricting the number of shortcuts, I think Gabor explained this quite well but the rational behind this is that if you create too many of these they very quickly become not-short-cuts because it will take the end user a long time to distinguish between all the possible options to choose the one they require, thereby negating the whole purpose of the shortcut. We wanted to discourage people doing this to themselves so that they would maintain the benefit of the shortcut.
Comment #126
Gábor HojtsyDid not rename "sets" yet, it would be good to get more input on that. "create custom shortcuts" is IMHO misleading, since you can actually create (add) custom shortcuts without being able to switch to to a totally different set.
Revived the "Add shortcut" functionality which was in the patch to some degree but was both broken an invisible (but just realized while working on fixing new set creation :). Now it became a local action, and just goes to the edit screen for an empty shortcut, where you can fill in values.
Worked on the experience of adding a new set. Now when you are about to add a new set, you are told that it is gonna copy the default shortcuts.
And then it does indeed copy the default shortcuts. In my case, I have an already modified default shortcut set, so that is what is being copied/forked.
We need to somehow add a UI to configure the per role defaults for the shortcut bars. I was envisioning a new tab on the shortcut editing screen for privileged users, but not sure it maps to the "different view of the same stuff" pattern, which we are supposed to use tabs for. Also, then that screen would allow you to set role relations, but we still need to be able to delete/rename sets, and the "change set" screen would not be nice for that. So having create on the "change set", but all other config on a separate tab for the sets sounds strange. Feedback welcome!
Also attaching previously missing updated toolbar.png. That was already posted by dmitrig in August, but this will save you from needing to dig it up. Place it in modules/toolbar/toolbar.png.
Comment #128
David_Rothstein CreditAttribution: David_Rothstein commentedBrought to you by Acquia, it's...
Proposal #7,522,608 (the "final" proposal)
So it turns out that 'decisiveness' and 'Drupal' don't mix, and that's for everyone's benefit :)
Here's what happened: A bunch of people had a long, long conversation about this earlier today. This included a number of people who have participated heavily in this issue (Dries, Gábor, me, Jacob, Jeff Noyes). In the end, we all came up with a new (again!) proposal that sort of combines a lot of ideas from above and - at the risk of crying wolf - might even make sense. Some kittens may die as a result of this proposal, but far fewer than could have died otherwise.
If you're interested in this issue, please read the proposal carefully and try to share comments ASAP if you have them, because we don't have a lot of time. I tried to organize it by section and put references to specific comments from the above discussion (e.g., "#123").
Thanks to Jacob and Linea for taking good notes, but any mistakes or digressions in the writeup are mine :)
Overall functionality
Specific use cases
Data storage
Icons
User interface
Some of these are questions and (hopefully) on more of a November 15 deadline so can use some help and advice.
Comment #129
Bojhan CreditAttribution: Bojhan commentedSomewhat scared to respond after this lengthy writeup, but what does the user benefit from a set of shortcuts over a per-user shortcut bar? I am not really following the added simplicity, or perhaps the not-added-simplicity for contrib sake? I hope you get to a patch soon, so I can use it to understand it.
Still seems very complex for just bookmarking perhaps 1 or 2 more links to my shortcut bar (lets remember to stay realistic, the majority of websites do not have 20 different administration account's with different needs, who will all customize their shortcut bar).
Comment #130
sunI'm glad you discussed before we reached #200. :P
99% of that makes sense.
UI issues raised:
1) No, just drop any switcher. Core assigns a set to each user account by default and that set is the target. The user account form allows to switch.
2) There's no point in disabled shortcuts or anything like that. If anything, it will be horribly confusing for the user. We have a set of links, and nothing else, no regions and nothing. Add or remove, and be done. A contrib module wanting to expand on core needs to override, just like everywhere else.
3) Drop the limitation. It's theme-dependent. The themer is guilty for taking care of a potentially too long list of shortcuts. The system can do it. The presentation is a different layer, and core shouldn't make assumptions about the ugliness or awesomeness of the presentation layer.
4) User account form.
Comment #131
sunAnd, please: You do not touch anything in modules/toolbar/* to implement this, unless absolutely required.
Comment #132
catchI'd also say drop the limit. My firefox live shortcuts start to get impractical over 8-10 or so - since at that point I have to click to see more. So when it gets that bad, they get pruned. There's no usability issue there at all. Far more annoying would be trying to add a shortcut, being told I can't, then having to choose which one to delete, then trying to add it again which is the point where I'd start looking for the setting to switch it off.
Comment #133
mcrittenden CreditAttribution: mcrittenden commented@catch: but how do you know which shortcut to prune? Did I miss something?
Comment #134
David_Rothstein CreditAttribution: David_Rothstein commentedFYI, I am working on an updated patch for this and intend to have something to post tomorrow.
If we're taking votes on the UI questions, I agree with @sun on #2 and #3, and on #4 as well -- although not sure that #4 was a complete answer to the question :) I'm on the fence about #1.
Regarding the possibility of not having disabled shortcuts but only the ability to delete them (as @sun suggested): Something in favor of that point is that I think this is a place where it would be really easy to replace the current paradigm of "click delete and get a confirmation form" with the holy grail of "click delete and have it happen automatically, but then get an 'undo' link". I don't think we'd actually implement that anywhere but in a followup, but I'm mentioning it here because it might affect people's opinions of how important it is to have a disabled state.
@Bojhan in #129: Well, I mentioned in the writeup that a couple kittens were likely being killed, and I think you've identified them :) Some things would be simpler if we didn't try to satisfy as many use cases at once, but ultimately, it seemed from this issue like there are a lot of different use cases people want to support, and per-role is important to many people, enough so that they didn't want to add too much that would make it harder to do. So the suggestion is a compromise. I should mention, though, that doing per-user shortcuts is probably not as bad as I made it sound in the writeup. Playing around with the permissions and all that would only be necessary if you wanted to make absolutely certain that there was no overlap between users. But if, for example, you and I were administering a site together, we could simply make one set of shortcuts called "Bojhan" and one called "David", agree not to use each other's, and everything would work fine, no extra work required.
Comment #135
David_Rothstein CreditAttribution: David_Rothstein commentedBy the way, the updated patch will not (at this point) make any changes to the UI from the previous patch -- except to add the setting to the user account form.
Comment #136
catch@mcrittenden - look at them and work out which one I can delete or move to actual bookmarks folder without missing it too much.
Comment #137
Gábor HojtsyAbout the limitation of number of shortcuts, it is not so much a UI mandated limitation as a UX mandated limitation, to stop you from misusing this tool to build tens or hundreds of shortcuts. As per alternative implementations of dropdown displays (as in Noyz' suggestions), those can override the menu callback for editing and do away with the limitation (if the limitation happens to cover counting all subitems in all children), since there the top level items became categories and not items.
On disabled shortcuts, there are two roles fulfilled by disabled shortcuts. (1) We (and site builders, and install profile builders) can put in suggested shortcuts (ref. suggested menu items in Drupal core). Think your browser toolbar customizer: you have a suggested set of toolbar icons/actions, from which you can more easily build your shortcut bar. (2) There might be shortcuts like the edit mode toggle, which are nearly impossible to find/add otherwise (unless you exactly now the Drupal path), so deleting them would be disallowed. If you delete them, there is no way to get them back.
Comment #138
mcrittenden CreditAttribution: mcrittenden commented@catch, sorry, I thought you were saying that the system would prune them automatically. Makes a LOT more sense now.
Comment #139
David_Rothstein CreditAttribution: David_Rothstein commentedNote that as per recent discussion at #473268: D7UX: Put edit links on everything the edit mode toggle is very likely going to be taken out of the shortcut bar.
Overall, it doesn't seem like a great pattern for modules to add critical things to the shortcuts that aren't available anywhere else. The intention of the shortcuts - at least in my opinion - is that they are supposed to be customizable, swappable, and safe to remove.
Comment #140
David_Rothstein CreditAttribution: David_Rothstein commentedHere's a start at a new patch.
This is not at all functional yet (there's still a fair amount of UI-related code that needs to be copied in from the other patches and made to work), but in terms of the underlying functional code, this is more or less an idea of how it will work.
Comment #141
David_Rothstein CreditAttribution: David_Rothstein commentedBetter version - this one actually puts the new shortcut.module files in the right place (not that it really matters since the patch is non-functional right now anyway).
Comment #142
JacobSingh CreditAttribution: JacobSingh commentedTried to get going on this, but got this when installing:
Comment #143
JacobSingh CreditAttribution: JacobSingh commentedUgh Ugh Ugh...
Had a bad time trying to install and start on this patch today. Wasted a lot of time.
Not a comment on David's re factoring, anyone could have done this easily, but a comment on our lack of Exception handling - especially during the install process. The obtuse error I got was actually because toolbar.install was referenced in the info file, but didn't exist.
I had to go through the diff line by line to find this, since it doesn't show up anywhere in any error report or logs. Another error I also combed through to find is the menu refactoring for delete_links.
+++ modules/toolbar/toolbar.info 13 Oct 2009 06:03:28 -0000
@@ -1,9 +1,9 @@
files[] = toolbar.install
This should be removed
Should be:
+ menu_delete_links($menu['menu_name']);
This review is powered by Dreditor.
Comment #144
JacobSingh CreditAttribution: JacobSingh commentedBorken on install because of:
http://drupal.org/node/568640
Trying to use drupal_write_record from hook_install doesn't work because the schema isn't there yet :( poo.
Comment #145
JacobSingh CreditAttribution: JacobSingh commentedFixes a couple things which were throwing fatal errors, still broken though (doesn't show shortcuts at present).
Also included is the interdiff of the two patches.
Comment #146
Noyz CreditAttribution: Noyz commentedThere's a general concern regarding the vertical size of the shortcut bar. Plus, creating a custom icon for each shortcut is problematic, so I propose this design change #602408: Adjust height of shortcut bar
Comment #147
Gábor HojtsyAfter a quick glance at the patch, I'd say naming functions with this pattern will cause major problems:
"_set" is understood as a "setter", so "shotcut_set_name" would set a shortcut's name, right? No! It gives you the name of a shortcut set. shortcut_get_unique_set_name() is just another very nice example.
Also, given that toolbar module now requires the shortcut module, do you envision that contrib shortcutting implementations would also be implemented on top of shortcuts module instead of replacing it? The reason I'm saying is that shortcut module might not have good ways to provide tools for Noyz's folder based shortcuts for example.
Comment #148
sunIn addition: We have a very standard for function names. It is: subject_verb()
So, without looking at those functions, the above examples translate into:
function shortcut_name_set($number = 1) {
function shortcut_set_name_get_unique() {
Also, any interdependencies between Toolbar and Shortcut module need to vanish.
oh, and btw, http://drupal.org/project/shortcut
Comment #149
David_Rothstein CreditAttribution: David_Rothstein commentedThe object is "shortcut set", so I believe the correct function names would be shortcut_set_name() and shortcut_set_get_unique_name(). However, Gábor makes a good point that in cases where the word can be a verb or a noun, this can get really confusing.
Not only http://drupal.org/project/shortcut but also http://drupal.org/project/shortcuts :( ... although the latter doesn't seem very active. Maybe we solve both of the above problems at once with "bookmark" and "bookmark group" (http://drupal.org/project/bookmarks exists, but not "bookmark")? Overall, not too worried about this aspect right now :)
The shortcut module does not depend on the toolbar in any way. I don't think we've gotten far enough to see about the other way around, but I don't see any reason why it would be a problem for the toolbar module to depend on shortcuts.
In any case, yes, the intention of the shortcut module is absolutely that it can provide support for more complicated structures such as Noyz's folder-based approach. That is one of the reasons for using menu links. Currently, the shortcut module has an API that will save any menu links you give it - it doesn't care how they are structured. So a contrib module that wanted shortcut folders would really only have to provide a UI for putting the links in the correct hierarchical structure, and then it would basically be done.
Comment #150
JacobSingh CreditAttribution: JacobSingh commentedOkay, here is a start on resurrecting the interface and making a sane abstraction here. I think this is a good start, although needs a lot of work still.
When looking at this, I was trying to address the concern that shortcut really has little to do with toolbar. Shortcuts could be shown in other places, and the space where the shortcuts are could be used by other modules (as @sun says).
Problem is, the collapsible drawrer in toolbar needs to exist for shortcuts to play with it.
So instead of having toolbar-shortcuts, now we have toolbar-drawrer! This should remove a strict dependency on shortcut in toolbar, and shortcut can theme itself and just put it in the toolbar-drawrer part of $page.
This is kinda a wtf, and someone with better experience in theming would probably be able to suggest a better approach, but basically:
in function shortcut_page_build:
And in toolbar_page_build
This is not pretty, but because the letter S comes before the letter T, I don't know how else to pass along the fact that we have filled the toolbar_drawrer.
Anyway, small WTF to do away with a much bigger one IMO and give a lot more flexibility.
Starting on the admin interface and getting stuff to actually work....
Comment #151
JacobSingh CreditAttribution: JacobSingh commentedHeh, as Gabor kindly corrected me, it is drawer, not drawrer. He speaks his 2nd language better than I speak my first it seems :(
Comment #152
Gábor HojtsyAcknowledged removal of the icon plaeceholder treatment given #602408: Adjust height of shortcut bar, but not sure why would the permanent down-state for shortcuts was removed. Inadvertently? Also, the default dashboard shortcut is not pointing to the right place and the add to shortcut link seems to be way more intruding and less sexy. I'd suggest keeping the old visual treatment from dmitri's patch and add in the shortcut menu name there. It should fit.
Function naming should also be fixed still.
Comment #153
JacobSingh CreditAttribution: JacobSingh commentedOkay, okay misunderstanding, I was just showing how we can remove one from the other. I think there is a little CSS cleanup to do to get it nice again.
Comment #154
JacobSingh CreditAttribution: JacobSingh commentedOkay, another update.
Also attached is the interdiff with 151.
Summary of updates:
* Now the button works again, and I also added the toolbar.png that it needs in this binary diff.
* The previous refactoring of menu_delete_links was actually broken, fixed
* shortcut_set_load now takes similar arguments to shortcut_set_save. Has a slightly greater performance overhead... don't know if it matters, can be made into more functions, but seems cleaner.
* New UX workflow, instead of going to a form, it just adds the shortcut directly and sends the user back to destination.
* Fixed some broken CSS from my last update.
* Put the correct dashboard path into the installer.
I'm feeling sick and might be calling it quits for tonight.
Comment #155
David_Rothstein CreditAttribution: David_Rothstein commentedOK, I'm going to start working on this patch again (a little bit later). In the meantime:
Interesting - that was a straight copy-paste... looks like the code may actually be broken in core? Need to remember to look at that - there don't appear to be any tests for it :)
Nice to see the tokens added back - nothing like a little security :) They were in the patch around 100 comments ago or thereabouts, but seem to have gotten lost in the shuffle. Probably to be extra safe, they should use the user ID when generating the token.
***
Discussion question:
With regard to toolbar/shortcut dependencies, seems like Jacob's approach of a toolbar drawer definitely makes the most sense. However, it currently means that the shortcut module adds stuff to a dedicated "toolbar_drawer" region of the page which seems targeted at the toolbar module (unless other modules similarly looked for such a region). Not sure if that's what we want - I sort of envisioned the shortcut module as being more of an API, which probably only exposes the shortcuts via a simple hook_block() or perhaps also via a special theme function that is "toolbar-targeted" (if it can be made generic) but that can be called by various modules rather than trying to inject itself onto the page?
We discussed the possibility of a hook_toolbar_drawer() to solve this (which the shortcut module would implement), or possibly instead having the toolbar module use the shortcuts as its fallback for the drawer (if no other module has populated the drawer region first and if module_exists('shortcut'))...
Not sure it's critical to nail this right now, but worth mentioning for discussion - it may be that @sun is the only person who will care :)
Comment #156
David_Rothstein CreditAttribution: David_Rothstein commentedNew version, with a lot more of the user interface code copied over (almost all of it).
A bunch of things aren't working still, but it's starting to. I suspect a lot of things can be fixed by doing a find/replace in the shortcut module (especially the CSS and JS) and replacing "toolbar" with "shortcut"...
Comment #157
JacobSingh CreditAttribution: JacobSingh commentedI'm not sure how this worked...
I'm on crack. Are you, too?
Comment #158
JacobSingh CreditAttribution: JacobSingh commentedOkay I made some changes here which may or may not be popular :) But I also finished up the UI in most sections, so hopefully I am forgiven.
First, I switched most of the data structures back to using StdClass instead of assoc arrays.
Why? Because in the book of code purity by Jacob, arrays are generally for iterated structures. If you have something which has a bunch of properties and a primary key, it is an object - even if it is a fake PHP StdClass. I have no great reasons, it's easier to read and write, it's more consistent with other data structures in Drupal ($node, $user).
There were lots of other bugs, and there are still some left.
So shortcut_set is back to being a StdClass. I didn't mess with the links array, however I did fix something in menu.inc to sort by weight, because this was broken.
The screen to re-order screenshots is there, as is the button to access it. The screen to edit an existing shortcut is there. Creating a new one is not yet.
Attached is the patch and interdiff against 157.
Comment #159
yoroy CreditAttribution: yoroy commentedCan I test it yet, dear bot?
Comment #161
David_Rothstein CreditAttribution: David_Rothstein commentedHm, not sure why that patch didn't apply. Here's a rerolled version that is the same exact thing (but not made using Git...)
I'm going to see what I can do to finish this up. It is actually pretty close, although indeed a few things are still completely broken. UI-wise, the goal is that it's supposed to be the same as it was in #124-126 (with the exception of adding something on the user account page to change shortcuts from there), so if that goal isn't met, it's only by accident :)
Comment #163
David_Rothstein CreditAttribution: David_Rothstein commentedOK, this patch actually works now (i.e., no explosions). Definitely small bugs and UI polish not done yet, but it is now functional again, and therefore reviewable :)
Let's also see what the testbot thinks.
Comment #165
David_Rothstein CreditAttribution: David_Rothstein commentedOK, this will fix most of the test exceptions (and with any luck, all of them).
The bug was in shortcut_page_build() which I haven't really looked at too carefully at all but is the source of some of the remaining "interesting" code... the interaction between the shortcuts and the toolbar still isn't quite clear.
Comment #167
sunWhat about 'plid' ?
Not sure whether menu links can be cloned that easily...
Maybe we can go with that and deal with the bug later on.
The pattern is subject_verb, so
menu_links_load()
menu_links_delete()
Wrong indentation.
Trailing white-space here.
This should use the #attached property in the form already.
Which basically makes the entire theme function a bit obsolete.
This looks like a page title...?
With #602522: Links in renderable arrays and forms (e.g. "Operations") are not alterable, these could use the new #type = 'link'.
This should be a checkbox according to our UX guidelines.
ditto, #attached
Instead of using a sub-form-builder, these should live in a single form builder function, conditionally setting the title and if required, additionally elements.
We use the term "build" when a renderable array is built.
?
You can use drupal_get_query_parameters() here.
We should prepare the link text separately.
Shouldn't the access be checked before something is built - so you can simply test isset() here...?
Maybe I overlooked it, but whenever there is a float, there must be an overflow: hidden in the parent container.
I'm on crack. Are you, too?
Comment #168
David_Rothstein CreditAttribution: David_Rothstein commentedAwesome feedback as always... This patch just fixes the broken test, does not address any of #167 for now. I have to go offline for a while soon, but can try to do it later.
I was very tempted to delete this test rather than fix it, but refrained :) (see the interdiff) At least the testbot should be happy.
Comment #170
David_Rothstein CreditAttribution: David_Rothstein commentedOK, the test failed because I didn't put things in alphabetical order... sigh :)
This should take care of that as well as most of @sun's feedback above. A quick recap of some of the things I did not change...
1. menu_load_links($menu_name): It's subtle but I actually think this might be the right function name. The "menu" is the object we are acting on, and "load links" is the thing we're doing to it.
2. Did not change select box to a checkbox for now (note that it gets hidden by javascript anyway, and then used in the tabledrag behavior, and I didn't feel like trying to make tabledrag work with a checkbox).
3. I left the sub-form-builder as a separate function (we had tried combining those functions before and they didn't come out looking so good, plus have separate submit handlers, etc).
4. I left as $data['content'] rather than $data['build'] because the code occurred inside hook_block_view() so it's required to be like that :)
5. I double-checked and it looks like there's already a overflow: hidden in the parent container.
Comment #171
webchickYoink. Grabbing this to give it a spin.
Comment #172
webchickWhen applying this to an existing install without starting from fresh (to simulate a user upgrading from Drupal 6), here's what I see:
1. (commit-blocker?) When the toolbar is enabled but shortcut is disabled, you see the collapsing icon, but it doesn't do anything. I haven't looked at the implementation closely, but this seems like unwanted coupling.
2. (commit-blocker) When I first enabled the module, I got:
2b. (commit-blocker) Apparently uninstalling it isn't pretty either, according to David. ;)
3. (commit-blocker?) My shortcuts bar has nothing in it by default. Just an "edit shortcuts" link. Not sure if this is by design or not, but I suspect not.
4. (commit-blocker) Clicking "edit shortcuts" gives me:
5. (post-commit clean-up) The description on that text field makes no sense to me:
I'm going to pause here with my testing while David works out these bugs, then have at it again.
Comment #173
webchickComment #174
David_Rothstein CreditAttribution: David_Rothstein commentedOK, here's a new version that fixes the uninstall bug.
The issues with enabling it on an existing install, I tracked it down a bit and it seems almost certainly like it's due to #200931: Schema not available in hook_install/hook_enable. Haven't tried that patch to see if it fixes it, but seems like it should. Worth including as part of this patch or not (it seems to be a one line fix)?
Comment #175
David_Rothstein CreditAttribution: David_Rothstein commentedWell, a one line fix, but it seems like that will cause its own testbot failures, so maybe best to leave as a separate issue if possible...
Comment #176
webchickUI review
Also, note that I was not able to test contextual "Add to shortcut" because I don't see any links for that and missed the images somewhere above. This implies that we might have some accessibility issues, though David suggested that it might work with JS disabled.
Code review
+++ includes/menu.inc 16 Oct 2009 04:24:13 -0000
@@ -2257,6 +2257,75 @@ function _menu_navigation_links_rebuild(
+function menu_links_clone($links, $menu_name = NULL) {
...
+function menu_load_links($menu_name) {
...
+function menu_delete_links($menu_name) {
Nice! I'm betting these will come in handy for contributed modules as well.
+++ modules/shortcut/shortcut.admin.inc 16 Oct 2009 04:24:13 -0000
@@ -0,0 +1,514 @@
+function shortcut_max_slots() {
+ return variable_get('shortcut_max_slots', 7);
+}
Ha! I was going to say that I can think of more than 7 links that I can't remember the paths too and lookee here. :)
+++ modules/shortcut/shortcut.api.php 16 Oct 2009 04:24:13 -0000
@@ -0,0 +1,40 @@
+function hook_shortcut_default_set_name($account) {
The name of this hook could really use some work. I would never guess that it was intended to let me alter the shortcut set for the given user.
+++ modules/shortcut/shortcut.module 16 Oct 2009 04:24:13 -0000
@@ -0,0 +1,525 @@
+function shortcut_permission() {
+ return array(
+ 'administer shortcuts' => array(
+ 'title' => t('Administer shortcuts'),
+ 'description' => t('Manage shortcuts and shortcut sets regardless of which user they are assigned to.'),
+ ),
+ 'customize shortcut links' => array(
+ 'title' => t('Customize shortcut links'),
+ 'description' => t("Edit, add and delete the links in the user's currently displayed shortcut set."),
+ ),
+ 'switch shortcut sets' => array(
+ 'title' => t('Choose a different shortcut set'),
+ 'description' => t('Choose which set of shortcuts are displayed for the user.')
+ ),
+ );
+}
(follow-up) These permission names/descriptions could use some work. In particular, it's not clear to me what the difference is between "Administer shortcuts" and "Customize shortcut links".
+++ modules/shortcut/shortcut.module 16 Oct 2009 04:24:13 -0000
@@ -0,0 +1,525 @@
+function shortcut_sets() {
+ return db_query("SELECT * FROM {shortcut_set}")->fetchAllAssoc('set_name');
+}
If you do this in a db_select(), then other modules can hook_query_alter() it.
+++ modules/shortcut/shortcut.module 16 Oct 2009 04:24:13 -0000
@@ -0,0 +1,525 @@
+ $configure_link = array('#markup' => l(t('edit shortcuts'), 'admin/config/system/shortcut/' . $shortcut_set->set_name, array('attributes' => array('id' => 'toolbar-customize'))));
Check permissions first.
+++ modules/menu/menu.module 16 Oct 2009 04:24:13 -0000
@@ -271,21 +271,13 @@ function menu_save($menu) {
- $links = db_query("SELECT * FROM {menu_links} WHERE menu_name = :menu_name", array(':menu_name' => $menu['menu_name']));
- foreach ($links as $link) {
- // To speed up the deletion process, we reset some link properties that
- // would trigger re-parenting logic in _menu_delete_item() and
- // _menu_update_parental_status().
- $link['has_children'] = FALSE;
- $link['plid'] = 0;
- _menu_delete_item($link);
- }
+ menu_delete_links($menu['menu_name']);
Love hunks like this. ;)
+++ modules/toolbar/toolbar.tpl.php 16 Oct 2009 04:24:13 -0000
@@ -8,7 +8,7 @@
- * - $toolbar['toolbar_shortcuts']: Convenience shortcuts.
+ * - $toolbar['toolbar_drawer']: A place for extended toolbar content.
Hm? Why this name change? The old name is way clearer.
A: We don't want to couple toolbar and shortcut menu together. This makes it a generic container for "extended" data, wherever it comes from.
Conclusion
This is the first time I've really had a chance to play around with this patch, and it was an absolute joy. Finally I have a place to put all of those links I can't remember the paths to anymore. :D I really think this will be an amazing offering in D7 core for power users, and site builders alike.
However, as you can see, this isn't quite ready yet. But it is very close. I think one or two more re-rolls ought to get us there. I can't really see holding this feature back on one or two re-rolls, but let's please try and get this nailed down in the next ~24 hours. If any of these things are going to take too long to fix, go ahead and file follow-up issues for them.
It's also worth spending a little time here (again < 24 hours) talking about the name of this module. When the dashboard feature got committed, there was an absolute sh*t storm about the fact that core took a name that a contrib module had already called "dibs" on. But really, IMO the ire was less about the namespace conflict and more the fact that the functionality the two modules implemented was similar in concept, but drastically different in implementation. While there are no recorded users of dashboard module in contrib yet, Drupal.org at the very least will eventually be using this module. (Incidentally, it turns out Gábor (major contributor to dashboard patch) and Neil (maintainer of dashboard module) had already had the discussion about this namespace conflict and Neil was cool with it.)
We have another such namespace conflict here with http://drupal.org/project/shortcut. It's a module about keyboard shortcuts (nothing to do with this core module) with ~25 users. I don't personally see this as a huge deal; modules frequently change names between major version of Drupal (bio => content_profile, workflow_ng => rules, amazon_tools => amazon, etc.) so I don't see this placing an incredible hardship on users as long as it's documented (Upgrade Status module even has rules for this). It would be great for one of the pathc authors though to reach out to the shortcut maintainer before we commit this patch and check if they'd be ok with something like "keyboard_shortcuts" instead.
Another option is we go the route of naming this to something like "bookmark" instead since http://drupal.org/project/bookmark currently doesn't exist. I'm not crazy about this though, since:
a) If I saw a module named "Bookmark" i would expect it to do what http://drupal.org/project/bookmarks does (bookmark individual nodes on my site)
b) I'm concerned people will get these bookmarks confused with their browsers' bookmarks. "Shortcuts" is clear; you're emulating the dock from your operating system.
Anyway, thoughts/opinions on that stuff would be nice. Great work on this patch!! :D
This review is powered by Dreditor.
Comment #177
JacobSingh CreditAttribution: JacobSingh commentedOokee :)
Good review.
I'm going to knock these out. They all seem pretty simple except the "Save changes" one....
To add the "Front page" link you must have left this page though, right? in which case, I don't understand the problem.
I think it would be a better UI to always save changes as they worked, but this is of course more work, and you need a save changes button anyway for accessibility.
Comment #178
JacobSingh CreditAttribution: JacobSingh commentedSomething in #171 (or core) is seriously messed up.
Gabor and I both saw this behavior:
Depending on the page visited, we saw different shortcuts, and some times a CSS offset.
My guess is depth field
Comment #179
JacobSingh CreditAttribution: JacobSingh commentedOkay.
Something in core changed which caused a massive fail on this issue and took a couple hours out of my day, but then it fixed itself! Yeah for self-healing Drupal.
Anyway, I think I fixed most of the small code things. And I've made a little movie to demonstrate the UI fixes.
You can watch it here: http://pajamadesign.com/drupal/movies/shortcut-178.mov
Here is a list of the things I didn't do:
Change the hook name
I agree w/ webchick, just don't have a great suggestion. Probably, the problem is that this pattern is not represented in Drupal, a "winner takes all" type of callback, that's why it doesn't really work. I know Crell has some strong feelings about this :)
Figure out why the shortcut bar vanishes on a 404 page
I just don't know / want to know much of menu.inc, but I fear it is somewhere in there.
General
I feel like the CRUD APIs here are redundant in a lot of places, and some cleanup would be a good idea. Sometimes we seem to load all sets into a static cache, sometimes an individual one, I think there are some overlap cases we should deal with. Particularly if we can pass around the objects returned by db_select(). Not a huge deal though.
Comment #181
effulgentsia CreditAttribution: effulgentsia commentedsubscribing
Comment #182
David_Rothstein CreditAttribution: David_Rothstein commentedOK, here's a new version. I've also attached the interdiff from the last patch @webchick reviewed, as well as reattaching the icon (from #126) for modules/toolbar/toolbar.png.
I think we've now gotten all of the points in @webchick's original review, except for the second screenshot which we were a little confused about what to do with :) Also, Jacob's point in #178 is probably not fixed either.
I think this is pretty close?
Comment #183
Dries CreditAttribution: Dries commentedLooks good. Some minor feedback -- none of which should hold up this patch.
This function has a lot of different code paths, and could be a candidate for some clean-up.
- For sets, we seem to be mixng 'name' and 'title'.
- For user names, we just do 'user'. For set names, we use 'set_name'.
This is somewhat cryptic, and could be clarified and expanded upon.
It is not clear what format that default set needs to be in. Do we just need to specify the name or something else? Could be clarified in the documentation.
Comment #184
Dries CreditAttribution: Dries commentedAlright, after a lot of testing, I committed this to CVS HEAD. I'm marking it 'code needs work' so we can follow-up with some refinements.
Great job all -- well done!
Comment #185
webchickNote that for a couple minutes, HEAD was broken. This patch was only partially committed for whatever reason. It should be fixed now though. :) In default profile, anyway.
When you install expert profile, however, upon enabling this module you get:
And an empty shortcut bar, then a bevvy of errors everywhere else. (basically, see #172)
It looks like default.profile is doing some instantiation that doesn't take effect when the module is installed after Drupal. Need that fixed. ;D
Comment #186
webchickHuh. Apologies if this posts twice.
Note that for a couple minutes, HEAD was broken. This patch was only partially committed for whatever reason. It should be fixed now though. :) In default profile, anyway.
When you install expert profile, however, upon enabling this module you get:
And an empty shortcut bar, then a bevvy of errors everywhere else. (basically, see #172)
It looks like default.profile is doing some instantiation that doesn't take effect when the module is installed after Drupal. Need that fixed. ;D
Comment #187
Damien Tournoud CreditAttribution: Damien Tournoud commentedMenuIncTestCase::testMenuGetNames() is now failing... and that menu test is effing stupid. Let's fix that.
Comment #188
Damien Tournoud CreditAttribution: Damien Tournoud commentedFixing the fix. This one passes locally.
Comment #189
webchickCommitted #188, turned testing bot back on. Let's see what happens.
Restoring needs work status.
Comment #190
asimmonds CreditAttribution: asimmonds commented#200931: Schema not available in hook_install/hook_enable appears to fix the notices when enabling shortcut module after installation using expert profile (as referred by David_Rothstein in #174)
Comment #191
sunok. I'm angry. So I keep it up to the point.
Comment #192
JacobSingh CreditAttribution: JacobSingh commented@sun: Since a picture says 1000 words, I'm not sure what you're talking about, but I suspect it is the "add to shortcuts" link when you are not using shortcuts. It actually has *nothing* to do with the toolbar. I made this patch not 1:1 with the toolbar by making the space the toolbar expands to not be shortcut specific and moving the shortcut related stuff into shortcut.module. This was directly in response to your (valid) complaints.
What you are seeing is a not so nice integration with the theme. Currently, there is this "add_to_shortcuts" variable which is chucked right into seven:
No one likes this. Also, no one has a better idea of how to position this thing where it belongs (next to the title) while not embedding it in the admin_theme. As a developer, you can of course use a preprocess hook to remove this var, so it doesn't show. Also, if you don't plan on offering shortcuts to users, you can just turn the shortcut modules off.
Let me know if I'm missing something here and found the wrong problem or if you have ideas of how to make this cleaner but as usable.
Best,
Jacob
Comment #193
catchThis caused a 6% performance regression, including for users with no access to shortcuts. #620634: Shortcuts are built unconditionally for anonymous users
Comment #194
bleen CreditAttribution: bleen commentedsuperscribe
Comment #195
gpk CreditAttribution: gpk commentedNote that the commit of #182 caused #633234: Error when enabling the toolbar module on a minimal site since it removed the dependency on menu.module in toolbar.install but not from toolbar_install().
Comment #196
catch#646486: shortcut_current_displayed_set() issues unnecessary queries / menu_load_links() causes a filesort
Comment #197
sun.core CreditAttribution: sun.core commentedRemaining stuff is/has been tackled elsewhere.
Comment #198
Bojhan CreditAttribution: Bojhan commentedPutting this back to active - supposedly this was to be closed when most followup's where solved but apparently it got no UX review - as we thought this was an intermediate step (seeing this is the actual final UI there are numerous follow ups) see :
#680500: Shortcuts violate Drupal UI standards
Comment #199
Everett Zufelt CreditAttribution: Everett Zufelt commentedtagging
Comment #200
ksenzeeI filed a separate issue for Jacob's point in #179 about shortcuts disappearing on 404 pages: #780930: Shortcuts disappear on 404 pages
I believe everything else has its own issue, so I'm moving this back to fixed.