primo commit
This commit is contained in:
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* @package OSMap
|
||||
* @contact www.joomlashack.com, help@joomlashack.com
|
||||
* @copyright 2007-2014 XMap - Joomla! Vargas - Guillermo Vargas. All rights reserved.
|
||||
* @copyright 2016-2024 Joomlashack.com. All rights reserved.
|
||||
* @license https://www.gnu.org/licenses/gpl.html GNU/GPL
|
||||
*
|
||||
* This file is part of OSMap.
|
||||
*
|
||||
* OSMap is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* OSMap is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with OSMap. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use Alledia\OSMap\Factory;
|
||||
|
||||
defined('_JEXEC') or die();
|
||||
|
||||
Factory::getApplication()->input->set('tmpl', 'component');
|
||||
|
||||
if (empty($this->message)) :
|
||||
echo $this->loadTemplate('items');
|
||||
|
||||
else : ?>
|
||||
<div class="alert alert-warning">
|
||||
<?php echo $this->message; ?>
|
||||
</div>
|
||||
<?php endif;
|
||||
|
||||
jexit();
|
||||
@ -0,0 +1,217 @@
|
||||
<?php
|
||||
/**
|
||||
* @package OSMap
|
||||
* @contact www.joomlashack.com, help@joomlashack.com
|
||||
* @copyright 2007-2014 XMap - Joomla! Vargas - Guillermo Vargas. All rights reserved.
|
||||
* @copyright 2016-2024 Joomlashack.com. All rights reserved.
|
||||
* @license https://www.gnu.org/licenses/gpl.html GNU/GPL
|
||||
*
|
||||
* This file is part of OSMap.
|
||||
*
|
||||
* OSMap is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* OSMap is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with OSMap. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Version;
|
||||
|
||||
defined('_JEXEC') or die();
|
||||
|
||||
|
||||
$frequncyOptions = HTMLHelper::_('osmap.frequencyList');
|
||||
array_walk(
|
||||
$frequncyOptions,
|
||||
function (string &$text, string $value) {
|
||||
$text = HTMLHelper::_('select.option', $value, $text);
|
||||
}
|
||||
);
|
||||
|
||||
$priorityOptions = array_map(
|
||||
function (float $priority) {
|
||||
return HTMLHelper::_('select.option', $priority, $priority);
|
||||
},
|
||||
HTMLHelper::_('osmap.priorityList')
|
||||
);
|
||||
|
||||
$showItemUid = $this->osmapParams->get('show_item_uid', 0);
|
||||
$showExternalLinks = (int)$this->osmapParams->get('show_external_links', 0);
|
||||
$items = [];
|
||||
|
||||
$this->sitemap->traverse(
|
||||
/**
|
||||
* @param object $item
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function (object $item) use (&$items, &$showItemUid, &$showExternalLinks) {
|
||||
if (
|
||||
($item->isInternal == false && $showExternalLinks === 0)
|
||||
|| $item->hasCompatibleLanguage() == false
|
||||
) :
|
||||
return false;
|
||||
endif;
|
||||
|
||||
if ($showExternalLinks === 2) :
|
||||
// Display only in the HTML sitemap
|
||||
$item->addAdminNote('COM_OSMAP_ADMIN_NOTE_IGNORED_EXTERNAL_HTML');
|
||||
endif;
|
||||
|
||||
// Add notes about sitemap visibility
|
||||
if ($item->visibleForXML == false) :
|
||||
$item->addAdminNote('COM_OSMAP_ADMIN_NOTE_VISIBLE_HTML_ONLY');
|
||||
endif;
|
||||
|
||||
if ($item->visibleForHTML == false) :
|
||||
$item->addAdminNote('COM_OSMAP_ADMIN_NOTE_VISIBLE_XML_ONLY');
|
||||
endif;
|
||||
|
||||
if ($item->visibleForRobots == false) :
|
||||
$item->addAdminNote('COM_OSMAP_ADMIN_NOTE_INVISIBLE_FOR_ROBOTS');
|
||||
endif;
|
||||
|
||||
if ($item->parentIsVisibleForRobots == false) :
|
||||
$item->addAdminNote('COM_OSMAP_ADMIN_NOTE_PARENT_INVISIBLE_FOR_ROBOTS');
|
||||
endif;
|
||||
|
||||
$items[] = $item;
|
||||
|
||||
return true;
|
||||
},
|
||||
false,
|
||||
true
|
||||
);
|
||||
|
||||
$count = count($items);
|
||||
?>
|
||||
<table class="adminlist table table-striped" id="itemList">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 1%;min-width:55px" class="text-center center">
|
||||
<?php echo Text::_('COM_OSMAP_HEADING_STATUS'); ?>
|
||||
</th>
|
||||
|
||||
<th class="title">
|
||||
<?php echo Text::_('COM_OSMAP_HEADING_URL'); ?>
|
||||
</th>
|
||||
|
||||
<th class="title">
|
||||
<?php echo Text::_('COM_OSMAP_HEADING_TITLE'); ?>
|
||||
</th>
|
||||
|
||||
<th class="text-center center">
|
||||
<?php echo Text::_('COM_OSMAP_HEADING_PRIORITY'); ?>
|
||||
</th>
|
||||
|
||||
<th class="text-center center">
|
||||
<?php echo Text::_('COM_OSMAP_HEADING_CHANGE_FREQ'); ?>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<?php
|
||||
foreach ($items as $row => $item) : ?>
|
||||
<tr class="sitemapitem <?php echo 'row' . $row; ?> <?php echo ($showItemUid) ? 'with-uid' : ''; ?>"
|
||||
data-uid="<?php echo $item->uid; ?>"
|
||||
data-settings-hash="<?php echo $item->settingsHash; ?>">
|
||||
|
||||
<td class="text-center center">
|
||||
<div class="sitemapitem-published"
|
||||
data-original="<?php echo $item->published ? '1' : '0'; ?>"
|
||||
data-value="<?php echo $item->published ? '1' : '0'; ?>">
|
||||
|
||||
<?php
|
||||
$class = $item->published ? 'publish' : 'unpublish';
|
||||
$title = $item->published
|
||||
? 'COM_OSMAP_TOOLTIP_CLICK_TO_UNPUBLISH'
|
||||
: 'COM_OSMAP_TOOLTIP_CLICK_TO_PUBLISH';
|
||||
?>
|
||||
|
||||
<span title="<?php echo Text::_($title); ?>"
|
||||
class="hasTooltip icon-<?php echo $class; ?>">
|
||||
</span>
|
||||
</div>
|
||||
<?php
|
||||
if ($notes = $item->getAdminNotesString()) : ?>
|
||||
<span class="icon-warning hasTooltip osmap-info" title="<?php echo $notes; ?>"></span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
|
||||
<td class="sitemapitem-link">
|
||||
<?php if ($item->level > 0) : ?>
|
||||
<span class="level-mark"><?php echo str_repeat('—', $item->level); ?></span>
|
||||
<?php endif;
|
||||
|
||||
if ($item->rawLink !== '#' && $item->link !== '#') :
|
||||
if (Version::MAJOR_VERSION < 4) :
|
||||
echo '<span class="icon-new-tab"></span>';
|
||||
endif;
|
||||
|
||||
echo HTMLHelper::_(
|
||||
'link',
|
||||
$item->rawLink,
|
||||
$item->rawLink,
|
||||
[
|
||||
'target' => '_blank',
|
||||
'class' => 'hasTooltip',
|
||||
'title' => $item->link,
|
||||
]
|
||||
);
|
||||
|
||||
else :
|
||||
echo sprintf('<span>%s</span>', $item->name ?? '');
|
||||
endif;
|
||||
|
||||
if ($showItemUid) :
|
||||
echo sprintf(
|
||||
'<br><div class="small osmap-item-uid">%s: %s</div>',
|
||||
Text::_('COM_OSMAP_UID'),
|
||||
$item->uid
|
||||
);
|
||||
endif;
|
||||
?>
|
||||
</td>
|
||||
|
||||
<td class="sitemapitem-name">
|
||||
<?php echo $item->name ?? ''; ?>
|
||||
</td>
|
||||
|
||||
<td class="text-center center">
|
||||
<div class="sitemapitem-priority"
|
||||
data-original="<?php echo $item->priority; ?>"
|
||||
data-value="<?php echo sprintf('%03.1f', $item->priority); ?>">
|
||||
|
||||
<?php echo sprintf('%03.1f', $item->priority); ?>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<td class="text-center center">
|
||||
<div class="sitemapitem-changefreq"
|
||||
data-original="<?php echo $item->changefreq; ?>"
|
||||
data-value="<?php echo $item->changefreq; ?>">
|
||||
|
||||
<?php echo Text::_('COM_OSMAP_' . strtoupper($item->changefreq)); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<div><?php echo Text::sprintf('COM_OSMAP_NUMBER_OF_ITEMS_FOUND', $count); ?></div>
|
||||
|
||||
<?php if (empty($count)) : ?>
|
||||
<div class="alert alert-warning">
|
||||
<?php echo Text::_('COM_OSMAP_NO_ITEMS'); ?>
|
||||
</div>
|
||||
<?php endif;
|
||||
108
components/com_osmap/views/adminsitemapitems/view.html.php
Normal file
108
components/com_osmap/views/adminsitemapitems/view.html.php
Normal file
@ -0,0 +1,108 @@
|
||||
<?php
|
||||
/**
|
||||
* @package OSMap
|
||||
* @contact www.joomlashack.com, help@joomlashack.com
|
||||
* @copyright 2007-2014 XMap - Joomla! Vargas - Guillermo Vargas. All rights reserved.
|
||||
* @copyright 2016-2024 Joomlashack.com. All rights reserved.
|
||||
* @license https://www.gnu.org/licenses/gpl.html GNU/GPL
|
||||
*
|
||||
* This file is part of OSMap.
|
||||
*
|
||||
* OSMap is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* OSMap is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with OSMap. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use Alledia\OSMap\Component\Helper as ComponentHelper;
|
||||
use Alledia\OSMap\Factory;
|
||||
use Alledia\OSMap\Sitemap\SitemapInterface;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\MVC\View\HtmlView;
|
||||
use Joomla\Input\Input;
|
||||
use Joomla\Registry\Registry;
|
||||
|
||||
defined('_JEXEC') or die();
|
||||
|
||||
class OSMapViewAdminSitemapItems extends HtmlView
|
||||
{
|
||||
/**
|
||||
* @var Registry
|
||||
*/
|
||||
protected $params = null;
|
||||
|
||||
/**
|
||||
* @var SitemapInterface
|
||||
*/
|
||||
protected $sitemap = null;
|
||||
|
||||
/**
|
||||
* @var Registry
|
||||
*/
|
||||
protected $osmapParams = null;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $message = null;
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @throws Exception
|
||||
*/
|
||||
public function display($tpl = null)
|
||||
{
|
||||
$this->checkAccess();
|
||||
|
||||
$container = Factory::getPimpleContainer();
|
||||
|
||||
try {
|
||||
$id = $container->input->getInt('id');
|
||||
|
||||
$this->params = Factory::getApplication()->getParams();
|
||||
|
||||
// Load the sitemap instance
|
||||
$this->sitemap = Factory::getSitemap($id);
|
||||
$this->osmapParams = ComponentHelper::getParams();
|
||||
|
||||
} catch (Exception $e) {
|
||||
$this->message = $e->getMessage();
|
||||
}
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
/**
|
||||
* This view should only be available from the backend
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function checkAccess()
|
||||
{
|
||||
$server = new Input(array_change_key_case($_SERVER, CASE_LOWER));
|
||||
$referer = parse_url($server->getString('http_referer'));
|
||||
|
||||
if (empty($referer['query']) == false) {
|
||||
parse_str($referer['query'], $query);
|
||||
|
||||
$option = empty($query['option']) ? null : $query['option'];
|
||||
$view = empty($query['view']) ? null : $query['view'];
|
||||
|
||||
if ($option == 'com_osmap' && $view == 'sitemapitems') {
|
||||
// Good enough
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
throw new Exception(Text::_('JERROR_PAGE_NOT_FOUND'), 404);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user