View | Details | Raw Unified | Return to bug 6874
Collapse All | Expand All

(-)a/cataloguing/value_builder/upload.pl (-2 / +12 lines)
Lines 49-55 sub plugin_javascript { Link Here
49
            if(id.match(/id=([0-9a-f]+)/)){
49
            if(id.match(/id=([0-9a-f]+)/)){
50
                id = RegExp.\$1;
50
                id = RegExp.\$1;
51
            }
51
            }
52
            window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=upload.pl&index=\"+index+\"&id=\"+id, 'upload', 'width=600,height=400,toolbar=false,scrollbars=no');
52
            var newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=upload.pl&index=\"+index+\"&id=\"+id+\"&from_popup=0\", 'upload', 'width=600,height=400,toolbar=false,scrollbars=no');
53
            newin.focus();
53
54
54
        }
55
        }
55
    </script>
56
    </script>
Lines 64-69 sub plugin { Link Here
64
    my $id = $input->param('id');
65
    my $id = $input->param('id');
65
    my $delete = $input->param('delete');
66
    my $delete = $input->param('delete');
66
    my $uploaded_file = $input->param('uploaded_file');
67
    my $uploaded_file = $input->param('uploaded_file');
68
    my $from_popup = $input->param('from_popup');
67
69
68
    my $template_name = ($id || $delete)
70
    my $template_name = ($id || $delete)
69
                    ? "upload_delete_file.tt"
71
                    ? "upload_delete_file.tt"
Lines 129-142 sub plugin { Link Here
129
            $template->param( error_upload_path_not_configured => 1 );
131
            $template->param( error_upload_path_not_configured => 1 );
130
        }
132
        }
131
133
134
        if (!$uploaded_file && !$dir && $from_popup) {
135
            print STDERR "$uploaded_file - $dir - $from_popup\n";
136
            $template->param(error_nothing_selected => 1);
137
        }
138
        elsif (!$uploaded_file && $dir) {
139
            $template->param(error_no_file_selected => 1);
140
        }
132
        if ($uploaded_file and not $dir) {
141
        if ($uploaded_file and not $dir) {
133
            $template->param(error_no_dir_selected => 1);
142
            $template->param(error_no_dir_selected => 1);
134
        }
143
        }
144
135
    }
145
    }
136
146
137
    $template->param(
147
    $template->param(
138
        index => $index,
148
        index => $index,
139
        id => $id
149
        id => $id,
140
    );
150
    );
141
151
142
    output_html_with_http_headers $input, $cookie, $template->output;
152
    output_html_with_http_headers $input, $cookie, $template->output;
