From a8d23d82a296cab71bd2f2b71dad6dca58a643d6 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Tue, 12 Feb 2008 13:41:53 -0500
Subject: [PATCH] Show message count in folder list and hint when creating a subfolder

---
 program/localization/de_DE/labels.inc      |    1 
 program/localization/de_DE/messages.inc    |    2 +
 skins/default/common.css                   |    5 ++
 skins/default/settings.css                 |   39 ++++++++++++++-----
 program/localization/de_CH/messages.inc    |    1 
 program/localization/en_US/messages.inc    |    2 +
 program/localization/en_US/labels.inc      |    1 
 skins/default/templates/managefolders.html |    3 +
 program/localization/de_CH/labels.inc      |    1 
 program/steps/settings/manage_folders.inc  |   27 ++++++++-----
 program/js/app.js                          |    9 +++-
 11 files changed, 65 insertions(+), 26 deletions(-)

diff --git a/program/js/app.js b/program/js/app.js
index 2c212a8..07b42a5 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -2551,6 +2551,9 @@
       this.set_env('folder', folder);
     else
       this.set_env('folder', null);
+      
+    if (this.gui_objects.createfolderhint)
+      this.gui_objects.createfolderhint.innerHTML = this.env.folder ? this.get_label('addsubfolderhint') : '';
     };
 
 
