Discussion
インストール
DokuWik に管理者権限のユーザーでログイン
[管理] [拡張機能管理] [検索とインストール]
拡張機能の検索:discussion
プラグインの設定
DokuWik に管理者権限のユーザーでログイン
[管理] [サイト設定]
Discussion
デフォルトで全てのページにコメントセクションを追加 | |
上記オプションを元に戻す、名前空間の一覧 | |
登録していないユーザーのコメントを許可 | |
ゲストのコメント表示を許可 | |
コメントした人の名前にe-mailリンクを貼る | |
コメントのアバターとしてユーザー画像を使用 | |
ユーザーのURL入力を許可 | |
ユーザーの郵便番号入力を許可 | |
管理者にインポートする為の全てのフィールドの設定を許可 | |
コメント内でもwiki文法を許可 | |
コメント購読の有効/無効を表示 | |
新しいコメントを最初に表示 | |
コメント内容を管理者が確認する | |
コメントのスレッド表示を許可 | |
ユーザー名の代わりにwikiのユーザー情報に登録されている名前を表示する | |
新しいスレッドフォームの位置 | 下 |
コメントセクションの表示を切り替えるボタンを有効にする | |
承認者グループ(DokuWikiのマネージャー権限と同じレベル)のカンマ区切り一覧 | @admin |
承認者に対して新しいコメントの通知メールを送信する |
カスタマイズ
メールアドレスの必須入力を解除
/site_root/lib/plugins/discussion/action.php を 変更
if(isset($_SERVER['REMOTE_USER']) && !$this->getConf('adminimport')) { $comment['user']['id'] = $_SERVER['REMOTE_USER']; $comment['user']['name'] = $INFO['userinfo']['name']; $comment['user']['mail'] = $INFO['userinfo']['mail']; } elseif((isset($_SERVER['REMOTE_USER']) && $this->getConf('adminimport') && $this->helper->isDiscussionMod()) || !isset($_SERVER['REMOTE_USER'])) { if(empty($_REQUEST['name'])) return; // don't add anonymous comments if(!empty($_REQUEST['mail']) && !mail_isvalid($_REQUEST['mail'])) { msg($lang['regbadmail'], -1); return; } else { $comment['user']['id'] = 'test'.hsc($_REQUEST['user']); $comment['user']['name'] = hsc($_REQUEST['name']);/site_root/lib/plugins/discussion/script.js を 変更
if (isBlank(form.name.value)){ form.name.focus(); form.name.style.backgroundColor = '#fcc'; return false; } else { form.name.style.backgroundColor = '#fff'; } // if (isBlank(form.mail.value) || form.mail.value.indexOf("@") == -1){ // form.mail.focus(); // form.mail.style.backgroundColor = '#fcc'; // return false; // } else { // form.mail.style.backgroundColor = '#fff'; // } if (isBlank(form.text.value)){ form.text.focus(); form.text.style.borderColor = '#fcc'; return false; }
コメント入力位置の変更
/site_root/lib/plugins/discussion/action.php を 変更
if($cnt > 1 || ($cnt == 1 && $data['comments'][$keys[0]]['show'] == 1) || $this->getConf('allowguests') || isset($_SERVER['REMOTE_USER'])) { $show = true; // section title $title = ($data['title'] ? hsc($data['title']) : $this->getLang('discussion')); ptln('<div class="comment_wrapper" id="comment_wrapper">'); // the id value is used for visibility toggling the section ptln('<h2><a name="discussion__section" id="discussion__section">', 2); ptln($title, 4); ptln('</a></h2>', 2); ptln('<div class="level2 hfeed">', 2); } // comment form if (($data['status'] == 1) && (!$reply || !$this->getConf('usethreading')) && !$edit) $this->_form(''); // now display the comments if (isset($data['comments'])) { if (!$this->getConf('usethreading')) { $data['comments'] = $this->_flattenThreads($data['comments']); uasort($data['comments'], '_sortCallback'); } if($this->getConf('newestfirst')) { $data['comments'] = array_reverse($data['comments']); } foreach ($data['comments'] as $key => $value) { if ($key == $edit) $this->_form($value['raw'], 'save', $edit); // edit form else $this->_print($key, $data, '', $reply); } } // // comment form // if (($data['status'] == 1) && (!$reply || !$this->getConf('usethreading')) && !$edit) $this->_form(''); if($show) { ptln('</div>', 2); // level2 hfeed ptln('</div>'); // comment_wrapper } // check for toggle print configuration
コメント欄の行数調整
コメント欄の行数を変更
/site_root/lib/plugins/discussion/action.php を 変更
<!-- Fix for disable the toolbar when wikisyntaxok is set to false. See discussion's script.jss --> <?php if($this->getConf('wikisyntaxok')) { ?> <div id="discussion__comment_toolbar" class="toolbar group"> <?php } else { ?> <div id="discussion__comment_toolbar_disabled"> <?php } ?> </div> <textarea class="edit<?php if($_REQUEST['comment'] == 'add' && empty($_REQUEST['text'])) echo ' error'?>" name="text" cols="80" rows="5" id="discussion__comment_text" tabindex="5"><?php if($raw) { echo formText($raw); } else { echo hsc($_REQUEST['text']); }
ユーザー定義スタイルシートの追加
見た目の微調整
スタイルシートの作成
userstyle.css が存在しない場合はファイルを作成
/site_root/conf/userstyle.css に追記
div.dokuwiki div#discussion__comment_preview { display: none; } div.dokuwiki div.comment_form { margin-bottom: 3.5em !important; margin-top: 0.5em !important; } #comment_wrapper > h2 { margin-bottom: 0; }
設置の確認
DokuWik に管理者権限のユーザーでログイン
[管理]
追加プラグインに コメントを承認する が表示されていること
利用方法・利用手順
DokuWik に管理者権限のユーザーでログイン
[管理] [コメントを承認する]
コメント