mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-17 13:00:20 +02:00
[ticket/15289] Update acp module
PHPBB3-15289
This commit is contained in:
parent
ba9f082bf4
commit
737a8f9f7d
@ -2,35 +2,44 @@
|
||||
|
||||
<a id="maincontent"></a>
|
||||
|
||||
<h1>{L_TITLE}</h1>
|
||||
<h1>{L_STORAGE_TITLE}</h1>
|
||||
|
||||
<p>{L_TITLE_EXPLAIN}</p>
|
||||
<p>{L_STORAGE_TITLE_EXPLAIN}</p>
|
||||
|
||||
<form id="acp_storage" method="post" action="{U_ACTION}">
|
||||
|
||||
<!-- BEGIN storage -->
|
||||
<fieldset>
|
||||
<legend>{storage.LEGEND}</legend>
|
||||
<dl>
|
||||
<dt><label for="{storage.key}">{storage.TITLE}{L_COLON}</label><!-- IF storage.TITLE_EXPLAIN --><br /><span>{storage.TITLE_EXPLAIN}</span><!-- ENDIF --></dt>
|
||||
<dd><select id="{storage.key}" name="{storage.key}[provider]" data-togglable-settings="true">{storage.OPTIONS}</select></dd>
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
<!-- BEGIN adapter -->
|
||||
<fieldset id="avatar_{avatar_backend.IDENTIFIER}_settings">
|
||||
<legend>{adapter.NAME}</legend>
|
||||
{adapter.SETTINGS}
|
||||
{% for storage in STORAGES %}
|
||||
<fieldset>
|
||||
<legend>{{ lang('STORAGE_' ~ storage.get_name | upper ~ '_TITLE') }}</legend>
|
||||
<dl>
|
||||
<dt><label for="{{ storage.get_name }}">{L_STORAGE_SELECT}{L_COLON}</label><br /><span>{L_STORAGE_SELECT_DESC}</span></dt>
|
||||
<dd>
|
||||
<select id="{{ storage.get_name }}" name="{{ storage.get_name }}[provider]" data-togglable-settings="true">
|
||||
{% for provider in PROVIDERS if provider.is_available %}
|
||||
<option value="{{ provider.get_class }}"{{ config['storage\\' ~ storage.get_name ~ '\\provider'] == provider.get_class ? ' selected' : '' }} data-toggle-setting="#{{ storage.get_name }}_{{ provider.get_name }}_settings">
|
||||
{{ lang('STORAGE_ADAPTER_' ~ provider.get_name | upper ~ '_NAME') }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</dd>
|
||||
</dl>
|
||||
</fieldset>
|
||||
<!-- END adapter -->
|
||||
<!-- END storage -->
|
||||
|
||||
<fieldset class="submit-buttons">
|
||||
<legend>{L_SUBMIT}</legend>
|
||||
<input class="button1" type="submit" id="submit" name="submit" value="{L_SUBMIT}" />
|
||||
<input class="button2" type="reset" id="reset" name="reset" value="{L_RESET}" />
|
||||
{S_FORM_TOKEN}
|
||||
</fieldset>
|
||||
{% for provider in PROVIDERS if provider.is_available %}
|
||||
<fieldset id="{{ storage.get_name }}_{{ provider.get_name }}_settings">
|
||||
<legend>{{ lang('STORAGE_' ~ storage.get_name | upper ~ '_TITLE') }} - {{ lang('STORAGE_ADAPTER_' ~ provider.get_name | upper ~ '_NAME') }}</legend>
|
||||
provider.get_options
|
||||
</fieldset>
|
||||
{% endfor %}
|
||||
|
||||
{% endfor %}
|
||||
|
||||
<fieldset class="submit-buttons">
|
||||
<legend>{L_SUBMIT}</legend>
|
||||
<input class="button1" type="submit" id="submit" name="submit" value="{L_SUBMIT}" />
|
||||
<input class="button2" type="reset" id="reset" name="reset" value="{L_RESET}" />
|
||||
{S_FORM_TOKEN}
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<!-- INCLUDE overall_footer.html -->
|
||||
|
@ -15,6 +15,7 @@ services:
|
||||
- []
|
||||
calls:
|
||||
- [setLexer, ['@template.twig.lexer']]
|
||||
- [addGlobal, ['config', '@config']]
|
||||
|
||||
template.twig.lexer:
|
||||
class: phpbb\template\twig\lexer
|
||||
|
@ -40,6 +40,12 @@ class acp_storage
|
||||
/** @var \phpbb\user */
|
||||
protected $user;
|
||||
|
||||
/** @var \phpbb\di\service_collection */
|
||||
protected $provider_collection;
|
||||
|
||||
/** @var \phpbb\di\service_collection */
|
||||
protected $storage_collection;
|
||||
|
||||
/** @var string */
|
||||
public $page_title;
|
||||
|
||||
@ -58,9 +64,11 @@ class acp_storage
|
||||
$this->request = $phpbb_container->get('request');
|
||||
$this->template = $phpbb_container->get('template');
|
||||
$this->user = $phpbb_container->get('user');
|
||||
$this->provider_collection = $phpbb_container->get('storage.provider_collection');
|
||||
$this->storage_collection = $phpbb_container->get('storage.storage_collection');
|
||||
|
||||
// Add necesary language files
|
||||
$this->user->add_lang(array('acp/storage'));
|
||||
$this->lang->add_lang(array('acp/storage'));
|
||||
|
||||
switch($mode)
|
||||
{
|
||||
@ -75,35 +83,6 @@ class acp_storage
|
||||
$form_name = 'acp_storage';
|
||||
add_form_key($form_name);
|
||||
|
||||
global $phpbb_container;
|
||||
$storage_collection = $phpbb_container->get('storage.storage_collection');
|
||||
$adapter_provider_collection = $phpbb_container->get('storage.provider_collection');
|
||||
|
||||
$storages = array();
|
||||
|
||||
foreach($storage_collection->getIterator() as $storage)
|
||||
{
|
||||
$this->template->assign_block_vars('storage', array(
|
||||
'LEGEND' => $storage->get_name(),
|
||||
'TITLE' => $storage->get_name(),
|
||||
'TITLE_EXPLAIN' => $storage->get_description(),
|
||||
'OPTIONS' => $this->generate_adapter_options(),
|
||||
));
|
||||
|
||||
foreach($adapter_provider_collection as $provider)
|
||||
{
|
||||
if(!$provider->is_available())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->template->assign_block_vars('storage.adapter', array(
|
||||
'NAME' => get_class($provider),
|
||||
'SETTINGS' => print_r($provider->get_options(), 1),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
// Template from adm/style
|
||||
$this->tpl_name = 'acp_storage';
|
||||
|
||||
@ -111,22 +90,8 @@ class acp_storage
|
||||
$this->page_title = 'STORAGE_TITLE';
|
||||
|
||||
$this->template->assign_vars(array(
|
||||
'STORAGES' => $this->storage_collection,
|
||||
'PROVIDERS' => $this->provider_collection
|
||||
));
|
||||
}
|
||||
|
||||
protected function generate_adapter_options()
|
||||
{
|
||||
global $phpbb_container;
|
||||
$adapter_provider_collection = $phpbb_container->get('storage.provider_collection');
|
||||
|
||||
$options = '';
|
||||
|
||||
foreach($adapter_provider_collection as $provider)
|
||||
{
|
||||
$class = get_class($provider);
|
||||
$options .= "<option value=\"$class\" data-toggle-setting=\"\">$class</option>";
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
|
34
phpBB/includes/acp/info/acp_storage.php
Normal file
34
phpBB/includes/acp/info/acp_storage.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the phpBB Forum Software package.
|
||||
*
|
||||
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||
*
|
||||
* For full copyright and license information, please see
|
||||
* the docs/CREDITS.txt file.
|
||||
*
|
||||
*/
|
||||
|
||||
class acp_storage_info
|
||||
{
|
||||
function module()
|
||||
{
|
||||
return array(
|
||||
'filename' => 'acp_storage',
|
||||
'title' => 'ACP_STORAGE',
|
||||
'modes' => array(
|
||||
'settings' => array('title' => 'ACP_STORAGE_SETTINGS', 'auth' => 'acl_a_storage', 'cat' => array('ACP_SERVER_CONFIGURATION')),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
function install()
|
||||
{
|
||||
}
|
||||
|
||||
function uninstall()
|
||||
{
|
||||
}
|
||||
}
|
@ -178,6 +178,9 @@ $lang = array_merge($lang, array(
|
||||
'ACP_SERVER_SETTINGS' => 'Server settings',
|
||||
'ACP_SIGNATURE_SETTINGS' => 'Signature settings',
|
||||
'ACP_SMILIES' => 'Smilies',
|
||||
|
||||
'ACP_STORAGE_SETTINGS' => 'Storage settings',
|
||||
|
||||
'ACP_STYLE_MANAGEMENT' => 'Style management',
|
||||
'ACP_STYLES' => 'Styles',
|
||||
'ACP_STYLES_CACHE' => 'Purge Cache',
|
||||
|
@ -37,4 +37,15 @@ if (empty($lang) || !is_array($lang))
|
||||
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
|
||||
|
||||
$lang = array_merge($lang, array(
|
||||
'STORAGE_TITLE' => 'Storage Settings',
|
||||
'STORAGE_TITLE_EXPLAIN' => 'Here you can change the storage.',
|
||||
'STORAGE_SELECT' => 'Select storage',
|
||||
'STORAGE_SELECT_DESC' => 'Select an storage from the list.',
|
||||
|
||||
'STORAGE_ATTACHMENT_TITLE' => 'Attachments storage',
|
||||
'STORAGE_AVATAR_TITLE' => 'Avatars storage',
|
||||
'STORAGE_BACKUP_TITLE' => 'Backup storage',
|
||||
|
||||
'STORAGE_ADAPTER_LOCAL_NAME' => 'Local',
|
||||
|
||||
));
|
||||
|
@ -15,6 +15,16 @@ namespace phpbb\storage\provider;
|
||||
|
||||
class local implements provider_interface
|
||||
{
|
||||
public function get_name()
|
||||
{
|
||||
return 'local';
|
||||
}
|
||||
|
||||
public function get_class()
|
||||
{
|
||||
return get_class($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
@ -28,7 +38,7 @@ class local implements provider_interface
|
||||
*/
|
||||
public function get_options()
|
||||
{
|
||||
return ['path'];
|
||||
return ['path' => array('lang' => 'PATH', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => false)];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -45,19 +45,14 @@ class storage
|
||||
$this->storage_name = $storage_name;
|
||||
}
|
||||
|
||||
public function get_id()
|
||||
{
|
||||
return $this->storage_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns storage name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_name()
|
||||
{
|
||||
return strtoupper('STORAGE_' . $this->storage_name . '_NAME');
|
||||
}
|
||||
|
||||
public function get_description()
|
||||
{
|
||||
return strtoupper('STORAGE_' . $this->storage_name . '_DESCRIPTION');
|
||||
return $this->storage_name;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user