@@ -2573,13 +2576,13 @@
   // tell server to create and subscribe a new mailbox
   this.create_folder = function(name)
     {
-  if (this.edit_folder)
-    this.reset_folder_rename();
+    if (this.edit_folder)
+      this.reset_folder_rename();
 
     var form;
     if ((form = this.gui_objects.editform) && form.elements['_folder_name'])
       name = form.elements['_folder_name'].value;
-    if (this.env.folder)
+    if (this.env.folder && name != '')
       name = this.env.folder+this.env.delimiter+name;
 
     if (name)
diff --git a/program/localization/de_CH/labels.inc b/program/localization/de_CH/labels.inc
index 3d2c815..018bf4e 100644
--- a/program/localization/de_CH/labels.inc
+++ b/program/localization/de_CH/labels.inc
@@ -227,6 +227,7 @@
 $labels['folders']  = 'Ordner';
 $labels['foldername']  = 'Ordnername';
 $labels['subscribed']  = 'Abonniert';
+$labels['messagecount'] = 'Nachrichten';
 $labels['create']      = 'Erstellen';
 $labels['createfolder']  = 'Neuen Ordner erstellen';
 $labels['rename'] = 'Umbenennen';
diff --git a/program/localization/de_CH/messages.inc b/program/localization/de_CH/messages.inc
index 90bffee..91779ab 100644
--- a/program/localization/de_CH/messages.inc
+++ b/program/localization/de_CH/messages.inc
@@ -74,5 +74,6 @@
 $messages['copyerror'] = 'Die Adressen konnten nicht kopiert werden';
 $messages['sourceisreadonly'] = 'Das Adressverzeichnis kann nicht verändert werden';
 $messages['errorsavingcontact'] = 'Die Änderungen konnten nicht gespeichert werden';
+$messages['addsubfolderhint'] = 'Wird als Unterdornder des aktuell selektieren Ordners erstellt';
 
 ?>
\ No newline at end of file
diff --git a/program/localization/de_DE/labels.inc b/program/localization/de_DE/labels.inc
index 409c4af..d74c296 100644
--- a/program/localization/de_DE/labels.inc
+++ b/program/localization/de_DE/labels.inc
@@ -178,6 +178,7 @@
 $labels['folders'] = 'Ordner';
 $labels['foldername'] = 'Ordnername';
 $labels['subscribed'] = 'Abonniert';
+$labels['messagecount'] = 'Nachrichten';
 $labels['create'] = 'Erstellen';
 $labels['createfolder'] = 'Neuen Ordner erstellen';
 $labels['rename'] = 'Umbenennen';
diff --git a/program/localization/de_DE/messages.inc b/program/localization/de_DE/messages.inc
index 2ef66ac..90537f6 100644
--- a/program/localization/de_DE/messages.inc
+++ b/program/localization/de_DE/messages.inc
@@ -77,4 +77,6 @@
 $messages['receiptsent'] = 'Bestätigung erfolgreich gesendet';
 $messages['errorsendingreceipt'] = 'Bestätigung konnte nicht gesendet werden';
 $messages['nodeletelastidentity'] = 'Sie koennen diesen Absender nicht loeschen.';
+$messages['addsubfolderhint'] = 'Wird als Unterdornder des aktuell selektieren Ordners erstellt';
+
 ?>
diff --git a/program/localization/en_US/labels.inc b/program/localization/en_US/labels.inc
index 533e40f..9a9c841 100644
--- a/program/localization/en_US/labels.inc
+++ b/program/localization/en_US/labels.inc
@@ -231,6 +231,7 @@
 $labels['folders']  = 'Folders';
 $labels['foldername']  = 'Folder name';
 $labels['subscribed']  = 'Subscribed';
+$labels['messagecount'] = 'Messages';
 $labels['create']  = 'Create';
 $labels['createfolder']  = 'Create new folder';
 $labels['rename'] = 'Rename';
diff --git a/program/localization/en_US/messages.inc b/program/localization/en_US/messages.inc
index 5ee04d7..4a35541 100644
--- a/program/localization/en_US/messages.inc
+++ b/program/localization/en_US/messages.inc
@@ -77,4 +77,6 @@
 $messages['receiptsent'] = 'Successfully sent a read receipt';
 $messages['errorsendingreceipt'] = 'Could not send the receipt';
 $messages['nodeletelastidentity'] = 'You cannot delete this identity, it\'s your last one.';
+$messages['addsubfolderhint'] = 'This folder will be created as subfolder of the currently selected one';
+
 ?>
\ No newline at end of file
diff --git a/program/steps/settings/manage_folders.inc b/program/steps/settings/manage_folders.inc
index e457dad..fb6ee14 100644
--- a/program/steps/settings/manage_folders.inc
+++ b/program/steps/settings/manage_folders.inc
@@ -5,7 +5,7 @@
  | program/steps/settings/manage_folders.inc                             |
  |                                                                       |
  | This file is part of the RoundCube Webmail client                     |
- | Copyright (C) 2005-2007, RoundCube Dev. - Switzerland                 |
+ | Copyright (C) 2005-2008, RoundCube Dev. - Switzerland                 |
  | Licensed under the GNU GPL                                            |
  |                                                                       |
  | PURPOSE:                                                              |
@@ -159,9 +159,9 @@
 
   // add table header
   $out .= "<thead><tr>\n";
-  $out .= sprintf('<td class="name">%s</td><td class="subscribed">%s</td>'.
+  $out .= sprintf('<td class="name">%s</td><td class="msgcount">%s</td><td class="subscribed">%s</td>'.
                   '<td class="rename">&nbsp;</td><td class="delete">&nbsp;</td>',
-                  rcube_label('foldername'), rcube_label('subscribed'));
+                  rcube_label('foldername'), rcube_label('messagecount'), rcube_label('subscribed'));
                   
   $out .= "\n</tr></thead>\n<tbody>\n";
 
@@ -201,20 +201,21 @@
     if (!$protected)
       $a_js_folders['rcmrow'.($i+1)] = array($folder, rcube_charset_convert($folder, 'UTF-7'));
 
-    $out .= sprintf('<tr id="rcmrow%d" class="%s"><td>%s</td>',
+    $out .= sprintf('<tr id="rcmrow%d" class="%s"><td class="name">%s</td><td class="msgcount">%d</td>',
                     $i+1,
                     $zebra_class,
-                    Q($folder_html));
+                    Q($folder_html),
+                    $IMAP->messagecount($folder));
                     
     if ($protected)
-      $out .= '<td>&nbsp;'.($subscribed ? '&#x2022;' : '-').'</td>';
+      $out .= '<td class="subscribed">&nbsp;'.($subscribed ? '&#x2022;' : '-').'</td>';
     else
-      $out .= '<td>'.$checkbox_subscribe->show($subscribed?$folder:'', array('value' => $folder)).'</td>';
+      $out .= '<td class="subscribed">'.$checkbox_subscribe->show($subscribed?$folder:'', array('value' => $folder)).'</td>';
 
     // add rename and delete buttons
     if (!$protected)
-      $out .= sprintf('<td><a href="#rename" title="%s">%s</a>'.
-                      '<td><a href="#delete" title="%s">%s</a></td>',
+      $out .= sprintf('<td class="rename"><a href="#rename" title="%s">%s</a>'.
+                      '<td class="delete"><a href="#delete" title="%s">%s</a></td>',
                       rcube_label('renamefolder'),
                       $edit_button,
                       rcube_label('deletefolder'),
@@ -239,9 +240,13 @@
 
 function rcube_create_folder_form($attrib)
   {
+  global $OUTPUT;
+  
   list($form_start, $form_end) = get_form_tags($attrib, 'create-folder');
   unset($attrib['form']);
 
+  if ($attrib['hintbox'])
+    $OUTPUT->add_gui_object('createfolderhint', $attrib['hintbox']);
 
   // return the complete edit form as table
   $out = "$form_start\n";
@@ -298,7 +303,7 @@
     }
 
   $out .= "\n$form_end";
-
+  
   return $out;
   }
 
@@ -311,7 +316,7 @@
 ));
 
 // add some labels to client
