Browse Source

Remove span tags from core

pdontthink 18 years ago
parent
commit
dd2823a8de
3 changed files with 56 additions and 3 deletions
  1. 28 0
      functions/html.php
  2. 2 3
      functions/template/message_list_util.php
  3. 26 0
      templates/default/span.tpl

+ 28 - 0
functions/html.php

@@ -112,8 +112,36 @@ function create_image($src, $alt='', $width='', $height='',
 }
 }
 
 
 
 
+/**
+ * Generates a span tag
+ *
+ * @param string $value   The contents that belong inside the span
+ * @param string $class   The CSS class name (OPTIONAL; default
+ *                        not used)
+ * @param string $id      The ID name (OPTIONAL; default not used)
+ *
+ * @return string The desired span tag.
+ *
+ * @since 1.5.2
+ *
+ */
+function create_span($value, $class='', $id='') {
+
+    global $oTemplate;
+
+    $oTemplate->assign('value', $value);
+    $oTemplate->assign('class', $class);
+    $oTemplate->assign('id', $id);
+
+    return $oTemplate->fetch('span.tpl');
+
+}
+
+
 /**
 /**
  * Generates html tags
  * Generates html tags
+//FIXME: this should not be used anywhere in the core, or we should
+//       convert this to use templates.  We sould not be assuming HTML output.
  *
  *
  * @param string $tag Tag to output
  * @param string $tag Tag to output
  * @param string $val Value between tags
  * @param string $val Value between tags

+ 2 - 3
functions/template/message_list_util.php

@@ -174,16 +174,15 @@ function getPriorityIcon ($priority, $icon_theme_path) {
     switch ($priority) {
     switch ($priority) {
         case 1:
         case 1:
         case 2:
         case 2:
-            $icon = getIcon($icon_theme_path, 'prio_high.png', '<span class="high_priority">!</span>');
+            $icon = getIcon($icon_theme_path, 'prio_high.png', create_span('!', 'high_priority'));
             break;
             break;
         case 5:
         case 5:
-            $icon = getIcon($icon_theme_path, 'prio_low.png', '<span class="low_priority">&#8595;</span>');
+            $icon = getIcon($icon_theme_path, 'prio_low.png', create_span('&#8595;', 'low_priority'));
             break;
             break;
         default:
         default:
             $icon = getIcon($icon_theme_path, 'transparent.png', '', '', 5);
             $icon = getIcon($icon_theme_path, 'transparent.png', '', '', 5);
             break;
             break;
     }
     }
- echo "prio = $priority<br>icon = $icon<br>";   
 
 
     return $icon;
     return $icon;
 }
 }

+ 26 - 0
templates/default/span.tpl

@@ -0,0 +1,26 @@
+<?php
+
+/**
+  * span.tpl
+  *
+  * Template for constructing a span tag.
+  *
+  * The following variables are available in this template:
+  *      + $value   - The contents that belong inside the span
+  *      + $class   - CSS class name (optional; may not be present)
+  *      + $id      - ID name (optional; may not be present)
+  *
+  * @copyright &copy; 1999-2006 The SquirrelMail Project Team
+  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+  * @version $Id$
+  * @package squirrelmail
+  * @subpackage templates
+  */
+
+
+// retrieve the template vars
+//
+extract($t);
+
+
+?><span<?php if (!empty($class)) echo ' class="' . $class . '"'; ?><?php if (!empty($id)) echo ' id="' . $id . '"'; ?>><?php echo $value; ?></span>