New qrcode.js version & vcard

This commit is contained in:
Pablo Aragon 2023-03-29 15:34:03 +02:00
parent 1a82056039
commit 2b121a2fd2
6 changed files with 2847 additions and 614 deletions

View File

@ -736,22 +736,18 @@ $userManagementTable->data['fields_addSettings'][1] .= html_print_div(
true
);
$contentQrCode = [];
$contentQrCode[] = html_print_image(
'images/example_qr.png',
true,
[
'width' => '200px',
'height' => '200px',
]
$CodeQRContent .= html_print_div(['id' => 'qr_container_image', 'class' => 'scale-0-8'], true);
$CodeQRContent .= html_print_anchor(
['id' => 'qr_code_agent_view'],
true
);
$contentQrCode[] = '<span class="input_sub_placeholder input_sub_placeholder_qrcode">'.__('Generated automatically with the information provided for the user').'</span>';
$CodeQRContent .= '<br/>'.$custom_id_div;
$qrCode = html_print_div(
// QR code div.
$CodeQRTable = html_print_div(
[
'style' => 'display: flex;flex-direction: column;align-items: center;',
'content' => implode('', $contentQrCode),
'class' => 'agent_qr',
'content' => $CodeQRContent,
],
true
);
@ -760,8 +756,33 @@ $qrCode = html_print_div(
html_print_div(
[
'id' => 'api_qrcode_display',
'content' => $qrCode.$apiTokenContent,
'content' => $CodeQRTable.$apiTokenContent,
]
);
html_print_table($userManagementTable);
$vcard_data = [];
$vcard_data['version'] = '3.0';
$vcard_data['firstName'] = $user_info['firstname'];
$vcard_data['lastName'] = $user_info['lastname'];
$vcard_data['middleName'] = ($user_info['middlename'] === '1') ? '' : $user_info['middlename'];
$vcard_data['nickname'] = $user_info['fullname'];
$vcard_data['workPhone'] = $user_info['phone'];
$vcard_data['email'] = $user_info['email'];
$vcard_data['organization'] = io_safe_output(get_product_name());
$vcard_data['url'] = ui_get_full_url('index.php');
$vcard_json = json_encode($vcard_data);
?>
<script type="text/javascript">
$(document).ready(function () {
paint_vcard(
<?php echo $vcard_json; ?>,
"#qr_code_agent_view",
128,
128
);
});
</script>

View File

@ -1283,14 +1283,95 @@ function paint_qrcode(text, where, width, height) {
$(where).empty();
var qrcode = new QRCode(where, {
text: text,
width: width,
height: height,
colorDark: "#343434",
colorLight: "#ffffff",
correctLevel: QRCode.CorrectLevel.M
var qrcode = qrCode.createQr({
typeElement: "createImg",
data: text,
typeNumber: 5,
cellSize: 5
});
$(where).append(qrcode);
}
function paint_vcard(text, where) {
if (typeof text == "undefined") {
text = window.location.href;
} else {
//null value
if (isEmptyObject(text)) {
text = window.location.href;
}
}
if (typeof where == "undefined") {
where = $("#qrcode_container_image").get(0);
} else if (typeof where == "string") {
where = $(where).get(0);
}
if (typeof where == "undefined") {
where = $("#qrcode_container_image").get(0);
} else if (typeof where == "string") {
where = $(where).get(0);
}
// version: "3.0",
// lastName: "Нижинский",
// middleName: "D",
// firstName: "Костя",
// nameSuffix: "JR",
// namePrefix: "MR",
// nickname: "Test User",
// gender: "M",
// organization: "ACME Corporation",
// workPhone: "312-555-1212444",
// homePhone: "312-555-1313333",
// cellPhone: "312-555-1414111",
// pagerPhone: "312-555-1515222",
// homeFax: "312-555-1616",
// workFax: "312-555-1717",
// birthday: "20140112",
// anniversary: "20140112",
// title: "Crash Test Dummy",
// role: "Crash Testing",
// email: "john.doe@testmail",
// workEmail: "john.doe@workmail",
// url: "http://johndoe",
// workUrl: "http://acemecompany/johndoe",
// homeAddress: {
// label: "Home Address",
// street: "123 Main Street",
// city: "Chicago",
// stateProvince: "IL",
// postalCode: "12345",
// countryRegion: "United States of America"
// },
// workAddress: {
// label: "Work Address",
// street: "123 Corporate Loop\nSuite 500",
// city: "Los Angeles",
// stateProvince: "CA",
// postalCode: "54321",
// countryRegion: "California Republic"
// },
// source: "http://sourceurl",
// note: "dddddd",
// socialUrls: {
// facebook: "johndoe",
// linkedIn: "johndoe",
// twitter: "johndoe",
// flickr: "johndoe",
// skype: "test_skype",
// custom: "johndoe"
// }
$(where).empty();
var qrcode = qrCode.createVCardQr(text, { typeNumber: 30, cellSize: 2 });
$(where).append(qrcode);
}
function show_dialog_qrcode(dialog, text, where, width, height) {

3305
pandora_console/include/javascript/qrcode.js Executable file → Normal file

File diff suppressed because it is too large Load Diff

View File

@ -6888,6 +6888,10 @@ div.graph div.legend table {
margin-left: 15px;
}
.mrgn_lft_17px {
margin-left: 17px;
}
.mrgn_lft_20px {
margin-left: 20px;
}
@ -11821,3 +11825,7 @@ span.help_icon_15px > img {
transform: rotate(360deg);
}
}
.scale-0-8 {
transform: scale(0.8);
}

View File

@ -326,6 +326,7 @@ if (is_metaconsole() === true) {
1,
2,
3,
-3,
-1,
];
} else {
@ -333,6 +334,7 @@ if (is_metaconsole() === true) {
0,
1,
2,
-3,
-1,
];
}

View File

@ -820,7 +820,7 @@ if (is_ajax() === true) {
break;
}
$draw_state = '<div class="center">';
$draw_state = '<div class="mrgn_lft_17px">';
$draw_state .= '<span class="invisible">';
$draw_state .= $state;
$draw_state .= '</span>';