mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Fix regression of bookmarks for blind people
This commit is contained in:
parent
59f66ce9bd
commit
c06655bc03
|
|
@ -60,10 +60,9 @@ function printDropdownBookmarksList()
|
|||
}
|
||||
|
||||
$searchForm = '<!-- form with POST method by default, will be replaced with GET for external link by js -->'."\n";
|
||||
$searchForm .= '<form id="top-menu-action-bookmark" name="actionbookmark" method="POST" action="" onsubmit="return false" >';
|
||||
$searchForm .= '<form id="top-menu-action-bookmark" name="actionbookmark" method="POST" action=""'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)?'onsubmit="return false"':'').'>';
|
||||
$searchForm .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$searchForm .= '<input name="bookmark" id="top-bookmark-search-input" class="dropdown-search-input" placeholder="'.$langs->trans('Bookmarks').'" autocomplete="off" >';
|
||||
$searchForm .= '</form>';
|
||||
|
||||
|
||||
// Url to list bookmark
|
||||
$listbtn = '<a class="top-menu-dropdown-link" title="'.$langs->trans('AddThisPageToBookmarks').'" href="'.DOL_URL_ROOT.'/bookmarks/list.php" >';
|
||||
|
|
@ -79,7 +78,6 @@ function printDropdownBookmarksList()
|
|||
$newbtn .= img_picto('', 'bookmark', '', false, 0, 0, '', 'paddingright').dol_escape_htmltag($langs->trans('AddThisPageToBookmarks')).'</a>';
|
||||
}
|
||||
|
||||
$bookmarkList = '<div id="dropdown-bookmarks-list" >';
|
||||
// Menu with list of bookmarks
|
||||
$sql = "SELECT rowid, title, url, target FROM ".MAIN_DB_PREFIX."bookmark";
|
||||
$sql .= " WHERE (fk_user = ".$user->id." OR fk_user is NULL OR fk_user = 0)";
|
||||
|
|
@ -87,59 +85,125 @@ function printDropdownBookmarksList()
|
|||
$sql .= " ORDER BY position";
|
||||
if ($resql = $db->query($sql))
|
||||
{
|
||||
$i = 0;
|
||||
while (($conf->global->BOOKMARKS_SHOW_IN_MENU == 0 || $i < $conf->global->BOOKMARKS_SHOW_IN_MENU) && $obj = $db->fetch_object($resql))
|
||||
{
|
||||
$bookmarkList .= '<a class="dropdown-item bookmark-item" id="bookmark-item-'.$obj->rowid.'" data-id="'.$obj->rowid.'" '.($obj->target == 1 ? ' target="_blank"' : '').' href="'.dol_escape_htmltag($obj->url).'" >';
|
||||
$bookmarkList .= dol_escape_htmltag($obj->title);
|
||||
$bookmarkList .= '</a>';
|
||||
$i++;
|
||||
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
||||
$bookmarkList = '<div id="dropdown-bookmarks-list" >';
|
||||
$i = 0;
|
||||
while ((empty($conf->global->BOOKMARKS_SHOW_IN_MENU) || $i < $conf->global->BOOKMARKS_SHOW_IN_MENU) && $obj = $db->fetch_object($resql))
|
||||
{
|
||||
$bookmarkList .= '<a class="dropdown-item bookmark-item" id="bookmark-item-'.$obj->rowid.'" data-id="'.$obj->rowid.'" '.($obj->target == 1 ? ' target="_blank"' : '').' href="'.dol_escape_htmltag($obj->url).'" >';
|
||||
$bookmarkList .= dol_escape_htmltag($obj->title);
|
||||
$bookmarkList .= '</a>';
|
||||
$i++;
|
||||
}
|
||||
$bookmarkList .= '</div>';
|
||||
|
||||
$searchForm .= '<input name="bookmark" id="top-bookmark-search-input" class="dropdown-search-input" placeholder="'.$langs->trans('Bookmarks').'" autocomplete="off" >';
|
||||
} else {
|
||||
$searchForm .= '<select name"=bookmark" id="boxbookmark" class="topmenu-bookmark-dropdown .dropdown-toggle">';
|
||||
//$searchForm .= '<option>--'.$langs->trans("Bookmarks").'--</option>';
|
||||
$searchForm .= '<option hidden value="listbookmarks" class="optiongrey" selected rel="'.DOL_URL_ROOT.'/bookmarks/list.php">'.$langs->trans('Bookmarks').'</option>';
|
||||
$searchForm .= '<option value="listbookmark" class="optionblue" rel="'.dol_escape_htmltag(DOL_URL_ROOT.'/bookmarks/list.php').'" ';
|
||||
$searchForm .= ' data-html="'.dol_escape_htmltag(img_picto('', 'bookmark').' '.($user->rights->bookmark->creer ? $langs->trans('EditBookmarks') : $langs->trans('ListOfBookmarks')).'...').'">';
|
||||
$searchForm .= dol_escape_htmltag($user->rights->bookmark->creer ? $langs->trans('EditBookmarks') : $langs->trans('ListOfBookmarks')).'...</option>';
|
||||
// Url to go on create new bookmark page
|
||||
if (! empty($user->rights->bookmark->creer))
|
||||
{
|
||||
$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&url='.urlencode($url);
|
||||
$searchForm .= '<option value="newbookmark" class="optionblue" rel="'.dol_escape_htmltag($urltoadd).'"';
|
||||
$searchForm .= ' data-html="'.dol_escape_htmltag(img_picto('', 'bookmark').' '.$langs->trans('AddThisPageToBookmarks').'...').'">'.dol_escape_htmltag($langs->trans('AddThisPageToBookmarks').'...').'</option>';
|
||||
}
|
||||
while ((empty($conf->global->BOOKMARKS_SHOW_IN_MENU) || $i < $conf->global->BOOKMARKS_SHOW_IN_MENU) && $obj = $db->fetch_object($resql))
|
||||
{
|
||||
$searchForm .= '<option name="bookmark'.$obj->rowid.'" value="'.$obj->rowid.'" '.($obj->target == 1 ? ' target="_blank"' : '').' rel="'.dol_escape_htmltag($obj->url).'" >';
|
||||
$searchForm .= dol_escape_htmltag($obj->title);
|
||||
$searchForm .= '</option>';
|
||||
$i++;
|
||||
}
|
||||
$searchForm .= '</select>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
$bookmarkList .= '</div>';
|
||||
|
||||
$html = '
|
||||
<!-- search input -->
|
||||
<div class="dropdown-header bookmark-header">
|
||||
' . $searchForm.'
|
||||
</div>
|
||||
';
|
||||
$searchForm .= '</form>';
|
||||
|
||||
$html .= '
|
||||
<!-- Menu Body -->
|
||||
<div class="bookmark-body dropdown-body">
|
||||
'.$bookmarkList.'
|
||||
</div>
|
||||
';
|
||||
// Generate the return string
|
||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
||||
$html = $searchForm;
|
||||
|
||||
$html .= '
|
||||
<!-- Menu Footer-->
|
||||
<div class="bookmark-footer">
|
||||
'.$newbtn.$listbtn.'
|
||||
<div style="clear:both;"></div>
|
||||
</div>
|
||||
';
|
||||
$html.='<!-- script to open selected choice -->
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
jQuery("#boxbookmark").change(function() {
|
||||
var urlselected = jQuery("#boxbookmark option:selected").attr("rel");
|
||||
if (! urlselected) console.log("Error, failed to get the URL to jump to from the rel attribute");
|
||||
var urltarget = jQuery("#boxbookmark option:selected").attr("target");
|
||||
if (! urltarget) { urltarget=""; }
|
||||
jQuery("form#top-menu-action-bookmark").attr("target",urltarget);
|
||||
jQuery("form#top-menu-action-bookmark").attr("action",urlselected);
|
||||
|
||||
$html .= '<script>
|
||||
$( document ).on("keyup", "#top-bookmark-search-input", function () {
|
||||
console.log("We change select bookmark. We choose urlselected="+urlselected+" with target="+urltarget);
|
||||
|
||||
var filter = $(this).val(), count = 0;
|
||||
$("#dropdown-bookmarks-list .bookmark-item").each(function () {
|
||||
// Method is POST for internal link, GET for external
|
||||
if (urlselected.startsWith(\'http\'))
|
||||
{
|
||||
var newmethod=\'GET\';
|
||||
jQuery("form#top-menu-action-bookmark").attr("method", newmethod);
|
||||
console.log("We change method to newmethod="+newmethod);
|
||||
jQuery("form#top-menu-action-bookmark").submit();
|
||||
console.log("We restore method to POST");
|
||||
jQuery("form#top-menu-action-bookmark").attr("method", \'POST\');
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery("form#top-menu-action-bookmark").submit();
|
||||
}
|
||||
});
|
||||
})
|
||||
</script>';
|
||||
} else {
|
||||
$html = '
|
||||
<!-- search input -->
|
||||
<div class="dropdown-header bookmark-header">
|
||||
' . $searchForm.'
|
||||
</div>
|
||||
';
|
||||
|
||||
if ($(this).text().search(new RegExp(filter, "i")) < 0) {
|
||||
$(this).addClass("hidden-search-result");
|
||||
} else {
|
||||
$(this).removeClass("hidden-search-result");
|
||||
count++;
|
||||
}
|
||||
});
|
||||
$("#top-bookmark-search-filter-count").text(count);
|
||||
});
|
||||
</script>';
|
||||
$html .= '
|
||||
<!-- Menu Body -->
|
||||
<div class="bookmark-body dropdown-body">
|
||||
'.$bookmarkList.'
|
||||
</div>
|
||||
';
|
||||
|
||||
$html .= '
|
||||
<!-- Menu Footer-->
|
||||
<div class="bookmark-footer">
|
||||
'.$newbtn.$listbtn.'
|
||||
<div style="clear:both;"></div>
|
||||
</div>
|
||||
';
|
||||
|
||||
$html .= '<!-- script to open/close the popup -->
|
||||
<script>
|
||||
$( document ).on("keyup", "#top-bookmark-search-input", function () {
|
||||
|
||||
var filter = $(this).val(), count = 0;
|
||||
$("#dropdown-bookmarks-list .bookmark-item").each(function () {
|
||||
|
||||
if ($(this).text().search(new RegExp(filter, "i")) < 0) {
|
||||
$(this).addClass("hidden-search-result");
|
||||
} else {
|
||||
$(this).removeClass("hidden-search-result");
|
||||
count++;
|
||||
}
|
||||
});
|
||||
$("#top-bookmark-search-filter-count").text(count);
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1969,51 +1969,57 @@ function top_menu_bookmark()
|
|||
include_once DOL_DOCUMENT_ROOT.'/bookmarks/bookmarks.lib.php';
|
||||
$langs->load("bookmarks");
|
||||
|
||||
$html .= '<!-- div for bookmark link -->
|
||||
<div id="topmenu-bookmark-dropdown" class="dropdown inline-block">
|
||||
<a class="dropdown-toggle login-dropdown-a" data-toggle="dropdown" href="#" title="'.$langs->trans('Bookmarks').' ('.$langs->trans('BookmarksMenuShortCut').')">
|
||||
<i class="fa fa-star" ></i>
|
||||
</a>
|
||||
<div class="dropdown-menu">
|
||||
'.printDropdownBookmarksList().'
|
||||
</div>
|
||||
</div>';
|
||||
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
||||
$html .= '<div id="topmenu-bookmark-dropdown" class="dropdown inline-block">';
|
||||
$html .= printDropdownBookmarksList();
|
||||
$html .= '</div>';
|
||||
} else {
|
||||
$html .= '<!-- div for bookmark link -->
|
||||
<div id="topmenu-bookmark-dropdown" class="dropdown inline-block">
|
||||
<a class="dropdown-toggle login-dropdown-a" data-toggle="dropdown" href="#" title="'.$langs->trans('Bookmarks').' ('.$langs->trans('BookmarksMenuShortCut').')">
|
||||
<i class="fa fa-star" ></i>
|
||||
</a>
|
||||
<div class="dropdown-menu">
|
||||
'.printDropdownBookmarksList().'
|
||||
</div>
|
||||
</div>';
|
||||
|
||||
$html .= '
|
||||
<!-- Code to show/hide the user drop-down -->
|
||||
<script>
|
||||
$( document ).ready(function() {
|
||||
$(document).on("click", function(event) {
|
||||
if (!$(event.target).closest("#topmenu-bookmark-dropdown").length) {
|
||||
//console.log("close bookmark dropdown - we click outside");
|
||||
// Hide the menus.
|
||||
$("#topmenu-bookmark-dropdown").removeClass("open");
|
||||
}
|
||||
});
|
||||
$html .= '
|
||||
<!-- Code to show/hide the bookmark drop-down -->
|
||||
<script>
|
||||
$( document ).ready(function() {
|
||||
$(document).on("click", function(event) {
|
||||
if (!$(event.target).closest("#topmenu-bookmark-dropdown").length) {
|
||||
//console.log("close bookmark dropdown - we click outside");
|
||||
// Hide the menus.
|
||||
$("#topmenu-bookmark-dropdown").removeClass("open");
|
||||
}
|
||||
});
|
||||
|
||||
$("#topmenu-bookmark-dropdown .dropdown-toggle").on("click", function(event) {
|
||||
console.log("toggle bookmark dropdown");
|
||||
openBookMarkDropDown();
|
||||
});
|
||||
$("#topmenu-bookmark-dropdown .dropdown-toggle").on("click", function(event) {
|
||||
console.log("toggle bookmark dropdown");
|
||||
openBookMarkDropDown();
|
||||
});
|
||||
|
||||
// Key map shortcut
|
||||
$(document).keydown(function(e){
|
||||
if( e.which === 77 && e.ctrlKey && e.shiftKey ){
|
||||
console.log(\'control + shift + m : trigger open bookmark dropdown\');
|
||||
openBookMarkDropDown();
|
||||
}
|
||||
});
|
||||
// Key map shortcut
|
||||
$(document).keydown(function(e){
|
||||
if( e.which === 77 && e.ctrlKey && e.shiftKey ){
|
||||
console.log(\'control + shift + m : trigger open bookmark dropdown\');
|
||||
openBookMarkDropDown();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var openBookMarkDropDown = function() {
|
||||
event.preventDefault();
|
||||
$("#topmenu-bookmark-dropdown").toggleClass("open");
|
||||
$("#top-bookmark-search-input").focus();
|
||||
}
|
||||
var openBookMarkDropDown = function() {
|
||||
event.preventDefault();
|
||||
$("#topmenu-bookmark-dropdown").toggleClass("open");
|
||||
$("#top-bookmark-search-input").focus();
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
';
|
||||
});
|
||||
</script>
|
||||
';
|
||||
}
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,13 +118,13 @@ a.badge-warning:focus, a.badge-warning:hover {
|
|||
}
|
||||
|
||||
/* WARNING colorblind */
|
||||
body[class^="colorblind-"] .badge-warning {
|
||||
body[class*="colorblind-"] .badge-warning {
|
||||
background-color: <?php print $colorblind_deuteranopes_badgeWarning; ?>;
|
||||
}
|
||||
body[class^="colorblind-"] a.badge-warning.focus,body[class^="colorblind-"] a.badge-warning:focus {
|
||||
body[class*="colorblind-"] a.badge-warning.focus,body[class^="colorblind-"] a.badge-warning:focus {
|
||||
box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($colorblind_deuteranopes_badgeWarning, 0.5); ?>;
|
||||
}
|
||||
body[class^="colorblind-"] a.badge-warning:focus, a.badge-warning:hover {
|
||||
body[class*="colorblind-"] a.badge-warning:focus, a.badge-warning:hover {
|
||||
background-color: <?php print colorDarker($colorblind_deuteranopes_badgeWarning, 10); ?>;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -145,16 +145,21 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
|
|||
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
|
||||
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
|
||||
}
|
||||
.progress-bar-green,
|
||||
.progress-bar-success {
|
||||
.progress-bar-green, .progress-bar-success {
|
||||
background-color: <?php echo $badgeSuccess ?>;
|
||||
}
|
||||
.progress-striped .progress-bar-green,
|
||||
.progress-striped .progress-bar-success {
|
||||
.progress-striped .progress-bar-green, .progress-striped .progress-bar-success {
|
||||
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
|
||||
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
|
||||
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
|
||||
}
|
||||
body[class*="colorblind-"] .progress-bar-green, body[class*="colorblind-"] .progress-bar-success {
|
||||
background-color: <?php echo $colorblind_deuteranopes_badgeSuccess ?>;
|
||||
}
|
||||
body[class*="colorblind-"] .progress-bar-red, body[class*="colorblind-"] .progress-bar-danger {
|
||||
background-color: <?php echo $colorblind_deuteranopes_badgeDanger ?>;
|
||||
}
|
||||
|
||||
.progress-bar-aqua,
|
||||
.progress-bar-info {
|
||||
background-color: #00c0ef;
|
||||
|
|
|
|||
|
|
@ -99,6 +99,7 @@ $badgeLight = '#f8f9fa';
|
|||
$colorblind_deuteranopes_badgeSuccess = '#37de5d'; //! text color black
|
||||
$colorblind_deuteranopes_badgeSuccess_textColor7 = '#000';
|
||||
$colorblind_deuteranopes_badgeWarning = '#e4e411';
|
||||
$colorblind_deuteranopes_badgeDanger = $badgeDanger; // currently not tested with a color blind people so use default color
|
||||
|
||||
/* default color for status : After a quick check, somme status can have oposite function according to objects
|
||||
* So this badges status uses default value according to theme eldy status img
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user