Relook wiki administration page to show the tree structure of the site
authorx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Fri, 22 Dec 2006 15:14:13 +0000 (15:14 +0000)
committerx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Fri, 22 Dec 2006 15:14:13 +0000 (15:14 +0000)
git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1309 839d8a87-29fc-0310-9880-83ba4fa771e5

htdocs/images/L.gif [new file with mode: 0644]
htdocs/images/T.gif [new file with mode: 0644]
htdocs/images/k2.gif [new file with mode: 0644]
modules/admin.php
modules/newsletter.php
templates/admin/wiki.tpl

diff --git a/htdocs/images/L.gif b/htdocs/images/L.gif
new file mode 100644 (file)
index 0000000..171dcb6
Binary files /dev/null and b/htdocs/images/L.gif differ
diff --git a/htdocs/images/T.gif b/htdocs/images/T.gif
new file mode 100644 (file)
index 0000000..cf2335f
Binary files /dev/null and b/htdocs/images/T.gif differ
diff --git a/htdocs/images/k2.gif b/htdocs/images/k2.gif
new file mode 100644 (file)
index 0000000..37eb368
Binary files /dev/null and b/htdocs/images/k2.gif differ
index ecb35d7..829bec4 100644 (file)
@@ -860,7 +860,9 @@ class AdminModule extends PLModule
         $table_editor->describe('description','description',false);
         $table_editor->apply($page, $action, $id);
     }
-    function handler_wiki(&$page, $action='list') {
+
+    function handler_wiki(&$page, $action='list')
+    {
         require_once 'wiki.inc.php';
 
         // update wiki perms
@@ -896,9 +898,19 @@ class AdminModule extends PLModule
             }
         }
         ksort($wiki_pages);
+        $wiki_tree = array();
+        foreach ($wiki_pages as $file => $desc) {
+            list($cat, $name) = explode('.', $file);
+            if (!isset($wiki_tree[$cat])) {
+                $wiki_tree[$cat] = array();
+            }
+            $wiki_tree[$cat][$name] = $desc;
+        }
+
+
 
         $page->changeTpl('admin/wiki.tpl');
-        $page->assign('wiki_pages', $wiki_pages);
+        $page->assign('wiki_pages', $wiki_tree);
         $page->assign('perms_opts', $perms);
     }
 }
index 87ba7a1..4eae2c0 100644 (file)
@@ -30,6 +30,12 @@ class NewsletterModule extends PLModule
             'admin/newsletter'             => $this->make_hook('admin_nl', AUTH_MDP, 'admin'),
             'admin/newsletter/categories'  => $this->make_hook('admin_nl_cat', AUTH_MDP, 'admin'),
             'admin/newsletter/edit'        => $this->make_hook('admin_nl_edit', AUTH_MDP, 'admin'),
+
+            'ax'             => $this->make_hook('ax',        AUTH_COOKIE),
+            'ax/show'        => $this->make_hook('ax_show',   AUTH_COOKIE),
+            'ax/submit'      => $this->make_hook('ax_submit', AUTH_MDP),
+            'ax/edit'        => $this->make_hook('ax_submit', AUTH_MDP),
+            'admin/axletter/rights'        => $this->make_hook('admin_ax_rights', AUTH_MDP, 'admin'),
         );
     }
 
@@ -154,8 +160,41 @@ class NewsletterModule extends PLModule
         $table_editor->describe('titre','intitulé',true);
         $table_editor->describe('pos','position',true);
         $table_editor->apply($page, $action, $id);
-    }    
-    
+    }
+
+    function handler_ax(&$page, $action = null)
+    {
+        require_once 'newsletter.inc.php';
+
+        $page->changeTpl('newsletter/ax.tpl');
+        $page->assign('xorg_title','Polytechnique.org - Envois de l\'AX');
+
+        switch ($action) {
+          case 'out': AXLetter::unsubscribe(); break;
+          case 'in':  AXLetter::subscribe(); break;
+          default: ;
+        }
+
+        $perm = AXLetter::hasPerms();
+        if ($perm) {
+            $waiting = AXLetter::awaiting();
+            if ($waiting) {
+                $new = new AXLetter($waiting);
+                $page->assign('new', $new);
+            }
+        }
+        $page->assign('axs', AXLetter::subscriptionState());
+        $page->assign('ax_list', AXLetter::listSent());
+        $page->assign('ax_rights', AXLetter::hasPerms());
+    }
+
+    function handler_ax_submit(&$page)
+    {
+        require_once('newsletter.inc.php');
+        if (!AXLetter::hasPerms()) {
+            return PL_FORBIDDEN;
+        }
+    }
 }
 
 ?>
index 84204d0..2320245 100644 (file)
       action
     </th>
   </tr>
-{foreach from=$wiki_pages item=perm key=page}
-  <tr class="{cycle values="impair,pair"}">
-    <td>
-      <a href="{$page|replace:'.':'/'}">{$page}</a> <a href="{$page|replace:'.':'/'}?action=edit" class="indice">{icon name=page_edit title='éditer'}</a>
+{foreach from=$wiki_pages key=cat item=pages}
+  <tr class="pair">
+    <td colspan="4" style="margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0; height: 20px">
+      <img src="images/k2.gif" alt="-" width="9" height="21" />
+      {$cat}
+    </td>
+  </tr>
+{foreach from=$pages item=perm key=page name=pages}
+  <tr class="impair" onmouseover="this.className='pair';" onmouseout="this.className='impair';">
+    <td style="margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0; height: 20px">
+      {if $smarty.foreach.pages.last}
+      <img src="images/L.gif" alt="L" width="12" height="21" />
+      {else}
+      <img src="images/T.gif" alt="|" style="width: 12px: height: 21px" />
+      {/if}
+      <a href="{$cat}/{$page}">{$page}</a> <a href="{$cat}/{$page}?action=edit" class="indice">{icon name=page_edit title='éditer'}</a>
     </td>
-    <td class="center">
+    <td class="center" style="margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0; height: 20px">
       {$perm.read}
     </td>
-    <td class="center">
+    <td class="center" style="margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0; height: 20px">
       {$perm.edit}
     </td>
-    <td class="action">
-      <input type="checkbox" name="{$page|replace:'.':'/'}"/>
+    <td class="action" style="margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0; height: 20px">
+      <input type="checkbox" name="{$cat}/{$page}"/>
     </td>
   </tr>
 {/foreach}
-  <tr>
+{/foreach}
+  <tr class="pair">
     <td class="action" colspan="4">
       <span onclick="check_all_boxes('update_pages', true)">{icon name=tick title='tout cocher'}</span>
       <span onclick="check_all_boxes('update_pages', false)">{icon name=cross title='tout décocher'}</span>
       <span onclick="check_all_boxes('update_pages', 'toggle')">{icon name=arrow_refresh title='toggle'}</span>
     </td>
   </tr>
-  <tr>
+  <tr class="pair">
     <td>
       Attribue les permissions aux pages cochées :
     </td>