Add AI assistant in top menu #38307
This commit is contained in:
parent
034647c653
commit
e735bed124
2 changed files with 35 additions and 12 deletions
|
|
@ -2261,14 +2261,17 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead
|
|||
$toprightmenu .= top_menu_search();
|
||||
}
|
||||
|
||||
// Add AI picto
|
||||
$toprightmenu .= top_menu_ai();
|
||||
|
||||
// Add bookmark dropdown
|
||||
$toprightmenu .= top_menu_bookmark();
|
||||
|
||||
if (getDolGlobalString('MAIN_USE_TOP_MENU_QUICKADD_DROPDOWN')) {
|
||||
// Add the quick add object dropdown
|
||||
$toprightmenu .= top_menu_quickadd();
|
||||
}
|
||||
|
||||
// Add bookmark dropdown
|
||||
$toprightmenu .= top_menu_bookmark();
|
||||
|
||||
if (getDolGlobalString('MAIN_USE_TOP_MENU_IMPORT_FILE')) {
|
||||
// Add the import file link
|
||||
$toprightmenu .= top_menu_importfile();
|
||||
|
|
@ -2710,6 +2713,33 @@ function top_menu_user($hideloginname = 0, $urllogout = '')
|
|||
return $btnUser;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the tooltip on top menu quick add.
|
||||
* Called when option MAIN_USE_TOP_MENU_QUICKADD_DROPDOWN is set
|
||||
*
|
||||
* @return string HTML content
|
||||
*/
|
||||
function top_menu_ai()
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
// Button disabled on text browser
|
||||
/*if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
|
||||
return '';
|
||||
}*/
|
||||
|
||||
$html = '';
|
||||
|
||||
if (isModEnabled('ai')) {
|
||||
$html .= '<!-- div for quick ai link -->
|
||||
<div id="topmenu-tool" class="atoplogin dropdown inline-block">
|
||||
<a accesskey="a" class="nofocusvisible" href="'.DOL_URL_ROOT.'/ai/assistant/index.php" title="'.$langs->trans('AI').' ('.$conf->browser->stringforfirstkey.' a)"><i class="fa fa-magic"></i></a>
|
||||
</div>';
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the tooltip on top menu quick add.
|
||||
* Called when option MAIN_USE_TOP_MENU_QUICKADD_DROPDOWN is set
|
||||
|
|
@ -2727,17 +2757,10 @@ function top_menu_quickadd()
|
|||
|
||||
$html = '';
|
||||
|
||||
if (isModEnabled('ai')) {
|
||||
$html .= '<!-- div for quick ai link -->
|
||||
<div id="topmenu-tool" class="atoplogin dropdown inline-block">
|
||||
<a accesskey="i" class="nofocusvisible" href="'.DOL_URL_ROOT.'/ai/assistant/index.php" title="'.$langs->trans('AI').' ('.$conf->browser->stringforfirstkey.' i)"><i class="fa fa-magic"></i></a>
|
||||
</div>';
|
||||
}
|
||||
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
$html .= '<!-- div for quick add link -->
|
||||
<div id="topmenu-quickadd-dropdown" class="atoplogin dropdown inline-block">
|
||||
<a accesskey="a" class="dropdown-toggle login-dropdown-a nofocusvisible" data-toggle="dropdown" href="#" title="'.$langs->trans('QuickAdd').' ('.$conf->browser->stringforfirstkey.' a)"><i class="fa fa-plus-circle"></i></a>
|
||||
<a accesskey="c" class="dropdown-toggle login-dropdown-a nofocusvisible" data-toggle="dropdown" href="#" title="'.$langs->trans('QuickAdd').' ('.$conf->browser->stringforfirstkey.' c)"><i class="fa fa-plus-circle"></i></a>
|
||||
<div class="dropdown-menu">'.printDropdownQuickadd().'</div>
|
||||
</div>';
|
||||
if (!defined('JS_JQUERY_DISABLE_DROPDOWN')) { // This may be set by some pages that use different jquery version to avoid errors
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ button.dropdown-item.global-search-item {
|
|||
display: block;
|
||||
}
|
||||
|
||||
|
||||
#topmenu-tool a,
|
||||
#topmenu-global-search-dropdown a.login-dropdown-a,
|
||||
#topmenu-quickadd-dropdown a.login-dropdown-a,
|
||||
#topmenu-bookmark-dropdown a.login-dropdown-a,
|
||||
|
|
|
|||
Loading…
Reference in a new issue