fcfinder 0.1.1 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +0 -1
  3. data/README-tr.md +356 -0
  4. data/README.md +362 -0
  5. data/app/assets/javascripts/fcfinder.js +1 -1
  6. data/app/assets/stylesheets/fcfinder.css.scss +347 -0
  7. data/fcfinder-0.1.0.gem +0 -0
  8. data/fcfinder-0.1.1.gem +0 -0
  9. data/fcfinder.gemspec +1 -1
  10. data/lib/fcfinder/connector.rb +2 -2
  11. data/lib/fcfinder/engine.rb +10 -2
  12. data/lib/fcfinder/version.rb +1 -1
  13. data/screenshots/fcfinder_interface.png +0 -0
  14. data/vendor/assets/images/fcfinder/about.png +0 -0
  15. data/vendor/assets/images/fcfinder/copy.png +0 -0
  16. data/vendor/assets/images/fcfinder/cut.png +0 -0
  17. data/vendor/assets/images/fcfinder/date_sorter.png +0 -0
  18. data/vendor/assets/images/fcfinder/delete.png +0 -0
  19. data/vendor/assets/images/fcfinder/directory-max.png +0 -0
  20. data/vendor/assets/images/fcfinder/directory.png +0 -0
  21. data/vendor/assets/images/fcfinder/directory_mini.png +0 -0
  22. data/vendor/assets/images/fcfinder/download.png +0 -0
  23. data/vendor/assets/images/fcfinder/duplicate.png +0 -0
  24. data/vendor/assets/images/fcfinder/edit.png +0 -0
  25. data/vendor/assets/images/fcfinder/files/7z.png +0 -0
  26. data/vendor/assets/images/fcfinder/files/Untitled-24.png +0 -0
  27. data/vendor/assets/images/fcfinder/files/avi.png +0 -0
  28. data/vendor/assets/images/fcfinder/files/bmp.png +0 -0
  29. data/vendor/assets/images/fcfinder/files/bz.png +0 -0
  30. data/vendor/assets/images/fcfinder/files/bz2.png +0 -0
  31. data/vendor/assets/images/fcfinder/files/css.png +0 -0
  32. data/vendor/assets/images/fcfinder/files/doc.png +0 -0
  33. data/vendor/assets/images/fcfinder/files/docx.png +0 -0
  34. data/vendor/assets/images/fcfinder/files/dv.png +0 -0
  35. data/vendor/assets/images/fcfinder/files/flv.png +0 -0
  36. data/vendor/assets/images/fcfinder/files/gif.png +0 -0
  37. data/vendor/assets/images/fcfinder/files/gz.png +0 -0
  38. data/vendor/assets/images/fcfinder/files/htm.png +0 -0
  39. data/vendor/assets/images/fcfinder/files/html.png +0 -0
  40. data/vendor/assets/images/fcfinder/files/ico.png +0 -0
  41. data/vendor/assets/images/fcfinder/files/jpeg.png +0 -0
  42. data/vendor/assets/images/fcfinder/files/jpg.png +0 -0
  43. data/vendor/assets/images/fcfinder/files/js.png +0 -0
  44. data/vendor/assets/images/fcfinder/files/mid.png +0 -0
  45. data/vendor/assets/images/fcfinder/files/mkv.png +0 -0
  46. data/vendor/assets/images/fcfinder/files/mov.png +0 -0
  47. data/vendor/assets/images/fcfinder/files/mp3.png +0 -0
  48. data/vendor/assets/images/fcfinder/files/mp4.png +0 -0
  49. data/vendor/assets/images/fcfinder/files/mp4a.png +0 -0
  50. data/vendor/assets/images/fcfinder/files/mpg.png +0 -0
  51. data/vendor/assets/images/fcfinder/files/ogg.png +0 -0
  52. data/vendor/assets/images/fcfinder/files/other.png +0 -0
  53. data/vendor/assets/images/fcfinder/files/pdf.png +0 -0
  54. data/vendor/assets/images/fcfinder/files/php.png +0 -0
  55. data/vendor/assets/images/fcfinder/files/png.png +0 -0
  56. data/vendor/assets/images/fcfinder/files/pps.png +0 -0
  57. data/vendor/assets/images/fcfinder/files/ppt.png +0 -0
  58. data/vendor/assets/images/fcfinder/files/pptx.png +0 -0
  59. data/vendor/assets/images/fcfinder/files/psd.png +0 -0
  60. data/vendor/assets/images/fcfinder/files/rar.png +0 -0
  61. data/vendor/assets/images/fcfinder/files/rb.png +0 -0
  62. data/vendor/assets/images/fcfinder/files/swf.png +0 -0
  63. data/vendor/assets/images/fcfinder/files/tar.png +0 -0
  64. data/vendor/assets/images/fcfinder/files/tbz.png +0 -0
  65. data/vendor/assets/images/fcfinder/files/tga.png +0 -0
  66. data/vendor/assets/images/fcfinder/files/tgz.png +0 -0
  67. data/vendor/assets/images/fcfinder/files/tif.png +0 -0
  68. data/vendor/assets/images/fcfinder/files/tiff.png +0 -0
  69. data/vendor/assets/images/fcfinder/files/txt.png +0 -0
  70. data/vendor/assets/images/fcfinder/files/wav.png +0 -0
  71. data/vendor/assets/images/fcfinder/files/wm.png +0 -0
  72. data/vendor/assets/images/fcfinder/files/wma.png +0 -0
  73. data/vendor/assets/images/fcfinder/files/xls.png +0 -0
  74. data/vendor/assets/images/fcfinder/files/xlsx.png +0 -0
  75. data/vendor/assets/images/fcfinder/files/xml.png +0 -0
  76. data/vendor/assets/images/fcfinder/files/zip.png +0 -0
  77. data/vendor/assets/images/fcfinder/finder.png +0 -0
  78. data/vendor/assets/images/fcfinder/icon_view.png +0 -0
  79. data/vendor/assets/images/fcfinder/info.png +0 -0
  80. data/vendor/assets/images/fcfinder/info2.png +0 -0
  81. data/vendor/assets/images/fcfinder/kind_sorter.png +0 -0
  82. data/vendor/assets/images/fcfinder/list_view.png +0 -0
  83. data/vendor/assets/images/fcfinder/name_sorter.png +0 -0
  84. data/vendor/assets/images/fcfinder/new_folder.png +0 -0
  85. data/vendor/assets/images/fcfinder/paste.png +0 -0
  86. data/vendor/assets/images/fcfinder/preview.png +0 -0
  87. data/vendor/assets/images/fcfinder/refresh.png +0 -0
  88. data/vendor/assets/images/fcfinder/rename.png +0 -0
  89. data/vendor/assets/images/fcfinder/settings.png +0 -0
  90. data/vendor/assets/images/fcfinder/show_date.png +0 -0
  91. data/vendor/assets/images/fcfinder/show_size.png +0 -0
  92. data/vendor/assets/images/fcfinder/size_sorter.png +0 -0
  93. data/vendor/assets/images/fcfinder/sort.png +0 -0
  94. data/vendor/assets/images/fcfinder/tree/folder.png +0 -0
  95. data/vendor/assets/images/fcfinder/tree/loader.gif +0 -0
  96. data/vendor/assets/images/fcfinder/tree/minus.png +0 -0
  97. data/vendor/assets/images/fcfinder/tree/plus.png +0 -0
  98. data/vendor/assets/images/fcfinder/up_folder.png +0 -0
  99. data/vendor/assets/images/fcfinder/upload.png +0 -0
  100. data/vendor/assets/javascripts/fcfinder.js +1698 -0
  101. data/vendor/assets/stylesheets/fcfinder.css +347 -0
  102. data/vendor/assets/stylesheets/fcfinder.css.erb +347 -0
  103. metadata +99 -5
