Clean code

This commit is contained in:
Laurent Destailleur 2025-10-27 22:18:20 +01:00
parent 342120f893
commit df5c3a8084
2 changed files with 17 additions and 6 deletions

View file

@ -102,12 +102,12 @@ print '<tr class="oddeven"><td>'.$langs->trans("CurrentVersion").'<br><span clas
// If current version differs from last upgrade
if (!getDolGlobalString('MAIN_VERSION_LAST_UPGRADE')) {
// Compare version with last install database version (upgrades never occurred)
if (DOL_VERSION != $conf->global->MAIN_VERSION_LAST_INSTALL) {
if (DOL_VERSION != getDolGlobalString('MAIN_VERSION_LAST_INSTALL')) {
print ' '.img_warning($langs->trans("RunningUpdateProcessMayBeRequired", DOL_VERSION, getDolGlobalString('MAIN_VERSION_LAST_INSTALL')));
}
} else {
// Compare version with last upgrade database version
if (DOL_VERSION != $conf->global->MAIN_VERSION_LAST_UPGRADE) {
if (DOL_VERSION != getDolGlobalString('MAIN_VERSION_LAST_UPGRADE')) {
print ' '.img_warning($langs->trans("RunningUpdateProcessMayBeRequired", DOL_VERSION, getDolGlobalString('MAIN_VERSION_LAST_UPGRADE')));
}
}
@ -116,7 +116,12 @@ $version = DOL_VERSION;
if (preg_match('/[a-z]+/i', $version)) {
$version = 'develop'; // If version contains text, it is not an official tagged version, so we use the full change log.
}
print ' &nbsp; <a href="https://raw.githubusercontent.com/Dolibarr/dolibarr/'.$version.'/ChangeLog" target="_blank" rel="noopener noreferrer external">'.$langs->trans("SeeChangeLog").'</a>';
$urlofchangelog = 'https://raw.githubusercontent.com/Dolibarr/dolibarr/'.$version.'/ChangeLog';
print ' &nbsp; ';
//print dolButtonToOpenUrlInDialogPopup('changelogpopup', $langs->trans("SeeChangeLog"), $langs->trans("SeeChangeLog"), $urlofchangelog);
print '<a href="'.$urlofchangelog.'" target="_blank" rel="noopener noreferrer external">'.$langs->trans("SeeChangeLog").'</a>';
$newversion = '';
if (function_exists('curl_init')) {

View file

@ -2887,13 +2887,19 @@ function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $di
$url .= '?dol_hide_topmenu=1&dol_hide_leftmenu=1&dol_openinpopup=' . urlencode($name);
}
if (preg_match('/^https/i', $url)) {
$urltoopen = $url;
} else {
$urltoopen = DOL_URL_ROOT . $url;
}
$out = '';
//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 -->';
$out .= '<a ' . ($accesskey ? ' accesskey="' . $accesskey . '"' : '') . ' class="cursorpointer reposition button_' . $name . ($morecss ? ' ' . $morecss : '') . '"' . $disabled . ' title="' . dol_escape_htmltag($label) . '"';
if (empty($conf->use_javascript_ajax)) {
$out .= ' href="' . DOL_URL_ROOT . $url . '" target="_blank"';
$out .= ' href="' . $urltoopen . '" target="_blank"';
} elseif ($jsonopen) {
$out .= ' href="#" onclick="' . $jsonopen . '"';
} else {
@ -2910,9 +2916,9 @@ function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $di
$out .= '<script nonce="' . getNonce() . '" type="text/javascript">
jQuery(document).ready(function () {
jQuery(".button_' . $name . '").click(function () {
console.log(\'Open popup with jQuery(...).dialog() on URL ' . dol_escape_js(DOL_URL_ROOT . $url) . '\');
console.log(\'Open popup with jQuery(...).dialog() on URL ' . dol_escape_js($urltoopen) . '\');
var $tmpdialog = $(\'#idfordialog' . $name . '\');
$tmpdialog.html(\'<iframe class="iframedialog" id="iframedialog' . $name . '" style="border: 0px;" src="' . DOL_URL_ROOT . $url . '" width="100%" height="98%"></iframe>\');
$tmpdialog.html(\'<iframe class="iframedialog" id="iframedialog' . $name . '" style="border: 0px;" src="' . $urltoopen . '" width="100%" height="98%"></iframe>\');
$tmpdialog.dialog({
autoOpen: false,
modal: true,