From 9fee0ed9af6bb1daa3af2ff7290f5589040b4821 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Sun, 16 Oct 2005 15:12:24 -0400
Subject: [PATCH] Fixed folder display; added Portuguese and Catalan

---
 CHANGELOG                        |    8 ++
 program/include/rcube_shared.inc |   19 ++++++
 program/include/main.inc         |   27 +++++++++
 program/lib/imap.inc             |    4 
 program/js/app.js                |   11 ++-
 program/localization/index.inc   |   59 +++++++++++++++++++
 program/include/rcube_imap.inc   |    8 +-
 7 files changed, 125 insertions(+), 11 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index bd121e6..1429671 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -42,3 +42,11 @@
 - Long folder names will not flow over message list (Bug #1267232)
 - Show nested mailboxes hieracically
 - Enable IMAPS by host
+
+
+2005/15/16
+----------
+- Added Portuguese and Catalan translation
+- Make SMTP auth method configurable
+- Make mailboxlist scrollable (Bug #1326372)
+
diff --git a/program/include/main.inc b/program/include/main.inc
index 1c413bb..5eabf75 100644
--- a/program/include/main.inc
+++ b/program/include/main.inc
@@ -423,6 +423,33 @@
   }
 
 
+// read directory program/localization/ and return a list of available languages
+function rcube_list_languages()
+  {
+  global $CONFIG, $INSTALL_PATH;
+  static $sa_languages = array();
+
+  if (!sizeof($sa_languages))
+    {
+    @include_once($INSTLL_PATH.'program/localization/index.inc');
+
+    if ($dh = @opendir($INSTLL_PATH.'program/localization'))
+      {
+      while (($name = readdir($dh)) !== false)
+        {
+        if ($name{0}=='.' || !is_dir($INSTLL_PATH.'program/localization/'.$name))
+          continue;
+
+        if ($label = $rcube_languages[$name])
+          $sa_languages[$name] = $label ? $label : $name;
+        }
+      closedir($dh);
+      }
+    }
+
+  return $sa_languages;
+  }
+
 
 
 // ************** template parsing and gui functions **************
diff --git a/program/include/rcube_imap.inc b/program/include/rcube_imap.inc
index 24cd94a..4c707e3 100644
--- a/program/include/rcube_imap.inc
+++ b/program/include/rcube_imap.inc
@@ -268,7 +268,7 @@
     else
       $count = iil_C_CountMessages($this->conn, $mailbox);
 
-//print "/**** get messagecount for $mailbox ($mode): $count ****/\n";
+// print "/**** get messagecount for $mailbox ($mode): $count ****/\n";
 
     if (is_array($a_mailbox_cache[$mailbox]))
       $a_mailbox_cache[$mailbox] = array();
@@ -312,8 +312,8 @@
       $a_header_index = iil_C_FetchHeaders($this->conn, $mailbox, "1:$max");
       $a_msg_headers = array();
       foreach ($a_header_index as $i => $headers)
-		if (!$headers->deleted)
-			$a_msg_headers[$headers->uid] = $headers;
+      if (!$headers->deleted)
+        $a_msg_headers[$headers->uid] = $headers;
         
 // print "/**** fetch headers ****/\n";
       }
