[Kolab-devel] server/kolab/kolab/admin/user create_user.php,1.10,1.11 forward.php,1.6,1.7 head.php,1.7,1.8 index.php,1.12,1.13 sieve.php,1.5,1.6 vacation.php,1.8,1.9 by martin at doto.intevation.de

root at intevation.de root at intevation.de
Sat Jun 14 19:06:33 CEST 2003


Update of /kolabrepository/server/kolab/kolab/admin/user
In directory doto:/tmp/cvs-serv24612/user

Modified Files:
	create_user.php forward.php head.php index.php sieve.php 
	vacation.php 
Log Message:
Martin K.: Merged css stuff from Konsec


Index: create_user.php
===================================================================
RCS file: /kolabrepository/server/kolab/kolab/admin/user/create_user.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- create_user.php	11 Jun 2003 11:19:18 -0000	1.10
+++ create_user.php	14 Jun 2003 17:06:31 -0000	1.11
@@ -11,8 +11,6 @@
   include("../include/checks.php");
 ?>
 
-<TABLE WIDTH="100%" CELLSPACING=0 CELLPADDING=0 BORDER=0>
-
 <?
 function debug ($a) {
 //   print "debug: $a<br>\n";
@@ -226,13 +224,13 @@
             array_push($errors, "Error: you need administrative permissions to delete users");
 
       if (!$errors) {    
-         print("<TR><TD><center><H1> Delete User </H1></center></TD></TR>\n");
+         print("<div class=\"maintitle\"> Delete User </div>\n");
          $delete_template['deleteflag'] = 'TRUE';
          if (!(ldap_modify($link,$dn,$delete_template))) {
             array_push($errors, "LDAP Error: could not mark ".utf8_decode($dn)." for deletion ".ldap_error($link));
          } else {
 //            system("sudo -u kolab /kolab/etc/kolab/kolab_buildconfig &");
-            print("<tr><td><center> The object ".utf8_decode($dn)." has been deleted </td></tr>\n");
+            print("<div class=\"message\"> The object ".utf8_decode($dn)." has been deleted </div>\n");
          }
       } 
 
@@ -241,17 +239,8 @@
       switch ($action) {
 
          case "firstsave":
-            #if (!empty($HTTP_GET_VARS['uid_0']) &&
-            #    uid_ok($HTTP_GET_VARS['uid_0'])) {
-            #   $ldap_object['uid'] = trim(strtolower(urldecode($HTTP_GET_VARS['uid_0']))); 
-            #   // $ldap_object['mail'] = $ldap_object['uid']."@".$domain;
-            #} else {
-            #   $comment['uid_0'] = "<span style=\"color:#FF0000\"> Fill in valid uid (lowercase <br>
-	    #                        letters and digits only, e. g. jblack)</span>";
-            #   missing_input();
-            #}
 	    if (empty($HTTP_GET_VARS['mail_0'])) {
-	       $comment['mail_0'] = "<span style=\"color:#FF0000\"> Fill in valid email address</span>";
+              $comment['mail_0'] = "<span class=\"warning\"> Fill in valid email address</span>";
 	       missing_input();
             }
 
@@ -261,32 +250,32 @@
                if (!empty($HTTP_GET_VARS['firstname'])) {
                   $firstname = trim(urldecode($HTTP_GET_VARS['firstname']));
                } else {
-                  $comment['firstname'] = "<span style=\"color:#FF0000\"> Fill in firstname </span>";
+                  $comment['firstname'] = "<span class=\"warning\"> Fill in firstname </span>";
                   missing_input();
                }
                if (!empty($HTTP_GET_VARS['lastname'])) {
                   $ldap_object['sn'] = trim(urldecode($HTTP_GET_VARS['lastname']));
                   if ($firstname) $ldap_object['cn'] = $firstname." ".$ldap_object['sn'];
                } else {
-                  $comment['lastname'] = "<span style=\"color:#FF0000\"> Fill in lastname </span>";
+                  $comment['lastname'] = "<span class=\"warning\"> Fill in lastname </span>";
                   missing_input();
                }
 	    }   
             if (!empty($HTTP_GET_VARS['password_0'])) $password_0 = urldecode($HTTP_GET_VARS['password_0']);
             else {
-               $comment['password_0'] = "<span style=\"color:#FF0000\"> Fill in password </span>";
+               $comment['password_0'] = "<span class=\"warning\"> Fill in password </span>";
                missing_input();
             }
             if (!empty($HTTP_GET_VARS['password_1'])) $password_1 = urldecode($HTTP_GET_VARS['password_1']);
             else {
-               $comment['password_1'] = "<span style=\"color:#FF0000\"> Fill in password </span>";
+               $comment['password_1'] = "<span class=\"warning\"> Fill in password </span>";
                missing_input();
             }
             if ($password_0 && $password_1) {
                if ($password_0 == $password_1) {
                   $ldap_object['userPassword'] = $password_0;
                } else {
-                  $comment['password_1'] = "<span style=\"color:#FF0000\"> Passwords do not match </span>"; 
+                  $comment['password_1'] = "<span class=\"warning\"> Passwords do not match </span>";
                   missing_input();
                }
             }
@@ -295,7 +284,7 @@
                $ldap_object['mail'] = trim(strtolower(urldecode($HTTP_GET_VARS['mail_0'])));
 	       if ($action == "firstsave") $ldap_object['uid'] = $ldap_object['mail']; 
             } else {
-               $comment['mail_0'] = "<span style=\"color:#FF0000\">email address is already taken by another user</span>";
+               $comment['mail_0'] = "<span class=\"warning\">email address is already taken by another user</span>";
                missing_input();
             }
 
@@ -319,14 +308,8 @@
 	    }   
             if (!$visible) $dn_add = ",cn=internal";
                else $dn_add = "";
-//print("ldap_object: "); print_r($ldap_object); print("<br>");
-
-	    #if (!empty($ldap_object['uid']) && !is_unique('uid',$ldap_object['uid'])) {
-	    #   $comment['uid_0'] = "<span style=\"color:#FF0000\"> Error: This uid is already taken by another user </span>";
-	    #   missing_input();
-	    #}
 	    if (!empty($ldap_object['alias']) && !is_unique('alias',$ldap_object['alias'])) {
-	       $comment['alias_0'] = "<span style=\"color:#FF0000\"> Error: the alias you gave is <br>". 
+               $comment['alias_0'] = "<span class=\"warning\"> Error: the alias you gave is <br>".
 	       			     "already taken by another user</span>";
 	       missing_input();
 	    }
