Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show author name under Table of Contents #5151

Open
neffe opened this issue Oct 14, 2019 · 4 comments
Open

Show author name under Table of Contents #5151

neffe opened this issue Oct 14, 2019 · 4 comments
Labels
Enhancement:1:Minor A new feature or improvement that can be implemented in less than 3 days. Hosting Bug reports and feature requests from Publishing Services's hosted clients.

Comments

@neffe
Copy link
Contributor

neffe commented Oct 14, 2019

Under Issues > Back Issues > Table of contents you see the titles of the articles. Some of our journals handle articles by author name, so a visible second line under each title with the author names would be very helpful.

image

@openacademia
Copy link

Yes! I have missed the author names many times, too. If there is a large issue/volume with many articles with similar titles, it can be hard distinguishing between them.

@Michevole
Copy link

Hi @neffe, hi @openacademia!

Many editors asked me to get a better view of the back/future issues, so I tried something. I'm not a coding expert, so I offer my solution to the community but I appreciate if someone could confirm my changes. I'm using OJS 3.3.0-6.

The table of content (TOC) read the data in columns, so I didn't add a second line for authors as you suggested, but I added a new column. This is the final result.

1

To this, I edited just two files. The first one is /controllers/grid/toc/TocGridHandler.inc.php. You need to find these lines that managed the unique standard column (about titles)...

    // Article title
    $this->addColumn(
        new GridColumn(
            'title',
            'article.title',
            null,
            null,
            $tocGridCellProvider
        )
    );

...and replace them with the following ones. They add a new column with authors; furthermore, they resize both column with an horizontal ratio of 25/75%.

  // Article author
  $this->addColumn(
  	new GridColumn(
  		'author',
  		'article.author',
  		null,
  		null,
  		$tocGridCellProvider,
  		['width' => 24 /*percent*/, 'maxLength' => 25 /*digits*/]
  	)
  );
  
  // Article title
  $this->addColumn(
  	new GridColumn(
  		'title',
  		'article.title',
  		null,
  		null,
  		$tocGridCellProvider,
  		['width' => 74 /*percent*/]
  	)
  );

At this moment, you have two columns but the system doesn't know where it can find the author's name. So you take the second file /controllers/grid/toc/TocGridCellProvider.inc.php, now. Search for the following lines.

    switch ($columnId) {
        case 'title':
            return ['label' => $element->getLocalizedTitle()];

And replace them with these ones, in which I added the case 'author' to point at the authors' names.

  switch ($columnId) {
  	case 'author':
  		return array('label' => $element->getShortAuthorString());
  	case 'title':
  		return array('label' => $element->getLocalizedTitle());

If everything works, now you have a nice double-columned Table of contents, with authors and titles. Unfortunately, the sections titles appear in the first short column and so they are truncated. However I preferred to not edit more files to change them.

Please, let me know if it works. I'd love it if it could become a feature of the new releases, so I don't have to change the code with every update!

@openacademia
Copy link

@Michevole Wow, this looks great! I am not able to test it myself, but would love for this solution to become part of future releases. Excellent!

@pmangahis
Copy link

+1 from PS Hosted Journal

@pmangahis pmangahis added Enhancement:1:Minor A new feature or improvement that can be implemented in less than 3 days. Hosting Bug reports and feature requests from Publishing Services's hosted clients. labels Feb 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement:1:Minor A new feature or improvement that can be implemented in less than 3 days. Hosting Bug reports and feature requests from Publishing Services's hosted clients.
Projects
None yet
Development

No branches or pull requests

4 participants