summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b75db19)
raw | patch | inline | side by side (parent: b75db19)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 12 Dec 2007 17:15:01 +0000 (17:15 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 12 Dec 2007 17:15:01 +0000 (17:15 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8116 594d385d-05f5-0310-b6e9-bd551577e9d8
22 files changed:
diff --git a/gosa-plugins/dh-make-gosa b/gosa-plugins/dh-make-gosa
--- /dev/null
@@ -0,0 +1,175 @@
+#!/bin/sh
+
+plugin=$1
+TMPDIR=/tmp/dh-make-gosa.$$
+
+check_plugin() {
+ [[ -r $1/manifest ]]
+}
+
+parse_manifest() {
+ pl_name=gofax
+ pl_version=1.0
+ pl_description="GOfax integration for GOsa"
+ pl_depends=
+ pl_author="Cajus Pollmeier <pollmeier@gonicus.de>"
+}
+
+
+##############################################################################
+# M A I N #
+##############################################################################
+
+# Sanity check
+if ! check_plugin $plugin; then
+ echo "Failed"
+ exit 1
+fi
+parse_manifest $plugin
+
+# Create temporary copy
+echo "Creating temporary copy of plugin '$plugin'..."
+mkdir -p $TMPDIR
+cp -a $plugin/* $TMPDIR
+rm $TMPDIR/manifest
+find $TMPDIR -name '*.svn' -type d -exec rm -rf {} \; 2> /dev/null
+
+# Add debian infrastructure
+mkdir $TMPDIR/debian
+cat <<EOF > $TMPDIR/debian/changelog
+gosa-plugin-$pl_name ($pl_version-1) unstable; urgency=low
+
+ * Initial release
+
+ -- $pl_author $(822-date)
+EOF
+
+echo 5 > $TMPDIR/debian/compat
+
+cat <<EOF > $TMPDIR/debian/control
+Source: gosa-plugin-$pl_name
+Section: utils
+Priority: optional
+Maintainer: $pl_author
+Standards-Version: 3.7.2.2
+Build-Depends: debhelper(>= 4.2.32)
+
+Package: gosa-plugin-$pl_name
+Architecture: any
+Depends: gosa-core $pl_depends
+Suggests: gosa
+Description: $pl_description
+ This package includes the $pl_name plugin for use with GOsa.
+ .
+ GOsa is a combination of system-administrator and end-user web
+ interface, designed to handle LDAP based setups.
+EOF
+
+cat <<EOF > $TMPDIR/debian/copyright
+This package was debianized by $pl_author
+on $(822-date)
+
+Copyright: GPL2
+
+This code is released under the terms of the GPLv2 license.
+
+See /usr/share/common-licenses/GPL-2 for the full license.
+EOF
+
+dirs=$(find $TMPDIR -maxdepth 1 -type d | grep -v debian)
+for dir in $(echo $dirs); do
+ [[ $dir == $TMPDIR ]] && continue
+ dir=$(basename $dir)
+ echo usr/share/gosa/plugins/$dir >> $TMPDIR/debian/dirs
+ echo $dir usr/share/gosa/plugins >> $TMPDIR/debian/install
+done
+
+cat <<EOF > $TMPDIR/debian/README.Debian
+README.Debian for $pl_name
+--------------------------
+
+You need a proper LDAP/GOsa setup to make this run. More
+text will follow later. Sorry.
+
+----
+$pl_author $(822-date)
+EOF
+
+cat <<EOF > $TMPDIR/debian/rules
+#!/usr/bin/make -f
+# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+build: patch
+ #********************************************************
+ #* Building plugin into a Debian/GNU Linux Package *
+ #* please stand by *
+ #********************************************************
+
+clean: clean-patched unpatch
+clean-patched:
+ dh_testdir
+ rm -f install-stamp
+ -rm -f debian/files
+ -rm -rf debian/tmp
+ -rm -f debian/substvars
+ dh_clean
+
+unpatch:
+ dpatch deapply-all
+ rm -rf patch-stamp debian/patched
+
+install: install-stamp
+install-stamp:
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ touch install-stamp
+
+patch: patch-stamp
+patch-stamp:
+ dpatch apply-all
+ dpatch cat-all >patch-stamp
+
+binary-indep: install
+ dh_testdir
+ dh_testroot
+
+ dh_install
+ dh_installdocs
+ dh_installcron
+ dh_installexamples
+ dh_installchangelogs
+ dh_link
+ dh_strip
+ dh_compress
+ dh_fixperms
+ dh_perl
+ dh_installdeb
+ dh_shlibdeps
+
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+source diff:
+ @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
+
+binary: binary-indep
+.PHONY: build install clean binary-indep binary
+
+binary-arch:
+
+EOF
+
+chmod +x $TMPDIR/debian/rules
+
+(cd $TMPDIR && dpkg-buildpackage -uc -us -rfakeroot)
+
+# Cleanup
+echo "Cleaning up..."
+#rm -rf "$TMPDIR"
diff --git a/gosa-plugins/gofax/admin/systems/services/gofax/class_goFaxServer.inc b/gosa-plugins/gofax/admin/systems/services/gofax/class_goFaxServer.inc
--- /dev/null
@@ -0,0 +1,103 @@
+<?php
+
+class goFaxServer extends goService {
+
+ var $cli_summary = "This pluign is used within the ServerService Pluign \nand indicates that this server supports fax informations.";
+ var $cli_description = "Some longer text\nfor help";
+ var $cli_parameters = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+ /* This plugin only writes its objectClass */
+ var $objectclasses = array("goFaxServer");
+ var $attributes = array("goFaxAdmin", "goFaxPassword");
+ var $StatusFlag = "goFaxServerStatus";
+
+ /* This class can't be assigned twice so it conflicts with itsself */
+ var $conflicts = array("goFaxServer");
+
+ var $DisplayName = "";
+ var $dn = NULL;
+ var $acl;
+
+ var $goFaxAdmin = "";
+ var $goFaxPassword = "";
+ var $goFaxServerStatus = "";
+ var $cn = "";
+ var $view_logged =FALSE;
+
+ function goFaxServer(&$config,$dn)
+ {
+ goService::goService($config,$dn);
+ $this->DisplayName = _("FAX database");
+ }
+
+
+ function execute()
+ {
+ $smarty = get_smarty();
+
+ if($this->is_account && !$this->view_logged){
+ $this->view_logged = TRUE;
+ new log("view","server/".get_class($this),$this->dn);
+ }
+
+ /* Assign acls */
+ $tmp = $this->plInfo();
+ foreach($tmp['plProvidedAcls'] as $name => $translation ){
+ $smarty->assign($name."ACL",$this->getacl($name));
+ }
+
+ foreach($this->attributes as $attr){
+ $smarty->assign($attr,$this->$attr);
+ }
+ return($smarty->fetch(get_template_path("goFaxServer.tpl",TRUE,dirname(__FILE__))));
+ }
+
+
+ function getListEntry()
+ {
+ $fields = goService::getListEntry();
+ $fields['Message'] = _("FAX database configuration");
+ $fields['AllowEdit'] = true;
+ return($fields);
+ }
+
+ function check()
+ {
+ $message = plugin::check();
+ if (empty($this->goFaxAdmin)){
+ $message[]= _("The attribute user is empty or contains invalid characters.");
+ }
+ if (empty($this->goFaxPassword)){
+ $message[]= _("The attribute password is empty or contains invalid characters.");
+ }
+ return($message);
+ }
+
+
+ function save_object()
+ {
+ if(isset($_POST['goFaxServerPosted'])){
+ plugin::save_object();
+ }
+ }
+
+ /* Return plugin informations for acl handling */
+ static function plInfo()
+ {
+ return (array(
+ "plShortName" => _("Fax database"),
+ "plDescription" => _("Fax database")." ("._("Services").")",
+ "plSelfModify" => FALSE,
+ "plDepends" => array(),
+ "plPriority" => 99,
+ "plSection" => array("administration"),
+ "plCategory" => array("server"),
+
+ "plProvidedAcls"=> array(
+ "goFaxAdmin" => _("Login name"),
+ "goFaxPassword" => _("Password"))
+ ));
+ }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/gofax/admin/systems/services/gofax/goFaxServer.tpl b/gosa-plugins/gofax/admin/systems/services/gofax/goFaxServer.tpl
--- /dev/null
@@ -0,0 +1,27 @@
+<h2><img class="center" alt="" align="middle" src="images/rightarrow.png" /> {t}FAX database information{/t}</h2>
+ <table summary="">
+ <tr>
+ <td>{t}FAX DB user{/t}{$must}</td>
+ <td>
+{render acl=$goFaxAdminACL}
+ <input name="goFaxAdmin" size=30 maxlength=60 id="goFaxAdmin" value="{$goFaxAdmin}" >
+{/render}
+ </td>
+ </tr>
+ <tr>
+ <td>{t}Password{/t}{$must}</td>
+ <td>
+{render acl=$goFaxPasswordACL}
+ <input type=password name="goFaxPassword" id="goFaxPassword" size=30 maxlength=60 value="{$goFaxPassword}" >
+{/render}
+ </td>
+ </tr>
+ </table>
+
+<p class='seperator'> </p>
+<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
+ <input type='submit' name='SaveService' value='{t}Save{/t}'>
+
+ <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
+</div>
+<input type="hidden" name="goFaxServerPosted" value="1">
diff --git a/gosa-plugins/gofax/gofax/blocklists/class_blocklistGeneric.inc b/gosa-plugins/gofax/gofax/blocklists/class_blocklistGeneric.inc
--- /dev/null
@@ -0,0 +1,371 @@
+<?php
+
+define("BLOCK_LIST_RECEIVE" , 0);
+define("BLOCK_LIST_SEND" , 1);
+
+class blocklistGeneric extends plugin
+{
+ /* Definitions */
+ var $plHeadline= "FAX Blocklists";
+ var $plDescription= "This does something";
+
+ var $cn ="";
+ var $description = "";
+ var $base = "";
+
+ var $type;
+ var $goFaxBlocklist = array();
+ var $readonly = FALSE;
+ var $view_logged = FALSE;
+ var $attributes = array("cn","description");
+
+ var $ignore_account = TRUE;
+
+ function __construct($config,$dn = "new")
+ {
+ plugin::plugin($config,$dn);
+
+ /* Set default list type */
+ $this->type = BLOCK_LIST_SEND;
+
+ /* Load defined numbers */
+ if($dn != "new"){
+
+ /* We will not be able to rename edited blocklists */
+ $this->readonly = TRUE;
+
+ /* Get blocklist type and defined numbers */
+ if (in_array("goFaxSBlock",$this->attrs['objectClass'])){
+ if(isset($this->attrs["goFaxSBlocklist"])){
+ for ($i= 0; $i<$this->attrs["goFaxSBlocklist"]["count"]; $i++){
+ $this->goFaxBlocklist[]= $this->attrs["goFaxSBlocklist"][$i];
+ }
+ }
+ $this->type= BLOCK_LIST_SEND;
+ } elseif (in_array("goFaxRBlock",$this->attrs['objectClass'])){
+ if(isset($this->attrs["goFaxRBlocklist"])){
+ for ($i= 0; $i<$this->attrs["goFaxRBlocklist"]["count"]; $i++){
+ $this->goFaxBlocklist[]= $this->attrs["goFaxRBlocklist"][$i];
+ }
+ }
+ $this->type= BLOCK_LIST_RECEIVE;
+ }
+ }
+
+ /* Set base */
+ if ($this->dn == "new"){
+ if(isset($_SESSION['CurrentMainBase'])){
+ $this->base= $_SESSION['CurrentMainBase'];
+ }else{
+ $ui= get_userinfo();
+ $this->base= dn2base($ui->dn);
+ }
+ } else {
+ $this->base =preg_replace ("/^[^,]+,[^,]+,[^,]+,/","",$this->dn);
+ }
+ }
+
+ public function execute()
+ {
+ /* Log view */
+ if(!$this->view_logged){
+ $this->view_logged = TRUE;
+ new log("view","blocklist/".get_class($this),$this->dn);
+ }
+
+
+ /**************
+ * Base select dialog
+ **************/
+
+ $once = true;
+ foreach($_POST as $name => $value){
+ if(preg_match("/^chooseBase/",$name) && $once){
+ $once = false;
+ $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
+ $this->dialog->setCurrentBase($this->base);
+ }
+ }
+
+ /* Dialog handling */
+ if(is_object($this->dialog)){
+ /* Must be called before save_object */
+ $this->dialog->save_object();
+
+ if($this->dialog->isClosed()){
+ $this->dialog = false;
+ }elseif($this->dialog->isSelected()){
+
+ /* A new base was selected, check if it is a valid one */
+ $tmp = $this->get_allowed_bases();
+ if(isset($tmp[$this->dialog->isSelected()])){
+ $this->base = $this->dialog->isSelected();
+ }
+ $this->dialog= false;
+
+ }else{
+ return($this->dialog->execute());
+ }
+ }
+
+
+ /***************
+ Add numer to blocklist
+ ***************/
+
+
+ /* Handle interactions: add */
+ if (isset($_POST['add_number']) && $_POST['number'] != ""){
+ if (is_phone_nr($_POST['number']) || preg_match ("/^[\/0-9 ()\^\.\$+*-]+$/",$_POST['number'])){
+ $this->addNumber ($_POST['number']);
+ } else {
+ print_red (_("Please specify a valid phone number."));
+ }
+ }
+
+
+ /***************
+ Delete number from list
+ ***************/
+
+ /* Handle interactions: delete */
+ if (isset($_POST['delete_number']) && isset($_POST['numbers']) && count($_POST['numbers']) > 0){
+ $this->delNumber ($_POST['numbers']);
+ }
+
+
+ /***************
+ Template output
+ ***************/
+
+ $smarty = get_smarty();
+ foreach($this->attributes as $name){
+ $smarty->assign($name,$this->$name);
+ }
+ $tmp = $this->plInfo();
+ foreach($tmp['plProvidedAcls'] as $name => $translation){
+ $smarty->assign($name."ACL",$this->getacl($name));
+ }
+ $smarty->assign("goFaxBlocklist",$this->goFaxBlocklist);
+ $smarty->assign("cnACL",$this->getacl("cn",$this->readonly));
+ $smarty->assign("typeACL",$this->getacl("type",$this->readonly));
+ $smarty->assign("base",$this->base);
+ $smarty->assign("bases", $this->get_allowed_bases());
+ $smarty->assign("types", array(BLOCK_LIST_SEND => _("send"), BLOCK_LIST_RECEIVE => _("receive")));
+ $smarty->assign("type", $this->type);
+ return($smarty->fetch(get_template_path('generic.tpl', TRUE)));
+ }
+
+
+ public function save_object()
+ {
+ if(isset($_POST['blocklist_posted'])){
+ $tmp_cn = $this->cn;
+ plugin::save_object();
+ $this->cn = $tmp_cn;
+
+ /* Save base, since this is no LDAP attribute */
+ $tmp = $this->get_allowed_bases();
+ if(isset($_POST['base'])){
+ if(isset($tmp[$_POST['base']])){
+ $this->base= $_POST['base'];
+ }
+ }
+ $tmp = $this->attributes;
+ $tmp[] = "type";
+ foreach($tmp as $attr){
+ if(in_array($attr,array("cn","type")) && $this->readonly){
+ continue;
+ }elseif(isset($_POST[$attr]) && $this->acl_is_writeable($attr)){
+ $this->$attr = $_POST[$attr];
+ }
+ }
+ }
+ }
+
+
+ function remove_from_parent()
+ {
+ $ldap= $this->config->get_ldap_link();
+ $ldap->rmDir($this->dn);
+ new log("remove","gofaxlist/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+ show_ldap_error($ldap->get_error(), sprintf(_("Removing of blocklist with dn '%s' failed."),$this->dn));
+ $this->handle_post_events("remove");
+ }
+
+
+ /* Check values */
+ function check()
+ {
+ /* Call common method to give check the hook */
+ $message= plugin::check();
+
+ /* check syntax: must cn */
+ if ($this->cn == ""){
+ $message[]= _("Required field 'Name' is not set.");
+ } else {
+ if (!is_uid($this->cn)){
+ $message[]= _("Required field 'Name' contains invalid characters");
+ }
+ if ($this->dn == 'new'){
+ $ldap= $this->config->get_ldap_link();
+ $ldap->cd ("ou=gofax,ou=systems,".$this->config->current["BASE"]);
+ $ldap->search ("(&(|(objectClass=goFaxSBlock)(objectClass=goFaxRBlock))(cn=".$this->cn."))", array("cn"));
+ if ($ldap->count() != 0){
+ $message[]= _("Specified name is already used.");
+ }
+ }
+ }
+ return $message;
+ }
+
+
+ /* Save to LDAP */
+ function save()
+ {
+ plugin::save();
+
+ /* Type selection */
+ if ($this->type == BLOCK_LIST_SEND){
+ $type= "goFaxSBlocklist";
+ $this->attrs['objectClass']= "goFaxSBlock";
+ } else {
+ $type= "goFaxRBlocklist";
+ $this->attrs['objectClass']= "goFaxRBlock";
+ }
+
+ /* Add list */
+ if (count($this->goFaxBlocklist)){
+ $this->attrs[$type]= $this->goFaxBlocklist;
+ }
+
+ /* Write back to ldap */
+ $ldap= $this->config->get_ldap_link();
+ $ldap->cd($this->base);
+ $ldap->cat($this->dn, array('dn'));
+ if ($ldap->count()){
+ if (!isset($this->attrs[$type])){
+ $this->attrs[$type]= array();
+ }
+ $ldap->cd($this->dn);
+ $this->cleanup();
+ $ldap->modify($this->attrs);
+ new log("modify","faxblocklist/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+ $this->handle_post_events("modify");
+ } else {
+ $ldap->cd($this->config->current['BASE']);
+ $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
+ $ldap->cd($this->dn);
+ $ldap->add($this->attrs);
+ new log("create","gofaxlist/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+ $this->handle_post_events("add");
+ }
+ show_ldap_error($ldap->get_error(), sprintf(_("Saving of blocklist with dn '%s' failed."),$this->dn));
+ }
+
+
+ /* Add number */
+ function addNumber($number)
+ {
+ if (!in_array($number, $this->goFaxBlocklist)){
+ $this->goFaxBlocklist[]= $number;
+ sort($this->goFaxBlocklist);
+ }
+ }
+
+
+ /* Remove number from list */
+ function delNumber($numbers)
+ {
+ $tmp= array();
+ foreach ($this->goFaxBlocklist as $val){
+ if (!in_array($val, $numbers)){
+ $tmp[]= $val;
+ }
+ }
+ $this->goFaxBlocklist= $tmp;
+ }
+
+
+ function getCopyDialog()
+ {
+ $smarty = get_smarty();
+ $smarty->assign("cn",$this->cn);
+ $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE,dirname(__FILE__)));
+ $ret = array();
+ $ret['string'] = $str;
+ $ret['status'] = "";
+ return($ret);
+ }
+
+ function saveCopyDialog()
+ {
+ if(isset($_POST['cn'])){
+ $this->cn = get_post('cn');
+ }
+ }
+
+
+ function PrepareForCopyPaste($source)
+ {
+ plugin::PrepareForCopyPaste($source);
+
+ /* We will not be able to rename edited blocklists */
+ $this->readonly = TRUE;
+
+ /* Get blocklist type and defined numbers */
+ if (in_array("goFaxSBlock",$source['objectClass'])){
+ if(isset($source["goFaxSBlocklist"])){
+ for ($i= 0; $i<$source["goFaxSBlocklist"]["count"]; $i++){
+ $this->goFaxBlocklist[]= $source["goFaxSBlocklist"][$i];
+ }
+ }
+ $this->type= BLOCK_LIST_SEND;
+ } elseif (in_array("goFaxRBlock",$source['objectClass'])){
+ if(isset($source["goFaxRBlocklist"])){
+ for ($i= 0; $i<$source["goFaxRBlocklist"]["count"]; $i++){
+ $this->goFaxBlocklist[]= $source["goFaxRBlocklist"][$i];
+ }
+ }
+ $this->type= BLOCK_LIST_RECEIVE;
+ }
+
+ /* Set base */
+ if ($this->dn == "new"){
+ if(isset($_SESSION['CurrentMainBase'])){
+ $this->base= $_SESSION['CurrentMainBase'];
+ }else{
+ $ui= get_userinfo();
+ $this->base= dn2base($ui->dn);
+ }
+ } else {
+ $this->base =preg_replace ("/^[^,]+,[^,]+,[^,]+,/","",$this->dn);
+ }
+ }
+
+
+ /* Return plugin informations for acl handling */
+ static function plInfo()
+ {
+ return (array(
+ "plShortName" => _("Fax"),
+ "plDescription" => _("Fax blocklists"),
+ "plSelfModify" => FALSE,
+ "plDepends" => array(),
+
+ "plPriority" => 0,
+ "plSection" => array("administration" => _("FAX Blocklists")),
+ "plCategory" => array("gofaxlist" => array("description" => _("Fax blocklists"),
+ "objectClass" => array("goFaxRBlock","goFaxSBlock"))),
+ "plProvidedAcls" => array(
+ "cn" => _("Name"),
+ "description" => _("Description"),
+ "base" => _("Base"),
+ "goFaxBlocklist" => _("Blocklist"),
+ "type" => _("Blocklist type"))
+ ));
+ }
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/gofax/gofax/blocklists/class_blocklistManagement.inc b/gosa-plugins/gofax/gofax/blocklists/class_blocklistManagement.inc
--- /dev/null
@@ -0,0 +1,477 @@
+<?php
+class blocklist extends plugin
+{
+ /* Definitions */
+ var $plHeadline= "FAX Blocklists";
+ var $plDescription= "This does something";
+
+ var $blocklists = array();
+ var $DivListBlocklist = NULL;
+ var $CopyPasteHandler = NULL;
+
+ var $start_pasting_copied_objects = FALSE;
+
+ function blocklist (&$config, $ui)
+ {
+ $this->ui = $ui;
+ $this->dn = "";
+ $this->config = &$config;
+ $this->base = $_SESSION['CurrentMainBase'];
+ $this->DivListBlocklist = new divListBlocklist($this->config,$this);
+
+ /* Initialize copy&paste queue */
+ if ($this->config->boolValueIsTrue("main", "enableCopyPaste")){
+ $this->CopyPasteHandler= new CopyPasteHandler($this->config);
+ }
+ }
+
+
+ function execute()
+ {
+ /* Call parent execute */
+ plugin::execute();
+
+ $_SESSION['LOCK_VARS_TO_USE'] = array("/^goFaxBlocklist_/","/^act$/","/^id$/","/^remove_multiple_blocklists/","/^item_selected/");
+
+ /***************
+ Init vars
+ ***************/
+
+ /* Get global smarty instance */
+ $smarty = get_smarty();
+ $s_action = ""; // Contains the action to proceed
+ $s_entry = ""; // The value for s_action
+ $base_back = ""; // The Link for Backbutton
+
+
+ /***************
+ Fetch posts
+ ***************/
+
+ /* Test Posts */
+ foreach($_POST as $key => $val){
+ // Post for delete
+ if(preg_match("/^goFaxBlocklist_del.*/",$key)){
+ $s_action = "del";
+ $s_entry = preg_replace("/^goFaxBlocklist_del_/i","",$key);
+ // Post for edit
+ }elseif(preg_match("/^goFaxBlocklist_edit_.*/",$key)){
+ $s_action="edit";
+ $s_entry = preg_replace("/^goFaxBlocklist_edit_/i","",$key);
+ // Post for new
+ }elseif(preg_match("/^goFaxBlocklist_new.*/",$key)){
+ $s_action="new";
+ }elseif(preg_match("/^remove_multiple_blocklists/",$key)){
+ $s_action="del_multiple";
+ }elseif(preg_match("/^copy/",$key)){
+ $s_action = "copy";
+ $s_entry= preg_replace("/^copy_/i", "", $key);
+ }elseif(preg_match("/^cut/",$key)){
+ $s_action = "cut";
+ $s_entry= preg_replace("/^cut_/i", "", $key);
+ }
+
+ }
+ if((isset($_GET['act']))&&($_GET['act']=="edit_entry")){
+ $s_action ="edit";
+ $s_entry = $_GET['id'];
+ }
+
+ $s_entry = preg_replace("/_.$/","",$s_entry);
+
+
+ /* handle C&P from layers menu */
+ if(isset($_POST['menu_action']) && preg_match("/^multiple_copy_systems/",$_POST['menu_action'])){
+ $s_action = "copy_multiple";
+ }
+ if(isset($_POST['menu_action']) && preg_match("/^multiple_cut_systems/",$_POST['menu_action'])){
+ $s_action = "cut_multiple";
+ }
+ if(isset($_POST['menu_action']) && preg_match("/^editPaste/",$_POST['menu_action'])){
+ $s_action = "editPaste";
+ }
+
+
+ /* Create options */
+ if(isset($_POST['menu_action']) && $_POST['menu_action'] == "goFaxBlocklist_new"){
+ $s_action = "new";
+ }
+
+ /* handle remove from layers menu */
+ if(isset($_POST['menu_action']) && preg_match("/^remove_multiple/",$_POST['menu_action'])){
+ $s_action = "del_multiple";
+ }
+
+
+ /***************
+ Handle copy & paste
+ ***************/
+
+ $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
+ if($ret){
+ return($ret);
+ }
+
+
+ /***************
+ Cancel some dialogs
+ ***************/
+
+ /* Cancel dialog */
+ if (isset($_POST['edit_cancel']) ||
+ isset($_POST['delete_blocklist_cancel']) ||
+ isset($_POST['delete_lock'])){
+
+ del_lock ($this->dn);
+ $this->dialog = NULL;
+ unset($_SESSION['objectinfo']);
+ }
+
+
+ /***************
+ Save blocklist
+ ***************/
+
+ /* What about finish? */
+ if (isset($_POST['edit_finish']) || isset($_POST['edit_apply'])){
+
+ /* No errors, save object */
+ $this->dialog->save_object();
+ $message= $this->check();
+ if (count ($message) == 0){
+
+ $this->dialog->save ();
+
+ if (!isset($_POST['edit_apply'])){
+ del_lock ($this->dn);
+ $this->dn= "";
+ $this->dialog = NULL;
+ unset($_SESSION['objectinfo']);
+ }
+ } else {
+ /* Errors found, show message */
+ show_errors ($message);
+ }
+ }
+
+
+ /***************
+ Create a new blocklist (dialog)
+ ***************/
+
+ /* Create new blocklist? */
+ if ($s_action=="new"){
+ $this->dn= "new";
+ $this->dialog = new faxblocktabs($this->config,$this->config->data['TABS']['FAXBLOCKTABS'],$this->dn);
+ $this->dialog->set_acl_base($this->base);
+ }
+
+
+ /***************
+ Edit blocklist
+ ***************/
+
+ if ($s_action=="edit" && !is_object($this->dialog)){
+
+ $this->dn=$this->blocklists[$s_entry]['dn'];
+
+ if (($user= get_lock($this->dn)) != ""){
+ return(gen_locked_message($user, $this->dn));
+ }else{
+ add_lock ($this->dn, $this->ui->dn);
+ }
+ $_SESSION['objectinfo']= trim($this->dn);
+ $this->dialog = new faxblocktabs($this->config,$this->config->data['TABS']['FAXBLOCKTABS'],$this->dn);
+ $this->dialog->set_acl_base($this->dn);
+ }
+
+
+ /***************
+ Display dialog
+ ***************/
+
+ if(is_object($this->dialog) && ($this->dialog instanceof faxblocktabs)){
+ $this->dialog->save_object();
+ return($this->dialog->execute());
+ }
+
+
+ /********************
+ Delete MULTIPLE entries requested, display confirm dialog
+ ********************/
+
+ if ($s_action=="del_multiple"){
+
+ $this->dns = array();
+ $ids = $this->list_get_selected_items();
+
+ if(count($ids)){
+ foreach($ids as $id){
+ $dn = $this->blocklists[$id]['dn'];
+ if (($user= get_lock($dn)) != ""){
+ return(gen_locked_message ($user, $dn));
+ }
+ $this->dns[$id] = $dn;
+ }
+
+ $dns_names = "<br><pre>";
+ foreach($this->dns as $dn){
+ add_lock ($dn, $this->ui->dn);
+ $dns_names .= $dn."\n";
+ }
+ $dns_names .="</pre>";
+
+ /* Lock the current entry, so nobody will edit it during deletion */
+ $smarty->assign("info", sprintf(_("You're about to delete the following blocklists(s) %s"), @LDAP::fix($dns_names)));
+ $smarty->assign("multiple", true);
+ return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+ }
+ }
+
+
+ /********************
+ Delete MULTIPLE entries confirmed
+ ********************/
+
+ /* Confirmation for deletion has been passed. */
+ if (isset($_POST['delete_multiple_blocklist_confirm'])){
+
+ /* Remove user by user and check acls before removeing them */
+ foreach($this->dns as $key => $dn){
+ if (preg_match("/d/",$this->ui->get_permissions($this->dn,"gofaxlist/blocklistGeneric"))){
+ $this->dn = $dn;
+ $this->dialog = new faxblocktabs($this->config,$this->config->data['TABS']['FAXBLOCKTABS'],$this->dn);
+ $this->dialog->delete();
+ $this->dialog = NULL;
+ } else {
+ print_red (sprintf(_("You are not allowed to delete the blocklist '%s'!"),$dn));
+ }
+ /* Remove lock file after successfull deletion */
+ del_lock ($dn);
+ unset($this->dns[$key]);
+ }
+ $this->reload();
+ }
+
+
+ /********************
+ Delete MULTIPLE entries Canceled
+ ********************/
+
+ /* Remove lock */
+ if(isset($_POST['delete_multiple_blocklist_cancel'])){
+ foreach($this->dns as $key => $dn){
+ del_lock ($dn);
+ unset($this->dns[$key]);
+ }
+ }
+
+
+ /***************
+ Remove blocklist
+ ***************/
+
+ /* Delete blocklist requested */
+ if ($s_action=="del"){
+ $this->dn=$this->blocklists[$s_entry]['dn'];
+
+ /* Check locking */
+ if (($user= get_lock($this->dn)) != ""){
+ $_SESSION['dn']= $this->dn;
+ return(gen_locked_message($user, $this->dn));
+ } else {
+
+ // Lock this dn for editing
+ add_lock ($this->dn, $this->ui->dn);
+ $smarty->assign("info", sprintf(_("You're about to delete the blocklist '%s'."), $this->dn));
+ $smarty->assign("multiple", false);
+ return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+ }
+ }
+
+
+ /***************
+ Remove blocklist confirmed
+ ***************/
+
+ /* Finally delete blocklist */
+ if (isset($_POST['delete_blocklist_confirm'])){
+ if (preg_match("/d/",$this->ui->get_permissions($this->dn,"gofaxlist/blocklistGeneric"))){
+ $this->dialog = new faxblocktabs($this->config,$this->config->data['TABS']['FAXBLOCKTABS'],$this->dn);
+ $this->dialog->delete();
+ $this->dialog = NULL;
+ del_lock ($this->dn);
+ } else {
+ print_red (_("You have no permission to remove this blocklist."));
+ }
+ }
+
+ /***************
+ Divlist dialog
+ ***************/
+
+ /* Check if there is a snapshot dialog open */
+ $base = $this->DivListBlocklist->selectedBase;
+ if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases())){
+ return($str);
+ }
+
+ /* Display dialog with system list */
+ $this->DivListBlocklist->parent = $this;
+ $this->DivListBlocklist->execute();
+
+ /* Add departments if subsearch is disabled */
+ if(!$this->DivListBlocklist->SubSearch){
+ $this->DivListBlocklist->AddDepartments($this->DivListBlocklist->selectedBase,3,1);
+ }
+ $this->reload();
+ $this->DivListBlocklist->setEntries($this->blocklists);
+ return($this->DivListBlocklist->Draw());
+ }
+
+
+ function list_get_selected_items()
+ {
+ $ids = array();
+ foreach($_POST as $name => $value){
+ if(preg_match("/^item_selected_[0-9]*$/",$name)){
+ $id = preg_replace("/^item_selected_/","",$name);
+ $ids[$id] = $id;
+ }
+ }
+ return($ids);
+ }
+
+
+ /* Return departments, that will be included within snapshot detection */
+ function get_used_snapshot_bases()
+ {
+ return(array("ou=gofax,ou=systems,". $this->DivListBlocklist->selectedBase));
+ }
+
+
+ /* Reload the list of known blocklists */
+ function reload()
+ {
+ /* Init some vars */
+ $filter = $filter2 = "";
+ $base = $this->DivListBlocklist->selectedBase;
+ $Regex = $this->DivListBlocklist->Regex;
+ $SubSearch = $this->DivListBlocklist->SubSearch;
+ $ShowSendBocklists = $this->DivListBlocklist->ShowSendBocklists;
+ $ShowReceiveBlocklists = $this->DivListBlocklist->ShowReceiveBlocklists;
+ $Flags = GL_SIZELIMIT;
+ $res = $res2 = array();
+
+ /* Append subsearch to Flags */
+ if($SubSearch){
+ $Flags |= GL_SUBSEARCH;
+ }else{
+ $base = "ou=gofax,ou=systems,".$base;
+ }
+
+ /* Create filter */
+ if ($ShowSendBocklists){
+ $filter = "(&(objectClass=goFaxSBlock)(|(cn=".$Regex.")(goFaxSBlocklist=".$Regex.")))";
+ $res= get_list($filter, "gofaxlist", $base,array("*"), $Flags);
+ }
+ if ($ShowReceiveBlocklists){
+ $filter2= "(&(objectClass=goFaxRBlock)(|(cn=".$Regex.")(goFaxRBlocklist=".$Regex.")))";
+ $res2= get_list($filter2, "gofaxlist", $base,array("*"), $Flags);
+ }
+
+ $this->blocklists = array_merge($res,$res2);
+
+ /* appen && sort */
+ $tmp=array();
+ foreach($this->blocklists as $tkey => $val ){
+
+ $acl = $this->ui ->get_permissions($base,"gofaxlist/blocklist");
+ if(preg_match("/r/",$acl)){
+ $tmp[strtolower($val['cn'][0]).$val['cn'][0]]=$val;
+ }
+ }
+ ksort($tmp);
+ $this->blocklists=array();
+ foreach($tmp as $val){
+ $this->blocklists[]=$val;
+ }
+ reset ($this->blocklists);
+ }
+
+
+ /* Save data to object */
+ function save_object()
+ {
+ $this->DivListBlocklist->save_object();
+ }
+
+
+
+
+
+ function copyPasteHandling_from_queue($s_action,$s_entry)
+ {
+ /* Check if Copy & Paste is disabled */
+ if(!is_object($this->CopyPasteHandler)){
+ return("");
+ }
+
+ /* Add a single entry to queue */
+ if($s_action == "cut" || $s_action == "copy"){
+ /* Cleanup object queue */
+ $this->CopyPasteHandler->cleanup_queue();
+ $dn = $this->blocklists[$s_entry]['dn'];
+ $this->CopyPasteHandler->add_to_queue($dn,$s_action,"faxblocktabs","FAXBLOCKTABS","gofaxlist");
+ }
+
+ /* Add entries to queue */
+ if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
+
+ /* Cleanup object queue */
+ $this->CopyPasteHandler->cleanup_queue();
+
+ /* Add new entries to CP queue */
+ foreach($this->list_get_selected_items() as $id){
+ $dn = $this->blocklists[$id]['dn'];
+
+ if($s_action == "copy_multiple"){
+ $this->CopyPasteHandler->add_to_queue($dn,"copy","faxblocktabs","FAXBLOCKTABS","gofaxlist");
+ }
+ if($s_action == "cut_multiple"){
+ $this->CopyPasteHandler->add_to_queue($dn,"cut","faxblocktabs","FAXBLOCKTABS","gofaxlist");
+ }
+ }
+ }
+
+ /* Start pasting entries */
+ if($s_action == "editPaste"){
+ $this->start_pasting_copied_objects = TRUE;
+ }
+
+ /* Return C&P dialog */
+ if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
+
+ /* Load entry from queue and set base */
+ $this->CopyPasteHandler->load_entry_from_queue();
+ $this->CopyPasteHandler->SetVar("base",$this->DivListBlocklist->selectedBase);
+
+ /* Get dialog */
+ $data = $this->CopyPasteHandler->execute();
+
+ /* Return dialog data */
+ if(!empty($data)){
+ return($data);
+ }
+ }
+
+ /* Automatically disable status for pasting */
+ if(!$this->CopyPasteHandler->entries_queued()){
+ $this->start_pasting_copied_objects = FALSE;
+ }
+ return("");
+ }
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/gofax/gofax/blocklists/class_divListBlocklists.inc b/gosa-plugins/gofax/gofax/blocklists/class_divListBlocklists.inc
--- /dev/null
@@ -0,0 +1,291 @@
+<?php
+
+class divListBlocklist extends MultiSelectWindow
+{
+
+ /* Current base */
+ var $selectedBase = "";
+ var $departments = array();
+
+ /* Regex */
+ var $Regex = "*";
+
+ /* checkboxes */
+ var $ShowSendBocklists ;
+ var $ShowReceiveBlocklists ;
+
+ /* Subsearch checkbox */
+ var $SubSearch;
+
+ var $parent ;
+ var $ui ;
+
+ function divListBlocklist (&$config, &$parent)
+ {
+ MultiSelectWindow::MultiSelectWindow($config, "Blocklists", "gofaxlist");
+
+ $this->parent = $parent;
+ $this->ui = get_userinfo();
+
+ /* Set list strings */
+ $this->SetTitle(_("List of blocklists"));
+ $this->SetSummary(_("List of blocklists"));
+
+ /* Result page will look like a headpage */
+ $this->SetHeadpageMode();
+ $this->SetInformation(_("This menu allows you to create, delete and edit selected blocklists. Having a large size of lists, you might prefer the range selectors on top of the select box."));
+
+ $this->EnableAplhabet (true);
+
+ /* Disable buttonsm */
+ $this->EnableCloseButton(false);
+ $this->EnableSaveButton (false);
+
+ /* Dynamic action col, depending on snapshot icons */
+ $action_col_size = 100;
+ if($this->parent->snapshotEnabled()){
+ $action_col_size += 20;
+ }
+
+ /* Toggle all selected / deselected */
+ $chk = "<input type='checkbox' id='select_all' name='select_all'
+ onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
+
+ /* set Page header */
+ $this->AddHeader(array("string"=> $chk, "attach"=>"style='width:20px;'"));
+ $this->AddHeader(array("string" => " ", "attach" => "style='text-align:center;width:20px;'"));
+ $this->AddHeader(array("string" => _("Blocklist name")." / "._("Department"), "attach" => "style=''"));
+ $this->AddHeader(array("string" => _("Actions"), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'" ));
+
+ /* Add Checkboxes / SubSearch checkbox */
+ $this->AddCheckBox("ShowSendBocklists" , _("Select to see send blocklists"), _("Show send blocklists"),true);
+ $this->AddCheckBox("ShowReceiveBlocklists" , _("Select to see receive blocklists"), _("Show receive blocklists"),true);
+
+ $this->AddCheckBox(SEPERATOR);
+ $this->AddCheckBox("SubSearch", _("Select to search within subtrees"), _("Search in subtrees"), false);
+
+ /* Name ,Text ,Default , Connect with alphabet */
+ $this->AddRegex ("Regex", _("Regular expression for matching list names"),"*" , true);
+ }
+
+
+ function GenHeader()
+ {
+ /* Prepare departments,
+ which are shown in the listbox on top of the listbox
+ */
+ $options= "";
+
+ /* Get all departments within this subtree */
+ $base = $this->config->current['BASE'];
+
+ /* Add base */
+ $tmp = array();
+ $tmp[] = array("dn"=>$this->config->current['BASE']);
+ $tmp= array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
+ array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
+
+ $deps = array();
+ foreach($tmp as $tm){
+ $deps[$tm['dn']] = $tm['dn'];
+ }
+
+ /* Load possible departments */
+ $ui= get_userinfo();
+ $tdeps= $ui->get_module_departments("gofaxlist");
+ $ids = $this->config->idepartments;
+ $first = "";
+ $found = FALSE;
+ foreach($ids as $dep => $name){
+ if(isset($deps[$dep]) && in_array_ics($dep, $tdeps)){
+
+ /* Keep first base dn in mind, we could need this
+ * info if no valid base was found
+ */
+ if(empty($first)) {
+ $first = $dep['dn'];
+ }
+
+ $value = $ids[$dep];
+ if ($this->selectedBase == $dep){
+ $found = TRUE;
+ $options.= "<option selected='selected' value='".$dep."'>$value</option>";
+ } else {
+ $options.= "<option value='".$dep."'>$value</option>";
+ }
+ }
+ }
+
+ /* The currently used base is not visible with your acl setup.
+ * Set base to first useable base.
+ */
+ if(!$found){
+ $this->selectedBase = $first;
+ }
+
+ /* Get acls */
+ $ui = get_userinfo();
+ $acl = $ui->get_permissions($this->selectedBase,"gofaxlist/blocklist");
+ $acl_all = $ui->has_complete_category_acls($this->selectedBase,"gofaxlist");
+
+ /* Add default header */
+ $listhead = MultiSelectWindow::get_default_header();
+
+ /* Append department selector */
+ $listhead .= " "._("Base")." <select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
+ " <input class='center' type='image' src='images/list_submit.png' align='middle'
+ title='"._("Submit department")."' name='submit_department' alt='"._("Submit")."'> ";
+
+ /* Create Layers menu */
+ $s = ".|"._("Actions")."|\n";
+ $s .= "..|<img src='images/list_new.png' alt='' border='0' class='center'>".
+ " "._("Create")."|\n";
+
+ /* Append create options */
+ if(preg_match("/c/",$acl)) {
+ $s.= "...|<input class='center' type='image' src='images/list_new_blocklist.png' alt=''>".
+ " "._("Blocklist")."|goFaxBlocklist_new|\n";
+ }
+
+ /* Multiple options */
+ $s.= "..|---|\n";
+ $s.= "..|<img src='images/edittrash.png' alt='' border='0' class='center'>".
+ " "._("Remove")."|"."remove_multiple|\n";
+
+ /* Add multiple copy & cut icons */
+ if(is_object($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
+ $s.= "..|---|\n";
+ $s.= "..|<img src='images/editcopy.png' alt='' border='0' class='center'>".
+ " "._("Copy")."|"."multiple_copy_systems|\n";
+ $s.= "..|<img src='images/editcut.png' alt='' border='0' class='center'>".
+ " "._("Cut")."|"."multiple_cut_systems|\n";
+
+ if($this->parent->CopyPasteHandler->entries_queued()){
+ $img = "<img border='0' class='center' src='images/editpaste.png' alt=''>";
+ $s.="..|".$img." "._("Paste")."|editPaste|\n";
+ }else{
+ $img = "<img border='0' class='center' src='images/cant_editpaste.png' alt=''>";
+ $s.="..|".$img." "._("Paste")."\n";
+ }
+ }
+
+ /* Add snapshot icons */
+ if(preg_match("/(c.*w|w.*c)/",$acl_all)){
+ $s .= "..|---|\n";
+ $s .= $this->get_snapshot_header(TRUE);
+ }
+
+ $this->SetDropDownHeaderMenu($s);
+
+ $this->SetListHeader($listhead);
+ }
+
+ function execute()
+ {
+ $this->ClearElementsList();
+ $this->GenHeader();
+ }
+
+ function setEntries($list)
+ {
+ // User and Template Images
+ $blockimg = "<img class='center' src='images/list_blocklist.png' alt='User' title='%s'>";
+ $editlink = "<a href='?plug=".$_GET['plug']."&id=%s&act=edit_entry'>%s</a>";
+
+ /* Dynamic action col, depending on snapshot icons */
+ $action_col_size = 100;
+ if($this->parent->snapshotEnabled()){
+ $action_col_size += 20;
+ }
+
+ /* Append to list */
+ $ui = get_userinfo();
+ foreach($list as $key => $val){
+
+ $acl = $ui->get_permissions($val['dn'],"gofaxlist/blocklist");
+ if(!preg_match("/r/",$acl)){
+ continue;
+ }
+
+ /* Edit link ; requires read access */
+ $action= "<input class='center' type='image' src='images/edit.png' alt='"._("edit")."' name='goFaxBlocklist_edit_%KEY%' title='"._("Edit user")."'>";
+
+
+ /* Create snapshot ; requires write access && create access */
+ if(preg_match("/w/",$acl) && preg_match("/c/",$acl)){
+ $action.= $this->GetSnapShotActions($val['dn']);
+ }
+
+ /* Add copy & cut icons */
+ if(preg_match("/(c.*w|w.*c)/",$acl) && $this->parent->CopyPasteHandler){
+ $action .= "<input class='center' type='image'
+ src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'> ";
+ $action.= "<input class='center' type='image'
+ src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'> ";
+ }
+
+
+ /* Delete entry ; requires remove access */
+ if(preg_match("/d/",$acl)){
+ $action.= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."' name='goFaxBlocklist_del_%KEY%' title='"._("Delete user")."'>";
+ }
+
+ // Generate Array to Add
+ if(isset($val["description"][0])){
+ $display= $val["cn"][0]." [".$val["description"][0]."]";
+ }else{
+ $display= $val["cn"][0];
+ }
+
+ /* Cutted objects should be displayed in light grey */
+ if(isset($this->parent->CopyPasteHandler->queue) && is_array($this->parent->CopyPasteHandler->queue)){
+ foreach($this->parent->CopyPasteHandler->queue as $queue_key => $queue_data){
+ if($queue_data['dn'] == $val['dn']) {
+ $display = "<font color='#999999'>".$display."</font>";
+ break;
+ }
+ }
+ }
+
+
+ /* Create each field */
+ $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
+ "attach" => "style='width:20px;'");
+ $field1 = array("string" => sprintf($blockimg,$val['dn']), "attach" => "style='text-align:center;width:20px;'");
+ $field2 = array("string" => sprintf($editlink,$key,$display), "attach" => "style='' title='".preg_replace('/ /', ' ', @LDAP::fix($val['dn']))."'");
+ $field3 = array("string" => preg_replace("/%KEY%/", "$key", $action), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'");
+ $this->AddElement( array($field0,$field1,$field2,$field3));
+ }
+
+ /* Create summary string for list footer */
+ $num_deps=0;
+ if(!$this->SubSearch){
+ $num_deps = count($this->Added_Departments);
+ }
+ $num_objs = count($list);
+
+ $num_obj_str = _("Number of listed blocklists");
+ $num_dep_str = _("Number of listed departments");
+
+ $str = "<img class='center' src='images/list_blocklist.png'
+ title='".$num_obj_str."' alt='".$num_obj_str."'> ".$num_objs." ";
+ $str.= "<img class='center' src='images/folder.png'
+ title='".$num_dep_str."' alt='".$num_dep_str."'> ".$num_deps." ";
+
+ $this->set_List_Bottom_Info($str);
+
+ }
+
+ function Save()
+ {
+ MultiSelectWindow :: Save();
+ }
+
+ function save_object()
+ {
+ /* Save automatic created POSTs like regex, checkboxes */
+ MultiSelectWindow :: save_object();
+ }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/gofax/gofax/blocklists/generic.tpl b/gosa-plugins/gofax/gofax/blocklists/generic.tpl
--- /dev/null
@@ -0,0 +1,109 @@
+<h2><img class="center" alt="" align="middle" src="images/rightarrow.png"> {t}Generic{/t}</h2>
+<table summary="" style="width:100%; vertical-align:top; text-align:left;">
+
+ <tr>
+ <td style="width:50%; vertical-align:top;">
+ <table summary="">
+ <tr>
+ <td><LABEL for="cn">{t}List name{/t}</LABEL>{$must}</td>
+ <td>
+
+{render acl=$cnACL}
+ <input name="cn" id="cn" size=25 maxlength=60 value="{$cn}" title="{t}Name of blocklist{/t}">
+{/render}
+ </td>
+ </tr>
+ <tr>
+ <td><LABEL for="base">{t}Base{/t}</LABEL>{$must}</td>
+ <td>
+{render acl=$baseACL}
+ <select id="base" size="1" name="base" title="{t}Choose subtree to place group in{/t}">
+ {html_options options=$bases selected=$base}
+ </select>
+{/render}
+
+{render acl=$baseACL disable_picture='images/folder_gray.png'}
+ <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
+{/render}
+ </td>
+ </tr>
+ </table>
+ </td>
+
+ <td style="border-left:1px solid #A0A0A0">
+
+ </td>
+
+ <td style="vertical-align:top;">
+ <table summary="">
+ <tr>
+ <td><LABEL for="type">{t}Type{/t}</LABEL></td>
+ <td>
+{render acl=$typeACL}
+ <select size="1" id="type" name="type" title="{t}Select wether to filter incoming or outgoing calls{/t}">
+ {html_options options=$types selected=$type}
+ <option disabled> </option>
+ </select>
+{/render}
+ </td>
+ </tr>
+ <tr>
+ <td><LABEL for="description">{t}Description{/t}</LABEL></td>
+ <td>
+{render acl=$descriptionACL}
+ <input name="description" id="description" size=25 maxlength=80 value="{$description}" title="{t}Descriptive text for this blocklist{/t}">
+{/render}
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+
+<p class="plugbottom" style="margin-bottom:0px; padding:0px;"> </p>
+
+<table summary="" style="width:100%">
+ <tr>
+ <td style="width:50%;">
+ <h2><img class="center" alt="" align="middle" src="images/false.png"> {t}Blocked numbers{/t}</h2>
+{render acl=$goFaxBlocklistACL}
+ <select style="width:100%; height:200px;" name="numbers[]" size=15 multiple>
+ {html_options values=$goFaxBlocklist output=$goFaxBlocklist}
+ <option disabled> </option>
+ </select>
+{/render}
+ <br>
+{render acl=$goFaxBlocklistACL}
+ <input id="number" name="number" size=25 maxlength=60 >
+{/render}
+{render acl=$goFaxBlocklistACL}
+ <input type=submit value="{t}Add{/t}" name="add_number">
+{/render}
+{render acl=$goFaxBlocklistACL}
+ <input type=submit value="{t}Delete{/t}" name="delete_number">
+{/render}
+ </td>
+ <td style="border-left:1px solid #A0A0A0">
+
+ </td>
+ <td style="vertical-align:top;" >
+ <h2><img class="center" alt="" align="middle" src="images/info_small.png"> {t}Information{/t}</h2>
+ <p>
+ {t}Numbers can also contain wild cards.{/t}
+ </p>
+ </td>
+ </tr>
+</table>
+
+<p class="plugbottom">
+ <input type=submit name="edit_finish" style="width:80px" value="{t}Ok{/t}">
+ <input type=submit name="edit_apply" value="{t}Apply{/t}">
+ <input type=submit name="edit_cancel" value="{t}Cancel{/t}">
+</p>
+<input type='hidden' name='blocklist_posted' value="1">
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+ <!-- // First input field on page
+ focus_field('n');
+ -->
+</script>
diff --git a/gosa-plugins/gofax/gofax/blocklists/main.inc b/gosa-plugins/gofax/gofax/blocklists/main.inc
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+if ($remove_lock){
+ if(isset($_SESSION['blocklist'])){
+ $blocklist= $_SESSION['blocklist'];
+ del_lock ($ui->dn);
+ sess_del ('blocklist');
+ }
+} else {
+ /* Create blocklist object on demand */
+ if (!isset($_SESSION['blocklist']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+ $_SESSION['blocklist']= new blocklist($config, $ui);
+ $_SESSION['blocklist']->set_acl_category("gofaxlist");
+ }
+ $blocklist= $_SESSION['blocklist'];
+ $blocklist->save_object();
+ $output= $blocklist->execute();
+
+ /* Reset requested? */
+ if (isset($_GET['reset']) && $_GET['reset'] == 1){
+ del_lock ($ui->dn);
+ sess_del ('blocklist');
+ }
+
+ /* Page header*/
+ if (isset($_SESSION['objectinfo'])){
+ $display= print_header(get_template_path('images/blocklists.png'), _("Blocklist management"), "<img alt=\"\"align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".@LDAP::fix($_SESSION['objectinfo']));
+ } else {
+ $display= print_header(get_template_path('images/blocklists.png'), _("Blocklist management"));
+ }
+ $display.= $output;
+
+ $_SESSION['blocklist']= $blocklist;
+}
+?>
diff --git a/gosa-plugins/gofax/gofax/blocklists/paste_generic.tpl b/gosa-plugins/gofax/gofax/blocklists/paste_generic.tpl
--- /dev/null
@@ -0,0 +1,8 @@
+<table summary="">
+ <tr>
+ <td><LABEL for="cn">{t}List name{/t}</LABEL></td>
+ <td>
+ <input name="cn" id="cn" size=25 maxlength=60 value="{$cn}" title="{t}Name of blocklist{/t}">
+ </td>
+ </tr>
+</table>
diff --git a/gosa-plugins/gofax/gofax/blocklists/remove.tpl b/gosa-plugins/gofax/gofax/blocklists/remove.tpl
--- /dev/null
@@ -0,0 +1,24 @@
+<div style="font-size:18px;">
+ <img alt="" src="images/button_cancel.png" align=top> {t}Warning{/t}
+</div>
+<p>
+ {$info}
+ {t}Please double check if your really want to do this since there is no way for GOsa to get your data back.{/t}
+</p>
+
+<p>
+ {t}So - if you're sure - press 'Delete' to continue or 'Cancel' to abort.{/t}
+</p>
+
+<p class="plugbottom">
+ {if $multiple}
+ <input type=submit name="delete_multiple_blocklist_confirm" value="{t}Delete{/t}">
+
+ <input type=submit name="delete_multiple_blocklist_cancel" value="{t}Cancel{/t}">
+ {else}
+ <input type=submit name="delete_blocklist_confirm" value="{t}Delete{/t}">
+
+ <input type=submit name="delete_blocklist_cancel" value="{t}Cancel{/t}">
+ {/if}
+</p>
+
diff --git a/gosa-plugins/gofax/gofax/blocklists/tabs_blocklist.inc b/gosa-plugins/gofax/gofax/blocklists/tabs_blocklist.inc
--- /dev/null
@@ -0,0 +1,38 @@
+<?php
+
+class faxblocktabs extends tabs
+{
+ function faxblocktabs($config, $data, $dn)
+ {
+ tabs::tabs($config, $data, $dn, 'gofaxlist');
+
+ /* Add references/acls/snapshots */
+ $this->addSpecialTabs();
+ }
+
+ function save($ignore_account= FALSE)
+ {
+ $baseobject= $this->by_object['blocklistGeneric'];
+
+ /* Check for new 'dn', in order to propagate the 'dn' to all plugins */
+ $new_dn= "cn=".$baseobject->cn.",ou=gofax,ou=systems,".$baseobject->base;
+
+ /* Move group? */
+ if ($this->dn != $new_dn){
+
+ /* Write entry on new 'dn' */
+ if ($this->dn != "new"){
+ $baseobject->move($this->dn, $new_dn);
+ $this->by_object['blocklistGeneric']= $baseobject;
+ }
+
+ /* Happen to use the new one */
+ $this->dn= $new_dn;
+ }
+
+ tabs::save();
+ }
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/gofax/gofax/faxaccount/class_gofaxAccount.inc b/gosa-plugins/gofax/gofax/faxaccount/class_gofaxAccount.inc
--- /dev/null
@@ -0,0 +1,857 @@
+<?php
+
+class gofaxAccount extends plugin
+{
+ /* Definitions */
+ var $plHeadline= "FAX";
+ var $plDescription= "This does something";
+
+ /* CLI vars */
+ var $cli_summary= "Manage users fax account";
+ var $cli_description= "Some longer text\nfor help";
+ var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+
+ /* Department list shown in the divSelectList*/
+ var $departments;
+
+ /* Fax attributes */
+ var $goFaxDeliveryMode= "";
+ var $facsimileTelephoneNumber= "";
+ var $goFaxIsEnabled= 1;
+ var $goFaxPrinter= "";
+ var $goFaxDivertNumber= "";
+ var $goFaxLanguage= "";
+ var $goFaxFormat= "";
+ var $goFaxRBlocklist = array();
+ var $goFaxRBlockgroups= array();
+ var $goFaxSBlocklist= array();
+ var $goFaxSBlockgroups= array();
+ var $mail= "";
+ var $facsimileAlternateTelephoneNumber= array();
+ var $fax_formats = array("pdf","ps","png","mtiff","tiff");
+
+ /* Internal variables */
+ var $printerList= array();
+ var $has_mailAccount= FALSE;
+ var $locals_dialog= FALSE;
+ var $in_blocklist_dialog= FALSE;
+ var $out_blocklist_dialog= FALSE;
+ var $current_blocklist= array();
+ var $view_logged = FALSE;
+
+ /* Copy & paste variables */
+ var $CopyPasteVars=array("facsimileTelephoneNumber");//,"goFaxRBlocklist","goFaxRBlockgroups","goFaxSBlocklist","goFaxSBlockgroups");
+
+ /* attribute list for save action */
+ var $attributes= array("goFaxDeliveryMode", "goFaxIsEnabled","facsimileAlternateTelephoneNumber","goFaxRBlocklist","goFaxRBlockgroups","goFaxSBlocklist","goFaxSBlockgroups","goFaxPrinter", "goFaxDivertNumber", "goFaxLanguage", "goFaxFormat", "mail","facsimileTelephoneNumber");
+
+ var $uid ="";
+
+ var $objectclasses= array("goFaxAccount");
+
+ function gofaxAccount (&$config, $dn= NULL)
+ {
+ /* General initialization */
+ plugin::plugin ($config, $dn);
+
+ /* Set uid, it is used in handle_post_events */
+ if(isset($this->attrs['uid'])){
+ $this->uid = $this->attrs['uid'][0];
+ }
+
+ /* Hickert : 11.11.05
+ * Added to be able to handle department selection in divSelelect
+ */
+ if(!isset($_SESSION["Fax_Filter"])){
+ $_SESSION['Fax_Filter']['depselect'] = $this->config->current['BASE'];
+ }
+
+ if ($dn != "new"){
+ /* Get arrays */
+ foreach (array("goFaxRBlocklist", "goFaxRBlockgroups", "goFaxSBlocklist",
+ "goFaxSBlockgroups", "facsimileAlternateTelephoneNumber") as $val){
+ $this->$val =array();
+ if (isset($this->attrs["$val"]["count"])){
+ for ($i= 0; $i<$this->attrs["$val"]["count"]; $i++){
+ array_push($this->$val, $this->attrs["$val"][$i]);
+ }
+ }
+ }
+
+ /* Set up has_mailAccount */
+ if (in_array("gosaMailAccount", $this->attrs['objectClass'])){
+ $this->has_mailAccount= TRUE;
+ }
+ }
+
+ /* Load printer list */
+ if (isset($this->config->data['SERVERS']['CUPS'])){
+ $this->printerList= get_printer_list ($this->config->data['SERVERS']['CUPS']);
+ asort ($this->printerList);
+ }
+
+ /* Check if the currently selected printer is still available.
+ If not, append current printer to list of available.
+ It could be possible, that we are not allowed to view printers and so the list is empty ... */
+ if(!empty($this->goFaxPrinter) && !isset($this->printerList[$this->goFaxPrinter])) {
+ $this->printerList[$this->goFaxPrinter] = "[".$this->goFaxPrinter."]";
+ }
+
+ /* Get global filter config */
+ if (!is_global("faxfilter")){
+ $ui= get_userinfo();
+ $base= get_base_from_people($ui->dn);
+ $faxfilter= array( "depselect" => $base,
+ "fuser" => "*",
+ "regex" => "");
+ register_global("faxfilter", $faxfilter);
+ }
+ }
+
+ function execute()
+ {
+ /* Call parent execute */
+ plugin::execute();
+
+ /* Log view */
+ if($this->is_account && !$this->view_logged){
+ $this->view_logged = TRUE;
+ new log("view","users/".get_class($this),$this->dn);
+ }
+
+ /* Hickert : 11.11.05
+ * Added to be able to handle department selection in divSelelect
+ */
+ if((isset($_GET['act']))&&($_GET['act']=="dep_open")){
+
+ if(strlen(base64_decode($_GET['dep_id']))>= strlen($this->config->current['BASE'])){
+ $_SESSION['Fax_Filter']['depselect']= base64_decode($_GET['dep_id']);
+ }else{
+ $_SESSION['Fax_Filter']['depselect']= $this->config->current['BASE'];
+ }
+ }
+
+ /* Edit mode specifies if we are editing from my accout */
+ $edit_mode = (!is_object($this->parent) && !isset($_SESSION['edit']));
+
+ /* Load smarty stuff */
+ $smarty= get_smarty();
+
+ /* Check if mail account is active. We'll display an additional
+ mail address field if this is not the case. Some people may
+ want goFax, but have a mailserver which is not managed with
+ GOsa */
+ if (!@isset($this->parent->by_object['mailAccount'])) {
+ $smarty->assign("has_mailaccount", $this->has_mailAccount?"true":"false");
+ } elseif ( !$this->parent->by_object['mailAccount']->is_account){
+ $smarty->assign("has_mailaccount", "false");
+ $this->has_mailAccount= false;
+ } else {
+ $smarty->assign("has_mailaccount", "true");
+ }
+
+ /* Do we need to flip is_account state? */
+ if (isset($_POST['modify_state'])){
+ $this->is_account= !$this->is_account;
+ }
+
+ /* Do we represent a valid account? */
+ if (!$this->is_account && $this->parent === NULL){
+ $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\"> <b>".
+ _("This account has no fax extensions.")."</b>";
+ $display.= back_to_main();
+ return ($display);
+ }
+
+ /* Show tab dialog headers */
+ $display= "";
+ if ($this->parent !== NULL){
+ if ($this->is_account){
+ $display= $this->show_disable_header(_("Remove fax account"),
+ _("This account has fax features enabled. You can disable them by clicking below."));
+ } else {
+ $display= $this->show_enable_header(_("Create fax account"),
+ _("This account has fax features disabled. You can enable them by clicking below."));
+ return ($display);
+ }
+ }
+
+ /* Trigger Add local fax alternatives dialog */
+ if (isset($_POST['add_local_alternate'])){
+ if($this->acl_is_writeable("facsimileAlternateTelephoneNumber",$edit_mode)){
+ $this->locals_dialog= TRUE;
+ $this->dialog= TRUE;
+ }
+ }
+
+ /* Add alternatives from dialog */
+ if (isset($_POST['add_locals_finish']) && isset($_POST['local_list'])){
+ if($this->acl_is_writeable("facsimileAlternateTelephoneNumber",$edit_mode)){
+ foreach ($_POST['local_list'] as $val){
+ $this->addAlternate($val);
+ $this->is_modified= TRUE;
+ }
+ }
+ }
+
+ /* Add alternatives */
+ if (isset($_POST['add_alternate']) && !empty($_POST['forward_address']) && is_phone_nr($_POST['forward_address'])){
+ if($this->acl_is_writeable("facsimileAlternateTelephoneNumber",$edit_mode)){
+ $this->addAlternate($_POST['forward_address']);
+ }
+ }
+
+ /* Delete alternate fax number */
+ if (isset($_POST['delete_alternate']) && isset($_POST['alternate_list']) && count($_POST['alternate_list'])){
+ if($this->acl_is_writeable("facsimileAlternateTelephoneNumber",$edit_mode)){
+ $this->delAlternate ($_POST['alternate_list']);
+ }
+ }
+
+
+ /* Edit incoming blocklists */
+ if (isset($_POST['edit_incoming'])){
+ if($this->acl_is_writeable("goFaxRBlocklist",$edit_mode)) {
+ $this->current_blocklist= array_merge($this->goFaxRBlocklist,$this->goFaxRBlockgroups);
+ sort($this->current_blocklist);
+ reset($this->current_blocklist);
+
+ $this->in_blocklist_dialog= TRUE;
+ $this->dialog= TRUE;
+ }
+ }
+
+ /* Edit outgoing blocklists */
+ if (isset($_POST['edit_outgoing'])){
+ $this->current_blocklist= array_merge($this->goFaxSBlocklist,$this->goFaxSBlockgroups);
+ sort($this->current_blocklist);
+ reset($this->current_blocklist);
+
+ $this->out_blocklist_dialog= TRUE;
+ $this->dialog= TRUE;
+ }
+
+ /* Add number to blocklist (dialog) */
+ if (isset($_POST['add_blocklist_number']) && $_POST['block_number'] != ""){
+ if (!is_phone_nr($_POST['block_number'])){
+ print_red (_("You're trying to add an invalid phone number."));
+ } else {
+ array_push($this->current_blocklist, $_POST['block_number']);
+ $this->current_blocklist= array_unique($this->current_blocklist);
+ sort($this->current_blocklist);
+ reset($this->current_blocklist);
+ }
+ }
+
+ /* Hickert : 11.11.05
+ * Add selection from divSelelect to our Blocklist
+ */
+ /* Add list to blocklist */
+ if (isset($_POST['add_blocklist'])){
+ foreach($_POST as $name => $value){
+ if(preg_match("/ADDLIST_/i",$name)){
+ $this->current_blocklist= array_merge($this->current_blocklist, array(base64_decode($value)));
+
+ }
+ }
+ $this->current_blocklist= array_unique($this->current_blocklist);
+ sort($this->current_blocklist);
+ reset($this->current_blocklist);
+ }
+
+ /* Add list to blocklist */
+ if (isset($_GET['add'])){
+ if(!is_array($this->current_blocklist)) $this->current_blocklist=array();
+ $this->current_blocklist= array_merge($this->current_blocklist, array( base64_decode($_GET['add'])));
+ $this->current_blocklist= array_unique($this->current_blocklist);
+ sort($this->current_blocklist);
+ reset($this->current_blocklist);
+ }
+
+ /* Delete from blocklist */
+ if (isset($_POST['delete_blocklist_number']) && isset($_POST['block_list'])){
+ $tmp= array();
+ foreach($this->current_blocklist as $val){
+ if (!in_array($val, $_POST['block_list'])){
+ $tmp[]= $val;
+ }
+ }
+ $this->current_blocklist= $tmp;
+ }
+
+
+ /* Blocklist edit finished */
+ if (isset($_POST['edit_blocklists_finish'])){
+
+ /* Incoming or outgoing? */
+ if ($this->in_blocklist_dialog){
+ $this->goFaxRBlocklist = array();
+ $this->goFaxRBlockgroups = array();
+
+ foreach ($this->current_blocklist as $val){
+ if (is_phone_nr($val)){
+ $this->goFaxRBlocklist[]=$val;
+ } else {
+ $this->goFaxRBlockgroups[]= $val;
+ }
+ }
+ } else {
+ $this->goFaxSBlocklist = array();
+ $this->goFaxSBlockgroups = array();
+
+ /* Transfer values to ourself */
+ foreach ($this->current_blocklist as $val){
+ if (is_phone_nr($val)){
+ $this->goFaxSBlocklist[]=$val;
+ } else {
+ $this->goFaxSBlockgroups[]= $val;
+ }
+ }
+ }
+ $this->is_modified= TRUE;
+ }
+
+
+ /* Set departments */
+ if ($this->locals_dialog || $this->in_blocklist_dialog || $this->out_blocklist_dialog){
+
+ $list= array ();
+ $ldap= $this->config->get_ldap_link();
+ if (isset ($_POST['department'])){
+ $ldap->cd ($_POST['department']);
+ } else {
+ $ldap->cd ($this->config->current['BASE']);
+ }
+ }
+
+ /* Cancel dialogs */
+ if (isset($_POST['add_locals_cancel']) || isset($_POST['edit_blocklists_finish']) ||
+ isset($_POST['edit_blocklists_cancel']) || isset($_POST['add_locals_finish'])){
+
+ $this->locals_dialog= FALSE;
+ $this->in_blocklist_dialog= FALSE;
+ $this->out_blocklist_dialog= FALSE;
+ $this->dialog= FALSE;
+ }
+
+ /* Manage locals dialog */
+ if ($this->locals_dialog){
+
+ /* Save data */
+ $faxfilter= get_global("faxfilter");
+ foreach( array("depselect", "fuser", "regex") as $type){
+ if (isset($_POST[$type])){
+ $faxfilter[$type]= $_POST[$type];
+ }
+ }
+ if (isset($_GET['search'])){
+ $s= mb_substr($_GET['search'], 0, 1, "UTF8")."*";
+ if ($s == "**"){
+ $s= "*";
+ }
+ $faxfilter['fuser']= $s;
+ }
+
+ if ($faxfilter['regex'] != '*' && $faxfilter['regex'] != ""){
+ $regex= $faxfilter['regex'];
+ $filter= "(facimileTelephoneNumber=$regex)";
+ } else {
+ $filter= "";
+ }
+ if ($faxfilter['fuser'] != ""){
+ $user= $faxfilter['fuser'];
+ $filter= "$filter(|(uid=$user)(cn=$user)(givenName=$user)(sn=$user))";
+ }
+
+ $base= $faxfilter['depselect'];
+ $res= get_list("(&(objectClass=goFaxAccount)$filter)", "gofax", $base,
+ array("sn", "givenName", "facsimileTelephoneNumber"), GL_SIZELIMIT | GL_SUBSEARCH);
+
+ foreach ($res as $attrs){
+ $list[$attrs['facsimileTelephoneNumber'][0]]=
+ $attrs['sn'][0].", ".
+ $attrs['givenName'][0]." [".
+ $attrs['facsimileTelephoneNumber'][0]."]";
+ }
+
+ /* Show dialog */
+ $smarty->assign("search_image", get_template_path('images/search.png'));
+ $smarty->assign("usearch_image", get_template_path('images/search_user.png'));
+ $smarty->assign("tree_image", get_template_path('images/tree.png'));
+ $smarty->assign("infoimage", get_template_path('images/info.png'));
+ $smarty->assign("launchimage", get_template_path('images/small_filter.png'));
+ $smarty->assign("departments", $this->config->idepartments);
+ $smarty->assign("list", $list);
+ if (isset($_POST['depselect'])){
+ $smarty->assign("depselect", $_POST['depselect']);
+ }
+ $smarty->assign("deplist", $this->config->idepartments);
+ $smarty->assign("apply", apply_filter());
+ $smarty->assign("alphabet", generate_alphabet());
+ $smarty->assign("hint", print_sizelimit_warning());
+ foreach( array("depselect", "fuser", "regex") as $type){
+ $smarty->assign("$type", $faxfilter[$type]);
+ }
+ $smarty->assign("hint", print_sizelimit_warning());
+
+ $display.= $smarty->fetch (get_template_path('locals.tpl', TRUE, dirname(__FILE__)));
+ return ($display);
+ }
+
+
+ /* Manage incoming blocklists */
+ if ($this->in_blocklist_dialog){
+
+ /* This handles the divSelectBox */
+
+ /* The base specifies the current position in the ldap tree
+ * The current base was specified by $_GET['dep_id'] before. Or contains the default value.
+ */
+ $base = $_SESSION['Fax_Filter']['depselect'];
+ $ldap->cd($base);
+
+ /* Ge all Blocklists */
+ $ldap->search ("(objectClass=goFaxRBlock)",array("cn","description"));
+ while ($attrs= $ldap->fetch()){
+
+ /* Generate list depending on description */
+ if(isset($attrs['description'][0])){
+ $list[$attrs['cn'][0]]=
+ $attrs['description'][0].
+ " [".$attrs['cn'][0]."]";
+ }else{
+ $list[$attrs['cn'][0]]= $attrs['cn'][0];
+ }
+ }
+
+ /* Create our divselect box */
+ $divSel = new divSelectBox("divSelectPredefined");
+ $divSel->setHeight(296);
+
+ /* NEW LIST MANAGMENT
+ * We also need to search for the departments
+ * So we are able to navigate like in konquerer
+ */
+ $this->departments= array();
+
+ /* Get all departments within the current department */
+ $base = $_SESSION['Fax_Filter']['depselect'];
+ $ldap->ls("(objectClass=gosaDepartment)",$base);
+
+ /* Base back is used to go one department up in our ldap tree */
+ $base_back = preg_replace("/^[^,]+,/","",$base);
+
+ /* Only show base_back if it is needed */
+ if((strlen($base_back)>= strlen($this->config->current['BASE']))&&($base!=$this->config->current['BASE'])){
+ $this->departments[preg_replace("/^[^,]+,/","",$base)] = ".. - ["._("back")."]";
+ }
+
+ /* Fetch all returned departments an add them to our divlist */
+ while($value = $ldap->fetch()){
+ if($value["description"][0]!=".."){
+ $this->departments[$value['dn']]=@LDAP::fix(convert_department_dn($value['dn'])." - [".$value["description"][0]."]");
+ }else{
+ $this->departments[$value['dn']]=$value["description"][0];
+ }
+ }
+ /* END NEW LIST MANAGMENT
+ */
+
+ // This links specifies the department open link
+ $linkopen = "<a href='?plug=".$_GET['plug']."&act=dep_open&dep_id=%s'>%s</a>";
+
+ /* Insert departments in divsel */
+ foreach($this->departments as $key=> $val){
+ if(!isset($this->config->departments[trim($key)])){
+ $this->config->departments[trim($key)]="";
+ }
+ $field1 = array("string" => "<img src='images/folder.png' alt='department'>","attach"=>"style='width:16px;text-align:center;'");
+ $field2 = array("string" => sprintf($linkopen,base64_encode($key),$val),"attach"=>" style='border:none'");
+ $divSel->AddEntry(array($field1,$field2));
+ }
+
+ /* Append predefined Blocklists */
+ foreach($list as $entry => $value){
+ $divSel->AddEntry(array(
+ array("string"=>"<input type='checkbox' value='".base64_encode($entry)."' name='ADDLIST_".base64_encode($entry)."'>"),
+ array("string"=>$value,"attach"=>"style='border:0px;'")
+ ));
+ }
+
+ /* Show dialog */
+ $smarty->assign("cblocklist", $this->current_blocklist);
+ $smarty->assign("departments", $this->config->idepartments);
+ $smarty->assign("divSelectPredefined", $divSel->DrawList());
+ $display.= $smarty->fetch (get_template_path('lists.tpl', TRUE, dirname(__FILE__)));
+ return ($display);
+ }
+
+ /* Manage outgoing blocklists */
+
+ if ($this->out_blocklist_dialog){
+
+ /* This handles the divSelectBox */
+
+ /* The base specifies the current position in the ldap tree
+ * The current base was specified by $_GET['dep_id'] before. Or contains the default value.
+ */
+ $base = $_SESSION['Fax_Filter']['depselect'];
+ $ldap->cd($base);
+
+ /* Ge all Blocklists */
+ $ldap->search ("(objectClass=goFaxSBlock)",array("cn","description"));
+ while ($attrs= $ldap->fetch()){
+ if(isset($attrs['description'][0])){
+ $list[$attrs['cn'][0]]=
+ $attrs['description'][0].
+ " [".$attrs['cn'][0]."]";
+ }else{
+ $list[$attrs['cn'][0]]= $attrs['cn'][0];
+ }
+ }
+
+ /*Create DivSel*/
+ $divSel = new divSelectBox("divSelectPredefined");
+ $divSel->setHeight(296);
+
+ /* NEW LIST MANAGMENT
+ * We also need to search for the departments
+ * So we are able to navigate like in konquerer
+ */
+ $this->departments= array();
+ $ldap->ls("(objectClass=gosaDepartment)",$base);
+
+ /* Generate Back url, and append if it is needed */
+ $base_back = preg_replace("/^[^,]+,/","",$base);
+ if((strlen($base_back)>= strlen($this->config->current['BASE']))&&($base!=$this->config->current['BASE'])){
+ $this->departments[preg_replace("/^[^,]+,/","",$base)] = ".. - ["._("back")."]";
+ }
+
+ /* Get all departments */
+ while($value = $ldap->fetch()){
+ if(isset($value["description"][0])){
+ $this->departments[$value['dn']]=@LDAP::fix(convert_department_dn($value['dn'])." - [".$value["description"][0]."]");
+ }else{
+ $this->departments[$value['dn']]=$value["description"][0];
+ }
+ }
+ /* END NEW LIST MANAGMENT
+ */
+
+ // Defining Links
+ $linkopen = "<a href='?plug=".$_GET['plug']."&act=dep_open&dep_id=%s'>%s</a>";
+
+ /* Insert departments in divlist*/
+ foreach($this->departments as $key=> $val){
+ if(!isset($this->config->departments[trim($key)])){
+ $this->config->departments[trim($key)]="";
+ }
+
+ $field1 = array("string" => "<img src='images/folder.png' alt='department'>","attach"=>"style='width:16px;text-align:center;'");
+ $field2 = array("string" => sprintf($linkopen,base64_encode($key),$val),"attach"=>" style='border:none'");
+ $divSel->AddEntry(array($field1,$field2));
+ }
+
+ /* Append Blocklits */
+ foreach($list as $entry => $value){
+ $divSel->AddEntry(array(
+ array("string"=>"<input type='checkbox' value='".base64_encode($entry)."' name='ADDLIST_".base64_encode($entry)."'>"),
+ array("string"=>$value,"attach"=>"style='border:0px;'")
+ ));
+ }
+
+ /* Show dialog */
+ $smarty->assign("cblocklist", $this->current_blocklist);
+ $smarty->assign("departments", $this->config->idepartments);
+ $smarty->assign("divSelectPredefined", $divSel->DrawList());
+ $display.= $smarty->fetch (get_template_path('lists.tpl', TRUE, dirname(__FILE__)));
+ return ($display);
+ }
+
+
+ /* Show main page */
+ $smarty->assign("languages", get_languages(TRUE));
+
+ $smarty->assign("formats", $this->fax_formats);
+ $smarty->assign("printers", $this->printerList);
+
+ /* Load attributes */
+ foreach(array("goFaxIsEnabled", "goFaxDeliveryMode", "facsimileTelephoneNumber",
+ "goFaxPrinter", "goFaxLanguage", "goFaxFormat",
+ "facsimileAlternateTelephoneNumber", "mail") as $val){
+
+ $smarty->assign("$val", $this->$val);
+ }
+
+ $tmp = $this->plInfo();
+ foreach($tmp['plProvidedAcls'] as $acl => $desc){
+ $smarty->assign($acl."ACL",$this->getacl($acl,$edit_mode));
+ }
+
+ /* Load checkboxes */
+ if ($this->goFaxIsEnabled == "1"){
+ $smarty->assign("goFaxIsEnabled", "");
+ } else {
+ $smarty->assign("goFaxIsEnabled", "checked");
+ }
+ /* goFaxAccount has "mail" as must! Block if no mailaddress is specified... */
+ if ($this->goFaxDeliveryMode & 32) {
+ $smarty->assign("faxtomail", "checked");
+ } else {
+ $smarty->assign("faxtomail", "");
+ }
+ if ($this->goFaxDeliveryMode & 64) {
+ $smarty->assign("faxtoprinter", "checked");
+ } else {
+ $smarty->assign("faxtoprinter", "");
+ }
+
+
+ $display.= $smarty->fetch (get_template_path('generic.tpl', TRUE, dirname(__FILE__)));
+ return ($display);
+ }
+
+ function remove_from_parent()
+ {
+ /* Cancel if there's nothing to do here */
+ if (!$this->initially_was_account){
+ return;
+ }
+
+ plugin::remove_from_parent();
+
+ /* Adapt mail settings if needed */
+ if ((isset($this->parent->by_object['mailAccount']->is_account)) && ($this->parent->by_object['mailAccount']->is_account)){
+ unset($this->attrs['mail']);
+ }
+
+ $ldap= $this->config->get_ldap_link();
+ $ldap->cd($this->dn);
+ $this->cleanup();
+ $ldap->modify ($this->attrs);
+
+ new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+
+ show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/fax account with dn '%s' failed."),$this->dn));
+
+ /* Optionally execute a command after we're done */
+ $this->handle_post_events('remove',array("uid"=> $this->uid));
+ }
+
+
+ /* Check formular input */
+ function check()
+ {
+ /* Call common method to give check the hook */
+ $message= plugin::check();
+
+ /* must: facsimileTelephoneNumber */
+ if ($this->facsimileTelephoneNumber == ""){
+ $message[]= _("The required field 'Fax' is not set.");
+ }
+
+ if (!is_phone_nr($this->facsimileTelephoneNumber)){
+ $message[]= _("Please enter a valid telephone number in the 'Fax' field.");
+ }
+
+ /* IF mail is specified (which is only the case if there's no mail account
+ present), check if it's valid.. */
+ if (@isset($this->parent->by_object['mailAccount']) &&
+ $this->goFaxDeliveryMode & 32){
+ if ($this->mail == ""){
+ $message[]= _("Mail delivery is checked, but no address has been specified.");
+ } elseif (!is_email($this->mail)){
+ $message[]= _("The mail address you've entered is invalid.");
+ }
+ }
+
+ // IE Fix, IE lets you choose disabled option, stupid browser ...
+ if((empty($this->goFaxPrinter))&&($this->goFaxDeliveryMode & 64)){
+ $message[]= _("Deliver fax to printer, is only possible if valid printer is given. Please correct your choice.");
+ }
+
+ return ($message);
+ }
+
+ /* Save data to object */
+ function save_object()
+ {
+ $edit_mode = (!is_object($this->parent) && !isset($_SESSION['edit']));
+ if (isset($_POST['faxTab'])){
+ plugin::save_object();
+
+
+ $tmp = 0+$this->goFaxDeliveryMode;
+
+ if($this->acl_is_writeable("faxtomail",$edit_mode)){
+ if (isset($_POST["faxtomail"]) && $_POST["faxtomail"] == 1){
+ $tmp |= 32;
+ }elseif($tmp & 32){
+ $tmp &= (!32);
+ }
+ }
+ if($this->acl_is_writeable("faxtoprinter",$edit_mode)){
+ if (isset($_POST["faxtoprinter"]) && $_POST["faxtoprinter"] == 1){
+ $tmp |= 64;
+ }elseif($tmp & 64){
+ $tmp &= !64;
+ }
+ }
+ $this->goFaxDeliveryMode = $tmp;
+
+ if($this->acl_is_writeable("goFaxIsEnabled",$edit_mode)){
+ if (isset($_POST["goFaxIsEnabled"]) && $_POST["goFaxIsEnabled"] == "1"){
+ $this->goFaxIsEnabled= "0";
+ } else {
+ $this->goFaxIsEnabled= "1";
+ }
+ }
+
+
+ if (isset($_POST['mail']) && $this->acl_is_writeable("faxtomail",$edit_mode)){
+ $this->mail= $_POST['mail'];
+ }
+
+ /* Check if mail account is active and correct the internal
+ reference to represent the current status. */
+ if(isset($this->parent)){
+ if (isset($this->parent->by_object['mailAccount']->is_account)&&($this->parent->by_object['mailAccount']->is_account)){
+ $this->has_mailAccount= TRUE;
+ }
+ }
+ }
+
+ }
+
+
+ /* Save to LDAP */
+ function save()
+ {
+ plugin::save();
+
+ /* Save arrays */
+ foreach (array("goFaxRBlocklist", "goFaxRBlockgroups", "goFaxSBlocklist",
+ "goFaxSBlockgroups", "facsimileAlternateTelephoneNumber") as $val){
+
+ $this->attrs[$val]= $this->$val;
+ }
+
+ if(!$this->attrs['goFaxDeliveryMode']){
+ $this->attrs['goFaxDeliveryMode'] = 0;
+ }
+
+ /* Do not save mail address ... it was possibly changed by mail plugin */
+ /* Adapt mail settings if needed */
+ if ((isset($this->parent->by_object['mailAccount']->is_account)) && ($this->parent->by_object['mailAccount']->is_account)){
+ unset($this->attrs['mail']);
+ }
+
+ /* Write back to ldap */
+ $ldap= $this->config->get_ldap_link();
+ $ldap->cd($this->dn);
+ $this->cleanup();
+ $ldap->modify ($this->attrs);
+
+ /* Log last action */
+ if($this->initially_was_account){
+ new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+ }else{
+ new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+ }
+
+ show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/fax account with dn '%s' failed."),$this->dn));
+
+ /* Optionally execute a command after we're done */
+ if ($this->initially_was_account == $this->is_account){
+ if ($this->is_modified){
+ $this->handle_post_events("mofidy",array("uid" => $this->uid));
+ }
+ } else {
+ $this->handle_post_events("add",array("uid" => $this->uid));
+ }
+
+ }
+
+
+ /* Adapt from template, using 'dn' */
+ function adapt_from_template($dn)
+ {
+ plugin::adapt_from_template($dn);
+
+ foreach (array("goFaxRBlocklist", "goFaxRBlockgroups", "goFaxSBlocklist",
+ "goFaxSBlockgroups", "facsimileAlternateTelephoneNumber") as $val){
+
+ if (isset($this->attrs[$val])){
+ $this->$val= $this->attrs[$val];
+ }
+ }
+ }
+
+
+
+ /* Add alternate fax recipient */
+ function addAlternate($number)
+ {
+ $this->facsimileAlternateTelephoneNumber[]= "$number";
+ $this->facsimileAlternateTelephoneNumber=
+ array_unique ($this->facsimileAlternateTelephoneNumber);
+
+ sort ($this->facsimileAlternateTelephoneNumber);
+ reset ($this->facsimileAlternateTelephoneNumber);
+ }
+
+ function delAlternate($numbers)
+ {
+ $this->facsimileAlternateTelephoneNumber= array_remove_entries ($numbers,
+ $this->facsimileAlternateTelephoneNumber);
+ }
+
+ function getCopyDialog()
+ {
+ $str = "";
+ $smarty = get_smarty();
+ $smarty->assign("facsimileTelephoneNumber", $this->facsimileTelephoneNumber);
+ $str['string'] = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE,dirname(__FILE__)));
+ $str['status'] ="";
+ return($str);
+ }
+
+ function SaveCopyDialog()
+ {
+ if(isset($_POST['facsimileTelephoneNumber'])){
+ $this->facsimileTelephoneNumber = $_POST['facsimileTelephoneNumber'];
+ }
+ }
+
+
+ /* Return plugin informations for acl handling
+ #FIXME some attributes are still missing in this plugin acls */
+ static function plInfo()
+ {
+ return (array(
+ "plShortName" => _("Fax"),
+ "plDescription" => _("Fax account settings"),
+ "plSelfModify" => TRUE,
+ "plDepends" => array("user"),
+ "plPriority" => 6,
+ "plSection" => "personal",
+ "plCategory" => array("users"),
+ "plOptions" => array(),
+
+ "plProvidedAcls" => array(
+ "goFaxIsEnabled" => _("Enable/Disable fax"),
+ "goFaxRBlocklist" => _("Receive blocklist"),
+ "goFaxSBlocklist" => _("Send blocklist"),
+ "facsimileTelephoneNumber" => _("Fax number"), // goFaxDeliveryMode
+ "facsimileAlternateTelephoneNumber" => _("Alternate fax number"), // goFaxDeliveryMode
+ "faxtomail" => _("Deliver fax as mail"),
+ "faxtoprinter" => _("Deliver fax to printer"),
+ "goFaxFormat" => _("Delivery format"),
+ "goFaxLanguage" => _("Language"))
+ ));
+ }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/gofax/gofax/faxaccount/generic.tpl b/gosa-plugins/gofax/gofax/faxaccount/generic.tpl
--- /dev/null
@@ -0,0 +1,145 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding="0" border="0">
+
+ <!-- Headline container -->
+ <tr>
+ <td style="width:50%; vertical-align:top;">
+ <h2><img class="center" alt="" align="middle" src="images/rightarrow.png" /> {t}Generic{/t}</h2>
+
+ <table summary="">
+ <tr>
+ <td><label for="facsimileTelephoneNumber">{t}Fax{/t}</label>{$must}</td>
+ <td>
+
+{render acl=$facsimileTelephoneNumberACL}
+ <input name="facsimileTelephoneNumber" id="facsimileTelephoneNumber" size=20 maxlength=65
+ value="{$facsimileTelephoneNumber}" title="{t}Fax number for GOfax to trigger on{/t}">
+{/render}
+
+ </td>
+ </tr>
+ <tr>
+ <td><label for="goFaxLanguage">{t}Language{/t}</label></td>
+ <td>
+
+{render acl=$goFaxLanguageACL}
+ <select size="1" name="goFaxLanguage" id="goFaxLanguage"
+ title="{t}Specify the GOfax communication language for fax to mail gateway{/t}">
+ {html_options options=$languages selected=$goFaxLanguage}
+ </select>
+{/render}
+
+ </td>
+ </tr>
+ <tr>
+ <td><label for="goFaxFormat">{t}Delivery format{/t}</label></td>
+ <td>
+
+{render acl=$goFaxFormatACL}
+ <select id="goFaxFormat" size="1" name="goFaxFormat" title="{t}Specify delivery format for fax to mail gateway{/t}">
+ {html_options values=$formats output=$formats selected=$goFaxFormat}
+ </select>
+{/render}
+ </td>
+ </tr>
+ </table>
+
+ </td>
+ <td style="border-left:1px solid #A0A0A0">
+
+ </td>
+ <td style="vertical-align:top; width:100%">
+ <h2><img class="center" alt="" align="middle" src="images/printer.png" /> {t}Delivery methods{/t}</h2>
+
+{render acl=$goFaxIsEnabledACL}
+ <input type=checkbox name="goFaxIsEnabled" value="1" {$goFaxIsEnabled}>
+{/render}
+ {t}Temporary disable fax usage{/t}<br>
+
+ {if $has_mailaccount eq "false"}
+{render acl=$faxtomailACL}
+ <input type=checkbox name="faxtomail" value="1" {$faxtomail}>
+{/render}
+ <label for="mail">{t}Deliver fax as mail to{/t}</label>
+{render acl=$faxtomailACL}
+ <input name="mail" id="mail" size=25 maxlength=65 value="{$mail}">
+{/render}
+ {else}
+{render acl=$faxtomailACL}
+ <input type=checkbox name="faxtomail" value="1" {$faxtomail}>
+{/render}
+ {t}Deliver fax as mail{/t}
+ {/if}
+ <br>
+
+{render acl=$faxtoprinterACL}
+ <input type=checkbox name="faxtoprinter" value="1" {$faxtoprinter}>
+{/render}
+ {t}Deliver fax to printer{/t}
+{render acl=$faxtoprinterACL}
+ <select size="1" name="goFaxPrinter">
+ {html_options options=$printers selected=$goFaxPrinter}
+ <option disabled> </option>
+ </select>
+{/render}
+ </td>
+ </tr>
+</table>
+
+<p class="seperator"> </p>
+
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4 border=0>
+ <tr>
+ <td style="width:50%; border-right:1px solid #A0A0A0">
+ <h2><img class="center" alt="" align="middle" src="images/fax_small.png"> {t}Alternate fax numbers{/t}</h2>
+{render acl=$facsimileAlternateTelephoneNumberACL}
+ <select style="width:100%" name="alternate_list[]" size="10" multiple>
+ {html_options values=$facsimileAlternateTelephoneNumber output=$facsimileAlternateTelephoneNumber}
+ <option disabled> </option>
+ </select>
+{/render}
+ <br>
+{render acl=$facsimileAlternateTelephoneNumberACL}
+ <input name="forward_address" size=20 align="middle" maxlength=65 value="">
+{/render}
+{render acl=$facsimileAlternateTelephoneNumberACL}
+ <input type=submit value="{t}Add{/t}" name="add_alternate">
+{/render}
+{render acl=$facsimileAlternateTelephoneNumberACL}
+ <input type=submit value="{t}Add local{/t}" name="add_local_alternate" >
+{/render}
+{render acl=$facsimileAlternateTelephoneNumberACL}
+ <input type=submit value="{t}Delete{/t}" name="delete_alternate">
+{/render}
+ </td>
+ <td style="vertical-align:top; width:50%">
+ <h2><img class="center" alt="" align="middle" src="images/false.png" /> {t}Blocklists{/t}</h2>
+ <table summary="" style="width:100%">
+ <tr>
+ <td>{t}Blocklists for incoming fax{/t}</td>
+ <td>
+{render acl=$goFaxRBlocklistACL}
+ <input type=submit name="edit_incoming" value="{t}Edit{/t}">
+{/render}
+ </td>
+ </tr>
+ <tr>
+ <td>{t}Blocklists for outgoing fax{/t}</td>
+ <td>
+{render acl=$goFaxSBlocklistACL}
+ <input type=submit name="edit_outgoing" value="{t}Edit{/t}">
+{/render}
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+
+<input type="hidden" name="faxTab" value="faxTab">
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+ <!-- // First input field on page
+ focus_field('facsimileTelephoneNumber');
+ -->
+</script>
diff --git a/gosa-plugins/gofax/gofax/faxaccount/lists.tpl b/gosa-plugins/gofax/gofax/faxaccount/lists.tpl
--- /dev/null
@@ -0,0 +1,35 @@
+
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4 border=0>
+ <tr>
+ <td style="vertical-align:top;width:50%;border-right:1px solid #A0A0A0">
+ <b>{t}Blocked numbers/lists{/t}</b>
+ <br>
+ <select style="width:100%; height:300px;" name="block_list[]" size=15 multiple>
+ {html_options values=$cblocklist output=$cblocklist}
+ <option disabled> </option>
+ </select>
+ <br>
+ <input name="block_number" size=25 align="middle" maxlength=30 value="">
+ <input type=submit value="{t}Add{/t}" name="add_blocklist_number" >
+ <input type=submit value="{t}Delete{/t}" name="delete_blocklist_number" >
+ </td>
+ <td>
+ <b>{t}List of predefined blocklists{/t}</b><br>
+ <table style="width:100%;height:300px;" summary="">
+ <tr>
+ <td valign="top">
+ {$divSelectPredefined}
+ </td>
+ </tr>
+ </table>
+ <input type=submit value="{t}Add the list to the blocklists{/t}" name="add_blocklist"><br>
+ </td>
+ </tr>
+</table>
+
+<p class="plugbottom">
+ <input type=submit name="edit_blocklists_finish" value="{t}Apply{/t}">
+
+ <input type=submit name="edit_blocklists_cancel" value="{t}Cancel{/t}">
+</p>
+
diff --git a/gosa-plugins/gofax/gofax/faxaccount/locals.tpl b/gosa-plugins/gofax/gofax/faxaccount/locals.tpl
--- /dev/null
@@ -0,0 +1,64 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
+<tr>
+ <td style="vertical-align:top; width:600px">
+ <div class="contentboxh" style="height:20px;">
+ <p class="contentboxh" style="font-size:12px">
+ <b>{t}Select numbers to add{/t} {$hint}</b><br>
+ </p>
+ </div>
+ <div class="contentboxb">
+ <p class="contentboxb" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+ <select style="width:100%; margin-top:4px; height:450px;" name="local_list[]" size="15" multiple>
+ {html_options options=$list}
+ </select>
+ </p>
+ </div>
+ </td>
+ <td style="vertical-align:top;">
+ <div class="contentboxh" style="height:20px;">
+ <p class="contentboxh" style="font-size:12px"><img src="{$launchimage}" align="right" alt="[F]"><b>{t}Filters{/t}</b></p>
+ </div>
+ <div class="contentboxb" style="background-color:#F8F8F8">
+ <table summary="" style="width:100%;border-top:1px solid #B0B0B0; background-color:#F8F8F8">
+ {$alphabet}
+ </table>
+ <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+ <tr>
+ <td>
+ <img class="center" alt="" src="{$tree_image}" align="middle" title="{t}Display numbers of department{/t}">
+ <select name="depselect" size="1" onChange="mainform.submit()" title="{t}Choose the department the search will be based on{/t}">
+ {html_options options=$deplist selected=$depselect}
+ </select>
+ </td>
+ </tr>
+ </table>
+ <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+ <tr>
+ <td width="18">
+ <img class="center" alt="" src="{$search_image}" align="middle" title="{t}Display numbers matching{/t}">
+ </td>
+ <td>
+ <input type='text' name='regex' maxlength='20' value='{$regex}' style="width:99%" title='{t}Regular expression for matching numbers{/t}' onChange="mainform.submit()"> </td>
+ </tr>
+ </table>
+ <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+ <tr>
+ <td width="18">
+ <img class="center" alt="" src="{$usearch_image}" align="middle" title="{t}Display numbers of user{/t}">
+ </td>
+ <td>
+ <input type='text' name='fuser' style="width:99%" maxlength='20' value='{$fuser}' title='{t}User name of which numbers are shown{/t}' onChange="mainform.submit()"> </td>
+ </tr>
+ </table>
+ {$apply}
+ </div>
+ </td>
+</tr>
+</table>
+
+<p class="plugbottom">
+ <input type=submit name="add_locals_finish" value="{t}Add{/t}">
+
+ <input type=submit name="add_locals_cancel" value="{t}Cancel{/t}">
+</p>
+
diff --git a/gosa-plugins/gofax/gofax/faxaccount/main.inc b/gosa-plugins/gofax/gofax/faxaccount/main.inc
--- /dev/null
@@ -0,0 +1,112 @@
+<?php
+
+$display ="";
+$lock_msg = "";
+
+if (!$remove_lock){
+
+ /* Reset requested? */
+ if (isset($_POST['edit_cancel']) ||
+ (isset($_GET['reset']) && $_GET['reset'] == 1)){
+
+ del_lock ($ui->dn);
+ sess_del ('edit');
+ sess_del ('gofaxAccount');
+ }
+
+ /* Create gofaxAccount object on demand */
+ if (!isset($_SESSION['gofaxAccount']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+ $_SESSION['gofaxAccount']= new gofaxAccount ($config, $ui->dn);
+ $_SESSION['gofaxAccount']->set_acl_base($ui->dn);
+ $_SESSION['gofaxAccount']->set_acl_category("users");
+
+ }
+ $gofaxAccount= $_SESSION['gofaxAccount'];
+
+ /* save changes back to object */
+ if (isset ($_SESSION['edit'])){
+ $gofaxAccount->save_object ();
+ }
+
+ /* Enter edit mode? */
+ if (isset($_POST['edit'])){
+
+ /* Check locking */
+ if (($username= get_lock($ui->dn)) != ""){
+ $_SESSION['back_plugin']= $plug;
+ $_SESSION['LOCK_VARS_TO_USE'] = array("/^edit$/","/^plug$/");
+ $lock_msg = gen_locked_message ($username, $ui->dn);
+
+ }else{
+
+ /* Lock the current entry */
+ add_lock ($ui->dn, $ui->dn);
+ $_SESSION['dn']= $ui->dn;
+ $_SESSION['edit']= TRUE;
+ }
+ }
+
+ /* save changes to LDAP and disable edit mode */
+ if (isset($_POST['edit_finish'])){
+
+ /* Perform checks */
+ $message= $gofaxAccount->check ();
+
+ /* No errors, save object */
+ if (count ($message) == 0){
+ $gofaxAccount->save ();
+ del_lock ($ui->dn);
+ sess_del ('edit');
+
+ } else {
+ /* Errors found, show message */
+ show_errors ($message);
+ }
+ }
+
+ /* Execute formular */
+ if($lock_msg){
+ $display.= $lock_msg;
+ }else{
+ $display.= $gofaxAccount->execute ();
+ }
+
+ $info= "";
+
+ /* Store changes in session */
+ if (isset ($_SESSION['edit'])){
+ $_SESSION['gofaxAccount']= $gofaxAccount;
+ }
+
+ /* Show page footer depending on the mode */
+ if (!$gofaxAccount->locals_dialog &&
+ !$gofaxAccount->out_blocklist_dialog &&
+ !$gofaxAccount->in_blocklist_dialog &&
+ $gofaxAccount->is_account &&
+ empty($lock_msg)){
+
+ $display.= "<p class=\"plugbottom\">\n";
+
+ /* Are we in edit mode? */
+ if (isset($_SESSION['edit'])){
+ $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
+ $display.= " \n";
+ $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+ $info= "<img alt='' align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".$ui->dn." ";
+ } else {
+ $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/openlock.png')."\"> ".$ui->dn." ";
+
+ if(preg_match("/w/",$ui->get_permissions($ui->dn,"users/gofaxAccount"))){
+ $info.= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/lamp.png')."\">"._("Click the 'Edit' button below to change informations in this dialog");
+ $display.= "<input type=submit name=\"edit\" value=\""._("Edit")."\">";
+ }
+ $display.= "<input type=\"hidden\" name=\"ignore\">\n";
+ }
+ $display.= "</p>";
+ }
+
+ /* Page header*/
+ $display= print_header(get_template_path('images/fax.png'), _("FAX settings"), $info).$display;
+
+}
+?>
diff --git a/gosa-plugins/gofax/gofax/faxaccount/paste_generic.tpl b/gosa-plugins/gofax/gofax/faxaccount/paste_generic.tpl
--- /dev/null
@@ -0,0 +1,31 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding="0" border="0">
+ <tr>
+ <td style="width:50%; vertical-align:top;">
+ <h2><img class="center" alt="" align="middle" src="images/rightarrow.png" /> {t}Generic{/t}</h2>
+ <table summary="">
+ <tr>
+ <td>
+ <label for="facsimileTelephoneNumber">{t}Fax{/t}</label>{$must}
+ </td>
+ <td>
+ <input name="facsimileTelephoneNumber" id="facsimileTelephoneNumber"
+ size=40 maxlength=65 value="{$facsimileTelephoneNumber}"
+ title="{t}Fax number for GOfax to trigger on{/t}">
+ </td>
+ </tr>
+ <tr>
+ <td colspan=2>
+ {t}Alternate fax numbers will not be copied{/t}
+ </td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+ <!-- // First input field on page
+ focus_field('facsimileTelephoneNumber');
+ -->
+</script>
diff --git a/gosa-plugins/gofax/gofax/faxreports/class_faxreport.inc b/gosa-plugins/gofax/gofax/faxreports/class_faxreport.inc
--- /dev/null
@@ -0,0 +1,507 @@
+<?php
+
+class faxreport extends plugin
+{
+ /* Definitions */
+ var $plHeadline = "FAX Reports";
+ var $plDescription = "This does something";
+
+ /* For internal use */
+ var $start = 0;
+ var $search_for = "*";
+ var $search_base = "";
+ var $year = "";
+ var $month = "";
+ var $sort = 1;
+ var $sort_direction = "down";
+ var $report_list = array();
+ var $ui = NULL;
+ var $range = 20;
+ var $view_logged = FALSE;
+
+ /* Constant stuff */
+ var $status= array( "SENT", "MAILED", "SERROR", "RERROR", "SBLOCK", "RBLOCK",
+ "DELETED", "REQUEUED", "DISABLED", "PRINTED", "DIVERTED",
+ "UNDEFINED", "UNDEFINED", "UNDEFINED", "UNDEFINED",
+ "UNDEFINED");
+ var $fields= array("uid", "queuing_time", "status", "sender_id", "receiver_id", "pages");
+
+ /* these vars will be stored in session to be able to remember last search config */
+ var $attributes_SO= array("search_for","search_base","month","year","start","year","month","sort","sort_direction","range");
+ var $objectclasses= array();
+ var $fax_users = array();
+
+
+ /* Create class */
+ function faxreport (&$config, &$ui)
+ {
+ /* Include config object */
+ $this->config = $config;
+ $this->ui = &$ui;
+ $this->search_base = get_base_from_people($ui->dn);
+ $this->year = date("Y");
+ $this->month = date("m");
+
+ /* Get global filter config and set class vars ,
+ or create a filter */
+ if (!is_global("faxreportfilter")){
+ $faxreportfilter = array();
+ foreach($this->attributes_SO as $name){
+ $faxreportfilter[$name] = $this->$name;
+ }
+ register_global("faxreportfilter",$faxreportfilter);
+ }else{
+ $faxreportfilter = get_global("faxreportfilter");
+ foreach($this->attributes_SO as $name){
+ $this->$name = $faxreportfilter[$name];
+ }
+ }
+ }
+
+
+ /* Create Filter & Search & Display results */
+ function execute()
+ {
+ /* Call parent execute */
+ plugin::execute();
+
+ /* Log view */
+ if(!$this->view_logged){
+ $this->view_logged = TRUE;
+ new log("view","users/".get_class($this),$this->dn);
+ }
+
+ /************
+ Variable initialisation
+ ************/
+
+ /* Create months */
+ $months= array();
+ for($i = 1 ; $i <= 12 ; $i ++ ){
+ $months[$i] = _(date("F",gmmktime(0,0,0,$i,1)));
+ }
+
+ /* Create years */
+ $current= date("Y");
+ $years= array();
+ for ($y= $current - 5; $y<=$current; $y++){
+ $years[]= $y;
+ }
+
+
+ /************
+ Set smarty defaults
+ ************/
+
+ $smarty= get_smarty();
+ $smarty->assign("launchimage" , get_template_path('images/launch.png'));
+ $smarty->assign("search_image" , get_template_path('images/search.png'));
+ $smarty->assign("search_for" , $this->search_for);
+ $smarty->assign("bases" , $this->config->idepartments);
+ $smarty->assign("base_select" , $this->search_base);
+ $smarty->assign("months" , $months);
+ $smarty->assign("month_select" , $this->month);
+ $smarty->assign("years" , $years);
+ $smarty->assign("year_select" , $this->year);
+ $smarty->assign("search_result" , "");
+
+
+ /************
+ Check database accessibility
+ ************/
+
+ /* Some checks */
+ if(!isset($this->config->data['SERVERS']['FAX'])){
+ print_red(_("No fax extension defined in your server configuration, no reports can be shown!"));
+ return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
+ }elseif(!is_callable("mysql_connect")){
+ print_red(_("There is no mysql extension available, please check your php setup."));
+ return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
+ }else{
+ /* Connecting, selecting database */
+ $cfg = $this->config->data['SERVERS']['FAX'];
+ $link = @mysql_pconnect($cfg['SERVER'], $cfg['LOGIN'], $cfg['PASSWORD']);
+ if ($link === FALSE){
+ print_red(_("Can't connect to fax database, no reports can be shown!"));
+ return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
+ }
+ if (! @mysql_select_db("gofax")){
+ print_red(_("Can't select fax database for report generation!"));
+ return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
+ }
+
+ if (! mysql_query("SELECT * FROM faxlog;")){
+ print_red(_("Can't query fax table 'faxlog' for report generation!"));
+ return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
+ }
+ }
+
+
+ /************
+ Perform a deatil view
+ ************/
+
+ /* Do detail view? */
+ if (isset($_GET['detail'])){
+
+ /* Create query */
+ $query = "SELECT id,uid,date_format(queuing_time, '%Y%m%d%H%i%s') as queuing_time,status,sender_id,sender_msn,receiver_id,".
+ "receiver_msn,pages,status_message,transfer_time FROM faxlog WHERE id=".$_GET['detail'].";";
+
+ /* Connecting, selecting database */
+ $cfg= $this->config->data['SERVERS']['FAX'];
+
+ /* Check if everything went ok*/
+ $result = @mysql_query($query);
+ if ($result === false){
+ print_red(_("Query for fax database failed!"));
+ @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query, "Database query failed");
+ return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
+ }
+
+ $line = mysql_fetch_array($result, MYSQL_ASSOC);
+ mysql_close($link);
+
+ if (!preg_match ("/'".$line["uid"]."'/", $this->userfilter)){
+ print_red (_("You have no permission to retrieve informations about this fax id!"));
+ return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
+ }
+
+ /* Check acls */
+ $fax_uids = array_flip($this->fax_users);
+ $uid = $line['uid'];
+ $dn = $fax_uids[$uid];
+ $acls = $this->ui->get_permissions($dn,"faxreport/faxreport");
+ if(!preg_match("/r/",$acls)){
+ print_red (_("You have no permission to retrieve informations about this fax id!"));
+ return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
+ }
+
+ $parts= array( "id", "uid", "queuing_time", "status", "sender_id", "sender_msn",
+ "receiver_id", "receiver_msn", "pages", "status_message", "transfer_time" );
+
+ foreach ($parts as $vname) {
+
+ $final="fax_$vname";
+ if($vname != "uid"){
+ $v_acl = $this->ui->get_permissions($dn,"faxreport/faxreport",preg_replace("/_/","",$vname));
+ }else{
+ $v_acl = "r";
+ }
+
+ if ($line[$vname] != "" && preg_match("/r/",$v_acl)){
+ $smarty->assign("$final", $line[$vname]);
+ } else {
+ $smarty->assign("$final", "-");
+ }
+ }
+ $queuing_time= $line['queuing_time'];
+
+ /* The user is allowed to download all fax images from those users
+ that are listed in $_SESSION['fuserfilter']
+ Don't forget to check getfax.php if you change somthing here */
+ $_SESSION['fuserfilter']= $this->userfilter;
+ $smarty->assign("plug", "?plug=".validate($_GET['plug']));
+ $smarty->assign("detail", validate($_GET['detail']));
+
+ $format= _("Y-M-D");
+ $date= preg_replace("/Y/", substr($queuing_time,0,4), $format);
+ $date= preg_replace("/M/", substr($queuing_time,4,2), $date);
+ $date= preg_replace("/D/", substr($queuing_time,6,2), $date);
+ $smarty->assign("date", $date);
+ $smarty->assign("time", substr($queuing_time,8,2).":".
+ substr($queuing_time,10,2).":".
+ substr($queuing_time,12,2));
+ return($smarty->fetch(get_template_path('detail.tpl', TRUE)));
+ }
+
+
+ /************
+ Search for uids matching the filter
+ ************/
+
+ /* Search button has been pressed */
+ if ($this->search_for != ""){
+
+ if (is_integer (strpos($this->search_for, "*"))){
+ $s= $this->search_for;
+ } else {
+ $s= "*".$this->search_for."*";
+ }
+ $ldap= $this->config->get_ldap_link();
+ $ldap->cd ($this->search_base);
+
+ /* Perform ldap search for potential users */
+ $filter= "(&(objectClass=gosaAccount)(!(objectClass=gosaUserTemplate))".
+ "(objectClass=goFaxAccount)".
+ "(|(uid=$s)(l=$s)(homePhone=$s)".
+ "(telephoneNumber=$s)(facsimileTelephoneNumber=$s)(mobile=$s)".
+ "(pager=$s)(cn=$s)(givenName=$s)(sn=$s)(personalTitle=$s)".
+ "(title=$s)))";
+
+ $res = get_list($filter, "users", $this->search_base, array("uid"), GL_SUBSEARCH );
+
+ /* Check if we are allowed to collect fax data */
+ $fax_users= array();
+ foreach($res as $attrs){
+ $acl = $this->ui->get_permissions($attrs['dn'],"users/user","uid");
+ if(preg_match("/r/",$acl)){
+ $fax_users[ $attrs['dn']]= $attrs["uid"][0];
+ }
+ }
+
+ $this->fax_users = $fax_users;
+
+ /* Prepare SQL query */
+ $this->userfilter= "";
+ foreach ($fax_users as $user){
+ $this->userfilter.= "uid = '$user' OR ";
+ }
+ $this->userfilter= preg_replace("/OR $/", "", $this->userfilter);
+ }
+
+ /************
+ Create filter
+ ************/
+
+ /* Perform SQL query */
+ if ($this->userfilter){
+ if ($this->sort_direction == "down"){
+ $desc= "DESC";
+ } else {
+ $desc= "";
+ }
+ $start= date ("YmdHis", mktime(0,0,0,$this->month,1,$this->year));
+ $end= date ("YmdHis", mktime(23,59,59,$this->month+1,0,$this->year));
+ $query = "SELECT id,uid,date_format(queuing_time, '%Y%m%d%H%i%s') as queuing_time,status,sender_id,receiver_id,pages FROM faxlog ".
+ "WHERE ( ".$this->userfilter." ) AND queuing_time <= $end AND ".
+ "queuing_time >= $start ORDER BY ".$this->fields[$this->sort]." $desc;";
+
+ if(!is_callable("mysql_connect")){
+ print_red("There is no mysql extension configured in your php setup.");
+ return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
+ }
+
+
+ /************
+ Create results
+ ************/
+
+ /* Connecting, selecting database */
+ $cfg= $this->config->data['SERVERS']['FAX'];
+ $link = @mysql_pconnect($cfg['SERVER'], $cfg['LOGIN'], $cfg['PASSWORD']);
+
+ @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query, "Database query");
+ $result = @mysql_query($query);
+ if ($result === false){
+ print_red(_("Query for fax database failed!"));
+ return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
+ }
+
+ $this->report_list= array();
+ $user_ids = array_flip($fax_users);
+ while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
+
+ /* Check permissions for each field */
+ $dn = $user_ids[$line['uid']];
+
+ /* Hide restricted attributes */
+ foreach(array("pages","receiverid","senderid","status","queuingtime","detailedView") as $attr){
+ $var = $attr."ACL";
+ $$var = $this->ui->get_permissions($dn,"faxreport/faxreport",$attr);
+ }
+
+ /* Restricted attributes will not be displayed, this will be displayed instead */
+ $no_acl = "<img class='center' src='images/closedlock.png'
+ title='"._("Insufficient permissions to view this attribute")."' alt='"._("Insufficient permissions")."'>";
+
+ /* Create date */
+ if((!empty($line["queuing_time"])) && preg_match("/r/",$queuingtimeACL)){
+ $hour= substr($line["queuing_time"], 8, 2);
+ $minute=substr($line["queuing_time"], 10, 2);
+ $format= _("Y-M-D");
+ $date= preg_replace("/Y/", substr($line["queuing_time"], 0, 4), $format);
+ $date= preg_replace("/M/", substr($line["queuing_time"], 4, 2), $date);
+ $date= preg_replace("/D/", substr($line["queuing_time"], 6, 2), $date);
+ $str_date = $date." ".$hour.":".$minute;
+ }else{
+ $str_date = $no_acl;
+ }
+
+ /* Create entry html str */
+
+ if(preg_match("/r/",$detailedViewACL)){
+ $str = "<td class=\"phonelist\">
+ <a href=\"main.php?plug=".validate($_GET['plug'])."&detail=".$line["id"]."\">
+ <img class='center' alt=\"\" align=\"middle\" border=0 src=\"".get_template_path('images/info_small.png')."\">
+ ".$line["uid"].
+ "</a>
+ </td>
+ <td>$str_date</td>";
+ }else{
+ $str = "<td>
+ <img class='center' alt=\"\" align=\"middle\" border=0 src=\"".get_template_path('images/info_small.png')."\">
+ ".$line["uid"]."</td>
+ <td>$str_date</td>";
+ }
+
+ /* Add Status td */
+ if(preg_match("/r/",$statusACL)){
+ $str.="<td>".$this->status[$line["status"]]."</td>";
+ }else{
+ $str.="<td>".$no_acl."</td>";
+ }
+
+ /* Add sender_id td */
+ if(preg_match("/r/",$senderidACL)){
+ $str.="<td>".$line["sender_id"]."</td>";
+ }else{
+ $str.="<td>".$no_acl."</td>";
+ }
+
+ /* Add receiver_id td */
+ if(preg_match("/r/",$receiveridACL)){
+ $str.="<td>".$line["receiver_id"]."</td>";
+ }else{
+ $str.="<td>".$no_acl."</td>";
+ }
+
+ /* Add receiver_id td */
+ if(preg_match("/r/",$pagesACL)){
+ $str.="<td>".$line["pages"]."</td>";
+ }else{
+ $str.="<td>".$no_acl."</td>";
+ }
+ $this->report_list[] = $str;
+ }
+
+ mysql_close($link);
+ }
+
+ /************
+ Create output out of results
+ ************/
+
+ /* Generate output */
+ $mod= 0;
+ $output= "";
+ foreach ($this->report_list as $val){
+ if ($mod < $this->start) {
+ $mod++;
+ continue;
+ }
+ if ($mod >= ($this->start + $this->range)){
+ $mod++;
+ break;
+ }
+ if ( ($mod++) & 1){
+ $col= "background-color: #ECECEC;";
+ } else {
+ $col= "background-color: #F5F5F5;";
+ }
+ $output.= "<tr style=\"height:22px; $col\">$val</tr>";
+ }
+
+
+ /************
+ Display results
+ ************/
+
+ if (isset($fax_users) && count($fax_users)){
+ $smarty->assign("search_result", $output);
+ $smarty->assign("range_selector", range_selector(count($this->report_list), $this->start, $this->range,"EntriesPerPage"));
+ }else{
+ $smarty->assign("search_result", "");
+ }
+
+ /* Show main page */
+ $smarty->assign("plug", "?plug=".validate($_GET['plug']));
+ for($i= 0; $i<7; $i++){
+ $smarty->assign("mode$i", "");
+ }
+ $smarty->assign("mode".$this->sort, "<img alt=\"\" src=\"images/sort_".$this->sort_direction.
+ ".png\" border=0 align=middle>");
+ return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
+ }
+
+
+ /* Save ui input, and store it in $_SESSION
+ to remember last search next time*/
+ function save_object()
+ {
+ $faxreportfilter = get_global("faxreportfilter");
+ if(isset($_POST['EntriesPerPage'])){
+ $this->range = $_POST['EntriesPerPage'];
+ }
+
+ if (isset($_GET['start'])){
+ $this->start= (int)$_GET['start'];
+ }
+
+ /* Adapt sorting */
+ if (isset($_GET['sort'])){
+ if ($this->sort == (int)$_GET['sort']){
+ if ($this->sort_direction == "down"){
+ $this->sort_direction= "up";
+ } else {
+ $this->sort_direction= "down";
+ }
+ }
+ $this->sort= (int)$_GET['sort'];
+ if ($this->sort < 0 || $this->sort > 5){
+ $this->sort= 0;
+ }
+ }
+ foreach( array("year", "month", "search_for", "search_base") as $type){
+ if (isset($_POST[$type])){
+ $faxreportfilter[$type]= $_POST[$type];
+
+ /* reset start page, if filter has changed */
+ if(!isset($_GET['start'])){
+ $this->start = 0;
+ }
+ }
+ $this->$type= $faxreportfilter[$type];
+
+ }
+ foreach($this->attributes_SO as $name){
+ $faxreportfilter[$name] = $this->$name;
+ }
+ register_global("faxreportfilter",$faxreportfilter);
+ }
+
+
+ /* Return plugin informations for acl handling
+ #FIXME You can only read attributes within this report plugin */
+ static function plInfo()
+ {
+
+ return (array(
+ "plShortName" => _("Fax report"),
+ "plDescription" => _("Fax report")." <i>"._("All entries are readonly")."</i>",
+ "plSelfModify" => TRUE,
+ "plDepends" => array(),
+ "plPriority" => 1, // Position in tabs
+ "plSection" => array("administration"), // This belongs to personal
+ "plCategory" => array("faxreport" => array("description" => _("Fax reports"),
+ "objectClass" => array())),
+ "plOptions" => array(),
+
+ "plProvidedAcls" => array(
+ "detailedView" => _("Detailed view"),
+ "id" => _("Fax ID"),
+ "queuingtime" => _("Date")." / "._("Time"),
+ "status" => _("Status"),
+ "senderid" => _("Sender ID"),
+ "sendermsn" => _("Sender MSN"),
+ "receiverid" => _("Receiver ID"),
+ "receivermsn" => _("Receiver MSN"),
+ "pages" => _("Number of pages"),
+ "statusmessage" => _("Status Message"),
+ "transfertime" => _("Transfer time"))
+ ));
+ }
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/gofax/gofax/faxreports/contents.tpl b/gosa-plugins/gofax/gofax/faxreports/contents.tpl
--- /dev/null
@@ -0,0 +1,59 @@
+<div class="contentboxh">
+ <p class="contentboxh"><img src="{$launchimage}" align="right" alt="[F]">{t}Filter{/t}</p>
+</div>
+<div class="contentboxb">
+ <p class="contentboxb" style="border-top:1px solid #B0B0B0; padding-top:5px;">
+ <img class="center" alt="" align="middle" border=0 src="{$search_image}"> {t}Search for{/t}
+ <input name="search_for" size=25 maxlength=60 value="{$search_for}" title="{t}Enter user name to search for{/t}" onChange="mainform.submit()">
+ {t}in{/t}
+ <select size="1" name="search_base" title="{t}Select subtree to base search on{/t}" onChange="mainform.submit()">
+ {html_options options=$bases selected=$base_select}
+ </select>
+ {t}during{/t}
+ <select size="1" name="month" onChange="mainform.submit()">
+ {html_options options=$months selected=$month_select}
+ </select>
+ {t}in{/t}
+ <select size="1" name="year" onChange="mainform.submit()">
+ {html_options values=$years output=$years selected=$year_select}
+ </select>
+
+ <input type=submit name="search" value="{t}Search{/t}">
+</p>
+</div>
+
+<br>
+
+{if $search_result ne ""}
+ <table summary="" style="width:100%; vertical-align:top; text-align:left; border:1px solid #B0B0B0;" cellpadding=2 cellspacing=1 border=0 rules="cols">
+ <tr style="background-color: #E8E8E8; height:26px; font-weight:bold">
+ <td><a href="main.php{$plug}&sort=0">{t}User{/t} {$mode0}</a></td>
+ <td><a href="main.php{$plug}&sort=1">{t}Date{/t} {$mode1}</a></td>
+ <td><a href="main.php{$plug}&sort=2">{t}Status{/t} {$mode2}</a></td>
+ <td><a href="main.php{$plug}&sort=3">{t}Sender{/t} {$mode3}</a></td>
+ <td><a href="main.php{$plug}&sort=4">{t}Receiver{/t} {$mode4}</a></td>
+ <td><a href="main.php{$plug}&sort=5">{t}# pages{/t} {$mode5}</a></td>
+ </tr>
+ {$search_result}
+ </table>
+
+ <table summary="" style="width:100%; vertical-align:top; text-align:center;" cellpadding=4 cellspacing=0 border=0>
+ <tr>
+ <td>{$range_selector}</td>
+ </tr>
+ </table>
+<p class="plugbottom">
+
+</p>
+
+{else}
+ <b>{t}Search returned no results...{/t}</b>
+{/if}
+
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+ <!-- // First input field on page
+ focus_field('search_for');
+ -->
+</script>
diff --git a/gosa-plugins/gofax/gofax/faxreports/detail.tpl b/gosa-plugins/gofax/gofax/faxreports/detail.tpl
--- /dev/null
@@ -0,0 +1,69 @@
+<table summary="">
+ <tr>
+ <td>
+ <a href="getfax.php?id={$detail}&download=1">
+ <img align="bottom" width="420" height="594" src="getfax.php?id={$detail}" alt="{t}FAX preview - please wait{/t}" border=1>
+ </a>
+ <p style="margin-top-width:0px; text-align:center;">
+ {t}Click on fax to download{/t}
+ </p>
+ </td>
+ <td style="width:20px;">
+
+ </td>
+ <td style="vertical-align:top">
+ <table summary="" border=0 cellspacing=5>
+ <tr>
+ <td><b>{t}FAX ID{/t}</b></td>
+ <td>{$fax_id}</td>
+ </tr>
+ <tr>
+ <td><b>{t}User{/t}</b></td>
+ <td>{$fax_uid}</td>
+ </tr>
+ <tr>
+ <td><b>{t}Date / Time{/t}</b></td>
+ <td>{$date} / {$time}</td>
+ </tr>
+ <tr>
+ <td><b>{t}Sender MSN{/t}</b></td>
+ <td>{$fax_sender_msn}</td>
+ </tr>
+ <tr>
+ <td><b>{t}Sender ID{/t}</b></td>
+ <td>{$fax_sender_id}</td>
+ </tr>
+ <tr>
+ <td><b>{t}Receiver MSN{/t}</b></td>
+ <td>{$fax_receiver_msn}</td>
+ </tr>
+ <tr>
+ <td><b>{t}Receiver ID{/t}</b></td>
+ <td>{$fax_receiver_id}</td>
+ </tr>
+ <tr>
+ <td><b>{t}Status{/t}</b></td>
+ <td>{$fax_status}</td>
+ </tr>
+ <tr>
+ <td><b>{t}Status message{/t}</b></td>
+ <td>{$fax_status_message}</td>
+ </tr>
+ <tr>
+ <td><b>{t}Transfer time{/t}</b></td>
+ <td>{$fax_transfer_time}</td>
+ </tr>
+ <tr>
+ <td><b>{t}# pages{/t}</b></td>
+ <td>{$fax_pages}</td>
+ </tr>
+ </table>
+
+ </td>
+ </tr>
+</table>
+
+<p class="plugbottom">
+ <input type=submit name="bck_to_list" value="{t}Back{/t}">
+</p>
+
diff --git a/gosa-plugins/gofax/gofax/faxreports/main.inc b/gosa-plugins/gofax/gofax/faxreports/main.inc
--- /dev/null
@@ -0,0 +1,19 @@
+<?php
+
+if (!$remove_lock){
+ /* Create faxreport object on demand */
+ if (!isset($_SESSION['faxreport']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+ $_SESSION['faxreport']= new faxreport ($config, $ui);
+ }
+ $faxreport= $_SESSION['faxreport'];
+
+ /* Execute formular */
+ $faxreport->save_object();
+ $display= $faxreport->execute ();
+ $display.= "<input type=\"hidden\" name=\"ignore\">\n";
+ $display= print_header(get_template_path('images/reports.png'), _("FAX reports")).$display;
+
+ /* Store changes in session */
+ $_SESSION['faxreport']= $faxreport;
+}
+?>
diff --git a/gosa-plugins/gofax/manifest b/gosa-plugins/gofax/manifest
--- /dev/null
@@ -0,0 +1,6 @@
+[manifest]
+name = gofax
+description = GOfax intetragion for GOsa.
+author = Cajus Pollmeier <pollmeier@gonicus.de>
+version = 1.0
+depends = gosa-core