Skip to content

Commit

Permalink
Merge branch 'componentrouteradvanced' of github.com:Hackwar/joomla-c…
Browse files Browse the repository at this point in the history
…ms into componentrulesitemid
  • Loading branch information
Hackwar committed Dec 19, 2014
2 parents e3f6963 + 0309e22 commit fd05703
Show file tree
Hide file tree
Showing 40 changed files with 1,191 additions and 1,067 deletions.
1 change: 0 additions & 1 deletion administrator/components/com_tags/helpers/html/index.html

This file was deleted.

1 change: 0 additions & 1 deletion administrator/components/com_tags/models/fields/index.html

This file was deleted.

2 changes: 1 addition & 1 deletion administrator/components/com_users/config.xml
Expand Up @@ -5,7 +5,7 @@
name="allowUserRegistration"
type="radio"
class="btn-group btn-group-yesno"
default="1"
default="0"
label="COM_USERS_CONFIG_FIELD_ALLOWREGISTRATION_LABEL"
description="COM_USERS_CONFIG_FIELD_ALLOWREGISTRATION_DESC">
<option value="1">JYES</option>
Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_users/models/users.php
Expand Up @@ -295,7 +295,7 @@ protected function getListQuery()
{
if ($active == '0')
{
$query->where('a.activation IN (' . $db->quote('') . ', 0)');
$query->where('a.activation IN (' . $db->quote('') . ', ' . $db->quote('0') . ')');
}
elseif ($active == '1')
{
Expand Down
126 changes: 67 additions & 59 deletions components/com_finder/views/search/tmpl/default_form.php
Expand Up @@ -9,74 +9,82 @@

defined('_JEXEC') or die;

JHtml::_('behavior.core');

$script = "jQuery(function() {";
if ($this->params->get('show_advanced', 1))
if ($this->params->get('show_advanced', 1) || $this->params->get('show_autosuggest', 1))
{
/*
* This segment of code adds the slide effect to the advanced search box.
*/
$script .= "
var searchSlider = jQuery('#advanced-search');
if (searchSlider.length)
{";
if (!$this->params->get('expand_advanced', 0))
{
$script .= "searchSlider.hide();";
}
JHtml::_('jquery.framework');

$script .= "
jQuery('#advanced-search-toggle').on('click', function(e) {
e.stopPropagation();
e.preventDefault();
searchSlider.slideToggle();
});
}";
/*
* This segment of code disables select boxes that have no value when the
* form is submitted so that the URL doesn't get blown up with null values.
*/
$script .= "
if (jQuery('#finder-search').length) {
jQuery('#finder-search').on('submit', function(e){
e.stopPropagation();
$script = "
jQuery(function() {
";
if ($this->params->get('show_advanced', 1))
{
/*
* This segment of code adds the slide effect to the advanced search box.
*/
$script .= "
var searchSlider = jQuery('#advanced-search');
if (searchSlider.length)
{
// Disable select boxes with no value selected.
searchSlider.find('select').each(function(index, el) {
var el = jQuery(el);
if(!el.val()){
el.attr('disabled', 'disabled');
{";
if (!$this->params->get('expand_advanced', 0))
{
$script .= "searchSlider.hide();";
}

$script .= "
jQuery('#advanced-search-toggle').on('click', function(e) {
e.stopPropagation();
e.preventDefault();
searchSlider.slideToggle();
});
}";
/*
* This segment of code disables select boxes that have no value when the
* form is submitted so that the URL doesn't get blown up with null values.
*/
$script .= "
if (jQuery('#finder-search').length) {
jQuery('#finder-search').on('submit', function(e){
e.stopPropagation();
if (searchSlider.length)
{
// Disable select boxes with no value selected.
searchSlider.find('select').each(function(index, el) {
var el = jQuery(el);
if(!el.val()){
el.attr('disabled', 'disabled');
}
});
}
});
}
});
}";
}
/*
* This segment of code sets up the autocompleter.
*/
if ($this->params->get('show_autosuggest', 1))
{
JHtml::_('script', 'media/jui/js/jquery.autocomplete.min.js', false, false, false, false, true);
";
}
/*
* This segment of code sets up the autocompleter.
*/
if ($this->params->get('show_autosuggest', 1))
{
JHtml::_('script', 'media/jui/js/jquery.autocomplete.min.js', false, false, false, false, true);

$script .= "
var a = jQuery('#q').autocomplete({
serviceUrl: '" . JRoute::_('index.php?option=com_finder&task=suggestions.suggest&format=json&tmpl=component', false) . "',
paramName: 'q',
minChars: 1,
maxHeight: 400,
width: 300,
zIndex: 9999,
deferRequestBy: 500
});";
}
$script .= "
var suggest = jQuery('#q').autocomplete({
serviceUrl: '" . JRoute::_('index.php?option=com_finder&task=suggestions.suggest&format=json&tmpl=component', false) . "',
paramName: 'q',
minChars: 1,
maxHeight: 400,
width: 300,
zIndex: 9999,
deferRequestBy: 500
});
";
}

$script .= "
});";
$script .= "
});
";

JFactory::getDocument()->addScriptDeclaration($script);
JFactory::getDocument()->addScriptDeclaration($script);
}
?>

<form id="finder-search" action="<?php echo JRoute::_($this->query->toURI()); ?>" method="get" class="form-inline">
Expand Down
57 changes: 38 additions & 19 deletions components/com_finder/views/search/tmpl/default_result.php
Expand Up @@ -12,34 +12,53 @@
// Get the mime type class.
$mime = !empty($this->result->mime) ? 'mime-' . $this->result->mime : null;

// Get the base url.
$base = JUri::getInstance()->toString(array('scheme', 'host', 'port'));
$show_description = $this->params->get('show_description', 1);

// Calculate number of characters to display around the result
$length = $this->params->get('description_length', 255) - strlen($this->query->input);
if ($show_description)
{
// Calculate number of characters to display around the result
$term_length = JString::strlen($this->query->input);
$desc_length = $this->params->get('description_length', 255);
$pad_length = $term_length < $desc_length ? floor(($desc_length - $term_length) / 2) : 0;

// Find the position of the search term
$pos = JString::strpos(JString::strtolower($this->result->description), JString::strtolower($this->query->input));

// Find a potential start point
$start = ($pos && $pos > $pad_length) ? $pos - $pad_length : 0;

// Find a space between $start and $pos, start right after it.
$space = JString::strpos($this->result->description, ' ', $start > 0 ? $start - 1 : 0);
$start = ($space && $space < $pos) ? $space + 1 : $start;

$description = JHtml::_('string.truncate', JString::substr($this->result->description, $start), $desc_length, true);
}

$route = $this->result->route;

// Get the route with highlighting information.
if (!empty($this->query->highlight) && empty($this->result->mime) && $this->params->get('highlight_terms', 1) && JPluginHelper::isEnabled('system', 'highlight'))
if (!empty($this->query->highlight)
&& empty($this->result->mime)
&& $this->params->get('highlight_terms', 1)
&& JPluginHelper::isEnabled('system', 'highlight'))
{
$route = $this->result->route . '&highlight=' . base64_encode(json_encode($this->query->highlight));
} else {
$route = $this->result->route;
$route .= '&highlight=' . base64_encode(json_encode($this->query->highlight));
}

?>

<li>
<h4 class="result-title <?php echo $mime; ?>"><a href="<?php echo JRoute::_($route); ?>"><?php echo $this->result->title; ?></a></h4>
<?php if ($this->params->get('show_description', 1)) : ?>
<p class="result-text<?php echo $this->pageclass_sfx; ?>">
<?php preg_match('/(?:.){0,' . $length . '}' . $this->query->input . '(?:.){0,' . $length . '}/s', $this->result->description, $description); ?>
<?php if(!empty($description[0])) : ?>
<?php echo $description[0]; ?>
<?php else: ?>
<?php echo JHtml::_('string.truncate', $this->result->description, $this->params->get('description_length', 255)); ?>
<?php endif; ?>
</p>
<h4 class="result-title <?php echo $mime; ?>">
<a href="<?php echo JRoute::_($route); ?>"><?php echo $this->result->title; ?></a>
</h4>
<?php if ($show_description) : ?>
<p class="result-text<?php echo $this->pageclass_sfx; ?>">
<?php echo $description; ?>
</p>
<?php endif; ?>
<?php if ($this->params->get('show_url', 1)) : ?>
<div class="small result-url<?php echo $this->pageclass_sfx; ?>"><?php echo $base . JRoute::_($this->result->route); ?></div>
<div class="small result-url<?php echo $this->pageclass_sfx; ?>">
<?php echo $this->baseUrl, JRoute::_($this->result->route); ?>
</div>
<?php endif; ?>
</li>
125 changes: 57 additions & 68 deletions components/com_finder/views/search/tmpl/default_results.php
Expand Up @@ -9,84 +9,73 @@

defined('_JEXEC') or die;

// Activate the highlighter if enabled.
if (!empty($this->query->highlight) && $this->params->get('highlight_terms', 1))
{
JHtml::_('behavior.highlighter', $this->query->highlight);
}

// Get the application object.
$app = JFactory::getApplication();

// Display the suggested search if it is different from the current search.
if (($this->suggested && $this->params->get('show_suggested_query', 1)) || ($this->explained && $this->params->get('show_explained_query', 1))):
?>
<?php // Display the suggested search if it is different from the current search. ?>
<?php if (($this->suggested && $this->params->get('show_suggested_query', 1)) || ($this->explained && $this->params->get('show_explained_query', 1))) : ?>
<div id="search-query-explained">
<?php
// Display the suggested search query.
if ($this->suggested && $this->params->get('show_suggested_query', 1))
{
// Replace the base query string with the suggested query string.
$uri = JUri::getInstance($this->query->toURI());
$uri->setVar('q', $this->suggested);
<?php // Display the suggested search query. ?>
<?php if ($this->suggested && $this->params->get('show_suggested_query', 1)) : ?>
<?php // Replace the base query string with the suggested query string. ?>
<?php $uri = JUri::getInstance($this->query->toURI()); ?>
<?php $uri->setVar('q', $this->suggested); ?>

// Compile the suggested query link.
$link = '<a href="' . JRoute::_($uri->toString(array('path', 'query'))) . '">'
. $this->escape($this->suggested)
. '</a>';
<?php // Compile the suggested query link. ?>
<?php $linkUrl = JRoute::_($uri->toString(array('path', 'query'))); ?>
<?php $link = '<a href="' . $linkUrl . '">' . $this->escape($this->suggested) . '</a>'; ?>

echo JText::sprintf('COM_FINDER_SEARCH_SIMILAR', $link);
}
// Display the explained search query.
elseif ($this->explained && $this->params->get('show_explained_query', 1))
{
echo $this->explained;
}
?>
<?php echo JText::sprintf('COM_FINDER_SEARCH_SIMILAR', $link); ?>

<?php // Display the explained search query. ?>
<?php elseif ($this->explained && $this->params->get('show_explained_query', 1)) : ?>
<?php echo $this->explained; ?>
<?php endif; ?>
</div>
<?php
endif;
<?php endif; ?>

if ($this->total == 0):
?>
<?php // Display the 'no results' message and exit the template. ?>
<?php if ($this->total == 0) : ?>
<div id="search-result-empty">
<h2><?php echo JText::_('COM_FINDER_SEARCH_NO_RESULTS_HEADING'); ?></h2>
<?php if ($app->getLanguageFilter()) : ?>
<p><?php echo JText::sprintf('COM_FINDER_SEARCH_NO_RESULTS_BODY_MULTILANG', $this->escape($this->query->input)); ?></p>
<?php else : ?>
<p><?php echo JText::sprintf('COM_FINDER_SEARCH_NO_RESULTS_BODY', $this->escape($this->query->input)); ?></p>
<?php endif; ?>
<?php $multilang = JFactory::getApplication()->getLanguageFilter() ? '_MULTILANG' : ''; ?>
<p><?php echo JText::sprintf('COM_FINDER_SEARCH_NO_RESULTS_BODY' . $multilang, $this->escape($this->query->input)); ?></p>
</div>
<?php
else:
// Prepare the pagination string. Results X - Y of Z
$start = (int) $this->pagination->get('limitstart') + 1;
$total = (int) $this->pagination->get('total');
$limit = (int) $this->pagination->get('limit') * $this->pagination->pagesTotal;
$limit = (int) ($limit > $total ? $total : $limit);
$pages = JText::sprintf('COM_FINDER_SEARCH_RESULTS_OF', $start, $limit, $total);
?>
<br id="highlighter-start" />
<ul class="search-results<?php echo $this->pageclass_sfx; ?> list-striped">
<?php
for ($i = 0, $n = count($this->results); $i < $n; $i++):
$this->result = &$this->results[$i];
$layout = $this->getLayoutFile($this->result->layout);
?>

<?php // Exit this template. ?>
<?php return; ?>
<?php endif; ?>

<?php // Activate the highlighter if enabled. ?>
<?php if (!empty($this->query->highlight) && $this->params->get('highlight_terms', 1)) : ?>
<?php JHtml::_('behavior.highlighter', $this->query->highlight); ?>
<?php endif; ?>

<?php // Display a list of results ?>
<br id="highlighter-start" />
<ul class="search-results<?php echo $this->pageclass_sfx; ?> list-striped">
<?php $this->baseUrl = JUri::getInstance()->toString(array('scheme', 'host', 'port')); ?>

<?php foreach ($this->results as $result) : ?>
<?php $this->result = &$result; ?>
<?php $layout = $this->getLayoutFile($this->result->layout); ?>
<?php echo $this->loadTemplate($layout); ?>
<?php endforeach; ?>
</ul>
<br id="highlighter-end" />

<?php // Display the pagination ?>
<div class="search-pagination">
<div class="pagination">
<?php echo $this->pagination->getPagesLinks(); ?>
</div>
<div class="search-pages-counter">
<?php
endfor;
?>
</ul>
<br id="highlighter-end" />
// Prepare the pagination string. Results X - Y of Z
$start = (int) $this->pagination->get('limitstart') + 1;
$total = (int) $this->pagination->get('total');
$limit = (int) $this->pagination->get('limit') * $this->pagination->pagesTotal;
$limit = (int) ($limit > $total ? $total : $limit);

<div class="search-pagination">
<div class="pagination">
<?php echo $this->pagination->getPagesLinks(); ?>
</div>
<div class="search-pages-counter">
<?php echo $pages; ?>
</div>
echo JText::sprintf('COM_FINDER_SEARCH_RESULTS_OF', $start, $limit, $total);
?>
</div>
<?php
endif;
</div>
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -17,7 +17,7 @@
"joomla/uri": "~1.1",
"ircmaxell/password-compat": "1.*",
"leafo/lessphp": "0.3.9",
"phpmailer/phpmailer": "5.2.8",
"phpmailer/phpmailer": "5.2.9",
"symfony/yaml": "2.*"
},
"require-dev": {
Expand Down

0 comments on commit fd05703

Please sign in to comment.