Code

added to more extension to connectivity
authoropensides <opensides@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 2 Nov 2005 21:45:44 +0000 (21:45 +0000)
committeropensides <opensides@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 2 Nov 2005 21:45:44 +0000 (21:45 +0000)
pptp and phpscheduleit

some more finishing touch to the xls plugin

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1799 594d385d-05f5-0310-b6e9-bd551577e9d8

13 files changed:
AUTHORS
contrib/gosa.conf
contrib/opensides/README.OpenSides
contrib/opensides/nagios.README
contrib/opensides/phpscheduleit.README [new file with mode: 0644]
contrib/opensides/pptp.README [new file with mode: 0644]
contrib/opensides/xls-export.README
html/getxls.php
plugins/addons/ldapmanager/class_exportxls.inc
plugins/personal/connectivity/class_phpscheduleitAccount.inc [new file with mode: 0644]
plugins/personal/connectivity/class_pptpAccount.inc [new file with mode: 0644]
plugins/personal/connectivity/phpscheduleit.tpl [new file with mode: 0644]
plugins/personal/connectivity/pptp.tpl [new file with mode: 0644]

diff --git a/AUTHORS b/AUTHORS
index d0ba52ddf6662ca96c7dc3a59efd08612266e578..4ec33b38334288ff43262bbf5073a6d62fe4d5a8 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -18,7 +18,8 @@ documentation and additional help.
   Fixes for magic_quotes_qpc
 
 * Guillaume Delecourt <guillaume.delecourt@opensides.be>
-  Setup fixes, nagios tab plugin
+  Setup fixes, nagios tab plugin, xls addons ldapmanager
+  pptp connectivity option, phpscheduleit connectivity option
 
 * Dan Ellis <danellis@rushmore.com>
   Sieve lib is taken from him
index 2cf870ffefdb21082fea58db4d0e542570f92c57..ad943ced9faefa3c828cd646dd9d7287f1b0195f 100644 (file)
@@ -71,8 +71,8 @@
                <tab class="connectivity" name="Connectivity" />
                <tab class="gofaxAccount" name="Fax" />
                <tab class="phoneAccount" name="Phone" />
-               <tab class="reference" name="References" />
 <!--                <tab class="nagiosAccount" name="Nagios" /> -->
+               <tab class="reference" name="References" />
        </usertabs>
 
        <grouptabs>
                <tab class="webdavAccount" />
                <tab class="phpgwAccount" />
                <tab class="intranetAccount" />
+<!--           <tab class="pptpAccount" /> -->
+<!--           <tab class="phpscheduleitAccount" /> -->
        </connectivity>
 
        <ldiftab>
index 339cfe04be44b14be4a1a5764932a2af7f26ab31..cfd8453425648357062825a1225e1bf3af9f6ddb 100644 (file)
@@ -7,9 +7,13 @@ goNagios.pl - This script will help you to manage the authentification
  
 slapd.conf - The slapd.conf confg for openldap 2.2
 
-nagios.README - how to add the right entry to make the nagios plugin work
+nagios.README - how to make the nagios plugin work
 
-xls-export.README - how to add the right entry to make the xls export xork
+pptp.README - how to make the pptp connectivity extension work
+
+phpscheduleit.README - how to make the phpscheduleit extension work
+
+xls-export.README - how to make the xls export xork
 
 
 The php_writeexcel library is coming from
index dfcbdbc491dfc2a4f710c7191b4eaf44fd74f349..beec8e5a28eb107f75c7a5b2ca7607386d094d62 100644 (file)
@@ -1,4 +1,8 @@
-To use the nagios plugin remove the comment in front of nagios in gosa.conf
+To use the nagios plugin
+
+1) Add the nagios schema to your schema directory
+
+2) Remove the comment in front of nagiosAccount in gosa.conf
 
 <!--                     <plugin acl="default" class="nagiosAccount" icon="monitoring.png"
                                 path="plugins/personal/nagios" /> -->
