mirror of
https://github.com/joomla-extensions/weblinks.git
synced 2025-01-27 22:38:28 +00:00
View and router frontend CS (#231)
* Update view.html.php * Update default_items.php * Update default.php * Update view.html.php * Update edit.php * Update router.php * Update router.php * Update default_items.php * Update view.html.php * Update view.html.php
This commit is contained in:
parent
8688bfd9cc
commit
77d2b1fbf9
@ -259,7 +259,11 @@ class WeblinksRouter extends JComponentRouterBase
|
||||
/**
|
||||
* Weblinks router functions
|
||||
*
|
||||
* These functions are proxys for the new router interface
|
||||
* @param array &$query An array of URL arguments
|
||||
*
|
||||
* @return array The URL arguments to use to assemble the subsequent URL.
|
||||
*
|
||||
* Note. These functions are proxies for the new router interface
|
||||
* for old SEF extensions.
|
||||
*
|
||||
* @deprecated 4.0 Use Class based routers instead
|
||||
@ -271,6 +275,18 @@ function WeblinksBuildRoute(&$query)
|
||||
return $router->build($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Weblinks router functions
|
||||
*
|
||||
* @param array $segments The segments of the URL to parse.
|
||||
*
|
||||
* @return array The URL attributes to be used by the application.
|
||||
*
|
||||
* Note. These functions are proxies for the new router interface
|
||||
* for old SEF extensions.
|
||||
*
|
||||
* @deprecated 4.0 Use Class based routers instead
|
||||
*/
|
||||
function WeblinksParseRoute($segments)
|
||||
{
|
||||
$router = new WeblinksRouter;
|
||||
|
@ -54,7 +54,6 @@ $listDirn = $this->escape($this->state->get('list.direction'));
|
||||
</fieldset>
|
||||
<?php endif; ?>
|
||||
<ul class="category list-striped list-condensed">
|
||||
|
||||
<?php foreach ($this->items as $i => $item) : ?>
|
||||
<?php if (in_array($item->access, $this->user->getAuthorisedViewLevels())) : ?>
|
||||
<?php if ($this->items[$i]->state == 0) : ?>
|
||||
@ -84,22 +83,21 @@ $listDirn = $this->escape($this->state->get('list.direction'));
|
||||
<?php echo '<img src="' . $this->params->get('link_icons') . '" alt="' . JText::_('COM_WEBLINKS_LINK') . '" />'; ?>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
// Compute the correct link
|
||||
$menuclass = 'category' . $this->pageclass_sfx;
|
||||
$link = $item->link;
|
||||
$width = $item->params->get('width');
|
||||
$height = $item->params->get('height');
|
||||
if ($width == null || $height == null)
|
||||
{
|
||||
$width = 600;
|
||||
$height = 500;
|
||||
}
|
||||
if ($this->items[$i]->state == 0) : ?>
|
||||
<?php // Compute the correct link ?>
|
||||
<?php $menuclass = 'category' . $this->pageclass_sfx; ?>
|
||||
<?php $link = $item->link; ?>
|
||||
<?php $width = $item->params->get('width'); ?>
|
||||
<?php $height = $item->params->get('height'); ?>
|
||||
<?php if ($width == null || $height == null) : ?>
|
||||
<?php $width = 600; ?>
|
||||
<?php $height = 500; ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->items[$i]->state == 0) : ?>
|
||||
<span class="label label-warning"><?php echo JText::_('JUNPUBLISHED'); ?></span>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php switch ($item->params->get('target', $this->params->get('target')))
|
||||
<?php
|
||||
switch ($item->params->get('target', $this->params->get('target')))
|
||||
{
|
||||
case 1:
|
||||
// Open in a new window
|
||||
@ -133,38 +131,32 @@ $listDirn = $this->escape($this->state->get('list.direction'));
|
||||
<?php $this->item->tagLayout = new JLayoutFile('joomla.content.tags'); ?>
|
||||
<?php echo $this->item->tagLayout->render($tagsData); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (($this->params->get('show_link_description')) and ($item->description != '')) : ?>
|
||||
<?php $images = json_decode($item->images); ?>
|
||||
<?php if (isset($images->image_first) and !empty($images->image_first)) : ?>
|
||||
<?php $imgfloat = (empty($images->float_first)) ? $this->params->get('float_first') : $images->float_first; ?>
|
||||
<div class="img-intro-<?php echo htmlspecialchars($imgfloat); ?>"> <img
|
||||
<?php if ($images->image_first_caption):
|
||||
echo 'class="caption"'.' title="' .htmlspecialchars($images->image_first_caption) .'"';
|
||||
endif; ?>
|
||||
<?php if ($images->image_first_caption) : ?>
|
||||
<?php echo 'class="caption" title="' . htmlspecialchars($images->image_first_caption) . '"'; ?>
|
||||
<?php endif; ?>
|
||||
src="<?php echo htmlspecialchars($images->image_first); ?>" alt="<?php echo htmlspecialchars($images->image_first_alt); ?>"/> </div>
|
||||
<?php endif; ?>
|
||||
<?php if (isset($images->image_second) and !empty($images->image_second)) : ?>
|
||||
<?php $imgfloat = (empty($images->float_second)) ? $this->params->get('float_second') : $images->float_second; ?>
|
||||
<div class="pull-<?php echo htmlspecialchars($imgfloat); ?> item-image"> <img
|
||||
<?php if ($images->image_second_caption):
|
||||
echo 'class="caption"'.' title="' .htmlspecialchars($images->image_second_caption) .'"';
|
||||
endif; ?>
|
||||
<?php if ($images->image_second_caption) : ?>
|
||||
<?php echo 'class="caption" title="' . htmlspecialchars($images->image_second_caption) . '"'; ?>
|
||||
<?php endif; ?>
|
||||
src="<?php echo htmlspecialchars($images->image_second); ?>" alt="<?php echo htmlspecialchars($images->image_second_alt); ?>"/> </div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php echo $item->description; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
</li>
|
||||
<?php endif;?>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
|
||||
<?php // Code to add a link to submit a weblink. ?>
|
||||
<?php /* if ($canCreate) : // TODO This is not working due to some problem in the router, I think. Ref issue #23685 ?>
|
||||
<?php echo JHtml::_('icon.create', $item, $item->params); ?>
|
||||
<?php endif; */ ?>
|
||||
<?php if ($this->params->get('show_pagination')) : ?>
|
||||
<div class="pagination">
|
||||
<?php if ($this->params->def('show_pagination_results', 1)) : ?>
|
||||
|
@ -24,6 +24,13 @@ class WeblinksViewForm extends JViewLegacy
|
||||
|
||||
protected $state;
|
||||
|
||||
/**
|
||||
* Display the view.
|
||||
*
|
||||
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
|
||||
*
|
||||
* @return mixed A string if successful, otherwise an Error object.
|
||||
*/
|
||||
public function display($tpl = null)
|
||||
{
|
||||
$user = JFactory::getUser();
|
||||
@ -78,6 +85,8 @@ class WeblinksViewForm extends JViewLegacy
|
||||
|
||||
/**
|
||||
* Prepares the document
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function _prepareDocument()
|
||||
{
|
||||
|
@ -20,6 +20,13 @@ class WeblinksViewWeblink extends JViewLegacy
|
||||
|
||||
protected $item;
|
||||
|
||||
/**
|
||||
* Display the view.
|
||||
*
|
||||
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
|
||||
*
|
||||
* @return mixed A string if successful, otherwise an Error object.
|
||||
*/
|
||||
public function display($tpl = null)
|
||||
{
|
||||
// Get some data from the models
|
||||
@ -28,17 +35,18 @@ class WeblinksViewWeblink extends JViewLegacy
|
||||
if ($this->getLayout() == 'edit')
|
||||
{
|
||||
$this->_displayEdit($tpl);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($item->url)
|
||||
{
|
||||
// redirects to url if matching id found
|
||||
// Redirects to url if matching id found
|
||||
JFactory::getApplication()->redirect($item->url);
|
||||
}
|
||||
else
|
||||
{
|
||||
//TODO create proper error handling
|
||||
// @TODO create proper error handling
|
||||
JFactory::getApplication()->redirect(JRoute::_('index.php'), JText::_('COM_WEBLINKS_ERROR_WEBLINK_NOT_FOUND'), 'notice');
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user