Revision 0c281964
Von Werner Hahn vor mehr als 7 Jahren hinzugefügt
templates/webpages/common/file_upload.html | ||
---|---|---|
1 |
[%- USE LxERP -%][%- USE L -%][%- USE HTML -%][%- USE JavaScript -%][% USE Base64 %] |
|
2 |
[% SET style="width: 500px" %] |
|
3 |
[% SET id_base_bak = "fileupload" %] |
|
4 |
[% SET id_base = 'fileupload_' _ (SELF.file.id ? SELF.file.id : 'new') %] |
|
5 |
[% SET trans_id = SELF.file.id ? SELF.file.trans_id : data.trans_id %] |
|
6 |
[% SET modul = SELF.file.id ? SELF.file.modul : data.modul %] |
|
7 |
|
|
8 |
<form method="post" id="fileupload_form" method="POST" enctype="multipart/form-data"> |
|
9 |
[% L.hidden_tag('form_prefix', id_base, id=id_base _ '_form_prefix') %] |
|
10 |
[% L.hidden_tag(id_base _ '.id', SELF.file.id, no_id=1) %] |
|
11 |
[% L.hidden_tag(id_base _ '.trans_id', trans_id) %] |
|
12 |
[% L.hidden_tag(id_base _ '.modul', modul) %] |
|
13 |
[% L.hidden_tag('aft', data.aft) %] |
|
14 |
|
|
15 |
<h2> |
|
16 |
[%- IF SELF.file.id %] |
|
17 |
[%- LxERP.t8("Edit fileproperties", SELF.file.position) %] |
|
18 |
[%- ELSE %] |
|
19 |
[%- LxERP.t8("Add file") %] |
|
20 |
[%- END %] |
|
21 |
</h2> |
|
22 |
|
|
23 |
<table> |
|
24 |
[% IF SELF.file.id %] |
|
25 |
<tr> |
|
26 |
<th align="right">[%- LxERP.t8("Position") %]:</th> |
|
27 |
<td>[% HTML.escape(SELF.file.position) %]</td> |
|
28 |
</tr> |
|
29 |
[% END %] |
|
30 |
|
|
31 |
<tr> |
|
32 |
<th align="right">[%- LxERP.t8("Description") %]:</th> |
|
33 |
<td>[% L.input_tag(id_base _ '.description', SELF.file.description, style=style) %]</td> |
|
34 |
</tr> |
|
35 |
|
|
36 |
<tr> |
|
37 |
<th align="right">[%- LxERP.t8("Title") %]:</th> |
|
38 |
<td>[% L.input_tag(id_base _ '.title', SELF.file.title, style=style) %]</td> |
|
39 |
</tr> |
|
40 |
|
|
41 |
[% IF SELF.file.file_content %] |
|
42 |
<tr> |
|
43 |
<th align="right">[%- LxERP.t8("File name") %]:</th> |
|
44 |
<td>[% HTML.escape(SELF.file.filename) %][% L.hidden_tag(id_base _ '.filename', SELF.file.filename) %][% L.hidden_tag('id', SELF.file.id, no_id=1) %]</td> |
|
45 |
</tr> |
|
46 |
|
|
47 |
<tr> |
|
48 |
<th align="right">[%- LxERP.t8("MIME type") %]:</th> |
|
49 |
<td>[% HTML.escape(SELF.file.file_content_type) %]</td> |
|
50 |
</tr> |
|
51 |
|
|
52 |
<tr> |
|
53 |
<th align="right">[%- LxERP.t8("Dimensions") %]:</th> |
|
54 |
<td>[% HTML.escape(SELF.file.files_img_width) %]x[% HTML.escape(SELF.file.files_img_height) %]</td> |
|
55 |
</tr> |
|
56 |
|
|
57 |
<tr> |
|
58 |
<th align="right">[%- LxERP.t8("Uploaded at") %]:</th> |
|
59 |
<td>[% HTML.escape(SELF.file.files_mtime.to_kivitendo(precision='second')) %]</td> |
|
60 |
</tr> |
|
61 |
[% END %] |
|
62 |
|
|
63 |
<tr> |
|
64 |
<th align="right">[%- LxERP.t8("Select file to upload") %]:</th> |
|
65 |
<td>[% L.input_tag(id_base _ '.file_content', '', type='file') %]</td> |
|
66 |
</tr> |
|
67 |
</table> |
|
68 |
|
|
69 |
<p> |
|
70 |
<!-- TODO action ändern in übergebene Variable, sodass jede xbelibiege Controller/Action aufgerufen werden kann --> |
|
71 |
[%- L.ajax_submit_tag('controller.pl?action=' _ data.ca, '#fileupload_form', LxERP.t8('Save'), no_id=1) %] |
|
72 |
<a href="#" onclick="$('#jqueryui_popup_dialog').dialog('close');">[%- LxERP.t8("Cancel") %]</a> |
|
73 |
</p> |
|
74 |
|
|
75 |
</form> |
|
76 |
|
|
77 |
[% IF SELF.file.id %] |
|
78 |
<h2>[% LxERP.t8("Current file") %]</h2> |
|
79 |
|
|
80 |
<div> |
|
81 |
<img src="data:[% HTML.escape(SELF.file.file_content_type) %];base64,[% SELF.file.file_content.encode_base64 %]"> |
|
82 |
</div> |
|
83 |
[% END %] |
templates/webpages/fileuploader/test_page.html | ||
---|---|---|
1 |
[% USE L %] |
|
2 |
|
|
3 |
<h1>Fileupload Testpage</h1> |
|
4 |
<form method="post" id="fileupload" method="POST" enctype="multipart/form-data"> |
|
5 |
<div id="testfunctions" style="width:50%; float:left; border:thin solid green"> |
|
6 |
<div id="part_1" height="75px"> |
|
7 |
Part: Select Part Where to store the file<br> |
|
8 |
[% L.part_picker('part_id1','',fat_set_item=1) %]<br> |
|
9 |
Part: <span id="change1"> </span> -- <span id="change2"></span><br> |
|
10 |
<div id="fileupload_button" style="display:none;"> |
|
11 |
[% L.hidden_tag("id") %] |
|
12 |
[% L.hidden_tag("modul","part") %] |
|
13 |
[% L.button_tag("add_file(this.form.id.value,this.form.modul.value)", 'Fileupload') %] |
|
14 |
</div> |
|
15 |
</div> |
|
16 |
<div id="shoppart" height="75px"> |
|
17 |
ShopPart: Select Part Where to store the file<br> |
|
18 |
[% L.part_picker('shoppart','',fat_set_item=1) %]<br> |
|
19 |
ShopPart: <span id="shoppartchange1"> </span> -- <span id="shoppartchange2"></span><br> |
|
20 |
<div id="shop_img_upload_button" style="display:none;"> |
|
21 |
[% L.hidden_tag("shop_part_id") %] |
|
22 |
[% L.hidden_tag("shop_part_modul","shop_part") %] |
|
23 |
[% L.button_tag("add_file(this.form.shop_part_id.value,this.form.shop_part_modul.value)", 'Fileupload') %] |
|
24 |
</div> |
|
25 |
</div> |
|
26 |
</div> |
|
27 |
</form> |
|
28 |
|
|
29 |
<div id="testviews" style="width:50%; float:left; border:thin solid green"> |
|
30 |
<div id="viewpart" height="75px"> |
|
31 |
</div> |
|
32 |
<div id="viewshoppart" height="75px"> |
|
33 |
</div> |
|
34 |
</div> |
|
35 |
<script type='text/javascript'> |
|
36 |
<!-- |
|
37 |
$('#part_id1').change(function() { $('#change1').html($('#part_id1').val()) }); |
|
38 |
$('#part_id1').on('set_item:PartPicker', function(e,o) { $('#id').val(o.id); |
|
39 |
$('#change2').html(o.id); |
|
40 |
$('#fileupload_button').show(); |
|
41 |
}); |
|
42 |
$('#shoppart').change(function() { $('#shoppartchange1').html($('#shoppart').val()) }); |
|
43 |
$('#shoppart').on('set_item:PartPicker', function(e,o) { $('#shop_part_id').val(o.id); |
|
44 |
$('#shoppartchange2').html(o.id); |
|
45 |
$('#shop_img_upload_button').show(); |
|
46 |
}); |
|
47 |
function add_file(id,modul) { |
|
48 |
//var id = this.$('#part').val(); |
|
49 |
kivi.popup_dialog({ |
|
50 |
url : 'controller.pl?action=FileUploader/ajax_add_file', |
|
51 |
data: 'id=' + id + '&modul=' + modul, |
|
52 |
dialog: { title: kivi.t8('File upload') } |
|
53 |
} ); |
|
54 |
return true; |
|
55 |
} |
|
56 |
--> |
|
57 |
</script> |
Auch abrufbar als: Unified diff
Shopmodul: nicht benötigte Dateien entfernt