Release search stable BETA.

This commit is contained in:
Llewellyn van der Merwe 2022-11-04 22:18:05 +02:00
parent f1cb398f7a
commit 9f30f30b9e
Signed by: Llewellyn
GPG Key ID: A9201372263741E7
17 changed files with 298 additions and 74 deletions

View File

@ -9,7 +9,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have!
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (3.1.10) with **ALL** its features and **ALL** concepts totally open-source and free!
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (3.1.11) with **ALL** its features and **ALL** concepts totally open-source and free!
> Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
@ -140,11 +140,11 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
+ *First Build*: 30th April, 2015
+ *Last Build*: 2nd November, 2022
+ *Version*: 3.1.10
+ *Last Build*: 4th November, 2022
+ *Version*: 3.1.11
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **333951**
+ *Line count*: **334175**
+ *Field count*: **2004**
+ *File count*: **2183**
+ *Folder count*: **381**

View File

@ -9,7 +9,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have!
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (3.1.10) with **ALL** its features and **ALL** concepts totally open-source and free!
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (3.1.11) with **ALL** its features and **ALL** concepts totally open-source and free!
> Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
@ -140,11 +140,11 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
+ *First Build*: 30th April, 2015
+ *Last Build*: 2nd November, 2022
+ *Version*: 3.1.10
+ *Last Build*: 4th November, 2022
+ *Version*: 3.1.11
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **333951**
+ *Line count*: **334175**
+ *Field count*: **2004**
+ *File count*: **2183**
+ *Folder count*: **381**

View File

