work on searc, lists modules
authorPierre Habouzit (MadCoder <pierre.habouzit@m4x.org>
Thu, 2 Dec 2004 08:48:25 +0000 (08:48 +0000)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Thu, 26 Jun 2008 21:26:20 +0000 (23:26 +0200)
* Search :
    - Begin to create a SearchConfig class, and put all data there.

* Lists :
    - Move file templates into install.d/lists/mail_templates.

* plat/al-devel :
    - Move scripts templates away, into the install.d/platal-dev dir.

+ : re-add carva_redirect.php that was lost ...

git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-12

22 files changed:
bin/devel/foobar.pl [deleted file]
bin/devel/foobar.tpl [deleted file]
bin/devel/modules_status
htdocs/advanced_search.php
htdocs/carva_redirect.php [new file with mode: 0644]
htdocs/search.php
include/conf.d/search.globals.inc.php [moved from bin/devel/foobar.php with 87% similarity]
include/search.classes.inc.php
install.d/banana/files
install.d/lists/files
install.d/lists/mail_templates/adminsubscribeack.txt [moved from bin/mailman/mails/adminsubscribeack.txt with 100% similarity]
install.d/lists/mail_templates/approve.txt [moved from bin/mailman/mails/approve.txt with 100% similarity]
install.d/lists/mail_templates/checkdbs.txt [moved from bin/mailman/mails/checkdbs.txt with 100% similarity]
install.d/lists/mail_templates/masthead.txt [moved from bin/mailman/mails/masthead.txt with 100% similarity]
install.d/lists/mail_templates/newlist.txt [moved from bin/mailman/mails/newlist.txt with 100% similarity]
install.d/lists/mail_templates/postauth.txt [moved from bin/mailman/mails/postauth.txt with 100% similarity]
install.d/lists/mail_templates/postheld.txt [moved from bin/mailman/mails/postheld.txt with 100% similarity]
install.d/lists/mail_templates/refuse.txt [moved from bin/mailman/mails/refuse.txt with 100% similarity]
install.d/lists/mail_templates/subauth.txt [moved from bin/mailman/mails/subauth.txt with 100% similarity]
install.d/lists/mail_templates/subscribeack.txt [moved from bin/mailman/mails/subscribeack.txt with 100% similarity]
install.d/platal-dev/files
upgrade/inc/pervasive.sh

diff --git a/bin/devel/foobar.pl b/bin/devel/foobar.pl
deleted file mode 100644 (file)
index a10179e..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#! /usr/bin/perl -w
-#***************************************************************************
-#*  Copyright (C) 2003-2004 Polytechnique.org                              *
-#*  http://opensource.polytechnique.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, write to the Free Software            *
-#*  Foundation, Inc.,                                                      *
-#*  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
-#***************************************************************************
-#       $Id: foobar.pl,v 1.1 2004/08/31 11:38:21 x2000habouzit Exp $
-#***************************************************************************
-
-use strict;
-
-exit 0;
diff --git a/bin/devel/foobar.tpl b/bin/devel/foobar.tpl
deleted file mode 100644 (file)
index a6bf5a6..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-{***************************************************************************
- *  Copyright (C) 2003-2004 Polytechnique.org                              *
- *  http://opensource.polytechnique.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, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************
-        $Id: foobar.tpl,v 1.1 2004/08/31 11:38:21 x2000habouzit Exp $
- ***************************************************************************}
-
-
-{* vim:set et sw=2 sts=2 sws=2: *}
index 50430ec..118a173 100755 (executable)
@@ -2,8 +2,8 @@
 
 chdir ${1:-.}
 
-dirs=(configs htdocs hooks include plugins scripts templates)
-opts=(-type f -not -path '*CVS*' -not -name '.cvsignore')
+dirs=(bin configs htdocs hooks include plugins templates)
+opts=(-type f -not -path '*CVS*' -not -name '.cvsignore' -not -path '*.arch*')
 
 diff -u <(cat install.d/**/files|sort) <(find $dirs $opts|sort) \
     | grep '^[-+][a-z]' | sed -e 's,^+,Orphaned: ,;s,^-,Missing : ,'
index 97ee888..e900fa4 100644 (file)
@@ -122,7 +122,7 @@ else {
                        u.prenom,
                        u.promo,
                        a.alias AS forlife,
-                       '.$globals->search_result_fields.'
+                       '.$globals->search->result_fields.'
                        c.uid AS contact,
                        w.ni_id AS contact
                  FROM  auth_user_md5  AS u'
@@ -131,20 +131,20 @@ else {
        .'   LEFT JOIN  aliases        AS a ON (u.user_id = a.id AND a.type="a_vie")
             LEFT JOIN  contacts       AS c ON (c.uid='.((array_key_exists('uid',$_SESSION))?$_SESSION['uid']:0).' AND c.contact=u.user_id)
             LEFT JOIN  watch_nonins   AS w ON (w.ni_id=u.user_id AND w.uid='.((array_key_exists('uid',$_SESSION))?$_SESSION['uid']:0).')
-            '.$globals->search_result_where_statement.'
+            '.$globals->search->result_where_statement.'
                 '.(($where!='')?('WHERE '.$where):'').'
              ORDER BY  '.(logged() && !empty($_REQUEST['mod_date_sort']) ? 'date DESC,' :'')
                        .implode(',',array_filter(array($fields->get_order_statement(),'promo DESC,NomSortKey,prenom'))).'
-                LIMIT  '.$offset->value.','.$globals->search_results_per_page;
+                LIMIT  '.$offset->value.','.$globals->search->per_page;
 
     $page->mysql_assign($sql, 'resultats', 'nb_resultats','nb_resultats_total');
-    $nbpages = ($page->get_template_vars('nb_resultats_total')-1)/$globals->search_results_per_page;
+    $nbpages = ($page->get_template_vars('nb_resultats_total')-1)/$globals->search->per_page;
     $page->assign('offsets',range(0,$nbpages));
     $page->assign('offset',$offset->value);
     $page->assign('url_args',$fields->get_url());
     $page->assign('with_soundex',$with_soundex);
     $page->assign('mod_date_sort',!empty($_REQUEST['mod_date_sort']));
-    $page->assign('perpage',$globals->search_results_per_page);
+    $page->assign('perpage',$globals->search->per_page);
     $page->assign('is_admin',has_perms());
     
     if(!$page->get_template_vars('nb_resultats_total')) {
diff --git a/htdocs/carva_redirect.php b/htdocs/carva_redirect.php
new file mode 100644 (file)
index 0000000..14cebec
--- /dev/null
@@ -0,0 +1,57 @@
+<?php
+/***************************************************************************
+ *  Copyright (C) 2003-2004 Polytechnique.org                              *
+ *  http://opensource.polytechnique.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, write to the Free Software            *
+ *  Foundation, Inc.,                                                      *
+ *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
+ ***************************************************************************
+    $Id: carva_redirect.php,v 1.8 2004/11/24 16:29:43 x2000habouzit Exp $
+ ***************************************************************************/
+
+require_once("xorg.inc.php");
+new_skinned_page('carva_redirect.tpl', AUTH_MDP);
+
+if (isset($_REQUEST['submit']) and ($_REQUEST['submit'] == "Valider" or $_REQUEST['submit'] == "Modifier") and isset($_REQUEST['url'])) {
+    // on change la redirection (attention à http://)
+    $globals->db->query("update auth_user_md5 set redirecturl = '{$_REQUEST['url']}'"
+              ." where user_id = '{$_SESSION['uid']}'");
+    if (mysql_errno($conn) == 0) {
+        $_SESSION['log']->log("carva_add","http://".$_REQUEST['url']);
+        $page->assign('message',"<p class='normal'>Redirection activée vers <a href='http://"
+                .$_REQUEST['url']."'>{$_REQUEST['url']}</a></p>\n");
+    } else {
+        $page->assign('message',"<p class='erreur'>Erreur de mise à jour</p>\n");
+    }
+} elseif (isset($_REQUEST['submit']) and $_REQUEST['submit'] == "Supprimer") {
+    // on supprime la redirection
+    $globals->db->query("update auth_user_md5 set redirecturl = '' where user_id = {$_SESSION['uid']}");
+    if (mysql_errno($conn) == 0) {
+        $_SESSION['log']->log("carva_del",$_REQUEST['url']);
+        $_POST['url'] = '';
+        $page->assign('message',"<p class='normal'>Redirection supprimée</p>");
+    } else {
+        $page->assign('message',"<p class='erreur'>Erreur de suppression</p>\n");
+    }
+}
+
+
+$result = $globals->db->query("select redirecturl from auth_user_md5 where user_id={$_SESSION['uid']}");
+list($carva) = mysql_fetch_row($result);
+mysql_free_result($result);
+$page->assign('carva', $carva);
+
+$page->run();
+?>
index 4afb76b..8993fe3 100644 (file)
@@ -52,7 +52,7 @@ if (array_key_exists('quick', $_REQUEST)) {
                        IF(u.prenom!="",u.prenom,u.prenom_ini) AS prenom,
                        u.promo AS promo,
                        a.alias AS forlife,
-                       '.$globals->search_result_fields.'
+                       '.$globals->search->result_fields.'
                        c.uid AS contact,
                       w.ni_id AS watch
                  FROM  auth_user_md5  AS r
@@ -60,26 +60,26 @@ if (array_key_exists('quick', $_REQUEST)) {
             LEFT JOIN  aliases        AS a   ON (u.user_id = a.id AND a.type="a_vie")
             LEFT JOIN  contacts       AS c   ON (c.uid='.((array_key_exists('uid',$_SESSION))?$_SESSION['uid']:0).' AND c.contact=u.user_id)
             LEFT JOIN  watch_nonins   AS w   ON (w.ni_id=u.user_id AND w.uid='.((array_key_exists('uid',$_SESSION))?$_SESSION['uid']:0).')
-            '.$globals->search_result_where_statement.'
+            '.$globals->search->result_where_statement.'
                 WHERE  '.$fields->get_where_statement().'
                HAVING  mark>0
              ORDER BY  '.(logged() && !empty($_REQUEST['mod_date_sort']) ? 'date DESC,' :'')
                        .implode(',',array_filter(array($fields->get_order_statement(),'u.promo DESC,NomSortKey,prenom'))).'
-                LIMIT  '.$offset->value.','.$globals->search_results_per_page;
+                LIMIT  '.$offset->value.','.$globals->search->per_page;
 
     $page->mysql_assign($sql, 'resultats', 'nb_resultats','nb_resultats_total');
     echo mysql_error();
     
-    $nbpages = ($page->get_template_vars('nb_resultats_total')-1)/$globals->search_results_per_page;
+    $nbpages = ($page->get_template_vars('nb_resultats_total')-1)/$globals->search->per_page;
     $page->assign('offsets',range(0,$nbpages));
     $page->assign('url_args',$fields->get_url());
     $page->assign('mod_date_sort',!empty($_REQUEST['mod_date_sort']));
     $page->assign('offset',$offset->value);
-    $page->assign('perpage',$globals->search_results_per_page);
+    $page->assign('perpage',$globals->search->per_page);
     $page->assign('is_admin',has_perms());
     
     if (!logged() &&
-       $page->get_template_vars('nb_resultats_total')>$globals->public_max_search_results)
+       $page->get_template_vars('nb_resultats_total')>$globals->search->public_max)
     {
        new ThrowError('Votre recherche a généré trop de résultats pour un affichage public.');
     }
similarity index 87%
rename from bin/devel/foobar.php
rename to include/conf.d/search.globals.inc.php
index 42d4d62..00ab2c4 100644 (file)
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-    $Id: foobar.php,v 1.4 2004/11/22 11:16:34 x2000habouzit Exp $
+    $Id: banana.globals.inc.php,v 1.2 2004/12/01 14:25:44 x2000habouzit Exp $
  ***************************************************************************/
 
-require('xorg.inc.php');
+// {{{ class SearchConfig
+
+class SearchConfig
+{
+    var $public_max = 25;
+    var $per_page   = 20;
+}
+
+// }}}
+
+$this->search = new SearchConfig;
 
 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
 ?>
index d43620e..e22c9cc 100644 (file)
@@ -26,7 +26,7 @@ require_once("xorg.misc.inc.php");
 /*
  * Variables globales pour l'affichage des résultats de la recherche
  */
-$globals->search_result_fields = '
+$globals->search->result_fields = '
                if(u.epouse=\'\', u.nom, u.epouse) AS NomSortKey,
                 u.epouse,u.date,u.web,u.mobile,
                 u.deces!=0 AS dcd,u.deces,
@@ -38,7 +38,7 @@ $globals->search_result_fields = '
                 e.entreprise, es.label AS secteur, ef.fonction_fr AS fonction,
                 IF(n.nat=\'\',n.pays,n.nat) AS nat, n.a2 AS iso3166,
                 adr.ville, gp.pays, gr.name AS region,';
-$globals->search_result_where_statement = '
+$globals->search->result_where_statement = '
                 LEFT JOIN  applis_ins     AS ai0 ON (u.user_id = ai0.uid AND ai0.ordre = 0)
                 LEFT JOIN  applis_def     AS ad0 ON (ad0.id = ai0.aid)
                 LEFT JOIN  applis_ins     AS ai1 ON (u.user_id = ai1.uid AND ai1.ordre = 1)
index 3478269..c3ffeda 100644 (file)
@@ -15,7 +15,7 @@ htdocs/banana/include/subscribe.inc.php
 htdocs/banana/index.php
 htdocs/banana/install.sh
 htdocs/banana/post.php
-htdocs/banana/bin/spoolgen.php
+htdocs/banana/scripts/spoolgen.php
 htdocs/banana/subscribe.php
 htdocs/banana/thread.php
 htdocs/banana/xface.php
index 10a4a07..33d80c3 100644 (file)
@@ -13,16 +13,6 @@ htdocs/listes/archives.php
 include/validations/listes.inc.php
 bin/mailman/foreach_template.py
 bin/mailman/mailman-rpc.py
-bin/mailman/mails/adminsubscribeack.txt
-bin/mailman/mails/approve.txt
-bin/mailman/mails/checkdbs.txt
-bin/mailman/mails/masthead.txt
-bin/mailman/mails/newlist.txt
-bin/mailman/mails/postauth.txt
-bin/mailman/mails/postheld.txt
-bin/mailman/mails/refuse.txt
-bin/mailman/mails/subauth.txt
-bin/mailman/mails/subscribeack.txt
 templates/admin/lists.tpl
 templates/include/form.valid.listes.tpl
 templates/include/form.valid.ml.tpl
index 7009c98..49e6db0 100644 (file)
@@ -1,8 +1,5 @@
 include/conf.d/README
 
-bin/devel/foobar.php
-bin/devel/foobar.pl
-bin/devel/foobar.tpl
 bin/devel/modules_status
 bin/devel/tplgettext.php
 
index f3cf898..c5f6e2c 100755 (executable)
@@ -18,7 +18,7 @@ function mailman_stop() {
 
 function mailman_templates() {
     echo -n "copies new mails templates"
-    cp -f ../../scripts/mailman/mails/*.txt /etc/mailman/fr/
+    cp -f ../install.d/lists/mail_templates/*.txt /etc/mailman/fr/
     echo .
 }