Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 38 additions & 34 deletions htdocs/js/PGProblemEditor/pgproblemeditor.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,43 @@
(() => {
const renderURL = `${webworkConfig?.webwork_url ?? '/webwork2'}/render_rpc`;

for (const pgmlLabButton of document.querySelectorAll('.pgml-lab')) {
pgmlLabButton.addEventListener('click', (e) => {
e.preventDefault();
const form = document.createElement('form');
form.style.display = 'none';
form.target = 'PGML';
form.action = renderURL;
form.method = 'post';

const inputs = [
['courseID', document.getElementsByName('courseID')[0]?.value],
['displayMode', document.getElementById('action_view_displayMode_id')?.value ?? 'MathJax'],
['fileName', 'PGMLLab/PGML-lab.pg'],
['uriEncodedProblemSource', pgmlLabButton.dataset.source]
];

const user = document.getElementsByName('user')[0];
if (user) inputs.push(['user', user.value]);
const sessionKey = document.getElementsByName('key')[0];
if (sessionKey) inputs.push(['key', sessionKey.value]);

for (const [name, value] of inputs) {
const input = document.createElement('input');
input.name = name;
input.value = value;
input.type = 'hidden';
form.append(input);
}

document.body.append(form);
form.submit();
form.remove();
});
}

const fileChooserForm = document.forms['pg-editor-file-chooser'];

if (fileChooserForm) {
const newProblemRadio = document.getElementById('new_problem');

Expand Down Expand Up @@ -342,7 +380,6 @@
}
});

const renderURL = `${webworkConfig?.webwork_url ?? '/webwork2'}/render_rpc`;
const fileType = document.getElementsByName('file_type')[0]?.value;

// This is either the div containing the CodeMirror editor or the problemContents textarea in the case that
Expand Down Expand Up @@ -650,37 +687,4 @@
rendering = false;
}
};

