OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Corresponding group names

Are you responsible for making OJS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
What to do if you have a technical problem with OJS:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a development question, try the OJS Development subforum.

Corresponding group names

Postby kreissaege » Thu Oct 18, 2012 6:09 am

Hello all,
under "About" we are using seperate EditorialBoard and EditorialTeam groups. Displaying member information from each group we would like to have the correct group title is shown on the head (see graphic).
The changes I made in templates/editorialTeamBoard.tpl (add the $group->getLocalizedTitle() variable as an header did not result in correct display. I think I need to declare the use of the group in this script.
Can somebody tell me how to do this?
many thanks
Katrin
Attachments
img.png
img.png (35.17 KiB) Viewed 917 times
kreissaege
 
Posts: 24
Joined: Thu Nov 05, 2009 4:14 am

Re: Corresponding group names

Postby springday » Sat Oct 20, 2012 1:46 pm

Hi Katrin,

this is actually a wonderful idea, so I tried to work out how it could be done. Here's one way - maybe not the best, but at least it works:

In "editorialTeamBoard.tpl" I've added two lines after line 26 and added a url parameter to the javascript call that opens the new window:

Code: Select all
{assign var=userId value=$user->getId()}
{php}$this->assign('pathArray', array($this->get_template_vars('userId'), $this->get_template_vars('groupId')));{/php}
<div id="member"><li><a href="javascript:openRTWindow('{url op="editorialTeamBio" path=$pathArray}')">{$user->getFullName()|escape}</a>{if $user->getLocalizedAffiliation()}, {$user->getLocalizedAffiliation()|escape}{/if}{if $user->getCountry()}{assign var=countryCode value=$user->getCountry()}{assign var=country value=$countries.$countryCode}, {$country|escape}{/if}</li></div>


With this modification, the url that's calling the editorialTeamBio will not only contain the user ID, but also the group ID.
The next step is to let the AboutHandler handle this additional parameter, the group ID. Therefore I added the following lines to the function editorialTeamBio($args) in /pages/about/AboutHandler.inc.php:

Code: Select all
$groupId = isset($args[1])?(int)$args[1]:0;

(That's inserted after the "$userId = isset($args[0])?(int)$args[0]:0;" in line 241)

Then, farther down in the code, right before the "$templateMgr->assign_by_ref('user', $user);", I added these lines:

Code: Select all
if($groupId) {
   $groupDao =& DAORegistry::getDAO('GroupDAO');
   $group =& $groupDao->getById($groupId);
}
$templateMgr->assign_by_ref('group', $group);


Now the editorialTeamBio will know about the group, and the only thing left to be done is to let it retrieve and display the group name:
To achieve this I modified line 54 into

Code: Select all
{if $group}<h1>{$group->getLocalizedTitle()}</h1>{else}<h1>{translate key="about.editorialTeam"}</h1>{/if}


So, if for some reason the group variable is not defined, it will still behave as before and display the generic editorial team title. However, if everything went well and the group variable has been successfully assigned, the title of this group will be displayed in the pop-up window.
The nice thing about this is that it even works well if you have one person being a member of two different groups. We have such a case on our OJS site:

http://www.reinhardt-journals.de/index.php/peu/about/editorialTeam

As you'll see there, Mr. Köller is in the two groups "verantwortlicher Redakteur" and "Herausgeber". Depending on which link you choose, those group names will appear differently in the editorialTeamBio window.

Hope this approach works for you as well.

Best wishes,
Kai Weber
springday
 
Posts: 111
Joined: Wed Jul 25, 2012 2:56 pm
Location: Munich, Germany

Re: Corresponding group names

Postby kreissaege » Mon Oct 22, 2012 11:42 pm

Hi Kai,
thanks a lot for your answer. Unfortunally it don't work for me. I have changed the code as you prefered (and i see it works for your OJS), but I get a blank Bio page for the user.
And also we are using for Mastheads the option "Title appear as its own category under People" and the listing in the own group ist done by "displayMembership".
I will test with your snippets later and see, what I can reach and will post my results ...
Many thanks
Katrin
kreissaege
 
Posts: 24
Joined: Thu Nov 05, 2009 4:14 am

Re: Corresponding group names

Postby springday » Tue Oct 23, 2012 4:08 am

Hi Katrin,

I see, we have different settings for the mastheads and therefore my code is never processed in your installation. My setting is "Have title appear under Editorial Team in People section of About the Journal (e.g. Editor)". I'll see if I have a chance to suggest a generalization of my code to make it work for other masthead settings as well. In the meantime, maybe you'll figure out a solution, too?

Best regards,
Kai
springday
 
Posts: 111
Joined: Wed Jul 25, 2012 2:56 pm
Location: Munich, Germany

Re: Corresponding group names

Postby springday » Tue Oct 23, 2012 10:53 am

Katrin,

with your masthead setting, the template responsible for displaying the people overview should be "displayMemberships.tpl", in the same folder as "editorialTeamBoard.tpl". The same mechanism as desribed above should work for this template, too. After the line 20:

Code: Select all
{assign var=user value=$member->getUser()}"


you can insert

Code: Select all
{assign var=userId value=$user->getId()}
{php}$this->assign('pathArray', array($this->get_template_vars('userId'), $this->get_template_vars('groupId')));{/php}


And in the following line replace the javascript-function-call with

Code: Select all
javascript:openRTWindow('{url op="editorialTeamBio" path=$pathArray}')


I'm sorry I can't try this by myself at the moment, because the MySQL server of my local test installation of OJS broke down just recently and I don't want to play around too much with our live system. If it doesn't work though, report here and I'll try to check further.

Best wishes,
Kai
springday
 
Posts: 111
Joined: Wed Jul 25, 2012 2:56 pm
Location: Munich, Germany

Re: Corresponding group names

Postby kreissaege » Wed Oct 24, 2012 12:28 am

Hi Kai,

I got it to work for both sections under About.
I need to change the code in the AboutHandler.inc.php from:
Code: Select all
$group =& $groupDao->getById($groupId);

to:
Code: Select all
$group =& $groupDao->getGroup($groupId);


Thanks again for your fast help
Katrin
kreissaege
 
Posts: 24
Joined: Thu Nov 05, 2009 4:14 am

Re: Corresponding group names

Postby springday » Wed Oct 24, 2012 1:53 am

Hi Katrin,

great to see it works for you as well. We should have exchanged OJS version information - I'm at 2.4.1 and you're probably somewhere in the 2.3.x line. The "getGroup()"-function is still there in 2.4.1, but marked as deprecated. So, if you upgrade to 2.4.1 your modification will keep working, but if you keep upgrading sometime in the future you might have to switch to "$group =& $groupDao->getById($groupId);"

Best wishes,
Kai
springday
 
Posts: 111
Joined: Wed Jul 25, 2012 2:56 pm
Location: Munich, Germany


Return to OJS Technical Support

Who is online

Users browsing this forum: No registered users and 4 guests