@@ -367,7 +350,7 @@
 //                     else system("sudo -u kolab /kolab/etc/kolab/kolab_buildconfig &");
                }
                if ($errors) {
-                  print("<TR><TD><center><H1> Create New User </H1></center></TD></TR>\n");
+                  print("<div class=\"maintitle\"> Create New User </div>\n");
  		  $blacklist = array('mail');
 		  $action = "create";
 		  $ldap_object = from_utf8($ldap_object);
@@ -375,20 +358,20 @@
                }
             }
             $action = "modify";
-            print("<TR><TD><center><H1> Modify Existing User </H1></center></TD></TR>\n");
+            print("<div class=\"maintitle\"> Modify Existing User </div>\n"); 
             break;
 
          case "create":
-            print("<TR><TD><center><H1> Create New User </H1></center></TD></TR>\n");
+            print("<div class=\"maintitle\"> Create New User </div>\n"); 
             $blacklist = array('mail');
             break;
 
          case "modify":
-            print("<TR><TD><center><H1> Modify Existing User </H1></center></TD></TR>\n");
+            print("<div class=\"maintitle\"> Modify Existing User </div>\n");
 	    break;
 
 	 case "delete":
-	    print("<TR><TD><center><H1> Confirm Delete User </H1></center></TD></TR>\n");
+            print("<div class=\"maintitle\"> Confirm Delete User </div>\n");
       }
 
       if ($dn) {
@@ -410,40 +393,40 @@
 //print "ldap_object gelesen: "; print_r($ldap_object); print "<br>";
 
 if (in_array($action, $valid_actions) && $action != "kill") {
-print "<TR><TD><CENTER><form action=\"$myself\" method=\"GET\">\n";
-switch ($action) {
-   case "create":
-      print("<input type=\"hidden\" name=\"action\" value=\"firstsave\">\n");
-      break;
-   case "delete":
-      print("<input type=\"hidden\" name=\"action\" value=\"kill\">\n");
-      break;
-   default:
-      print("<input type=\"hidden\" name=\"action\" value=\"save\">\n");
-}
-if ($dn) print "<input type=\"hidden\" name=\"dn\" value=\"$dn\">\n";
-print "<table cellspacing=0 cellpadding=3>\n";
-
-if (is_array($ldap_object['sn'])) $lastname = $ldap_object['sn'][0];
-   else $lastname = $ldap_object['sn']; 
-if (is_array($ldap_object['cn'])) $cn = $ldap_object['cn'][0];
-   else $cn = $ldap_object['cn'];
-if ($lastname) {
-   $a = strlen($lastname); 
-   if ($cn) {
+  print "<div class=\"contenttable\"><form action=\"$myself\" method=\"GET\">\n";
+  switch ($action) {
+     case "create":
+        print("<input type=\"hidden\" name=\"action\" value=\"firstsave\">\n");
+        break;
+     case "delete":
+        print("<input type=\"hidden\" name=\"action\" value=\"kill\">\n");
+        break;
+     default:
+        print("<input type=\"hidden\" name=\"action\" value=\"save\">\n");
+  }
+  if ($dn) print "<input type=\"hidden\" name=\"dn\" value=\"$dn\">\n";
+  print "<table class=\"contentform\">\n";
+  if (is_array($ldap_object['sn'])) $lastname = $ldap_object['sn'][0];
+  else $lastname = $ldap_object['sn']; 
+  if (is_array($ldap_object['cn'])) $cn = $ldap_object['cn'][0];
+  else $cn = $ldap_object['cn'];
+  if ($lastname) {
+    $a = strlen($lastname); 
+    if ($cn) {
       $b = strlen($cn);
       $firstname = substr($cn, 0, $b - $a);
-   }
-}
-if ($action == "delete") print("<tr><th> Attribute </th><th> Value </th></tr>\n");
-else print("<tr><th> Attribute </th><th> Value </th><th> Comment </th></tr>\n");
-print "<tr><td> First Name </td><td>\n";
-if ($action == "delete") print("$firstname </td></tr>\n");
-else {
-   if ($group == "admin" || $group == "maintainer") {
-      print "<input type=\"text\" name=\"firstname\" size=$width maxlength=80 value=\"$firstname\">\n";
-      print "</td><td>".(comment('firstname'))."</td></tr>\n";
-   } else print("$firstname </td><td>   </td></tr>\n");
+    }
+  }
+  if ($action == "delete") print("<tr><th> Attribute </th><th> Value </th></tr>\n");
+  else print("<tr><th> Attribute </th><th> Value </th><th> Comment </th></tr>\n");
+  print "<tr><td> First Name </td><td>\n";
+  if ($action == "delete") print("$firstname </td></tr>\n");
+  else {
+  if ($group == "admin" || $group == "maintainer") {
+    print "<input type=\"text\" name=\"firstname\" size=$width maxlength=80 value=\"$firstname\">\n";
+    print "</td><td>".(comment('firstname'))."</td></tr>\n";
+  } 
+  else print("$firstname </td><td>   </td></tr>\n");
 }
 
 print "<tr><td> Last Name </td><td>\n";
@@ -504,28 +487,25 @@
       print "<td>".(comment('visible'))."</td></tr>\n";
    }
 }
+print "</table>\n";
 
-print "</table></CENTER></TD><TR>\n";
-
-print "<tr><td><center><table cellspacing=0 cellpadding=3>\n";
+print "<table class=\"button\">\n";
 print "<tr><td><input type=\"image\" src=\"../pics/button_ok.png\" name=\"apply\" value=\"Apply\"></td>\n";
 if ($group == "user") {
    print "<td><a href=\"..\"> <img src=\"../pics/button_cancel.png\" alt=\"cancel\"></a></td></tr>\n";
 } else {
    print "<td><a href=\"index.php\"> <img src=\"../pics/button_cancel.png\" alt=\"cancel\"></a></td></tr>\n";
 }
-print "</center></td></tr>\n";
+print "</td></tr>\n";
 
 } // if $action != delete
