fcfinder 1.0.0 → 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.
- checksums.yaml +5 -5
- data/.gitignore +9 -9
- data/.travis.yml +3 -3
- data/CODE_OF_CONDUCT.md +13 -13
- data/Gemfile +4 -4
- data/LICENSE.txt +21 -21
- data/README-tr.md +356 -0
- data/README.md +362 -356
- data/Rakefile +1 -1
- data/app/assets/stylesheets/fcfinder.css.scss +347 -347
- data/bin/console +14 -14
- data/bin/setup +7 -7
- data/fcfinder.gemspec +31 -31
- data/lib/fcfinder/version.rb +1 -1
- data/vendor/assets/javascripts/fcfinder.js +1698 -1698
- data/vendor/assets/stylesheets/fcfinder.css +346 -346
- data/vendor/assets/stylesheets/fcfinder.css.erb +347 -347
- metadata +17 -17
data/README.md
CHANGED
@@ -1,356 +1,362 @@
|
|
1
|
-
# Fcfinder
|
2
|
-
|
3
|
-
[](http://badge.fury.io/rb/fcfinder)
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-

|
9
|
-
|
10
|
-
##
|
11
|
-
|
12
|
-
###ImageMagick
|
13
|
-
|
14
|
-
[imagemagick](http://github.com)'in kurulu olması gerekmektedir.
|
15
|
-
|
16
|
-
Windows
|
17
|
-
[imagemagick](http://github.com)
|
18
|
-
Windows
|
19
|
-
ImageMagick-******-dll.exe
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
`convert -version`
|
24
|
-
|
25
|
-
|
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 (
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
##
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
```ruby
|
46
|
-
gem 'fcfinder'
|
47
|
-
```
|
48
|
-
|
49
|
-
```
|
50
|
-
$ bundle install
|
51
|
-
```
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
##
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
#
|
67
|
-
#
|
68
|
-
|
69
|
-
|
70
|
-
#
|
71
|
-
#
|
72
|
-
#
|
73
|
-
#
|
74
|
-
#
|
75
|
-
#
|
76
|
-
# :
|
77
|
-
# :
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
:
|
82
|
-
:
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
else
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
render :layout => false
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
|
97
|
-
#
|
98
|
-
def download
|
99
|
-
# 'uploads'
|
100
|
-
send_file File.join(Rails.public_path,'uploads',params[:path].split(":").join("/")+"."+params[:format])
|
101
|
-
end
|
102
|
-
end
|
103
|
-
```
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
<%=
|
156
|
-
<%=
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
```
|
189
|
-
|
190
|
-
|
191
|
-
```
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
if (typeof(
|
300
|
-
|
301
|
-
|
302
|
-
}
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
```
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
window.
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
}
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
</
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
1
|
+
# Fcfinder
|
2
|
+
|
3
|
+
[](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
|
+

|
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
|
+
|