mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
New: Move mailman and spip feature into a specific module
This commit is contained in:
parent
a57295cc73
commit
f8b2a2c774
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2012 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>
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
|
||||
|
|
@ -42,6 +42,10 @@ $type=array('yesno','texte','chaine');
|
|||
$action = GETPOST("action");
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// Action mise a jour ou ajout d'une constante
|
||||
if ($action == 'update' || $action == 'add')
|
||||
{
|
||||
|
|
@ -198,84 +202,6 @@ print '</table>';
|
|||
print '<br>';
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Mailman
|
||||
*/
|
||||
$var=!$var;
|
||||
if ($conf->global->ADHERENT_USE_MAILMAN)
|
||||
{
|
||||
$lien=img_picto($langs->trans("Active"),'tick').' ';
|
||||
$lien.='<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_MAILMAN">'.$langs->trans("Disable").'</a>';
|
||||
// Edition des varibales globales
|
||||
$constantes=array(
|
||||
'ADHERENT_MAILMAN_LISTS',
|
||||
'ADHERENT_MAILMAN_ADMINPW',
|
||||
'ADHERENT_MAILMAN_URL',
|
||||
'ADHERENT_MAILMAN_UNSUB_URL'
|
||||
);
|
||||
print_fiche_titre("Mailman mailing list system",$lien,'');
|
||||
|
||||
// JQuery activity
|
||||
print '<script type="text/javascript">
|
||||
var i1=0;
|
||||
var i2=0;
|
||||
jQuery(document).ready(function(){
|
||||
jQuery("#exampleclick1").click(function(event){
|
||||
if (i1 == 0) { jQuery("#example1").show(); i1=1; }
|
||||
else if (i1 == 1) { jQuery("#example1").hide(); i1=0; }
|
||||
});
|
||||
jQuery("#exampleclick2").click(function(){
|
||||
if (i2 == 0) { jQuery("#example2").show(); i2=1; }
|
||||
else if (i2 == 1) { jQuery("#example2").hide(); i2=0; }
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
|
||||
form_constantes($constantes);
|
||||
|
||||
print '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||
print '%LISTE%, %MAILMAN_ADMINPW%, %EMAIL% <br>';
|
||||
|
||||
print '<br>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$lien='<a href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_MAILMAN">'.$langs->trans("Activate").'</a>';
|
||||
print_fiche_titre("Mailman mailing list system",$lien,'');
|
||||
print "<hr>\n";
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Spip
|
||||
*/
|
||||
$var=!$var;
|
||||
if ($conf->global->ADHERENT_USE_SPIP)
|
||||
{
|
||||
$lien=img_picto($langs->trans("Active"),'tick').' ';
|
||||
$lien.='<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_SPIP">'.$langs->trans("Disable").'</a>';
|
||||
// Edition des varibales globales
|
||||
$constantes=array(
|
||||
'ADHERENT_USE_SPIP_AUTO',
|
||||
'ADHERENT_SPIP_SERVEUR',
|
||||
'ADHERENT_SPIP_DB',
|
||||
'ADHERENT_SPIP_USER',
|
||||
'ADHERENT_SPIP_PASS'
|
||||
);
|
||||
|
||||
print_fiche_titre("SPIP CMS",$lien,'');
|
||||
form_constantes($constantes);
|
||||
print '<br>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$lien='<a href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_SPIP">'.$langs->trans("Activate").'</a>';
|
||||
print_fiche_titre("SPIP - CMS",$lien,'');
|
||||
print "<hr>\n";
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Edition info modele document
|
||||
*/
|
||||
|
|
@ -342,140 +268,8 @@ print '<br>';
|
|||
|
||||
dol_fiche_end();
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
|
||||
|
||||
function form_constantes($tableau)
|
||||
{
|
||||
global $db,$bc,$langs,$conf,$_Avery_Labels;
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td>'.$langs->trans("Value").'*</td>';
|
||||
print '<td> </td>';
|
||||
print '<td align="center" width="80">'.$langs->trans("Action").'</td>';
|
||||
print "</tr>\n";
|
||||
$var=true;
|
||||
|
||||
$listofparam=array();
|
||||
foreach($tableau as $const) // Loop on each param
|
||||
{
|
||||
$sql = "SELECT ";
|
||||
$sql.= "rowid";
|
||||
$sql.= ", ".$db->decrypt('name')." as name";
|
||||
$sql.= ", ".$db->decrypt('value')." as value";
|
||||
$sql.= ", type";
|
||||
$sql.= ", note";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."const";
|
||||
$sql.= " WHERE ".$db->decrypt('name')." = '".$const."'";
|
||||
$sql.= " AND entity in (0, ".$conf->entity.")";
|
||||
$sql.= " ORDER BY name ASC, entity DESC";
|
||||
$result = $db->query($sql);
|
||||
|
||||
dol_syslog("List params sql=".$sql);
|
||||
if ($result)
|
||||
{
|
||||
$obj = $db->fetch_object($result); // Take first result of select
|
||||
$var=!$var;
|
||||
|
||||
print "\n".'<form action="adherent.php" method="POST">';
|
||||
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
// Affiche nom constante
|
||||
print '<td>';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="rowid" value="'.$obj->rowid.'">';
|
||||
print '<input type="hidden" name="constname" value="'.$const.'">';
|
||||
print '<input type="hidden" name="constnote" value="'.nl2br($obj->note).'">';
|
||||
|
||||
print $langs->trans("Desc".$const) != ("Desc".$const) ? $langs->trans("Desc".$const) : ($obj->note?$obj->note:$const);
|
||||
|
||||
if ($const=='ADHERENT_MAILMAN_URL')
|
||||
{
|
||||
print '. '.$langs->trans("Example").': <a href="#" id="exampleclick1">'.img_down().'</a><br>';
|
||||
//print 'http://lists.domain.com/cgi-bin/mailman/admin/%LISTE%/members?adminpw=%MAILMAN_ADMINPW%&subscribees=%EMAIL%&send_welcome_msg_to_this_batch=1';
|
||||
print '<div id="example1" class="hidden">';
|
||||
print 'http://lists.domain.com/cgi-bin/mailman/admin/%LISTE%/members/add?subscribees_upload=%EMAIL%&adminpw=%MAILMAN_ADMINPW%&subscribe_or_invite=0&send_welcome_msg_to_this_batch=0&notification_to_list_owner=0';
|
||||
print '</div>';
|
||||
}
|
||||
if ($const=='ADHERENT_MAILMAN_UNSUB_URL')
|
||||
{
|
||||
print '. '.$langs->trans("Example").': <a href="#" id="exampleclick2">'.img_down().'</a><br>';
|
||||
print '<div id="example2" class="hidden">';
|
||||
print 'http://lists.domain.com/cgi-bin/mailman/admin/%LISTE%/members/remove?unsubscribees_upload=%EMAIL%&adminpw=%MAILMAN_ADMINPW%&send_unsub_ack_to_this_batch=0&send_unsub_notifications_to_list_owner=0';
|
||||
print '</div>';
|
||||
//print 'http://lists.domain.com/cgi-bin/mailman/admin/%LISTE%/members/remove?adminpw=%MAILMAN_ADMINPW%&unsubscribees=%EMAIL%';
|
||||
}
|
||||
|
||||
|
||||
print "</td>\n";
|
||||
|
||||
if ($const == 'ADHERENT_CARD_TYPE' || $const == 'ADHERENT_ETIQUETTE_TYPE')
|
||||
{
|
||||
print '<td>';
|
||||
// List of possible labels (defined into $_Avery_Labels variable set into format_cards.lib.php)
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/lib/format_cards.lib.php');
|
||||
$arrayoflabels=array();
|
||||
foreach(array_keys($_Avery_Labels) as $codecards)
|
||||
{
|
||||
$arrayoflabels[$codecards]=$_Avery_Labels[$codecards]['name'];
|
||||
}
|
||||
print $form->selectarray('constvalue',$arrayoflabels,($obj->value?$obj->value:'CARD'),1,0,0);
|
||||
print '</td><td>';
|
||||
print '<input type="hidden" name="consttype" value="yesno">';
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td>';
|
||||
//print 'aa'.$const;
|
||||
if (in_array($const,array('ADHERENT_CARD_TEXT','ADHERENT_CARD_TEXT_RIGHT')))
|
||||
{
|
||||
print '<textarea class="flat" name="constvalue" cols="35" rows="5" wrap="soft">'."\n";
|
||||
print $obj->value;
|
||||
print "</textarea>\n";
|
||||
print '</td><td>';
|
||||
print '<input type="hidden" name="consttype" value="texte">';
|
||||
}
|
||||
else if (in_array($const,array('ADHERENT_AUTOREGISTER_MAIL','ADHERENT_MAIL_VALID','ADHERENT_MAIL_COTIS','ADHERENT_MAIL_RESIL')))
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
|
||||
$doleditor=new DolEditor('constvalue'.$const,$obj->value,'',160,'dolibarr_notes','',false,false,$conf->fckeditor->enabled,5,60);
|
||||
$doleditor->Create();
|
||||
|
||||
print '</td><td>';
|
||||
print '<input type="hidden" name="consttype" value="texte">';
|
||||
}
|
||||
else if ($obj->type == 'yesno')
|
||||
{
|
||||
print $form->selectyesno('constvalue',$obj->value,1);
|
||||
print '</td><td>';
|
||||
print '<input type="hidden" name="consttype" value="yesno">';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="text" class="flat" size="48" name="constvalue" value="'.$obj->value.'">';
|
||||
print '</td><td>';
|
||||
print '<input type="hidden" name="consttype" value="chaine">';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
print '<td align="center">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Update").'" name="Button"> ';
|
||||
// print '<a href="adherent.php?name='.$const.'&action=unset">'.img_delete().'</a>';
|
||||
print "</td>";
|
||||
print "</tr>\n";
|
||||
print "</form>\n";
|
||||
}
|
||||
}
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
175
htdocs/adherents/admin/mailman.php
Normal file
175
htdocs/adherents/admin/mailman.php
Normal file
|
|
@ -0,0 +1,175 @@
|
|||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2011 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>
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* 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/adherents/admin/adherent.php
|
||||
* \ingroup member
|
||||
* \brief Page to setup the module Foundation
|
||||
*/
|
||||
|
||||
require("../../main.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/mailmanspip.lib.php");
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("members");
|
||||
|
||||
if (! $user->admin) accessforbidden();
|
||||
|
||||
|
||||
$type=array('yesno','texte','chaine');
|
||||
|
||||
$action = GETPOST("action");
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// Action mise a jour ou ajout d'une constante
|
||||
if ($action == 'update' || $action == 'add')
|
||||
{
|
||||
$constname=GETPOST("constname");
|
||||
$constvalue=GETPOST("constvalue");
|
||||
|
||||
if (($constname=='ADHERENT_CARD_TYPE' || $constname=='ADHERENT_ETIQUETTE_TYPE') && $constvalue == -1) $constvalue='';
|
||||
if ($constname=='ADHERENT_LOGIN_NOT_REQUIRED') // Invert choice
|
||||
{
|
||||
if ($constvalue) $constvalue=0;
|
||||
else $constvalue=1;
|
||||
}
|
||||
|
||||
if (in_array($constname,array('ADHERENT_MAIL_VALID','ADHERENT_MAIL_COTIS','ADHERENT_MAIL_RESIL'))) $constvalue=$_POST["constvalue".$constname];
|
||||
$consttype=$_POST["consttype"];
|
||||
$constnote=GETPOST("constnote");
|
||||
$res=dolibarr_set_const($db,$constname,$constvalue,$type[$consttype],0,$constnote,$conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$mesg = '<div class="ok">'.$langs->trans("SetupSaved").'</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg = '<div class="error">'.$langs->trans("Error").'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
// Action activation d'un sous module du module adherent
|
||||
if ($action == 'set')
|
||||
{
|
||||
$result=dolibarr_set_const($db, $_GET["name"],$_GET["value"],'',0,'',$conf->entity);
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
// Action desactivation d'un sous module du module adherent
|
||||
if ($action == 'unset')
|
||||
{
|
||||
$result=dolibarr_del_const($db,$_GET["name"],$conf->entity);
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$help_url='';
|
||||
|
||||
llxHeader('',$langs->trans("MailmanSpipSetup"),$help_url);
|
||||
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print_fiche_titre($langs->trans("MailmanSpipSetup"),$linkback,'setup');
|
||||
|
||||
|
||||
$head = mailmanspip_admin_prepare_head($adh);
|
||||
|
||||
dol_fiche_head($head, 'mailman', $langs->trans("Setup"), 0, 'user');
|
||||
|
||||
|
||||
dol_htmloutput_mesg($mesg);
|
||||
|
||||
|
||||
/*
|
||||
* Mailman
|
||||
*/
|
||||
$var=!$var;
|
||||
if ($conf->global->ADHERENT_USE_MAILMAN)
|
||||
{
|
||||
$lien=img_picto($langs->trans("Active"),'tick').' ';
|
||||
$lien.='<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_MAILMAN">'.$langs->trans("Disable").'</a>';
|
||||
// Edition des varibales globales
|
||||
$constantes=array(
|
||||
'ADHERENT_MAILMAN_ADMINPW',
|
||||
'ADHERENT_MAILMAN_URL',
|
||||
'ADHERENT_MAILMAN_UNSUB_URL',
|
||||
'ADHERENT_MAILMAN_LISTS'
|
||||
);
|
||||
|
||||
print_fiche_titre("Mailman mailing list system",$lien,'');
|
||||
|
||||
// JQuery activity
|
||||
print '<script type="text/javascript">
|
||||
var i1=0;
|
||||
var i2=0;
|
||||
jQuery(document).ready(function(){
|
||||
jQuery("#exampleclick1").click(function(event){
|
||||
if (i1 == 0) { jQuery("#example1").show(); i1=1; }
|
||||
else if (i1 == 1) { jQuery("#example1").hide(); i1=0; }
|
||||
});
|
||||
jQuery("#exampleclick2").click(function(){
|
||||
if (i2 == 0) { jQuery("#example2").show(); i2=1; }
|
||||
else if (i2 == 1) { jQuery("#example2").hide(); i2=0; }
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
|
||||
form_constantes($constantes);
|
||||
|
||||
print '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||
print '%LISTE%, %MAILMAN_ADMINPW%, %EMAIL% <br>';
|
||||
|
||||
print '<br>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$lien='<a href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_MAILMAN">'.$langs->trans("Activate").'</a>';
|
||||
print_fiche_titre("Mailman mailing list system",$lien,'');
|
||||
print "<hr>\n";
|
||||
}
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
154
htdocs/adherents/admin/spip.php
Normal file
154
htdocs/adherents/admin/spip.php
Normal file
|
|
@ -0,0 +1,154 @@
|
|||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2011 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>
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* 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/adherents/admin/adherent.php
|
||||
* \ingroup member
|
||||
* \brief Page to setup the module Foundation
|
||||
*/
|
||||
|
||||
require("../../main.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/mailmanspip.lib.php");
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("members");
|
||||
|
||||
if (! $user->admin) accessforbidden();
|
||||
|
||||
|
||||
$type=array('yesno','texte','chaine');
|
||||
|
||||
$action = GETPOST("action");
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// Action mise a jour ou ajout d'une constante
|
||||
if ($action == 'update' || $action == 'add')
|
||||
{
|
||||
$constname=GETPOST("constname");
|
||||
$constvalue=GETPOST("constvalue");
|
||||
|
||||
if (($constname=='ADHERENT_CARD_TYPE' || $constname=='ADHERENT_ETIQUETTE_TYPE') && $constvalue == -1) $constvalue='';
|
||||
if ($constname=='ADHERENT_LOGIN_NOT_REQUIRED') // Invert choice
|
||||
{
|
||||
if ($constvalue) $constvalue=0;
|
||||
else $constvalue=1;
|
||||
}
|
||||
|
||||
if (in_array($constname,array('ADHERENT_MAIL_VALID','ADHERENT_MAIL_COTIS','ADHERENT_MAIL_RESIL'))) $constvalue=$_POST["constvalue".$constname];
|
||||
$consttype=$_POST["consttype"];
|
||||
$constnote=GETPOST("constnote");
|
||||
$res=dolibarr_set_const($db,$constname,$constvalue,$type[$consttype],0,$constnote,$conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$mesg = '<div class="ok">'.$langs->trans("SetupSaved").'</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg = '<div class="error">'.$langs->trans("Error").'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
// Action activation d'un sous module du module adherent
|
||||
if ($action == 'set')
|
||||
{
|
||||
$result=dolibarr_set_const($db, $_GET["name"],$_GET["value"],'',0,'',$conf->entity);
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
// Action desactivation d'un sous module du module adherent
|
||||
if ($action == 'unset')
|
||||
{
|
||||
$result=dolibarr_del_const($db,$_GET["name"],$conf->entity);
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$help_url='';
|
||||
|
||||
llxHeader('',$langs->trans("MailmanSpipSetup"),$help_url);
|
||||
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print_fiche_titre($langs->trans("MailmanSpipSetup"),$linkback,'setup');
|
||||
|
||||
|
||||
$head = mailmanspip_admin_prepare_head($adh);
|
||||
|
||||
dol_fiche_head($head, 'spip', $langs->trans("Setup"), 0, 'user');
|
||||
|
||||
|
||||
dol_htmloutput_mesg($mesg);
|
||||
|
||||
/*
|
||||
* Spip
|
||||
*/
|
||||
$var=!$var;
|
||||
if ($conf->global->ADHERENT_USE_SPIP)
|
||||
{
|
||||
$lien=img_picto($langs->trans("Active"),'tick').' ';
|
||||
$lien.='<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_SPIP">'.$langs->trans("Disable").'</a>';
|
||||
// Edition des varibales globales
|
||||
$constantes=array(
|
||||
'ADHERENT_SPIP_SERVEUR',
|
||||
'ADHERENT_SPIP_DB',
|
||||
'ADHERENT_SPIP_USER',
|
||||
'ADHERENT_SPIP_PASS'
|
||||
);
|
||||
|
||||
print_fiche_titre("SPIP CMS",$lien,'');
|
||||
form_constantes($constantes);
|
||||
print '<br>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$lien='<a href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_SPIP">'.$langs->trans("Activate").'</a>';
|
||||
print_fiche_titre("SPIP - CMS",$lien,'');
|
||||
print "<hr>\n";
|
||||
}
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
|
|
@ -1348,7 +1348,7 @@ class Adherent extends CommonObject
|
|||
}
|
||||
|
||||
// spip
|
||||
if ($conf->global->ADHERENT_USE_SPIP && $conf->global->ADHERENT_USE_SPIP_AUTO)
|
||||
if ($conf->global->ADHERENT_USE_SPIP && $conf->mailmanspip->enabled)
|
||||
{
|
||||
$result=$this->add_to_spip();
|
||||
if ($result < 0)
|
||||
|
|
@ -1389,7 +1389,7 @@ class Adherent extends CommonObject
|
|||
}
|
||||
}
|
||||
|
||||
if ($conf->global->ADHERENT_USE_SPIP && $conf->global->ADHERENT_USE_SPIP_AUTO)
|
||||
if ($conf->global->ADHERENT_USE_SPIP && $conf->mailmanspip->enabled)
|
||||
{
|
||||
$result=$this->del_to_spip();
|
||||
if ($result < 0)
|
||||
|
|
|
|||
|
|
@ -981,4 +981,142 @@ function complete_dictionnary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsq
|
|||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show array with constants to edit
|
||||
*
|
||||
* @param array $tableau Array of constants
|
||||
* @return void
|
||||
*/
|
||||
function form_constantes($tableau)
|
||||
{
|
||||
global $db,$bc,$langs,$conf,$_Avery_Labels;
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td>'.$langs->trans("Value").'*</td>';
|
||||
print '<td> </td>';
|
||||
print '<td align="center" width="80">'.$langs->trans("Action").'</td>';
|
||||
print "</tr>\n";
|
||||
$var=true;
|
||||
|
||||
$listofparam=array();
|
||||
foreach($tableau as $const) // Loop on each param
|
||||
{
|
||||
$sql = "SELECT ";
|
||||
$sql.= "rowid";
|
||||
$sql.= ", ".$db->decrypt('name')." as name";
|
||||
$sql.= ", ".$db->decrypt('value')." as value";
|
||||
$sql.= ", type";
|
||||
$sql.= ", note";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."const";
|
||||
$sql.= " WHERE ".$db->decrypt('name')." = '".$const."'";
|
||||
$sql.= " AND entity in (0, ".$conf->entity.")";
|
||||
$sql.= " ORDER BY name ASC, entity DESC";
|
||||
$result = $db->query($sql);
|
||||
|
||||
dol_syslog("List params sql=".$sql);
|
||||
if ($result)
|
||||
{
|
||||
$obj = $db->fetch_object($result); // Take first result of select
|
||||
$var=!$var;
|
||||
|
||||
print "\n".'<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
// Affiche nom constante
|
||||
print '<td>';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="rowid" value="'.$obj->rowid.'">';
|
||||
print '<input type="hidden" name="constname" value="'.$const.'">';
|
||||
print '<input type="hidden" name="constnote" value="'.nl2br($obj->note).'">';
|
||||
|
||||
print $langs->trans("Desc".$const) != ("Desc".$const) ? $langs->trans("Desc".$const) : ($obj->note?$obj->note:$const);
|
||||
|
||||
if ($const=='ADHERENT_MAILMAN_URL')
|
||||
{
|
||||
print '. '.$langs->trans("Example").': <a href="#" id="exampleclick1">'.img_down().'</a><br>';
|
||||
//print 'http://lists.domain.com/cgi-bin/mailman/admin/%LISTE%/members?adminpw=%MAILMAN_ADMINPW%&subscribees=%EMAIL%&send_welcome_msg_to_this_batch=1';
|
||||
print '<div id="example1" class="hidden">';
|
||||
print 'http://lists.domain.com/cgi-bin/mailman/admin/%LISTE%/members/add?subscribees_upload=%EMAIL%&adminpw=%MAILMAN_ADMINPW%&subscribe_or_invite=0&send_welcome_msg_to_this_batch=0&notification_to_list_owner=0';
|
||||
print '</div>';
|
||||
}
|
||||
if ($const=='ADHERENT_MAILMAN_UNSUB_URL')
|
||||
{
|
||||
print '. '.$langs->trans("Example").': <a href="#" id="exampleclick2">'.img_down().'</a><br>';
|
||||
print '<div id="example2" class="hidden">';
|
||||
print 'http://lists.domain.com/cgi-bin/mailman/admin/%LISTE%/members/remove?unsubscribees_upload=%EMAIL%&adminpw=%MAILMAN_ADMINPW%&send_unsub_ack_to_this_batch=0&send_unsub_notifications_to_list_owner=0';
|
||||
print '</div>';
|
||||
//print 'http://lists.domain.com/cgi-bin/mailman/admin/%LISTE%/members/remove?adminpw=%MAILMAN_ADMINPW%&unsubscribees=%EMAIL%';
|
||||
}
|
||||
|
||||
|
||||
print "</td>\n";
|
||||
|
||||
if ($const == 'ADHERENT_CARD_TYPE' || $const == 'ADHERENT_ETIQUETTE_TYPE')
|
||||
{
|
||||
print '<td>';
|
||||
// List of possible labels (defined into $_Avery_Labels variable set into format_cards.lib.php)
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/lib/format_cards.lib.php');
|
||||
$arrayoflabels=array();
|
||||
foreach(array_keys($_Avery_Labels) as $codecards)
|
||||
{
|
||||
$arrayoflabels[$codecards]=$_Avery_Labels[$codecards]['name'];
|
||||
}
|
||||
print $form->selectarray('constvalue',$arrayoflabels,($obj->value?$obj->value:'CARD'),1,0,0);
|
||||
print '</td><td>';
|
||||
print '<input type="hidden" name="consttype" value="yesno">';
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td>';
|
||||
//print 'aa'.$const;
|
||||
if (in_array($const,array('ADHERENT_CARD_TEXT','ADHERENT_CARD_TEXT_RIGHT')))
|
||||
{
|
||||
print '<textarea class="flat" name="constvalue" cols="35" rows="5" wrap="soft">'."\n";
|
||||
print $obj->value;
|
||||
print "</textarea>\n";
|
||||
print '</td><td>';
|
||||
print '<input type="hidden" name="consttype" value="texte">';
|
||||
}
|
||||
else if (in_array($const,array('ADHERENT_AUTOREGISTER_MAIL','ADHERENT_MAIL_VALID','ADHERENT_MAIL_COTIS','ADHERENT_MAIL_RESIL')))
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
|
||||
$doleditor=new DolEditor('constvalue'.$const,$obj->value,'',160,'dolibarr_notes','',false,false,$conf->fckeditor->enabled,5,60);
|
||||
$doleditor->Create();
|
||||
|
||||
print '</td><td>';
|
||||
print '<input type="hidden" name="consttype" value="texte">';
|
||||
}
|
||||
else if ($obj->type == 'yesno')
|
||||
{
|
||||
print $form->selectyesno('constvalue',$obj->value,1);
|
||||
print '</td><td>';
|
||||
print '<input type="hidden" name="consttype" value="yesno">';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="text" class="flat" size="48" name="constvalue" value="'.$obj->value.'">';
|
||||
print '</td><td>';
|
||||
print '<input type="hidden" name="consttype" value="chaine">';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
print '<td align="center">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Update").'" name="Button"> ';
|
||||
// print '<a href="adherent.php?name='.$const.'&action=unset">'.img_delete().'</a>';
|
||||
print "</td>";
|
||||
print "</tr>\n";
|
||||
print "</form>\n";
|
||||
}
|
||||
}
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
?>
|
||||
50
htdocs/core/lib/mailmanspip.lib.php
Normal file
50
htdocs/core/lib/mailmanspip.lib.php
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
/* Copyright (C) 2006-2011 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/>.
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/lib/member.lib.php
|
||||
* \brief Ensemble de fonctions de base pour les adherents
|
||||
*/
|
||||
|
||||
/**
|
||||
* Return array head with list of tabs to view object informations
|
||||
*
|
||||
* @param Object $object Member
|
||||
* @return array head
|
||||
*/
|
||||
function mailmanspip_admin_prepare_head($object)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/adherents/admin/mailman.php';
|
||||
$head[$h][1] = $langs->trans("Mailman");
|
||||
$head[$h][2] = 'mailman';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/adherents/admin/spip.php';
|
||||
$head[$h][1] = $langs->trans("Spip");
|
||||
$head[$h][2] = 'spip';
|
||||
$h++;
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -24,8 +24,8 @@
|
|||
/**
|
||||
* Return array head with list of tabs to view object informations
|
||||
*
|
||||
* @param object Member
|
||||
* @return array head
|
||||
* @param Object $object Member
|
||||
* @return array head
|
||||
*/
|
||||
function member_prepare_head($object)
|
||||
{
|
||||
|
|
@ -93,8 +93,9 @@ function member_prepare_head($object)
|
|||
|
||||
/**
|
||||
* Return array head with list of tabs to view object informations
|
||||
* @param object Member
|
||||
* @return array head
|
||||
*
|
||||
* @param Object $object Member
|
||||
* @return array head
|
||||
*/
|
||||
function member_admin_prepare_head($object)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ class modAdherent extends DolibarrModules
|
|||
// Dependances
|
||||
//------------
|
||||
$this->depends = array();
|
||||
$this->requiredby = array();
|
||||
$this->requiredby = array('modMailmanSpip');
|
||||
$this->langfiles = array("members","companies");
|
||||
|
||||
// Constantes
|
||||
|
|
@ -79,7 +79,6 @@ class modAdherent extends DolibarrModules
|
|||
$this->const[10] = array("ADHERENT_MAILMAN_UNSUB_URL","chaine","http://lists.domain.com/cgi-bin/mailman/admin/%LISTE%/members?adminpw=%MAILMAN_ADMINPW%&user=%EMAIL%","Url de désinscription aux listes mailman");
|
||||
$this->const[11] = array("ADHERENT_MAILMAN_URL","chaine","http://lists.domain.com/cgi-bin/mailman/admin/%LISTE%/members?adminpw=%MAILMAN_ADMINPW%&send_welcome_msg_to_this_batch=1&subscribees=%EMAIL%","Url pour les inscriptions mailman");
|
||||
$this->const[12] = array("ADHERENT_MAILMAN_LISTS","chaine","","Mailing-list to subscribe new members to");
|
||||
$this->const[16] = array("ADHERENT_USE_SPIP_AUTO","yesno","","Utilisation de SPIP automatiquement");
|
||||
$this->const[17] = array("ADHERENT_SPIP_USER","chaine","","Utilisateur de connexion à la base spip");
|
||||
$this->const[18] = array("ADHERENT_SPIP_PASS","chaine","","Mot de passe de connexion à la base spip");
|
||||
$this->const[19] = array("ADHERENT_SPIP_SERVEUR","chaine","","serveur spip");
|
||||
|
|
|
|||
110
htdocs/core/modules/modMailmanSpip.class.php
Normal file
110
htdocs/core/modules/modMailmanSpip.class.php
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
<?php
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.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/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \defgroup clicktodial Module clicktodial
|
||||
* \brief Module pour gerer l'appel automatique
|
||||
* \file htdocs/core/modules/modClickToDial.class.php
|
||||
* \ingroup clicktodial
|
||||
* \brief Fichier de description et activation du module de click to Dial
|
||||
*/
|
||||
|
||||
include_once(DOL_DOCUMENT_ROOT ."/core/modules/DolibarrModules.class.php");
|
||||
|
||||
|
||||
/**
|
||||
* \class modMailmanSpip
|
||||
* \brief Classe de description et activation du module de Click to Dial
|
||||
*/
|
||||
|
||||
class modMailmanSpip extends DolibarrModules
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor. Define names, constants, directories, boxes, permissions
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function modMailmanSpip($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
$this->numero = 105;
|
||||
|
||||
$this->family = "technic";
|
||||
// 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));
|
||||
$this->description = "Mailman or Spip interface for member module";
|
||||
|
||||
$this->version = 'dolibarr'; // 'development' or 'experimental' or 'dolibarr' or version
|
||||
|
||||
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
||||
$this->special = 1;
|
||||
$this->picto='technic';
|
||||
|
||||
// Data directories to create when module is enabled
|
||||
$this->dirs = array();
|
||||
|
||||
// Dependencies
|
||||
$this->depends = array('modAdherent');
|
||||
$this->requiredby = array();
|
||||
|
||||
// Config pages
|
||||
$this->config_page_url = array('mailman.php@adherents');
|
||||
|
||||
// Constants
|
||||
$this->const = array();
|
||||
|
||||
// Boxes
|
||||
$this->boxes = array();
|
||||
|
||||
// Permissions
|
||||
$this->rights = array();
|
||||
$this->rights_class = 'clicktodial';
|
||||
}
|
||||
|
||||
/**
|
||||
* Function called when module is enabled.
|
||||
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
||||
* It also creates data directories
|
||||
*
|
||||
* @param string $options Options when enabling module ('', 'noboxes')
|
||||
* @return int 1 if OK, 0 if KO
|
||||
*/
|
||||
function init($options='')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$sql = array();
|
||||
|
||||
return $this->_init($sql,$options);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Function called when module is disabled.
|
||||
* Remove from database constants, boxes and permissions from Dolibarr database.
|
||||
* Data directories are not deleted.
|
||||
* \return int 1 if OK, 0 if KO
|
||||
*/
|
||||
function remove()
|
||||
{
|
||||
$sql = array();
|
||||
|
||||
return $this->_remove($sql);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -1273,6 +1273,8 @@ BankOrderGlobal=General
|
|||
BankOrderGlobalDesc=General display order
|
||||
BankOrderES=Spanish
|
||||
BankOrderESDesc=Spanish display order
|
||||
##### MailmanSpip #####
|
||||
MailmanSpipSetup=Mailman and Spip module Setup
|
||||
##### Multicompany #####
|
||||
MultiCompanySetup=Multi-company module setup
|
||||
##### Suppliers #####
|
||||
|
|
|
|||
|
|
@ -1281,6 +1281,8 @@ BankOrderGlobal=Général
|
|||
BankOrderGlobalDesc=Ordre d'affichage général
|
||||
BankOrderES=Espagnol
|
||||
BankOrderESDesc=Ordre d'affichage Espagnol
|
||||
##### MailmanSpip #####
|
||||
MailmanSpipSetup=Configuration du module Mailman et Spip
|
||||
##### Multicompany #####
|
||||
MultiCompanySetup=Configuration du module Multi-société
|
||||
##### Suppliers #####
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user