From 6105bb2bb62d0129fd4975cfa84ac03ea36812d4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 10 Dec 2018 18:10:57 +0100 Subject: [PATCH] Fix: difference between text and url into external web site module --- htdocs/externalsite/frames.php | 47 +++++++++++++++++++++++++++++++--- htdocs/langs/en_US/errors.lang | 1 + 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/htdocs/externalsite/frames.php b/htdocs/externalsite/frames.php index 611e84fe9c3..714b7b3e037 100644 --- a/htdocs/externalsite/frames.php +++ b/htdocs/externalsite/frames.php @@ -22,7 +22,8 @@ * \brief Page that build two frames: One for menu, the other for the target page to show * Usage: * mydomain.com/externalsite/frames.php to show URL set into setup - * mydomain.com/externalsite/frames.php?keyforcontent to show content defined into conf->global->$keyforcontent + * mydomain.com/externalsite/frames.php?keyforcontent=EXTERNAL_SITE_CONTENT_abc to show html text defined into $conf->global->EXTERNAL_SITE_CONTENT_abc + * mydomain.com/externalsite/frames.php?keyforcontent=EXTERNAL_SITE_URL_abc to show URL defined into $conf->global->EXTERNAL_SITE_URL_abc */ require '../main.inc.php'; @@ -56,10 +57,11 @@ if (! empty($keyforcontent)) print '
'; - if (! preg_match('/EXTERNAL_SITE_CONTENT_/', $keyforcontent)) + if (! preg_match('/EXTERNAL_SITE_CONTENT_/', $keyforcontent) + && ! preg_match('/EXTERNAL_SITE_URL_/', $keyforcontent)) { $langs->load("errors"); - print $langs->trans("Variablekeyforcontentmustbenamed", 'EXTERNAL_SITE_CONTENT_'); + print $langs->trans("ErrorVariableKeyForContentMustBeSet", 'EXTERNAL_SITE_CONTENT_'.$keyforcontent, 'EXTERNAL_SITE_URL_'.$keyforcontent); } else if (empty($conf->global->$keyforcontent)) { @@ -68,7 +70,44 @@ if (! empty($keyforcontent)) } else { - print $conf->global->$keyforcontent; + if (preg_match('/EXTERNAL_SITE_CONTENT_/', $keyforcontent)) + { + print $conf->global->$keyforcontent; + } + elseif (preg_match('/EXTERNAL_SITE_URL_/', $keyforcontent)) + { + print " + + + Dolibarr frame for external web site + + + global->MAIN_MENU_INVERT)?"rows":"cols")."=\"".$heightforframes.",*\" border=0 framespacing=0 frameborder=0> + + "; + print ''; + print " + + <body> + + </body> + + + + + <body> + <br><div class=\"center\"> + Sorry, your browser is too old or not correctly configured to view this area.<br> + Your browser must support frames.<br> + </div> + </body> + + + + "; + } } print '
'; diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 4bb9fcf2dec..79da7ef45f8 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -213,6 +213,7 @@ ErrorNoteAlsoThatSubProductCantBeFollowedByLot=Note also that using virtual prod ErrorDescRequiredForFreeProductLines=Description is mandatory for lines with free product ErrorAPageWithThisNameOrAliasAlreadyExists=The page/container %s has the same name or alternative alias that the one your try to use ErrorDuringChartLoad=Error when loading chart of account. If few accounts were not loaded, you can still enter them manually. +ErrorVariableKeyForContentMustBeSet=Error, the constant with name %s (with text content to show) or %s (with external url to show) must be set. # Warnings WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user. WarningMandatorySetupNotComplete=Mandatory setup parameters are not yet defined