PluginProbe ʕ •ᴥ•ʔ
Download Manager / 3.3.63
Download Manager v3.3.63
3.3.63 3.3.62 3.3.61 3.3.60 3.3.59 3.3.58 3.3.57 3.3.56 trunk 2.1.3 2.3.0 2.5.96 2.5.97 2.6.2 2.6.96 2.8.3 2.9.99 3.0.4 3.1.05 3.1.07 3.1.08 3.1.11 3.1.12 3.1.14 3.1.17 3.1.18 3.1.22 3.1.23 3.1.24 3.1.25 3.1.26 3.1.27 3.1.28 3.2.04 3.2.13 3.2.14 3.2.16 3.2.18 3.2.19 3.2.21 3.2.22 3.2.23 3.2.24 3.2.25 3.2.27 3.2.28 3.2.29 3.2.30 3.2.31 3.2.32 3.2.33 3.2.34 3.2.35 3.2.37 3.2.38 3.2.39 3.2.40 3.2.41 3.2.42 3.2.43 3.2.44 3.2.45 3.2.46 3.2.47 3.2.48 3.2.49 3.2.50 3.2.51 3.2.52 3.2.53 3.2.54 3.2.55 3.2.56 3.2.57 3.2.58 3.2.59 3.2.60 3.2.61 3.2.63 3.2.64 3.2.65 3.2.66 3.2.67 3.2.68 3.2.69 3.2.70 3.2.71 3.2.72 3.2.73 3.2.74 3.2.75 3.2.76 3.2.77 3.2.78 3.2.79 3.2.80 3.2.81 3.2.82 3.2.83 3.2.84 3.2.85 3.2.86 3.2.87 3.2.88 3.2.89 3.2.90 3.2.91 3.2.92 3.2.93 3.2.94 3.2.95 3.2.96 3.2.97 3.2.98 3.2.99 3.3.00 3.3.01 3.3.02 3.3.03 3.3.04 3.3.05 3.3.06 3.3.07 3.3.08 3.3.09 3.3.10 3.3.11 3.3.12 3.3.13 3.3.14 3.3.15 3.3.16 3.3.17 3.3.18 3.3.19 3.3.20 3.3.21 3.3.22 3.3.23 3.3.24 3.3.25 3.3.26 3.3.27 3.3.28 3.3.29 3.3.30 3.3.31 3.3.32 3.3.33 3.3.34 3.3.35 3.3.36 3.3.37 3.3.38 3.3.39 3.3.40 3.3.41 3.3.42 3.3.43 3.3.44 3.3.45 3.3.46 3.3.47 3.3.48 3.3.49 3.3.50 3.3.51 3.3.52 3.3.53 3.3.54 3.3.55
download-manager / src / AssetManager / views / asset-manager-ui.php
download-manager / src / AssetManager / views Last commit date
asset-manager-picker.php 7 months ago asset-manager-ui.php 1 week ago dir-viewer.php 9 months ago embed-asset.php 5 years ago
asset-manager-ui.php
1844 lines
1 <?php
2
3 use WPDM\AssetManager\AssetManager;
4
5 if(!defined('ABSPATH')) die('Error!');
6 global $current_user;
7 $root = AssetManager::root();
8 //$items = file_exists($root)?glob($root.'*', GLOB_ONLYDIR):array();
9 if(is_admin()){
10 ?>
11
12 <div>
13
14 <?php
15 }
16 ?>
17 <style>
18 @import url("https://fonts.googleapis.com/css2?family=Overpass+Mono&subset=latin");
19 #wpcontent{
20 padding-left: 0 !important;
21 }
22 #mainfmarea{
23 width: calc(100% - 160px);
24 position: fixed;
25 z-index: 99;
26 }
27 #wpdm-dashboard-content{
28 overflow: visible;
29 }
30 #rename, #upfile, #newfol{
31 z-index: 999999999999;
32 padding-top: 150px;
33 overflow: hidden;
34 }
35 #upfile{
36 width: 350px;
37 }
38 #upfile .drag-drop .drag-drop-inside{
39 margin: 45px auto 0;
40 width: 300px;
41 }
42 #upfile .panel-heading{
43 box-shadow: none !important;
44 background: #f5f5f5;
45 }
46 #filelist .panel-heading{
47 padding-right: 30px;
48 }
49 .w3eden #upfile .progress-bar-info {
50 background-color: var(--color-purple);
51 }
52 #breadcrumb,
53 .wpdm-file-locator,
54 .wpdm-dir-locator a.explore-dir{
55 font-family: 'Overpass Mono', sans-serif !important;
56 }
57 .well-file{
58 font-family: Montserrat,sans-serif;
59 font-size: 12px;
60 line-height: 40px;
61 }
62 .progress:after{
63 position: absolute;
64 color: rgba(0,0,0,0.3);
65 width: 100%;
66 text-align: center;
67 left: 0;
68 font-family: Montserrat,sans-serif;
69 font-size: 12px;
70 text-transform: uppercase;
71 }
72 .panel-file{
73 font-size: 12px;
74 }
75 .panel-file .media-body {
76 line-height: normal;
77 display: inline-block;
78 }
79 .item_label{
80 margin-top: 5px;
81 font-size: 9pt;
82 line-height: 1;
83 display: block;
84 font-weight: 600;
85 letter-spacing: 0.5px;
86 color: #5e6a6d;
87 }
88
89 .w3eden .well .btn-sm{
90 padding: 8px 16px;
91 }
92 .panel-file .panel-footer{
93 text-align: center;
94 }
95 .modal *{
96 font-size: 10pt;
97 }
98 .w3eden .modal-header{
99 font-size: 10pt;
100 line-height: normal;
101 font-family: var(--wpdm-font);
102 background: #f5f5f5;
103 border-radius: 10px 10px 0 0 !important;
104 }
105 .w3eden .modal-footer{
106 border: 0 !important;
107 border-radius: 0 0 10px 10px !important;
108 padding-top: 0;
109 }
110 .w3eden .modal-content{
111 border-radius: 10px !important;
112 box-shadow: 0 0 25px rgba(0,0, 0, 0.2);
113 }
114 #drag-drop-area{
115 border: 0.2rem dashed #28c83599 !important;
116 border-radius: 5px;
117 font-family: "Overpass Mono", monospace;
118 color: rgba(0,0,0,0.2);
119 font-size: 14pt;
120 }
121 #drag-drop-area .btn{
122 font-family: "Overpass Mono", monospace;
123 border-radius: 500px;
124 }
125
126 #breadcrumb{
127 margin: 10px 0 10px;
128 font-size: 9pt;
129 color: #888888;
130 }
131
132 .w3eden .panel.wpdm-file-manager-panel{
133 border: 0 !important;
134 box-shadow: none !important;
135 border-radius: 0 !important;
136 margin-bottom: 0 !important;
137 }
138 .w3eden .panel.wpdm-file-manager-panel .panel-heading{
139 /*background: linear-gradient(to bottom, rgb(253, 255, 255) 0%,rgb(240, 243, 243) 100%);*/
140 background: rgba(240, 243, 243, 0.3);
141 border-top: 1px solid #e7eaea !important;
142 border-bottom: 1px solid #e7eaea !important;
143 /*box-shadow: 2px 0 5px rgba(18, 150, 201, 0.09);*/
144
145 }
146 .panel-heading,
147 #breadcrumb a{
148 color: #aaaaaa;
149 text-transform: unset !important;
150 font-weight: 400;
151 }
152 #breadcrumb .fa{
153 color: #8896aa;
154 display: inline-block;
155 margin-top: -2px !important;
156 vertical-align: middle;
157 margin-right: 5px;
158 margin-left: 5px;
159 }
160 .panel-file .panel-body{
161 height: 130px;
162 text-align: center;
163 }
164 #scandir .file-row,
165 #scandir .dir-row{
166 padding: 10px 10px 10px 0;
167 border-bottom: 1px solid #eeeeee;
168 -webkit-transition: all ease-in-out 300ms;
169 -moz-transition: all ease-in-out 300ms;
170 -ms-transition: all ease-in-out 300ms;
171 -o-transition: all ease-in-out 300ms;
172 transition: all ease-in-out 300ms;
173 }
174 #scandir .file-row:hover, #scandir .dir-row:hover {
175 background: rgba(0,0,0,0.02);
176 -webkit-transition: all ease-in-out 300ms;
177 -moz-transition: all ease-in-out 300ms;
178 -ms-transition: all ease-in-out 300ms;
179 -o-transition: all ease-in-out 300ms;
180 transition: all ease-in-out 300ms;
181
182 }
183 img.icon{
184 width: 38px;
185 margin-right: 5px;
186 padding: 0 !important;
187 }
188 #scandir img{
189 box-shadow: none;
190 margin-bottom: 0;
191 }
192 .action-btns-ctrl{
193 line-height: 40px;
194 width: 32px;
195 text-align: center;
196 outline: none !important;
197 margin-right: 5px;
198 }
199 .action-btns {
200 opacity: 0 !important;
201 position: absolute !important;
202 z-index: -99;
203 right: 50px;
204 white-space: nowrap;
205 -webkit-transition: all ease-in-out 400ms;
206 -moz-transition: all ease-in-out 400ms;
207 -ms-transition: all ease-in-out 400ms;
208 -o-transition: all ease-in-out 400ms;
209 transition: all ease-in-out 400ms;
210 line-height: 40px;
211 }
212 .action-btns.action-btns-show{
213 opacity: 1 !important;
214 z-index: 999;
215 }
216
217 .action-btns .btn.btn-xs {
218 width: 32px;
219 height: 28px;
220 line-height: 26px;
221 padding: 0;
222 font-size: 8pt;
223 text-align: center;
224 border-radius: 5px;
225 }
226
227 .c-pointer{
228 color: #1272d2;
229 transition: all ease-in-out 300ms;
230 }
231 .c-pointer:hover{
232 color: #2c92fa;
233 }
234 .d-inline-block{
235 display: inline-block !important;
236 }
237
238 img.fm-folder{
239 box-shadow: none;
240 width: 16px;
241 display: inline-block;
242 vertical-align: middle;
243 }
244 .wpdmfm-folder-tree{
245 padding: 0;
246 margin: 0;
247 }
248
249 .wpdmfm-folder-tree li{
250 list-style: none;
251 padding: 0;
252 margin: 0;
253 font-size: 12px;
254 color: #757f8d;
255 white-space: nowrap;
256 line-height: 20px;
257 }
258 .wpdmfm-folder-tree li > .handle{
259 background: url("<?php echo WPDM_BASE_URL.'assets/images/folder.svg' ?>") left center no-repeat;
260 background-size: 16px;
261 display: inline-block;
262 width: 20px;
263 height: 20px;
264 float: left;
265 cursor: pointer;
266 }
267 .wpdmfm-folder-tree ul{
268 margin-left: 18px !important;
269 padding-left: 0;
270 }
271 .wpdmfm-folder-tree li a:visited,
272 .wpdmfm-folder-tree li a:hover,
273 .wpdmfm-folder-tree li a{
274 color: #657989;
275 text-decoration: none;
276 font-family: var(--wpdm-font);
277 cursor: pointer;
278 }
279 .wpdmfm-folder-tree li a:hover{
280 color: #6075c8;
281 }
282 .wpdmfm-folder-tree li.expanded > .handle{
283 background: url("<?php echo WPDM_BASE_URL.'assets/images/folder-o.svg' ?>") left 2px no-repeat;
284 background-size: 16px;
285 }
286 .wpdmfm-folder-tree li.busy > .handle{
287 background: url("<?php echo WPDM_BASE_URL.'assets/images/loader.svg' ?>") left no-repeat;
288 background-size: 16px;
289 }
290 .wpdm-dir-locator,
291 .wpdm-file-locator{
292 padding: 15px !important;
293 }
294 .wpdm-dir-locator{
295 background: rgba(240, 243, 243, 0.2);
296 border-right: 1px solid #e7eaea;
297 }
298
299 [data-simplebar]{
300 height: 500px;
301 overflow: auto;
302 min-width: 100%;
303 }
304 .wpdm-dir-locator .simplebar-content{
305 overflow-x: auto !important;
306 }
307 .wpdm-file-locator [data-simplebar]{
308 overflow-x: hidden !important;
309 }
310
311 #wpbody-content{
312 margin-bottom: 0 !important;
313 padding-bottom: 0 !important;
314 }
315
316 #mainfmc{
317 overflow: hidden;
318 }
319 .w3eden #mainfmc .btn{
320 text-transform: capitalize !important;
321 font-family: var(--wpdm-font) !important;
322 font-weight: 400 !important;
323 }
324
325 .w3eden .btn.btn-simple:not(:hover){
326 color: #7886a2;
327 border-color: #c9cfdb;
328 }
329
330 .w3eden .btn.btn-simple:hover { background-color: rgba(201, 207, 219, 0.2) !important; }
331 .w3eden .btn.btn-simple:hover:not(.btn-danger):not(.btn-info):not(.btn-primary):not(.btn-success){ color: #3c5382; }
332 .w3eden .btn.btn-simple.btn-success:hover { background-color: rgba(var(--color-success-rgb), 0.1) !important; }
333 .w3eden .btn.btn-simple.btn-primary:hover { background-color: rgba(var(--color-primary-rgb), 0.1) !important; }
334 .w3eden .btn.btn-simple.btn-danger:hover { background-color: rgba(var(--color-danger-rgb), 0.1) !important; }
335 .w3eden .btn.btn-simple.btn-info:hover { background-color: rgba(var(--color-info-rgb), 0.1) !important; }
336 .w3eden .btn.btn-simple.btn-warning:hover { background-color: rgba(var(--color-warning-rgb), 0.1) !important; color: var(--color-warning) !important; }
337
338 .w3eden .btn.btn-simple:active {
339 box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.13);
340 }
341
342 #wpdmeditor{
343 position: absolute;
344 left: 0;
345 top: 0;
346 border: 0;
347 width: 100%;
348 height: calc(100vh - 150px);
349 z-index: 9;
350 box-shadow: none;
351 border-radius: 0;
352 }
353 #wpdmeditor .panel-heading{
354 border-top: 0 !important;
355 }
356 #wpdmeditor .panel-heading,
357 #wpdmeditor .panel-footer{
358 border-radius: 0;
359 }
360 #wpdmeditor #filecontent_alt,
361 #wpdmeditor #filecontent{
362 height: calc(100% - 40px);
363 width: 100%;
364 padding: 30px;
365 overflow: auto;
366 font-family: "Overpass Mono", monospace;
367 border: 0;
368 background: transparent;
369 }
370 .CodeMirror.cm-s-default.CodeMirror-wrap{
371 height: calc(100% - 94px);
372 }
373 #wpdmeditor #filecontent_alt{
374 text-align: center;
375 }
376 #wpdmeditor #filecontent_alt img{
377 max-width: 100%;
378 }
379 #filewin{
380 -webkit-transition: all ease-in-out 400ms;
381 -moz-transition: all ease-in-out 400ms;
382 -ms-transition: all ease-in-out 400ms;
383 -o-transition: all ease-in-out 400ms;
384 transition: all ease-in-out 400ms;
385 }
386
387 .w3eden #__file_settings_tabs.nav.nav-tabs > li > a{
388 box-shadow: none !important;
389 border: 1px solid #e8e8e8;
390 padding: 8px 16px;
391 font-size: 10px;
392 font-weight: 400 !important;
393 }
394 .w3eden #__file_settings_tabs.nav.nav-tabs > li.active > a{
395 border-bottom: 1px solid #ffffff;
396 }
397 .w3eden #__file_settings_tabs.nav.nav-tabs > li:not(.active) > a{
398 background: #fafafa;
399 }
400
401 .w3eden #__asset_settings .form-control.form-control-lg{
402 border: 0;
403 background: #ffffff; text-align: center; font-family: "Overpass Mono", monospace;font-size: 11pt !important;box-shadow: none !important;
404 }
405 .w3eden #__asset_settings .panel-default{
406 border: 1px solid #e6e6e6;
407 }
408 .w3eden #__asset_settings .panel-default .panel-heading {
409 border-bottom: 1px solid #e6e6e6;
410 background: #fafafa;
411 }
412 .w3eden #__asset_settings .panel-default .panel-footer {
413 border-top: 1px solid #e6e6e6;
414 background: #fafafa;
415 }
416
417 .allow-roles label,
418 .w3eden #__asset_settings .tab-content *,
419 .w3eden #__asset_settings .tab-content{
420 font-size: 11px;
421 }
422 .allow-roles label{
423 font-weight: 400;
424 line-height: 16px;
425 }
426 .allow-roles label input{
427 margin: 0 5px !important;
428 }
429
430
431 .w3eden .modal-header .close.pull-right {
432 height: 16px;
433 line-height: 16px;
434 }
435
436 #__asset_links .asset-link{
437 margin: 5px 0;
438 border: 1px solid #e8e8e8;
439 border-radius: 3px !important;
440 }
441 #__asset_links .asset-link .form-control{
442 background: #ffffff;
443 border: 0 !important;
444 box-shadow: none !important;
445 }
446 #__asset_links .asset-link .input-group-addon{
447 border: 0 !important;
448 background: #ffffff;
449 padding-right: 0;
450 color: var(--color-info);
451 }
452 #__asset_links .asset-link .btn{
453 border: 0 !important;
454 background: #ffffff;
455 color: var(--color-success);
456 border-left: 1px solid #e8e8e8 !important;
457 z-index: 2;
458 }
459 #__asset_links .asset-link .btn .fa-trash.color-danger{
460 color: var(--color-danger) !important;
461 }
462
463 .w3eden #__asset_links .asset-link.input-group-lg > .form-control, .w3eden #__asset_links .asset-link.input-group-lg > .input-group-addon, .w3eden #__asset_links .asset-link.input-group-lg > .input-group-btn > .btn {
464 height: 36px;
465 padding: 8px 12px;
466 }
467
468 .wp-video{ margin: 0 auto !important; width: 100% !important; }
469 .wp-video-shortcode,
470 .wp-audio-shortcode {
471 margin: 15px 15px 10px 15px;
472 width: calc(100% - 30px) !important;
473 }
474 .wp-video-shortcode{
475 height: auto !important;
476 }
477
478 #filelist .panel.upcompleted .panel-heading::before {
479 content: "\f560";
480 position: absolute;
481 color: #41c441;
482 right: 10px;
483 font-family: "Font Awesome 5 Free";
484 transition: all ease-in-out 400ms;
485
486 }
487 #filelist .panel.upfailed .panel-heading::before {
488 content: "\f071";
489 position: absolute;
490 color: var(--color-red);
491 right: 10px;
492 font-family: "Font Awesome 5 Free";
493 transition: all ease-in-out 400ms;
494
495 }
496 button.btn-unzip{
497 display: none !important;
498 }
499 button.btn-unzip.application_zip{
500 display: inline-block !important;
501 }
502 .modal-backdrop.in{
503 display: none;
504 }
505 .w3eden .modal.fade.in{
506 background: rgba(0,0,0,0.3);
507 }
508 #__asset_settings {
509 height: calc(100vh - 190px);
510 overflow: auto;
511 }
512 [data-simplebar]{
513 height: calc(100vh - 175px);
514 }
515 #cogwin > .panel{
516 height: calc(100vh - 146px);
517 box-shadow: none;
518 }
519 .ss-wrapper {
520 overflow: hidden;
521 width: 100%;
522 height: 100%;
523 position: relative;
524 z-index: 1;
525 float: left;
526 }
527
528 .ss-content {
529 height: 100%;
530 width: calc(100% + 18px);
531 padding: 0 0 0 0;
532 position: relative;
533 overflow-x: hidden !important;
534 overflow-y: scroll;
535 box-sizing: border-box;
536 }
537
538 .ss-content.rtl {
539 width: calc(100% + 18px);
540 right: auto;
541 }
542
543 .ss-scroll {
544 position: relative;
545 background: rgba(0, 0, 0, 0.1);
546 width: 9px;
547 border-radius: 4px;
548 top: 0;
549 z-index: 2;
550 cursor: pointer;
551 opacity: 0;
552 transition: opacity 0.25s linear;
553 }
554
555 .ss-hidden {
556 display: none;
557 }
558
559 .ss-container:hover .ss-scroll,
560 .ss-container:active .ss-scroll {
561 opacity: 1;
562 }
563
564 .ss-grabbed {
565 -o-user-select: none;
566 -ms-user-select: none;
567 -moz-user-select: none;
568 -webkit-user-select: none;
569 user-select: none;
570 }
571 </style>
572
573 <div class="w3eden" id="mainfmarea">
574 <?php do_action("wpdm_frontend_filemanager_top", ""); ?>
575 <div id="loadingfm" class="blockui" style="position: fixed;width: 100%;height: 100%;z-index: 99"></div>
576 <div id="mainfmc" class="panel panel-default wpdm-file-manager-panel" style="display: none;">
577 <div class="panel-body">
578 <div class="media well-sm well-file" style="margin: 0;padding: 0">
579 <div class="pull-right">
580 <span id="__file_search"><input v-on:keyup.enter="searchAsset.execute()" type="search" v-model="keyword" placeholder="Search File..." class="form-control input-sm" style="font-family: 'Overpass Mono', monospace;width: 140px;display: inline-block;padding: 0 10px;min-height: 20px;height: 27px;"></span>
581 <button class="btn btn-primary btn-simple btn-sm ttip" title="Reload" id="reload"><i class="fa fa-sync"></i></button>
582 <div class="btn-group">
583 <button class="btn btn-simple btn-sm wpdm-am-newfol" type="button"><i class="fa fa-folder-open"></i> <?php echo __( "New Folder", "download-manager" ) ?></button>
584 <button class="btn btn-simple btn-sm wpdm-am-newfile" type="button"><i class="far fa-file"></i> <?php echo esc_attr__( 'New File', "download-manager" ); ?></button>
585 <button class="btn btn-simple btn-sm" id="btn-upload-file" ><i class="fa fa-cloud-upload-alt"></i> <?php echo __( "Upload File", "download-manager" ) ?></button>
586 </div>
587 <button class="btn btn-info btn-simple btn-sm ttip" id="btn-paste" disabled="disabled" title="Paste"><i class="fa fa-clipboard"></i></button>
588 <button class="btn btn-simple btn-sm ttip" title="Full Screen" onclick="openFullscreen('mainfmarea');"><i class="fa fa-expand-arrows-alt"></i></button>
589 </div>
590 <h3 style="display: inline-block;font-size: 14pt;letter-spacing: 0.5px;font-weight: 600;font-family: var(--wpdm-font)">
591 <img src="<?php echo WPDM_BASE_URL ?>assets/images/asset-manager.svg" style="height: 20px;margin-right: 5px" /> <?php echo __( "Digital Asset Manager", "download-manager" ) ?>
592 </h3>
593 <?php /* if(!current_user_can('manage_options')){ ?>
594 <div class="media-body">
595 <div class="progress text-center" style="margin: 2px 0 0 5px;height: 27px;line-height: 27px;border-radius;border-radius: 2px;font-family: 'Overpass Mono', sans-serif !important;">
596 Used: <span id="disklimit"><i class="fa fa-sun fa-spin"></i></span> | Limit: <?php echo wpdm_user_space_limit(); ?> MB
597 <div title="15% Used" class="progress-bar progress-bar-success progress-bar-striped" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width:0%;line-height: 31px;font-size: 13px;overflow: visible">
598 </div>
599 </div>
600 </div>
601 <?php } */ ?>
602 </div>
603 </div>
604 <div class="panel-heading" style="border-radius: 0;border-top: 1px solid #dddddd">
605 <div id="ldn" style="float:right;font-size: 9pt;margin-top: 10px;display: none" class="text-danger"><i class="fa fa-sun fa-spin"></i> <?php echo esc_attr__( 'Loading', "download-manager" ); ?>...</div>
606 <div v-if="total_pages > 1" id="__asset_pages" style="margin: 0;float: right;font-weight: 400;font-family: 'Overpass Mono', sans-serif !important;white-space: nowrap">
607 <div style="float:left;">
608 <div class="c-pointer d-inline-block" v-on:click="prevPage()"><i v-if="current_page > 1" class="fa fa-arrow-alt-circle-left"></i></div> <span class="text-muted">On Page</span> <strong>{{current_page}}</strong> <span class="text-muted">of total</span> <strong>{{total_pages}}</strong> <div class="c-pointer d-inline-block" v-if="current_page < total_pages" v-on:click="nextPage()"><i class="fa fa-arrow-alt-circle-right"></i></div>
609 </div>
610 <div style="display: inline-block;margin-left: 10px">
611 <div class="input-group input-group-xs" style="width: 90px;">
612 <input type="number" @input="event => goto_page = event.target.value" :value="current_page" :max="total_pages" min="1" placeholder="Page" class="form-control" style="min-height: 16px; line-height: 20px; height: 20px; padding: 0px; font-size: 10px;text-align: center;font-family: 'Overpass Mono', monospace;">
613 <div class="input-group-btn"><button type="button" v-on:click="gotoPage()" class="btn btn-secondary btn-xs">GO</button></div>
614 </div>
615 </div>
616 </div>
617 <div id="breadcrumb" style="margin: 0"></div>
618 </div>
619 <div class="panel-body-c" id="wpdmfm_explorer">
620
621 <div class="row" style="margin: 0">
622 <?php do_action("wpdm_frontend_filemanager_after_breadcrumb", ""); ?>
623 <div class="col-md-3 wpdm-dir-locator">
624 <div data-simplebar ss-container>
625 <ul class="wpdmfm-folder-tree" id="wpdmfm-folder-tree">
626 <li data-path="" id="<?php echo md5('home'); ?>" class="expand-dir"><i class="fa fa-hdd color-purple"></i> <a class="explore-dir" href="#" data-path=""> <?php echo esc_attr__( 'Home', "download-manager" ); ?></a></li>
627 </ul>
628 </div>
629 </div>
630 <div class="col-md-9 wpdm-file-locator" id="filewin">
631 <div id="wpdmeditor" class="panel panel-default blockui" style="display: none;">
632 <div class="panel-heading"><div class="pull-right"><a id="close-editor" href="#"><i class="fa fa-times-circle text-muted"></i></a></div><span id="wpdmefn"></span></div>
633 <textarea id="filecontent"></textarea>
634 <div id="filecontent_alt" style="display: none"></div>
635 <div class="panel-footer text-right">
636 <button type="button" id="savefile" class="btn btn-primary"><i class="fa fa-save"></i> <?php echo __( "Save Changes", "download-manager" ) ?></button>
637 </div>
638 </div>
639 <div data-simplebar ss-container>
640 <div id="scandir">
641 </div>
642 </div>
643 </div>
644 <div class="col-md-3" id="cogwin" style="display: none;">
645 <div class="panel panel-default blockui" style="left:0;width: 100%;border: 0;border-left: 1px solid #eee;border-radius: 0;position: absolute;margin: 0">
646 <div class="panel-heading" style="border-radius: 0;border-top: 0 !important;">
647 <a href="#" class="pull-right" id="close-settings"><i class="fas fa-times-circle text-muted"></i></a>
648 <?php echo esc_attr__( 'Asset Settings', "download-manager" ); ?>
649 </div>
650 <div class="panel-body" id="__asset_settings">
651 <div class="thumbnail text-center" v-html="asset.preview"></div>
652 <div class="form-group">
653 <div class="media" style="border:1px solid #e8e8e8;border-radius: 3px;padding: 10px;">
654 <div class="pull-right">
655 <button class="btn btn-xs btn-secondary btn-rename" type="button" title="<?php echo esc_attr__( 'Rename', "download-manager" ); ?>" data-toggle="modal" data-target="#rename"><i class="fas fa-i-cursor"></i> <?php echo esc_attr__( 'Rename', "download-manager" ); ?></button>
656 </div>
657 <div class="media-body">
658 &nbsp;{{ asset.name }}
659 </div>
660 </div>
661
662 <div class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" id="rename">
663 <div class="modal-dialog modal-sm" role="document">
664 <div class="modal-content">
665 <div class="modal-header">
666 <strong class="modal-title" id="myModalLabel"><?php echo esc_attr__( 'Rename', "download-manager" ); ?></strong>
667 <button type="button" class="close pull-right p-0" data-dismiss="modal" aria-label="Close"><span aria-hidden="true"><i class="fa fa-times-circle"></i></span></button>
668 </div>
669 <div id="upload" class="modal-body">
670 <input type="text" v-bind:value="asset.name" placeholder="<?php echo esc_attr__( 'New Name', "download-manager" ); ?>" id="newname" class="form-control form-control-lg" style="margin: 0px;border: 1px dashed #d4d4d4;">
671 </div>
672 <div class="modal-footer text-right">
673 <button type="button" id="renamenow" class="btn btn-info" :data-assetid="asset.ID" :data-oldname="asset.name" :data-path="asset.path"><?php echo esc_attr__( 'Rename', "download-manager" ); ?></button>
674 </div>
675 </div>
676 </div>
677 </div>
678
679 </div>
680
681 <div>
682
683 <!-- Nav tabs -->
684 <ul class="nav nav-tabs" id="__file_settings_tabs" role="tablist" style="margin-left: -15px;padding-left: 15px;margin-right: -15px;border-bottom: 1px solid #e8e8e8;">
685 <li role="presentation" class="active"><a href="#share" aria-controls="share" role="tab" data-toggle="tab"><?php echo esc_attr__( 'Share', "download-manager" ); ?></a></li>
686 </ul>
687
688 <!-- Tab panes -->
689 <div class="tab-content">
690 <!-- div role="tabpanel" class="tab-pane" id="activity">...</div -->
691 <div role="tabpanel" class="tab-pane active" id="share">
692 <div class="panel panel-default" style="margin-top: 15px;margin-bottom: 0;" v-if="asset.type === 'file'">
693 <div class="input-group" style="border: 0 !important;">
694 <input type="text" readonly="readonly" id="sharecode" class="form-control form-control-lg" v-bind:value="asset.sharecode" />
695 <div onclick="WPDM.copy('sharecode');" class="input-group-addon ttip" title="<?php echo __( "Copy Shortcode", "download-manager" ) ?>" style="border: 0 !important;background: #ffffff;cursor: pointer;"><i class="fa fa-copy color-purple"></i></div>
696 </div>
697 <div class="panel-footer text-center">
698 <?php echo esc_attr__( 'Use the shortcode to embed this asset on any page or post', "download-manager" ); ?>
699 </div>
700 </div>
701
702
703
704
705 </div>
706
707 </div>
708
709 </div>
710 </div>
711 </div>
712 </div>
713 <?php do_action("wpdm_frontend_filemanager_bottom", ""); ?>
714 </div>
715
716 </div>
717 </div>
718
719
720
721 <div id="dirTPL" style="display: none">
722 <div class="dir-row">
723 <div class="row panel-file panel-folder">
724
725 <div class="col-md-8">
726 <div class="media-folder media" data-id="{{dirid}}" data-path="{{path}}" style="cursor: pointer">
727 <img class="icon pull-left" src="<?php echo plugins_url('download-manager/assets/file-type-icons/folder.png'); ?>" />
728 <div class="dir-info"><div class="item_label" title="{{item}}">{{item_label}}</div><small class="color-purple">{{note}}</small></div>
729 </div>
730 </div>
731 <div class="col-md-4 text-right">
732 <?php if(current_user_can('WPDM_ADMIN_CAP') || 1) { ?>
733 <div class="action-btns" id="action-btns-{{id}}">
734 <button class="btn btn-xs btn-simple btn-primary btn-settings" type="button" title="Settings" data-oldname="{{item}}" data-path="{{path}}"><i class="far fa-sun"></i></button>
735 <button class="btn btn-xs btn-simple btn-success btn-zip" type="button" title="Zip" data-dirname="{{item}}" data-dirpath="{{path}}"><i class="fa fa-archive"></i></button>
736 <button class="btn btn-xs btn-info btn-simple" data-item="{{item}}" title="Cut" type="button"><i class="fa fa-cut"></i></button>
737 <button class="btn btn-xs btn-primary btn-simple btn-copy" data-item="{{item}}" title="Copy" type="button"><i class="fa fa-copy"></i></button>
738
739 <button class="btn btn-xs btn-danger btn-simple btn-delete" type="button" title="Delete" data-path="{{path}}"><i class="fas fa-trash"></i></button>
740 </div>
741 <a href="#" class="text-muted pull-right action-btns-ctrl" data-target="#action-btns-{{id}}"><i class="fas fa-ellipsis-v"></i></a>
742 <?php } ?>
743 </div>
744
745 </div>
746 </div>
747 </div>
748
749 <div id="fileTPL" style="display: none">
750
751 <div class="file-row">
752 <div class="row panel-file file-tpl">
753 <div class="col-md-8 text-left btn-open-file c-pointer" data-filetype="{{contenttype}}" data-path="{{path}}">
754
755 <div class="file-info media">
756 <img class="icon pull-left" src="{{icon}}" />
757 <div class="dir-info"><div class="item_label" title="{{item}}">{{item_label}}</div><small class="color-purple">{{note}}</small></div>
758 </div>
759 </div>
760 <div class="col-md-4 text-right">
761 <?php if(current_user_can('WPDM_ADMIN_CAP') || 1) { ?>
762 <div class="action-btns" id="action-btns-{{id}}">
763 <button class="btn btn-xs btn-simple btn-primary btn-settings" type="button" title="Settings" data-oldname="{{item}}" data-path="{{path}}"><i class="far fa-sun"></i></button>
764 <button class="btn btn-xs btn-simple btn-warning btn-unzip {{ext}}" type="button" title="UnZip" data-dirname="{{item}}" data-dirpath="{{path}}"><i class="fas fa-box-open"></i></button>
765 <button class="btn btn-xs btn-simple btn-cut" data-item="{{item}}" title="Cut" type="button"><i class="fa fa-cut"></i></button>
766 <button class="btn btn-xs btn-simple btn-copy" data-item="{{item}}" title="Copy" type="button"><i class="fa fa-copy"></i></button>
767 <a class="btn btn-xs btn-simple btn-download" type="button" title="Download" href="<?php echo home_url('/?wpdmfmdl={{path}}') ?>"><i class="fas fa-arrow-down"></i></a>
768 <button class="btn btn-xs btn-simple btn-danger btn-delete" title="Delete" type="button" data-path="{{path}}"><i class="fas fa-trash"></i></button>
769 </div>
770 <a href="#" class="text-muted pull-right action-btns-ctrl" data-target="#action-btns-{{id}}"><i class="fas fa-ellipsis-v"></i></a>
771 <?php } ?>
772 </div>
773 </div>
774 </div>
775
776 </div>
777
778 <div id="upfile" style="position: fixed;z-index: 999999;bottom: 0px;right: 40px;display: none">
779 <div class="panel panel-default">
780 <div class="panel-heading">
781 <div class="pull-right c-pointer" onclick="jQuery('#upfile').slideUp();"><i class="far fa-window-close color-red"></i></div>
782 <?php echo __( "Upload File", "download-manager" ) ?>
783 </div>
784 <div class="panel-body">
785 <div id="upload" class="modal-body">
786 <div id="plupload-upload-ui" class="hide-if-no-js">
787 <div id="drag-drop-area">
788 <div class="drag-drop-inside">
789 <p class="drag-drop-info"><?php _e('Drop files here'); ?></p>
790 <p><?php _ex('or', 'Uploader: Drop files here - or - Select Files'); ?></p>
791 <p class="drag-drop-buttons"><button id="plupload-browse-button" type="button" class="btn btn-success"> &mdash; <?php esc_attr_e('Select Files'); ?> &mdash; </button></p>
792 </div>
793 </div>
794 </div>
795
796 <?php
797 $slimit = get_option('__wpdm_max_upload_size',0);
798 if($slimit>0)
799 $slimit = wp_convert_hr_to_bytes($slimit.'M');
800 else
801 $slimit = wp_max_upload_size();
802
803 $plupload_init = array(
804 'runtimes' => 'html5,silverlight,flash,html4',
805 'browse_button' => 'plupload-browse-button',
806 'container' => 'plupload-upload-ui',
807 'drop_element' => 'drag-drop-area',
808 'file_data_name' => 'package_file', //(current_user_can(WPDM_ADMIN_CAP)?'package_file':'attach_file'),
809 'multiple_queues' => true,
810 'max_file_size' => $slimit.'b',
811 'url' => admin_url('admin-ajax.php'),
812 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
813 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
814 'filters' => array(array('title' => __('Allowed Files'), 'extensions' => implode(",", WPDM()->fileSystem->getAllowedFileTypes()))),
815 'multipart' => true,
816 'urlstream_upload' => true,
817
818 // additional post data to send to our ajax hook
819 'multipart_params' => array(
820 '_ajax_nonce' => wp_create_nonce(NONCE_KEY),
821 '__noconflict' => 1,
822 '__wpdmfm_upload' => wp_create_nonce(NONCE_KEY),
823 'action' => 'wpdm_admin_upload_file', //(current_user_can(WPDM_ADMIN_CAP)?'wpdm_admin_upload_file':'wpdm_frontend_file_upload'), // the ajax action name
824 ),
825 );
826
827 if(get_option('__wpdm_chunk_upload',0) == 1){
828 $plupload_init['chunk_size'] = get_option('__wpdm_chunk_size', 1024).'kb';
829 $plupload_init['max_retries'] = 3;
830 } else
831 $plupload_init['max_file_size'] = wp_max_upload_size().'b';
832
833 // we should probably not apply this filter, plugins may expect wp's media uploader...
834 $plupload_init = apply_filters('plupload_init', $plupload_init); ?>
835
836
837
838 </div>
839 </div>
840
841 </div>
842
843 <div id="filelist"></div>
844 <div style="clear: both"></div>
845 </div>
846
847 <script type="text/template" id="newfol-tpl">
848 <div id="upload" class="modal-body">
849 <input type="text" placeholder="Folder Name" id="folname" class="form-control form-control-lg" style="margin: 0">
850 </div>
851 <div class="text-right" style="margin-top: 12px">
852 <div style="float:left;display: none;" id="fcd" class="text-success"><i class="fa fa-check-circle"></i> <?php echo esc_attr__( 'Folder Created', "download-manager" ); ?></div>
853 <button type="button" id="createfol" class="btn btn-info"><?php echo esc_attr__( 'Create Folder', "download-manager" ); ?></button>
854 </div>
855 </script>
856
857 <script type="text/template" id="newfile-tpl">
858 <div id="upload" class="modal-body">
859 <input type="text" placeholder="File Name" id="filename" class="form-control form-control-lg" style="margin: 0">
860 </div>
861 <div class="text-right" style="margin-top: 12px">
862 <div style="float:left;display: none;" id="fcd" class="text-success"><i class="fa fa-check-circle"></i> <?php echo esc_attr__( 'File Created', "download-manager" ); ?></div>
863 <button type="button" id="createfile" class="btn btn-info"><?php echo esc_attr__( 'Create File', "download-manager" ); ?></button>
864 </div>
865 </script>
866
867 <div class="modal fade" tabindex="-1" role="dialog" id="__link_settings">
868 <div class="modal-dialog" role="document">
869 <div class="modal-content">
870 <div class="modal-header">
871 <button type="button" class="close pull-right" data-dismiss="modal" aria-label="Close"><span aria-hidden="true"><i class="fa fa-times-circle"></i></span></button>
872 <strong class="modal-title"><?php echo esc_attr__( 'Update link', "download-manager" ); ?></strong>
873 </div>
874 <div class="modal-body">
875 <form id="update_sharelink_form" method="post" action="<?php echo admin_url('admin-ajax.php'); ?>">
876 <?php wp_nonce_field(WPDMAM_NONCE_KEY, '__wpdm_updatelink'); ?>
877 <input type="hidden" name="action" value="wpdm_updatelink" />
878 <input type="hidden" name="ID" v-bind:value="link.ID" />
879 <div class="panel panel-default">
880 <div class="panel-heading" style="box-shadow: none !important;border-bottom: 1px solid #e3e3e3 !important;border-top: 0 !important;"><?php echo __( "Authorized User Groups:", "download-manager" ) ?></div>
881 <div class="panel-body allow-roles">
882
883 <div class="row">
884 <div class="col-md-3">
885 <label><input v-bind:checked="roleSelected('guest')" type="checkbox" name="access[roles][]" value="guest" /> <?php echo __( "All Visitors" , "download-manager" ); ?></label>
886 </div>
887
888 <?php
889 global $wp_roles;
890 $roles = array_reverse($wp_roles->role_names);
891 foreach( $roles as $role => $name ) {
892 ?>
893 <div class="col-md-3"><label><input v-bind:checked="roleSelected('<?php echo $role; ?>')" type="checkbox" name="access[roles][]" value="<?php echo $role; ?>" /> <?php echo $name; ?></label></div>
894 <?php } ?>
895 </div>
896 </div>
897
898 <?php
899 if(is_plugin_active('wpdm-custom-access-level/wpdm-custom-access-level.php')){ ?>
900
901
902 <div class="panel-heading" style="box-shadow: none !important;border-radius: 0;border-top: 1px solid #e3e3e3;"><?php echo __('Authorized Users:','download-manager'); ?></div>
903 <div class="panel-body" id="_uaco">
904
905
906 <span style="margin-right: 3px" class="btn btn-simple btn-sm" id="uaco-admin" v-for="user in link.access.users">
907 <input type="hidden" name="access[users][]" value="admin">
908 <a class="uaco-del" onclick="jQuery(this.rel).remove()" v-bind:rel="'#uaco-' + user"><i class="far fa-times-circle"></i></a>&nbsp;{{ user }}
909 </span>
910
911
912 </div>
913 <div class="panel-footer"><input id="_maname" placeholder="Start typing to search members..." style="width: 100%" type="text" class="form-control"></div>
914
915
916 <?php } ?>
917
918 </div>
919
920 <div class="text-right">
921 <button type="submit" id="create_sharelink" class="btn btn-info"><?php echo esc_attr__( 'Update Link', "download-manager" ); ?></button>
922 </div>
923
924
925 </form>
926
927 </div>
928 </div>
929 </div>
930 </div>
931
932
933
934
935 </div>
936
937 <script src="<?php echo WPDM_BASE_URL ?>assets/js/simple-scrollbar.min.js"></script>
938 <script>
939 var current_path = '', editor = '', opened = '', wpdmfm_active_asset = '', wpdmfm_active_asset_settings, $ = jQuery;
940 var _path = localStorage.getItem('__wpdm_am_cp');
941
942 /* === searchAsset === */
943 var searchAsset = Vue.createApp({
944 data() {
945 return { keyword: '' };
946 },
947 methods: {
948 execute() {
949 WPDMAM.searchDir(current_path, this.keyword);
950 }
951 }
952 }).mount('#__file_search');
953
954 /* === assetPages === */
955 var assetPages = Vue.createApp({
956 data() {
957 return {
958 total_pages: 1,
959 current_page: 1,
960 items_per_page: 15,
961 goto_page: 1
962 };
963 },
964 methods: {
965 nextPage() {
966 let topage = this.current_page + 1;
967 topage = topage > this.total_pages ? 1 : topage;
968 WPDMAM.scanDir(current_path, topage);
969 },
970 prevPage() {
971 let topage = this.current_page - 1;
972 topage = topage < 1 ? 1 : topage;
973 WPDMAM.scanDir(current_path, topage);
974 },
975 gotoPage() {
976 WPDMAM.scanDir(current_path, this.goto_page);
977 }
978 }
979 }).mount('#__asset_pages');
980
981 /* keep your line as-is */
982 if (typeof _path !== 'undefined' && _path) current_path = _path;
983
984 /* === assetSettings === */
985 var assetSettings = Vue.createApp({
986 data() {
987 return { asset: [] };
988 }
989 }).mount('#__asset_settings');
990
991 /* === linkSettings === */
992 var linkSettings = Vue.createApp({
993 data() {
994 return {
995 link: {
996 access: {
997 roles: ['guest'],
998 users: ['admin']
999 }
1000 }
1001 };
1002 },
1003 methods: {
1004 roleSelected(role) {
1005 for (var i = 0; i < this.link.access.roles.length; i++) {
1006 if (this.link.access.roles[i] == role) return true;
1007 }
1008 return false;
1009 }
1010 }
1011 }).mount('#__link_settings');
1012
1013 /*var searchAsset = new Vue({
1014 el: '#__file_search',
1015 data: {
1016 keyword: '',
1017 },
1018 methods: {
1019 execute: function () {
1020 WPDMAM.searchDir(current_path, this.keyword);
1021 }
1022
1023 }
1024 });
1025
1026 var assetPages = new Vue({
1027 el: '#__asset_pages',
1028 data: {
1029 total_pages: 1,
1030 current_page: 1,
1031 items_per_page: 15,
1032 goto_page: 1
1033 },
1034 methods: {
1035 nextPage: function () {
1036 let topage = this.current_page + 1;
1037 topage = topage > this.total_pages ? 1 : topage;
1038 WPDMAM.scanDir(current_path, topage)
1039 },
1040 prevPage: function () {
1041 let topage = this.current_page - 1;
1042 topage = topage < 1 ? 1 : topage;
1043 WPDMAM.scanDir(current_path, topage)
1044 },
1045 gotoPage: function() {
1046 WPDMAM.scanDir(current_path, this.goto_page);
1047 }
1048
1049 }
1050 });
1051 if(_path) current_path = _path;
1052 var assetSettings = new Vue({
1053 el: '#__asset_settings',
1054 data: {
1055 asset: []
1056 }
1057 });
1058
1059 var linkSettings = new Vue({
1060 el: '#__link_settings',
1061 data: {
1062 link: {
1063 access: {
1064 roles: ['guest'],
1065 users:['admin']
1066 }
1067 }
1068 },
1069 methods: {
1070 roleSelected: function (role) {
1071 for(var i=0; i < this.link.access.roles.length; i++){
1072 if( this.link.access.roles[i] == role){
1073 return true
1074 }
1075 }
1076 return false
1077 }
1078 }
1079 });*/
1080
1081 /* View in fullscreen */
1082 function openFullscreen(elementid) {
1083 var elem = document.getElementById(elementid);
1084 if (elem.requestFullscreen) {
1085 elem.requestFullscreen();
1086 } else if (elem.mozRequestFullScreen) { /* Firefox */
1087 elem.mozRequestFullScreen();
1088 } else if (elem.webkitRequestFullscreen) { /* Chrome, Safari and Opera */
1089 elem.webkitRequestFullscreen();
1090 } else if (elem.msRequestFullscreen) { /* IE/Edge */
1091 elem.msRequestFullscreen();
1092 }
1093 }
1094
1095 var WPDMAM = {
1096 assetSettings: function (asset, row) {
1097 $('.item-row').removeClass('active');
1098 row.addClass('active');
1099 wpdmfm_active_asset = asset;
1100 $('#filewin').removeClass('col-md-9').addClass('col-md-6');
1101 $('#cogwin').fadeIn();
1102 $('#cogwin > .panel').addClass('blockui');
1103 $.get(ajaxurl, {__wpdm_filesettings:'<?php echo wp_create_nonce(WPDMAM_NONCE_KEY); ?>', action: 'wpdm_filesettings', file: asset }, function (data) {
1104 data.sharecode = "[wpdm_asset id='"+data.ID+"']";
1105 assetSettings.asset = data;
1106 $('#cogwin > .panel').removeClass('blockui');
1107 });
1108 },
1109 copy: function (item) {
1110 localStorage.setItem("__wpdm_fm_copy", current_path+"|||"+item);
1111 localStorage.setItem("__wpdm_fm_move", 0);
1112 $('.btn-copy').html('<i class="fa fa-copy"></i>');
1113 $('.btn-cut').html('<i class="fa fa-cut"></i>');
1114 $('#btn-paste').removeAttr('disabled').attr("data-item", localStorage.getItem("__wpdm_fm_copy"));
1115 },
1116 cut: function (item) {
1117 localStorage.setItem("__wpdm_fm_copy", current_path+"|||"+item);
1118 localStorage.setItem("__wpdm_fm_move", 1);
1119 $('.btn-copy').html('<i class="fa fa-copy"></i>');
1120 $('.btn-cut').html('<i class="fa fa-cut"></i>');
1121 $('#btn-paste').removeAttr('disabled').attr("data-item", localStorage.getItem("__wpdm_fm_copy"));
1122 },
1123 delete: function (filepath) {
1124 if(!confirm('Are you sure?')) return false;
1125 $.get(ajaxurl, {__wpdm_unlink:'<?php echo wp_create_nonce(WPDMAM_NONCE_KEY); ?>', action: 'wpdm_unlink', path: current_path, delete: filepath}, function (data) {
1126 WPDMAM.scanDir(current_path);
1127 });
1128 },
1129 scanDir: function(path, page) {
1130 this.hideEditor();
1131 this.hideSettings();
1132 $('#reload').attr('disabled', 'disabled').find('.fa').addClass('fa-spin');
1133 WPDM.blockUI('#filewin');
1134 if(typeof page === 'undefined') page = 1;
1135 localStorage.setItem('__wpdm_am_cp', path);
1136 $.get(ajaxurl, {__wpdm_scandir:'<?php echo wp_create_nonce(NONCE_KEY); ?>', action: 'wpdm_scandir', path: path, sdpage: page}, function (data) {
1137 if(data.success === true) {
1138 assetPages.total_pages = data.total_pages;
1139 assetPages.current_page = data.current_page;
1140 $('#scandir').html('');
1141 var items = data.items;
1142 $.each(items, function (index, entry) {
1143 if (entry.type == 'file') {
1144 ext = entry.contenttype.replace("/", "_");
1145 var tpl = $('#fileTPL').html();
1146 tpl = tpl.replace("{{icon}}", entry.icon);
1147 tpl = tpl.replace("{{ext}}", ext);
1148 tpl = tpl.replace("{{contenttype}}", entry.contenttype);
1149 tpl = tpl.replace("{{item_label}}", entry.item_label);
1150 tpl = tpl.replace("{{note}}", entry.note);
1151 tpl = tpl.replace("{{file_size}}", entry.file_size);
1152 tpl = tpl.replace(/\{\{path\}\}/ig, entry.path);
1153 tpl = tpl.replace(/\{\{item\}\}/ig, entry.item);
1154 tpl = tpl.replace(/\{\{id\}\}/ig, index);
1155 var _star = entry.featured ? 'fas' : 'far';
1156 tpl = tpl.replace(/\{\{star\}\}/ig, _star);
1157 } else {
1158 var tpl = $('#dirTPL').html();
1159 tpl = tpl.replace("{{icon}}", entry.icon);
1160 tpl = tpl.replace("{{item_label}}", entry.item_label);
1161 tpl = tpl.replace("{{note}}", entry.note);
1162 tpl = tpl.replace("{{file_size}}", entry.file_size);
1163 tpl = tpl.replace(/\{\{path\}\}/ig, entry.path);
1164 tpl = tpl.replace(/\{\{item\}\}/ig, entry.item);
1165 tpl = tpl.replace(/\{\{id\}\}/ig, index);
1166 tpl = tpl.replace(/\{\{dirid\}\}/ig, entry.id);
1167 }
1168 $('#scandir').append(tpl);
1169 });
1170 WPDM.unblockUI('#filewin');
1171 $('#reload').removeAttr('disabled', 'disabled').html("<i class='fa fa-sync'></i>");
1172 $('#breadcrumb').html(data.breadcrumb);
1173 } else {
1174 WPDM.pushNotify("<?=esc_attr__( 'Error', 'download-manager' ); ?>!", data.message, 'https://cdn0.iconfinder.com/data/icons/small-n-flat/24/678080-shield-error-256.png', 'https://cdn0.iconfinder.com/data/icons/small-n-flat/24/678080-shield-error-256.png');
1175 }
1176 });
1177 },
1178 searchDir: function(path, keyword) {
1179 this.hideEditor();
1180 this.hideSettings();
1181 $('#reload').attr('disabled', 'disabled').find('.fa').addClass('fa-spin');
1182 WPDM.blockUI('#filewin');
1183 if(typeof page === 'undefined') page = 1;
1184 localStorage.setItem('__wpdm_am_cp', path);
1185 $.get(ajaxurl, {__wpdm_scandir:'<?php echo wp_create_nonce(NONCE_KEY); ?>', action: 'wpdm_scandir', path: path, keyword: keyword}, function (data) {
1186 if(data.success === true) {
1187 assetPages.total_pages = data.total_pages;
1188 assetPages.current_page = data.current_page;
1189 $('#scandir').html('');
1190 var items = data.items;
1191 $.each(items, function (index, entry) {
1192 if (entry.type == 'file') {
1193 ext = entry.contenttype.replace("/", "_");
1194 var tpl = $('#fileTPL').html();
1195 tpl = tpl.replace("{{icon}}", entry.icon);
1196 tpl = tpl.replace("{{ext}}", ext);
1197 tpl = tpl.replace("{{contenttype}}", entry.contenttype);
1198 tpl = tpl.replace("{{item_label}}", entry.item_label);
1199 tpl = tpl.replace("{{note}}", entry.note);
1200 tpl = tpl.replace("{{file_size}}", entry.file_size);
1201 tpl = tpl.replace(/\{\{path\}\}/ig, entry.path);
1202 tpl = tpl.replace(/\{\{item\}\}/ig, entry.item);
1203 tpl = tpl.replace(/\{\{id\}\}/ig, index);
1204 var _star = entry.featured ? 'fas' : 'far';
1205 tpl = tpl.replace(/\{\{star\}\}/ig, _star);
1206 } else {
1207 var tpl = $('#dirTPL').html();
1208 tpl = tpl.replace("{{icon}}", entry.icon);
1209 tpl = tpl.replace("{{item_label}}", entry.item_label);
1210 tpl = tpl.replace("{{note}}", entry.note);
1211 tpl = tpl.replace("{{file_size}}", entry.file_size);
1212 tpl = tpl.replace(/\{\{path\}\}/ig, entry.path);
1213 tpl = tpl.replace(/\{\{item\}\}/ig, entry.item);
1214 tpl = tpl.replace(/\{\{id\}\}/ig, index);
1215 tpl = tpl.replace(/\{\{dirid\}\}/ig, entry.id);
1216 }
1217 $('#scandir').append(tpl);
1218 });
1219 WPDM.unblockUI('#filewin');
1220 $('#reload').removeAttr('disabled', 'disabled').html("<i class='fa fa-sync'></i>");
1221 $('#breadcrumb').html(data.breadcrumb);
1222 } else {
1223 WPDM.pushNotify("<?=esc_attr__( 'Error', 'download-manager' ); ?>!", data.message, 'https://cdn0.iconfinder.com/data/icons/small-n-flat/24/678080-shield-error-256.png', 'https://cdn0.iconfinder.com/data/icons/small-n-flat/24/678080-shield-error-256.png');
1224 }
1225 });
1226 },
1227 hideEditor: function() {
1228 $('#wpdmeditor').fadeOut();
1229 if(editor == '') return;
1230 editor.codemirror.toTextArea();
1231 $('#filecontent').val('');
1232 $('#wpdmeditor').addClass('blockui');
1233 },
1234 hideSettings: function() {
1235 $('#cogwin').hide();
1236 $('#filewin').removeClass('col-md-6').addClass('col-md-9');
1237 $('#cogwin > .panel').addClass('blockui');
1238 }
1239 }
1240
1241
1242 jQuery(function ($) {
1243
1244 //$('#wpdmfm_explorer').css('height', (window.innerHeight - 190)+'px');
1245
1246 $('#mainfmc').fadeIn();
1247 $('#loadingfm').hide();
1248
1249
1250
1251 function refresh_scandir(path) {
1252 hide_editor();
1253 hide_settings();
1254 $('#reload').attr('disabled', 'disabled').find('.fa').addClass('fa-spin');
1255 WPDM.blockUI('#filewin');
1256 localStorage.setItem('__wpdm_am_cp', path);
1257 $.get(ajaxurl, {__wpdm_scandir:'<?php echo wp_create_nonce(NONCE_KEY); ?>', action: 'wpdm_scandir', path: path}, function (data) {
1258 if(data.success === true) {
1259 assetPages.total_pages = data.total_pages;
1260 assetPages.current_page = data.current_page;
1261 $('#scandir').html('');
1262 var items = data.items;
1263 $.each(items, function (index, entry) {
1264 if (entry.type == 'file') {
1265 ext = entry.contenttype.replace("/", "_");
1266 var tpl = $('#fileTPL').html();
1267 tpl = tpl.replace("{{icon}}", entry.icon);
1268 tpl = tpl.replace("{{ext}}", ext);
1269 tpl = tpl.replace("{{contenttype}}", entry.contenttype);
1270 tpl = tpl.replace("{{item_label}}", entry.item_label);
1271 tpl = tpl.replace("{{note}}", entry.note);
1272 tpl = tpl.replace("{{file_size}}", entry.file_size);
1273 tpl = tpl.replace(/\{\{path\}\}/ig, entry.path);
1274 tpl = tpl.replace(/\{\{item\}\}/ig, entry.item);
1275 tpl = tpl.replace(/\{\{id\}\}/ig, index);
1276 } else {
1277 var tpl = $('#dirTPL').html();
1278 tpl = tpl.replace("{{icon}}", entry.icon);
1279 tpl = tpl.replace("{{item_label}}", entry.item_label);
1280 tpl = tpl.replace("{{note}}", entry.note);
1281 tpl = tpl.replace("{{file_size}}", entry.file_size);
1282 tpl = tpl.replace(/\{\{path\}\}/ig, entry.path);
1283 tpl = tpl.replace(/\{\{item\}\}/ig, entry.item);
1284 tpl = tpl.replace(/\{\{id\}\}/ig, index);
1285 tpl = tpl.replace(/\{\{dirid\}\}/ig, entry.id);
1286 }
1287 $('#scandir').append(tpl);
1288 });
1289 WPDM.unblockUI('#filewin');
1290 $('#reload').removeAttr('disabled', 'disabled').html("<i class='fa fa-sync'></i>");
1291 $('#breadcrumb').html(data.breadcrumb);
1292
1293 } else {
1294 WPDM.pushNotify("<?php echo esc_attr__( 'Error', 'download-manager' ); ?>!", data.message, 'https://cdn0.iconfinder.com/data/icons/small-n-flat/24/678080-shield-error-256.png', 'https://cdn0.iconfinder.com/data/icons/small-n-flat/24/678080-shield-error-256.png');
1295 }
1296 });
1297 }
1298
1299 function hide_editor() {
1300 $('#wpdmeditor').fadeOut();
1301 if(editor == '') return;
1302 editor.codemirror.toTextArea();
1303 $('#filecontent').val('');
1304 $('#wpdmeditor').addClass('blockui');
1305 }
1306
1307 function hide_settings() {
1308 $('#cogwin').hide();
1309 $('#filewin').removeClass('col-md-6').addClass('col-md-9');
1310 $('#cogwin > .panel').addClass('blockui');
1311 }
1312
1313 function auto_expand()
1314 {
1315 var expanded = localStorage.getItem('__wpdmam_xdirs');
1316 if(!expanded) expanded = "";
1317 expanded = expanded.split(",");
1318
1319 }
1320
1321 function expand_dir(id) {
1322
1323 /*var expanded = localStorage.getItem('__wpdmam_xdirs');
1324 if(!expanded) expanded = "";
1325 expanded = expanded.split(",");
1326 expanded.push(id);
1327 localStorage.setItem('__wpdmam_xdirs', expanded);*/
1328
1329 localStorage.setItem('__expanded_'+id, true);
1330
1331 var $this = $('#'+id);
1332 $this.addClass('busy');
1333 var chid = "expanded_" + id;
1334 var slide = 1;
1335 var _ajaxurl = ajaxurl == undefined ? wpdm_url.ajax : ajaxurl;
1336 $.get(_ajaxurl, {__wpdm_scandir:'<?php echo wp_create_nonce(NONCE_KEY); ?>', action: 'wpdm_scandir', dirs: 1, path: $this.data('path')}, function (dirs){
1337 if($("#"+chid).length == 1) {
1338 $("#" + chid).remove();
1339 slide = 0;
1340 }
1341
1342 $this.append("<ul id='"+chid+"' style='display: none'></ul>");
1343 $.each(dirs, function (id, dir) {
1344 $('#'+chid).append("<li class='expand-dir' id='"+dir.id+"' data-path='"+dir.path+"'><span class='handle'></span><a href='#' class='explore-dir' data-path='"+dir.path+"'>"+dir.item_label+"</a></li>");
1345 var xpanded = localStorage.getItem('__expanded_'+dir.id);
1346 if(xpanded) {
1347 expand_dir(dir.id);
1348 }
1349 });
1350 $this.removeClass('busy').addClass('expanded');
1351 if(slide == 1)
1352 $('#'+chid).slideDown();
1353 else
1354 $('#'+chid).show();
1355 });
1356 }
1357
1358 // create the uploader and pass the config from above
1359 var uploader = new plupload.Uploader(<?php echo json_encode($plupload_init); ?>);
1360
1361 // checks if browser supports drag and drop upload, makes some css adjustments if necessary
1362 uploader.bind('Init', function(up){
1363 var uploaddiv = jQuery('#plupload-upload-ui');
1364
1365 if(up.features.dragdrop){
1366 uploaddiv.addClass('drag-drop');
1367 jQuery('#drag-drop-area')
1368 .bind('dragover.wp-uploader', function(){ uploaddiv.addClass('drag-over'); })
1369 .bind('dragleave.wp-uploader, drop.wp-uploader', function(){ uploaddiv.removeClass('drag-over'); });
1370
1371 }else{
1372 uploaddiv.removeClass('drag-drop');
1373 jQuery('#drag-drop-area').unbind('.wp-uploader');
1374 }
1375 });
1376
1377 uploader.init();
1378
1379 // a file was added in the queue
1380 uploader.bind('FilesAdded', function(up, files){
1381 //var hundredmb = 100 * 1024 * 1024, max = parseInt(up.settings.max_file_size, 10);
1382
1383 uploader.settings.multipart_params.current_path = current_path;
1384
1385 plupload.each(files, function(file){
1386 jQuery('#filelist').append(
1387 '<div class="panel panel-default file" id="' + file.id + '"><div class="panel-heading txtellipsis"><b>' +
1388
1389 file.name + '</b></div><div class="panel-body">' +
1390 '<div class="progress" style="margin: 0;"><div class="progress-bar progress-bar-info progress-bar-striped fileprogress" role="progressbar"><span class="sr-only">(<span>' + plupload.formatSize(0) + '</span>/' + plupload.formatSize(file.size) + ')</span></div></div></div></div>');
1391 });
1392
1393 up.refresh();
1394 up.start();
1395 });
1396
1397 uploader.bind('UploadProgress', function(up, file) {
1398 jQuery('#' + file.id + " .fileprogress").width(file.percent + "%");
1399 jQuery('#' + file.id + " span").html(plupload.formatSize(parseInt(file.size * file.percent / 100)));
1400 });
1401
1402
1403 // a file was uploaded
1404 uploader.bind('FileUploaded', function(up, file, response) {
1405 var d = new Date();
1406 var ID = d.getTime();
1407 if(response.status == 200) {
1408 response = JSON.parse(response.response);
1409 if (response.success) {
1410 jQuery('#' + file.id).addClass('upcompleted');
1411 refresh_scandir(current_path);
1412 jQuery('#' + file.id + ".upcompleted").on('click', function () {
1413 jQuery(this).slideUp();
1414 });
1415 } else {
1416 jQuery('#' + file.id).addClass('upfailed');
1417 jQuery('#' + file.id + ".upfailed").on('click', function () {
1418 jQuery(this).slideUp();
1419 });
1420 }
1421 } else {
1422 jQuery('#' + file.id).addClass('upfailed');
1423 jQuery('#' + file.id + ".upfailed").on('click', function () {
1424 jQuery(this).slideUp();
1425 });
1426 }
1427 });
1428
1429 $('#reload').on('click', function () {
1430 refresh_scandir(current_path);
1431 });
1432
1433 $('body').on('click', '.wpdm-am-newfol', function () {
1434 WPDM.dialog.show({
1435 title: '<?php echo esc_js(__( "New Folder", "download-manager" )); ?>',
1436 content: document.getElementById('newfol-tpl').innerHTML,
1437 size: 'sm', icon: false
1438 });
1439 });
1440 $('body').on('click', '.wpdm-am-newfile', function () {
1441 WPDM.dialog.show({
1442 title: '<?php echo esc_js(esc_attr__( "New File", "download-manager" )); ?>',
1443 content: document.getElementById('newfile-tpl').innerHTML,
1444 size: 'sm', icon: false
1445 });
1446 });
1447
1448 $('body').on('click', '#createfol', function () {
1449 var $btn = $(this);
1450 var folname = $('#folname').val();
1451 if(folname !=''){
1452 $btn.html('<i class="fa fa-refresh fa-spin"></i> &nbsp; Creating...');
1453 $.get(ajaxurl, {__wpdm_mkdir:'<?php echo wp_create_nonce(WPDMAM_NONCE_KEY); ?>', action: 'wpdm_mkdir', path: current_path, name: folname}, function (data) {
1454 refresh_scandir(current_path);
1455 $btn.closest('.wpdm-dialog-wrapper').find('.wpdm-dialog__close').trigger('click');
1456 });
1457 }
1458 });
1459
1460 $('body').on('click', '#createfile', function () {
1461 var $btn = $(this);
1462 var filename = $('#filename').val();
1463 if(filename !=''){
1464 $btn.html('<i class="fa fa-refresh fa-spin"></i> &nbsp; Creating...');
1465 $.get(ajaxurl, {__wpdm_newfile:'<?php echo wp_create_nonce(WPDMAM_NONCE_KEY); ?>', action: 'wpdm_newfile', path: current_path, name: filename}, function (data) {
1466 refresh_scandir(current_path);
1467 $btn.closest('.wpdm-dialog-wrapper').find('.wpdm-dialog__close').trigger('click');
1468 });
1469 }
1470 });
1471
1472 /* Delete */
1473 $('body').on('click', '.btn-delete', function (e) {
1474 e.preventDefault();
1475 if(!confirm('Are you sure?')) return false;
1476 $(this).html('<i class="fa fa-spinner fa-spin"></i>');
1477 var filepath = $(this).data('path');
1478 $.get(ajaxurl, {__wpdm_unlink:'<?php echo wp_create_nonce(WPDMAM_NONCE_KEY); ?>', action: 'wpdm_unlink', path: current_path, delete: filepath}, function (data) {
1479 refresh_scandir(current_path);
1480 });
1481 });
1482
1483
1484 $('body').on('click', '.btn-open-file', function (e) {
1485 e.preventDefault();
1486 $('#wpdmeditor').fadeIn();
1487 var filepath = $(this).data('path');
1488 var filename = $(this).find('.item_label').attr('title');
1489 $('#wpdmefn').text(filename);
1490 $.get(ajaxurl, {__wpdm_openfile:'<?php echo wp_create_nonce(WPDMAM_NONCE_KEY); ?>', action: 'wpdm_openfile', path: current_path, file: filepath}, function (data) {
1491 if(data.content != '') {
1492 $('#filecontent').show();
1493 $('#filecontent_alt').hide();
1494 $('#filecontent').val(data.content);
1495 opened = data.id;
1496 $('#savefile').data('path', filepath);
1497 $('#wpdmeditor').removeClass('blockui');
1498 $('#wpdmeditor .panel-footer').fadeIn();
1499 editor = wp.codeEditor.initialize($('#filecontent'), wpdmcm_settings);
1500 var fileext = filename.split('.').pop();
1501 fileext = fileext == 'html' ? 'htmlmixed' : fileext;
1502 fileext = fileext == 'js' ? 'javascript' : fileext;
1503 editor.codemirror.setOption('mode', fileext);
1504 } else {
1505 $('#filecontent').hide();
1506 $('#filecontent_alt').html(data.embed).show();
1507 $('#wpdmeditor .panel-footer').fadeOut();
1508 $('#wpdmeditor').removeClass('blockui');
1509 }
1510 });
1511 });
1512
1513 $('body').on('click', '#close-editor', function (e) {
1514 e.preventDefault();
1515 hide_editor();
1516 });
1517
1518 $('body').on('click', '#close-settings', function (e) {
1519 e.preventDefault();
1520 hide_settings();
1521 });
1522
1523 $('body').on('click', '#savefile', function (e) {
1524 e.preventDefault();
1525 $('#wpdmeditor').addClass('blockui');
1526 var filepath = $(this).data('path');
1527 var content = editor.codemirror.getValue();
1528 $.post(ajaxurl, {__wpdm_savefile:'<?php echo wp_create_nonce(WPDMAM_NONCE_KEY); ?>', action: 'wpdm_savefile', content: content, file: filepath, opened: opened }, function (data) {
1529 WPDM.pushNotify("Save File", data.message);
1530 $('#wpdmeditor').removeClass('blockui');
1531 });
1532 });
1533
1534
1535 $('body').on('click', '.btn-edit-link', function () {
1536 $('#update_sharelink_form').addClass('blockui');
1537 var linkid = $(this).data('linkid');
1538 $.post(ajaxurl, {__wpdm_getlinkdet:'<?php echo wp_create_nonce(WPDMAM_NONCE_KEY); ?>', action: 'wpdm_getlinkdet', linkid: linkid }, function (data) {
1539 linkSettings.link = data;
1540 $('#update_sharelink_form').removeClass('blockui');
1541 });
1542 });
1543
1544
1545 $('body').on('click', '.btn-delete-link', function (e) {
1546 e.preventDefault();
1547 var linkid = $(this).data('linkid');
1548 WPDM.confirm("Delete Link", "Are you sure?",[
1549 {
1550 'label': 'No',
1551 'class': 'btn btn-secondary',
1552 'callback': function () {
1553 $(this).modal('hide');
1554 }
1555 },
1556 {
1557 'label': 'Yes, Remove',
1558 'class': 'btn btn-danger',
1559 'callback': function () {
1560 $(this).find('.modal-body').html('<i class="fa fa-sun fa-spin"></i> Deleting...');
1561 var confirm = $(this);
1562 $.post(ajaxurl, {__wpdm_deletelink:'<?php echo wp_create_nonce(WPDMAM_NONCE_KEY); ?>', action: 'wpdm_deletelink', linkid: linkid }, function (data) {
1563 confirm.modal('hide');
1564 $('#asset-link-'+linkid).slideUp();
1565 });
1566 }
1567 }
1568 ]);
1569
1570 });
1571
1572
1573 $('#sharelink_form').on('submit', function (e) {
1574 e.preventDefault();
1575 $('#sharelink_form').addClass('blockui');
1576 $(this).ajaxSubmit({
1577 success: function(data){
1578 assetSettings.asset.links = data;
1579 $('#sharelink_form').removeClass('blockui');
1580 $('#sharelink').modal('hide');
1581
1582 }
1583 });
1584 });
1585
1586 $('#update_sharelink_form').on('submit', function (e) {
1587 e.preventDefault();
1588 $('#update_sharelink_form').addClass('blockui');
1589 $(this).ajaxSubmit({
1590 success: function(data){
1591 console.log(data);
1592 $('#update_sharelink_form').removeClass('blockui');
1593 $('#__link_settings').modal('hide');
1594
1595 }
1596 });
1597 });
1598
1599
1600 $('body').on('click', '.media-folder', function (e) {
1601 e.preventDefault();
1602 current_path = $(this).data('path');
1603 refresh_scandir(current_path);
1604 expand_dir($(this).data('id'));
1605 });
1606
1607 $('body').on('click', '.btn-copy', function (e) {
1608 e.preventDefault();
1609 localStorage.setItem("__wpdm_fm_copy", current_path+"|||"+$(this).data('item'));
1610 localStorage.setItem("__wpdm_fm_move", 0);
1611 $('.btn-copy').html('<i class="fa fa-copy"></i>');
1612 $(this).html('<i class="fa fa-check-circle"></i>');
1613 $('#btn-paste').removeAttr('disabled').attr("data-item", localStorage.getItem("__wpdm_fm_copy"));
1614 });
1615
1616 $('body').on('click', '.btn-cut', function (e) {
1617 e.preventDefault();
1618 localStorage.setItem("__wpdm_fm_copy", current_path+"|||"+$(this).data('item'));
1619 localStorage.setItem("__wpdm_fm_move", 1);
1620 $('.btn-copy').html('<i class="fa fa-copy"></i>');
1621 $(this).html('<i class="fa fa-check-circle"></i>');
1622 $('#btn-paste').removeAttr('disabled').attr("data-item", localStorage.getItem("__wpdm_fm_copy"));
1623 });
1624
1625 /* Rename */
1626 $('body').on('click', '#renamenow', function (e) {
1627 e.preventDefault();
1628 $(this).html('<i class="fa fa-spinner fa-spin"></i>');
1629 var filepath = $(this).data('path');
1630 $.post(ajaxurl, {__wpdm_rename:'<?php echo wp_create_nonce(WPDMAM_NONCE_KEY); ?>', action: 'wpdm_rename', path: current_path, newname: $('#newname').val(), assetid: assetSettings.asset.ID}, function (data) {
1631 refresh_scandir(current_path);
1632 $(this).data('oldname', $('#newname').val());
1633 $('#renamenow').html('Rename');
1634 $('#rename').modal('hide');
1635 });
1636 });
1637
1638 $('body').on('click', '#btn-upload-file', function () {
1639 $('#upfile').slideToggle();
1640 });
1641
1642 $('body').on('click', '.btn-settings', function (e) {
1643 e.preventDefault();
1644 var file_path = $(this).data('path');
1645 wpdmfm_active_asset = file_path;
1646 $('#filewin').removeClass('col-md-9').addClass('col-md-6');
1647 $('#cogwin').fadeIn();
1648 $('#cogwin > .panel').addClass('blockui');
1649 $.get(ajaxurl, {__wpdm_filesettings:'<?php echo wp_create_nonce(WPDMAM_NONCE_KEY); ?>', action: 'wpdm_filesettings', file: file_path }, function (data) {
1650 data.sharecode = "[wpdm_asset id='"+data.ID+"']";
1651 assetSettings.asset = data;
1652 $('#cogwin > .panel').removeClass('blockui');
1653 });
1654
1655 });
1656
1657 $('body').on('click', '.btn-zip', function (e) {
1658 e.preventDefault();
1659 var zip_dir_path = $(this).data('dirpath');
1660 //WPDM.blockUI("#wpdmfm_explorer");
1661 $(this).html('<i class="fa fa-spinner fa-spin"></i>');
1662 $.get(ajaxurl, {__wpdm_createzip:'<?php echo wp_create_nonce(WPDMAM_NONCE_KEY); ?>', action: 'wpdm_createzip', dir_path: zip_dir_path }, function (response) {
1663 if(!response.success){
1664 WPDM.notify(response.message, 'error');
1665 } else {
1666 refresh_scandir(current_path);
1667 }
1668 });
1669 });
1670
1671 $('body').on('click', '.btn-unzip.application_zip', function (e) {
1672 e.preventDefault();
1673 var zip_dir_path = $(this).data('dirpath');
1674 //WPDM.blockUI("#wpdmfm_explorer");
1675 $(this).html('<i class="fa fa-spinner fa-spin"></i>');
1676 $.get(ajaxurl, {__wpdm_unzipit:'<?php echo wp_create_nonce(WPDMAM_NONCE_KEY); ?>', action: 'wpdm_unzipit', dir_path: zip_dir_path }, function (response) {
1677 if(!response.success){
1678 WPDM.notify(response.message, 'error');
1679 } else {
1680 refresh_scandir(current_path);
1681 }
1682 });
1683 });
1684
1685 $('body').on('click', '.action-btns-ctrl', function (e) {
1686 e.preventDefault();
1687 $($(this).data('target')).toggleClass("action-btns-show");
1688 });
1689 $('body').on('click', '#btn-paste', function (e) {
1690 e.preventDefault();
1691 $(this).html('<i class="fa fa-spinner fa-spin"></i>');
1692 var params = {__wpdm_copypaste:'<?php echo wp_create_nonce(WPDMAM_NONCE_KEY); ?>', action: 'wpdm_copypaste', source: localStorage.getItem("__wpdm_fm_copy"), dest: current_path};
1693 if(localStorage.getItem("__wpdm_fm_move") == 1)
1694 params = {__wpdm_cutpaste:'<?php echo wp_create_nonce(WPDMAM_NONCE_KEY); ?>', action: 'wpdm_cutpaste', source: localStorage.getItem("__wpdm_fm_copy"), dest: current_path};
1695 $.get(ajaxurl, params, function (data) {
1696 if(!data.success){
1697 WPDM.notify(data.message, 'error');
1698 } else {
1699 refresh_scandir(current_path);
1700 }
1701 $('#btn-paste').html('<i class="fa fa-clipboard"></i>');
1702 if(localStorage.getItem("__wpdm_fm_move") == 1){
1703 localStorage.setItem("__wpdm_fm_move", 0);
1704 localStorage.setItem("__wpdm_fm_copy", '');
1705 $('#btn-paste').attr('disabled','disabled');
1706 }
1707 });
1708 });
1709
1710 $('body').on('click', '.asset-link .form-control', function () {
1711 $(this).select();
1712 document.execCommand('copy');
1713 });
1714
1715 $('body').on('click', '.expand-dir > .handle, .explore-dir', function (e) {
1716 e.preventDefault();
1717
1718 var $this = $(this).parent('.expand-dir');
1719 var chid = "expanded_"+$(this).parent('.expand-dir').attr('id');
1720
1721 if ($(this).hasClass('explore-dir')){
1722 current_path = $this.data('path');
1723 refresh_scandir($this.data('path'));
1724 }
1725
1726 if($this.hasClass('expanded') && !$(this).hasClass('explore-dir')){
1727 $('#'+chid).slideUp(function () {
1728 $(this).remove();
1729 $this.removeClass('expanded');
1730 localStorage.removeItem('__expanded_'+$this.attr('id'));
1731 });
1732 return false;
1733 }
1734
1735 $this.addClass('busy');
1736
1737 expand_dir($(this).parent('.expand-dir').attr('id'));
1738 });
1739
1740 var uacc = '';
1741
1742 function split(val) {
1743 return val.split(/,\s*/);
1744 }
1745
1746 function extractLast(term) {
1747 return split(term).pop();
1748 }
1749
1750 $("#maname")
1751 .bind("keydown", function (event) {
1752 if (event.keyCode === $.ui.keyCode.TAB &&
1753 $(this).data("ui-autocomplete").menu.active) {
1754 event.preventDefault();
1755 }
1756 })
1757 .autocomplete({
1758 source: function (request, response) {
1759 $.getJSON(ajaxurl + '?action=wpdm_cal_suggest_members', {
1760 action: 'wpdm_cal_suggest_members',
1761 term: extractLast($("#maname").val())
1762 }, response);
1763 },
1764 search: function () {
1765
1766 var term = extractLast($("#maname").val());
1767 if (term.length < 2) {
1768 return false;
1769 }
1770 },
1771 focus: function () {
1772
1773 return false;
1774 },
1775 select: function (event, ui) {
1776 $('#uaco').prepend('<span style="margin-right: 3px" class="btn btn-simple btn-sm" id="uaco-' + ui.item.value.replace(/[^a-zA-Z]/ig, '-') + '"><input type="hidden" name="access[users][]" value="' + ui.item.value + '" /> <a class="uaco-del" onclick="jQuery(this.rel).remove()" rel="#uaco-' + ui.item.value.replace(/[^a-zA-Z]/ig, '-') + '"><i class="far fa-times-circle"></i></a>&nbsp;' + ui.item.value + '</span>');
1777 this.value = "";
1778 return false;
1779 }
1780 });
1781
1782 $("#_maname")
1783 .bind("keydown", function (event) {
1784 if (event.keyCode === $.ui.keyCode.TAB &&
1785 $(this).data("ui-autocomplete").menu.active) {
1786 event.preventDefault();
1787 }
1788 })
1789 .autocomplete({
1790 source: function (request, response) {
1791 $.getJSON(ajaxurl + '?action=wpdm_cal_suggest_members', {
1792 action: 'wpdm_cal_suggest_members',
1793 term: extractLast($("#_maname").val())
1794 }, response);
1795 },
1796 search: function () {
1797
1798 var term = extractLast($("#_maname").val());
1799 if (term.length < 2) {
1800 return false;
1801 }
1802 },
1803 focus: function () {
1804
1805 return false;
1806 },
1807 select: function (event, ui) {
1808 $('#_uaco').prepend('<span style="margin-right: 3px" class="btn btn-simple btn-sm" id="uaco-' + ui.item.value.replace(/[^a-zA-Z]/ig, '-') + '"><input type="hidden" name="access[users][]" value="' + ui.item.value + '" /> <a class="uaco-del" onclick="jQuery(this.rel).remove()" rel="#uaco-' + ui.item.value.replace(/[^a-zA-Z]/ig, '-') + '"><i class="far fa-times-circle"></i></a>&nbsp;' + ui.item.value + '</span>');
1809 this.value = "";
1810 return false;
1811 }
1812 });
1813
1814
1815 if(localStorage.getItem("__wpdm_fm_copy") != undefined && localStorage.getItem("__wpdm_fm_copy") != ''){
1816 $('#btn-paste').removeAttr('disabled').attr("data-item", localStorage.getItem("__wpdm_fm_copy"));
1817 }
1818
1819 refresh_scandir(current_path);
1820 expand_dir('<?php echo md5('home'); ?>');
1821
1822 $('.ttip').tooltip();
1823
1824
1825 });
1826
1827 </script>
1828
1829
1830 <?php if(is_admin()){ ?>
1831 <script>
1832 jQuery(function ($) {
1833 /*$('[data-simplebar], #cogwin > .panel').css('height', (window.innerHeight - 160)+'px');
1834 $(window).on('resize', function() {
1835 $('[data-simplebar], #cogwin > .panel').css('height', (window.innerHeight - 160) + 'px');
1836 if($('#mainfmarea').is(":fullscreen")){
1837 $('[data-simplebar]').css('height', (window.innerHeight - 135) + 'px');
1838 }
1839 });*/
1840 });
1841 </script>
1842 </div>
1843 <?php }
1844