OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



upload author version - notification for editor

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.

upload author version - notification for editor

Postby stephanehess » Sun Dec 07, 2008 12:42 pm

Hi,

it would be useful for the editor (or in some cases section editor) in charge of a paper to receive an e-mail when an author uploads a revised version through the "Upload Author Version" option. Same thing when people upload a "supplementary file". Which files would the relevant statements have to be added to?

THanks

Stephane
stephanehess
 
Posts: 71
Joined: Thu Feb 28, 2008 12:18 pm

Re: upload author version - notification for editor

Postby mcrider » Tue Dec 09, 2008 11:34 am

Hi Stephane,

First off, your comment in addition to similar comments by other users has prompted us to add a feature request to BugZilla to let users fine-tune what actions will cause an email notification to be sent to them: http://pkp.sfu.ca/bugzilla/show_bug.cgi?id=3922, so keep an eye on that in future releases of OJS.

For now, i'll give you some help finding the files you will have to add some code to, and I'll refer you to an older post I wrote that explains how to write up a quick function that can be called wherever an action you want notifications for: http://pkp.sfu.ca/support/forum/viewtopic.php?f=9&t=3549.

For alerts when authors upload revised versions, you'll probably want to put this function call in pages/author/TrackSubmissionHandler.inc.php, in the uploadRevisedVersion() function. For author supplementary file uploads, you'll want to add the code to the execute() function in classes/author/form/submit/AuthorSubmitSuppFileForm.inc.php.

Hope that helps,
Matt
mcrider
 
Posts: 952
Joined: Mon May 05, 2008 10:29 am
Location: Vancouver, BC

Re: upload author version - notification for editor

Postby stephanehess » Mon Dec 15, 2008 3:18 am

Hi James,

thanks.

I was hoping to just be able to add a few lines of code in the uploadRevisedVesion() function, along the lines of:
Code: Select all
Dear editor,

this is an automated announcment to inform you that a revised version of paper {$articleId} has been submitted to the journal website.


However, I'm not sure where to get the details for the editor in the charge of the paper (the template in the link you sent me was for an e-mail to the author). I've done this in open conference systems before but not sure if it's the same in open journal system.

Once I know how to do it for uploadRevisedVersion() then I can do the same for execute() in classes/author/form/submit/AuthorSubmitSuppFileForm.inc.php.

Thanks

Stephane
stephanehess
 
Posts: 71
Joined: Thu Feb 28, 2008 12:18 pm

Re: upload author version - notification for editor

Postby mcrider » Mon Dec 15, 2008 12:14 pm

Hi Stephane,

If you're using an ArticleMailTemplate (classes/mail/ArticleMailTemplate.inc.php), which I would suggest, you can use the ccAssignedEditors($articleId) function (and just remove the $mail->addrecipient() function from the example I gave). To get the $articleID parameter, you would have to use $article->getArticleID().

Cheers,
Matt
mcrider
 
Posts: 952
Joined: Mon May 05, 2008 10:29 am
Location: Vancouver, BC

Re: upload author version - notification for editor

Postby stephanehess » Tue Dec 16, 2008 3:41 am

Matt,

thanks. Sorry, being a bit useless here.

So I've got the following

Code: Select all
   /**
    * Upload the author's revised version of an article.
    */
   function uploadRevisedVersion() {
      $articleId = Request::getUserVar('articleId');
      list($journal, $submission) = TrackSubmissionHandler::validate($articleId);   
      parent::setupTemplate(true);

      AuthorAction::uploadRevisedVersion($submission);

      Request::redirect(null, null, 'submissionReview', $articleId);
   }


and somewhere, I guess at the end, I would add something along the lines of?

Code: Select all
      
                import('mail.ArticleMailTemplate');
                $article->getArticleID()
                $mail = &new ArticleMailTemplate($article, 'revised_version');
      $mail->setFrom($journal->getSetting('contactEmail'), $journal->getSetting('contactName'));
                $mail->assignParams(array('username' => $this->getData('username'), 'password' => $password, 'userFullName' => $user->getFullName()));
                ccAssignedEditors($articleId);
                $mail->send();


