Develop/Modification1/51に戻る

> diff -w table_edit.inc.php.16 table_edit.inc.php.18
4a5,7
> define('PLUGIN_TABLE_EDIT_IMAGE_BASEURL', ''); // guess image path
> //define('PLUGIN_TABLE_EDIT_IMAGE_BASEURL', 'http://www.example.com/wiki/image/'); // specified uri
>
6a10
> define('PLUGIN_TABLE_EDIT_USE_MULTIROW', false);
8a13,14
> define('PLUGIN_TABLE_EDIT_FORM_SELECTION_MAX_ITEM', 0);    // 0 is off
> define('PLUGIN_TABLE_EDIT_FORM_SELECTION_RADIO', true);    // true=radio, false=select
15a22
> //define('PLUGIN_TABLE_EDIT_STRING_NEW_ITEM',     'new item');
22a30
26a35,36
> define('PLUGIN_TABLE_EDIT_NEW_ITEM', '!!!table_edit@new_item!!!'); // must be unique
>
28c38
< define('PLUGIN_TABLE_EDIT_USAGE', '#include(): Usage: (a-page-name-you-want-to-edit)');
---
> define('PLUGIN_TABLE_EDIT_USAGE', '#table_edit(): Usage: (a-page-name-you-want-to-edit)');
92c102
< function EditableTableEditCell($text, $link)
---
> function EditableTableEditCell($text, $link, $icon = '')
93a104
>   global $script;
94a106,113
>
>   if (defined('PLUGIN_TABLE_EDIT_IMAGE_BASEURL') && $icon != '') {
>     if (PLUGIN_TABLE_EDIT_IMAGE_BASEURL == '')
>       $icon_uri = mbereg_replace('(.+/).+', '\1', get_script_uri()) . IMAGE_DIR . $icon;
>     else
>       $icon_uri = PLUGIN_TABLE_EDIT_IMAGE_BASEURL . $icon;
>     $this->rawtext = '[[&ref(' . $icon_uri . ',nolink,' . $text .');' . '>' . $link . ']]';
>   } else {
96a116
> }
304c324
<         $new_table->elements[0][] = & new EditableTableEditCell(PLUGIN_TABLE_EDIT_STRING_ADD, get_script_uri()  . '?cmd=' . PLUGIN_TABLE_EDIT_PLUGIN_NAME . '&mode=edit&page=' . rawurlencode($vars['page']) . '&table=' . $table_number . '&row=-1&from=' . rawurlencode($from_page));
---
>         $new_table->elements[0][] = & new EditableTableEditCell(PLUGIN_TABLE_EDIT_STRING_ADD, get_script_uri()  . '?cmd=' . PLUGIN_TABLE_EDIT_PLUGIN_NAME . '&mode=edit&page=' . rawurlencode($vars['page']) . '&table=' . $table_number . '&row=-1&from=' . rawurlencode($from_page), 'table_edit_add.png');
306c326
<         $new_table->elements[0][] = & new EditableTableEditCell(PLUGIN_TABLE_EDIT_STRING_EDIT, get_script_uri() . '?cmd=' . PLUGIN_TABLE_EDIT_PLUGIN_NAME . '&mode=edit&page=' . rawurlencode($vars['page']) . '&table=' . $table_number . '&row=' . ($cnt-1) . '&from=' . rawurlencode($from_page));
---
>         $new_table->elements[0][] = & new EditableTableEditCell(PLUGIN_TABLE_EDIT_STRING_EDIT, get_script_uri() . '?cmd=' . PLUGIN_TABLE_EDIT_PLUGIN_NAME . '&mode=edit&page=' . rawurlencode($vars['page']) . '&table=' . $table_number . '&row=' . ($cnt-1) . '&from=' . rawurlencode($from_page), 'table_edit_edit.png');
426c446
<   return '#include(): Included already: ' . $link . '<br />' . "\n";
---
>   return '#table_edit(): Included already: ' . $link . '<br />' . "\n";
428c448
<   return '#include(): No such page: ' . $s_page . '<br />' . "\n";
---
>   return '#table_edit(): No such page: ' . $s_page . '<br />' . "\n";
430c450
<   return '#include(): Limit exceeded: ' . $link . '<br />' . "\n";
---
>   return '#table_edit(): Limit exceeded: ' . $link . '<br />' . "\n";
463c483
< if ($row == -1 || $vars['copy'] == 'on') {
---
> if ($row == -1 || $vars['copy'] == 'on') { // add mode
466a487,488
>     if ($str == PLUGIN_TABLE_EDIT_NEW_ITEM) $str = $vars['cell_' . ($i+1) . '_str'];
>     if (PLUGIN_TABLE_EDIT_USE_MULTIROW) $str = mbereg_replace('[\r\n]+', '&br;', $str);
470c492
< } else {
---
> } else { // edit mode
473a496,497
>     if ($str == PLUGIN_TABLE_EDIT_NEW_ITEM) $str = $vars['cell_' . ($i+1) . '_str'];
>     if (PLUGIN_TABLE_EDIT_USE_MULTIROW) $str = mbereg_replace('[\r\n]+', '&br;', $str);
494c518
< $body = '<form action="' . get_script_uri() . '?cmd=' . PLUGIN_TABLE_EDIT_PLUGIN_NAME . '&mode=post&from=' . rawurlencode($from_page) . '&table=' . $table_id . '&row=' . $row . '&page=' . rawurlencode($vars['page']) . '&digest=' . $digest . '" method="post">';
---
> $body .= '<form action="' . get_script_uri() . '?cmd=' . PLUGIN_TABLE_EDIT_PLUGIN_NAME . '&mode=post&from=' . rawurlencode($from_page) . '&table=' . $table_id . '&row=' . $row . '&page=' . rawurlencode($vars['page']) . '&digest=' . $digest . '" method="post">';
509c533,583
<   $body .= ' &nbsp; &nbsp; <input type="text" size="' . PLUGIN_TABLE_EDIT_FIELD_WIDTH . '" name="cell_' . ($i+1) . '" value=';
---
>
>   $cand_item = array();
>   if (PLUGIN_TABLE_EDIT_FORM_SELECTION_MAX_ITEM > 0) {
>     // generate candidates
>     $row_size = count($table->elements);
>     for ($j = 1; $j < $row_size; $j++) {
>       $cell_item = $table->elements[$j][$i];
>       for ($k = 0; $k < count($cand_item); $k++) {
>         if ($cand_item[$k]->cellString() == $cell_item->cellString()) break;
>       }
>       if ($k == count($cand_item)) {
>         for ($k = 0; $k < count($cand_item); $k++) {
>           if ($cand_item[$k]->cellString() > $cell_item->cellString()) break;
>         }
>         if (true) {
>           $cand_item[] = null;
>           for ($l = count($cand_item) - 1; $k < $l; --$l) {
>             $cand_item[$l] = $cand_item[$l - 1];
>           }
>           $cand_item[$k] = $cell_item;
>         } else {
>           $cand_item[] = $cell_item;
>         }
>       }
>     }
>   }
>
>   if (PLUGIN_TABLE_EDIT_FORM_SELECTION_MAX_ITEM > 0 && count($cand_item) <= PLUGIN_TABLE_EDIT_FORM_SELECTION_MAX_ITEM) {
>     if (PLUGIN_TABLE_EDIT_FORM_SELECTION_RADIO) {
>       $is_firstelem = true;
>       foreach ($cand_item as $j) {
>         $is_checked = $row == -1? $is_firstelem : $table->elements[$row][$i]->cellString() == $j->cellString();
>         $body .= ' &nbsp; <input type="radio" name="cell_' . ($i+1) . '" value="' . $j->rawtext . '" ' . ($is_checked? 'checked' : '') . '>' . $j->cellString() . "</input><br />";
>         $is_firstelem = false;
>       }
>       $body .= ' &nbsp; <input type="radio" name="cell_' . ($i+1) . '" value="' . PLUGIN_TABLE_EDIT_NEW_ITEM . '" ' . ($is_firstelem? 'checked' : '') . '>' . PLUGIN_TABLE_EDIT_STRING_NEW_ITEM . '</input> <input type="textarea" size="' . PLUGIN_TABLE_EDIT_FIELD_WIDTH . '" name="cell_' . ($i+1) . '_str"></input><br />';
>     } else {
>       $body .= ' &nbsp; <select name="cell_' . ($i+1) . '" size="1">';
>       foreach ($cand_item as $j) {
>         $body .= ' &nbsp; <option value="' . $j->rawtext . '" ' . ($table->elements[$row][$i]->cellString() == $j->cellString()? 'selected' : '') . '>' . $j->cellString() . "</input><br />";
>       }
>       $body .= ' &nbsp; <option value="' . PLUGIN_TABLE_EDIT_NEW_ITEM . '">' . PLUGIN_TABLE_EDIT_STRING_NEW_ITEM . '</input></select> <br />';
>       $body .= ' &nbsp; (' . PLUGIN_TABLE_EDIT_STRING_NEW_ITEM . ') <input type="textarea" size="' . PLUGIN_TABLE_EDIT_FIELD_WIDTH . '" name="cell_' . ($i+1) . '_str"></input><br />';
>     }
>   } else if (PLUGIN_TABLE_EDIT_USE_MULTIROW) {
>     $text_rows = 1 + mbereg('&br;', $table->elements[$row][$i]->rawtext);
>     $body .= ' &nbsp; &nbsp; <textarea rows="' . $text_rows . '" cols="' . PLUGIN_TABLE_EDIT_FIELD_WIDTH . '" name="cell_' . ($i+1) . '">'
>       . mbereg_replace('&br;', '
> ', $table->elements[$row][$i]->rawtext) . '</textarea><br />';
>   } else {
>     $body .= ' &nbsp; &nbsp; <input type="textarea" size="' . PLUGIN_TABLE_EDIT_FIELD_WIDTH . '" name="cell_' . ($i+1) . '" value=';
513a588
> }
527c602
<   $body .= '<br /> &nbsp; <input type="submit" value="' . PLUGIN_TABLE_EDIT_STRING_DELETE . '">';
---
>   $body .= ' &nbsp; <input type="submit" value="' . PLUGIN_TABLE_EDIT_STRING_DELETE . '">';

トップ 編集凍結差分バックアップ添付複製名前変更リロード 新規一覧 単語検索 最終更新  ヘルプ  最終更新のRSS
Last-modified: 2010-09-12 (日) 22:31:22 (4153d)