/lenasys/trunk

To get this branch, use:
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
		
64.1.1 by b11johgu
ExamplesController:
10
		url: '../../../uploadfile/'+$('input[name="cid"]').val()+'/'+$('input[name="example"]').val()+'/'+$('input[name="page"]').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()">';
20
			html += "</div>";
21
			$('#filelist').append(html);
20.1.1 by galaxyAbstractor
* Added an simple admin panel to the codeviewer-cmssy stuff
22
23
		},
24
		
25
    	error: function(err, file) {
26
			switch(err) {
27
				case 'BrowserNotSupported':
28
					showMessage('Your browser does not support HTML5 file uploads!');
29
					break;
30
				default:
31
					break;
32
			}
33
		},
34
		
35
		// Called before each upload is started
36
		beforeEach: function(file){
37
			
38
		},
39
		
40
		uploadStarted:function(i, file, len){
41
			
42
		},
43
		
44
		progressUpdated: function(i, file, progress) {
45
			$('.progress').width(progress);
46
		}
47
    	 
48
	});
49
	
50
51
	function showMessage(msg){
52
		message.html(msg);
53
	}
54
23.1.2 by galaxyAbstractor
Fixed database stuff, added files to database.
55
});
56
57
function fileupdated(){
58
	var fileinfo = [];
59
	$('.file').each(function() {
60
		inputs = $(this).find("input");
64.1.1 by b11johgu
ExamplesController:
61
		fileinfo.push({"filename":inputs.get(0).value, "lang": inputs.get(1).value, "type": inputs.get(2).value});
23.1.2 by galaxyAbstractor
Fixed database stuff, added files to database.
62
	});
63
	$("input[name='files']").val(JSON.stringify(fileinfo));
64.1.1 by b11johgu
ExamplesController:
64
}