Fix dropdown menu in sortable_table.class.php

pull/3890/head
Julio Montoya 4 years ago
parent bb8a90e040
commit 4dca070d82
  1. 20
      public/main/inc/lib/display.lib.php
  2. 1
      public/main/inc/lib/message.lib.php
  3. 37
      public/main/inc/lib/sortable_table.class.php
  4. 6
      public/main/messages/inbox.php

@ -2176,7 +2176,12 @@ class Display
$html .= self::url(
$item['title'],
$item['href'],
['class' => 'text-gray-700 block px-4 py-2 text-sm', 'role' => 'menuitem']
[
'class' => 'text-gray-700 block px-4 py-2 text-sm',
'role' => 'menuitem',
'onclick' => $item['onclick'] ?? '',
'data-action' => $item['data-action'] ?? '',
]
);
}
$html .= '
@ -2889,19 +2894,6 @@ HTML;
return self::return_icon($image, $name, [], $size);
}
public static function dropdownMenu($items = [], array $attr = [])
{
$links = null;
$url = null;
foreach ($items as $row) {
$url = self::url($row['icon'].$row['item'], $row['url'], ['class' => 'dropdown-item']);
$links .= self::tag('li', $url);
}
$html = self::tag('ul', $links, $attr);
return $html;
}
/**
* @param $id
*

@ -2152,7 +2152,6 @@ class MessageManager
$success_read = get_lang('Selected messages have been marked as read');
$success_unread = get_lang('Selected messages have been marked as unread');
$currentUserId = api_get_user_id();
if (isset($_REQUEST['action'])) {
switch ($_REQUEST['action']) {
case 'mark_as_unread':

@ -435,8 +435,7 @@ class SortableTable extends HTML_Table
}
}
$html .= '<input type="hidden" name="action">';
$html .= '<div class="q-card">';
$html .= '<div class="q-card p-2 mb-4">';
$html .= '<div class="flex flex-row justify-between">';
if (count($this->form_actions) > 0) {
@ -444,30 +443,24 @@ class SortableTable extends HTML_Table
$html .= '<a
class="btn btn-primary"
href="?'.$params.'&amp;'.$this->param_prefix.'selectall=1"
onclick="javascript: setCheckbox(true, \''.$table_id.'\'); return false;">'.get_lang('Select all').'</a>';
onclick="javascript: setCheckbox(true, \''.$table_id.'\'); return false;">'.
get_lang('Select all').'</a>';
$html .= '<a
class="btn btn-primary"
href="?'.$params.'"
onclick="javascript: setCheckbox(false, \''.$table_id.'\'); return false;">'.get_lang('UnSelect all').'</a> ';
$html .= '<div class="btn-group" role="group">
<button
id="'.$table_id.'_actions"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"
class="btn btn-outline-primary dropdown-toggle"
onclick="javascript:return false;">'.
get_lang('Detail').'
</button>
';
$html .= '<div class="dropdown-menu" aria-labelledby="'.$table_id.'_actions" >';
foreach ($this->form_actions as $action => &$label) {
$html .= '<a
class="dropdown-item"
data-action ="'.$action.'"
href="#"
onclick="javascript:action_click(this, \''.$table_id.'\');">'.$label.'</a>';
onclick="javascript: setCheckbox(false, \''.$table_id.'\'); return false;">'.
get_lang('Deselect all').'</a> ';
$items = [];
foreach ($this->form_actions as $action => $label) {
$items[] = [
'href' => 'javascript:void();',
'onclick' => "javascript:action_click(this, '$table_id');",
'title' => $label,
'data-action' => $action,
];
}
$html .= '</div>';
$html .= '</div>';
$html .= Display::groupButtonWithDropDown(get_lang('Detail'), $items);
} else {
$html .= $form;
}

@ -87,7 +87,7 @@ if ($actions) {
// Block Social Avatar
SocialManager::setSocialUserBlock($tpl, api_get_user_id(), 'messages');
if ($allowSocial) {
/*if ($allowSocial) {
$tpl->assign('social_menu_block', $social_menu_block);
$tpl->assign('social_right_content', $social_right_content);
$social_layout = $tpl->get_template('social/inbox.tpl');
@ -95,4 +95,6 @@ if ($allowSocial) {
} else {
$tpl->assign('content', $social_right_content);
$tpl->display_one_col_template();
}
}*/
$tpl->assign('content', $social_right_content);
$tpl->display_one_col_template();

Loading…
Cancel
Save