Code

Added default index to edoit_finish
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 15 Sep 2005 06:31:41 +0000 (06:31 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 15 Sep 2005 06:31:41 +0000 (06:31 +0000)
Fixed date of birth to allow a value below 1971

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

plugins/personal/generic/class_user.inc
plugins/personal/generic/main.inc

index 254b506010514e744515471695ff96501b977e6c..9f216a9575fa82dec047d274cdf18a5de813796d 100644 (file)
@@ -185,7 +185,8 @@ class user extends plugin
     if (isset ($this->attrs['dateOfBirth'])){
       /* This entry is ISO 8601 conform */
       list($year, $month, $day)= split("-", $this->attrs['dateOfBirth'][0], 3);
-      $this->dob= mktime ( 0, 0, 0, $month, $day, $year);
+    
+      $this->dob=array( 'mon'=> $month,"mday"=> $day,"year"=> $year);
       $this->use_dob= "1";
     } else {
       $this->use_dob= "0";
@@ -207,7 +208,11 @@ class user extends plugin
     if ($this->dob == "0"){
       $date= getdate();
     } else {
-      $date= getdate($this->dob);
+      if(is_array($this->dob)){
+        $date = $this->dob;
+      }else{
+        $date = getdate($this->dob);
+      } 
     }
 
     $days= array();
@@ -215,7 +220,16 @@ class user extends plugin
       $days[$d]= $d;
     }
     $years= array();
-    for($y= $date['year']-100; $y<=$date['year']+100; $y++){
+
+    if(($date['year']-100)<1901){
+      $start = 1901;
+    }else{
+      $start = $date['year']-100;
+    }
+
+    $end = $start +100;
+    
+    for($y= $start; $y<=$end; $y++){
       $years[]= $y;
     }
     $years['-']= "-&nbsp;";
index f3826f4d3ca59d89d8e51469e05297453573c272..037274a9ce35a194f03d346511085dae2b504379 100644 (file)
@@ -158,6 +158,13 @@ if (!$remove_lock){
       $display.= "<input type=submit name=\"edit_finish\" value=\""._("Finish")."\">\n";
       $display.= "&nbsp;";
       $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+      $display.="<script language='javascript'>
+      $display.="      <!-- Place cursor -->
+              <script language=\"JavaScript\" type=\"text/javascript\">
+                    document.mainform.edit_finish.select();
+                    document.mainform.edit_finish.focus();
+                                </script>";
+
       $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png').
              "\"> ".$ui->dn."&nbsp;";
     } else {