OJS美化

XIAO Qinghe
XIAO Qinghe
管理员
1586
文章
0
粉丝
建站资源评论101字数 1881阅读6分16秒阅读模式

1、汉化问题

需要先安装Default Translation Plugin,大部分都已汉化。
不同的插件plugins和主题(也在plugins里)都有locale文件夹,可以补充zh_CN文件夹,把en文件夹里的locale.po文件拷贝进去,然后一一修改即可。
如:修改make a submission中文名字,在plugins/blocks里面找到makeSubmission,修改
msgid "plugins.block.makeSubmission.linkLabel"
msgstr "提交文章"
三个地方有汉化文件:
(1)根文件locale
(2)lib/pkp/locale
(3)plugins/~/locale
另外,出现##default.groups.name.translator##
需要在网站后台Roles里面修改,将其修改为“译者”即可。
如果不是插件,直接在根目录locale中修改zh_CN
如修改文稿为投稿
另外一例:中文版显示“期22,2024”,显然不符合规则,但不好改,不如将期改回No.
需要在根目录locale中zh_CN文件夹中locale.po将issue.number; issue. no中的“期”改为“No.”;
另外,how to cite中还有“期”,在插件文件夹lib/vendor/cite-style-language/locale中把“期”改为“No.”即可。

2、修改字体

部分theme的字体无法显示,可以在custom stylesheet中进行修改,如把所有字体都改成arial:
body {
  font-family: Arial, Helvetica, sans-serif;
}
h1,h2,h3,h4,h5,h6 {
 font-family: Arial, Helvetica, sans-serif;
}
.h1,.h2,.h3,.h4,.h5,.h6 {
 font-family: Arial, Helvetica, sans-serif;
}
.btn {
 font-family: Arial, Helvetica, sans-serif
}
.card-title {
 font-family: Arial, Helvetica, sans-serif
}
.dropdown-header {
 font-family: Arial, Helvetica, sans-serif
}
.navbar-logo-text {
 font-family: Arial, Helvetica, sans-serif
}
#connect-orcid-button {
 font-family: Arial, Helvetica, sans-serif
}
.form-register .list-group-item-heading {
font-family: Arial, Helvetica, sans-serif
}
.article-summary-title {
 font-family: Arial, Helvetica, sans-serif
}
.article-summary-date {
font-family: Arial, Helvetica, sans-serif
}
.article-details-issue-identifier {
font-family: Arial, Helvetica, sans-serif
}
.author-symbol {
font-family: Arial, Helvetica, sans-serif
}
.issue-toc-section-title {
font-family: Arial, Helvetica, sans-serif
}
.announcement-summary-date {
font-family: Arial, Helvetica, sans-serif
}
.homepage-issue-published {
font-family: Arial, Helvetica, sans-serif
}
.page-announcement .announcement0date {
font-family: Arial, Helvetica, sans-serif
}
.page-search .pagination strong,
.page-search .pagination a {
font-family: Arial, Helvetica, sans-serif
}
.author-details-issue {
font-family: Arial, Helvetica, sans-serif
}
.category-title {
font-family: Arial, Helvetica, sans-serif
}
.category-subcategories-list li a {
font-family: Arial, Helvetica, sans-serif
}
.block_make_submission .block_make_submission_link {
font-family: Arial, Helvetica, sans-serif
}

3、增加一个scroll up 的图标

