Subversion Repositories bacoAlunos

Rev

Rev 1312 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
223 jmachado 1
<%--
2
  Created by IntelliJ IDEA.
3
  User: Jorge
4
  Date: 9/Jul/2008
5
  Time: 16:52:37
6
  To change this template use File | Settings | File Templates.
7
--%>
8
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
1353 jmachado 9
<jsp:useBean id="CourseUnitView" type="pt.estgp.estgweb.domain.views.CourseUnitView" scope="request"/>
10
<script>
11
    var jsonFiles = JSON.parse('${CourseUnitView.courseUnit.filesJson}');
12
    function searchFilesUnit(){
13
        $(".searchResults").html("<div class=\"files\"><table></table></div>");
14
        var text =  $("#searchFiles").val().toLowerCase();
15
        jsonFiles.forEach(function(item){
16
            if (item.filename.toLowerCase().search(text) != -1) {
17
                $(".searchResults .files table").append(
18
                        "<tr class=\"file\">" +
19
                                "<td>" +
20
                                    "<img src=\"<%=request.getContextPath()%>/imgs/mime/" + item.extension +".gif\"/>" +
21
                                    " <a href=\"<%=request.getContextPath()%>/ftpProxyStream/ionline" + item.fileCompletePathEncoded + "\">" +
22
                                        item.file +
23
                                    "</a>"+
24
                                "</td>" +
25
                                "<td>" + item.lastmodifieddate + "</td>" +
26
                                "<td>" + item.size + "</td>" +
27
                        "</tr>"
1312 jmachado 28
 
1353 jmachado 29
                );
30
            }
31
        });
32
    }
33
    $(document).ready(
34
            function(){
35
                $(".ftpClientPanel .panel-heading").append(
36
                    "<span class=\"pull-right\"><input type=\"text\" id=\"searchFiles\"><button class=\"btn btn-default\" id=\"searchFilesBtn\" type=\"button\"><span class=\"glyphicon glyphicon-search\"></button></span>"
37
 
38
                );
39
                $(".ftpClientPanel .panel-heading").after(
40
                        "<div class=\"panel-body searchResults\"></div>"
41
                );
42
 
43
                $("#searchFilesBtn").click(searchFilesUnit);
44
                $('#searchFiles').bind("keypress", function(e) {
45
                    if (e.keyCode == 13) {
46
                        searchFilesUnit();
47
                    }
48
                });
49
            }
50
    );
51
</script>
1312 jmachado 52
<jsp:include page="/user/ftpclient/ftpclient.jsp"/>