-
-print("</table>\n");
+print("</table></div>\n");
 
 if ($errors) {
-   print("<TABLE WIDTH=\"100%\" CELLSPACING=20 CELLPADDING=0 BORDER=0>\n");
-   print("<TR><TD HEIGHT=20></TD></TR>\n");
-   print("<TR><TD><H3> There were Errors : </H3></TD></TR>\n");
-   print("<TR><TD>\n");
-   foreach ($errors as $message) print("<span style=\"color:#FF0000\">".$message."</span><br>");
+   print("<TABLE style=\"errors\">\n");
+   print("<TR><TD class=\"head\"> There were Errors : </TD></TR>\n");
+   print("<TR><TD class=\"body\">\n");
+   foreach ($errors as $message) print($message);
    print("</TD></TR>\n");
    print("</TABLE>\n");
 }

Index: forward.php
===================================================================
RCS file: /kolabrepository/server/kolab/kolab/admin/user/forward.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- forward.php	11 Jun 2003 11:19:18 -0000	1.6
+++ forward.php	14 Jun 2003 17:06:31 -0000	1.7
@@ -10,9 +10,7 @@
   Head();
 ?>
 
-<TABLE border=0 WIDTH="100%" CELLSPACING=8 CELLPADDING=8>
-<TR><TD HEIGHT=20></TD></TR>
-<TR><TD><center><H1>My User Forward Settings</H1></center></TD></TR>
+<div class="maintitle">My Forward Settings</div>
 
 <?
 
@@ -73,13 +71,14 @@
 if (!$errors) {
    // on start show if sieve script is present or not
    if ($sieve->sieve_listscripts())  {
+     if ($action == "start") 
+        print("<div class=\"message\">Vacation notification or email forwarding already activated</div>");
+
+     $sieveactive = TRUE;
+   } 
+   else {
       if ($action == "start") 
-         print("<TR><TD><center>Vacation notification or email forwarding
-already activated</center></TD></TR>");
-      $sieveactive = TRUE;
-   } else {
-      if ($action == "start") 
-         print("<tr><td><center>Currently no forwarding of email activated</center></td></tr>");
+         print("<div class=\"message\">Currently no forwarding of email activated</center></div>");
       $sieveactive = FALSE;
    }
    
@@ -88,8 +87,7 @@
 //          print("\naction: $action.\n\n");
           if ($sieveactive == TRUE) {
              delete_script ($scriptname);
-	     print "<tr><td><center>Vacation notification or email forwarding
-                    directive got deleted on server</center></td></tr>";
+             print "<div class=\"message\">Vacation notification or email forwarding got deleted on Kolab server</div>";
           }
 	  
           $newscript = "redirect \"$email\";\n";
@@ -101,35 +99,31 @@
           if(!($sieve->sieve_setactivescript($scriptname)))
               array_push($errors,"Could not upload and activate forward directive on your IMAP server!");
 	      
-	  print "<tr><td><center>Forwarding to email address activated</center></td></tr>\n";
-	  print "<tr><td><center>E-Mail sent to you will be redirected to $email<center></td></tr>\n";
-	  if ($keep == "keep")
-	     print "<tr><td><center>E-Mails will also kept stored on the server<center></td></tr>\n";
-	  print "</table>";
+          print "<div class=\"message\">Forward directive on server activated</div>\n";
+          print "<div class=\"message\">E-Mail sent to you will be redirected to $email</div>\n";
 
-          print "<CENTER><TABLE WIDTH=\"10%%\" CELLSPACING=0 CELLPADDING=0 BORDER=0>\n";
-	  print "<TR><TD HEIGHT=20></TD></TR>\n";
-          print "<TR><TD><form action=\"$myself\" method=\"GET\">\n";
+	  if ($keep == "keep")
+            print "<div class=\"message\">E-Mails will also kept stored on the server</div>\n";
+          print "<div class=\"contenttable\"><table class=\"contentform\"><form action=\"$myself\" method=\"GET\">\n";
 	  print "<td><a href=\"../index.php\"> <img src=\"../pics/button_ok.png\" alt=\"OK\"></a></td></tr>\n";
-          print "</table></form></center>\n";
-          print "</td></tr>\n";
-       break;
+          print "</table></form>\n";
+          break;
        
        case "delete":
 //          print("\naction: $action.\n\n");
           if ($sieveactive == TRUE) {
-             delete_script ($scriptname);
-	     print "<tr><td><center>Deleted vacation or forward directive on server</center></td></tr></table>\n";
-          } else {
-	     print "<tr><td><center>No vacation or forward directive on server found to be deleted!</center></td></tr></table>\n";
+            delete_script ($scriptname);
+            print "<div class=\"message\">Deleted vacation or forward directive on server</div>\n";
+          } 
+          else {
+            print "<div class=\"message\">No vacation or forward directive on server found to be deleted!</div>\n";
           }
 
-          print "<CENTER><TABLE WIDTH=\"10%%\" CELLSPACING=0 CELLPADDING=0 BORDER=0>\n";
-	  print "<TR><TD HEIGHT=20></TD></TR>\n";
-          print "<TR><TD><form action=\"$myself\" method=\"GET\">\n";
+          print "<div class=\"contenttable\"><table class=\"contentform\"><form action=\"$myself\" method=\"GET\">\n";
 	  print "<td><a href=\"$myself\"> <img src=\"../pics/button_ok.png\" alt=\"OK\"></a></td></tr>\n";
 	  print "<input type=\"hidden\" name=\"action\" value=\"start\">\n";
-          print "</table></form></center>\n";
+          print "</table></form>";
+
           print "</td></tr>\n";
        break;
        
@@ -141,64 +135,63 @@
 	     $action = "firstcreate";
 	  }
 
-          print "<TR><TD><CENTER><form action=\"$myself\" method=\"GET\">\n";
-          print "<table cellspacing=0 cellpadding=3>\n";
-	  print "<TR><TD HEIGHT=20></TD></TR>\n";
+          print "<table class=\"contentform\"><form action=\"$myself\" method=\"GET\">\n";
 
           if ($action == "firstcreate") {
              print "<tr><th> </th><th></th><th></th></tr>\n";
              if ($wrong_email) {
-	        print "<tr><td></td><td><blockquote><font color=#aa0000>";
-	        print "The E-Mail address you entered is not correct - please change!</font></blockquote>";
-		print "</font></blockquote></td><td></td></tr>";
-                $wrong_email = FALSE;
+               print "<tr><td></td><td class=\"warning\">";
+               print "The E-Mail address you entered is not correct - please change!";
+               print "</td><td></td></tr>";
+               $wrong_email = FALSE;
              }
      print "<tr><td>Forward my email to</td>\n";
      print "<td align=\"left\"><input type=\"text\" name=\"email\" size=25 maxlength=80 value=\"$email\"></td></tr>\n";
              print "<tr>\n";
 	     print "<td>Keep copy on server</td><td align=\"left\"><input type=\"checkbox\" name=\"keep\" value=\"keep\"></td>\n";
              print "</tr>\n";
-             print "</table></CENTER>\n";
-
-             print "<tr><td><center><table width=\"60%\" cellspacing=10 cellpadding=10><tr>\n";
-	     print "<TR><TD HEIGHT=20></TD></TR>\n";
-             print "<input type=\"image\" src=\"../pics/button_ok.png\" name=\"create\" alt=\"create\" value=\"Apply\">\n";
-	     print "<input type=\"hidden\" name=\"action\" value=\"create\">\n";
-             print "<a href=\"../index.php\"> <img src=\"../pics/button_cancel.png\" alt=\"cancel\"></a></td></tr>\n";
-             print "</table></CENTER>\n";
-          } else {
-	     // delete the script on the server before setting a new one...
-	     print "<tr><td>Please delete the currently active your vacation
+             print "</table>\n";
+            print "<tr><td><input type=\"image\" src=\"../pics/button_ok.png\" name=\"create\" alt=\"create\" value=\"Apply\">\n";
+            print "<input type=\"hidden\" name=\"action\" value=\"create\">\n";
+            print "<a href=\"../index.php\"> <img src=\"../pics/button_cancel.png\" alt=\"cancel\"></a></td></tr>\n";
+            print "</table>\n";
+          } 
+          else {
+            // delete the script on the server before setting a new one...
+	    print "<tr><td>Please delete the currently active your vacation
                     notification or email forward setting by pressing the OK button! 
                    </td></tr>\n";
-	     print "</table>\n";
-             print "<TABLE WIDTH=\"30%%\" CELLSPACING=0 CELLPADDING=0 BORDER=0>\n";
-	     print "<TR><TD HEIGHT=20></TD></TR>\n";
-	     print "<tr><td><input type=\"image\" src=\"../pics/button_ok.png\" name=\"delete\" value=\"Apply\"></td>\n";
-	     print "<input type=\"hidden\" name=\"action\" value=\"delete\">\n";
-	     print "<td><a href=\"../index.php\"> <img src=\"../pics/button_cancel.png\" alt=\"cancel\"></a></td></tr>\n";
+	    print "</table>\n";
+            print "<tr><td>Please delete the currently active your vacation
+                    notification or email forward setting by pressing the OK
+                    button!</td></tr>\n";
+            print "</table>\n";
+            print "<table class=\"contentform\">\n";
+            print "<tr><td><input type=\"image\" src=\"../pics/button_ok.png\" 
+                   name=\"delete\" value=\"Apply\"></td>\n";
+            print "<input type=\"hidden\" name=\"action\" value=\"delete\">\n";
+            print "<td><a href=\"../index.php\"> <img src=\"../pics/button_cancel.png\" 
+                   alt=\"cancel\"></a></td></ tr>\n";
 	  }
           // close the centered table form
-          print "</table></form></center>\n";
-          print "</td></tr>\n";
+          print "</table></form></div>\n";
    }
    $sieve->sieve_logout();
 }
 
 if ($errors) {
-   print "<TR><TD><TABLE WIDTH=\"100%\" CELLSPACING=20 CELLPADDING=0 BORDER=0>\n";
-   print "<TR><TD HEIGHT=20></TD></TR>\n";
-   print "<TR><TD><H3> There were Errors : </H3></TD></TR>\n";
-   print "<TR><TD>\n";
-   foreach ($errors as $message) print("<span style=\"color:#FF0000\">".$message."</span><br>"); 
-   print "</TD></TR>\n";
-   print "</TABLE>\n";
-   print "</TD></TR>\n";
+  print("<TABLE style=\"errors\">\n");
+  print("<TR><TD class=\"head\"> There were Errors : </TD></TR>\n");
+  print("<TR><TD class=\"body\">\n");
+  foreach ($errors as $message) print($message);
+  print("</TD></TR>\n");
+  print("</TABLE>\n");
 }
