POP3 fixes
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 1 Sep 2010 19:45:19 +0000 (13:45 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 1 Sep 2010 20:12:58 +0000 (14:12 -0600)
imp/js/dimpbase.js
imp/js/dimpcore.js
imp/lib/Ajax/Application.php
imp/lib/Views/ListMessages.php
imp/lib/Views/ShowMessage.php
imp/templates/dimp/index.inc
imp/templates/dimp/javascript_defs_dimp.php
imp/themes/dimp/screen.css

index 2cc00d8..3c67b61 100644 (file)
@@ -302,7 +302,7 @@ var DimpBase = {
         var url = DIMP.conf.URI_MESSAGE;
         url += (url.include('?') ? '&' : '?') +
                $H({ folder: r.view,
-                    uid: Number(r.imapuid) }).toQueryString();
+                    uid: r.imapuid }).toQueryString();
         DimpCore.popupWindow(url, 'msgview' + r.view + r.imapuid);
     },
 
@@ -354,7 +354,7 @@ var DimpBase = {
             }
         }
 
-        this.viewport.loadView(f, { search: (this.uid ? { imapuid: Number(this.uid) } : null), background: opts.background});
+        this.viewport.loadView(f, { search: (this.uid ? { imapuid: this.uid } : null), background: opts.background});
 
         if (need_delete) {
             this.viewport.deleteView(need_delete);
@@ -1538,15 +1538,20 @@ var DimpBase = {
     // 'noload' = (boolean) If true, don't load the mailbox
     quicksearchClear: function(noload)
     {
-        var f = this.folder;
+        var f = this.folder,
+            qs = $('qsearch');
 
-        if (!$('qsearch').hasClassName('qsearchFocus')) {
+        if (!qs) {
+            return;
+        }
+
+        if (!qs.hasClassName('qsearchFocus')) {
             this._setQsearchText(true);
         }
 
         if (this.isSearch()) {
             this.resetSelected();
-            $('qsearch', 'qsearch_icon', 'qsearch_input').invoke('show');
+            $(qs, 'qsearch_icon', 'qsearch_input').invoke('show');
             if (!noload) {
                 this.loadMailbox(this.search ? this.search.mbox : 'INBOX');
             }
@@ -2297,6 +2302,8 @@ var DimpBase = {
 
     _folderLoadCallback: function(r, callback)
     {
+        var nf = $('normalfolders');
+
         if (r.response.expand) {
             this.expandfolder = true;
         }
@@ -2316,7 +2323,7 @@ var DimpBase = {
         $('foldersLoading').hide();
         $('foldersSidebar').show();
 
-        if ($('normalfolders').getStyle('max-height') !== null) {
+        if (nf && nf.getStyle('max-height') !== null) {
             this._sizeFolderlist();
         }
 
@@ -2662,7 +2669,9 @@ var DimpBase = {
     _sizeFolderlist: function()
     {
         var nf = $('normalfolders');
-        nf.setStyle({ height: (document.viewport.getHeight() - nf.cumulativeOffset()[1]) + 'px' });
+        if (nf) {
+            nf.setStyle({ height: (document.viewport.getHeight() - nf.cumulativeOffset()[1]) + 'px' });
+        }
     },
 
     toggleSubscribed: function()
index cf7ae94..3adadf9 100644 (file)
@@ -44,13 +44,13 @@ var DimpCore = {
                 return;
             }
 
-            var u = o.value.numericSort(),
+            var u = (DIMP.conf.pop3 ? o.value : o.value.numericSort()),
                 first = u.shift(),
                 last = first,
                 out = [];
 
             u.each(function(k) {
-                if (last + 1 == k) {
+                if (!DIMP.conf.pop3 && (last + 1 == k)) {
                     last = k;
                 } else {
                     out.push(first + (last == first ? '' : (':' + last)));
@@ -93,8 +93,9 @@ var DimpCore = {
             uidstr.split(',').each(function(e) {
                 var r = e.split(':');
                 if (r.size() == 1) {
-                    uids.push(Number(e));
+                    uids.push(DIMP.conf.pop3 ? e : Number(e));
                 } else {
+                    // POP3 will never exist in range here.
                     uids = uids.concat($A($R(Number(r[0]), Number(r[1]))));
                 }
             });
index 82e4841..40a15b4 100644 (file)
@@ -907,7 +907,7 @@ class IMP_Ajax_Application extends Horde_Core_Ajax_Application
         $args = array(
             'mailbox' => $mbox,
             'preview' => true,
-            'uid' => intval($idx)
+            'uid' => $idx
         );
         $result = new stdClass;
         $result->preview = new stdClass;
@@ -1381,10 +1381,10 @@ class IMP_Ajax_Application extends Horde_Core_Ajax_Application
 
         $result = $this->showPreview();
         $new_indices_list = $new_indices->getSingle();
-        $result->newuid = intval($new_indices_list[1]);
+        $result->newuid = $new_indices_list[1];
         $old_indices_list = $indices->getSingle();
         $result->oldmbox = $old_indices_list[0];
-        $result->olduid = intval($old_indices_list[1]);
+        $result->olduid = $old_indices_list[1];
         $result->ViewPort = $this->_viewPortData(true);
 
         return $result;
index fdf16de..7b3e2bf 100644 (file)
@@ -374,7 +374,7 @@ class IMP_Views_ListMessages
         while (list(,$ob) = each($overview['overview'])) {
             /* Initialize the header fields. */
             $msg = array(
-                'imapuid' => intval($ob['uid']),
+                'imapuid' => (($_SESSION['imp']['protocol'] == 'pop') ? $ob['uid'] : intval($ob['uid'])),
                 'view' => $ob['mailbox'],
             );
 
index be15744..11a9fb7 100644 (file)
@@ -100,7 +100,7 @@ class IMP_Views_ShowMessage
         $result = array(
             'js' => array(),
             'mailbox' => $mailbox,
-            'uid' => intval($uid)
+            'uid' => $uid
         );
 
         /* Set the current time zone. */
index 612ce4c..b2788d9 100644 (file)
@@ -114,6 +114,7 @@ function _simpleButton($id, $text, $image, $nodisplay = false)
      </ul>
     </div>
 <?php endif; ?>
+<?php if ($_SESSION['imp']['protocol'] != 'pop'): ?>
     <div class="sepfull"></div>
     <ul class="folderlist" id="normalfolders">
      <li class="folder" id="folderopts">
@@ -125,6 +126,7 @@ function _simpleButton($id, $text, $image, $nodisplay = false)
       <a title="<?php echo _("Move to Base Level") ?>"><?php echo _("Move to Base Level") ?></a>
      </li>
     </ul>
+<?php endif; ?>
    </div>
   </div>
 
index 2792a23..c699a12 100644 (file)
@@ -66,6 +66,7 @@ $code['conf'] = array_filter(array(
     'login_view' => $GLOBALS['prefs']->getValue('dimp_login_view'),
     'mbox_expand' => intval($GLOBALS['prefs']->getValue('nav_expanded') == 2),
     'name' => $GLOBALS['registry']->get('name', 'imp'),
+    'pop3' => intval((isset($_SESSION['imp']) && ($_SESSION['imp']['protocol'] == 'pop'))),
     'popup_height' => 610,
     'popup_width' => 820,
     'preview_pref' => ($GLOBALS['prefs']->getValue('dimp_show_preview') ? $GLOBALS['prefs']->getValue('dimp_show_preview') : 'horiz'),
index a0523df..0ab42a8 100644 (file)
@@ -378,6 +378,9 @@ div.vpRowVert.flagUnseen {
 #logo, #dimpbarActions, #serviceActions, #foldersSidebar, #normalfolders {
     overflow-x: hidden;
 }
+#applicationfolders {
+    overflow: hidden;
+}
 
 #folderopts a {
     display: inline !important;