@ -48,6 +48,11 @@ const doSearch = async (signal, tables) => {
// start search timer
startSearchTimer();
// reset our global counters
fieldCount = 0;
lineCount = 0;
// set our local counters
let total = 0;
let progress = tables.length;
let index;
@ -68,23 +73,13 @@ const doSearch = async (signal, tables) => {
if (abort_this_search_values) {
break;
}
const response = await fetch(Url + 'doSearch', options).then(response => {
const response = await fetch(UrlAjax + 'doSearch', options).then(response => {
total++;
// calculate the percent
let percent = 100.0 * (total / progress);
// update the progress bar
searchProgressBarObject.style.width = percent.toFixed(2) + '%';
searchProgressBarObject.innerHTML = percent.toFixed(2) + '%';
// when complete hide the progress bar
if (progress == total) {
searchProgressBarObject.innerHTML = Joomla.JText._('COM_COMPONENTBUILDER_SEARCH_FINISHED_IN') + ' ' + getSearchLenght() + ' ' + Joomla.JText._('COM_COMPONENTBUILDER_SECONDS');
setTimeout(function () {
searchProgressObject.style.display = 'none';
}, 3000);
}
// return the json response
if (response.ok) {
return response.json();
} else {
UIkit.notify(Joomla.JText._('COM_COMPONENTBUILDER_THE_SEARCH_PROCESS_HAD_AN_ERROR_WITH_TABLE') + ' ' + tableName, {pos:'top-right', status:'danger'});
}
}).then((data) => {
if (typeof data.success !== 'undefined') {
@ -95,8 +90,35 @@ const doSearch = async (signal, tables) => {
if (typeof data.items !== 'undefined') {
addTableItems(resultsTable, data.items, typeSearch);
}
if (typeof data.fields_count !== 'undefined') {
fieldCount += data.fields_count;
}
if (typeof data.line_count !== 'undefined') {
lineCount += data.line_count;
}
// calculate the percent
let percent = 100.0 * (total / progress);
// update the progress bar
searchProgressBarObject.style.width = percent.toFixed(2) + '%';
searchProgressBarObject.innerHTML = percent.toFixed(2) + '%';
// when complete hide the progress bar
if (progress == total) {
let total_field_line = ' ' + fieldCount + ' ' + Joomla.JText._('COM_COMPONENTBUILDER_FIELDS_THAT_HAD') + ' ' + lineCount + ' ' + Joomla.JText._('COM_COMPONENTBUILDER_LINES') + ' ';
if (progress == 1) {
searchProgressBarObject.innerHTML = Joomla.JText._('COM_COMPONENTBUILDER_SEARCHING') + ' ' + tableName + total_field_line + Joomla.JText._('COM_COMPONENTBUILDER_AND_FINISHED_THE_SEARCH_IN') + ' ' + getSearchLenght() + ' ' + Joomla.JText._('COM_COMPONENTBUILDER_SECONDS');
} else {
searchProgressBarObject.innerHTML = Joomla.JText._('COM_COMPONENTBUILDER_SEARCHING') + ' ' + progress + ' ' + Joomla.JText._('COM_COMPONENTBUILDER_TABLES_WITH') + total_field_line + Joomla.JText._('COM_COMPONENTBUILDER_AND_FINISHED_THE_SEARCH_IN') + ' ' + getSearchLenght() + ' ' + Joomla.JText._('COM_COMPONENTBUILDER_SECONDS');
}
setTimeout(function () {
// hide the progress bar again
searchProgressObject.style.display = 'none';
}, 13000);
}
}).catch(error => {
console.log(error);
if (error.name === "AbortError") {
abort_this_search_values = true;
}
});
}
} catch (error) {
@ -129,7 +151,7 @@ const getSearchLenght = () => {
// get seconds
return Math.round(timeDiff);
}
};
/**
* JS Function to fetch selected item
@ -154,12 +176,12 @@ const getSelectedItem = async (table, row, field, line) => {
// get search value
if (mode == 1) {
// calling URL
postURL = Url + 'getSearchValue';
postURL = UrlAjax + 'getSearchValue';
} else {
// add the line value
formData.append('line_nr', line);
// calling URL
postURL = Url + 'getReplaceValue';
postURL = UrlAjax + 'getReplaceValue';
}
let options = {
@ -198,28 +220,23 @@ const replaceAllCheck = () => {
Joomla.JText._('COM_COMPONENTBUILDER_ARE_YOU_THEREFORE_ABSOLUTELY_SURE_YOU_WANT_TO_CONTINUE');
// do check
UIkit.modal.confirm(question, function () {
// we clear the table again
clearAll();
// show the search settings again
showSearch();
// clear search values
clearSearch();
// Create new controller and issue new request
controller = new AbortController();
controller_replace = new AbortController();
// check if any specific table was set
let tables = [];
let table = tableObject.value;
if (table != -1) {
tables.push(table);
replaceAll(controller.signal, tables);
replaceAll(controller_replace.signal, tables);
} else {
replaceAll(controller.signal, searchTables);
replaceAll(controller_replace.signal, searchTables);
}
});
}, {labels: { Ok: Joomla.JText._('COM_COMPONENTBUILDER_YES_UPDATE_ALL'), Cancel: Joomla.JText._('COM_COMPONENTBUILDER_NO') }});
};
/**
@ -230,31 +247,38 @@ const replaceAll = async (signal, tables) => {
// build form
const formData = new FormData();
// load the result table
const resultsTable = new DataTable('#search_results_table');
// get the search mode
let typeSearch = modeObject.querySelector('input[type=\'radio\']:checked').value;
// set some search values
let searchValue = searchObject.value;
let replaceValue = replaceObject.value;
let matchValue = matchObject.checked ? 1 : 0;
let wholeValue = wholeObject.checked ? 1 : 0;
let regexValue = regexObject.checked ? 1 : 0;
// add the form data
formData.append('table_name', '');
formData.append('type_search', typeSearch);
formData.append('search_value', searchValue);
formData.append('replace_value', replaceValue);
formData.append('match_case', matchObject.checked ? 1 : 0);
formData.append('whole_word', wholeObject.checked ? 1 : 0);
formData.append('regex_search', regexObject.checked ? 1 : 0);
formData.append('match_case', matchValue);
formData.append('whole_word', wholeValue);
formData.append('regex_search', regexValue);
// reset the progress bar
replaceProgressBarObject.style.width = '0%';
// show the progress bar
replaceProgressObject.style.display = '';
let abort_this_replace_values = false;
let total = 0;
let progress = tables.length;
let index;
for (index = 0; index < tables.length; index++) {
for (index = 0; index < progress; index++) {
let tableName = tables[index];
@ -270,10 +294,12 @@ const replaceAll = async (signal, tables) => {
if (abort_this_replace_values) {
break;
}
const response = await fetch(Url + 'replaceAll', options).then(response => {
const response = await fetch(UrlAjax + 'replaceAll', options).then(response => {
total++;
if (response.ok) {
return response.json();
} else {
UIkit.notify(Joomla.JText._('COM_COMPONENTBUILDER_THE_REPLACE_PROCESS_HAD_AN_ERROR_WITH_TABLE') + ' ' + tableName, {pos:'top-right', status:'danger'});
}
}).then((data) => {
if (typeof data.success !== 'undefined') {
@ -281,8 +307,44 @@ const replaceAll = async (signal, tables) => {
} else if (typeof data.error !== 'undefined') {
UIkit.notify(data.error, {pos:'bottom-right', timeout : 200});
}
// calculate the percent
let percent = 100.0 * (total / progress);
// update the progress bar
replaceProgressBarObject.style.width = percent.toFixed(2) + '%';
// when complete hide the progress bar
if (progress == total) {
setTimeout(function () {
// hide the progress bar again
replaceProgressObject.style.display = 'none';
// we clear the table again
clearAll();
// if not reqex we reverse the search for you so you can see the update was a success
if (regexValue == 0) {
// set the replace value as the search value
UIkit.modal.confirm(Joomla.JText._('COM_COMPONENTBUILDER_WOULD_YOU_LIKE_TO_DO_A_REVERSE_SEARCH'), function(){
setSearch(replaceValue, searchValue, matchValue, wholeValue, regexValue, 2);
}, function () {
UIkit.modal.confirm(Joomla.JText._('COM_COMPONENTBUILDER_WOULD_YOU_LIKE_TO_REPEAT_THE_SAME_SEARCH'), function(){
onChange();
}, function () {
clearSearch();
}, {labels: { Ok: Joomla.JText._('COM_COMPONENTBUILDER_YES'), Cancel: Joomla.JText._('COM_COMPONENTBUILDER_NO') }});
}, {labels: { Ok: Joomla.JText._('COM_COMPONENTBUILDER_YES'), Cancel: Joomla.JText._('COM_COMPONENTBUILDER_NO') }});
} else {
// else we search it again just to prove its changed
UIkit.modal.confirm(Joomla.JText._('COM_COMPONENTBUILDER_WOULD_YOU_LIKE_TO_REPEAT_THE_SAME_SEARCH'), function(){
onChange();
}, function () {
clearSearch();
}, {labels: { Ok: Joomla.JText._('COM_COMPONENTBUILDER_YES'), Cancel: Joomla.JText._('COM_COMPONENTBUILDER_NO') }});
}
}, 3000);
}
}).catch(error => {
console.log(error);
if (error.name === "AbortError") {
abort_this_replace_values = true;
}
});
}
} catch (error) {
@ -303,7 +365,7 @@ const setValueCheck = (row, field, table) => {
// do check
UIkit.modal.confirm(question, function () {
setValue(row, field, table);
});
}, {labels: { Ok: Joomla.JText._('COM_COMPONENTBUILDER_YES'), Cancel: Joomla.JText._('COM_COMPONENTBUILDER_NO') }});
};
/**
@ -327,7 +389,7 @@ const setValue = async (row, field, table) => {
body: formData
}
const response = await fetch(Url + 'setValue', options).then(response => {
const response = await fetch(UrlAjax + 'setValue', options).then(response => {
if (response.ok) {
return response.json();
}
@ -382,7 +444,7 @@ const addSelectedItem = async (value, table, row, field, line) => {
buttonUpdateItemObject.style.display = 'none';
}
}
}
};
/**
* JS Function to clear item from the editor and hide it
@ -399,7 +461,7 @@ const clearSelectedItem = async () => {
itemLineNumberObject.innerHTML = '...';
// clear update button
buttonUpdateItemObject.setAttribute('onclick', '');
}
};
/**
* JS Function to clear table items
@ -410,7 +472,7 @@ const clearTableItems = async () => {
// hide the update all items
buttonUpdateAllObject.style.display = 'none';
}
};
/**
* JS Function to clear all details of the search
@ -420,7 +482,7 @@ const clearAll = async () => {
clearTableItems();
clearSelectedItem();
searchedObject.innerHTML = '....';
}
};
/**
* JS Function to clear the search and replace values
@ -429,7 +491,54 @@ const clearSearch = async () => {
// clear the search and replace values
searchObject.value = '';
replaceObject.value = '';
}
};
/**
* JS Function to set the search and replace values
*/
const setSearch = async (search, replace = '', match = 0, whole = 0, regex = 0, mode = 1) => {
// update the type of search
if (mode == 1) {
window.location.href = UrlSearch +
'&search_value=' + search +
'&type_search=1&match_case=' + match +
'&whole_word=' + whole +
'&regex_search=' + regex;
} else if (mode == 2) {
window.location.href = UrlSearch +
'&search_value=' + search +
'&replace_value=' + replace +
'&type_search=2&match_case=' + match +
'&whole_word=' + whole +
'&regex_search=' + regex;
}
};
/**
* JS Function to check if a element has a class
*/
const hasClass = (elementObject, classNaam) => {
return !!elementObject.className.match(new RegExp('(\\s|^)' + classNaam + '(\\s|$)'));
};
/**
* JS Function add a class from an element
*/
const addClass = (elementObject, classNaam) => {
if (!hasClass(elementObject, classNaam)) {
elementObject.className += " " + classNaam;
}
};
/**
* JS Function remove a class from an element
*/
const removeClass = (elementObject, classNaam) => {
if (hasClass(elementObject, classNaam)) {
var reg = new RegExp('(\\s|^)' + classNaam + '(\\s|$)');
elementObject.className = elementObject.className.replace(reg, ' ');
}
};
/**
* JS Function to add items to the table
@ -441,7 +550,7 @@ const addTableItems = async (table, items, typeSearch) => {
} else {
buttonUpdateAllObject.style.display = 'none'; // TODO should only show once all items are loaded
}
}
};
/**
* JS Function to execute (A) on search/replace text change , (B) on search options changes

View File

@ -1302,6 +1302,7 @@ COM_COMPONENTBUILDER_ALREADY_SELECTED_TRY_ANOTHER="Already selected, try another
COM_COMPONENTBUILDER_ALREADY_TRANSLATED_INTO="Already translated into"
COM_COMPONENTBUILDER_ALWAYS_ADD="Always Add"
COM_COMPONENTBUILDER_ALWAYS_INSURE_THAT_YOU_HAVE_YOUR_LOCAL_COMPONENTS_BACKED_UP_BY_MAKING_AN_EXPORT_OF_ALL_YOUR_LOCAL_COMPONENTS_BEFORE_IMPORTING_ANY_NEW_COMPONENTS_SMALLMAKE_BSUREB_TO_MOVE_THIS_ZIPPED_BACKUP_PACKAGE_OUT_OF_THE_TMP_FOLDER_BEFORE_DOING_AN_IMPORTSMALLBR_IF_YOU_ARE_IMPORTING_A_PACKAGE_OF_A_THREERD_PARTY_JCB_PACKAGE_DEVELOPER_BMAKE_SURE_IT_IS_A_REPUTABLE_JCB_PACKAGE_DEVELOPERSB_A_SFIND_OUT_WHYA="Always insure that you have your local components backed up, by making an export of all your local components before importing any new components. <small>(Make <b>SURE</b> to move this zipped backup package out of the tmp folder before doing an import)</small><br />If you are importing a package of a 3rd party JCB package developer, <b>make sure it is a reputable JCB package developers!</b> <a %s>Find out why!</a>"
COM_COMPONENTBUILDER_AND_FINISHED_THE_SEARCH_IN="and finished the search in"
COM_COMPONENTBUILDER_ANY_LANGUAGE="Any language"
COM_COMPONENTBUILDER_ANY_SELECTION_ONLY_FOUR_LISTRADIOCHECKBOXESDYNAMIC_LIST="Any Selection (only 4 list/radio/checkboxes/dynamic_list)"
COM_COMPONENTBUILDER_AN_ERROR_HAS_OCCURRED="An error has occurred"
@ -4722,7 +4723,7 @@ COM_COMPONENTBUILDER_EMOWNEREM_BSB="<em>Owner:</em> <b>%s</b>"
COM_COMPONENTBUILDER_EMPTY_TRASH="Empty trash"
COM_COMPONENTBUILDER_EMWEBSITEEM_BSB="<em>Website:</em> <b>%s</b>"
COM_COMPONENTBUILDER_ENTER_YOUR_REPLACE_TEXT="Enter your replace text"
COM_COMPONENTBUILDER_ENTER_YOUR_SEARCH_TEXT="Enter your search text."
COM_COMPONENTBUILDER_ENTER_YOUR_SEARCH_TEXT="Enter your search text"
COM_COMPONENTBUILDER_EQUAL="Equal"
COM_COMPONENTBUILDER_EQUAL_MEANS_THAT_THE_COMMUNITY_SNIPPET_WITH_THE_SAME_NAME_LIBRARY_AND_TYPE_AND_YOUR_LOCAL_SNIPPET_WITH_THE_SAME_NAME_LIBRARY_AND_TYPE_HAS_THE_SAME_BCREATIONB_AND_BMODIFIED_DATEB="Equal means that the community snippet (with the same name, library and type) and your local snippet (with the same name, library and type) has the same <b>creation</b> and <b>modified date</b>."
COM_COMPONENTBUILDER_ERROR="Error"
@ -4795,6 +4796,7 @@ COM_COMPONENTBUILDER_FIELDS_N_ITEMS_UNPUBLISHED="%s Fields unpublished."
COM_COMPONENTBUILDER_FIELDS_N_ITEMS_UNPUBLISHED_1="%s Field unpublished."
COM_COMPONENTBUILDER_FIELDS_SUBMENU="Fields Submenu"
COM_COMPONENTBUILDER_FIELDS_SUBMENU_DESC="Allows the users in this group to submenu of field"
COM_COMPONENTBUILDER_FIELDS_THAT_HAD="fields that had"
COM_COMPONENTBUILDER_FIELDTYPE="Fieldtype"
COM_COMPONENTBUILDER_FIELDTYPES="Fieldtypes"
COM_COMPONENTBUILDER_FIELDTYPES_ACCESS="Fieldtypes Access"
@ -7753,6 +7755,7 @@ COM_COMPONENTBUILDER_LIBRARY_VERSION_LABEL="Version"
COM_COMPONENTBUILDER_LICENSE="License"
COM_COMPONENTBUILDER_LICENSE_S="License: %s"
COM_COMPONENTBUILDER_LINE="line"
COM_COMPONENTBUILDER_LINES="lines"
COM_COMPONENTBUILDER_LINK="Link"
COM_COMPONENTBUILDER_LINK_LOCAL_DYNAMIC="Link & Local (dynamic)"
COM_COMPONENTBUILDER_LINK_TO_THE_CONTRIBUTOR="Link to the contributor"
@ -8164,6 +8167,7 @@ COM_COMPONENTBUILDER_REMOVING_ALL_ZIP_PACKAGES_FROM_THE_TEMPORARY_FOLDER_OF_THE_
COM_COMPONENTBUILDER_RENAME="Rename"
COM_COMPONENTBUILDER_REPLACE="Replace"
COM_COMPONENTBUILDER_REPLACED_WITH="replaced with"
COM_COMPONENTBUILDER_REPLACE_PROCESS_COMPLETE="replace process complete"
COM_COMPONENTBUILDER_REPORT_AN_ISSUE_BSB="Report an issue: <b>%s</b>"
COM_COMPONENTBUILDER_REQUIRES_THE_VALUE_ENTERED_BE_ONE_OF_THE_OPTIONS_IN_AN_ELEMENT_OF_TYPEQUOTLISTQUOT_THAT_IS_THAT_THE_ELEMENT_IS_A_SELECT_LIST="Requires the value entered be one of the options in an element of type=&quot;list&quot;: that is, that the element is a select list."
COM_COMPONENTBUILDER_REQUIRES_THE_VALUE_TO_BE_A_TELEPHONE_NUMBER_COMPLYING_WITH_THE_STANDARDS_OF_NANPA_ITUT_TRECEONE_HUNDRED_AND_SIXTY_FOUR_OR_IETF_RFCFOUR_THOUSAND_NINE_HUNDRED_AND_THIRTY_THREE="Requires the value to be a Telephone number complying with the standards of nanpa, ITU-T T-REC-E.164 or ietf rfc4933."
@ -8180,13 +8184,13 @@ COM_COMPONENTBUILDER_SBR_YOU_CAN_ADD_A_BGITHUB_ACCESS_TOKENB_TO_COMPONENTBUILDER
COM_COMPONENTBUILDER_SEARCH="Search"
COM_COMPONENTBUILDER_SEARCHABLE="Searchable"
COM_COMPONENTBUILDER_SEARCHED_FOR="searched for"
COM_COMPONENTBUILDER_SEARCHING="searching"
COM_COMPONENTBUILDER_SEARCH_ACCESS="Search Access"
COM_COMPONENTBUILDER_SEARCH_ACCESS_DESC="Allows the users in this group to access search."
COM_COMPONENTBUILDER_SEARCH_COMPILER_BUTTON_ACCESS="Search Compiler Button Access"
COM_COMPONENTBUILDER_SEARCH_COMPILER_BUTTON_ACCESS_DESC="Allows the users in this group to access the compiler button."
COM_COMPONENTBUILDER_SEARCH_DATABASE_AGAIN="Search Database Again"
COM_COMPONENTBUILDER_SEARCH_DESC="JCB Search"
COM_COMPONENTBUILDER_SEARCH_FINISHED_IN="Search finished in"
COM_COMPONENTBUILDER_SEARCH_OR_SEARCH_AND_REPLACE="Search, or Search and Replace"
COM_COMPONENTBUILDER_SEARCH_SUBMENU="Search Submenu"
COM_COMPONENTBUILDER_SEARCH_SUBMENU_DESC="Allows the users in this group to submenu of Search"
@ -9032,6 +9036,7 @@ COM_COMPONENTBUILDER_S_WE_DETECTED_BNEW_EXTERNALCODEB_BUT_YOU_DO_NOT_HAVE_PERMIS
COM_COMPONENTBUILDER_TAB="Tab"
COM_COMPONENTBUILDER_TABLE="Table"
COM_COMPONENTBUILDER_TABLES="Tables"
COM_COMPONENTBUILDER_TABLES_WITH="tables with"
COM_COMPONENTBUILDER_TABLE_BSB_NOT_FOUND_IN_THE_LOCAL_DATABASE_SO_ITS_VALUES_COULD_NOT_BE_IMPORTED_PLEASE_UPDATE_YOUR_JCB_INSTALL_AND_TRY_AGAIN="Table <b>%s</b> not found in the local database so its values could not be imported, please update your JCB install and try again."
COM_COMPONENTBUILDER_TABLE_BSB_NOT_FOUND_IN_THE_LOCAL_DATABASE_SO_ITS_VALUES_COULD_NOT_BE_IMPORTED_THE_WHOLE_POWERS_FEATURE_IS_ONLY_AVAILABLE_TO_A_HREFSPRO_MEMBERSA_AT_THIS_TIME="Table <b>%s</b> not found in the local database so its values could not be imported. The whole powers feature is only available to <a href=%s>PRO Members</a> at this time."
COM_COMPONENTBUILDER_TARGET_BEHAVIOUR="Target Behaviour"
@ -9184,6 +9189,7 @@ COM_COMPONENTBUILDER_THE_BSB_LIBRARY_CAN_NOT_BE_DELETED_OR_THINGS_WILL_BREAK="Th
COM_COMPONENTBUILDER_THE_BSB_RETURNED_AN_INVALID_STRING="The <b>%s</b> returned an invalid string!"
COM_COMPONENTBUILDER_THE_BSHOW_IN_ALL_LIST_VIEWSB_OPTION_WILL_ADD_THIS_FIELD_TO_ALL_LIST_VIEWS_ADMIN_AMP_LINKED="The <b>Show in All List Views</b> option will Add this field to all list views, admin &amp; linked."
COM_COMPONENTBUILDER_THE_BSINGLE_FILTERB_SELECTION_OPTION_ALLOWS_THE_USER_TO_SELECT_JUST_ONE_VALUE_IN_THIS_FILTERFIELD="The <b>single filter</b> selection option allows the user to select just one value in this filter/field."
COM_COMPONENTBUILDER_THE_CHANGES_YOU_MAKE_HERE_CAN_NOT_BE_UNDONE_THEREFORE_YOU_MUST_ALWAYS_USE_THE_UPDATE_AND_REPLACE_FEATURES_WITH_GREAT_CAUTION_SEARCH_FEATURE_IS_IN_BETA_STAGE="The changes you make here can not be undone, therefore you must always use the update and replace features with great caution. Search feature is in BETA stage."
COM_COMPONENTBUILDER_THE_CODESTRING_FROM_BSB_HAS_BEEN_ADDED_FOR_THE_BFIRST_TIMEB_PLEASE_IINVESTIGATEI_TO_ENSURE_THE_CORRECT_CODESTRING_WAS_USED_BSHOULD_YOU_NOT_KNOW_ABOUT_THIS_NEW_EXTERNAL_CODESTRING_BEING_ADDED_THEN_THIS_IS_A_SERIOUS_DANGER_AND_REQUIRES_IMMEDIATE_ATTENTIONB_DO_NOT_IGNORE_THIS_WARNING_AS_IT_WILL_ONLY_SHOW_BONCEB="The code/string from <b>%s</b> has been added for the <b>first time</b>. Please <i>investigate</i> to ensure the correct code/string was used! <b>Should you not know about this NEW external code/string being added, then this is a serious danger! and requires immediate attention!</b> Do not ignore this warning as it will only show <b>once</b>."
COM_COMPONENTBUILDER_THE_CODESTRING_FROM_BSB_HAS_BEEN_BCHANGEDB_SINCE_THE_LAST_COMPILATION_PLEASE_INVESTIGATE_TO_ENSURE_THE_CHANGES_ARE_SAFE_BSHOULD_YOU_NOT_EXPECT_THIS_CHANGE_TO_THE_EXTERNAL_CODESTRING_BEING_ADDED_THEN_THIS_IS_A_SERIOUS_ISSUE_AND_REQUIRES_IMMEDIATE_ATTENTIONB_DO_NOT_IGNORE_THIS_WARNING_AS_IT_WILL_ONLY_SHOW_BONCEB="The code/string from <b>%s</b> has been <b>changed</b> since the last compilation. Please investigate to ensure the changes are safe! <b>Should you not expect this change to the external code/string being added, then this is a serious issue! and requires immediate attention!</b> Do not ignore this warning as it will only show <b>once</b>."
COM_COMPONENTBUILDER_THE_COMPONENT="The Component"
@ -9218,7 +9224,9 @@ COM_COMPONENTBUILDER_THE_PRIVATE_KEY_FIELD_COULD_NOT_BE_LOADED_FOR_BSB_SERVER="T
COM_COMPONENTBUILDER_THE_PRIVATE_KEY_FILE_COULD_NOT_BE_LOADEDFOUND_FOR_BSB_SERVER="The private key file could not be loaded/found for <b>%s</b> server!"
COM_COMPONENTBUILDER_THE_PRO_BOARD_IS_LOADING="The pro board is loading"
COM_COMPONENTBUILDER_THE_README_IS_LOADING="The readme is loading"
COM_COMPONENTBUILDER_THE_REPLACE_PROCESS_HAD_AN_ERROR_WITH_TABLE="The replace process had an error with table"
COM_COMPONENTBUILDER_THE_SEARCH_FOR_THE_SNIPPETS_ARE_CASE_SENSITIVE_SO_IF_YOU_CHANGED_THE_LOCAL_BNAMESB_OF_EITHER_OR_THE_BSNIPPET_LIBRARY_OR_SNIPPET_TYPESB_IN_ANY_SMALL_WAY_THE_SYSTEM_WILL_NOT_BE_ABLE_TO_CONNECT_YOUR_LOCAL_SNIPPETS_WITH_THOSE_IN_THE_COMMUNITY_REPOSITORY_SO_WE_STRONGLY_ADVICE_TO_BKEEP_TO_THE_COMMUNITY_NAMINGB_TO_AVOID_MISMATCHING_THAT_WILL_IN_TURN_CAUSE_DUPLICATION_SO_IF_YOU_CHANGED_ANY_NAMES_JUST_CHANGE_THEM_BACK_AND_ALL_WILL_AGAIN_WORK_AS_EXPECTED="The search for the snippets are case sensitive so if you changed the local <b>names</b> of either or the <b>snippet, library or snippet types</b> in any small way, the system will not be able to connect your local snippets with those in the community repository. So we strongly advice to <b>keep to the community naming</b> to avoid mismatching, that will in turn cause duplication. So if you changed any names, just change them back and all will again work as expected."
COM_COMPONENTBUILDER_THE_SEARCH_PROCESS_HAD_AN_ERROR_WITH_TABLE="The search process had an error with table"
COM_COMPONENTBUILDER_THE_SERVER_DETAILS_FOR_BID_SB_COULD_NOT_BE_RETRIEVED="The server details for <b>(ID: %s)</b> could not be retrieved!"
COM_COMPONENTBUILDER_THE_SNIPPETS_WERE_SUCCESSFULLY_EXPORTED="The Snippets Were Successfully Exported!"
COM_COMPONENTBUILDER_THE_SNIPPET_WAS_SUCCESSFULLY_EXPORTED="The Snippet Was Successfully Exported!"
@ -9228,7 +9236,6 @@ COM_COMPONENTBUILDER_THE_URL_S_SET_TO_RETRIEVE_THE_PACKAGES_DOES_NOT_EXIST="The
COM_COMPONENTBUILDER_THE_URL_S_SET_TO_RETRIEVE_THE_PACKAGES_DOES_NOT_RETURN_ANY_DATA="The url (%s) set to retrieve the packages does not return any data!"
COM_COMPONENTBUILDER_THE_WIKI_CAN_ONLY_BE_LOADED_WHEN_YOUR_JCB_SYSTEM_HAS_INTERNET_CONNECTION="The wiki can only be loaded when your JCB system has internet connection."
COM_COMPONENTBUILDER_THE_WIKI_IS_LOADING="The wiki is loading"
COM_COMPONENTBUILDER_THIS_AREA_IS_STILL_UNDER_DEVELOPMENT_ALTHOUGH_IT_WORKS_IT_SHOULD_BE_USED_WITH_EXTREME_CAUTION_AS_ITS_NOT_STABLE="This area is still under development, although it works, it should be used with extreme caution as its not stable."
COM_COMPONENTBUILDER_THIS_BSB_IS_NOT_LINKED_TO_ANY_OTHER_AREAS_OF_JCB_AT_THIS_TIME="This <b>%s</b> is not linked to any other areas of JCB at this time!"
COM_COMPONENTBUILDER_THIS_CAN_NOT_BE_UNDONE_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE="This can not be undone, are you sure you want to continue?"
COM_COMPONENTBUILDER_THIS_CAN_NOT_BE_UNDONE_BYOU_HAVE_BEEN_WARNEDB="This can not be undone, <b>you have been warned</b>!"
@ -9427,7 +9434,10 @@ COM_COMPONENTBUILDER_WE_SUCCESSFULLY_MOVED_BSB="We successfully moved <b>%s</b>!
COM_COMPONENTBUILDER_WHILE_WE_DOWNLOAD_ALL_TWENTY_SIX_COMPILER_GIF_ANIMATIONS_RANDOMLY_USED_IN_THE_COMPILER_GUI_DURING_COMPILATION="While we download all 26 compiler GIF animations randomly used in the compiler GUI during compilation"
COM_COMPONENTBUILDER_WHOLE_WORD="Whole Word"
COM_COMPONENTBUILDER_WIKI="Wiki"
COM_COMPONENTBUILDER_WOULD_YOU_LIKE_TO_DO_A_REVERSE_SEARCH="Would you like to do a reverse search?"
COM_COMPONENTBUILDER_WOULD_YOU_LIKE_TO_REPEAT_THE_SAME_SEARCH="Would you like to repeat the same search?"
COM_COMPONENTBUILDER_YES="Yes"
COM_COMPONENTBUILDER_YES_UPDATE_ALL="Yes! Update ALL"
COM_COMPONENTBUILDER_YOUR_ARE_ABOUT_TO_REPLACE_BALLB_SEARCH_RESULTS="Your are about to replace <b>ALL</b> search results."
COM_COMPONENTBUILDER_YOUR_ARE_ABOUT_TO_UPDATE_ROW="Your are about to update row"
COM_COMPONENTBUILDER_YOUR_DATA_IS_ENCRYPTED_WITH_A_AES_ONE_HUNDRED_AND_TWENTY_EIGHT_BIT_ENCRYPTION_USING_THE_ABOVE_THIRTY_TWO_CHARACTER_KEY="Your data is encrypted with a AES 128 bit encryption using the above 32 character key."

View File

@ -3639,10 +3639,19 @@ class ComponentbuilderModelAjax extends ListModel
if (($items = SearchFactory::_('Agent')->table($tableName)) !== null)
{
return ['success' => JText::sprintf('COM_COMPONENTBUILDER_WE_FOUND_SOME_INSTANCES_IN_S', $tableName), 'items' => $items];
return [
'success' => JText::sprintf('COM_COMPONENTBUILDER_WE_FOUND_SOME_INSTANCES_IN_S', $tableName),
'items' => $items,
'fields_count' => SearchFactory::_('Config')->field_counter,
'line_count' => SearchFactory::_('Config')->line_counter
];
}
return ['not_found' => JText::sprintf('COM_COMPONENTBUILDER_NO_INSTANCES_WHERE_FOUND_IN_S', $tableName)];
return [
'not_found' => JText::sprintf('COM_COMPONENTBUILDER_NO_INSTANCES_WHERE_FOUND_IN_S', $tableName),
'fields_count' => SearchFactory::_('Config')->field_counter,
'line_count' => SearchFactory::_('Config')->line_counter
];
}
catch(Exception $error)
{

View File

@ -17,9 +17,12 @@ JHtml::_('behavior.formvalidator');
JHtml::_('formbehavior.chosen', 'select');
JHtml::_('behavior.keepalive');
// allow main menu selection
$this->app->input->set('hidemainmenu', false);
$selectNotice = '<h3>' . JText::_('COM_COMPONENTBUILDER_HI') . ' ' . $this->user->name . '</h3>';
$selectNotice .= '<p>' . JText::_('COM_COMPONENTBUILDER_ENTER_YOUR_SEARCH_TEXT') . '</p>';
// set the basu URL
$url_base = JUri::base() . 'index.php?option=com_componentbuilder';
$url_search = $url_base . '&view=search';
?>
<?php if ($this->canDo->get('search.access')): ?>
<script type="text/javascript">
@ -36,8 +39,8 @@ $selectNotice .= '<p>' . JText::_('COM_COMPONENTBUILDER_ENTER_YOUR_SEARCH_TEXT')
</script>
<?php $urlId = (isset($this->item->id)) ? '&id='. (int) $this->item->id : ''; ?>
<div class="alert alert-danger" role="alert">
<?php echo JText::_('COM_COMPONENTBUILDER_THIS_AREA_IS_STILL_UNDER_DEVELOPMENT_ALTHOUGH_IT_WORKS_IT_SHOULD_BE_USED_WITH_EXTREME_CAUTION_AS_ITS_NOT_STABLE'); ?>
<div class="alert alert-warning" role="alert">
<?php echo JText::_('COM_COMPONENTBUILDER_THE_CHANGES_YOU_MAKE_HERE_CAN_NOT_BE_UNDONE_THEREFORE_YOU_MUST_ALWAYS_USE_THE_UPDATE_AND_REPLACE_FEATURES_WITH_GREAT_CAUTION_SEARCH_FEATURE_IS_IN_BETA_STAGE'); ?>
</div>
<hr />
<?php if(!empty( $this->sidebar)): ?>
@ -49,7 +52,7 @@ $selectNotice .= '<p>' . JText::_('COM_COMPONENTBUILDER_ENTER_YOUR_SEARCH_TEXT')
<div id="j-main-container">
<?php endif; ?>
<?php if ($this->form): ?>
<form action="<?php echo JRoute::_('index.php?option=com_componentbuilder&view=search'); ?>" method="post"
<form action="<?php echo JRoute::_($url_search); ?>" method="post"
name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
<div class="form-horizontal">
<div class="row-fluid" id="search_progress_block" style="display: none">
@ -57,6 +60,11 @@ $selectNotice .= '<p>' . JText::_('COM_COMPONENTBUILDER_ENTER_YOUR_SEARCH_TEXT')
<div id="search_progress_bar" class="uk-progress-bar" style="width: 0%;">0%</div>
</div>
</div>
<div class="row-fluid" id="replace_progress_block" style="display: none">
<div class="uk-progress uk-progress-small uk-progress-danger uk-progress-striped uk-active">
<div id="replace_progress_bar" class="uk-progress-bar" style="width: 0%;"></div>
</div>
</div>
<div class="row-fluid" id="search_details_block" style="display: none">
<span id="search_details">
<span class="search_details_title"><?php echo JText::_('COM_COMPONENTBUILDER_SEARCHED_FOR'); ?></span>:
@ -125,10 +133,18 @@ $selectNotice .= '<p>' . JText::_('COM_COMPONENTBUILDER_ENTER_YOUR_SEARCH_TEXT')
const searchTables = <?php echo json_encode($this->item['tables']); ?>;
// the search Ajax URLs
const Url = '<?php echo JUri::base(); ?>index.php?option=com_componentbuilder&format=json&raw=true&<?php echo JSession::getFormToken(); ?>=1&task=ajax.';
const UrlAjax = '<?php echo $url_base; ?>&format=json&raw=true&<?php echo JSession::getFormToken(); ?>=1&task=ajax.';
// the search URL
const UrlSearch = '<?php echo $url_search; ?>';
// make sure our controller is set
let controller = null;
let controller_replace = null;
// some counters
var fieldCount = 0;
var lineCount = 0;
// start search time keepers
var startSearchTime, endSearchTime;
@ -139,6 +155,8 @@ var editButtonSelected;
// get search progress area
const searchProgressObject = document.getElementById("search_progress_block");
const searchProgressBarObject = document.getElementById("search_progress_bar");
const replaceProgressObject = document.getElementById("replace_progress_block");
const replaceProgressBarObject = document.getElementById("replace_progress_bar");
// get search settings area
const searchSettingsObject = document.getElementById("search_settings_block");
@ -149,8 +167,12 @@ const searchedObject = document.getElementById("searched");
const replaceDetailsObject = document.getElementById("replace_details");
const replacedObject = document.getElementById("replaced");
// set the search mode object
// set the search mode objects
const modeObject = document.getElementById("type_search");
const typeSearchObject = document.getElementById("type_search0");
const typeReplaceObject = document.getElementById("type_search1");
const typeSearchLabelObject = document.querySelector('[for=type_search0]');
const typeReplaceLabelObject = document.querySelector('[for=type_search1]');
// set the search settings objects
const searchObject = document.getElementById("search_value");

View File

@ -65,9 +65,20 @@ class ComponentbuilderViewSearch extends HtmlView
JText::script('COM_COMPONENTBUILDER_YOUR_ARE_ABOUT_TO_REPLACE_BALLB_SEARCH_RESULTS');
JText::script('COM_COMPONENTBUILDER_THIS_CAN_NOT_BE_UNDONE_BYOU_HAVE_BEEN_WARNEDB');
JText::script('COM_COMPONENTBUILDER_ARE_YOU_THEREFORE_ABSOLUTELY_SURE_YOU_WANT_TO_CONTINUE');
JText::script('COM_COMPONENTBUILDER_SEARCH_FINISHED_IN');
JText::script('COM_COMPONENTBUILDER_THE_SEARCH_PROCESS_HAD_AN_ERROR_WITH_TABLE');
JText::script('COM_COMPONENTBUILDER_THE_REPLACE_PROCESS_HAD_AN_ERROR_WITH_TABLE');
JText::script('COM_COMPONENTBUILDER_REPLACE_PROCESS_COMPLETE');
JText::script('COM_COMPONENTBUILDER_SEARCHING');
JText::script('COM_COMPONENTBUILDER_TABLES_WITH');
JText::script('COM_COMPONENTBUILDER_FIELDS_THAT_HAD');
JText::script('COM_COMPONENTBUILDER_LINES');
JText::script('COM_COMPONENTBUILDER_AND_FINISHED_THE_SEARCH_IN');
JText::script('COM_COMPONENTBUILDER_SECONDS');
JText::script('COM_COMPONENTBUILDER_WOULD_YOU_LIKE_TO_DO_A_REVERSE_SEARCH');
JText::script('COM_COMPONENTBUILDER_WOULD_YOU_LIKE_TO_REPEAT_THE_SAME_SEARCH');
JText::script('COM_COMPONENTBUILDER_YES_UPDATE_ALL');
JText::script('COM_COMPONENTBUILDER_NO');
JText::script('COM_COMPONENTBUILDER_YES');
// We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal')

View File

@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="4" method="upgrade">
<name>COM_COMPONENTBUILDER</name>
<creationDate>2nd November, 2022</creationDate>
<creationDate>4th November, 2022</creationDate>
<author>Llewellyn van der Merwe</author>
<authorEmail>joomla@vdm.io</authorEmail>
<authorUrl>https://dev.vdm.io</authorUrl>
<copyright>Copyright (C) 2015 Vast Development Method. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<version>3.1.10</version>
<version>3.1.11</version>
<description><![CDATA[
<h1>Component Builder (v.3.1.10)</h1>
<h1>Component Builder (v.3.1.11)</h1>
<div style="clear: both;"></div>
<p>The Component Builder for [Joomla](https://extensions.joomla.org/extension/component-builder/) is highly advanced tool that is truly able to build extremely complex components in a fraction of the time.

View File

@ -1097,10 +1097,10 @@
<element>pkg_component_builder</element>
<type>package</type>
<client>site</client>
<version>3.1.10</version>
<version>3.1.11</version>
<infourl title="Component Builder!">https://dev.vdm.io</infourl>
<downloads>
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v3.1.10.zip</downloadurl>
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v3.1.11.zip</downloadurl>
</downloads>
<tags>
<tag>stable</tag>

View File

@ -255,7 +255,7 @@ class External implements ExternalInterface
))
{
// update the hash since it changed
$object = new stdClass();
$object = new \stdClass();
$object->target = $target_key;
$object->hash = $live_hash;
// update local hash
@ -296,7 +296,7 @@ class External implements ExternalInterface
))
{
// add the hash to track changes
$object = new stdClass();
$object = new \stdClass();
$object->target = $target_key;
$object->hash = $live_hash;
// insert local hash

View File

@ -108,6 +108,16 @@ abstract class Engine
// set end marker
$this->end = $this->config->marker_end;
}
/**
* we count every line being searched
*
* @since 3.2.0
*/
protected function lineCounter()
{
// we count every line we search
$this->config->line_counter = $this->config->line_counter + 1;
}
}

View File

@ -15,6 +15,7 @@ namespace VDM\Joomla\Componentbuilder\Search\Agent;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Componentbuilder\Search\Factory;
use VDM\Joomla\Componentbuilder\Search\Config;
use VDM\Joomla\Componentbuilder\Search\Interfaces\SearchTypeInterface as SearchEngine;
use VDM\Joomla\Componentbuilder\Search\Interfaces\SearchInterface;
@ -34,6 +35,14 @@ class Search implements SearchInterface
*/
protected array $found = [];
/**
* Search Config
*
* @var Config
* @since 3.2.0
*/
protected Config $config;
/**
* Search Engine
*
@ -45,12 +54,14 @@ class Search implements SearchInterface
/**
* Constructor
*
* @param Config|null $config The search config object.
* @param SearchEngine|null $search The search engine object.
*
* @since 3.2.0
*/
public function __construct(?SearchEngine $search = null)
public function __construct(?Config $config = null, ?SearchEngine $search = null)
{
$this->config = $config ?: Factory::_('Config');
$this->search = $search ?: Factory::_('Search');
}
@ -226,6 +237,9 @@ class Search implements SearchInterface
// line counter
$line = 1;
// we count every field we search
$this->fieldCounter();
// check if string has a new line
if (\preg_match('/\R/', $value))
{
@ -285,6 +299,16 @@ class Search implements SearchInterface
}
// we should add a call to get the item name if the table has a name field TODO
}
/**
* we count every field being searched
*
* @since 3.2.0
*/
protected function fieldCounter()
{
// we count every field we search
$this->config->field_counter = $this->config->field_counter + 1;
}
}

View File

@ -132,6 +132,28 @@ class Config extends BaseConfig
return $this->input->get('item_id', 0, 'INT');
}
/**
* get field counter
*
* @return int we start at 0
* @since 3.2.0
*/
protected function getFieldcounter(): ?int
{
return 0;
}
/**
* get line counter
*
* @return int we start at 0
* @since 3.2.0
*/
protected function getLinecounter(): ?int
{
return 0;
}
/**
* get the start marker
*

View File

@ -93,6 +93,9 @@ class Basic extends Engine implements SearchTypeInterface
*/
public function string(string $value): ?string
{
// we count every line
$this->lineCounter();
if (StringHelper::check($this->searchValue))
{
if ($this->wholeWord == 1)

View File

@ -65,6 +65,9 @@ class Regex extends Engine implements SearchTypeInterface
*/
public function string(string $value): ?string
{
// we count every line
$this->lineCounter();
if (StringHelper::check($this->searchValue) && $this->match($value))
{
return trim(preg_replace(

View File

@ -119,6 +119,7 @@ class Agent implements ServiceProviderInterface
public function getSearch(Container $container): Search
{
return new Search(
$container->get('Config'),
$container->get('Search')
);
}

View File

@ -9422,7 +9422,7 @@ class com_componentbuilderInstallerScript
echo '<a target="_blank" href="https://dev.vdm.io" title="Component Builder">
<img src="components/com_componentbuilder/assets/images/vdm-component.jpg"/>
</a>
<h3>Upgrade to Version 3.1.10 Was Successful! Let us know if anything is not working as expected.</h3>';
<h3>Upgrade to Version 3.1.11 Was Successful! Let us know if anything is not working as expected.</h3>';
// Set db if not set already.
if (!isset($db))