Removed unused code
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 4 Nov 2009 19:45:01 +0000 (12:45 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Fri, 6 Nov 2009 20:50:08 +0000 (13:50 -0700)
imp/lib/Dimp.php
imp/templates/chunks/compose.php
imp/templates/chunks/message.php
imp/templates/index/index-dimp.inc

index 1439d93..5fb7f9b 100644 (file)
@@ -22,33 +22,21 @@ class IMP_Dimp
      * 'icon' - The icon CSS classname.
      * 'id' - The DOM ID of the link.
      * 'title' - The title string.
-     * 'tooltip' - Tooltip text to use.
      * </pre>
      *
      * @return string  An HTML link to $url.
      */
     static public function actionButton($params = array())
     {
-        $tooltip = (empty($params['tooltip'])) ? '' : $params['tooltip'];
-
-        if (empty($params['title'])) {
-            $old_error = error_reporting(0);
-            $tooltip = nl2br(htmlspecialchars($tooltip, ENT_QUOTES, Horde_Nls::getCharset()));
-            $title = $ak = '';
-        } else {
-            $title = $params['title'];
-            $ak = Horde::getAccessKey($title);
-        }
-
-        return Horde::link('', $tooltip,
+        return Horde::link('', '',
                            empty($params['class']) ? '' : $params['class'],
-                           '', '', '', $ak,
+                           '', '', '', Horde::getAccessKey($params['title']),
                            empty($params['id']) ? array() : array('id' => $params['id']),
-                           !empty($title))
+                           true)
             . (!empty($params['icon'])
                   ? '<span class="iconImg dimpaction' . $params['icon'] . '"></span>'
                   : '')
-            . $title . '</a>';
+            . $params['title'] . '</a>';
     }
 
     /**
index edab1ae..761504d 100644 (file)
@@ -18,19 +18,6 @@ $save_attach = $GLOBALS['prefs']->getValue('save_attachments');
 /* Determine if compose mode is disabled. */
 $compose_disable = !IMP::canCompose();
 
-// Small utility function to simplify creating dimpactions buttons.
-// As of right now, we don't show text only links.
-function _createDAcompose($text, $image, $id)
-{
-    $params = array('icon' => $image, 'id' => $id);
-    if (!in_array($GLOBALS['prefs']->getValue('menu_view'), array('text', 'both'))) {
-        $params['tooltip'] = $text;
-    } else {
-        $params['title'] = $text;
-    }
-    echo '<div>' . IMP_Dimp::actionButton($params) . '</div>';
-}
-
 ?>
 <form id="compose" name="compose" enctype="multipart/form-data" action="compose-dimp.php" method="post" target="submit_frame">
 <?php echo Horde_Util::formInput() ?>
@@ -41,10 +28,10 @@ function _createDAcompose($text, $image, $id)
 
 <div class="dimpActions dimpActionsCompose">
 <?php if (!$compose_disable): ?>
- <?php _createDAcompose(_("Send"), 'Forward', 'send_button') ?>
+ <div><?php echo IMP_Dimp::actionButton(array('icon' => 'Forward', 'id' => 'send_button', 'title' => _("Send"))); ?></div>
 <?php endif; ?>
- <?php _createDAcompose(_("Check Spelling"), 'Spellcheck', 'spellcheck') ?>
- <?php _createDAcompose(_("Save as Draft"), 'Drafts', 'draft_button') ?>
+ <div><?php echo IMP_Dimp::actionButton(array('icon' => 'Spellcheck', 'id' => 'spellcheck', 'title' => _("Check Spelling"))); ?></div>
+ <div><?php echo IMP_Dimp::actionButton(array('icon' => 'Drafts', 'id' => 'draft_button', 'title' => _("Save as Draft"))); ?></div>
 </div>
 
 <div id="writemsg" class="noprint">
index aad8de8..c25e71c 100644 (file)
@@ -1,43 +1,28 @@
 <?php
 /**
+ * Dynamic view (dimp) compose template.
+ *
  * Copyright 2005-2009 The Horde Project (http://www.horde.org/)
  *
  * See the enclosed file COPYING for license information (GPL). If you
  * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
  */
-
-$menu_view = $prefs->getValue('menu_view');
-$show_text = ($menu_view == 'text' || $menu_view == 'both');
-
-// Small utility function to simplify creating dimpactions buttons.
-// As of right now, we don't show text only links.
-function _createDAfmsg($text, $image, $id, $class = '', $show_text = true)
-{
-    $params = array('icon' => $image, 'id' => $id, 'class' => $class);
-    if ($show_text) {
-        $params['title'] = $text;
-    } else {
-        $params['tooltip'] = $text;
-    }
-    echo '<div>' . IMP_Dimp::actionButton($params) . '</div>';
-}
-
 ?>
 <div id="dimpLoading"><?php echo _("Loading...") ?></div>
 <div id="pageContainer" style="display:none">
  <div id="msgData">
   <div class="dimpActions dimpActionsMsg noprint">
    <div class="headercloseimg closeImg" id="windowclose" title="X"></div>
-   <?php _createDAfmsg(_("Reply"), 'Reply', 'reply_link', 'hasmenu', $show_text) ?>
-   <?php _createDAfmsg(_("Forward"), 'Forward', 'forward_link', '', $show_text) ?>
+   <div><?php echo IMP_Dimp::actionButton(array('class' => 'hasmenu', 'icon' => 'Reply', 'id' => 'reply_link', 'title' => _("Reply"))) ?></div>
+   <div><?php echo IMP_Dimp::actionButton(array('icon' => 'Forward', 'id' => 'forward_link', 'title' => _("Forward"))) ?></div>
 <?php if (!empty($conf['spam']['reporting']) && (!$conf['spam']['spamfolder'] || ($folder != IMP::folderPref($prefs->getValue('spam_folder'), true)))): ?>
-   <?php _createDAfmsg(_("Report Spam"), 'Spam', 'button_spam', '', $show_text) ?>
+   <div><?php echo IMP_Dimp::actionButton(array('icon' => 'Spam', 'id' => 'button_spam', 'title' => _("Report Spam"))) ?></div>
 <?php endif; ?>
 <?php if (!empty($conf['notspam']['reporting']) && (!$conf['notspam']['spamfolder'] || ($folder == IMP::folderPref($prefs->getValue('spam_folder'), true)))): ?>
-   <?php _createDAfmsg(_("Report Innocent"), 'Ham', 'button_ham', '', $show_text) ?>
+   <div><?php echo IMP_Dimp::actionButton(array('icon' => 'Ham', 'id' => 'button_ham', 'title' => _("Report Innocent"))) ?></div>
 <?php endif; ?>
 <?php if (!$readonly): ?>
-   <?php _createDAfmsg(_("Delete"), 'Delete', 'button_deleted', '', $show_text) ?>
+   <div><?php echo IMP_Dimp::actionButton(array('icon' => 'Delete', 'id' => 'button_deleted', 'title' => _("Delete"))) ?></div>
 <?php endif; ?>
   </div>
 
index 83435ea..b7a0eaa 100644 (file)
@@ -1,7 +1,14 @@
 <?php
+/**
+ * Dynamic view (dimp) index template.
+ *
+ * Copyright 2005-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (GPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
+ */
 
 $usetrash = $prefs->getValue('use_trash');
-$show_text = in_array($prefs->getValue('menu_view'), array('both', 'text'));
 $use_sub = $prefs->getValue('subscribe');
 
 $has_blacklist = $registry->hasMethod('mail/blacklistFrom');
@@ -14,20 +21,6 @@ $show_quota = (isset($_SESSION['imp']['quota']) && is_array($_SESSION['imp']['qu
 $imp_flags = IMP_Imap_Flags::singleton();
 $flag_list = $imp_flags->getList(array('imap' => true));
 
-// Small utility functions to simplify creating dimpactions buttons.
-// As of right now, we don't show text only links.
-function _createDA($text, $image, $id = null, $class = '', $show_text = true,
-                   $div_text = '')
-{
-    $params = array('icon' => $image, 'id' => $id, 'class' => $class);
-    if ($show_text) {
-        $params['title'] = $text;
-    } else {
-        $params['tooltip'] = $text;
-    }
-    echo '<div' . $div_text . '>' . IMP_Dimp::actionButton($params) . '</div>';
-}
-
 function _simpleButton($id, $text, $image)
 {
     $ak = Horde::getAccessKey($text, true);
@@ -175,18 +168,18 @@ function _simpleButton($id, $text, $image)
       </span>
       </div>
 <?php endif; ?>
-      <?php _createDA(_("Reply"), 'Reply', 'button_reply', 'noselectDisable', $show_text) ?>
-      <?php _createDA(_("Forward"), 'Forward', 'button_forward', 'noselectDisable', $show_text) ?>
+      <div><?php echo IMP_Dimp::actionButton(array('class' => 'noselectDisable', 'icon' => 'Reply', 'id' => 'button_reply', 'title' => _("Reply"))) ?></div>
+      <div><?php echo IMP_Dimp::actionButton(array('class' => 'noselectDisable', 'icon' => 'Forward', 'id' => 'button_forward', 'title' => _("Forward"))) ?></div>
 <?php if (!empty($conf['spam']['reporting'])): ?>
-      <?php _createDA(_("Spam"), 'Spam', 'button_spam', 'noselectDisable', $show_text) ?>
+      <div><?php echo IMP_Dimp::actionButton(array('class' => 'noselectDisable', 'icon' => 'Spam', 'id' => 'button_spam', 'title' => _("Spam"))) ?></div>
 <?php endif; ?>
 <?php if (!empty($conf['notspam']['reporting'])): ?>
-      <?php _createDA(_("Innocent"), 'Ham', 'button_ham', 'noselectDisable', $show_text, ' style="display:none"') ?>
+      <div><?php echo IMP_Dimp::actionButton(array('class' => 'noselectDisable', 'icon' => 'Ham', 'id' => 'button_ham', 'title' => _("Innocent"))) ?></div>
 <?php endif; ?>
-      <?php _createDA(_("Delete"), 'Delete', 'button_deleted', 'noselectDisable', $show_text) ?>
-      <?php _createDA(_("Compose"), 'Compose', '', '', $show_text, ' id="button_compose"') ?>
-      <?php _createDA(_("Get Mail"), 'Checkmail', '', '', $show_text, ' id="button_checkmail"') ?>
-      <?php _createDA(_("Other Actions"), 'Other', 'button_other', '', $show_text) ?>
+      <div><?php echo IMP_Dimp::actionButton(array('class' => 'noselectDisable', 'icon' => 'Delete', 'id' => 'button_deleted', 'title' => _("Delete"))) ?></div>
+      <div id="button_compose"><?php echo IMP_Dimp::actionButton(array('icon' => 'Compose', 'title' => _("Compose"))) ?></div>
+      <div id="button_checkmail"><?php echo IMP_Dimp::actionButton(array('icon' => 'Checkmail', 'title' => _("Get Mail"))) ?></div>
+      <div><?php echo IMP_Dimp::actionButton(array('icon' => 'Other', 'id' => 'button_other', 'title' => _("Other Actions"))) ?></div>
      </div>
 
      <div id="msglistHeader" class="item">