Work on CMS module

This commit is contained in:
Laurent Destailleur 2016-01-24 21:35:41 +01:00
parent 8d46a56dac
commit ba833dc412
5 changed files with 119 additions and 16 deletions

View File

@ -16,19 +16,19 @@
*/
/**
* \defgroup website Module website
* \brief Website module descriptor.
* \file htdocs/core/modules/modWebsite.class.php
* \ingroup website
* \brief Description and activation file for module Website
* \defgroup websites Module websites
* \brief Websites module descriptor.
* \file htdocs/core/modules/modWebsites.class.php
* \ingroup websites
* \brief Description and activation file for module Websites
*/
include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
/**
* Class to describe Website module
* Class to describe Websites module
*/
class modWebsite extends DolibarrModules
class modWebsites extends DolibarrModules
{
/**
@ -63,7 +63,7 @@ class modWebsite extends DolibarrModules
// Config pages
//-------------
$this->config_page_url = array('website.php');
$this->config_page_url = array('websites.php');
// Dependancies
//-------------
@ -71,7 +71,7 @@ class modWebsite extends DolibarrModules
$this->depends = array(); // List of modules id that must be enabled if this module is enabled
$this->requiredby = array(); // List of modules id to disable if this one is disabled
$this->conflictwith = array(); // List of modules id this module is in conflict with
$this->langfiles = array("website");
$this->langfiles = array("websites");
// Constants
//-----------
@ -87,7 +87,7 @@ class modWebsite extends DolibarrModules
// Permissions
$this->rights = array(); // Permission array used by this module
$this->rights_class = 'website';
$this->rights_class = 'websites';
$r=0;
$this->rights[$r][0] = 10001;
@ -110,14 +110,15 @@ class modWebsite extends DolibarrModules
// Main menu entries
$r=0;
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=home', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
$this->menu[$r]=array( 'fk_menu'=>'0', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'type'=>'top', // This is a Left menu entry
'titre'=>'Website',
'url'=>'/website/index.php',
'langs'=>'website', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'titre'=>'Websites',
'mainmenu'=>'websites',
'url'=>'/websites/index.php',
'langs'=>'websites', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>100,
'enabled'=>'$conf->website->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
'perms'=>'$user->rights->website->read', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
'enabled'=>'$conf->websites->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
'perms'=>'$user->rights->websites->read', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
'target'=>'',
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
$r++;

View File

@ -0,0 +1,31 @@
<?php
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/externalsite/frametop.php
* \ingroup externalsite
* \brief Top frame to show external web application
*/
require ("../main.inc.php");
$langs->load("externalsite");
top_htmlhead("","");
top_menu("","","_top");

View File

71
htdocs/websites/index.php Normal file
View File

@ -0,0 +1,71 @@
<?php
/* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* \file htdocs/externalsite/frames.php
* \ingroup externalsite
* \brief Page that build two frames: One for menu, the other for the target page to show
* \author Laurent Destailleur
*/
require '../main.inc.php';
$langs->load("externalsite");
if (empty($conf->global->EXTERNALSITE_URL))
{
llxHeader();
print '<div class="error">'.$langs->trans('ExternalSiteModuleNotComplete').'</div>';
llxFooter();
}
$mainmenu=GETPOST('mainmenu', 'alpha');
$leftmenu=GETPOST('leftmenu', 'alpha');
$idmenu=GETPOST('idmenu', 'int');
$theme=GETPOST('theme', 'alpha');
$codelang=GETPOST('lang', 'alpha');
print "
<html>
<head>
<title>Dolibarr frame for external web site</title>
</head>
<frameset ".(empty($conf->global->MAIN_MENU_INVERT)?"rows":"cols")."=\"".($heightforframes+50).",*\" 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>
";