-rcube_add_label('deletefolderconfirm');
+rcube_add_label('deletefolderconfirm','addsubfolderhint');
 
 $OUTPUT->send('managefolders');
 ?>
diff --git a/skins/default/common.css b/skins/default/common.css
index 308953b..82e1d40 100644
--- a/skins/default/common.css
+++ b/skins/default/common.css
@@ -107,6 +107,11 @@
   font-size: 11px;
 }
 
+.hint
+{
+  color: #666;
+  font-size: 11px;
+}
 
 /** common user interface objects */
 
diff --git a/skins/default/settings.css b/skins/default/settings.css
index 53e948c..3d18296 100644
--- a/skins/default/settings.css
+++ b/skins/default/settings.css
@@ -69,8 +69,8 @@
 
 #folder-manager
 {
-  width: 500px;
-  bottom: 120px;
+  width: 540px;
+  bottom: 140px;
   overflow: auto;
   border: 1px solid #999999;
   height: expression((parseInt(document.documentElement.clientHeight)-215)+'px');
@@ -119,8 +119,8 @@
 #bottomboxes
 {
   position: absolute;
-  width: 500px;
-  height: 100px;
+  width: 540px;
+  height: 120px;
   left: 20px;
   bottom: 20px;
 }
@@ -142,7 +142,7 @@
 
 div.settingsbox
 {
-  width: 500px;
+  width: 540px;
   margin-top: 20px;
   margin-bottom: 20px;
   border: 1px solid #999999;
@@ -157,13 +157,12 @@
 #subscription-table
 {
   width: 100%;
-  table-layout: fixed;
 }
 
 #subscription-table tbody td
 {
   padding-left: 6px;
-  padding-right: 20px;
+  padding-right: 10px;
   white-space: nowrap;
   border-bottom: 1px solid #EBEBEB;
   background-color: #F9F9F9;
@@ -183,12 +182,30 @@
   background-color: #FFFFA6;
 }
 
-#subscription-table td.name
+#subscription-table thead td.name
 {
-  width: 280px;
+  width: 240px;
 }
 
-#subscription-table td.subscribed
+#subscription-table thead td.msgcount
 {
-  width: 80px;
+  width: 70px;
+}
+
+#subscription-table thead td.subscribed
+{
+  width: 60px;
+}
+
+#subscription-table tbody td.msgcount,
+#subscription-table tbody td.subscribed
+{
+  padding-left: 18px;
+}
+
+#subscription-table thead td.rename,
+#subscription-table thead td.delete
+{
+  width: 20px;
+  text-align: center;
 }
diff --git a/skins/default/templates/managefolders.html b/skins/default/templates/managefolders.html
index 93f3caa..1637972 100644
--- a/skins/default/templates/managefolders.html
+++ b/skins/default/templates/managefolders.html
@@ -26,8 +26,9 @@
 
 <div class="settingspart">
 <roundcube:label name="foldername" />:&nbsp;
-<roundcube:object name="createfolder" form="subscriptionform" />
+<roundcube:object name="createfolder" form="subscriptionform" hintbox="rcmailaddfolderhint" />
 <roundcube:button command="create-folder" type="input" class="button" label="create" />
+<div id="rcmailaddfolderhint" class="hint" style="margin-top:1em; height:16px"></div>
 </div>
 </div>
 

--
Gitblit v1.9.1