由于文章比较长,所以在底部增加一个scroll up图标就很有必要,首先安装custom header plugin
在header加入:
<button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
在footer加入:
<script>
// Get the button
let mybutton = document.getElementById("myBtn");
// When the user scrolls down 20px from the top of the document, show the button
window.onscroll = function() {scrollFunction()};
function scrollFunction() {
  if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
    mybutton.style.display = "block";
  } else {
    mybutton.style.display = "none";
  }
}
// When the user clicks on the button, scroll to the top of the document
function topFunction() {
  document.body.scrollTop = 0;
  document.documentElement.scrollTop = 0;
}
</script>
然后再在style sheet中加入如下css,并上传即可:
#myBtn {
  display: none; /* Hidden by default */
  position: fixed; /* Fixed/sticky position */
  bottom: 20px; /* Place the button at the bottom of the page */
  right: 30px; /* Place the button 30px from the right */
  z-index: 99; /* Make sure it does not overlap */
  border: none; /* Remove borders */
  outline: none; /* Remove outline */
  background-color: red; /* Set a background color */
  color: white; /* Text color */
  cursor: pointer; /* Add a mouse pointer on hover */
  padding: 15px; /* Some padding */
  border-radius: 10px; /* Rounded corners */
  font-size: 18px; /* Increase font size */
}
#myBtn:hover {
  background-color: #555; /* Add a dark-grey background on hover */
}

4、修改页脚logo

 

只需要替换templates/images中的相关图片即可。
另外,可以删除页脚的logo:
lib/pkp/templates/frontend/components
Demo: journals.chinesecs.cn

5、更换域名

 

除了在网站设置里更换域名之外,需要修改config.inc.php
注意有两个地方需要修改;除了更换域名,也可以添加域名:
base_url = "https://jrcc1.chinesecs.cc";"https://journals.chinesecs.cc"
allowed_hosts = "[\"jrcc1.chinesecs.cc\","\journals.chinesecs.cc\"]"

6、更换服务器

1、备份ojs所有文件,包括files(如果列在别处);
2、备份数据库;
3、以上都可以通过宝塔面板进行;
4、在新服务器,通过宝塔面板新建网站,输入新网址,并申请ssl;(提前解析好);
5、将ojs所有文件上传到新网站文件夹;上传备份数据库,并导入;
6、注意修改config.inc.php内容如下:

1)修改网址,有两个地方:

base_url = "https://journals.chinesecs.cc"
allowed_hosts = "[\"journals.chinesecs.cc\"]"

2)修改数据库

name以及password修改成新数据库的名称与密码;

3)修改files路径(如果在根目录,可以不用修改)

如果不成功,如500错误,可能是文件解压不完全或者丢失,可以再次上传。

注意服务器环境:需要用apache

具体参考:

https://docs.pkp.sfu.ca/faq/en/site-administration#:~:text=How%20can%20I%20move%20an%20installation%20to%20a,the%20base%20install%20directory%20and%20non-public%20files%20directory

 

7、移除index.php

首先在config.inc.php中把restful_Url设置成on

其次,在htacess中加入:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,L]
</IfModule>

 

参考:https://docs.pkp.sfu.ca/faq/en/site-administration#how-can-i-remove-indexphp-from-the-urls-in-ojs

 

8、修改菜单字体大小

一般是在主题中修改相关代码,如healthscience主题,路径是:

~/plugins/themes/~/styles/components/header.less

 

9、修改custom style sheet

路径是~/public/journals/1(此为杂志所在文件夹);site中的sheet可以删除。

 

注意:修改css后,需要清除缓存。

 

10、升级ojs

(1)注意首先做好备份;

(2)新建文件夹,更改网站目录;

(3)上传新系统,解压;

(4)复制cache、files文件,覆盖;

(5)修改inc文件;

(6)修改install=on 为off;

(7)https://你的域名/ojs/index.php/install/upgrade

或者将cache、files、inc文件全部覆盖新系统?

 

1、新建文件夹
2、剪切旧文件到新建文件夹
3、原文件夹上传新系统
4、解压
5、复制旧Cache、files、plugins文件覆盖
6、复制其他文件如favicon、hitaccess
7、修改inc文件,主要是网址、数据库、文件夹
8、访问/index.php/index/upgrade
9、install=off 改成on

 

然后全部覆盖

不成功:全部覆盖?

如果出现上传错误,修改files权限为777

 

11、增加下载、浏览数量

文章页:

