OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Editor Accept Final Draft

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.

Editor Accept Final Draft

Postby bar338 » Tue Jun 23, 2009 1:37 pm

After completing the review stage and having the submission Accepted by the editor it moves to the editing phase. In this phase the author will have to put their article into the standard template that we provide. I would like to have an option for approving the final submission like the initial submission was approved.
The option would be controlled by the editor. In the proofreading section there would be a drop down similar to the review page. The options in this drop down would be 'approve the final file' and 'final file needs modification'. Until the author chooses to 'approve the final file' the scheduling option will remain disabled (like the copyedit radio buttons).
Is there any easy way to do this? I've started working on it and i just keep digging deeper and deeper into the code making modification to make it work. Im afraid by the time i'm done i will have missed something small and it won't work. Any suggestions?

Files i've explored and altered so far:
SectionEditorAction.inc.php
SubmissionEditHandler.inc.php
And i added a table to the database that will hold editor decisions.

One problem i'm having right now is i'm gettintg this error:
Use of undefined constant SUBMISSION_EDITOR_FINAL_DECISION_ACCEPT
SUBMISSION_EDITOR_FINAL_DECISION_ACCEPT is the name of the constant i'm using to signify the editor accepting the final article. But where do i originally need to create this constant?

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

Re: Editor Accept Final Draft

Postby bar338 » Tue Jun 23, 2009 3:32 pm

Ok, here is a more specific question for you. Where does the content come from for this select option menu? I see the options are loaded from $editorDecisionOptions. If i wanted to add another option where would I have to add the code? I know some of it is in the SubmissionEditHandler.inc.php but it must be hiding somewhere else too.

sectionEdtior > editorDecision..tpl
Code: Select all
                       
 <select name="decision" size="1" class="selectMenu"{if not $allowRecommendation} disabled="disabled"{/if}>
          {html_options_translate options=$editorDecisionOptions selected=$lastDecision}
   </select>
bar338
 
Posts: 90
Joined: Tue Jun 09, 2009 11:54 am

Re: Editor Accept Final Draft

Postby mcrider » Wed Jun 24, 2009 11:15 am

Hi bar338,

That menu is populated by an array pulled from the getEditorDecisionOptions function in classes/submission/sectionEditor/SectionEditorSubmission.inc.php. You can just add another constant and locale key to add an item to the menu--But handling this new option may be quite complex... I'd suggesting grepping through the code for another one of the editor decision constants and watching how it is used throughout the editing process.

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

Re: Editor Accept Final Draft

Postby bar338 » Wed Jun 24, 2009 12:12 pm

My goal right now is to get the options i've created to appear in the drop-down form (it is very empty at the moment), this is what i've done so far.

Ya i had added another function right below that one like this:
Code: Select all
        function &getEditorFinalDecisionOptions() {
                static $editorFinalDecisionOptions = array(
                        '' => 'common.chooseOne',
                        SUBMISSION_EDITOR_FINAL_DECISION_ACCEPT => 'editor.article.finalDecision.accept',
                        SUBMISSION_EDITOR_FINAL_DECISION_PENDING_REVISIONS => 'editor.article.finalDecision.pendingRevisions',
                );
                return $editorFinalDecisionOptions;
        }


And added this in the pages/sectionEditor/SubmissionEditHandler.inc.ph
Code: Select all
                $templateMgr->assign('editorFinalDecisionOptions',
                        array(
                                '' => 'common.chooseOne',
                                SUBMISSION_EDITOR_FINAL_DECISION_ACCEPT => 'editor.article.finalDecision.accept',
                                SUBMISSION_EDITOR_FINAL_DECISION_PENDING_REVISIONS => 'editor.article.finalDecision.pendingRevisions'
                        )
                );


Next I added this in classes/submission/sectionEditor/SectionEditorSubmission.inc.ph
Code: Select all
        function &getEditorFinalDecisionOptions() {
                static $editorFinalDecisionOptions = array(
                        '' => 'common.chooseOne',
                        SUBMISSION_EDITOR_FINAL_DECISION_ACCEPT => 'editor.article.finalDecision.accept',
                        SUBMISSION_EDITOR_FINAL_DECISION_PENDING_REVISIONS => 'editor.article.finalDecision.pendingRevisions',
                );
                return $editorFinalDecisionOptions;
        }


