Skip to content

Commit

Permalink
Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into d…
Browse files Browse the repository at this point in the history
…evelop
  • Loading branch information
eldy committed Nov 10, 2017
2 parents ab78007 + 788d22d commit c2d7b88
Show file tree
Hide file tree
Showing 12 changed files with 271 additions and 218 deletions.
4 changes: 4 additions & 0 deletions dev/examples/ldap/ldapsearch_sample1.txt
Expand Up @@ -7,3 +7,7 @@
# ldapsearch -h hostname -x -b "ou=people,dc=teclib,dc=infra"
# ldapsearch -h hostname -x -z 0 -b "o=somecompany.com" -D "cn=manager,o=somecompany.com" -w password "(objectclass=*)"
# ldapsearch -h hostname -x -b "o=somecompany.com" -D "cn=manager,o=somecompany.com" -w password "(objectclass=*)"
#
# Example to test a ldap search:
# ldapsearch -h hostname -x -z 5 -b 'OU=Collaborateurs,OU=Utilisateurs,OU=MyCompany,DC=bocal,DC=lan' -D 'CN=UserAdmin,OU=Informatique,OU=Utilisateurs,OU=MyCompany,DC=bocal,DC=lan' -w password

2 changes: 1 addition & 1 deletion htdocs/admin/defaultvalues.php
Expand Up @@ -276,7 +276,7 @@
{
$texthelp.=$key.' -> '.$val.'<br>';
}
$textvalue=$form->textwithpicto($langs->trans("Value"), $texthelp, 1, 'help', '', 0, 2, ''); // No tooltip on click, this also triggers the sort click
$textvalue=$form->textwithpicto($langs->trans("Value"), $texthelp, 1, 'help', '', 0, 2, 'subsitutiontooltip');
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion htdocs/admin/mails_templates.php
Expand Up @@ -708,7 +708,7 @@
{
if (! empty($tabhelp[$id][$value]))
{
if (in_array($value, array('topic'))) $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2); // Tooltip on hover
if (in_array($value, array('topic'))) $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, 'tooltip'.$value); // Tooltip on hover
else $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2); // Tooltip on hover
}
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "align=".$align, $sortfield, $sortorder);
Expand Down
13 changes: 8 additions & 5 deletions htdocs/bookmarks/bookmarks.lib.php
Expand Up @@ -76,13 +76,16 @@ function printBookmarksList($aDb, $aLangs)
$ret.= '<form id="actionbookmark" name="actionbookmark" method="POST" action="">';
$ret.= '<select name="bookmark" id="boxbookmark" class="flat boxcombo vmenusearchselectcombo" alt="Bookmarks">';
$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_htmltag(DOL_URL_ROOT.'/bookmarks/list.php').'">'.dol_escape_htmltag($user->rights->bookmark->creer ? $langs->trans('EditBookmarks') : $langs->trans('ListOfBookmarks')).'...</option>';
$ret.= '<option value="listbookmark" class="optionblue" rel="'.dol_escape_htmltag(DOL_URL_ROOT.'/bookmarks/list.php').'" ';
$ret.= ' html="'.dol_escape_htmltag('<span class="fa fa-star-o"></span> '.dol_escape_htmltag($user->rights->bookmark->creer ? $langs->trans('EditBookmarks') : $langs->trans('ListOfBookmarks')).'...').'">';
$ret.= 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&amp;urlsource='.urlencode($url).'&amp;url='.urlencode($url);
$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&amp;url='.urlencode($url);
$ret.= '<option value="newbookmark" class="optionblue" rel="'.dol_escape_htmltag($urltoadd).'">'.dol_escape_htmltag($langs->trans('AddThisPageToBookmarks')).'...</option>';
$ret.= '<option value="newbookmark" class="optionblue" rel="'.dol_escape_htmltag($urltoadd).'"';
$ret.= ' html="'.dol_escape_htmltag('<span class="fa fa-star-o"></span> '.$langs->trans('AddThisPageToBookmarks').'...').'">'.dol_escape_htmltag($langs->trans('AddThisPageToBookmarks').'...').'</option>';
}
// Menu with all bookmarks
if (! empty($conf->global->BOOKMARKS_SHOW_IN_MENU))
Expand All @@ -96,9 +99,9 @@ function printBookmarksList($aDb, $aLangs)
$i=0;
while ($i < $conf->global->BOOKMARKS_SHOW_IN_MENU && $obj = $db->fetch_object($resql))
{
$ret.='<option name="bookmark'.$obj->rowid.'" value="'.$obj->rowid.'" '.($obj->target == 1?' target="_blank"':'').' rel="'.dol_escape_htmltag($obj->url).'">';
//$ret.='<span class="fa fa-print">aa</span>';
$ret.=img_picto('','object_bookmark').' ';
$ret.='<option name="bookmark'.$obj->rowid.'" value="'.$obj->rowid.'" '.($obj->target == 1?' target="_blank"':'').' rel="'.dol_escape_htmltag($obj->url).'"';
//$ret.=' html="'.dol_escape_htmltag('<span class="fa fa-print"></span> '.$obj->title).'"';
$ret.='>';
$ret.=dol_escape_htmltag($obj->title);
$ret.='</option>';
$i++;
Expand Down
6 changes: 3 additions & 3 deletions htdocs/bookmarks/list.php
Expand Up @@ -107,9 +107,9 @@

print "<tr class=\"liste_titre\">";
//print "<td>&nbsp;</td>";
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"rowid","", $param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre("Title",$_SERVER["PHP_SELF"],"title","", $param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre("Link",'','');
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"b.rowid","", $param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre("Title",$_SERVER["PHP_SELF"],"b.title","", $param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre("Link",$_SERVER["PHP_SELF"],"b.url","", $param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre("Target",'','','','','align="center"');
print_liste_field_titre("Owner",$_SERVER["PHP_SELF"],"u.lastname","", $param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"b.dateb","", $param,'align="center"',$sortfield,$sortorder);
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/class/html.form.class.php
Expand Up @@ -534,7 +534,7 @@ function textwithpicto($text, $htmltext, $direction = 1, $type = 'help', $extrac
elseif ($type == 'warning') $img = img_warning($alt);
else $img = img_picto($alt, $type);

return $this->textwithtooltip($text, $htmltext, ($tooltiptrigger?3:2), $direction, $img, $extracss, $notabs, '', $noencodehtmltext, $tooltiptrigger);
return $this->textwithtooltip($text, $htmltext, (($tooltiptrigger && ! $img)?3:2), $direction, $img, $extracss, $notabs, '', $noencodehtmltext, $tooltiptrigger);
}

/**
Expand Down
141 changes: 141 additions & 0 deletions htdocs/core/js/lib_foot.js.php
@@ -0,0 +1,141 @@
<?php
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* or see http://www.gnu.org/
*/

/**
* \file htdocs/core/js/lib_foot.js.php
* \brief File that include javascript functions (included if option use_javascript activated)
*/

//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1');
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1);
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1);
if (! defined('NOLOGIN')) define('NOLOGIN',1);
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1);
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');

session_cache_limiter(FALSE);

require_once '../../main.inc.php';

// Define javascript type
top_httphead('text/javascript; charset=UTF-8');
// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access.
if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate');
else header('Cache-Control: no-cache');

//var_dump($conf);

// Wrapper to show tooltips (html or onclick popup)
if (empty($conf->dol_no_mouse_hover))
{
print "\n/* JS CODE TO ENABLE Tooltips on all object with class classfortooltip */\n";
print '
jQuery(document).ready(function () {
jQuery(".classfortooltip").tooltip({
show: { collision: "flipfit", effect:\'toggle\', delay:50 },
hide: { effect:\'toggle\', delay: 50 },
tooltipClass: "mytooltip",
content: function () {
return $(this).prop(\'title\'); /* To force to get title as is */
}
});
jQuery(".classfortooltiponclicktext").dialog({ closeOnEscape: true, classes: { "ui-dialog": "highlight" }, maxHeight: window.innerHeight-60, width: '.($conf->browser->layout == 'phone' ? 400 : 700).', autoOpen: false }).css("z-index: 5000");
jQuery(".classfortooltiponclick").click(function () {
console.log("We click on tooltip for element with dolid="+$(this).attr(\'dolid\'));
if ($(this).attr(\'dolid\'))
{
obj=$("#idfortooltiponclick_"+$(this).attr(\'dolid\')); /* obj is a div component */
obj.dialog("open");
return false;
}
});
});
' . "\n";
}

// Wrapper to manage dropdown
if (! defined('JS_JQUERY_DISABLE_DROPDOWN'))
{
print "\n/* JS CODE TO ENABLE dropdown */\n";
print '
jQuery(document).ready(function () {
$(".dropdown dt a").on(\'click\', function () {
console.log("We click on dropdown");
//console.log($(this).parent().parent().find(\'dd ul\'));
$(this).parent().parent().find(\'dd ul\').slideToggle(\'fast\');
// Note: Did not find a way to get exact height (value is update at exit) so i calculate a generic from nb of lines
heigthofcontent = 21 * $(this).parent().parent().find(\'dd div ul li\').length;
if (heigthofcontent > 300) heigthofcontent = 300; // limited by max-height on css .dropdown dd ul
posbottom = $(this).parent().parent().find(\'dd\').offset().top + heigthofcontent + 8;
var scrollBottom = $(window).scrollTop() + $(window).height();
diffoutsidebottom = (posbottom - scrollBottom);
console.log("heigthofcontent="+heigthofcontent+", diffoutsidebottom (posbottom="+posbottom+" - scrollBottom="+scrollBottom+") = "+diffoutsidebottom);
if (diffoutsidebottom > 0)
{
pix = "-"+(diffoutsidebottom+8)+"px";
console.log("We reposition top by "+pix);
$(this).parent().parent().find(\'dd\').css("top", pix);
}
// $(".dropdown dd ul").slideToggle(\'fast\');
});
$(".dropdowncloseonclick").on(\'click\', function () {
console.log("Link has class dropdowncloseonclick, so we close/hide the popup ul");
$(this).parent().parent().hide();
});
$(document).bind(\'click\', function (e) {
// TODO Use a bind on elements in dropdown only to avoid to bind/code all clicks
var $clicked = $(e.target);
if (!$clicked.parents().hasClass("dropdown")) $(".dropdown dd ul").hide();
});
});
';
}

// Wrapper to manage document_preview
if ($conf->browser->layout != 'phone')
{
print "\n/* JS CODE TO ENABLE document_preview */\n";
print '
jQuery(document).ready(function () {
jQuery(".documentpreview").click(function () {
console.log("We click on preview for element with href="+$(this).attr(\'href\')+" mime="+$(this).attr(\'mime\'));
document_preview($(this).attr(\'href\'), $(this).attr(\'mime\'), \''.dol_escape_js($langs->transnoentities("Preview")).'\');
return false;
});
});
' . "\n";
}

print "\n/* JS CODE TO ENABLE reposition management (does not work if a redirect is done after action of submission) */\n";
print '
jQuery(document).ready(function() {
/* If page_y set, we set scollbar with it */
page_y=getParameterByName(\'page_y\', 0); if (page_y > 0) $(\'html, body\').scrollTop(page_y);
/* Set handler to add page_y param on some a href links */
jQuery(".reposition").click(function() {
var page_y = $(document).scrollTop();
this.href=this.href+\'&page_y=\'+page_y;
console.log("We click on tag with .reposition class. this.ref is now "+this.href)
});
});'."\n";

2 changes: 1 addition & 1 deletion htdocs/core/js/lib_head.js.php
Expand Up @@ -875,7 +875,7 @@ function document_preview(file, type, title)
if ($.inArray(type, ValidImageTypes) < 0) {
var width='85%';
var object_width='100%';
var height = $( window ).height()*0.90;
var height = ($( window ).height() - 60) * 0.90;
var object_height='98%';

show_preview('notimage');
Expand Down

0 comments on commit c2d7b88

Please sign in to comment.