Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the AppletObjects.pl macro for changes in the ADD_JS_FILE usage #549

Merged
merged 2 commits into from
Mar 22, 2021
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
8 changes: 4 additions & 4 deletions macros/AppletObjects.pl
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ =head1 DESCRIPTION

# Add basic functionality to the header of the question
sub _AppletObjects_init{
ADD_JS_FILE("apps/Base64/Base64.js", 1);
ADD_JS_FILE("apps/AppletSupport/ww_applet_support.js", 1);
ADD_JS_FILE("js/apps/Base64/Base64.js");
ADD_JS_FILE("js/apps/AppletSupport/ww_applet_support.js");
};

=head3 FlashApplet
Expand All @@ -39,7 +39,7 @@ =head3 FlashApplet
=cut

sub FlashApplet {
ADD_JS_FILE("apps/AppletSupport/AC_RunActiveContent.js", 1);
ADD_JS_FILE("js/apps/AppletSupport/AC_RunActiveContent.js");
return new FlashApplet(@_);
}

Expand Down Expand Up @@ -70,7 +70,7 @@ =head3 GeogebraWebApplet
=cut

sub GeogebraWebApplet {
ADD_JS_FILE("//web.geogebra.org/4.4/web/web.nocache.js", 0);
ADD_JS_FILE("//web.geogebra.org/4.4/web/web.nocache.js", 1);
return new GeogebraWebApplet(@_);
}

Expand Down
45 changes: 36 additions & 9 deletions macros/PG.pl
Original file line number Diff line number Diff line change
Expand Up @@ -173,19 +173,46 @@ sub SET_PROBLEM_TEXTDIRECTION {
}
}

# Request that the problem HTML page also include additional CSS files
# from the webwork2/htdocs/css/ directory.
=head4 ADD_CSS_FILE

Request that the problem HTML page also include additional CSS files
from the webwork2/htdocs/ directory or from an external location.

ADD_CSS_FILE($file, $external);

If external is 1, it is assumed the full url is provided. If external is 0 or
not given, then file name will be prefixed with the webwork2/htdocs/ directory.
For example:

ADD_CSS_FILE("css/rtl.css");
ADD_CSS_FILE("https://external.domain.com/path/to/file.css", 1);

=cut

sub ADD_CSS_FILE {
my $file = shift;
push(@{$PG->{flags}{extra_css_files}}, $file);
my ($file, $external) = shift;
push(@{$PG->{flags}{extra_css_files}}, { file => $file, external => $external });
}

# Request that the problem HTML page also include additional JS files.
# If local is 1 the given file name will be prefixed with the webwork2/htdocs/js/ directory,
# otherwise it is assumed the full url is provided.
=head4 ADD_JS_FILE

Request that the problem HTML page also include additional JS files
from the webwork2/htdocs/ directory or from an external location.

ADD_JS_FILE($file, $external);

If external is 1, it is assumed the full url is provided. If external is 0 or
not given, then file name will be prefixed with the webwork2/htdocs/ directory.
For example:

ADD_JS_FILE("js/apps/Base64/Base64.js");
ADD_JS_FILE("//web.geogebra.org/4.4/web/web.nocache.js", 1);

=cut

sub ADD_JS_FILE {
my ($file, $local) = @_;
push(@{$PG->{flags}{extra_js_files}}, { file => $file, local => $local });
my ($file, $external) = @_;
push(@{$PG->{flags}{extra_js_files}}, { file => $file, external => $external });
}

sub AskSage {
Expand Down