修訂 | 4ae10ae819598d5b4576842c4cf9b14b86a556fa (tree) |
---|---|
時間 | 2007-10-04 00:18:15 |
作者 | henoheno <henoheno> |
Commiter | henoheno |
Simplify: _page
@@ -1,6 +1,6 @@ | ||
1 | 1 | <?php |
2 | 2 | // PukiWiki - Yet another WikiWikiWeb clone |
3 | -// $Id: tracker.inc.php,v 1.101 2007/10/02 13:52:15 henoheno Exp $ | |
3 | +// $Id: tracker.inc.php,v 1.102 2007/10/03 15:18:15 henoheno Exp $ | |
4 | 4 | // Copyright (C) 2003-2005, 2007 PukiWiki Developers Team |
5 | 5 | // License: GPL v2 or (at your option) any later version |
6 | 6 | // |
@@ -228,7 +228,8 @@ function plugin_tracker_action() | ||
228 | 228 | // Data set of XHTML form or something |
229 | 229 | class Tracker_form |
230 | 230 | { |
231 | - var $id; | |
231 | + var $id; // Unique id per instance | |
232 | + | |
232 | 233 | var $base; |
233 | 234 | var $refer; |
234 | 235 | var $config; |
@@ -240,7 +241,7 @@ class Tracker_form | ||
240 | 241 | |
241 | 242 | function Tracker_form($base, $refer, $config) |
242 | 243 | { |
243 | - static $id = 0; // Unique id per instance | |
244 | + static $id = 0; | |
244 | 245 | $this->id = ++$id; |
245 | 246 | |
246 | 247 | $this->base = $base; |
@@ -365,9 +366,10 @@ class Tracker_form | ||
365 | 366 | // Field classes within a form |
366 | 367 | class Tracker_field |
367 | 368 | { |
368 | - var $id; | |
369 | + var $id; // Unique id per instance, and per class(extended-class) | |
369 | 370 | |
370 | 371 | var $form; // Parent (class Tracker_form) |
372 | + | |
371 | 373 | var $name; |
372 | 374 | var $title; |
373 | 375 | var $values; |
@@ -380,7 +382,7 @@ class Tracker_field | ||
380 | 382 | function Tracker_field(& $tracker_form, $field) |
381 | 383 | { |
382 | 384 | global $post; |
383 | - static $id = 0; // Unique id per instance, and per class(extended-class) | |
385 | + static $id = 0; | |
384 | 386 | |
385 | 387 | $this->id = ++$id; |
386 | 388 |
@@ -434,6 +436,7 @@ class Tracker_field_text extends Tracker_field | ||
434 | 436 | } |
435 | 437 | } |
436 | 438 | |
439 | +// Special type: The page names | |
437 | 440 | class Tracker_field_page extends Tracker_field_text |
438 | 441 | { |
439 | 442 | var $sort_type = PLUGIN_TRACKER_SORT_TYPE_STRING; |
@@ -444,8 +447,14 @@ class Tracker_field_page extends Tracker_field_text | ||
444 | 447 | if (is_pagename($value)) $value = '[[' . $value . ']]'; |
445 | 448 | return parent::format_value($value); |
446 | 449 | } |
450 | + | |
451 | + function format_cell($value) | |
452 | + { | |
453 | + return '[[' . $value . ']]'; | |
454 | + } | |
447 | 455 | } |
448 | 456 | |
457 | +// Special type : Real(Raw) value of page name | |
449 | 458 | class Tracker_field_real extends Tracker_field_text |
450 | 459 | { |
451 | 460 | var $sort_type = PLUGIN_TRACKER_SORT_TYPE_NATURAL; |
@@ -486,19 +495,20 @@ class Tracker_field_textarea extends Tracker_field | ||
486 | 495 | } |
487 | 496 | } |
488 | 497 | |
498 | +// Text with formatting if trim($cell) != '' | |
499 | +// See also: http://home.arino.jp/?tracker.inc.php%2F41 | |
489 | 500 | class Tracker_field_format extends Tracker_field |
490 | 501 | { |
491 | 502 | var $sort_type = PLUGIN_TRACKER_SORT_TYPE_STRING; |
503 | + | |
492 | 504 | var $styles = array(); |
493 | 505 | var $formats = array(); |
494 | 506 | |
495 | 507 | function Tracker_field_format(& $tracker_form, $field) |
496 | 508 | { |
497 | 509 | parent::Tracker_field($tracker_form, $field); |
498 | - | |
499 | 510 | foreach ($this->form->config->get($this->name) as $option) { |
500 | - list($key, $style, $format) = | |
501 | - array_pad(array_map(create_function('$a', 'return trim($a);'), $option), 3, ''); | |
511 | + list($key, $style, $format) = array_pad(array_map('trim', $option), 3, ''); | |
502 | 512 | if ($style != '') $this->styles[$key] = $style; |
503 | 513 | if ($format != '') $this->formats[$key] = $format; |
504 | 514 | } |
@@ -831,7 +841,8 @@ function plugin_tracker_list_render($base, $refer, $config_name, $list, $order_c | ||
831 | 841 | // Listing class |
832 | 842 | class Tracker_list |
833 | 843 | { |
834 | - var $form; | |
844 | + var $form; // class Tracker_form | |
845 | + | |
835 | 846 | var $list; |
836 | 847 | |
837 | 848 | var $pattern; |
@@ -941,7 +952,7 @@ class Tracker_list | ||
941 | 952 | $filetime = get_filetime($pagename); |
942 | 953 | $row = array( |
943 | 954 | // column => default data of the cell |
944 | - '_page' => '[[' . $pagename . ']]', // TODO: Redudant column pair [1] | |
955 | + '_page' => $pagename, // TODO: Redudant column pair [1] | |
945 | 956 | '_real' => $pagename, // TODO: Redudant column pair [1] |
946 | 957 | '_update' => $filetime, // TODO: Redudant column pair [2] |
947 | 958 | '_past' => $filetime, // TODO: Redudant column pair [2] |