const pgmlLabButton = document.getElementById('pgml-lab');
pgmlLabButton?.addEventListener('click', () => {
const form = document.createElement('form');
form.style.display = 'none';
form.target = 'PGML';
form.action = renderURL;
form.method = 'post';

const inputs = [
['courseID', document.getElementsByName('courseID')[0]?.value],
['displayMode', document.getElementById('action_view_displayMode_id')?.value ?? 'MathJax'],
['fileName', 'PGMLLab/PGML-lab.pg'],
['uriEncodedProblemSource', pgmlLabButton.dataset.source]
];

const user = document.getElementsByName('user')[0];
if (user) inputs.push(['user', user.value]);
const sessionKey = document.getElementsByName('key')[0];
if (sessionKey) inputs.push(['key', sessionKey.value]);

for (const [name, value] of inputs) {
const input = document.createElement('input');
input.name = name;
input.value = value;
input.type = 'hidden';
form.append(input);
}

document.body.append(form);
form.submit();
form.remove();
});
})();
4 changes: 2 additions & 2 deletions lib/WeBWorK/ConfigValues.pm
Original file line number Diff line number Diff line change
Expand Up @@ -545,8 +545,8 @@ sub getConfigValues ($ce) {
var => 'permissionLevels{report_bugs}',
doc => x('Can report bugs'),
doc2 => x(
'Users with at least this permission level get a link in the left panel for reporting bugs to the '
. 'bug tracking system at bugs.webwork.maa.org.'
'Users with at least this permission level get a link in the left panel for reporting issues at '
. 'github.com/openwebwork/webwork2.'
),
type => 'permission'
},
Expand Down
19 changes: 8 additions & 11 deletions templates/ContentGenerator/Instructor/PGProblemEditor.html.ep
Original file line number Diff line number Diff line change
Expand Up @@ -103,20 +103,19 @@
<div class="mb-2">
<%= link_to maketext('Sample Problems') => url_for('sample_problem_index'),
target => 'techniques_window',
title => maketext('POD for macros and sample problem code and snippets'),
class => 'reference-link btn btn-sm btn-info',
title => maketext('Sample problem code with documentation.'),
class => 'btn btn-sm btn-info',
data => { bs_toggle => 'tooltip', bs_placement => 'top' } =%>
% # http://webwork.maa.org/wiki/Category:MathObjects
<%= link_to maketext('Math Objects') => $ce->{webworkURLs}{MathObjectsHelpURL},
target => 'math_objects',
title => maketext('Wiki summary page for MathObjects'),
class => 'reference-link btn btn-sm btn-info',
class => 'btn btn-sm btn-info',
data => { bs_toggle => 'tooltip', bs_placement => 'top' } =%>
% # PG POD served locally
<%= link_to maketext('POD') => url_for('pod_index'),
target => 'pod_docs',
title => maketext('Documentation from source code for PG modules and macro files.'),
class => 'reference-link btn btn-sm btn-info',
class => 'btn btn-sm btn-info',
data => { bs_toggle => 'tooltip', bs_placement => 'top' } =%>
% # PGML lab problem rendered as an unattached problem in a new window.
% my $pgml_lab_source = readFile("$ce->{webworkDirs}{assets}/pg/PGMLLab/PGML-lab.pg");
Expand All @@ -125,15 +124,13 @@
'PG markdown syntax used to format WeBWorK questions. '
. 'This interactive lab can help you to learn the techniques.'
),
id => 'pgml-lab',
class => 'reference-link btn btn-sm btn-info',
data => { source => url_escape($pgml_lab_source), bs_toggle => 'tooltip', bs_placement => 'top' },
class => 'pgml-lab btn btn-sm btn-info',
data => { source => url_escape($pgml_lab_source), bs_toggle => 'tooltip', bs_placement => 'top' },
'PGML' =%>
% # http://webwork.maa.org/wiki/Category:Authors
<%= link_to maketext('Author Info') => $ce->{webworkURLs}{AuthorHelpURL},
target => 'author_info',
title => maketext('Top level of author information on the wiki.'),
class => 'reference-link btn btn-sm btn-info',
class => 'btn btn-sm btn-info',
data => { bs_toggle => 'tooltip', bs_placement => 'top' } =%>
% # Only show the report bugs in problem button if editing an OPL or Contrib problem.
% if ($ce->{webworkURLs}{OPLBugReporter}
Expand All @@ -152,7 +149,7 @@
. 'The very first time you do this you will need to register with an email address so that '
. 'information on the bug fix can be reported back to you.'
),
class => 'reference-link btn btn-sm btn-info',
class => 'btn btn-sm btn-info',
data => { bs_toggle => 'tooltip', bs_placement => 'top' } =%>
% }
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
%
<%= form_for current_route, method => 'POST', name => 'pg-editor-file-chooser',
class => 'needs-validation', novalidate => undef, begin =%>
<%= hidden_field courseID => $c->{courseID} =%>
<div class="row align-items-center mb-3">
<div class="col-auto">
<div class="form-check">
Expand Down
4 changes: 2 additions & 2 deletions templates/HelpFiles/InstructorFileManager.html.ep
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
. 'and are created when exporting a problem set from the "Sets Manager". Each set definition file '
. 'contains a list of problems used and the dates and times. These definitions can be imported into the '
. 'current course.',
'href="https://webwork.maa.org/wiki/Set_Definition_Files" target="Webworkdocs"') =%>
'href="https://wiki.openwebwork.org/wiki/Set_Definition_Files" target="Webworkdocs"') =%>
</dd>
<dt><%= maketext('Class list (".lst") files') %></dt>
<dd>
Expand All @@ -44,7 +44,7 @@
. 'ClassList files can be prepared using a spreadsheet and then saved as [_3] (comma separated values) '
. 'text files. However, to access as a classlist file, the file suffix needs to be changed to [_4], '
. 'which can be done with the "Rename" button.',
'href="http://webwork.maa.org/wiki/Classlist_Files#Format_of_classlist_files" target="Webworkdocs"',
'href="https://wiki.openwebwork.org/wiki/Classlist_Files#Format_of_classlist_files" target="Webworkdocs"',
'<code>demoCourse.lst</code>', '<code>.csv</code>', '<code>.lst</code>') =%>
</dd>
<dt><%= maketext('Scoring (".csv") files') %></dt>
Expand Down
34 changes: 10 additions & 24 deletions templates/HelpFiles/InstructorPGProblemEditor.html.ep
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@
<dd class="list-group-item">
<dl>
<dt>
<a href="https://webwork.maa.org/wiki/Category:Problem_Techniques" target="techniques_window">
<%= maketext('Problem Techniques') =%>
</a>
<%= link_to maketext('Sample Problems') => url_for('sample_problem_index'),
target => 'techniques_window' =%>
</dt>
<dd><%= maketext('This links to a list of problem authoring techniques.') %></dd>
<dd><%= maketext('Sample problem code with documentation.') %></dd>
<dt>
<a href="https://webwork.maa.org/wiki/Category:MathObjects" target="math_objects">
<a href="https://wiki.openwebwork.org/wiki/Category:MathObjects" target="math_objects">
<%= maketext('Math Objects') %>
</a>
</dt>
Expand All @@ -28,29 +27,16 @@
. 'macro files themselves.') =%>
</dd>
<dt>
% if (-e "$ce->{courseDirs}{templates}/PGMLLab/PGML-lab.pg") {
<%= link_to maketext('PGML') => $c->systemLink(
url_for('problem_detail', setID => 'Undefined_Set', problemID => 1),
params => {
displayMode => $ce->{pg}{options}{displayMode},
problemSeed => 1234,
editMode => 'temporaryFile',
sourceFilePath => 'PGMLLab/PGML-lab.pg'
}
),
target => 'PGML' =%>
% } else {
<a><%= maketext('PGML') %></a>
% }
<%= link_to PGML => '#', class => 'pgml-lab', target => 'PGML',
data => { source => url_escape(readFile("$ce->{webworkDirs}{assets}/pg/PGMLLab/PGML-lab.pg")) } =%>
</dt>
<dd>
<%= maketext('This links to a WeBWorK "problem" which allows you to try out fragments of PGML code. '
. 'This link will not be available if the file [_1] is not located in the templates directory of '
. 'the course.',
'PGMLLab/PGML-lab.pg') =%>
<%= maketext(
'This links to a WeBWorK "problem" which allows you to try out fragments of PGML code.'
) =%>
</dd>
<dt>
<a href="https://webwork.maa.org/wiki/Category:Authors" target="author_info">
<a href="https://wiki.openwebwork.org/wiki/Category:Authors" target="author_info">
<%= maketext('Author Info') %>
</a>
</dt>
Expand Down
2 changes: 1 addition & 1 deletion templates/HelpFiles/InstructorUserList.html.ep
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<dd>
<%== maketext('This is most easily done by importing a class list. The class list can be uploaded from your '
. 'workstation to the server using the File Manager page. The class list must be a file ending in .lst and '
. 'must have a specific <a href="http://webwork.maa.org/wiki/Classlist_Files#Format_of_classlist_files">'
. 'must have a specific <a href="https://wiki.openwebwork.org/wiki/Classlist_Files#Format_of_classlist_files">'
. 'format</a>. Once the file has been uploaded to the server the file will appear in the import action '
. 'pop-up list (5th action). demoCourse.lst is available for most courses and adds the "practice users" '
. 'which activate guest logins to the class list.') =%>
Expand Down
20 changes: 11 additions & 9 deletions templates/HelpFiles/instructor_links.html.ep
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<hr>
<%== maketext('The main page for WeBWorK documentation is the <a [_1]>webwork wiki</a> while specific help for '
. q{instructors setting up a course are in the <a [_2]>instructors' section</a>.},
'href="http://webwork.maa.org/wiki" target="ww_wiki"',
'href="http://webwork.maa.org/wiki/Instructors" target="ww_wiki"') =%>
'href="https://wiki.openwebwork.org/wiki" target="ww_wiki"',
'href="https://wiki.openwebwork.org/wiki/Instructors" target="ww_wiki"') =%>
<hr>

