/lenasys/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/lenasys/trunk

« back to all changes in this revision

Viewing changes to codeigniter/js/script.js

  • Committer: a11andoh
  • Date: 2013-05-31 06:21:54 UTC
  • mfrom: (135 lenasys_b)
  • mto: This revision was merged to the branch mainline in revision 137.
  • Revision ID: a11andoh@student.his.se-20130531062154-x18nki8dufjub99h
blurp

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
                
 
10
                url: '../../../uploadfile/'+$('input[name="cid"]').val()+'/'+$('input[name="example"]').val()+'/'+$('input[name="page"]').val(),
 
11
                
 
12
                uploadFinished:function(i,file,response){
 
13
                        $('.progress').addClass('done');
 
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);
 
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
 
 
55
});
 
56
 
 
57
function fileupdated(){
 
58
        var fileinfo = [];
 
59
        $('.file').each(function() {
 
60
                inputs = $(this).find("input");
 
61
                fileinfo.push({"filename":inputs.get(0).value, "lang": inputs.get(1).value, "type": inputs.get(2).value});
 
62
        });
 
63
        $("input[name='files']").val(JSON.stringify(fileinfo));
 
64
}
 
 
b'\\ No newline at end of file'