Skip to content

Commit

Permalink
Merge branch 'adaptToOps-3_4_0' into 'main'
Browse files Browse the repository at this point in the history
Adapta plugin para OPS 3.4.0

See merge request softwares-pkp/temas/scielo!10
  • Loading branch information
JhonathanLepidus committed Feb 8, 2024
2 parents f468433 + 3085e4d commit a266f6a
Show file tree
Hide file tree
Showing 40 changed files with 933 additions and 1,095 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/generate-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
create-release:
name: Create release and package
env:
PLUGIN_NAME: scielo-theme
PLUGIN_NAME: scieloTheme
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand Down
3 changes: 3 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
variables:
PLUGIN_NAME: 'scieloTheme'

include:
- project: 'documentacao-e-tarefas/modelosparaintegracaocontinua'
ref: main
Expand Down
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

36 changes: 24 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,28 @@
# Tema - Scielo Preprints
# SciELO Theme

Esse repositório se trata do tema usado pela [Scielo Preprints](https://preprints.scielo.org/index.php/scielo).
This repository contains the theme plugin used by [Scielo Preprints](https://preprints.scielo.org/index.php/scielo).

## Pré-requisitos
Esse tema é compatível com o **OPS**, suportado a partir da versão:
- 3.3.0
## Compatibility

## Instalação
1. Entre na área de administração do seu site OPS pelo Painel de Controle.
2. Navegue até o `Configurações` > `Website` > `Plugins` > `Enviar novo plugin`.
3. Em Enviar arquivo selecione o arquivo **ScieloThemePlugin.tar.gz**.
4. Clique em Salvar e o plugin já estará instalado no seu OPS.
The latest release of this plugin is compatible with the following PKP applications:

---
**Copyright ©️ Lepidus Tecnologia**
* OPS 3.4.0

## Plugin Download

To download the plugin, go to the [Releases page](https://github.com/lepidus/scielo-theme/releases) and download the tar.gz package of the latest release compatible with your website.

## Installation

1. Enter the administration area of ​​your OPS website through the __Dashboard__.
2. Navigate to `Settings`>` Website`> `Plugins`> `Upload a new plugin`.
3. Under __Upload file__ select the file __scieloTheme.tar.gz__.
4. Click __Save__ and the plugin will be installed on your website.


# License
__This plugin is licensed under the GNU General Public License v3.0__

__Copyright (c) 2020 - 2024 Lepidus Tecnologia__

__Copyright (c) 2020 - 2024 SciELO__
79 changes: 26 additions & 53 deletions ScieloThemePlugin.inc.php → ScieloThemePlugin.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

/**
* @file plugins/themes/scielo-theme/ScieloThemePlugin.inc.php
* @file plugins/themes/scieloTheme/ScieloThemePlugin.php
*
* Copyright (c) 2014-2020 Simon Fraser University
* Copyright (c) 2003-2020 John Willinsky
* Copyright (c) 2020 - 2024 Lepidus Tecnologia
* Copyright (c) 2020 - 2024 SciELO
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class ScieloThemePlugin
Expand All @@ -13,16 +13,20 @@
* @brief Scielo theme
*/

import('lib.pkp.classes.plugins.ThemePlugin');
namespace APP\plugins\themes\scieloTheme;

use APP\core\Application;
use APP\file\PublicFileManager;
use PKP\config\Config;
use PKP\plugins\ThemePlugin;
use PKP\session\SessionManager;
use PKP\plugins\Hook;

class ScieloThemePlugin extends ThemePlugin
{
/**
* @copydoc ThemePlugin::isActive()
*/
public function isActive()
{
if (defined('SESSION_DISABLE_INIT')) {
if (SessionManager::isDisabled()) {
return true;
}
return parent::isActive();
Expand All @@ -36,8 +40,6 @@ public function isActive()
*/
public function init()
{
AppLocale::requireComponents(LOCALE_COMPONENT_PKP_MANAGER, LOCALE_COMPONENT_APP_MANAGER);

// Register theme options
$this->addOption('typography', 'FieldOptions', [
'type' => 'radio',
Expand Down Expand Up @@ -87,17 +89,6 @@ public function init()
],
'default' => false,
]);
// $this->addOption('useHomepageImageAsHeader', 'FieldOptions', [
// 'label' => __('plugins.themes.scielo.option.useHomepageImageAsHeader.label'),
// 'description' => __('plugins.themes.scielo.option.useHomepageImageAsHeader.description'),
// 'options' => [
// [
// 'value' => true,
// 'label' => __('plugins.themes.scielo.option.useHomepageImageAsHeader.option')
// ],
// ],
// 'default' => false,
// ]);

// Load primary stylesheet
$this->addStyle('stylesheet', 'styles/index.less');
Expand Down Expand Up @@ -133,6 +124,7 @@ public function init()
$additionalLessVariables[] = '@bg-base:' . $this->getOption('baseColour') . ';';
if (!$this->isColourDark($this->getOption('baseColour'))) {
$additionalLessVariables[] = '@text-bg-base:rgba(0,0,0,0.84);';
$additionalLessVariables[] = '@bg-base-border-color:rgba(0,0,0,0.2);';
}
}

Expand All @@ -152,12 +144,9 @@ public function init()

// Get homepage image and use as header background if useAsHeader is true
$context = Application::get()->getRequest()->getContext();
if ($context && $this->getOption('useHomepageImageAsHeader')) {
if ($context && $this->getOption('useHomepageImageAsHeader') && ($homepageImage = $context->getLocalizedData('homepageImage'))) {
$publicFileManager = new PublicFileManager();
$publicFilesDir = $request->getBaseUrl() . '/' . $publicFileManager->getContextFilesPath($context->getId());

$homepageImage = $context->getLocalizedData('homepageImage');

$homepageImageUrl = $publicFilesDir . '/' . $homepageImage['uploadName'];

$this->addStyle(
Expand Down Expand Up @@ -186,10 +175,10 @@ public function init()
$this->addScript('default', 'js/main.js');

// Add navigation menu areas for this theme
$this->addMenuArea(array('primary', 'user'));
$this->addMenuArea(['primary', 'user']);

HookRegistry::register('LoadHandler', array($this, 'changeHandlerPath'));
HookRegistry::register('Templates::Common::Sidebar', array($this, 'setSidebarToNotShowAtHome'));
Hook::add('LoadHandler', [$this, 'replaceIndexHandler']);
Hook::add('Templates::Common::Sidebar', [$this, 'setSidebarToNotShowAtHome']);
}

public function register($category, $path, $mainContextId = null)
Expand All @@ -200,19 +189,21 @@ public function register($category, $path, $mainContextId = null)
return $success;
}

public function changeHandlerPath($hookName, $args)
public function replaceIndexHandler($hookName, $params)
{
if ($args[0] == '' || $args[0] == 'index') {
$sourceFile =& $args[2];
$sourceFile = 'plugins/themes/scielo-theme/pages/index/index.php';
$page = $params[0];
if ($page == '' or $page == 'index') {
define('HANDLER_CLASS', 'APP\plugins\themes\scieloTheme\pages\index\ScieloIndexHandler');
return true;
}
return false;
}

public function setSidebarToNotShowAtHome($hookName, $args)
{
$params =& $args[0];
$smarty =& $args[1];
$output =& $args[2];
$params = & $args[0];
$smarty = & $args[1];
$output = & $args[2];

if ($params['location'] == 'sidebar') {
$request = Application::get()->getRequest();
Expand All @@ -225,39 +216,21 @@ public function setSidebarToNotShowAtHome($hookName, $args)
}
}

/**
* Get the name of the settings file to be installed on new journal
* creation.
* @return string
*/
public function getContextSpecificPluginSettingsFile()
{
return $this->getPluginPath() . '/settings.xml';
}

/**
* Get the name of the settings file to be installed site-wide when
* OJS is installed.
* @return string
*/
public function getInstallSitePluginSettingsFile()
{
return $this->getPluginPath() . '/settings.xml';
}

/**
* Get the display name of this plugin
* @return string
*/
public function getDisplayName()
{
return __('plugins.themes.scielo.name');
}

/**
* Get the description of this plugin
* @return string
*/
public function getDescription()
{
return __('plugins.themes.scielo.description');
Expand Down
21 changes: 0 additions & 21 deletions index.php

This file was deleted.

33 changes: 0 additions & 33 deletions locale/ar_IQ/locale.xml

This file was deleted.

30 changes: 0 additions & 30 deletions locale/cs_CZ/locale.xml

This file was deleted.

28 changes: 0 additions & 28 deletions locale/da_DK/locale.xml

This file was deleted.

51 changes: 0 additions & 51 deletions locale/de_DE/locale.po

This file was deleted.

Loading

0 comments on commit a266f6a

Please sign in to comment.