NEW Externalsite module can accept iframe content.
This commit is contained in:
parent
26ee7ec5be
commit
0f51963600
@ -26,6 +26,8 @@
|
|||||||
* \brief Page de configuration du module externalsite
|
* \brief Page de configuration du module externalsite
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION','1'); // Do not check anti CSRF attack test
|
||||||
|
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||||
|
|
||||||
@ -50,7 +52,7 @@ if ($action == 'update')
|
|||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$label = GETPOST('EXTERNALSITE_LABEL','alpha');
|
$label = GETPOST('EXTERNALSITE_LABEL','alpha');
|
||||||
$exturl = GETPOST('EXTERNALSITE_URL','alpha');
|
$exturl = GETPOST('EXTERNALSITE_URL','none');
|
||||||
|
|
||||||
$i+=dolibarr_set_const($db,'EXTERNALSITE_LABEL',trim($label),'chaine',0,'',$conf->entity);
|
$i+=dolibarr_set_const($db,'EXTERNALSITE_LABEL',trim($label),'chaine',0,'',$conf->entity);
|
||||||
$i+=dolibarr_set_const($db,'EXTERNALSITE_URL',trim($exturl),'chaine',0,'',$conf->entity);
|
$i+=dolibarr_set_const($db,'EXTERNALSITE_URL',trim($exturl),'chaine',0,'',$conf->entity);
|
||||||
@ -104,9 +106,12 @@ print "</tr>";
|
|||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td class="fieldrequired">'.$langs->trans("ExternalSiteURL")."</td>";
|
print '<td class="fieldrequired">'.$langs->trans("ExternalSiteURL")."</td>";
|
||||||
print "<td><input type=\"text\" class=\"flat\" name=\"EXTERNALSITE_URL\" value=\"". (GETPOST('EXTERNALSITE_URL','alpha')?GETPOST('EXTERNALSITE_URL','alpha'):(empty($conf->global->EXTERNALSITE_URL)?'':$conf->global->EXTERNALSITE_URL)) . "\" size=\"40\"></td>";
|
print '<td><textarea class="flat minwidth500" name="EXTERNALSITE_URL">';
|
||||||
|
print (GETPOST('EXTERNALSITE_URL','none')?GETPOST('EXTERNALSITE_URL','none'):(empty($conf->global->EXTERNALSITE_URL)?'':$conf->global->EXTERNALSITE_URL));
|
||||||
|
print '</textarea></td>';
|
||||||
print "<td>http://localhost/myurl/";
|
print "<td>http://localhost/myurl/";
|
||||||
print "<br>http://wikipedia.org/";
|
print "<br>https://wikipedia.org/";
|
||||||
|
print "<br><iframe>...</iframe>";
|
||||||
print "</td>";
|
print "</td>";
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -17,55 +17,104 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/externalsite/frames.php
|
* \file htdocs/externalsite/frames.php
|
||||||
* \ingroup externalsite
|
* \ingroup externalsite
|
||||||
* \brief Page that build two frames: One for menu, the other for the target page to show
|
* \brief Page that build two frames: One for menu, the other for the target page to show
|
||||||
* \author Laurent Destailleur
|
* 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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require '../main.inc.php';
|
require '../main.inc.php';
|
||||||
|
|
||||||
$langs->load("externalsite");
|
$langs->load("externalsite");
|
||||||
|
|
||||||
if (empty($conf->global->EXTERNALSITE_URL))
|
|
||||||
{
|
|
||||||
llxHeader();
|
|
||||||
print '<div class="error">'.$langs->trans('ExternalSiteModuleNotComplete').'</div>';
|
|
||||||
llxFooter();
|
|
||||||
}
|
|
||||||
|
|
||||||
$mainmenu=GETPOST('mainmenu', "aZ09");
|
$mainmenu=GETPOST('mainmenu', "aZ09");
|
||||||
$leftmenu=GETPOST('leftmenu', "aZ09");
|
$leftmenu=GETPOST('leftmenu', "aZ09");
|
||||||
$idmenu=GETPOST('idmenu', 'int');
|
$idmenu=GETPOST('idmenu', 'int');
|
||||||
$theme=GETPOST('theme', 'alpha');
|
$theme=GETPOST('theme', 'alpha');
|
||||||
$codelang=GETPOST('lang', 'aZ09');
|
$codelang=GETPOST('lang', 'aZ09');
|
||||||
|
$keyforcontent = GETPOST('keyforcontent', 'aZ09');
|
||||||
print "
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Dolibarr frame for external web site</title>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<frameset ".(empty($conf->global->MAIN_MENU_INVERT)?"rows":"cols")."=\"".$heightforframes.",*\" border=0 framespacing=0 frameborder=0>
|
|
||||||
<frame name=\"barre\" src=\"frametop.php?mainmenu=".$mainmenu."&leftmenu=".$leftmenu."&idmenu=".$idmenu.($theme?'&theme='.$theme:'').($codelang?'&lang='.$codelang:'')."&nobackground=1\" noresize scrolling=\"NO\" noborder>
|
|
||||||
<frame name=\"main\" src=\"".$conf->global->EXTERNALSITE_URL."\">
|
|
||||||
<noframes>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</noframes>
|
|
||||||
</frameset>
|
|
||||||
|
|
||||||
<noframes>
|
|
||||||
<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>
|
|
||||||
</noframes>
|
|
||||||
|
|
||||||
</html>
|
|
||||||
";
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (empty($keyforcontent) && empty($conf->global->EXTERNALSITE_URL))
|
||||||
|
{
|
||||||
|
llxHeader();
|
||||||
|
print '<div class="error">'.$langs->trans('ExternalSiteModuleNotComplete').'</div>';
|
||||||
|
llxFooter();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($keyforcontent))
|
||||||
|
{
|
||||||
|
llxHeader();
|
||||||
|
|
||||||
|
print '<div class="framecontent" style="height: '.($_SESSION['dol_screenheight']-90).'px">';
|
||||||
|
|
||||||
|
if (! preg_match('/EXTERNAL_SITE_CONTENT_/', $keyforcontent))
|
||||||
|
{
|
||||||
|
$langs->load("errors");
|
||||||
|
print $langs->trans("Variablekeyforcontentmustbenamed", 'EXTERNAL_SITE_CONTENT_');
|
||||||
|
}
|
||||||
|
else if (empty($conf->global->$keyforcontent))
|
||||||
|
{
|
||||||
|
$langs->load("errors");
|
||||||
|
print $langs->trans("ErrorNoContentDefinedIntoVar", $keyforcontent);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $conf->global->$keyforcontent;
|
||||||
|
}
|
||||||
|
|
||||||
|
print '<div>';
|
||||||
|
llxFooter();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (preg_match('/^\//', $conf->global->EXTERNALSITE_URL) || preg_match('/^http/i', $conf->global->EXTERNALSITE_URL))
|
||||||
|
{
|
||||||
|
print "
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Dolibarr frame for external web site</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<frameset ".(empty($conf->global->MAIN_MENU_INVERT)?"rows":"cols")."=\"".$heightforframes.",*\" border=0 framespacing=0 frameborder=0>
|
||||||
|
<frame name=\"barre\" src=\"frametop.php?mainmenu=".$mainmenu."&leftmenu=".$leftmenu."&idmenu=".$idmenu.($theme?'&theme='.$theme:'').($codelang?'&lang='.$codelang:'')."&nobackground=1\" noresize scrolling=\"NO\" noborder>
|
||||||
|
";
|
||||||
|
print '<frame name="main" src="';
|
||||||
|
print $conf->global->EXTERNALSITE_URL;
|
||||||
|
print '">';
|
||||||
|
print "
|
||||||
|
<noframes>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</noframes>
|
||||||
|
</frameset>
|
||||||
|
|
||||||
|
<noframes>
|
||||||
|
<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>
|
||||||
|
</noframes>
|
||||||
|
|
||||||
|
</html>
|
||||||
|
";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
llxHeader();
|
||||||
|
print '<div class="framecontent" style="height: '.($_SESSION['dol_screenheight']-90).'px">';
|
||||||
|
print $conf->global->EXTERNALSITE_URL;
|
||||||
|
print '<div>';
|
||||||
|
llxFooter();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -3206,6 +3206,20 @@ a.impayee:active { font-weight: bold; color: #550000; }
|
|||||||
a.impayee:hover { font-weight: bold; color: #550000; }
|
a.impayee:hover { font-weight: bold; color: #550000; }
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* External web site
|
||||||
|
*/
|
||||||
|
|
||||||
|
.framecontent {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.framecontent iframe {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Other
|
* Other
|
||||||
|
|||||||
@ -3265,6 +3265,16 @@ a.impayee:hover { font-weight: bold; color: #550000; }
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* External web site
|
||||||
|
*/
|
||||||
|
|
||||||
|
.framecontent iframe {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Other
|
* Other
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user