From 9df4bac2028e6f5d90b41ddae74da13dbd6f7b12 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Apr 2017 11:56:19 +0200 Subject: [PATCH] NEW Bookmarks are into a combo list. --- htdocs/bookmarks/bookmarks.lib.php | 42 ++++++++++++++++++++--- htdocs/bookmarks/card.php | 10 ++++-- htdocs/bookmarks/list.php | 4 +-- htdocs/core/class/html.form.class.php | 2 +- htdocs/core/lib/ajax.lib.php | 3 +- htdocs/core/menus/standard/eldy.lib.php | 20 +++++------ htdocs/langs/en_US/bookmarks.lang | 4 ++- htdocs/theme/eldy/style.css.php | 44 ++++++++++++++++--------- htdocs/theme/md/style.css.php | 36 ++++++++++++++------ 9 files changed, 116 insertions(+), 49 deletions(-) diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php index 3cee534e797..d84713d1e62 100644 --- a/htdocs/bookmarks/bookmarks.lib.php +++ b/htdocs/bookmarks/bookmarks.lib.php @@ -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.= ''; - + */ $ret.= ''."\n"; + $ret.= '
'; + $ret.= ''; + $ret.= '
'; + + $ret.=ajax_combobox('boxbookmark'); + + $ret.=''; $ret .= ''; return $ret; diff --git a/htdocs/bookmarks/card.php b/htdocs/bookmarks/card.php index cf5a52cf9c6..a9d4a39ef85 100644 --- a/htdocs/bookmarks/card.php +++ b/htdocs/bookmarks/card.php @@ -157,15 +157,19 @@ if ($action == 'create') print ''; - print ''; - - print ''; + print ''; + dol_set_focus('#titlebookmark'); + + // Url + print ''; + // Target print ''; + // Owner print ''; diff --git a/htdocs/bookmarks/list.php b/htdocs/bookmarks/list.php index d72fb19a6e5..b0cda58951c 100644 --- a/htdocs/bookmarks/list.php +++ b/htdocs/bookmarks/list.php @@ -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"; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 2771161572f..f58bd0953ab 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -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) diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index a1041e9358b..942c17f5df9 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -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; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 7207f8f2189..f78a38d20b0 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -494,6 +494,16 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu print "\n"; } + if (is_array($moredata) && ! empty($moredata['bookmarks'])) + { + print "\n"; + print "\n"; + print '
'."\n"; + print $moredata['bookmarks']; + print '
'."\n"; + print "\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 '
'; } - if (is_array($moredata) && ! empty($moredata['bookmarks'])) - { - print "\n"; - print "\n"; - print '
'."\n"; - print $moredata['bookmarks']; - print '
'."\n"; - print "\n"; - } - return count($menu_array); } diff --git a/htdocs/langs/en_US/bookmarks.lang b/htdocs/langs/en_US/bookmarks.lang index e529130e1bc..0b6216c6be4 100644 --- a/htdocs/langs/en_US/bookmarks.lang +++ b/htdocs/langs/en_US/bookmarks.lang @@ -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 diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index dac7cf43f5e..a797d6f760b 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -349,6 +349,12 @@ span.timesheetalreadyrecorded input { select.flat, form.flat select { font-weight: normal; } +.optionblue { + color: rgb() !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; display: none; } +/* 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; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index f4b38d08012..6e85ca8eb7d 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -346,6 +346,12 @@ span.timesheetalreadyrecorded input { select.flat, form.flat select { font-weight: normal; } +.optionblue { + color: rgb() !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:px; font-family: ; text-align: ; font-weight: normal; color: #666666; text-decoration: none; } -div.blockvmenupair, div.blockvmenuimpair, div.blockvmenubookmarks +div.blockvmenupair, div.blockvmenuimpair { font-family: ; 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: ; 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;
'.$langs->trans("BookmarkTitle").''.$langs->trans("SetHereATitleForLink").'
'.$langs->trans("UrlOrLink").''.$langs->trans("UseAnExternalHttpLinkOrRelativeDolibarrLink").'
'.$langs->trans("BookmarkTitle").''.$langs->trans("SetHereATitleForLink").'
'.$langs->trans("UrlOrLink").''.$langs->trans("UseAnExternalHttpLinkOrRelativeDolibarrLink").'
'.$langs->trans("BehaviourOnClick").''; $liste=array(0=>$langs->trans("ReplaceWindow"),1=>$langs->trans("OpenANewWindow")); print $form->selectarray('target',$liste,1); print ''.$langs->trans("ChooseIfANewWindowMustBeOpenedOnClickOnBookmark").'
'.$langs->trans("Owner").''; print $form->select_dolusers(isset($_POST['userid'])?$_POST['userid']:$user->id, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); print '