01-10-2014 11:35 AM
<extension>
<modules>
<module>
<id>Floating Document Preview</id>
<description>Keeps the preview visible even when scrolling</description>
<auto-deploy>true</auto-deploy>
<customizations>
<customization>
<targetPackageRoot>org.alfresco.components.preview</targetPackageRoot>
<sourcePackageRoot>com.XXX.training.components.preview.customization</sourcePackageRoot>
</customization>
</customizations>
</module>
</modules>
</extension>
<<@markup id="custom-preview-dependencies" target="js" action="after" scope="global">
<@script type="text/javascript" src="${url.context}/res/jquery/jquery-1.6.2.js" group="web-preview"/>
<@script type="text/javascript" src="${url.context}/res/components/preview/extensions/floating-preview.js" group="web-preview"/>
</@markup>
// Find the default DocumentList widget and replace it with the custom widget
for (var i = 0; i < model.widgets.length; i++) {
if (model.widgets.id == "WebPreview") {
model.widgets.name = "Training.custom.WebPreview";
}
}
// Declare Training namespace…
if (typeof Training == undefined || !Training) {
var Training = {};
}
if (!Training.custom) {
Training.custom = {};
}
(function() {
// Define constructor…
Training.custom.WebPreview = function CustomWebPreview_constructor(containerId) {
Training.custom.WebPreview.superclass.constructor.call(this, containerId);
return this;
};
// Extend default DocumentList…
YAHOO.extend(Training.custom.WebPreview, Alfresco.WebPreview,
{
onReady: function CustomWP_onReady(layer, args)
{
// Call super class method…
Training.custom.WebPreview.superclass.onReady.call(this);
// Pop-up a message…
Alfresco.util.PopupManager.displayMessage({
text: "Hello!"
});
}
});
})();
01-10-2014 12:29 PM
01-13-2014 10:26 AM
Only thing I'd change might be the use of widgetUtils in the .get.js if you're >= 4.2.e or 4.2.0 enterprise
<customizations>
<customization>
<targetPackageRoot>org.alfresco.components.preview</targetPackageRoot>
<sourcePackageRoot>com.XXX.training.components.preview.customization</sourcePackageRoot>
</customization>
///New Tag
<customization>
<targetPackageRoot>org.alfresco.components.preview.include</targetPackageRoot>
<sourcePackageRoot>com.XXX.training.components.preview.customization</sourcePackageRoot>
</customization>
</customizations>
01-13-2014 12:29 PM
01-13-2014 12:55 PM
<@region id="custom-javascript" target="web-preview" action="before" scope="template">
<@script type="text/javascript" src="${url.context}/res/jquery/jquery-1.6.2.js" group="web-preview"/>
<@script type="text/javascript" src="${url.context}/res/components/preview/extensions/floating-preview.js" group="web-preview"/>
</@>
2014-01-13 17:54:08,428 WARN [extensibility.impl.ExtensibilityModelImpl] [http-apr-8081-exec-3] The 'before' action was attempted to used when defining the base model by directive:ID: custom-javascript, ACTION:before
01-14-2014 07:13 AM
group
element within the <@script>
tag in the FreeMarker Template file. If you look at the original code the value was 'web-preview'. To fix the problem I changed this value to 'document-details'. This blog post by Dave Draper explains in further detail but a summary (and the specific details of my problem) will probably help.group
element of the <@script>
tag is used by Alfresco so that it can make one request for all files in a group.
<@script src="/aaa.js" group="1"/>
<@script src="/bbb.js" group="2"/>
<@script src="/ccc.js" group="3"/>
<@script src="/ddd.js" group="2"/>
<@script src="/eee.js" group="1"/>
<script src="/aaa.js"></script>
<script src="/eee.js"></script>
<script src="/bbb.js"></script>
<script src="/ddd.js"></script>
<script src="/ccc.js"></script>
<@templateHeader>
<@script type="text/javascript" src="${url.context}/res/modules/documentlibrary/doclib-actions.js" group="document-details"/>
<@link rel="stylesheet" type="text/css" href="${url.context}/res/components/document-details/document-details-panel.css" group="document-details"/>
<@templateHtmlEditorAssets />
</@>
group
value for the @script
tags - "document-details".group
value in my extension class to "document-details" I could ensure that these files were loaded before the component was instantiated. For completeness here is my extension file:
<@markup id="custom-javascript" target="js" action="after" scope="global">
<@script type="text/javascript" src="${url.context}/res/jquery/jquery-1.6.2.js" group="document-details"/>
<@script type="text/javascript" src="${url.context}/res/components/preview/extensions/floating-preview.js" group="document-details"/>
</@markup>
01-14-2014 04:30 AM
01-14-2014 07:16 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.