Skip to content

Commit

Permalink
*8094* Remove breadcrumb code
Browse files Browse the repository at this point in the history
  • Loading branch information
asmecher committed Feb 7, 2013
1 parent a69c258 commit 0a12c7e
Show file tree
Hide file tree
Showing 66 changed files with 163 additions and 1,069 deletions.
32 changes: 0 additions & 32 deletions classes/plugins/ImportExportPlugin.inc.php
Expand Up @@ -46,38 +46,6 @@ function getDescription() {
return 'This is the ImportExportPlugin base class. Its functions can be overridden by subclasses to provide import/export functionality for various formats.';
}

/**
* Set the page's breadcrumbs, given the plugin's tree of items
* to append.
* @param $crumbs Array ($url, $name, $isTranslated)
* @param $subclass boolean
*/

This comment has been minimized.

Copy link
@jalperin

jalperin May 1, 2013

Member

@asmecher : this is causing a code in the DataCite plugin to break, which still calls the setBreadcrumbs. I assume this was done because the new structure doesn't do breadcrumbs? and its safe for me to take out the call?

This comment has been minimized.

Copy link
@asmecher

asmecher May 1, 2013

Author Member

Yes, please take it out. The Future Will Not Contain Breadcrumbs.

function setBreadcrumbs($crumbs = array(), $isSubclass = false) {
$request =& $this->getRequest();
$templateMgr =& TemplateManager::getManager($request);
$pageCrumbs = array(
array(
$request->url(null, 'user'),
'navigation.user'
),
array(
$request->url(null, 'manager'),
'user.role.manager'
),
array (
$request->url(null, 'manager', 'importexport'),
'manager.importExport'
)
);
if ($isSubclass) $pageCrumbs[] = array(
$request->url(null, 'manager', 'importexport', array('plugin', $this->getName())),
$this->getDisplayName(),
true
);

$templateMgr->assign('pageHierarchy', array_merge($pageCrumbs, $crumbs));
}

/**
* Display the import/export plugin UI.
* @param $args array The array of arguments the user supplied.
Expand Down
24 changes: 0 additions & 24 deletions classes/plugins/PubIdPlugin.inc.php
Expand Up @@ -113,7 +113,6 @@ function manage($verb, $args, &$message, &$messageParams, &$pluginModalContent =
$message = NOTIFICATION_TYPE_SUCCESS;
return false;
} else {
$this->_setBreadcrumbs();
$form->initData();
$pluginModalContent = $form->fetch($request);
}
Expand Down Expand Up @@ -453,29 +452,6 @@ function setEnabled($enabled) {
function _getDAOs() {
return array('IssueDAO', 'ArticleDAO', 'ArticleGalleyDAO', 'SuppFileDAO');
}

/**
* Set the breadcrumbs, given the plugin's tree of items to append.
*/
function _setBreadcrumbs() {
$request =& $this->getRequest();
$templateMgr =& TemplateManager::getManager($request);
$pageCrumbs = array(
array(
$request->url(null, 'user'),
'navigation.user'
),
array(
$request->url(null, 'manager'),
'user.role.manager'
),
array(
$request->url(null, 'manager', 'plugins'),
'manager.plugins'
)
);
$templateMgr->assign('pageHierarchy', $pageCrumbs);
}
}

?>
32 changes: 0 additions & 32 deletions classes/plugins/ReportPlugin.inc.php
Expand Up @@ -76,38 +76,6 @@ function getMetricFullName($metricType) {
return null;
}

/**
* Set the page's breadcrumbs, given the plugin's tree of items
* to append.
* @param $crumbs Array ($url, $name, $isTranslated)
* @param $subclass boolean
*/
function setBreadcrumbs($crumbs = array(), $isSubclass = false) {
$request =& $this->getRequest();
$templateMgr =& TemplateManager::getManager($request);
$pageCrumbs = array(
array(
$request->url(null, 'user'),
'navigation.user'
),
array(
$request->url(null, 'manager'),
'user.role.manager'
),
array (
$request->url(null, 'manager', 'reports'),
'manager.statistics.reports'
)
);
if ($isSubclass) $pageCrumbs[] = array(
$request->url(null, 'manager', 'reports', array('plugin', $this->getName())),
$this->getDisplayName(),
true
);

$templateMgr->assign('pageHierarchy', array_merge($pageCrumbs, $crumbs));
}

