Changing the default instructions in Alfresco 5.1 searchbox - alfresco

I have successfully created a number of amps to customize Alfresco 5.1. The one change that aludes me, is to develop an amp to change the default text in the searchbox. The text currently is "Search files, people, sites" and I want it to say "Search Reports". I can force the change by modifiying the line in the Aikau jar which contains the "search.instructions=Search files, people, sites" but this will not hold if we upgrade to the newer version of Alfresco.instruction which is different than the search placeholder text. Let me know what version of Aikua you are using.

You can user module deployment approach for this.
Create .xml file within web-extension/site-data/extensions/share-module.xml
<extension>
<modules>
<module>
<id>AAAAA</id>
<version>1.0</version>
<auto-deploy>true</auto-deploy>
<customizations>
<customization>
<targetPackageRoot>org.alfresco.share.header</targetPackageRoot>
<sourcePackageRoot>com.menu</sourcePackageRoot>
</customization>
</customizations>
</module>
</modules>
</extension>
Create .js file within web-extension/site-webscripts/com/menu/share-header.get.js
var searchBox = widgetUtils.findObject(model.jsonModel.widgets, "id", "HEADER_SEARCH");
searchBox.config.placeholder= "search-custom.label";

Related

Installing custom template from local nupkg contains additional files

I'm successfully creating and installing a custom project template using the pretty good instructions here. The template is installed successfully, however, when I create a new project based on this template the resulting folder contains three additional things I actually don't want to have there:
_rels/.rels
[Content_Types].xml
The original nuspec file
The project template was created locally as a local NuGet package. See the flow of things in the screenshots and
Can anyone tell me how I can prevent these additional files to be part of the project that is generated from my template?
I have faced with the same problem. Found the solution with nuspec file.
the nuspec file was like
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>XYZ.Template</id>
<version>1.0.7</version>
<description>
Creates the XYZ API Template
</description>
<authors>XYZ</authors>
<packageTypes>
<packageType name="Template" />
</packageTypes>
</metadata>
<files>
<file src="**" exclude="**\bin\**\*;**\obj\**\*;**\*.user;"/>
</files>
</package>
The problem was file src expression. The ** expression will be include those files. Move your nuspec file to one folder above. Then change the following line.
<file src="api/**" exclude="**\bin\**\*;**\obj\**\*;**\*.user;"/>
You can exclude files. In your template.json:
"sources": [
{
"modifiers": [
{
"exclude": [ "[Content_Types].xml" ,"_rels/**", "Baumgarb.Demo.DemoWebApi.nuspec"]
}
]
}
]
But I would put all files that are not related to your template outside the template folder.

jboss modules system dependencies from ear/lib

