/** * Handle any section information on submission step 3 * @return string */ protected function _handleStep3($data) { parent::_handleStep3($data); if (isset($data['chapters'])) { foreach ($data['chapters'] as $chapter) { $this->click('css=[id^=component-grid-users-chapter-chaptergrid-addChapter-button-]'); $this->waitForElementPresent('//form[@id=\'editChapterForm\']//input[starts-with(@id,\'title-\')]'); $this->type('//form[@id=\'editChapterForm\']//input[starts-with(@id,\'title-\')]', $chapter['title']); if (isset($chapter['subtitle'])) { $this->type('//form[@id=\'editChapterForm\']//input[starts-with(@id,\'subtitle-\')]', $chapter['subtitle']); } // Contributors foreach ($chapter['contributors'] as $i => $contributor) { $this->waitForElementPresent('css=[id^=component-listbuilder-users-chapterauthorlistbuilder-addItem-button-]'); $this->clickAt('css=[id^=component-listbuilder-users-chapterauthorlistbuilder-addItem-button-]', '10,10'); $this->waitForElementPresent('xpath=(//div[@id="chapterAuthorContainer"]//select[@name="newRowId[name]"])[' . ($i + 1) . ']//option[text()=' . $this->quoteXpath($contributor) . ']'); $this->select('xpath=(//div[@id="chapterAuthorContainer"]//select[@name="newRowId[name]"])[' . ($i + 1) . ']', 'label=' . $contributor); $this->waitJQuery(); } // Files foreach ($chapter['files'] as $i => $file) { $this->waitForElementPresent('css=[id^=component-listbuilder-files-chapterfileslistbuilder-addItem-button-]'); $this->clickAt('css=[id^=component-listbuilder-files-chapterfileslistbuilder-addItem-button-]', '10,10'); $this->waitForElementPresent('xpath=(//div[@id="chapterFilesContainer"]//select[@name="newRowId[name]"])[' . ($i + 1) . ']//option[text()=' . $this->quoteXpath($file) . ']'); $this->select('xpath=(//div[@id="chapterFilesContainer"]//select[@name="newRowId[name]"])[' . ($i + 1) . ']', 'label=' . $file); $this->waitJQuery(); } $this->click('//form[@id=\'editChapterForm\']//span[text()=\'Save\']/..'); $this->waitForElementNotPresent('css=.ui-widget-overlay'); } } }
/** * Handle any section information on submission step 3 * @return string */ protected function _handleStep3($data) { parent::_handleStep3($data); // Set submitter's role // assumes the submitter is first in the contributors list $this->waitForElementPresent('css=[id^=component-grid-users-author-authorgrid]//css=[id*=editAuthor-button]'); $this->click('css=[id^=component-grid-users-author-authorgrid]//css=[id*=editAuthor-button]'); $this->waitForElementPresent('css=[id=userGroupId]'); $this->click('//label[contains(.,\'' . $this->escapeJS($data['submitterRole']) . '\')]'); $this->click('//button[text()=\'Save\']'); $this->waitForElementNotPresent('css=div.pkp_modal_panel'); if (isset($data['chapters'])) { foreach ($data['chapters'] as $chapter) { $this->click('css=[id^=component-grid-users-chapter-chaptergrid-addChapter-button-]'); $this->waitForElementPresent('//form[@id=\'editChapterForm\']//input[starts-with(@id,\'title-\')]'); $this->type('//form[@id=\'editChapterForm\']//input[starts-with(@id,\'title-\')]', $chapter['title']); if (isset($chapter['subtitle'])) { $this->type('//form[@id=\'editChapterForm\']//input[starts-with(@id,\'subtitle-\')]', $chapter['subtitle']); } // Contributors foreach ($chapter['contributors'] as $i => $contributor) { $this->waitForElementPresent('css=[id^=component-listbuilder-users-chapterauthorlistbuilder-addItem-button-]'); $this->clickAt('css=[id^=component-listbuilder-users-chapterauthorlistbuilder-addItem-button-]', '10,10'); $this->waitForElementPresent('xpath=(//div[@id="chapterAuthorContainer"]//select[@name="newRowId[name]"])[' . ($i + 1) . ']//option[text()=' . $this->quoteXpath($contributor) . ']'); $this->select('xpath=(//div[@id="chapterAuthorContainer"]//select[@name="newRowId[name]"])[' . ($i + 1) . ']', 'label=' . $contributor); } // Files foreach ($chapter['files'] as $i => $file) { $this->waitForElementPresent('css=[id^=component-listbuilder-files-chapterfileslistbuilder-addItem-button-]'); $this->clickAt('css=[id^=component-listbuilder-files-chapterfileslistbuilder-addItem-button-]', '10,10'); $this->waitForElementPresent($selector = 'xpath=(//div[@id="chapterFilesContainer"]//select[@name="newRowId[name]"])[' . ($i + 1) . ']//option[contains(text(),' . $this->quoteXpath($file) . ')]'); $optionFullText = $this->getText($selector); $this->select('xpath=(//div[@id="chapterFilesContainer"]//select[@name="newRowId[name]"])[' . ($i + 1) . ']', 'label=' . $optionFullText); } $this->click('//form[@id=\'editChapterForm\']//button[text()=\'Save\']'); $this->waitForElementNotPresent('css=div.pkp_modal_panel'); // pkp/pkp-lib#655 } } }