NEW Bookmarks are into a combo list.
This commit is contained in:
parent
761ece3125
commit
9df4bac202
@ -41,9 +41,12 @@ function printBookmarksList($aDb, $aLangs)
|
||||
$langs->load("bookmarks");
|
||||
|
||||
$url= $_SERVER["PHP_SELF"].(! empty($_SERVER["QUERY_STRING"])?'?'.$_SERVER["QUERY_STRING"]:'');
|
||||
|
||||
// TODO Add post param to $url
|
||||
|
||||
$ret = '';
|
||||
|
||||
// Menu bookmark
|
||||
/*
|
||||
$ret.= '<div class="menu_titre">';
|
||||
$ret.= '<table class="nobordernopadding" width="100%" summary="bookmarkstable"><tr><td>';
|
||||
$ret.= '<a class="vmenu" href="'.DOL_URL_ROOT.'/bookmarks/list.php">'.$langs->trans('Bookmarks').'</a>';
|
||||
@ -56,9 +59,18 @@ function printBookmarksList($aDb, $aLangs)
|
||||
}
|
||||
$ret.= '</td></tr></table>';
|
||||
$ret.= '</div>';
|
||||
|
||||
*/
|
||||
$ret.= '<div class="menu_top"></div>'."\n";
|
||||
|
||||
$ret.= '<form id="actionbookmark" name="actionbookmark" method="POST" action="">';
|
||||
$ret.= '<select name="bookmark" id="boxbookmark" class="flat boxcombo vmenusearchselectcombo">';
|
||||
$ret.= '<option hidden value="listbookmarks" class="optiongrey" selected rel="'.DOL_URL_ROOT.'/bookmarks/list.php">'.$langs->trans('Bookmarks').'</option>';
|
||||
$ret.= '<option value="listbookmark" class="optionblue" rel="'.dol_escape_js(DOL_URL_ROOT.'/bookmarks/list.php').'">'.dol_escape_htmltag($user->rights->bookmark->creer ? $langs->trans('EditBookmarks') : $langs->trans('ListOfBookmarks')).'...</option>';
|
||||
if ($user->rights->bookmark->creer)
|
||||
{
|
||||
$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&urlsource='.urlencode($url).'&url='.urlencode($url);
|
||||
$ret.= '<option value="newbookmark" class="optionblue" rel="'.dol_escape_js($urltoadd).'">'.dol_escape_htmltag($langs->trans('AddThisPageToBookmarks')).'...</option>';
|
||||
}
|
||||
// Menu with all bookmarks
|
||||
if (! empty($conf->global->BOOKMARKS_SHOW_IN_MENU))
|
||||
{
|
||||
@ -71,9 +83,12 @@ function printBookmarksList($aDb, $aLangs)
|
||||
$i=0;
|
||||
while ($i < $conf->global->BOOKMARKS_SHOW_IN_MENU && $obj = $db->fetch_object($resql))
|
||||
{
|
||||
$ret.='<div class="menu_contenu"><a class="vsmenu" title="'.$obj->title.'" href="'.$obj->url.'"'.($obj->target == 1?' target="_blank"':'').'>';
|
||||
//$ret.='<div class="menu_contenu">';
|
||||
$ret.='<option name="bookmark'.$obj->rowid.'" value="'.$obj->rowid.'" '.($obj->target == 1?' target="_blank"':'').' rel="'.dol_escape_js($obj->url).'">'.img_picto('','object_bookmark').' '.$obj->title.'</option>';
|
||||
/*$ret.='<a class="vsmenu" title="'.$obj->title.'" href="'.$obj->url.'"'.($obj->target == 1?' target="_blank"':'').'>';
|
||||
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $ret.=' '.img_object('','bookmark').' ';
|
||||
$ret.= dol_trunc($obj->title, 20).'</a><br></div>';
|
||||
$ret.= dol_trunc($obj->title, 20).'</a><br>';*/
|
||||
//$ret.='</div>';
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
@ -82,7 +97,24 @@ function printBookmarksList($aDb, $aLangs)
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$ret.= '</select>';
|
||||
$ret.= '</form>';
|
||||
|
||||
$ret.=ajax_combobox('boxbookmark');
|
||||
|
||||
$ret.='<script type="text/javascript">
|
||||
$(document).ready(function () {';
|
||||
$ret.=' jQuery("#boxbookmark").change(function() {
|
||||
var urlselected = jQuery("#boxbookmark option:selected").attr("rel");
|
||||
var urltarget = jQuery("#boxbookmark option:selected").attr("target");
|
||||
if (! urltarget) { urltarget=""; }
|
||||
console.log("We change select bookmark. We choose "+urlselected+" with target "+urltarget);
|
||||
jQuery("form#actionbookmark").attr("target",urltarget);
|
||||
jQuery("form#actionbookmark").attr("action",urlselected);
|
||||
jQuery("#actionbookmark").submit();
|
||||
});';
|
||||
$ret.='})</script>';
|
||||
$ret .= '<div class="menu_end"></div>';
|
||||
|
||||
return $ret;
|
||||
|
||||
@ -157,15 +157,19 @@ if ($action == 'create')
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("BookmarkTitle").'</td><td><input class="flat" name="title" size="30" value="'.$title.'"></td><td class="hideonsmartphone">'.$langs->trans("SetHereATitleForLink").'</td></tr>';
|
||||
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("UrlOrLink").'</td><td><input class="flat" name="url" class="quatrevingtpercent" value="'.$url.'"></td><td class="hideonsmartphone">'.$langs->trans("UseAnExternalHttpLinkOrRelativeDolibarrLink").'</td></tr>';
|
||||
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("BookmarkTitle").'</td><td><input id="titlebookmark" class="flat minwidth100" name="title" value="'.$title.'"></td><td class="hideonsmartphone">'.$langs->trans("SetHereATitleForLink").'</td></tr>';
|
||||
dol_set_focus('#titlebookmark');
|
||||
|
||||
// Url
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("UrlOrLink").'</td><td><input class="flat quatrevingtpercent" name="url" value="'.$url.'"></td><td class="hideonsmartphone">'.$langs->trans("UseAnExternalHttpLinkOrRelativeDolibarrLink").'</td></tr>';
|
||||
|
||||
// Target
|
||||
print '<tr><td>'.$langs->trans("BehaviourOnClick").'</td><td>';
|
||||
$liste=array(0=>$langs->trans("ReplaceWindow"),1=>$langs->trans("OpenANewWindow"));
|
||||
print $form->selectarray('target',$liste,1);
|
||||
print '</td><td class="hideonsmartphone">'.$langs->trans("ChooseIfANewWindowMustBeOpenedOnClickOnBookmark").'</td></tr>';
|
||||
|
||||
// Owner
|
||||
print '<tr><td>'.$langs->trans("Owner").'</td><td>';
|
||||
print $form->select_dolusers(isset($_POST['userid'])?$_POST['userid']:$user->id, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
|
||||
print '</td><td class="hideonsmartphone"> </td></tr>';
|
||||
|
||||
@ -71,9 +71,9 @@ if ($_GET["action"] == 'delete')
|
||||
|
||||
$userstatic=new User($db);
|
||||
|
||||
llxHeader();
|
||||
llxHeader('', $langs->trans("ListOfBookmarks"));
|
||||
|
||||
print load_fiche_titre($langs->trans("Bookmarks"));
|
||||
print load_fiche_titre($langs->trans("ListOfBookmarks"));
|
||||
|
||||
$sql = "SELECT b.fk_soc as rowid, b.dateb, b.rowid as bid, b.fk_user, b.url, b.target, b.title, b.favicon, b.position,";
|
||||
$sql.= " u.login, u.lastname, u.firstname";
|
||||
|
||||
@ -5087,7 +5087,7 @@ class Form
|
||||
* @param string $morecss Add more class to css styles
|
||||
* @param int $callurlonselect If set to 1, some code is added so an url return by the ajax is called when value is selected.
|
||||
* @param string $placeholder String to use as placeholder
|
||||
* @param integer $acceptdelayedhtml 1 if caller request to have html delayed content not returned but saved into global $delayedhtmlcontent (so caller can show it at end of page to avoid flash FOUC effect)
|
||||
* @param integer $acceptdelayedhtml 1 if caller request to have html js content not returned but saved into global $delayedhtmlcontent (so caller can show it at end of page to avoid flash FOUC effect)
|
||||
* @return string HTML select string
|
||||
*/
|
||||
static function selectArrayAjax($htmlname, $url, $id='', $moreparam='', $moreparamtourl='', $disabled=0, $minimumInputLength=1, $morecss='', $callurlonselect=0, $placeholder='', $acceptdelayedhtml=0)
|
||||
|
||||
@ -401,7 +401,7 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $
|
||||
if ($forcefocus) $msg.= '.select2(\'focus\')';
|
||||
$msg.= ';'."\n";
|
||||
|
||||
if (count($events))
|
||||
if (count($events)) // If an array of js events to do were provided.
|
||||
{
|
||||
$msg.= '
|
||||
jQuery("#'.$htmlname.'").change(function () {
|
||||
@ -414,6 +414,7 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $
|
||||
});
|
||||
|
||||
function runJsCodeForEvent'.$htmlname.'(obj) {
|
||||
console.log("Run runJsCodeForEvent'.$htmlname.'");
|
||||
var id = $("#'.$htmlname.'").val();
|
||||
var method = obj.method;
|
||||
var url = obj.url;
|
||||
|
||||
@ -494,6 +494,16 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
print "<!-- End SearchForm -->\n";
|
||||
}
|
||||
|
||||
if (is_array($moredata) && ! empty($moredata['bookmarks']))
|
||||
{
|
||||
print "\n";
|
||||
print "<!-- Begin Bookmarks -->\n";
|
||||
print '<div id="blockvmenubookmarks" class="blockvmenubookmarks">'."\n";
|
||||
print $moredata['bookmarks'];
|
||||
print '</div>'."\n";
|
||||
print "<!-- End Bookmarks -->\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* We update newmenu with entries found into database
|
||||
* --------------------------------------------------
|
||||
@ -1632,16 +1642,6 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
if ($altok) print '<div class="blockvmenuend"></div>';
|
||||
}
|
||||
|
||||
if (is_array($moredata) && ! empty($moredata['bookmarks']))
|
||||
{
|
||||
print "\n";
|
||||
print "<!-- Begin Bookmarks -->\n";
|
||||
print '<div id="blockvmenubookmarks" class="blockvmenubookmarks">'."\n";
|
||||
print $moredata['bookmarks'];
|
||||
print '</div>'."\n";
|
||||
print "<!-- End Bookmarks -->\n";
|
||||
}
|
||||
|
||||
return count($menu_array);
|
||||
}
|
||||
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
# Dolibarr language file - Source file is en_US - marque pages
|
||||
AddThisPageToBookmarks=Add this page to bookmarks
|
||||
AddThisPageToBookmarks=Add current page to bookmarks
|
||||
Bookmark=Bookmark
|
||||
Bookmarks=Bookmarks
|
||||
ListOfBookmarks=List of bookmarks
|
||||
EditBookmarks=Edit bookmarks
|
||||
NewBookmark=New bookmark
|
||||
ShowBookmark=Show bookmark
|
||||
OpenANewWindow=Open a new window
|
||||
|
||||
@ -349,6 +349,12 @@ span.timesheetalreadyrecorded input {
|
||||
select.flat, form.flat select {
|
||||
font-weight: normal;
|
||||
}
|
||||
.optionblue {
|
||||
color: rgb(<?php echo $colortextlink; ?>) !important;
|
||||
}
|
||||
.select2-results .select2-highlighted.optionblue {
|
||||
color: #FFF !important;
|
||||
}
|
||||
.optiongrey, .opacitymedium {
|
||||
opacity: 0.5;
|
||||
}
|
||||
@ -906,14 +912,14 @@ div.blockvmenulogo
|
||||
{
|
||||
border-bottom: 0 !important;
|
||||
}
|
||||
div.blockvmenupair, div.blockvmenuimpair, div.blockvmenubookmarks {
|
||||
div.blockvmenupair, div.blockvmenuimpair {
|
||||
border-top: none !important;
|
||||
border-left: none !important;
|
||||
border-right: none !important;
|
||||
border-bottom: 1px solid #e0e0e0;
|
||||
padding-left: 0 !important;
|
||||
}
|
||||
div.blockvmenuend {
|
||||
div.blockvmenuend, div.blockvmenubookmarks {
|
||||
border: none !important;
|
||||
padding-left: 0 !important;
|
||||
}
|
||||
@ -1718,14 +1724,19 @@ div.vmenu, td.vmenu {
|
||||
}
|
||||
|
||||
.vmenu {
|
||||
width: 190px;
|
||||
margin-left: 4px;
|
||||
<?php if (GETPOST("optioncss") == 'print') { ?>
|
||||
display: none;
|
||||
<?php } ?>
|
||||
}
|
||||
|
||||
/* Force vmenusearchselectcombo with type=text differently than without because beautify with select2 affect vmenusearchselectcombo differently */
|
||||
input.vmenusearchselectcombo[type=text] {
|
||||
width: 180px !important;
|
||||
}
|
||||
.vmenusearchselectcombo {
|
||||
width: 188px;
|
||||
width: 188px;
|
||||
}
|
||||
|
||||
.menu_contenu {
|
||||
@ -1757,10 +1768,6 @@ a.help:link, a.help:visited, a.help:hover, a.help:active, span.help { font-size:
|
||||
a.vsmenu.addbookmarkpicto {
|
||||
padding-right: 10px;
|
||||
}
|
||||
.vmenu div.blockvmenubookmarks, .vmenu div.blockvmenuend, .vmenu div.blockvmenulogo, .vmenu div.blockvmenusearchphone
|
||||
{
|
||||
/* border-bottom: 1px solid #BBB; */
|
||||
}
|
||||
div.blockvmenusearchphone
|
||||
{
|
||||
border-bottom: none !important;
|
||||
@ -1771,7 +1778,7 @@ div.blockvmenusearchphone
|
||||
}
|
||||
.vmenu div.blockvmenusearch
|
||||
{
|
||||
padding-bottom: 14px;
|
||||
padding-bottom: 4px;
|
||||
/* border-bottom: 1px solid #e0e0e0; */
|
||||
}
|
||||
.vmenu div.blockvmenuend
|
||||
@ -1785,7 +1792,7 @@ div.blockvmenusearchphone
|
||||
}
|
||||
div.blockvmenubookmarks
|
||||
{
|
||||
padding-bottom: 6px !important;
|
||||
padding-bottom: 16px !important;
|
||||
}
|
||||
div.blockvmenupair, div.blockvmenuimpair, div.blockvmenubookmarks, div.blockvmenuend
|
||||
{
|
||||
@ -3862,14 +3869,19 @@ div.dataTables_length select {
|
||||
/* Select2 */
|
||||
/* ============================================================================== */
|
||||
|
||||
.select2-default {
|
||||
color: #999 !important;
|
||||
/*opacity: 0.2;*/
|
||||
}
|
||||
.select2-choice, .select2-container .select2-choice {
|
||||
border-bottom: solid 1px rgba(0,0,0,.2);
|
||||
border-bottom: solid 1px rgba(0,0,0,.4);
|
||||
}
|
||||
.select2-container .select2-choice > .select2-chosen {
|
||||
margin-right: 23px;
|
||||
}
|
||||
.select2-container .select2-choice .select2-arrow {
|
||||
border-radius: 0;
|
||||
background: transparent;
|
||||
}
|
||||
.select2-container-multi .select2-choices {
|
||||
background-image: none;
|
||||
@ -3988,18 +4000,18 @@ a span.select2-chosen
|
||||
|
||||
|
||||
/* Special case for the select2 add widget */
|
||||
#addbox .select2-container .select2-choice > .select2-chosen {
|
||||
#addbox .select2-container .select2-choice > .select2-chosen, #actionbookmark .select2-container .select2-choice > .select2-chosen {
|
||||
text-align: left;
|
||||
opacity: 0.2;
|
||||
opacity: 0.4;
|
||||
}
|
||||
/* Style used before the select2 js is executed on boxcombo */
|
||||
#boxcombo.boxcombo {
|
||||
#boxbookmark.boxcombo, #boxcombo.boxcombo {
|
||||
text-align: left;
|
||||
opacity: 0.2;
|
||||
border-bottom: 1px solid #000;
|
||||
opacity: 0.4;
|
||||
border-bottom: solid 1px rgba(0,0,0,.4) !important;
|
||||
height: 26px;
|
||||
line-height: 24px;
|
||||
padding: 0 0 5px 5px;
|
||||
padding: 0 0 2px 0;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
|
||||
@ -346,6 +346,12 @@ span.timesheetalreadyrecorded input {
|
||||
select.flat, form.flat select {
|
||||
font-weight: normal;
|
||||
}
|
||||
.optionblue {
|
||||
color: rgb(<?php echo $colortextlink; ?>) !important;
|
||||
}
|
||||
.select2-results .select2-highlighted.optionblue {
|
||||
color: #FFF !important;
|
||||
}
|
||||
.optiongrey, .opacitymedium {
|
||||
opacity: 0.5;
|
||||
}
|
||||
@ -1782,7 +1788,7 @@ font.vsmenudisabledmargin { margin: 1px 1px 1px 8px; }
|
||||
a.help:link, a.help:visited, a.help:hover, a.help:active, span.help { font-size:<?php print $fontsizesmaller ?>px; font-family: <?php print $fontlist ?>; text-align: <?php print $left; ?>; font-weight: normal; color: #666666; text-decoration: none; }
|
||||
|
||||
|
||||
div.blockvmenupair, div.blockvmenuimpair, div.blockvmenubookmarks
|
||||
div.blockvmenupair, div.blockvmenuimpair
|
||||
{
|
||||
font-family: <?php print $fontlist ?>;
|
||||
color: #000000;
|
||||
@ -1797,11 +1803,21 @@ div.blockvmenupair, div.blockvmenuimpair, div.blockvmenubookmarks
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 1px solid #e0e0e0;
|
||||
}
|
||||
div.blockvmenubookmarks
|
||||
{
|
||||
padding-bottom: 16px !important;
|
||||
}
|
||||
div.blockvmenuend {
|
||||
border: none !important;
|
||||
padding-left: 0 !important;
|
||||
}
|
||||
a.vsmenu.addbookmarkpicto {
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
div.blockvmenusearch
|
||||
div.blockvmenufirst {
|
||||
padding-top: 10px;
|
||||
}
|
||||
div.blockvmenusearch, div.blockvmenubookmarks
|
||||
{
|
||||
font-family: <?php print $fontlist ?>;
|
||||
color: #000000;
|
||||
@ -1811,7 +1827,7 @@ div.blockvmenusearch
|
||||
padding-right: 1px;
|
||||
padding-top: 3px;
|
||||
padding-bottom: 3px;
|
||||
margin: 1px 0px 12px 0px;
|
||||
margin: 1px 0px 2px 0px;
|
||||
|
||||
padding-bottom: 10px;
|
||||
/* border-bottom: 1px solid #f4f4f4; */
|
||||
@ -4103,15 +4119,15 @@ a span.select2-chosen
|
||||
|
||||
|
||||
/* Special case for the select2 add widget */
|
||||
#addbox .select2-container .select2-choice > .select2-chosen {
|
||||
#addbox .select2-container .select2-choice > .select2-chosen, #actionbookmark .select2-container .select2-choice > .select2-chosen {
|
||||
text-align: left;
|
||||
opacity: 0.2;
|
||||
opacity: 0.3;
|
||||
}
|
||||
/* Style used before the select2 js is executed on boxcombo */
|
||||
#boxcombo.boxcombo {
|
||||
#boxbookmark.boxcombo, #boxcombo.boxcombo {
|
||||
text-align: left;
|
||||
opacity: 0.2;
|
||||
border-bottom: 1px solid #000;
|
||||
opacity: 0.3;
|
||||
border-bottom: solid 1px rgba(0,0,0,.4) !important;
|
||||
height: 26px;
|
||||
line-height: 24px;
|
||||
padding: 0 0 5px 5px;
|
||||
@ -4124,7 +4140,7 @@ a span.select2-chosen
|
||||
margin: 0 0 2px 3px;
|
||||
position: relative;
|
||||
line-height: 13px;
|
||||
color: #333;
|
||||
color: #444;
|
||||
cursor: default;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 3px;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user