Bug 22990: Add CSRF protection to boraccount, pay and suggestion
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / members / files.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE KohaDates %]
4 [% USE Branches %]
5 [% USE AuthorisedValues %]
6 [% SET footerjs = 1 %]
7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>Files for [% INCLUDE 'patron-title.inc' no_html = 1 %]</title>
9 [% INCLUDE 'doc-head-close.inc' %]
10 </head>
11
12 <body id="pat_files" class="pat">
13 [% WRAPPER 'header.inc' %]
14     [% INCLUDE 'patron-search-header.inc' %]
15 [% END %]
16
17 [% WRAPPER 'sub-header.inc' %]
18     [% WRAPPER breadcrumbs %]
19         [% WRAPPER breadcrumb_item %]
20             <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>
21         [% END %]
22         [% WRAPPER breadcrumb_item %]
23             <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% INCLUDE 'patron-title.inc' %]</a>
24         [% END %]
25         [% WRAPPER breadcrumb_item bc_active= 1 %]
26             <span>Files</span>
27         [% END %]
28     [% END #/ WRAPPER breadcrumbs %]
29 [% END #/ WRAPPER sub-header.inc %]
30
31 <div class="main container-fluid">
32     <div class="row">
33         <div class="col-sm-10 col-sm-push-2">
34             <main>
35
36                 [% INCLUDE 'members-toolbar.inc' %]
37
38                 <h1>Files</h1>
39
40                 [% IF errors %]
41                     <div class="dialog alert">
42                         [% IF errors.empty_upload %]The file you are attempting to upload has no contents.[% END %]
43                         [% IF errors.no_file %]You did not select a file to upload.[% END %]
44                     </div>
45                 [% END %]
46
47                 [% IF ( files ) %]
48                     <div class="page-section">
49                         <table>
50                             <thead>
51                                 <tr>
52                                     <th>Name</th>
53                                     <th>Type</th>
54                                     <th>Description</th>
55                                     <th>Uploaded</th>
56                                     [% IF CAN_user_borrowers_edit_borrowers %]<th>&nbsp;</th>[% END %]
57                                 </tr>
58                             </thead>
59
60                             <tbody>
61                                 [% FOREACH f IN files %]
62                                     <tr>
63                                         <td><a href="?borrowernumber=[% patron.borrowernumber | uri %]&amp;op=download&amp;file_id=[% f.file_id | uri %]">[% f.file_name | html %]</a></td>
64                                         <td>[% f.file_type | html %]</td>
65                                         <td>[% f.file_description | html %]</td>
66                                         <td>[% f.date_uploaded | $KohaDates %]</td>
67                                         [% IF CAN_user_borrowers_edit_borrowers %]<td><a class="btn btn-default btn-xs confirmdelete" href="?borrowernumber=[% patron.borrowernumber | html %]&amp;op=delete&amp;file_id=[% f.file_id | html %]"><i class="fa fa-trash-can"></i> Delete</a></td>[% END %]
68                                     </tr>
69                                 [% END %]
70                             </tbody>
71                         </table>
72                     </div>
73                 [% ELSE %]
74                 <div class="dialog message">
75                     <p>This patron has no files attached.</p>
76                 </div>
77                 [% END %]
78
79                 <form method="post" action="/cgi-bin/koha/members/files.pl" enctype="multipart/form-data">
80                     <fieldset class="rows">
81                         <legend>Upload new file</legend>
82                         <ol>
83                         <li><input type="hidden" name="op" value="upload" />
84                         <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]" />
85                         <input type="hidden" name="MAX_FILE_SIZE" value="2000000" />
86
87                         <label for="description">Description:</label>
88                         <input name="description" id="description" type="text" /></li>
89
90                         <li><label for="uploadfile">File:</label><input name="uploadfile" type="file" id="uploadfile" /></li>
91
92                         </ol>
93                     </fieldset>
94                     <fieldset class="action">
95                         <input name="upload" type="submit" id="upload" class="btn btn-primary" value="Upload file" />
96                     </fieldset>
97                 </form>
98
99             </main>
100         </div> <!-- /.col-sm-10.col-sm-push-2 -->
101
102         <div class="col-sm-2 col-sm-pull-10">
103             <aside>
104                 [% INCLUDE 'circ-menu.inc' %]
105             </aside>
106         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
107      </div> <!-- /.row -->
108
109 [% MACRO jsinclude BLOCK %]
110     [% INCLUDE 'str/members-menu.inc' %]
111     [% Asset.js("js/members-menu.js") | $raw %]
112     <script>
113         $(document).ready(function(){
114             $(".confirmdelete").on("click", function(){
115                 $(this).parents('tr').addClass("warn");
116                 if(confirm(_("Are you sure you want to delete this file?"))){
117                     return true;
118                 } else {
119                     $(this).parents('tr').removeClass("warn");
120                     return false;
121                 }
122             });
123     });
124     </script>
125 [% END %]
126
127 [% INCLUDE 'intranet-bottom.inc' %]