From c742134f3925bc3ac583d4a0d02b169b98a33a98 Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 19 Jun 2007 12:29:47 +0000 Subject: [PATCH] Initial scalix plugin git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@6626 594d385d-05f5-0310-b6e9-bd551577e9d8 --- html/images/scalix.png | Bin 0 -> 3343 bytes html/images/scalix16.png | Bin 0 -> 751 bytes plugins/admin/groups/acl_definition.inc | 13 + .../personal/scalix/class_scalixAccount.inc | 429 ++++++++++++++++++ plugins/personal/scalix/generic.tpl | 97 ++++ plugins/personal/scalix/main.inc | 133 ++++++ 6 files changed, 672 insertions(+) create mode 100644 html/images/scalix.png create mode 100644 html/images/scalix16.png create mode 100644 plugins/personal/scalix/class_scalixAccount.inc create mode 100644 plugins/personal/scalix/generic.tpl create mode 100644 plugins/personal/scalix/main.inc diff --git a/html/images/scalix.png b/html/images/scalix.png new file mode 100644 index 0000000000000000000000000000000000000000..649e7bf892bc2040690789e0bba91567f6c7f8fc GIT binary patch literal 3343 zcmV+q4e;`bP)I4r%=pZov-44g?s zK~#7F?O9u_R>c)wd;iyS;T*2kQk5!*S`7pd4uS-<(pp|-shsE z?IUx}?3r0Jv*!C|)~uPmf066q`V9O}GZ0)$?_-bc2};%Sn%dyNuKtC?I|mjm8j+|i zNhgw|)s-|xzKb-95t&AskD1136D1-@S)U|{Br)10%%`YNkVk~9)oPEo+wFr0r=SON1cXB+vmU#79`_M5|C>V37*zP{Snp)L1f;MpM? zCSSF1^&NYMSFIWeYm22cFeFl2AVFL6D#fHJ)A$ zi-DAZ5{z;f{b*3`lVH)XgbRixsP{=& zD?=G#XcG~X03IuVe+@z4VfnHH8o(qdQbbng2hC5oRrea@>)5MatBoGsx_*ag=smqI zl}!Bbd%^ONP5ZS_<{ZN8Dkw2B0CT1|wtNpZRAKypwu6-Is2unm_8vH@%1SQ7_Fl$R z7mp2nfUvJ#-~asPb-tO_6bO`RwKe5hX^`GTH(YC4lBugA(@5b4=?d{sB1}2yp=W@N zN7N|{BqeA(Sd}^?ZXI;cBo9IRs5qM(lF15IrOz-72C;|M2W}yORob@M9(2`lT6_bEf7tLnFL&tLosFsWv+w*Ly5BnXEP&E&=YE| zSIny5D0ZRY8@_Xaz`&A)J5vQ{)iKCe0Ps#*fhRZ%2wv3hQ!n!PR}xAJJ>dQX9xJHT zrGmW@Pd6oQG)1mlKtuE(Ft-X^84{+z@Um=yWs^Apl5(lE6Uh@^GK0YINYa6?hi?w6 zm}&Jg^fVv>VhX<7g3pJ)2iPP5F`lwW>4B=N@0Qw~Yov11EmFefpBWNNLigOq(*EE* zX}&!njn`k5Wb%qOOKErf_tB(E#z@$+TrQ8~^%e-EO_)p#)fJqqG2A3Q4FmA=bj8sM z@GzM+Ob1|60O$3fe9KB1-u{S`7A>*%^E^Yi;o8kBG!AWj2s&dq^VE|vb@U(TVF0Zw zS-2civdTg}j}^(}$fUU6usXo(1|dvED{TeT=5aj;5?moT>)7aw^>riC|G<~?YOXoY z2`UW?8bBQk4;$2UxV#q`4{u=Bq(FejKkNdY#raL|F2t1A#lTOGX`C=r6!e>~LQJqdWA z2uk3Y1~xxvT5?aW)YPGa(inSQV%RtDK-^Q@HJ^ z>HYKm^1UkWB`4 zWdOCnp(vz60@sWdGqD?sNs$1r44B;jdqD3n)WbUfXs9AJ2kHkQTqjx+uS?(B^*MFL zEL~*(J!>^`%kmAaIq`;Edj45yyawN|h&TwxaA1*FLR7^nm-;qNLaBx#0r+_}7GA(W zLd_o%RYLGiV?qKTdij|@N%gkdaq8lo;Tl2+H#!I}#MnIfj+}n#SJL51I?$%xnM;lw zB&HpSa?OopuEq%xzI0=Q@#e{tFXfCpuy}3YD`J8xg}$_-9AElG&OQB0>6|&0Q+aLK z{@d@ATYvr=DKB2C@NCu{c&Z>NOEQ8^QW#(c0h*8lFlZzSyAsSPDVR{gOB#+{ zvSMdmi5O^D8YrZUV4bF+2e!-L#?3N`lXvpSVVOSuwyl&S!4XMd@ZOCwyk)zp$v>L! zo{;WEdsFMJg3Y(CW^U$ttI*R>AdsfKPUHIE>T&zWAG;yw!&MMG0QwMCtFmz0!y5Ub z)Bf<^(*5MTdaV-fOtqW8DAlF2FMjO*(I0-N(`qvhy-Jv=4auPxP0p0PdZ9=FCcy6* z`8N4HyD1$AZIksB`5fQ6`c|&i=wZpbCUMLda zCRFTZIz(^Hi(d*ToEm>wPELGF7Hqs9SAz{QaQ7N}J?!Z&FMTpy;dLbW<>RV0cd6f zW;WV}@Qh#9jsib9>NMCsO%LP=6if&Q*|9i|8u;!%ID78he&!&i7J6(@UsN(IaMWyY z-K7fF>a8woL)0i}o$p7P{S&b2(sGhE(C`>KWTCJE+g?1HPE9s;b4K~{&U-(jUjdbC z83XDHxs>f(dvwUaLTK$s#sOhJf->C(&cM68LyjK3KByw2P898aR#N?;SvUoa~uglN6k>G?XJZ%e#6lgvpLal70(Z=XT z@xC47$G*c-J`_yISKybzJ@}M;Cw>*t4ec=XpmRVCHn3$03c)=%xE6CDRK_lpv8lFE z0rEXL3)+T_(2|}fisL;j%?xv{02{sVzuhIreD#jU<2X48@CQ(LZ03eV)9c~-4E(=m Z;6MLHi9tKb4s!qi002ovPDHLkV1g%QJ|X}B literal 0 HcmV?d00001 diff --git a/html/images/scalix16.png b/html/images/scalix16.png new file mode 100644 index 0000000000000000000000000000000000000000..9ac5eed2f70ab24389aa39f758f156e79418aaaf GIT binary patch literal 751 zcmV{l3X1YMp^uhM9TadA@gMfgLt$OFw^S zB;VH6IiAh76yj>tm0k_n-+&AP=%@}^=iU&Z9~8qN96LW%nq#don7=!k@40@n2vK*{ z(gNhKpOBRbbj^eG1E?@E2C5;Tg@6=7)Vz(t!1RZ?6uWfv^^Mz^w9DhI<{UVL%&9!G zXZqnD?xCZ$VQFZ&uA3g`y$*k}xlBQR{|2%~95v8-=^E0V-AJSaQWh-R!RoUKtiF1Q zBq0IywBr<5YYg;y*+t+ZQ8DbUBSsv3Dxv)JAv9sT$4($t3Q0`LBqlw(zz{bLDu`{H z7HMfuJ1=6_@ssGdF^uTz7i^T?q5flqv@zI&KZ!vhK;F!W%c=+Ad5AvF!k?KWY#Xgq z|GuGNbl&=X9v(ecm?I+ONq_AA)p7+d=WsjxPaWb z3pjXt#B4|?y!EL!SbqEf2^(k _("Scalix Mail node"), + "scalixMailboxClass" => _("Mailbox class"), + "scalixServerLanguage" => _("Server language"), + "scalixAdministrator" => _("Administrator"), + "scalixMailboxAdministrator"=> _("Mailbox administrator"), + "scalixHideUserEntry" => _("Hide user entry in Scalix"), + "scalixLimitMailboxSize" => _("Mailbox size limitations"), + "scalixLimitOutboundMail" => _("Limit outbound"), + "scalixLimitInboundMail" => _("Limit inbound"), + "scalixLimitNotifyUser" => _("Notify user"), + "scalixEmailAddress" => _("Scalix email addresses")); + ?> diff --git a/plugins/personal/scalix/class_scalixAccount.inc b/plugins/personal/scalix/class_scalixAccount.inc new file mode 100644 index 000000000..7f41d7e7d --- /dev/null +++ b/plugins/personal/scalix/class_scalixAccount.inc @@ -0,0 +1,429 @@ +, + based on work by Cajus Pollmeier + \version 0.01 + \date 20.10.2006 + + This class provides the functionality to read and write all attributes + relevant for scalixAccounts from/to the LDAP. It does syntax checking + and displays the formulars required. + */ + +class scalixAccount extends plugin +{ + /* Definitions */ + var $plHeadline = "Scalix"; + var $plDescription= "This does something"; + + /* CLI vars */ + var $cli_summary = "Manage users scalix account"; + var $cli_description= "Some longer text\nfor help"; + var $cli_parameters = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser"); + + /* plugin specific values - scalixUserClass */ + /* MUST */ + var $scalixScalixObject= TRUE; //TRUE or FALSE + var $scalixMailnode= ""; + /* INDIRECT MUST, scalix will complain if no email was specified */ + + /* MAY */ + var $scalixAdministrator= FALSE; + var $scalixMailboxAdministrator = FALSE; + var $scalixServerLanguage= ""; + var $scalixEmailAddress= array(); + var $scalixLimitMailboxSize= ""; + var $scalixLimitOutboundMail= FALSE; + var $scalixLimitInboundMail= FALSE; + var $scalixLimitNotifyUser= FALSE; + var $scalixHideUserEntry= FALSE; + var $scalixMailboxClass= ""; + + var $default_permissions= "none"; + var $member_permissions= "post"; + var $members= array(); + var $admins= array(); + var $vacations= array(); + var $perms= array( "lrs" => "read", "lrsp" => "post", "lrsip" => "append", + "lrswipcd" => "write", "lrswipcda" => "all" ); + + /* attribute list for save action */ + var $attributes= array("scalixMailnode", "scalixServerLanguage", "scalixLimitMailboxSize", "scalixMailboxClass"); + var $fakeBooleanAttributes= array("scalixAdministrator", "scalixMailboxAdministrator", "scalixLimitOutboundMail", "scalixLimitInboundMail", "scalixLimitNotifyUser", "scalixHideUserEntry"); + var $objectclasses= array("scalixUserClass"); + + + /* constructor, if 'dn' is set, the node loads the given + 'dn' from LDAP */ + function scalixAccount ($config, $dn= NULL) + { + /* dn shouldn't be NULL */ + if($dn == NULL){ + trigger_error("Initialising scalixAccount without valid dn."); + } + + /* Load bases attributes */ + plugin::plugin($config, $dn); + + /* Load attributes */ + if ($dn != "new"){ + + $this->uid = $this->attrs['uid']; + + foreach ($this->fakeBooleanAttributes as $val){ + if (isset($this->attrs["$val"][0])&&$this->attrs["$val"][0]=="TRUE"){ + $this->$val = TRUE; + } else { + $this->$val = FALSE; + } + } + + /* Load attributes containing arrays */ + foreach (array("scalixEmailAddress") as $val){ + if (isset($this->attrs["$val"]["count"])){ + for ($i= 0; $i<$this->attrs["$val"]["count"]; $i++){ + array_push($this->$val, $this->attrs["$val"][$i]); + } + } + } + } + + /* Save initial account state */ + $this->initially_was_account= $this->is_account; + } + + + function execute() + { + /* Call parent execute */ + plugin::execute(); + + /* Load templating engine */ + $smarty= get_smarty(); + $display= ""; + + /* Do we need to flip is_account state? */ + if (isset($_POST['modify_state'])){ + $this->is_account= !$this->is_account; + } + + /* Show main page */ + $mailboxClasses = array("", "LIMITED", "FULL"); + $serverLanguages= array("", "GERMAN", "ENGLISH"); + + /* Do we represent a valid account? */ + if (!$this->is_account && $this->parent == NULL){ + $display= "\"\" ". + _("This account has no scalix extensions.").""; + + $display.= back_to_main(); + return ($display); + } + + /* Show tab dialog headers */ + if ($this->parent != NULL){ + if ($this->is_account){ + $display= $this->show_header(_("Remove scalix account"), + _("This account has scalix synchronization enabled. You can disable it by clicking below.")); + } else { + $display= $this->show_header(_("Create scalix account"), _("This account has scalix synchronization disabled. You can enable it by clicking below.")); + return ($display); + } + } + + /* Trigger forward add dialog? */ + if (isset($_POST['add_local_forwarder'])){ + $this->forward_dialog= TRUE; + $this->dialog= TRUE; + } + + /* Cancel forward add dialog? */ + if (isset($_POST['add_locals_cancel'])){ + $this->forward_dialog= FALSE; + $this->dialog= FALSE; + } + + /* Add email addresses */ + if (isset($_POST['add_email'])){ + if ($_POST['email_address'] != "" && + chkacl ($this->acl, "scalixEmailAddress") == ""){ + + $valid= FALSE; + if (!is_email($_POST['email_address'])){ + if ($this->is_template){ + if (!(is_email($_POST['email_address'], TRUE))){ + print_red (_("You're trying to add an invalid email address to the list of alternate addresses.")); + } else { + $valid= TRUE; + } + } else { + print_red (_("You're trying to add an invalid email address to the list of alternate addresses.")); + } + + } else { + $valid= TRUE; + } + + if ($valid && ($user= $this->addEmail ($_POST['email_address'])) != ""){ + $ui= get_userinfo(); + if ($user != $ui->username){ + print_red (_("The address you're trying to add is already used by user")." '$user'."); + } + } + } + } + + /* Delete email addresses */ + if (isset($_POST['delete_email']) && isset ($_POST['emails_list'])){ + if (count($_POST['emails_list']) && + chkacl ($this->acl, "scalixEmailAddress") == ""){ + + $this->delEmail ($_POST['emails_list']); + } + } + + $smarty->assign("mailboxClasses", $mailboxClasses); + $smarty->assign("serverLanguages", $serverLanguages); + foreach(array("perms", "scalixScalixObject", "scalixMailnode", "scalixAdministrator", "scalixMailboxAdministrator", + "scalixServerLanguage", "scalixLimitMailboxSize", "scalixLimitOutboundMail", "scalixEmailAddress", + "scalixLimitInboundMail", "scalixLimitNotifyUser", "scalixHideUserEntry", "scalixMailboxClass") as $val){ + + $smarty->assign("$val", $this->$val); + $smarty->assign("$val"."ACL", chkacl($this->acl, "$val")); + } + + /* Fill checkboxes */ + if ($this->scalixAdministrator) { + $smarty->assign("scalixAdministrator", "checked"); + } else { + $smarty->assign("scalixAdministrator", ""); + } + if ($this->scalixMailboxAdministrator) { + $smarty->assign("scalixMailboxAdministrator", "checked"); + } else { + $smarty->assign("scalixMailboxAdministrator", ""); + } + if ($this->scalixLimitOutboundMail) { + $smarty->assign("scalixLimitOutboundMail", "checked"); + } else { + $smarty->assign("scalixLimitOutboundMail", ""); + } + if ($this->scalixLimitInboundMail) { + $smarty->assign("scalixLimitInboundMail", "checked"); + } else { + $smarty->assign("scalixLimitInboundMail", ""); + } + if ($this->scalixLimitNotifyUser) { + $smarty->assign("scalixLimitNotifyUser", "checked"); + } else { + $smarty->assign("scalixLimitNotifyUser", ""); + } + if ($this->scalixHideUserEntry) { + $smarty->assign("scalixHideUserEntry", "checked"); + } else { + $smarty->assign("scalixHideUserEntry", ""); + } + + $display.= $smarty->fetch (get_template_path('generic.tpl', TRUE, dirname(__FILE__))); + return ($display); + } + + + /* remove object from parent */ + function remove_from_parent() + { + /* Cancel if there's nothing to do here */ + if (!$this->initially_was_account){ + return; + } + + /* include global link_info */ + $ldap= $this->config->get_ldap_link(); + + /* Remove and write to LDAP */ + plugin::remove_from_parent(); + + /* Zero arrays */ + $this->attrs['scalixEmailAddress']= array(); + + /* Unset fake boolean attributes from entry */ + foreach ($this->fakeBooleanAttributes as $val){ + $this->attrs["$val"]= array(); + } + + /*unset scalixScalixObject*/ + $this->attrs['scalixScalixObject']=array(); + + @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,$this->attributes, "Save"); + $ldap->cd($this->dn); + $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() + { + if (isset($_POST['scalixTab'])){ + + /* Save ldap attributes */ + plugin::save_object(); + + /* Save fakeBooleanAttributes*/ + foreach ($this->fakeBooleanAttributes as $val){ + if (chkacl ($this->acl, "$val") == "") { + if( isset ($_POST["$val"])) { + $data = TRUE; + } else { + $data = FALSE; + } + if ($this->$val != $data){ + $this->is_modified= TRUE; + } + + $this->$val= $data; + } + } + } + } + + + /* Save data to LDAP, depending on is_account we save or delete */ + function save() + { + $ldap= $this->config->get_ldap_link(); + + /* Call parents save to prepare $this->attrs */ + plugin::save(); + + /* Save arrays */ + $this->attrs['scalixEmailAddress']= $this->scalixEmailAddress; + + /* Save boolean vars ... the scalix schema expects them as strings */ + $this->attrs['scalixScalixObject'] = $this->scalixScalixObject?"TRUE":"FALSE"; + $this->attrs['scalixAdministrator'] = $this->scalixAdministrator?"TRUE":"FALSE"; + $this->attrs['scalixMailboxAdministrator'] = $this->scalixMailboxAdministrator?"TRUE":"FALSE"; + $this->attrs['scalixLimitOutboundMail'] = $this->scalixLimitOutboundMail?"TRUE":"FALSE"; + $this->attrs['scalixLimitInboundMail'] = $this->scalixLimitInboundMail?"TRUE":"FALSE"; + $this->attrs['scalixLimitNotifyUser'] = $this->scalixLimitNotifyUser?"TRUE":"FALSE"; + $this->attrs['scalixHideUserEntry'] = $this->scalixHideUserEntry?"TRUE":"FALSE"; + + /* Remove Mailquota if = "" */ + if((isset($this->attrs['scalixLimitMailboxSize']))&&($this->attrs['scalixLimitMailboxSize']=="")) { + $this->attrs['scalixLimitMailboxSize']=array(); + } + + /* Save data to LDAP */ + $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("modify"); + } + } else { + $this->handle_post_events("add"); + } + + } + + /* Check formular input */ + function check() + { + $ldap= $this->config->get_ldap_link(); + + $message= array(); + + if(empty($this->scalixMailnode)){ + $message[]= _("There is no scalix mailnode specified."); + } + if(empty($this->scalixScalixObject)){ + $message[]= _("scalixScalixObject must be set!"); + } + + $ldap->cd($this->config->current['BASE']); + foreach($this->scalixEmailAddress as $k => $mail) { + $ldap->search ("(&(!(objectClass=gosaUserTemplate))(objectClass=scalixUserClass)(|(scalixEmailAddress=". + $mail."))(!(uid=".$this->uid."))(!(cn=".$this->uid.")))", array("uid")); + if ($ldap->count() != 0){ + $message[]= _("The email address '$mail' you've entered is already in use."); + } + } + + /* Check quota */ + if ($this->scalixLimitMailboxSize != '' && chkacl ($this->acl, "scalixLimitMailboxSize") == ""){ + if (!is_numeric($this->scalixLimitMailboxSize)) { + $message[]= _("Value in 'Limit Mailbox size' is not valid."); + } else { + $this->scalixLimitMailboxSize= (int) $this->scalixLimitMailboxSize; + } + } + + return ($message); + } + + /* Adapt from template, using 'dn' */ + function adapt_from_template($dn) + { + plugin::adapt_from_template($dn); + + foreach (array("scalixEmailAddress") as $val){ + $this->$val= array(); + if (isset($this->attrs["$val"]["count"])){ + for ($i= 0; $i<$this->attrs["$val"]["count"]; $i++){ + $value= $this->attrs["$val"][$i]; + foreach (array("sn", "givenName", "uid") as $repl){ + if (preg_match("/%$repl/i", $value)){ + $value= preg_replace ("/%$repl/i", $this->parent->$repl, $value); + } + } + array_push($this->$val, strtolower(rewrite($value))); + } + } + } + $this->mail= strtolower(rewrite($this->mail)); + } + + function addEmail($address) + { + $ldap= $this->config->get_ldap_link(); + + $address= strtolower($address); + + /* Is this address already assigned in LDAP? */ + $ldap->cd ($this->config->current['BASE']); + $ldap->search ("(&(objectClass=scalixUserClass)(|(scalixEmailAddress=$address)". + "(scalixEmailAddress=$address)))", array("uid")); + + if ($ldap->count() > 0){ + $attrs= $ldap->fetch (); + return ($attrs["uid"][0]); + } + + /* Add to list of alternates */ + if (!in_array($address, $this->scalixEmailAddress)){ + $this->scalixEmailAddress[]= $address; + $this->is_modified= TRUE; + } + + //sort ($this->scalixEmailAddress); //scalix makes the first email the destination, all others can receive + reset ($this->scalixEmailAddress); + + return (""); + } + + + function delEmail($addresses) + { + $this->scalixEmailAddress= array_remove_entries ($addresses, $this->scalixEmailAddress); + $this->is_modified= TRUE; + } +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/plugins/personal/scalix/generic.tpl b/plugins/personal/scalix/generic.tpl new file mode 100644 index 000000000..353196217 --- /dev/null +++ b/plugins/personal/scalix/generic.tpl @@ -0,0 +1,97 @@ + + + + + + + + +
+

 {t}Generic{/t}

