home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / tsw / TSW_3.4.0.exe / Apache2 / admin / pref_columns.php < prev    next >
Encoding:
PHP Script  |  2003-08-29  |  5.6 KB  |  158 lines

  1. <?php
  2. /////////////////////////////////////////////////////////
  3. //    
  4. //    source/pref_columns.php
  5. //
  6. //    (C)Copyright 2000-2002 Ryo Chijiiwa <Ryo@IlohaMail.org>
  7. //
  8. //        This file is part of IlohaMail.
  9. //        IlohaMail is free software released under the GPL 
  10. //        license.  See enclosed file COPYING for details,
  11. //        or see http://www.fsf.org/copyleft/gpl.html
  12. //
  13. /////////////////////////////////////////////////////////
  14.  
  15. /********************************************************
  16.  
  17.     AUTHOR: Ryo Chijiiwa <ryo@ilohamail.org>
  18.     FILE: source/pref_columns.php
  19.     PURPOSE:
  20.         Interface for reordering message listing columns
  21.     PRE-CONDITIONS:
  22.         $user - Session ID
  23.         
  24. ********************************************************/
  25.  
  26.     include("../include/super2global.inc");
  27.     include("../include/header_main.inc");
  28.     include("../include/icl.inc");    
  29.     include("../lang/".$my_prefs["lang"]."prefs.inc");
  30.     include("../lang/".$my_prefs["lang"]."main.inc");
  31.     include("../lang/".$my_prefs["lang"]."contacts.inc");
  32.  
  33.     
  34.     //authenticate
  35.     $conn=iil_Connect($host, $loginID, $password, $AUTH_MODE);
  36.     if ($conn){
  37.         if ($ICL_CAPABILITY["folders"]){
  38.             if ($my_prefs["hideUnsubscribed"]){
  39.                 $mailboxes = iil_C_ListSubscribed($conn, $my_prefs["rootdir"], "*");
  40.             }else{
  41.                 $mailboxes = iil_C_ListMailboxes($conn, $my_prefs["rootdir"], "*");
  42.             }
  43.             sort($mailboxes);
  44.         }
  45.         iil_Close($conn);
  46.     }else{
  47.         echo "Authentication failed.";
  48.         echo "</body></html>\n";
  49.         exit;
  50.     }
  51.     
  52.     
  53.     /*
  54.         c: check boxes
  55.         a: attachment
  56.         m: flags
  57.         f: sender/recipient
  58.         s: subject
  59.         d: date
  60.         z: size
  61.     */
  62.     $col_codes = "camfsdz";
  63.     $col_count = strlen($col_codes);
  64.     $col_required = "cfsd";
  65.     $col_label['c'] = $pref_col_label['c'];
  66.     $col_label['a'] = $pref_col_label['a'];
  67.     $col_label['m'] = $pref_col_label['m'];
  68.     $col_label['f'] = $mainStrings[8]."/".$mainStrings[7];
  69.     $col_label['s'] = $mainStrings[6];
  70.     $col_label['d'] = $mainStrings[9];
  71.     $col_label['z'] = $mainStrings[14];
  72.  
  73.     //do stuff
  74.     if (isset($apply)){
  75.         asort($col_order);
  76.         reset($col_order);
  77.         $new_order = "";
  78.         while(list($code,$order)=each($col_order))
  79.             if ($order>0) $new_order.=$code;
  80.         
  81.         $my_prefs["main_cols"] = $new_order;
  82.         include("../include/save_prefs.inc");
  83.     }else if (isset($revert)){
  84.         $my_prefs["main_cols"] = $col_codes;
  85.     }
  86.     
  87.     //show title heading
  88.     echo "\n<table width=\"100%\" cellpadding=2 cellspacing=0><tr bgcolor=\"".$my_colors["main_head_bg"]."\">\n";
  89.     echo "<td align=left valign=bottom>\n";
  90.     echo "<span class=\"bigTitle\">".$pref_col_title."</span>\n";
  91.     echo "   ";
  92.     echo '<span class="mainHeadingSmall">';
  93.     echo '[<a href="javascript:close();" onClick="window.close();" class="mainHeadingSmall">'.$cStrings["close"].'</a>]';
  94.     echo '</span>';
  95.     echo "</td></tr></table>\n";
  96.     
  97. ?>
  98.  
  99. <center>
  100.     <form method="POST" action="pref_columns.php">
  101.     <input type="hidden" name="user" value="<?php echo $user?>">
  102.     <p>
  103.     <table border="0" cellspacing="1" cellpadding="1" bgcolor="#b1b1b9">
  104.         <tr bgcolor="#222244">
  105.             <td><span class="tblheader"><?php echo $pref_colstr["order"]?></span></td>
  106.             <td><span class="tblheader"><?php echo $pref_colstr["field"]?></span></td>
  107.         </tr>
  108.     <?php
  109.         for($i=0;$i<$col_count;$i++){
  110.             $col_code = $col_codes[$i];
  111.             $cur_order = strpos($my_prefs["main_cols"], $col_code);
  112.             if ($cur_order!==false) $cur_order++;
  113.             echo "<tr bgcolor=\"#f0f0f0\">\n";
  114.             echo "\t<td>\n";
  115.             echo "\t\t<select name=\"col_order[$col_code]\">\n";
  116.             if (!ereg("[".$col_code."]", $col_required))
  117.                 echo "\t\t\t<option value=\"\">--\n";
  118.             for ($order=1;$order<=$col_count;$order++)
  119.                 echo "\t\t\t<option value=\"$order\" ".($order==$cur_order?"SELECTED":"").">$order\n";
  120.             echo "\t\t</select>\n";
  121.             echo "\t</td>\n";
  122.             echo "\t<td>\n".$col_label[$col_code]."\n\t</td>\n";
  123.             echo "</tr>\n";
  124.         }
  125.  
  126.     ?>
  127.     </table>
  128.     <?php
  129.         //show preview
  130.         include("../include/main.inc");
  131.         $num_cols = strlen($my_prefs["main_cols"]);
  132.         echo "<p><table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\" bgcolor=\"".$my_colors["main_hilite"]."\">\n";
  133.         echo "<tr bgcolor=\"".$my_colors["main_head_bg"]."\">\n";
  134.             $check_link="<SCRIPT type=\"text/javascript\" language=JavaScript1.2><!-- Make old browsers think this is a comment.\n";
  135.             $check_link.="document.write(\"<a href=javascript:SelectAllMessages(true) class='tblheader'><b>+</b></a><span class=tblheader>|</span><a href=javascript:SelectAllMessages(false) class=tblheader><b>-</b></a>\")";
  136.             $check_link.="\n--></SCRIPT><NOSCRIPT>";
  137.             $check_link.="<a href=\"main.php?folder=".urlencode($folder)."&start=$start&user=$user&sort_field=$sort_field&sort_order=$sort_order&check_all=1\"><b>+</b></a>|";
  138.              $check_link.="<a href=\"main.php?folder=".urlencode($folder)."&start=$start&user=$user&sort_field=$sort_field&sort_order=$sort_order&uncheck_all=1\"><b>-</b></a>";
  139.             $check_link.="</NOSCRIPT>";
  140.             $tbl_header["c"] = "\n<td>$check_link</td>";
  141.             $tbl_header["s"] = "\n<td>".FormFieldHeader("subject", $mainStrings[6])."</td>";
  142.             $tbl_header["f"] = "\n<td>".FormFieldHeader("from", $mainStrings[8])."</td>";
  143.             $tbl_header["d"] = "\n<td>".FormFieldHeader("date", $mainStrings[9])."</td>";
  144.             $tbl_header["z"] = "\n<td>".FormFieldHeader("size", $mainStrings[14])."</td>";
  145.             $tbl_header["a"] = "<td><img src=\"themes/".$my_prefs["theme"]."/images/att.gif\"></td>";
  146.             $tbl_header["m"] = "<td><img src=\"themes/".$my_prefs["theme"]."/images/reply.gif\"></td>";
  147.             for ($i=0;$i<$num_cols;$i++) echo $tbl_header[$my_prefs["main_cols"][$i]];
  148.         echo "\n</tr>\n";
  149.         echo "</table>\n";
  150.     ?>
  151.     <input type="submit" name="apply" value="<?php echo $prefsButtonStrings[1]?>">
  152.     <input type="submit" name="revert" value="<?php echo $prefsButtonStrings[3]?>">
  153.     </form>
  154.     
  155. </center>
  156.  
  157. </BODY></HTML>
  158.