Allow \t in xml sent by lists.rpc
authorx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Tue, 16 Jan 2007 21:18:04 +0000 (21:18 +0000)
committerx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Tue, 16 Jan 2007 21:18:04 +0000 (21:18 +0000)
Update banana support to allow css based html rendering

git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1348 839d8a87-29fc-0310-9880-83ba4fa771e5

bin/lists.rpc.py
classes/platalpage.php
classes/plmailer.php
include/banana/ml.inc.php
include/banana/moderate.inc.php
modules/banana.php
modules/lists.php
templates/skin/common.header.tpl

index ed311c9..671b365 100755 (executable)
@@ -171,7 +171,7 @@ def quote(s, is_header=False):
         h = Utils.oneline(s, 'iso-8859-1')
     else:
         h = s
-    h = str('').join(re.split('[\x00-\x09\x0B-\x1f]+', h))
+    h = str('').join(re.split('[\x00-\x08\x0B-\x1f]+', h))
     return Utils.uquote(h.replace('&', '&amp;').replace('>', '&gt;').replace('<', '&lt;')) 
 
 def to_forlife(email):
@@ -576,7 +576,7 @@ def get_pending_mail(userdesc, perms, vhost, listname, id, raw=0):
         mlist.Unlock()
 
         if raw:
-            return str(msg)
+            return quote(str(msg))
         results_plain = []
         results_html  = []
         for part in typed_subpart_iterator(msg, 'text', 'plain'):
index 25112c2..ee56a9d 100644 (file)
@@ -184,6 +184,16 @@ class PlatalPage extends Smarty
     }
 
     // }}}
+    // {{{ function addCssInline
+
+    function addCssInline($css)
+    {
+        if (!empty($css)) {
+            $this->append('xorg_inline_css', $css);
+        }    
+    }
+
+    // }}}
     // {{{ function setRssLink
 
     function setRssLink($title, $path)
index dd5f81d..151df42 100644 (file)
@@ -21,8 +21,6 @@
 
 require_once('smarty/libs/Smarty.class.php');
 
-// {{{ class PlMail
-
 /** Classe de mail avec corps en templates.
  */
 class PlMail extends Smarty
index 97e43aa..00301d9 100644 (file)
@@ -39,7 +39,7 @@ class MLBanana extends Banana
         Banana::$spool_boxlist = false;
         Banana::$msgedit_canattach = true;
         array_push(Banana::$msgparse_headers, 'x-org-id', 'x-org-mail');
-         
+
         MLBanana::$listname = $params['listname'];
         MLBanana::$domain   = $params['domain'];
         $params['group'] = $params['listname'] . '@' . $params['domain'];
index d2d077c..4458662 100644 (file)
@@ -66,6 +66,7 @@ class ModerationBanana extends Banana
         Banana::$spool_boxlist = false;
         Banana::$msgshow_withthread = false;
         Banana::$withtabs      = false;
+        Banana::$msgshow_externalimages = false;
         array_push(Banana::$msgparse_headers, 'x-org-id', 'x-org-mail');
         parent::__construct($params, 'MLInterface', 'ModerationPage');
     }
@@ -143,7 +144,7 @@ class BananaMLInterface implements BananaProtocoleInterface
         $message = null;
         $msg = ModerationBanana::$client->get_pending_mail(ModerationBanana::$listname, $id, 1);
         if ($msg) {
-            $message = new BananaMessage($msg);
+            $message = new BananaMessage(html_entity_decode($msg));
         }
         return $message;
     }
index efa90c0..ea857c5 100644 (file)
@@ -144,7 +144,6 @@ class BananaModule extends PLModule
     static function run_banana(&$page, $params = null)
     {
         $page->changeTpl('banana/index.tpl');
-        $page->addCssLink('banana.css');
         $page->assign('xorg_title','Polytechnique.org - Forums & PA');
 
         require_once 'banana/forum.inc.php';
@@ -153,6 +152,8 @@ class BananaModule extends PLModule
         $res = $banana->run();
         $page->assign_by_ref('banana', $banana);
         $page->assign('banana_res', $res);
+        $page->addCssInline($banana->css());
+        $page->addCssLink('banana.css');
     }
 }
 
index 31c6965..38cc4cb 100644 (file)
@@ -361,6 +361,7 @@ class ListsModule extends PLModule
             require_once('banana/ml.inc.php');
             $banana = new MLBanana($get);
             $page->assign('banana', $banana->run());
+            $page->addCssInline($banana->css());
             $page->addCssLink('banana.css');
         } else {
             $page->kill("La liste n'existe pas ou tu n'as pas le droit de la consulter");
@@ -443,6 +444,7 @@ class ListsModule extends PLModule
                 $params = array('listname' => $liste, 'domain' => $domain, 'artid' => Get::i('mid'), 'part' => Get::v('part'));
                 $banana = new ModerationBanana($params, $this->client);
                 $res    = $banana->run();
+                $page->addCssInline($banana->css());
 
                 $msg = file_get_contents('/etc/mailman/fr/refuse.txt');
                 $msg = str_replace("%(adminaddr)s", "$liste-owner@{$domain}", $msg);
index a2bbd6e..4a3a278 100644 (file)
     {foreach from=$xorg_css item=css}
     <link rel="stylesheet" type="text/css" href="css/{$css}" media="all"/>
     {/foreach}
+    {foreach from=$xorg_inline_css item=css}
+    <style type="text/css">
+    {$css|smarty:nodefaults}
+    </style>
+    {/foreach}
     <link rel="stylesheet" type="text/css" href="css/print.css" media="print"/>
     {foreach from=$xorg_js item=js}
     <script type="text/javascript" src="javascript/{$js}"></script>