The Upgrade Status module indicates no D7 upgrade path for this module ("No available releases found").

Will this module be upgraded to D7?

Comments

Vc Developer’s picture

Subscribe

AlexisWilke’s picture

I do not intend to do the upgrade. But if someone wants to do it, I'll gladly give him/her access. 8-)

Thank you.
Alexis

aren cambre’s picture

Are there alternatives to this module?

AlexisWilke’s picture

Not that I know of. Although there are modules to support wiki's and it could be that one of them includes a table of contents.

binford2k’s picture

subscribe

bigdave’s picture

subscribe

mhaudenschild’s picture

subscribe

AlexisWilke’s picture

Title: Drupal 7 port » Drupal 7 port, searching for a co-maintainer
WorldFallz’s picture

way back i worked on the code for v2 of this module-- i'm happy to comaintain it. However, i can't make any firm commitment on the d7 version-- i've only just begun converting my modules.

AlexisWilke’s picture

WorldFallz,

The code has changed quite a bit since then... 8-)

If you think you can create a version and post a tarball here, then we can have others test that first. Then if it works well, have you become a co-maintainer and check the code in.

Thank you.
Alexis

WorldFallz’s picture

sounds good-- I should have time to give it shot this weekend.

thomasvdv’s picture

subscribe

mo6’s picture

Subscribe. I can help porting this module to D7.

AlexisWilke’s picture

George,

You may want to contact WorldFallZ directly to see whether he's done some work on this so far.

Once one of you has a version that runs on D7, post a tarball or zip file here so others can test.

Thank you.
Alexis

stclaird’s picture

subscribe

xenyo’s picture

Subscribe +

dooug’s picture

Subscribe. Thanks for the good work!

SanDiego’s picture

subscribe

d.olaresko’s picture

StatusFileSize
new103.6 KB

I ported TOC module to drupal7. please check it. (patch for release version)

d.olaresko’s picture

StatusFileSize
new29.46 KB

Corrected patch attached. Works for branch 6.x-3.x.
git clone --branch 6.x-3.x http://git.drupal.org/project/tableofcontents.git

shadowmihai’s picture

subscribe

d.olaresko’s picture

StatusFileSize
new31.34 KB

New patch. Fixes

Recoverable fatal error: Object of class stdClass could not be converted to string in _tableofcontents_prepare()
mrsinguyen’s picture

subscribe

dwhutton’s picture

subscribe

bensnyder’s picture

subscribe

silurius’s picture

Subscribe

webankit’s picture

I tried to apply it to git head version but failed both20&22...

AlexisWilke’s picture

Did you do the following as stated in #20?
git clone --branch 6.x-3.x http://git.drupal.org/project/tableofcontents.git

webankit’s picture

i tried doing patch -po< patch_filename earlier
but was succesful when i did git apply

webankit’s picture

Recoverable fatal error: Object of class stdClass could not be converted to string in tableofcontents_filter_tips() (line 59 of /home2/unitinga/public_html/spicmacay/demo/sites/all/modules/tableofcontents/tableofcontents.module).

webankit’s picture

@dolar4ik: plz look into #30

d.olaresko’s picture

