Code

Ported 2.5 fixes to trunk. (Part 1/x)
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 14 Nov 2006 04:35:36 +0000 (04:35 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 14 Nov 2006 04:35:36 +0000 (04:35 +0000)
Prepared several user addons for Copy & Paste
Fixed Setup problems, ne loop and missing error msgs anymore.
Added GraphiMagick fix

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

15 files changed:
html/setup.php
ihtml/themes/default/setup.tpl
ihtml/themes/default/setup_introduction.tpl
ihtml/themes/default/setup_step2.tpl
include/class_CopyPasteHandler.inc
include/class_plugin.inc
include/functions_setup.inc
plugins/admin/users/class_userManagement.inc
plugins/personal/generic/class_user.inc
plugins/personal/mail/class_mailAccount.inc
plugins/personal/mail/mail_locals.tpl
plugins/personal/netatalk/class_netatalk.inc
plugins/personal/posix/class_posixAccount.inc
plugins/personal/posix/paste_generic.tpl
plugins/personal/samba/class_sambaAccount.inc

index aec16d04da27f6ba50e3d8a87fd1b024d4e73e7d..3320ffd20fb4117e9a71921bedaddcf136c94bd6 100644 (file)
 session_start();
 $_SESSION['DEBUGLEVEL']= 1;
 
-
 if (!isset($_GET['js']) && !isset($_SESSION['js'])){
   echo '<script language="JavaScript" type="text/javascript">';
   echo '  location = "setup.php?js=true";';
   echo '</script>';
 
   $_SESSION['js']= FALSE;
-} else {
+} elseif(isset($_GET['js'])) {
   $_SESSION['js']= TRUE;
 }
 
@@ -56,6 +55,10 @@ if (!file_exists(CONFIG_TEMPLATE_DIR."/gosa.conf")){
 
 // No Errors occured yet
 $_SESSION['errors']= "";
+$_SESSION['errors']             = "";
+$_SESSION['errorsAlreadyPosted']= array();
+$_SESSION['LastError']          = "";
+
 
 // Print out gosa.conf 
 //if(isset($_SESSION['classes'])) print "\$_SESSION['classes']=ok";
@@ -133,13 +136,13 @@ if($next < 1){
 //  and we call this func again, to output the error
 
 // I hope this will work fine ^^
-if((!show_setup_page1(false))||($next == 1)) {
+if((show_setup_page1(false))||($next == 1)) {
   show_setup_page1();  
-} elseif((!show_setup_page2(false))||($next==2)) {
+} elseif((show_setup_page2(false))||($next==2)) {
   show_setup_page2();
-} elseif((!show_setup_page3(false))||($next==3)) {
+} elseif((show_setup_page3(false))||($next==3)) {
   show_setup_page3();
-} elseif((!show_setup_page4(false))||($next==4)) {
+} elseif((show_setup_page4(false))||($next==4)) {
   show_setup_page4();
 }
 // This is called to test if we have an administrative Group with a User in it
@@ -153,5 +156,3 @@ else {
 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>
-</body>
-</html>
index 09b0894087842b1282015d08788b7a6bc14e3d99..df4d2be7c969085127ed84a98693f5b086c3fd6a 100644 (file)
   </tr>
   <tr style='height:100%;'>
     <td style="background-color: white;vertical-align:top;" colspan=2>
+
     {include file="$content"}
+
     </td>
   </tr>
-<table summary="">
+</table>
 
 <script language="JavaScript" type="text/javascript">
   <!--
     h=parseInt(window.innerHeight)-20;
-    document.write('</div>');
+    document.write('<\/div>');
   //-->
 </script>
 
index abdf49860c2f124ace51b5f2747bc68f706fea74..451855b523207da276b76e8eb7cc659a5ed05027 100644 (file)
@@ -9,7 +9,7 @@
 </div>
 <p class="plugbottom">
  <input type="hidden" name="next" value="2">
- <input type='submit' name='continue' value='{t}Continue{/t}'>
+ <input type='submit' name='continue' value='{t}Continue{/t}' {$mode}>
 </p>
 
 <p class="seperator">&nbsp;</p>
index 6d23e42efe2e85688544fbe3c855977f4ac7adbc..763b3f1f5278a384ebd3e0b0eebcc507ba163bd7 100644 (file)
@@ -10,5 +10,5 @@
 <p class="plugbottom">
  <input type="hidden" name="next" value="3">
  <input type='submit' name='back' value='{t}Back{/t}'>
- <input type='submit' name='continue2' value='{t}Continue{/t}'>
+ <input type='submit' name='continue2' value='{t}Continue{/t}' {$mode}>
 </p>
index 5336f57c7bde328bb71732b783851d99db38b0a7..78cfb746bd115f9cad1961e131ac60ffe6bc6fdd 100644 (file)
@@ -139,6 +139,7 @@ class CopyPasteHandler {
           }
         }else{
           $this->current->save();
+          $this->lastdn = $this->current->dn;
           $this->dialogOpen =false;
           $this->Clear();
         }
index 9f92c624b90d15f7ada4db1823710116c196d1c1..72793b3c75ef87e45c321b900f6129c13d6e94d5 100644 (file)
@@ -915,7 +915,9 @@ class plugin
     }
     $todo[] = "is_account";
     foreach($todo as $var){
-      $this->$var = $source->$var;
+      if (isset($source->$var)){
+        $this->$var= $source->$var;
+      }
     }
   }
 
index cabcbbdb1c9128883b402e4fe900c3d2757a03c0..7d5582b06223aa3e1516d731c283fc1582978496 100644 (file)
@@ -338,6 +338,7 @@ function get_link($function_name) {
   $result= "<a href='http://de.php.net/manual/en/function.";
 
   /* Replace all underscores with hyphens (phpdoc convention) */
+  /* hjb: added alternative check for GraphicsMagick >= 1.1.2 */
   $function_name= str_replace("_", "-", $function_name);
 
   /* Append to base URL */
@@ -387,11 +388,18 @@ function perform_additional_checks(&$faults)
   $output= shell_exec ($query);
   if ($output != ""){
     $lines= split ("\n", $output);
-    $version= preg_replace ("/^Version:.+Magick ([^\s]+).*/", "\\1", $lines[0]);
-    list($major, $minor)= split("\.", $version);
-    $msg.= check (     $faults, _("Checking for ImageMagick (>=5.4.0)"),
-        _("ImageMagick is used to convert user supplied images to fit the suggested size and the unified JPEG format."),
-        ($major > 5 || ($major == 5 && $minor >= 4)));
+    $version= preg_replace ("/^Version: (.+Magick) ([^\s]+).*/", "\\1 \\2", $lines[0]);
+    list($prog, $version) = split(" ", $version);
+    list($major, $minor,$minor2)= split("\.", $version);
+    if (preg_match('/GraphicsMagick/', $prog)) {
+      $msg.= check (   $faults, _("Checking for GraphicsMagick (>=1.1.2)"),
+          _("GraphicsMagick is used to convert user supplied images to fit the suggested size and the unified JPEG format."),
+          ($major > 1 || ($major == 1 && $minor >= 1) || ($major == 1 && $minor == 1 && $minor2 >= 2) ) );
+    } else {
+      $msg.= check (   $faults, _("Checking for ImageMagick (>=5.4.0)"),
+          _("ImageMagick is used to convert user supplied images to fit the suggested size and the unified JPEG format."),
+          ($major > 5 || ($major == 5 && $minor >= 4)));
+        }
   } else {
     $msg.= check (     $faults, _("Checking imagick module for PHP"),
         _("Imagick is used to convert user supplied images to fit the suggested size and the unified JPEG format from PHP script."), function_exists('imagick_blob2image'), TRUE);
@@ -622,11 +630,14 @@ function parse_contrib_conf()
 /* Show setup_page 1 */
 function show_setup_page1($withoutput = true)
 {
-  $faults = array();
+  $faults   = false;
+  $faults2  = false;
   $smarty = get_smarty();  
   $smarty->assign ("content", get_template_path('setup_introduction.tpl'));
   $smarty->assign ("tests", perform_php_checks($faults));
-  $smarty->assign ("detailed_tests", perform_additional_function_checks($faults));
+  $smarty->assign ("detailed_tests", perform_additional_function_checks($faults2));
+
+  $faults = $faults || $faults2;
 
   /* This var is true if anything went wrong */
   if ($faults){
@@ -646,14 +657,14 @@ function show_setup_page1($withoutput = true)
     $smarty->display (get_template_path('setup.tpl'));
   }
 
-  return (!$faults);
+  return ($faults);
 }
 
 
 /* Show setup_page 2 */
 function show_setup_page2($withoutput = true)
 {
-  $faults = array();
+  $faults = false;
   $smarty = get_smarty();
   $smarty->assign ("content", get_template_path('setup_step2.tpl'));
   $smarty->assign ("tests", perform_additional_checks($faults));
@@ -671,7 +682,7 @@ function show_setup_page2($withoutput = true)
     $smarty->display (get_template_path('setup.tpl'));
   }
 
-  return (!$faults);                               
+  return ($faults);                               
 }
 
 
@@ -701,18 +712,7 @@ function show_setup_page3($withoutput = true)
   /* No error till now */
   $fault = false;
 
-  /* If we pushed the Button continue */
-  if(isset($_POST['continue3'])){
-    if(!isset($uri)) {
-      $fault = true;
-
-      /* Output the Error */
-      if($withoutput) {
-        print_red (_("You've to specify an ldap server before continuing!"));
-        $smarty->assign ("content", get_template_path('setup_step3.tpl'));
-      }
-    }
-  } elseif (!$ds = @ldap_connect (validate($uri))) {
+  if (!$ds = @ldap_connect (validate($uri))) {
     $fault =true;
 
     /* Output the Error */
@@ -757,7 +757,7 @@ function show_setup_page3($withoutput = true)
     $smarty->display (get_template_path('setup.tpl'));
   }
 
-  return (!$fault);                             
+  return ($fault);                             
 }
 
 
@@ -765,6 +765,34 @@ function show_setup_page4($withoutput = true)
 {
   $smarty= get_smarty();      
 
+  /* check POST data */
+  if(isset($_POST['check'])) {
+
+    /* Check if all needed vars are submitted */
+    foreach($checkvars as $key) {
+      if($key == "peopleou"){
+        continue;
+      }
+      if($key == "groupou"){
+        continue;
+      }
+
+      if((isset($_POST[$key]))&&($_POST[$key]!="")) {
+        $_SESSION['ldapconf'][$key] = $_POST[$key];
+      } else {
+        if($withoutput) {
+          print_red(sprintf(_("You're missing the required attribute '%s' from this formular. Please complete!"), $key));
+        }
+        $fault = true;
+      }
+    }
+  }
+
+  /* Transfer base */
+  if(isset($_POST['base'])){
+    $_SESSION['ldapconf']['base']= $_POST['base'];
+  }
+
        // ?
   if(!isset($_SESSION['ldapconf']['base'])){
     $_SESSION['ldapconf']['base']= $base;
@@ -797,7 +825,7 @@ function show_setup_page4($withoutput = true)
 
   /* If there are some empty vars in ldapconnect -
      these values also represent out default values */
-  if(!$ds = @ldap_connect (validate($uri))){
+  if(!$ds =  @ldap_connect (validate($uri))){
     $fault = true;
     if($withoutput){
       print_red (_("Can't connect to the specified LDAP server! Please make sure that is reachable for GOsa."));
@@ -805,22 +833,21 @@ function show_setup_page4($withoutput = true)
   } elseif(!@ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3)){
     $fault = true;
     if($withoutput){
-      print_red (_("Can't bind to the specified LDAP server! Please make sure that it is reachable for GOsa."));
+      print_red (_("Can't set ldap protocol version 3."));
     }
   } elseif(!$r= @ldap_bind ($ds)){
     $fault = true;
     if($withoutput){
-      print_red (_("Can't bind to the specified LDAP server! Please make sure that it is reachable for GOsa."));
+      print_red (_("Could not bind to the specified LDAP server! Please make sure that it is reachable for GOsa."));
     }
   } else {
-    $sr=   @ldap_search ($ds, NULL, "objectClass=*", array("namingContexts"));
+    $sr=   @ldap_search ($r, NULL, "objectClass=*", array("namingContexts"));
     $attr= @ldap_get_entries($ds,$sr);
 
     if((empty($attr))) {
-      $base= "dc=example,dc=net";
 
       if($withoutput){
-        print_red(_("Bind to server successful, but the server seems to be completly empty, please check all information twice"));
+#        print_red(_("Bind to server successful, but the server seems to be completly empty, please check all information twice"));
       }
 
     } else {
@@ -860,34 +887,6 @@ function show_setup_page4($withoutput = true)
     $_SESSION['ldapconf']['arr_crypts']   = $tmp['md5'];
   }
 
-  /* check POST data */
-  if(isset($_POST['check'])) {
-
-    /* Check if all needed vars are submitted */
-    foreach($checkvars as $key) {
-      if($key == "peopleou"){
-        continue;
-      }
-      if($key == "groupou"){
-        continue;
-      }
-
-      if((isset($_POST[$key]))&&($_POST[$key]!="")) {
-        $_SESSION['ldapconf'][$key] = $_POST[$key];
-      } else {
-        if($withoutput) {
-          print_red(sprintf(_("You're missing the required attribute '%s' from this formular. Please complete!"), $key));
-        }
-        $fault = true;
-      }
-    }
-  }
-
-  /* Transfer base */
-  if(isset($_POST['base'])){
-    $_SESSION['ldapconf']['base']= $_POST['base'];
-  }
-
   $smarty->assign("arr_cryptkeys",$_SESSION['ldapconf']['arr_cryptkeys']);
   $smarty->assign("mail_methods", $_SESSION['ldapconf']['mail_methods']);
 
@@ -895,7 +894,7 @@ function show_setup_page4($withoutput = true)
     $smarty->assign($key,$val);
   }
 
-  if(isset($_POST['check'])) {
+  if(isset($_POST['check']) || (isset($_POST['admin'])) && isset($_POST['password'])) {
     $ldap= new LDAP($_SESSION['ldapconf']['admin'],
         $_SESSION['ldapconf']['password'],
         $_SESSION['ldapconf']['uri']);
@@ -934,7 +933,8 @@ function show_setup_page4($withoutput = true)
   if($withoutput){
     $smarty->display (get_template_path('setup.tpl'));
   }
-  return (!$fault);
+
+  return ($fault);
 }
 
 
index daa147d92741f7c44fdfe6d3a5892a645123d653..cd3d5a39246042ecb4fe756431cf6c0270382294 100644 (file)
@@ -51,8 +51,6 @@ class userManagement extends plugin
     /* Creat dialog object */
     $this->DivListUsers = new divListUsers($this->config,$this);
 
-    /* LOCK MESSAGE Vars */
-    $_SESSION['LOCK_VARS_TO_USE'] = array("/^act$/","/^id$/","/^user_edit_/","/^user_del_/");
   }
 
 
@@ -61,6 +59,9 @@ class userManagement extends plugin
     /* Call parent execute */
     plugin::execute();
 
+    /* LOCK MESSAGE Vars */
+    $_SESSION['LOCK_VARS_TO_USE'] = array("/^act$/","/^id$/","/^user_edit_/","/^user_del_/");
+
     $smarty       = get_smarty();                 // Smarty instance
     $s_action     = "";                           // Contains the action to be taken
     $s_entry      = "";                           // The value for s_action
@@ -201,7 +202,7 @@ class userManagement extends plugin
     if (isset($_POST['password_finish'])){
 
       /* For security reasons, check if user is allowed to set password again */
-      $dn  = $this->usertab->dn;
+      $dn  = $this->dn;
       $acl = $this->ui->get_permissions($dn, "users/password");
       $cacl= $this->ui->get_permissions($dn, "users/user");
 
@@ -798,6 +799,9 @@ class userManagement extends plugin
 
         /* Use the last dn to search for it's ID in the newly generated list. */
         $dn= $this->CopyPasteHandler->lastdn;
+
+        /* Get new user list */
+        $this->reload();
         foreach($this->list as $id => $entry){
           if($entry['dn'] == $dn){
             $s_entry= $id;
index 53b986073c2f732e93431ab48dcd7a298a4f7d34..a407f793625956b1bbdda4078860c89dff65debf 100644 (file)
@@ -463,8 +463,27 @@ class user extends plugin
           /* Read out data*/
           $timeto   = $certificate->getvalidto_date();
           $timefrom = $certificate->getvalidfrom_date();
-          $str = "<table summary=\"\" border=0><tr><td style='vertical-align:top'>CN</td><td>".preg_replace("/ /", "&nbsp;", $certificate->getname())."</td></tr></table><br>".
-                  sprintf(_("Certificate is valid from %s to %s and is currently %s."), "<b>".date('d M Y',$timefrom)."</b>","<b>".date('d M Y',$timeto)."</b>", $certificate->isvalid()?"<b><font style='color:green'>"._("valid")."</font></b>":"<b><font style='color:red'>"._("invalid")."</font></b>");
+         
+          
+          /* Additional info if start end time is '0' */
+          $add_str_info = "";
+          if($timeto == 0 && $timefrom == 0){
+            $add_str_info = "<br><i>"._("(Some types of certificates are currently not supported and may be displayed as 'invalid'.)")."</i>";
+          }
+
+          $str = "<table summary=\"\" border=0>
+                    <tr>
+                      <td style='vertical-align:top'>CN</td>
+                      <td>".preg_replace("/ /", "&nbsp;", $certificate->getname())."</td>
+                    </tr>
+                  </table><br>".
+
+                  sprintf(_("Certificate is valid from %s to %s and is currently %s."),
+                        "<b>".date('d M Y',$timefrom)."</b>",
+                        "<b>".date('d M Y',$timeto)."</b>",
+                        $certificate->isvalid()?"<b><font style='color:green'>"._("valid")."</font></b>":
+                                                "<b><font style='color:red'>"._("invalid")."</font></b>").$add_str_info;
+
           $smarty->assign($cert."info",$str);
           $smarty->assign($cert."_state","true");
         } else {
@@ -1272,6 +1291,23 @@ class user extends plugin
   }
 
 
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);
+
+    /* Reset certificate information addepted from source user
+       to avoid setting the same user certificate for the destination user. */
+    $this->userPKCS12= "";
+    $this->userSMIMECertificate= "";
+    $this->userCertificate= "";
+    $this->certificateSerialNumber= "";
+    $this->old_certificateSerialNumber= "";
+    $this->old_userPKCS12= "";
+    $this->old_userSMIMECertificate= "";
+    $this->old_userCertificate= "";
+  }
+
+
   function plInfo()
   {
   
index 3ec98eea56712c508990a30b94c541e4b7b118eb..327f9069006c59e5ce1747e3f3aa8d673206a5f3 100644 (file)
@@ -990,6 +990,15 @@ class mailAccount extends plugin
     }
   }
 
+   
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);
+
+    /* Reset alternate mail addresses */
+    $this->gosaMailAlternateAddress = array();    
+   }
+
 
   function plInfo()
   {
index 3af89089dc533a470a0fc034fb5539fb4d2540c4..d277ceb458c8ce830eb7079343ecd20c4d79a8af 100644 (file)
@@ -1,40 +1,74 @@
 <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><LABEL for="local_list">{t}Select addresses to add{/t}</LABEL> {$hint}</b><br>
-    </p>
-   </div>
-   <div class="contentboxb">
-    <p class="contentboxb" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-     <select id="local_list" style="width:600px; margin-top:4px; height:450px;" name="local_list[]" size="15" multiple>
-               {html_options options=$mailusers}
-     </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><LABEL for="depselect"><img alt="" src="{$tree_image}" align=middle>&nbsp;
-    <select id="depselect" 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 style="width:18px"><img alt="" src="{$search_image}" align=middle></td><td>
-    <input type='text' name='regex' maxlength='20' style="width:99%" value='{$regex}' title='{t}Regular expression for matching addresses{/t}' onChange="mainform.submit()"></td></tr></table>
-    <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8"><tr><td width="18px"><img src="{$usearch_image}" align=middle alt={t}Display addresses of user{/t}""></td>
-    <td><input type='text' name='muser' maxlength='20' style="width:99%" value='{$muser}' title='{t}User name of which addresses are shown{/t}' onChange="mainform.submit()"></td></tr></table>
-   {$apply}
-   </div>
-  </td>
-</tr>
+  <tr>
+    <td style="vertical-align:top;width:600px">
+      <div class="contentboxh" style="height:20px;">
+        <p class="contentboxh" style="font-size:12px">
+          <b>
+            <LABEL for="local_list">{t}Select addresses to add{/t}</LABEL> 
+            {$hint}
+          </b>
+          <br>
+        </p>
+      </div>
+      <div class="contentboxb">
+        <p class="contentboxb" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+          <select id="local_list" style="width:600px; margin-top:4px; height:450px;" name="local_list[]" size="15" multiple>
+                 {html_options options=$mailusers}
+          </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>
+              <LABEL for="depselect">{t}Select department{/t}</LABEL>
+              <img alt="" src="{$tree_image}" align=middle>&nbsp;
+              <select id="depselect" 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 style="width:18px">
+              <img alt="" src="{$search_image}" align="middle">
+            </td>
+            <td>
+              <input type='text' name='regex' maxlength='20' style="width:99%" value='{$regex}' 
+                title='{t}Regular expression for matching addresses{/t}' onChange="mainform.submit()">
+            </td>
+          </tr>
+        </table>
+
+        <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+          <tr>
+            <td style="width:18px;">
+              <img src="{$usearch_image}" align=middle alt="{t}Display addresses of user{/t}">
+            </td>
+            <td>
+              <input type='text' name='muser' maxlength='20' style="width:99%" value='{$muser}' 
+                title='{t}User name of which addresses are shown{/t}' onChange="mainform.submit()">
+            </td>
+          </tr>
+        </table>
+        {$apply}
+      </div>
+    </td>
+  </tr>
 </table>
 
 <p class="plugbottom">
@@ -42,3 +76,6 @@
   &nbsp;
   <input type=submit name="add_locals_cancel" value="{t}Cancel{/t}">
 </p>
+<!-- 
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+-->
index 9478ccb42029f33c617a03e01df2e884dc633195..f17f5b36b1b9e3df943c7bd3a51e1379ce1bf50d 100644 (file)
@@ -55,6 +55,10 @@ class netatalk extends plugin {
   var $shares_loaded= false;
   
   /* Attributes to save to LDAP */
+  var $attributes = array ("apple-user-homeurl", "apple-user-homeDirectory");
+  var $CopyPasteVars= array("apple_user_homeurl", "apple_user_homeDirectory","apple_user_share","shares_settings","apple_user_homepath_raw",
+                             "apple_user_homeurl_raw","apple_user_homeurl_xml","apple_user_homeurl","selectedshare","mountDirectory");
+
   /* Slip setting those attributes, we can't define class variables with - */
   var $use_save_attributes = array ("apple-user-homeurl", "apple-user-homeDirectory");
 
@@ -71,6 +75,40 @@ class netatalk extends plugin {
   var $is_chk_box = array ();
   
   var $uid = "";
+
+  /* The constructor just saves a copy of the config. You may add what ever you need. */
+  function netatalk($config, $dn = NULL,$parent = NULL) {
+
+    /* Include config object */
+    $this->config = $config;
+    plugin :: plugin($config, $dn,$parent);
+
+    /* Setting uid to default */
+    if(isset($this->attrs['uid'][0])){
+      $this->uid = $this->attrs['uid'][0];
+    }
+
+    /* Copy needed attributes */
+    foreach($this->attributes as $val) {
+      if (isset($this->attrs["$val"][0])) {
+        $name = str_replace('-', '_', $val);
+        $this->$name = $this->attrs["$val"][0];
+      }
+    }
+      
+    if (strlen($this->apple_user_homeDirectory) >0) {
+      $this->apple_user_homepath_raw = substr($this->apple_user_homeDirectory, strrpos($this->apple_user_homeDirectory, '/') + 1 );
+    }
+
+    /* get share list an set default values */
+    $this->get_netatalk_shares();
+    $this->apple_user_share = $this->selectedshare;
+    /* Save initial account state */
+    $this->initially_was_account = $this->is_account;
+  }
+
+
   function get_shares()
   {
     $this->shares_loaded= TRUE;
@@ -111,33 +149,7 @@ class netatalk extends plugin {
     asort($this->shares);
   }
 
-  /* The constructor just saves a copy of the config. You may add what ever you need. */
-  function netatalk($config, $dn = NULL) {
 
-    /* Include config object */
-    $this->config = $config;
-    plugin :: plugin($config, $dn);
-
-    /* Setting uid to default */
-    if(isset($this->attrs['uid'][0])){
-      $this->uid = $this->attrs['uid'][0];
-    }
-
-    /* Copy needed attributes */
-    foreach($this->use_save_attributes as $val) {
-      if (isset($this->attrs["$val"][0])) {
-        $name = str_replace('-', '_', $val);
-        $this->$name = $this->attrs["$val"][0];
-      }
-    }
-      
-    if (strlen($this->apple_user_homeDirectory) >0) {
-      $this->apple_user_homepath_raw = substr($this->apple_user_homeDirectory, strrpos($this->apple_user_homeDirectory, '/') + 1 );
-    }
-    /* Save initial account state */
-    $this->initially_was_account = $this->is_account;
-  }
 
   /* Execute the plugin, produce the output. */
   function execute() {
@@ -210,7 +222,7 @@ class netatalk extends plugin {
   /* Check if we have correct data */
   function check() {
     $message = array ();
-
+  
     if (strlen($this->apple_user_share) == 0) {
       $message[] = _("You must select a share to use.");
     }
@@ -247,8 +259,13 @@ class netatalk extends plugin {
 
     $ldap = $this->config->get_ldap_link();
 
-    /* Call parents save to prepare $this->attrs */
+    /* Reset array of used attributes, because plugin::save() 
+        will not work with '-' in attributes names 
+        after calling save restore attributes array */
+    $attributes = $this->attributes;
+    $this->attributes = array();
     plugin :: save();
+    $this->attributes = $attributes;
 
     /* Do attribute conversion */
     foreach ($this->use_save_attributes as $val) {
index 552f59a36958e94ad2e8574f72cbd94deb6dc9fb..bbbcee0f3b5a9d0ffd460a6ae59813f38f19888b 100644 (file)
@@ -67,9 +67,10 @@ class posixAccount extends plugin
   var $SubSearch        = false;
 
   /* attribute list for save action */
-  var $CopyPasteVars  = array("grouplist","groupMembership","use_shadowMin","use_shadowMax",
-      "use_shadowWarning","use_shadowInactive","use_shadowExpire","mustchangepassword",
-      "force_ids","printerList","grouplist","savedGidNumber","savedUidNumber","savedGroupMembership");
+  var $CopyPasteVars  = 
+      array("grouplist","groupMembership","use_shadowMin",
+      "use_shadowMax","use_shadowWarning","use_shadowInactive","use_shadowExpire",
+      "must_change_password","printerList","grouplist","savedGidNumber","savedUidNumber");
 
   var $attributes     = array("homeDirectory", "loginShell", "uidNumber", "gidNumber", "gecos",
       "shadowMin", "shadowMax", "shadowWarning", "shadowInactive", "shadowLastChange",
@@ -472,8 +473,15 @@ class posixAccount extends plugin
     }
 
     /* Fill calendar */
-    $date= getdate($this->shadowExpire);
-
+    /* If this $this->shadowExpire is empty 
+        use current date as base for calculating selectbox values.
+       (This attribute is empty if this is a new user )*/ 
+    if(empty($this->shadowExpire)){
+      $date= getdate(time());
+    }else{
+      $date= getdate($this->shadowExpire);
+    }
     $days= array();
     for($d= 1; $d<32; $d++){
       $days[$d]= $d;
@@ -853,9 +861,9 @@ class posixAccount extends plugin
     /* Remove lock needed for unique id generation */
     del_lock ("uidnumber");
 
-
-    /* Posix accounts have group interrelationship, take care about these here. */
-    if ($this->force_ids == 0 && $this->primaryGroup == 0){
+    /* Posix accounts have group interrelationship, 
+       take care about these here if this is a new user without forced gidNumber. */
+    if ($this->force_ids == 0 && $this->primaryGroup == 0 && !$this->initially_was_account){
       $ldap->cd($this->config->current['BASE']);
       $ldap->search("(&(objectClass=posixGroup)(gidNumber=".$this->gidNumber."))", array("cn"));
 
@@ -1199,6 +1207,26 @@ class posixAccount extends plugin
   }
 
 
+  /* Get posts from copy & paste dialog */ 
+  function saveCopyDialog()
+  {
+    if(isset($_POST['homeDirectory'])){
+      $this->homeDirectory = $_POST['homeDirectory'];
+      if (isset ($_POST['force_ids'])){
+        $data= 1;
+        $this->gidNumber = $_POST['gidNumber'];
+        $this->uidNumber = $_POST['uidNumber'];
+      } else {
+        $data= 0;
+      }
+      if ($this->force_ids != $data){
+        $this->is_modified= TRUE;
+      }
+      $this->force_ids= $data;
+    }
+  }
+
   /* Create the posix dialog part for copy & paste */
   function getCopyDialog()
   {
@@ -1273,6 +1301,16 @@ class posixAccount extends plugin
   }
 
 
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);
+
+    /* Avoid using the same gid/uid number as source user */
+    $this->savedUidNumber = $this->get_next_id("gidNumber");
+    $this->savedGidNumber = $this->get_next_id("uidNumber");
+  }
+
+
   function plInfo()
   {
     return (array(
index fbb298152578cc707c0b5319754f7efa2673de33..baf71141a45e8a1fc41cc28446e2c537bc196257 100644 (file)
@@ -12,7 +12,7 @@
                                        </td>
                                </tr>
                        </table>
-                       <table>
+                       <table style='width:100%;'>
                                <tr>
                                        <td>
                                                <input id="force_ids" type=checkbox name="force_ids" value="1"  {$force_ids}
index 017e4d7588f7ccf4d0ddc6968ac10b1e082ef578..98357370a1e5b8a5294e8fc579357e35b0c79e5b 100644 (file)
@@ -551,12 +551,20 @@ class sambaAccount extends plugin
         $smarty->assign("flagsN", "");
     }
 
-    /* 'normal' Checkboxes */
-    if ($this->pwdCanChange=="1"){
-      $smarty->assign("flagsP", "checked");
-    } else {
-      $smarty->assign("flagsP", "");
+    if($this->samba3){
+      if ($this->sambaPwdCanChange=="1"){
+        $smarty->assign("flagsP", "checked");
+      } else {
+        $smarty->assign("flagsP", "");
+      }
+    }else{
+      if ($this->pwdCanChange=="1"){
+        $smarty->assign("flagsP", "checked");
+      } else {
+        $smarty->assign("flagsP", "");
+      }
     }
+
     if ($this->password_expires=="1"){
       $smarty->assign("flagsC", "checked");
     } else {