[TEP-COMMIT] CVS: catalog/catalog/includes/classes message_stack.php,1.2,1.3

Harald Ponce de Leon <[email protected]>
Newsgroups gmane.comp.web.oscommerce.cvs
Message-ID <[email protected]>
Update of /cvsroot/tep/catalog/catalog/includes/classes
In directory sc8-pr-cvs1:/tmp/cvs-serv17341/includes/classes

Modified Files:
	message_stack.php 
Log Message:
update the layout of the messagestack output messages


Index: message_stack.php
===================================================================
RCS file: /cvsroot/tep/catalog/catalog/includes/classes/message_stack.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- message_stack.php	17 Nov 2003 19:15:52 -0000	1.2
+++ message_stack.php	4 Dec 2003 14:12:16 -0000	1.3
@@ -10,7 +10,7 @@
   Released under the GNU General Public License
 */
 
-  class messageStack extends tableBox {
+  class messageStack {
 
 // class constructor
     function messageStack() {
@@ -31,15 +31,7 @@
 
 // class methods
     function add($class, $message, $type = 'error') {
-      if ($type == 'error') {
-        $this->messages[] = array('params' => 'class="messageStackError"', 'class' => $class, 'text' => tep_image(DIR_WS_ICONS . 'error.gif', ICON_ERROR) . '&nbsp;' . $message);
-      } elseif ($type == 'warning') {
-        $this->messages[] = array('params' => 'class="messageStackWarning"', 'class' => $class, 'text' => tep_image(DIR_WS_ICONS . 'warning.gif', ICON_WARNING) . '&nbsp;' . $message);
-      } elseif ($type == 'success') {
-        $this->messages[] = array('params' => 'class="messageStackSuccess"', 'class' => $class, 'text' => tep_image(DIR_WS_ICONS . 'success.gif', ICON_SUCCESS) . '&nbsp;' . $message);
-      } else {
-        $this->messages[] = array('params' => 'class="messageStackError"', 'class' => $class, 'text' => $message);
-      }
+      $this->messages[] = array('class' => $class, 'type' => $type, 'message' => $message);
     }
 
     function add_session($class, $message, $type = 'error') {
@@ -61,28 +53,41 @@
     }
 
     function output($class) {
-      $this->table_data_parameters = 'class="messageBox"';
-
-      $output = array();
+      $messages = '<ul>';
       for ($i=0, $n=sizeof($this->messages); $i<$n; $i++) {
         if ($this->messages[$i]['class'] == $class) {
-          $output[] = $this->messages[$i];
+          switch ($this->messages[$i]['type']) {
+            case 'error':
+              $bullet_image = DIR_WS_ICONS . 'error.gif';
+              break;
+            case 'warning':
+              $bullet_image = DIR_WS_ICONS . 'warning.gif';
+              break;
+            case 'success':
+              $bullet_image = DIR_WS_ICONS . 'success.gif';
+              break;
+            default:
+              $bullet_image = DIR_WS_ICONS . 'bullet_default.gif';
+          }
+
+          $messages .= '<li style="list-style-image: url(\'' . $bullet_image . '\')">' . tep_output_string($this->messages[$i]['message']) . '</li>';
         }
       }
+      $messages .= '</ul>';
 
-      return $this->tableBox($output);
+      return '<div class="messageStack">' . $messages . '</div>';
     }
 
     function size($class) {
-      $count = 0;
+      $class_size = 0;
 
       for ($i=0, $n=sizeof($this->messages); $i<$n; $i++) {
         if ($this->messages[$i]['class'] == $class) {
-          $count++;
+          $class_size++;
         }
       }
 
-      return $count;
+      return $class_size;
     }
   }
 ?>



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.