Move dev module mantis to nltechno repository

This commit is contained in:
Laurent Destailleur 2011-09-24 23:49:45 +00:00
parent 9e09b16219
commit 78ac6060f5
6 changed files with 0 additions and 514 deletions

View File

@ -1,132 +0,0 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2007 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 2 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/>.
*/
/**
* \defgroup mantis Module mantis
* \brief Module to include Mantis into Dolibarr
* \file htdocs/includes/modules/modMantis.class.php
* \ingroup mantis
* \brief Description and activation file for module Mantis
*/
include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php");
/**
* \class modMantis
* \brief Description and activation class for module Mantis
*/
class modMantis extends DolibarrModules
{
/**
* \brief Constructor. Define names, constants, directories, boxes, permissions
* \param DB Database handler
*/
function modMantis($DB)
{
$this->db = $DB;
// Id for module (must be unique).
// Use here a free id.
$this->numero = 50300;
// Family can be 'crm','financial','hr','projects','product','technic','other'
// It is used to sort modules in module setup page
$this->family = "projects";
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i','',get_class($this));
// Module description used translation string 'ModuleXXXDesc' not found (XXX is id value)
$this->description = "Interfacage avec le bug tracking Mantis";
// Possible values for version are: 'experimental' or 'dolibarr' or version
$this->version = 'development';
// Id used in llx_const table to manage module status (enabled/disabled)
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
// Where to store the module in setup page (0=common,1=interface,2=other)
$this->special = 1;
// Name of png file (without png) used for this module
$this->picto='calendar';
// Data directories to create when module is enabled
$this->dirs = array();
// Config pages
$this->config_page_url = array("mantis.php@mantis");
// Dependencies
$this->depends = array(); // List of modules id that must be enabled
$this->requiredby = array(); // List of modules id to disable if this one is disabled
// Constants
$this->const = array(); // List of parameters
// Boxes
$this->boxes = array(); // List of boxes
// Permissions
$this->rights_class = 'mantis'; // Permission key
$this->rights = array(); // Permission array used by this module
// Menus
//------
$r=0;
$this->menu[$r]=array('fk_menu'=>0,
'type'=>'top',
'titre'=>'BugTracker',
'mainmenu'=>'mantis',
'leftmenu'=>'1',
'url'=>'/mantis/mantis.php',
'langs'=>'other',
'position'=>100,
'enabled'=>'$conf->mantis->enabled',
'perms'=>'',
'target'=>'',
'user'=>0);
$r++;
}
/**
* \brief Function called when module is enabled.
* Add constants, boxes and permissions into Dolibarr database.
* It also creates data directories.
*/
function init()
{
$sql = array();
return $this->_init($sql);
}
/**
* \brief Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted.
*/
function remove()
{
$sql = array();
return $this->_remove($sql);
}
}
?>

View File

