Redirect to previous page after NON-AJAX Post delete via second parameter in /item/drop
This commit is contained in:
parent
7d5494dd67
commit
b66bcb20da
|
@ -345,7 +345,7 @@ function drop_items(array $items)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function drop_item($id)
|
function drop_item($id, $return)
|
||||||
{
|
{
|
||||||
$a = BaseObject::getApp();
|
$a = BaseObject::getApp();
|
||||||
|
|
||||||
|
@ -409,8 +409,16 @@ function drop_item($id)
|
||||||
// delete the item
|
// delete the item
|
||||||
Item::deleteForUser(['id' => $item['id']], local_user());
|
Item::deleteForUser(['id' => $item['id']], local_user());
|
||||||
|
|
||||||
$a->internalRedirect('network');
|
$return_url = hex2bin($return);
|
||||||
//NOTREACHED
|
notice("RETURN: " + $return_url);
|
||||||
|
if (empty($return_url) || strpos($return_url, 'display') ) {
|
||||||
|
$a->internalRedirect('network');
|
||||||
|
//NOTREACHED
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$a->internalRedirect($return_url);
|
||||||
|
//NOTREACHED
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
notice(L10n::t('Permission denied.') . EOL);
|
notice(L10n::t('Permission denied.') . EOL);
|
||||||
$a->internalRedirect('display/' . $item['guid']);
|
$a->internalRedirect('display/' . $item['guid']);
|
||||||
|
|
|
@ -881,11 +881,11 @@ function item_content(App $a)
|
||||||
|
|
||||||
$o = '';
|
$o = '';
|
||||||
|
|
||||||
if (($a->argc == 3) && ($a->argv[1] === 'drop') && intval($a->argv[2])) {
|
if (($a->argc >= 3) && ($a->argv[1] === 'drop') && intval($a->argv[2])) {
|
||||||
if ($a->isAjax()) {
|
if ($a->isAjax()) {
|
||||||
$o = Item::deleteForUser(['id' => $a->argv[2]], local_user());
|
$o = Item::deleteForUser(['id' => $a->argv[2]], local_user());
|
||||||
} else {
|
} else {
|
||||||
$o = drop_item($a->argv[2]);
|
$o = drop_item($a->argv[2], $a->argv[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($a->isAjax()) {
|
if ($a->isAjax()) {
|
||||||
|
|
|
@ -414,6 +414,7 @@ class Post extends BaseObject
|
||||||
'received' => $item['received'],
|
'received' => $item['received'],
|
||||||
'commented' => $item['commented'],
|
'commented' => $item['commented'],
|
||||||
'created_date' => $item['created'],
|
'created_date' => $item['created'],
|
||||||
|
'return' => ($a->cmd) ? bin2hex($a->cmd) : '',
|
||||||
];
|
];
|
||||||
|
|
||||||
$arr = ['item' => $item, 'output' => $tmp_item];
|
$arr = ['item' => $item, 'output' => $tmp_item];
|
||||||
|
|
|
@ -141,7 +141,7 @@ as the value of $top_child_total (this is done at the end of this file)
|
||||||
|
|
||||||
{{if $item.drop.dropping}}
|
{{if $item.drop.dropping}}
|
||||||
<li role="menuitem">
|
<li role="menuitem">
|
||||||
<button type="button" class="btn-link navicon delete" onclick="dropItem('item/drop/{{$item.id}}', 'item-{{$item.guid}}');" title="{{$item.drop.delete}}"><i class="fa fa-trash" aria-hidden="true"></i> {{$item.drop.delete}}</button>
|
<button type="button" class="btn-link navicon delete" onclick="dropItem('item/drop/{{$item.id}}/{{$item.return}}', 'item-{{$item.guid}}');" title="{{$item.drop.delete}}"><i class="fa fa-trash" aria-hidden="true"></i> {{$item.drop.delete}}</button>
|
||||||
</li>
|
</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
Loading…
Reference in a new issue