I am trying to add more functionality to a product i work on( it is web application) by using jboss modules, the product is a .ear file which contains a utility.jar (this jar is inside the lib folder inside .ear file). Now I am trying to add a single class file by using jboss modules, i have created a jar which contains the new class file and i am trying to add the dependency in module.xml since this new class needs lot of files/class from utility.jar's different packages (around 15 classes are used/imported to compile this new class). Is it possible to achieve this.
I am trying to do this way since product team is the owner for deployment and they don't want to touch/modify the .ear file,hence i can't ask them to just add the new class file in the utility.jar (which works perfectly by the way).
Content of the module.xml are given below.
Error message in jboss log is
Caused by: java.lang.ClassNotFoundException: com.xyx.mdm.wkflw.eng.activities.SqActInstImpl from [Module "com.xyx.mdm:main" from local module loader #5add5415 (roots: D:\project\jboss-as-7.1.1.Final\modules)]
<module xmlns="urn:jboss:module:1.1" name="com.xyx.mdm">
<resources><resource-root path="activity.jar" />
</resources>
<dependencies>
<system export="true">
<paths>
<path name="com/xyx/mdm/wkflw/eng/activities"/>
</paths>
</system>
</dependencies>
</module>

What are the steps to creating a custom Service Mix distribution

ServiceMix's documentation on creating a custom distribution merely states the steps to creating a custom karaf distribution. I understand that Karaf is the backbone of ServiceMix and ServiceMix is a custom distribution of Karaf.
Has anyone actually built a custom esb on top of servicemix rather than on top of karaf? If so how did you do it?
How did you stage the project with servicemix's src?
Here are some steps that I wish I had when trying to figure this out...
Download the sources for the version of service mix you want to build on: https://github.com/apache/servicemix/releases
Unpack the sources zip into any folder.
Create a project with the following layout:
MyESB
pom.xml
src
main
java
Copy the contents from the pom.xml located in apache-service-mix-x.x.x-src/assembly to your pom.xml
In that pom.xml, replace the artifactId, and name to look something like this:
<parent>
<groupId>org.apache.servicemix</groupId>
<artifactId>parent</artifactId>
<version>5.4.0</version>
</parent>
<groupId>com.mycompany.esb</groupId>
<artifactId>mycustom-esb</artifactId>
<packaging>pom</packaging>
<name>Custom :: ESB</name>
Copy the resource directories of apache-service-mix-x.x.x-src/assembly/src/main to MyESB/src/main.
Make whatever customizations you want to the org.apache.karaf.tooling:features-maven-plugin or the configuratoin files in the resource directories you just copied over.
For example, If you wanted to add a particular feature you could do the following edits to your pom.xml:
Add a features.xml to add-features-to-repo configuration descriptors
Add myfeature to the add-features-to-repo features list
To have that feature started by default, add the feature to the featuresBoot property located here: MyESB\src\main\filtered-resources\etc\org.apache.karaf.features.cfg
Run the maven install target! This will build a zip file into the MyESB/target folder. Now you can unplack that and run servicemix.bat
After starting your ESB, verify that your feature is installed by entering the following command into the Karaf console:
features:list | grep myfeature
Well, just do it like servicemix itself it does. And tbh it's just the way it's described in the Karaf documentation.
For an example you might want to look here
In short define it in your custom assembly POM, take a look at the following snippet:
<plugins>
<plugin>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>karaf-maven-plugin</artifactId>
<version>${karaf.version}</version>
<executions>
<execution>
<id>add-features-to-repo</id>
<phase>compile</phase>
<goals>
<goal>features-add-to-repository</goal>
</goals>
<configuration>
<descriptors>
<descriptor>mvn:org.apache.karaf.features/standard/${karaf.version}/xml/features</descriptor>
<descriptor>mvn:org.apache.karaf.features/enterprise/${karaf.version}/xml/features</descriptor>
<descriptor>mvn:org.apache.karaf.features/spring/${karaf.version}/xml/features</descriptor>
<descriptor>mvn:org.apache.activemq/activemq-karaf/${activemq.version}/xml/features</descriptor>
<descriptor>mvn:org.apache.camel.karaf/apache-camel/${camel.version}/xml/features</descriptor>
<descriptor>mvn:org.apache.cxf.karaf/apache-cxf/${cxf.version}/xml/features</descriptor>
<descriptor>file:${basedir}/target/classes/internal.xml</descriptor>
<descriptor>file:${basedir}/target/classes/features.xml</descriptor>
<descriptor>file:${basedir}/target/classes/examples.xml</descriptor>
</descriptors>
<features>
<feature>cxf</feature>
<feature>obr</feature>
<feature>config</feature>
<feature>standard</feature>
<feature>package</feature>
<feature>kar</feature>
<feature>ssh</feature>
<feature>management</feature>
<feature>eventadmin</feature>
<feature>activemq-broker-noweb</feature>
<feature>activemq-service</feature>
<feature>camel</feature>
<feature>camel-cxf</feature>
<feature>activemq-camel</feature>
<feature>camel-blueprint</feature>
<feature>war</feature>
<feature>jaxrs-api</feature>
</features>
<includeMvnBasedDescriptors>true</includeMvnBasedDescriptors>
<repository>target/features-repo</repository>
</configuration>
<inherited>false</inherited>
</execution>
</executions>
</plugin>
If you need your own custom bundles/features make sure you
a) have a feature descriptor for your own bundles
b) define the feature descriptor
c) tell the plugin to use the corresponding feature

Choose a profile when installing a quickinstaller product (Plone 4)

