mirror of
https://github.com/joomla/joomla-cms.git
synced 2024-06-30 00:53:41 +00:00
[4.0] helpsite removal (#28088)
* [4.0] helpsite removal Removes the remaining parts of the helpsite code that was removed in 3.9. due to file renaming these were missed. code review * remove
This commit is contained in:
parent
0a7a28b980
commit
d6c698da8b
|
@ -1,67 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_users
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Component\Users\Administrator\Controller;
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Client\ClientHelper;
|
||||
use Joomla\CMS\Filesystem\File;
|
||||
use Joomla\CMS\Help\Help;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\MVC\Controller\BaseController;
|
||||
use Joomla\CMS\Response\JsonResponse;
|
||||
|
||||
/**
|
||||
* Profile controller class for Users.
|
||||
*
|
||||
* @since 3.5
|
||||
*/
|
||||
class ProfileController extends BaseController
|
||||
{
|
||||
/**
|
||||
* Returns the updated options for help site selector
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 3.5
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function gethelpsites()
|
||||
{
|
||||
if ($this->app->getIdentity()->guest)
|
||||
{
|
||||
throw new \Exception(Text::_('JERROR_ALERTNOAUTHOR'), 500);
|
||||
}
|
||||
|
||||
// Set FTP credentials, if given
|
||||
ClientHelper::setCredentialsFromRequest('ftp');
|
||||
|
||||
if (($data = file_get_contents('https://update.joomla.org/helpsites/helpsites.xml')) === false)
|
||||
{
|
||||
throw new \Exception(Text::_('COM_CONFIG_ERROR_HELPREFRESH_FETCH'), 500);
|
||||
}
|
||||
elseif (!File::write(JPATH_ADMINISTRATOR . '/help/helpsites.xml', $data))
|
||||
{
|
||||
throw new \Exception(Text::_('COM_CONFIG_ERROR_HELPREFRESH_ERROR_STORE'), 500);
|
||||
}
|
||||
|
||||
$options = array_merge(
|
||||
array(
|
||||
HTMLHelper::_('select.option', '', Text::_('JOPTION_USE_DEFAULT'))
|
||||
),
|
||||
Help::createSiteList(JPATH_ADMINISTRATOR . '/help/helpsites.xml')
|
||||
);
|
||||
|
||||
echo new JsonResponse($options);
|
||||
|
||||
$this->app->close();
|
||||
}
|
||||
}
|
|
@ -291,46 +291,6 @@ class Users
|
|||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the sanitized helpsite link
|
||||
*
|
||||
* @param mixed $value Value of the field
|
||||
*
|
||||
* @return mixed String/void
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function helpsite($value)
|
||||
{
|
||||
if (empty($value))
|
||||
{
|
||||
return static::value($value);
|
||||
}
|
||||
|
||||
$text = $value;
|
||||
|
||||
if ($xml = simplexml_load_file(JPATH_ADMINISTRATOR . '/help/helpsites.xml'))
|
||||
{
|
||||
foreach ($xml->sites->site as $site)
|
||||
{
|
||||
if ((string) $site->attributes()->url == $value)
|
||||
{
|
||||
$text = (string) $site;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$value = htmlspecialchars($value, ENT_COMPAT, 'UTF-8');
|
||||
|
||||
if (strpos($value, 'http') === 0)
|
||||
{
|
||||
return '<a href="' . $value . '">' . $text . '</a>';
|
||||
}
|
||||
|
||||
return '<a href="http://' . $value . '">' . $text . '</a>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the sanitized template style
|
||||
*
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<joshelp>
|
||||
<sites>
|
||||
<site tag="en-GB" url="https://help.joomla.org/proxy?keyref=Help{major}{minor}:{keyref}&lang={langcode}">English (GB) - Joomla help wiki</site>
|
||||
</sites>
|
||||
</joshelp>
|
|
@ -433,8 +433,6 @@ JGLOBAL_FILTER_TYPE_DESC="1. Blacklist allows all tags and attributes except for
|
|||
JGLOBAL_FILTER_TYPE_LABEL="Filter Type<sup>1</sup>"
|
||||
JGLOBAL_FULL_TEXT="Full Text"
|
||||
JGLOBAL_GT=">"
|
||||
; The following strings is deprecated and will be removed with 4.0.
|
||||
JGLOBAL_HELPREFRESH_BUTTON="Refresh"
|
||||
JGLOBAL_HISTORY_LIMIT_OPTIONS_DESC="The maximum number of old versions of an item to save. If zero, all old versions will be saved."
|
||||
JGLOBAL_HISTORY_LIMIT_OPTIONS_LABEL="Maximum Versions"
|
||||
JGLOBAL_HITS="Hits"
|
||||
|
|
|
@ -184,12 +184,6 @@ body {
|
|||
margin-left: .5rem;
|
||||
}
|
||||
|
||||
#helpsite-refresh {
|
||||
float: right;
|
||||
margin-top: 1px;
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
.field-calendar {
|
||||
float: none;
|
||||
}
|
||||
|
|
|
@ -431,8 +431,6 @@ JGLOBAL_FILTER_TYPE_DESC="1. Blacklist allows all tags and attributes except for
|
|||
JGLOBAL_FILTER_TYPE_LABEL="Filter Type<sup>1</sup>"
|
||||
JGLOBAL_FULL_TEXT="Full Text"
|
||||
JGLOBAL_GT=">"
|
||||
; The following strings is deprecated and will be removed with 4.0.
|
||||
JGLOBAL_HELPREFRESH_BUTTON="Refresh"
|
||||
JGLOBAL_HISTORY_LIMIT_OPTIONS_DESC="The maximum number of old versions of an item to save. If zero, all old versions will be saved."
|
||||
JGLOBAL_HISTORY_LIMIT_OPTIONS_LABEL="Maximum Versions"
|
||||
JGLOBAL_HITS="Hits"
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
/**
|
||||
* @package Joomla.JavaScript
|
||||
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
/**
|
||||
* Rebuilds the list with the available help sites
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
var resetHelpSiteList = function() {
|
||||
|
||||
// Uses global variable helpsite_base for bast uri
|
||||
var select_id = this.getAttribute('rel');
|
||||
var showDefault = this.getAttribute('showDefault');
|
||||
|
||||
Joomla.request(
|
||||
{
|
||||
url: 'index.php?option=com_users&task=profile.gethelpsites&format=json',
|
||||
method: 'GET',
|
||||
data: '',
|
||||
perform: true,
|
||||
headers: {'Content-Type': 'application/json;charset=utf-8'},
|
||||
onSuccess: function(response, xhr)
|
||||
{
|
||||
response = JSON.parse(response);
|
||||
|
||||
// The response contains the options to use in help site select field
|
||||
var node;
|
||||
|
||||
document.getElementById(select_id).innerHTML = '';
|
||||
|
||||
// Build options
|
||||
response.data.forEach(function(item) {
|
||||
if (item.value !== '' || showDefault === 'true') {
|
||||
node = document.createElement('option');
|
||||
node.value = item.value;
|
||||
node.innerHTML = item.text;
|
||||
document.getElementById(select_id).appendChild(node);
|
||||
}
|
||||
});
|
||||
},
|
||||
onError: function(xhr)
|
||||
{
|
||||
// Remove js messages, if they exist.
|
||||
Joomla.removeMessages();
|
||||
|
||||
Joomla.renderMessages(Joomla.ajaxErrorsMessages(xhr));
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
document.getElementById('helpsite-refresh').addEventListener('click', resetHelpSiteList);
|
||||
});
|
|
@ -273,8 +273,6 @@ JGLOBAL_FILTER_BUTTON="Filter"
|
|||
JGLOBAL_FILTER_LABEL="Filter"
|
||||
JGLOBAL_FULL_TEXT="Full Text"
|
||||
JGLOBAL_GT=">"
|
||||
; The following string is deprecated and will be removed with 4.0.
|
||||
JGLOBAL_HELPREFRESH_BUTTON="Refresh"
|
||||
JGLOBAL_HITS="Hits"
|
||||
JGLOBAL_HITS_ASC="Hits ascending"
|
||||
JGLOBAL_HITS_COUNT="Hits: %s"
|
||||
|
|
|
@ -314,7 +314,6 @@ JLoader::registerAlias('JFormFieldFolderList', '\\Joomla\\CMS\\Form
|
|||
JLoader::registerAlias('JFormFieldFrontend_Language', '\\Joomla\\CMS\\Form\\Field\\FrontendlanguageField', '5.0');
|
||||
JLoader::registerAlias('JFormFieldGroupedList', '\\Joomla\\CMS\\Form\\Field\\GroupedlistField', '5.0');
|
||||
JLoader::registerAlias('JFormFieldHeadertag', '\\Joomla\\CMS\\Form\\Field\\HeadertagField', '5.0');
|
||||
JLoader::registerAlias('JFormFieldHelpsite', '\\Joomla\\CMS\\Form\\Field\\HelpsiteField', '5.0');
|
||||
JLoader::registerAlias('JFormFieldHidden', '\\Joomla\\CMS\\Form\\Field\\HiddenField', '5.0');
|
||||
JLoader::registerAlias('JFormFieldImageList', '\\Joomla\\CMS\\Form\\Field\\ImagelistField', '5.0');
|
||||
JLoader::registerAlias('JFormFieldInteger', '\\Joomla\\CMS\\Form\\Field\\IntegerField', '5.0');
|
||||
|
|
|
@ -1,75 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Joomla! Content Management System
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\CMS\Form\Field;
|
||||
|
||||
\defined('JPATH_PLATFORM') or die;
|
||||
|
||||
use Joomla\CMS\Help\Help;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
|
||||
/**
|
||||
* Form Field class for the Joomla Platform.
|
||||
* Provides a select list of help sites.
|
||||
*
|
||||
* @since 1.6
|
||||
* @deprecated 4.0 To be removed
|
||||
*/
|
||||
class HelpsiteField extends ListField
|
||||
{
|
||||
/**
|
||||
* The form field type.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.6
|
||||
*/
|
||||
public $type = 'Helpsite';
|
||||
|
||||
/**
|
||||
* Method to get the help site field options.
|
||||
*
|
||||
* @return array The field option objects.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
// Merge any additional options in the XML definition.
|
||||
$options = array_merge(parent::getOptions(), Help::createSiteList(JPATH_ADMINISTRATOR . '/help/helpsites.xml', $this->value));
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override to add refresh button
|
||||
*
|
||||
* @return string The field input markup.
|
||||
*
|
||||
* @since 3.2
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
HTMLHelper::_('script', 'legacy/helpsite.js', array('version' => 'auto', 'relative' => true));
|
||||
|
||||
$showDefault = (string) $this->getAttribute('showDefault') === 'false' ? 'false' : 'true';
|
||||
|
||||
$html = parent::getInput();
|
||||
$button = '<button
|
||||
type="button"
|
||||
class="btn btn-secondary"
|
||||
id="helpsite-refresh"
|
||||
rel="' . $this->id . '"
|
||||
showDefault="' . $showDefault . '"
|
||||
>
|
||||
<span>' . Text::_('JGLOBAL_HELPREFRESH_BUTTON') . '</span>
|
||||
</button>';
|
||||
|
||||
return $html . $button;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user