Code

* Integrated Jan's changes for binary downloads
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 12 Oct 2005 13:06:27 +0000 (13:06 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 12 Oct 2005 13:06:27 +0000 (13:06 +0000)
* Added cosmetic fix for quota display

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

TODO
html/getbin.php [new file with mode: 0644]
html/getldif.php
html/getpic.php [deleted file]
plugins/admin/applications/class_applicationGeneric.inc
plugins/admin/applications/generic.tpl
plugins/admin/groups/class_groupMail.inc
plugins/personal/generic/class_user.inc
plugins/personal/generic/generic.tpl
plugins/personal/generic/generic_picture.tpl
plugins/personal/mail/class_mailAccount.inc

diff --git a/TODO b/TODO
index 1a9a37bbbaf756a69698430950799b3ab83deb56..e61031a056bf76fd2114c75b29fc9d958205bea8 100644 (file)
--- a/TODO
+++ b/TODO
@@ -48,6 +48,14 @@ Things to fix before 2.4:
 
 * Workstation is defect
 
+* Save FAI sub objects directly when they already exist
+
+* FAI variables are not editable during creation
+
+* FAI package lists -> why do we ask for distribution if the list is already filled?
+
+* FAI package lists behave strange
+
 
 Target for 2.5:
 ===============
diff --git a/html/getbin.php b/html/getbin.php
new file mode 100644 (file)
index 0000000..3040535
--- /dev/null
@@ -0,0 +1,51 @@
+<?php
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2003  Cajus Pollmeier
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+/* Basic setup, remove eventually registered sessions */
+@require_once ("../include/php_setup.inc");
+@require_once ("functions.inc");
+error_reporting (0);
+session_start ();
+
+/* Logged in? Simple security check */
+if (!isset($_SESSION['ui'])){
+  gosa_log ("Error: getbin.php called without session");
+  header ("Location: ../index.php");
+  exit;
+}
+
+header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
+header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
+header("Cache-Control: no-cache");
+header("Pragma: no-cache");
+header("Cache-Control: post-check=0, pre-check=0");
+$bintype = isset($_SESSION['binarytype']) 
+  ? $_SESSION['binarytype'] : "octet-stream";
+header("Content-type: " . $bintype);
+if (isset($_SESSION['binaryfile'])) {
+  header( "Content-disposition: attachment; filename=" 
+    . $_SESSION['binaryfile'] );
+}
+
+echo $_SESSION['binary'];
+error_reporting (E_ALL);
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
index 541204607c66b26ee340a12b01e474efadcc4080..63d9636967b885d31642292083b2ce64b12af7fd 100644 (file)
@@ -65,7 +65,7 @@ session_start ();
 
 /* Logged in? Simple security check */
 if (!isset($_SESSION['ui'])){
-  gosa_log ("Error: getpic.php called without session");
+  gosa_log ("Error: getldif.php called without session");
   header ("Location: ../index.php");
   exit;
 }
diff --git a/html/getpic.php b/html/getpic.php
deleted file mode 100644 (file)
index 8f941ae..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-/*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2003  Cajus Pollmeier
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-/* Basic setup, remove eventually registered sessions */
-@require_once ("../include/php_setup.inc");
-@require_once ("functions.inc");
-error_reporting (0);
-session_start ();
-
-/* Logged in? Simple security check */
-if (!isset($_SESSION['ui'])){
-  gosa_log ("Error: getpic.php called without session");
-  header ("Location: ../index.php");
-  exit;
-}
-
-header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
-header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
-header("Cache-Control: no-cache");
-header("Pragma: no-cache");
-header("Cache-Control: post-check=0, pre-check=0");
-header("Content-type: image/jpeg");
-
-echo $_SESSION['picture'];
-error_reporting (E_ALL);
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
index 1dc42b8902671d68d798d19f89e9c109e3bd35df..34ab301b7394030bafc1a9162983469c9db5c90a 100644 (file)
@@ -38,7 +38,8 @@ class application extends plugin
        if ($this->iconData == ""){
                $this->set_picture("");
        }
-       $_SESSION['picture']= $this->iconData;
+       $_SESSION['binary']= $this->iconData;
+       $_SESSION['binarytype']= "image/jpeg";
        $this->gosaApplicationIcon= $this->iconData;
 
        /* This is always an account */
@@ -370,7 +371,8 @@ class application extends plugin
        if (file_exists($filename)){
                $fd = fopen ($filename, "rb");
                $this->iconData= fread ($fd, filesize ($filename));
-               $_SESSION['picture']= $this->iconData;
+               $_SESSION['binary']= $this->iconData;
+               $_SESSION['binarytype']= "image/jpeg";
                $this->gosaApplicationIcon= $this->iconData;
 
                fclose ($fd);
index 80294dfd0abc5379e2d1658485d94b2ef9fa5a12..fac82d0964c2e16311f701ba424175c4dc730ab9 100644 (file)
@@ -45,7 +45,7 @@
   <td style="vertical-align:top;">
     <LABEL for="picture_file">{t}Icon{/t}</LABEL>
     <br>
-    <img alt="" src="getpic.php?rand={$rand}" border=1 style="width:48px; height:48; background-color:white; vertical-align:bottom;">
+    <img alt="" src="getbin.php?rand={$rand}" border=1 style="width:48px; height:48; background-color:white; vertical-align:bottom;">
     <input type="hidden" name="MAX_FILE_SIZE" value="100000">
     <input name="picture_file" type="file" size="20" maxlength="255" accept="image/*.png" id="picture_file">
     <input type="submit" name="update" value="{t}Update{/t}" title="{t}Reload picture from LDAP{/t}">
index ba9e62e2c010668715642a395b94730292695abb..40b0e8be8e4dd3678260084b3b2e28a8272fe3ca 100644 (file)
@@ -426,7 +426,7 @@ class mailgroup extends plugin
       $smarty->assign("$val"."ACL", chkacl($this->acl, "$val"));
     }
     if (is_numeric($this->gosaMailQuota) && $this->gosaMailQuota != 0){
-      $smarty->assign("quotausage", progressbar(($this->quotaUsage * 100)/ $this->gosaMailQuota,100,15,true));
+      $smarty->assign("quotausage", progressbar(round(($this->quotaUsage * 100)/ $this->gosaMailQuota,100,15,true)));
       $smarty->assign("quotadefined", "true");
     } else {
       $smarty->assign("quotadefined", "false");
index 2df7054191fa4e15acc383b5c3f443921f7792b4..6489392170bf3937a46b3d2d2da80110a4e4d8ed 100644 (file)
@@ -309,7 +309,8 @@ class user extends plugin
       $this->photoData= $this->old_photoData;
 
       /* Update picture */
-      $_SESSION['picture']= $this->photoData;
+      $_SESSION['binary']= $this->photoData;
+      $_SESSION['binarytype']= "image/jpeg";
       $this->picture_dialog= FALSE;
       $this->dialog= FALSE;
     }
@@ -1024,7 +1025,8 @@ class user extends plugin
       if ($ei) {
         if ($info = ldap_get_values_len($ds, $ei, "jpegPhoto")){
           $this->photoData= $info[0];
-          $_SESSION['picture']= $this->photoData;
+          $_SESSION['binary']= $this->photoData;
+          $_SESSION['binarytype']= "image/jpeg";
           $this->jpegPhoto= "";
         }
       }
@@ -1081,7 +1083,8 @@ class user extends plugin
 
     $fd = fopen ($filename, "rb");
     $this->photoData= fread ($fd, filesize ($filename));
-    $_SESSION['picture']= $this->photoData;
+    $_SESSION['binary']= $this->photoData;
+    $_SESSION['binarytype']= "image/jpeg";
     $this->jpegPhoto= "";
 
     fclose ($fd);
index 6f3122dcf6624dd9fd937f57be026ce7dcd7fa45..337ac381cf928b43cf1855854c051432d877cb85 100644 (file)
@@ -12,7 +12,7 @@
 
   <!-- Image container -->
   <td style="vertical-align:top">
-   <img align="bottom" border="1" width="145" height="200" src="getpic.php?rand={$rand}" alt="{t}Personal picture{/t}">
+   <img align="bottom" border="1" width="145" height="200" src="getbin.php?rand={$rand}" alt="{t}Personal picture{/t}">
    <br>
    <input type=submit name="edit_picture" {$jpegPhotoACL} value="{t}Change picture{/t}...">
   </td>
index cb76dc282461baec6b9f4163dd8bbd54b194be7d..b3b4ae76994d92fa452eb19c3995390fef49c26a 100644 (file)
@@ -12,7 +12,7 @@
 
    <!-- Image container -->
    <td>
-     <img alt="" align="bottom" border="1" width="145" height="200" src="getpic.php?rand=$rand">
+     <img alt="" align="bottom" border="1" width="145" height="200" src="getbin.php?rand=$rand">
    </td>
 
    <!-- Name, ... -->
index 13bc4b0c9dcb0debd51588fbe24c88b6e0c594e8..515a918396cace4db13cf31d8ca15ddf167db2d9 100644 (file)
@@ -441,7 +441,7 @@ class mailAccount extends plugin
     }
 
     if (is_numeric($this->gosaMailQuota) && $this->gosaMailQuota != 0){
-      $smarty->assign("quotausage", progressbar(($this->quotaUsage * 100)/ $this->gosaMailQuota,100,15,true));
+      $smarty->assign("quotausage", progressbar(round(($this->quotaUsage * 100)/ $this->gosaMailQuota,100,15,true)));
       $smarty->assign("quotadefined", "true");
     } else {
       $smarty->assign("quotadefined", "false");