+ + + + + + + + + + + + + +
{$must}
+ +
+ +
+ +

 

+ + + +
+ {t}Scalix Administrator{/t} +
+ {t}Scalix Mailbox Administrator{/t} +
+ {t}hide this user entry in Scalix{/t} +
+
+ +

 

+ + + + + + + + + +
+ {t}Limit Outbound Mail{/t} +
+ {t}Limit Inbound Mail{/t} +
+ {t}Notify User{/t} +
+
+
+   + +

+ +
+ +   + +
+ + + + + diff --git a/plugins/personal/scalix/main.inc b/plugins/personal/scalix/main.inc new file mode 100644 index 000000000..f7c6aa6db --- /dev/null +++ b/plugins/personal/scalix/main.inc @@ -0,0 +1,133 @@ +dn); + sess_del ('edit'); + sess_del ('scalixAccount'); + } + + /* Create mail object on demand */ + if (!isset($_SESSION['scalixAccount']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){ + $_SESSION['scalixAccount']= new scalixAccount ($config, $ui->dn); + } + $scalixAccount= $_SESSION['scalixAccount']; + + /* save changes back to object */ + if (isset ($_SESSION['edit'])){ + $scalixAccount->save_object (); + } + + /* Enter edit mode? */ + if (isset($_POST['edit'])){ + + /* Check locking */ + if (($username= get_lock($ui->dn)) != ""){ + $_SESSION['back_plugin']= $plug; + gen_locked_message ($username, $ui->dn); + exit (); + } + + /* Lock the current entry */ + add_lock ($ui->dn, $ui->dn); + $_SESSION['dn']= $ui->dn; + $_SESSION['edit']= TRUE; + } + + /* Adjust acl's to mode */ + if (isset($_SESSION['edit'])){ + $acl= get_permissions ($ui->dn, $ui->subtreeACL); + $scalixAccount->acl= get_module_permission($acl, "scalix", $ui->dn); + } else { + $acl= get_permissions ($ui->dn, $ui->subtreeACL); + $editacl= get_module_permission($acl, "scalix", $ui->dn); + $scalixAccount->acl= "#none#"; + } + + /* save changes to LDAP and disable edit mode */ + if (isset($_POST['edit_finish'])){ + + /* Perform checks */ + $message= $scalixAccount->check (); + + /* No errors, save object */ + if (count ($message) == 0){ + $scalixAccount->save (); + gosa_log ("User/scalix object'".$ui->dn."' has been saved"); + $scalixAccount->acl= "#none#"; + del_lock ($ui->dn); + sess_del ('edit'); + + /* Store object */ + $_SESSION['scalixAccount']= $scalixAccount; + } else { + /* Errors found, show message */ + show_errors ($message); + } + } + + /* Execute formular */ + $display= $scalixAccount->execute (); + + /* Store changes in session */ + if (isset ($_SESSION['edit'])){ + $_SESSION['scalixAccount']= $scalixAccount; + } + + /* Show page footer depending on the mode */ + if ($scalixAccount->is_account){ + + $display.= "

"; + + /* Are we in edit mode? */ + if (isset($_SESSION['edit'])){ + $display.= "\n"; + $display.= " "; + $display.= "\n"; + $info= "\"\" ".$ui->dn." "; + } else { + $info= "\"\" ".$ui->dn." "; + if (isset($editacl) && $editacl != "#none#"){ + $info.= "\"\" ". + _("Click the 'Edit' button below to change informations in this dialog"); + + $display.= "\n"; + } + $display.= "\n"; + } + $display.= "

\n"; + } + + + $info= ""; + + /* Page header*/ + $display= print_header(get_template_path('images/scalix.png'), _("User scalixsettings"), $info).$display; + +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> -- 2.30.2