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