Adds option to stop and start a search. Adds better user experience to the search area.
This commit is contained in:
@@ -22,7 +22,10 @@ $this->app->input->set('hidemainmenu', false);
|
||||
|
||||
// set the basu URL
|
||||
$url_base = JUri::base() . 'index.php?option=com_componentbuilder';
|
||||
$url_search = $url_base . '&view=search';
|
||||
$url_search = $url_base . '&view=search';
|
||||
|
||||
// get main search input field
|
||||
$search_value = $this->form->getField('search_value');
|
||||
?>
|
||||
<?php if ($this->canDo->get('search.access')): ?>
|
||||
<script type="text/javascript">
|
||||
@@ -74,16 +77,42 @@ $url_search = $url_base . '&view=search';
|
||||
<span class="search_details_title"><?php echo JText::_('COM_COMPONENTBUILDER_REPLACED_WITH'); ?></span>:
|
||||
[<span id="replaced" class="found_code">....</span>]
|
||||
</span>
|
||||
<button style="float: right;" type="button" onclick="showSearch();" class="btn button-new btn-success">
|
||||
<span class="icon-search icon-white" aria-hidden="true"></span>
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_SEARCH_DATABASE_AGAIN'); ?>
|
||||
</button>
|
||||
<div class="btn-group" style="float: right;">
|
||||
<button style="display: none;" type="button" onclick="replaceAllCheck();" class="update_all_block hasTooltip btn button-new btn-danger"
|
||||
title="<?php echo JText::_('COM_COMPONENTBUILDER_UPDATE_ALL_ITEMS_FOUND_WITH_THIS_DATABASE_SEARCH_WITH_THE_REPLACE_VALUE'); ?>">
|
||||
<span class="icon-database icon-white" aria-hidden="true"></span>
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_UPDATE_ALL'); ?>
|
||||
</button>
|
||||
<button type="button" onclick="showSearch();" class="btn button-new btn-success">
|
||||
<span class="icon-search icon-white" aria-hidden="true"></span>
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_SEARCH_DATABASE_AGAIN'); ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-fluid" id="search_settings_block">
|
||||
<div class="span7">
|
||||
<?php echo $this->form->renderField('type_search'); ?>
|
||||
<?php echo $this->form->renderField('search_value'); ?>
|
||||
<div class="btn-wrapper input-append">
|
||||
<?php echo $search_value->input; ?>
|
||||
<button id="start_search_button" onclick="startSearch(this, true);" type="button" class="btn hasTooltip"
|
||||
title="<?php echo JHtml::_('tooltipText', 'COM_COMPONENTBUILDER_START_A_SEARCH'); ?>"
|
||||
aria-label="<?php echo JText::_('COM_COMPONENTBUILDER_START_A_SEARCH'); ?>">
|
||||
<span class="icon-search" aria-hidden="true"></span>
|
||||
</button>
|
||||
<button id="stop_search_button" onclick="stopSearch();" type="button" class="btn btn-danger hasTooltip" style="display: none"
|
||||
title="<?php echo JHtml::_('tooltipText', 'COM_COMPONENTBUILDER_STOP_A_SEARCH'); ?>"
|
||||
aria-label="<?php echo JText::_('COM_COMPONENTBUILDER_STOP_A_SEARCH'); ?>">
|
||||
<span class="icon-stop" aria-hidden="true"></span>
|
||||
</button>
|
||||
</div>
|
||||
<?php echo $this->form->renderField('replace_value'); ?>
|
||||
<div class="update_all_block" style="display: none;">
|
||||
<button type="button" onclick="replaceAllCheck();" class="hasTooltip btn btn-small button-new btn-danger span11"
|
||||
title="<?php echo JText::_('COM_COMPONENTBUILDER_UPDATE_ALL_ITEMS_FOUND_WITH_THIS_DATABASE_SEARCH_WITH_THE_REPLACE_VALUE'); ?>">
|
||||
<span class="icon-database icon-white" aria-hidden="true"></span>
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_UPDATE_ALL'); ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="span4">
|
||||
<?php echo $this->form->renderFieldset('settings'); ?>
|
||||
@@ -96,27 +125,19 @@ $url_search = $url_base . '&view=search';
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-fluid" id="item_view_block">
|
||||
<hr>
|
||||
<div>
|
||||
<span id="item_notice_block" style="display: none">
|
||||
<span id="item_edit_button"></span>
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_TABLE'); ?>: <b><span id="item_table_name">
|
||||
</span></b>(<?php echo JText::_('COM_COMPONENTBUILDER_ID'); ?>:<b><span id="item_row_id">
|
||||
</span></b>) |
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_FIELD'); ?>: <b><span id="item_field_name">
|
||||
</span></b>(<?php echo JText::_('COM_COMPONENTBUILDER_LINE'); ?>:<b><span id="item_line_number">
|
||||
</span></b>)
|
||||
<button type="button" id="item_button_update" onclick="" class="hasTooltip btn btn-small button-new btn-success"
|
||||
title="<?php echo JText::_('COM_COMPONENTBUILDER_SAVE_ALL_CHANGES_MADE_TO_THE_SELECTED_ITEM'); ?>">
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_SAVE_ITEM'); ?>
|
||||
</button>
|
||||
</span>
|
||||
<span id="update_all_block" style="display: none;">
|
||||
<button style="float: right;" type="button" onclick="replaceAllCheck();" class="hasTooltip btn btn-small button-new btn-danger"
|
||||
title="<?php echo JText::_('COM_COMPONENTBUILDER_UPDATE_ALL_ITEMS_FOUND_WITH_THIS_DATABASE_SEARCH_WITH_THE_REPLACE_VALUE'); ?>">
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_UPDATE_ALL'); ?>
|
||||
</button>
|
||||
</span>
|
||||
<div id="item_notice_block" style="display: none">
|
||||
<hr>
|
||||
<span id="item_edit_button"></span>
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_TABLE'); ?>: <b><span id="item_table_name">
|
||||
</span></b>(<?php echo JText::_('COM_COMPONENTBUILDER_ID'); ?>:<b><span id="item_row_id">
|
||||
</span></b>) |
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_FIELD'); ?>: <b><span id="item_field_name">
|
||||
</span></b>(<?php echo JText::_('COM_COMPONENTBUILDER_LINE'); ?>:<b><span id="item_line_number">
|
||||
</span></b>)
|
||||
<button type="button" id="item_button_update" onclick="" class="hasTooltip btn btn-small button-new btn-success"
|
||||
title="<?php echo JText::_('COM_COMPONENTBUILDER_SAVE_ALL_CHANGES_MADE_TO_THE_SELECTED_ITEM'); ?>">
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_SAVE_ITEM'); ?>
|
||||
</button>
|
||||
</div>
|
||||
<hr>
|
||||
<?php echo $this->form->getInput('item_code'); ?>
|
||||
@@ -174,6 +195,10 @@ const typeReplaceObject = document.getElementById("type_search1");
|
||||
const typeSearchLabelObject = document.querySelector('[for=type_search0]');
|
||||
const typeReplaceLabelObject = document.querySelector('[for=type_search1]');
|
||||
|
||||
// search buttons
|
||||
const startSearchButton = document.getElementById("start_search_button");
|
||||
const stopSearchButton = document.getElementById("stop_search_button");
|
||||
|
||||
// set the search settings objects
|
||||
const searchObject = document.getElementById("search_value");
|
||||
const replaceObject = document.getElementById("replace_value");
|
||||
@@ -183,17 +208,17 @@ const regexObject = document.getElementById("search_behaviour2");
|
||||
const tableObject = document.getElementById("table_name");
|
||||
|
||||
// Do the search on key up of search or replace input elements
|
||||
searchObject.onkeyup = onChange;
|
||||
searchObject.onkeyup = startSearch;
|
||||
|
||||
// when the made changes and there is replace value do search
|
||||
modeObject.onchange = onChange;
|
||||
replaceObject.onkeyup = onChange;
|
||||
modeObject.onchange = startSearch;
|
||||
replaceObject.onkeyup = startSearch;
|
||||
|
||||
// Do the search on key up of search input elements
|
||||
matchObject.onchange = onChange;
|
||||
wholeObject.onchange = onChange;
|
||||
regexObject.onchange = onChange;
|
||||
tableObject.onchange = onChange;
|
||||
matchObject.onchange = startSearch;
|
||||
wholeObject.onchange = startSearch;
|
||||
regexObject.onchange = startSearch;
|
||||
tableObject.onchange = startSearch;
|
||||
|
||||
// set the item notice area
|
||||
const itemNoticeObject = document.getElementById("item_notice_block");
|
||||
@@ -205,7 +230,7 @@ const itemLineNumberObject = document.getElementById("item_line_number");
|
||||
|
||||
// set the update buttons
|
||||
const buttonUpdateItemObject = document.getElementById("item_button_update");
|
||||
const buttonUpdateAllObject = document.getElementById("update_all_block");
|
||||
const buttonUpdateAllObject = document.querySelectorAll(".update_all_block");
|
||||
|
||||
// get the editor
|
||||
var editorObject;
|
||||
@@ -222,8 +247,10 @@ const tableConfigObject = {
|
||||
order: [[ 2, "asc" ]],
|
||||
select: true,
|
||||
paging: true,
|
||||
deferRender: true,
|
||||
lengthMenu: [5, 10, 20 ,50, 80, 100, 150, 200, 500, 1000, 1500, 2000],
|
||||
pageLength: 80,
|
||||
// pagingType: "scrolling", // NOT YET
|
||||
scrollY: 170,
|
||||
columnDefs: [
|
||||
{ 'targets': [ 0 ], 'visible': false, 'searchable': false },
|
||||
@@ -305,7 +332,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
|
||||
showSearch();
|
||||
<?php if (strlen($this->urlvalues['search_value']) > 2): ?>
|
||||
onChange();
|
||||
startSearch();
|
||||
<?php endif; ?>
|
||||
});
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user