Code

Added copy & paste for generic
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 21 Mar 2006 07:56:24 +0000 (07:56 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 21 Mar 2006 07:56:24 +0000 (07:56 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2873 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/personal/generic/class_user.inc
plugins/personal/generic/generic_picture.tpl

index 1d3e4d4d150153fcc19853a56dd3de96c492ee55..cd0a3a9778cfb88312507042d461048428932a2d 100644 (file)
@@ -201,7 +201,7 @@ class user extends plugin
     /* Put gender attribute to upper case */
     if (isset ($this->attrs['gender'])){
       $this->gender= strtoupper($this->attrs['gender'][0]);
-    }  
+    }
   }
 
 
@@ -1224,10 +1224,95 @@ class user extends plugin
   } 
 
 
+  function getCopyDialog()
+  {
+    $str = "";
 
+    $_SESSION['binary'] = $this->photoData; 
+    $_SESSION['binarytype']= "image/jpeg";
+
+    /* Get random number for pictures */
+    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);
+  }
+
+  function saveCopyDialog()
+  {
 
+    if((isset($_FILES['picture_file']['tmp_name'])) && ($_FILES['picture_file']['size'] > 0)){
+      $this->set_picture($_FILES['picture_file']['tmp_name']);
+      echo "changed";
+    }
 
+    /* Remove picture? */
+    if (isset($_POST['picture_remove'])){
+      $this->jpegPhoto= "*removed*";
+      $this->set_picture ("./images/default.jpg");
+      $this->is_modified= TRUE;
+    }
 
+    $attrs = array("uid","givenName","sn");
+    foreach($attrs as $attr){
+      if(isset($_POST[$attr])){
+        $this->$attr = $_POST[$attr];
+      }
+    } 
+  }
 }
 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
index 008ed40f26236d5299451a9a74f2a0d449a297fd..2fe6069e4cdd918be7f5f0d0125df792747b7ac8 100644 (file)
@@ -1,17 +1,13 @@
 <table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4 border=0>
-
  <!-- Headline container -->
  <tr>
    <td colspan=2>
      <h2><img alt="" class="center" align="middle" src="images/head.png"> {t}Personal picture{/t}</h2>
    </td>
  </tr>
-
  <!-- Base container -->
  <tr>
-
-   <!-- Image container -->
-        <!-- Image container -->
+ <!-- Image container -->
   <td>
    <table>
     <tr>