/lenasys/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/lenasys/trunk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
$(function(){

	var dropbox = $('#dropbox'),
		message = $('.message', dropbox);
	
	dropbox.filedrop({
		// The name of the $_FILES entry:
		paramname:'files',
		
		url: '../../../uploadfile/'+$('input[name="cid"]').val()+'/'+$('input[name="example"]').val()+'/'+$('input[name="page"]').val(),
		
		uploadFinished:function(i,file,response){
			$('.progress').addClass('done');
			html = "";
			html += '<div class="file">';
			html += "<strong>"+file.name+"</strong>";
			html += '<input type="hidden" value="'+file.name+'">';
			html += '<label>Language</label><input type="text" name="'+file.name.replace(/\s/g,"")+'_lang" onChange="fileupdated()">';
			html += '<label>Type</label><input type="text"  name="'+file.name.replace(/\s/g,"")+'_type" onChange="fileupdated()">';
			html += "</div>";
			$('#filelist').append(html);

		},
		
    	error: function(err, file) {
			switch(err) {
				case 'BrowserNotSupported':
					showMessage('Your browser does not support HTML5 file uploads!');
					break;
				default:
					break;
			}
		},
		
		// Called before each upload is started
		beforeEach: function(file){
			
		},
		
		uploadStarted:function(i, file, len){
			
		},
		
		progressUpdated: function(i, file, progress) {
			$('.progress').width(progress);
		}
    	 
	});
	

	function showMessage(msg){
		message.html(msg);
	}

});

function fileupdated(){
	var fileinfo = [];
	$('.file').each(function() {
		inputs = $(this).find("input");
		fileinfo.push({"filename":inputs.get(0).value, "lang": inputs.get(1).value, "type": inputs.get(2).value});
	});
	$("input[name='files']").val(JSON.stringify(fileinfo));
}