Skip to content

Commit 938151b

Browse files
committed
Adding move sent see BT#7680
1 parent 6643e57 commit 938151b

File tree

2 files changed

+70
-20
lines changed

2 files changed

+70
-20
lines changed

main/dropbox/dropbox_functions.inc.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,9 @@ function handle_multiple_actions()
8080
}
8181

8282
// STEP 3C: moving
83+
8384
if (strstr($_POST['action'], 'move_')) {
84-
// check move_received_n or move_sent_n command
85+
// check move_received_n or move_sent_n command
8586
if (strstr($_POST['action'], 'received')) {
8687
$part = 'received';
8788
$to_cat_id = str_replace('move_received_', '', $_POST['action']);
@@ -90,9 +91,10 @@ function handle_multiple_actions()
9091
$to_cat_id = str_replace('move_sent_', '', $_POST['action']);
9192
}
9293

93-
foreach ($checked_file_ids as $key => $value) {
94+
foreach ($checked_file_ids as $value) {
9495
store_move($value, $to_cat_id, $part);
9596
}
97+
9698
return get_lang('FilesMoved');
9799
}
98100

main/dropbox/index.php

Lines changed: 66 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
$viewReceivedCategory = isset($_GET['view_received_category']) ? Security::remove_XSS($_GET['view_received_category']) : null;
1818
$viewSentCategory = isset($_GET['view_sent_category']) ? Security::remove_XSS($_GET['view_sent_category']) : null;
1919

20-
2120
// Do the tracking
2221
event_access_tool(TOOL_DROPBOX);
2322

@@ -151,10 +150,14 @@
151150
// only the download has is handled separately in dropbox_init_inc.php because this has to be done before the headers are sent
152151
// (which also happens in dropbox_init.inc.php
153152

154-
if (!isset($_POST['feedback']) && (strstr($postAction, 'move_received') OR
155-
$postAction == 'delete_received' OR $postAction == 'download_received' OR
156-
$postAction == 'delete_sent' OR $postAction == 'download_sent')) {
157-
153+
if (!isset($_POST['feedback']) && (
154+
strstr($postAction, 'move_received') OR
155+
strstr($postAction, 'move_sent') OR
156+
$postAction == 'delete_received' OR
157+
$postAction == 'download_received' OR
158+
$postAction == 'delete_sent' OR
159+
$postAction == 'download_sent')
160+
) {
158161
$display_message = handle_multiple_actions();
159162
Display :: display_normal_message($display_message);
160163
}
@@ -269,19 +272,15 @@
269272
}
270273
}
271274
}
272-
273275
/* THE MENU TABS */
274-
275276
if ($dropbox_cnf['sent_received_tabs']) {
276277
?>
277-
278278
<ul class="nav nav-tabs">
279279
<li <?php if (!$view OR $view == 'sent') { echo 'class="active"'; } ?> >
280280
<a href="index.php?<?php echo api_get_cidreq(); ?>&view=sent" ><?php echo get_lang('SentFiles'); ?></a></li>
281281
<li <?php if ($view == 'received') { echo 'class="active"'; } ?> >
282282
<a href="index.php?<?php echo api_get_cidreq(); ?>&view=received" ><?php echo get_lang('ReceivedFiles'); ?></a></li>
283283
</ul>
284-
285284
<?php
286285
}
287286

@@ -345,7 +344,6 @@
345344
$column_order[3] = 8;
346345
$column_order[5] = 7;
347346

