[Kolab-devel] server/kolab/kolab/admin/administrator create_administrator.php,1.6,1.7 head.php,1.5,1.6 index.php,1.7,1.8 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/administrator
In directory doto:/tmp/cvs-serv24612/administrator

Modified Files:
	create_administrator.php head.php index.php 
Log Message:
Martin K.: Merged css stuff from Konsec


Index: create_administrator.php
===================================================================
RCS file: /kolabrepository/server/kolab/kolab/admin/administrator/create_administrator.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- create_administrator.php	22 May 2003 17:50:35 -0000	1.6
+++ create_administrator.php	14 Jun 2003 17:06:31 -0000	1.7
@@ -13,7 +13,6 @@
     include("../include/checks.php");
 ?>
 
-<TABLE WIDTH="100%" CELLSPACING=0 CELLPADDING=0 BORDER=0>
 
 <?
 function debug ($a) 
@@ -35,10 +34,9 @@
 if (!empty($HTTP_GET_VARS['dn'])) $dn = trim(urldecode($HTTP_GET_VARS['dn']));
 
 if (strcmp($dn,"cn=manager,".$_SESSION['base_dn']) == 0) {
-   print("<TR><TD HEIGHT=20></TD></TR>\n");
-   print("<tr><td><span style=\"color:#FF0000\">"); 
+   print("<span class=\"warning\">"); 
    print("Error: The Administrator Account 'manager' is internally used and may not be changed");
-   print("</span></td></tr></table>");
+   print("</span>");
    Foot();
    exit;
 }
@@ -183,11 +181,11 @@
       elseif ($group != "admin") 
          array_push($errors, "Error: you need administrative permissions to delete administrators");
       if (!$errors) {    
-         print("<TR><TD><center><H1> Delete Administrator </H1></center></TD></TR>\n");
+         print("<div class=\"maintitle\"> Delete Administrator </div>\n");
          if (!(ldap_delete($link,$dn))) 
             array_push($errors, "LDAP Error: could not delete ".utf8_decode($dn)." ".ldap_error($link));
          else {
-           print("<tr><td><center> The object ".utf8_decode($dn)." is deleted </td></tr>\n");
+           print("<div class=\"message\"> The object ".utf8_decode($dn)." is deleted </div>\n");
            if (!ldap_mod_del($link, "cn=admin,".$_SESSION['base_dn'], $oldmemberline))
               array_push($errors, "LDAP Error: could not update admin group ".ldap_error($link));
          }
@@ -201,7 +199,7 @@
             if (!empty($HTTP_GET_VARS['uid'])) {
                $ldap_object['uid'] = trim(urldecode($HTTP_GET_VARS['uid']));
             } else {
-               $comment['uid'] = "<span style=\"color:#FF0000\"> Fill in uid </span>";
+               $comment['uid'] = "<span class=\"warning\"> Fill in uid </span>";
                missing_input();
             }
 
@@ -210,39 +208,39 @@
             if ($action == "save" && !$dn) array_push($errors, "Internal Error: need dn to save");
             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\"> Password do not match </span>";
+                  $comment['password_1'] = "<span class=\"warning\"> Password do not match </span>";
                   missing_input();
                }
             }
             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['sn'])) {
                $ldap_object['sn'] = trim(urldecode($HTTP_GET_VARS['sn']));
                if (isset($firstname)) $ldap_object['cn'] = $firstname." ".$ldap_object['sn'];
             } else {
-               $comment['sn'] = "<span style=\"color:#FF0000\"> Fill in lastname </span>";
+               $comment['sn'] = "<span class=\"warning\"> Fill in lastname </span>";
                missing_input();
             }
 
             $ldap_object = to_utf8($ldap_object);
             if (!empty($ldap_object['uid']) && !is_unique('uid', $ldap_object['uid'])) {
-               $comment['uid'] = "<span style=\"color:#FF0000\"> Error: This uid is already taken by another user </span>";
+               $comment['uid'] = "<span class=\"warning\"> Error: This uid is already taken by another user </span>";
                missing_input();
             }
 