diff --git a/contrib/opensides/phpscheduleit.README b/contrib/opensides/phpscheduleit.README
new file mode 100644 (file)
index 0000000..4b634c8
--- /dev/null
@@ -0,0 +1,10 @@
+To use the phpscheduleit connectivity extension
+
+1) Add the schema phpscheduleit.schema in your schema directory
+
+2) Remove the comment in front of phpscheduleitAccount in gosa.conf
+
+<!--    <tab class="pptpAccount" /> -->
+
+Guillaume Delecourt
+OpenSides November 2005
diff --git a/contrib/opensides/pptp.README b/contrib/opensides/pptp.README
new file mode 100644 (file)
index 0000000..556e274
--- /dev/null
@@ -0,0 +1,13 @@
+To use the pptp connectivity extension
+
+1) Add the pptp.schema to your schema directory
+
+2) Remove the comment in front of pptpAccount in gosa.conf
+
+<!--    <tab class="pptpAccount" /> -->
+
+Guillaume Delecourt
+OpenSides November 2005
+
+
+
index 6cb3e08eb801c0ef0cc8ef4e97721f82f0a212e9..e9b06069ebf3eb96b09a526c4c20348468a5b36d 100644 (file)
@@ -1,6 +1,7 @@
-To use the xls export addon uncomment the following line in your gosa.conf :
+To use the xls export ldapamanager addon uncomment the following line in your gosa.conf :
 
 <!--            <tab class="xlsexport" name="Excel Export" />   -->
 
-Guillaume
+Guillaume Delecourt
+Vincent Seynhaeve
 OpenSides October 2005
