]> git.mxchange.org Git - friendica.git/blob - view/templates/filebrowser_plain.tpl
4d29f60b8fd9e63bd8ab00a64c4bc4a0d763f8f4
[friendica.git] / view / templates / filebrowser_plain.tpl
1         <!--
2                 This is the template used by mod/fbrowser.php when is called from plain text editor.
3                 See also 'filebrowser.tpl'
4         -->
5
6 <script type="text/javascript" src="{{$baseurl}}/js/ajaxupload.js" ></script>
7
8 <div class="fbrowser {{$type}}">
9
10         <div class="path">
11                 {{foreach $path as $p}}<a href="{{$p.0}}">{{$p.1}}</a>{{/foreach}}
12         </div>
13         
14         <div class="folders">
15                 <ul>
16                         {{foreach $folders as $f}}<li><a href="{{$baseurl}}/fbrowser/{{$type}}/{{$f.0}}">{{$f.1}}</a></li>{{/foreach}}
17                 </ul>
18         </div>
19                 
20         {{foreach $files as $f}}
21         <div class="photo-album-image-wrapper">
22                 <a href="#" class="photo-album-photo-link" data-link="{{$f.0}}" data-filename="{{$f.1}}" data-img="{{$f.2}}">
23                         <img src="{{$f.2}}">
24                         <p>{{$f.1}}</p>
25                 </a>
26         </div>
27         <div class="photo-album-image-wrapper-end"></div>
28         {{/foreach}}
29
30         <div class="upload">
31                 <button id="upload-{{$type}}"><img id="profile-rotator" src="images/rotator.gif" alt="{{$wait}}" title="{{$wait|escape:'html'}}" style="display: none;" /> {{"Upload"|t}}</button> 
32         </dksiv>
33 </div>
34
35
36
37         <script>
38                 $(".photo-album-photo-link").on('click', function(e){
39                         e.preventDefault();
40                         
41                         {{if $type == "image"}}
42                         var embed = "[url="+this.dataset.link+"][img]"+this.dataset.img+"[/img][/url]";
43                         {{/if}}
44                         {{if $type == "file"}}
45                         var embed = "[url="+this.dataset.link+"][img]"+this.dataset.img+"[/img] "+this.dataset.filename+"[/url]";
46                         {{/if}}
47                         console.log(this.dataset.filename, embed, parent.$("body"));
48                         parent.$("body").trigger("fbrowser.{{$type}}", [
49                                 this.dataset.filename,
50                                 embed,
51                         ]);
52                         
53                 });
54                 
55                 if ($("#upload-image").length)
56                         var image_uploader = new window.AjaxUpload(
57                                 'upload-image',
58                                 { action: 'wall_upload/{{$nickname}}',
59                                         name: 'userfile',
60                                         onSubmit: function(file,ext) { $('#profile-rotator').show(); },
61                                         onComplete: function(file,response) {
62                                                 location = baseurl + "/fbrowser/image/?mode=minimal";
63                                                 location.reload(true);
64                                         }                                
65                                 }
66                         );
67
68                 if ($("#upload-file").length)
69                         var file_uploader = new window.AjaxUpload(
70                                 'upload-file',
71                                 { action: 'wall_attach/{{$nickname}}',
72                                         name: 'userfile',
73                                         onSubmit: function(file,ext) { $('#profile-rotator').show(); },
74                                         onComplete: function(file,response) {
75                                                 location = baseurl + "/fbrowser/file/?mode=minimal";
76                                                 location.reload(true);                          }                                
77                                 }
78                         );
79                 
80                 
81
82         </script>
83
84         </body>
85         
86 </html>