WIP Public virtual card

This commit is contained in:
Laurent Destailleur 2023-01-07 12:36:53 +01:00
parent 93f5c69b1c
commit a89995b63f
7 changed files with 30 additions and 18 deletions

View File

@ -1731,11 +1731,13 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename =
* @param string $url Relative Url to open. For example '/project/card.php'
* @param string $disabled Disabled text
* @param string $morecss More CSS
* @param string $jsonopen Some JS code to execute on click/open of popup
* @param string $backtopagejsfields The back to page must be managed using javascript instead of a redirect.
* Value is 'keyforpopupid:Name_of_html_component_to_set_with id,Name_of_html_component_to_set_with_label'
* @param string $accesskey A key to use shortcut
* @return string HTML component with button
*/
function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $disabled = '', $morecss = 'classlink button bordertransp', $backtopagejsfields = '')
function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $disabled = '', $morecss = 'classlink button bordertransp', $jsonopen = '', $backtopagejsfields = '', $accesskey = '')
{
global $conf;
@ -1763,9 +1765,11 @@ function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $di
//print '<input type="submit" class="button bordertransp"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("MediaFiles")).'" name="file_manager">';
$out .= '<!-- a link for button to open url into a dialog popup with backtopagejsfields = '.$backtopagejsfields.' -->';
$out .= '<a class="cursorpointer button_'.$name.($morecss ? ' '.$morecss : '').'"'.$disabled.' title="'.dol_escape_htmltag($label).'"';
$out .= '<a '.($accesskey ? ' accesskey="'.$accesskey.'"' : '').' class="cursorpointer button_'.$name.($morecss ? ' '.$morecss : '').'"'.$disabled.' title="'.dol_escape_htmltag($label).'"';
if (empty($conf->use_javascript_ajax)) {
$out .= ' href="'.DOL_URL_ROOT.$url.'" target="_blank"';
} elseif ($jsonopen) {
$out .= ' onclick="javascript:'.$jsonopen.'"';
}
$out .= '>'.$buttonstring.'</a>';
@ -2324,7 +2328,7 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
// Add alias for thirdparty
if (!empty($object->name_alias)) {
$morehtmlref .= '<div class="refidno opacitymedium">'.$object->name_alias.'</div>';
$morehtmlref .= '<div class="refidno opacitymedium">'.dol_escape_htmltag($object->name_alias).'</div>';
}
// Add label
@ -2346,7 +2350,7 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && ($conf->global->MAIN_SHOW_TECHNICAL_ID == '1' || preg_match('/'.preg_quote($object->element, '/').'/i', $conf->global->MAIN_SHOW_TECHNICAL_ID)) && !empty($object->id)) {
$morehtmlref .= '<div style="clear: both;"></div>';
$morehtmlref .= '<div class="refidno opacitymedium">';
$morehtmlref .= $langs->trans("TechnicalID").': '.$object->id;
$morehtmlref .= $langs->trans("TechnicalID").': '.((int) $object->id);
$morehtmlref .= '</div>';
}

View File

@ -226,6 +226,7 @@ NoUserGroupDefined=No user group defined
Password=Password
PasswordRetype=Repeat your password
NoteSomeFeaturesAreDisabled=Note that a lot of features/modules are disabled in this demonstration.
YourUserFile=Your user file
Name=Name
NameSlashCompany=Name / Company
Person=Person
@ -1213,4 +1214,4 @@ InternalUser=Internal user
ExternalUser=External user
NoSpecificContactAddress=No specific contact or address
NoSpecificContactAddressBis=This tab is dedicated to force specific contacts or addresses for the current object. Use it only if you want to define one or several specific contacts or addresses for the object when the information on the thirdparty is not enough or not accurate.
AddToContacts=Add address to my contacts

View File

