bzr branch
http://gegoxaren.bato24.eu/bzr/lenasys/trunk
|
20.1.1
by galaxyAbstractor
* Added an simple admin panel to the codeviewer-cmssy stuff |
1 |
$(function(){ |
2 |
||
3 |
var dropbox = $('#dropbox'), |
|
4 |
message = $('.message', dropbox); |
|
5 |
|
|
6 |
dropbox.filedrop({ |
|
7 |
// The name of the $_FILES entry: |
|
8 |
paramname:'files', |
|
9 |
|
|
|
53.1.1
by galaxyAbstractor
fixed adminpanel and codeviewer a bit |
10 |
url: '../../../../uploadfile/'+$('input[name="cid"]').val()+'/'+$('input[name="category"]').val()+'/'+$('input[name="subcategory"]').val()+'/'+$('input[name="example"]').val(), |
|
20.1.1
by galaxyAbstractor
* Added an simple admin panel to the codeviewer-cmssy stuff |
11 |
|
12 |
uploadFinished:function(i,file,response){ |
|
13 |
$('.progress').addClass('done'); |
|
|
23.1.2
by galaxyAbstractor
Fixed database stuff, added files to database. |
14 |
html = ""; |
15 |
html += '<div class="file">'; |
|
16 |
html += "<strong>"+file.name+"</strong>"; |
|
17 |
html += '<input type="hidden" value="'+file.name+'">'; |
|
18 |
html += '<label>Language</label><input type="text" name="'+file.name.replace(/\s/g,"")+'_lang" onChange="fileupdated()">'; |
|
19 |
html += '<label>Type</label><input type="text" name="'+file.name.replace(/\s/g,"")+'_type" onChange="fileupdated()">'; |
|
|
53.1.1
by galaxyAbstractor
fixed adminpanel and codeviewer a bit |
20 |
html += '<label>Column</label><select name="'+file.name.replace(/\s/g,"")+'_type" onChange="fileupdated()"><option>1</option><option selected>2</option></select>'; |
|
23.1.2
by galaxyAbstractor
Fixed database stuff, added files to database. |
21 |
html += "</div>"; |
22 |
$('#filelist').append(html); |
|
|
20.1.1
by galaxyAbstractor
* Added an simple admin panel to the codeviewer-cmssy stuff |
23 |
|
24 |
}, |
|
25 |
|
|
26 |
error: function(err, file) { |
|
27 |
switch(err) { |
|
28 |
case 'BrowserNotSupported': |
|
29 |
showMessage('Your browser does not support HTML5 file uploads!'); |
|
30 |
break; |
|
31 |
default: |
|
32 |
break; |
|
33 |
} |
|
34 |
}, |
|
35 |
|
|
36 |
// Called before each upload is started |
|
37 |
beforeEach: function(file){ |
|
38 |
|
|
39 |
}, |
|
40 |
|
|
41 |
uploadStarted:function(i, file, len){ |
|
42 |
|
|
43 |
}, |
|
44 |
|
|
45 |
progressUpdated: function(i, file, progress) { |
|
46 |
$('.progress').width(progress); |
|
47 |
} |
|
48 |
|
|
49 |
}); |
|
50 |
|
|
51 |
||
52 |
function showMessage(msg){ |
|
53 |
message.html(msg); |
|
54 |
} |
|
55 |
||
|
50.1.1
by galaxyAbstractor
Started implementing categories and a menu |
56 |
|
57 |
||
|
23.1.2
by galaxyAbstractor
Fixed database stuff, added files to database. |
58 |
});
|
59 |
||
60 |
function fileupdated(){ |
|
61 |
var fileinfo = []; |
|
62 |
$('.file').each(function() { |
|
63 |
inputs = $(this).find("input"); |
|
|
53.1.1
by galaxyAbstractor
fixed adminpanel and codeviewer a bit |
64 |
selects = $(this).find("select"); |
65 |
fileinfo.push({"filename":inputs.get(0).value, "lang": inputs.get(1).value, "type": inputs.get(2).value, "columnNr": selects.get(0).value}); |
|
|
23.1.2
by galaxyAbstractor
Fixed database stuff, added files to database. |
66 |
}); |
67 |
$("input[name='files']").val(JSON.stringify(fileinfo)); |
|
68 |
}
|