|
|
(同じ利用者による、間の23版が非表示) |
1行目: |
1行目: |
| = 2012年1月4日(水)=
| | 351-0198 埼玉県和光市広沢2−1 |
| === SyntaxHighlight GeSHi の導入 ===
| |
| * http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi のインストール
| |
|
| |
|
| === Pubmed プラグイン利用時に表示が遅い ===
| | 国立研究開発法人理化学研究所脳神経科学研究センター |
| * キャッシュ機能はキーワードを元に pubmed に問い合わせて得られた結果の pmid をキャッシュしているため,表示毎に<nowiki><pubmed>...</pubmed></nowiki>の数だけ通信が発生する.
| |
| * 対策として pubmed に問い合わせる前段階でキャッシュする機能を実装.
| |
| * extensions/Pubmed/entrez.cl/entrez_eutil_nijc.class.php
| |
| <syntaxhighlight lang="php">
| |
| <?php
| |
|
| |
|
| class entrez_eutils_nijc extends entrez_eutils_fcgi {
| | 神経情報基盤開発ユニット |
| // constructor
| |
| function entrez_eutils_nijc() {
| |
| parent::entrez_eutils_fcgi();
| |
| }
| |
|
| |
|
| // override search2 method
| | システム担当:今泉,奥村 |
| function search2($db, $term, $off=0, $limit=500) {
| |
| global $wgPubmedCacheExpire;
| |
| if (empty($this->_cache))
| |
| return parent::search2($db, $term, $off, $limit);
| |
| $cache = new Cache();
| |
| $cache->cachedir = $this->_cache;
| |
| $filename = sprintf('esearch_%s', md5($term));
| |
| $now = time();
| |
| $expire = 604800; // 86400:1day, 604800:1 week
| |
| if (isset($wgPubmedCacheExpire))
| |
| $expire = intval($wgPubmedCacheExpire);
| |
| if ($cache->check($filename)) {
| |
| $data = $cache->load($filename);
| |
| if ($data['date'] + $expire >= $now)
| |
| return $data['value'];
| |
| }
| |
| $data = array(
| |
| 'date' => $now,
| |
| 'value' => parent::search2($db, $term, $off, $limit),
| |
| );
| |
| $cache->save($filename, $data);
| |
| return $data['value'];
| |
| }
| |
| }
| |
| </syntaxhighlight>
| |
| * extension/Pubmed/Pubmed.php
| |
| <syntaxhighlight lang="php">
| |
| require_once("entrez.cl/entrez_eutil.class.php");
| |
| // NIJC:
| |
| require_once("entrez.cl/entrez_eutil_nijc.class.php");
| |
| include("layout.inc.php");
| |
| ...
| |
| // NIJC:
| |
| //$ncbi = new entrez_eutils_fcgi();
| |
| $ncbi = new entrez_eutils_nijc();
| |
| | |
| </syntaxhighlight>
| |
| * LocalSettings.php
| |
| <syntaxhighlight lang="php">
| |
| $wgPubmedCacheExpire = 604800; // 1week yo 12/1/4
| |
| </syntaxhighlight>
| |
| | |
| === Pubmed 文献の参考文献の際,参照番号の右に著者を表示したい ===
| |
| * レイアウトテンプレートを修正
| |
| ** extension/Pubmed/layouts/layout_ext.def
| |
| <pre>
| |
| <b>##Authors##</b>
| |
| <p style=" border:none; outset none; margin:0em; padding:0em; background-color:#fff;">
| |
| ##Title## <br>
| |
| <i>##Journal##</i>: ##Year##, ##Volume##(##Issue##);##Pages## ##PMID## ##WORLDCAT## ##DOI## <br>
| |
| </p>
| |
| </pre>
| |
| | |
| = 2011年12月15日(木)=
| |
| === ページ毎に meta タグに入れるキーワードを設定したい ===
| |
| * 前日に作った拡張 AddKeywordsMetaTag に [http://www.mediawiki.org/wiki/Extension:MetaKeywordsTag この機能] をマージ
| |
| <syntaxhighlight lang="php">
| |
| <?php
| |
| | |
| $wgExtensionCredits['other'][] = array(
| |
| 'name' => 'AddKeywordsMetaTag',
| |
| 'status' => 'Experimental',
| |
| 'author' => 'Yoshihiro OKUMURA',
| |
| 'version' => '2.0',
| |
| 'url' => 'http://www.neuroinf.jp/',
| |
| 'description' => 'Add keywords into meta tag',
| |
| );
| |
| $wgHooks['OutputPageBeforeHTML'][] = 'wfAddKeywordsMetaTag';
| |
| $wgExtensionFunctions[] = 'wfAddKeywordsMetaTagParserHooks';
| |
|
| |
| function wfAddKeywordsMetaTagParserHooks() {
| |
| global $wgParser, $wgMessageCache;
| |
| $wgParser->setHook( 'keywords', 'wfAddKeywordsMetaTagRender' );
| |
| $wgMessageCache->addMessage(
| |
| 'metakeywordstag-missing-content',
| |
| 'Error: <keywords> tag must contain a "content" attribute.'
| |
| );
| |
| }
| |
|
| |
| function wfAddKeywordsMetaTagRender($text, $params = array(), $parser) {
| |
| // Short-circuit with error message if content is not specified.
| |
| if (!isset($params['content'])) {
| |
| return '<div class="errorbox">'.
| |
| wfMsgForContent('metakeywordstag-missing-content').
| |
| '</div>';
| |
| }
| |
| // Return encoded content
| |
| return '<!-- META_KEYWORDS '.base64_encode($params['content']).' -->';
| |
| }
| |
|
| |
| function wfAddKeywordsMetaTag(&$out, &$text) {
| |
| global $wgTitle, $wgParser, $wgRequest, $action;
| |
| if ($action !== 'edit' &&
| |
| $action !== 'history' &&
| |
| $action !== 'delete' &&
| |
| $action !== 'watch') {
| |
| // Mediawiki:Keywords
| |
| $title = Title::MakeTitle(NS_MEDIAWIKI, 'Keywords');
| |
| $article = new Article($title);
| |
| $keywords = array_map('trim', explode(',', $article->getRawText()));
| |
| foreach ($keywords as $keyword)
| |
| if (!empty($keyword))
| |
| $out->addKeyword($keyword);
| |
| $namespaces = array(NS_MAIN, NS_USER, NS_PROJECT, NS_MEDIAWIKI);
| |
| foreach ($namespaces as $namespace) {
| |
| // Mediawiki::Keywords-$namespace
| |
| if ($wgTitle->getNamespace() === $namespace) {
| |
| $page = sprintf('Keywords-%u', $namespace);
| |
| $title = Title::MakeTitle(NS_MEDIAWIKI, $page);
| |
| $article = new Article($title);
| |
| $keywords = array_map('trim', explode(',', $article->getRawText()));
| |
| foreach ($keywords as $keyword)
| |
| if (!empty($keyword))
| |
| $out->addKeyword($keyword);
| |
| }
| |
| }
| |
| }
| |
| // part of MetaKeywordsTag.php
| |
| if (preg_match_all('/<!-- META_KEYWORDS ([0-9a-zA-Z\\+\\/]+=*) -->/m', $text, $matches)) {
| |
| $data = $matches[1];
| |
| // Merge keyword data into OutputPage as meta tags
| |
| foreach ($data aS $item) {
| |
| $content = @base64_decode($item);
| |
| $keywords = array_map('trim', explode(',', $content));
| |
| foreach ($keywords as $keyword)
| |
| if (!empty($keyword))
| |
| $out->addKeyword($keyword);
| |
| }
| |
| }
| |
| return true;
| |
| }
| |
| </syntaxhighlight>
| |
| | |
| = 2011年12月14日(水)=
| |
| === FCKEditor を使うと図のキャプションが消える.===
| |
| * [http://www.mediawiki.org/wiki/Extension_talk:FCKeditor_%28Official%29#disappearing_thumbnail_captions 参照]
| |
| <pre>
| |
| 使用前 [[Image:Differentialdisplay.jpg|thumb|テスト]]
| |
| 使用後 [[Image:Differentialdisplay.jpg|thumb]]
| |
| </pre>
| |
| * extensions/FCKeditor/FCKeditorSkin.body.php を上記を参考に以下のように修正
| |
| <syntaxhighlight lang="php">
| |
| // NIJC:
| |
| //if (isset($fp['alt']) && !empty($fp['alt']) && $fp['alt'] != "Image:" . $orginal) {
| |
| // $ret .= "alt=\"".htmlspecialchars($fp['alt'])."\" ";
| |
| if (isset($fp['caption']) && !empty($fp['caption']) && $fp['caption'] != "Image:" . $orginal) {
| |
| $ret .= "alt=\"".htmlspecialchars($fp['caption'])."\" ";
| |
| }
| |
| </syntaxhighlight>
| |
| | |
| === keywords meta タグを入れたい ===
| |
| * extension/AddKeywordsMetaTag.php を作ってみた.
| |
| <syntaxhighlight lang="php">
| |
| <?php
| |
| | |
| $wgExtensionCredits['other'][] = array(
| |
| 'name' => 'AddKeywordsMetaTag',
| |
| 'status' => 'Experimental',
| |
| 'author' => 'Yoshihiro OKUMURA',
| |
| 'version' => '1.0',
| |
| 'url' => 'http://www.neuroinf.jp/',
| |
| 'description' => 'Mediawiki:Keywords ページの内容を keywords meta タグとして出力します.',
| |
| );
| |
| $wgHooks['OutputPageBeforeHTML'][] = 'wfAddKeywordsMetaTag';
| |
|
| |
| function wfAddKeywordsMetaTag(&$out, &$text) {
| |
| global $wgTitle, $wgParser, $wgRequest, $action;
| |
| if ($action !== 'edit' &&
| |
| $action !== 'history' &&
| |
| $action !== 'delete' &&
| |
| $action !== 'watch') {
| |
| // Mediawiki:Keywords
| |
| $title = Title::MakeTitle(NS_MEDIAWIKI, 'Keywords');
| |
| $article = new Article($title);
| |
| $keywords = array_map('trim', explode(',', $article->getRawText()));
| |
| foreach ($keywords as $keyword)
| |
| if (!empty($keyword))
| |
| $out->addKeyword($keyword);
| |
| $namespaces = array(NS_MAIN, NS_USER, NS_PROJECT, NS_MEDIAWIKI);
| |
| foreach ($namespaces as $namespace) {
| |
| // Mediawiki::Keywords-$namespace
| |
| if ($wgTitle->getNamespace() === $namespace) {
| |
| $page = sprintf('Keywords-%u', $namespace);
| |
| $title = Title::MakeTitle(NS_MEDIAWIKI, $page);
| |
| $article = new Article($title);
| |
| $keywords = array_map('trim', explode(',', $article->getRawText()));
| |
| foreach ($keywords as $keyword)
| |
| if (!empty($keyword))
| |
| $out->addKeyword($keyword);
| |
| }
| |
| }
| |
| }
| |
| return true;
| |
| }
| |
| </syntaxhighlight>
| |
| | |
| = 2011年12月12日(月)=
| |
| === FCKEditor を使うとwikipediaへのリンクが符号化される. ===
| |
| <pre>
| |
| 使用前 [[wikipedia:jp:理化学研究所|理化学研究所]]
| |
| 使用後 [[wikipedia:jp:%E7%90%86%E5%8C%96%E5%AD%A6%E7%A0%94%E7%A9%B6%E6%89%80|理化学研究所]]
| |
| </pre>
| |
| * extensions/FCKeditor/plugins/mediawiki/fckplugin.js を以下のように修正
| |
| <syntaxhighlight lang="javascript">
| |
| if (a.className == 'extiw')
| |
| {
| |
| a.href = a.title ;
| |
| // NIJC:
| |
| // a.setAttribute( '_fcksavedurl', a.href ) ;
| |
| a.setAttribute( '_fcksavedurl', a.title ) ;
| |
| }
| |
| </syntaxhighlight>
| |
| | |
| = 2011年12月7日(水)=
| |
| === metaタグ index,follow の制御が効かない. ===
| |
| * 承認モジュール ApprovedRevs 由来の問題 [https://bugzilla.wikimedia.org/show_bug.cgi?id=29859 参考]
| |
| * includes/Article.php を以下のように修正
| |
| <syntaxhighlight lang="php">
| |
| // NIJC:
| |
| //if ( $this->getID() === 0 || $this->getOldID() ) {
| |
| if ( $this->getID() === 0 || $this->getOldID() == intval( @$_GET['oldid'] ) ) {
| |
| # Non-articles (special pages etc), and old revisions
| |
| return array( 'index' => 'noindex',
| |
| 'follow' => 'nofollow' );
| |
| } elseif ( $wgOut->isPrintable() ) {
| |
| </syntaxhighlight>
| |
| | |
| = 2011年6月15日 (水) =
| |
| == 設定変更 ==
| |
| * URLが http://www.bsd.neuroinf.jp/ でも接続できるように
| |
| * ドキュメントのライセンスを[http://creativecommons.org/licenses/by-nd/2.1/jp/ CC-BY-ND Japan]に変更
| |
| | |
| = 2011年6月7日 (火) =
| |
| | |
| == サーバ準備 ==
| |
| * ホスト名: bsd.neuroinf.jp (仮)
| |
| * OS: Linux CentOS 5.6 x86_64
| |
| | |
| == MediaWiki 導入 ==
| |
| * [http://www.mediawiki.org/wiki/MediaWiki MediaWiki] 1.16.5 インストール
| |
| ** 言語は日本語(ja)を利用
| |
| ** ドキュメントのライセンスを無難なセンで[http://creativecommons.org/licenses/by-sa/2.1/jp/ CC-BY-SA Japan]に設定 (仮)
| |
| * [http://www.mediawiki.org/wiki/Manual:Short_URL Short_URL] 設定
| |
| * ロゴ画像設置(仮)
| |
| ** [http://www.iconfinder.com/icondetails/23662/128/accessories_dictionary_icon これ]をベースに文字を入れ替えたものに
| |
| <syntaxhighlight lang="php">
| |
| $wgLogo = "$wgScriptPath/images/BSD-Logo.png";
| |
| </syntaxhighlight>
| |
| * 画像アップロードの設定
| |
| <syntaxhighlight lang="php">
| |
| $wgEnableUploads = true;
| |
| $wgUploadPath = "{$wgScriptPath}/images";
| |
| $wgUploadDirectory = "{$IP}/images";
| |
| $wgUseImageMagick = true;
| |
| $wgImageMagickConvertCommand = "/usr/bin/convert";
| |
| </syntaxhighlight>
| |
| * 数式への対応
| |
| ** [http://www.mediawiki.org/wiki/Manual:Running_MediaWiki_on_Fedora このあたり]を参考に
| |
| <syntaxhighlight lang="php">
| |
| $wgUseTeX = true;
| |
| $wgTexvc = "/usr/bin/texvc116";
| |
| $wgMathPath = "{$wgUploadPath}/math";
| |
| $wgMathDirectory = "{$wgUploadDirectory}/math";
| |
| $wgTmpDirectory = "{$wgUploadDirectory}/tmp";
| |
| </syntaxhighlight>
| |
| * 匿名ユーザの「新規アカウント作成」と「ページの編集」はとりあえず無効に
| |
| <syntaxhighlight lang="php">
| |
| $wgGroupPermissions['*']['createaccount'] = false;
| |
| $wgGroupPermissions['*']['edit'] = false;
| |
| </syntaxhighlight>
| |
| | |
| == UMIN の既存データの複製 ==
| |
| * https://center3.umin.ac.jp/umin-wiki/mw_bsd/index.php/メインページ のデータをこのサイトへ貼り付け
| |
| | |
| == TODO ==
| |
| * Extensions の選定と設置
| |
| ** Youtube 等の動画貼り付け
| |
| ** 査読
| |
| ** 等々
| |