@ -1,206 +0,0 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 <EFBFBD>ric Seigne <erics@rycks.com>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
*
* 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 2 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/mantis/admin/mantis.php
* \ingroup mantis
* \brief Page de configuration du module mantis
*/
require("../../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
require_once(DOL_DOCUMENT_ROOT.'/mantis/class/mantis.class.php');
if (!$user->admin)
accessforbidden();
$langs->load("admin");
$langs->load("other");
$def = array();
$actiontest=$_POST["test"];
$actionsave=$_POST["save"];
// Sauvegardes parametres
if ($actionsave)
{
$i=0;
$db->begin();
$i+=dolibarr_set_const($db,'PHPMANTIS_URL',trim($_POST["phpmantis_url"]),'chaine',0,'',$conf->entity);
$i+=dolibarr_set_const($db,'PHPMANTIS_HOST',trim($_POST["phpmantis_host"]),'chaine',0,'',$conf->entity);
$i+=dolibarr_set_const($db,'PHPMANTIS_DBNAME',trim($_POST["phpmantis_dbname"]),'chaine',0,'',$conf->entity);
$i+=dolibarr_set_const($db,'PHPMANTIS_USER',trim($_POST["phpmantis_user"]),'chaine',0,'',$conf->entity);
$i+=dolibarr_set_const($db,'PHPMANTIS_PASS',trim($_POST["phpmantis_pass"]),'chaine',0,'',$conf->entity);
if ($i >= 5)
{
$db->commit();
$mesg = "<font class=\"ok\">".$langs->trans("MantisSetupSaved")."</font>";
}
else
{
$db->rollback();
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
}
elseif ($actiontest)
{
//$resql=$db->query("select count(*) from llx_const");
//print "< ".$db." - ".$db->db." - ".$resql." - ".$db->error()."><br>\n";
// Test de la connexion a la database mantis
$conf->mantis->db->type=$dolibarr_main_db_type;
$conf->mantis->db->host=$_POST["phpmantis_host"];
$conf->mantis->db->port=$_POST["phpmantis_port"];
$conf->mantis->db->user=$_POST["phpmantis_user"];
$conf->mantis->db->pass=$_POST["phpmantis_pass"];
$conf->mantis->db->name=$_POST["phpmantis_dbname"];
$mantis=new Mantis();
//print "D ".$db." - ".$db->db."<br>\n";
//print "W ".$mantis->localdb." - ".$mantis->localdb->db."<br>\n";
if ($mantis->localdb->connected == 1 && $mantis->localdb->database_selected == 1)
{
// V<>rifie si bonne base
$sql="SELECT value FROM mantis_config_table WHERE config_id='database_version'";
$resql=$mantis->localdb->query($sql);
if ($resql) {
$mesg ="<div class=\"ok\">";
$mesg.=$langs->trans("MantisTestOk",$_POST["phpmantis_host"],$_POST["phpmantis_dbname"],$_POST["phpmantis_user"]);
$mesg.="</div>";
}
else {
$mesg ="<div class=\"error\">";
$mesg.=$langs->trans("MantisErrorConnectOkButWrongDatabase");
$mesg.="</div>";
}
//$mantis->localdb->close(); Ne pas fermer car la conn de mantis est la meme que dolibarr si parametre host/user/pass identique
}
elseif ($mantis->connected == 1 && $mantis->database_selected != 1)
{
$mesg ="<div class=\"error\">".$langs->trans("MantisTestKo1",$_POST["phpmantis_host"],$_POST["phpmantis_dbname"]);
$mesg.="<br>".$mantis->localdb->error();
$mesg.="</div>";
//$mantis->localdb->close(); Ne pas fermer car la conn de mantis est la meme que dolibarr si parametre host/user/pass identique
}
else
{
$mesg ="<div class=\"error\">".$langs->trans("MantisTestKo2",$_POST["phpmantis_host"],$_POST["phpmantis_user"]);
$mesg.="<br>".$mantis->localdb->error();
$mesg.="</div>";
}
//$resql=$db->query("select count(*) from llx_const");
//print "< ".$db." - ".$db->db." - ".$resql." - ".$db->error()."><br>\n";
}
/**
* Affichage du formulaire de saisie
*/
llxHeader();
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("MantisSetup"),$linkback,'setup');
print '<br>';
print '<form name="phpmantisconfig" action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">";
print "<td width=\"30%\">".$langs->trans("Parameter")."</td>";
print "<td>".$langs->trans("Value")."</td>";
print "<td>".$langs->trans("Examples")."</td>";
print "</tr>";
print "<tr class=\"impair\">";
print "<td>".$langs->trans("MantisURL")."</td>";
print "<td><input type=\"text\" class=\"flat\" name=\"phpmantis_url\" value=\"". ($_POST["phpmantis_url"]?$_POST["phpmantis_url"]:$conf->global->PHPMANTIS_URL) . "\" size=\"40\"></td>";
print "<td>http://localhost/mantis/";
print "<br>https://mantisserver/";
print "</td>";
print "</tr>";
print "<tr class=\"pair\">";
print "<td>".$langs->trans("MantisServer")."</td>";
print "<td><input type=\"text\" class=\"flat\" name=\"phpmantis_host\" value=\"". ($_POST["phpmantis_host"]?$_POST["phpmantis_host"]:$conf->global->PHPMANTIS_HOST) . "\" size=\"30\"></td>";
print "<td>localhost";
//print "<br>__dolibarr_main_db_host__ <i>(".$dolibarr_main_db_host.")</i>"
print "</td>";
print "</tr>";
print "<tr class=\"impair\">";
print "<td>".$langs->trans("MantisDatabaseName")."</td>";
print "<td><input type=\"text\" class=\"flat\" name=\"phpmantis_dbname\" value=\"". ($_POST["phpmantis_dbname"]?$_POST["phpmantis_dbname"]:$conf->global->PHPMANTIS_DBNAME) . "\" size=\"30\"></td>";
print "<td>bugtracker";
//print "<br>__dolibarr_main_db_name__ <i>(".$dolibarr_main_db_name.")</i>";
print "</td>";
print "</tr>";
print "<tr class=\"pair\">";
print "<td>".$langs->trans("MantisUser")."</td>";
print "<td><input type=\"text\" class=\"flat\" name=\"phpmantis_user\" value=\"". ($_POST["phpmantis_user"]?$_POST["phpmantis_user"]:$conf->global->PHPMANTIS_USER) . "\" size=\"30\"></td>";
print "<td>mantis";
//print "<br>__dolibarr_main_db_user__ <i>(".$dolibarr_main_db_user.")</i>";
print "</td>";
print "</tr>";
print "<tr class=\"impair\">";
print "<td>".$langs->trans("Password")."</td>";
print "<td><input type=\"password\" class=\"flat\" name=\"phpmantis_pass\" value=\"" . ($_POST["phpmantis_pass"]?$_POST["phpmantis_pass"]:$conf->global->PHPMANTIS_PASS) . "\" size=\"30\"></td>";
print '<td>';
//if ($dolibarr_main_db_pass) print '__dolibarr_main_db_pass__ <i>('.preg_replace('/./i','*',$dolibarr_main_db_pass).')</i>';
print '&nbsp;</td>';
print "</tr>";
print "</table>";
print '<br><center>';
print "<input type=\"submit\" name=\"test\" class=\"button\" value=\"".$langs->trans("TestConnection")."\">";
print "&nbsp; &nbsp;";
print "<input type=\"submit\" name=\"save\" class=\"button\" value=\"".$langs->trans("Save")."\">";
print "</center>";
print "</form>\n";
clearstatcache();
if ($mesg) print "<br>$mesg<br>";
print "<br>";
$db->close();
llxFooter();
?>

View File

@ -1,68 +0,0 @@
<?php
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 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 2 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/mantis/class/mantis.class.php
* \ingroup mantis
* \brief Ensemble des fonctions permettant d'acceder a la database mantis.
* \author Laurent Destailleur.
*/
/**
* \class Mantis
* \brief Classe permettant d'acceder a la database mantis
*/
class Mantis {
var $localdb;
var $date;
var $duree = 0; // Secondes
var $texte;
var $desc;
var $error;
/**
\brief Constructeur de la classe d'interface a mantisendar
*/
function Mantis()
{
global $conf;
global $dolibarr_main_db_type,$dolibarr_main_db_host,$dolibarr_main_db_user;
global $dolibarr_main_db_pass,$dolibarr_main_db_name;
// Defini parametres mantis (avec substitution eventuelle)
$mantistype=preg_replace('/__dolibarr_main_db_type__/i',$dolibarr_main_db_type,$conf->mantis->db->type);
$mantishost=preg_replace('/__dolibarr_main_db_host__/i',$dolibarr_main_db_host,$conf->mantis->db->host);
$mantisport=preg_replace('/__dolibarr_main_db_port__/i',$dolibarr_main_db_port,$conf->mantis->db->port);
$mantisuser=preg_replace('/__dolibarr_main_db_user__/i',$dolibarr_main_db_user,$conf->mantis->db->user);
$mantispass=preg_replace('/__dolibarr_main_db_pass__/i',$dolibarr_main_db_pass,$conf->mantis->db->pass);
$mantisname=preg_replace('/__dolibarr_main_db_name__/i',$dolibarr_main_db_name,$conf->mantis->db->name);
// On initie la connexion a la base mantisendar
require_once (DOL_DOCUMENT_ROOT ."/lib/databases/".$mantistype.".lib.php");
$this->localdb = new DoliDb($mantistype,$mantishost,$mantisuser,$mantispass,$mantisname,$mantisport);
}
}
?>

View File

@ -1 +0,0 @@
Url not available

View File

@ -1,68 +0,0 @@
<?php
/* Copyright (C) 2004-2007 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 2 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/mantis/mantis.php
* \ingroup mantis
* \brief Page generant 2 frames, une pour le menu Dolibarr, l'autre pour l'affichage de Mantis
* \author Laurent Destailleur
*/
require("../main.inc.php");
if (empty($conf->global->PHPMANTIS_URL))
{
llxHeader();
print '<div class="error">Module Mantis was not configured properly.</div>';
llxFooter();
}
$mainmenu=isset($_GET["mainmenu"])?$_GET["mainmenu"]:"";
$leftmenu=isset($_GET["leftmenu"])?$_GET["leftmenu"]:"";
$idmenu=isset($_GET["idmenu"])?$_GET["idmenu"]:"";
print "
<html>
<head>
<title>Dolibarr frame for Mantis</title>
</head>
<frameset rows=\"".$heightforframes.",*\" border=0 framespacing=0 frameborder=0>
<frame name=\"barre\" src=\"mantistop.php?mainmenu=".$mainmenu."&leftmenu=".$leftmenu."&idmenu=".$idmenu."&nobackground=1\" noresize scrolling=\"NO\" noborder>
<frame name=\"main\" src=\"".$conf->global->PHPMANTIS_URL."\">
<noframes>
<body>
</body>
</noframes>
</frameset>
<noframes>
<body>
<br><center>
Sorry, your browser is too old or not correctly configured to view this area.<br>
Your browser must support frames.<br>
</center>
</body>
</noframes>
</html>
";
?>

View File

@ -1,39 +0,0 @@
<?php
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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 2 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/mantis/mantistop.php
* \ingroup mantis
* \brief Top frame to show mantis application
*/
require ("../main.inc.php");
top_htmlhead("","");
top_menu("","","_top");
?>