From: Michael M Slusarz Date: Fri, 7 Aug 2009 21:43:10 +0000 (-0600) Subject: Move all folder icon display to CSS. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=8cc50344a04667ea8829783385d99ee10b95909f;p=horde.git Move all folder icon display to CSS. --- diff --git a/imp/folders.php b/imp/folders.php index 78981d8bc..9dbb159df 100644 --- a/imp/folders.php +++ b/imp/folders.php @@ -13,6 +13,7 @@ * @package IMP */ +<<<<<<< Updated upstream /** * Utility function to return a url for the various images. */ @@ -31,7 +32,6 @@ function _image($name, $alt) } require_once dirname(__FILE__) . '/lib/base.php'; -Horde::addScriptFile('folders.js', 'imp', true); /* Redirect back to the mailbox if folder use is not allowed. */ if (!$conf['user']['allow_folders']) { @@ -341,6 +341,8 @@ $folders_token = Horde::getRequestToken('imp.folders'); $folders_url = Horde_Util::addParameter($folders_url, 'folders_token', $folders_token); +Horde::addScriptFile('folders.js', 'imp', true); + if ($_SESSION['imp']['file_upload'] && ($actionID == 'import_mbox')) { $title = _("Folder Navigator"); IMP::prepareMenu(); @@ -440,14 +442,14 @@ foreach ($raw_rows as $val) { $val['editvfolder'] = Horde::link($imp_search->editURL($val['value']), _("Edit Virtual Folder")) . _("Edit") . ''; } - $val['class'] = (++$rowct % 2) ? 'item0' : 'item1'; + $val['cname'] = (++$rowct % 2) ? 'item0' : 'item1'; /* Highlight line differently if folder/mailbox is unsubscribed. */ if ($showAll && $subscribe && !$val['container'] && !$imaptree->isSubscribed($val['base_elt'])) { - $val['class'] .= ' folderunsub'; + $val['cname'] .= ' folderunsub'; } if (!$val['container']) { @@ -457,7 +459,9 @@ foreach ($raw_rows as $val) { $val['name'] = Horde::link(Horde_Util::addParameter($name_url, 'mailbox', $val['value']), sprintf(_("View messages in %s"), ($val['vfolder']) ? $val['base_elt']['l'] : $val['display'])) . $val['name'] . ''; } - $dir2 = _image($val, null, 'folder'); + $dir2 = $val['user_icon'] + ? Horde::img($val['icon'], $val['alt'], null, $val['icondir']) + : ''; if ($val['children']) { $dir = Horde_Util::addParameter($folders_url, 'folder', $val['value']); diff --git a/imp/js/DimpBase.js b/imp/js/DimpBase.js index 059f05ef9..84d571e18 100644 --- a/imp/js/DimpBase.js +++ b/imp/js/DimpBase.js @@ -2022,7 +2022,7 @@ var DimpBase = { cname += ' unsubFolder'; } - div = new Element('DIV', { className: 'iconDiv' }); + div = new Element('SPAN', { className: 'iconSpan' }); if (ob.i) { div.setStyle({ backgroundImage: 'url("' + ob.i + '")' }); } @@ -2038,7 +2038,7 @@ var DimpBase = { div.addClassName('col'); } } else { - div.addClassName(ob.ch ? 'exp' : (ob.cl || 'base')); + div.addClassName(ob.ch ? 'exp' : (ob.cl || 'folderImg')); if (ob.s) { parent_e = $('specialfolders'); @@ -2046,7 +2046,7 @@ var DimpBase = { /* Create a dummy container element in 'normalfolders' * section. */ if (ob.ch) { - div.removeClassName('exp').addClassName(ob.cl || 'base'); + div.removeClassName('exp').addClassName(ob.cl || 'folderImg'); tmp = Object.clone(ob); tmp.co = true; diff --git a/imp/lib/Dimp.php b/imp/lib/Dimp.php index ffef8aeb1..f70c074e7 100644 --- a/imp/lib/Dimp.php +++ b/imp/lib/Dimp.php @@ -192,6 +192,7 @@ class IMP_Dimp if ($elt['children']) { $ob->ch = 1; } + $ob->cl = $elt['class']; $ob->m = $elt['value']; if ($ob->m != $elt['name']) { $ob->l = $elt['name']; @@ -215,50 +216,17 @@ class IMP_Dimp } if ($elt['container']) { - $ob->co = 1; $ob->cl = 'exp'; + $ob->co = 1; } else { if ($elt['polled']) { $ob->u = intval($elt['unseen']); } - switch ($elt['special']) { - case IMP_Imap_Tree::SPECIAL_INBOX: - $ob->cl = 'inbox'; - $ob->s = 1; - break; - - case IMP_Imap_Tree::SPECIAL_TRASH: - $ob->cl = 'trash'; - $ob->s = 1; - break; - - case IMP_Imap_Tree::SPECIAL_SPAM: - $ob->cl = 'spam'; + if ($elt['special']) { $ob->s = 1; - break; - - case IMP_Imap_Tree::SPECIAL_DRAFT: - $ob->cl = 'drafts'; - $ob->s = 1; - break; - - case IMP_Imap_Tree::SPECIAL_SENT: - $ob->cl = 'sent'; - $ob->s = 1; - break; - - default: - if ($elt['vfolder']) { - if ($GLOBALS['imp_search']->isVTrashFolder($elt['value'])) { - $ob->cl = 'trash'; - } elseif ($GLOBALS['imp_search']->isVINBOXFolder($elt['value'])) { - $ob->cl = 'inbox'; - } - } elseif ($elt['children']) { - $ob->cl = 'exp'; - } - break; + } elseif (!$elt['vfolder'] && $elt['children']) { + $ob->cl = 'exp'; } } diff --git a/imp/lib/Imap/Tree.php b/imp/lib/Imap/Tree.php index 868496328..efdb961fb 100644 --- a/imp/lib/Imap/Tree.php +++ b/imp/lib/Imap/Tree.php @@ -44,13 +44,6 @@ class IMP_Imap_Tree * mailboxes. */ const BASE_ELT = '\0'; - /* Defines used with the output from the build() function. */ - const SPECIAL_INBOX = 1; - const SPECIAL_TRASH = 2; - const SPECIAL_DRAFT = 3; - const SPECIAL_SPAM = 4; - const SPECIAL_SENT = 5; - /* Defines used with folderList(). */ const FLIST_CONTAINER = 1; const FLIST_UNSUB = 2; @@ -1806,11 +1799,13 @@ class IMP_Imap_Tree *
      * 'alt' - (string) The alt text for the icon.
      * 'base_elt' - (array) The return from get().
-     * 'children' - (children) Does the element have children?
+     * 'children' - (boolean) Does the element have children?
+     * 'class' - (string) The CSS class name.
      * 'container' - (boolean) Is this a container element?
      * 'editvfolder' - (boolean) Can this virtual folder be edited?
      * 'icon' - (string) The name of the icon graphic to use.
      * 'icondir' - (string) The path of the icon directory.
+     * 'iconopen' - ???
      * 'level' - (integer) The deepness level of this element.
      * 'mbox_val' - (string) A html-ized version of 'value'.
      * 'msgs' - (integer) The number of total messages in the element (if
@@ -1821,7 +1816,7 @@ class IMP_Imap_Tree
      * 'recent' - (integer) The number of new messages in the element (if
      *            polled).
      * 'sub' - (boolean) Is folder subscribed to?
-     * 'special' - (integer) A mask indicating if this is a "special" element.
+     * 'special' - (boolean) Is this is a "special" element?
      * 'specialvfolder' - (boolean) Is this a "special" virtual folder?
      * 'unseen' - (integer) The number of unseen messages in the element (if
      *            polled).
@@ -1855,7 +1850,7 @@ class IMP_Imap_Tree
             'parent' => $mailbox['p'],
             'polled' => false,
             'recent' => 0,
-            'special' => 0,
+            'special' => false,
             'specialvfolder' => false,
             'sub' => $this->isSubscribed($mailbox),
             'user_icon' => false,
@@ -1886,7 +1881,8 @@ class IMP_Imap_Tree
             case 'INBOX':
                 $row['icon'] = 'folders/inbox.png';
                 $row['alt'] = _("Inbox");
-                $row['special'] = self::SPECIAL_INBOX;
+                $row['class'] = 'inboxImg';
+                $row['special'] = true;
                 break;
 
             case $this->_eltCache['trash']:
@@ -1896,29 +1892,39 @@ class IMP_Imap_Tree
                 } else {
                     $row['icon'] = 'folders/trash.png';
                     $row['alt'] = _("Trash folder");
-                    $row['special'] = self::SPECIAL_TRASH;
+                    $row['class'] = 'trashImg';
+                    $row['special'] = true;
                 }
                 break;
 
             case $this->_eltCache['draft']:
                 $row['icon'] = 'folders/drafts.png';
                 $row['alt'] = _("Draft folder");
-                $row['special'] = self::SPECIAL_DRAFT;
+                $row['class'] = 'draftsImg';
+                $row['special'] = true;
                 break;
 
             case $this->_eltCache['spam']:
                 $row['icon'] = 'folders/spam.png';
                 $row['alt'] = _("Spam folder");
-                $row['special'] = self::SPECIAL_SPAM;
+                $row['class'] = 'spamImg';
+                $row['special'] = true;
                 break;
 
             default:
                 if (in_array($mailbox['v'], $this->_eltCache['sent'])) {
                     $row['icon'] = 'folders/sent.png';
                     $row['alt'] = _("Sent mail folder");
-                    $row['special'] = self::SPECIAL_SENT;
+                    $row['class'] = 'sentImg';
+                    $row['special'] = true;
                 } else {
-                    $row['icon'] = ($this->isOpen($mailbox)) ? 'folders/open.png' : 'folders/folder.png';
+                    if ($this->isOpen($mailbox)) {
+                        $row['icon'] = 'folders/open.png';
+                        $row['class'] = 'folderopenImg';
+                    } else {
+                        $row['icon'] = 'folders/folder.png';
+                        $row['class'] = 'folderImg';
+                    }
                     $row['alt'] = _("Mailbox");
                 }
                 break;
@@ -1932,10 +1938,12 @@ class IMP_Imap_Tree
                     $row['specialvfolder'] = true;
                     $row['icon'] = 'folders/trash.png';
                     $row['alt'] = _("Virtual Trash Folder");
+                    $row['class'] = 'trashImg';
                 } elseif ($GLOBALS['imp_search']->isVINBOXFolder($mailbox['v'])) {
                     $row['specialvfolder'] = true;
                     $row['icon'] = 'folders/inbox.png';
                     $row['alt'] = _("Virtual INBOX Folder");
+                    $row['class'] = 'inboxImg';
                 }
             }
         } else {
@@ -1944,10 +1952,12 @@ class IMP_Imap_Tree
             if ($this->_forceopen && $this->isOpen($mailbox)) {
                 $row['icon'] = 'folders/open.png';
                 $row['alt'] = _("Opened Folder");
+                $row['class'] = 'folderopenImg';
             } else {
                 $row['icon'] = 'folders/folder.png';
                 $row['iconopen'] = 'folders/open.png';
                 $row['alt'] = ($this->_forceopen) ? _("Closed Folder") : _("Folder");
+                $row['class'] = 'folderImg';
             }
             if ($this->isVFolder($mailbox)) {
                 $row['vfolder'] = true;
diff --git a/imp/templates/folders/folders.html b/imp/templates/folders/folders.html
index c27a37203..3c9d5f9b2 100644
--- a/imp/templates/folders/folders.html
+++ b/imp/templates/folders/folders.html
@@ -1,5 +1,5 @@
 
-
+
 disabled="disabled" value="" /> (/)   [] []
diff --git a/imp/templates/index/index-dimp.inc b/imp/templates/index/index-dimp.inc index d050534d3..d12bc576a 100644 --- a/imp/templates/index/index-dimp.inc +++ b/imp/templates/index/index-dimp.inc @@ -118,11 +118,11 @@ function _simpleButton($id, $text, $image, $imagedir = null)
diff --git a/imp/themes/screen-dimp.css b/imp/themes/screen-dimp.css index 87e38b8d1..3cba3701a 100644 --- a/imp/themes/screen-dimp.css +++ b/imp/themes/screen-dimp.css @@ -311,7 +311,7 @@ div.vpRow.flagDeleted { #sidebarPanel li.on { background: #ffa; } -#sidebarPanel li div { +#sidebarPanel li span { cursor: pointer; } #sidebarPanel .folderlist li a { @@ -331,37 +331,22 @@ div.vpRow.flagDeleted { border: 1px solid orange; padding: 1px 1px 1px 19px; } -#sidebarPanel div.iconDiv { +#sidebarPanel span.iconSpan { display: inline; float: left; width: 20px; height: 100%; background-repeat: no-repeat; } -#sidebarPanel div.base, #ctx_folder_sub span.contextImg, #ctx_folder_unsub span.contextImg, #ctx_folderopts_sub span.contextImg, #ctx_folderopts_unsub span.contextImg { +#ctx_folder_sub span.contextImg, #ctx_folder_unsub span.contextImg, #ctx_folderopts_sub span.contextImg, #ctx_folderopts_unsub span.contextImg { background-image: url("graphics/folders/folder.png"); } -#sidebarPanel div.col, #ctx_folderopts_collapse span.contextImg { +#sidebarPanel span.col, #ctx_folderopts_collapse span.contextImg { background-image: url("graphics/folders/minus.png"); } -#sidebarPanel div.exp, #ctx_folderopts_expand span.contextImg { +#sidebarPanel span.exp, #ctx_folderopts_expand span.contextImg { background-image: url("graphics/folders/plus.png"); } -#sidebarPanel div.drafts { - background-image: url("graphics/folders/drafts.png"); -} -#sidebarPanel div.inbox { - background-image: url("graphics/folders/inbox.png"); -} -#sidebarPanel div.sent { - background-image: url("graphics/folders/sent.png"); -} -#sidebarPanel div.spam { - background-image: url("graphics/folders/spam.png"); -} -#sidebarPanel div.trash { - background-image: url("graphics/folders/trash.png"); -} #normalfolders { overflow-x: hidden; } diff --git a/imp/themes/screen.css b/imp/themes/screen.css index 9bec46f8b..9384246fd 100644 --- a/imp/themes/screen.css +++ b/imp/themes/screen.css @@ -180,6 +180,27 @@ form#search div { #fmanager div.folderChoose { padding-left: 5px; } +span.folderImg { + background-image: url("graphics/folders/folder.png"); +} +span.folderopenImg { + background-image: url("graphics/folders/open.png"); +} +span.draftsImg { + background-image: url("graphics/folders/drafts.png"); +} +span.inboxImg { + background-image: url("graphics/folders/inbox.png"); +} +span.sentImg { + background-image: url("graphics/folders/sent.png"); +} +span.spamImg { + background-image: url("graphics/folders/spam.png"); +} +span.trashImg { + background-image: url("graphics/folders/trash.png"); +} /* Style for div that fixes KHTML browsers. */ .ohide { @@ -616,7 +637,7 @@ td.addressTr span.loadingImg { white-space: nowrap; } -.downloadAtc, .downloadZipAtc, .saveImgAtc, .stripAtc { +.downloadAtc, .downloadZipAtc, .saveImgAtc, .stripAtc, .foldersImg { display: -moz-inline-stack; display: inline-block; height: 16px; diff --git a/imp/themes/silver/screen-dimp.css b/imp/themes/silver/screen-dimp.css index 7cd7dfcba..1275ccbeb 100644 --- a/imp/themes/silver/screen-dimp.css +++ b/imp/themes/silver/screen-dimp.css @@ -1,27 +1,12 @@ -#sidebarPanel div.base, #ctx_folder_sub span.contextImg, #ctx_folder_unsub span.contextImg, #ctx_folderopts_sub span.contextImg, #ctx_folderopts_unsub span.contextImg { +#ctx_folder_sub span.contextImg, #ctx_folder_unsub span.contextImg, #ctx_folderopts_sub span.contextImg, #ctx_folderopts_unsub span.contextImg { background-image: url("graphics/folders/folder.png"); } -#sidebarPanel div.col, #ctx_folderopts_collapse span.contextImg { +#sidebarPanel span.col, #ctx_folderopts_collapse span.contextImg { background-image: url("graphics/folders/minus.png"); } -#sidebarPanel div.exp, #ctx_folderopts_expand span.contextImg { +#sidebarPanel span.exp, #ctx_folderopts_expand span.contextImg { background-image: url("graphics/folders/plus.png"); } -#sidebarPanel div.drafts { - background-image: url("graphics/folders/drafts.png"); -} -#sidebarPanel div.inbox { - background-image: url("graphics/folders/inbox.png"); -} -#sidebarPanel div.sent { - background-image: url("graphics/folders/sent.png"); -} -#sidebarPanel div.spam { - background-image: url("graphics/folders/spam.png"); -} -#sidebarPanel div.trash { - background-image: url("graphics/folders/trash.png"); -} #attach_list div, span.attachmentImg { background-image: url("graphics/attachment.png"); diff --git a/imp/themes/silver/screen.css b/imp/themes/silver/screen.css index b451c8661..5871775cd 100644 --- a/imp/themes/silver/screen.css +++ b/imp/themes/silver/screen.css @@ -57,3 +57,25 @@ div.msgflags.flagDeleted, span.contextImg.flagDeleted { div.msgflags.flagForwarded, span.contextImg.flagForwarded { background-image: url("graphics/mail_forwarded.png"); } + +span.folderImg { + background-image: url("graphics/folders/folder.png"); +} +span.folderopenImg { + background-image: url("graphics/folders/open.png"); +} +span.draftsImg { + background-image: url("graphics/folders/drafts.png"); +} +span.inboxImg { + background-image: url("graphics/folders/inbox.png"); +} +span.sentImg { + background-image: url("graphics/folders/sent.png"); +} +span.spamImg { + background-image: url("graphics/folders/spam.png"); +} +span.trashImg { + background-image: url("graphics/folders/trash.png"); +}