Hide standard outline tabs and links

druppi - July 3, 2009 - 16:12
Project:BookMadeSimple
Version:6.x-2.1
Component:User interface
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

With BMS I try to make book handling very easy for users. They do not need all functions of the book module.

To make life easier for them (and also for me to avoid questions from the users) I would like to remove all links, tabs, field-sets of the book module that are better solved with BMS functions. This is: outline-tab on node (edit) form, book outline field-set on node edit form. These links are all needless/confusing, if I restrict books and child pages to certain node types with BMS and do not allow a default book(page). I can add a page with the BMS-link "add node-type(s)", reorder the pages with the BMS-tab "Reorder the book", so all needed functions are in place where I need them.

Would it be possible to add a setting in BMS to suppress these needless book-links, perhaps by role (i.e. user experience)? If a user has more than one role, then it is sufficient if any of these roles allows the display.

#1

MarcElbichon - July 6, 2009 - 07:57
Status:active» won't fix

Outline tab can be managed by un/setting administer book outlines permission to role.
Fieldset can be hidden by adding fieldset.book-outline-form {display:none;} in your css file.

#2

druppi - July 13, 2009 - 07:12

Outline tab can be managed by un/setting administer book outlines permission to role.

Then a major function of BMS becomes inactive; users can no longer manage the outline of the current book, too.

Fieldset can be hidden by adding fieldset.book-outline-form {display:none;} in your css file.

How can you do this on a per role basis?

btw. I can not only hide the fieldset but also the outline tab with css. But I can not do this based on user experience (role).

#3

druppi - July 13, 2009 - 07:11
Status:won't fix» needs work

#4

MarcElbichon - July 13, 2009 - 07:46
Status:needs work» won't fix

Which major function of BMS becomes inactive ?
You wanted to hide tab. So unset administer book outlines permission to users.

For the fieldset. I think there's a "dysfonction" because tab and fiedset don't act as the same way.
Tab is hidden according permission, while fieldset isn't if parent book is set. I think this a book feature and not an BMS one.
So, post an issue to core book.

#5

druppi - July 13, 2009 - 08:30
Status:won't fix» needs work

It isn't an issue of the core book module, it is an issue of BMS. If I hide the outline-tab by roles permission, the BMS tab "Reorder the book" is also hidden (same permission) and the user can not even reorder the current book. What I want is to hide all tabs and links the user does not need anymore as these links may confuse the user. He does not need multiple ways to reach a function, one complicated way (outline-tab of core book module) and one easy way (BMS "Reorder the book"). I would like the complicated way to be hidden (e.g. outline tab) if the easy way is enabled (e.g. "reorder the book"). I could live with hiding the fieldsets with css (though this is not a "clean" way) if possible.

#6

MarcElbichon - July 13, 2009 - 14:33

Core book tabs cannot be managed by other modules because it is a menu. So, I added a new permission "administer book ordering" to allow access of the Reorder the book tab to roles.

Download Release 2.2a

So disable Administer outline book and enable administer book ordering

Fieldset in edit page will act the same way of outline tab.

#7

druppi - July 13, 2009 - 20:10