I had performance problems when loading MathJax dynamically in my Plone 4 application. Thus, I found the Plone integration at https://github.com/collective/collective.mathjax and, as I noticed it does the same, forked it, which works well; I included a current MathJax 2.3 and changed the profile to use the "local" copy.
Now I wonder whether it is possible to choose between "online"/"remote" behaviour (load everything from rackcdn.com) and the "default" behaviour (use the included copy) by choosing a profile when installing the product in the Plone QuickInstaller Tool.
I changed the configure.zcml like this:
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser"
xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
i18n_domain="collective.mathjax">
<browser:resourceDirectory
name="mathjax"
directory="resources/MathJax" />
<genericsetup:registerProfile
name="default"
title="collective.mathjax: default"
directory="profiles/default"
description="collective.mathjax default profile: Includes MathJax 2.3."
provides="Products.GenericSetup.interfaces.EXTENSION" />
<genericsetup:registerProfile
name="online"
title="collective.mathjax: online"
directory="profiles/online"
description="collective.mathjax online profile: Load MathJax dynamically from rackcdn.com."
provides="Products.GenericSetup.interfaces.EXTENSION" />
</configure>
Unfortunately I can't see the "online" profile in the QuickInstaller, not even after deinstalling the product and changing the version number.
Update: In the console output, I found the following text:
INFO CMFQuickInstallerTool Multiple extension profiles found for product collective.mathjax. Used profile: collective.mathjax:default
Is there some fundamental misunderstanding, or what can I do to let people choose?
Plone Quickinstaller (both ZMI and Plone UI) will only display one profile as "installation" profile. The chosen ones will be the first found (alphabetically speaking).
To manually run a profile, go to the portal_setup tool in ZMI, then go the the "Import" tab and select your wanted profile (the provided order here is a mess... you will probably find a very long combo box). At the end of the page select "Import all steps"
It is actually possible to have multiple "alternative" profiles show up in Quickinstaller - you just need to 'trick' GenericSetup by registering each profile for its own (sub)package.
So the trick is to put the profile definitions inside different configure.zcml files that reside in different packages (directories), and making sure to include the <five:registerPackage package="."/> directive in each configure.zcml file.
While it works, I am not sure how recommendable this trick is: I found it in the dexterity.membrane package, used as an example here:
First, a 'default' profile is registered completely normally in the main configure.zcml of the dexterity.membrane package. Nothing special - but note that it includes the content subpackage:
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:five="http://namespaces.zope.org/five"
xmlns:i18n="http://namespaces.zope.org/i18n"
xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
i18n_domain="dexterity.membrane">
<!-- Include configuration for dependencies listed in setup.py -->
<includeDependencies package="." />
<!-- Grok the package to initialise schema interfaces and content classes -->
<i18n:registerTranslations directory="locales" />
<include package=".behavior" />
<include package=".content" />
<!-- Register an extension profile to make the product installable -->
<genericsetup:registerProfile
name="default"
title="dexterity.membrane: behaviors"
description="Configuration for the dexterity.membrane behaviors"
directory="profiles/default"
provides="Products.GenericSetup.interfaces.EXTENSION"
/>
<!-- Note that the example profile is registered in the content
directory. It is registered in such a way that both profiles
are visible and can be installed separately. Any upgrade steps
for that profile are also defined there. -->
<genericsetup:upgradeStep
title="Update profile"
description="Dummy step to fix profile registration after rename."
source="1000"
destination="1001"
handler="dexterity.membrane.migration.dummy_step"
profile="dexterity.membrane:default" />
<adapter name="Title" factory=".indexers.Title" />
<!-- -*- extra stuff goes here -*- -->
</configure>
Here's the configure.zcml of the said content subpackage: Nothing special either, except for the (second) registerPackage directive, and the second profile:
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:five="http://namespaces.zope.org/five"
xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
i18n_domain="dexterity.membrane">
<!-- make this show up in the quickinstaller separately -->
<five:registerPackage package="."/>
<genericsetup:registerProfile
name="example"
title="dexterity.membrane: content"
description="Configuration for the dexterity.membrane example content type"
directory="../profiles/example"
provides="Products.GenericSetup.interfaces.EXTENSION"
/>
</configure>
To make an answer from the helpful comments of Ida and Keul:
There is (unfortunately) no such thing as a choice between alternative profiles (which makes the name "profiles" slightly misleading here, IMO).
To switch between profiles, I ended in having distinct branches. The process goes like this:
Go to the product directory and switch to the desired branch, e.g. git checkout <branch name>
Restart Plone (otherwise it wouldn't notice the change, unless there was a new version number meanwhile)
re-install the product;
when all is well, update the buildout.cfg to reflect the change.

How to add additional files to adobe air installer?

I've created an AIR application, but it uses an external SWF for extra functionality. I want that SWF to be included in the install, but currently it's not. Is there anyway I can get FlexBuilder or any other tool to include this extra file in the installer? I've tried manually adding the file (as a .air file is just a zip file in disguise), but there must be hash checks inside the file.
If you place the SWF file in your application's src directory it will give you the option to include in the installer (previously I tried putting it in the application's root folder).
If you are working in Flash, go to File>Adobe AIR 2.0 Settings. At the bottom of the dialgoue box is a list of included files. Add your SWF to that list.
What if you wanted to add a text file instead to the installer using Flex Builder? I tried to add it using the export release build wizard, but I don't see the text file generated in the application directory...any ideas?
I would add a custom builder, under project -> properties -> builders
I use something like the following for one of my projects that I want to package some mxml and as files with so that the compiler doesn't try to compile them on export. Save the xml below as something like copy_files.xml and add a new Ant Builder to your project. Under the targets tab of the builder I have mine set to run the copy-files target on every clean.
<?xml version="1.0" encoding="UTF-8"?>
<project name="SampleProject">
<target name="copy-files" description="Copy Source Files">
<copy todir="bin-debug/sources">
<fileset dir="sources" >
<include name="**/*.*" />
</fileset>
</copy>
<copy todir="bin-release/sources">
<fileset dir="sources" >
<include name="**/*.*" />
</fileset>
</copy>
</target>
</project>

Resources