Displays marketing text to the marketer.
authorStéphane Jacob <sj@m4x.org>
Wed, 4 Nov 2009 23:48:17 +0000 (00:48 +0100)
committerStéphane Jacob <sj@m4x.org>
Sat, 7 Nov 2009 13:05:23 +0000 (14:05 +0100)
modules/marketing.php
templates/marketing/public.tpl

index 5b4af06..a0123ef 100644 (file)
@@ -311,6 +311,23 @@ class MarketingModule extends PLModule
                     $market->add();
                 }
             }
+        } else {
+            global $globals;
+            require_once 'marketing.inc.php';
+
+            $sender = User::getSilent(S::v('uid'));
+            $market = new AnnuaireMarketing(null, null);
+            $text = $market->getText(array(
+                'sexe'           => $user->isFemale(),
+                'forlife_email'  => $user->login() . '@' . $globals->mail->domain,
+                'forlife_email2' => $user->login() . '@' . $globals->mail->domain2
+            ));
+            $perso_signature = '"' . $sender->fullName() . '" <' . $sender->bestEmail() . '>';
+            $text = preg_replace("{-- (.|\n)*}",
+                                "-- \n<span id=\"sender\">" . $perso_signature . '</span>', $text);
+            $page->assign('text', nl2br($text));
+            $page->assign('xorg_signature', str_replace("\n", '<br />', $market->getSignature()));
+            $page->assign('perso_signature', $perso_signature);
         }
     }
 
index 5b48c3d..a810568 100644 (file)
@@ -87,15 +87,35 @@ peut sans aucun doute l'aider à se décider&nbsp;!
     <tr class="impair">
       <td>Nous lui écrirons&nbsp;:</td>
       <td>
-        <label><input type="radio" name="origine" value="user" checked="checked" /> en ton nom</label><br />
-        <label><input type="radio" name="origine" value="staff" /> au nom de l'équipe Polytechnique.org</label>
+        <label>
+          <input type="radio" name="origine" value="user" checked="checked"
+                 onclick="$('#sender').html('{$perso_signature}');" />
+          en ton nom
+        </label><br />
+        <label>
+          <input type="radio" name="origine" value="staff"
+                 onclick='$("#sender").html("{$xorg_signature}");' />
+          au nom de l'équipe Polytechnique.org
+        </label>
       </td>
     </tr>
   </table>
-  <div>
+  <div class="center">
     <br />
     <input type="submit" name="valide" value="Valider" />
+    <br />
+    <br />
   </div>
+  <table class="bicol" summary="Texte de l'email">
+    <tr>
+      <th colspan="2">Texte de l'email</th>
+    </tr>
+    <tr>
+      <td colspan="2">
+        {$text|smarty:nodefaults}
+      </td>
+    </tr>
+  </table>
 </form>
 {/if}