@@ -445,7 +445,7 @@
     $cache_key = $this->mailbox.'.msg';
     if ($this->caching_enabled && $result && ($a_cached_headers = $this->get_cache($cache_key)))
       {
-      // close and re-open connection      
+      // close and re-open connection
       $this->reconnect();
 
       foreach ($uids as $uid)
diff --git a/program/include/rcube_shared.inc b/program/include/rcube_shared.inc
index 21c3ae8..693a2c8 100644
--- a/program/include/rcube_shared.inc
+++ b/program/include/rcube_shared.inc
@@ -1109,6 +1109,9 @@
   if ($text=='')
     $text = $a_text_item['single'];
 
+  // perform utf-8 decoding
+  //if (function_exists('utf8_decode'))
+  //  $text = utf8_decode($text);
 
   // replace vars in text
   if (is_array($attrib['vars']))
@@ -1414,4 +1417,20 @@
 
 
 
+function abbrevate_string($str, $maxlength, $place_holder='...')
+  {
+  $length = strlen($str);
+  $first_part_length = floor($maxlength/2) - strlen($place_holder);
+  
+  if ($length > $maxlength)
+    {
+    $second_starting_location = $length - $maxlength + $first_part_length + 1;
+    $str = substr($str, 0, $first_part_length) . $place_holder . substr($str, $second_starting_location, $length);
+    }
+
+  return $str;
+  }
+  
+
+
 ?>
\ No newline at end of file
diff --git a/program/js/app.js b/program/js/app.js
index fb0c455..18ce674 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -1,4 +1,4 @@
-/*
+/*
  +-----------------------------------------------------------------------+
  | RoundCube Webmail Client Script                                       |
  |                                                                       |
@@ -1006,6 +1006,7 @@
     if (!page && mbox != this.env.mailbox)
       {
       page = 1;
+      add_url += '&_refresh=1';
       this.env.current_page = page;
       this.clear_selection();
       }
@@ -1016,14 +1017,14 @@
     // load message list remotely
     if (this.gui_objects.messagelist)
       {
-      this.list_mailbox_remote(mbox, page);
+      this.list_mailbox_remote(mbox, page, add_url);
       return;
       }
     
     if (this.env.contentframe && window.frames && window.frames[this.env.contentframe])
       {
       target = window.frames[this.env.contentframe];
-      add_url = '&_framed=1';
+      add_url += '&_framed=1';
       }
 
     // load message list to target frame/window
@@ -1036,7 +1037,7 @@
 
 
   // send remote request to load message list
-  this.list_mailbox_remote = function(mbox, page)
+  this.list_mailbox_remote = function(mbox, page, add_url)
     {
     // clear message list
     var table = this.gui_objects.messagelist;
@@ -1050,7 +1051,7 @@
     // send request to server
     var url = '_mbox='+escape(mbox)+(page ? '&_page='+page : '');
     this.set_busy(true, 'loading');
-    this.http_request('list', url);
+    this.http_request('list', url+add_url);
     };
 
 
diff --git a/program/lib/imap.inc b/program/lib/imap.inc
index 7d225c6..22757ba 100644
--- a/program/lib/imap.inc
+++ b/program/lib/imap.inc
@@ -325,7 +325,7 @@
 	}
 	
 	//open socket connection
-	$conn->fp = @fsockopen($host, $ICL_PORT, &$errno, &$errstr, 10);
+	$conn->fp = @fsockopen($host, $ICL_PORT, $errno, $errstr, 10);
 	if (!$conn->fp){
         $iil_error = "Could not connect to $host at port $ICL_PORT: $errstr";
         $iil_errornum = -1;
@@ -1388,7 +1388,7 @@
 		$result=array();
 		reset($index);
 		while (list($key, $val)=each($index)){
-			$result[$i]=$a[$key];
+			$result[$key]=$a[$key];
 			$i++;
 		}
 	}
diff --git a/program/localization/index.inc b/program/localization/index.inc
new file mode 100644
index 0000000..94b07b9
--- /dev/null
+++ b/program/localization/index.inc
@@ -0,0 +1,59 @@
+<?php
+
+/*
+ +-----------------------------------------------------------------------+
+ | program/localization/index.inc                                        |
+ |                                                                       |
+ | This file is part of the RoundCube Webmail client                     |
+ | Copyright (C) 2005, RoundCube Dev, - Switzerland                      |
+ | Licensed under the GNU GPL                                            |
+ |                                                                       |
+ | PURPOSE:                                                              |
+ |   Provide centralized location for keeping track of                   |
+ |   available languages                                                 |
+ |                                                                       |
+ +-----------------------------------------------------------------------+
+ | Author: Thomas Bruederli <roundcube@gmail.com>                        |
+ +-----------------------------------------------------------------------+
+
+ $Id$
+ 
+ */
+ 
+ $rcube_languages = array(
+	'en'    => 'English (US)',
+	'en_GB' => 'English (GB)',
+	'ar'    => 'Arabic',
+	'bg'    => 'Bulgarian',
+	'cat'   => 'Catalan',
+	'tw'    => 'Chinese (BIG5)',
+	'cn'    => 'Chinese(GB2312)',
+	'cz'    => 'Czech',
+ 	'ca'    => 'Catalan',
+	'da'    => 'Dansk',
+ 	'de'    => 'Deutsch',
+ 	'es'    => 'Espa&ntilde;ol',
+	'fr'    => 'Fran&ccedil;ais', 
+	'ga'    => 'Galician',
+	'el'    => 'Greek',
+	'hu'    => 'Hungarian',
+	'it'    => 'Italiano',
+	'jp'    => 'Japanese', 
+	'kr'    => 'Korean',
+	'lt'    => 'Lithuanian',
+	'nl'    => 'Nederlands',
+	'no'    => 'Norsk (bokm&aring;l)',
+	'fa'    => 'Persian',
+	'pl'    => 'Polski',
+	'pt'    => 'Portuguese (Standard)',
+	'pt_BR' => 'Portuguese (Brazilian)',
+	'ro'    => 'Romanian',
+	'ru'    => 'Russian',
+	'fi'    => 'Suomi',
+	'se'    => 'Svenska',
+	'si'    => 'Slovenian',
+	'tr'    => 'Turkish',
+	'vn'    => 'Vietnamese'
+);
+
+?>
\ No newline at end of file

--
Gitblit v1.9.1