@ babbar.ankit: I`m not a maintainer. When I have a free time I will look on it but you need to ask maintainer to fix this problem I think

JohnnyX’s picture

A Drupal 7 release would be great!

Subscribe

tobias’s picture

+1

webankit’s picture

StatusFileSize
new31.73 KB

Resolved #30 ...
plz test

DnaX’s picture

On node display (with [toc]):
Notice: Trying to get property of non-object in _tableofcontents_replace_toc() (linea 667 di /home/web/santmart/public_html/sites/all/modules/tableofcontents/tableofcontents.pages.inc).

No TOC displayed.

marcoka’s picture

subscribe

marcoka’s picture

i chose to autogenerate the TOC, i get:
* Notice: Use of undefined constant filter_toc - assumed 'filter_toc' in tableofcontents_filter_FILTER_tips() (line 58 of /var/www/WORKSPACE_DRUPAL/drupalwiki7/sites/all/modules/tableofcontents/tableofcontents.module).
* Notice: Use of undefined constant filter_toc - assumed 'filter_toc' in tableofcontents_filter_FILTER_tips() (line 58 of /var/www/WORKSPACE_DRUPAL/drupalwiki7/sites/all/modules/tableofcontents/tableofcontents.module).

also i could not fully apply the patch with "patch -p1 < patch.patch" it got some problems with both info files and on 295 in the tableofcontents.module. corrected that manually.

no toc is beeing displayed

if i try to use the block:

Notice: Trying to get property of non-object in _tableofcontents_replace_toc() (line 668 of /var/www/WORKSPACE_DRUPAL/drupalwiki7/sites/all/modules/tableofcontents/tableofcontents.pages.inc).

chapatt’s picture

I got basically the same result as #38. I can't wait for a working version. I'm trying to migrate to D7 and use this for wikis. Thanks!

dwalker51’s picture

+1

Jean Gionet’s picture

+1 subscribe

is it still possible to apply any of these patches to make it work with D7? If so, what are the exact steps/order to do so?
I've tried every possible combination and haven't been able to apply any of these patches.

thanks

AlexisWilke’s picture

#35 should be after the latest changes as viewable here:

http://drupalcode.org/project/tableofcontents.git/commit/b9b8d9b

Jean Gionet’s picture

no luck :(

ran this first:
git clone --branch 6.x-3.x http://git.drupal.org/project/tableofcontents.git

then:

git apply -v Drupal7Port-902564-35.patch
Checking patch tableofcontents.admin.inc...
Checking patch tableofcontents.info...
Checking patch tableofcontents.install...
Checking patch tableofcontents.js...
Checking patch tableofcontents.module...
error: while searching for:
function tableofcontents_theme() {
  return array(
    'tableofcontents_toc' => array(
      'arguments' => array(
        'toc' => NULL,
      ),
      'file' => 'tableofcontents.pages.inc',
    ),
    'tableofcontents_back_to_top' => array(
      'arguments' => array(
        'toc' => NULL,
      ),
      'file' => 'tableofcontents.pages.inc',
    ),
    'tableofcontents_number' => array(
      'arguments' => array(
        'toc' => NULL,
      ),
      'file' => 'tableofcontents.pages.inc',

error: patch failed: tableofcontents.module:280
error: tableofcontents.module: patch does not apply
Checking patch tableofcontents.pages.inc...
Checking patch tableofcontents_block/tableofcontents_block.info...
Checking patch tableofcontents_block/tableofcontents_block.module...
mdm’s picture

StatusFileSize
new31.28 KB

I've rolled up the previous patches and applied them to the most recent code from the 6.x-3.x branch. I've also made a few tweaks to fix the above "Trying to get property of non-object" error, and I've refactored the _tableofcontents_replace_toc function because function parameters with default values should always go at the end of the parameter list. Otherwise, you have to specify the value every time you call it anyways and it defeats the purpose of having a default.

***PLEASE NOTE THIS PATCH STILL DOES NOT MAKE TABLE OF CONTENTS WORK ON DRUPAL 7.***

But the problem I'm running into now is that I don't understand the way part of the module works. In my case, I'm getting to line 765 of tableofcontents.pages.inc ok, then _tableofcontents_headers is called. In that function we have this on line 276 (all line numbers are post-included-patch):

$toc->headers = array();

No value ever gets put in this array, and when we return to _tableofcontents_replace_toc we get to line 780 which says:

// Any headers? if not do nothing...
  $max = count($_tableofcontents_toc->headers);
  if ($max == 0) {
    // not even 1 header!!!
    if ($_tableofcontents_block_toc) {
      return '';
    }

So since we never did anything with that $toc->headers array, it's empty here, count() returns 0, and _tableofcontents_replace_toc returns a blank string. What is that array supposed to have in it and why are we checking it?

AlexisWilke’s picture

The $toc->header is the list of HTML headers found in your page (H1, H2, ... H6). If none are found, we just cannot generate a table of contents.

There are many reasons why this would happen. Verify that the $text is indeed the content of your page and that there are some headers and that the headers present in your text are accepted (i.e. you may only access H3 and H4 and not have any of those in your text.)

Thank you.
Alexis

mdm’s picture

StatusFileSize
new31.85 KB

Thanks Alexis.

Following your explanation, I set my text filter to Full HTML and started getting error messages: one about a non-existent array index "render element" in theme.inc line 824, and one about array to string conversion in tableofcontents.pages.inc line 839. To solve the first problem, I wrapped $output in an array when passing it to theme() on line 1028 of toc.pages.inc:

return theme('tableofcontents_toc_text', array($output));

theme() expects $variables to be an array, and we were passing a string to it, which made from problems later on. To solve the second problem, I changed theme_tableofcontents_toc_text in toc.pages.inc to:

function theme_tableofcontents_toc_text($variables) {
  return $variables[0];
}

Since we're passing in $variables from theme(), this returns an array and was the cause of the illegal array to string conversion. After doing this, I've got a working TOC on my Drupal 7.2 site. I've attached a patch against the latest 6.x-3.x branch, hope it works for everyone else too!

marcoka’s picture

applied patch

patch -p1 < tableofcontents-d7-upgrade-902564-45.patch

Result

Recoverable fatal error: Object of class stdClass could not be converted to string in _tableofcontents_replace_toc() (line 682 of /var/www/WORKSPACE_DRUPAL/drupalwiki7/sites/all/modules/tableofcontents/tableofcontents.pages.inc).

i foxed that somehow....you do

if (variable_get('tableofcontents_hide_table_' . $format, FALSE)) {

and $format is an object.

after fixing that it does not really work. enabled in the text format, chose create auto TOC on top...nothing

webankit’s picture

On saving content if body is empty
Notice: Undefined property: stdClass::$body in tableofcontents_node_presave() (line 176 of sites/all/modules/tableofcontents/tableofcontents.module).
Notice: Undefined property: stdClass::$body in _tableofcontents_hide_in_teaser() (line 409 of sites/all/modules/tableofcontents/tableofcontents.admin.inc).

AlexisWilke’s picture

I just did an update of the 6.x version to support the target attributes in links.

It would be easier for the people offering a potential D7 version to offer a .tar.gz or .zip instead of patches...

Thank you.
Alexis Wilke

Jean Gionet’s picture

yes please! Can somebody ZIP/TAR.GZ a completely patched/working D7 version! thxs

mdm’s picture

StatusFileSize
new33.48 KB

This tarball is the 6.x-3.x codebase with patches #22, #35, #44, and #46 applied. The problem mentioned in #47 should be fixed here too. I've also changed the function signature of _tableofcontents_process to:

function _tableofcontents_process($text, $format, $filter = 0) {

and removed the default $filter value from the function signature of _tableofcontents_replace_toc. All calls to _tableofcontents_process should reflect these changes. The reason I've done this is explained in #44. This module works for me on 7.2, it might not work for you. I propose that a 7.x branch should be created in the git repository so we can import what we've got so far and continue work on it there. Then an actual 7.x dev snapshot can be put up on the project's main page so it's more readily apparent that work is being done on a 7.x version. Just my $0.02.

marcoka’s picture

i downloaded the module, replaced the old one.

still: Recoverable fatal error: Object of class stdClass could not be converted to string in _tableofcontents_replace_toc() (line 682 of /var/www/WORKSPACE_DRUPAL/drupalwiki7/sites/all/modules/tableofcontents/tableofcontents.pages.inc).

anyone tested it on a complete clean install and can report? i will try that one on a completely clean install this weekend.

Jean Gionet’s picture

Thxs for the file and patches!

I just installed it on my 7.2 install and didn't get any errors. I enabled the module and adjusted my Text formats to apply this filter, however it doesn't seem to be working/loading. Also, I don't see any option to ADD a ToC to a page/node manually.

AlexisWilke’s picture

mdm,

Would you like to become the D7 maintainer?

So far, I've seen many people saying it wasn't working for them so I don't see the point in creating a D7 version. I'll do it only if enough people say it works for them because I do not plan in maintaining D7 myself.

Thank you.
Alexis

fpahl’s picture

subscribe

marcoka’s picture

tested on a clean drupal 7.2, no errors but no display too:
tag depth has ben set to 2
tags do not work

http://screensnapr.com/v/3uFLhb.png

without tags and auto add

http://screensnapr.com/v/JZAN2D.png

marcoka’s picture

returned again after some debugging.

@mdm, i bet you use the BLOCK, because the block works. But the normal TOC also gibes the ability to add a TOC on the bottom/top of a node automatically, WITHOUT a block.

I think your port is not complete and only for the block, could that be?

http://screensnapr.com/v/REZ0KY.png

mdm’s picture

@AlexisWilke sure, I'd love to maintain a D7 version of TOC :)

@e-anima I haven't specifically set TOC to use a block, but it's calling TOC's block functions and creating one at the top of my nodes. In fact, when I configure my Full HTML text filter at /admin/config/content/formats/full_html, the Table of Contents checkbox isn't checked...however my TOCs are being generated using that filter...so that seems odd to me...

marcoka’s picture

@mdn, you did not check the "TOC" checkbox in the filter settings?

mdm’s picture

@e-anima correct, however the TOCs are still working on nodes that contain [toc] tags, so something's not right. Here's my testing set-up:

Relevant portion of /admin/config/content/formats/full_html: http://i.imgur.com/wSssv.png

TOC block from a node page: http://i.imgur.com/0XUQp.png

Here's the TOC tag from that node:

[toc list: ol; minlevel: 2; maxlevel: 2;]

Unless I'm completely misunderstanding the filter configuration (a distinct possibility!), I shouldn't have any TOCs appearing while that checkbox is unchecked, but there it is.

AlexisWilke’s picture

mdm,

There are 3 possibilities for the table of contents to appear:

(1) The block as mentioned

(2) The filter as shown in one of your images (although in your case it isn't set.)

(3) The node type (Administer » Content management » Content type)

I guess you have (3) active because otherwise the [toc] would not be transformed.

Option (3) is good if you want to make sure you don't get the [toc] transformed in teasers (i.e. (3) has the possibility to detect whether the node is shown as a page or as a teaser.)

From what I understand, also, (1) still has problems and can generate double numbering. I'd like to fix that at some point...

Thank you.
Alexis Wilke

AlexisWilke’s picture

mdm,

You should have access to git and the necessary options in the project to add a new release.

The default instructions are really good, go to the project page and see under "Git instructions". You will have to create the D7 branch first. Let me know if you need some help with getting started.

Thank you.
Alexis Wilke

P.S. one more thing... as a maintainer, you should add the "Contact" feature in your user account so people can contact you directly if needed (i.e. security issues, etc.)

mdm’s picture

@AlexisWilke Thanks. I've created a 7.x-1.x branch in git and committed the code from the tarball I posted here. I tried posting a dev snapshot release, but I couldn't figure out how to attach the tar.gz/zip files.

I'm still working on getting the TOC to work through text filters and content types, if anyone else has any patches against 7.x-1.x, they're very welcome! :)

AlexisWilke’s picture

mdm,

At the bottom of the project page, you have an Administer Releases. When you click on that link, a page appears with 7.x-1.x-dev at the top and you have two checkboxes. The "Show snapshot release" flag is the one that will display the 7.x-1.x-dev version on the front page (it is already visible in the releases page, but that's quite hidden...)

Thank you.
Alexis

marcoka’s picture

Version: 6.x-3.x-dev » 7.x-1.x-dev
Category: support » bug

the toc block is not working correctly too,

http://screensnapr.com/v/Lu5KAc.png

see screenshot, the first h1 tag is not in the toc, the second is.
"Install" is missing

AlexisWilke’s picture

Status: Active » Fixed

e-anima,

By default the toc starts with H2 and goes up to H4.

You can change the defaults in the settings.

Thank you.
Alexis

marcoka’s picture

activated numbering in the TOC block:

http://screensnapr.com/v/8BbyOv.png

its seems that the output is not a field its the whole array itself. "array"

AlexisWilke’s picture

e-anima,

Yeah... that looks like a bug in the block display code.

Would you mind to open a new issue for that problem as this issue was about getting an actual version 7.x out the door.

Thank you.
Alexis Wilke

Status: Fixed » Closed (fixed)

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

AlexisWilke’s picture

mdm,

There are issues being posted in regard to 7.x not working right. As the maintainer of that version, you need to take care of them.

It is possible for me to add you to a list of people emailed whenever a new issue is posted. If you see it's for 7.x, then you can take care of it. For this purpose, I'd need an email address. You can use my user contact form to give me the email address you'd like me to use.

TOC v7.x issues

Thank you.
Alexis Wilke

larowlan’s picture

Alexis, @mdm, I'm interested in putting some time into the 7.x branch - please contact me using my contact form or on irc @larowlan

AlexisWilke’s picture

Hi larowlan, mdm is the one in charge of D7.