Table editor fills the new entry form with the default values of the fields
[platal.git] / modules / xnet.php
index fc45365..f3cf0f9 100644 (file)
@@ -25,31 +25,46 @@ class XnetModule extends PLModule
     {
         return array(
             'index'     => $this->make_hook('index',     AUTH_PUBLIC),
+            'login'     => $this->make_hook('login',     AUTH_MDP),
             'exit'      => $this->make_hook('exit',      AUTH_PUBLIC),
 
             'admin'     => $this->make_hook('admin',     AUTH_MDP, 'admin'),
             'groups'    => $this->make_hook('groups',    AUTH_PUBLIC),
             'groupes.php' => $this->make_hook('groups2', AUTH_PUBLIC),
             'plan'      => $this->make_hook('plan',      AUTH_PUBLIC),
+            'send_bug'  => $this->make_hook('bug',       AUTH_MDP),
         );
     }
 
+    function handler_bug(&$page)
+    {
+        $this->handler_index(&$page);
+        $page->assign('bug', 1);
+    }
+    
     function handler_index(&$page)
     {
+        $page->nomenu = true;
         $page->changeTpl('xnet/index.tpl');
     }
 
+    function handler_login(&$page)
+    {
+        $allkeys = func_get_args();
+        unset($allkeys[0]);
+        $url = join('/',$allkeys);
+        pl_redirect($url);
+    }
+
     function handler_exit(&$page)
     {
         XnetSession::destroy();
         $page->changeTpl('xnet/deconnexion.tpl');
-        $page->useMenu();
     }
 
     function handler_admin(&$page)
     {
         new_admin_page('xnet/admin.tpl');
-        $page->useMenu();
 
         if (Get::has('del')) {
             $res = XDB::query('SELECT id, nom, mail_domain
@@ -68,11 +83,10 @@ class XnetModule extends PLModule
                                                 WHERE  alias LIKE {?}', '%@'.$domain);
                     $page->trig('suppression des alias mails');
 
-                    require_once('lists.inc.php');
-                    $client =& lists_xmlrpc(S::v('uid'), S::v('password'), $domain);
-                    if ($listes = $client->get_lists()) {
+                    $mmlist = new MMList(S::v('uid'), S::v('password'), $domain);
+                    if ($listes = $mmlist->get_lists()) {
                         foreach ($listes as $l) {
-                            $client->delete_list($l['list'], true);
+                            $mmlist->delete_list($l['list'], true);
                         }
                         $page->trig('mail lists surpprimées');
                     }
@@ -136,7 +150,6 @@ class XnetModule extends PLModule
                   WHERE  FIND_IN_SET("Institutions", cat)
                ORDER BY  diminutif');
         $page->assign('inst', $res);
-        $page->useMenu();
     }
 
     function handler_groups2(&$page)
@@ -163,18 +176,17 @@ class XnetModule extends PLModule
         $page->assign('doms', $doms);
 
         if (empty($doms)) {
-            $res = XDB::query("SELECT diminutif, nom FROM groupex.asso
+            $res = XDB::query("SELECT diminutif, nom, site FROM groupex.asso
                                    WHERE FIND_IN_SET({?}, cat)
                                 ORDER BY nom", $cat);
             $page->assign('gps', $res->fetchAllAssoc());
         } elseif (!is_null($dom)) {
-            $res = XDB::query("SELECT diminutif, nom FROM groupex.asso
+            $res = XDB::query("SELECT diminutif, nom, site FROM groupex.asso
                                 WHERE FIND_IN_SET({?}, cat) AND dom={?}
                              ORDER BY nom", $cat, $dom);
             $page->assign('gps', $res->fetchAllAssoc());
         }
 
-        $page->useMenu();
         $page->setType($cat);
     }
 }