/**
* Display the import/export plugin UI.
* @param $args Array The array of arguments the user supplied.
Expand Down
35 changes: 0 additions & 35 deletions classes/submission/sectionEditor/SectionEditorAction.inc.php
Expand Up @@ -2410,41 +2410,6 @@ function uploadReviewForReviewer($reviewId, $article, $request) {
ArticleLog::logEvent($request, $article, ARTICLE_LOG_REVIEW_FILE_BY_PROXY, 'log.review.reviewFileByProxy', array('reviewerName' => $reviewer->getFullName(), 'round' => $reviewAssignment->getRound(), 'userName' => $user->getFullName(), 'reviewId' => $reviewAssignment->getId()));
}
}

/**
* Helper method for building submission breadcrumb
* @param $articleId
* @param $parentPage name of submission component
* @return array
*/
function submissionBreadcrumb($articleId, $parentPage, $section) {
$breadcrumb = array();
if ($articleId) {
$breadcrumb[] = array(Request::url(null, $section, 'submission', $articleId), "#$articleId", true);
}

if ($parentPage) {
switch($parentPage) {
case 'summary':
$parent = array(Request::url(null, $section, 'submission', $articleId), 'submission.summary');
break;
case 'review':
$parent = array(Request::url(null, $section, 'submissionReview', $articleId), 'submission.review');
break;
case 'editing':
$parent = array(Request::url(null, $section, 'submissionEditing', $articleId), 'submission.editing');
break;
case 'history':
$parent = array(Request::url(null, $section, 'submissionHistory', $articleId), 'submission.history');
break;
}
if ($section != 'editor' && $section != 'sectionEditor') {
$parent[0] = Request::url(null, $section, 'submission', $articleId);
}
$breadcrumb[] = $parent;
}
return $breadcrumb;
}
}