Sorry, but this does not work :(

I disabled "administer book outline" and enabled "administer book ordering". Then the "outline" tab is gone. But when I click on "Reorder the book" I get "You are not authorized to access this page." I didn't expect anything else, as this page (core book module) checks for "administer book outline" (core book module) and not for "administer book ordering" (BMS).

#8

MarcElbichon - July 23, 2009 - 07:55

Simplest things may be hardest to resolve !

Menu tabs can only be managed by theming functions. So, I redirected template themed function to module themed function.
Now, there are two permissions :

  • Show book reorder link : Show or hide book reorder link. Has no effect if administer book outlines is unchecked
  • Show core Outline links : Show or hide Outline Tab and book outline fieldset

So to do what you want with the new 2.2a version :

  • Check administer book outlines
  • Check Show book reorder link
  • Show core Outline links

IMPORTANT - Clear theme registry cache or cached pages

#9

scottrigby - July 22, 2009 - 17:17

Hi Marc,
Is this new feature added to the code at http://code.google.com/p/mmr-drupal-modules/wiki/BookMadeSimple ?
If so, I'll be happy to review

It sounds like disabling 'Show core Outline links' will:
a. hide outline tab
b. hide outline fieldset from node edit form on content-types that aren't configured to be allowed as book nodes

Can you verify this is how it works? Disabling 'Show core Outline links' won't remove the fieldset from all content-types, will it? If not, great! But if so, how can we add the node to a book outline or as a new book?

Thanks in advance for clarifying

#10

scottrigby - July 22, 2009 - 20:06
Status:needs work» reviewed & tested by the community

@MarcElbichon: Actually I tried the zip file @ that link and it works like a champ ;)

The only problem I found is that some book-override modules don't play nicely together. For example, the Outline.module (which we're also using) hijacked core book links, so the 'Add child' links could not be overridden by BookMadeSimple. But i think that's an Outline issue so i made a patch which fixes this: #527816: Option to not hijack core book links

On a related note, I previously wrote a module (not added to d.o yet) that does some of what BookMadeSimple does - though BMS is more feature-rich. So I'm thinking of switching to use your module instead, and not bothering to submit mine -- no need for 'Druplication' :)
However, If I use the BMS module on our sites I would like to see it maintained - I realize you have port limitations though. So in response to: http://drupal.org/node/415860#comment-1511224 - I would be happy to publish code for you, and potentially contribute, to keep the releases updated. I think i would need to be added as a co-maintainer to do that though - do you know about that?

#11

MarcElbichon - July 23, 2009 - 08:04

Hi scott

I'd be very glad to add you as co-maintainer.
Please tell me when you'll have CVS access to grant you access.
Maybe have you some ideas to promote this module ?

#9 : Fieldset is hidden for all content-type, so changing parent book or creating new book is not possible (except by admin). This option force book management with BMS.
Maybe can we define a rule for displaying core outline links ?

#12

druppi - July 26, 2009 - 09:31

Hi Marc,

now I'm back from holiday ;)

