From dab9c2ef9978c75d1e445bd6b596a0f4fa917bde Mon Sep 17 00:00:00 2001 From: Angel Borroy Date: Thu, 30 Mar 2023 13:59:39 +0200 Subject: [PATCH] first commit --- .gitignore | 38 ++ LICENSE | 165 +++++++ README.md | 21 + pom.xml | 454 ++++++++++++++++++ .../log4j.properties | 1 + .../module.properties | 48 ++ .../extensions/live-search-extension.xml | 18 + .../alfresco/live/search/share-header.get.js | 9 + 8 files changed, 754 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md create mode 100644 pom.xml create mode 100644 src/main/resources/alfresco/module/share-live-search-disable/log4j.properties create mode 100644 src/main/resources/alfresco/module/share-live-search-disable/module.properties create mode 100644 src/main/resources/alfresco/web-extension/site-data/extensions/live-search-extension.xml create mode 100644 src/main/resources/alfresco/web-extension/site-webscripts/org/alfresco/live/search/share-header.get.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6dfea5b --- /dev/null +++ b/.gitignore @@ -0,0 +1,38 @@ +**.log* + +# Maven +target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties +.mvn/timing.properties +.mvn/wrapper/maven-wrapper.jar + +# Eclipse +.metadata +.project +.classpath +bin/ +tmp/ +*.tmp +.settings/ +.loadpath +.recommenders + +# IntelliJ IDEA +**.idea +**.iml + +# Visual Studio Code +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json + +# macOS +*.DS_Store \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..8805d0d --- /dev/null +++ b/LICENSE @@ -0,0 +1,165 @@ +GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/README.md b/README.md new file mode 100644 index 0000000..18b4c65 --- /dev/null +++ b/README.md @@ -0,0 +1,21 @@ +# Alfresco Share Disable Live Search feature + +This is a Share project for Alfresco SDK 4.5 (ACS 7.3) + +The [Alfresco Share Toolbar](https://docs.alfresco.com/content-services/latest/using/share/#alfresco-share-toolbar) includes a Search Box in the top right hand corner that provides suggested results after typing 2 or more characters for documents, people and sites. This featured is named **live search**. This project disables this feature, so the user needs to type the full search string and hit the button to get the results. + +## Building the project + +The project can be built using regular Maven command. + +``` +$ mvn clean package +``` + +You'll find `share-live-search-disable-1.0.0.jar` Share addon in `target` folder ready to be deployed to ACS after that. Just copy this JAR file to `tomcat/webapps/share/WEB-INF/lib` folder or apply equivalent operation in your deployment to apply the addon. + +## Share extension + +[live-search-extension.xml](src/main/resources/alfresco/web-extension/site-data/extensions/live-search-extension.xml) declares a simple extension for [org.alfresco.share-header](https://github.com/Alfresco/alfresco-community-share/tree/release/7.3.1/share/src/main/resources/alfresco/site-webscripts/org/alfresco/share/header) package. This package contains the `share-header.get.js` file that is being extended. + +[share-header.get.js](src/main/resources/alfresco/web-extension/site-webscripts/org/alfresco/custom/share-header.get.js) contains the configuration to remove people, sites and documents results from *live search* feature. \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..ed78b0d --- /dev/null +++ b/pom.xml @@ -0,0 +1,454 @@ + + + 4.0.0 + org.alfresco + share-live-search-disable + 1.0.0 + share-live-search-disable Share JAR Module + Sample Share JAR Module (to be included in the share.war) + jar + + + + 4.5.0 + + UTF-8 + + + org.alfresco + acs-community-packaging + 7.3.0 + alfresco + 17.137 + 7.3.0 + + + alfresco/alfresco-content-repository-community + alfresco/alfresco-share + + -Dencryption.keystore.type=JCEKS + -Dencryption.cipherAlgorithm=AES/CBC/PKCS5Padding + -Dencryption.keyAlgorithm=AES + -Dencryption.keystore.location=/usr/local/tomcat/shared/classes/alfresco/extension/keystore/keystore + -Dmetadata-keystore.password=mp6yc0UD9e + -Dmetadata-keystore.aliases=metadata + -Dmetadata-keystore.metadata.password=oKIWzVdEdA + -Dmetadata-keystore.metadata.algorithm=AES + + + 1.1.8 + + + 8180 + 9898 + share-live-search-disable-acs + 8080 + 5555 + + + + + + + + ${alfresco.groupId} + share + classes + + + + + + + + ${alfresco.groupId} + ${alfresco.bomDependencyArtifactId} + ${alfresco.platform.version} + pom + import + + + + ${alfresco.groupId} + share + ${alfresco.share.version} + war + provided + + + ${alfresco.groupId} + share + ${alfresco.share.version} + classes + provided + + + ${alfresco.groupId} + alfresco-web-framework-commons + ${alfresco.share.version} + classes + provided + + + + + + + + + + + + + org.apache.maven.plugins + maven-resources-plugin + 3.1.0 + + UTF-8 + + ftl + acp + svg + pdf + doc + docx + xls + xlsx + ppt + pptx + bin + lic + swf + zip + msg + jar + ttf + eot + woff + woff2 + css + ico + psd + js + + + + + copy-and-filter-docker-compose-resources + validate + + copy-resources + + + ${project.build.outputDirectory}/docker + + + docker + true + + + + + + copy-and-filter-docker-resources + validate + + copy-resources + + + ${project.build.directory} + + + src/main/docker + true + + + + + + copy-share-extension + package + + copy-resources + + + ${project.build.directory}/extensions + + + target + + ${project.build.finalName}.jar + + false + + + + + + + + + + net.alchim31.maven + yuicompressor-maven-plugin + 1.5.1 + + + + compress-assembly + + compress + + + ${project.basedir}/src/main/assembly/web + ${project.basedir}/src/main/assembly/web + + **/webscripts/** + **/site-webscripts/** + **/META-INF/** + **/*.lib.js + **/*.css + **/*-min.js + **/*-min.css + + true + false + + + + + compress-resources + + compress + + + + **/webscripts/** + **/site-webscripts/** + **/*.lib.js + **/*.css + **/*-min.js + **/*-min.css + + true + false + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + 3.1.1 + + + + collect-extensions + package + + copy-dependencies + + + ${project.build.directory}/extensions + runtime + + + + + + + + + org.zeroturnaround + jrebel-maven-plugin + ${jrebel.version} + + + generate-rebel-xml + process-resources + + generate + + + + + + + all + + + ${project.build.outputDirectory} + ${project.build.testOutputDirectory} + + + + + + true + + + + + + + + src/main/resources + true + + + + + + src/test/resources + true + + + + + + + java8 + + [1.8,11.0) + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.0 + + 1.8 + 1.8 + + + + + + + java11 + + [11.0,17) + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.0 + + 11 + + + + + + + java17 + + [17,) + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.0 + + 17 + + + + + + + + + + + alfresco-public + https://artifacts.alfresco.com/nexus/content/groups/public + + + alfresco-public-snapshots + https://artifacts.alfresco.com/nexus/content/groups/public-snapshots + + true + daily + + + + + alfresco-private-repository + https://artifacts.alfresco.com/nexus/content/groups/private + + + alfresco-internal + https://artifacts.alfresco.com/nexus/content/groups/internal + + + + + + alfresco-plugin-public + https://artifacts.alfresco.com/nexus/content/groups/public + + + alfresco-plugin-public-snapshots + https://artifacts.alfresco.com/nexus/content/groups/public-snapshots + + true + daily + + + + diff --git a/src/main/resources/alfresco/module/share-live-search-disable/log4j.properties b/src/main/resources/alfresco/module/share-live-search-disable/log4j.properties new file mode 100644 index 0000000..29523b4 --- /dev/null +++ b/src/main/resources/alfresco/module/share-live-search-disable/log4j.properties @@ -0,0 +1 @@ +# Add here module-specific custom log4j.properties configuration \ No newline at end of file diff --git a/src/main/resources/alfresco/module/share-live-search-disable/module.properties b/src/main/resources/alfresco/module/share-live-search-disable/module.properties new file mode 100644 index 0000000..158500f --- /dev/null +++ b/src/main/resources/alfresco/module/share-live-search-disable/module.properties @@ -0,0 +1,48 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + + +# SDK Sample module + +# ==== Beginning of Alfresco required/optional properties ====== # +# NB: These properties are filtered at build time by Maven, single +# sourcing from POM properties +module.id=${project.artifactId} +#module.aliases=myModule-123, my-module +module.title=${project.name} +module.description=${project.description} +module.version=${project.version} + +# The following optional properties can be used to prevent the module from being added +# to inappropriate versions of the WAR file. +# module.repo.version.min=2.0 +# module.repo.version.max=2.1 + +# FIXME: This dependencies should come out of mvn dependencies on amp + +# The following describe dependencies on other modules +# Depends on net.sf.myproject.module.SupportModuleA version ${version} or later +# module.depends.net.sf.myproject.module.SupportModuleA=${version}-* +# Depends on net.sf.myproject.module.SupportModuleA version ${version} to 2.0 +# module.depends.net.sf.myproject.module.SupportModuleB=${version}-2.0 +# Depends on net.sf.myproject.module.SupportModuleC - any version +# module.depends.net.sf.myproject.module.SupportModuleB=* + + +# ==== End of Alfresco required/optional properties ======= # + + +# ==== Beginning of module required properties/optional ====== # \ No newline at end of file diff --git a/src/main/resources/alfresco/web-extension/site-data/extensions/live-search-extension.xml b/src/main/resources/alfresco/web-extension/site-data/extensions/live-search-extension.xml new file mode 100644 index 0000000..549f952 --- /dev/null +++ b/src/main/resources/alfresco/web-extension/site-data/extensions/live-search-extension.xml @@ -0,0 +1,18 @@ + + + + Menu customisation + true + + + + org.alfresco + org.alfresco.live.search + + share-header + + + + + + \ No newline at end of file diff --git a/src/main/resources/alfresco/web-extension/site-webscripts/org/alfresco/live/search/share-header.get.js b/src/main/resources/alfresco/web-extension/site-webscripts/org/alfresco/live/search/share-header.get.js new file mode 100644 index 0000000..cf3a371 --- /dev/null +++ b/src/main/resources/alfresco/web-extension/site-webscripts/org/alfresco/live/search/share-header.get.js @@ -0,0 +1,9 @@ +// Disable live search for documents, people and sites +var headerSearch = widgetUtils.findObject(model.jsonModel, "id", "HEADER_SEARCH"); +if (headerSearch) +{ + headerSearch.config.showDocumentResults = false; + headerSearch.config.showPeopleResults = false; + headerSearch.config.showSiteResults = false; + headerSearch.config.placeholder="Search files"; +} \ No newline at end of file