Code

Messages base64 encoded Closes #450
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 30 Apr 2008 12:32:09 +0000 (12:32 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 30 Apr 2008 12:32:09 +0000 (12:32 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10745 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/addons/goto/events/DaemonEvent_notify.tpl
gosa-plugins/goto/addons/goto/events/class_DaemonEvent_notify.inc

index 1499e46fa1e7a1dd9328fef4f8ed5ef9c924b3e6..479dafb61409ee02ee33773aae4c7c53c56863fa 100644 (file)
@@ -6,6 +6,10 @@
     <td style='width:50%; vertical-align:top; border-right:1px solid #AAA'>
          <b>{t}Message settings{/t}</b>
          <table style="width:100%;">
+               <tr>
+                       <td>{t}Sender{/t}</td>
+                       <td><input type='text' name="from" value="{$from}" style="width:100%;"></td>
+               </tr>
                <tr>
                        <td>{t}Subject{/t}</td>
                        <td><input type='text' name="subject" value="{$subject}" style="width:100%;"></td>
index 0f0365bc9c057efd1a66ad73eabffd54856c87f4..16a2796f9e96518f62170681655347d1dc52bfd2 100644 (file)
@@ -29,10 +29,17 @@ class DaemonEvent_notify extends DaemonEvent
 
   var $message = "";
   var $subject = "";
+  var $from    = "";
 
   public function __construct($config,$data = array())
   {
     DaemonEvent::__construct($config,$data);
+
+    $ui = get_userinfo();
+    $this->from = $ui->cn; 
+    $this->message = base64_decode($this->message);
+
     $this->s_Menu_Name  = _("Send message");
     $this->s_Event_Name = _("Send message");
 
@@ -57,8 +64,6 @@ class DaemonEvent_notify extends DaemonEvent
     $display = $this->get_header();
     $tmp = $this->data;
     $smarty = get_smarty();
-    $smarty->assign("subject" ,"subject");
-    $smarty->assign("message" ,"message");
     $smarty->assign("data"        , $this->data);
     $smarty->assign("is_new"      , $this->is_new);
     $smarty->assign("timestamp"   , $this->get_time_select());
@@ -69,6 +74,7 @@ class DaemonEvent_notify extends DaemonEvent
     $smarty->assign("add_str", msgPool::addButton(_("Target")));
     $smarty->assign("del_str", msgPool::delButton(_("Target")));
 
+    $smarty->assign("from",    xmlentities($this->from));
     $smarty->assign("subject", xmlentities($this->subject));
     $smarty->assign("message", xmlentities($this->message));
 
@@ -87,6 +93,9 @@ class DaemonEvent_notify extends DaemonEvent
     if(empty($this->message)){
       $msgs[] = msgPool::required(_("Message"));
     }
+    if(empty($this->from)){
+      $msgs[] = msgPool::required(_("From"));
+    }
     if(!count($this->groups) && !count($this->users)){
       $msgs[] = msgPool::required(_("Target"));
     }
@@ -119,6 +128,9 @@ class DaemonEvent_notify extends DaemonEvent
     if(isset($_POST['message'])){
       $this->message = get_post('message');
     }
+    if(isset($_POST['from'])){
+      $this->from = get_post('from');
+    }
   }
 
   public function add_users($targets)
@@ -187,7 +199,8 @@ class DaemonEvent_notify extends DaemonEvent
     $ret['users']   = array_values($this->users);
     $ret['groups']  = array_values($this->groups);
     $ret['subject'] = $this->subject;
-    $ret['message'] = $this->message;
+    $ret['from']    = $this->from;
+    $ret['message'] = base64_encode($this->message);
     return($ret);
   }
 }