);
# Dealing with the uploaded file
- if ($uploaded_file) {
+ my $dir = $input->param('dir');
+ if ($uploaded_file and $dir) {
my $fh = $input->upload('uploaded_file');
- my $dir = $input->param('dir');
$id = C4::UploadedFiles::UploadFile($uploaded_file, $dir, $fh->handle);
if($id) {
} else {
$template->param( error_upload_path_not_configured => 1 );
}
+
+ if ($uploaded_file and not $dir) {
+ $template->param(error_no_dir_selected => 1);
+ }
}
$template->param(
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="[% interface %]/lib/jquery/jquery.js"></script>
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/staff-global.css" />
+ <script type="text/javascript">
+ function _(s) { return s; }
+ $(document).ready(function() {
+ $('form').each(function() {
+ $(this).submit(function() {
+ var value = $(this).find('input[type="radio"][name="dir"]:checked').val();
+ if (!value) {
+ alert(_("Please select the destination of file"));
+ return false;
+ }
+ });
+ })
+ });
+ </script>
</head>
<body>
<p>Configuration variable 'upload_path' is not configured.</p>
<p>Please configure it in your koha-conf.xml</p>
[% ELSE %]
+ [% IF (error_no_dir_selected) %]
+ <p class="error">Error: You have to select the destination of uploaded file.<p>
+ [% END %]
<h2>Please select the file to upload : </h2>
<form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/cataloguing/plugin_launcher.pl">
[% filefield %]