@ -2280,12 +2280,14 @@ function top_menu_user($hideloginname = 0, $urllogout = '')
if (empty($urllogout)) {
$urllogout = DOL_URL_ROOT.'/user/logout.php?token='.newToken();
}
$logoutLink = '<a accesskey="l" href="'.$urllogout.'" class="button-top-menu-dropdown" ><i class="fa fa-sign-out-alt"></i> '.$langs->trans("Logout").'</a>';
$profilLink = '<a accesskey="l" href="'.DOL_URL_ROOT.'/user/card.php?id='.$user->id.'" class="button-top-menu-dropdown" ><i class="fa fa-user"></i> '.$langs->trans("Card").'</a>';
// Defined the links for bottom of card
$profilLink = '<a accesskey="c" href="'.DOL_URL_ROOT.'/user/card.php?id='.$user->id.'" class="button-top-menu-dropdown" title="'.dol_escape_htmltag($langs->trans("YourUserFile")).'"><i class="fa fa-user"></i> '.$langs->trans("Card").'</a>';
$urltovirtualcard = '/user/virtualcard.php?id='.((int) $user->id);
$virtuelcardLink = dolButtonToOpenUrlInDialogPopup('publicvirtualcardmenu', $langs->trans("PublicVirtualCardUrl"), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', ''), $urltovirtualcard, '', 'button-top-menu-dropdown marginleftonly nohover', "closeTopMenuLoginDropdown()", '', 'v');
$logoutLink = '<a accesskey="l" href="'.$urllogout.'" class="button-top-menu-dropdown" title="'.dol_escape_htmltag($langs->trans("Logout")).'"><i class="fa fa-sign-out-alt"></i> '.$langs->trans("Logout").'</a>';
$profilName = $user->getFullName($langs).' ('.$user->login.')';
if (!empty($user->admin)) {
$profilName = '<i class="far fa-star classfortooltip" title="'.$langs->trans("Administrator").'" ></i> '.$profilName;
}
@ -2341,6 +2343,9 @@ function top_menu_user($hideloginname = 0, $urllogout = '')
<div class="pull-left">
'.$profilLink.'
</div>
<div class="pull-left">
'.$virtuelcardLink.'
</div>
<div class="pull-right">
'.$logoutLink.'
</div>
@ -2363,12 +2368,15 @@ function top_menu_user($hideloginname = 0, $urllogout = '')
$btnUser .= '
<!-- Code to show/hide the user drop-down -->
<script>
function closeTopMenuLoginDropdown() {
//console.log("close login dropdown"); // This is call at each click on page, so we disable the log
// Hide the menus.
jQuery("#topmenu-login-dropdown").removeClass("open");
}
jQuery(document).ready(function() {
jQuery(document).on("click", function(event) {
if (!$(event.target).closest("#topmenu-login-dropdown").length) {
//console.log("close login dropdown");
// Hide the menus.
jQuery("#topmenu-login-dropdown").removeClass("open");
closeTopMenuLoginDropdown();
}
});
';

View File

@ -699,7 +699,7 @@ if ($action == 'create' && $user->rights->projet->creer) {
// TODO @LDR Implement this
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) {
$tmpbacktopagejsfields = 'addthirdparty:socid,search_socid';
print dolButtonToOpenUrlInDialogPopup('addthirdparty', $langs->transnoentitiesnoconv('AddThirdParty'), $newbutton, $url, '', '', $tmpbacktopagejsfields);
print dolButtonToOpenUrlInDialogPopup('addthirdparty', $langs->transnoentitiesnoconv('AddThirdParty'), $newbutton, $url, '', '', '', $tmpbacktopagejsfields);
} else {
print ' <a href="'.DOL_URL_ROOT.$url.'">'.$newbutton.'</a>';
}

View File

@ -257,7 +257,7 @@ if ($showbarcode) {
}
print '<div class="opacitymedium">'.$langs->trans("Me").'</div>'."\n";
//print '<div class="opacitymedium">'.$langs->trans("Me").'</div>'."\n";
print '<table id="dolpaymenttable" summary="Job position offer" class="center">'."\n";
// Output payment summary form
@ -368,8 +368,8 @@ print '<br>';
print '<div class="backgreypublicpayment">';
print '<div class="center">';
print '<a href="'.$urlforqrcode.'">';
print img_picto($langs->trans("AddTocontacts"), 'add').' ';
print $langs->trans("AddTocontacts");
print img_picto($langs->trans("AddToContacts"), 'add').' ';
print $langs->trans("AddToContacts");
print '</a>';
print '</div>';
//print '<div>';

View File

@ -1433,12 +1433,10 @@ if ($action == 'create' || $action == 'adduserldap') {
print dol_get_fiche_head($head, 'user', $title, -1, 'user');
$morehtmlref = '<a href="'.DOL_URL_ROOT.'/user/vcard.php?id='.$object->id.'" class="refid" rel="noopener">';
$morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
$morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard").' ('.$langs->trans("AddToContacts").')', 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
$morehtmlref .= '</a>';
//$urltovirtualcard = $object->getOnlineVirtualCardUrl();
$urltovirtualcard = '/user/virtualcard.php?id='.((int) $object->id);
$morehtmlref .= dolButtonToOpenUrlInDialogPopup('publicvirtualcard', $langs->trans("PublicVirtualCardUrl"), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', 'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard, '', 'nohover');
/*$morehtmlref .= '<a href="'.$urltovirtualcard.'" class="refid" target="_blank" rel="noopener">';
$morehtmlref .= img_picto($langs->trans("PublicVirtualCardUrl"), 'id-card', 'class="valignmiddle marginleftonly paddingrightonly"');

View File

@ -133,6 +133,7 @@ print '<br>';
print '<span class="opacitymedium">'.$langs->trans("UserPublicPageDesc").'</span><br><br>';
$param = '&id='.((int) $object->id);
$param .= '&dol_openinpopup=1';
$enabledisablehtml = $langs->trans("EnablePublicVirtualCard").' ';
if (!getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) {