OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Adding a comment field

OJS development discussion, enhancement requests, third-party patches and plug-ins.

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

Forum rules
Developer Resources:

Documentation: The OJS Technical Reference and the OJS API Reference are both available from the OJS Documentation page.

Git: You can access our public Git Repository here. Comprehensive Git usage instructions are available on the wiki.

Bugzilla: You can access our Bugzilla report tracker here.

Search: You can use our Google Custom Search to search across our main website, the support forum, and Bugzilla.

Questions and discussion are welcome, but if you have a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a technical support question, try the OJS Technical Support subforum.

Adding a comment field

Postby bar338 » Sat Jun 20, 2009 12:44 pm

Are there any plugins for adding additional comment fields?

I need to be able to add another textbox for authors to enter comments to be read by the editor. The comment box would go along with a revised submission. The comments would describe the changes that were made.

If not, this is a pretty tough change isn't it? I'm going to need to add the text box for input for the author, create a table to save the information, find a way to save the info to the table, and then retrieve the table and display it somewhere in the editors menu.
bar338
 
Posts: 90
Joined: Tue Jun 09, 2009 11:54 am

Re: Adding a comment field

Postby jmacgreg » Tue Jun 23, 2009 10:56 am

Hi bar338,

There aren't any plugins to add the functionality you want; and yes, it'll be a fairly large-scale change, touching on just about everything you've identified there. Your best course of action would be to follow exactly how any other comments box works, and follow that. Note that it's not as simple as creating the new template information -- any information you enter has to pass through the guts of OJS to be added to the database. It's that internal step that's the hardest (and that I admittedly don't know how to do myself). Take a look at another example, and let us know if you run into problems.

Cheers,
James
jmacgreg
 
Posts: 4190
Joined: Tue Feb 14, 2006 10:50 am

Re: Adding a comment field

Postby bar338 » Fri Jul 03, 2009 7:19 am

What about doing something along these lines:

I see that the editor has a comment function. When the editor clicks on the author/editor email records button he as the ability to input a comment. Do you think it would be easier to try to translate that same comment form to the author and put it in the editorDecision section so that the author can submit comments at the same time they upload their file. The only problem i'm seeing is being able to accomplish this with a single submit button.
bar338
 
Posts: 90
Joined: Tue Jun 09, 2009 11:54 am

Re: Adding a comment field

Postby bar338 » Fri Jul 03, 2009 10:15 am

Where is the function that handles processing the comment form?

templates/submission/comment/editorDecisionComment.tpl
Code: Select all
<form method="post" action="{url op=$commentAction}">


This is the header for the form that the editor uses to leave a comment. But i can't find a function anywhere called commentAction
bar338
 
Posts: 90
Joined: Tue Jun 09, 2009 11:54 am

Re: Adding a comment field

Postby bar338 » Mon Jul 06, 2009 1:44 pm

I think i may have found a easier way to do this but i really could use some help. I've made the following changes (surrounded by stars). I know that this doesn't work as it is but is it possible to make just a couple small changes to get it to work like this? I've tried doing a new comment system but i'm pretty sure i'm not capable of doing that major of a change. The goal of this is to be able to have the author submit a comment to the editor/author comment record directly from the submit form where the author uploads the revision.

In templates/author/submission/editorDecision.tpl
Code: Select all
<form method="post" action="{url op="uploadRevisedVersion"}" enctype="multipart/form-data">
    <input type="hidden" name="articleId" value="{$submission->getArticleId()}" />

*************************************************************************************************
{if $smarty.capture.editorArticleDecision|trim ==  "Minor Revision Required"}
        <tr valign="top">
                <td class="label" width="20%">
                        Comments
                </td>
                <td>
                        <textarea id="comments" name="comments" rows="4" cols="60" class="textArea">{$comments|escape}</textarea>
                </td>
        </tr>
    {/if}
*************************************************************************************************
    <tr valign="top">
        <td class="label" width="20%">
            {if $smarty.capture.editorArticleDecision|trim ==  "Minor Revision Required"}
                Upload Revision
            {else}
                {translate key="author.article.uploadAuthorVersion"}
            {/if}
        </td>
        <td class="value" width="70%">
            <input type="file" name="upload" class="uploadField" /><br /><br />
            <input type="submit" name="submit" value="Submit" class="button" />

        </td>
    </tr>
</form>



In pages/authors/TrackSubmissionHandler.inc.php
Code: Select all
function uploadRevisedVersion() {
                $articleId = Request::getUserVar('articleId');
                list($journal, $submission) = TrackSubmissionHandler::validate($articleId);
                parent::setupTemplate(true);

                AuthorAction::uploadRevisedVersion($submission);
*************************************************************************************************
                AuthorHandler::saveComment();
*************************************************************************************************
                Request::redirect(null, null, 'submissionReview', $articleId);
        }



I really appreciate your help, i've been stuck on this for a long time and its becoming quite frustrating.
bar338
 
Posts: 90
Joined: Tue Jun 09, 2009 11:54 am

Re: Adding a comment field

Postby bar338 » Wed Jul 08, 2009 12:36 pm

I've almost got it figured out but i have one small question.

What is the purpose of this line
Code: Select all
$email->send();


In this function
Code: Select all
        function emailEditorDecisionComment($authorSubmission, $send) {
                $userDao = &DAORegistry::getDAO('UserDAO');
                $journal = &Request::getJournal();

                $user = &Request::getUser();
                import('mail.ArticleMailTemplate');
                $email = &new ArticleMailTemplate($authorSubmission);

                $editAssignments = $authorSubmission->getEditAssignments();
                $editors = array();
                foreach ($editAssignments as $editAssignment) {
                        array_push($editors, $userDao->getUser($editAssignment->getEditorId()));
                }

                if ($send && !$email->hasErrors()) {
                        HookRegistry::call('AuthorAction::emailEditorDecisionComment', array(&$authorSubmission, &$email));
                        /*$email->send();*/

                        $articleCommentDao =& DAORegistry::getDAO('ArticleCommentDAO');
                        $articleComment =& new ArticleComment();
                        $articleComment->setCommentType(COMMENT_TYPE_EDITOR_DECISION);
                        $articleComment->setRoleId(ROLE_ID_AUTHOR);
                        $articleComment->setArticleId($authorSubmission->getArticleId());
                        $articleComment->setAuthorId($authorSubmission->getUserId());
                        $articleComment->setCommentTitle($email->getSubject());
                        $articleComment->setComments($email->getBody());
                        $articleComment->setDatePosted(Core::getCurrentDate());
                        $articleComment->setViewable(true);
                        $articleComment->setAssocId($authorSubmission->getArticleId());
                        $articleCommentDao->insertArticleComment($articleComment);

                        return true;
                } else {
                        if (!Request::getUserVar('continued')) {
                                $email->setSubject($authorSubmission->getArticleTitle());
                                if (!empty($editors)) {
                                        foreach ($editors as $editor) {
                                                $email->addRecipient($editor->getEmail(), $editor->getFullName());
                                        }
                                } else {
                                        $email->addRecipient($journal->getSetting('contactEmail'), $journal->getSetting('contactName'));
                                }
                        }

                        $email->displayEditForm(Request::url(null, null, 'emailEditorDecisionComment', 'send'), array('articleId' => $authorSubmission->getArticleId()), 'submission/comment/editorDecisionEma$

                        return false;
                }
        }
           


In the class: AuthorAction.php

I've commented out the line but emails are still being sent. What am i effecting by removing this line? And where is the line that sends the actual email.

Thanks.
bar338
 
Posts: 90
Joined: Tue Jun 09, 2009 11:54 am

Re: Adding a comment field

Postby mcrider » Wed Jul 15, 2009 9:51 am

Hi bar338,

Well, that code should be the only line that sends the actual email, unless you've written some code elsewhere that is registered against the AuthorAction::emailEditorDecisionComment hook which is called one line above. This function checks whether or not the $send variable is true and if so, sends the email, or else displays the email form. Maybe you made some modifications to the $articleCommentDao->insertArticleComment($articleComment); function that sends emails?

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


Return to OJS Development

Who is online

Users browsing this forum: No registered users and 2 guests