Tuesday, June 21, 2016

Changing the Default Date Format in Alfresco

Changing the Date Format in Alfresco

By default, Alfresco displays dates in the dd/mm/yyyy format, while most US users prefer to have dates shown in the mm/dd/yyyy format.  There are two files that must be edited to change the date format in Alfresco.

Open the following file for editing:
<alfresco home>\tomcat\webapps\share\WEB-INF\classes\alfresco\messages\common_en.properties
Look for any date format entries and edit them to swap the positions of the mm and dd values (change dd/mm/yyyy to mm/dd/yyyy, for example).  Search for mm to be sure you get them all (we found 12 values to change on a recent installation).  Note that “ddd” and “dddd” values represent the day of the week (Mon or Monday, respectively), and are probably already in the correct locations.

The second file controls the dates displayed in the date picker control, but this file may not exist in your environment.  See if the following file exists:
<alfresco home>\tomcat\shared\classes\alfresco\web-extension\site-webscripts\org\alfresco\components\form\form.get_en.properties
If it doesn’t exist, copy it from here (create the form folder if necessary):
<alfresco home>\tomcat\webapps\share\WEB-INF\classes\alfresco\site-webscripts\org\alfresco\components\form\form.get_en.properties
Open the form.get_en.properties file for editing.  Search for “form-control.date-picker” to find the proper properties to change (we found four values on a recent installation).

Restart Alfresco to make the changes take effect.

EDM Module - Changing Background Color in the Alfresco Previewer

By default, the Alfresco previewer uses a white background to display an AutoCAD drawing.

Unfortunately, this makes lighter colors very difficult to see (like yellow, which seems to be a very common color in AutoCAD).  By adding a parameter to the conversion script, we can change the way the drawing is displayed in the Alfresco previewer.

EDM Module 2.x (for Alfresco 4.x)
Edit the [ALF_HOME]/formtek/edm_module/bin/cad2pdf.sh script to make the following change:

${dwg_exename} -i=${sourcename} -o=${targetname}.png -f=png -extents=true -Q -rsz=${edm_resolution} -last -b=0

Use 0 for black, 1 for white (default), and 2 for gray.  Note that this doesn't actually change the background color of the original drawing; it only adds a solid rectangle of the desired color at the base of the previewer, and then renders the rest of the drawing on top of the colored rectangle.

EDM Module 3.x (for Alfresco 5.x)
The vector PDF format used to render AutoCAD drawings in EDM Module 3.x doesn't support a background color the way the raster PDF format does in EDM Module 2.x.  The drawing will be rendered in all of its colors on a white background.  However, a "-mono" switch can be used to render all all layer colors as black instead, which can result in a more-readable drawing.  This setting can be made inside the [ALF_HOME]/formtek/edm_module/bin/edm-cad2pdf.bat script as follows:

%dwg_exename% -i=%sourcename% -o%targetname% -f=pdf -basic -mono -axpath="%ax2011Dir%ax2011.exe"

This may end up being added as a setting in the UI inside the EDM Module at some point, but we can make the setting at the script level for now.