I've added the $article->getArticleID() as you suggested, but wouldn't $articleId = Request::getUserVar('articleId'); in uploadRevisedVersion() already have dealt with this?

It would also be useful to know where to get the author name and paper title from.

Thanks again!

Stephane
stephanehess
 
Posts: 71
Joined: Thu Feb 28, 2008 12:18 pm

Re: upload author version - notification for editor

Postby mcrider » Tue Dec 16, 2008 11:37 am

Hi Stephane,

Yes, you can use the $articleId variable from $articleId = Request::getUserVar('articleId'); instead.. But also make sure you actually have an $article object instantiated. You'll probably have to add this near the top of the function:
Code: Select all
$articleDao = &DAORegistry::getDAO('ArticleDAO');
$article = &$articleDao->getArticleById($articleId);

Also, ccAssignedEditors is a function of the ArticleMail class, so make sure you call it like
Code: Select all
 $mail->ccAssignedEditors($articleId);


Cheers,
Matt
mcrider
 
Posts: 952
Joined: Mon May 05, 2008 10:29 am
Location: Vancouver, BC

Re: upload author version - notification for editor

Postby stephanehess » Thu Dec 18, 2008 2:55 am

Hi Matt,

thanks again. Getting closer, but I still can't get it to work.

After some more tweaks, the following now doesn't give me a white screen, but nor does it result in the editor getting sent an e-mail when a new author version is uploaded. Any idea what's missing? This has all been added to the end of uploadRevisedVersion()

Code: Select all
      $articleDao = &DAORegistry::getDAO('ArticleDAO');
      $article = &$articleDao->getArticleById($articleId);
      import('mail.ArticleMailTemplate');
      $mail = &new ArticleMailTemplate($article, 'revised_version');
      $mail->setFrom($journal->getSetting('contactEmail'), $journal->getSetting('contactName'));
      $mail->ccAssignedEditors($articleId);
        $mail->send();


Thanks!

Stephane
stephanehess
 
Posts: 71
Joined: Thu Feb 28, 2008 12:18 pm

Re: upload author version - notification for editor

Postby mcrider » Thu Dec 18, 2008 11:32 am

Hi Stephane,

