Skip to content

Commit

Permalink
Fix some issues that have cropped up if a user attempts to access the
Browse files Browse the repository at this point in the history
editor without sufficient permissions.
  • Loading branch information
drgrice1 committed Jul 14, 2023
1 parent 8efa759 commit 001a777
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
15 changes: 9 additions & 6 deletions lib/WeBWorK/ContentGenerator/Instructor/PGProblemEditor.pm
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ sub initialize ($c) {
$c->stash->{hardcopyLabels} = [];

# Tell the templates if we are working on a PG file
$c->{is_pg} = ($c->{file_type} eq 'course_info') ? 0 : 1;
$c->{is_pg} = $c->{file_type} && $c->{file_type} eq 'course_info' ? 0 : 1;

# Check permissions
return
Expand Down Expand Up @@ -336,18 +336,21 @@ sub path ($c, $args) {
# page. The bread crumb path leads back to the problem being edited, not to the Instructor tool.
return $c->pathMacro(
$args,
'WeBWorK' => $c->url_for('root'),
$c->stash('courseID') => $c->url_for('set_list'),
($c->stash('setID') // '') => $c->url_for('problem_list'),
$c->{prettyProblemNumber} => $c->url_for('problem_detail', problemID => $c->stash('problemID') || ''),
$c->maketext('Editor') => ''
'WeBWorK' => $c->url_for('root'),
$c->stash('courseID') => $c->url_for('set_list'),
($c->stash('setID') // '') => $c->url_for('problem_list'),
($c->{prettyProblemNumber} // '') =>
$c->url_for('problem_detail', problemID => $c->stash('problemID') || ''),
$c->maketext('Editor') => ''
);
}

sub page_title ($c) {
my $setID = $c->stash('setID');
my $problemID = $c->stash('problemID');

return 'Editor' unless $c->{file_type};

return $c->maketext('Set Header for set [_1]', $setID) if $c->{file_type} eq 'set_header';
return $c->maketext('Hardcopy Header for set [_1]', $setID) if $c->{file_type} eq 'hardcopy_header';
return $c->maketext('Course Information for course [_1]', $c->stash('courseID'))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
% use WeBWorK::HTML::CodeMirrorEditor
% qw(generate_codemirror_html generate_codemirror_controls_html output_codemirror_static_files);
%
% my $codemirrorMode = $c->{file_type} eq 'course_info' ? 'htmlmixed' : 'PG';
% my $codemirrorMode = $c->{file_type} && $c->{file_type} eq 'course_info' ? 'htmlmixed' : 'PG';
% content_for js => begin
<%= output_codemirror_static_files($c, $codemirrorMode) =%>
<%= javascript getAssetURL($ce, 'js/ActionTabs/actiontabs.js'), defer => undef =%>
Expand Down

0 comments on commit 001a777

Please sign in to comment.