Skip to content
Permalink
Browse files

[plugin:tracker] fix "IS NULL" cell style with default value

tracker プラグインの config 設定で、[条件]が "IS NULL" の場合に設定した、
[セルの書式] が、[ページに記入する書式] に値が入っていると効かない問題を修正。
  • Loading branch information
nao-pon committed Jun 26, 2013
1 parent 5b3fc6c commit 08993863de3d2d18a6d8d5d8f756116dcc9e57ef
Showing with 28 additions and 1 deletion.
  1. +28 −1 xoops_trust_path/modules/xpwiki/plugin/tracker.inc.php
@@ -398,6 +398,7 @@ class XpWikiTracker_field
var $data;
var $sort_type = SORT_REGULAR;
var $id = 0;
var $field_remover = '';

function XpWikiTracker_field(& $xpwiki, $field, $base, $refer, & $config)
{
@@ -445,6 +446,15 @@ function get_value($value)
{
return $value; // Default: $value itself
}

function set_field_remover()
{
$fields = array();
foreach ($this->config->get('fields') as $field) {
$fields[] = preg_quote($field[0], '/');
}
$this->config->put('field_remover', array('/\[(?:'.join('|', $fields).')\]/'));
}
}

class XpWikiTracker_field_text extends XpWikiTracker_field
@@ -569,9 +579,26 @@ function format_value($str)

function get_style($str)
{
$key = $this->get_key($str);
$key = $this->get_key(! $this->is_null_style($str));
return isset($this->styles[$key]) ? $this->styles[$key] : '%s';
}

function is_null_style($str)
{
if (! $this->config->get('field_remover')) {
$this->set_field_remover();
}
$arr = $this->config->get('field_remover');
$this->field_remover = $arr[0];
if (isset($this->formats['IS NULL'])) {
$null = $this->formats['IS NULL'];
$this->func->cleanup_template_source($null);
$null = preg_replace($this->field_remover, '', $null);
} else {
$null = '';
}
return ($str === $null);
}
}

class XpWikiTracker_field_file extends XpWikiTracker_field_format

0 comments on commit 0899386

Please sign in to comment.
You can’t perform that action at this time.