?>
22 changes: 2 additions & 20 deletions pages/admin/AdminCategoriesHandler.inc.php
Expand Up @@ -133,7 +133,7 @@ function editCategory($args, &$request) {

$this->validate($request, $categoryId);

$this->setupTemplate($request, $this->category, true);
$this->setupTemplate($request);
import('classes.journal.categories.CategoryForm');

$templateMgr =& TemplateManager::getManager($request);
Expand Down Expand Up @@ -177,7 +177,7 @@ function updateCategory($args, &$request) {
$this->validate($request, $categoryId);
$category =& $this->category;
}
$this->setupTemplate($request, $category);
$this->setupTemplate($request);

import('classes.journal.categories.CategoryForm');

Expand All @@ -192,7 +192,6 @@ function updateCategory($args, &$request) {
} else {

$templateMgr =& TemplateManager::getManager($request);
$templateMgr->append('pageHierarchy', array($request->url(null, 'admin', 'categories'), 'admin.categories'));

$templateMgr->assign('pageTitle',
$category?
Expand All @@ -217,23 +216,6 @@ function setCategoriesEnabled($args, &$request) {
$request->redirect(null, null, 'categories');
}

/**
* Set up the template.
* @param $request PKPRequest
* @param $category Category optional
* @param $subclass boolean optional
*/
function setupTemplate($request, $category = null, $subclass = false) {
parent::setupTemplate($request, true);
$templateMgr =& TemplateManager::getManager($request);
if ($subclass) {
$templateMgr->append('pageHierarchy', array($request->url(null, 'admin', 'categories'), 'admin.categories'));
}
if ($category) {
$templateMgr->append('pageHierarchy', array($request->url(null, 'admin', 'editCategory', $category->getId()), $category->getLocalizedName(), true));
}
}

/**
* Validate the request. If a category ID is supplied, the category object
* will be fetched and validated against. If,
Expand Down
15 changes: 2 additions & 13 deletions pages/author/AuthorHandler.inc.php
Expand Up @@ -149,22 +149,11 @@ function validate(&$request, $articleId = null, $reason = null) {

/**
* Setup common template variables.
* @param $subclass boolean set to true if caller is below this handler in the hierarchy
* @param $request PKPRequest
*/
function setupTemplate($request, $subclass = false, $articleId = 0, $parentPage = null) {
function setupTemplate($request) {
parent::setupTemplate($request);
AppLocale::requireComponents(LOCALE_COMPONENT_APP_AUTHOR, LOCALE_COMPONENT_PKP_SUBMISSION);
$templateMgr =& TemplateManager::getManager($request);

$pageHierarchy = $subclass ? array(array($request->url(null, 'user'), 'navigation.user'), array($request->url(null, 'author'), 'user.role.author'), array($request->url(null, 'author'), 'article.submissions'))
: array(array($request->url(null, 'user'), 'navigation.user'), array($request->url(null, 'author'), 'user.role.author'));

import('classes.submission.sectionEditor.SectionEditorAction');
$submissionCrumb = SectionEditorAction::submissionBreadcrumb($articleId, $parentPage, 'author');
if (isset($submissionCrumb)) {
$pageHierarchy = array_merge($pageHierarchy, $submissionCrumb);
}
$templateMgr->assign('pageHierarchy', $pageHierarchy);
}

/**
Expand Down
25 changes: 6 additions & 19 deletions pages/comment/CommentHandler.inc.php
Expand Up @@ -58,7 +58,7 @@ function view($args, &$request) {
if (!$comment) $comments =& $commentDao->getRootCommentsBySubmissionId($articleId, 1);
else $comments =& $comment->getChildren();

$this->setupTemplate($request, $article, $galleyId, $comment);
$this->setupTemplate($request);

$templateMgr =& TemplateManager::getManager($request);
if ($request->getUserVar('refresh')) $templateMgr->setCacheability(CACHEABILITY_NO_CACHE);
Expand Down Expand Up @@ -96,7 +96,7 @@ function add($args, $request) {
}

$this->validate($request, $articleId);
$this->setupTemplate($request, $publishedArticle, $galleyId, $parent);
$this->setupTemplate($request);

// Bring in comment constants
$enableComments = $journal->getSetting('enableComments');
Expand Down Expand Up @@ -225,28 +225,15 @@ function validate(&$request, $articleId) {
* @param $galleyId int
* @param $comment Comment
*/
function setupTemplate(&$request, $article, $galleyId, $comment = null) {
parent::setupTemplate();
function setupTemplate($request) {
parent::setupTemplate($request);
AppLocale::requireComponents(LOCALE_COMPONENT_PKP_READER);
$templateMgr =& TemplateManager::getManager($request);
$journal =& $request->getJournal();
$templateMgr = TemplateManager::getManager($request);
$journal = $request->getJournal();

if (!$journal || !$journal->getSetting('restrictSiteAccess')) {
$templateMgr->setCacheability(CACHEABILITY_PUBLIC);
}

$pageHierarchy = array(
array(
$request->url(null, 'article', 'view', array(
$article->getBestArticleId($request->getJournal()), $galleyId
)),
String::stripUnsafeHtml($article->getLocalizedTitle()),
true
)
);

if ($comment) $pageHierarchy[] = array($request->url(null, 'comment', 'view', array($article->getId(), $galleyId)), 'comments.readerComments');
$templateMgr->assign('pageHierarchy', $pageHierarchy);
}
}

Expand Down
15 changes: 1 addition & 14 deletions pages/copyeditor/CopyeditorHandler.inc.php
Expand Up @@ -111,23 +111,10 @@ function index($args, &$request) {
/**
* Setup common template variables.
* @param $request PKPRequest
* @param $subclass boolean set to true if caller is below this handler in the hierarchy
* @param $articleId int
* @param $parentPage string optional
*/
function setupTemplate($request, $subclass = false, $articleId = 0, $parentPage = null) {
function setupTemplate($request) {
parent::setupTemplate($request);
AppLocale::requireComponents(LOCALE_COMPONENT_PKP_SUBMISSION);
$templateMgr =& TemplateManager::getManager($request);
$pageHierarchy = $subclass ? array(array($request->url(null, 'user'), 'navigation.user'), array($request->url(null, 'copyeditor'), 'user.role.copyeditor'))
: array(array('user', 'navigation.user'), array('copyeditor', 'user.role.copyeditor'));

import('classes.submission.sectionEditor.SectionEditorAction');
$submissionCrumb = SectionEditorAction::submissionBreadcrumb($articleId, $parentPage, 'copyeditor');
if (isset($submissionCrumb)) {
$pageHierarchy = array_merge($pageHierarchy, $submissionCrumb);
}
$templateMgr->assign('pageHierarchy', $pageHierarchy);
}

/**
Expand Down
36 changes: 5 additions & 31 deletions pages/editor/EditorHandler.inc.php
Expand Up @@ -40,7 +40,7 @@ function EditorHandler() {
*/
function index($args, $request) {
$this->validate($request);
$this->setupTemplate($request, EDITOR_SECTION_HOME);
$this->setupTemplate($request);

$templateMgr =& TemplateManager::getManager($request);
$journal =& $request->getJournal();
Expand Down Expand Up @@ -159,7 +159,7 @@ function index($args, $request) {
*/
function submissions($args, $request) {
$this->validate($request);
$this->setupTemplate($request, EDITOR_SECTION_SUBMISSIONS);
$this->setupTemplate($request);

$journal =& $request->getJournal();
$journalId = $journal->getId();
Expand Down Expand Up @@ -413,15 +413,15 @@ function assignEditor($args, $request) {
// has been done, send the email and store the editor
// selection.

$this->setupTemplate($request, EDITOR_SECTION_SUBMISSIONS, $articleId, 'summary');
$this->setupTemplate($request);

// FIXME: Prompt for due date.
if (EditorAction::assignEditor($articleId, $editorId, $isEditor, $request->getUserVar('send'), $request)) {
$request->redirect(null, null, 'submission', $articleId);
}
} else {
// Allow the user to choose a section editor or editor.
$this->setupTemplate($request, EDITOR_SECTION_SUBMISSIONS, $articleId, 'summary');
$this->setupTemplate($request);

$searchType = null;
$searchMatch = null;
Expand Down Expand Up @@ -490,7 +490,7 @@ function deleteSubmission($args, $request) {
$articleId = (int) array_shift($args);

$this->validate($request, $articleId);
parent::setupTemplate($request, true);
parent::setupTemplate($request);

$journal =& $request->getJournal();

Expand All @@ -511,32 +511,6 @@ function deleteSubmission($args, $request) {

$request->redirect(null, null, 'submissions', 'submissionsArchives');
}

/**
* Setup common template variables.
* @param $level int set to 0 if caller is at the same level as this handler in the hierarchy; otherwise the number of levels below this handler
*/
function setupTemplate($request, $level = EDITOR_SECTION_HOME, $articleId = 0, $parentPage = null) {
parent::setupTemplate($request);

// Layout Editors have access to some Issue Mgmt functions. Make sure we give them
// the appropriate breadcrumbs and sidebar.
$isLayoutEditor = $request->getRequestedPage() == 'layoutEditor';

$journal =& $request->getJournal();
$templateMgr =& TemplateManager::getManager($request);

if ($level==EDITOR_SECTION_HOME) $pageHierarchy = array(array($request->url(null, 'user'), 'navigation.user'));
else if ($level==EDITOR_SECTION_SUBMISSIONS) $pageHierarchy = array(array($request->url(null, 'user'), 'navigation.user'), array($request->url(null, 'editor'), 'user.role.editor'), array($request->url(null, 'editor', 'submissions'), 'article.submissions'));
else if ($level==EDITOR_SECTION_ISSUES) $pageHierarchy = array(array($request->url(null, 'user'), 'navigation.user'), array($request->url(null, $isLayoutEditor?'layoutEditor':'editor'), $isLayoutEditor?'user.role.layoutEditor':'user.role.editor'), array($request->url(null, $isLayoutEditor?'layoutEditor':'editor', 'futureIssues'), 'issue.issues'));

import('classes.submission.sectionEditor.SectionEditorAction');
$submissionCrumb = SectionEditorAction::submissionBreadcrumb($articleId, $parentPage, 'editor');
if (isset($submissionCrumb)) {
$pageHierarchy = array_merge($pageHierarchy, $submissionCrumb);
}
$templateMgr->assign('pageHierarchy', $pageHierarchy);
}
}

?>

0 comments on commit 0a12c7e

Please sign in to comment.