Code

Fixed baseSelectDialog parameters
[gosa.git] / plugins / personal / generic / class_user.inc
index cd0a3a9778cfb88312507042d461048428932a2d..ec56ed885bf14dc326de4d57bcc74ce677f5445f 100644 (file)
@@ -257,7 +257,9 @@ class user extends plugin
     $smarty->assign("gender_list", $sex);
 
     /* Assign prefered langage */
-    $language= array(0 => " ", "fr_FR" => ("fr_FR"), "en_EN" => ("en_EN"), "de_DE" => ("de_DE"), "it_IT" => ("it_IT"), "nl_NL" => ("nl_NL"));
+    $language= array(0 => " ", "fr_FR" => ("fr_FR"), "en_EN" => ("en_EN"), 
+                                    "de_DE" => ("de_DE"), "it_IT" => ("it_IT"), 
+                                    "nl_NL" => ("nl_NL"), "ru_RU" => ("ru_RU"));
     $smarty->assign("preferredLanguage_list", $language);
 
     /* Get random number for pictures */
@@ -276,7 +278,7 @@ class user extends plugin
     foreach($_POST as $name => $value){
       if(preg_match("/^chooseBase/",$name) && $once){
         $once = false;
-        $this->dialog = new baseSelectDialog($this->config,$this->allowedBasesToMoveTo());
+        $this->dialog = new baseSelectDialog($this->config,$this,$this->allowedBasesToMoveTo());
         $this->dialog->setCurrentBase($this->base);
       }
     }
@@ -479,7 +481,7 @@ class user extends plugin
       $this->pw_storage= $this->config->current['HASH'];
     }
 
-    $temp   = passwordMethod::get_available_methods();
+    $temp   = @passwordMethod::get_available_methods();
     $hashes = $temp['name'];
     
     $smarty->assign("pwmode", $hashes);
@@ -541,6 +543,7 @@ class user extends plugin
   {
     $ldap= $this->config->get_ldap_link();
     $ldap->rmdir ($this->dn);
+    show_ldap_error($ldap->get_error(), _("Removing generic user account failed"));
 
     /* Delete references to groups */
     $ldap->cd ($this->config->current['BASE']);
@@ -808,7 +811,7 @@ class user extends plugin
 
     /* Save data. Using 'modify' implies that the entry is already present, use 'add' for
        new entries. So do a check first... */
-    $ldap->cat ($this->dn);
+    $ldap->cat ($this->dn, array('dn'));
     if ($ldap->fetch()){
       $mode= "modify";
     } else {
@@ -829,7 +832,7 @@ class user extends plugin
     $this->cleanup();
     $ldap->cd ($this->dn);
     $ldap->$mode ($this->attrs);
-    if (show_ldap_error($ldap->get_error())){
+    if (show_ldap_error($ldap->get_error(), _("Saving generic user account failed"))){
       return (1);
     }
 
@@ -921,6 +924,9 @@ class user extends plugin
       $this->handle_post_events("modify");
     }
 
+    /* Fix tagging if needed */
+    $this->handle_object_tagging();
+
     return (0);
   }
 
@@ -928,7 +934,8 @@ class user extends plugin
   /* Check formular input */
   function check()
   {
-    $message= array();
+    /* Call common method to give check the hook */
+    $message= plugin::check();
 
     /* Assemble cn */
     $this->cn= $this->givenName." ".$this->sn;
@@ -1235,60 +1242,25 @@ class user extends plugin
     srand((double)microtime()*1000000); 
     $rand = rand(0, 10000);
 
-    $str = "
-    <table>
-      <tr>
-        <td style='vertical-align:top;'>
-          <h2>"._("User settings")."</h2>
-          <table> 
-            <tr>
-              <td><label for=\"sn\">"._("Last name")."</label></td>
-              <td><input id=\"sn\" name=\"sn\" size=25 maxlength=60  value=\"".$this->sn."\"></td>
-            </tr>
-            <tr>
-              <td><label for=\"givenName\">"._("First name")."</label></td>
-              <td><input id=\"givenName\" name=\"givenName\" size=25 maxlength=60 value=\"".$this->givenName."\"></td>
-            </tr>
-            <tr>
-              <td><label for=\"uid\">"._("Login")."</label></td>
-              <td><input id=\"uid\" name=\"uid\" size=25 maxlength=60 value=\"".$this->uid."\"></td>
-            </tr>
-            <tr>
-              <!-- Name, ... -->
-              <td style=\"vertical-align:top; width:100%;\">
-                <input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"2000000\">
-                 "._("User picture")."
-              </td>
-              <td>
-                <input id=\"picture_file\" name=\"picture_file\" type=\"file\" size=\"20\" maxlength=\"255\" accept=\"image/*.jpg\">
-                &nbsp;
-                <input type=submit name=\"picture_remove\" value=\""._("Remove picture")."\">
-              </td>
-            </tr>
-          </table>
-        </td>
-        <td style=\"vertical-align:top \">
-          <table summary=\"\" style=\"width:100%; vertical-align:top; text-align:left;\" cellpadding=4 border=0>
-            <tr>
-            <!-- Image container -->
-              <td>
-                <table>
-                  <tr>
-                    <td width=\"147\" height=\"200\" bgcolor=\"gray\">
-                      <img align=\"center\" valign=\"center\" border=\"0\" width=\"100%\" src=\"getbin.php?rand=".$rand."\" 
-                          alt=\""._("Personal picture")."\">
-                    </td>
-                  </tr>
-                </table>
-              </td>
-            </tr>
-          </table>
-        </td>
-      </tr>
-    </table>
-
-    ";
-    return($str);
+    $smarty = get_smarty();
+
+    $smarty->assign("passwordTodo","clear");
+
+    if(isset($_POST['passwordTodo'])){
+      $smarty->assign("passwordTodo",$_POST['passwordTodo']);
+    }
+
+    $smarty->assign("sn",       $this->sn);
+    $smarty->assign("givenName",$this->givenName);
+    $smarty->assign("uid",      $this->uid);
+    $smarty->assign("rand",     $rand);
+    $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE,dirname(__FILE__)));
+
+
+    $ret = array();
+    $ret['string'] = $str;
+    $ret['status'] = "";  
+    return($ret);
   }
 
   function saveCopyDialog()
@@ -1296,7 +1268,6 @@ class user extends plugin
 
     if((isset($_FILES['picture_file']['tmp_name'])) && ($_FILES['picture_file']['size'] > 0)){
       $this->set_picture($_FILES['picture_file']['tmp_name']);
-      echo "changed";
     }
 
     /* Remove picture? */