Support from Acquia helps fund testing for Drupal Acquia logo

Comments

druvision’s picture

Title: Drupal 6 version / alternatives? » Html2Book Drupal 6 version / alternatives?
looplog’s picture

Is the maintainer out there? I tried to wrap my head around how this module works, but between that and trying to grok the changes to the way book works in menu for 6.x, I got completely lost. I also tried running this module through deadwood conversion module but the result is no different. It also, not surprisingly, produces absolutely no results.

Any chances of an update to this extremely useful data entry module?

Hoditz’s picture

I second the request. This module is important for my sites and without it I can't upgrade to 6...
Can anyone help?

dugh’s picture

subscribe

adam_b’s picture

subscribe

junedkazi’s picture

Hi

I love this module. So I have started work on it. I think I will have something out
within a week's time.

Thanks

Juned Kazi

KarenS’s picture

@jundkazi, thanks, I appreciate the help. I just have not had time to do anything with this yet.

junedkazi’s picture

@KarenS

I have tried to upgrade the module but faced lot of problems. I am attaching the patch files below.

junedkazi’s picture

Status: Active » Needs work

@KarenS

The problem which I faced is as follows:

In D5 the "html2book_split" function was called in "submit" case of the nodeapi which has now changed to
"presave" in D6. So when I call the html2book_split function under the nodeapi presave case it does into
an infinite loop.
On further debugging I noticed that the node_save function in html2book_split is itself calling the presave
case at the beginning of the nodesave function.

So as of now I have changed the nodeapi case to insert. The module is working fine except that the parent
node is picking up the whole HTML and its child nodes are created properly.

junedkazi’s picture

FileSize
8.64 KB

I am also attaching a tar ball of the whole module in case the patches don't work

junedkazi’s picture

Title: Html2Book Drupal 6 version / alternatives? » Html2Book Drupal 6 port
junedkazi’s picture

FileSize
7.15 KB

here is a working copy of the module file.I am just attaching it as a txt file.
Please rename it to .module again.
This is just an attempt. It has not been tested for edge cases.
If you come across any bugs pls report it here and I will try and fix it.

Hoditz’s picture

Thank you so much.
I've installed the module in my Drupal 6 test site and I made some simple tests. I'm happy that the module is functional and I'm planning now to upgrade my sites. There's a problem, but I don't know if it's solvable - maybe it's a book module issue, a weight problem, or maybe I didn't found yet the correct procedure.
Basically it's about the order of child pages - the table of contents for the new book is listing the subpages in alphabetical order, or numerical order (if the chapters are numbered), instead of respecting the order in the source file.
Example: if the chapters in the source file are, in order: Chapter, Achpter, Hcapter, Tchaper, Echaptr - then html2book is generating an alphabetical toc: Achpter, Chapter, Echaptr, Hcapter, Rchapte, Tchaper.
Another example - headers in source file: I, II, III, IV, V, VI, VII, VIII, IX etc. - but generated table of contents: I, II, III, IV, IX, V, VI, VII, VIII.
A final example: names of chapters in the source file: 1, 2, 3, 4, 5... 10, 11 etc. - result after html2book: 1, 10, 11, 2, 3 etc.
Of course, Drupal 6 has drag and drop and it's easy now to rearrange the chapters of a book. But for books with many chapters it would be great if a solution can be found. Html2book should order the child pages exactly in the original succession.
In the html2book for Drupal 5 the table of contents was correctly produced, in general, but the same disorder was produced if editing anything in the outline view.
Again, I need to use more the module to be sure, but I think this is a issue to be resolved.
Thanks again.

junedkazi’s picture

FileSize
7.21 KB

@Hoditz

Thanks for pointing that bug out. Can you please try again with this file.

Thanks

Juned Kazi

Hoditz’s picture

Thanks.
The new code gives an error on line 112 - Class 'Logger' not found.
Commenting out that line, the module seems to function properly.

junedkazi’s picture

@Hoditz

Sorry for that . That was a debugging statement which I use. we can comment that line.

Thanks

Juned Kazi

