From 7fc2cfd6778c0fd4cc9d4cd8310df31290a28940 Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Mon, 15 Jun 2026 07:26:35 -0500 Subject: [PATCH] Disabled tabs for the PG editor. The "Save" tab will always shown for all file types, but will be disabled for any file not in the course's templates directory (symlinks do not count here, i.e., this tab will not be disabled for a file that is linked to from the course's templates directory assuming the server has write permission to the file), or the server does not have write permission to the file. The "Append" tabe will be shown for all PG file types (problems and set headers). However, it will be disabled for any file not in the course's templates directory (again symlinks do not count here, i.e., this tab will not be disabled for a file that is linked to from the course's templates directory, even if the server does not have write permissions to the file). Also the help has been updated. help for this. The help for each action tab now states when the tab is available and when it is active. --- .../Instructor/PGProblemEditor.html.ep | 9 +- .../InstructorPGProblemEditor.html.ep | 127 ++++++++++++------ 2 files changed, 93 insertions(+), 43 deletions(-) diff --git a/templates/ContentGenerator/Instructor/PGProblemEditor.html.ep b/templates/ContentGenerator/Instructor/PGProblemEditor.html.ep index 5d7f86dbe6..d02dc6f3e1 100644 --- a/templates/ContentGenerator/Instructor/PGProblemEditor.html.ep +++ b/templates/ContentGenerator/Instructor/PGProblemEditor.html.ep @@ -204,11 +204,12 @@ % my $line_contents = include("ContentGenerator/Instructor/PGProblemEditor/${actionID}_form"); % my $active = ''; % my $disabled = - % $actionID eq 'revert' - % && (!defined($c->{tempFilePath}) || !-e $c->{tempFilePath}) - % && !$c->getBackupTimes ? ' disabled' : ''; + % ($actionID eq 'revert' && (!defined($c->{tempFilePath}) || !-e $c->{tempFilePath}) && !$c->getBackupTimes) + % || ($actionID eq 'save' && $line_contents eq '') + % || ($actionID eq 'add_problem' && $c->{is_pg} && $line_contents eq '') + % ? ' disabled' : ''; % - % if (($line_contents && $line_contents ne '') || $actionID eq 'revert') { + % if (($line_contents && $line_contents ne '') || $disabled) { % unless ($default_choice) { $active = ' active'; $default_choice = $actionID; } % content_for 'tab-list' => begin