+
 ?>
 
 </TABLE>
 
-<?php
+<?
 Foot(); 
 ?>

Index: head.php
===================================================================
RCS file: /kolabrepository/server/kolab/kolab/admin/user/head.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- head.php	11 Jun 2003 11:19:18 -0000	1.7
+++ head.php	14 Jun 2003 17:06:31 -0000	1.8
@@ -11,12 +11,12 @@
   $uid=$_SERVER['PHP_AUTH_USER'];
   $group_id = uid2group($uid);
   $_pid = 1;
+
   Function idxExtend() {
     global $group_id;
     if (($group_id == "admin" )||($group_id=="maintainer")){
       idxSpace(5);
-      idxSubLink("user/create_user.php?action=create","Create User","Create
-User");
+      idxSubLink("user/create_user.php?action=create","Create User","Create User");
       idxSpace(2);
     }
     else {
@@ -31,6 +31,5 @@
     global $title;
     idxPrefix("../");
     Mainhead("- User Settings".$title);
-    print("<img alt=\"kolab_logo\" src=\"../pics/kolab_logo.gif\">");
   }
 ?>

Index: index.php
===================================================================
RCS file: /kolabrepository/server/kolab/kolab/admin/user/index.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- index.php	11 Jun 2003 11:19:18 -0000	1.12
+++ index.php	14 Jun 2003 17:06:31 -0000	1.13
@@ -8,11 +8,6 @@
   include("head.php");
   This("user/");
   Head();
-?>
-
-<table width="100%" cellspacing="8" cellpadding="8" border="0" summary="main contents">
-<tr><td><center><h1> Manage Email Users </h1></center></td></tr>
-<?
 
 $utf8 = array ( 'cn', 'sn' );
 
@@ -30,6 +25,8 @@
 // read selector for register display
 if (isset($HTTP_GET_VARS['alphaselect'])) $alphaselect = $HTTP_GET_VARS['alphaselect'];
    else $alphaselect = "[A-F]";
+if (isset($HTTP_GET_VARS['page'])) $page = $HTTP_GET_VARS['page'];
+   else $page = "1";
 
 if (isset($_SESSION['base_dn'])) $base_dn = $_SESSION['base_dn'];
    else $base_dn = 'k=kolab' ;
@@ -45,108 +42,199 @@
 if (!$errors && !($link = ldap_connect($ldap_server,$ldap_port)) || !ldap_bind($link,$bind_dn,$_SERVER["PHP_AUTH_PW"])) 
    array_push($errors, "Communication Error: could not query ldap://$ldap_server:$ldap_port ".ldap_error($link));   
 
-switch ($alphaselect) {
-   case "[A-F]":
-      $filter = "(&(cn=*)(objectclass=inetOrgPerson)(uid=*)(mail=*)(|(sn=F*)(sn=E*)(sn=D*)(sn=C*)(sn=B*)(sn=A*)";
-      $filter = $filter."(sn=f*)(sn=e*)(sn=d*)(sn=c*)(sn=b*)(sn=a*)";
-      if (in_array('sn', $utf8)) $filter = $filter."(sn=".utf8_encode("Ä")."*)(sn=".utf8_encode("ä")."*)";
-      $filter = $filter."))";
-      break;
-   case "[G-L]":
-      $filter = "(&(cn=*)(objectclass=inetOrgPerson)(uid=*)(mail=*)(|(sn=G*)(sn=H*)(sn=I*)(sn=J*)(sn=K*)(sn=L*)";
-      $filter = $filter."(sn=g*)(sn=h*)(sn=i*)(sn=j*)(sn=k*)(sn=l*)))";
-      break;
-   case "[M-S]":
-      $filter = "(&(cn=*)(objectclass=inetOrgPerson)(uid=*)(mail=*)(|(sn=M*)(sn=N*)(sn=O*)(sn=P*)(sn=Q*)(sn=R*)(sn=S*)";
-      $filter = $filter."(sn=m*)(sn=n*)(sn=o*)(sn=p*)(sn=q*)(sn=r*)(sn=s*)";
-      if (in_array('sn', $utf8)) $filter = $filter."(sn=".utf8_encode("Ö")."*)(sn=".utf8_encode("ö")."*)".
-                                                   "(sn=".utf8_encode("Ü")."*)(sn=".utf8_encode("ü")."*)";   
-      $filter = $filter."))";
-      break;
-   case "[T-Z]":
-      $filter = "(&(cn=*)(objectclass=inetOrgPerson)(uid=*)(mail=*)(|(sn=T*)(sn=U*)(sn=V*)(sn=W*)(sn=X*)(sn=Y*)(sn=Z*)";
-      $filter = $filter."(sn=t*)(sn=u*)(sn=v*)(sn=w*)(sn=x*)(sn=y*)(sn=z*)))";
-      break;
-   default: 
-      $filter = "(&(cn=*)(objectclass=inetOrgPerson)(uid=*)(mail=*)(sn=*))";
-      break;
-}
+// get all entries & dynamically split the letters with growing entries
+       $filter = "(&(cn=*)(objectclass=inetOrgPerson)(uid=*)(mail=*)(sn=*))";
+       $result = ldap_search($link, $base_dn, $filter);
+       if (!$errors) {
+               $entries = ldap_count_entries($link, $result);
+               printf("<div class=\"maintitle\">Manage Email Users (%s Users)</div>", $entries);
+               // if there are more than 2000 entries, split in 26 categories for every letter
+               if ($entries > 2000) {
+                   print("<div class=\"alphabetlisting\"><form method=\"POST\" action=\"$myself\">\n\n");
+                       for ($i = 65; $i < 91; $i++) {
+                           printf("<a href=\"$myself?alphaselect=[%s]\"> [%s] </a>", chr($i), chr($i));
+                       }
+                   $text="[all]";
+                   print("<a href=\"$myself?alphaselect=$text\">  $text  </a>\n");
+                   print("</form></div>\n");
 
-if (!$errors) {
-$result = ldap_search($link, $base_dn, $filter);
-if ($result) {
-   print("<tr><td><center><form method=\"POST\" action=\"$myself\">\n<h2>\n");
-   $text = "[A-F]";
-   print("<a href=\"$myself?alphaselect=$text\"> $text </a>");
-   $text = "[G-L]";
-   print("<a href=\"$myself?alphaselect=$text\"> $text </a>");
-   $text="[M-S]";
-   print("<a href=\"$myself?alphaselect=$text\"> $text </a>");
-   $text="[T-Z]";
-   print("<a href=\"$myself?alphaselect=$text\"> $text </a>");
-   $text="[all]";
-   print("<a href=\"$myself?alphaselect=$text\">  $text  </a>\n");
-   print("</h2></form></center></td></tr>");
-   print("<tr><td height=\"20\"></td></tr>\n");
+                   for ($i = 65; $i < 91; $i++) {
+                     switch ($alphaselect) {
+                       case "[".chr($i)."]":
+                         $filter = "(&(cn=*)(objectclass=inetOrgPerson)(uid=*)(mail=*)(|(sn=".chr($i)." *)(sn=".chr($i+32)."*)";
+                         if ($i == 65) {
+                         if (in_array('sn', $utf8)) $filter = $filter."(sn=".utf8_encode("Ä")."
+*)(sn=".utf8_encode("ä")."*)"; }
+                         if ($i == 79) {
+                           if (in_array('sn', $utf8)) $filter = $filter."(sn=".utf8_encode("Ö")."
+*)(sn=".utf8_encode("ö")."*)"; 
+                         }
+                         if ($i == 85) {
+                           if (in_array('sn', $utf8)) $filter = $filter."(sn=".utf8_encode("Ü")."
+*)(sn=".utf8_encode("ü")."*)"; 
+                           }
+                           $filter = $filter."))";
+                           break;
+                         }
+                      }
+               ldap_free_result($result);
+                       $result = ldap_search($link, $base_dn, $filter);
+                       $entries = ldap_count_entries($link, $result);
+               }
+               // if there are more than 50 entries, split in four categories
+               elseif ($entries >50) {
+                 print("<div class=\"alphabetlisting\"><form method=\"POST\" action=\"$myself\">\n\n");
+                   $text = "[A-F]";
+                   print("<a href=\"$myself?alphaselect=$text\"> $text </a>");
+                   $text = "[G-L]";
+                   print("<a href=\"$myself?alphaselect=$text\"> $text </a>");
+                   $text="[M-S]";
+                   print("<a href=\"$myself?alphaselect=$text\"> $text </a>");
+                   $text="[T-Z]";
+                   print("<a href=\"$myself?alphaselect=$text\"> $text </a>");
+                   $text="[all]";
+                   print("<a href=\"$myself?alphaselect=$text\">  $text  </a>\n");
+                       print("</form></div>\n");
+                       switch ($alphaselect) {
+                         case "[A-F]":
+                           $filter = "(&(cn=*)(objectclass=inetOrgPerson)(uid=*)(mail=*)(|(sn=F*)(sn=E*)(sn=D*)(sn=C*)(sn=B*)(sn=A*)";
+                           $filter = $filter."(sn=f*)(sn=e*)(sn=d*)(sn=c*)(sn=b*)(sn=a*)";
+                           if (in_array('sn', $utf8)) $filter = $filter."(sn=".utf8_encode("Ä")."*)(sn=".utf8_enc
+ode("ä")."*)";
+                           $filter = $filter."))";
+                           break;
+                         case "[G-L]":
+                           $filter = "(&(cn=*)(objectclass=inetOrgPerson)(uid=*)(mail=*)(|(sn=G*)(sn=H*)(sn=I*)(sn=J*)(sn=K*)(sn=L*)";
+                           $filter = $filter."(sn=g*)(sn=h*)(sn=i*)(sn=j*)(sn=k*)(sn=l*)))";
+                           break;
+                         case "[M-S]":
+                           $filter = "(&(cn=*)(objectclass=inetOrgPerson)(uid=*)(mail=*)(|(sn=M*)(sn=N*)(sn=O*)(sn=P*)(sn=Q*)(sn=R*)(sn=S*)";
+                           $filter = $filter."(sn=m*)(sn=n*)(sn=o*)(sn=p*)(sn=q*)(sn=r*)(sn=s*)";
+                           if (in_array('sn', $utf8)) $filter = $filter."(sn=".utf8_encode("Ö")."*)(sn=".utf8_enc
+ode("ö")."*)"."(sn=".utf8_encode("Ü")."*)(sn=".utf8_encode("ü")."*)";
+                           $filter = $filter."))";
+                           break;
+                         case "[T-Z]":
+$filter."(sn=t*)(sn=u*)(sn=v*)(sn=w*)(sn=x*)(sn=y*)(sn=z*)))";
+                           break;
+                         default:
+                           $filter = "(&(cn=*)(objectclass=inetOrgPerson)(uid=*)(mail=*)(sn=*))";
+                               break;
+                       }
+               ldap_free_result($result);
+                       $result = ldap_search($link, $base_dn, $filter);
+                       $entries = ldap_count_entries($link, $result);
 
-   print("<tr><td>\n");
-   print("<table width=\"95%\" border=\"1\" cellspacing=\"0\"
-cellpadding=\"3\" bgcolor=\"#dcdcdc\" 
-          summary=\"none\" nosave>\n");
+               }
+               // if there are less than 50 entries, all entries are shown - w/o options
+               else { 
+                 echo "<div class=\"alphabetlisting\"></div>\n";
+                 $alphaselect = "[all]"; 
+               }
+       }
 
-   ldap_sort($link,$result,'sn');
-   $entry = ldap_first_entry($link, $result);
-   if (!$entry) { 
-      print("<tr><td> (No users in the category $alphaselect) </td></tr>\n");
-   } else {
-      printf("<thead><td><b> Name </b></td><td><b> E-Mail </b></td><td><b> Action </b></td></thead>\n");
+// splitting into more than one page?
+print("<div class=\"pagelisting\">");
+$pages = ceil($entries / $views);
+if ($pages > 1) {
+  for ($i = 1; $i < $pages; $i++) {
+    // the actual page won't be clickable
+    if ($page != $i)
+      printf(" <a href=\"index.php?alphaselect=%s&page=%s\">%s</a> |\n", $alphaselect, $i, $i);
+    else
+      printf(" %s |\n", $i);
+    }
+    // last item w/o vertical dash
+    if ($page != $i)
+      printf(" <a href=\"index.php?alphaselect=%s&page=%s\">%s</a> \n", $alphaselect, $i, $i);
+    else
+      printf(" %s ", $i);
+  }
+  print("</div>");
+}
+
+if ($result) {
+  if (!$errors) {
+    print("<div class=\"contenttable\">");
+    print("<TABLE class=\"content\" nosave>\n");
+    ldap_sort($link,$result,'sn');
+    $entry = ldap_first_entry($link, $result);
+    // skipping to correct page and start with first entry
+    if ($page != '1') {
+      for ($i = 1; $i <= ($page-1)*$views; $i++) {
+        $entry = ldap_next_entry($link, $entry);
+      }
+    }
+    if (!$entry) {
+      print("<tr><td class=\"nocontent\"> (No users in the category $alphaselect) </td></tr>\n"); }
+    else {
+      printf("<thead><td class=\"content\"> Name </td><td class=\"content\"> E-Mail </td><td class=\"content\"> Action </td ></thead>\n");
       while ($entry) {   
-         $dn = ldap_get_dn($link,$entry);
-         $attrs = ldap_get_attributes($link, $entry);
-         $deleted = $attrs['deleteflag'][0];
-         $userid = $attrs['uid'][0];
-         $mail = $attrs['mail'][0];
-         $sn = $attrs['sn'][0];
-         if (in_array('sn', $utf8)) $sn = utf8_decode($sn);
-         $cn = $attrs['cn'][0];
-         if (in_array('cn', $utf8)) $cn = utf8_decode($cn);
-         $a = strlen($sn);
-         $b = strlen($cn);
-         $fn = substr($cn, 0, $b - $a);
-         $gid = uid2group($userid);
-         if ($gid == "user") {
-            $userid = urlencode($userid);
-            $dn = urlencode($dn);
-            if ($deleted != "TRUE") {
-              printf("<tr><td> %s, %s </td><td> <a href=\"mailto:%s\">%s</a></td>
-                          <td> <a href=\"create_user.php?action=modify&dn=%s\"> [Modify]</a>
-                               <a href=\"create_user.php?action=delete&dn=%s\"> [Delete]</a> </td>
-                     </tr>\n", $sn, $fn, $mail, $mail, $dn, $dn);
-            } else {
-              printf("<tr><td> %s, %s </td>
-                          <td> <a href=\"mailto:%s\">%s</a></td>
-                          <td> <b> User Deleted, awaiting cleanup... </b></td>
-                     </tr>\n", $sn, $fn, $mail, $mail, $dn, $dn);
-            }
-         }
-         $entry = ldap_next_entry($link, $entry);
+        $dn = ldap_get_dn($link,$entry);
+        $attrs = ldap_get_attributes($link, $entry);
+        $deleted = $attrs['deleteflag'][0];
+        $userid = $attrs['uid'][0];
+        $mail = $attrs['mail'][0];
+        $sn = $attrs['sn'][0];
+        if (in_array('sn', $utf8)) $sn = utf8_decode($sn);
+        $cn = $attrs['cn'][0];
+        if (in_array('cn', $utf8)) $cn = utf8_decode($cn);
+        $a = strlen($sn);
+        $b = strlen($cn);
+        $fn = substr($cn, 0, $b - $a);
+        $gid = uid2group($userid);
+        if ($gid == "user") {
+          $userid = urlencode($userid);
+          $dn = urlencode($dn);
+          if ($deleted != "TRUE") {
+            printf("<tr><td class=\"content\"> %s, %s </td><td class=\"content\"> <a href=\"mailto:%s\">%s</a></td>
+                    <td class=\"contentaction\"> <a href=\"create_user.php?action=modify&dn=%s\"> [Modify]</a>
+                    <a href=\"create_user.php?action=delete&dn=%s\"> [Delete]</a> </td>
+                    </tr>\n", $sn, $fn, $mail, $mail, $dn, $dn); } 
+          else {
+            printf("<tr><td class=\"content\"> %s, %s </td>
+                    <td class=\"content\"> <a href=\"mailto:%s\">%s</a></td>
+                    <td class=\"content\"> <b> User Deleted, awaiting cleanup... </b></td>
+                    </tr>\n", $sn, $fn, $mail, $mail, $dn, $dn);
+          }
+        }
+        $entry = ldap_next_entry($link, $entry);
+        // counts the entries, which are already listed on this page and breaks on overflow
+        $countentries++;
+        if ($countentries >= $views) break;
       } 
       ldap_free_result($result);
-   }
-   ldap_close($link);
-} else array_push($errors, "Communication Error: ldap server did not answer query for user information");
-
+    }
+    ldap_close($link); } 
+  else array_push($errors, "Communication Error: ldap server did not answer query for user information");
 }
-print("</table></td></tr>\n");
+print("</table>\n");
+print("<div class=\"pagelisting\">");
+// splitting into more than one page?
+$pages = ceil($entries / $views);
+if ($pages > 1) {
+  for ($i = 1; $i < $pages; $i++) {
+    // the actual page won't be clickable
+    if ($page != $i)
+      printf(" <a href=\"index.php?alphaselect=%s&page=%s\">%s</a> |\n", $alphaselect, $i, $i);
+    else printf(" %s |\n", $i);
+  }
+  // last item w/o vertical dash
+  if ($page != $i)
+    printf(" <a href=\"index.php?alphaselect=%s&page=%s\">%s</a> \n", $alphaselect, $i, $i);
+  else printf(" %s ", $i);
+}
+print("</div>");
+print("</div>\n");
+
 
 if ($errors) {
-   print("<table width=\"100%\" cellspacing=\"20\" cellpadding=\"0\" border=\"0\" summary=\"none\">\n");
-   print("<tr><td></td></tr>\n");
-   print("<tr><td><h3> There were Errors : </h3></td></tr>\n");
-   print("<tr><td>\n");
-   foreach ($errors as $message) print("<span style=\"color:#FF0000\">".$message."</span><br>"); 
-   print("</td></tr>\n");
-   print("</table>\n");
+  print("<TABLE style=\"errors\">\n");
+  print("<TR><TD class=\"head\"> There were Errors : </TD></TR>\n");
+  print("<TR><TD class=\"body\">\n");
+  foreach ($errors as $message) print($message);
+    print("</TD></TR>\n");
+  print("</TABLE>\n");
 }
 
 Foot(); 

Index: sieve.php
===================================================================
RCS file: /kolabrepository/server/kolab/kolab/admin/user/sieve.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- sieve.php	11 Jun 2003 11:19:18 -0000	1.5
+++ sieve.php	14 Jun 2003 17:06:31 -0000	1.6
@@ -19,8 +19,8 @@
 
 $ServerAddress = "127.0.0.1";
 $sieveport = 2000;
-$username = "achim";
-$acctpass = "qw507er";
+$username = $uid;
+$acctpass = $passwd;
 
 $action = "delete";
 $scriptname = "kmail-vacation.siv";

Index: vacation.php
===================================================================
RCS file: /kolabrepository/server/kolab/kolab/admin/user/vacation.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- vacation.php	12 Jun 2003 16:58:49 -0000	1.8
+++ vacation.php	14 Jun 2003 17:06:31 -0000	1.9
@@ -10,9 +10,7 @@
   Head();
 ?>
 
-<TABLE border=0 WIDTH="100%" CELLSPACING=10 CELLPADDING=10>
-<TR><TD HEIGHT=20></TD></TR>
-<TR><TD><center><H1> My User Vacation Notification Setup</H1></center></TD></TR>
++<div class="maintitle">User Vacation Settings</div>
 
 <?
 
@@ -77,11 +75,11 @@
    // on start show if sieve script is present or not
    if ($sieve->sieve_listscripts())  {
       if ($action == "start") 
-         print("<TR><TD><center>vacation notifiy or email forward already active!</center></TD></TR>");
+        print("<div class=\"message\">vacation notifiy or email forwarding already active!</div>");
       $sieveactive = TRUE;
    } else {
       if ($action == "start") 
-//         print("<TR><TD><center>Currently neither a vacation or forward setting activated</center></TD></TR>");
+         print("<div class=\"message\">Currently neither a vacation or forward setting activated</center></div>");
       $sieveactive = FALSE;
    }
    
@@ -90,7 +88,7 @@
 //          print("\naction: $action.\n\n");
           if ($sieveactive == TRUE) {
              delete_script ($scriptname);
-//	     print "<tr><td><center>Deleted vacation or forward directive on server</center></td></tr>";
+//             print "<div class=\"message\">Deleted vacation or forward directive on server</div>";
           }
 	  
           $newscript = "require \"vacation\";";
@@ -136,31 +134,23 @@
     $vacmsg=str_replace("\'","´",$vacmsg); 
     $vacmsg=stripslashes($vacmsg);
 
-    print "<tr><td>People sending you E-Mail will be notified every $vacnotify days with the following message:</td></tr>\n";
-    print "<tr><td align=\"left\"><pre>$vacmsg</pre></center></td></tr></table>\n";
-    print "<CENTER><TABLE WIDTH=\"10%%\" CELLSPACING=0 CELLPADDING=0 BORDER=0>\n";
-    print "<TR><TD HEIGHT=20></TD></TR>\n";
-    print "<TR><TD><form action=\"$myself\" method=\"GET\">\n";
+    print "<div class=\"message\">People sending you E-Mail will be notified every $vacnotify days with the following message:</div>\n";
+    print "<div class=\"message\">$vacmsg</div>\n";
+    print "<div class=\"contenttable\"><table class=\"contentform\"><form action=\"$myself\" method=\"GET\">\n";
     print "<td><a href=\"../index.php\"> <img src=\"../pics/button_ok.png\" alt=\"OK\"></a></td></tr>\n";
-    print "</table></form></center>\n";
-    print "</td></tr>\n";
+    print "</table></form>\n";
     break;
   case "delete":
     if ($sieveactive == TRUE) {
       delete_script ($scriptname);
-	     print "<tr><td><center>Vacation notification or email forwarding
-setting successfully deleteted</center></td></tr></table>\n";
-    }
+        print "<div class=\"message\">Vacation notification or email forwarding setting successfully deleteted</div>\n";
     else {
-      print "<tr><td><center>No vacation or forward directive on server found to be deleted!</center></td></tr></table>\n";
+      print "<div class=\"message\">No vacation or forward directive on server found to be deleted!</div>\n";
     }
-    print "<center><table width=\"10%%\" cellspacing=0 cellpadding=0 border=0>\n";
-    print "<TR><TD height=20></TD></TR>\n";
-    print "<TR><TD><form action=\"$myself\" method=\"GET\">\n";
+    print "<table class=\"contentform\"><form action=\"$myself\" method=\"GET\">\n";
     print "<td><a href=\"$myself\"> <img src=\"../pics/button_ok.png\" alt=\"OK\"></a></td></tr>\n";
     print "<input type=\"hidden\" name=\"action\" value=\"start\">\n";
-    print "</table></form></center>\n";
-    print "</td></tr>\n";
+    print "</table></form>\n";
     break;
   default:
 //          print("\naction: $action.\n\n");
@@ -169,8 +159,7 @@
     else {
 	     $action = "firstcreate"; 
     }
-    print "<tr><td><center><form action=\"$myself\" method=\"GET\">\n";
-    print "<table border=0 cellspacing=0 cellpadding=3>\n";
+    print "<table class=\"contentform\"><form action=\"$myself\" method=\"GET\">\n";
     if ($action == "firstcreate") {
 	     $today = getdate();
 	     $day = $today['mday'];
@@ -234,50 +223,38 @@
                 }
              }
              print "</select> day period.</td>\n";
+             print "</table>\n";
 
-             print "</table></CENTER>\n";
-
-             print "<tr><td><center><table width=\"60%\" cellspacing=10 cellpadding=10><tr>\n";
-	     print "<TR><TD HEIGHT=20></TD></TR>\n";
+             print "<table class=\"contentform\"><tr><td>\n";
              print "<input type=\"image\" src=\"../pics/button_ok.png\" name=\"create\" alt=\"create\" value=\"Apply\">\n";
 	     print "<input type=\"hidden\" name=\"action\" value=\"create\">\n";
              print "<a href=\"../index.php\"> <img src=\"../pics/button_cancel.png\" alt=\"cancel\"></a></td></tr>\n";
-             print "</table></CENTER>\n";
+             print "</table>\n";
+
           } else {
 	     // delete the script on the server before setting a new one...
-	     print "<tr><td>Please delete the currently active your vacation
-notification or email forward setting by pressing the OK button before
-proceeding!
-</td></tr>\n";
+             print "<div class=\"message\">Please delete the currently active your vacation notification or email forward setting by pressing the OK button before proceeding!</div>\n";
+
 	     print "</table>\n";
-             print "<TABLE WIDTH=\"30%%\" CELLSPACING=0 CELLPADDING=0 BORDER=0>\n";
-	     print "<TR><TD HEIGHT=20></TD></TR>\n";
+             print "<table class=\"contentform\"><tr><td>\n";
 	     print "<tr><td><input type=\"image\" src=\"../pics/button_ok.png\" name=\"delete\" value=\"Apply\"></td>\n";
 	     print "<input type=\"hidden\" name=\"action\" value=\"delete\">\n";
 	     print "<td><a href=\"../index.php\"> <img src=\"../pics/button_cancel.png\" alt=\"cancel\"></a></td></tr>\n";
 	  }
           // close the centered table form
-
-          print "</table></form></center>\n";
-          print "</td></tr>\n";
+          print "</table></form></div>\n";
    }
    $sieve->sieve_logout();
 }
 
 if ($errors) {
-   print "<tr><td><table width=\"100%\" cellspacing=20 cellpadding=0 border=0>\n";
-   print "<tr><td height=20></td></tr>\n";
-   print "<tr><td><h3> There were Errors : </h3></td></tr>\n";
-   print "<tr><td>\n";
-   foreach ($errors as $message) print("<span style=\"color:#FF0000\">".$message."</span><br>"); 
-   print "</td></tr>\n";
-   print "</table>\n";
-   print "</td></tr>\n";
+  print("<TABLE style=\"errors\">\n");
+  print("<TR><TD class=\"head\"> There were Errors : </TD></TR>\n");
+  print("<TR><TD class=\"body\">\n");
+  foreach ($errors as $message) print($message);
+  print("</TD></TR>\n");
+  print("</TABLE>\n");
 }
-?>
-
-</TABLE>
 
-<?php
 Foot(); 
 ?>





More information about the devel mailing list