diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php index 5ce2f782d39..1e54cc816fd 100644 --- a/htdocs/bookmarks/bookmarks.lib.php +++ b/htdocs/bookmarks/bookmarks.lib.php @@ -150,3 +150,140 @@ function printBookmarksList($aDb, $aLangs) return $ret; } + + + +/** + * Add area with bookmarks in top menu + * + * @param DoliDb $aDb Database handler + * @param Translate $aLangs Object lang + * @return string + */ +function printDropdownBookmarksList($aDb, $aLangs) +{ + global $conf, $user; + + $db = $aDb; + $langs = $aLangs; + + require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php'; + if (! isset($conf->global->BOOKMARKS_SHOW_IN_MENU)) $conf->global->BOOKMARKS_SHOW_IN_MENU=5; + + $langs->load("bookmarks"); + + $url= $_SERVER["PHP_SELF"]; + + if (! empty($_SERVER["QUERY_STRING"])) + { + $url.=(dol_escape_htmltag($_SERVER["QUERY_STRING"])?'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]):''); + } + else + { + global $sortfield,$sortorder; + $tmpurl=''; + // No urlencode, all param $url will be urlencoded later + if ($sortfield) $tmpurl.=($tmpurl?'&':'').'sortfield='.$sortfield; + if ($sortorder) $tmpurl.=($tmpurl?'&':'').'sortorder='.$sortorder; + if (is_array($_POST)) + { + foreach($_POST as $key => $val) + { + if (preg_match('/^search_/', $key) && $val != '') $tmpurl.=($tmpurl?'&':'').$key.'='.$val; + } + } + $url.=($tmpurl?'?'.$tmpurl:''); + } + + $searchForm = ''."\n"; + $searchForm.= '
'; + $searchForm.= ''; + $searchForm.= '
'; + + // Url to list bookmark + $listbtn = ''; + $listbtn.= ' '.$langs->trans('Bookmarks').''; + + // Url to go on create new bookmark page + $newbtn = ''; + if (! empty($user->rights->bookmark->creer)) + { + //$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&urlsource='.urlencode($url).'&url='.urlencode($url); + $urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&url='.urlencode($url); + $newbtn.= ''; + $newbtn.= ' '.dol_escape_htmltag($langs->trans('AddThisPageToBookmarks')).''; + } + + + $bookmarkList=''; + + $html= ''; + if (! empty($conf->global->BOOKMARKS_SHOW_IN_MENU)) { + $html.= ' + + + '; + } + + $html.= ' + + + '; + + $html.= ' + + + '; + + if (! empty($conf->global->BOOKMARKS_SHOW_IN_MENU)) { + $html .= ''; + } + + return $html; +} diff --git a/htdocs/langs/en_US/bookmarks.lang b/htdocs/langs/en_US/bookmarks.lang index 5330ab6e87c..87466cadcfa 100644 --- a/htdocs/langs/en_US/bookmarks.lang +++ b/htdocs/langs/en_US/bookmarks.lang @@ -18,3 +18,4 @@ SetHereATitleForLink=Set a name for the bookmark UseAnExternalHttpLinkOrRelativeDolibarrLink=Use an external/absolute link (https://URL) or an internal/relative link (/DOLIBARR_ROOT/htdocs/...) ChooseIfANewWindowMustBeOpenedOnClickOnBookmark=Choose if the linked page should open in the current tab or a new tab BookmarksManagement=Bookmarks management +BookmarksMenuShortCut=Ctrl + shift + m diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 845a3fd0873..75c0190ddcd 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1602,6 +1602,10 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead print '
'."\n"; + + + + // Add login user link $toprightmenu.='
'; @@ -1609,6 +1613,17 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead $mode=-1; $toprightmenu.='
'; @@ -1823,12 +1838,10 @@ function top_menu_user(User $user, Translate $langs) else $appli.=" ".DOL_VERSION; $btnUser = ' -