Code

Updated notifications
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 3 Mar 2008 16:47:05 +0000 (16:47 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 3 Mar 2008 16:47:05 +0000 (16:47 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9264 594d385d-05f5-0310-b6e9-bd551577e9d8

14 files changed:
gosa-plugins/messaging/addons/messaging/class_msgplug.inc [new file with mode: 0644]
gosa-plugins/messaging/addons/messaging/contents.tpl [new file with mode: 0644]
gosa-plugins/messaging/addons/messaging/main.inc [new file with mode: 0644]
gosa-plugins/messaging/class_msgplug.inc [new file with mode: 0644]
gosa-plugins/messaging/contents.tpl [new file with mode: 0644]
gosa-plugins/messaging/main.inc [new file with mode: 0644]
gosa-plugins/messaging/plugin.dsc [new file with mode: 0644]
gosa-plugins/notifications/addons/messaging/class_msgplug.inc [deleted file]
gosa-plugins/notifications/addons/messaging/contents.tpl [deleted file]
gosa-plugins/notifications/addons/messaging/main.inc [deleted file]
gosa-plugins/notifications/class_msgplug.inc [deleted file]
gosa-plugins/notifications/contents.tpl [deleted file]
gosa-plugins/notifications/main.inc [deleted file]
gosa-plugins/notifications/plugin.dsc [deleted file]

diff --git a/gosa-plugins/messaging/addons/messaging/class_msgplug.inc b/gosa-plugins/messaging/addons/messaging/class_msgplug.inc
new file mode 100644 (file)
index 0000000..cbc098d
--- /dev/null
@@ -0,0 +1,258 @@
+<?php
+
+class msgplug extends plugin
+{
+  /* Definitions */
+  var $plHeadline= "Notifications";
+  var $plDescription= "Send user notifications";
+
+  /* attribute list for save action */
+  var $attributes= array("target", "nmessage");
+  var $objectclasses= array();
+
+  /* Helpers */
+  var $target= "group";
+  var $nmessage= "";
+
+  var $targets= array();
+  var $users= array();
+  var $groups= array();
+  var $recipients= array();
+  var $show_templates= false;
+  var $templates= array();
+  var $template= "";
+  var $finalized= false;
+  var $module = "msgplug";
+  var $view_logged = FALSE;
+
+  function msgplug (&$config, $dn= NULL)
+  {
+    /* Include config object */
+    $this->config= &$config;
+    $ui= get_userinfo();
+    $tag= $ui->gosaUnitTag;
+
+    /* Preset values */
+    $this->targets= array("user" => _("Users"), "group" => _("Groups"));
+    asort($this->targets);
+
+    $res = get_list("(objectClass=gosaAccount)", "users", $this->config->current['BASE'],array('uid', 'cn'),GL_SUBSEARCH);
+    foreach($res as $key => $attrs){
+      $this->users['U:'.$attrs['uid'][0]]= $attrs['cn'][0].' ['.$attrs['uid'][0].']';
+    }
+    ksort($this->users);
+
+    $res = get_list("(objectClass=posixGroup)", "groups", $this->config->current['BASE'],array('cn','description'));
+    foreach($res as $key => $attrs){
+      $dsc= "";
+      if (isset($attrs['description'][0])){
+        $dsc= $attrs['description'][0];
+      }
+      $this->groups['G:'.$attrs['cn'][0]]= $attrs['cn'][0].' ['.$dsc.']';
+    }
+    ksort($this->users);
+
+
+    /* Load templates */
+    if (isset($this->config->current['NOTIFYDIR'])){
+      $dir= $this->config->current['NOTIFYDIR'];
+      if (is_dir($dir) && is_readable($dir)){
+
+        /* Look for files and build the vacation array */
+        $dh= opendir($dir);
+        while ($file = readdir($dh)){
+          $description= $this->parse_notification("$dir/$file");
+          if ($description != ""){
+            $this->templates["$dir/$file"]= $description;
+          }
+        }
+        closedir($dh);
+      }
+
+      /* Enable templates if there are some... */
+      if (count($this->templates)){
+        $this->show_templates= true;
+      }
+    }
+  }
+
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* Log view */
+    if(!$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","msgplug/".get_class($this),$this->dn);
+    }
+
+    /* Send message? */
+    if (isset($_POST['send']) && $this->acl_is_writeable("notify")){
+
+      /* Do we have recipients? */
+      if (count($this->recipients)){
+
+        /*Permissions ok? */
+        if (!$this->acl_is_writeable('notify')){
+         msg_dialog::display(_("Permission error"), _("You have no permissions to send a message!"), ERROR_DIALOG);
+        } else {
+          $cmd= $this->config->search("msgplug", "NOTIFY_COMMAND",array('menu'));
+          if ($cmd == ""){
+           msg_dialog::display(_("Configuration error"), sprintf(_("Missing '%s' directive in configuration!"), "notify_command"), ERROR_DIALOG);
+          } else {
+            $parameters= base64_encode($this->nmessage) ." ";
+            foreach ($this->recipients as $key => $value){
+              $parameters.= "$key ";
+            }
+            exec ("$cmd $parameters", $dummy, $retval);
+            if ($retval != 0){
+              msg_dialog::display(_("Configuration error"), sprintf(_("'%s' defined for the '%s' directive cannot be executed!"), $cmd, "notify_command"), ERROR_DIALOG);
+            }
+            $this->finalized= true;
+          }
+        }
+      } else {
+       msg_dialog::display(_("Error"), _("Please specify at least one recipient to send a message!") , ERROR_DIALOG);
+      }
+    }
+
+    /* Bounce back to the original dialog */
+    if (isset($_POST['continue'])){
+      $this->finalized= false;
+    }
+
+    /* Add to list? */
+    if (isset($_POST['add']) && isset($_POST['source']) && $this->acl_is_writeable("notify")){
+      foreach ($_POST['source'] as $key){
+        if ($this->target == 'user'){
+          if(isset($this->users[$key])){
+            $this->recipients[$key]= $this->users[$key];
+          }
+        }
+        if ($this->target == 'group'){
+          if(isset($this->groups[$key])){
+            $this->recipients[$key]= $this->groups[$key];
+          }
+        }
+      }
+      ksort($this->recipients);
+    }
+
+    /* Remove from list? */
+    if (isset($_POST['del']) && isset($_POST['recipient'])){
+      foreach ($_POST['recipient'] as $key){
+          unset($this->recipients[$key]);
+      }
+    }
+
+    /* Import message? */
+    if (isset($_POST["import_template"]) && isset($this->templates[$_POST["nmessage_template"]])){
+      $contents= "";
+      $lines= file($_POST["nmessage_template"]);
+      foreach ($lines as $line){
+        if (!preg_match('/^DESC:/', $line)){
+          $contents.= $line;
+        }
+      }
+
+      /* Replace attributes */
+      $ui= get_userinfo();
+      $contents= preg_replace('/%self/', $ui->cn, $contents);
+
+      /* Save message */
+      $this->nmessage= htmlspecialchars($contents);
+    }
+
+    $smarty= get_smarty();
+
+    /* Assign possible target types */
+    $smarty->assign("targets", $this->targets);
+    foreach ($this->attributes as $attr){
+      $smarty->assign($attr, $this->$attr);
+    }
+
+    /* Generate list */
+    $tmp= array();
+    foreach (array("user" => "users", "group" => "groups") as $field => $arr){
+      if ($this->target == $field){
+        foreach ($this->$arr as $key => $value){
+          if (!isset($this->recipients[$key])){
+            $tmp[$key]= $value;
+          }
+        }
+      }
+    }
+    $smarty->assign('sources', $tmp);
+    $smarty->assign('recipients', $this->recipients);
+
+    /* Assign ACL */
+    $smarty->assign('nmessageACL', $this->getacl("notify"));
+
+    /* Handle templates */
+    $smarty->assign('show_templates', $this->show_templates?"true":"false");
+    $smarty->assign('message_templates', $this->templates);
+    $smarty->assign('template', $this->template);
+    $smarty->assign('finished', $this->finalized?"true":"false");
+
+    /* Show main page */
+    return ($smarty->fetch (get_template_path('contents.tpl', TRUE)));
+  }
+
+
+  function parse_notification($file)
+  {
+    $desc= "";
+
+    if (is_file($file)){
+      $fh = fopen($file, "r");
+      $line= fgets($fh, 256);
+
+      if (!preg_match('/^DESC:/', $line)){
+       msg_dialog::display(_("Error"), sprintf(_("Cannot find a DESC tag in file '%s'!"), $file), ERROR_DIALOG);
+        return $desc;
+      }
+      fclose ($fh);
+
+      $desc= trim(preg_replace('/^DESC:\s*/', '', $line));
+    }
+
+    return $desc;
+  }
+
+  
+  function save_object()
+  {
+    plugin::save_object();
+    foreach($this->attributes as $attr){
+      if(isset($_POST[$attr])){
+        $this->$attr = $_POST[$attr];
+      }
+    }
+  }
+
+  
+  /* Return plugin informations for acl handling */
+  static function plInfo()
+  {
+    return (array(
+        "plShortName"   => _("Notification"),
+        "plDescription" => _("Notification plugin"),
+        "plSelfModify"  => FALSE,
+        "plDepends"     => array(),
+        "plPriority"    => 89,
+        "plSection"     => array("addon"),
+        "plCategory"    => array("msgplug" => array("objectClass" => "none", "description" => _("Notification plugin"))),
+
+        "plProvidedAcls" => array(
+            "notify"          => _("Allow sending notifications")
+          )
+        ));
+  }
+
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/messaging/addons/messaging/contents.tpl b/gosa-plugins/messaging/addons/messaging/contents.tpl
new file mode 100644 (file)
index 0000000..6898696
--- /dev/null
@@ -0,0 +1,80 @@
+{if $finished eq "false"}
+<h2>{t}Notification target{/t}</h2>
+
+<table style="width:100%">
+ <tr>
+  <td style="width:48%; vertical-align:top;">
+   {t}Use target from{/t}
+   <select name="target" onChange="document.mainform.submit()">
+        {html_options options=$targets selected=$target}
+        <option disabled>&nbsp;</option>
+   </select>
+   {if $javascript eq 'false'}<input type="submit" value="{t}Apply{/t}" name="refresh">{/if}<br><br>
+  </td>
+  <td>
+  </td>
+  <td>
+  </td>
+ </tr>
+ <tr>
+  <td>
+   {t}Available recipients{/t}<br>
+   <select style="width:100%;height:180px;" name="source[]" size="20" multiple title="{t}List message possible targets{/t}">
+            {html_options options=$sources}
+           <option disabled>&nbsp;</option>
+   </select>
+  </td>
+  <td style="vertical-align:center; text-align:center">
+   <input type="submit" value="&gt;" name="add">
+   <br><br>
+   <input type="submit" value="&lt;" name="del">
+  </td>
+  <td style="width:48%; vertical-align:top;">
+   {t}Recipients{/t}<br>
+   <select style="width:100%;height:180px;" name="recipient[]" size="20" multiple title="{t}List message recipients{/t}">
+            {html_options options=$recipients}
+           <option disabled>&nbsp;</option>
+   </select>
+  </td>
+ </tr>
+</table>
+
+
+<p class="seperator">&nbsp;</p>
+<h2>{t}Message{/t}</h2>
+{render acl=$nmessageACL}
+  <textarea id="nmessage" style="width:99%; height:180px;" name="nmessage" rows="4" cols="512" >{$nmessage}</textarea>
+{/render}
+
+{if $show_templates eq "true"}
+<select name="nmessage_template">
+       {html_options options=$message_templates selected=$template}
+       <option disabled>&nbsp;</option>
+</select>
+<input type="submit" value="{t}Import{/t}" name="import_template">
+{/if}
+
+<p class="seperator">&nbsp;</p>
+<div style='text-align:right;margin-top:5px'>
+{render acl=$nmessageACL}
+        <input type="submit" name="send" value="{t}Send message{/t}">
+{/render}
+</div>
+
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+  document.mainform.nmessage.focus();
+  -->
+</script>
+{else}
+<h2>{t}Notification send!{/t}</h2>
+<p class="seperator">&nbsp;</p>
+<br>
+{t}Your message has been sent successfully. Press the continue button to get back to the notification plugin.{/t}
+<p class="seperator">&nbsp;</p>
+<div style='text-align:right;margin-top:5px'>
+        <input type="submit" name="continue" value="{t}Continue{/t}">
+</div>
+{/if}
diff --git a/gosa-plugins/messaging/addons/messaging/main.inc b/gosa-plugins/messaging/addons/messaging/main.inc
new file mode 100644 (file)
index 0000000..fa90571
--- /dev/null
@@ -0,0 +1,52 @@
+<?php
+/*
+  This code is part of GOsa (https://gosa.gonicus.de)
+  Copyright (C) 2005  Cajus Pollmeier
+
+  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
+*/
+
+if (!$remove_lock){
+       /* Create msgplug object on demand */
+       if (!session::is_set('msgplug') || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+               $ui = get_userinfo();
+               $msgplug= new msgplug ($config);
+               $msgplug->set_acl_category("msgplug");
+
+               /* Check root dn and user dn for acl informations */
+               $msgplug->set_acl_base($config->current['BASE']);
+               if($msgplug->getacl("") == ""){
+                       $msgplug->set_acl_base($ui->dn);
+               }
+               session::set('msgplug',$msgplug);
+       }
+       $msgplug = session::get('msgplug');
+
+       /* save changes back to object */
+       if (isset ($_POST['target'])){
+         $msgplug->save_object ();
+       }
+
+       /* Execute formular */
+       $display= $msgplug->execute ();
+       $display.= "<input type=\"hidden\" name=\"ignore\">\n";
+
+       /* Page header*/
+       $display= print_header(get_template_path('images/notifications.png'), _("Notifications")).$display;
+
+       /* Store changes  in session */
+       session::set('msgplug',$msgplug);
+}
+?>
diff --git a/gosa-plugins/messaging/class_msgplug.inc b/gosa-plugins/messaging/class_msgplug.inc
new file mode 100644 (file)
index 0000000..cbc098d
--- /dev/null
@@ -0,0 +1,258 @@
+<?php
+
+class msgplug extends plugin
+{
+  /* Definitions */
+  var $plHeadline= "Notifications";
+  var $plDescription= "Send user notifications";
+
+  /* attribute list for save action */
+  var $attributes= array("target", "nmessage");
+  var $objectclasses= array();
+
+  /* Helpers */
+  var $target= "group";
+  var $nmessage= "";
+
+  var $targets= array();
+  var $users= array();
+  var $groups= array();
+  var $recipients= array();
+  var $show_templates= false;
+  var $templates= array();
+  var $template= "";
+  var $finalized= false;
+  var $module = "msgplug";
+  var $view_logged = FALSE;
+
+  function msgplug (&$config, $dn= NULL)
+  {
+    /* Include config object */
+    $this->config= &$config;
+    $ui= get_userinfo();
+    $tag= $ui->gosaUnitTag;
+
+    /* Preset values */
+    $this->targets= array("user" => _("Users"), "group" => _("Groups"));
+    asort($this->targets);
+
+    $res = get_list("(objectClass=gosaAccount)", "users", $this->config->current['BASE'],array('uid', 'cn'),GL_SUBSEARCH);
+    foreach($res as $key => $attrs){
+      $this->users['U:'.$attrs['uid'][0]]= $attrs['cn'][0].' ['.$attrs['uid'][0].']';
+    }
+    ksort($this->users);
+
+    $res = get_list("(objectClass=posixGroup)", "groups", $this->config->current['BASE'],array('cn','description'));
+    foreach($res as $key => $attrs){
+      $dsc= "";
+      if (isset($attrs['description'][0])){
+        $dsc= $attrs['description'][0];
+      }
+      $this->groups['G:'.$attrs['cn'][0]]= $attrs['cn'][0].' ['.$dsc.']';
+    }
+    ksort($this->users);
+
+
+    /* Load templates */
+    if (isset($this->config->current['NOTIFYDIR'])){
+      $dir= $this->config->current['NOTIFYDIR'];
+      if (is_dir($dir) && is_readable($dir)){
+
+        /* Look for files and build the vacation array */
+        $dh= opendir($dir);
+        while ($file = readdir($dh)){
+          $description= $this->parse_notification("$dir/$file");
+          if ($description != ""){
+            $this->templates["$dir/$file"]= $description;
+          }
+        }
+        closedir($dh);
+      }
+
+      /* Enable templates if there are some... */
+      if (count($this->templates)){
+        $this->show_templates= true;
+      }
+    }
+  }
+
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* Log view */
+    if(!$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","msgplug/".get_class($this),$this->dn);
+    }
+
+    /* Send message? */
+    if (isset($_POST['send']) && $this->acl_is_writeable("notify")){
+
+      /* Do we have recipients? */
+      if (count($this->recipients)){
+
+        /*Permissions ok? */
+        if (!$this->acl_is_writeable('notify')){
+         msg_dialog::display(_("Permission error"), _("You have no permissions to send a message!"), ERROR_DIALOG);
+        } else {
+          $cmd= $this->config->search("msgplug", "NOTIFY_COMMAND",array('menu'));
+          if ($cmd == ""){
+           msg_dialog::display(_("Configuration error"), sprintf(_("Missing '%s' directive in configuration!"), "notify_command"), ERROR_DIALOG);
+          } else {
+            $parameters= base64_encode($this->nmessage) ." ";
+            foreach ($this->recipients as $key => $value){
+              $parameters.= "$key ";
+            }
+            exec ("$cmd $parameters", $dummy, $retval);
+            if ($retval != 0){
+              msg_dialog::display(_("Configuration error"), sprintf(_("'%s' defined for the '%s' directive cannot be executed!"), $cmd, "notify_command"), ERROR_DIALOG);
+            }
+            $this->finalized= true;
+          }
+        }
+      } else {
+       msg_dialog::display(_("Error"), _("Please specify at least one recipient to send a message!") , ERROR_DIALOG);
+      }
+    }
+
+    /* Bounce back to the original dialog */
+    if (isset($_POST['continue'])){
+      $this->finalized= false;
+    }
+
+    /* Add to list? */
+    if (isset($_POST['add']) && isset($_POST['source']) && $this->acl_is_writeable("notify")){
+      foreach ($_POST['source'] as $key){
+        if ($this->target == 'user'){
+          if(isset($this->users[$key])){
+            $this->recipients[$key]= $this->users[$key];
+          }
+        }
+        if ($this->target == 'group'){
+          if(isset($this->groups[$key])){
+            $this->recipients[$key]= $this->groups[$key];
+          }
+        }
+      }
+      ksort($this->recipients);
+    }
+
+    /* Remove from list? */
+    if (isset($_POST['del']) && isset($_POST['recipient'])){
+      foreach ($_POST['recipient'] as $key){
+          unset($this->recipients[$key]);
+      }
+    }
+
+    /* Import message? */
+    if (isset($_POST["import_template"]) && isset($this->templates[$_POST["nmessage_template"]])){
+      $contents= "";
+      $lines= file($_POST["nmessage_template"]);
+      foreach ($lines as $line){
+        if (!preg_match('/^DESC:/', $line)){
+          $contents.= $line;
+        }
+      }
+
+      /* Replace attributes */
+      $ui= get_userinfo();
+      $contents= preg_replace('/%self/', $ui->cn, $contents);
+
+      /* Save message */
+      $this->nmessage= htmlspecialchars($contents);
+    }
+
+    $smarty= get_smarty();
+
+    /* Assign possible target types */
+    $smarty->assign("targets", $this->targets);
+    foreach ($this->attributes as $attr){
+      $smarty->assign($attr, $this->$attr);
+    }
+
+    /* Generate list */
+    $tmp= array();
+    foreach (array("user" => "users", "group" => "groups") as $field => $arr){
+      if ($this->target == $field){
+        foreach ($this->$arr as $key => $value){
+          if (!isset($this->recipients[$key])){
+            $tmp[$key]= $value;
+          }
+        }
+      }
+    }
+    $smarty->assign('sources', $tmp);
+    $smarty->assign('recipients', $this->recipients);
+
+    /* Assign ACL */
+    $smarty->assign('nmessageACL', $this->getacl("notify"));
+
+    /* Handle templates */
+    $smarty->assign('show_templates', $this->show_templates?"true":"false");
+    $smarty->assign('message_templates', $this->templates);
+    $smarty->assign('template', $this->template);
+    $smarty->assign('finished', $this->finalized?"true":"false");
+
+    /* Show main page */
+    return ($smarty->fetch (get_template_path('contents.tpl', TRUE)));
+  }
+
+
+  function parse_notification($file)
+  {
+    $desc= "";
+
+    if (is_file($file)){
+      $fh = fopen($file, "r");
+      $line= fgets($fh, 256);
+
+      if (!preg_match('/^DESC:/', $line)){
+       msg_dialog::display(_("Error"), sprintf(_("Cannot find a DESC tag in file '%s'!"), $file), ERROR_DIALOG);
+        return $desc;
+      }
+      fclose ($fh);
+
+      $desc= trim(preg_replace('/^DESC:\s*/', '', $line));
+    }
+
+    return $desc;
+  }
+
+  
+  function save_object()
+  {
+    plugin::save_object();
+    foreach($this->attributes as $attr){
+      if(isset($_POST[$attr])){
+        $this->$attr = $_POST[$attr];
+      }
+    }
+  }
+
+  
+  /* Return plugin informations for acl handling */
+  static function plInfo()
+  {
+    return (array(
+        "plShortName"   => _("Notification"),
+        "plDescription" => _("Notification plugin"),
+        "plSelfModify"  => FALSE,
+        "plDepends"     => array(),
+        "plPriority"    => 89,
+        "plSection"     => array("addon"),
+        "plCategory"    => array("msgplug" => array("objectClass" => "none", "description" => _("Notification plugin"))),
+
+        "plProvidedAcls" => array(
+            "notify"          => _("Allow sending notifications")
+          )
+        ));
+  }
+
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/messaging/contents.tpl b/gosa-plugins/messaging/contents.tpl
new file mode 100644 (file)
index 0000000..6898696
--- /dev/null
@@ -0,0 +1,80 @@
+{if $finished eq "false"}
+<h2>{t}Notification target{/t}</h2>
+
+<table style="width:100%">
+ <tr>
+  <td style="width:48%; vertical-align:top;">
+   {t}Use target from{/t}
+   <select name="target" onChange="document.mainform.submit()">
+        {html_options options=$targets selected=$target}
+        <option disabled>&nbsp;</option>
+   </select>
+   {if $javascript eq 'false'}<input type="submit" value="{t}Apply{/t}" name="refresh">{/if}<br><br>
+  </td>
+  <td>
+  </td>
+  <td>
+  </td>
+ </tr>
+ <tr>
+  <td>
+   {t}Available recipients{/t}<br>
+   <select style="width:100%;height:180px;" name="source[]" size="20" multiple title="{t}List message possible targets{/t}">
+            {html_options options=$sources}
+           <option disabled>&nbsp;</option>
+   </select>
+  </td>
+  <td style="vertical-align:center; text-align:center">
+   <input type="submit" value="&gt;" name="add">
+   <br><br>
+   <input type="submit" value="&lt;" name="del">
+  </td>
+  <td style="width:48%; vertical-align:top;">
+   {t}Recipients{/t}<br>
+   <select style="width:100%;height:180px;" name="recipient[]" size="20" multiple title="{t}List message recipients{/t}">
+            {html_options options=$recipients}
+           <option disabled>&nbsp;</option>
+   </select>
+  </td>
+ </tr>
+</table>
+
+
+<p class="seperator">&nbsp;</p>
+<h2>{t}Message{/t}</h2>
+{render acl=$nmessageACL}
+  <textarea id="nmessage" style="width:99%; height:180px;" name="nmessage" rows="4" cols="512" >{$nmessage}</textarea>
+{/render}
+
+{if $show_templates eq "true"}
+<select name="nmessage_template">
+       {html_options options=$message_templates selected=$template}
+       <option disabled>&nbsp;</option>
+</select>
+<input type="submit" value="{t}Import{/t}" name="import_template">
+{/if}
+
+<p class="seperator">&nbsp;</p>
+<div style='text-align:right;margin-top:5px'>
+{render acl=$nmessageACL}
+        <input type="submit" name="send" value="{t}Send message{/t}">
+{/render}
+</div>
+
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+  document.mainform.nmessage.focus();
+  -->
+</script>
+{else}
+<h2>{t}Notification send!{/t}</h2>
+<p class="seperator">&nbsp;</p>
+<br>
+{t}Your message has been sent successfully. Press the continue button to get back to the notification plugin.{/t}
+<p class="seperator">&nbsp;</p>
+<div style='text-align:right;margin-top:5px'>
+        <input type="submit" name="continue" value="{t}Continue{/t}">
+</div>
+{/if}
diff --git a/gosa-plugins/messaging/main.inc b/gosa-plugins/messaging/main.inc
new file mode 100644 (file)
index 0000000..fa90571
--- /dev/null
@@ -0,0 +1,52 @@
+<?php
+/*
+  This code is part of GOsa (https://gosa.gonicus.de)
+  Copyright (C) 2005  Cajus Pollmeier
+
+  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
+*/
+
+if (!$remove_lock){
+       /* Create msgplug object on demand */
+       if (!session::is_set('msgplug') || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+               $ui = get_userinfo();
+               $msgplug= new msgplug ($config);
+               $msgplug->set_acl_category("msgplug");
+
+               /* Check root dn and user dn for acl informations */
+               $msgplug->set_acl_base($config->current['BASE']);
+               if($msgplug->getacl("") == ""){
+                       $msgplug->set_acl_base($ui->dn);
+               }
+               session::set('msgplug',$msgplug);
+       }
+       $msgplug = session::get('msgplug');
+
+       /* save changes back to object */
+       if (isset ($_POST['target'])){
+         $msgplug->save_object ();
+       }
+
+       /* Execute formular */
+       $display= $msgplug->execute ();
+       $display.= "<input type=\"hidden\" name=\"ignore\">\n";
+
+       /* Page header*/
+       $display= print_header(get_template_path('images/notifications.png'), _("Notifications")).$display;
+
+       /* Store changes  in session */
+       session::set('msgplug',$msgplug);
+}
+?>
diff --git a/gosa-plugins/messaging/plugin.dsc b/gosa-plugins/messaging/plugin.dsc
new file mode 100644 (file)
index 0000000..6e36df1
--- /dev/null
@@ -0,0 +1,5 @@
+[gosa-plugin]
+name = messaging
+description = "User notification plugin"
+version = 2.6
+author = "Cajus Pollmeier <pollmeier@gonicus.de>"
diff --git a/gosa-plugins/notifications/addons/messaging/class_msgplug.inc b/gosa-plugins/notifications/addons/messaging/class_msgplug.inc
deleted file mode 100644 (file)
index cbc098d..0000000
+++ /dev/null
@@ -1,258 +0,0 @@
-<?php
-
-class msgplug extends plugin
-{
-  /* Definitions */
-  var $plHeadline= "Notifications";
-  var $plDescription= "Send user notifications";
-
-  /* attribute list for save action */
-  var $attributes= array("target", "nmessage");
-  var $objectclasses= array();
-
-  /* Helpers */
-  var $target= "group";
-  var $nmessage= "";
-
-  var $targets= array();
-  var $users= array();
-  var $groups= array();
-  var $recipients= array();
-  var $show_templates= false;
-  var $templates= array();
-  var $template= "";
-  var $finalized= false;
-  var $module = "msgplug";
-  var $view_logged = FALSE;
-
-  function msgplug (&$config, $dn= NULL)
-  {
-    /* Include config object */
-    $this->config= &$config;
-    $ui= get_userinfo();
-    $tag= $ui->gosaUnitTag;
-
-    /* Preset values */
-    $this->targets= array("user" => _("Users"), "group" => _("Groups"));
-    asort($this->targets);
-
-    $res = get_list("(objectClass=gosaAccount)", "users", $this->config->current['BASE'],array('uid', 'cn'),GL_SUBSEARCH);
-    foreach($res as $key => $attrs){
-      $this->users['U:'.$attrs['uid'][0]]= $attrs['cn'][0].' ['.$attrs['uid'][0].']';
-    }
-    ksort($this->users);
-
-    $res = get_list("(objectClass=posixGroup)", "groups", $this->config->current['BASE'],array('cn','description'));
-    foreach($res as $key => $attrs){
-      $dsc= "";
-      if (isset($attrs['description'][0])){
-        $dsc= $attrs['description'][0];
-      }
-      $this->groups['G:'.$attrs['cn'][0]]= $attrs['cn'][0].' ['.$dsc.']';
-    }
-    ksort($this->users);
-
-
-    /* Load templates */
-    if (isset($this->config->current['NOTIFYDIR'])){
-      $dir= $this->config->current['NOTIFYDIR'];
-      if (is_dir($dir) && is_readable($dir)){
-
-        /* Look for files and build the vacation array */
-        $dh= opendir($dir);
-        while ($file = readdir($dh)){
-          $description= $this->parse_notification("$dir/$file");
-          if ($description != ""){
-            $this->templates["$dir/$file"]= $description;
-          }
-        }
-        closedir($dh);
-      }
-
-      /* Enable templates if there are some... */
-      if (count($this->templates)){
-        $this->show_templates= true;
-      }
-    }
-  }
-
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* Log view */
-    if(!$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","msgplug/".get_class($this),$this->dn);
-    }
-
-    /* Send message? */
-    if (isset($_POST['send']) && $this->acl_is_writeable("notify")){
-
-      /* Do we have recipients? */
-      if (count($this->recipients)){
-
-        /*Permissions ok? */
-        if (!$this->acl_is_writeable('notify')){
-         msg_dialog::display(_("Permission error"), _("You have no permissions to send a message!"), ERROR_DIALOG);
-        } else {
-          $cmd= $this->config->search("msgplug", "NOTIFY_COMMAND",array('menu'));
-          if ($cmd == ""){
-           msg_dialog::display(_("Configuration error"), sprintf(_("Missing '%s' directive in configuration!"), "notify_command"), ERROR_DIALOG);
-          } else {
-            $parameters= base64_encode($this->nmessage) ." ";
-            foreach ($this->recipients as $key => $value){
-              $parameters.= "$key ";
-            }
-            exec ("$cmd $parameters", $dummy, $retval);
-            if ($retval != 0){
-              msg_dialog::display(_("Configuration error"), sprintf(_("'%s' defined for the '%s' directive cannot be executed!"), $cmd, "notify_command"), ERROR_DIALOG);
-            }
-            $this->finalized= true;
-          }
-        }
-      } else {
-       msg_dialog::display(_("Error"), _("Please specify at least one recipient to send a message!") , ERROR_DIALOG);
-      }
-    }
-
-    /* Bounce back to the original dialog */
-    if (isset($_POST['continue'])){
-      $this->finalized= false;
-    }
-
-    /* Add to list? */
-    if (isset($_POST['add']) && isset($_POST['source']) && $this->acl_is_writeable("notify")){
-      foreach ($_POST['source'] as $key){
-        if ($this->target == 'user'){
-          if(isset($this->users[$key])){
-            $this->recipients[$key]= $this->users[$key];
-          }
-        }
-        if ($this->target == 'group'){
-          if(isset($this->groups[$key])){
-            $this->recipients[$key]= $this->groups[$key];
-          }
-        }
-      }
-      ksort($this->recipients);
-    }
-
-    /* Remove from list? */
-    if (isset($_POST['del']) && isset($_POST['recipient'])){
-      foreach ($_POST['recipient'] as $key){
-          unset($this->recipients[$key]);
-      }
-    }
-
-    /* Import message? */
-    if (isset($_POST["import_template"]) && isset($this->templates[$_POST["nmessage_template"]])){
-      $contents= "";
-      $lines= file($_POST["nmessage_template"]);
-      foreach ($lines as $line){
-        if (!preg_match('/^DESC:/', $line)){
-          $contents.= $line;
-        }
-      }
-
-      /* Replace attributes */
-      $ui= get_userinfo();
-      $contents= preg_replace('/%self/', $ui->cn, $contents);
-
-      /* Save message */
-      $this->nmessage= htmlspecialchars($contents);
-    }
-
-    $smarty= get_smarty();
-
-    /* Assign possible target types */
-    $smarty->assign("targets", $this->targets);
-    foreach ($this->attributes as $attr){
-      $smarty->assign($attr, $this->$attr);
-    }
-
-    /* Generate list */
-    $tmp= array();
-    foreach (array("user" => "users", "group" => "groups") as $field => $arr){
-      if ($this->target == $field){
-        foreach ($this->$arr as $key => $value){
-          if (!isset($this->recipients[$key])){
-            $tmp[$key]= $value;
-          }
-        }
-      }
-    }
-    $smarty->assign('sources', $tmp);
-    $smarty->assign('recipients', $this->recipients);
-
-    /* Assign ACL */
-    $smarty->assign('nmessageACL', $this->getacl("notify"));
-
-    /* Handle templates */
-    $smarty->assign('show_templates', $this->show_templates?"true":"false");
-    $smarty->assign('message_templates', $this->templates);
-    $smarty->assign('template', $this->template);
-    $smarty->assign('finished', $this->finalized?"true":"false");
-
-    /* Show main page */
-    return ($smarty->fetch (get_template_path('contents.tpl', TRUE)));
-  }
-
-
-  function parse_notification($file)
-  {
-    $desc= "";
-
-    if (is_file($file)){
-      $fh = fopen($file, "r");
-      $line= fgets($fh, 256);
-
-      if (!preg_match('/^DESC:/', $line)){
-       msg_dialog::display(_("Error"), sprintf(_("Cannot find a DESC tag in file '%s'!"), $file), ERROR_DIALOG);
-        return $desc;
-      }
-      fclose ($fh);
-
-      $desc= trim(preg_replace('/^DESC:\s*/', '', $line));
-    }
-
-    return $desc;
-  }
-
-  
-  function save_object()
-  {
-    plugin::save_object();
-    foreach($this->attributes as $attr){
-      if(isset($_POST[$attr])){
-        $this->$attr = $_POST[$attr];
-      }
-    }
-  }
-
-  
-  /* Return plugin informations for acl handling */
-  static function plInfo()
-  {
-    return (array(
-        "plShortName"   => _("Notification"),
-        "plDescription" => _("Notification plugin"),
-        "plSelfModify"  => FALSE,
-        "plDepends"     => array(),
-        "plPriority"    => 89,
-        "plSection"     => array("addon"),
-        "plCategory"    => array("msgplug" => array("objectClass" => "none", "description" => _("Notification plugin"))),
-
-        "plProvidedAcls" => array(
-            "notify"          => _("Allow sending notifications")
-          )
-        ));
-  }
-
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-plugins/notifications/addons/messaging/contents.tpl b/gosa-plugins/notifications/addons/messaging/contents.tpl
deleted file mode 100644 (file)
index 6898696..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-{if $finished eq "false"}
-<h2>{t}Notification target{/t}</h2>
-
-<table style="width:100%">
- <tr>
-  <td style="width:48%; vertical-align:top;">
-   {t}Use target from{/t}
-   <select name="target" onChange="document.mainform.submit()">
-        {html_options options=$targets selected=$target}
-        <option disabled>&nbsp;</option>
-   </select>
-   {if $javascript eq 'false'}<input type="submit" value="{t}Apply{/t}" name="refresh">{/if}<br><br>
-  </td>
-  <td>
-  </td>
-  <td>
-  </td>
- </tr>
- <tr>
-  <td>
-   {t}Available recipients{/t}<br>
-   <select style="width:100%;height:180px;" name="source[]" size="20" multiple title="{t}List message possible targets{/t}">
-            {html_options options=$sources}
-           <option disabled>&nbsp;</option>
-   </select>
-  </td>
-  <td style="vertical-align:center; text-align:center">
-   <input type="submit" value="&gt;" name="add">
-   <br><br>
-   <input type="submit" value="&lt;" name="del">
-  </td>
-  <td style="width:48%; vertical-align:top;">
-   {t}Recipients{/t}<br>
-   <select style="width:100%;height:180px;" name="recipient[]" size="20" multiple title="{t}List message recipients{/t}">
-            {html_options options=$recipients}
-           <option disabled>&nbsp;</option>
-   </select>
-  </td>
- </tr>
-</table>
-
-
-<p class="seperator">&nbsp;</p>
-<h2>{t}Message{/t}</h2>
-{render acl=$nmessageACL}
-  <textarea id="nmessage" style="width:99%; height:180px;" name="nmessage" rows="4" cols="512" >{$nmessage}</textarea>
-{/render}
-
-{if $show_templates eq "true"}
-<select name="nmessage_template">
-       {html_options options=$message_templates selected=$template}
-       <option disabled>&nbsp;</option>
-</select>
-<input type="submit" value="{t}Import{/t}" name="import_template">
-{/if}
-
-<p class="seperator">&nbsp;</p>
-<div style='text-align:right;margin-top:5px'>
-{render acl=$nmessageACL}
-        <input type="submit" name="send" value="{t}Send message{/t}">
-{/render}
-</div>
-
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-  document.mainform.nmessage.focus();
-  -->
-</script>
-{else}
-<h2>{t}Notification send!{/t}</h2>
-<p class="seperator">&nbsp;</p>
-<br>
-{t}Your message has been sent successfully. Press the continue button to get back to the notification plugin.{/t}
-<p class="seperator">&nbsp;</p>
-<div style='text-align:right;margin-top:5px'>
-        <input type="submit" name="continue" value="{t}Continue{/t}">
-</div>
-{/if}
diff --git a/gosa-plugins/notifications/addons/messaging/main.inc b/gosa-plugins/notifications/addons/messaging/main.inc
deleted file mode 100644 (file)
index fa90571..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-/*
-  This code is part of GOsa (https://gosa.gonicus.de)
-  Copyright (C) 2005  Cajus Pollmeier
-
-  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
-*/
-
-if (!$remove_lock){
-       /* Create msgplug object on demand */
-       if (!session::is_set('msgplug') || (isset($_GET['reset']) && $_GET['reset'] == 1)){
-               $ui = get_userinfo();
-               $msgplug= new msgplug ($config);
-               $msgplug->set_acl_category("msgplug");
-
-               /* Check root dn and user dn for acl informations */
-               $msgplug->set_acl_base($config->current['BASE']);
-               if($msgplug->getacl("") == ""){
-                       $msgplug->set_acl_base($ui->dn);
-               }
-               session::set('msgplug',$msgplug);
-       }
-       $msgplug = session::get('msgplug');
-
-       /* save changes back to object */
-       if (isset ($_POST['target'])){
-         $msgplug->save_object ();
-       }
-
-       /* Execute formular */
-       $display= $msgplug->execute ();
-       $display.= "<input type=\"hidden\" name=\"ignore\">\n";
-
-       /* Page header*/
-       $display= print_header(get_template_path('images/notifications.png'), _("Notifications")).$display;
-
-       /* Store changes  in session */
-       session::set('msgplug',$msgplug);
-}
-?>
diff --git a/gosa-plugins/notifications/class_msgplug.inc b/gosa-plugins/notifications/class_msgplug.inc
deleted file mode 100644 (file)
index cbc098d..0000000
+++ /dev/null
@@ -1,258 +0,0 @@
-<?php
-
-class msgplug extends plugin
-{
-  /* Definitions */
-  var $plHeadline= "Notifications";
-  var $plDescription= "Send user notifications";
-
-  /* attribute list for save action */
-  var $attributes= array("target", "nmessage");
-  var $objectclasses= array();
-
-  /* Helpers */
-  var $target= "group";
-  var $nmessage= "";
-
-  var $targets= array();
-  var $users= array();
-  var $groups= array();
-  var $recipients= array();
-  var $show_templates= false;
-  var $templates= array();
-  var $template= "";
-  var $finalized= false;
-  var $module = "msgplug";
-  var $view_logged = FALSE;
-
-  function msgplug (&$config, $dn= NULL)
-  {
-    /* Include config object */
-    $this->config= &$config;
-    $ui= get_userinfo();
-    $tag= $ui->gosaUnitTag;
-
-    /* Preset values */
-    $this->targets= array("user" => _("Users"), "group" => _("Groups"));
-    asort($this->targets);
-
-    $res = get_list("(objectClass=gosaAccount)", "users", $this->config->current['BASE'],array('uid', 'cn'),GL_SUBSEARCH);
-    foreach($res as $key => $attrs){
-      $this->users['U:'.$attrs['uid'][0]]= $attrs['cn'][0].' ['.$attrs['uid'][0].']';
-    }
-    ksort($this->users);
-
-    $res = get_list("(objectClass=posixGroup)", "groups", $this->config->current['BASE'],array('cn','description'));
-    foreach($res as $key => $attrs){
-      $dsc= "";
-      if (isset($attrs['description'][0])){
-        $dsc= $attrs['description'][0];
-      }
-      $this->groups['G:'.$attrs['cn'][0]]= $attrs['cn'][0].' ['.$dsc.']';
-    }
-    ksort($this->users);
-
-
-    /* Load templates */
-    if (isset($this->config->current['NOTIFYDIR'])){
-      $dir= $this->config->current['NOTIFYDIR'];
-      if (is_dir($dir) && is_readable($dir)){
-
-        /* Look for files and build the vacation array */
-        $dh= opendir($dir);
-        while ($file = readdir($dh)){
-          $description= $this->parse_notification("$dir/$file");
-          if ($description != ""){
-            $this->templates["$dir/$file"]= $description;
-          }
-        }
-        closedir($dh);
-      }
-
-      /* Enable templates if there are some... */
-      if (count($this->templates)){
-        $this->show_templates= true;
-      }
-    }
-  }
-
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* Log view */
-    if(!$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","msgplug/".get_class($this),$this->dn);
-    }
-
-    /* Send message? */
-    if (isset($_POST['send']) && $this->acl_is_writeable("notify")){
-
-      /* Do we have recipients? */
-      if (count($this->recipients)){
-
-        /*Permissions ok? */
-        if (!$this->acl_is_writeable('notify')){
-         msg_dialog::display(_("Permission error"), _("You have no permissions to send a message!"), ERROR_DIALOG);
-        } else {
-          $cmd= $this->config->search("msgplug", "NOTIFY_COMMAND",array('menu'));
-          if ($cmd == ""){
-           msg_dialog::display(_("Configuration error"), sprintf(_("Missing '%s' directive in configuration!"), "notify_command"), ERROR_DIALOG);
-          } else {
-            $parameters= base64_encode($this->nmessage) ." ";
-            foreach ($this->recipients as $key => $value){
-              $parameters.= "$key ";
-            }
-            exec ("$cmd $parameters", $dummy, $retval);
-            if ($retval != 0){
-              msg_dialog::display(_("Configuration error"), sprintf(_("'%s' defined for the '%s' directive cannot be executed!"), $cmd, "notify_command"), ERROR_DIALOG);
-            }
-            $this->finalized= true;
-          }
-        }
-      } else {
-       msg_dialog::display(_("Error"), _("Please specify at least one recipient to send a message!") , ERROR_DIALOG);
-      }
-    }
-
-    /* Bounce back to the original dialog */
-    if (isset($_POST['continue'])){
-      $this->finalized= false;
-    }
-
-    /* Add to list? */
-    if (isset($_POST['add']) && isset($_POST['source']) && $this->acl_is_writeable("notify")){
-      foreach ($_POST['source'] as $key){
-        if ($this->target == 'user'){
-          if(isset($this->users[$key])){
-            $this->recipients[$key]= $this->users[$key];
-          }
-        }
-        if ($this->target == 'group'){
-          if(isset($this->groups[$key])){
-            $this->recipients[$key]= $this->groups[$key];
-          }
-        }
-      }
-      ksort($this->recipients);
-    }
-
-    /* Remove from list? */
-    if (isset($_POST['del']) && isset($_POST['recipient'])){
-      foreach ($_POST['recipient'] as $key){
-          unset($this->recipients[$key]);
-      }
-    }
-
-    /* Import message? */
-    if (isset($_POST["import_template"]) && isset($this->templates[$_POST["nmessage_template"]])){
-      $contents= "";
-      $lines= file($_POST["nmessage_template"]);
-      foreach ($lines as $line){
-        if (!preg_match('/^DESC:/', $line)){
-          $contents.= $line;
-        }
-      }
-
-      /* Replace attributes */
-      $ui= get_userinfo();
-      $contents= preg_replace('/%self/', $ui->cn, $contents);
-
-      /* Save message */
-      $this->nmessage= htmlspecialchars($contents);
-    }
-
-    $smarty= get_smarty();
-
-    /* Assign possible target types */
-    $smarty->assign("targets", $this->targets);
-    foreach ($this->attributes as $attr){
-      $smarty->assign($attr, $this->$attr);
-    }
-
-    /* Generate list */
-    $tmp= array();
-    foreach (array("user" => "users", "group" => "groups") as $field => $arr){
-      if ($this->target == $field){
-        foreach ($this->$arr as $key => $value){
-          if (!isset($this->recipients[$key])){
-            $tmp[$key]= $value;
-          }
-        }
-      }
-    }
-    $smarty->assign('sources', $tmp);
-    $smarty->assign('recipients', $this->recipients);
-
-    /* Assign ACL */
-    $smarty->assign('nmessageACL', $this->getacl("notify"));
-
-    /* Handle templates */
-    $smarty->assign('show_templates', $this->show_templates?"true":"false");
-    $smarty->assign('message_templates', $this->templates);
-    $smarty->assign('template', $this->template);
-    $smarty->assign('finished', $this->finalized?"true":"false");
-
-    /* Show main page */
-    return ($smarty->fetch (get_template_path('contents.tpl', TRUE)));
-  }
-
-
-  function parse_notification($file)
-  {
-    $desc= "";
-
-    if (is_file($file)){
-      $fh = fopen($file, "r");
-      $line= fgets($fh, 256);
-
-      if (!preg_match('/^DESC:/', $line)){
-       msg_dialog::display(_("Error"), sprintf(_("Cannot find a DESC tag in file '%s'!"), $file), ERROR_DIALOG);
-        return $desc;
-      }
-      fclose ($fh);
-
-      $desc= trim(preg_replace('/^DESC:\s*/', '', $line));
-    }
-
-    return $desc;
-  }
-
-  
-  function save_object()
-  {
-    plugin::save_object();
-    foreach($this->attributes as $attr){
-      if(isset($_POST[$attr])){
-        $this->$attr = $_POST[$attr];
-      }
-    }
-  }
-
-  
-  /* Return plugin informations for acl handling */
-  static function plInfo()
-  {
-    return (array(
-        "plShortName"   => _("Notification"),
-        "plDescription" => _("Notification plugin"),
-        "plSelfModify"  => FALSE,
-        "plDepends"     => array(),
-        "plPriority"    => 89,
-        "plSection"     => array("addon"),
-        "plCategory"    => array("msgplug" => array("objectClass" => "none", "description" => _("Notification plugin"))),
-
-        "plProvidedAcls" => array(
-            "notify"          => _("Allow sending notifications")
-          )
-        ));
-  }
-
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-plugins/notifications/contents.tpl b/gosa-plugins/notifications/contents.tpl
deleted file mode 100644 (file)
index 6898696..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-{if $finished eq "false"}
-<h2>{t}Notification target{/t}</h2>
-
-<table style="width:100%">
- <tr>
-  <td style="width:48%; vertical-align:top;">
-   {t}Use target from{/t}
-   <select name="target" onChange="document.mainform.submit()">
-        {html_options options=$targets selected=$target}
-        <option disabled>&nbsp;</option>
-   </select>
-   {if $javascript eq 'false'}<input type="submit" value="{t}Apply{/t}" name="refresh">{/if}<br><br>
-  </td>
-  <td>
-  </td>
-  <td>
-  </td>
- </tr>
- <tr>
-  <td>
-   {t}Available recipients{/t}<br>
-   <select style="width:100%;height:180px;" name="source[]" size="20" multiple title="{t}List message possible targets{/t}">
-            {html_options options=$sources}
-           <option disabled>&nbsp;</option>
-   </select>
-  </td>
-  <td style="vertical-align:center; text-align:center">
-   <input type="submit" value="&gt;" name="add">
-   <br><br>
-   <input type="submit" value="&lt;" name="del">
-  </td>
-  <td style="width:48%; vertical-align:top;">
-   {t}Recipients{/t}<br>
-   <select style="width:100%;height:180px;" name="recipient[]" size="20" multiple title="{t}List message recipients{/t}">
-            {html_options options=$recipients}
-           <option disabled>&nbsp;</option>
-   </select>
-  </td>
- </tr>
-</table>
-
-
-<p class="seperator">&nbsp;</p>
-<h2>{t}Message{/t}</h2>
-{render acl=$nmessageACL}
-  <textarea id="nmessage" style="width:99%; height:180px;" name="nmessage" rows="4" cols="512" >{$nmessage}</textarea>
-{/render}
-
-{if $show_templates eq "true"}
-<select name="nmessage_template">
-       {html_options options=$message_templates selected=$template}
-       <option disabled>&nbsp;</option>
-</select>
-<input type="submit" value="{t}Import{/t}" name="import_template">
-{/if}
-
-<p class="seperator">&nbsp;</p>
-<div style='text-align:right;margin-top:5px'>
-{render acl=$nmessageACL}
-        <input type="submit" name="send" value="{t}Send message{/t}">
-{/render}
-</div>
-
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-  document.mainform.nmessage.focus();
-  -->
-</script>
-{else}
-<h2>{t}Notification send!{/t}</h2>
-<p class="seperator">&nbsp;</p>
-<br>
-{t}Your message has been sent successfully. Press the continue button to get back to the notification plugin.{/t}
-<p class="seperator">&nbsp;</p>
-<div style='text-align:right;margin-top:5px'>
-        <input type="submit" name="continue" value="{t}Continue{/t}">
-</div>
-{/if}
diff --git a/gosa-plugins/notifications/main.inc b/gosa-plugins/notifications/main.inc
deleted file mode 100644 (file)
index fa90571..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-/*
-  This code is part of GOsa (https://gosa.gonicus.de)
-  Copyright (C) 2005  Cajus Pollmeier
-
-  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
-*/
-
-if (!$remove_lock){
-       /* Create msgplug object on demand */
-       if (!session::is_set('msgplug') || (isset($_GET['reset']) && $_GET['reset'] == 1)){
-               $ui = get_userinfo();
-               $msgplug= new msgplug ($config);
-               $msgplug->set_acl_category("msgplug");
-
-               /* Check root dn and user dn for acl informations */
-               $msgplug->set_acl_base($config->current['BASE']);
-               if($msgplug->getacl("") == ""){
-                       $msgplug->set_acl_base($ui->dn);
-               }
-               session::set('msgplug',$msgplug);
-       }
-       $msgplug = session::get('msgplug');
-
-       /* save changes back to object */
-       if (isset ($_POST['target'])){
-         $msgplug->save_object ();
-       }
-
-       /* Execute formular */
-       $display= $msgplug->execute ();
-       $display.= "<input type=\"hidden\" name=\"ignore\">\n";
-
-       /* Page header*/
-       $display= print_header(get_template_path('images/notifications.png'), _("Notifications")).$display;
-
-       /* Store changes  in session */
-       session::set('msgplug',$msgplug);
-}
-?>
diff --git a/gosa-plugins/notifications/plugin.dsc b/gosa-plugins/notifications/plugin.dsc
deleted file mode 100644 (file)
index 6e36df1..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-[gosa-plugin]
-name = messaging
-description = "User notification plugin"
-version = 2.6
-author = "Cajus Pollmeier <pollmeier@gonicus.de>"