Filter affects following tables

geoffc - May 3, 2008 - 05:02
Project:Table Manager
Version:5.x-1.4
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

If you happen to place more than one tablemanager table in a node:

The first table:

[tablemanager:4,,,column=1|start="Fred"]

another table

[tablemanager:6]

Then in this case tablemanager will apply the filter from the first table to the second table as well.

Geoffrey

#1

pobster - May 3, 2008 - 12:04

Very disheartening that this hasn't been picked up on previously. Its simply down to an incorrect placement of the commands in tablemanager_process which reset the variables which store the attrib info. I'll post a patch later.

Pobster

#2

pobster - May 12, 2008 - 13:05

Crap I forgot all about this... Sorry...

Anyways, just change the function _tablemanager_process_text to this (and let me know if it solves the problem);

/**
* Function to match and process the tablemanager filter
*/
function _tablemanager_process_text($text) {
  $pattern = "/\[tablemanager:(\d+,?\w*,?\w*,?\w*=?\d*\|?\w*=?\w*\|?\w*=?\w*,?.*?)\]/i";
  if (preg_match_all($pattern, $text, $matches)) {
    foreach ($matches[1] as $no => $args) {
      $date = array(); // these two variable declarations
      $attrib = array(); // have moved - and NOTHING else is changed.
      $arg = explode(',', $args);
      if ($arg[3]) {
        $params = explode('|', $arg[3]);
        foreach ($params as $param) {
          $temp = explode('=', $param);
          $date[trim($temp[0])] = trim(trim($temp[1]), '"');
        }
      }
      if ($arg[4]) {
        $params = explode('|', $arg[4]);
        foreach ($params as $param) {
          $temp = explode('=', $param);
          $attrib[trim($temp[0])] = trim($temp[1]);
        }
      }
      $text = str_replace($matches[0][$no], tablemanager_display(trim($arg[0]), trim($arg[1]), trim($arg[2]), $date, $attrib), $text);
    }
  }
  return $text;
} // _tablemanager_process_text

Thanks,

Pobster

#3

Summit - December 3, 2008 - 23:00

Subscribing, greetings, Martijn

 
 

Drupal is a registered trademark of Dries Buytaert.