data/README.md ADDED
@@ -0,0 +1,362 @@
1
+ # Fcfinder
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/fcfinder.svg)](http://badge.fury.io/rb/fcfinder)
4
+
5
+ Web File Manager For The Rails
6
+ Integrated in ckeditor and TinyMCE with File Explorer you can use as a quick and simple way.
7
+
8
+ ![Arayuzu](https://raw.githubusercontent.com/furkancelik/fcfinder/master/screenshots/fcfinder_interface.png)
9
+
10
+ ## Requirements
11
+
12
+ ###ImageMagick
13
+
14
+ [imagemagick](http://github.com)'in kurulu olması gerekmektedir.
15
+
16
+ For A Windows Installation;
17
+ [imagemagick](http://github.com) from the address the Download button
18
+ Windows binary from the release area **compatible with ruby** (same as installed x86 x64)
19
+ ImageMagick -******-dll.exe download the file and you can install it in the installation process, make sure that is added to the PATH environment variable.
20
+
21
+ To The Command Line
22
+
23
+ `convert -version`
24
+
25
+ when you write in this way, you can see that you have successfully installed.
26
+
27
+ ```
28
+ Version: ImageMagick 6.9.1-4 Q16 x86 2015-05-31 http://www.imagemagick.org
29
+ Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
30
+ License: http://www.imagemagick.org/script/license.php
31
+ Features: Cipher DPC Modules OpenMP
32
+ ...
33
+ ```
34
+
35
+ ### Puma Server (Optional)
36
+ Requirement requirement but not Webrick large files can give a problem in the installation process.
37
+ the Puma for Windows installation [Here](https://github.com/hicknhack-software/rails-disco/wiki/Installing-puma-on-windows) you can look at.
38
+
39
+
40
+
41
+ ## Setup
42
+
43
+ Gemfile for rails applications, you must add the following line to your file.
44
+
45
+ ```ruby
46
+ gem 'fcfinder'
47
+ ```
48
+
49
+ ```
50
+ $ bundle install
51
+ ```
52
+
53
+ with rails you can perform the installation process.
54
+
55
+
56
+ ## Use
57
+
58
+
59
+ ###Setting The Controller
60
+
61
+ ```ruby
62
+ class YourController < ApplicationController
63
+
64
+ def index
65
+ if request.post?
66
+ # The bottom line is that only the logged in user (admin) can access the Finder
67
+ # The Session Name Must Be The Same As The Name You Use On Your System
68
+ # The Logon Process Will Be If You Can Remove This Line
69
+ if session[:user_id]
70
+ # example file with the name you want under the terms you can create the public folder, 'uploads' was created in the form of
71
+ # File.join(Rails.public_path, 'uploads', "/*")
72
+ # Files you want to be listed as a parameter
73
+ # server address,
74
+ # post parameters,
75
+ # Parameter Hash in the hash
76
+ # :max_file_size = indicates the size of the file to be loaded (byte)
77
+ # :allowed_mime = the file types that you want to allow extra
78
+ # :disallowed_mime = disallowed file types
79
+ render text: Fcfinder::Connector.new(File.join(Rails.public_path, 'uploads', "/*"), request.env["HTTP_HOST"], params[:fcfinder],
80
+ {
81
+ :max_file_size => 1_000_000,
82
+ :allowed_mime => {'pdf' => 'application/pdf'},
83
+ :disallowed_mime => {}
84
+ }).run, :layout => false
85
+ # If Not Logged On
86
+ #( session[:user_id] if you must remove the else part of the if statement block is removed)
87
+ else
88
+ # if the value is null is blocking access session_id, keep your files safe.
89
+ render :text => "Access not allowed!".to_json, :layout => false
90
+ end
91
+ else
92
+ render :layout => false
93
+ end
94
+ end
95
+
96
+
97
+ #to download the file
98
+ def download
99
+ # 'uploads' folder under the public folder part again.
100
+ send_file File.join(Rails.public_path,'uploads',params[:path].split(":").join("/")+"."+params[:format])
101
+ end
102
+ end
103
+ ```
104
+
105
+ ###Route Setting
106
+
107
+ ```ruby
108
+ scope '/fcfinder' do
109
+ match '/', to: 'your_controller#index', via: [:get, :post]
110
+ get '/download/:path', to: 'your_controller#download'
111
+ end
112
+ ```
113
+
114
+ **This way if you can use a namespace if you want to use under**
115
+
116
+ ```ruby
117
+ namespace :admin do
118
+ scope '/fcfinder' do
119
+ match '/', to: 'your_controller#index', via: [:get, :post]
120
+ get '/download/:path', to: 'your_controller#download'
121
+ end
122
+ end
123
+ ```
124
+
125
+ ###View Setting
126
+
127
+ ####1.Method
128
+ **app/assets/javascripts/application.js in your file**
129
+
130
+ ```js
131
+ //= require jquery
132
+ //= require jquery_ujs
133
+ ```
134
+
135
+ these lines must be attached ***(make sure jQuery is loaded!!)***
136
+
137
+
138
+ **config/initializers/assets.rb** in the file to the bottom
139
+
140
+ ```ruby
141
+ Rails.application.config.assets.precompile += %w( fcfinder.js )
142
+ Rails.application.config.assets.precompile += %w( fcfinder.css )
143
+ ```
144
+
145
+ you must add the lines
146
+
147
+ **View the content of your file should be like this**
148
+
149
+ ```html
150
+ <!DOCTYPE html>
151
+ <html>
152
+ <head>
153
+ <title>FcFinder</title>
154
+
155
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
156
+ <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
157
+
158
+ <%= javascript_include_tag 'fcfinder', 'data-turbolinks-track' => true %>
159
+ <%= stylesheet_link_tag 'fcfinder', media: 'all', 'data-turbolinks-track' => true %>
160
+ <%= csrf_meta_tags %>
161
+ </head>
162
+ <body>
163
+ <div id="fcfinder"></div>
164
+
165
+ <script type="text/javascript">
166
+ $(function(){
167
+ $("#fcfinder").fcFinder({
168
+ // this value must be the address that you set in the route
169
+ url:"/fcfinder",
170
+ getFileCallback: function(url) {
171
+ /**
172
+ Integrated Editor For The First Stage Of The Process, You Can Leave This Value Blank
173
+ By default CKEditor is working in an integrated manner with
174
+ */
175
+ }
176
+ });
177
+ });
178
+ </script>
179
+ </body>
180
+ </html>
181
+ ```
182
+
183
+ ####2.Method
184
+
185
+ **app/assets/javascripts/application.js in your file**
186
+ make sure that the jQuery files are installed
187
+
188
+ ```js
189
+ //= require jquery
190
+ //= require jquery_ujs
191
+ ```
192
+ under
193
+
194
+ ```js
195
+ //= require fcfinder
196
+ ```
197
+ add the line
198
+
199
+
200
+ **app/assets/stylesheets/application.css in file**
201
+
202
+ ```css
203
+ *= require fcfinder
204
+ ```
205
+
206
+ add the line
207
+
208
+
209
+
210
+ **View the content of your file should be like this**
211
+
212
+ ```html
213
+ <!DOCTYPE html>
214
+ <html>
215
+ <head>
216
+ <title>FcFinder</title>
217
+
218
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
219
+ <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
220
+ <%= csrf_meta_tags %>
221
+
222
+ </head>
223
+ <body>
224
+ <div id="fcfinder"></div>
225
+
226
+ <script type="text/javascript">
227
+ $(function(){
228
+ $("#fcfinder").fcFinder({
229
+ // this value must be the address that you set in the route
230
+ url:"/fcfinder",
231
+ getFileCallback: function(url) {
232
+ /**
233
+ Integrated Editor For The First Stage Of The Process, You Can Leave This Value Blank
234
+ By default CKEditor is working in an integrated manner with
235
+ */
236
+ }
237
+ });
238
+ });
239
+ </script>
240
+ </body>
241
+ </html>
242
+ ```
243
+
244
+
245
+ **You Can Now Start Your Server And Test It :)**
246
+
247
+ ## Integrated Operations
248
+ ### CKEditor
249
+
250
+ Comes integrated with ckeditor by default.
251
+ Ckeditor In A Page That Contains Flour
252
+
253
+ ```js
254
+ CKEDITOR.replace( 'editor1',{
255
+ /* In this way, you will specify the path to the Ckeditor in the Finder. */
256
+ filebrowserBrowseUrl : 'http://localhost:3000/fcfinder'
257
+ });
258
+ ```
259
+
260
+ ### Tinymce
261
+
262
+ On the page that contains the TinyMCE editor
263
+
264
+ ```js
265
+ function fcFinderBrowser (field_name, url, type, win) {
266
+ tinymce.activeEditor.windowManager.open({
267
+ /* URL Finder */
268
+ file: "http://localhost:3000/admin/fcfinder",
269
+ title: 'FCFinder File Manager',
270
+ width: 900,
271
+ height: 450,
272
+ resizable: 'yes'
273
+ }, {
274
+ setUrl: function (url) {
275
+ win.document.getElementById(field_name).value = url;
276
+ }
277
+ });
278
+ return false;
279
+ }
280
+
281
+ tinymce.init({
282
+ selector: "textarea#elm1",
283
+ theme: "modern",
284
+ file_browser_callback : fcFinderBrowser,
285
+ ....
286
+ ...
287
+ ..
288
+ .
289
+ });
290
+ ```
291
+
292
+ **Resides on the page where fcfinder**
293
+
294
+ ```js
295
+ $("#fcfinder").fcFinder({
296
+ url:"/admin/fcfinder",
297
+ getFileCallback: function(url) {
298
+
299
+ if (typeof(window.opener) !== 'undefined' && window.opener !== null) {
300
+ window.opener.FCFinder.callBack(url);
301
+ window.close();
302
+ }
303
+
304
+ if (typeof(top.tinymce) !== 'undefined' && typeof(top.tinymce) !== null) {
305
+ top.tinymce.activeEditor.windowManager.getParams().setUrl(url);
306
+ top.tinymce.activeEditor.windowManager.close();
307
+ }
308
+
309
+ }
310
+ });
311
+ ```
312
+
313
+ ### Integrated process for the input
314
+
315
+ **the page where input is needed**
316
+
317
+ ```html
318
+ <html>
319
+ <head>
320
+ <script type="text/javascript">
321
+ function openFCFinder(field) {
322
+ window.FCFinder = {
323
+ callBack: function(url) {
324
+ field.value = url;
325
+ }
326
+ };
327
+
328
+ window.open('http://localhost:3000/admin/fcfinder', 'kcfinder_textbox',
329
+ 'status=0, toolbar=0, location=0, menubar=0, directories=0, ' +
330
+ 'resizable=1, scrollbars=0, width=950, height=400'
331
+ );
332
+ }
333
+ </script>
334
+ </head>
335
+ <body>
336
+ <input type="text" readonly="readonly" onclick="openFCFinder(this)"
337
+ value="Click here and select a file double clicking on it" style="width:600px;cursor:pointer" />
338
+ </body>
339
+ </html>
340
+ ```
341
+
342
+ **The page where is located the Finder (the Finder parameter setting)**
343
+
344
+
345
+ ```js
346
+ $("#fcfinders").fcFinder({
347
+ url:"/admin/fcfinder",
348
+ getFileCallback: function(url) {
349
+
350
+ if (typeof(window.opener) !== 'undefined' && window.opener !== null) {
351
+ window.opener.FCFinder.callBack(url);
352
+ window.close();
353
+ }
354
+
355
+ if (typeof(top.tinymce) !== 'undefined' && typeof(top.tinymce) !== null) {
356
+ top.tinymce.activeEditor.windowManager.getParams().setUrl(url);
357
+ top.tinymce.activeEditor.windowManager.close();
358
+ }
359
+ }
360
+ });
361
+ ```
362
+
@@ -291,7 +291,7 @@
291
291
 
292
292
 
293
293
  //HTML'yi Yükle
294
- fcfinder.append('<div class="left"><div id="all_folders">'+
294
+ fcfinder.append('<div class="left"><div id="all_folders">'+
295
295
  '<ul class="folders">'+
296
296
  '<li><a><span class="folder">'+opts.i18n.loading+'<span class="load"></span></span>'+
297
297
  '</a></li>'+