<section class="item abstract">
<span>
<h2 class="lable">Counts</h2>
{assign var=galleys value=$article->getGalleys()}
Views: {$article->getViews()}
{if $galleys}
{foreach from=$galleys item=galley name=galleyList}
/ Downloads: {$galley->getViews()}
{/foreach}
</span>
</section>
{/if}

templates/frontend/objects/details.tpl

 

列表页:

{assign var=galleys value=$article->getGalleys()}
Views: {$article->getViews()}
{if $galleys}
    {foreach from=$galleys item=galley name=galleyList}
       /
    {/foreach}
{/if}
{if $galleys}
{foreach from=$galleys item=galley name=galleyList}
{$galley->getGalleyLabel()} Downloaded: {$galley->getViews()} times
{/foreach}
{/if}
</div>
{/if}
templates/frontend/objects/summary.tpl

 

注意:只有官方默认主题才有效。

 

12、修改页脚(全部)

 

路径:/lib/pkp/templates/frontend/components

如增加在 {$pageFooter}增加:© 2025 is licensed under <a href="https://creativecommons.org/licenses/by/4.0/?ref=chooser-v1" target="_blank" rel="license noopener noreferrer">CC BY 4.0 <img src="https://docs.pkp.sfu.ca/img/creativecommons.svg" alt="知识共享标志" /><img src="https://docs.pkp.sfu.ca/img/attribution.svg" alt="归因图标" /></a>

 

13、下载量汉化:

路径:/templates/frontend/objects

<section class="item abstract">
<span>
<h2 class="lable">{translate key="article.Counts"}</h2>
{assign var=galleys value=$article->getGalleys()}
{translate key="article.Views"}: {$article->getViews()}
{if $galleys}
{foreach from=$galleys item=galley name=galleyList}
/ {translate key="article.Downloads"}: {$galley->getViews()}
{/foreach}
</span>
</section>
{/if}

 

第一步:locale/en/locale

msgid "article.Counts"
msgstr "Counts"

msgid "article.Views"
msgstr "Views"

msgid "article.Downloads"
msgstr "Downloads"

第二步:locale/zh_CN/locale

msgid "article.Counts"
msgstr "统计"

msgid "article.Views"
msgstr "浏览"

msgid "article.Downloads"
msgstr "下载"

 

14、其他主题增加下载量

路径:/plugins/themes/classic/templates/frontend/objects

details.tpl: (放在 {call_hook name="Templates::Article::Main"}之后)

<span>
<h2 class="lable">{translate key="article.Counts"}</h2>
{assign var=galleys value=$article->getGalleys()}
{translate key="article.Views"}: {$article->getViews()}
{if $galleys}
{foreach from=$galleys item=galley name=galleyList}
/ {translate key="article.Downloads"}: {$galley->getViews()}
{/foreach}
</span>
</section>
{/if}

 

summary.tpl:(放在 {call_hook name="Templates::Issue::Issue::Article"}</article>之前)

{assign var=galleys value=$article->getGalleys()}
{translate key="article.Views"}: {$article->getViews()}
{if $galleys}
{foreach from=$galleys item=galley name=galleyList}
/ {translate key="article.Downloaded"}: {$galley->getViews()}
{/foreach}
{/if}

 

参加:https://forum.pkp.sfu.ca/t/how-to-get-total-pdf-downloads-count-in-ojs-3-3-x-x/70449/7

15、开启文章下载量图示

在website主题设置中打开Use bar type of the chart for usage statistics display.

汉化Downloads

在locale增加:plugins.themes.healthSciences.displayStats.downloads

为“下载”

其他主题改为:msgid "plugins.themes.classic.displayStats.downloads"
msgstr "下载"

更多内容:

 

参考:

 

https://dev.bdhostit.com/category/ojs/

 

PKP社区:

 

https://forum.pkp.sfu.ca/

继续阅读
 
  • 建站资源
匿名

发表评论

匿名网友
确定

拖动滑块以完成验证