fcfinder 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.travis.yml +3 -0
  4. data/CODE_OF_CONDUCT.md +13 -0
  5. data/Gemfile +4 -0
  6. data/LICENSE.txt +21 -0
  7. data/Rakefile +1 -0
  8. data/app/assets/images/fcfinder/about.png +0 -0
  9. data/app/assets/images/fcfinder/copy.png +0 -0
  10. data/app/assets/images/fcfinder/cut.png +0 -0
  11. data/app/assets/images/fcfinder/date_sorter.png +0 -0
  12. data/app/assets/images/fcfinder/delete.png +0 -0
  13. data/app/assets/images/fcfinder/directory-max.png +0 -0
  14. data/app/assets/images/fcfinder/directory.png +0 -0
  15. data/app/assets/images/fcfinder/directory_mini.png +0 -0
  16. data/app/assets/images/fcfinder/download.png +0 -0
  17. data/app/assets/images/fcfinder/duplicate.png +0 -0
  18. data/app/assets/images/fcfinder/edit.png +0 -0
  19. data/app/assets/images/fcfinder/files/7z.png +0 -0
  20. data/app/assets/images/fcfinder/files/Untitled-24.png +0 -0
  21. data/app/assets/images/fcfinder/files/avi.png +0 -0
  22. data/app/assets/images/fcfinder/files/bmp.png +0 -0
  23. data/app/assets/images/fcfinder/files/bz.png +0 -0
  24. data/app/assets/images/fcfinder/files/bz2.png +0 -0
  25. data/app/assets/images/fcfinder/files/css.png +0 -0
  26. data/app/assets/images/fcfinder/files/doc.png +0 -0
  27. data/app/assets/images/fcfinder/files/docx.png +0 -0
  28. data/app/assets/images/fcfinder/files/dv.png +0 -0
  29. data/app/assets/images/fcfinder/files/flv.png +0 -0
  30. data/app/assets/images/fcfinder/files/gif.png +0 -0
  31. data/app/assets/images/fcfinder/files/gz.png +0 -0
  32. data/app/assets/images/fcfinder/files/htm.png +0 -0
  33. data/app/assets/images/fcfinder/files/html.png +0 -0
  34. data/app/assets/images/fcfinder/files/ico.png +0 -0
  35. data/app/assets/images/fcfinder/files/jpeg.png +0 -0
  36. data/app/assets/images/fcfinder/files/jpg.png +0 -0
  37. data/app/assets/images/fcfinder/files/js.png +0 -0
  38. data/app/assets/images/fcfinder/files/mid.png +0 -0
  39. data/app/assets/images/fcfinder/files/mkv.png +0 -0
  40. data/app/assets/images/fcfinder/files/mov.png +0 -0
  41. data/app/assets/images/fcfinder/files/mp3.png +0 -0
  42. data/app/assets/images/fcfinder/files/mp4.png +0 -0
  43. data/app/assets/images/fcfinder/files/mp4a.png +0 -0
  44. data/app/assets/images/fcfinder/files/mpg.png +0 -0
  45. data/app/assets/images/fcfinder/files/ogg.png +0 -0
  46. data/app/assets/images/fcfinder/files/other.png +0 -0
  47. data/app/assets/images/fcfinder/files/pdf.png +0 -0
  48. data/app/assets/images/fcfinder/files/php.png +0 -0
  49. data/app/assets/images/fcfinder/files/png.png +0 -0
  50. data/app/assets/images/fcfinder/files/pps.png +0 -0
  51. data/app/assets/images/fcfinder/files/ppt.png +0 -0
  52. data/app/assets/images/fcfinder/files/pptx.png +0 -0
  53. data/app/assets/images/fcfinder/files/psd.png +0 -0
  54. data/app/assets/images/fcfinder/files/rar.png +0 -0
  55. data/app/assets/images/fcfinder/files/rb.png +0 -0
  56. data/app/assets/images/fcfinder/files/swf.png +0 -0
  57. data/app/assets/images/fcfinder/files/tar.png +0 -0
  58. data/app/assets/images/fcfinder/files/tbz.png +0 -0
  59. data/app/assets/images/fcfinder/files/tga.png +0 -0
  60. data/app/assets/images/fcfinder/files/tgz.png +0 -0
  61. data/app/assets/images/fcfinder/files/tif.png +0 -0
  62. data/app/assets/images/fcfinder/files/tiff.png +0 -0
  63. data/app/assets/images/fcfinder/files/txt.png +0 -0
  64. data/app/assets/images/fcfinder/files/wav.png +0 -0
  65. data/app/assets/images/fcfinder/files/wm.png +0 -0
  66. data/app/assets/images/fcfinder/files/wma.png +0 -0
  67. data/app/assets/images/fcfinder/files/xls.png +0 -0
  68. data/app/assets/images/fcfinder/files/xlsx.png +0 -0
  69. data/app/assets/images/fcfinder/files/xml.png +0 -0
  70. data/app/assets/images/fcfinder/files/zip.png +0 -0
  71. data/app/assets/images/fcfinder/finder.png +0 -0
  72. data/app/assets/images/fcfinder/icon_view.png +0 -0
  73. data/app/assets/images/fcfinder/info.png +0 -0
  74. data/app/assets/images/fcfinder/info2.png +0 -0
  75. data/app/assets/images/fcfinder/kind_sorter.png +0 -0
  76. data/app/assets/images/fcfinder/list_view.png +0 -0
  77. data/app/assets/images/fcfinder/name_sorter.png +0 -0
  78. data/app/assets/images/fcfinder/new_folder.png +0 -0
  79. data/app/assets/images/fcfinder/paste.png +0 -0
  80. data/app/assets/images/fcfinder/preview.png +0 -0
  81. data/app/assets/images/fcfinder/refresh.png +0 -0
  82. data/app/assets/images/fcfinder/rename.png +0 -0
  83. data/app/assets/images/fcfinder/settings.png +0 -0
  84. data/app/assets/images/fcfinder/show_date.png +0 -0
  85. data/app/assets/images/fcfinder/show_size.png +0 -0
  86. data/app/assets/images/fcfinder/size_sorter.png +0 -0
  87. data/app/assets/images/fcfinder/sort.png +0 -0
  88. data/app/assets/images/fcfinder/tree/folder.png +0 -0
  89. data/app/assets/images/fcfinder/tree/loader.gif +0 -0
  90. data/app/assets/images/fcfinder/tree/minus.png +0 -0
  91. data/app/assets/images/fcfinder/tree/plus.png +0 -0
  92. data/app/assets/images/fcfinder/up_folder.png +0 -0
  93. data/app/assets/images/fcfinder/upload.png +0 -0
  94. data/app/assets/javascripts/fcfinder.js +1697 -0
  95. data/app/assets/stylesheets/fcfinder.css +347 -0
  96. data/bin/console +14 -0
  97. data/bin/setup +7 -0
  98. data/fcfinder.gemspec +31 -0
  99. data/lib/fcfinder.rb +7 -0
  100. data/lib/fcfinder/connector.rb +612 -0
  101. data/lib/fcfinder/engine.rb +4 -0
  102. data/lib/fcfinder/version.rb +3 -0
  103. data/lib/fcfinder/zip_file_generator.rb +47 -0
  104. metadata +203 -0