@@ -275,7 +273,7 @@
                }
                if ($errors) {
                   $action = "create";
-                  print("<TR><TD><center><H1> Create New Administrator </H1></center></TD></TR>\n");
+                  print("<div class=\"maintitle\"> Create New Administrator </div>\n");
 		  $ldap_object = from_utf8($ldap_object);
                   break;
                }
@@ -287,19 +285,19 @@
             if (!ldap_mod_add($link, "cn=admin,".$_SESSION['base_dn'], $memberline))
                array_push($errors, "LDAP Error: could not add new info to maintainer group ".ldap_error($link));
             $action = "modify";
-            print("<TR><TD><center><H1> Modify Existing Administrator </H1></center></TD></TR>\n");
+            print("<div class=\"maintitle\"> Modify Existing Administrator </div>\n");
             break;
 
          case "create":
-            print("<TR><TD><center><H1> Create New Administrator </H1></center></TD></TR>\n");
+            print("<div class=\"maintitle\"> Create New Administrator </div>\n");
             break;
 
          case "modify":
-            print("<TR><TD><center><H1> Modify Existing Administrator </H1></center></TD></TR>\n");
+            print("<div class=\"maintitle\"> Modify Existing Administrator </div>\n");
 	    break;
 
 	 case "delete":
-	    print("<TR><TD><center><H1> Confirm Delete Administrator </H1></center></TD></TR>\n");
+	    print("<div class=\"maintitle\"> Confirm Delete Administrator </div>\n");
       }
       if ($dn) {
          if (($result = ldap_read($link, $dn, "(objectclass=*)")) &&
@@ -319,7 +317,7 @@
 
 if ($action != "kill") {
 
-print "<TR><TD><CENTER><form action=\"$myself\" method=\"GET\">\n";
+print "<div class=\"contenttable\"><form action=\"$myself\" method=\"GET\">\n";
 switch ($action) {
    case "create":
       print("<input type=\"hidden\" name=\"action\" value=\"firstsave\">\n");
@@ -331,7 +329,7 @@
       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");
+   print("<TABLE class=\"contentform\" nosave>\n");
 
 if (is_array($ldap_object['sn'])) $lastname = $ldap_object['sn'][0];
    else $lastname = $ldap_object['sn'];
@@ -380,31 +378,28 @@
 }
 print("</td>");
 if ($action != "delete") print("<td>".(comment('uid'))."</td>\n");
-print("</tr></table></CENTER></TD><TR>\n");
+print("</tr></table>\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("</table>\n");
+print("</table></div>\n");
 
 }  // if $action != delete
 
 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");
 }
 
-print("</TABLE>\n");
 
 Foot();
 ?>

Index: head.php
===================================================================
RCS file: /kolabrepository/server/kolab/kolab/admin/administrator/head.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- head.php	22 May 2003 17:50:35 -0000	1.5
+++ head.php	14 Jun 2003 17:06:31 -0000	1.6
@@ -21,6 +21,5 @@
 
 	idxPrefix("../");
 	Mainhead("- Manage Administrators".$title);
-        print("<IMG SRC=\"../pics/kolab_logo.gif\">");
     }
 ?>

Index: index.php
===================================================================
RCS file: /kolabrepository/server/kolab/kolab/admin/administrator/index.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- index.php	22 May 2003 17:50:35 -0000	1.7
+++ index.php	14 Jun 2003 17:06:31 -0000	1.8
@@ -9,14 +9,6 @@
     This("administrator/");
     Head();
 
-?>
-
-<TABLE WIDTH="100%" CELLSPACING=0 CELLPADDING=0 BORDER=0>
-<TR><TD HEIGHT=20></TD></TR>
-<TR><TD><center><H1> Manage Administrators </H1></center></TD></TR>
-
-<?
-
 $utf8 = array ( 'cn', 'sn' );
 
 $errors = array();
@@ -32,7 +24,13 @@
 
 // read selector for register display
 if (isset($HTTP_GET_VARS['alphaselect'])) $alphaselect = $HTTP_GET_VARS['alphaselect'];
-   else $alphaselect = "[A-F]";
+   else $alphaselect = "[all]";
+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' ;
 
 $myself = $_SERVER['PHP_SELF'];
 
@@ -43,63 +41,147 @@
    else $ldap_port = 389;
 
 if (!$errors && !($link = ldap_connect($ldap_server,$ldap_port)) || !ldap_bind($link)) 
-   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=*)(|(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("AÄ")."*)(sn=".utf8_encode("Aä")."*)";
-      $filter = $filter."))";
-      break;
+   array_push($errors, "Communication Error: could not query ldap://$ldap_server:$ldap_port ".ldap_error($link));
 
-   case "[G-L]":
-      $filter = "(&(cn=*)(objectclass=inetOrgPerson)(uid=*)(|(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;
+// get all entries & dynamically split the letters with growing entries
+	$filter = "(&(cn=*)(objectclass=inetOrgPerson)(uid=*)(sn=*))";
+	$result = ldap_search($link, $base_dn, $filter);
+	
+	// counting all entries
+	if ($result) {
+	ldap_sort($link,$result,'sn');
+	$entry = ldap_first_entry($link, $result);
+	$entries = 0;
+		while ($entry) {   
+			$dn = ldap_get_dn($link,$entry);
+			$attrs = ldap_get_attributes($link, $entry);
+			$userid = $attrs['uid'][0];
+         	$gid = uid2group($userid);
+			if ($gid == "admin") {
+				$entries++;
+			}
+			$entry = ldap_next_entry($link, $entry);
+		} 
+		ldap_free_result($result);
+	} else array_push($errors, "Communication Error: ldap server did not answer query for user information");
 
-   case "[M-S]":
-      $filter = "(&(cn=*)(objectclass=inetOrgPerson)(uid=*)(|(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("AÖ")."*)(sn=".utf8_encode("Aö")."*)".
-                                                   "(sn=".utf8_encode("AÜ")."*)(sn=".utf8_encode("Aü")."*)";
-      $filter = $filter."))";
-      break;
+if (!$errors) {
+	printf("<div class=\"maintitle\">Manage Administrators (%s Administrators)</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");
 
-   case "[T-Z]":
-      $filter = "(&(cn=*)(objectclass=inetOrgPerson)(uid=*)(|(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;
+		for ($i = 65; $i < 91; $i++) {
+			switch ($alphaselect) {
+				case "[".chr($i)."]":
+					$filter = "(&(cn=*)(objectclass=inetOrgPerson)(uid=*)(|(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;
+			}
+		}
+	}
+	// 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=*)(|(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=*)(|(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=*)(|(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=*)(|(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=*)(sn=*))";
+				break;
+			}
+		
+	}
+	// if there are less than 50 entries, all entries are shown - w/o options
+	else { echo "<div class=\"alphabetlisting\"></div>\n"; $alphaselect = "[all]"; $filter = "(&(cn=*)(objectclass=inetOrgPerson)(uid=*)(sn=*))"; }
 