<dl>
Expand All @@ -24,14 +24,14 @@
<%= maketext('Edit class roster data. Add students, edit student data, drop students from class, import '
. 'students from a classlist, and give user professor privileges. Access to individual assignments.') =%>
</dd>
<dt><%= maketext('Assigner Tool') %></dt>
<dd><%= maketext('Assign and unassign selected exercise sets to selected users.') %></dd>
<dt><%= maketext('Sets Manager') %></dt>
<dd>
<%= maketext('Edit sets for the entire class. Change set due dates, create new sets from a set '
. 'definition file, create new sets, make sets visible/invisible, score assignments. Assign '
. 'sets to the class.') =%>
</dd>
<dt><%= maketext('Assigner Tool') %></dt>
<dd><%= maketext('Assign and unassign selected exercise sets to selected users.') %></dd>
<dt><%= maketext('Problem Editor') %></dt>
<dd><%= maketext('Write a new PG problem file or edit an existing one.') %></dd>
<dt><%= maketext('Library Browser') %></dt>
Expand All @@ -45,23 +45,25 @@
<%= maketext('Score one or more sets. This can also be done from the "Sets Manager" or from the '
. '"Instructor Tools", but the "Scoring Tools" page allows control over parameters.') =%>
</dd>
<dt><%= maketext('LTI Grade Update') %></dt>
<dd>
<%= maketext('Manually initiate an LTI grade passback for selected sets or users. This link is only visible '
. 'if LTI grade passback is enabled for the course.') =%>
</dd>
<dt><%= maketext('Achievements Manager') %></dt>
<dd>
<%= maketext('Edit achivements for the course. This link is only present if achievements '
. 'are enabled for the course.') =%>
</dd>
<dt><%= maketext('Email') %></dt>
<dd><%= maketext('Send email to students.') %></dd>
<dt><%= maketext('Job Manager') %></dt>
<dd><%= maketext('View and manage jobs in the job queue.') %></dd>
<dt><%= maketext('File Manager') %></dt>
<dd>
<%= maketext('Upload, download and delete text files, including scoring spread sheets, set definition files, '
. 'class list spread sheets, and "PG" problems.') =%>
</dd>
<dt><%= maketext('LTI Grade Update') %></dt>
<dd>
<%= maketext('Manually initiate an LTI grade passback for selected sets or users. This link is only visible '
. 'if LTI grade passback is enabled for the course.') =%>
</dd>
<dt><%= maketext('Course Configuration') %></dt>
<dd>
<%= maketext('Allows configuration of certain parameters, such as permission levels, default display mode for '
Expand Down