junedkazi’s picture

FileSize
7.17 KB

I am attaching a new file after removing the Logger statement .

Hoditz’s picture

Thank you, the error is corrected.
From my point of view the module is functional and will start using it in production soon.
I'll be able to test it more thoroughly, with a variety of books. I'll report here if problems occur.
(Some unwanted rearrangements after editing in "edit order and titles", just as in the D5 version).
I believe the module is ready for deployment for Drupal 6 users - thanks again, junedkazi (and also KarenS).

junedkazi’s picture

@karenS,

Can u please review the code and can we have a dev version or something like that ?.

Thanks

Juned Kazi

KarenS’s picture

Status: Needs work » Fixed

OK, I finally got the D5 branch split off so we can work on D6. I committed the code above. The new -dev versions probably won't show up for 12 hours or so, then you can see if it's working correctly.

Reopen this issue only for problems with the D5->D6 port itself. If there are other bugs or problems with the way the code works, open separate issues for them.

Thanks so much for all the work junedkazi!

progesterone’s picture

FileSize
7.55 KB

@junedkazi

I didn't see your contribution until I have done the working version for D6 by myself.

It is not thouroughly tested anyway. I just did the following modification to the D5 version and got D6 version.
- change from 'submit' case to 'presave' case to be compatible with D6
- set $node->html2book = 0; just after before calling html2book_split function to prevent infinite loop of calling hook_nodeapi
- Display the title of untitled page as 'Page page_number_in_node' format.

Status: Fixed » Closed (fixed)

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

druvision’s picture

Status: Needs review » Closed (fixed)

The officially committed D6 dev version doesn't create any book sub-pages, only deletes the text on the main node.

Fortunately, Patch #21 above semi-works - at least it splits the pages correctly (with the sample pages proviced on the module's description). But, the book hierarchy is flat.

druvision’s picture

Version: 5.x-1.x-dev » 6.x-1.x-dev
Priority: Normal » Critical
Status: Closed (fixed) » Active
druvision’s picture

Status: Active » Needs review
FileSize
7.94 KB

I have asked a freelancer to fix the above mentioned issues and others. Attached is a code which works in all test-cases except the last one. The last test case can easily be bypassed by doing it in two steps, with the previous test cases.

All test cases should be run on an empty drupal site, with the book navigation block on the left.

Test cases:

Test case 1:
=========
1. Add new book
2. Paste the example into the body
3. Check the split option.
4. Save the book

Test case 2:
=========
Created a new book, then add a book outline outline before saving.
Updating the book and selecting the split option, then press save.

Test case 3
=========
Create a new book node, then saved it, then edit the book node and add an outline, then press split.

Test case 4
=========
1. Create a new book node, then save it.
2. Re-edit it and select the split radio button (without creating any outline).
3. Press save.

Test case 5
=========
1. Create a new book, paste the sample html on the project description, choose the split option and press save. This creates an hierarchical book with sub-pages.
2. Go to one of the sub-pages, edit it, paste the sample html, choose the split option and press save.
3. Now, the bug: the book navigation block to the left shows the new pages as part of the overall book but when I go to the sub-pages I see that new books were created and they are not connected to the parent book. The breadcrumb displays OK.

keinstein’s picture

Status: Closed (fixed) » Needs review
FileSize
7.95 KB
2.37 KB

I updated the patch with to avoid a warning in strict php error checking mode. Since I didn't really use the module I expect more to appear.

The patch is aginst rev. 1.2 from CVS

@KarenS can you release an updated version?

verbosity’s picture

Status: Needs review » Reviewed & tested by the community

tested, works fine for me :)

KarenS’s picture

Status: Reviewed & tested by the community » Fixed

I committed this without doing any testing because it's still likely better than what is there. I botched the commit message which was intended to give credit for the patch, so sorry about that.

Please report any follow-up changes that are needed.

Status: Fixed » Closed (fixed)

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

  • Commit 01872eb on master, 6.x-1.x, 7.x-1.x by KarenS:
    #253587 Port to D6, patch by junedkazi.