-   default: 
-      $filter = "(&(cn=*)(objectclass=inetOrgPerson)(uid=*)(sn=*))";
-      break;
 }
 
-if (!$errors) {
 
-$result = ldap_search($link, $_SESSION['base_dn'], $filter);
+if (!$errors) {
+	$result = ldap_search($link, $base_dn, $filter);
+	$entries = 0;
+	ldap_sort($link,$result,'sn');
+	$entry = ldap_first_entry($link, $result);
+	while ($entry) {   
+		$dn = ldap_get_dn($link,$entry);
+		$attrs = ldap_get_attributes($link, $entry);
+		$userid = $attrs['uid'][0];
+		$gid = uid2group($userid);
+        if ($gid == "admin")
+			$entries = $entries+1;
+       	$entry = ldap_next_entry($link, $entry);
+    }
+	ldap_free_result($result);
+	$result = ldap_search($link, $base_dn, $filter);
+// 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) {
-   print("<tr><td><form method=\"POST\" action=\"$myself\">\n<center><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");
-   print("<TD ALIGN=center>\n");
-
-   print("<TABLE WIDTH=95% BORDER=1 CELLSPACING=0 bgcolor=\"#dcdcdc\" CELLPADDING=3 nosave>\n");
+   print("<div class=\"contenttable\">");
+   print("<TABLE class=\"content\" nosave>\n");
    ldap_sort($link,$result,'sn');
-   $entry = ldap_first_entry($link, $result);
+	$entry = ldap_first_entry($link, $result);
       $first=0;
+	  $skip = 0;
       while ($entry) {   
          $dn = ldap_get_dn($link,$entry);
          $attrs = ldap_get_attributes($link, $entry);
@@ -113,37 +195,65 @@
          $fn = substr($cn, 0, $b - $a);
          $gid = uid2group($userid);
          if ($gid == "admin") {
-            if ($dn != "cn=manager,".$_SESSION['base_dn']) {
-               $userid = urlencode($userid);
-               $dn = urlencode($dn);
-	       if ($first == 0) printf("<thead><td><b> Name </b></td><td><b>UID</b></td><td><b> Action </b></td></thead>\n");
-               $first++;
-               printf("<tr align=center><td> %s, %s </td><td> %s </td><td>
-                       <a href=\"create_administrator.php?action=modify&dn=%s\"> [Modify]</a>
-                       <a href=\"create_administrator.php?action=delete&dn=%s\"> [Delete]</a>
-	               </td></tr>\n", $sn, $fn, $userid, $dn,$dn);
-            } else printf("<tr align=center><td> %s </td><td> %s </td><td></td>  </tr>\n", $sn, $userid);
+			// skipping to correct page and start with first entry
+			if ($skip <= ($page-1)*$views) {
+				$entry = ldap_next_entry($link, $entry);
+			}
+			else {
+				// counts the entries, which are already listed on this page and breaks on overflow
+				if ($countentries < $views) {
+					if ($dn != "cn=manager,".$_SESSION['base_dn']) {
+					$userid = urlencode($userid);
+					$dn = urlencode($dn);
+					if ($first == 0) printf("<thead><td class=\"content\"> Name </td><td class=\"content\"> UID </td><td class=\"content\"> Action </td></thead>\n");
+						$first++;
+						printf("<tr><td class=\"content\"> %s, %s </td><td class=\"content\"> %s </td><td class=\"contentaction\">
+	            	        <a href=\"create_administrator.php?action=modify&dn=%s\"> [Modify]</a>
+    	    	            <a href=\"create_administrator.php?action=delete&dn=%s\"> [Delete]</a>
+							</td></tr>\n", $sn, $fn, $userid, $dn,$dn);
+					} else printf("<tr><td class=\"content\"> %s </td><td class=\"content\"> %s </td><td class=\"content\">   </td></tr>\n", $sn, $userid);
+				}
+				$countentries++;
+			}
          }
-         $entry = ldap_next_entry($link, $entry);
+		$skip++;
+		$entry = ldap_next_entry($link, $entry);
       } 
       ldap_free_result($result);
-  if ($first == 0) print("<tr><td align=center> (No administrators in the category $alphaselect) </td></tr>\n"); 
+  if ($first == 0) print("<tr><td class=\"nocontent\"> (No administrators in the category $alphaselect) </td></tr>\n"); 
   ldap_close($link);
 } else array_push($errors, "Communication Error: ldap server did not answer query for user information");
 
 } // if !$errors
 
-print("</table>\n");
+print("</table>\n<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></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");
 }
+
 
 Foot(); 
 ?>





More information about the devel mailing list