(-)a/installer/data/mysql/kohastructure.sql (-1 / +2 lines)
Lines 3198-3209 CREATE TABLE IF NOT EXISTS `borrower_modifications` ( Link Here
3198
  PRIMARY KEY (`verification_token`,`borrowernumber`),
3198
  PRIMARY KEY (`verification_token`,`borrowernumber`),
3199
  KEY `verification_token` (`verification_token`),
3199
  KEY `verification_token` (`verification_token`),
3200
  KEY `borrowernumber` (`borrowernumber`)
3200
  KEY `borrowernumber` (`borrowernumber`)
3201
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
3201
3202
3202
--
3203
--
3203
-- Table structure for table uploaded_files
3204
-- Table structure for table uploaded_files
3204
--
3205
--
3205
3206
3206
DROP TABLE IF EXISTS uploaded_files
3207
DROP TABLE IF EXISTS uploaded_files;
3207
CREATE TABLE uploaded_files (
3208
CREATE TABLE uploaded_files (
3208
    id CHAR(40) NOT NULL PRIMARY KEY,
3209
    id CHAR(40) NOT NULL PRIMARY KEY,
3209
    filename TEXT NOT NULL,
3210
    filename TEXT NOT NULL,
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/upload.tt (-15 / +36 lines)
Lines 7-24 Link Here
7
    <script type="text/javascript" src="[% interface %]/lib/jquery/jquery.js"></script>
7
    <script type="text/javascript" src="[% interface %]/lib/jquery/jquery.js"></script>
8
    <link rel="stylesheet" type="text/css" href="[% themelang %]/css/staff-global.css" />
8
    <link rel="stylesheet" type="text/css" href="[% themelang %]/css/staff-global.css" />
9
    <script type="text/javascript">
9
    <script type="text/javascript">
10
      function _(s) { return s; }
10
      function ValidateForm() {
11
      $(document).ready(function() {
11
        var filename = document.forms["UploadForm"]["uploaded_file"].value;
12
        var selected = 0;
13
        var value;
12
        $('form').each(function() {
14
        $('form').each(function() {
13
          $(this).submit(function() {
15
          value = $(this).find('input[type="radio"][name="dir"]:checked').val();
14
            var value = $(this).find('input[type="radio"][name="dir"]:checked').val();
16
          if (value) {
15
            if (!value) {
17
            selected = 1;
16
              alert(_("Please select the destination of file"));
18
          }
17
              return false;
19
        });
18
            }
20
        if (!filename && !selected) {
19
          });
21
          alert("Please select a file and its destination.");
20
        })
22
          return false;
21
      });
23
        }
24
        else if (!filename) {
25
          alert("Please select a file to upload.");
26
          return false;
27
        }
28
        else if (!selected) {
29
          alert("Please select a file destination.");
30
          return false;
31
        }
32
        else {
33
          return true;
34
        }
35
      }
22
    </script>
36
    </script>
23
37
24
</head>
38
</head>
Lines 73-89 Link Here
73
          <p>Configuration variable 'upload_path' is not configured.</p>
87
          <p>Configuration variable 'upload_path' is not configured.</p>
74
          <p>Please configure it in your koha-conf.xml</p>
88
          <p>Please configure it in your koha-conf.xml</p>
75
        [% ELSE %]
89
        [% ELSE %]
90
          [% IF (error_nothing_selected) %]
91
              <p class="error">Error: You have to choose the file to upload and select where to upload the file.<p>
92
          [% END %]
93
          [% IF (error_no_file_selected) %]
94
              <p class="error">Error: You have to choose the file to upload.<p>
95
          [% END %]
76
          [% IF (error_no_dir_selected) %]
96
          [% IF (error_no_dir_selected) %]
77
              <p class="error">Error: You have to select the destination of uploaded file.<p>
97
              <p class="error">Error: You have to select where to upload the file.<p>
78
          [% END %]
98
          [% END %]
79
          <h2>Please select the file to upload : </h2>
99
          <h2>Please select the file to upload : </h2>
80
          <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/cataloguing/plugin_launcher.pl">
100
          <form name="UploadForm" method="post" enctype="multipart/form-data" action="/cgi-bin/koha/cataloguing/plugin_launcher.pl" onsubmit="return ValidateForm()">
81
              [% filefield %]
101
              [% filefield %]
82
              <h3>Choose where to upload file</h3>
102
              <h3>Choose where to upload the file</h3>
83
              [% INCLUDE list_dirs dirs = dirs_tree %]
103
              [% INCLUDE list_dirs dirs = dirs_tree %]
104
              <input type="hidden" name="from_popup" value="1" />
84
              <input type="hidden" name="plugin_name" value="upload.pl" />
105
              <input type="hidden" name="plugin_name" value="upload.pl" />
85
              <input type="hidden" name="index" value="[% index %]" />
106
              <input type="hidden" name="index" value="[% index %]" />
86
              <input type="submit">
107
              <input type="submit" value="Upload file">
87
          </form>
108
          </form>
88
        [% END %]
109
        [% END %]
89
    [% END %]
110
    [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/upload_delete_file.tt (-2 / +1 lines)
Lines 4-10 Link Here
4
<head>
4
<head>
5
    <title>Upload plugin</title>
5
    <title>Upload plugin</title>
6
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7
    <script type="text/javascript" src="[% themelang %]/lib/jquery/jquery.js"></script>
7
    <script type="text/javascript" src="[% interface %]/lib/jquery/jquery.js"></script>
8
    <link rel="stylesheet" type="text/css" href="[% themelang %]/css/staff-global.css" />
8
    <link rel="stylesheet" type="text/css" href="[% themelang %]/css/staff-global.css" />
9
    <script type="text/javascript">
9
    <script type="text/javascript">
10
        //<![CDATA[
10
        //<![CDATA[
11
- 

Return to bug 6874