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

Add zip to archives in File Manager #2163

Merged
merged 23 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
4f72e38
Add zip capability to archiving/unarchiving in File Manager
pstaabp Aug 8, 2023
b42783c
replace call to zip with perl packages and include make archive
pstaabp Aug 10, 2023
f5182e8
update check_modules and add new UI for archive
pstaabp Aug 10, 2023
7c829e6
Fixes and improvements for the new "Make Archive" page.
drgrice1 Aug 15, 2023
b90a466
Switch to using the Archive::Zip::SimpleZip module for creating zip a…
drgrice1 Aug 16, 2023
e7b1b0a
Changes selecting files to Mojo::File and other fixes.
pstaabp Aug 16, 2023
c854a71
Fix the broken stuff.
drgrice1 Aug 16, 2023
9b38a06
Tweaks to the file manager make archive page.
pstaabp Aug 24, 2023
0f304cd
Suggested code updates
pstaabp Aug 25, 2023
3e4a523
Switch archive type from radio button to select
pstaabp Aug 25, 2023
8e302d9
Some accessibility changes to the archive type select
pstaabp Aug 28, 2023
43b82fe
Add text-end to archive file name input, File Type -> Archive Type
pstaabp Aug 28, 2023
3dd5496
Change the way that the archive type is determined.
drgrice1 Aug 28, 2023
c565bbb
Merge pull request #47 from drgrice1/add-zip-to-archives-type-rework
pstaabp Aug 30, 2023
4619b32
Validate the archive filename.
drgrice1 Aug 30, 2023
2121dd1
Merge pull request #48 from drgrice1/add-zip-to-archives-filename-val…
pstaabp Aug 31, 2023
2852dcb
Switch to using `Archive::Zip` and `Archive::Tar` to extract archives.
drgrice1 Sep 3, 2023
35c62a4
Merge pull request #49 from drgrice1/add-zip-to-archives-safe
pstaabp Sep 4, 2023
f351e9b
Changed the error handling to report number of existing and outside f…
pstaabp Sep 4, 2023
97a8263
Fix messages for existing files or files outside the course directory.
drgrice1 Sep 4, 2023
1e17baf
Merge pull request #50 from drgrice1/add-zip-to-archives-message-fix
pstaabp Sep 6, 2023
7b50a49
Add the .zip extension when a single file or directory without extens…
drgrice1 Sep 14, 2023
508a710
Merge pull request #51 from drgrice1/add-zip-to-archives-extension-fix
pstaabp Sep 19, 2023
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
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ RUN apt-get update \
imagemagick \
iputils-ping \
jq \
libarchive-extract-perl \
libarchive-zip-perl \
libarray-utils-perl \
libc6-dev \
Expand Down Expand Up @@ -184,7 +185,7 @@ RUN apt-get update \
# ==================================================================
# Phase 4 - Install additional Perl modules from CPAN that are not packaged for Ubuntu or are outdated in Ubuntu.

RUN cpanm install Statistics::R::IO DBD::MariaDB Mojo::SQLite@3.002 Perl::Tidy@20220613 \
RUN cpanm install Statistics::R::IO DBD::MariaDB Mojo::SQLite@3.002 Perl::Tidy@20220613 Archive::Zip::SimpleZip \
&& rm -fr ./cpanm /root/.cpanm /tmp/*

# ==================================================================
Expand Down
3 changes: 2 additions & 1 deletion DockerfileStage1
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ RUN apt-get update \
imagemagick \
iputils-ping \
jq \
libarchive-extract-perl \
libarchive-zip-perl \
libarray-utils-perl \
libc6-dev \
Expand Down Expand Up @@ -146,7 +147,7 @@ RUN apt-get update \
# ==================================================================
# Phase 3 - Install additional Perl modules from CPAN that are not packaged for Ubuntu or are outdated in Ubuntu.

RUN cpanm install -n Statistics::R::IO DBD::MariaDB Mojo::SQLite@3.002 Perl::Tidy@20220613 \
RUN cpanm install -n Statistics::R::IO DBD::MariaDB Mojo::SQLite@3.002 Perl::Tidy@20220613 Archive::Zip::SimpleZip \
&& rm -fr ./cpanm /root/.cpanm /tmp/*

# ==================================================================
1 change: 1 addition & 0 deletions bin/check_modules.pl
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ =head1 DESCRIPTION

my @modulesList = qw(
Archive::Zip
Archive::Zip::SimpleZip
Array::Utils
Benchmark
Carp
Expand Down
2 changes: 1 addition & 1 deletion conf/site.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ $externalPrograms{rm} = "/bin/rm";
$externalPrograms{mkdir} = "/bin/mkdir";
$externalPrograms{tar} = "/bin/tar";
$externalPrograms{gzip} = "/bin/gzip";
$externalPrograms{git} = "/usr/bin/git";
$externalPrograms{git} = "/usr/bin/git";

####################################################
# equation rendering/hardcopy utiltiies
Expand Down
15 changes: 14 additions & 1 deletion htdocs/js/FileManager/filemanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
if (
numSelected === 0 ||
numSelected > 1 ||
!/\.(tar|tar\.gz|tgz)$/.test(files.children[files.selectedIndex].value)
!/\.(tar|tar\.gz|tgz|zip)$/.test(files.children[files.selectedIndex].value)
)
archiveButton.value = archiveButton.dataset.archiveText;
else archiveButton.value = archiveButton.dataset.unarchiveText;
Expand All @@ -45,6 +45,19 @@
files?.addEventListener('change', checkFiles);
if (files) checkFiles();

const archiveFilenameInput = document.getElementById('archive-filename');
const archiveTypeSelect = document.getElementById('archive-type');
if (archiveFilenameInput && archiveTypeSelect) {
archiveTypeSelect.addEventListener('change', () => {
if (archiveTypeSelect.value) {
archiveFilenameInput.value = archiveFilenameInput.value.replace(
/\.(zip|tgz|tar.gz)$/,
`.${archiveTypeSelect.value}`
);
}
});
}

const file = document.getElementById('file');
const uploadButton = document.getElementById('Upload');
const checkFile = () => (uploadButton.disabled = file.value === '');
Expand Down
2 changes: 1 addition & 1 deletion htdocs/themes/math4/math4.scss
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ h2.page-title {
gap: 0.25rem;
margin: 0 0 0.5rem;

p {
div {
margin: 0;
}
}
Expand Down
6 changes: 4 additions & 2 deletions lib/WeBWorK/ContentGenerator.pm
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,9 @@ message() template escape handler.

sub addgoodmessage ($c, $message) {
$c->addmessage($c->tag(
'p',
'div',
class => 'alert alert-success alert-dismissible fade show ps-1 py-1',
role => 'alert',
$c->c(
$message,
$c->tag(
Expand All @@ -290,8 +291,9 @@ message() template escape handler.

sub addbadmessage ($c, $message) {
$c->addmessage($c->tag(
'p',
'div',
class => 'alert alert-danger alert-dismissible fade show ps-1 py-1',
role => 'alert',
$c->c(
$message,
$c->tag(
Expand Down
Loading