www/js/import_ingredients.js

changeset 818
f9c071906643
parent 817
6ee186182c70
child 819
d759d9ed357e
equal deleted inserted replaced
817:6ee186182c70 818:f9c071906643
1 /*****************************************************************************
2 * Copyright (C) 2019
3 *
4 * Michiel Broek <mbroek at mbse dot eu>
5 *
6 * This file is part of BMS
7 *
8 * This is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2, or (at your option) any
11 * later version.
12 *
13 * BrewCloud is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with ThermFerm; see the file COPYING. If not, write to the Free
20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
21 *****************************************************************************/
22
23
24 $(document).ready(function() {
25
26 var url = '';
27
28 if (my_select == 'fermentables')
29 url = 'upl_fermentables.php';
30 else if (my_select == 'hops')
31 url = 'upl_hops.php';
32 else if (my_select == 'miscs')
33 url = 'upl_miscs.php';
34 else if (my_select == 'yeasts')
35 url = 'upl_yeasts.php';
36 else if (my_select == 'styles')
37 url = 'upl_styles.php';
38
39 $('#jqxFileUpload').jqxFileUpload({
40 width: 300,
41 browseTemplate: 'success',
42 cancelTemplate: 'inverse',
43 uploadTemplate: 'primary',
44 theme: theme,
45 multipleFilesUpload: false,
46 accept: 'application/xml',
47 uploadUrl: url,
48 fileInputName: 'fileToUpload'
49 });
50 $('#eventsPanel').jqxPanel({
51 width: 800,
52 height: 200,
53 theme: theme
54 });
55 $('#jqxFileUpload').on('select', function(event) {
56 var args = event.args,
57 fileName = args.file,
58 fileSize = args.size;
59 $('#eventsPanel').jqxPanel('clearcontent');
60 $('#eventsPanel').jqxPanel('append', '<strong>' + event.type + ':</strong> ' + fileName + ' size: ' + fileSize + '<br />');
61 });
62 $('#jqxFileUpload').on('uploadEnd', function(event) {
63 var args = event.args,
64 fileName = args.file,
65 serverResponce = args.response;
66 $('#eventsPanel').jqxPanel('append', '<strong>' + event.type + ':</strong> ontvangen ' + fileName + '<br />' + serverResponce + '<br />');
67 });
68
69 });

mercurial