Make sure the email template you are using exists--also, they are typically in all capital letters. You might also want to try putting the code above the 'redirect' code at the bottom of the function... I'm not sure how the redirect will affect the execution of the rest of the function. Finally, the blank page you got is because you aren't displaying PHP errors to the screen--check your log, or set errors to be printed to the screen to see them (check out viewtopic.php?f=8&t=2481#t1 for more information on doing this).

One more thing to try if that doesn't work is to try using the $mail->addRecipient() function, as I'm not 100% sure the email will get sent without a main recipient (and just CC's). In that case, you might be able to use a fake email address (or your own).

Let us know how it goes!

Cheers,
Matt
mcrider
 
Posts: 952
Joined: Mon May 05, 2008 10:29 am
Location: Vancouver, BC

Re: upload author version - notification for editor

Postby stephanehess » Fri Dec 19, 2008 2:05 am

M att,

we're very close now...

Moving it all above Request::redirect(null, null, 'submissionReview', $articleId); certainly made sense. However, I now get the following error:

Fatal error: Call to undefined function: getarticlebyid() in /home/sites/jocm.org.uk/public_html/pages/author/TrackSubmissionHandler.inc.php on line 318

My code is:

Code: Select all
      $articleDao = &DAORegistry::getDAO('ArticleDAO');
      $article = &$articleDao->getArticleById($articleId);
      import('mail.ArticleMailTemplate');
      $mail = &new ArticleMailTemplate($article, 'revised_version');
      $mail->setFrom($journal->getSetting('contactEmail'), $journal->getSetting('contactName'));
      $mail->ccAssignedEditors($articleId);
        $mail->send();


If I remove the first two lines, it obviously doesn't know what article I'm talking about, and complains about that too, but it does send the e-mail. So the first two lines is all that needs fixing still. Any thoughts what's wrong now?

Cheers

Stephane
stephanehess
 
Posts: 71
Joined: Thu Feb 28, 2008 12:18 pm

Re: upload author version - notification for editor

Postby mcrider » Fri Dec 19, 2008 11:46 am

Hi Stephane,

Hmm.. The way you're calling the ArticleDAO and getting the article object is correct, so my guess is that you don't actually have the right $articleID. Try printing the article ID to the screen (comment out the mail sending code and just put in 'echo $articleId;'), or seeing if the $articleDao or $article objects are null.. If it isn't a valid article id, then you would have to find some other way to get the article object.

Cheers,
Matt
mcrider
 
Posts: 952
Joined: Mon May 05, 2008 10:29 am
Location: Vancouver, BC

Re: upload author version - notification for editor

Postby stephanehess » Mon Dec 22, 2008 2:24 pm

Matt,

thanks. I tried the echo approach, but this doesn't help. I still get the message

Fatal error: Call to undefined function: getarticlebyid() in /home/sites/jocm.org.uk/public_html/pages/author/TrackSubmissionHandler.inc.php on line 318

So it fails before it even gets to echo.

It's fine with: $articleDao = &DAORegistry::getDAO('ArticleDAO');

But fails on: $article = &$articleDao->getArticleById($articleId);

The problem is that it doesn't know the function getarticlebyid(). Is there a spelling mistake in the name?

Thanks

Stephane
stephanehess
 
Posts: 71
Joined: Thu Feb 28, 2008 12:18 pm

Re: upload author version - notification for editor

Postby mcrider » Wed Dec 24, 2008 1:20 pm

Hi Stephane,

Try just using getArticle($articleId). You're right that there is no getarticlebyid function, so it looks like the original code is wrong... I'll post a bug report for this.

Cheers,
Matt
mcrider
 
Posts: 952
Joined: Mon May 05, 2008 10:29 am
Location: Vancouver, BC

Re: upload author version - notification for editor

Postby stephanehess » Mon Jan 05, 2009 2:22 am

Matt,

thanks.

I now use the following:

Code: Select all
      $articleDao = &DAORegistry::getDAO('ArticleDAO');
      $tempid = &$articleDao->getArticle($articleId);
      import('mail.ArticleMailTemplate');
      $mail = &new ArticleMailTemplate($tempid, 'revised_version');
      $mail->setFrom($journal->getSetting('contactEmail'), $journal->getSetting('contactName'));
      $mail->ccAssignedEditors($articleId);
        $mail->send();


This no longer produces an error, but in my e-mail template:

Dear editor,

this is an automated announcment to inform you that a revised version of paper {$tempid} has been submitted to the journal website.


the {$tempid} gets displayed as such, and does not get replaced by the actual id.

Any suggestions?

Thanks again

Stephane
stephanehess
 
Posts: 71
Joined: Thu Feb 28, 2008 12:18 pm

Re: upload author version - notification for editor

Postby mcrider » Mon Jan 05, 2009 11:56 am

Hi Stephane,

You'll have to assign the parameter from the code to the template, e.g. by adding this line before $mail->send():
Code: Select all
$mail->assignParams(array(
   'tempid' => $tempid->getArticleId()
));


Cheers,
Matt
mcrider
 
Posts: 952
Joined: Mon May 05, 2008 10:29 am
Location: Vancouver, BC

Re: upload author version - notification for editor

Postby stephanehess » Tue Jan 06, 2009 1:56 am

Matt,

thanks. This works now!

I also tried to add the same code to the bottom of the execute() function in classes/author/form/submit/AuthorSubmitSuppFileForm.inc.php as you suggested (for supplementary file uploads), but this doesn't seem to be doing anything (and no error message either). I put it just before return $this->suppFileId;. Is that not the right place.

Thanks again for all your help with this

Stephane
stephanehess
 
Posts: 71
Joined: Thu Feb 28, 2008 12:18 pm

Next

Return to OJS Technical Support

Who is online

Users browsing this forum: Yahoo [Bot] and 3 guests