really closes #184
authorx2000habouzit <x2000habouzit>
Sat, 27 Nov 2004 19:00:32 +0000 (19:00 +0000)
committerx2000habouzit <x2000habouzit>
Sat, 27 Nov 2004 19:00:32 +0000 (19:00 +0000)
ChangeLog
htdocs/listes/delete.php [new file with mode: 0644]
templates/listes/delete.tpl [new file with mode: 0644]
templates/listes/header_listes.tpl

index 2626785..725a3a9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -39,7 +39,7 @@ Bug/Wish :
                - #83,208,222 : New fiche.                                                                                      -MC
        
        * Lists :
-               - #184 : XML-RPC now know how to delete a list.                                         -MC
+               - #184 : Owners can now delete their lists.                                                     -MC
                - #231 : Add a link to the user's fiche on moderation page.                     -MC
 
        * Search :
diff --git a/htdocs/listes/delete.php b/htdocs/listes/delete.php
new file mode 100644 (file)
index 0000000..f8b38ad
--- /dev/null
@@ -0,0 +1,45 @@
+<?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: delete.php,v 1.1 2004-11-27 19:00:32 x2000habouzit Exp $
+ ***************************************************************************/
+
+if(empty($_REQUEST['liste'])) header('Location: index.php');
+$liste = strtolower($_REQUEST['liste']);
+
+require_once("xorg.inc.php");
+new_skinned_page('listes/delete.tpl', AUTH_MDP);
+require_once('xml-rpc-client.inc.php');
+
+$client = new xmlrpc_client("http://{$_SESSION['uid']}:{$_SESSION['password']}@localhost:4949/polytechnique.org");
+
+if ( isset($_POST['valid']) && ($_POST['valid'] == 'OUI')
+        && $client->delete_list($liste,!empty($_POST['del_archive'])) ) {
+    $page->assign('deleted', true);
+} elseif (list($details,$options) = $client->get_owner_options($liste)) {
+    $page->assign_by_ref('details', $details);
+    $page->assign_by_ref('options', $options);
+    $page->assign('bogo_level', $client->get_bogo_level($liste));
+} else {
+    $page->assign('no_list', true);
+}
+
+$page->run();
+?>
diff --git a/templates/listes/delete.tpl b/templates/listes/delete.tpl
new file mode 100644 (file)
index 0000000..3fc230c
--- /dev/null
@@ -0,0 +1,78 @@
+{***************************************************************************
+ *  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 : admin.tpl,v 1.4 2004/09/23 18:47:00 x2000habouzit Exp $
+ ***************************************************************************}
+
+{dynamic}
+
+{if $no_list || ( !$details.own && $smarty.session.perms neq admin )}
+
+<p class='erreur'>La liste n'existe pas ou tu n'as pas le droit de l'administrer</p>
+
+{else}
+
+{if $deleted}
+
+<p>[<a href='index.php'>Voir toutes les listes</a>]</p>
+<p class="erreur">La liste a été détruite !</p>
+
+{else}
+
+{if !$details.own}
+<p class='erreur'>
+Tu n'es pas administrateur de la liste, mais du site.
+</p>
+{/if}
+
+{include file="listes/header_listes.tpl" on=delete}
+
+<h1>
+  Détruire la liste {$details.addr} ?
+</h1>
+
+<form method='post' action='{$smarty.server.REQUEST_URI}'>
+  <table class='tinybicol' cellpadding='2' cellspacing='0'>
+    <tr class='impair'>
+      <td>
+        Veux tu réellement détruire la liste {$details.addr} ?<br />
+        Pour valider ton choix, écris en majuscules (sans espace) « OUI » :
+        <input type='text' size='3' maxlength='3' name="valid" />
+      </td>
+    </tr>
+    <tr class='pair'>
+      <td>
+        Si tu veux préserver les archives de la liste, décoche la case ci-contre.
+        <input type="checkbox" checked="checked" name="del_archive" />
+      </td>
+    </tr>
+    <tr class='impair'>
+      <td class="center">
+        <input type="submit" value="Détruire !" />
+      </td>
+    </tr>
+  </table>
+</form>
+{/if}
+
+{/if}
+
+{/dynamic}
+
+{* vim:set et sw=2 sts=2 sws=2: *}
index 352d377..73b653c 100644 (file)
@@ -17,7 +17,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: header_listes.tpl,v 1.2 2004-11-07 14:58:35 x2000habouzit Exp $
+        $Id: header_listes.tpl,v 1.3 2004-11-27 19:00:33 x2000habouzit Exp $
  ***************************************************************************}
 
 {dynamic}
@@ -45,7 +45,7 @@
   </tr>
   {if $details.own || $smarty.session.perms eq admin}
   <tr>
-    <td><strong>Administration de la liste :</strong></td>
+    <td><strong>Administrer la liste :</strong></td>
     <td>
       {if $on neq moderate}
       [<a href='moderate.php?liste={$smarty.get.liste}'>modération</a>]
       {else}
       [options]
       {/if}
+      {if $on neq delete}
+      [<a href='delete.php?liste={$smarty.get.liste}'>détruire liste</a>]
+      {else}
+      [détruire liste]
+      {/if}
     </td>
   </tr>
   {/if}
   {perms level=admin}
   <tr>
-    <td><strong>Administration avancée :</strong></td>
+    <td><strong>Administrer (avancé) :</strong></td>
     <td>
       {if $on neq soptions}
       [<a href='soptions.php?liste={$smarty.get.liste}'>options avancées</a>]