Merge branch '2.1.x'

Conflicts:
	tests/unit/functions/version_check_test.php
This commit is contained in:
Marc Alexander
2015-06-13 18:20:43 +02:00
24 changed files with 198 additions and 448 deletions

View File

@@ -18,6 +18,6 @@ The extension is currently under heavy development and not supported until furth
We are starting to have unit and functional tests in order to prevent regressions. You can check our travis build below.
2.1.x - [![Build Status](https://travis-ci.org/board3/Board3-Portal.svg?branch=2.1.x)](https://travis-ci.org/board3/Board3-Portal)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/board3/Board3-Portal/badges/quality-score.png?b=develop-2.1.x)](https://scrutinizer-ci.com/g/board3/Board3-Portal/?branch=develop-2.1.x)
[![Code Coverage](https://scrutinizer-ci.com/g/board3/Board3-Portal/badges/coverage.png?b=develop-2.1.x)](https://scrutinizer-ci.com/g/board3/Board3-Portal/?branch=develop-2.1.x)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/board3/Board3-Portal/badges/quality-score.png?b=2.1.x)](https://scrutinizer-ci.com/g/board3/Board3-Portal/?branch=2.1.x)
[![Code Coverage](https://scrutinizer-ci.com/g/board3/Board3-Portal/badges/coverage.png?b=2.1.x)](https://scrutinizer-ci.com/g/board3/Board3-Portal/?branch=2.1.x)

View File

@@ -18,7 +18,7 @@ class portal_module
protected $c_class;
protected $db, $user, $cache, $template, $display_vars, $config, $phpbb_root_path, $phpbb_admin_path, $phpEx, $phpbb_container;
protected $root_path, $version_check, $request, $php_ext, $portal_helper, $modules_helper, $log, $portal_columns;
protected $root_path, $request, $php_ext, $portal_helper, $modules_helper, $log, $portal_columns;
/** @var \board3\portal\portal\modules\manager */
protected $modules_manager;
@@ -51,7 +51,6 @@ class portal_module
$this->phpbb_admin_path = $phpbb_admin_path;
$this->php_ext = $phpEx;
$this->phpbb_container = $phpbb_container;
$this->version_check = $this->phpbb_container->get('board3.portal.version.check');
$this->portal_helper = $this->phpbb_container->get('board3.portal.helper');
$this->modules_helper = $this->phpbb_container->get('board3.portal.modules_helper');
$this->log = $phpbb_log;
@@ -99,7 +98,6 @@ class portal_module
'board3_enable' => array('lang' => 'PORTAL_ENABLE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'board3_left_column' => array('lang' => 'PORTAL_LEFT_COLUMN', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'board3_right_column' => array('lang' => 'PORTAL_RIGHT_COLUMN', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'board3_version_check' => array('lang' => 'PORTAL_VERSION_CHECK', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
'board3_display_jumpbox' => array('lang' => 'PORTAL_DISPLAY_JUMPBOX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'legend2' => 'ACP_PORTAL_COLUMN_WIDTH_SETTINGS',
@@ -168,11 +166,6 @@ class portal_module
$this->template->assign_var('SHOW_MODULE_OPTIONS', true);
}
}
else
{
// only show the mod version check if we are on the General Settings page
$this->version_check->check();
}
$this->new_config = $this->config;
$cfg_array = ($this->request->is_set('config')) ? $this->request->variable('config', array('' => ''), true) : $this->new_config;

View File

@@ -13,31 +13,6 @@
</div>
<!-- ENDIF -->
<!-- BEGIN mods -->
<fieldset>
<legend>{L_VERSION_CHECK}</legend>
<p style="font-weight: bold; color: <!-- IF mods.S_UP_TO_DATE -->#228822<!-- ELSE -->#BC2A4D<!-- ENDIF -->;">{mods.UP_TO_DATE}</p>
<dl>
<dt><label>{L_CURRENT_VERSION}</label></dt>
<dd><strong>{mods.CURRENT_VERSION}</strong></dd>
</dl>
<dl>
<dt><label>{L_LATEST_VERSION}</label></dt>
<dd><strong>{mods.LATEST_VERSION}</strong></dd>
</dl>
<!-- IF not mods.S_UP_TO_DATE -->
<dl>
<dt><label>{L_DOWNLOAD_LATEST}</label></dt>
<dd><strong><a href="{mods.DOWNLOAD}">{L_DOWNLOAD} {mods.TITLE} {mods.LATEST_VERSION}</a></strong></dd>
</dl>
<dl>
<dt><label>{L_ANNOUNCEMENT_TOPIC}</label></dt>
<dd><strong><a href="{mods.ANNOUNCEMENT}">{L_RELEASE_ANNOUNCEMENT}</a></strong></dd>
</dl>
<!-- ENDIF -->
</fieldset>
<!-- END mods -->
<form id="acp_portal_config" method="post" action="{B3P_U_ACTION}">
<!-- IF SHOW_MODULE_OPTIONS -->
<fieldset>

View File

@@ -13,33 +13,39 @@ phpbb.addAjaxCallback('b3p_move_module_up', function(res) {
return;
}
var el = $(this).parents('tr:first'),
trSwap = el.prev(),
elClass = trSwap.attr('class'),
trSwapClass = el.attr('class');
var $bottomRow = $(this).parents('tr:first'),
$topRow = $bottomRow.prev(),
topRowClass = $topRow.attr('class'),
bottomRowClass = $bottomRow.attr('class');
el.insertBefore(trSwap);
el.attr('class', elClass);
trSwap.attr('class', trSwapClass);
$bottomRow.insertBefore($topRow);
if (bottomRowClass !== 'row3' && topRowClass !== 'row3') {
$bottomRow.attr('class', topRowClass);
$topRow.attr('class', bottomRowClass);
} else if (bottomRowClass === 'row3') {
$topRow.attr('class', (topRowClass === 'row1') ? 'row2' : 'row1');
} else if (topRowClass === 'row3') {
$bottomRow.attr('class', (bottomRowClass === 'row1') ? 'row2' : 'row1');
}
// Swap images if swap element is first row
var swapIsFirstRow = trSwap.find('img[src*="icon_up_disabled"]').parents('span:first').is(':visible');
var swapIsFirstRow = $topRow.find('img[src*="icon_up_disabled"]').parents('span:first').is(':visible');
if (swapIsFirstRow) {
trSwap.find('img[src*="icon_up_disabled"]').parents('span:first').toggle();
trSwap.find('img[src*="icon_up."]').parents('span:first').toggle();
el.find('img[src*="icon_up."]').parents('span:first').toggle();
el.find('img[src*="icon_up_disabled"]').parents('span:first').toggle();
$topRow.find('img[src*="icon_up_disabled"]').parents('span:first').toggle();
$topRow.find('img[src*="icon_up."]').parents('span:first').toggle();
$bottomRow.find('img[src*="icon_up."]').parents('span:first').toggle();
$bottomRow.find('img[src*="icon_up_disabled"]').parents('span:first').toggle();
}
// Swap images if move element is last row
var elIsLastRow = el.find('img[src*="icon_down_disabled"]').parents('span:first').is(':visible');
var elIsLastRow = $bottomRow.find('img[src*="icon_down_disabled"]').parents('span:first').is(':visible');
if (elIsLastRow) {
trSwap.find('img[src*="icon_down_disabled"]').parents('span:first').toggle();
trSwap.find('img[src*="icon_down."]').parents('span:first').toggle();
el.find('img[src*="icon_down."]').parents('span:first').toggle();
el.find('img[src*="icon_down_disabled"]').parents('span:first').toggle();
$topRow.find('img[src*="icon_down_disabled"]').parents('span:first').toggle();
$topRow.find('img[src*="icon_down."]').parents('span:first').toggle();
$bottomRow.find('img[src*="icon_down."]').parents('span:first').toggle();
$bottomRow.find('img[src*="icon_down_disabled"]').parents('span:first').toggle();
}
});
@@ -48,33 +54,39 @@ phpbb.addAjaxCallback('b3p_move_module_down', function(res) {
return;
}
var el = $(this).parents('tr:first'),
trSwap = el.next(),
elClass = trSwap.attr('class'),
trSwapClass = el.attr('class');
var $topRow = $(this).parents('tr:first'),
$bottomRow = $topRow.next(),
bottomRowClass = $bottomRow.attr('class'),
topRowClass = $topRow.attr('class');
el.insertAfter(trSwap);
el.attr('class', elClass);
trSwap.attr('class', trSwapClass);
$topRow.insertAfter($bottomRow);
if (bottomRowClass !== 'row3' && topRowClass !== 'row3') {
$bottomRow.attr('class', topRowClass);
$topRow.attr('class', bottomRowClass);
} else if (bottomRowClass === 'row3') {
$topRow.attr('class', (topRowClass === 'row1') ? 'row2' : 'row1');
} else if (topRowClass === 'row3') {
$bottomRow.attr('class', (bottomRowClass === 'row1') ? 'row2' : 'row1');
}
// Swap images if swap element is last row
var swapIsLastRow = trSwap.find('img[src*="icon_down_disabled"]').parents('span:first').is(':visible');
var swapIsLastRow = $bottomRow.find('img[src*="icon_down_disabled"]').parents('span:first').is(':visible');
if (swapIsLastRow) {
trSwap.find('img[src*="icon_down_disabled"]').parents('span:first').toggle();
trSwap.find('img[src*="icon_down."]').parents('span:first').toggle();
el.find('img[src*="icon_down."]').parents('span:first').toggle();
el.find('img[src*="icon_down_disabled"]').parents('span:first').toggle();
$bottomRow.find('img[src*="icon_down_disabled"]').parents('span:first').toggle();
$bottomRow.find('img[src*="icon_down."]').parents('span:first').toggle();
$topRow.find('img[src*="icon_down."]').parents('span:first').toggle();
$topRow.find('img[src*="icon_down_disabled"]').parents('span:first').toggle();
}
// Swap images if move element is first row
var elIsFirstRow = el.find('img[src*="icon_up_disabled"]').parents('span:first').is(':visible');
var elIsFirstRow = $topRow.find('img[src*="icon_up_disabled"]').parents('span:first').is(':visible');
if (elIsFirstRow) {
trSwap.find('img[src*="icon_up_disabled"]').parents('span:first').toggle();
trSwap.find('img[src*="icon_up."]').parents('span:first').toggle();
el.find('img[src*="icon_up."]').parents('span:first').toggle();
el.find('img[src*="icon_up_disabled"]').parents('span:first').toggle();
$bottomRow.find('img[src*="icon_up_disabled"]').parents('span:first').toggle();
$bottomRow.find('img[src*="icon_up."]').parents('span:first').toggle();
$topRow.find('img[src*="icon_up."]').parents('span:first').toggle();
$topRow.find('img[src*="icon_up_disabled"]').parents('span:first').toggle();
}
});
@@ -83,16 +95,20 @@ phpbb.addAjaxCallback('b3p_delete_module', function(res) {
return;
}
var el = $(this).parents('tr:first'),
nextEl = el.next();
var $deletedRow = $(this).parents('tr:first'),
$nextRow = $deletedRow.next();
el.remove();
$deletedRow.remove();
// Fix classes of next elements
while (nextEl !== undefined && nextEl.is('tr')) {
var nextElClass = (nextEl.attr('class') === 'row1') ? 'row2' : 'row1';
nextEl.attr('class', nextElClass);
nextEl = nextEl.next();
while ($nextRow !== undefined && $nextRow.is('tr')) {
var nextRowClass = ($nextRow.attr('class') === 'row1') ? 'row2' : 'row1';
if ($nextRow.attr('class') !== 'row3') {
$nextRow.attr('class', nextRowClass);
}
$nextRow = $nextRow.next();
}
});

View File

@@ -42,6 +42,8 @@
<property name="build-directory" value="build" override="true" />
<property name="package-directory" value="${build-directory}/package/${vendor-name}/${extension-name}" />
<property name="phpbb-root" value="${build-directory}/../../../../../" />
<property name="clover-path" value="${build-directory}/logs/clover.xml" />
<property name="coverage-html-path" value="${build-directory}/coverage" />
<!-- These are the main targets which you will probably want to use -->
<target name="all" depends="prepare-structure,package" />
@@ -59,19 +61,81 @@
passthru="true" />
</target>
<target name="test" depends="clean,composer">
<target name="prepare-tests" depends="clean,composer">
<exec command="if [ -d '${build-directory}/../../../../../' ]; then echo 'true'; else echo 'false'; fi;" outputProperty="output.IS_DIRECTORY_EXISTS" />
<if>
<equals arg1="${output.IS_DIRECTORY_EXISTS}" arg2="true" />
<then>
<echo msg="phpBB is already set up." />
</then>
<else>
<!-- Move Board3 Portal and set up phpBB -->
<exec command="CURRENT_BUILD_REV=$(git rev-parse --abbrev-ref HEAD)" passthru="true" />
<exec command="echo $GIT_BRANCH" passthru="true" />
<exec command="git clone https://github.com/phpbb/phpbb.git phpbb" passthru="true" />
<exec dir="${build-directory}/../phpbb/phpBB" command="php ../composer.phar install" passthru="true" />
<mkdir dir="phpbb/phpBB/ext/board3" />
<exec dir="${build-directory}/../phpbb/phpBB/ext/board3" command="git clone https://github.com/board3/Board3-Portal.git portal" passthru="true" />
<exec dir="${build-directory}/../phpbb/phpBB/ext/board3/portal" command="git checkout $GIT_BRANCH" passthru="true" />
<exec dir="${build-directory}/../phpbb/phpBB/ext/board3/portal" command="php composer.phar install" passthru="true" />
<property name="phpbb-root" value="${build-directory}/../phpbb" override="true" />
<property name="clover-path" value="../build/logs/clover.xml" override="true" />
<property name="coverage-html-path" value="../build/coverage" override="true" />
<exec dir="${build-directory}/../phpbb" command="cp ~/workspace/test_config.php tests/test_config.php" passthru="true" />
<exec dir="${build-directory}/../phpbb" command="chmod 777 phpBB/cache" passthru="true" />
<exec dir="${build-directory}/../phpbb" command="chmod 777 phpBB/files" passthru="true" />
<exec dir="${build-directory}/../phpbb" command="chmod 777 phpBB/store" passthru="true" />
<exec dir="${build-directory}/../phpbb" command="chmod 777 phpBB/images/avatars/upload" passthru="true" />
</else>
</if>
</target>
<target name="test" depends="clean,composer,prepare-tests">
<if>
<available property="phpunit-available" file="phpbb/phpBB/vendor/bin/phpunit" type="file" />
<then>
<exec dir="${phpbb-root}"
command="phpBB/vendor/bin/phpunit
-c phpBB/ext/${vendor-name}/${extension-name}/"
passthru="true" />
-c phpBB/ext/${vendor-name}/${extension-name}/ --coverage-clover=${clover-path} --coverage-html=${coverage-html-path}"
passthru="true" returnProperty="test.pass" />
<if>
<not>
<equals arg1="${test.pass}" arg2="0"/>
</not>
<then>
<fail msg="PHPUnit tests failed."/>
</then>
</if>
</then>
<else>
<echo msg="PHPUnit couldn't be found." />
</else>
</if>
</target>
<target name="test-slow" depends="clean,composer">
<if>
<available property="phpunit-available" file="phpbb/phpBB/vendor/bin/phpunit" type="file" />
<then>
<exec dir="${phpbb-root}"
command="phpBB/vendor/bin/phpunit
-c phpBB/ext/${vendor-name}/${extension-name}/
--group slow"
passthru="true" />
<if>
<not>
<equals arg1="${test.pass}" arg2="0"/>
</not>
<then>
<fail msg="PHPUnit slow tests failed."/>
</then>
</if>
</then>
<else>
<echo msg="PHPUnit couldn't be found." />
</else>
</if>
</target>
<!--

View File

@@ -2,14 +2,6 @@ imports:
- { resource: modules.yml }
parameters:
board3.version_data:
author: Marc
title: Board3 Portal
version: board3_portal_version
file:
- board3.de
- /updatecheck
- board3_portal.json
board3.portal.config.table: %core.table_prefix%portal_config
board3.portal.modules.table: %core.table_prefix%portal_modules
@@ -42,16 +34,6 @@ services:
- %core.root_path%
- .%core.php_ext%
board3.portal.version.check:
class: board3\portal\includes\version_check
scope: prototype
arguments:
- %board3.version_data%
- @config
- @version_helper
- @template
- @user
board3.portal.module_collection:
class: phpbb\di\service_collection
arguments:

View File

@@ -1,134 +0,0 @@
<?php
/**
*
* @package Board3 Portal v2.1
* @copyright (c) 2013 Board3 Group ( www.board3.de )
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
namespace board3\portal\includes;
class version_check
{
/**
* @var array version_data
*/
protected $version_data;
/**
* @var \phpbb\config\config
*/
protected $config;
/**
* @var \phpbb\version_helper $version_helper phpBB version helper
*/
protected $version_helper;
/**
* @var \phpbb\template\twig\twig
*/
protected $template;
/**
* @var \phpbb\user
*/
protected $user;
/**
* @var string Current version
*/
protected $current_version;
/** @var array Update data */
protected $update_data;
/** @var array Template data */
protected $template_data;
/**
* Construct a version_check object
*
* @param array $version_data Version data
* @param \phpbb\config\config $config phpBB config
* @param \phpbb\version_helper $version_helper phpBB version helper
* @param \phpbb\template\twig\twig $template phpBB template object
* @param \phpbb\user $user phpBB user object
*/
public function __construct($version_data, $config, $version_helper, $template, $user)
{
$this->version_data = $version_data;
$this->config = $config;
$this->version_helper = $version_helper;
$this->template = $template;
$this->user = $user;
$this->current_version = $this->config[str_replace(' ', '', $this->version_data['version'])];
}
/**
* Check MOD version and assign template variables for version info if not
* returning current version
*
* @param bool $return_version Yes if current version should be returned
* @return string|bool Current version if $return_version is set to true, false if not
*/
public function check($return_version = false)
{
// Set file location
$this->version_helper->set_file_location($this->version_data['file'][0], $this->version_data['file'][1], $this->version_data['file'][2]);
// Set current version
$this->version_helper->set_current_version($this->current_version);
$this->version_helper->force_stability(($this->config['extension_force_unstable'] || !$this->version_helper->is_stable($this->current_version)) ? 'unstable' : null);
// Expect version_helper to throw RuntimeExceptions
try
{
$this->update_data = $this->version_helper->get_suggested_updates(true);
}
catch (\RuntimeException $e)
{
return false;
}
// Return version if $return_version is set to true
if ($return_version)
{
return $this->current_version;
}
$version_up_to_date = empty($this->update_data);
$this->template_data = array(
'AUTHOR' => $this->version_data['author'],
'CURRENT_VERSION' => $this->current_version,
'UP_TO_DATE' => sprintf((!$version_up_to_date) ? $this->user->lang['NOT_UP_TO_DATE'] : $this->user->lang['UP_TO_DATE'], $this->version_data['title']),
'S_UP_TO_DATE' => $version_up_to_date,
'U_AUTHOR' => 'http://www.phpbb.com/community/memberlist.php?mode=viewprofile&un=' . $this->version_data['author'],
'TITLE' => (string) $this->version_data['title'],
'LATEST_VERSION' => $this->current_version,
);
$this->display_update_information();
$this->template->assign_block_vars('mods', $this->template_data);
return false;
}
/**
* Display update information if updates exist
*/
protected function display_update_information()
{
if (!empty($this->update_data))
{
$update = array_shift($this->update_data);
$this->template_data = array_merge($this->template_data, array(
'ANNOUNCEMENT' => (string) $update['announcement'],
'DOWNLOAD' => (string) $update['download'],
'LATEST_VERSION' => $update['current'],
));
}
}
}

View File

@@ -88,7 +88,6 @@ $lang = array_merge($lang, array(
'PORTAL_LEFT_COLUMN_EXP' => 'Die Linke Spalte auf dem Portal anzeigen',
'PORTAL_RIGHT_COLUMN' => 'Rechte Spalte aktivieren',
'PORTAL_RIGHT_COLUMN_EXP' => 'Die Rechte Spalte auf dem Portal anzeigen',
'PORTAL_VERSION_CHECK' => 'Versioncheck auf Portal',
'ACP_PORTAL_COLUMN_WIDTH_SETTINGS' => 'Breiteneinstellung der rechten und linken Spalte',
'PORTAL_LEFT_COLUMN_WIDTH' => 'Breite der linken Spalte',
'PORTAL_LEFT_COLUMN_WIDTH_EXP' => 'Ändere hier die Breite der linken Spalte in Pixel, empfohlener Wert 180',
@@ -107,17 +106,4 @@ $lang = array_merge($lang, array(
// Install
'PORTAL_BASIC_INSTALL' => 'Füge Basismodule hinzu',
'PORTAL_BASIC_UNINSTALL' => 'Entferne Module von Datenbank',
/**
* A copy of Handyman` s MOD version check, to view it on the gallery overview
*/
'ANNOUNCEMENT_TOPIC' => 'Release Ankündigung',
'CURRENT_VERSION' => 'Derzeitige Version',
'DOWNLOAD_LATEST' => 'Neueste Version herunterladen',
'LATEST_VERSION' => 'Neueste Version',
'NO_INFO' => 'Der Server konnte nicht erreicht werden',
'NOT_UP_TO_DATE' => '%s ist nicht aktuell',
'RELEASE_ANNOUNCEMENT' => 'Ankündigungsthema',
'UP_TO_DATE' => '%s ist aktuell',
'VERSION_CHECK' => 'Extension Version Check',
));

View File

@@ -88,7 +88,6 @@ $lang = array_merge($lang, array(
'PORTAL_LEFT_COLUMN_EXP' => 'Switch to no if you wish to turn off the left column',
'PORTAL_RIGHT_COLUMN' => 'Enable right column',
'PORTAL_RIGHT_COLUMN_EXP' => 'Switch to no if you wish to turn off the right column',
'PORTAL_VERSION_CHECK' => 'Versioncheck on Portal',
'PORTAL_DISPLAY_JUMPBOX' => 'Display jumpbox',
'PORTAL_DISPLAY_JUMPBOX_EXP' => 'Display the jumpbox on the portal. The jumpbox will only be displayed if it is also enabled in the board features.',
'ACP_PORTAL_COLUMN_WIDTH_SETTINGS' => 'Left and right column width settings',
@@ -107,17 +106,4 @@ $lang = array_merge($lang, array(
// Install
'PORTAL_BASIC_INSTALL' => 'Adding basic set of modules',
'PORTAL_BASIC_UNINSTALL' => 'Removing modules from database',
/**
* A copy of Handyman` s MOD version check, to view it on the portal overview
*/
'ANNOUNCEMENT_TOPIC' => 'Release Announcement',
'CURRENT_VERSION' => 'Current Version',
'DOWNLOAD_LATEST' => 'Download Latest Version',
'LATEST_VERSION' => 'Latest Version',
'NO_INFO' => 'Version server could not be contacted',
'NOT_UP_TO_DATE' => '%s is not up to date',
'RELEASE_ANNOUNCEMENT' => 'Annoucement Topic',
'UP_TO_DATE' => '%s is up to date',
'VERSION_CHECK' => 'Extension Version Check',
));

View File

@@ -86,7 +86,6 @@ $lang = array_merge($lang, array(
'PORTAL_LEFT_COLUMN_EXP' => 'Cambie a No si desea deshabilitar la columna de la izquierda.',
'PORTAL_RIGHT_COLUMN' => 'Habilitar columna derecha',
'PORTAL_RIGHT_COLUMN_EXP' => 'Cambie a No si desea deshabilitar la columna de la derecha.',
'PORTAL_VERSION_CHECK' => 'Versioncheck en el Portal',
'PORTAL_DISPLAY_JUMPBOX' => 'Mostrar Ir a',
'PORTAL_DISPLAY_JUMPBOX_EXP' => 'Mostrar Ir a en el portal. El Ir a sólo se muestra si está activo también en las Características del sitio.',
'ACP_PORTAL_COLUMN_WIDTH_SETTINGS' => 'Configuración de ancho de columnas izquierda y derecha',
@@ -101,17 +100,4 @@ $lang = array_merge($lang, array(
// Install
'PORTAL_BASIC_INSTALL' => 'Agregando un conjunto básico de módulos',
'PORTAL_BASIC_UNINSTALL' => 'Eliminando módulos de la base de datos',
/**
* A copy of Handyman` s MOD version check, to view it on the portal overview
*/
'ANNOUNCEMENT_TOPIC' => 'Anuncio de lanzamiento',
'CURRENT_VERSION' => 'Versión Actual',
'DOWNLOAD_LATEST' => 'Descarga la última versión',
'LATEST_VERSION' => 'Última versión',
'NO_INFO' => 'Version server could not be contacted',
'NOT_UP_TO_DATE' => '%s no está actualizado',
'RELEASE_ANNOUNCEMENT' => 'Tema del Anuncio',
'UP_TO_DATE' => '%s está actualizado',
'VERSION_CHECK' => 'Comprobar versión de extensión',
));

View File

@@ -89,7 +89,6 @@ $lang = array_merge($lang, array(
'PORTAL_LEFT_COLUMN_EXP' => 'Changer sur « Non » si vous souhaitez désactiver la colonne de gauche.',
'PORTAL_RIGHT_COLUMN' => 'Activer la colonne de droite',
'PORTAL_RIGHT_COLUMN_EXP' => 'Changer sur « Non » si vous souhaitez désactiver la colonne de droite.',
'PORTAL_VERSION_CHECK' => 'Vérification de la version du portail',
'PORTAL_DISPLAY_JUMPBOX' => 'Afficher laccès rapide aux forums',
'PORTAL_DISPLAY_JUMPBOX_EXP' => 'Afficher laccès rapide aux forums sur le portail. Laccès rapide aux forums ne sera affiché que si il est également activé dans les fonctionnalités du forum.',
'ACP_PORTAL_COLUMN_WIDTH_SETTINGS' => 'Paramètres de largeur des colonnes de gauche et de droite',
@@ -108,17 +107,4 @@ $lang = array_merge($lang, array(
// Install
'PORTAL_BASIC_INSTALL' => 'Ajout dun ensemble de modules de base',
'PORTAL_BASIC_UNINSTALL' => 'Suppression des modules de la base de données',
/**
* A copy of Handyman` s MOD version check, to view it on the portal overview
*/
'ANNOUNCEMENT_TOPIC' => 'Annonce',
'CURRENT_VERSION' => 'Version actuelle',
'DOWNLOAD_LATEST' => 'Télécharger la dernière version',
'LATEST_VERSION' => 'Dernière version',
'NO_INFO' => 'Le serveur na pu être contacté',
'NOT_UP_TO_DATE' => '%s nest pas à jour',
'RELEASE_ANNOUNCEMENT' => ' Date de publication de lannonce',
'UP_TO_DATE' => 'Lextension %s est à jour',
'VERSION_CHECK' => 'Vérification de la version du portail',
));

View File

@@ -86,7 +86,6 @@ $lang = array_merge($lang, array(
'PORTAL_LEFT_COLUMN_EXP' => 'Impostare su "No" per nascondere la colonna sinistra',
'PORTAL_RIGHT_COLUMN' => 'Enable right column',
'PORTAL_RIGHT_COLUMN_EXP' => 'Impostare su "No" per nascondere la colonna destra',
'PORTAL_VERSION_CHECK' => 'Versioncheck on Portal',
'PORTAL_DISPLAY_JUMPBOX' => 'Mostra jumpbox',
'PORTAL_DISPLAY_JUMPBOX_EXP' => 'Mostra la jumpbox nel portale. La jumpbox sarà mostrata se abilitata nelle impostazioni della board.',
'ACP_PORTAL_COLUMN_WIDTH_SETTINGS' => 'Impostazioni larghezza colonna sinistra e destra',
@@ -101,17 +100,4 @@ $lang = array_merge($lang, array(
// Install
'PORTAL_BASIC_INSTALL' => 'Aggiunta moduli di base',
'PORTAL_BASIC_UNINSTALL' => 'Rimozione dei moduli dal database',
/**
* A copy of Handyman` s MOD version check, to view it on the portal overview
*/
'ANNOUNCEMENT_TOPIC' => 'Annuncio rilascio',
'CURRENT_VERSION' => 'Versione corrente',
'DOWNLOAD_LATEST' => 'Scarica ultima versione',
'LATEST_VERSION' => 'Ultima versione',
'NO_INFO' => 'Impossibile contattare il server per il controllo versione',
'NOT_UP_TO_DATE' => '%s non è aggiornato',
'RELEASE_ANNOUNCEMENT' => 'Topic annuncio',
'UP_TO_DATE' => '%s è aggiornato',
'VERSION_CHECK' => 'Estensione controllo versione',
));

View File

@@ -81,7 +81,6 @@ $lang = array_merge($lang, array(
'PORTAL_LEFT_COLUMN_EXP' => 'Verander naar nee als je de linkerkolom wilt uitschakelen',
'PORTAL_RIGHT_COLUMN' => 'Rechterkolom inschakelen',
'PORTAL_RIGHT_COLUMN_EXP' => 'Verander naar nee als je de rechterkolom wilt uitschakelen',
'PORTAL_VERSION_CHECK' => 'Versiecontrole op portaalpagina',
'PORTAL_DISPLAY_JUMPBOX' => 'Jumpbox weergeven',
'PORTAL_DISPLAY_JUMPBOX_EXP' => 'Jumpbox op de portaalpagina weergeven. De jumpbox wordt alleen zichtbaar als je hem hebt ingeschakeld bij de forumfuncties.',
'ACP_PORTAL_COLUMN_WIDTH_SETTINGS' => 'Linker en rechterkolom breedte instellingen',
@@ -95,17 +94,4 @@ $lang = array_merge($lang, array(
// Install
'PORTAL_BASIC_INSTALL' => 'Basisset van modules toevoegen',
'PORTAL_BASIC_UNINSTALL' => 'Modules verwijderen uit de database',
/**
* A copy of Handyman` s MOD version check, to view it on the portal overview
*/
'ANNOUNCEMENT_TOPIC' => 'Release aankondiging',
'CURRENT_VERSION' => 'Huidige versie',
'DOWNLOAD_LATEST' => 'Download de laatste versie',
'LATEST_VERSION' => 'Laatste versie',
'NO_INFO' => 'De server voor de versie controle kan niet worden bereikt',
'NOT_UP_TO_DATE' => '%s is niet up-to-date',
'RELEASE_ANNOUNCEMENT' => 'Aankondigingsonderwerp',
'UP_TO_DATE' => '%s is up-to-date',
'VERSION_CHECK' => 'EXT Versie Controle',
));

View File

@@ -20,6 +20,7 @@ class v210 extends \phpbb\db\migration\migration
{
return array(
array('config.update', array('board3_portal_version', '2.1.0')),
array('config.remove', array('board3_version_check')),
array('custom', array(array($this, 'add_donation_setting'))),
array('custom', array(array($this, 'convert_serialize_to_json'))),
);

View File

@@ -20,4 +20,16 @@
<directory suffix="_test.php" phpVersion="5.3.19" phpVersionOperator=">=">./tests/functional/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>../../../../phpBB/ext/board3/portal/</directory>
<exclude>
<directory>../../../../phpBB/ext/board3/portal/tests/</directory>
<directory>../../../../phpBB/ext/board3/portal/develop/</directory>
<directory>../../../../phpBB/ext/board3/portal/migrations/</directory>
<directory>../../../../phpBB/ext/board3/portal/language/</directory>
<directory>../../../../phpBB/ext/board3/portal/vendor/</directory>
</exclude>
</whitelist>
</filter>
</phpunit>

View File

@@ -18,31 +18,69 @@ var portal_right_width;
* the center column but rather right after the last module of the left column.
*/
phpbb.b3p_fix_right_column_margin = function() {
var width = $(window).width();
var $portal_right = $('#portal-right');
var $portal_left = $('#portal-left');
var $portal_center = $('#portal-center');
var width = $(window).width(),
$portal_right = $('#portal-right'),
$portal_left = $('#portal-left'),
$portal_center = $('#portal-center'),
marginLeft = 'margin-left',
marginRight = 'margin-right';
if ($('body').hasClass('rtl')) {
marginLeft = marginRight;
marginRight = 'margin-left';
}
if (width <= (895 - $.getScrollbarWidth())) {
// Get correct margin-left for portal-right and add 10px for padding
if ($portal_left.width() > 0) {
$portal_right.css('margin-left', - ($portal_right.width() + 1));
if (!$portal_center.length && $portal_left.length) {
$portal_right.css(marginLeft, 5);
$portal_left.css(marginRight, 0);
} else {
$portal_right.css(marginLeft, - ($portal_right.width() + 1));
}
$portal_right.css('margin-top', $portal_center.height() + 'px');
$portal_left.css('margin-top', $portal_center.height() + 'px');
} else {
$portal_right.css('margin-left', 0);
$portal_right.css(marginLeft, 0);
$portal_right.css('margin-top', 0);
}
} else {
$portal_right.css('margin-top', '0px');
$portal_right.css('margin-left', -portal_right_width);
if (!$portal_center.length && $portal_left.length) {
$portal_right.css(marginLeft, 0);
} else {
$portal_right.css(marginLeft, -portal_right_width);
}
$portal_right.width(portal_right_width);
$portal_left.css('margin-top', 0);
phpbb.b3pFixLeftColumnMargin();
}
};
/**
* Correctly align left column if center column does not exist
*/
phpbb.b3pFixLeftColumnMargin = function() {
var $portalLeft = $('#portal-left'),
marginLeft = 'margin-left',
marginRight = 'margin-right';
if ($('body').hasClass('rtl')) {
marginLeft = marginRight;
marginRight = 'margin-left';
}
if ($portalLeft.length && !$('#portal-center').length) {
$portalLeft.css(marginLeft, '0');
$portalLeft.css(marginRight, 10);
}
};
$(document).ready(function() {
portal_right_width = $('#portal-right').width();
portal_right_width = $('#portal-right').attr('data-width');
phpbb.b3pFixLeftColumnMargin();
phpbb.b3p_fix_right_column_margin();
$(window).resize(function() {
phpbb.b3p_fix_right_column_margin();

View File

@@ -1,14 +1,6 @@
<!-- INCLUDE overall_header.html -->
<!-- INCLUDE portal/_block_config.html -->
<!-- IF PORTAL_VERSION_CHECK and U_ACP -->
<div id="portal_version_check" class="rules">
<div class="inner"><span class="corners-top"><span></span></span>
<strong>{L_INFORMATION}{L_COLON}</strong> {PORTAL_VERSION_CHECK}
<span class="corners-bottom"><span></span></span></div>
</div>
<!-- ENDIF -->
<div id="portal-body" role="grid">
<!-- IF S_TOP_COLUMN -->
<div id="portal-top" role="gridcell">
@@ -71,7 +63,7 @@
<!-- [+] right module area -->
<!-- IF S_RIGHT_COLUMN -->
<div id="portal-right" style="width: {S_PORTAL_RIGHT_COLUMN}px; margin-<!-- IF S_CONTENT_DIRECTION eq 'rtl' -->right<!-- ELSE -->left<!-- ENDIF -->: -{S_PORTAL_RIGHT_COLUMN}px;" role="gridcell">
<div id="portal-right" style="width: {S_PORTAL_RIGHT_COLUMN}px; margin-<!-- IF S_CONTENT_DIRECTION eq 'rtl' -->right<!-- ELSE -->left<!-- ENDIF -->: -{S_PORTAL_RIGHT_COLUMN}px;" data-width="{S_PORTAL_RIGHT_COLUMN}" role="gridcell">
<!-- BEGIN modules_right -->
<!-- DEFINE $TEMPLATE_FILE = '{modules_right.TEMPLATE_FILE}' -->
<!-- DEFINE $IMAGE_SRC = '{modules_right.IMAGE_SRC}' -->

View File

@@ -1,20 +1,6 @@
<!-- INCLUDE overall_header.html -->
<!-- INCLUDE portal/_block_config.html -->
<!--version $Id: portal_body.html 591 2009-12-11 23:48:49Z marc1706 $ //-->
<!-- IF PORTAL_VERSION_CHECK and U_ACP -->
<table class="tablebg" width="100%" cellspacing="1" cellpadding="0" style="margin-top: 5px;">
<tbody>
<tr>
<td class="row1">
<p class="breadcrumbs"><span style="color: red;">{PORTAL_VERSION_CHECK}</span></p>
</td>
</tr>
</tbody>
</table>
<br />
<!-- ENDIF -->
<table cellpadding="0" cellspacing="0" border="0" width="100%" align="center" role="grid">
<!-- IF S_TOP_COLUMN -->
<tr>

View File

@@ -38,11 +38,6 @@ class phpbb_acp_move_module_test extends \board3\portal\tests\testframework\data
$user = new \board3\portal\tests\mock\user();
$request = new \phpbb_mock_request;
$phpbb_container = new \phpbb_mock_container_builder();
// Mock version check
$phpbb_container->set('board3.portal.version.check',
$this->getMockBuilder('\board3\portal\includes\version_check')
->disableOriginalConstructor()
->getMock());
// Mock module service collection
$config = new \phpbb\config\config(array());
$auth = $this->getMock('\phpbb\auth\auth', array('acl_get'));

View File

@@ -1,86 +0,0 @@
<?php
/**
*
* @package testing
* @copyright (c) Board3 Group ( www.board3.de )
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
require_once(dirname(__FILE__) . '/../../../../../../includes/utf/utf_tools.php');
class phpbb_functions_version_check_test extends \board3\portal\tests\testframework\test_case
{
protected $version_check;
protected $template;
protected $config;
public function setUp()
{
global $phpbb_root_path, $phpEx;
include_once($phpbb_root_path . 'includes/functions.' . $phpEx);
include_once($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
$this->version_data = array(
'author' => 'Marc',
'version' => 'board3_portal_version',
'title' => 'Board3 Portal',
'file' => array('board3.de', '/updatecheck', 'board3_portal.json'),
);
$this->config = new \phpbb\config\config(array());
$this->user = new \board3\portal\tests\mock\user;
$this->user->set(array(
'NO_INFO' => 'NO_INFO',
'NOT_UP_TO_DATE' => 'NOT_UP_TO_DATE',
'UP_TO_DATE' => 'UP_TO_DATE',
));
$this->cache = $this->getMockBuilder('\phpbb\cache\service')
->disableOriginalConstructor()
->getMock();
}
protected function get_version_helper($version)
{
global $phpbb_root_path;
$this->config->set('board3_portal_version', $version);
$this->template = new \board3\portal\tests\mock\template($this);
$this->language_file_loader = new \phpbb\language\language_file_loader($phpbb_root_path, 'php');
$this->language = new \phpbb\language\language($this->language_file_loader);
$version_helper = new \phpbb\version_helper($this->cache, $this->config, new \phpbb\file_downloader(), new \phpbb\user($this->language, '\phpbb\datetime'));
$this->version_check = new \board3\portal\includes\version_check($this->version_data, $this->config, $version_helper, $this->template, $this->user);
}
public function data_version_check()
{
return array(
array('2.1.0', array(
'CURRENT_VERSION' => '2.1.0',
'TITLE' => 'Board3 Portal',
'UP_TO_DATE' => 'UP_TO_DATE',
'S_UP_TO_DATE' => true,
'LATEST_VERSION' => '2.1.0',
)),
array('2.1.0-a1', array(
'CURRENT_VERSION' => '2.1.0-a1',
'TITLE' => 'Board3 Portal',
'UP_TO_DATE' => 'NOT_UP_TO_DATE',
'S_UP_TO_DATE' => false,
'LATEST_VERSION' => '2.1.0-rc2',
)),
);
}
/**
* @dataProvider data_version_check
*/
public function test_version_up_to_date($version, $template_data)
{
$this->get_version_helper($version);
$this->assertEquals($version, $this->version_check->check(true));
$this->assertFalse($this->version_check->check());
$this->template->assert_equals($template_data, 'mods');
}
}

View File

@@ -7,7 +7,6 @@
*
*/
class board3_includes_helper_test extends \board3\portal\tests\testframework\test_case
{
protected $portal_helper;

View File

@@ -7,6 +7,7 @@
*
*/
require_once dirname(__FILE__) . '/../../../../../../includes/functions_admin.php';
class board3_includes_modules_helper_test extends \board3\portal\tests\testframework\database_test_case
{