I then added ''editor.article.finalDecision.accept' and ' 'editor.article.finalDecision.pendingRevisions' to the locale file.

Code: Select all
 <form method="post" action="{url op="recordFinalDecision"}">
                        <input type="hidden" name="articleId" value="{$submission->getArticleId()}" />
                        <select name="finalDecision" size="1" class="selectMenu">
                                {html_options_translate options=$editorFinalDecisionOptions}
                               
                        </select>
                        <input type="submit" onclick="return confirm('{translate|escape:"jsparam" key="editor.submissionReview.confirmDecision"}')" name="submit" value="{translate
key="editor.article.recordDecision"}" {if not $allowRecommendation}disabled="disabled"{/if} class="button" />
                        {if not $allowRecommendation}&nbsp;&nbsp;{translate key="editor.article.cannotRecord}{/if}
                </form>


And i'm getting this error:
Code: Select all
Use of undefined constant SUBMISSION_EDITOR_FINAL_DECISION_ACCEPT - assumed 'SUBMISSION_EDITOR_FINAL_DECISION_ACCEPT' in /pkp/pages/sectionEditor/SubmissionEditHandler.inc.php on line 276


I've also edited a ton of files trying to get everything working but at this point i'm thinking that making this change is more than I can do. I've still been unable to get anything to appear in the dropd own form above let alone add any functionality.
bar338
 
Posts: 90
Joined: Tue Jun 09, 2009 11:54 am

Re: Editor Accept Final Draft

Postby mcrider » Wed Jun 24, 2009 1:11 pm

Hi bar338,

Grep is your friend--You'll probably want to define those constants where the other editor decision constants are, i.e. in classes/submission/common/Action.inc.php. Also, you won't need to redefine the array in SubmissionEditHandler--You can just call the function you created in SectionEditorSubmission. I'm seeing now that we did that for the editorDecisionOptions array (defining it twice), which is pretty inneficient.

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

Re: Editor Accept Final Draft

Postby bar338 » Wed Jun 24, 2009 2:17 pm

Ok, i figured out one of my problems.

If i put this code directly in sectionEditor/submission/proofread.tpl is there any reason it won't work? The original code came from editorDecision.tpl (in the same directory) i just changed which options it uses. The code works (it displays the two options I inserted into the code) if I put it in the editorDecision.tpl file ( in other words there were two decision drop-downs for testing purposes), but if i put it in proofread.tpl (where i want the drop-down) none of the values fill the drop-down. I looked at submissionReview.tpl and submissionEdit.tpl (files that call editDecision and proofread) and they both use the same header and everything. So i'm wondering why I can't get it to work in the proofread section.

I'm sure its something obvious, but any suggestions?

Code: Select all
<form method="post" action="{url op="recordFinalDecision"}">
                        <input type="hidden" name="articleId" value="{$submission->getArticleId()}" />
                        <select name="finalDecision" size="1" class="selectMenu">
                                {html_options_translate options=$editorFinalDecisionOptions}
                               
                        </select>
                        <input type="submit" onclick="return confirm('{translate|escape:"jsparam" key="editor.submissionReview.confirmDecision"}')" name="submit" value="{translate
key="editor.article.recordDecision"}" {if not $allowRecommendation}disabled="disabled"{/if} class="button" />
                        {if not $allowRecommendation}&nbsp;&nbsp;{translate key="editor.article.cannotRecord}{/if}
                </form>
bar338
 
Posts: 90
Joined: Tue Jun 09, 2009 11:54 am

Re: Editor Accept Final Draft

Postby bar338 » Thu Jun 25, 2009 4:02 pm

any suggestions on why if I include 'templates/sectionEditor/Submission/editorDecision.tpl' in 'templates/sectionEditor/submissionEditing.tpl' it will not print the select options for editor decision? i've dug through all the files and i can't figure out what is tying editorDecision.tpl to the review stage.
bar338
 
Posts: 90
Joined: Tue Jun 09, 2009 11:54 am

Re: Editor Accept Final Draft

Postby mcrider » Thu Jun 25, 2009 4:39 pm

Hi bar338,

Did you assign the $editorDecisionOptions variable to the template in the handling function that calls the template (pages/sectionEditor/SubmissionEditHandler::submissionEditing())? You'll have to make sure all variables that the template uses are properly assigned.

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

Re: Editor Accept Final Draft

Postby bar338 » Mon Jun 29, 2009 11:31 am

I've got everything displaying correctly now, and have it so that it will show the most current decisions and also have it setup so scheduling is disabled until the editor accepts the submission. What i'm stuck on right now is saving the editors decision when he submits the form. I'm going to show you some of the changes i've made and hopefully you will see something i'm doing wrong. I also probably have made some changes which have no use but i've just tried a lot of different things to get this to work:

My understanding of how a decision is recorded:
SectionEditorHandler::recordDecision() calls SubmissionEditHandler::recordDecision(),
if submission is declined
SubmissionEditHandler::recordDecision() calls SectionEditorAction::recordDecision($sectionEditorSubmission, $decision

recordDecision($sectionEditorSubmission, $decision) calls
    SectionEditorSubmission->setStatus(STATUS_QUEUED)
    sectionEditorSubmission->stampStatusModified();
    sectionEditorSubmission->addDecision($editorDecision, $sectionEditorSubmission->getCurrentRound()); (classes/submission/sectionEditor/SectionEditorSubmission.inc.php)
    sectionEditorSubmissionDao::updateSectionEditorSubmission($sectionEditorSubmission);
      Inserts/Updates Database



SectionEditorSubmissionDAO::&_returnSectionEditorSubmissionFromRow(&$row) calls
    SectionEditorSubmission::setDecisions($editorDecisions, $round)
    SectionEditorSubmissionDAO::getEditorDecisions
      Queries Database for editorDecisions


The code i've added/modified (i think this is most of what i've done but i'm sure i forgot something):
pages/sectionEditor/SubmissionEditHandler.inc.php
I added this function under recordDecision().
Code: Select all
function recordFinalDecision() {
                $articleId = Request::getUserVar('articleId');
                list($journal, $submission) = SubmissionEditHandler::validate($articleId, SECTION_EDITOR_ACCESS_EDIT);

                $finalDecision = Request::getUserVar('finalDecision');

                switch ($finalDecision) {
                        case SUBMISSION_EDITOR_FINAL_DECISION_ACCEPT:
                        case SUBMISSION_EDITOR_FINAL_DECISION_PENDING_REVISIONS:
                                SectionEditorAction::recordFinalDecision($submission, $finalDecision);
                                break;
                }

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

In recordDecision() it calls SectionEditorAction::recordDecision, why does it only do this if the submission is denied? Through process does the decision get recorded if it is accepted

classes/submission/sectionEditor/SectionEditorAction.inc.php
I added this unction under recordDecision

Code: Select all
 function recordFinalDecision($sectionEditorSubmission, $finalDecision) {
                $editAssignments =& $sectionEditorSubmission->getEditAssignments();
                if (empty($editAssignments)) return;

                $sectionEditorSubmissionDao = &DAORegistry::getDAO('SectionEditorSubmissionDAO');
                $user = &Request::getUser();
                $editorFinalDecision = array(
                        'editDecisionId' => null,
                        'editorId' => $user->getUserId(),
                        'decision' => $finalDecision,
                        'dateDecided' => date(Core::getCurrentDate())
                );

                if (!HookRegistry::call('SectionEditorAction::recordFinalDecision', array(&$sectionEditorSubmission, $editorFinalDecision))) {
                        $sectionEditorSubmission->setStatus(STATUS_QUEUED);
                        $sectionEditorSubmission->stampStatusModified();
                        $sectionEditorSubmission->addFinalDecision($editorFinalDecision, $sectionEditorSubmission->getCurrentFinalRound());
                        $sectionEditorSubmissionDao->updateSectionEditorSubmission($sectionEditorSubmission);

                        $finalDecisions = SectionEditorSubmission::getEditorFinalDecisionOptions();
                        // Add log
                        import('article.log.ArticleLog');
                        import('article.log.ArticleEventLogEntry');
                        ArticleLog::logEvent($sectionEditorSubmission->getArticleId(), ARTICLE_LOG_EDITOR_DECISION, ARTICLE_LOG_TYPE_EDITOR, $user->getUserId(), 'log.editor.decision',
                        array('editorName' =>  $user->getFullName(), 'articleId' => $sectionEditorSubmission->getArticleId(), 'finalDecision' => Locale::translate($finalDecisions[$finalDecision])));
                }
        }


classes/submission/sectionEditor/SectionEditorSubmissionDAO.inc.php

Code: Select all
&_returnSectionEditorSubmissionFromRow(&$row){
               
//Right below //Editor Decisions
//Editor Final Decisions
                for ($i =1; $i <= $row['current_round']; $i++) {
                        $sectionEditorSubmission->setFinalDecisions($this->getEditorFinalDecisions($row['article_id'], $i), $i);
                }

}


Code: Select all
// Update editor final decisions
                for ($i = 1; $i <= $sectionEditorSubmission->getCurrentRound(); $i++) {
                        $editorFinalDecisions = $sectionEditorSubmission->getFinalDecisions($i);
                        if (is_array($editorFinalDecisions)) {
                                foreach ($editorFinalDecisions as $editorFinalDecision) {
                                        if ($editorFinalDecision['editFinalDecisionId'] == null) {
                                                $this->update(
                                                        sprintf('INSERT INTO editor_final_decisions
                                                                (article_id, editor_id, decision, date_decided)
                                                                VALUES (?, ?, ?, %s)',
                                                                $this->datetimeToDB($editorDecision['dateDecided'])),
                                                        array($sectionEditorSubmission->getArticleId(), $editorFinalDecision['editorId'], $editorFinalDecision['finalDecision'])
                                                );
                                        }
                                }
                        }
                }


Code: Select all
function getEditorFinalDecisions($articleId, $round = null) {
                $finalDecisions = array();

                if ($round == null) {
                        $result = &$this->retrieve(
                                'SELECT edit_decision_id, editor_id, decision, date_decided FROM editor_final_decisions WHERE article_id = ? ORDER BY date_decided ASC', $articleId
                        );
                } else {
                        $result = &$this->retrieve(
                                'SELECT edit_decision_id, editor_id, decision, date_decided FROM editor_final_decisions WHERE article_id = ? ORDER BY date_decided ASC', $articleId
                        );
                }

                while (!$result->EOF) {
                        $finalDecisions[] = array(
                                'editDecisionId' => $result->fields['edit_decision_id'],
                                'editorId' => $result->fields['editor_id'],
                                'finalDecision' => $result->fields['decision'],
                                'dateDecided' => $this->datetimeFromDB($result->fields['date_decided'])
                        );
                        $result->moveNext();
                }
                $result->Close();
                unset($result);

                return $finalDecisions;
        }



classes/submission/sectionEditor/SectionEditorSubmission.inc.php

Code: Select all
 function addFinalDecision($editorFinalDecision, $round) {
                if (isset($this->editorFinalDecisions[$round]) && is_array($this->editorFinalDecisions[$round])) {
                        array_push($this->editorFinalDecisions[$round], $editorFinalDecision);
                }
                else $this->editorFinalDecisions[$round] = Array($editorFinalDecision);
        }

        function getFinalDecisions($round = null) {
                if ($round == null) {
                        return $this->editorFinalDecisions;
                } else {
                        if (isset($this->editorFinalDecisions[$round])) return $this->editorFinalDecisions[$round];
                        else return null;
                }
        }

Code: Select all
 function setFinalDecisions($editorFinalDecisions) {
                return $this->editorFinalDecisions = $editorFinalDecisions;
        }
bar338
 
Posts: 90
Joined: Tue Jun 09, 2009 11:54 am

Re: Editor Accept Final Draft

Postby bar338 » Tue Jun 30, 2009 12:20 pm

In the editorDecision.tpl file for Section Editor there is a form for picking a decision. In the form the action is op=”recordDecision” what does this reference? The method SectionEditorAction::recordDecision? If so i see that recordDecsion takes to arguments: $sectionEditorSubmission, $finalDecision. What values does the form pass to fill these values?

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

Re: Editor Accept Final Draft

Postby mcrider » Tue Jun 30, 2009 12:28 pm

Hi bar338,

Nope, that refers to pages/sectionEditor/SubmissionEditHandler::recordDecision(), which has no arguments--It gets its data by reading form values using the 'Request::getUserVar' method. This recordDecision function in turn calls the one in SectionEditorAction.

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

Re: Editor Accept Final Draft

Postby bar338 » Tue Jun 30, 2009 12:42 pm

Ok, i don't quite understand the Request::getUserVar function. How does it get the value from the form.
I see it calls it like this: $decision = Request::getUserVar('decision'); and then decision is going to equal somehint along the lines of SUBMISSION_EDITOR_FINAL_DECISION_ACCEPT. How does that value get to getUserVar and getUserVar has a parameter of decision, How/where is 'decision' associated with the option from the form?

And thanks for your help, as soon as i can figure out all the base things like this I hope to be able to make modifications like this a little faster.
bar338
 
Posts: 90
Joined: Tue Jun 09, 2009 11:54 am

Re: Editor Accept Final Draft

Postby mcrider » Tue Jun 30, 2009 1:05 pm

Hi bar338,

The value in the getUserVar function ('decision') equals a form element in the template file for that form.. so in the editorDecision.tpl file there should be a form element (a drop-down select menu) with name="decision". After a form is submitted, any form elements can be pulled into the handling code using Request::getUserVar.

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

Re: Editor Accept Final Draft

Postby bar338 » Tue Jun 30, 2009 1:46 pm

That makes sense. I feel like i'm so close right now and I have everything working except saving the value the editor submits to the form. I just can't get it to save to the database.

I think this is pretty close and just posting it up if someone else tries to scan through this thread later:

Procedure for editorDecision
    1.EditorDecision.tpl - Editor picks his option from the menu and hits submit button. The forms post action points to recordFinalDecision (SubmissionEditorHandler ).
      1.SubmissionEditorHandler::recordFinalDecision – gets the form value from Request::getUserVar('finalDecision'). It then calls SectionEditorAction::recordFinalDecision($submission(articleId), $finalDecision);
        1. SectionEditorAction::recordFinalDecision – creates a variable $editorFinalDecision and sets the decision from the finalDecision argument, and sets the editDecisionId to null. It then calls $sectionEditorSubmission->addFinalDecision and $sectionEditorSubmissionDAO->updateSectionEditorSubmission().
          1.$sectionEditorSubmission::addFinalDecision - Recieves the complete array of the editor decision and the current round in the parameter. It then grabs a class global variable called $editorFinalDecisions[$round] and checks to see if it is set and if it is an array. If it is then it pushs the new decision on top of this array. If its not set then it starts the array by adding the new decision as the first decision.
          2.$sectionEditorSubmissionDAO::updateSectionEditorSubmission – receives the article id via the $sectionEditorSubmission variable. It then calls $sectionEditorSubmission->getFinalDecisions. It then process the return to see if it is an array, if it is it goes through each element of the array. If the editDecisionId == null (meaning it is new and hasn't been inserted to the database yet) then it runs a insert with the criteria in the array)
            1.$sectionEditorSubmission::getFinalDecisions($currentRound) – if no round is passed then it just returns the global class array $editorFinalDecisions (updated earlier with addFinalDecision). If a round is passed then it returns $editorFinalDecisions[$round]
bar338
 
Posts: 90
Joined: Tue Jun 09, 2009 11:54 am

Re: Editor Accept Final Draft

Postby bar338 » Wed Jul 01, 2009 6:39 am

What does this line do in classes/submission/sectionEditor?
Code: Select all
 if (!HookRegistry::call('SectionEditorAction::recordFinalDecision', array(&$sectionEditorSubmission, $editorFinalDecision)))


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

Next

Return to OJS Technical Support

Who is online

Users browsing this forum: Bing [Bot] and 2 guests