I tested your newest 2.2a version (dated 17.07.2009). It partially works: the core outline links are hidden, but the main outline tab is not :(

@Scott (#9):

As I understand what Marc has done:

  1. You are able to take over the control over the book module and modify the user interface.
  2. Faults in core book module concerning translations are solved
  3. Books are created automatically and the user must not actually request the creation of a book. Thus only certain node types can be books and these node types are always books.
  4. Subpages are not added to any book but the book the user is currently viewing. I think that's a more user friendly method than defining the book the subpage belongs to while (and not before) adding the subpage, as core book module does.

I always develop my Drupal-sites with the end-user in mind. As I develop sites for non-profit organizations, these end-users are often very unexperienced users (like those that use word or writer like a typewriter, with manually line brakes and space indentation). And multiple ways to achieve a result is confusing for those users, too. For these users BMS is very well designed!

#13

druppi - July 26, 2009 - 09:41

Hi Marc,

Can you hide the tab "Reorder the book" if the book is empty or even better: if the book contains at least two pages, does it make sense to reorder one page? If you currently click on the link you will be presented with an empty page and a button "Save book pages". If you then press this button you will get errors from the book module:

* warning: array_keys(): The first argument should be an array in /example.org/modules/book/book.admin.inc on line 107.
* warning: array_flip(): The argument should be an array in /example.org/modules/book/book.admin.inc on line 107.
* warning: array_merge(): Argument #1 is not an array in /example.org/modules/book/book.admin.inc on line 108.

#14

MarcElbichon - July 27, 2009 - 09:37

#12 : Have you cleared your theme registry or cached pages ?

Release 2.2b added a BMS setting to hide/show reorder link.
Can you alter your translation file and send it to update my package ?

#15

druppi - July 28, 2009 - 04:49

I work with a zen-based theme and have checked the option to permanently clear the theme registry. The cache is not on but I cleared it anyway. Nothing happens: the outline-tab is still present. This also happens with the 2.2bversion.

This version is great: now you can decide to hide the reorder-tab if the book is empty or if it contains only one page. But what I do not understand: why is it an option? It does not make sense to display this tab if the book is empty or contains only one page. I bet you will get future issues with the warning messages when reordering an empty book as the uers forget to check this option. If you really insist on this option, I suggest it to name it: "Show reorder tab even if book is empty". So one has to explicitly activate it!

#16

druppi - July 28, 2009 - 05:35

@#12: could it be a matter of sequence? That the book "outline" tab is generated after BMS has modified the links?

I added

<?php
/**
  * Hide outline tab
  *
  */
function mytheme_menu_item_link($link) {
  if (
$link['path'] == 'node/%/outline') {
    return
null;
  }
  else {
    return
zen_menu_item_link($link);
  }
}
?>

to my template.php in my zen-based theme mytheme and the outline tab is gone!

But this is not a solution, it is only a workaraound.

#17

MarcElbichon - July 28, 2009 - 07:18

Warning messages went from core book module. I think this is a book bug.
I added this parameter to be backward compatible. Perhaps somebody will want this behaviour.
For your suggestion, you consider a book empty when it has less than 2 subpages, what is not really right. A book is not empty if it has one subpage !
So i suggest to rename the param to 'Hide reorder tab when no needed' with Yes by default.

Can you add this line

<?php
   watchdog
('BMS','Theme menu_item_link entered');
?>

just after function book_made_simple_theme_menu_item_link($link) ?

#18

druppi - July 28, 2009 - 15:59

Sorry, sorry,

I only tested with user #1 which by default owns all permissions :(
When I switched to another user without the "show core Outline links" permission, it works!

Thanks for the hint with watchdog, I didn't find a way to trace this, but now I know ;)

So you did a good job, and I didn't :(

So i suggest to rename the param to 'Hide reorder tab when no needed' with Yes by default.

Then you have to explain what "(not) needed" means. I think "empty" as "no subpages" is sufficient. I could live with this and forget about "at least two pages" as it does not produce warnings from the book module.

#19

MarcElbichon - July 29, 2009 - 08:16

Finally, i follow up your suggestion. I added a param Show reorder tab even if book is empty with a description to explain when a book is considered empty.
Content types in BMS setting are now in columns (i have many content types so page looks more pretty). This can be disabled by checkind Disable BMS layout param.

All this features are enabled in the last 2.2b release.
Can you verify the 'well english spoken" of new params in settings and send me your new translation file ?

#20

druppi - July 30, 2009 - 04:26

Please upload the file so it can be tested :)

#21

MarcElbichon - July 30, 2009 - 07:59

You can get it as usual but post it as attachement

AttachmentSize
BookMadeSimple_6.x_2.2b.zip 13.81 KB

#22

druppi - July 30, 2009 - 15:25

But neither this nor the zip-file on google contains your changes!

#23

MarcElbichon - July 31, 2009 - 07:34

Sorry.
Can you get the new release on google ?

#24

druppi - July 31, 2009 - 15:30

I did as suggested, but nothing changed.

The module file inside the zip is dated 27.07.2009 11:26. Could that be correct?

On the other hand, the german translation file is out of date (17.06.2009).

#25

MarcElbichon - July 31, 2009 - 17:48

Are you sure ? I download this release, and module file name is dated 29/07

#26

MarcElbichon - July 31, 2009 - 17:50

Attached file would be good !!!

AttachmentSize
BookMadeSimple_6.x_2.2b.zip 13.81 KB

#27

cyc - August 2, 2009 - 15:13

@MarcElbichon,

Have problems with permissions.. could you clarify that?

I've thought this module allow to remove general 'admnister book outlines' permissions for specific role, and flexibly allow such permissions for some content types/roles. But something is still unclear for me

1. I've installed 2.2b
2. Selected some content types taht can be included in book in BMS settings
(the same as in core book module)
3. Go to permissions for my role 'author':
- Unchecked administer book outlines in core 'book' section,
- Checked 'show book reorder link' in BMS section,
- Unchecked 'show core Outline links' in BMS
- Logged as Author role

Effect:
- During adding proper content type, I'm not able to choose book
- During editing content which is book page already, I cannot see reorder tab

How to show "book reorder tab" for users without 'administer book outlines' permission?
Now BMS allows me only to show 'core Outline links' for choosen content (of course its OK)

#28

druppi - August 3, 2009 - 16:08

@#26: now it works! I have sent you the translation file by E-Mail to embed it into the new release ;)

#29

druppi - August 3, 2009 - 16:41

@cyk (#27)

  1. All users that should be able to reorder any book must have the core book permissions administer book outlines and create new books.
  2. If for those users, the core book outline-tab and book outline-section on the edit form should be hidden, the user must not have the BMS permissions show core Outline links.
  3. If the users instead (or additionally) should have the possibility to directly go to the node/%/reorder page for the current book, they should have the BMS permission show book reorder link.

If you hide the core book tabs and links and show the reorder the book, you should set your BMS settings and content type settings accordingly:

  • check the node types to create a book automatically in BMS Settings page (or alternatively on the content type settings page). You will not be able to create a book manually as all links are hidden!
  • uncheck all checked entries in SELECT NODE TYPES THAT CAN BE INCLUDED IN A BOOK on the BMS Settings page (this is a suggestion, why use core book functions when you installed BMS?)
  • on the content type settings page check the node types that can be used as child pages in this node type and whether this node type creates a book automatically. Be sure not to check a node type as child page that creates a book automatically (that would be a sub-book and the core book-module can not handle that)

Then: First create the book node, then create the book pages from that node or from other book pages as subpages. You will no longer be able to create a node and then assign a book(page) to it (unless you show the core book outline links again).

By following these rules all should work perfectly.

#30

scottrigby - August 4, 2009 - 17:27

@MarcElbichon: Re #11 - apologies for not replying for over a week! I don't know why I didn't receive the emails after post in this thread? In any case, I'll use your post in #11 to apply and help with releases. I can also post the few things I've done with my (not yet contributed) module as patches to this one if any of those features seem helpful. But my first goal will be to help with the releases so we can easily keep track of patches, allow other people to more easily contribute etc :)

#31

scottrigby - August 4, 2009 - 18:00

@MarcElbichon: So I've applied for CVS to help maintain releases for BookMadeSimple, and created a new issue #539928: BookMadeSimple 6.x-2.2 for coordinating the next release (per best practices guidelines here: Coordinating development and releases). I'll let you know as soon as I hear back. BTW, I can also usually be reached on IRC during the week for any coordinating, etc.

@druppi & cyc: sorry guys for focusing on this stuff in this issue - I realize you get these emails too - but it seems sorting out releases would be helpful in allowing others to contribute and test patches, and since we've already seen the difficulties of sorting out patches & releases in this one issue (and because Marc's response to my request is already in #11, i figured I'd keep this here rather than creating a new issue for it).

#32

druppi - August 6, 2009 - 05:11

No need for apologize, Scott. I appreciate your collaboration in this project. I, myself, can only collaborate in having ideas and testing new releases but not in developing new modules :(
BMS is a very nice module making core book handling much easier and providing an enhancement to the user interface. If one developer has problems to post new versions and another developer is willing to help in that issue, this is the best example of working in an open source community.

#33

scottrigby - August 6, 2009 - 14:28
Status:reviewed & tested by the community» fixed

Marking as fixed because this patch is included in 6.x-2.2. Also committed to 6.x-2.x-dev (currently the dev snapshot and new release are exactly the same), so new patches can be made against dev :)

#34

System Message - August 20, 2009 - 14:30
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.