348-
349347
// The content of the sortable table = the received files
350348
foreach ($dropbox_person -> receivedWork as $dropbox_file) {
351349
$dropbox_file_data = array();
@@ -400,11 +398,15 @@
400398

401399
// The content of the sortable table = the categories (if we are not in the root)
402400
if ($view_dropbox_category_received == 0) {
403-
foreach ($dropbox_categories as $category) { // Note: This can probably be shortened since the categories for the received files are already in the $dropbox_received_category array;
401+
foreach ($dropbox_categories as $category) {
402+
/* Note: This can probably be shortened since the categories
403+
for the received files are already in the
404+
$dropbox_received_category array;*/
404405
$dropbox_category_data = array();
405406
if ($category['received'] == '1') {
406407
$movelist[$category['cat_id']] = $category['cat_name'];
407-
$dropbox_category_data[] = $category['cat_id']; // This is where the checkbox icon for the files appear
408+
// This is where the checkbox icon for the files appear
409+
$dropbox_category_data[] = $category['cat_id'];
408410
// The icon of the category
409411
$link_open = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$category['cat_id'].'&amp;view_sent_category='.$viewSentCategory.'&amp;view='.$view.'">';
410412
$dropbox_category_data[] = $link_open.build_document_icon_tag('folder', $category['cat_name']).'</a>';
@@ -420,9 +422,14 @@
420422
}
421423
}
422424
}
425+
423426
// Displaying the table
424427
$additional_get_parameters = array('view' => $view, 'view_received_category' => $viewReceivedCategory, 'view_sent_category' => $viewSentCategory);
425-
$selectlist = array('delete_received' => get_lang('Delete'), 'download_received' => get_lang('Download'));
428+
$selectlist = array(
429+
'delete_received' => get_lang('Delete'),
430+
'download_received' => get_lang('Download')
431+
);
432+
426433
if (is_array($movelist)) {
427434
foreach ($movelist as $catid => $catname){
428435
$selectlist['move_received_'.$catid] = get_lang('Move') . '->'. Security::remove_XSS($catname);
@@ -433,7 +440,17 @@
433440
$selectlist = array();
434441
}
435442

436-
Display::display_sortable_config_table('dropbox', $column_header, $dropbox_data_recieved, $sorting_options, $paging_options, $additional_get_parameters, $column_show, $column_order, $selectlist);
443+
Display::display_sortable_config_table(
444+
'dropbox',
445+
$column_header,
446+
$dropbox_data_recieved,
447+
$sorting_options,
448+
$paging_options,
449+
$additional_get_parameters,
450+
$column_show,
451+
$column_order,
452+
$selectlist
453+
);
437454
}
438455

439456
/* SENT FILES */
@@ -500,7 +517,7 @@
500517
$column_order[5] = 7;
501518

502519
// The content of the sortable table = the received files
503-
foreach ($dropbox_person -> sentWork as $dropbox_file) {
520+
foreach ($dropbox_person->sentWork as $dropbox_file) {
504521
$dropbox_file_data = array();
505522

506523
if ($view_dropbox_category_sent == $dropbox_file->category) {
@@ -541,11 +558,16 @@
541558
}
542559
}
543560

561+
$moveList = array();
544562
// The content of the sortable table = the categories (if we are not in the root)
545563
if ($view_dropbox_category_sent == 0) {
546564
foreach ($dropbox_categories as $category) {
547565
$dropbox_category_data = array();
566+
548567
if ($category['sent'] == '1') {
568+
569+
$moveList[$category['cat_id']] = $category['cat_name'];
570+
549571
$dropbox_category_data[] = $category['cat_id']; // This is where the checkbox icon for the files appear.
550572
$link_open = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&amp;view_sent_category='.$category['cat_id'].'&amp;view='.$view.'">';
551573
$dropbox_category_data[] = $link_open.build_document_icon_tag('folder', Security::remove_XSS($category['cat_name'])).'</a>';
@@ -565,13 +587,39 @@
565587
}
566588
}
567589
}
590+
568591
// Displaying the table
569-
$additional_get_parameters = array('view' => $view, 'view_received_category' => $viewReceivedCategory, 'view_sent_category' => $viewSentCategory);
570-
$selectlist = array('delete_received' => get_lang('Delete'), 'download_received' => get_lang('Download'));
592+
$additional_get_parameters = array(
593+
'view' => $view,
594+
'view_received_category' => $viewReceivedCategory,
595+
'view_sent_category' => $viewSentCategory
596+
);
597+
598+
$selectlist = array(
599+
'delete_received' => get_lang('Delete'),
600+
'download_received' => get_lang('Download')
601+
);
602+
603+
if (!empty($moveList)) {
604+
foreach ($moveList as $catid => $catname) {
605+
$selectlist['move_sent_'.$catid] = get_lang('Move') . '->'. Security::remove_XSS($catname);
606+
}
607+
}
608+
571609
if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
572610
$selectlist = array('download_received' => get_lang('Download'));
573611
}
574-
Display::display_sortable_config_table('dropbox', $column_header, $dropbox_data_sent, $sorting_options, $paging_options, $additional_get_parameters, $column_show, $column_order, $selectlist);
612+
Display::display_sortable_config_table(
613+
'dropbox',
614+
$column_header,
615+
$dropbox_data_sent,
616+
$sorting_options,
617+
$paging_options,
618+
$additional_get_parameters,
619+
$column_show,
620+
$column_order,
621+
$selectlist
622+
);
575623
}
576624
}
577625

0 commit comments

Comments
 (0)