index b54d3862816dc25c24f459f53c9baef523113e1a..b7590a3f89f139c41e5fdae2dd1a25c4e76041e2 100644 (file)
@@ -34,18 +34,29 @@ function dump_ldap ($mode= 0)
   if($mode == 2){      // Single Entry Export !
     $d =  base64_decode($_GET['d']);
     $n =  base64_decode($_GET['n']);
-    //         print_r($_GET);
     $dn=$d.$n;
-    //         echo $dn ;
+    $date=date('dS \of F Y ');
     $fname = tempnam("/tmp", "demo.xls");
     $workbook=& new writeexcel_workbook($fname);
 
+    $title_title=& $workbook->addformat(array(
+          bold    => 1,
+          color   => 'green',
+          size    => 11,
+          underline => 2,
+          font    => 'Helvetica'
+          ));
+
     $title_bold=& $workbook->addformat(array(
           bold    => 1,
           color   => 'black',
           size    => 10,
           font    => 'Helvetica'
           ));
+   # Create a format for the phone numbers
+   $f_phone =& $workbook->addformat();
+   $f_phone->set_align('left');
+   $f_phone->set_num_format('\0#');
 
 
     switch ($d){
@@ -53,12 +64,15 @@ function dump_ldap ($mode= 0)
         $user=                                    $ldap->gen_xls($dn,"(objectClass=*)",array("uid","dateOfBirth","gender","givenName","preferredLanguage"));
       $intitul=array(_("Birthday").":", _("Sexe").":", _("Name")."/"._("Firstname").":",_("Language").":");
 
+      //name of the xls file
+      $name_section=_("Users");
+       
       $worksheet=& $workbook->addworksheet(_("Users"));
-      $worksheet->set_column('A:B', 32);
-
+      $worksheet->set_column('A:B', 51);
 
       $user_nbr=count($user);
-      $r=1;
+      $worksheet->write('A1',_("User List of ").$n._(" on ").$date,$title_title);
+      $r=3;
       for($i=1;$i<$user_nbr;$i++)
       {
         if($i>1)
@@ -69,6 +83,7 @@ function dump_ldap ($mode= 0)
         {
           $r++;
           $worksheet->write('A'.$r,$intitul[$j-1]);
+          $user[$i][$j]=utf8_decode ($user[$i][$j]);
           $worksheet->write('B'.$r,$user[$i][$j]);
         }
         $worksheet->write('A'.$r++,"");
@@ -77,12 +92,17 @@ function dump_ldap ($mode= 0)
 
       case "ou=groups,": $groups= $ldap->gen_xls($dn,"(objectClass=*)",array("cn","memberUid"),TRUE,1);
       $intitul=array(_("Members").":");
+
+      //name of the xls file
+      $name_section=_("Groups");
+
       $worksheet =& $workbook->addworksheet(_("Groups"));
-      $worksheet->set_column('A:B', 32);
+      $worksheet->set_column('A:B', 51);
 
       //count number of groups
       $groups_nbr=count($groups);
-      $r=1;
+      $worksheet->write('A1',_("Groups of ").$n._(" on ").$date,$title_title);
+      $r=3;
       for($i=1;$i<$groups_nbr;$i++)
       {
         $worksheet->write('A'.$r++,_("User ID").": ".$groups[$i][0][0],$title_bold);
@@ -103,7 +123,6 @@ function dump_ldap ($mode= 0)
       $intitul=array(_("Description").":",_("User ID").":");
       $worksheet =& $workbook->addworksheet(_("Computers"));
       $worksheet->set_column('A:B', 32);
-
       //count number of computers
       $computers_nbr=count($computers);
       $r=1;
@@ -116,6 +135,7 @@ function dump_ldap ($mode= 0)
         {
           $r++;
           $worksheet->write('A'.$r,$intitul[$j-1]);
+          $computers[$i][$j]=utf8_decode ($computers[$i][$j]);
           $worksheet->write('B'.$r,$computers[$i][$j]);
         }
         $worksheet->write('A'.$r++,"");
@@ -125,12 +145,16 @@ function dump_ldap ($mode= 0)
       case "ou=servers,ou=systems,": $servers= $ldap->gen_xls($dn,"(objectClass=*)",array("cn"));
       $intitul=array(_("Server Name").":");
 
+      //name of the xls file
+      $name_section=_("Servers");
+
       $worksheet =& $workbook->addworksheet(_("Servers"));
-      $worksheet->set_column('A:B', 32);
+      $worksheet->set_column('A:B', 51);
 
       //count number of servers
       $servers_nbr=count($servers);
-      $r=1;
+      $worksheet->write('A1',_("Servers of ").$n._(" on ").$date,$title_title);
+      $r=3;
       $worksheet->write('A'.$r++,_("Servers").": ",$title_bold);
       for($i=1;$i<$servers_nbr;$i++)
       {
@@ -138,6 +162,7 @@ function dump_ldap ($mode= 0)
         {
           $r++;
           $worksheet->write('A'.$r,$intitul[$j]);
+          $servers[$i][$j]=utf8_decode ($servers[$i][$j]);
           $worksheet->write('B'.$r,$servers[$i][$j]);
         }
       }
@@ -147,13 +172,17 @@ function dump_ldap ($mode= 0)
         $address= $ldap->gen_xls($dn,"(objectClass=*)",array("cn","displayName","facsimileTelephoneNumber","givenName","homePhone","homePostalAddress","initials","l","mail","mobile","o","ou","pager","telephoneNumber","postalAddress","postalCode","sn","st","title"));
 
       $intitul=array(_("Common name").":",_("Display Name").":",_("Fax").":",_("Name")."/"._("Firstname").":",_("Home phone").":",_("Home postal address").":",_("Initials").":",_("Location").":",_("Mail address").":",_("Mobile phone").":",_("City").":",_("Postal address").":",_("Pager").":",_("Phone number").":",_("Adress").":",_("Postal code").":",_("Surename").":",_("State").":",_("Function").":");
+      
+      //name of the xls file
+      $name_section=_("Adressbook");
 
       $worksheet =& $workbook->addworksheet(_("Servers"));
-      $worksheet->set_column('A:B', 32);
+      $worksheet->set_column('A:B', 51);
 
       //count number of entries
       $address_nbr=count($address);
-      $r=1;
+      $worksheet->write('A1',_("Adressbook of ").$n._(" on ").$date,$title_title);
+      $r=3;
       for($i=1;$i<$address_nbr;$i++)
       {
         if($i>1)
@@ -163,7 +192,8 @@ function dump_ldap ($mode= 0)
         {
           $r++;
           $worksheet->write('A'.$r,$intitul[$j]);
-          $worksheet->write('B'.$r,$address[$i][$j]);
+          $address[$i][$j]=utf8_decode ($address[$i][$j]);
+          $worksheet->write('B'.$r,$address[$i][$j],$f_phone);
         }
         $worksheet->write('A'.$r++,"");
       }
@@ -180,7 +210,7 @@ function dump_ldap ($mode= 0)
     header('Content-type: application/x-msexcel');
 
     // It will be called demo.xls
-    header('Content-Disposition: attachment; filename="demo.xls"');
+    header('Content-Disposition: attachment; filename='.$name_section.".xls");
 
     // The source is in original.xls
     readfile($fname);
@@ -205,7 +235,9 @@ function dump_ldap ($mode= 0)
     $address= $ldap->gen_xls("dc=addressbook,".$dn,"(objectClass=*)",array("cn","displayName","facsimileTelephoneNumber","givenName","homePhone","homePostalAddress","initials","l","mail","mobile","o","ou","pager","telephoneNumber","postalAddress","postalCode","sn","st","title"));
     $address_intitul=array("cn",_("DisplayName").":",_("Fax").":",_("Name")."/"._("Firstname").":",_("Phone Number").":",_("Postal Adress").":",_("Initials").":",_("City").":",_("Email address").":",_("mobile").":",_("Organization").":",_("Organizational Unit").":",_("Pager").":",_("Phone Number").":",_("Postal Address").":",_("Postal Code").":",_("Sn").":",_("st").":",_("Title").":");
 
-
+    //name of the xls file
+    $name_section=_("Full");
+    $date=date('dS \of F Y ');
     $fname = tempnam("/tmp", "demo.xls");
     $workbook =& new writeexcel_workbook($fname);
     $worksheet =& $workbook->addworksheet(_("Users"));
@@ -214,11 +246,18 @@ function dump_ldap ($mode= 0)
     $worksheet4 =& $workbook->addworksheet(_("Computers"));
     $worksheet5 =& $workbook->addworksheet(_("Adressbook"));
 
-    $worksheet->set_column('A:B', 32);
-    $worksheet2->set_column('A:B', 32);
-    $worksheet3->set_column('A:B', 32);
-    $worksheet4->set_column('A:B', 32);
-    $worksheet5->set_column('A:B', 32);
+    $worksheet->set_column('A:B', 51);
+    $worksheet2->set_column('A:B', 51);
+    $worksheet3->set_column('A:B', 51);
+    $worksheet4->set_column('A:B', 51);
+    $worksheet5->set_column('A:B', 51);
+
+    $title_title=& $workbook->addformat(array(
+          bold    => 1,
+          color   => 'green',
+          size    => 11,
+          font    => 'Helvetica'
+          ));
 
     $title_bold =& $workbook->addformat(array(
           bold    => 1,
@@ -227,10 +266,15 @@ function dump_ldap ($mode= 0)
           font    => 'Helvetica'
           ));
 
+   # Create a format for the phone numbers
+   $f_phone =& $workbook->addformat();
+   $f_phone->set_align('left');
+   $f_phone->set_num_format('\0#');
 
     //count number of users
     $user_nbr=count($user);
-    $r=1;
+    $worksheet->write('A1',_("User List of ").$dn._(" on ").$date,$title_title);
+    $r=3;
     for($i=1;$i<$user_nbr;$i++)
     {
       if($i>1)
@@ -240,6 +284,7 @@ function dump_ldap ($mode= 0)
       {
         $r++;
         $worksheet->write('A'.$r,$user_intitul[$j-1]);
+        $user[$i][$j]=utf8_decode ($user[$i][$j]);
         $worksheet->write('B'.$r,$user[$i][$j]);
       }
       $worksheet->write('A'.$r++,"");
@@ -247,7 +292,8 @@ function dump_ldap ($mode= 0)
 
     //count number of groups
     $groups_nbr=count($groups);
-    $r=1;
+    $worksheet2->write('A1',_("Groups of ").$dn._(" on ").$date,$title_title);
+    $r=3;
     for($i=1;$i<$groups_nbr;$i++)
     {
       $worksheet2->write('A'.$r++,_("User ID").": ".$groups[$i][0][0],$title_bold);
@@ -265,7 +311,8 @@ function dump_ldap ($mode= 0)
 
     //count number of servers
     $servers_nbr=count($servers);
-    $r=1;
+    $worksheet3->write('A1',_("Servers of ").$dn._(" on ").$date,$title_title);
+    $r=3;
     $worksheet3->write('A'.$r++,_("Servers").": ",$title_bold);
     for($i=1;$i<$servers_nbr;$i++)
     {
@@ -273,13 +320,15 @@ function dump_ldap ($mode= 0)
       {
         $r++;
         $worksheet3->write('A'.$r,$servers_intitul[$j]);
+        $servers[$i][$j]=utf8_decode ($servers[$i][$j]);
         $worksheet3->write('B'.$r,$servers[$i][$j]);
       }
     }
 
     //count number of computers
     $computers_nbr=count($computers);
-    $r=1;
+    $worksheet4->write('A1',_("Computers of ").$dn._(" on ").$date,$title_title);
+    $r=3;
     for($i=1;$i<$computers_nbr;$i++)
     {
       if($i>1)
@@ -289,6 +338,7 @@ function dump_ldap ($mode= 0)
       {
         $r++;
         $worksheet4->write('A'.$r,$computers_intitul[$j-1]);
+        $computers[$i][$j]=utf8_decode ($computers[$i][$j]);
         $worksheet4->write('B'.$r,$computers[$i][$j]);
       }
       $worksheet4->write('A'.$r++,"");
@@ -296,7 +346,9 @@ function dump_ldap ($mode= 0)
 
     //count number of entries
     $address_nbr=count($address);
-    $r=1;
+    $worksheet5->write('A1',_("Adressbook of ").$dn._(" on ").$date,$title_title);
+
+    $r=3;
     for($i=1;$i<$address_nbr;$i++)
     {
       if($i>1)
@@ -306,7 +358,8 @@ function dump_ldap ($mode= 0)
       {
         $r++;
         $worksheet5->write('A'.$r,$address_intitul[$j]);
-        $worksheet5->write('B'.$r,$address[$i][$j]);
+        $address[$i][$j]=utf8_decode ($address[$i][$j]);
+        $worksheet5->write('B'.$r,$address[$i][$j],$f_phone);
       }
       $worksheet5->write('A'.$r++,"");
     }
@@ -317,9 +370,8 @@ function dump_ldap ($mode= 0)
     header('Content-type: application/x-msexcel');
 
     // It will be called demo.xls
-    header('Content-Disposition: attachment; filename="demo.xls"');
+    header('Content-Disposition: attachment; filename='.$name_section.".xls");
 
-    // The PDF source is in original.xl
     readfile($fname);
 
     unlink ($fname);
index d41bea08db706bb9f205704c968d2d06c68de200..f3c1d3cc2e52d06aff91477c4f269e07313b7253 100644 (file)
@@ -4,7 +4,7 @@
 class xlsexport extends plugin
 {
   /* Definitions */
-  var $plHeadline= "XLS export";
+  var $plHeadline= "XLS import";
   var $plDescription= "This does something";
   var $access= "";
 
@@ -19,7 +19,7 @@ class xlsexport extends plugin
 
     $ui= get_userinfo();
     $acl= get_permissions ($config->current['BASE'], $ui->subtreeACL);
-    $acl= get_module_permission($acl, "xlsexport", $config->current['BASE']);
+    $acl= get_module_permission($acl, "ldifexport", $config->current['BASE']);
     $this->access= $acl;
   }
 
@@ -32,7 +32,7 @@ class xlsexport extends plugin
     
     /* Check permissions for export */
     if ($this->access != '#all#'){
-      print_red(_("You've no permission to do XLS exports."));
+      print_red(_("You've no permission to do LDAP exports."));
     } else {
       // fill in old vars in the Export form
       if((isset($_POST['single']))&&(isset($_POST['sfrmgetsingle']))){
@@ -85,7 +85,7 @@ class xlsexport extends plugin
        print_red (_("Error while exporting the requested entries!"));
       }
     }
-
+//     print_r($_POST);
     // Export a single LDAP entry
     if(isset($_POST['sfrmgetsingle']))
     {
diff --git a/plugins/personal/connectivity/class_phpscheduleitAccount.inc b/plugins/personal/connectivity/class_phpscheduleitAccount.inc
new file mode 100644 (file)
index 0000000..1015705
--- /dev/null
@@ -0,0 +1,117 @@
+<?php
+
+class phpscheduleitAccount extends plugin
+{
+  /* Definitions */
+  var $plHeadline= "PHPscheduleit Account";
+  var $plDescription= "This does something";
+
+  /* CLI vars */
+  var $cli_summary= "Manage users phpscheduleit account";
+  var $cli_description= "Some longer text\nfor help";
+  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* attribute list for save action */
+  var $attributes= array();
+  var $objectclasses= array("phpscheduleitAccount");
+
+  function phpscheduleitAccount ($config, $dn= NULL)
+  {
+    plugin::plugin ($config, $dn);
+  }
+
+  function execute()
+  {
+    /* Show tab dialog headers */
+    $display= "";
+
+    /* Show main page */
+    $smarty= get_smarty();
+
+    if ($this->is_account){
+      $smarty->assign("phpscheduleitState", "checked");
+    } else {
+      $smarty->assign("phpscheduleitState", "");
+      $smarty->assign("wstate", "disabled");
+    }
+
+    if ($this->parent != NULL){
+      $smarty->assign("tabbed", 1);
+    }
+
+    $smarty->assign('gosaphpscheduleitACL', chkacl($this->acl, 'gosaphpscheduleit'));
+
+    $display.= $smarty->fetch (get_template_path('phpscheduleit.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();
+    $ldap= $this->config->get_ldap_link();
+
+    $ldap->cd($this->dn);
+    @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
+        $this->attributes, "Save");
+    $ldap->modify($this->attrs);
+    show_ldap_error($ldap->get_error());
+
+    /* Optionally execute a command after we're done */
+    $this->handle_post_events('remove');
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    /* Do we need to flip is_account state? */
+    if (isset($_POST['connectivityTab'])){
+      if (isset($_POST['phpscheduleit'])){
+        if (!$this->is_account && $_POST['phpscheduleit'] == "B"){
+          $this->is_account= TRUE;
+        }
+      } else {
+        $this->is_account= FALSE;
+      }
+    }
+
+    plugin::save_object();
+    if (isset($_POST["phpscheduleitStatus"])){
+      $this->pptpStatus = "disabled";
+    } else {
+      $this->pptpStatus = "enabled";
+    }
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    plugin::save();
+
+    /* Write back to ldap */
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd($this->dn);
+    $ldap->modify($this->attrs);
+    show_ldap_error($ldap->get_error());
+
+    /* Optionally execute a command after we're done */
+    if ($this->initially_was_account == $this->is_account){
+      if ($this->is_modified){
+        $this->handle_post_events("mofify");
+      }
+    } else {
+      $this->handle_post_events("add");
+    }
+
+  }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/personal/connectivity/class_pptpAccount.inc b/plugins/personal/connectivity/class_pptpAccount.inc
new file mode 100644 (file)
index 0000000..e98bb78
--- /dev/null
@@ -0,0 +1,117 @@
+<?php
+
+class pptpAccount extends plugin
+{
+  /* Definitions */
+  var $plHeadline= "PPTP Server";
+  var $plDescription= "This does something";
+
+  /* CLI vars */
+  var $cli_summary= "Manage users pptp account";
+  var $cli_description= "Some longer text\nfor help";
+  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* attribute list for save action */
+  var $attributes= array();
+  var $objectclasses= array("pptpServerAccount");
+
+  function pptpAccount ($config, $dn= NULL)
+  {
+    plugin::plugin ($config, $dn);
+  }
+
+  function execute()
+  {
+    /* Show tab dialog headers */
+    $display= "";
+
+    /* Show main page */
+    $smarty= get_smarty();
+
+    if ($this->is_account){
+      $smarty->assign("pptpState", "checked");
+    } else {
+      $smarty->assign("pptpState", "");
+      $smarty->assign("wstate", "disabled");
+    }
+
+    if ($this->parent != NULL){
+      $smarty->assign("tabbed", 1);
+    }
+
+    $smarty->assign('gosapptpACL', chkacl($this->acl, 'gosapptp'));
+
+    $display.= $smarty->fetch (get_template_path('pptp.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();
+    $ldap= $this->config->get_ldap_link();
+
+    $ldap->cd($this->dn);
+    @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
+        $this->attributes, "Save");
+    $ldap->modify($this->attrs);
+    show_ldap_error($ldap->get_error());
+
+    /* Optionally execute a command after we're done */
+    $this->handle_post_events('remove');
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    /* Do we need to flip is_account state? */
+    if (isset($_POST['connectivityTab'])){
+      if (isset($_POST['pptp'])){
+        if (!$this->is_account && $_POST['pptp'] == "B"){
+          $this->is_account= TRUE;
+        }
+      } else {
+        $this->is_account= FALSE;
+      }
+    }
+
+    plugin::save_object();
+    if (isset($_POST["pptpStatus"])){
+      $this->pptpStatus = "disabled";
+    } else {
+      $this->pptpStatus = "enabled";
+    }
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    plugin::save();
+
+    /* Write back to ldap */
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd($this->dn);
+    $ldap->modify($this->attrs);
+    show_ldap_error($ldap->get_error());
+
+    /* Optionally execute a command after we're done */
+    if ($this->initially_was_account == $this->is_account){
+      if ($this->is_modified){
+        $this->handle_post_events("mofify");
+      }
+    } else {
+      $this->handle_post_events("add");
+    }
+
+  }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/personal/connectivity/phpscheduleit.tpl b/plugins/personal/connectivity/phpscheduleit.tpl
new file mode 100644 (file)
index 0000000..f3ca926
--- /dev/null
@@ -0,0 +1 @@
+<h2>{if $tabbed eq 1}<input type="checkbox" name="phpscheduleit" value="B" {$phpscheduleitState} {$gosaphpscheduleitACL}>{/if}{t}PHPscheduleit account{/t}</h2>
diff --git a/plugins/personal/connectivity/pptp.tpl b/plugins/personal/connectivity/pptp.tpl
new file mode 100644 (file)
index 0000000..70e9958
--- /dev/null
@@ -0,0 +1 @@
+<h2>{if $tabbed eq 1}<input type="checkbox" name="pptp" value="B" {$pptpState} {$gosapptpACL}>{/if}{t}PPTP Server account{/t}</h2>