0f4bf36bb13fa77d78b9ac0a72d46785d9512821
1 <?php
3 class webdavAccount extends plugin
4 {
5 /* Definitions */
6 var $plHeadline= "WebDAV";
7 var $plDescription= "This does something";
9 /* CLI vars */
10 var $cli_summary= "Manage users webdav account";
11 var $cli_description= "Some longer text\nfor help";
12 var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
14 /* attribute list for save action */
15 var $attributes= array();
16 var $objectclasses= array("gosaWebdavAccount");
18 function webdavAccount ($config, $dn= NULL)
19 {
20 plugin::plugin ($config, $dn);
21 }
23 function execute()
24 {
25 /* Call parent execute */
26 // plugin::execute();
28 /* Show tab dialog headers */
29 $display= "";
31 /* Show main page */
32 $smarty= get_smarty();
34 if ($this->is_account){
35 $smarty->assign("webdavState", "checked");
36 } else {
37 $smarty->assign("webdavState", "");
38 $smarty->assign("wstate", "disabled");
39 }
41 if ($this->parent != NULL){
42 $smarty->assign("tabbed", 1);
43 }
45 $smarty->assign('gosaWebdavACL', chkacl($this->acl, 'gosaWebdav'));
47 $display.= $smarty->fetch (get_template_path('webdav.tpl', TRUE, dirname(__FILE__)));
48 return ($display);
49 }
51 function remove_from_parent()
52 {
53 /* Cancel if there's nothing to do here */
54 if (!$this->initially_was_account){
55 return;
56 }
58 plugin::remove_from_parent();
59 $ldap= $this->config->get_ldap_link();
61 $ldap->cd($this->dn);
62 @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
63 $this->attributes, "Save");
64 $ldap->modify($this->attrs);
65 show_ldap_error($ldap->get_error());
67 /* Optionally execute a command after we're done */
68 $this->handle_post_events('remove');
69 }
72 /* Save data to object */
73 function save_object()
74 {
75 /* Do we need to flip is_account state? */
76 if (isset($_POST['connectivityTab'])){
77 if (isset($_POST['webdav'])){
78 if (!$this->is_account && $_POST['webdav'] == "B"){
79 $this->is_account= TRUE;
80 }
81 } else {
82 $this->is_account= FALSE;
83 }
84 }
86 plugin::save_object();
87 if (isset($_POST["WEBDAVStatus"])){
88 $this->WEBDAVStatus = "disabled";
89 } else {
90 $this->WEBDAVStatus = "enabled";
91 }
92 }
95 /* Save to LDAP */
96 function save()
97 {
98 plugin::save();
100 /* Write back to ldap */
101 $ldap= $this->config->get_ldap_link();
102 $ldap->cd($this->dn);
103 $ldap->modify($this->attrs);
104 show_ldap_error($ldap->get_error());
106 /* Optionally execute a command after we're done */
107 if ($this->initially_was_account == $this->is_account){
108 if ($this->is_modified){
109 $this->handle_post_events("mofify");
110 }
111 } else {
112 $this->handle_post_events("add");
113 }
115 }
117 }
119 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
120 ?>