@@ -0,0 +1,347 @@
1
+ @import url(http://fonts.googleapis.com/css?family=Roboto:400,300&subset=latin,latin-ext);
2
+ * {outline: none; position: relative;
3
+ /*font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif;*/
4
+ font-family: 'Roboto', Trebuchet MS, Tahoma, Verdana, Arial, sans-serif;
5
+ font-weight: 300;
6
+ }
7
+ html, body{margin:0px; padding: 0px; height: 100%; min-height: 100%; font-size: 100%;}
8
+ #fcfinder { background: #dddddd; max-width: 100%; height: 100%; position: relative; }
9
+ #fcfinder .left { height:94%; border: 1px solid #c0c0c0; background: #f0f0f0; width: 25%; min-width: 135px; margin:5px 0 0 5px; border-radius: 5px; float: left; overflow: auto; }
10
+ #fcfinder .left #all_folders { width: 100%; display: flex;}
11
+ #fcfinder .right { height:94%; margin: 5px 0px 0px 0px; float: left; }
12
+ #fcfinder .right ul.widget {height:35px; width: 99%; margin:4px 0px 0px 0px; padding:0px 0px 0px 5px; font-size: 15px; }
13
+ #fcfinder .right ul.widget li { float: left; list-style: none; margin-right:10px; }
14
+ #fcfinder .right ul.widget li a{
15
+ border-radius: 32px; width:32px; height: 32px; display: block; font-size: 0%;
16
+ position:relative;
17
+ overflow:hidden;
18
+ -webkit-transition: all 0.2s ease;
19
+ -moz-transition: all 0.2s ease;
20
+ -o-transition: all 0.2s ease;
21
+ transition: all 0.2s ease;
22
+ z-index:0;
23
+ box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26);
24
+ -webkit-box-shadow:rgba(0, 0, 0, 0.26) 0 2px 5px 0;
25
+ -moz-box-shadow:rgba(0, 0, 0, 0.26) 0 2px 5px 0;
26
+ }
27
+ #fcfinder .right ul.widget li a:hover{
28
+ box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.80);
29
+ -webkit-box-shadow:rgba(0, 0, 0, 0.80) 0 2px 5px 0;
30
+ -moz-box-shadow:rgba(0, 0, 0, 0.80) 0 2px 5px 0;
31
+ }
32
+
33
+
34
+ #fcfinder .ink {display: block; position: absolute;background:rgba(255, 255, 255, 0.3);border-radius: 100%;-webkit-transform:scale(0);-moz-transform:scale(0);-o-transform:scale(0);transform:scale(0);}
35
+ #fcfinder .animate {-webkit-animation:ripple 0.65s linear;-moz-animation:ripple 0.65s linear;-ms-animation:ripple 0.65s linear;-o-animation:ripple 0.65s linear;animation:ripple 0.65s linear;}
36
+ @-webkit-keyframes ripple {100% {opacity: 0; -webkit-transform: scale(2.5);}}
37
+ @-moz-keyframes ripple {100% {opacity: 0; -moz-transform: scale(2.5);}}
38
+ @-o-keyframes ripple {100% {opacity: 0; -o-transform: scale(2.5);}}
39
+ @keyframes ripple {100% {opacity: 0; transform: scale(2.5);}}
40
+
41
+
42
+ /*#fcfinder .right ul.widget li a:hover { border-radius: 5px; border: 1px solid #ccc;}*/
43
+
44
+ #fcfinder .right ul.widget li a.up_folder { background: url("./fcfinder/up_folder.png") no-repeat; }
45
+ #fcfinder .right ul.widget li a.upload { background: url("./fcfinder/upload.png") no-repeat; }
46
+ #fcfinder .right ul.widget li a.refresh { background: url("./fcfinder/refresh.png") no-repeat; }
47
+ #fcfinder .right ul.widget li a.settings { background: url("./fcfinder/settings.png") no-repeat; }
48
+ #fcfinder .right ul.widget li a.new_folder{ background: url("./fcfinder/new_folder.png") no-repeat; }
49
+ #fcfinder .right ul.widget li a.download{ background: url("./fcfinder/download.png") no-repeat; }
50
+
51
+ #fcfinder .right ul.widget li a.info{ background: url("./fcfinder/info.png") no-repeat; }
52
+ #fcfinder .right ul.widget li a.preview{ background: url("./fcfinder/preview.png") no-repeat; }
53
+ #fcfinder .right ul.widget li a.edit{ background: url("./fcfinder/edit.png") no-repeat; }
54
+ #fcfinder .right ul.widget li a.cut{ background: url("./fcfinder/cut.png") no-repeat; }
55
+ #fcfinder .right ul.widget li a.copy{ background: url("./fcfinder/copy.png") no-repeat; }
56
+ #fcfinder .right ul.widget li a.paste{ background: url("./fcfinder/paste.png") no-repeat; }
57
+ #fcfinder .right ul.widget li a.duplicate{ background: url("./fcfinder/duplicate.png") no-repeat; }
58
+ #fcfinder .right ul.widget li a.rename{ background: url("./fcfinder/rename.png") no-repeat; }
59
+ #fcfinder .right ul.widget li a.delete{ background: url("./fcfinder/delete.png") no-repeat; }
60
+ #fcfinder .right ul.widget li a.list_view{ background: url("./fcfinder/list_view.png") no-repeat; }
61
+ #fcfinder .right ul.widget li a.icon_view{ background: url("./fcfinder/icon_view.png") no-repeat; }
62
+ #fcfinder .right ul.widget li a.show_date{ background: url("./fcfinder/show_date.png") no-repeat; }
63
+ #fcfinder .right ul.widget li a.show_size{ background: url("./fcfinder/show_size.png") no-repeat; }
64
+ #fcfinder .right ul.widget li a.sort{ background: url("./fcfinder/sort.png") no-repeat; }
65
+ #fcfinder .right ul.widget li a.name_sorter{ background: url("./fcfinder/name_sorter.png") no-repeat; }
66
+ #fcfinder .right ul.widget li a.size_sorter{ background: url("./fcfinder/size_sorter.png") no-repeat; }
67
+ #fcfinder .right ul.widget li a.date_sorter{ background: url("./fcfinder/date_sorter.png") no-repeat; }
68
+ #fcfinder .right ul.widget li a.kind_sorter{ background: url("./fcfinder/kind_sorter.png") no-repeat; }
69
+ #fcfinder .right ul.widget li a.about{ background: url("./fcfinder/about.png") no-repeat; }
70
+
71
+ #fcfinder .right ul.widget li a.passive {
72
+ -webkit-filter: grayscale(100%);
73
+ filter: grayscale(100%);}
74
+
75
+
76
+
77
+
78
+
79
+ #fcfinder .right ul.widget div { position: absolute; padding:0; margin:0; z-index:1; display: none; padding-top:8px; margin-left: -10px; }
80
+ #fcfinder .right ul.widget li:hover div { display: block; }
81
+
82
+ #fcfinder .right ul.widget div ul { padding:0; margin:0px; background: #DDD; clear: both; float: left; padding-left:3px;border-radius:0px 0px 5px 5px; border: 2px solid #CCC; border-top: 0px none;}
83
+ #fcfinder .right ul.widget li div ul li { clear: both; margin-bottom: 8px; padding:0; text-align: center; margin-left:5px;}
84
+ #fcfinder .right ul.widget li div ul li:hover a {
85
+ box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.80);
86
+ -webkit-box-shadow:rgba(0, 0, 0, 0.80) 0 2px 5px 0;
87
+ -moz-box-shadow:rgba(0, 0, 0, 0.80) 0 2px 5px 0;
88
+ }
89
+
90
+
91
+
92
+ /*#fcfinder .right .widget {height:35px; border: 1px solid #c0c0c0; background: #f0f0f0; width: 99%; margin:0px 0px 0 5px; border-radius: 5px;}*/
93
+ #fcfinder .right ul.wrapper {height:2%; border: 1px solid #c0c0c0; background: #f0f0f0; margin:5px 0px 0 5px; border-radius: 5px; list-style: none; padding:0px; overflow:auto;}
94
+
95
+ #fcfinder .right ul.wrapper.list_view {}
96
+ #fcfinder .right ul.wrapper.list_view li div { display: flex; float: left; width:100%; height: 35px !important; padding: 0; margin: 0; border: 0; background-size: 24px 24px !important; background-position: 5px 5px !important;}
97
+ #fcfinder .right ul.wrapper.list_view li div.directory { background: url("./fcfinder/directory_mini.png") 5px 5px no-repeat;}
98
+ #fcfinder .right ul.wrapper.list_view li div span.file_name { font-size:13px; overflow: hidden; float: left; margin: 0; padding:8px 5px 0 35px; width: 200px; text-align: left;}
99
+ #fcfinder .right ul.wrapper.list_view li div span.file_name input { width:95%; padding: 0 2px;font-size: 12px;height: 15px;border-radius: 5px;display: block;border: 1px solid #999;}
100
+ #fcfinder .right ul.wrapper.list_view li div span.file_size { float: left; font-size: 12px; color: #666; display:block !important;; margin: 0; padding: 8px 5px 0 10px; text-align:left; width: 100px;}
101
+ #fcfinder .right ul.wrapper.list_view li div span.file_date { float: left; font-size: 12px; color: #666; display:block !important; margin: 0; padding: 8px 5px 0 10px; text-align:left; width: 180px;}
102
+ #fcfinder .right ul.wrapper.list_view li div:hover {box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26); color: #fff; -webkit-box-shadow:rgba(0, 0, 0, 0.26) 0 2px 5px 0;-moz-box-shadow:rgba(0, 0, 0, 0.26) 0 2px 5px 0; background-color:#1E92CC !important; border: 0px none;border-radius: 0;}
103
+ #fcfinder .right ul.wrapper.list_view li div.active {box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26); color: #fff; -webkit-box-shadow:rgba(0, 0, 0, 0.26) 0 2px 5px 0;-moz-box-shadow:rgba(0, 0, 0, 0.26) 0 2px 5px 0; background-color:#1E92CC !important; border: 0px none; border-radius: 0;}
104
+ #fcfinder .right ul.wrapper.list_view li div.list_head { width: 100%; background: #ddd; color: #000; font-size: 14px; border-radius: 0 !important; border-bottom: 1px solid #ccc; cursor: default; }
105
+ #fcfinder .right ul.wrapper.list_view li div.list_head:hover { color:#000; background-color:#ddd !important; box-shadow:none !important; -webkit-box-shadow:none !important;-moz-box-shadow:none !important; border-bottom: 1px solid #ccc;}
106
+ #fcfinder .right ul.wrapper.list_view li div.list_head span.file_name { color: #000; font-size: 13px; width:200px; text-align: left;}
107
+ #fcfinder .right ul.wrapper.list_view li div.list_head span.file_size { color: #000; font-size: 13px; width:100px; text-align: left;}
108
+ #fcfinder .right ul.wrapper.list_view li div.list_head span.file_date { color: #000; font-size: 13px; width:180px; text-align: left;}
109
+ /*----*/
110
+ #fcfinder .right ul.wrapper.icon_view {}
111
+
112
+ #fcfinder .right ul.wrapper li { margin:0px; display:block; width: 100%;}
113
+ #fcfinder .right ul.wrapper li div { border: 2px solid transparent; position: relative; font-size:13px; text-align: center; float: left; margin:5px; padding: 5px; width:75px; height:80px;/*line-height: 145px;*/ overflow: hidden; display: block; outline: none; cursor: pointer; border-radius: 5px; max-height: 128px; }
114
+
115
+ #fcfinder .right ul.wrapper li div.directory { background: url("./fcfinder/directory.png") center 5px no-repeat; }
116
+ #fcfinder .right ul.wrapper li div.other { background: url("./fcfinder/files/other.png") center 5px no-repeat; }
117
+ /*---*/
118
+ #fcfinder .dialog .file_bg.seven_z,#fcfinder .right ul.wrapper li div.seven_z { background: url("./fcfinder/files/7z.png") center 5px no-repeat; }
119
+ #fcfinder .dialog .file_bg.avi,#fcfinder .right ul.wrapper li div.avi { background: url("./fcfinder/files/avi.png") center 5px no-repeat; }
120
+ #fcfinder .dialog .file_bg.bmp,#fcfinder .right ul.wrapper li div.bmp{ background: url("./fcfinder/files/bmp.png") center 5px no-repeat; }
121
+ #fcfinder .dialog .file_bg.bz,#fcfinder .right ul.wrapper li div.bz { background: url("./fcfinder/files/bz.png") center 5px no-repeat; }
122
+ #fcfinder .dialog .file_bg.bz2,#fcfinder .right ul.wrapper li div.bz2 { background: url("./fcfinder/files/bz2.png") center 5px no-repeat; }
123
+ #fcfinder .dialog .file_bg.css,#fcfinder .right ul.wrapper li div.css { background: url("./fcfinder/files/css.png") center 5px no-repeat; }
124
+ #fcfinder .dialog .file_bg.doc,#fcfinder .right ul.wrapper li div.doc { background: url("./fcfinder/files/doc.png") center 5px no-repeat; }
125
+ #fcfinder .dialog .file_bg.docx,#fcfinder .right ul.wrapper li div.docx { background: url("./fcfinder/files/docx.png") center 5px no-repeat; }
126
+ #fcfinder .dialog .file_bg.dv,#fcfinder .right ul.wrapper li div.dv { background: url("./fcfinder/files/dv.png") center 5px no-repeat; }
127
+ #fcfinder .dialog .file_bg.flv,#fcfinder .right ul.wrapper li div.flv { background: url("./fcfinder/files/flv.png") center 5px no-repeat; }
128
+ #fcfinder .dialog .file_bg.gif,#fcfinder .right ul.wrapper li div.gif { background: url("./fcfinder/files/gif.png") center 5px no-repeat; }
129
+ #fcfinder .dialog .file_bg.gz,#fcfinder .right ul.wrapper li div.gz { background: url("./fcfinder/files/gz.png") center 5px no-repeat; }
130
+ #fcfinder .dialog .file_bg.html,#fcfinder .right ul.wrapper li div.html { background: url("./fcfinder/files/html.png") center 5px no-repeat; }
131
+ #fcfinder .dialog .file_bg.htm,#fcfinder .right ul.wrapper li div.htm { background: url("./fcfinder/files/htm.png") center 5px no-repeat; }
132
+ #fcfinder .dialog .file_bg.ico,#fcfinder .right ul.wrapper li div.ico { background: url("./fcfinder/files/ico.png") center 5px no-repeat; }
133
+ #fcfinder .dialog .file_bg.jpeg,#fcfinder .right ul.wrapper li div.jpeg { background: url("./fcfinder/files/jpeg.png") center 5px no-repeat; }
134
+ #fcfinder .dialog .file_bg.jpg,#fcfinder .right ul.wrapper li div.jpg { background: url("./fcfinder/files/jpg.png") center 5px no-repeat; }
135
+ #fcfinder .dialog .file_bg.js,#fcfinder .right ul.wrapper li div.js { background: url("./fcfinder/files/js.png") center 5px no-repeat; }
136
+ #fcfinder .dialog .file_bg.mid,#fcfinder .right ul.wrapper li div.mid { background: url("./fcfinder/files/mid.png") center 5px no-repeat; }
137
+ #fcfinder .dialog .file_bg.mkv,#fcfinder .right ul.wrapper li div.mkv { background: url("./fcfinder/files/mkv.png") center 5px no-repeat; }
138
+ #fcfinder .dialog .file_bg.mov,#fcfinder .right ul.wrapper li div.mov { background: url("./fcfinder/files/mov.png") center 5px no-repeat; }
139
+ #fcfinder .dialog .file_bg.mp3,#fcfinder .right ul.wrapper li div.mp3 { background: url("./fcfinder/files/mp3.png") center 5px no-repeat; }
140
+ #fcfinder .dialog .file_bg.mp4,#fcfinder .right ul.wrapper li div.mp4 { background: url("./fcfinder/files/mp4.png") center 5px no-repeat; }
141
+ #fcfinder .dialog .file_bg.mp4a,#fcfinder .right ul.wrapper li div.mp4a { background: url("./fcfinder/files/mp4a.png") center 5px no-repeat; }
142
+ #fcfinder .dialog .file_bg.mpg,#fcfinder .right ul.wrapper li div.mpg { background: url("./fcfinder/files/mpg.png") center 5px no-repeat; }
143
+ #fcfinder .dialog .file_bg.ogg,#fcfinder .right ul.wrapper li div.ogg { background: url("./fcfinder/files/ogg.png") center 5px no-repeat; }
144
+ #fcfinder .dialog .file_bg.pdf,#fcfinder .right ul.wrapper li div.pdf { background: url("./fcfinder/files/pdf.png") center 5px no-repeat; }
145
+ #fcfinder .dialog .file_bg.php,#fcfinder .right ul.wrapper li div.php { background: url("./fcfinder/files/php.png") center 5px no-repeat; }
146
+ #fcfinder .dialog .file_bg.png,#fcfinder .right ul.wrapper li div.png { background: url("./fcfinder/files/png.png") center 5px no-repeat; }
147
+ #fcfinder .dialog .file_bg.pps,#fcfinder .right ul.wrapper li div.pps { background: url("./fcfinder/files/pps.png") center 5px no-repeat; }
148
+ #fcfinder .dialog .file_bg.ppt,#fcfinder .right ul.wrapper li div.ppt { background: url("./fcfinder/files/ppt.png") center 5px no-repeat; }
149
+ #fcfinder .dialog .file_bg.psd,#fcfinder .right ul.wrapper li div.psd { background: url("./fcfinder/files/psd.png") center 5px no-repeat; }
150
+ #fcfinder .dialog .file_bg.pptx,#fcfinder .right ul.wrapper li div.pptx { background: url("./fcfinder/files/pptx.png") center 5px no-repeat; }
151
+ #fcfinder .dialog .file_bg.rar,#fcfinder .right ul.wrapper li div.rar { background: url("./fcfinder/files/rar.png") center 5px no-repeat; }
152
+ #fcfinder .dialog .file_bg.rb,#fcfinder .right ul.wrapper li div.rb { background: url("./fcfinder/files/rb.png") center 5px no-repeat; }
153
+ #fcfinder .dialog .file_bg.swf,#fcfinder .right ul.wrapper li div.swf { background: url("./fcfinder/files/swf.png") center 5px no-repeat; }
154
+ #fcfinder .dialog .file_bg.tar,#fcfinder .right ul.wrapper li div.tar { background: url("./fcfinder/files/tar.png") center 5px no-repeat; }
155
+ #fcfinder .dialog .file_bg.tbz,#fcfinder .right ul.wrapper li div.tbz { background: url("./fcfinder/files/tbgz.png") center 5px no-repeat; }
156
+ #fcfinder .dialog .file_bg.tga,#fcfinder .right ul.wrapper li div.tga { background: url("./fcfinder/files/tga.png") center 5px no-repeat; }
157
+ #fcfinder .dialog .file_bg.tgz,#fcfinder .right ul.wrapper li div.tgz { background: url("./fcfinder/files/tgz.png") center 5px no-repeat; }
158
+ #fcfinder .dialog .file_bg.tif,#fcfinder .right ul.wrapper li div.tif { background: url("./fcfinder/files/tif.png") center 5px no-repeat; }
159
+ #fcfinder .dialog .file_bg.tiff,#fcfinder .right ul.wrapper li div.tiff { background: url("./fcfinder/files/tiff.png") center 5px no-repeat; }
160
+ #fcfinder .dialog .file_bg.txt,#fcfinder .right ul.wrapper li div.txt { background: url("./fcfinder/files/txt.png") center 5px no-repeat; }
161
+ #fcfinder .dialog .file_bg.mpeg,#fcfinder .right ul.wrapper li div.mpeg { background: url("./fcfinder/files/mpeg.png") center 5px no-repeat; }
162
+ #fcfinder .dialog .file_bg.wav,#fcfinder .right ul.wrapper li div.wav { background: url("./fcfinder/files/wav.png") center 5px no-repeat; }
163
+ #fcfinder .dialog .file_bg.wm,#fcfinder .right ul.wrapper li div.wm { background: url("./fcfinder/files/wm.png") center 5px no-repeat; }
164
+ #fcfinder .dialog .file_bg.wma,#fcfinder .right ul.wrapper li div.wma { background: url("./fcfinder/files/wma.png") center 5px no-repeat; }
165
+ #fcfinder .dialog .file_bg.xls,#fcfinder .right ul.wrapper li div.xls { background: url("./fcfinder/files/xls.png") center 5px no-repeat; }
166
+ #fcfinder .dialog .file_bg.xlsx,#fcfinder .right ul.wrapper li div.xlsx { background: url("./fcfinder/files/xlsx.png") center 5px no-repeat; }
167
+ #fcfinder .dialog .file_bg.xml,#fcfinder .right ul.wrapper li div.xml { background: url("./fcfinder/files/xml.png") center 5px no-repeat; }
168
+ #fcfinder .dialog .file_bg.zip,#fcfinder .right ul.wrapper li div.zip { background: url("./fcfinder/files/zip.png") center 5px no-repeat; }
169
+ /*--*/
170
+
171
+
172
+
173
+
174
+ #fcfinder .right ul.wrapper li div:hover {box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26); color: #fff; -webkit-box-shadow:rgba(0, 0, 0, 0.26) 0 2px 5px 0;-moz-box-shadow:rgba(0, 0, 0, 0.26) 0 2px 5px 0; background-color:#1E92CC !important; border: 2px solid #216DCC;}
175
+ #fcfinder .right ul.wrapper li div.active {box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26); color: #fff; -webkit-box-shadow:rgba(0, 0, 0, 0.26) 0 2px 5px 0;-moz-box-shadow:rgba(0, 0, 0, 0.26) 0 2px 5px 0; background-color:#1E92CC !important; border: 2px solid #216DCC;}
176
+ #fcfinder .right ul.wrapper li div.cutting { opacity: 0.5;}
177
+ #fcfinder .right ul.wrapper li div span.file_name { font-size:13px; text-align: center; display: block; margin-top: 64px; height: 16px; overflow: hidden;}
178
+ #fcfinder .right ul.wrapper li div span.file_name input { width: 69px;padding: 0 2px;font-size: 12px;height: 14px;border-radius: 5px;display: block;border: 1px solid #999;}
179
+ #fcfinder .right ul.wrapper li div span.file_date,
180
+ #fcfinder .right ul.wrapper li div span.file_size { font-size: 12px; color: #666; display: none;}
181
+
182
+ #fcfinder .right ul.wrapper li div:hover span.file_date,
183
+ #fcfinder .right ul.wrapper li div:hover span.file_size ,
184
+ #fcfinder .right ul.wrapper li div.active span.file_date,
185
+ #fcfinder .right ul.wrapper li div.active span.file_size {color: #ddd;}
186
+
187
+
188
+ #fcfinder .right ul.wrapper li div.image_file { background: none; background-size: 80px 60px;}
189
+
190
+
191
+
192
+
193
+
194
+
195
+ #fcfinder ul.bottom { margin: 0; padding: 0; list-style: none; position: fixed;left: 10px;font-size: 13px;color: #555;bottom: 5px; }
196
+ #fcfinder .left ul.folders { list-style: none; margin:10px 10px; padding: 0px; font-size: 14px; }
197
+ #fcfinder .left ul.folders li ul.folders { margin-top:4px; margin-left:20px; margin-bottom: 0px;}
198
+ #fcfinder .left ul.folders li { margin:1px 0px;}
199
+ #fcfinder .left ul.folders li a { text-decoration: none; color: #555; display: flex;}
200
+
201
+
202
+
203
+ #fcfinder .left ul.folders li a span.braca {width: 16px; height: 16px; padding:3px 0px 0px 0px; float: left;}
204
+ #fcfinder .left ul.folders li a span.braca.closed { background: url("./fcfinder/tree/plus.png") no-repeat left center;}
205
+ #fcfinder .left ul.folders li a span.braca.opened {background: url("./fcfinder/tree/minus.png") no-repeat left center;}
206
+
207
+ #fcfinder .left ul.folders li a span.folder {border:1px solid transparent; background: url("./fcfinder/tree/folder.png") no-repeat 2px center; padding:1px 10px 2px 22px; margin-left: 2px;
208
+ position:relative;
209
+ overflow:hidden;
210
+ -webkit-transition: all 0.2s ease;
211
+ -moz-transition: all 0.2s ease;
212
+ -o-transition: all 0.2s ease;
213
+ transition: all 0.2s ease;
214
+ z-index:0;
215
+ }
216
+
217
+
218
+
219
+
220
+
221
+ #fcfinder .left ul.folders li a:hover{ color:#fff;}
222
+ #fcfinder .left ul.folders li a:hover span.folder { border-radius: 3px; background: url("./fcfinder/tree/folder.png") no-repeat 2px center #ccc; border: 1px solid #999; box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26);
223
+ -webkit-box-shadow:rgba(0, 0, 0, 0.26) 0 2px 5px 0;
224
+ -moz-box-shadow:rgba(0, 0, 0, 0.26) 0 2px 5px 0;}
225
+
226
+ #fcfinder .left ul.folders li a.active{ color:#fff;}
227
+ #fcfinder .left ul.folders li a.active span.folder { border-radius: 3px; background: url("./fcfinder/tree/folder.png") no-repeat 2px center #1e92cc; border: 1px solid #216dcc;box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26);
228
+ -webkit-box-shadow:rgba(0, 0, 0, 0.26) 0 2px 5px 0;
229
+ -moz-box-shadow:rgba(0, 0, 0, 0.26) 0 2px 5px 0;}
230
+
231
+ #fcfinder .upload_field {cursor: pointer;}
232
+ #fcfinder span.load {background: url("./fcfinder/tree/loader.gif"); float: left;width: 16px; height: 16px;}
233
+ #fcfinder span.folder_load {background: url("./fcfinder/tree/loader.gif") no-repeat; display:block; min-height: 16px; margin: 7px 0px 0px 37px; padding-left: 18px; color: #000;}
234
+
235
+ #fcfinder .clear { clear: both; width: 100%; height:0px;}
236
+
237
+
238
+ #fcfinder .dialog { border-radius:4px;
239
+ background-color: #FFF;
240
+ padding: 10px;
241
+ min-width: 250px;
242
+ max-width: 90%;
243
+ max-height: 90%;
244
+ overflow: auto;
245
+ min-height: 150px;
246
+ box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26);
247
+ -webkit-box-shadow:rgba(0, 0, 0, 0.26) 0 2px 5px 0;
248
+ -moz-box-shadow:rgba(0, 0, 0, 0.26) 0 2px 5px 0;
249
+ z-index: 6;
250
+ position: absolute;
251
+ left: 0;
252
+ top: 0;
253
+ }
254
+ #fcfinder .dialog h1 { margin: 0px; padding:5px; font-size:22px; border-bottom: 1px solid #ccc; font-weight: 500; }
255
+ #fcfinder .dialog .file_bg { float: left; width: 64px; height: 64px !important; margin:15px; display: block;padding-right: 20px;}
256
+ #fcfinder .dialog .file_bg.directory { background: url("./fcfinder/directory.png") no-repeat;}
257
+
258
+ #fcfinder .dialog img.preview { margin: 0 auto; padding: 10px; display: block;}
259
+
260
+ #fcfinder .dialog span.file_name{ font-size:18px; font-weight: bold; display: block; margin-top: 15px;}
261
+ #fcfinder .dialog span.file_type{margin-top:5px;font-size:15px;display: block;}
262
+ #fcfinder .dialog ul.file_info{ list-style: none; margin: 0; padding: 0; clear: both;font-size: 14px;}
263
+ #fcfinder .dialog ul.file_info li { }
264
+ #fcfinder .dialog ul.file_info li span { width: 125px; text-align: right; display: block; float: left; padding-right: 10px;}
265
+ #fcfinder .dialog ul.file_info li a{ color: #06f;}
266
+ #fcfinder .dialog ul.file_info li a:hover {color: #3F51B5;}
267
+ #fcfinder .dialog a.close { position: relative; overflow: hidden; font-size: 13px; font-weight: bold; color: #3F51B5; text-decoration: none; border-radius: 5px; text-transform: uppercase; padding:10px 15px; display: block; float: right;}
268
+ #fcfinder .dialog a.close:hover{background-color: rgba(158, 158, 158, 0.2);}
269
+ #fcfinder .dialog a.btn { position: relative; overflow: hidden; font-size: 13px; font-weight: bold; color: #3F51B5; text-decoration: none; border-radius: 5px; text-transform: uppercase; padding:10px 15px; display: block; float: right;}
270
+ #fcfinder .dialog a.btn:hover{background-color: rgba(158, 158, 158, 0.2);}
271
+
272
+ #fcfinder .dialog div.content { padding:15px 5px;}
273
+ #fcfinder .dialog div.content div { padding:5px;}
274
+ #fcfinder .dialog-scope { position: fixed; z-index: 5; background:#000; opacity: 0.5; width: 100%; height: 100%; left: 0; top:0; }
275
+
276
+ #fcfinder .dialog.danger { border:2px solid #A94442;
277
+ -webkit-box-shadow: 0px 0px 20px 5px #A94442;
278
+ -moz-box-shadow: 0px 0px 20px 5px #A94442;
279
+ box-shadow: 0px 0px 20px 5px #A94442;
280
+ }
281
+ #fcfinder .dialog.warning{ border: 2px solid #CEA969;
282
+ -webkit-box-shadow: 0px 0px 20px 5px #CEA969;
283
+ -moz-box-shadow: 0px 0px 20px 5px #CEA969;
284
+ box-shadow: 0px 0px 20px 5px #CEA969;
285
+ }
286
+ #fcfinder .dialog.success { border: 2px solid #6CBC6D;
287
+ -webkit-box-shadow: 0px 0px 20px 5px #6CBC6D;
288
+ -moz-box-shadow: 0px 0px 20px 5px #6CBC6D;
289
+ box-shadow: 0px 0px 20px 5px #6CBC6D;
290
+ }
291
+
292
+
293
+
294
+
295
+ #fcfinder ul#ctxMenu {margin: 0; padding: 0; list-style: none; position: absolute; display: block; width:200px; max-height:350px;height: 300px; overflow: auto; overflow-x:hidden; z-index: 4;border: solid 1px #CCC; background: #fff; box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26);-webkit-box-shadow:rgba(0, 0, 0, 0.26) 0 2px 5px 0;-moz-box-shadow:rgba(0, 0, 0, 0.26) 0 2px 5px 0; border-radius: 3px;}
296
+ #fcfinder ul#ctxMenu li { padding:3px 0; font-size: 13px; }
297
+ #fcfinder ul#ctxMenu li a {padding:8px; display: block; color: #000; text-decoration: none; border-left: 5px solid transparent; }
298
+ #fcfinder ul#ctxMenu li a.none:hover { background: none;border-left: 5px solid transparent; }
299
+
300
+ #fcfinder ul#ctxMenu li a:hover {background: #ededed; border-left: 5px solid #ddd; }
301
+ #fcfinder ul#ctxMenu li.hr {padding:0px;font-size:0%; border-bottom: 1px solid #ccc;}
302
+
303
+ #progress {
304
+ position: fixed;
305
+ z-index: 1;
306
+ top: 0;
307
+ left: -6px;
308
+ width: 1%;
309
+ height: 2px;
310
+ background: #1293cc;
311
+ -moz-border-radius: 1px;
312
+ -webkit-border-radius: 1px;
313
+ border-radius: 1px;
314
+ -moz-transition: width 500ms ease-out,opacity 400ms linear;
315
+ -ms-transition: width 500ms ease-out,opacity 400ms linear;
316
+ -o-transition: width 500ms ease-out,opacity 400ms linear;
317
+ -webkit-transition: width 500ms ease-out,opacity 400ms linear;
318
+ transition: width 500ms ease-out,opacity 400ms linear;
319
+ }
320
+
321
+ #progress dd, #progress dt {
322
+ position: absolute;
323
+ top: 0;
324
+ height: 3px;
325
+ -moz-box-shadow: #1293cc 1px 0 6px 1px;
326
+ -ms-box-shadow: #1293cc 1px 0 6px 1px;
327
+ -webkit-box-shadow: #1293cc 1px 0 6px 1px;
328
+ box-shadow: #1293cc 1px 0 6px 1px;
329
+ -moz-border-radius: 100%;
330
+ -webkit-border-radius: 100%;
331
+ border-radius: 100%;
332
+ background:#1293CC;
333
+ }
334
+
335
+ #progress dt {
336
+ opacity: .6;
337
+ width: 180px;
338
+ right: -80px;
339
+ clip: rect(-6px,90px,14px,-6px);
340
+ }
341
+
342
+ #progress dd {
343
+ opacity: .6;
344
+ width: 20px;
345
+ right: 0;
346
+ clip: rect(-6px,22px,14px,10px);
347
+ }
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "fcfinder"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
data/fcfinder.gemspec ADDED
@@ -0,0 +1,31 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'fcfinder/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "fcfinder"
8
+ spec.version = Fcfinder::VERSION
9
+ spec.authors = ["Furkan \xC3\x87elik"]
10
+ spec.email = ["furkan.celik32@gmail.com"]
11
+
12
+ spec.summary = %q{Rails icin web dosya gezgini}
13
+ spec.description = %q{Dosya yukleme klasor olusturma gibi islemleri hızlıbir şekilde yapabileceginiz cke tinymce gibi editorlerle entegreli kullanacieceginiz dosya gezgini}
14
+ spec.homepage = "https://github.com/furkancelik/fcfinder"
15
+ spec.license = "MIT"
16
+
17
+
18
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
+ spec.bindir = "exe"
20
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.9"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ spec.add_dependency "mini_magick", "~> 4.2"
26
+ spec.add_dependency "rubyzip", "~> 1.1"
27
+
28
+ #spec.requirements << "zip"
29
+ #spec.requirements << "mini_magick"
30
+
31
+ end
data/lib/fcfinder.rb ADDED
@@ -0,0 +1,7 @@
1
+ require 'fileutils'
2
+ require 'zip'
3
+ require 'mini_magick'
4
+ require 'fcfinder/version'
5
+ require 'fcfinder/engine'
6
+ require 'fcfinder/zip_file_generator'
7
+ require 'fcfinder/connector'
@@ -0,0 +1,612 @@
1
+ module Fcfinder
2
+ class Connector
3
+ attr_reader :run
4
+
5
+ def initialize(file,host_url,fc_params=nil,options = {})
6
+
7
+ #Max dosya boyutu boş ise 1MB dosya yüklemesine izin ver
8
+ @max_file_size = options[:max_file_size] ||= 1_000_000
9
+ @allowed_mime = options[:allowed_mime] ||= {}
10
+ @disallowed_mime = options[:disallowed_mime] ||= {}
11
+ #izin verilen dosyalar
12
+ @permission_mime = permission_mime(@allowed_mime,@disallowed_mime)
13
+
14
+ @file = file
15
+ @fcdir = file.chomp('/*')
16
+ @main_folder = @fcdir.split('/').last
17
+ @host_url = host_url
18
+ @main_file = {}
19
+
20
+
21
+ if fc_params.nil?
22
+ @main_params = append_file(file)
23
+ @main_params[:main_file] = {:path => file.split('/')[-2], :url => file, :sub_dir => @main_file[:sub_dir]}
24
+ result = [@main_params, @main_params[:directory].size+@main_params[:file].size, format_mb(directory_size(@main_params[:main_file][:url].chomp('/*')))]
25
+ else
26
+ result = case fc_params[:type]
27
+ when 'path_to_url'
28
+ path_to_url(get_path(fc_params[:path]))
29
+
30
+ #Tum Dosyaları Listele
31
+ #Klasor Secilme İslemi Yapilinca
32
+ when 'all_file_list'
33
+ all_file_list(get_path(fc_params[:url]))
34
+
35
+ #Yeni Klasor Olusturma
36
+ when 'create_directory'
37
+ create_directory(fc_params[:path], fc_params[:directory_name])
38
+
39
+ #Yenileme Islemi
40
+ when 'refresh'
41
+ refresh(get_path(fc_params[:path]))
42
+
43
+ #Dosya Indirme Islemi
44
+ when 'download'
45
+ download(get_path(fc_params[:path]))
46
+
47
+ #Bilgiler
48
+ when 'info'
49
+ info_and_preview(fc_params[:file], fc_params[:kind])
50
+
51
+ #Onizleme
52
+ when 'preview'
53
+ info_and_preview(fc_params[:file], fc_params[:kind])
54
+
55
+ #Dosya Kopyala
56
+ when 'copy'
57
+ copy(get_path(fc_params[:copy_file_path]), get_path(fc_params[:this_folder_path]))
58
+
59
+ #Dosya Zorunlu Kopyala
60
+ when 'copy!'
61
+ copy!(get_path(fc_params[:copy_file_path]), get_path(fc_params[:this_folder_path]))
62
+
63
+ #Dosya Kesme
64
+ when 'cut'
65
+ cut(get_path(fc_params[:cut_file_path]), get_path(fc_params[:this_folder_path]))
66
+
67
+ #Dosyayı Zorla Kes
68
+ when 'cut!'
69
+ cut!(get_path(fc_params[:cut_file_path]), get_path(fc_params[:this_folder_path]))
70
+
71
+ #Dosya Kopyasını Oluşturma
72
+ when 'duplicate'
73
+ duplicate(get_path(fc_params[:file_path]))
74
+
75
+ #Dosya Yeniden Adlandır
76
+ when 'file_rename'
77
+ file_rename(get_path(fc_params[:path]), fc_params[:file_name])
78
+
79
+ #Dosya Silme İşlemi
80
+ when 'delete'
81
+ delete!(get_path(fc_params[:file_path]))
82
+
83
+ #Dosya Yükleme İşlemi
84
+ when 'upload'
85
+ upload(fc_params[:upload], get_path(fc_params[:path]))
86
+
87
+ #Dosya Duzenleme
88
+ when 'edit_file'
89
+ edit_file(get_path(fc_params[:file_path]))
90
+ else
91
+ # type code here
92
+ end
93
+ end
94
+ @run = result.to_json
95
+ end
96
+
97
+
98
+ def path_to_url(path)
99
+ if File.exist?(path)
100
+ ['true',path]
101
+ else
102
+ %w(false 0)
103
+ end
104
+ end
105
+
106
+
107
+ def all_file_list(url)
108
+ @url_params = append_file(url+'/*')
109
+ [@url_params,@url_params[:directory].size+@url_params[:file].size,format_mb(directory_size(url))]
110
+ end
111
+
112
+ def create_directory(path,directory_name)
113
+ create_file_path = File.join(get_path(path),directory_name)
114
+ create_file_thumbs = create_file_path.sub(@fcdir.chomp('/'),@fcdir.chomp('/')+'/.thumbs')
115
+ if File.exist?(create_file_path)
116
+ #-1 => Aynı İsimde Dosya Var Dosya Oluşmadı
117
+ %w(false -1)
118
+ else
119
+ if Dir.mkdir(create_file_path) && Dir.mkdir(create_file_thumbs)
120
+ ['true', {:top_dir => path, :path => set_path(create_file_path)}]
121
+ else
122
+ #0 => Herhangibir Hata var Dosya Oluşmadı
123
+ %w(false 0)
124
+ end
125
+ end
126
+ end
127
+
128
+ def refresh(path)
129
+ append_file(File.join(path,'/*'))
130
+ end
131
+
132
+ def add_zip_file(path, output_file)
133
+ zf = ZipFileGenerator.new(path, output_file)
134
+ zf.write
135
+ end
136
+
137
+ def download(path)
138
+ begin
139
+ if File.directory?(path)
140
+ output_file = path.chomp('/')+'.zip'
141
+ add_zip_file(path, output_file)
142
+ file = set_path(output_file).sub('fcdir:/', '').split('/').join(':')
143
+ type = path.chomp('/')+'.zip'
144
+ else
145
+ file = set_path(path).sub('fcdir:/', '').split('/').join(':')
146
+ type = path
147
+ end
148
+ result = { :file => file, :type => MIME::Types.type_for(type).first.content_type }
149
+ rescue Exception => e
150
+ result = ['false', '0',e.to_s]
151
+ end
152
+ result
153
+ end
154
+
155
+ def info_and_preview(file,kind)
156
+ { :url => get_url(file),
157
+ :path => file,
158
+ :size => kind=='directory' ? format_mb(directory_size(get_path(file))) : format_mb(File.size(get_path(file))),
159
+ :ctime => File.ctime(get_path(file)).strftime('%d/%m/%Y %H:%M'),
160
+ :mtime => File.mtime(get_path(file)).strftime('%d/%m/%Y %H:%M'),
161
+ :type => File.directory?(get_path(file)) ? 'directory' : set_type(MIME::Types.type_for(get_path(file)).first.content_type) ,
162
+ :mime_type => File.directory?(get_path(file)) ? 'directory' : MIME::Types.type_for(get_path(file)).first.content_type ,
163
+ :permissions => {:write => File.writable?(get_path(file)).to_s, :read => File.readable?(get_path(file)).to_s}
164
+ }
165
+ end
166
+
167
+ def thumbs(opt)
168
+ thumbs = ''
169
+ thumbs = opt[:target].sub(@fcdir.chomp('/'),@fcdir.chomp('/')+'/.thumbs') if opt[:type] == :cut || opt[:type] == :copy || opt[:type] == :rename
170
+ thumbs = opt[:file_path].sub(@fcdir.chomp('/'), @fcdir.chomp('/')+'/.thumbs') if opt[:type] == :duplicate || opt[:type] == :duplicate2
171
+ if File.directory?(opt[:file])
172
+ FileUtils.cp_r(opt[:file].sub(@fcdir.chomp('/'),@fcdir.chomp('/')+'/.thumbs'),thumbs) if opt[:type ] == :copy
173
+ FileUtils.mv(opt[:file].sub(@fcdir.chomp('/'),@fcdir.chomp('/')+'/.thumbs'),thumbs) if opt[:type ] == :cut
174
+ FileUtils.cp_r(thumbs, opt[:folder_name].sub(@fcdir.chomp('/'), @fcdir.chomp('/')+'/.thumbs')+'/'+opt[:file_name]+' copy 1'+opt[:extension]) if opt[:type ] == :duplicate
175
+ FileUtils.cp_r(thumbs, opt[:new_file_path].sub(@fcdir.chomp('/'), @fcdir.chomp('/')+'/.thumbs')) if opt[:type2] == :duplicate2
176
+ FileUtils.mv(thumbs, File.join(opt[:folder_name].sub(@fcdir.chomp('/'), @fcdir.chomp('/')+'/.thumbs'),opt[:file_name])) if opt[:type] == :rename
177
+ else
178
+ if %w(image/x-ms-bmp image/jpeg image/gif image/png).include?(MIME::Types.type_for(opt[:file]).first.content_type)
179
+ unless File.exist?(thumbs)
180
+ _folder = ''
181
+ thumbs.split('/').each do |folder|
182
+ _folder << folder+'/'
183
+ unless File.exist?(_folder)
184
+ Dir.mkdir(_folder.chomp('/'))
185
+ end
186
+ end
187
+ end
188
+ FileUtils.cp_r(opt[:file].sub(@fcdir.chomp('/'),@fcdir.chomp('/')+'/.thumbs'),thumbs) if opt[:type] == :copy
189
+ FileUtils.mv(opt[:file].sub(@fcdir.chomp('/'),@fcdir.chomp('/')+'/.thumbs'),thumbs) if opt[:type] == :cut
190
+ FileUtils.cp_r(thumbs, opt[:folder_name].sub(@fcdir.chomp('/'), @fcdir.chomp('/')+'/.thumbs')+'/'+opt[:file_name]+' copy 1'+opt[:extension]) if opt[:type] == :duplicate
191
+ FileUtils.cp_r(thumbs, opt[:new_file_path].sub(@fcdir.chomp('/'), @fcdir.chomp('/')+'/.thumbs')) if opt[:type] == :duplicate2
192
+ FileUtils.mv(thumbs, File.join(opt[:folder_name].sub(@fcdir.chomp('/'), @fcdir.chomp('/')+'/.thumbs'),opt[:file_name])) if opt[:type] == :rename
193
+ end
194
+ end
195
+ end
196
+
197
+ def image_resize(file_path)
198
+ file_path.each do |file|
199
+ #ORJ=>thumbs = file.sub(@fcdir.chomp('/'), @fcdir.chomp('/')+'/.thumbs').chomp(file.sub(@fcdir.chomp('/'), @fcdir.chomp('/')+'/.thumbs').split('/').last).chomp('/')
200
+ thumbs = file.sub(@fcdir.chomp('/'), @fcdir.chomp('/')+'/.thumbs').chomp(file.split('/').last).chomp('/')
201
+ unless File.exist?(thumbs)
202
+ _folder = ''
203
+ thumbs.split('/').each do |folder|
204
+ _folder << folder + '/'
205
+ unless File.exist?(_folder)
206
+ Dir.mkdir(_folder.chomp('/'))
207
+ end
208
+ end
209
+ end
210
+ image = MiniMagick::Image.open(file)
211
+ image.resize '64x64'
212
+ image.write(file.sub(@fcdir.chomp('/'), @fcdir.chomp('/')+'/.thumbs'))
213
+ end
214
+ end
215
+
216
+ def copy(file,target)
217
+ begin
218
+ file_path = File.join(target,file.split('/').last)
219
+ if File.exist?(file_path)
220
+ #0 => Aynı Dosyadan Var
221
+ result = %w(false 0)
222
+ else
223
+ #Kopyalama İşlemini Gerçekleştir
224
+ FileUtils.cp_r(file,target)
225
+ thumbs({:file=>file, :target=>target, :type=>:copy})
226
+ result = %w(true)
227
+ end
228
+ rescue Exception => e
229
+ result = ['false', '-1',e.to_s]
230
+ end
231
+ result
232
+ end
233
+
234
+ def copy!(file,target)
235
+ begin
236
+ #Kopyalama İşlemini Gerçekleştir
237
+ FileUtils.cp_r(file,target)
238
+
239
+ #thumbs'a kopyasını gönder
240
+ thumbs({:file=>file, :target=>target, :type=>:copy})
241
+ result = %w(true)
242
+ rescue Exception => e
243
+ result = ['false', '-1',e.to_s]
244
+ end
245
+ result
246
+ end
247
+
248
+ def cut(file,target)
249
+ begin
250
+ file_path = target.chomp('/')+'/'+file.split('/').last
251
+ if File.exist?(file_path) || File.directory?(file_path)
252
+ #0 => Aynı Dosyadan Var
253
+ result = %w(false 0)
254
+ else
255
+ #Kesme İşlemini Gerçekleştir
256
+ FileUtils.mv(file,target)
257
+ #thumbs'a kopyasını gönder
258
+ thumbs({:file=>file, :target=>target, :type=>:cut})
259
+ result = %w(true)
260
+ end
261
+ rescue Exception => e
262
+ result = ['false', '-1',e.to_s]
263
+ end
264
+ result
265
+ end
266
+
267
+ def cut!(file,target)
268
+ begin
269
+ #Kesme İşlemini Gerçekleştir
270
+ FileUtils.mv(file,target)
271
+ #thumbs'a kopyasını gönder
272
+ thumbs({:file=>file, :target=>target, :type=>:cut})
273
+ result = %w(true)
274
+ rescue Exception => e
275
+ result = ['false', '-1',e.to_s]
276
+ end
277
+ result
278
+ end
279
+
280
+ def duplicate(file)
281
+ begin
282
+ file_path = file.chomp('/')
283
+ extension = (file_path.split('/').last.split('.').size>1) ? '.'+file_path.split('/').last.split('.').last : ''
284
+ file_name = file_path.split('/').last.chomp(extension)
285
+ folder_name = file_path.chomp(file_path.split('/').last).chomp('/')
286
+
287
+ reg_file = "#{file_name}".match(/(.+?) copy ([0-9])/i)
288
+ if reg_file.nil? && !File.exist?(folder_name+'/'+file_name+' copy 1'+extension)
289
+ FileUtils.cp_r(file_path, folder_name+'/'+file_name+' copy 1'+extension)
290
+ #thumbs dosyaları ekle
291
+ thumbs({:file_path=>file_path,:file=>file_path,:type=>:duplicate,:folder_name=>folder_name,:file_name=>file_name,:extension=>extension})
292
+ result = %w(true)
293
+ else
294
+ #"file_name copy 1" şeklinde bir dosya adı var
295
+ reg_file = "#{file_name} copy 1#{extension}".match(/(.+?) copy ([0-9])/i) if reg_file.nil?
296
+ j = Dir.glob("#{folder_name}/#{reg_file[1]} copy *#{extension}").last.match(/#{reg_file[1]} copy ([0-9])#{extension}/)[1].to_i + 1
297
+
298
+ new_file_name = "#{reg_file[1]} copy #{j}#{extension}"
299
+ new_file_path = folder_name.chomp('/')+'/'+new_file_name
300
+ FileUtils.cp_r(file_path, new_file_path)
301
+ #thumbs'a kopyasını gönder
302
+ thumbs({:file_path=>file_path,:file=>file_path,:type=>:duplicate2,:new_file_path=>new_file_path})
303
+ result = %w(true)
304
+ end
305
+ rescue Exception => e
306
+ result = ['false', '-1',e.to_s]
307
+ end
308
+ result
309
+ end
310
+
311
+ def file_rename(path,file_name)
312
+ begin
313
+ if File.exist?(path)
314
+ folder_name = path.chomp(path.split('/').last).chomp('/')
315
+ FileUtils.mv(path,folder_name+'/'+file_name)
316
+ #thumbs'a kopyasını gönder
317
+ thumbs({:file=>path,:target=>path,:type=>:rename,:folder_name=>folder_name,:file_name=>file_name})
318
+ result = %w(true)
319
+ else
320
+ #return false Dosya Yok!
321
+ result = %w(false)
322
+ end
323
+ rescue Exception => e
324
+ result = ['false', '-1',e.to_s]
325
+ end
326
+ result
327
+ end
328
+
329
+ def delete!(path)
330
+ begin
331
+ if File.exist?(path)
332
+ FileUtils.rm_rf(path)
333
+ FileUtils.rm_rf(path.sub(@fcdir.chomp('/'), @fcdir.chomp('/')+'/.thumbs')) if File.exist?(path.sub(@fcdir.chomp('/'), @fcdir.chomp('/')+'/.thumbs'))
334
+ result = %w(true)
335
+ else
336
+ #return false Dosya Yok!
337
+ result = %w(false 0)
338
+ end
339
+ rescue Exception => e
340
+ result = ['false', '-1',e.to_s]
341
+ end
342
+ result
343
+ end
344
+
345
+ def upload(upload_files,path)
346
+ begin
347
+ image_mime_type = %w(image/x-ms-bmp image/jpeg image/gif image/png)
348
+ file_path,error_delete_file = [],[]
349
+ upload_files.each do |file|
350
+ #dosya büyük
351
+ return ['false', '0',format_mb(@max_file_size)] if file.tempfile.size > @max_file_size
352
+ #format yok
353
+ return ['false', '-1',@permission_mime.to_a] unless @permission_mime.has_key?(file.original_filename.split('.').last) || @permission_mime[file.original_filename.split('.').last]==file.content_type
354
+ file_path.push(File.join(path,file.original_filename)) if image_mime_type.include?(file.content_type)
355
+ error_delete_file.push(File.join(path,file.original_filename))
356
+ File.open(File.join(path,file.original_filename), 'wb') do |f|
357
+ f.write(file.read)
358
+ end
359
+ end
360
+
361
+ # resimleri yeniden boyutlandır
362
+ image_resize(file_path)
363
+ result = %w(true)
364
+ rescue Exception => e
365
+ error_delete_file.each do |file|
366
+ FileUtils.rm_rf(file) unless File.size(file) > 0
367
+ end
368
+ result = ['false', '-2',e.to_s]
369
+ end
370
+ result
371
+ end
372
+
373
+ def edit_file(path)
374
+ File.exist?(path) ?
375
+ { :url => get_url(set_path(path)), :title => path.chomp('/').split('/').last } :
376
+ %w(false 0)
377
+ end
378
+
379
+ def append_file(files_url)
380
+ all_file,all_dir = {},{}
381
+ Dir.glob(files_url).each do |file|
382
+ if File.directory?(file)
383
+ @main_file[:sub_dir] = true if @main_file[:sub_dir].nil?
384
+ all_dir[file.split('/').last] = {:file=>file,:url => get_url(set_path(file)), :sub_dir => false, :size_2 => directory_size(file), :size => format_mb(directory_size(file)), :ctime => File.ctime(file).strftime('%d/%m/%Y %H:%M'), :path => set_path(file), :type => '_directory'}
385
+ Dir.glob(file+'/*').each do |sub_dir|
386
+ if File.directory?(sub_dir)
387
+ all_dir[file.split('/').last][:sub_dir] = true
388
+ end
389
+ end
390
+ else
391
+ all_file[file.split('/').last] = {:file=>file, :path => set_path(file), :url => get_url(set_path(file)), :type => set_type(MIME::Types.type_for(file).first.content_type), :size_2 => File.size(file), :size => format_mb(File.size(file)), :ctime => File.ctime(file).strftime('%d/%m/%Y %H:%M')}
392
+ end
393
+ end
394
+ { :directory => all_dir, :file => all_file }
395
+ end
396
+
397
+
398
+ def set_path(path)
399
+ path.chomp('/').sub(@fcdir, 'fcdir:')
400
+ end
401
+
402
+
403
+ def get_path(path)
404
+ path.chomp('/').sub('fcdir:',@fcdir)
405
+ end
406
+
407
+
408
+ def set_url(path)
409
+ path.chomp('/').sub(File.join(@host_url,@main_folder)+@main_folder, 'fcdir:')
410
+ end
411
+
412
+
413
+ def get_url(path)
414
+ path.chomp('/').sub('fcdir:',File.join(@host_url,@main_folder))
415
+ end
416
+
417
+
418
+ def set_type(type)
419
+ case type
420
+ when 'application/vnd.ms-word'
421
+ 'doc'
422
+ when 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
423
+ 'docx'
424
+ when 'application/vnd.ms-excel'
425
+ 'xls'
426
+ when 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
427
+ 'xlsx'
428
+ when 'application/vnd.openxmlformats-officedocument.presentationml.presentation'
429
+ 'pptx'
430
+ when 'application/vnd.ms-powerpoint'
431
+ 'ppt'
432
+ when 'application/pdf'
433
+ 'pdf'
434
+ when 'application/xml'
435
+ 'xml'
436
+ when 'application/x-shockwave-flash'
437
+ 'swf'
438
+ when 'application/x-gzip', 'application/gzip'
439
+ 'gz'
440
+ when 'application/x-gtar'
441
+ 'tgz'
442
+ when 'application/x-bzip'
443
+ 'bz'
444
+ when 'application/x-bzip2'
445
+ 'bz2'
446
+ when 'application/zip'
447
+ 'zip'
448
+ when 'application/x-rar', 'application/x-rar-compressed'
449
+ 'rar'
450
+ when 'application/x-tar'
451
+ 'tar'
452
+ when 'application/x-7z-compressed'
453
+ '7z'
454
+ when 'text/plain'
455
+ 'txt'
456
+ when 'text/x-php', 'application/x-httpd-php'
457
+ 'php'
458
+ when 'text/html'
459
+ 'html'
460
+ when 'text/htm'
461
+ 'htm'
462
+ when 'application/javascript'
463
+ 'js'
464
+ when 'text/css'
465
+ 'css'
466
+ when 'application/x-ruby'
467
+ 'rb'
468
+ when 'image/tiff'
469
+ 'tiff'
470
+ when 'image/x-targa'
471
+ 'tga'
472
+ when 'image/vnd.adobe.photoshop'
473
+ 'psd'
474
+ when 'image/x-icon'
475
+ 'ico'
476
+ when 'audio/mpeg'
477
+ 'mp3'
478
+ when 'audio/midi'
479
+ 'mid'
480
+ when 'audio/ogg'
481
+ 'ogg'
482
+ when 'audio/mp4'
483
+ 'mp4a'
484
+ when 'audio/wav', 'audio/x-wav'
485
+ 'wav'
486
+ when 'audio/x-ms-wma'
487
+ 'vma'
488
+ when 'video/x-msvideo'
489
+ 'avi'
490
+ when 'video/x-dv'
491
+ 'dv'
492
+ when 'video/mp4'
493
+ 'mp4'
494
+ when 'video/mpeg'
495
+ 'mpeg'
496
+ when 'video/mpeg'
497
+ 'mpg'
498
+ when 'video/quicktime'
499
+ 'mov'
500
+ when 'video/x-ms-wmv'
501
+ 'vm'
502
+ when 'video/x-flv'
503
+ 'flv'
504
+ when 'video/x-matroska'
505
+ 'mkv'
506
+ when 'image/png', 'image/jpeg','image/x-ms-bmp','image/gif'
507
+ 'image_file'
508
+ else
509
+ 'other'
510
+ end
511
+ end
512
+
513
+
514
+ def directory_size(path)
515
+ path << '/' unless path.end_with?('/')
516
+ raise RuntimeError, "#{path} is not a directory" unless File.directory?(path)
517
+ total_size = 0
518
+ Dir["#{path}**/*"].each do |f|
519
+ total_size += File.size(f) if File.file?(f) && File.size?(f)
520
+ end
521
+ total_size
522
+ end
523
+
524
+
525
+ def format_mb(size)
526
+ conv = %w(B KB MB GB TER PB EB)
527
+ scale = 1024
528
+ ndx=1
529
+ return "#{(size)} #{conv[ndx-1]}" if size < 2*(scale**ndx)
530
+ size=size.to_f
531
+ [2,3,4,5,6,7].each do |ndx|
532
+ return "#{'%.3f' % (size/(scale**(ndx-1)))} #{conv[ndx-1]}" if size < 2*(scale**ndx)
533
+ end
534
+ ndx=7
535
+ "#{'%.3f' % (size/(scale**(ndx-1)))} #{conv[ndx-1]}"
536
+ end
537
+
538
+
539
+ def permission_mime(allowed_mime,disallowed_mime)
540
+ permission = {
541
+ 'doc' => 'application/vnd.ms-word',
542
+ 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
543
+ 'xls' => 'application/vnd.ms-excel',
544
+ 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
545
+ 'ppt' => 'application/vnd.ms-powerpoint',
546
+ 'pps' => 'application/vnd.ms-powerpoint',
547
+ 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
548
+ 'pdf' => 'application/pdf',
549
+ 'xml' => 'application/xml',
550
+ 'swf' => 'application/x-shockwave-flash',
551
+ # archives
552
+ 'gz' => 'application/x-gzip',
553
+ 'tgz' => 'application/x-gzip',
554
+ 'bz' => 'application/x-bzip2',
555
+ 'bz2' => 'application/x-bzip2',
556
+ 'tbz' => 'application/x-bzip2',
557
+ 'zip' => 'application/zip',
558
+ 'rar' => 'application/x-rar',
559
+ 'tar' => 'application/x-tar',
560
+ 'rar' => 'application/x-rar-compressed',
561
+ '7z' => 'application/x-7z-compressed',
562
+ # texts
563
+ 'txt' => 'text/plain',
564
+ 'php' => 'text/x-php',
565
+ 'html' => 'text/html',
566
+ 'htm' => 'text/html',
567
+ 'js' => 'text/javascript',
568
+ 'css' => 'text/css',
569
+ 'rtf' => 'text/rtf',
570
+ 'rtfd' => 'text/rtfd',
571
+ 'py' => 'text/x-python',
572
+ 'java' => 'text/x-java-source',
573
+ 'rb' => 'text/x-ruby',
574
+ 'erb' => 'text/x-ruby',
575
+ 'sh' => 'text/x-shellscript',
576
+ 'pl' => 'text/x-perl',
577
+ 'sql' => 'text/x-sql',
578
+ # images
579
+ 'bmp' => 'image/x-ms-bmp',
580
+ 'jpg' => 'image/jpeg',
581
+ 'jpeg' => 'image/jpeg',
582
+ 'gif' => 'image/gif',
583
+ 'png' => 'image/png',
584
+ 'tif' => 'image/tiff',
585
+ 'tiff' => 'image/tiff',
586
+ 'tga' => 'image/x-targa',
587
+ 'psd' => 'image/vnd.adobe.photoshop',
588
+ 'ico' => 'image/x-icon',
589
+ # audio
590
+ 'mp3' => 'audio/mpeg',
591
+ 'mid' => 'audio/midi',
592
+ 'ogg' => 'audio/ogg',
593
+ 'mp4a' => 'audio/mp4',
594
+ 'wav' => 'audio/wav',
595
+ 'wma' => 'audio/x-ms-wma',
596
+ # video
597
+ 'avi' => 'video/x-msvideo',
598
+ 'dv' => 'video/x-dv',
599
+ 'mp4' => 'video/mp4',
600
+ 'mpeg' => 'video/mpeg',
601
+ 'mpg' => 'video/mpeg',
602
+ 'mov' => 'video/quicktime',
603
+ 'wm' => 'video/x-ms-wmv',
604
+ 'flv' => 'video/x-flv',
605
+ 'mkv' => 'video/x-matroska'
606
+ }
607
+ permission.merge!(allowed_mime)
608
+ permission.delete_if {|key| disallowed_mime.include?(key) }
609
+ permission
610
+ end
611
+ end
612
+ end