1 |
85ad3d82
|
Assos Assos
|
<?php
|
2 |
|
|
|
3 |
|
|
/**
|
4 |
|
|
* @file
|
5 |
|
|
* Handles ajax file operations.
|
6 |
|
|
*/
|
7 |
|
|
|
8 |
|
|
/**
|
9 |
|
|
* Ajax operation: navigate
|
10 |
|
|
*/
|
11 |
|
|
function imce_js_navigate(&$imce) {
|
12 |
|
|
return array(
|
13 |
|
|
'files' => theme('imce_file_list', array('imce_ref' => array('imce' => &$imce))),
|
14 |
|
|
'dirsize' => format_size($imce['dirsize']),
|
15 |
|
|
'subdirectories' => array_map('rawurlencode', $imce['subdirectories']),
|
16 |
|
|
'perm' => $imce['perm']
|
17 |
|
|
);
|
18 |
|
|
}
|
19 |
|
|
|
20 |
|
|
/**
|
21 |
|
|
* Ajax operation: upload
|
22 |
|
|
*/
|
23 |
|
|
function imce_js_upload(&$imce) {
|
24 |
|
|
if ($imce['perm']['upload']) {
|
25 |
|
|
$_POST['op'] = t('Upload');
|
26 |
|
|
drupal_get_form('imce_upload_form', array('imce' => &$imce));
|
27 |
|
|
return array('added' => isset($imce['added']) ? $imce['added'] : NULL, 'dirsize' => format_size($imce['dirsize']));
|
28 |
|
|
}
|
29 |
|
|
}
|
30 |
|
|
|
31 |
|
|
/**
|
32 |
|
|
* Ajax operation: thumbnails
|
33 |
|
|
*/
|
34 |
|
|
function imce_js_thumb(&$imce) {
|
35 |
|
|
if ($imce['perm']['thumb']) {
|
36 |
|
|
$_POST['op'] = t('Create thumbnails');
|
37 |
|
|
return imce_process_fileop($imce);
|
38 |
|
|
}
|
39 |
|
|
}
|
40 |
|
|
|
41 |
|
|
/**
|
42 |
|
|
* Ajax operation: delete
|
43 |
|
|
*/
|
44 |
|
|
function imce_js_delete(&$imce) {
|
45 |
|
|
if ($imce['perm']['delete']) {
|
46 |
|
|
$_POST['op'] = t('Delete');
|
47 |
|
|
return imce_process_fileop($imce);
|
48 |
|
|
}
|
49 |
|
|
}
|
50 |
|
|
|
51 |
|
|
/**
|
52 |
|
|
* Ajax operation: resize
|
53 |
|
|
*/
|
54 |
|
|
function imce_js_resize(&$imce) {
|
55 |
|
|
if ($imce['perm']['resize']) {
|
56 |
|
|
$_POST['op'] = t('Resize');
|
57 |
|
|
return imce_process_fileop($imce);
|
58 |
|
|
}
|
59 |
|
|
}
|
60 |
|
|
|
61 |
|
|
/**
|
62 |
|
|
* Process file operations form
|
63 |
|
|
*/
|
64 |
|
|
function imce_process_fileop(&$imce) {
|
65 |
|
|
drupal_get_form('imce_fileop_form', array('imce' => &$imce));
|
66 |
|
|
return array('added' => isset($imce['added']) ? $imce['added'] : NULL, 'removed' => isset($imce['removed']) ? $imce['removed'] : NULL, 'dirsize' => format_size($imce['dirsize']));
|
67 |
|
|
} |